public class SpringLayouter
extends java.lang.Object
SpringLayouter
is designed for elements
to do layout automatically on network canvas with spring arithmetic.Constructor and Description |
---|
SpringLayouter(TDataBox box,
boolean layoutInSwingThread)
Creates a
SpringLayouter instance with specified data box. |
Modifier and Type | Method and Description |
---|---|
protected TDataBox |
getDataBox()
Gets the connected data box.
|
int |
getForceSize()
Gets the force size of spring layout parameter which will
affect the balance distance between elements.
|
java.awt.Rectangle |
getLimitBounds()
Gets the limit bounds for this spring layouter to limit the
elements doing layout inside the specified bounds area.
|
double |
getLinkRepulsionFactor()
Gets the link repulsion factor for this spring layouter which will
affect the balance distance between links.
|
MovableFilter |
getMovableFilter()
Gets the movable filter for this spring layouter, the
movable filter makes some elements fix in original location
when doing layout.
|
double |
getNodeRepulsionFactor()
Gets the node repulsion factor for this spring layouter which will
affect the balance distance between nodes.
|
int |
getStepSize()
Gets the step size of spring layout parameter which will
affect the balance time consumed for layout.
|
int |
getUpdateDuration()
Gets the update duration of spring layout parameter which will
affect the balance time consumed for layout.
|
VisibleFilter |
getVisibleFilter()
Gets the visible filter for this spring layouter, the
visible filter makes some elements will not participate
in doing layout.
|
void |
random(int offset,
int randomSize)
Calls this method to make the elements of data box dispersed randomly.
|
void |
setForceSize(int forceSize)
Sets the force size of spring layout parameter which will
affect the balance distance between elements.
|
void |
setLimitBounds(java.awt.Rectangle limitBounds)
Sets the limit bounds for this spring layouter to limit the
elements doing layout inside the specified bounds area.
|
void |
setLinkRepulsionFactor(double linkRepulsionFactor)
Sets the link repulsion factor for this spring layouter which will
affect the balance distance between links.
|
void |
setMovableFilter(MovableFilter movableFilter)
Sets the movable filter for this spring layouter, the
movable filter makes some elements fix in original location
when doing layout.
|
void |
setNodeRepulsionFactor(double nodeRepulsionFactor)
Sets the node repulsion factor for this spring layouter which will
affect the balance distance between nodes.
|
void |
setStepSize(int stepSize)
Sets the step size of spring layout parameter which will
affect the balance time consumed for layout.
|
void |
setUpdateDuration(int updateDuration)
Sets the update duration of spring layout parameter which will
affect the balance time consumed for layout.
|
void |
setVisibleFilter(VisibleFilter visibleFilter)
Sets the visible filter for this spring layouter to
make some elements will not participate in doing layout.
|
void |
start()
Calls this method to start doing layout of elements in data box.
|
void |
stop()
Calls this method to stop doing layout.
|
public SpringLayouter(TDataBox box, boolean layoutInSwingThread)
SpringLayouter
instance with specified data box.
Notice that if the data box is binding with TView components like network, You can only set the layoutInSwingThread parameter with true. if the data box isn't connected with any TView components, you can do layout in nomally thread.
box
- the connected data box.layoutInSwingThread
- True to do layout in swing thread, false in nomally thread.protected TDataBox getDataBox()
public void random(int offset, int randomSize)
offset
- the center offsetrandomSize
- the random size.public void start()
Notice that once start doing layout it will not stop by itself till you call #stop() method.
stop()
public void stop()
start()
public int getForceSize()
The default force size value is 100 pixels.
public void setForceSize(int forceSize)
The default force size value is 100 pixels.
forceSize
- the force size of spring layout parameter.public int getStepSize()
The default step size value is 30 pixels.
public void setStepSize(int stepSize)
The default step size value is 30 pixels.
stepSize
- the step size of spring layout parameter.public int getUpdateDuration()
The default update duration value is 10 millisecond.
public void setUpdateDuration(int updateDuration)
The default update duration value is 10 millisecond.
updateDuration
- public VisibleFilter getVisibleFilter()
public void setVisibleFilter(VisibleFilter visibleFilter)
visibleFilter
- the visible filter for this spring layouter.public MovableFilter getMovableFilter()
public void setMovableFilter(MovableFilter movableFilter)
movableFilter
- the movable filter for this spring layouterpublic java.awt.Rectangle getLimitBounds()
public void setLimitBounds(java.awt.Rectangle limitBounds)
limitBounds
- the limit bounds for this spring layouterpublic double getNodeRepulsionFactor()
public void setNodeRepulsionFactor(double nodeRepulsionFactor)
nodeRepulsionFactor
- the node repulsion factor for this spring layouterpublic double getLinkRepulsionFactor()
public void setLinkRepulsionFactor(double linkRepulsionFactor)
linkRepulsionFactor
- the link repulsion factor for this spring layouterCopyright © 2002 - 2010 Serva Software. All Rights Reserved.