cz.cmc.tcgui
Class TCEditor

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bycz.cmc.tcgui.TCEditor
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable, TCExport, TCImport

public class TCEditor
extends JPanel
implements TCExport, TCImport

Title: Class TCEditor

Description: TCEditor provides functionality of the traffic control editing panel

Copyright: Copyright (c) 2003

Company: CMC Computers

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  String device
          Name of the network device this schema stands for
protected  int freeTCObjectID
          TCObject ID generator.
protected  TCGraph graph
          TC Graph associated with this editor.
protected  boolean interactive
          Interactive mode flag.
protected  TCObject objectBeingPlaced
          The object that is currently being placed, if any.
protected  EventListenerList tcEditorListenerList
          This entry holds list of all interfaces who subscribed listening of hoTCEditorEvents
protected  TCGui tcGui
          TCGui environment owning this editor
protected  Map tcObjectIDMap
          Hashtable tc object id => tc object
protected  org.jgraph.graph.GraphUndoManager undoManager
          Undo manager associated with this editor.
 
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
TCEditor(TCGui tcGui)
          Create TCEdtior using defaults
TCEditor(TCGui tcGui, boolean isDoubleBuffered)
          Create TCEdtior specifying whether to use double buffering
TCEditor(TCGui tcGui, LayoutManager layout)
          Create TCEdtior using given layot manager
TCEditor(TCGui tcGui, LayoutManager layout, boolean isDoubleBuffered)
          Create TCEdtior using given layot manager with ability to set double buffering
 
Method Summary
 void addFilter(FilterContainer fc, Filter f)
          Adds the filter to the FilterContainer
 void addFilterElement(Filter f, FilterElement fe)
          Adds the filter element to the Filter
 void addTCEditorListener(TCEditorListener l)
          Add listener for editor events
 void addTCObject(TCObject tco)
          Adds TCObject to the schema
static Map applyAttributeChangeMap(Map attributes, Map changeMap)
          Applies the change map to attributes and return result
 void applyTCAttributes(TCObject tco, Map map)
          Applies attributes for given TCObject.
 void applyViewAttributes(TCObject tco, Map map)
          Applies given view attributes for given TCObject Keys are strings, values are basic java objects as Float, Boolean, Integer, String, java.awt.Rectangle, java.awt.Point
 void attachQDisc(Class c, QDisc qd)
          Attaches the given QDisc to the given class. If something was attached on the class, it would be removed. If the qdisc was attached on a class, it would be detached.
 void attachSubclass(SubclassableTCObject stco, Class c)
          Attaches the given subclass to the given SubclassableTCObject. If a QDisc was attached on the class, it would be disconnected.
 void clearSchema()
          Empties the whole schema
 void connect(TCOutputPort port1, TCInputPort port2)
          Connects the two ports by calling the right method of the TCImport interface.
 void connectFilterMatch(FilterElement fe, Class c)
          Connects filter element to the matching class Throws exception if the Class is not a subclass of the ClassfulQDisc owning the FilterElement.
 JPopupMenu createPopupMenu(Point pt, Object cell)
          Create popup menu for an popup event in this editor
 void detachAllSubclasses(SubclassableTCObject stco)
          Dettaches all subclasses of the given SubclassableTCObject.
 void detachFilter(Filter f)
          Removes the Filter from its FilterContainer
 void detachFilterElement(FilterElement fe)
          Removes the FilterElement from its Filter
 void detachQDisc(Class c)
          Detaches the QDisc attached to the given Class.
 void detachQDisc(QDisc qd)
          Detaches the given QDisc from the Class it is attached on.
 void detachSubclass(Class c)
          Detaches the given class from its parent SubclassableTCObject.
 void disconnectFilterMatch(FilterElement fe)
          Disconnects the FilterElement from the matching Class counterpart
 void disconnectFilterMatches(Class c)
          Disconnects the Class from matching FilterElements.
 void disconnectChild(TCObject child)
          Separates child from its parent
 TCObjectView findLeafTCObjectView(org.jgraph.graph.CellView[] views, Point pt)
          Returns CellView that is to be selected for given point.
 TCObjectView findLeafTCObjectView(org.jgraph.graph.CellView view, Point pt)
          Returns CellView that to be selected for given point
protected  void fireTCEditorEvent(TCEditorEvent tce, String method)
          fires TCEditorEvent
 FilterContainer[] getAllFilterContainers()
           
 Filter[] getAllFilters()
           
 ClassfulQDisc getAncestorClassfulQDisc(Class c)
          Returns classfull qdisc which is (possibly indirect) parent of the given Class.
 QDisc getAttachedQDisc(Class c)
          Returns QDisc attached to the given class. Returns null if the class is not leaf or if there is no QDisc attached.
 Class getClassMatch(FilterElement fe)
          Get Class matching the given FilterElement
 DataDefinition getDataDefinition()
          Get DataDefinition instance which defines TCObjects and their attributes
protected  String getDefaultClassName()
          Returns incremental identifiers for newly created queuing disciplines.
protected  String getDefaultFilterElementName()
          Returns incremental identifiers for newly created filter elements.
protected  String getDefaultFilterName()
          Returns incremental identifiers for newly created filter heads.
protected  String getDefaultQDiscName()
          Returns incremental identifiers for newly created queuing disciplines.
 String getDevice()
           
 Filter getFilter(FilterElement fe)
          Returns filter the filter element is in.
 FilterContainer getFilterContainer(Filter f)
          Returns filter container the filter is in.
 FilterElement[] getFilterElements(Filter f)
          Returns filter elements in the given filter.
 FilterElement[] getFilterMatch(Class c)
          Get FilterElement matching the given Class
 Filter[] getFilters(FilterContainer fc)
          Return filters attached to the given FilterContainer (ClassfulQDisc or Class) in the correct order.
 TCGraph getGraph()
           
 Class getParentClass(QDisc qd)
          Returns the Class the given qdisc is attached on.
 SubclassableTCObject getParentSubclassableTCObject(Class c)
          Returns ClassfulQDisc or class which is parent of the given class.
protected  TCObjectContainer getRootTCObjectContainer(TCObject tco)
          Returns the root TCObjectContainer for the given TCObject.
 TCObject[] getRootTCObjects()
           
 Class[] getSubclasses(SubclassableTCObject stco)
          Gets all subclasses of the specified SubclassableTCObject. Returns null if stco is a leaf class. Returns empty array if stco is a classfull qdisc without classes.
 Map getTCAttributes(TCObject tco)
          Get attributes for given TCObject The returned map should not be changed since it is not guaranteed to be copied at the return time.
protected  int getTCEditorListenerCount()
           
 TCGui getTCGui()
           
protected  TCObjectContainer getTCObjectContainer(TCObjectContainerEntry tcoe)
          Get TCObjectContainer from the given TCObjectContainerEntry
protected  TCObjectContainerEntry[] getTCObjectContainerEntries(TCObjectContainer tcoc)
          Get TCObjectContainerEntries from the given TCObjectContainer
 TCObject getTCObjectForID(int id)
          Returns TCObject with the given id.
 TCObject getTCParent(TCObject tco)
          Returns parent of the given TCObejct in the TC tree.
 UndoableEditSupport getUndoableEditSupport()
           
 Map getViewAttributes(TCObject tco)
          Returns view attributes for the given TCObject The returned map should not be changed since it is guaranteed to be copied at the return time.
protected  void initialize(TCGui tcGui)
          Initializethe editor, called by constructors
 void insertFilterAt(FilterContainer fc, Filter f, int index)
          Inserts the filter into the FilterContainer onto the given position
 void insertFilterElementAt(Filter f, FilterElement fe, int index)
          Inserts the filter element into the Filter onto the given position
 int isConnectable(TCPort port1, TCPort port2)
          Decides whether port1 and port2 may be connected.
 boolean isInteractive()
          Returns whether the editor's state is interactive.
 boolean isLeafClass(Class c)
          Returns whether the Class is Leaf (has no subclasses).
protected  void passConnectionToGenerator(TCObject dtco, TCObject tco1, TCObject tco2)
          Passes a connection event to the generator while switching to the noninteractive mode to prevent nested generator calls.
protected  void passDisconnectionToGenerator(TCObject dtco, TCObject tco1, TCObject tco2)
          Passes a disconnection event to the generator while switching to the noninteractive mode to prevent nested generator calls.
protected  void passChangesToGenerator(TCObject dtco, TCObject tco, Map changes)
          Passes map changes to the generator while switching to the noninteractive mode to prevent nested generator calls.
 void placeClass()
          Place a new class.
 void placeClassfulQDisc()
          Place a new classful queuing discipline.
 void placeClasslessQDisc()
          Place a new classless queuing discipline.
 void placeFilter()
          Place a new filter head.
 void placeFilterElement()
          Place a new filter element.
 void redo()
          Redo the last change
 void removeEdgesConnectedToPort(TCPort port)
          Disconnects all edges from a given port
 void removeTCAttributes(TCObject tco)
          Removes all TC attributes from the given TCObject
 void removeTCAttributes(TCObject tco, Object[] keys)
          Remove TC attributes from the given TCObject
 void removeTCEditorListener(TCEditorListener l)
          Remove listener for editor events
 void removeTCObject(TCObject tco)
          Removes TCObject and all its children from the schema.
 void removeViewAttributes(TCObject tco)
          Removes all view attributes from the given TCObject
 void removeViewAttributes(TCObject tco, Object[] keys)
          Remove view attributes from the given TCObject
protected  void resetIDGenerators()
          Reset counters generatimg numeric ids.
 Iterator selectionHierarchyIterator(Class c)
          Gets Hierarchy iterator for hierarchy based on supplied class (wrapper for TCGraphSelectionModel)
 int selectionHierarchySize(Class c)
          Gets hierarchy size (number of cells at) (wrapper for TCGraphSelectionModel)
protected  void setDefaultCursor()
          Sets current cursor to default
 void setDevice(String device)
          Sets the device name
 void setInteractive(boolean interactive)
          Sets the interactity flag.
 void setTCObjectID(TCObject tco, int id)
          Sets id of the TCObject. The ID must be uniqie within schema.
 void test()
           
 void testExport()
           
 void undo()
          Undo the last change
protected  void updateTCObjectContainerEntryBounds(Map attributes, Rectangle bounds, TCObjectContainerEntry[] tcoce, TCObjectContainer tcoc)
          Updates bounds of TCObjectContainerEntries and its entries recursively.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintComponent, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printComponent, printChildren, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, checkImage, checkImage, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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
 

Field Detail

tcGui

protected TCGui tcGui
TCGui environment owning this editor


graph

protected TCGraph graph
TC Graph associated with this editor.


interactive

protected boolean interactive
Interactive mode flag.


tcEditorListenerList

protected EventListenerList tcEditorListenerList
This entry holds list of all interfaces who subscribed listening of hoTCEditorEvents

See Also:
addTCEditorListener(cz.cmc.tcgui.TCEditorListener), removeTCEditorListener(cz.cmc.tcgui.TCEditorListener)

undoManager

protected org.jgraph.graph.GraphUndoManager undoManager
Undo manager associated with this editor.


device

protected String device
Name of the network device this schema stands for


tcObjectIDMap

protected Map tcObjectIDMap
Hashtable tc object id => tc object


objectBeingPlaced

protected TCObject objectBeingPlaced
The object that is currently being placed, if any.


freeTCObjectID

protected int freeTCObjectID
TCObject ID generator.

Constructor Detail

TCEditor

public TCEditor(TCGui tcGui)
Create TCEdtior using defaults


TCEditor

public TCEditor(TCGui tcGui,
                LayoutManager layout)
Create TCEdtior using given layot manager


TCEditor

public TCEditor(TCGui tcGui,
                boolean isDoubleBuffered)
Create TCEdtior specifying whether to use double buffering


TCEditor

public TCEditor(TCGui tcGui,
                LayoutManager layout,
                boolean isDoubleBuffered)
Create TCEdtior using given layot manager with ability to set double buffering

Method Detail

initialize

protected void initialize(TCGui tcGui)
Initializethe editor, called by constructors


getTCGui

public TCGui getTCGui()

isInteractive

public boolean isInteractive()
Returns whether the editor's state is interactive. The interactive state means that Generators are called on TCImport operations.


setInteractive

public void setInteractive(boolean interactive)
Sets the interactity flag. The interactive state means that Generators are called on TCImport operations.


passChangesToGenerator

protected void passChangesToGenerator(TCObject dtco,
                                      TCObject tco,
                                      Map changes)
Passes map changes to the generator while switching to the noninteractive mode to prevent nested generator calls.

Parameters:
dtco - datadefinition TCObject to call the generator for. If it is null, nothing is done.
tco - TCObject to be Generator called for
changes - changes to pass

passConnectionToGenerator

protected void passConnectionToGenerator(TCObject dtco,
                                         TCObject tco1,
                                         TCObject tco2)
Passes a connection event to the generator while switching to the noninteractive mode to prevent nested generator calls.

Parameters:
dtco - datadefinition TCObject to call the generator for. If it is null, nothing is done.
tco1 - source TCObject

passDisconnectionToGenerator

protected void passDisconnectionToGenerator(TCObject dtco,
                                            TCObject tco1,
                                            TCObject tco2)
Passes a disconnection event to the generator while switching to the noninteractive mode to prevent nested generator calls.

Parameters:
dtco - datadefinition TCObject to call the generator for. If it is null, nothing is done.
tco1 - source TCObject

getDataDefinition

public DataDefinition getDataDefinition()
Get DataDefinition instance which defines TCObjects and their attributes

Specified by:
getDataDefinition in interface TCExport
Returns:
instance of DataDefinition interface

getDevice

public String getDevice()
Specified by:
getDevice in interface TCExport
Returns:
device name for which the tc schema stands for

getTCObjectForID

public TCObject getTCObjectForID(int id)
Returns TCObject with the given id.

Specified by:
getTCObjectForID in interface TCExport

getRootTCObjects

public TCObject[] getRootTCObjects()
Specified by:
getRootTCObjects in interface TCExport
Returns:
array of tc objects which do not have tree input edge

getTCAttributes

public Map getTCAttributes(TCObject tco)
Get attributes for given TCObject The returned map should not be changed since it is not guaranteed to be copied at the return time. Keys are AttributeInstances or Strings, values are basic java objects as Float, Boolean, Integer, String, java.util.Set; the datadef object has key TCGraphConstants.DATADEFINITION

Specified by:
getTCAttributes in interface TCExport
Parameters:
tco - TCObject to get attributes for
Returns:
Map key => value

getViewAttributes

public Map getViewAttributes(TCObject tco)
Returns view attributes for the given TCObject The returned map should not be changed since it is guaranteed to be copied at the return time. Keys are strings, values are basic java objects as Float, Boolean, Integer, String, java.awt.Rectangle, java.awt.Point

Specified by:
getViewAttributes in interface TCExport
Parameters:
tco - TCObject to return view attributes for
Returns:
Map key => value

getSubclasses

public Class[] getSubclasses(SubclassableTCObject stco)
Gets all subclasses of the specified SubclassableTCObject. Returns null if stco is a leaf class. Returns empty array if stco is a classfull qdisc without classes.

Specified by:
getSubclasses in interface TCExport
Parameters:
stco - Class or ClassfulQDisc to return subclasses for
Returns:
subclasses of the specified SubclassableTCObject
See Also:
TCExport.getAttachedQDisc(Class), TCExport.getParentClass(QDisc)

isLeafClass

public boolean isLeafClass(Class c)
Returns whether the Class is Leaf (has no subclasses).

Specified by:
isLeafClass in interface TCExport
Parameters:
c - Class
Returns:
true if the given Class has no subclasses

getParentSubclassableTCObject

public SubclassableTCObject getParentSubclassableTCObject(Class c)
Returns ClassfulQDisc or class which is parent of the given class.

Specified by:
getParentSubclassableTCObject in interface TCExport
Parameters:
c - class to return parent for
Returns:
parent SubclassableTCObject

getAncestorClassfulQDisc

public ClassfulQDisc getAncestorClassfulQDisc(Class c)
Returns classfull qdisc which is (possibly indirect) parent of the given Class.

Specified by:
getAncestorClassfulQDisc in interface TCExport

getAttachedQDisc

public QDisc getAttachedQDisc(Class c)
Returns QDisc attached to the given class. Returns null if the class is not leaf or if there is no QDisc attached.

Specified by:
getAttachedQDisc in interface TCExport
Parameters:
c - class to get attched QDisc for
Returns:
QDisc attached to the given class

getParentClass

public Class getParentClass(QDisc qd)
Returns the Class the given qdisc is attached on.

Specified by:
getParentClass in interface TCExport
Parameters:
qd - attached QDisc
Returns:
Class the given qdisc is attached on

getFilters

public Filter[] getFilters(FilterContainer fc)
Return filters attached to the given FilterContainer (ClassfulQDisc or Class) in the correct order.

Specified by:
getFilters in interface TCExport
Parameters:
fc - FilterContainer to return filters
Returns:
filters in the given filter container

getFilterContainer

public FilterContainer getFilterContainer(Filter f)
Returns filter container the filter is in.

Specified by:
getFilterContainer in interface TCExport
Parameters:
f - filter
Returns:
filter container the filter is in

getFilterElements

public FilterElement[] getFilterElements(Filter f)
Returns filter elements in the given filter.

Specified by:
getFilterElements in interface TCExport
Parameters:
f - Filter to return filter elements for
Returns:
filter elements in the given Filter

getFilter

public Filter getFilter(FilterElement fe)
Returns filter the filter element is in.

Specified by:
getFilter in interface TCExport
Parameters:
fe - filter element
Returns:
filter the filter element is in

getClassMatch

public Class getClassMatch(FilterElement fe)
Get Class matching the given FilterElement

Specified by:
getClassMatch in interface TCExport
Parameters:
fe - filter element to return matching Class for
Returns:
Class matching the given FilterElement or null

getFilterMatch

public FilterElement[] getFilterMatch(Class c)
Get FilterElement matching the given Class

Specified by:
getFilterMatch in interface TCExport
Parameters:
c - Class to return matching FilterElement for
Returns:
FilterElement matching the given Class or null

getTCParent

public TCObject getTCParent(TCObject tco)
Returns parent of the given TCObejct in the TC tree. Parent is the parent SubclassableTCObject or class the TCObject is attached on.

Parameters:
tco - TCObject to return parent for Note that FilterMatchEdge connections are not reflected by this.
Returns:
TCObject which is parent to the given TCObject or null

getAllFilters

public Filter[] getAllFilters()
Returns:
all filters in the schema

getAllFilterContainers

public FilterContainer[] getAllFilterContainers()
Returns:
all filter containers in the schema

getUndoableEditSupport

public UndoableEditSupport getUndoableEditSupport()
Specified by:
getUndoableEditSupport in interface TCImport
Returns:
undoable edit support instance or null if no UndoableEditSupport available

setDevice

public void setDevice(String device)
Sets the device name

Specified by:
setDevice in interface TCImport
Parameters:
device - device name to be set

addTCObject

public void addTCObject(TCObject tco)
Adds TCObject to the schema

Specified by:
addTCObject in interface TCImport

clearSchema

public void clearSchema()
Empties the whole schema

Specified by:
clearSchema in interface TCImport

removeTCObject

public void removeTCObject(TCObject tco)
Removes TCObject and all its children from the schema.

Specified by:
removeTCObject in interface TCImport

setTCObjectID

public void setTCObjectID(TCObject tco,
                          int id)
Sets id of the TCObject. The ID must be uniqie within schema.

Specified by:
setTCObjectID in interface TCImport

applyAttributeChangeMap

public static Map applyAttributeChangeMap(Map attributes,
                                          Map changeMap)
Applies the change map to attributes and return result

Parameters:
attributes - old attributes
changeMap - attribute change map
Returns:
the new attributes

applyTCAttributes

public void applyTCAttributes(TCObject tco,
                              Map map)
Applies attributes for given TCObject. Keys are AttributeInstances or Strings, values are basic java objects as Float, Boolean, Integer, String, java.util.Set; the datadef object has key TCGraphConstants.DATADEFINITION

Specified by:
applyTCAttributes in interface TCImport
Parameters:
tco - TCObject to be attributes applied to
map - attributes to be applied

removeTCAttributes

public void removeTCAttributes(TCObject tco,
                               Object[] keys)
Remove TC attributes from the given TCObject

Specified by:
removeTCAttributes in interface TCImport
Parameters:
keys - keys of attributes to be removed

removeTCAttributes

public void removeTCAttributes(TCObject tco)
Removes all TC attributes from the given TCObject

Specified by:
removeTCAttributes in interface TCImport

applyViewAttributes

public void applyViewAttributes(TCObject tco,
                                Map map)
Applies given view attributes for given TCObject Keys are strings, values are basic java objects as Float, Boolean, Integer, String, java.awt.Rectangle, java.awt.Point

Specified by:
applyViewAttributes in interface TCImport
Parameters:
tco - TCObject to be attributes applied to
map - attributes to be applied

removeViewAttributes

public void removeViewAttributes(TCObject tco,
                                 Object[] keys)
Remove view attributes from the given TCObject

Specified by:
removeViewAttributes in interface TCImport
Parameters:
keys - keys of attributes to be removed

removeViewAttributes

public void removeViewAttributes(TCObject tco)
Removes all view attributes from the given TCObject

Specified by:
removeViewAttributes in interface TCImport

attachSubclass

public void attachSubclass(SubclassableTCObject stco,
                           Class c)
Attaches the given subclass to the given SubclassableTCObject. If a QDisc was attached on the class, it would be disconnected.

Specified by:
attachSubclass in interface TCImport
Parameters:
stco - Class or ClassfulQDisc to attach class on
c - Class to be attached

detachSubclass

public void detachSubclass(Class c)
Detaches the given class from its parent SubclassableTCObject.

Specified by:
detachSubclass in interface TCImport
Parameters:
c - Class to be dettached

detachAllSubclasses

public void detachAllSubclasses(SubclassableTCObject stco)
Dettaches all subclasses of the given SubclassableTCObject.

Specified by:
detachAllSubclasses in interface TCImport
Parameters:
stco - Class or ClassfulQDisc to detach class from

attachQDisc

public void attachQDisc(Class c,
                        QDisc qd)
Attaches the given QDisc to the given class. If something was attached on the class, it would be removed. If the qdisc was attached on a class, it would be detached.

Specified by:
attachQDisc in interface TCImport
Parameters:
c - class to attach the QDisc on
qd - QDisc to attach

detachQDisc

public void detachQDisc(Class c)
Detaches the QDisc attached to the given Class.

Specified by:
detachQDisc in interface TCImport
Parameters:
c - Class whose QDisc is to be detached

detachQDisc

public void detachQDisc(QDisc qd)
Detaches the given QDisc from the Class it is attached on.

Specified by:
detachQDisc in interface TCImport
Parameters:
qd - QDisc to detach

addFilter

public void addFilter(FilterContainer fc,
                      Filter f)
Adds the filter to the FilterContainer

Specified by:
addFilter in interface TCImport
Parameters:
fc - FilterContainer to add filter to
f - Filter to add

insertFilterAt

public void insertFilterAt(FilterContainer fc,
                           Filter f,
                           int index)
Inserts the filter into the FilterContainer onto the given position

Specified by:
insertFilterAt in interface TCImport
Parameters:
fc - FilterContainer to add filter to
f - Filter to add
index - position to insert the filter at

detachFilter

public void detachFilter(Filter f)
Removes the Filter from its FilterContainer

Specified by:
detachFilter in interface TCImport
Parameters:
f - filter to detach

addFilterElement

public void addFilterElement(Filter f,
                             FilterElement fe)
Adds the filter element to the Filter

Specified by:
addFilterElement in interface TCImport
Parameters:
f - Filter to add the element to
fe - FilterElement to add

insertFilterElementAt

public void insertFilterElementAt(Filter f,
                                  FilterElement fe,
                                  int index)
Inserts the filter element into the Filter onto the given position

Specified by:
insertFilterElementAt in interface TCImport
Parameters:
f - Filter to add the element to
fe - Filter to add
index - position to insert the filter element at

detachFilterElement

public void detachFilterElement(FilterElement fe)
Removes the FilterElement from its Filter

Specified by:
detachFilterElement in interface TCImport

connectFilterMatch

public void connectFilterMatch(FilterElement fe,
                               Class c)
Connects filter element to the matching class Throws exception if the Class is not a subclass of the ClassfulQDisc owning the FilterElement.

Specified by:
connectFilterMatch in interface TCImport
Parameters:
fe - matched FilterElement
c - matching Class
Throws:
InvalidConnectionException

disconnectFilterMatch

public void disconnectFilterMatch(FilterElement fe)
Disconnects the FilterElement from the matching Class counterpart

Specified by:
disconnectFilterMatch in interface TCImport
Parameters:
fe - FilterElement to be disconnected

disconnectFilterMatches

public void disconnectFilterMatches(Class c)
Disconnects the Class from matching FilterElements.

Specified by:
disconnectFilterMatches in interface TCImport
Parameters:
c - Class to be disconnected

updateTCObjectContainerEntryBounds

protected void updateTCObjectContainerEntryBounds(Map attributes,
                                                  Rectangle bounds,
                                                  TCObjectContainerEntry[] tcoce,
                                                  TCObjectContainer tcoc)
Updates bounds of TCObjectContainerEntries and its entries recursively.

Parameters:
tcoce - TCObjectContainerEntries to be updated
tcoc - the TCObjectContainer to base new bounds on

getRootTCObjectContainer

protected TCObjectContainer getRootTCObjectContainer(TCObject tco)
Returns the root TCObjectContainer for the given TCObject.


getTCObjectContainer

protected TCObjectContainer getTCObjectContainer(TCObjectContainerEntry tcoe)
Get TCObjectContainer from the given TCObjectContainerEntry

Parameters:
tcoe - TCObjectContainerEntry
Returns:
parent TCObjectContainer

getTCObjectContainerEntries

protected TCObjectContainerEntry[] getTCObjectContainerEntries(TCObjectContainer tcoc)
Get TCObjectContainerEntries from the given TCObjectContainer

Parameters:
tcoc - TCObjectContainer
Returns:
array of child TCObjectContainerEntries

connect

public void connect(TCOutputPort port1,
                    TCInputPort port2)
Connects the two ports by calling the right method of the TCImport interface.


disconnectChild

public void disconnectChild(TCObject child)
Separates child from its parent

Parameters:
child - child to be disconnected

setDefaultCursor

protected void setDefaultCursor()
Sets current cursor to default


getDefaultQDiscName

protected String getDefaultQDiscName()
Returns incremental identifiers for newly created queuing disciplines.


getDefaultClassName

protected String getDefaultClassName()
Returns incremental identifiers for newly created queuing disciplines.


getDefaultFilterName

protected String getDefaultFilterName()
Returns incremental identifiers for newly created filter heads.


getDefaultFilterElementName

protected String getDefaultFilterElementName()
Returns incremental identifiers for newly created filter elements.


test

public void test()

testExport

public void testExport()

isConnectable

public int isConnectable(TCPort port1,
                         TCPort port2)
Decides whether port1 and port2 may be connected. It does not ask eventual Checkers, which may be more restrictive.

Parameters:
port1 - first port to connect
port2 - second port to connect
Returns:
1 if port1 is connectable to port2 -1 if port2 is connectable to port1 0 if ports are not connectable

findLeafTCObjectView

public TCObjectView findLeafTCObjectView(org.jgraph.graph.CellView view,
                                         Point pt)
Returns CellView that to be selected for given point


findLeafTCObjectView

public TCObjectView findLeafTCObjectView(org.jgraph.graph.CellView[] views,
                                         Point pt)
Returns CellView that is to be selected for given point.


removeEdgesConnectedToPort

public void removeEdgesConnectedToPort(TCPort port)
Disconnects all edges from a given port

Parameters:
port - port to be separated

placeClassfulQDisc

public void placeClassfulQDisc()
Place a new classful queuing discipline.


placeClasslessQDisc

public void placeClasslessQDisc()
Place a new classless queuing discipline.


placeFilter

public void placeFilter()
Place a new filter head.


placeFilterElement

public void placeFilterElement()
Place a new filter element.


placeClass

public void placeClass()
Place a new class.


undo

public void undo()
Undo the last change


redo

public void redo()
Redo the last change


getGraph

public TCGraph getGraph()
Returns:
TCGraph used in this editor

resetIDGenerators

protected void resetIDGenerators()
Reset counters generatimg numeric ids.


createPopupMenu

public JPopupMenu createPopupMenu(Point pt,
                                  Object cell)
Create popup menu for an popup event in this editor

Parameters:
pt - point where the popup was requested
cell - cell to create it for or null
Returns:
created popup menu

selectionHierarchyIterator

public Iterator selectionHierarchyIterator(Class c)
Gets Hierarchy iterator for hierarchy based on supplied class (wrapper for TCGraphSelectionModel)

Parameters:
c - hierarchy class to return iterator for
Returns:
Iterator over hierarchy

selectionHierarchySize

public int selectionHierarchySize(Class c)
Gets hierarchy size (number of cells at) (wrapper for TCGraphSelectionModel)

Parameters:
c - hierarchy class to get cell count for
Returns:
hierarchy cell count

addTCEditorListener

public void addTCEditorListener(TCEditorListener l)
Add listener for editor events

Parameters:
l - listener to add

removeTCEditorListener

public void removeTCEditorListener(TCEditorListener l)
Remove listener for editor events

Parameters:
l - listener to remove

getTCEditorListenerCount

protected int getTCEditorListenerCount()
Returns:
number of registered TCEditorListeners

fireTCEditorEvent

protected void fireTCEditorEvent(TCEditorEvent tce,
                                 String method)
fires TCEditorEvent

Parameters:
tce - event to be passed
method - TCEditorListener's method to be the event passed to