public class TDataBox extends java.lang.Object implements java.beans.PropertyChangeListener, java.io.Serializable, Batchable
Element
instances.
In TWaver, all business objects displayed on components are contained
and managed by a databox. Data box will notify its listeners
when an object is added, removed, cleared, index changed or any property value changed.
use following code to create a databox and connect to several TWaver components:
TDataBox box = new TDataBox(); TNetwork network = new TNetwork(box); TTree tree = new TTree(box); TTable table = new TTable(box); TPropertySheet sheet = new TPropertySheet(box);
You can operate data in databox with APIs or XML. Databox also can output all contained data into XML or Java serializable binary.
The databox is a data model without graphical interface. It can connect one or more TWaver components and "drive" the components. Once the data changed, all connected components will be updated automatically. Normally, you can connect tree, network, table and property sheet components to a databox to share the network data. In this case, you only need to maintenance the same set of data.
The main features of databox are:
Databox comes with a AlarmModel which used to save and mange all alarm
instances. See AlarmModel
for more information.
Databox has an alarm propagator used to propagate alarm state.
See AlarmPropagator
for more information.
More information about databox, please see
document TWaver Developer Guide for details.
AlarmModel}
,
AlarmPropagator}
,
Element}
,
DataBoxSelectionModel}
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected java.util.Map |
clientProperties |
Constructor and Description |
---|
TDataBox()
Creates a data box instance with name "DataBox".
|
TDataBox(java.util.List elements)
Create a databox by given list.
|
TDataBox(java.lang.String name)
Create a data box with a given name.
|
TDataBox(java.lang.String name,
java.util.List elements)
Creates a databox instance by given name and list.
|
Modifier and Type | Method and Description |
---|---|
void |
addBatchListener(BatchListener l)
Adds a batch listener to this data box.
|
void |
addDataBoxListener(DataBoxListener l)
Adds a listener to the databox that's notified when a
change of the databox occurs.
|
void |
addDataBoxSequenceListener(DataBoxSequenceListener l)
Adds a listener to the list that's notified when element's sequence change.
|
void |
addElement(Element element)
Adds an element into this databox.
|
void |
addElement(Element element,
Element parentOfRootElement)
Adds the element into this data box with given root parent element.
|
void |
addElement(int index,
Element element)
Adds an element into this databox.
|
void |
addElementPropertyChangeListener(java.beans.PropertyChangeListener l)
Adds an element property change listener into this databox.
|
void |
addElements(java.util.Collection collection)
Adds a collection of elements into data box.
|
void |
addElements(java.util.Collection collection,
Element parentOfRootElement)
Adds a collection of elements into data box.
|
void |
addElementWithDescendant(Element element)
Adds the specified element with all descendant into this data box
|
void |
addElementWithDescendant(Element element,
VisibleFilter filter)
Adds the specified element with all descendant into this data box.
|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener on this data box.
|
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener for a specific property.
|
void |
alignBottomSelection()
Makes all selected elements align at bottom with the lowest selected element.
|
void |
alignCenterSelection()
Makes all selected elements align at horizontal center positon.
|
void |
alignLeftSelection()
Makes all selected elements align at left with the leftest selected element.
|
void |
alignMiddleSelection()
Makes all selected elements align at vertical middle positon.
|
void |
alignRightSelection()
Makes all selected elements align at right with the rightest selected element.
|
void |
alignTopSelection()
Makes all selected elements align at top with the topest selected element.
|
void |
bottomPileSelection()
Makes all selected elements piled from bottom.
|
java.util.Enumeration |
breadthFirstEnumeration()
Gets an enumeration visit all elements in breadth-first rule.
|
java.util.Enumeration |
breadthFirstEnumeration(Element root)
Gets an enumeration visit all children elements in breadth-first rule.
|
void |
clear()
Removes all contained elements away from this databox.
|
void |
clearAllElementAlarmState()
Clears all alarm state of elements contained in this data box.
|
boolean |
contains(Element element)
Checks whether this databox contains the given element.
|
boolean |
containsByID(java.lang.Object id)
Checks whether this databox contains the element with the given id.
|
void |
copySelection()
Copies all selected elements.
|
DataBoxQuickFinder |
createClientPropertyFinder(java.lang.String clientPropertyKey)
Creates a data quick finder which find elements by a given client property name.
|
DataBoxQuickFinder |
createClientPropertyFinder(java.lang.String clientPropertyKey,
java.lang.Class elementClass)
Creates a data quick finder which find elements by a given client property name.
|
DataBoxQuickFinder |
createJavaBeanFinder(java.lang.String propertyName)
Creates a data quick finder which find element by
a standard java bean property name.
|
DataBoxQuickFinder |
createJavaBeanFinder(java.lang.String propertyName,
java.lang.Class elementClass)
Creates a data quick finder which find element by
a standard java bean property name and property class type.
|
DataBoxQuickFinder |
createUserPropertyFinder(java.lang.String userPropertyKey)
Creates a data quick finder which find elements by a given user property name.
|
DataBoxQuickFinder |
createUserPropertyFinder(java.lang.String userPropertyKey,
java.lang.Class elementClass)
Creates a data quick finder which find elements by a user property key.
|
java.util.Enumeration |
depthFirstEnumeration()
Gets an enumeration visit all elements in depth-first rule.
|
java.util.Enumeration |
depthFirstEnumeration(Element root)
Gets an enumeration visit all children elements in depth-first rule.
|
void |
endBatch()
Terminates a batch of modifications.
|
void |
evenHSpaceSelection()
Makes all selected elements with even horizontal space.
|
void |
evenVSpaceSelection()
Makes all selected elements with even vertical space.
|
void |
fireIndexChanged(Element element) |
protected void |
firePropertyChange(java.lang.String propertyName,
boolean oldValue,
boolean newValue)
Support for reporting bound property changes for boolean properties.
|
protected void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
Support for reporting bound property changes for Object properties.
|
AlarmModel |
getAlarmModel()
Gets alarm model comes with this databox instance.
|
AlarmPropagator |
getAlarmPropagator()
Gets the alarm propagator of this databox.
|
java.util.List |
getAllElements()
Returns a new list contained all elements in this databox.
|
java.util.List |
getAllElementsReverse()
Returns a new list contained all elements in this databox in a
reversed order.
|
Background |
getBackground()
Gets the background for this data box.
|
java.util.List |
getBundledLinks(Link link) |
java.util.List |
getBundledLinks(Node node1,
Node node2)
Gets a list of bundled links between the given node1 and node2.
|
int |
getChildIndex(Element element)
Get the
|
java.util.Map |
getClientProperties()
Gets all client properties stored in this data box.
|
java.lang.Object |
getClientProperty(java.lang.Object key)
Returns the value of the client property with the given key.
|
Element |
getElementByID(java.lang.Object id)
Gets the element which id is equals to specified id.
|
Element |
getElementByName(java.lang.String name)
Returns the first element which name is equals to
the given name.
|
Element |
getElementByTag(java.lang.String tag)
Gets the element which equipment tag is equal to the given tag.
|
java.util.List |
getElementPropertyChangeListeners()
Returns a list contains all element property change listeners.
|
java.util.List |
getElementsByType(java.lang.Class clazz)
Returns a list of elements which are assignable from the specified class.
|
twaver.base.obfuscate.network.gif.GifElementFinder |
getGifIconFinder()
Internal use only.
|
twaver.base.obfuscate.network.gif.GifElementFinder |
getGifImageFinder()
Internal use only.
|
java.lang.Object |
getID()
Gets the id of this data box.
|
Element |
getLastSelectedElement()
Gets the last selected element.
|
LayerModel |
getLayerModel()
Gets the layer model of this data box.
|
java.util.List |
getLayers()
Gets layer container which contains all elements.
|
Generator |
getLinkBundleAgentGenerator()
Gets default link bundle agent generator for this data box.
|
VisibleFilter |
getLinkBundleFilter()
Gets the link bundle filter for this data box.
|
java.lang.String |
getName()
Gets the name for this databox.
|
java.beans.PropertyChangeSupport |
getPropertyChangeSupport()
Gets the PropertyChangeSupport instance comes with this databox.
|
Element |
getRandomElement()
Gets a random element from this box.
|
java.util.List |
getRootElements()
Gets all elements whose parent is null.
|
java.util.List |
getRootElementsReverse()
Gets all elements whose parent is null.
|
DataBoxSelectionModel |
getSelectionModel()
Gets the bound selection model object of this databox.
|
UndoRedoManager |
getUndoRedoManager()
Gets the UndoRedoManager object of this data box.
|
java.lang.String |
getVersion()
Gets the version for this data box.
|
int |
indexOf(Element element)
Return the sequence index of the given element in this data box.
|
boolean |
isBatching()
Checks whether this data box is in batch phase.
|
boolean |
isEmpty()
Checks whether this databox is empty.
|
boolean |
isEnableAdjustIndex()
Determines whether this data box is enable to adjust element index.
|
boolean |
isTagLinkWhenAlarmStateChanged()
Determines whether to tag link when element's alarm state changed.
|
java.util.Iterator |
iterator()
Returns an iterator of the elements in this box.
|
java.util.Iterator |
iterator(java.lang.Class clazz)
Returns an iterator of the elements in this box that
are assignable from the specified class.
|
void |
iterator(ElementCallbackHandler handler)
Calls the method to go through all elements in this data box,
The ElementCallbackHandler object will be called processElement(Element)
method during the iteration, if processElement method return false, then
the subsequent elements will not be processed anymore.
|
void |
iteratorByLayer(ElementCallbackHandler handler)
Calls the method to go through all elements in this data box by layer,
The ElementCallbackHandler object will be called processElement(Element)
method during the iteration, if processElement method return false, then
the subsequent elements will not be processed anymore.
|
java.util.Iterator |
iteratorReverse()
Returns an iterator of the elements in this box.
|
void |
iteratorReverse(ElementCallbackHandler handler)
Calls the method to go through all elements in this data box reversely,
The ElementCallbackHandler object will be called processElement(Element)
method during the iteration, if processElement method return false, then
the subsequent elements will not be processed anymore.
|
void |
iteratorReverseByLayer(ElementCallbackHandler handler)
Calls the method to go through all elements in this data box by layer reversely,
The ElementCallbackHandler object will be called processElement(Element)
method during the iteration, if processElement method return false, then
the subsequent elements will not be processed anymore.
|
void |
iteratorSelection(ElementCallbackHandler handler)
Calls the method to go through all selected elements in this data box,
The ElementCallbackHandler object will be called processElement(Element)
method during the iteration, if processElement method return false, then
the subsequent elements will not be processed anymore.
|
void |
leftPileSelection()
Makes all selected elements piled from left.
|
java.util.ListIterator |
listIterator(int index)
Returns a list iterator of the elements
in this databox (in proper sequence),
starting at the specified position in the list index.
|
void |
loadSubNetwork(TSubNetwork subNetwork)
Loads subnetwork's descendant data.
|
void |
loadSubNetwork(TSubNetwork subNetwork,
java.awt.Component component)
Loads subnetwork's descendant data.
|
static void |
moveElements(java.util.Iterator elements,
MovableFilter movableFilter,
double xOffset,
double yOffset)
Calls this method to move specified elements by given x offset and y offset.
|
void |
moveSelectionToBottom()
Moves all selected elements to the bottom position level.
|
void |
moveSelectionToDown()
Moves all selected elements to the one more lower position.
|
void |
moveSelectionToTop()
Moves all selected elements to the top position level.
|
void |
moveSelectionToUp()
Moves all selected elements to the one more upper position.
|
void |
moveTo(int index,
Element element)
Moves the specified element to a new index position at the same level.
|
void |
moveToBottom(Element element)
Moves the given element to the bottom of its position level.
|
void |
moveToDown(Element element)
Moves given element to one step lower position.
|
void |
moveToTop(Element element)
Moves the given element to top (index 0) in its position level.
|
void |
moveToUp(Element element)
Moves the specified element to the one more upper position.
|
void |
output(DataBoxOutputSetting outputSetting)
Writes out all contained data into output stream that carried
by DataBoxOutputSetting object in xml format.
|
void |
output(java.io.OutputStream out,
boolean withElementId)
Writes out all contained data into given output stream in xml format.
|
void |
output(java.lang.String fileName,
boolean withElementId)
Writes out all contained data into the specified xml file.
|
void |
output(java.lang.String fileName,
boolean withElementId,
boolean withAlarmState,
ElementPersistentFilter elementFilter,
ClientPropertyPersistentFilter clientPropertyFilter)
Writes out all contained data into the specified xml file.
|
void |
output(java.lang.String fileName,
DataBoxOutputSetting outputSetting)
Writes out all contained data into the specified xml file.
|
void |
outputJar(java.io.OutputStream out)
output data box to a outputStream by jar format
|
void |
outputJar(java.lang.String fileName)
output data box to file by jar format
|
void |
parse(java.io.InputStream in)
Parses xml data from given input stream.
|
void |
parse(java.io.InputStream in,
Element parentOfRootElement)
Parses xml data from an input stream, and sets all created
elements as children of given root element.
|
void |
parse(java.lang.String url)
Parses xml data from a specified file.
|
void |
parse(java.lang.String url,
Element parentOfRootElement)
Parses xml data from a file name, and set all created
elements as children of given root element.
|
void |
parseJar(java.io.InputStream in)
Parse jar input stream into this data box.
|
void |
parseJar(java.io.InputStream in,
Element parentOfRootElement)
Parse jar input stream into this data box.
|
void |
parseJar(java.lang.String filename)
Parse jar file into this data box.
|
void |
parseJar(java.lang.String filename,
Element parentOfRootElement)
Parse jar file into this data box.
|
void |
parseXML(java.lang.String xml)
Parses xml data from given string object.
|
void |
parseXML(java.lang.String xml,
Element parent)
Parses xml date from given string object with given parent element.
|
java.util.List |
pasteElements(Element parentElement)
Calls this method to add all element created from copied elements
into this databox.
|
void |
propertyChange(java.beans.PropertyChangeEvent e) |
void |
putClientProperty(java.lang.Object key,
java.lang.Object value)
Adds an arbitrary key/value "client property" to this data box.
|
void |
removeBatchListener(BatchListener l)
Removes a batch listener from this data box.
|
void |
removeDataBoxListener(DataBoxListener l)
Removes a listener from the box that's notified each
time a change to the element occurs.
|
void |
removeDataBoxSequenceListener(DataBoxSequenceListener l)
Removes a listener to the list that's notified when element's sequence change.
|
void |
removeDescendant(Element element)
Removes all the element's descendant from this databox.
|
boolean |
removeElement(Element element)
Removes an element from this databox.
|
Element |
removeElementByID(java.lang.Object id)
Removes an element by given element id.
|
void |
removeElementPropertyChangeListener(java.beans.PropertyChangeListener l)
Removes an element property change listener from this databox.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from this data box.
|
void |
removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener for a specific property.
|
void |
removeSelectedElements()
Removes all selected elements from this databox.
|
void |
reverseBundleExpand(Link link) |
void |
rightPileSelection()
Makes all selected elements piled from right.
|
void |
sameHeightSelection()
Makes all selected elements have the same height with the first selected element.
|
void |
sameWidthSelection()
Makes all selected elements have the same width with the first selected element.
|
void |
selectAll()
Selects all elements contained in this data box.
|
java.util.Iterator |
selection()
Returns an element iterator of all selected elements.
|
void |
sendToBottom(Element element)
Sends given element to the bottom index.
|
void |
sendToBottom(Element element,
Element referenceElement)
Sends given element to the layer below reference element.
|
void |
sendToTop(Element element)
Sends the given element to the toppest index.
|
void |
setAlarmPropagator(AlarmPropagator alarmPropagator)
Sets the alarm propagator of this databox.
|
void |
setBackground(Background background)
Sets a new background for this data box.
|
void |
setEnableAdjustIndex(boolean enableAdjustIndex)
Sets whether this data box is enable to adjust element index.
|
void |
setID(java.lang.Object id)
Sets a new id value for this data box.
|
void |
setLinkBundleAgentGenerator(Generator linkBundleAgentGenerator)
Sets a new link bundle agent generator for this data box.
|
void |
setLinkBundleFilter(VisibleFilter linkBundleFilter)
Sets the link bundle filter for this data box.
|
void |
setName(java.lang.String name)
Sets a new name for this databox.
|
void |
setSelectionModel(DataBoxSelectionModel selectionModel)
Sets specified selection model for this box.
|
void |
setTagLinkWhenAlarmStateChanged(boolean tagLinkWhenAlarmStateChanged)
Sets whether to tag link when element's alarm state changed.
|
void |
setVersion(java.lang.String version)
Sets the version for this data box.
|
int |
size()
Returns the total number of elements this databox contained.
|
void |
startBatch()
Starts a batch of modifications.
|
void |
tagLinkIndex(Link link)
Tags all links's bundle index between the given link's
fromAgentNode and toAgentNode.
|
void |
tagLinkIndex(Node node1,
Node node2)
Tags all links's bundle index between the given node1 and node2.
|
byte[] |
toJarBytes()
translate data box to jar bytes format
|
void |
topPileSelection()
Makes all selected elements piled from top.
|
java.lang.String |
toXML()
Returns the xml string of all contained data in this data box.
|
java.lang.String |
toXML(DataBoxOutputSetting setting)
Returns the xml string of all contained data in this data box
with given DataBoxOutputSetting object
|
public TDataBox()
public TDataBox(java.lang.String name)
name
- the data box namepublic TDataBox(java.util.List elements)
Most of the cases you don't need to create databox by this constructor.
elements
- List list used to save element datapublic TDataBox(java.lang.String name, java.util.List elements)
Most of the cases you don't need to create databox by this constructor.
name
- String databox nameelements
- List element listpublic boolean isBatching()
isBatching
in interface Batchable
public void startBatch()
startBatch
in interface Batchable
endBatch()
public void endBatch()
endBatch
in interface Batchable
startBatch()
public void addBatchListener(BatchListener l)
addBatchListener
in interface Batchable
l
- a batch listener to be added.removeBatchListener(BatchListener)
public void removeBatchListener(BatchListener l)
removeBatchListener
in interface Batchable
l
- a batch listener to be removed.addBatchListener(BatchListener)
public void setBackground(Background background)
background
- a new background for this data box.public Background getBackground()
public java.lang.String getName()
public void setName(java.lang.String name)
name
- a new name for this databox.public java.lang.Object getClientProperty(java.lang.Object key)
key
- the being queriednull
putClientProperty(java.lang.Object, java.lang.Object)
public java.util.Map getClientProperties()
public void putClientProperty(java.lang.Object key, java.lang.Object value)
key
- the client property keyvalue
- the new client property value;getClientProperty(Object)
,
addPropertyChangeListener(PropertyChangeListener)
,
#putUserProperty(Object, Object)
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- the PropertyChangeListener to be added.getPropertyChangeSupport()
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
propertyName
- the name of the property to listen on.listener
- the PropertyChangeListener to be added.getPropertyChangeSupport()
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- the PropertyChangeListener to be removed.getPropertyChangeSupport()
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
propertyName
- the name of the property to listen on.listener
- the PropertyChangeListener to be removed.getPropertyChangeSupport()
public AlarmModel getAlarmModel()
AlarmModel
for more details about alarm model.AlarmModel}
public LayerModel getLayerModel()
LayerModel
public java.beans.PropertyChangeSupport getPropertyChangeSupport()
protected void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
propertyName
- the property whose value has changedoldValue
- the property's previous valuenewValue
- the property's new valueprotected void firePropertyChange(java.lang.String propertyName, boolean oldValue, boolean newValue)
propertyName
- the property whose value has changedoldValue
- the property's previous valuenewValue
- the property's new valuepublic void addDataBoxSequenceListener(DataBoxSequenceListener l)
l
- the listener to be added.public void removeDataBoxSequenceListener(DataBoxSequenceListener l)
l
- the listener to be removed.public void fireIndexChanged(Element element)
public void addDataBoxListener(DataBoxListener l)
l
- the listener to be added.public void removeDataBoxListener(DataBoxListener l)
l
- the listener to be removed.public DataBoxSelectionModel getSelectionModel()
public Element getLastSelectedElement()
getSelectionModel().lastElement()
public java.util.Iterator selection()
public void setSelectionModel(DataBoxSelectionModel selectionModel)
selectionModel
- the new selection model.public Element getElementByID(java.lang.Object id)
id
- the querying element id.public Element getRandomElement()
public Element getElementByName(java.lang.String name)
Please note that this method only return the first
matched element. If you want more flexible ways to
search elements by conditions, use class
twaver.DataBoxQuickFinder
.
name
- the querying element namepublic Element getElementByTag(java.lang.String tag)
tag
- the equrying tagpublic boolean containsByID(java.lang.Object id)
id
- the querying element idpublic boolean contains(Element element)
element
- Element element need to checkpublic void addElement(Element element) throws java.lang.IllegalArgumentException
element
- the element to be addjava.lang.IllegalArgumentException
- thrown If the element id
is duplicate with an existed elementpublic void addElement(int index, Element element)
index
- the root element indexelement
- the element to be addpublic int size()
public int getChildIndex(Element element)
element
- Elementpublic boolean removeElement(Element element)
element
- the element to be removedpublic Element removeElementByID(java.lang.Object id)
id
- the given element id which to be removedpublic void removeSelectedElements()
public java.util.Iterator iterator()
public java.util.Iterator iteratorReverse()
public void iterator(ElementCallbackHandler handler)
handler
- the element handler that will be called back during the iteration.public void iteratorSelection(ElementCallbackHandler handler)
handler
- the element handler that will be called back during the iteration.public void iteratorReverse(ElementCallbackHandler handler)
handler
- the element handler that will be called back during the iteration.public void iteratorReverseByLayer(ElementCallbackHandler handler)
handler
- the element handler that will be called back during the iteration.public void iteratorByLayer(ElementCallbackHandler handler)
handler
- the element handler that will be called back during the iteration.public java.util.Iterator iterator(java.lang.Class clazz)
clazz
- the the specified class type.public java.util.List getElementsByType(java.lang.Class clazz)
clazz
- the the specified class type.public boolean isEmpty()
public java.util.ListIterator listIterator(int index)
index
- int index of the first element to be returned
from the list iterator (by a call to the next method).public java.util.List getAllElements()
public java.util.List getAllElementsReverse()
public java.util.List getRootElements()
public java.util.List getRootElementsReverse()
public void clear()
public int indexOf(Element element)
element
- the element to be checkedpublic void sendToTop(Element element)
element
- the element will be sent to top.public void sendToBottom(Element element)
element
- the element to be sent to bottomsendToTop(Element)
public void sendToBottom(Element element, Element referenceElement)
element
- the element to be sent.referenceElement
- the reference elementsendToBottom(Element)
public AlarmPropagator getAlarmPropagator()
public void setAlarmPropagator(AlarmPropagator alarmPropagator)
alarmPropagator
- the new alarm propagator.public void propertyChange(java.beans.PropertyChangeEvent e)
propertyChange
in interface java.beans.PropertyChangeListener
e
- PropertyChangeEventpublic void addElementPropertyChangeListener(java.beans.PropertyChangeListener l)
l
- the listener to be addedpublic void removeElementPropertyChangeListener(java.beans.PropertyChangeListener l)
l
- the listener to be removedpublic java.util.List getElementPropertyChangeListeners()
public void parseJar(java.io.InputStream in) throws java.io.IOException
java.io.IOException
public void parseJar(java.io.InputStream in, Element parentOfRootElement) throws java.io.IOException
java.io.IOException
public void outputJar(java.lang.String fileName) throws java.io.IOException
java.io.IOException
public byte[] toJarBytes() throws java.io.IOException
java.io.IOException
public void outputJar(java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void parseJar(java.lang.String filename) throws java.io.IOException
java.io.IOException
public void parseJar(java.lang.String filename, Element parentOfRootElement) throws java.io.IOException
java.io.IOException
public void parse(java.io.InputStream in) throws java.io.IOException
in
- a input stream contains xml data.java.io.IOException
- thrown if any I/O exception occurpublic void parse(java.lang.String url) throws java.io.IOException
fileName
- a filename contains xml datajava.io.IOException
- thrown if any I/O exception occurpublic void parse(java.io.InputStream in, Element parentOfRootElement) throws java.io.IOException
in
- an input stream contains xml dataparentOfRootElement
- the parent element for all parsed elements whose parent is null.java.io.IOException
- thrown if any I/O exception occurpublic void parse(java.lang.String url, Element parentOfRootElement) throws java.io.IOException
url
- a filename where contains the xml dataparentOfRootElement
- the parent element for all parsed elements whose parent is null.java.io.IOException
- thrown if any I/O exception occurpublic void output(java.lang.String fileName, boolean withElementId) throws java.io.IOException
fileName
- the file name data will outputwithElementId
- whether output element id. True output element id, false otherwise.java.io.IOException
- thrown if any I/O exception occurpublic void output(java.lang.String fileName, boolean withElementId, boolean withAlarmState, ElementPersistentFilter elementFilter, ClientPropertyPersistentFilter clientPropertyFilter) throws java.io.IOException
fileName
- the file name data will write into.withElementId
- true if output element id, false otherwise.withAlarmState
- true if output alarm state, false otherwise.elementFilter
- a persistent filter used to determine which element property should be write out.clientPropertyFilter
- a persistent filter used to determine
which client property should be write out.java.io.IOException
- thrown if any I/O exception occurpublic void output(java.lang.String fileName, DataBoxOutputSetting outputSetting) throws java.io.IOException
fileName
- the file name data will write into.outputSetting
- the setting that carrys parameters for outputing xmljava.io.IOException
- thrown if any I/O exception occurpublic void output(DataBoxOutputSetting outputSetting) throws java.io.IOException
outputSetting
- the setting that carrys parameters for outputing xmljava.io.IOException
- thrown if any I/O exception occurpublic void output(java.io.OutputStream out, boolean withElementId) throws java.io.IOException
out
- the output stream all data will be writed intowithElementId
- true if output element id, false otherwise.java.io.IOException
- thrown if any I/O exception occurpublic twaver.base.obfuscate.network.gif.GifElementFinder getGifImageFinder()
public twaver.base.obfuscate.network.gif.GifElementFinder getGifIconFinder()
public void selectAll()
public java.util.List getLayers()
public java.util.Enumeration depthFirstEnumeration()
public java.util.Enumeration depthFirstEnumeration(Element root)
root
- the root elementpublic java.util.Enumeration breadthFirstEnumeration()
public java.util.Enumeration breadthFirstEnumeration(Element root)
root
- the root elementpublic void addElementWithDescendant(Element element)
element
- the element and its descendant to be addedpublic void addElementWithDescendant(Element element, VisibleFilter filter)
element
- the element and its descendant to be addedfilter
- the filter used to filte the elements that don't need to be added.public void removeDescendant(Element element)
element
- the element whose descendant to be removed.public DataBoxQuickFinder createJavaBeanFinder(java.lang.String propertyName)
propertyName
- the property name to be queriedpublic DataBoxQuickFinder createJavaBeanFinder(java.lang.String propertyName, java.lang.Class elementClass)
propertyName
- the property name to be queriedelementClass
- the class type of queried elementpublic DataBoxQuickFinder createClientPropertyFinder(java.lang.String clientPropertyKey)
clientPropertyKey
- the client property key to be queriedpublic DataBoxQuickFinder createClientPropertyFinder(java.lang.String clientPropertyKey, java.lang.Class elementClass)
clientPropertyKey
- the client property key to be queriedelementClass
- the class type of queried elementpublic DataBoxQuickFinder createUserPropertyFinder(java.lang.String userPropertyKey)
userPropertyKey
- the user property key to be queriedpublic DataBoxQuickFinder createUserPropertyFinder(java.lang.String userPropertyKey, java.lang.Class elementClass)
userPropertyKey
- the user property key to be queriedelementClass
- the class type of queried elementpublic Generator getLinkBundleAgentGenerator()
TUIManager.getLinkBundleAgentGenerator()
public void setLinkBundleAgentGenerator(Generator linkBundleAgentGenerator)
linkBundleAgentGenerator
- the new link bundle agent generator.TUIManager.setLinkBundleAgentGenerator(Generator)
public void reverseBundleExpand(Link link)
public void tagLinkIndex(Link link)
link
- the given link to be tagged.public void tagLinkIndex(Node node1, Node node2)
node1
- the one node to be tagged.node2
- the another one node to be tagged.public java.util.List getBundledLinks(Link link)
public java.util.List getBundledLinks(Node node1, Node node2)
node1
- the one node.node2
- the another one node.getLinkBundleFilter()
public void moveTo(int index, Element element)
element
- the element to be movedindex
- int the new index position.public void moveToUp(Element element)
element
- the element to be moved uppublic void moveToDown(Element element)
element
- the element to be moved downpublic void moveToTop(Element element)
element
- the element to be moved to toppublic void moveToBottom(Element element)
element
- the element to be moved to bottompublic void moveSelectionToUp()
public void moveSelectionToDown()
public void moveSelectionToTop()
public void moveSelectionToBottom()
public void copySelection()
public java.util.List pasteElements(Element parentElement)
parentElement
- the parent elmenet for the elements whose parent is null.TWaverUtil.setCopyElements(List)
,
TWaverUtil.getPasteOffset()
,
Element.copy(TDataBox)
public void sameHeightSelection()
public void sameWidthSelection()
public void alignBottomSelection()
public void alignCenterSelection()
public void alignLeftSelection()
public void alignMiddleSelection()
public void alignRightSelection()
public void alignTopSelection()
public void evenHSpaceSelection()
public void evenVSpaceSelection()
public void bottomPileSelection()
public void leftPileSelection()
public void topPileSelection()
public void rightPileSelection()
public static void moveElements(java.util.Iterator elements, MovableFilter movableFilter, double xOffset, double yOffset)
iterator
- the iterator contains elements to be moved.filter
- the filter used to filte elements that don't need to be moved.xOffset
- the offset of x coordinateyOffset
- the offset of y coordinatepublic UndoRedoManager getUndoRedoManager()
UndoRedoManager
public boolean isTagLinkWhenAlarmStateChanged()
public void setTagLinkWhenAlarmStateChanged(boolean tagLinkWhenAlarmStateChanged)
tagLinkWhenAlarmStateChanged
- If true tag link when
element's alarm state changed, false do nothing.public void loadSubNetwork(TSubNetwork subNetwork)
subNetwork
- the subnetwork to be loaded.DataLoader
public void loadSubNetwork(TSubNetwork subNetwork, java.awt.Component component)
subNetwork
- the subnetwork to be loaded.component
- the component that will be shownDataLoader
public void addElements(java.util.Collection collection)
Notice this method will obey some rules, such as the from and to node of a link should be added prior to link; parent element should be added prior to child; so if from node, to node or parent element are not in the data box, then they will be added firstly.
collection
- a collection of elements to be added.addElement(Element, Element)
public void addElements(java.util.Collection collection, Element parentOfRootElement)
Notice this method will obey some rules, such as the from and to node of a link should be added prior to link; parent element should be added prior to child; so if from node, to node or parent element are not in the data box, then they will be added firstly.
collection
- a collection of elements to be added.parentOfRootElement
- the root parent element for elements whose parent is null.addElement(Element, Element)
public void addElement(Element element, Element parentOfRootElement)
Notice this method will obey some rules, such as the from and to node of a link should be added prior to link; parent element should be added prior to child; so if from node, to node or parent element are not in the data box, then they will be added firstly.
element
- the element to be added.parentOfRootElement
- the root parent element for elements whose parent is null.public void parseXML(java.lang.String xml)
xml
- the given xml data.public void parseXML(java.lang.String xml, Element parent)
xml
- the given xml data.parent
- the parent element for elements whose parent is null.public java.lang.String toXML()
public java.lang.String toXML(DataBoxOutputSetting setting)
setting
- the DataBoxOutputSetting object that carries output paramters.public void clearAllElementAlarmState()
AlarmState.clear()
public boolean isEnableAdjustIndex()
public void setEnableAdjustIndex(boolean enableAdjustIndex)
enableAdjustIndex
- True if this data box is enable to
adjust element index, false otherwise.public java.lang.String getVersion()
The default version value is null, User can set version value for outputting xml.
setVersion(String)
,
TWaverUtil.getDataBoxVersion()
public void setVersion(java.lang.String version)
The default version value is null, User can set version value for outputting xml.
version
- the version for this data box.getVersion()
,
TWaverUtil.setDataBoxVersion(String)
public java.lang.Object getID()
The default id value is null, User can set id value to distinguish this data box from others.
public void setID(java.lang.Object id)
The default id value is null, User can set id value to distinguish this data box from others.
id
- public VisibleFilter getLinkBundleFilter()
public void setLinkBundleFilter(VisibleFilter linkBundleFilter)
linkBundleFilter
- the link bundle filter for this data box.getLinkBundleFilter()
,
getBundledLinks(Node, Node)
Copyright © 2002 - 2010 Serva Software. All Rights Reserved.