com.yworks.yfiles.bpmn.view
Class CompositeMinimumSizeProvider

java.lang.Object
  extended bycom.yworks.yfiles.bpmn.view.CompositeMinimumSizeProvider
All Implemented Interfaces:
GenericNodeRealizer.GenericSizeConstraintProvider

public class CompositeMinimumSizeProvider
extends Object
implements GenericNodeRealizer.GenericSizeConstraintProvider

Restricts the minimum size of nodes by adding up minimum sizes from multiple GenericNodeRealizer.GenericSizeConstraintProvider implementations. Minimum sizes are added up either by adding up all height values and calculating the maximum width or by adding up all width values and calculating the maximum height.

 

Constructor Summary
CompositeMinimumSizeProvider(boolean vertical)
          Initializes a new CompositeMinimumSizeProvider instance.
 
Method Summary
 void addProvider(GenericNodeRealizer.GenericSizeConstraintProvider provider)
          Adds a size constraint provider whose minimum size has to be included in this provider's minimum size calculation.
protected  YDimension getMargin(NodeRealizer context)
          Returns a horizontal and vertical margin that is added to the width and height of the minimum size calculated by this size constraint provider.
 YDimension getMaximumSize(NodeRealizer context)
           
 YDimension getMinimumSize(NodeRealizer context)
          Calculates a minimum size for the specified node by adding up minimum sizes of all previously registered size constraint providers.
 double getOffset()
          Returns the offset that is added in-between two consecutive minimum sizes.
 boolean isVertical()
          Determines if minimum sizes are added up by width of by height.
 void removeProvider(GenericNodeRealizer.GenericSizeConstraintProvider provider)
          Removes a size constraint provider that has previously been added.
 void setOffset(double offset)
          Specifies the offset that is added in-between two consecutive minimum sizes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeMinimumSizeProvider

public CompositeMinimumSizeProvider(boolean vertical)
Initializes a new CompositeMinimumSizeProvider instance.

Parameters:
vertical - if true, minimum sizes are added up by height; otherwise minimum sizes are added up by width.
See Also:
isVertical()
Method Detail

isVertical

public boolean isVertical()
Determines if minimum sizes are added up by width of by height. If sizes are added up by height, the minimum size reported by this size constraint provider is the sum of all height values and the maximum of all width values. If sizes are added up by width, the minimum size reported by this size constraint provider is the sum of all width values and the maximum of all height values.

Returns:
true if minimum sizes are added up by height; false if minimum sizes are added up by width.

getOffset

public double getOffset()
Returns the offset that is added in-between two consecutive minimum sizes.

By default, the offset is 0.

Returns:
the offset that is added in-between two consecutive minimum sizes.
See Also:
setOffset(double)

setOffset

public void setOffset(double offset)
Specifies the offset that is added in-between two consecutive minimum sizes.

By default, the offset is 0.

Parameters:
offset - the offset that is added in-between two consecutive minimum sizes.
See Also:
getOffset()

addProvider

public void addProvider(GenericNodeRealizer.GenericSizeConstraintProvider provider)
Adds a size constraint provider whose minimum size has to be included in this provider's minimum size calculation.

Parameters:
provider - the size constraint provider to include.
See Also:
addProvider(y.view.GenericNodeRealizer.GenericSizeConstraintProvider), getMinimumSize(y.view.NodeRealizer)

removeProvider

public void removeProvider(GenericNodeRealizer.GenericSizeConstraintProvider provider)
Removes a size constraint provider that has previously been added.

Parameters:
provider - the size constraint provider to remove.
See Also:
addProvider(y.view.GenericNodeRealizer.GenericSizeConstraintProvider), getMinimumSize(y.view.NodeRealizer)

getMaximumSize

public YDimension getMaximumSize(NodeRealizer context)
Specified by:
getMaximumSize in interface GenericNodeRealizer.GenericSizeConstraintProvider

getMinimumSize

public YDimension getMinimumSize(NodeRealizer context)
Calculates a minimum size for the specified node by adding up minimum sizes of all previously registered size constraint providers. Minimum sizes are added up either by adding up all height values and calculating the maximum width or by adding up all width values and calculating the maximum height.

Specified by:
getMinimumSize in interface GenericNodeRealizer.GenericSizeConstraintProvider
Parameters:
context - the visualization of the node whose minimum size has to be determined.
Returns:
the minimum size for the specified node.
See Also:
addProvider(y.view.GenericNodeRealizer.GenericSizeConstraintProvider)

getMargin

protected YDimension getMargin(NodeRealizer context)
Returns a horizontal and vertical margin that is added to the width and height of the minimum size calculated by this size constraint provider. Called from getMinimumSize(y.view.NodeRealizer).

Parameters:
context - the visualization of the node whose minimum size has to be determined.
Returns:
a horizontal and vertical margin that is added to the width and height of the minimum size calculated by this size constraint provider.
See Also:
getMinimumSize(y.view.NodeRealizer), addProvider(y.view.GenericNodeRealizer.GenericSizeConstraintProvider)


© Copyright 2010-2014,
yWorks GmbH.
All rights reserved.