|
||||||||||
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
javax.swing.JPanel
cz.cmc.tcgui.TCEditor
Title: Class TCEditor
Description: TCEditor provides functionality of the traffic control editing panel
Copyright: Copyright (c) 2003
Company: CMC Computers
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected TCGui tcGui
protected TCGraph graph
protected boolean interactive
protected EventListenerList tcEditorListenerList
addTCEditorListener(cz.cmc.tcgui.TCEditorListener)
,
removeTCEditorListener(cz.cmc.tcgui.TCEditorListener)
protected org.jgraph.graph.GraphUndoManager undoManager
protected String device
protected Map tcObjectIDMap
protected TCObject objectBeingPlaced
protected int freeTCObjectID
Constructor Detail |
public TCEditor(TCGui tcGui)
public TCEditor(TCGui tcGui, LayoutManager layout)
public TCEditor(TCGui tcGui, boolean isDoubleBuffered)
public TCEditor(TCGui tcGui, LayoutManager layout, boolean isDoubleBuffered)
Method Detail |
protected void initialize(TCGui tcGui)
public TCGui getTCGui()
public boolean isInteractive()
public void setInteractive(boolean interactive)
protected void passChangesToGenerator(TCObject dtco, TCObject tco, Map changes)
dtco
- datadefinition TCObject to call the generator for. If it is
null, nothing is done.tco
- TCObject to be Generator called forchanges
- changes to passprotected void passConnectionToGenerator(TCObject dtco, TCObject tco1, TCObject tco2)
dtco
- datadefinition TCObject to call the generator for. If it is
null, nothing is done.tco1
- source TCObjectprotected void passDisconnectionToGenerator(TCObject dtco, TCObject tco1, TCObject tco2)
dtco
- datadefinition TCObject to call the generator for. If it is
null, nothing is done.tco1
- source TCObjectpublic DataDefinition getDataDefinition()
getDataDefinition
in interface TCExport
public String getDevice()
getDevice
in interface TCExport
public TCObject getTCObjectForID(int id)
getTCObjectForID
in interface TCExport
public TCObject[] getRootTCObjects()
getRootTCObjects
in interface TCExport
public Map getTCAttributes(TCObject tco)
getTCAttributes
in interface TCExport
tco
- TCObject to get attributes for
public Map getViewAttributes(TCObject tco)
getViewAttributes
in interface TCExport
tco
- TCObject to return view attributes for
public Class[] getSubclasses(SubclassableTCObject stco)
getSubclasses
in interface TCExport
stco
- Class or ClassfulQDisc to return subclasses for
TCExport.getAttachedQDisc(Class)
,
TCExport.getParentClass(QDisc)
public boolean isLeafClass(Class c)
isLeafClass
in interface TCExport
c
- Class
public SubclassableTCObject getParentSubclassableTCObject(Class c)
getParentSubclassableTCObject
in interface TCExport
c
- class to return parent for
public ClassfulQDisc getAncestorClassfulQDisc(Class c)
getAncestorClassfulQDisc
in interface TCExport
public QDisc getAttachedQDisc(Class c)
getAttachedQDisc
in interface TCExport
c
- class to get attched QDisc for
public Class getParentClass(QDisc qd)
getParentClass
in interface TCExport
qd
- attached QDisc
public Filter[] getFilters(FilterContainer fc)
getFilters
in interface TCExport
fc
- FilterContainer to return filters
public FilterContainer getFilterContainer(Filter f)
getFilterContainer
in interface TCExport
f
- filter
public FilterElement[] getFilterElements(Filter f)
getFilterElements
in interface TCExport
f
- Filter to return filter elements for
public Filter getFilter(FilterElement fe)
getFilter
in interface TCExport
fe
- filter element
public Class getClassMatch(FilterElement fe)
getClassMatch
in interface TCExport
fe
- filter element to return matching Class for
public FilterElement[] getFilterMatch(Class c)
getFilterMatch
in interface TCExport
c
- Class to return matching FilterElement for
public TCObject getTCParent(TCObject tco)
tco
- TCObject to return parent for
Note that FilterMatchEdge connections are not reflected by this.
public Filter[] getAllFilters()
public FilterContainer[] getAllFilterContainers()
public UndoableEditSupport getUndoableEditSupport()
getUndoableEditSupport
in interface TCImport
public void setDevice(String device)
setDevice
in interface TCImport
device
- device name to be setpublic void addTCObject(TCObject tco)
addTCObject
in interface TCImport
public void clearSchema()
clearSchema
in interface TCImport
public void removeTCObject(TCObject tco)
removeTCObject
in interface TCImport
public void setTCObjectID(TCObject tco, int id)
setTCObjectID
in interface TCImport
public static Map applyAttributeChangeMap(Map attributes, Map changeMap)
attributes
- old attributeschangeMap
- attribute change map
public void applyTCAttributes(TCObject tco, Map map)
applyTCAttributes
in interface TCImport
tco
- TCObject to be attributes applied tomap
- attributes to be appliedpublic void removeTCAttributes(TCObject tco, Object[] keys)
removeTCAttributes
in interface TCImport
keys
- keys of attributes to be removedpublic void removeTCAttributes(TCObject tco)
removeTCAttributes
in interface TCImport
public void applyViewAttributes(TCObject tco, Map map)
applyViewAttributes
in interface TCImport
tco
- TCObject to be attributes applied tomap
- attributes to be appliedpublic void removeViewAttributes(TCObject tco, Object[] keys)
removeViewAttributes
in interface TCImport
keys
- keys of attributes to be removedpublic void removeViewAttributes(TCObject tco)
removeViewAttributes
in interface TCImport
public void attachSubclass(SubclassableTCObject stco, Class c)
attachSubclass
in interface TCImport
stco
- Class or ClassfulQDisc to attach class onc
- Class to be attachedpublic void detachSubclass(Class c)
detachSubclass
in interface TCImport
c
- Class to be dettachedpublic void detachAllSubclasses(SubclassableTCObject stco)
detachAllSubclasses
in interface TCImport
stco
- Class or ClassfulQDisc to detach class frompublic void attachQDisc(Class c, QDisc qd)
attachQDisc
in interface TCImport
c
- class to attach the QDisc onqd
- QDisc to attachpublic void detachQDisc(Class c)
detachQDisc
in interface TCImport
c
- Class whose QDisc is to be detachedpublic void detachQDisc(QDisc qd)
detachQDisc
in interface TCImport
qd
- QDisc to detachpublic void addFilter(FilterContainer fc, Filter f)
addFilter
in interface TCImport
fc
- FilterContainer to add filter tof
- Filter to addpublic void insertFilterAt(FilterContainer fc, Filter f, int index)
insertFilterAt
in interface TCImport
fc
- FilterContainer to add filter tof
- Filter to addindex
- position to insert the filter atpublic void detachFilter(Filter f)
detachFilter
in interface TCImport
f
- filter to detachpublic void addFilterElement(Filter f, FilterElement fe)
addFilterElement
in interface TCImport
f
- Filter to add the element tofe
- FilterElement to addpublic void insertFilterElementAt(Filter f, FilterElement fe, int index)
insertFilterElementAt
in interface TCImport
f
- Filter to add the element tofe
- Filter to addindex
- position to insert the filter element atpublic void detachFilterElement(FilterElement fe)
detachFilterElement
in interface TCImport
public void connectFilterMatch(FilterElement fe, Class c)
connectFilterMatch
in interface TCImport
fe
- matched FilterElementc
- matching Class
InvalidConnectionException
public void disconnectFilterMatch(FilterElement fe)
disconnectFilterMatch
in interface TCImport
fe
- FilterElement to be disconnectedpublic void disconnectFilterMatches(Class c)
disconnectFilterMatches
in interface TCImport
c
- Class to be disconnectedprotected void updateTCObjectContainerEntryBounds(Map attributes, Rectangle bounds, TCObjectContainerEntry[] tcoce, TCObjectContainer tcoc)
tcoce
- TCObjectContainerEntries to be updatedtcoc
- the TCObjectContainer to base new bounds onprotected TCObjectContainer getRootTCObjectContainer(TCObject tco)
protected TCObjectContainer getTCObjectContainer(TCObjectContainerEntry tcoe)
tcoe
- TCObjectContainerEntry
protected TCObjectContainerEntry[] getTCObjectContainerEntries(TCObjectContainer tcoc)
tcoc
- TCObjectContainer
public void connect(TCOutputPort port1, TCInputPort port2)
public void disconnectChild(TCObject child)
child
- child to be disconnectedprotected void setDefaultCursor()
protected String getDefaultQDiscName()
protected String getDefaultClassName()
protected String getDefaultFilterName()
protected String getDefaultFilterElementName()
public void test()
public void testExport()
public int isConnectable(TCPort port1, TCPort port2)
port1
- first port to connectport2
- second port to connect
public TCObjectView findLeafTCObjectView(org.jgraph.graph.CellView view, Point pt)
public TCObjectView findLeafTCObjectView(org.jgraph.graph.CellView[] views, Point pt)
public void removeEdgesConnectedToPort(TCPort port)
port
- port to be separatedpublic void placeClassfulQDisc()
public void placeClasslessQDisc()
public void placeFilter()
public void placeFilterElement()
public void placeClass()
public void undo()
public void redo()
public TCGraph getGraph()
protected void resetIDGenerators()
public JPopupMenu createPopupMenu(Point pt, Object cell)
pt
- point where the popup was requestedcell
- cell to create it for or null
public Iterator selectionHierarchyIterator(Class c)
c
- hierarchy class to return iterator for
public int selectionHierarchySize(Class c)
c
- hierarchy class to get cell count for
public void addTCEditorListener(TCEditorListener l)
l
- listener to addpublic void removeTCEditorListener(TCEditorListener l)
l
- listener to removeprotected int getTCEditorListenerCount()
protected void fireTCEditorEvent(TCEditorEvent tce, String method)
tce
- event to be passedmethod
- TCEditorListener's method to be the event passed to
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |