easik.sketch
Class Sketch

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by org.jgraph.JGraph
                  extended by easik.sketch.Sketch
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.Scrollable

public class Sketch
extends org.jgraph.JGraph

A Sketch represents an EA Sketch diagram used to represent a database, this object also extends the JGraph swing component, allowing it to be added directly to the application's GUI. When done with the current sketch, instead of creating a new one, the sketch should simply be reinitialised, and it will become ready. Since a sketch is also a Swing component it can get hairy creating a new one and changing all the references. This might have become easier since the singletons were introduced, so feel free to try to change that.

Version:
2006-08-02 Kevin Green
Author:
Rob Fletcher 2005, Kevin Green 2006, Vera Ranieri 2006
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jgraph.JGraph
org.jgraph.JGraph.EmptySelectionModel, org.jgraph.JGraph.GraphSelectionRedirector
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  ApplicationFrame _appFrame
          The current ApplicationFrame
private  java.util.LinkedList<Constraint> _constraints
          Linked List of all constraints
private  java.io.File _currentFile
          The current file, initialized to null
private  boolean _dirty
          Records whether the sketch has been modified since the last save.
private  DocumentInfo _docInfo
          The current DocumentInfo
private  java.util.HashMap<java.lang.String,org.jgrapht.graph.DefaultEdge> _edges
          Hash Map of all edges, indexed by their label
private  java.util.HashMap<java.lang.String,EntityNode> _entityNodes
          Hash Map of all entity nodes, indexed by their name
private  SketchAdapter _modelAdapter
          The current SketchAdapter
private  org.jgrapht.graph.ListenableDirectedGraph<SketchVertex,org.jgrapht.graph.DefaultEdge> _ourGraph
          The current ListenableDirectedGraph
private  java.util.HashMap<java.lang.String,SketchPath> _paths
          Hash Map of all paths, indexed by their name
private  SketchSelectionListener _selectionListener
          The current SketchSelectionListener
private  DataTypeController _typeController
          The current DataTypeController for this sketch
 
Fields inherited from class org.jgraph.JGraph
antiAliased, ANTIALIASED_PROPERTY, autoResizeGraph, bendable, cloneable, connectable, CROSS_GRID_MODE, disconnectable, disconnectOnMove, DOT_GRID_MODE, dragEnabled, dropEnabled, edgeLabelsMovable, editable, EDITABLE_PROPERTY, editClickCount, enabled, GRAPH_LAYOUT_CACHE_PROPERTY, GRAPH_MODEL_PROPERTY, graphLayoutCache, graphModel, GRID_COLOR_PROPERTY, GRID_SIZE_PROPERTY, GRID_VISIBLE_PROPERTY, gridColor, gridEnabled, gridMode, gridSize, gridVisible, HANDLE_COLOR_PROPERTY, HANDLE_SIZE_PROPERTY, handleColor, handleSize, highlightColor, INVOKES_STOP_CELL_EDITING_PROPERTY, invokesStopCellEditing, IS_MAC, isJumpToDefaultPort, isMoveIntoGroups, isMoveOutOfGroups, LINE_GRID_MODE, LOCKED_HANDLE_COLOR_PROPERTY, lockedHandleColor, marquee, MARQUEE_HANDLER_PROPERTY, marqueeColor, minimumMove, moveable, moveBelowZero, offgraphics, offscreen, PORTS_SCALED_PROPERTY, PORTS_VISIBLE_PROPERTY, portsScaled, portsVisible, previewInvalidNullPorts, scale, SCALE_PROPERTY, SELECTION_MODEL_PROPERTY, selectionEnabled, SELECTIONENABLED_PROPERTY, selectionModel, selectionRedirector, sizeable, tolerance, VERSION, xorEnabled
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Sketch(ApplicationFrame inFrame)
          The default constructor sets all the visual settings for the JGraph, as well as initialising the sketch to be empty.
 
Method Summary
 void addConstraint(Constraint c)
          Adds a constraint to the sketch.
 void addEdge(SketchEdge inEdge)
          Adds an edge to the sketch
 void addEntity(EntityNode theEntity)
          Add an entity to the graph, deals with all of the dependencies.
 void addNewConstraint(Constraint c)
          Add a new constraint to the sketch
 void addNewEntity(java.lang.String name, double x, double y)
          Add a new, empty entity at point X, Y
 boolean containsMultiEdges()
          Tests if the sketch has multiple edges between any two entities
 SketchAdapter getAdapter()
          An accessor for the model's JGraphT->JGraph adapter.
 java.util.LinkedList<Constraint> getConstraints()
          Returns the linkedlist of constraints
 DataTypeController getDataTypeController()
          Returns the DataTypeController for the sketch
 boolean getDirty()
          Determines whether the sketch has been modified since the last save.
 DocumentInfo getDocInfo()
          Gets the document information
 java.util.HashMap getEdges()
          Returns the HashMap of all of the edges in the sketch
 java.util.HashMap getEntities()
          Accessor for the entities in the sketch
 java.io.File getFile()
          Get the working file for this sketch.
 ApplicationFrame getFrame()
          Returns the parental application frame to whoever asks for it.
 org.jgrapht.graph.ListenableDirectedGraph<SketchVertex,org.jgrapht.graph.DefaultEdge> getGraphData()
          Get the sketch's underlying JGraphT graph, a ListenableDirectedGraph
 java.lang.String getNewEdgeName(boolean isInjective)
          Returns the first available unique edge identifier
 java.lang.String getNewName()
          Returns the next available 'NewName', so we don't get duplicates.
 java.util.HashMap getPaths()
          Returns the HashMap of all paths in the sketch
 SketchSelectionListener getSelectionListener()
          An accessor for the Model's selection listener
 void initialiseFromData(java.util.HashMap<java.lang.String,EntityNode> entityNodes, java.util.HashMap<java.lang.String,org.jgrapht.graph.DefaultEdge> edges, java.util.HashMap<java.lang.String,SketchPath> paths, java.util.LinkedList<Constraint> constraints, java.util.ArrayList dataTypes, DocumentInfo head, boolean inMySQL, boolean inOracle, boolean inDB2, boolean inXML, boolean inUserDefined)
          Used to initialise a new sketch based on provided data (usually from the Sketch loading methods).
 void initialiseSketch()
          When we initialise the sketch, we flush out all the data concerning the sketch itself.
 boolean isEdgeNameUsed(java.lang.String inName)
          Checks to see if a name is in use, so that we will not have several instances at once.
 boolean isNameUsed(java.lang.String inName)
          Checks to see if a name is in use, so that we will not have several instances at once.
 void loadFromXML(java.io.File inputFile)
          Requests that an XML file be loaded into the sketch.
 void newSketch()
          When we initialise a new sketch, we need to clear the selection buffer just in case something is still selected.
 void removeConstraint(Constraint toRemove)
          Removes a constraint and guide arrows
 void removeEdge(SketchEdge toRemove)
          Removes an edge, also cascades to remove all constraints using it.
 void removeEntity(EntityNode toRemove)
          Removes an entity, and also cascades to remove all the arrows involved with it.
 void saveToXML(java.io.File outputFile)
          Saves the existing sketch as an XML file.
 void setDirty(boolean inDirty)
          Used to mark a sketch as dirty or not.
 void setFile(java.io.File inFile)
          This assigns a file to the current sketch.
 void updateCellMoved(org.jgraph.graph.DefaultGraphCell inCell)
          Whenever a cell moves, it calls this method of the sketch in order to keep all of the coordinates stored in the entities accurate.
 void updateUI()
          Since this is a Swing component, this method is overloading a method of JGraph to adjust the look and feel.
 
Methods inherited from class org.jgraph.JGraph
addGraphSelectionListener, addSampleData, addSelectionCell, addSelectionCells, cancelEditing, clearSelection, cloneCells, convertValueToString, createBounds, drawImage, drawImage, fireValueChanged, fromScreen, fromScreen, getAttributes, getCellBounds, getCellBounds, getCenterPoint, getDefaultPortForCell, getDescendants, getEdgeLabelsMovable, getEditClickCount, getEditingCell, getFirstCellForLocation, getGraphLayoutCache, getGridColor, getGridMode, getGridSize, getHandleColor, getHandleSize, getHighlightColor, getImage, getInvokesStopCellEditing, getLeafViewAt, getLockedHandleColor, getMarqueeColor, getMarqueeHandler, getMinimumMove, getModel, getNextCellForLocation, getNextSelectableViewAt, getNextViewAt, getNextViewAt, getNextViewAt, getNextViewAt, getOffgraphics, getOffscreen, getPortForLocation, getPortViewAt, getPortViewAt, getPreferredScrollableViewportSize, getRoots, getRoots, getScale, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectionCell, getSelectionCellAt, getSelectionCells, getSelectionCells, getSelectionCount, getSelectionModel, getTolerance, getToolTipText, getTopmostViewAt, getUI, getUIClassID, graphDidChange, isAntiAliased, isAutoResizeGraph, isBendable, isCellEditable, isCellSelected, isCloneable, isConnectable, isDisconnectable, isDisconnectOnMove, isDragEnabled, isDropEnabled, isEditable, isEditing, isGridEnabled, isGridVisible, isJumpToDefaultPort, isMoveable, isMoveBelowZero, isMoveIntoGroups, isMoveOutOfGroups, isPortsScaled, isPortsVisible, isPreviewInvalidNullPorts, isSelectionEmpty, isSelectionEnabled, isSizeable, isXorEnabled, main, order, paramString, removeGraphSelectionListener, removeSelectionCell, scrollCellToVisible, scrollPointToVisible, setAntiAliased, setAutoResizeGraph, setBendable, setCloneable, setConnectable, setDisconnectable, setDisconnectOnMove, setDragEnabled, setDropEnabled, setEdgeLabelsMovable, setEditable, setEditClickCount, setGraphLayoutCache, setGridColor, setGridEnabled, setGridMode, setGridSize, setGridVisible, setHandleColor, setHandleSize, setHighlightColor, setInvokesStopCellEditing, setJumpToDefaultPort, setLockedHandleColor, setMarqueeColor, setMarqueeHandler, setMinimumMove, setModel, setMoveable, setMoveBelowZero, setMoveIntoGroups, setMoveOutOfGroups, setPortsScaled, setPortsVisible, setPreviewInvalidNullPorts, setScale, setScale, setSelectionCell, setSelectionCells, setSelectionEnabled, setSelectionModel, setSizeable, setTolerance, setUI, setXorEnabled, snap, snap, snap, startEditingAtCell, stopEditing, toScreen, toScreen, updateAutoSize
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.accessibility.Accessible
getAccessibleContext
 

Field Detail

_dirty

private boolean _dirty
Records whether the sketch has been modified since the last save. Initialized to false


_currentFile

private java.io.File _currentFile
The current file, initialized to null


_ourGraph

private org.jgrapht.graph.ListenableDirectedGraph<SketchVertex,org.jgrapht.graph.DefaultEdge> _ourGraph
The current ListenableDirectedGraph


_modelAdapter

private SketchAdapter _modelAdapter
The current SketchAdapter


_entityNodes

private java.util.HashMap<java.lang.String,EntityNode> _entityNodes
Hash Map of all entity nodes, indexed by their name


_edges

private java.util.HashMap<java.lang.String,org.jgrapht.graph.DefaultEdge> _edges
Hash Map of all edges, indexed by their label


_paths

private java.util.HashMap<java.lang.String,SketchPath> _paths
Hash Map of all paths, indexed by their name


_constraints

private java.util.LinkedList<Constraint> _constraints
Linked List of all constraints


_typeController

private DataTypeController _typeController
The current DataTypeController for this sketch


_selectionListener

private SketchSelectionListener _selectionListener
The current SketchSelectionListener


_appFrame

private ApplicationFrame _appFrame
The current ApplicationFrame


_docInfo

private DocumentInfo _docInfo
The current DocumentInfo

Constructor Detail

Sketch

public Sketch(ApplicationFrame inFrame)
The default constructor sets all the visual settings for the JGraph, as well as initialising the sketch to be empty. It also adds appropriate listeners for all of the actions we are concerned with.

Parameters:
inFrame - The application frame of the sketch
Method Detail

getFile

public java.io.File getFile()
Get the working file for this sketch.

Returns:
The file last saved using this sketch

setFile

public void setFile(java.io.File inFile)
This assigns a file to the current sketch.

Parameters:
inFile - File to be assigned.

updateUI

public void updateUI()
Since this is a Swing component, this method is overloading a method of JGraph to adjust the look and feel. The feel we are changing is ignoring all but left clicks, allowing for right-click functionality not affecting the selections.

Overrides:
updateUI in class org.jgraph.JGraph

updateCellMoved

public void updateCellMoved(org.jgraph.graph.DefaultGraphCell inCell)
Whenever a cell moves, it calls this method of the sketch in order to keep all of the coordinates stored in the entities accurate. Called from the sketch listener.

Parameters:
inCell - The cell which has been moved

getDirty

public boolean getDirty()
Determines whether the sketch has been modified since the last save.

Returns:
The dirtiness, true means dirty.

setDirty

public void setDirty(boolean inDirty)
Used to mark a sketch as dirty or not.

Parameters:
inDirty - NEw dirtiness.

getDataTypeController

public DataTypeController getDataTypeController()
Returns the DataTypeController for the sketch

Returns:
The DataTypeController for the sketch

getFrame

public ApplicationFrame getFrame()
Returns the parental application frame to whoever asks for it.

Returns:
The current application frame

getDocInfo

public DocumentInfo getDocInfo()
Gets the document information

Returns:
The document information

initialiseSketch

public void initialiseSketch()
When we initialise the sketch, we flush out all the data concerning the sketch itself. Even the modelAdapter is reinitialized. This methods serves as a "new sketch" function.


newSketch

public void newSketch()
When we initialise a new sketch, we need to clear the selection buffer just in case something is still selected. Or else it will remain selected because there will be no events removing it.


initialiseFromData

public void initialiseFromData(java.util.HashMap<java.lang.String,EntityNode> entityNodes,
                               java.util.HashMap<java.lang.String,org.jgrapht.graph.DefaultEdge> edges,
                               java.util.HashMap<java.lang.String,SketchPath> paths,
                               java.util.LinkedList<Constraint> constraints,
                               java.util.ArrayList dataTypes,
                               DocumentInfo head,
                               boolean inMySQL,
                               boolean inOracle,
                               boolean inDB2,
                               boolean inXML,
                               boolean inUserDefined)
Used to initialise a new sketch based on provided data (usually from the Sketch loading methods).

Parameters:
entityNodes - A hash map of all of the entities in the sketch
edges - A hash map containing all of the edges in the sketch
paths - A hash map containing all of the paths in the sketch
constraints - A linked list containing all of the constraints of the sketch
dataTypes - An array list of all the data types used for the sketch
inMySQL - If the MySQL output is enabled or not
inOracle - If Oracle output is enabled or not
inDB2 - If DB2 output is enabled or not
inXML - If XML output is enabled or not
inUserDefined - If user defined output is enabled or not
head - The header created from the loaded XML file.

getAdapter

public SketchAdapter getAdapter()
An accessor for the model's JGraphT->JGraph adapter.

Returns:
The current model adapter

getSelectionListener

public SketchSelectionListener getSelectionListener()
An accessor for the Model's selection listener

Returns:
The selection listener

getGraphData

public org.jgrapht.graph.ListenableDirectedGraph<SketchVertex,org.jgrapht.graph.DefaultEdge> getGraphData()
Get the sketch's underlying JGraphT graph, a ListenableDirectedGraph

Returns:
The underlying graph

getEdges

public java.util.HashMap getEdges()
Returns the HashMap of all of the edges in the sketch

Returns:
HashMap of all the edges.

getPaths

public java.util.HashMap getPaths()
Returns the HashMap of all paths in the sketch

Returns:
HashMap of paths
Since:
2006-05-29

getEntities

public java.util.HashMap getEntities()
Accessor for the entities in the sketch

Returns:
HashMap of the entities

getConstraints

public java.util.LinkedList<Constraint> getConstraints()
Returns the linkedlist of constraints

Returns:
The constraints

loadFromXML

public void loadFromXML(java.io.File inputFile)
Requests that an XML file be loaded into the sketch.

Parameters:
inputFile - The file from which the data will be drawn.

removeEntity

public void removeEntity(EntityNode toRemove)
Removes an entity, and also cascades to remove all the arrows involved with it.

Parameters:
toRemove - The entity about to be removed

removeEdge

public void removeEdge(SketchEdge toRemove)
Removes an edge, also cascades to remove all constraints using it.

Parameters:
toRemove - The edge about to be removed

removeConstraint

public void removeConstraint(Constraint toRemove)
Removes a constraint and guide arrows

Parameters:
toRemove - The constraint about to be removed

saveToXML

public void saveToXML(java.io.File outputFile)
Saves the existing sketch as an XML file.

Parameters:
outputFile - The file to be written to

addNewEntity

public void addNewEntity(java.lang.String name,
                         double x,
                         double y)
Add a new, empty entity at point X, Y

Parameters:
name - The name of the new entity being added
x - X Coordinate of new entity
y - Y Coordinate of new entity

addEntity

public void addEntity(EntityNode theEntity)
Add an entity to the graph, deals with all of the dependencies.

Parameters:
theEntity -

addEdge

public void addEdge(SketchEdge inEdge)
Adds an edge to the sketch

Parameters:
inEdge - The edge to be added

addNewConstraint

public void addNewConstraint(Constraint c)
Add a new constraint to the sketch

Parameters:
c - The constraint to be added

addConstraint

public void addConstraint(Constraint c)
Adds a constraint to the sketch. This will register the constraint in the constraint list, as well as adding a visual representation of the constraint to the graph.

Parameters:
c - The constraint to be added.

getNewName

public java.lang.String getNewName()
Returns the next available 'NewName', so we don't get duplicates.

Returns:
The next new name.

isNameUsed

public boolean isNameUsed(java.lang.String inName)
Checks to see if a name is in use, so that we will not have several instances at once.

Parameters:
inName - The desired new name to check against
Returns:
Is it used or not.

getNewEdgeName

public java.lang.String getNewEdgeName(boolean isInjective)
Returns the first available unique edge identifier

Parameters:
isInjective - true if the edge is injective, false otherwise
Returns:
The next id

isEdgeNameUsed

public boolean isEdgeNameUsed(java.lang.String inName)
Checks to see if a name is in use, so that we will not have several instances at once. For edges.

Parameters:
inName - The desired new edge name to check against
Returns:
Is it used or not.

containsMultiEdges

public boolean containsMultiEdges()
Tests if the sketch has multiple edges between any two entities

Returns:
True if there exists a situation of multiple edges