public class NetworkElementRenderer
extends java.lang.Object
implements java.beans.PropertyChangeListener
getUIClassID
method to paint this element. By default, renderer install all UI class instance
into the UI table. If no UI class found, renderer will try to load the class
from disk by the package name of DEFAULT_UI_PACKAGE
.
Developer should override getUIClassID
method when subclasses
element object to specified which UI class it will used. If developer want create
new UI class, subclass ElementUI and package to DEFAULT_UI_PACKAGE
.
A renderer is also a PropertyChangeListener, when network or element property changed, renderer repaint relative element.
Constructor and Description |
---|
NetworkElementRenderer(TNetwork network)
Create a renderer to paint given network's elements.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeHandler(twaver.base.obfuscate.box.PropertyChangeHandler handler)
Add a property change handler into this renderer.
|
void |
clearUITable()
clear all elementUI from ui mapping table
|
boolean |
contains(Element element,
int x,
int y)
Check whether this element contains the specified point.
|
java.awt.Rectangle |
getBounds(Element element)
Returns an integer Rectangle that completely encloses the Element.
|
ElementUI |
getElementUI(Element element)
Get specified element's UI object.
|
TNetwork |
getNetwork()
Get the network component this renderer belong to.
|
java.util.Map |
getUITable() |
void |
propertyChange(java.beans.PropertyChangeEvent e)
This method gets called when a bound property is changed.
|
void |
removePropertyChangeHandler(twaver.base.obfuscate.box.PropertyChangeHandler handler)
remove the specified handler from this render.
|
void |
removeUITable(Element element)
remove the specified element's elementUI from ui mapping table
|
void |
repaint(java.util.Collection elements)
Repaint the specified elements's bounds.
|
void |
repaint(Element element)
Repaint the specified element's bounds.
|
void |
repaintLogicalBounds(java.awt.Rectangle bounds)
Repaint the specified logical bounds.
|
void |
repaintPhysicalBounds(java.awt.Rectangle bounds)
Repaint the specified physical bounds.
|
public NetworkElementRenderer(TNetwork network)
network
- network object.public void addPropertyChangeHandler(twaver.base.obfuscate.box.PropertyChangeHandler handler)
handler
- handler object.public void removePropertyChangeHandler(twaver.base.obfuscate.box.PropertyChangeHandler handler)
handler
- the handler will be removed.public boolean contains(Element element, int x, int y)
element
- element object.x
- the x coordinate of the point.y
- the y coordinate of the point.public ElementUI getElementUI(Element element)
getUIClassID
to get the ui class id, get the related ui class and return.element
- element object.public java.awt.Rectangle getBounds(Element element)
public void propertyChange(java.beans.PropertyChangeEvent e)
propertyChange
in interface java.beans.PropertyChangeListener
e
- event.public void repaint(Element element)
element
- the element need repaint.public void repaint(java.util.Collection elements)
element
- the element need repaint.public void repaintLogicalBounds(java.awt.Rectangle bounds)
bounds
- public void repaintPhysicalBounds(java.awt.Rectangle bounds)
bounds
- public void removeUITable(Element element)
element
- public void clearUITable()
public java.util.Map getUITable()
public TNetwork getNetwork()
Copyright © 2002 - 2010 Serva Software. All Rights Reserved.