cz.cmc.tcgui
Class TCObjectView

java.lang.Object
  extended byorg.jgraph.graph.AbstractCellView
      extended byorg.jgraph.graph.VertexView
          extended bycz.cmc.tcgui.TCObjectView
All Implemented Interfaces:
org.jgraph.graph.CellView, Serializable
Direct Known Subclasses:
ClassView, FilterEntryView, QDiscView

public abstract class TCObjectView
extends org.jgraph.graph.VertexView

Title: TC Object View

Description: The superclass for views of TC objects

Copyright: Copyright (c) 2003

Company: CMC Computers

See Also:
Serialized Form

Nested Class Summary
static class TCObjectView.TCObjectContainerEntryPlacementContext
          Title: class TCObjectContainerEntryPlacementContext Description: structure to return TCObjectConatinerEntry container position Copyright: Copyright (c) 2003 Company: CMC Computers
static class TCObjectView.TCObjectEditor
          Editor class common to TC Object Views
 class TCObjectView.TCObjectHandle
          Title: Class TCObjectHandle Description: Basic handle for TCObjectView.
static class TCObjectView.TCObjectRenderer
           
 
Nested classes inherited from class org.jgraph.graph.VertexView
org.jgraph.graph.VertexView.SizeHandle
 
Field Summary
static int[] resizeCursors
          Array that holds the cursors for the different control points.
 
Fields inherited from class org.jgraph.graph.VertexView
bounds, groupBounds, renderer
 
Fields inherited from class org.jgraph.graph.AbstractCellView
allAttributes, attributes, cell, cellEditor, graph, childViews, mapper, parent
 
Constructor Summary
TCObjectView(Object cell, TCGraph graph, org.jgraph.graph.CellMapper mapper, boolean createIcon)
          Creates a new instance of TCObjectView.
 
Method Summary
 Rectangle computeTCObjectContainerEntryInsertionBounds(TCObjectView.TCObjectContainerEntryPlacementContext placementContext)
          Computes bounds to be displayed as insertion area of the moved TCObjectContainerEntry.
protected  void createIcon()
          Called when icon should be created and getIcon() returns null at the initialization time.
protected abstract  void createStaticRenderer()
          Called when static renderer should be lazilly created.
abstract  org.jgraph.graph.GraphCellEditor getEditor()
          Returns the editor for given component
 org.jgraph.graph.CellHandle getHandle(org.jgraph.graph.GraphContext context)
           
protected abstract  Icon getIcon()
          Returns the icon of the TCObject.
 Dimension getMaximumUsableSize()
           
 Dimension getMinimumUsableSize()
           
abstract  org.jgraph.graph.CellViewRenderer getRenderer()
           
protected  void initSizes(Map map)
          Initializes size parameters to reasonable values
 boolean isAloneInSelection()
           
abstract  void resetAutoSizeConstraints(Map map, boolean min, boolean max)
          Resets autosize constraints
 void resetAutoSizeConstraints(Map map, Dimension usable, Dimension fixed, boolean min, boolean max)
          Method providing some common code for resetting auto-size constraints.
protected abstract  void setIcon(Icon icon)
          Sets the icon of the TCObject.
protected abstract  void setInitialAttributes(Map map)
          Called when the initial attributes are needed.
 void updateTCObjectContainerEntryPlacementContext(TCObjectView.TCObjectContainerEntryPlacementContext pc, TCObjectContainer[] containers, Rectangle bounds)
          Updates the given TCObjectContainerEntry placement context
 
Methods inherited from class org.jgraph.graph.VertexView
getBounds, getCachedBounds, getCenterPoint, getPerimeterPoint, childUpdated, isConstrainedSizeEvent, setCachedBounds, update, updateGroupBounds
 
Methods inherited from class org.jgraph.graph.AbstractCellView
getAllAttributes, getAttributes, getBounds, getCell, getDescendantViews, getGraph, getChildViews, getMapper, getModel, getParentView, getRendererComponent, intersects, isLeaf, refresh, removeFromParent, scale, setAttributes, setBounds, translate, updateAllAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resizeCursors

public static final transient int[] resizeCursors
Array that holds the cursors for the different control points.

Constructor Detail

TCObjectView

public TCObjectView(Object cell,
                    TCGraph graph,
                    org.jgraph.graph.CellMapper mapper,
                    boolean createIcon)
Creates a new instance of TCObjectView.

Parameters:
cell - cell the view is created for
graph - graph the view is created for
mapper - cell mapper
createIcon - create icon if it does not exist
Method Detail

createStaticRenderer

protected abstract void createStaticRenderer()
Called when static renderer should be lazilly created. If the renderer does not exist yet, it will be created. In case that some TCObject does not use a static renderer, this should be overriden with an empty implementation.


setInitialAttributes

protected abstract void setInitialAttributes(Map map)
Called when the initial attributes are needed.

Parameters:
map - map attributes should be set to

createIcon

protected void createIcon()
Called when icon should be created and getIcon() returns null at the initialization time. This implementation searches the icon at default resources using key _icon, where the class name is lowercased.


getIcon

protected abstract Icon getIcon()
Returns the icon of the TCObject.

Returns:
icon of the TCObject or null if the view does not use an icon

setIcon

protected abstract void setIcon(Icon icon)
Sets the icon of the TCObject.

Parameters:
icon - icon to set

getRenderer

public abstract org.jgraph.graph.CellViewRenderer getRenderer()
Returns:
renderer for TCObjectView

getHandle

public org.jgraph.graph.CellHandle getHandle(org.jgraph.graph.GraphContext context)
Parameters:
context - GraphContext (cell-view) the handle is created for
Returns:
handle for given context

isAloneInSelection

public boolean isAloneInSelection()
Returns:
true if this cell view is the only one in the selection.

getEditor

public abstract org.jgraph.graph.GraphCellEditor getEditor()
Returns the editor for given component


getMinimumUsableSize

public Dimension getMinimumUsableSize()
Returns:
mimimum usable size

getMaximumUsableSize

public Dimension getMaximumUsableSize()
Returns:
mimimum usable size

resetAutoSizeConstraints

public abstract void resetAutoSizeConstraints(Map map,
                                              boolean min,
                                              boolean max)
Resets autosize constraints

Parameters:
map - map to save changes to
min - whether to reset `minimum' constraint
max - whether to reset `maximum' constraint

resetAutoSizeConstraints

public final void resetAutoSizeConstraints(Map map,
                                           Dimension usable,
                                           Dimension fixed,
                                           boolean min,
                                           boolean max)
Method providing some common code for resetting auto-size constraints. Constrains are also corrected to be consistent.

Parameters:
map - map to save changes to
usable - dimension that can be used as usable
fixed - dimension that cannot be used as usable
min - whether to reset `minimum' constraint
max - whether to reset `maximum' constraint

initSizes

protected final void initSizes(Map map)
Initializes size parameters to reasonable values


updateTCObjectContainerEntryPlacementContext

public void updateTCObjectContainerEntryPlacementContext(TCObjectView.TCObjectContainerEntryPlacementContext pc,
                                                         TCObjectContainer[] containers,
                                                         Rectangle bounds)
Updates the given TCObjectContainerEntry placement context

Parameters:
pc - TCObjectContainerEntryPlacementContext to update
containers - containers available for placement
bounds - new bounds of the placed view (this)

computeTCObjectContainerEntryInsertionBounds

public Rectangle computeTCObjectContainerEntryInsertionBounds(TCObjectView.TCObjectContainerEntryPlacementContext placementContext)
Computes bounds to be displayed as insertion area of the moved TCObjectContainerEntry.

Parameters:
placementContext - TCObjectContainerEntryPlacementContext
Returns:
bounds to be displayed or null if there is no place to insert the TCObjectContainerEntry