tico.board
Class TBoardModel

java.lang.Object
  extended by javax.swing.undo.UndoableEditSupport
      extended by org.jgraph.graph.DefaultGraphModel
          extended by tico.board.TBoardModel
All Implemented Interfaces:
java.io.Serializable, org.jgraph.graph.GraphModel

public class TBoardModel
extends org.jgraph.graph.DefaultGraphModel

Custom model than does not allow Connections between nodes. This model do not use the Graph structure.

Version:
1.1 May 09, 2009
Author:
Pablo Muñoz
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jgraph.graph.DefaultGraphModel
org.jgraph.graph.DefaultGraphModel.EmptyIterator, org.jgraph.graph.DefaultGraphModel.GraphModelEdit, org.jgraph.graph.DefaultGraphModel.GraphModelLayerEdit
 
Constructor Summary
TBoardModel()
          Creates a new empty TBoardModel and with defaultAttributes.
TBoardModel(org.jgraph.graph.AttributeMap attributes)
          Creates a new empty TBoardModel with the specified initial attributes.
TBoardModel(java.util.List roots)
          Creates a new TBoardModel with the specified initial roots and defaultAttributes.
TBoardModel(java.util.List roots, org.jgraph.graph.AttributeMap attributes)
          Creates a new TBoardModel with the specified initial roots and attributes.
 
Method Summary
 boolean acceptsSource(java.lang.Object edge, java.lang.Object port)
          Edges are not used in this model, therefore port are not used too.
 boolean acceptsTarget(java.lang.Object edge, java.lang.Object port)
          Edges are not used in this model, therefore port are not used too.
 void deleteBoardFromAttributes(TBoard board)
          Deletes the specified board from all the model component's attributes.
 void edit(java.util.Map attributes, org.jgraph.graph.ConnectionSet cs, org.jgraph.graph.ParentMap pm, javax.swing.undo.UndoableEdit[] edits)
           
 void edit(java.lang.Object[] inserted, java.lang.Object[] removed, java.util.Map attributes, org.jgraph.graph.ConnectionSet cs, org.jgraph.graph.ParentMap pm, javax.swing.undo.UndoableEdit[] edits)
           
 void editAndRemove(java.util.Map attributes, java.lang.Object[] removed)
          Applies the attributeMaps to the components specified in attributes and removes the components in removed.
 boolean existsId(java.lang.String id)
          Determines if any model component has the specified id.
 org.jgraph.graph.AttributeMap getAttributes(java.lang.Object node)
           
 java.lang.Object getSource(java.lang.Object edge)
          Edges are not used in this model.
 java.lang.Object getTarget(java.lang.Object edge)
          Edges are not used in this model.
 void insert(java.lang.Object[] inserted, java.util.Map attributes, org.jgraph.graph.ConnectionSet cs, org.jgraph.graph.ParentMap pm, javax.swing.undo.UndoableEdit[] edits)
           
 boolean isRepeatedId(TComponent original, java.lang.String id)
          Determines if any model component different from original has the specified id.
 void remove(java.lang.Object[] removed)
          Removes cells from the model.
 void removeInsertAndEdit(java.lang.Object[] insert, java.lang.Object[] removed, java.util.Map attributes)
          Applies the attributeMaps to the components specified in attributes, removes the components in removed and inserts the components in insert.
static TBoardModel XMLDecode(org.w3c.dom.Element element)
          Returns a TBoardModel object from the data contained in the XML Element.
 org.w3c.dom.Node XMLEncode(org.w3c.dom.Document doc)
          Generates a XML Node that contains the model board information.
 
Methods inherited from class org.jgraph.graph.DefaultGraphModel
addGraphModelListener, cellsChanged, cloneCell, cloneCell, cloneCells, contains, containsEdgeBetween, edges, getAll, getAttributes, getChild, getChildCount, getConnectionSet, getDescendants, getEdges, getEdges, getEdgesBetween, getGraphModelListeners, getIncomingEdges, getIndexOfChild, getIndexOfRoot, getOpposite, getOutgoingEdges, getParent, getRootAt, getRootCount, getRoots, getRoots, getRoots, getSourceVertex, getTargetVertex, getTopmostCells, getUserObject, getValue, hasAncestorIn, isEdge, isGroup, isLeaf, isPort, order, removeGraphModelListener, setSourcePort, setTargetPort, toBack, toFront, valueForCellChanged
 
Methods inherited from class javax.swing.undo.UndoableEditSupport
addUndoableEditListener, beginUpdate, endUpdate, getUndoableEditListeners, getUpdateLevel, postEdit, removeUndoableEditListener, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jgraph.graph.GraphModel
addUndoableEditListener, removeUndoableEditListener
 

Constructor Detail

TBoardModel

public TBoardModel()
Creates a new empty TBoardModel and with defaultAttributes.


TBoardModel

public TBoardModel(java.util.List roots)
Creates a new TBoardModel with the specified initial roots and defaultAttributes.

Parameters:
roots - The specified initial roots

TBoardModel

public TBoardModel(org.jgraph.graph.AttributeMap attributes)
Creates a new empty TBoardModel with the specified initial attributes.

Parameters:
attributes - The specified initial attributes

TBoardModel

public TBoardModel(java.util.List roots,
                   org.jgraph.graph.AttributeMap attributes)
Creates a new TBoardModel with the specified initial roots and attributes.

Parameters:
roots - The specified initial roots
attributes - The specified initial attributes
Method Detail

getSource

public java.lang.Object getSource(java.lang.Object edge)
Edges are not used in this model.

Specified by:
getSource in interface org.jgraph.graph.GraphModel
Overrides:
getSource in class org.jgraph.graph.DefaultGraphModel
Returns:
null

getTarget

public java.lang.Object getTarget(java.lang.Object edge)
Edges are not used in this model.

Specified by:
getTarget in interface org.jgraph.graph.GraphModel
Overrides:
getTarget in class org.jgraph.graph.DefaultGraphModel
Returns:
null

acceptsSource

public boolean acceptsSource(java.lang.Object edge,
                             java.lang.Object port)
Edges are not used in this model, therefore port are not used too.

Specified by:
acceptsSource in interface org.jgraph.graph.GraphModel
Overrides:
acceptsSource in class org.jgraph.graph.DefaultGraphModel
Returns:
false.

acceptsTarget

public boolean acceptsTarget(java.lang.Object edge,
                             java.lang.Object port)
Edges are not used in this model, therefore port are not used too.

Specified by:
acceptsTarget in interface org.jgraph.graph.GraphModel
Overrides:
acceptsTarget in class org.jgraph.graph.DefaultGraphModel
Returns:
false.

getAttributes

public org.jgraph.graph.AttributeMap getAttributes(java.lang.Object node)
Specified by:
getAttributes in interface org.jgraph.graph.GraphModel
Overrides:
getAttributes in class org.jgraph.graph.DefaultGraphModel

insert

public void insert(java.lang.Object[] inserted,
                   java.util.Map attributes,
                   org.jgraph.graph.ConnectionSet cs,
                   org.jgraph.graph.ParentMap pm,
                   javax.swing.undo.UndoableEdit[] edits)
Specified by:
insert in interface org.jgraph.graph.GraphModel
Overrides:
insert in class org.jgraph.graph.DefaultGraphModel

edit

public void edit(java.util.Map attributes,
                 org.jgraph.graph.ConnectionSet cs,
                 org.jgraph.graph.ParentMap pm,
                 javax.swing.undo.UndoableEdit[] edits)
Specified by:
edit in interface org.jgraph.graph.GraphModel
Overrides:
edit in class org.jgraph.graph.DefaultGraphModel

remove

public void remove(java.lang.Object[] removed)
Removes cells from the model. Notifies the model- and undo listeners of the change.

Specified by:
remove in interface org.jgraph.graph.GraphModel
Overrides:
remove in class org.jgraph.graph.DefaultGraphModel

edit

public void edit(java.lang.Object[] inserted,
                 java.lang.Object[] removed,
                 java.util.Map attributes,
                 org.jgraph.graph.ConnectionSet cs,
                 org.jgraph.graph.ParentMap pm,
                 javax.swing.undo.UndoableEdit[] edits)
Overrides:
edit in class org.jgraph.graph.DefaultGraphModel

editAndRemove

public void editAndRemove(java.util.Map attributes,
                          java.lang.Object[] removed)
Applies the attributeMaps to the components specified in attributes and removes the components in removed.

Parameters:
attributes - Pairs component - attributeMap that determines wich objects will receive wich attribute map modifications
removed - The components to remove

removeInsertAndEdit

public void removeInsertAndEdit(java.lang.Object[] insert,
                                java.lang.Object[] removed,
                                java.util.Map attributes)
Applies the attributeMaps to the components specified in attributes, removes the components in removed and inserts the components in insert.

Parameters:
insert - The components to insert
removed - The components to remove
attributes - Pairs component - attributeMap that determines which objects will receive which attribute map modifications

deleteBoardFromAttributes

public void deleteBoardFromAttributes(TBoard board)
Deletes the specified board from all the model component's attributes. Is used when the board has been deleted from the boards project

Parameters:
board - The board to be deleted from model component's attributes

existsId

public boolean existsId(java.lang.String id)
Determines if any model component has the specified id.

Parameters:
id - The specified id
Returns:
true if any model component has the specified id

isRepeatedId

public boolean isRepeatedId(TComponent original,
                            java.lang.String id)
Determines if any model component different from original has the specified id.

Parameters:
original - The original component
id - The specified id
Returns:
true if any model component different from original has the specified id

XMLEncode

public org.w3c.dom.Node XMLEncode(org.w3c.dom.Document doc)
Generates a XML Node that contains the model board information.

Parameters:
doc - The Document that represents the entire XML document
Returns:
The XML Node generated

XMLDecode

public static TBoardModel XMLDecode(org.w3c.dom.Element element)
                             throws InvalidFormatException
Returns a TBoardModel object from the data contained in the XML Element.

Parameters:
element - The XML Element that contains the board data
Returns:
The generated TBoardModel
Throws:
InvalidFormatException - If Element has an invalid format