OME
Interface View


public interface View

This interface describes the methods that characterize a graphical state of a model. These characteristics include the positions,expandednesses, visibilities, and selections of the various objects in the model.

IMPORTANT: A view provides access for users to inspect as well as modify a model. At present the only implementing view is GraphicView. But future views could include ListView, TreeView etc.


Inner Class Summary
static class View.GraphicLocation
          A particular kind of location that has a point in 2D space associated with it.
static interface View.Location
          This is to handle the general concept of WHERE in a view a particular object may live.
 
Method Summary
 void closeView(PluginMethod method)
          Closes this view.
 ViewElement createElement(java.lang.Object type, View.Location l)
          Adds an element to the view AND the model.
 ViewLink createLink(java.lang.Object type, ModelObject from, ModelObject to)
          Creates a link in the view AND the model.
 void deleteElement(ViewElement ve)
          Deletes the element from the view AND the model, after first deleting all of it's links and children.
 void deleteLink(ViewLink vl)
          Deletes the link from the view AND the model.
 void deleteObject(ViewObject vo)
          Deletes the given object from the view and the model.
 void deleteSelectedElements()
          Deletes the selected elements, as per deleteElement.
 void deleteSelectedLinks()
          Deletes the selected links from the view AND the model.
 void deselectObject(ViewObject o)
          Deselects the given object.
 void dirtyElement(ModelElement e)
          Update (or create) the element with this model-element.
 void dirtyLink(ModelLink l)
          Update (or create) the link with this model-element A dirty element is an element that has changed since the last serialization (ie it has been newly created, modified or deleted) and thus need to be redrawn.
 java.util.Collection getAllElements()
          Returns the ViewElements within this view.
 java.util.Collection getAllLinks()
          Returns the ViewLinks within this view.
 View.Location getDefaultLocation(ModelObject newobject)
          Returns a Location that is reasonable for a the placement of a new element.
 java.util.Collection getExpandedElements()
          Returns the expanded elements.
 java.util.Collection getHighlightedObjects()
          Returns the ViewObjects that are highlighted
 int getID()
          Returns the unique (within the model) integer Id for the view.
 java.awt.Image getImage(java.lang.Object type)
          Returns the image that is associated with the given object (for this View).
 ImageTable getImageTable()
          Returns an ImageTable that can be used to scale, rotate, and scribble on images.
 OMEModel getModel()
          Returns the model for this view.
 java.lang.String getName()
          Returns the name of this view.
 java.util.Collection getSaveFileAndDirectory()
          Displays up a save dialogue and returns a collection whose first member is the file name and whose second member is the directory name (both of which are Strings).
 java.lang.String getSavePathname()
          Returns the absolute path where view (and thus model) should be saved.
 java.util.Collection getSelectedElements()
          Returns the selected elements.
 java.util.Collection getSelectedLinks()
          Returns the selected links.
 java.util.Collection getVisibleElements()
          Returns the visible elements.
 java.util.Collection getVisibleLinks()
          Returns visible links.
 void load(OME.ViewSerializer vs)
          Recover said important stuff from the serializer.
 void promptContract(ViewElement e)
           
 void promptExpand(ViewElement e)
           
 void promptRename(ViewObject o)
          Prompt the user to rename the given ViewObject in a View specific way.
 void promptResize(ViewObject o)
           
 void promptStraighten(ViewObject o)
          Prompt the user to resize the given ViewObject in a View specific way.
 void resize(ViewObject o, java.lang.Double d)
           
 void save(OME.ViewSerializer vs)
          Save the important stuff to the serializer.
 void selectObject(ViewObject o)
          Selects the given object.
 void setContract(boolean b)
           
 void setExpand(boolean b)
           
 void setID(int id)
          Sets the unique identifier (within this model) for this view.
 void setName(java.lang.String n)
          Sets the name of this view.
 void setStraighten(boolean b)
           
 void showDialog(javax.swing.JDialog jd)
          Displays the given JDialog to the user.
 void updateView()
          Announce to this view that it has become "dirty", and needs to be updated.
 

Method Detail

getDefaultLocation

public View.Location getDefaultLocation(ModelObject newobject)
Returns a Location that is reasonable for a the placement of a new element.
Parameters:
newobject - the object whose default location we want.

setName

public void setName(java.lang.String n)
Sets the name of this view.

getName

public java.lang.String getName()
Returns the name of this view. Views of a model should have unique names.

getModel

public OMEModel getModel()
Returns the model for this view.

getID

public int getID()
Returns the unique (within the model) integer Id for the view. This helps with serialization, preventing name mangling, and the special-character hazards that entails.

setID

public void setID(int id)
Sets the unique identifier (within this model) for this view.
Parameters:
id - the identifier to be set for this view.

getAllElements

public java.util.Collection getAllElements()
Returns the ViewElements within this view.

getAllLinks

public java.util.Collection getAllLinks()
Returns the ViewLinks within this view.

getHighlightedObjects

public java.util.Collection getHighlightedObjects()
Returns the ViewObjects that are highlighted

getSelectedElements

public java.util.Collection getSelectedElements()
Returns the selected elements.

getSelectedLinks

public java.util.Collection getSelectedLinks()
Returns the selected links.

getExpandedElements

public java.util.Collection getExpandedElements()
Returns the expanded elements.

getVisibleElements

public java.util.Collection getVisibleElements()
Returns the visible elements. This will omit elements that are hidden as well as elements that are not within the visible area of the view, eg: the visible rectangle for graph-views, or the number of lines in a tree-list view.

getVisibleLinks

public java.util.Collection getVisibleLinks()
Returns visible links. This will omit links that are hidden as well as links that are not within the visible area of the view, eg: the visible rectangle for graph-views, or the number of lines in a tree-list view.

getImage

public java.awt.Image getImage(java.lang.Object type)
Returns the image that is associated with the given object (for this View).

promptRename

public void promptRename(ViewObject o)
Prompt the user to rename the given ViewObject in a View specific way. These could certainly be done in a more general way.
Parameters:
o - the ViewObject we wish to rename.

promptStraighten

public void promptStraighten(ViewObject o)
Prompt the user to resize the given ViewObject in a View specific way. These could certainly be done in a more general way.
Parameters:
o - the ViewObject we wish to resize.

setStraighten

public void setStraighten(boolean b)

promptExpand

public void promptExpand(ViewElement e)

promptContract

public void promptContract(ViewElement e)

setExpand

public void setExpand(boolean b)

setContract

public void setContract(boolean b)

promptResize

public void promptResize(ViewObject o)

resize

public void resize(ViewObject o,
                   java.lang.Double d)

selectObject

public void selectObject(ViewObject o)
Selects the given object.
Parameters:
o - the ViewObject we wish to select

deselectObject

public void deselectObject(ViewObject o)
Deselects the given object.
Parameters:
the - ViewObject we wish to deselect

createElement

public ViewElement createElement(java.lang.Object type,
                                 View.Location l)
                          throws java.lang.Exception
Adds an element to the view AND the model.
Parameters:
type - the type of object to be added.
location - the location at which the object should be added.

deleteElement

public void deleteElement(ViewElement ve)
Deletes the element from the view AND the model, after first deleting all of it's links and children.
Parameters:
ve - the ViewElement to be deleted.

deleteSelectedElements

public void deleteSelectedElements()
Deletes the selected elements, as per deleteElement.

createLink

public ViewLink createLink(java.lang.Object type,
                           ModelObject from,
                           ModelObject to)
Creates a link in the view AND the model.
Parameters:
type - the type of link to be created.
from - the ModelObject that is the source of the created link
to - the ModelObject that is the destination of the created link

deleteLink

public void deleteLink(ViewLink vl)
Deletes the link from the view AND the model.
Parameters:
vl - the ViewLink to be deleted.

deleteSelectedLinks

public void deleteSelectedLinks()
Deletes the selected links from the view AND the model.

deleteObject

public void deleteObject(ViewObject vo)
Deletes the given object from the view and the model.
Parameters:
vo - the ViewObject to be deleted.

dirtyElement

public void dirtyElement(ModelElement e)
Update (or create) the element with this model-element. A dirty element is an element that has changed since the last serialization (ie it has been newly created, modified or deleted) and thus need to be redrawn.
Parameters:
e - the ModelElement that is to be marked as dirty.

dirtyLink

public void dirtyLink(ModelLink l)
Update (or create) the link with this model-element A dirty element is an element that has changed since the last serialization (ie it has been newly created, modified or deleted) and thus need to be redrawn.
Parameters:
l - the ModelLink that is to be marked as dirty.

getSavePathname

public java.lang.String getSavePathname()
Returns the absolute path where view (and thus model) should be saved.

getSaveFileAndDirectory

public java.util.Collection getSaveFileAndDirectory()
Displays up a save dialogue and returns a collection whose first member is the file name and whose second member is the directory name (both of which are Strings). Returns a null vector if no file was supplied by the user.

save

public void save(OME.ViewSerializer vs)
Save the important stuff to the serializer.
Parameters:
vs - the ViewSerializer where we wish to save to.

load

public void load(OME.ViewSerializer vs)
Recover said important stuff from the serializer.
Parameters:
vs - the ViewSerializer where we wish to load from.

updateView

public void updateView()
Announce to this view that it has become "dirty", and needs to be updated. Typically this happens when the state of the model (or the visibilities of the model) has changed.

showDialog

public void showDialog(javax.swing.JDialog jd)
Displays the given JDialog to the user.
Parameters:
jd - the JDialog to be displayed.

getImageTable

public ImageTable getImageTable()
Returns an ImageTable that can be used to scale, rotate, and scribble on images.

closeView

public void closeView(PluginMethod method)
Closes this view. The view will take care of saving and then closing the frame.
Parameters:
method - I believe this can any Plugin Method that may aid in saving the view (This comment should be updated!!!)