Class SDWidget
java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.eclipse.tracecompass.tmf.ui.views.uml2sd.ScrollView
org.eclipse.tracecompass.tmf.ui.views.uml2sd.SDWidget
- All Implemented Interfaces:
EventListener,org.eclipse.jface.util.IPropertyChangeListener,org.eclipse.swt.events.DisposeListener,org.eclipse.swt.events.SelectionListener,org.eclipse.swt.graphics.Drawable,ITimeCompressionListener
public class SDWidget
extends ScrollView
implements org.eclipse.swt.events.SelectionListener, org.eclipse.jface.util.IPropertyChangeListener, org.eclipse.swt.events.DisposeListener, ITimeCompressionListener
This class implements sequence diagram widget used in the sequence diagram view.
- Version:
- 1.0
- Author:
- sveyrier
-
Field Summary
Fields inherited from class org.eclipse.tracecompass.tmf.ui.views.uml2sd.ScrollView
ALWAYS_OFF, ALWAYS_ON, AUTO, HBAR, VBARFields inherited from class org.eclipse.swt.widgets.Control
handleFields inherited from class org.eclipse.swt.widgets.Widget
nativeZoom -
Constructor Summary
ConstructorsConstructorDescriptionSDWidget(org.eclipse.swt.widgets.Composite c, int s) Constructor for SDWidget. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSelection(List<GraphNode> list) Adds a list of node to the selected nodes list.voidaddSelection(GraphNode node) Adds a graph node to the selected nodes list.voidClear the list of GraphNodes which must be drawn selected.intcontentsToViewX(int x) Transform X axis coordinates from contents to widgets.intcontentsToViewY(int y) Transform Y axis coordinates from contents to widgets.voiddeltaSelected(Lifeline lifeline, int startEvent, int nbEvent, IColor color) Notifies listeners about a selected delta.voidensureVisible(GraphNode node) Moves the Sequence diagram to ensure the given node is visibleintAccess method for the contentsX property.intAccess method for the contentsY property.Returns the current graph node.Returns the graph node focused on.getFrame()Returns the current Frame (the sequence diagram container)Return the lifelines reorder sequence (using Drag and Drop) if the the reorder mode is turn on.Returns the GraphNode overView the mouse if anyorg.eclipse.swt.graphics.ImagegetOverview(org.eclipse.swt.graphics.Rectangle rect) Gets the overview image.org.eclipse.swt.printing.PrinterReturns teh printer reference.Returns a list of selected graph nodes.org.eclipse.jface.viewers.ISelectionProviderReturns the selection provider for the current sequence diagramintReturn the visible height of scroll view, might be > contentsHeightintReturn int the visible width of scroll view, might be > contentsWidth().floatReturns the current zoom factor.booleanGets the zoom in mode.booleanGets the zoom out mode.floatReturns the current zoom value.booleanReturns if ctrl selectionbooleanbooleanReturns whether the widget is used for printing or not.booleanReturns if shift selectionvoidMoves the Sequence diagram to ensure the given node is visible and draw it selectedvoidprint()Method to print.voidprintPage(int i, int j, SDPrintDialogUI pd, NGC context, int pageNum) Method to print page ranges.voidprintPage(int pageNum, SDPrintDialogUI pd, NGC context) Method to print a page.voidprintUI(SDPrintDialogUI sdPrintDialog) Method to print UI.voidpropertyChange(org.eclipse.jface.util.PropertyChangeEvent e) Called when property changed occurs in the preference page.voidremoveSelection(List<GraphNode> list) Removes a list of graph nodes from the selected nodes list.voidremoveSelection(GraphNode node) Removes a node from the selected nodes list.voidResets the zoom factor.voidresizeContents(Frame frame) Resize the contents to insure the frame fit into the viewbooleansetContentsPos(int x, int y) Change top left position of visible area.voidSets the focus on given graph node (current node).voidThe frame to render (the sequence diagram)voidsetReorderMode(boolean mode) Enable or disable the lifeline reodering using Drag and DropvoidsetSite(org.eclipse.ui.part.ViewPart viewSite) Sets view part.voidSets the time compression bar.voidsetZoomInMode(boolean value) Sets the zoom in mode.voidsetZoomOutMode(boolean value) Sets the zoom out mode.voidsetZoomValue(float zoomValue) Sets the current zoom value.voidMethod to traverse down.voidMethod to traverse to the end.voidMethod to traverse home.voidMethod to traverse left.voidMethod to traverse right.voidMethod to traverse up.voidwidgetDefaultSelected(org.eclipse.swt.events.SelectionEvent event) voidwidgetDisposed(org.eclipse.swt.events.DisposeEvent e) voidwidgetSelected(org.eclipse.swt.events.SelectionEvent event) Methods inherited from class org.eclipse.tracecompass.tmf.ui.views.uml2sd.ScrollView
computeBarVisibility, computeTrim, contentsToView, ensureVisible, ensureVisible, getClientArea, getContentsHeight, getContentsWidth, getDragAutoScrollPeriod, getHorizontalBar, getHorizontalBarHeight, getHScrollBarIncrement, getHScrollBarMode, getOverviewSize, getVerticalBar, getVerticalBarWidth, getViewControl, getVisiblePart, getVisiblePart, getVScrollBarIncrement, getVScrollBarMode, isDragAutoScroll, isOverviewEnabled, isVisible, isVisible, redraw, replaceControlListener, replaceKeyListener, replaceMouseListener, replaceMouseMoveListener, replacePaintListener, resizeContents, scrollBy, setBackground, setCornerControl, setCursor, setDragAutoScroll, setDragAutoScrollPeriod, setFocus, setHScrollBarIncrement, setHScrollBarMode, setOverviewEnabled, setOverviewSize, setToolTipText, setVScrollBarIncrement, setVScrollBarMode, viewToContents, viewToContentsX, viewToContentsYMethods inherited from class org.eclipse.swt.widgets.Composite
changed, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setLayout, setLayoutDeferred, setTabList, toStringMethods inherited from class org.eclipse.swt.widgets.Scrollable
getScrollbarsMode, setScrollbarsModeMethods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackgroundImage, setBounds, setBounds, setCapture, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, updateMethods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, dispose, getData, getData, getDisplay, getListeners, getStyle, getTypedListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, reskin, setData, setDataMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.swt.graphics.Drawable
isAutoScalable
-
Constructor Details
-
SDWidget
public SDWidget(org.eclipse.swt.widgets.Composite c, int s) Constructor for SDWidget.- Parameters:
c- The parent composites- The style
-
-
Method Details
-
setTimeBar
Sets the time compression bar.- Parameters:
bar- The time compression bar to set
-
resizeContents
Resize the contents to insure the frame fit into the view- Parameters:
frame- the frame which will be drawn in the view
-
setFrame
The frame to render (the sequence diagram)- Parameters:
theFrame- the frame to displayresetPosition- boolean
-
getFrame
Returns the current Frame (the sequence diagram container)- Returns:
- the frame
-
getSelectionProvider
public org.eclipse.jface.viewers.ISelectionProvider getSelectionProvider()Returns the selection provider for the current sequence diagram- Returns:
- the selection provider
-
getSelection
Returns a list of selected graph nodes.- Returns:
- a list of selected graph nodes.
-
addSelection
Adds a graph node to the selected nodes list.- Parameters:
node- A graph node
-
addSelection
Adds a list of node to the selected nodes list.- Parameters:
list- of graph nodes
-
removeSelection
Removes a node from the selected nodes list.- Parameters:
node- to remove
-
removeSelection
Removes a list of graph nodes from the selected nodes list.- Parameters:
list- of nodes to remove.
-
clearSelection
public void clearSelection()Clear the list of GraphNodes which must be drawn selected. -
setSite
public void setSite(org.eclipse.ui.part.ViewPart viewSite) Sets view part.- Parameters:
viewSite- The view part to set
-
getMouseOverNode
Returns the GraphNode overView the mouse if any- Returns:
- the current graph node
-
setZoomInMode
public void setZoomInMode(boolean value) Sets the zoom in mode.- Parameters:
value- The mode value to set.
-
setZoomOutMode
public void setZoomOutMode(boolean value) Sets the zoom out mode.- Parameters:
value- The mode value to set.
-
setZoomValue
public void setZoomValue(float zoomValue) Sets the current zoom value.- Parameters:
zoomValue- The current zoom value
-
moveTo
Moves the Sequence diagram to ensure the given node is visible and draw it selected- Parameters:
node- the GraphNode to move to
-
ensureVisible
Moves the Sequence diagram to ensure the given node is visible- Parameters:
node- the GraphNode to move to
-
getZoomFactor
public float getZoomFactor()Returns the current zoom factor.- Returns:
- the current zoom factor.
-
getPrinter
public org.eclipse.swt.printing.Printer getPrinter()Returns teh printer reference.- Returns:
- the printer reference
-
isPrinting
public boolean isPrinting()Returns whether the widget is used for printing or not.- Returns:
- whether the widget is used for printing or not
-
getCurrentGraphNode
Returns the current graph node.- Returns:
- the current graph node
-
getZoomValue
public float getZoomValue()Returns the current zoom value.- Returns:
- the current zoom value
-
getZoomInMode
public boolean getZoomInMode()Gets the zoom in mode.- Returns:
- the mode value to set.
-
getZoomOutMode
public boolean getZoomOutMode()Gets the zoom out mode.- Returns:
- the mode value to set.
-
isCtrlSelection
public boolean isCtrlSelection()Returns if ctrl selection- Returns:
- true if ctrl selection else false
-
isShiftSelection
public boolean isShiftSelection()Returns if shift selection- Returns:
- true if shift Selection else false
-
getOverview
public org.eclipse.swt.graphics.Image getOverview(org.eclipse.swt.graphics.Rectangle rect) Gets the overview image.- Parameters:
rect- Rectangle to include overview.- Returns:
- the overview image
-
resetZoomFactor
public void resetZoomFactor()Resets the zoom factor. -
setReorderMode
public void setReorderMode(boolean mode) Enable or disable the lifeline reodering using Drag and Drop- Parameters:
mode- - true to enable false otherwise
-
getLifelineReoderList
Return the lifelines reorder sequence (using Drag and Drop) if the the reorder mode is turn on. Each ArryList element is of type Lifeline[2] with Lifeline[0] inserted before Lifeline[1] in the diagram- Returns:
- - the re-odered sequence
-
setFocus
Sets the focus on given graph node (current node).- Parameters:
node- The graph node to focus on.
-
getFocusNode
Returns the graph node focused on.- Returns:
- the current graph node
-
traverseRight
public void traverseRight()Method to traverse right. -
traverseLeft
public void traverseLeft()Method to traverse left. -
traverseUp
public void traverseUp()Method to traverse up. -
traverseDown
public void traverseDown()Method to traverse down. -
traverseHome
public void traverseHome()Method to traverse home. -
traverseEnd
public void traverseEnd()Method to traverse to the end. -
printUI
Method to print UI.- Parameters:
sdPrintDialog- the sequence diagram printer dialog.
-
print
public void print()Method to print. -
printPage
Method to print a page.- Parameters:
pageNum- The page numberpd- The sequence diagram print dialogcontext- The graphical context
-
printPage
Method to print page ranges.- Parameters:
i- The start pagej- The end pagepd- The sequence diagram print dialogcontext- The graphical contextpageNum- The current page
-
isFocusControl
public boolean isFocusControl()- Overrides:
isFocusControlin classorg.eclipse.swt.widgets.Control
-
setContentsPos
public boolean setContentsPos(int x, int y) Description copied from class:ScrollViewChange top left position of visible area. Check if the given point is inside contents area.- Overrides:
setContentsPosin classScrollView- Parameters:
x- x contents coordinates of visible area.y- y contents coordinates of visible area.- Returns:
- true if view really moves
-
widgetDefaultSelected
public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent event) - Specified by:
widgetDefaultSelectedin interfaceorg.eclipse.swt.events.SelectionListener
-
widgetSelected
public void widgetSelected(org.eclipse.swt.events.SelectionEvent event) - Specified by:
widgetSelectedin interfaceorg.eclipse.swt.events.SelectionListener
-
propertyChange
public void propertyChange(org.eclipse.jface.util.PropertyChangeEvent e) Called when property changed occurs in the preference page. "PREFOK" is fired when the user press the ok or apply button- Specified by:
propertyChangein interfaceorg.eclipse.jface.util.IPropertyChangeListener
-
widgetDisposed
public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e) - Specified by:
widgetDisposedin interfaceorg.eclipse.swt.events.DisposeListener
-
deltaSelected
Description copied from interface:ITimeCompressionListenerNotifies listeners about a selected delta.- Specified by:
deltaSelectedin interfaceITimeCompressionListener- Parameters:
lifeline- The current lifeline.startEvent- The start event selected.nbEvent- A number of events.color- The current color to use.
-
getVisibleWidth
public int getVisibleWidth()Description copied from class:ScrollViewReturn int the visible width of scroll view, might be > contentsWidth().- Overrides:
getVisibleWidthin classScrollView- Returns:
- int the visible width of scroll view, might be > contentsWidth()
-
getVisibleHeight
public int getVisibleHeight()Description copied from class:ScrollViewReturn the visible height of scroll view, might be > contentsHeight- Overrides:
getVisibleHeightin classScrollView- Returns:
- the visible height of scroll view, might be > contentsHeight()
-
contentsToViewX
public int contentsToViewX(int x) Description copied from class:ScrollViewTransform X axis coordinates from contents to widgets.- Overrides:
contentsToViewXin classScrollView- Parameters:
x- contents coordinate to transform.- Returns:
- x coordinate in widget area
-
contentsToViewY
public int contentsToViewY(int y) Description copied from class:ScrollViewTransform Y axis coordinates from contents to widgets.- Overrides:
contentsToViewYin classScrollView- Parameters:
y- contents coordinate to transform- Returns:
- y coordinate in widget area
-
getContentsX
public int getContentsX()Description copied from class:ScrollViewAccess method for the contentsX property.- Overrides:
getContentsXin classScrollView- Returns:
- the current value of the contentsX property
-
getContentsY
public int getContentsY()Description copied from class:ScrollViewAccess method for the contentsY property.- Overrides:
getContentsYin classScrollView- Returns:
- the current value of the contentsY property
-