|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
org.jgraph.JGraph
easik.sketch.Sketch
public class Sketch
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.
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 |
---|
private boolean _dirty
private java.io.File _currentFile
private org.jgrapht.graph.ListenableDirectedGraph<SketchVertex,org.jgrapht.graph.DefaultEdge> _ourGraph
private SketchAdapter _modelAdapter
private java.util.HashMap<java.lang.String,EntityNode> _entityNodes
private java.util.HashMap<java.lang.String,org.jgrapht.graph.DefaultEdge> _edges
private java.util.HashMap<java.lang.String,SketchPath> _paths
private java.util.LinkedList<Constraint> _constraints
private DataTypeController _typeController
private SketchSelectionListener _selectionListener
private ApplicationFrame _appFrame
private DocumentInfo _docInfo
Constructor Detail |
---|
public Sketch(ApplicationFrame inFrame)
inFrame
- The application frame of the sketchMethod Detail |
---|
public java.io.File getFile()
public void setFile(java.io.File inFile)
inFile
- File to be assigned.public void updateUI()
updateUI
in class org.jgraph.JGraph
public void updateCellMoved(org.jgraph.graph.DefaultGraphCell inCell)
inCell
- The cell which has been movedpublic boolean getDirty()
public void setDirty(boolean inDirty)
inDirty
- NEw dirtiness.public DataTypeController getDataTypeController()
public ApplicationFrame getFrame()
public DocumentInfo getDocInfo()
public void initialiseSketch()
public void newSketch()
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)
entityNodes
- A hash map of all of the entities in the sketchedges
- A hash map containing all of the edges in the sketchpaths
- A hash map containing all of the paths in the sketchconstraints
- A linked list containing all of the constraints of the sketchdataTypes
- An array list of all the data types used for the sketchinMySQL
- If the MySQL output is enabled or notinOracle
- If Oracle output is enabled or notinDB2
- If DB2 output is enabled or notinXML
- If XML output is enabled or notinUserDefined
- If user defined output is enabled or nothead
- The header created from the loaded XML file.public SketchAdapter getAdapter()
public SketchSelectionListener getSelectionListener()
public org.jgrapht.graph.ListenableDirectedGraph<SketchVertex,org.jgrapht.graph.DefaultEdge> getGraphData()
public java.util.HashMap getEdges()
public java.util.HashMap getPaths()
public java.util.HashMap getEntities()
public java.util.LinkedList<Constraint> getConstraints()
public void loadFromXML(java.io.File inputFile)
inputFile
- The file from which the data will be drawn.public void removeEntity(EntityNode toRemove)
toRemove
- The entity about to be removedpublic void removeEdge(SketchEdge toRemove)
toRemove
- The edge about to be removedpublic void removeConstraint(Constraint toRemove)
toRemove
- The constraint about to be removedpublic void saveToXML(java.io.File outputFile)
outputFile
- The file to be written topublic void addNewEntity(java.lang.String name, double x, double y)
name
- The name of the new entity being addedx
- X Coordinate of new entityy
- Y Coordinate of new entitypublic void addEntity(EntityNode theEntity)
theEntity
- public void addEdge(SketchEdge inEdge)
inEdge
- The edge to be addedpublic void addNewConstraint(Constraint c)
c
- The constraint to be addedpublic void addConstraint(Constraint c)
c
- The constraint to be added.public java.lang.String getNewName()
public boolean isNameUsed(java.lang.String inName)
inName
- The desired new name to check against
public java.lang.String getNewEdgeName(boolean isInjective)
isInjective
- true if the edge is injective, false otherwise
public boolean isEdgeNameUsed(java.lang.String inName)
inName
- The desired new edge name to check against
public boolean containsMultiEdges()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |