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
  • Constructor Details

    • SDWidget

      public SDWidget(org.eclipse.swt.widgets.Composite c, int s)
      Constructor for SDWidget.
      Parameters:
      c - The parent composite
      s - The style
  • Method Details

    • setTimeBar

      public void setTimeBar(TimeCompressionBar bar)
      Sets the time compression bar.
      Parameters:
      bar - The time compression bar to set
    • resizeContents

      public void resizeContents(Frame frame)
      Resize the contents to insure the frame fit into the view
      Parameters:
      frame - the frame which will be drawn in the view
    • setFrame

      public void setFrame(Frame theFrame, boolean resetPosition)
      The frame to render (the sequence diagram)
      Parameters:
      theFrame - the frame to display
      resetPosition - boolean
    • getFrame

      public Frame 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

      public List<GraphNode> getSelection()
      Returns a list of selected graph nodes.
      Returns:
      a list of selected graph nodes.
    • addSelection

      public void addSelection(GraphNode node)
      Adds a graph node to the selected nodes list.
      Parameters:
      node - A graph node
    • addSelection

      public void addSelection(List<GraphNode> list)
      Adds a list of node to the selected nodes list.
      Parameters:
      list - of graph nodes
    • removeSelection

      public void removeSelection(GraphNode node)
      Removes a node from the selected nodes list.
      Parameters:
      node - to remove
    • removeSelection

      public void removeSelection(List<GraphNode> list)
      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

      public GraphNode 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

      public void moveTo(GraphNode node)
      Moves the Sequence diagram to ensure the given node is visible and draw it selected
      Parameters:
      node - the GraphNode to move to
    • ensureVisible

      public void ensureVisible(GraphNode node)
      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

      public GraphNode 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

      public List<Lifeline[]> 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

      public void setFocus(GraphNode node)
      Sets the focus on given graph node (current node).
      Parameters:
      node - The graph node to focus on.
    • getFocusNode

      public GraphNode 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

      public void printUI(SDPrintDialogUI sdPrintDialog)
      Method to print UI.
      Parameters:
      sdPrintDialog - the sequence diagram printer dialog.
    • print

      public void print()
      Method to print.
    • printPage

      public void printPage(int pageNum, SDPrintDialogUI pd, NGC context)
      Method to print a page.
      Parameters:
      pageNum - The page number
      pd - The sequence diagram print dialog
      context - The graphical context
    • printPage

      public void printPage(int i, int j, SDPrintDialogUI pd, NGC context, int pageNum)
      Method to print page ranges.
      Parameters:
      i - The start page
      j - The end page
      pd - The sequence diagram print dialog
      context - The graphical context
      pageNum - The current page
    • isFocusControl

      public boolean isFocusControl()
      Overrides:
      isFocusControl in class org.eclipse.swt.widgets.Control
    • setContentsPos

      public boolean setContentsPos(int x, int y)
      Description copied from class: ScrollView
      Change top left position of visible area. Check if the given point is inside contents area.
      Overrides:
      setContentsPos in class ScrollView
      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:
      widgetDefaultSelected in interface org.eclipse.swt.events.SelectionListener
    • widgetSelected

      public void widgetSelected(org.eclipse.swt.events.SelectionEvent event)
      Specified by:
      widgetSelected in interface org.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:
      propertyChange in interface org.eclipse.jface.util.IPropertyChangeListener
    • widgetDisposed

      public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e)
      Specified by:
      widgetDisposed in interface org.eclipse.swt.events.DisposeListener
    • deltaSelected

      public void deltaSelected(Lifeline lifeline, int startEvent, int nbEvent, IColor color)
      Description copied from interface: ITimeCompressionListener
      Notifies listeners about a selected delta.
      Specified by:
      deltaSelected in interface ITimeCompressionListener
      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: ScrollView
      Return int the visible width of scroll view, might be > contentsWidth().
      Overrides:
      getVisibleWidth in class ScrollView
      Returns:
      int the visible width of scroll view, might be > contentsWidth()
    • getVisibleHeight

      public int getVisibleHeight()
      Description copied from class: ScrollView
      Return the visible height of scroll view, might be > contentsHeight
      Overrides:
      getVisibleHeight in class ScrollView
      Returns:
      the visible height of scroll view, might be > contentsHeight()
    • contentsToViewX

      public int contentsToViewX(int x)
      Description copied from class: ScrollView
      Transform X axis coordinates from contents to widgets.
      Overrides:
      contentsToViewX in class ScrollView
      Parameters:
      x - contents coordinate to transform.
      Returns:
      x coordinate in widget area
    • contentsToViewY

      public int contentsToViewY(int y)
      Description copied from class: ScrollView
      Transform Y axis coordinates from contents to widgets.
      Overrides:
      contentsToViewY in class ScrollView
      Parameters:
      y - contents coordinate to transform
      Returns:
      y coordinate in widget area
    • getContentsX

      public int getContentsX()
      Description copied from class: ScrollView
      Access method for the contentsX property.
      Overrides:
      getContentsX in class ScrollView
      Returns:
      the current value of the contentsX property
    • getContentsY

      public int getContentsY()
      Description copied from class: ScrollView
      Access method for the contentsY property.
      Overrides:
      getContentsY in class ScrollView
      Returns:
      the current value of the contentsY property