venice
Interface Visualization

All Known Implementing Classes:
ZVisualization

public interface Visualization

Visualization represents a single visualization of some data. It's used by getting an instance of a class which implemenets the Visualization interface form the VisualizationFactory. After an instance has been acquired, one can add different VModelElements to the visualization (see subclasses of VModelElement).

Note that different VModelElement subclasses (e.g. VPackage) returned by the factory methods of this interface are compatible only with the particular visualization from whose instance they have been acquired.

Visualization supports a selection listener (a VSelectionListener) which is notified when the selection in the visualization area changes.

Author:
Hannu Laurila

Field Summary
static int MODE_NONE
          a constant describing that there is no active mode
static int MODE_PAN
          a constant describing panning mode (moving the visualization area)
static int MODE_SELECT
          a constant describing a mode where things can be selected.
static int MODE_ZOOM
          a constant describing a mode where the visualization can be zoomed.
 
Method Summary
 void addVRelationship(VRelationship inRelship)
          Adds a relationship to the visualization.
 void addVRelationshipWithoutAddingOriginalReference(VRelationship inRelship)
          Add the given relationship to the visualization.
 void clear()
          Clears the visualization (drops everything from the root package).
 void enterNonInteractiveMode()
          enters non-interactive mode.
 VModelElement findElementById(java.lang.String inId)
          findElementById finds a model element stored in visualization subsystem data structures by its id.
 javax.swing.JMenu getDebugMenu()
          getDebugMenu returns a menu which can be placed to a menubar.
 VPackage getRootPackage()
          returns a reference to the root package of the visualization.
 VModelElement[] getSelection()
          returns currently selected items in the visualization
 javax.swing.JComponent getSwingComponent()
          returns a Swing component representing the visualization.
 int getToolMode()
          gets the current mode of the visualization area.
 void leaveNonInteractiveMode()
          leaves non-interactive mode.
 void loadLayout(java.io.InputStream layoutStream)
          Load layout information from a stream
 void makeDefaultLayout()
          constructs a default layout for the visualization.
 VComponent newVComponent(java.lang.String inId)
          a factory method for generating new VComponents.
 VDependency newVDependency(java.lang.String inId)
          a factory method for generating new VDependencies.
 VGeneralization newVGeneralization(java.lang.String inId)
          a factory method for generating new VGeneralizations.
 VInterface newVInterface(java.lang.String inId)
          a factory method for generating new VInterfaces.
 VPackage newVPackage(java.lang.String inId)
          a factory method for generating new VPackages.
 VRealization newVRealization(java.lang.String inId)
          a factory method for generating new VRealizations.
 void printCurrentView()
          brings up a print dialog which user can use to send currently visible view to printer.
 void removeElement(java.lang.String inId)
          removes element specified by inId from lookup structures.
 void removeVRelationship(VRelationship inRelship)
          remove a relationship from the visualization.
 void saveLayout(java.io.OutputStream layoutStream)
          Saves the layout information to an output stream.
 void setSelection(VModelElement[] inSelection)
          sets the currently selected model elements in the visualization.
 void setSelectionListener(VSelectionListener inListener)
          sets the object which receives notifications about selection changes.
 void setToolMode(int inMode)
          sets the current operating mode of the visualization area.
 void setZoomVolume(int inDx)
          sets the current speed of zooming
 void zoomTo(VModelElement inElement)
          Zooms the visualization area to a particular element. zooms the visualization area so that inElement is as big as possible but still fully visible.
 void zoomToSelection()
          Zooms to the current selection on the visualization area.
 

Field Detail

MODE_NONE

public static final int MODE_NONE
a constant describing that there is no active mode

MODE_PAN

public static final int MODE_PAN
a constant describing panning mode (moving the visualization area)

MODE_SELECT

public static final int MODE_SELECT
a constant describing a mode where things can be selected.

MODE_ZOOM

public static final int MODE_ZOOM
a constant describing a mode where the visualization can be zoomed.
Method Detail

addVRelationship

public void addVRelationship(VRelationship inRelship)
Adds a relationship to the visualization. Relationships is either a realization, a generalization or a dependency. The given VRelationship must have its source and destination set. If they are not set, the relationship will not be added. Also adds a reference of the given relationship to both its source and destination node.
Parameters:
inRelship - relationship to add to visualization.

addVRelationshipWithoutAddingOriginalReference

public void addVRelationshipWithoutAddingOriginalReference(VRelationship inRelship)
Add the given relationship to the visualization. The relationship must have its source and destination node set.
Parameters:
inRelship - relationship to add to visualization.

findElementById

public VModelElement findElementById(java.lang.String inId)
findElementById finds a model element stored in visualization subsystem data structures by its id.
Parameters:
inId - ID of the model element to find
Returns:
reference to the element if found, null otherwise

getDebugMenu

public javax.swing.JMenu getDebugMenu()
getDebugMenu returns a menu which can be placed to a menubar. Debug menu includes menu items for getting debug information regarding the visualization. The information is mainly ment for developers

getRootPackage

public VPackage getRootPackage()
returns a reference to the root package of the visualization.

getSelection

public VModelElement[] getSelection()
returns currently selected items in the visualization
Returns:
array consisting of currently selected elements

getSwingComponent

public javax.swing.JComponent getSwingComponent()
returns a Swing component representing the visualization. The swing component can then be placed on the user interface of the visualization software
Returns:
a reference to a Swing JComponent.

getToolMode

public int getToolMode()
gets the current mode of the visualization area. Constants beginning with a MODE_ describe the possible visualization area modes.

loadLayout

public void loadLayout(java.io.InputStream layoutStream)
                throws java.io.IOException
Load layout information from a stream
Parameters:
layoutStream - Layout stream which has been saved using saveLayout-method.

makeDefaultLayout

public void makeDefaultLayout()
constructs a default layout for the visualization. What is 'the default layout' depends on the particular visualization subsystem implementation used. This method should be called after all model elements loaded from the model data source have been inserted to the visualization.

removeElement

public void removeElement(java.lang.String inId)
removes element specified by inId from lookup structures. After removeElement the element can not be looked up using findElementById. Note that this does not remove the element from any VPackage if it is there.

newVComponent

public VComponent newVComponent(java.lang.String inId)
a factory method for generating new VComponents.

newVDependency

public VDependency newVDependency(java.lang.String inId)
a factory method for generating new VDependencies.

newVGeneralization

public VGeneralization newVGeneralization(java.lang.String inId)
a factory method for generating new VGeneralizations.

newVInterface

public VInterface newVInterface(java.lang.String inId)
a factory method for generating new VInterfaces.

newVPackage

public VPackage newVPackage(java.lang.String inId)
a factory method for generating new VPackages.

newVRealization

public VRealization newVRealization(java.lang.String inId)
a factory method for generating new VRealizations.

removeVRelationship

public void removeVRelationship(VRelationship inRelship)
remove a relationship from the visualization.

saveLayout

public void saveLayout(java.io.OutputStream layoutStream)
                throws java.io.IOException
Saves the layout information to an output stream. Layout is saved in a format which can be loaded using loadLayout() method.
Parameters:
layoutStream - a stream where to save to layout information

setSelection

public void setSelection(VModelElement[] inSelection)
sets the currently selected model elements in the visualization.

setSelectionListener

public void setSelectionListener(VSelectionListener inListener)
sets the object which receives notifications about selection changes. The object must implement the VSelectionListener interface. After been notified, the object can query the currently selected model elements via getSelection method.
Parameters:
inListener - a reference to a VSelectionListener which will receive notifications about changes in selection.

setToolMode

public void setToolMode(int inMode)
sets the current operating mode of the visualization area.
Parameters:
inMode - one of constants beginning with a MODE_ keyword.

setZoomVolume

public void setZoomVolume(int inDx)
sets the current speed of zooming
Parameters:
inDx - FIXME: What is this really

zoomTo

public void zoomTo(VModelElement inElement)
Zooms the visualization area to a particular element. zooms the visualization area so that inElement is as big as possible but still fully visible.
Parameters:
inElement - the model element to be zoomed on.

zoomToSelection

public void zoomToSelection()
Zooms to the current selection on the visualization area. The currently selected model elements will be visible.

clear

public void clear()
Clears the visualization (drops everything from the root package).

Note that VPackages which were in the visualization lose their childs so don't rely on getVChildren() after clearing the visualization. In general, the VModelElement instances in the visualization should not be used after the visualization has been cleared.


enterNonInteractiveMode

public void enterNonInteractiveMode()
enters non-interactive mode.

In non-interactive mode processing speed is gained by not updating the visualization area constantly.

Non-interactive mode should be entered before doing heavy tasks like setting up the initial view.

No user interaction should be allowed during non-interactive mode.


leaveNonInteractiveMode

public void leaveNonInteractiveMode()
leaves non-interactive mode.

printCurrentView

public void printCurrentView()
brings up a print dialog which user can use to send currently visible view to printer.