|
Zest 1.5.100.201405261516 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.zest.layouts.algorithms.AbstractLayoutAlgorithm
public abstract class AbstractLayoutAlgorithm
Handles common elements in all layout algorithms [irbull] Refactored into a template pattern. ApplyLayout now delegates the task to ApplyLayoutInternal [irbull] Included asynchronous layouts
Field Summary | |
---|---|
protected java.util.Comparator |
comparator
|
protected Filter |
filter
|
protected boolean |
internalAsynchronous
|
protected boolean |
internalContinuous
|
protected int |
layout_styles
|
protected boolean |
layoutStopped
|
static int |
MIN_ENTITY_SIZE
|
protected boolean |
resizeEntitiesAfterLayout
|
Constructor Summary | |
---|---|
AbstractLayoutAlgorithm(int styles)
Initializes the abstract layout algorithm. |
Method Summary | |
---|---|
void |
addEntity(LayoutEntity entity)
Queues up the given entity (if it isn't in the list) to be added to the algorithm. |
void |
addProgressListener(ProgressListener listener)
A layout algorithm could take an uncomfortable amout of time to complete. |
void |
addRelationship(LayoutRelationship relationship)
Queues up the given relationshp (if it isn't in the list) to be added to the algorithm. |
void |
applyLayout(LayoutEntity[] entitiesToLayout,
LayoutRelationship[] relationshipsToConsider,
double x,
double y,
double width,
double height,
boolean asynchronous,
boolean continuous)
This actually applies the layout |
protected abstract void |
applyLayoutInternal(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout,
org.eclipse.zest.layouts.dataStructures.InternalRelationship[] relationshipsToConsider,
double boundsX,
double boundsY,
double boundsWidth,
double boundsHeight)
Apply the layout to the given entities. |
protected void |
defaultFitWithinBounds(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout,
org.eclipse.zest.layouts.dataStructures.DisplayIndependentRectangle realBounds)
Find an appropriate size for the given nodes, then fit them into the given bounds. |
protected void |
defaultFitWithinBounds(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout,
org.eclipse.zest.layouts.dataStructures.InternalRelationship[] relationships,
org.eclipse.zest.layouts.dataStructures.DisplayIndependentRectangle realBounds)
Find an appropriate size for the given nodes, then fit them into the given bounds. |
protected void |
fireProgressEnded(int totalNumberOfSteps)
|
protected void |
fireProgressEvent(int currentStep,
int totalNumberOfSteps)
Fires an event to notify all of the registered ProgressListeners that another step has been completed in the algorithm. |
protected void |
fireProgressStarted(int totalNumberOfSteps)
|
protected abstract int |
getCurrentLayoutStep()
Gets the current layout step |
double |
getEntityAspectRatio()
Returns the width to height ratio this layout will use to set the size of the entities. |
protected org.eclipse.zest.layouts.dataStructures.DisplayIndependentRectangle |
getLayoutBounds(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout,
boolean includeNodeSize)
Find the bounds in which the nodes are located. |
protected org.eclipse.zest.layouts.dataStructures.DisplayIndependentPoint |
getLocalLocation(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout,
double x,
double y,
org.eclipse.zest.layouts.dataStructures.DisplayIndependentRectangle realBounds)
Gets the location in the layout bounds for this node |
protected int |
getNumberOfProgressListeners()
|
int |
getStyle()
Gets the current layout style |
protected abstract int |
getTotalNumberOfLayoutSteps()
Gets the total number of steps in this layout |
boolean |
isRunning()
Returns true if the layout algorithm is running |
protected abstract boolean |
isValidConfiguration(boolean asynchronous,
boolean continuous)
Determines if the configuration is valid for this layout |
protected abstract void |
postLayoutAlgorithm(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout,
org.eclipse.zest.layouts.dataStructures.InternalRelationship[] relationshipsToConsider)
Code called after the layout algorithm ends |
protected abstract void |
preLayoutAlgorithm(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout,
org.eclipse.zest.layouts.dataStructures.InternalRelationship[] relationshipsToConsider,
double x,
double y,
double width,
double height)
Code called before the layout algorithm starts |
void |
removeEntity(LayoutEntity entity)
Queues up the given entity to be removed from the algorithm next time it runs. |
void |
removeProgressListener(ProgressListener listener)
Removes the given progress listener, preventing it from receiving any more updates. |
void |
removeRelationship(LayoutRelationship relationship)
Queues up the given relationship to be removed from the algorithm next time it runs. |
void |
removeRelationships(java.util.Collection collection)
|
void |
removeRelationships(java.util.List relationships)
Queues up all the relationships in the list to be removed. |
void |
setComparator(java.util.Comparator comparator)
Determines the order in which the objects should be displayed. |
void |
setEntityAspectRatio(double ratio)
Set the width to height ratio you want the entities to use |
void |
setFilter(Filter filter)
Filters the entities and relationships to apply the layout on |
abstract void |
setLayoutArea(double x,
double y,
double width,
double height)
|
void |
setStyle(int style)
Sets the current layout style. |
void |
stop()
Stops the current layout from running. |
protected void |
updateBendPoints(org.eclipse.zest.layouts.dataStructures.InternalRelationship[] relationshipsToConsider)
Update external bend points from the internal bendpoints list. |
protected org.eclipse.zest.layouts.dataStructures.InternalNode[] |
updateEntities(org.eclipse.zest.layouts.dataStructures.InternalNode[] entities)
Updates the given array of entities checking if any need to be removed or added. |
protected void |
updateLayoutLocations(org.eclipse.zest.layouts.dataStructures.InternalNode[] nodes)
Updates the layout locations so the external nodes know about the new locations |
protected org.eclipse.zest.layouts.dataStructures.InternalRelationship[] |
updateRelationships(org.eclipse.zest.layouts.dataStructures.InternalRelationship[] relationships)
Updates the given array of relationships checking if any need to be removed or added. |
static boolean |
verifyInput(LayoutEntity[] entitiesToLayout,
LayoutRelationship[] relationshipsToConsider)
Verifies the endpoints of the relationships are entities in the entitiesToLayout list. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MIN_ENTITY_SIZE
protected java.util.Comparator comparator
protected Filter filter
protected boolean internalContinuous
protected boolean internalAsynchronous
protected boolean layoutStopped
protected int layout_styles
protected boolean resizeEntitiesAfterLayout
Constructor Detail |
---|
public AbstractLayoutAlgorithm(int styles)
LayoutStyles
Method Detail |
---|
public void removeRelationships(java.util.Collection collection)
public void addEntity(LayoutEntity entity)
addEntity
in interface LayoutAlgorithm
entity
- public void addRelationship(LayoutRelationship relationship)
addRelationship
in interface LayoutAlgorithm
relationship
- public void removeEntity(LayoutEntity entity)
removeEntity
in interface LayoutAlgorithm
entity
- The entity to removepublic void removeRelationship(LayoutRelationship relationship)
removeRelationship
in interface LayoutAlgorithm
relationship
- The relationship to remove.public void removeRelationships(java.util.List relationships)
removeRelationships
in interface LayoutAlgorithm
relationships
- public void setStyle(int style)
setStyle
in interface LayoutAlgorithm
style
- public int getStyle()
getStyle
in interface LayoutAlgorithm
public abstract void setLayoutArea(double x, double y, double width, double height)
protected abstract boolean isValidConfiguration(boolean asynchronous, boolean continuous)
asynchronous
- continuous
- protected abstract void applyLayoutInternal(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout, org.eclipse.zest.layouts.dataStructures.InternalRelationship[] relationshipsToConsider, double boundsX, double boundsY, double boundsWidth, double boundsHeight)
entitiesToLayout
- Apply the algorithm to these entitiesrelationshipsToConsider
- Only consider these relationships when applying the algorithm.x
- The left side of the bounds in which the layout can place the entities.y
- The top side of the bounds in which the layout can place the entities.width
- The width of the bounds in which the layout can place the entities.height
- The height of the bounds in which the layout can place the entities.protected org.eclipse.zest.layouts.dataStructures.InternalNode[] updateEntities(org.eclipse.zest.layouts.dataStructures.InternalNode[] entities)
entities
- the current entities
protected org.eclipse.zest.layouts.dataStructures.InternalRelationship[] updateRelationships(org.eclipse.zest.layouts.dataStructures.InternalRelationship[] relationships)
relationships
- the current relationships
public boolean isRunning()
isRunning
in interface LayoutAlgorithm
public void stop()
stop
in interface LayoutAlgorithm
stop
in interface Stoppable
protected abstract void preLayoutAlgorithm(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout, org.eclipse.zest.layouts.dataStructures.InternalRelationship[] relationshipsToConsider, double x, double y, double width, double height)
protected abstract void postLayoutAlgorithm(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout, org.eclipse.zest.layouts.dataStructures.InternalRelationship[] relationshipsToConsider)
protected abstract int getTotalNumberOfLayoutSteps()
protected abstract int getCurrentLayoutStep()
public void applyLayout(LayoutEntity[] entitiesToLayout, LayoutRelationship[] relationshipsToConsider, double x, double y, double width, double height, boolean asynchronous, boolean continuous) throws InvalidLayoutConfiguration
applyLayout
in interface LayoutAlgorithm
entitiesToLayout
- Apply the algorithm to these entitiesrelationshipsToConsider
- Only consider these relationships when applying the algorithm.x
- The left side of the bounds in which the layout can place the entities.y
- The top side of the bounds in which the layout can place the entities.width
- The width of the bounds in which the layout can place the entities.height
- The height of the bounds in which the layout can place the entities.asynchronous
- Should the algorithm run Asynchronously
InvalidLayoutConfiguration
protected void updateBendPoints(org.eclipse.zest.layouts.dataStructures.InternalRelationship[] relationshipsToConsider)
relationshipsToConsider
- public void setFilter(Filter filter)
setFilter
in interface LayoutAlgorithm
public void setComparator(java.util.Comparator comparator)
setComparator
in interface LayoutAlgorithm
public static boolean verifyInput(LayoutEntity[] entitiesToLayout, LayoutRelationship[] relationshipsToConsider)
protected org.eclipse.zest.layouts.dataStructures.DisplayIndependentPoint getLocalLocation(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout, double x, double y, org.eclipse.zest.layouts.dataStructures.DisplayIndependentRectangle realBounds)
x
- y
-
protected void defaultFitWithinBounds(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout, org.eclipse.zest.layouts.dataStructures.DisplayIndependentRectangle realBounds)
protected void defaultFitWithinBounds(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout, org.eclipse.zest.layouts.dataStructures.InternalRelationship[] relationships, org.eclipse.zest.layouts.dataStructures.DisplayIndependentRectangle realBounds)
protected org.eclipse.zest.layouts.dataStructures.DisplayIndependentRectangle getLayoutBounds(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout, boolean includeNodeSize)
public void setEntityAspectRatio(double ratio)
setEntityAspectRatio
in interface LayoutAlgorithm
public double getEntityAspectRatio()
getEntityAspectRatio
in interface LayoutAlgorithm
public void addProgressListener(ProgressListener listener)
addProgressListener
in interface LayoutAlgorithm
addProgressListener
in interface Stoppable
public void removeProgressListener(ProgressListener listener)
removeProgressListener
in interface LayoutAlgorithm
protected void updateLayoutLocations(org.eclipse.zest.layouts.dataStructures.InternalNode[] nodes)
protected void fireProgressStarted(int totalNumberOfSteps)
protected void fireProgressEnded(int totalNumberOfSteps)
protected void fireProgressEvent(int currentStep, int totalNumberOfSteps)
currentStep
- The current step completed.totalNumberOfSteps
- The total number of steps in the algorithm.protected int getNumberOfProgressListeners()
|
Zest 1.5.100.201405261516 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |