Arch4J 1.1

org.arch4j.ui.layout
Class AlignmentOriginConstraint

java.lang.Object
  |
  +--org.arch4j.ui.layout.OriginConstraint
        |
        +--org.arch4j.ui.layout.AlignmentOriginConstraint

public class AlignmentOriginConstraint
extends OriginConstraint

An AlignmentOriginConstraint is used with an instance of FractionalLayout to describe the layout of an unbounded figure. It provides for the 'location point' of the figure to be inset from the top and left edges of the figure. A couple of examples:

Version:
1.01, 04/18/96
Author:
Eric Lunt (elunt@mcs.net)
See Also:
FractionalLayout

Field Summary
 double leftAlignmentFraction
          A number between 0.0 and 1.0 which represents the inset of the location point from the left edge of the component.
 double topAlignmentFraction
          A number between 0.0 and 1.0 which represents the inset of the location point from the top edge of the component.
 
Fields inherited from class org.arch4j.ui.layout.OriginConstraint
left, leftFraction, top, topFraction
 
Constructor Summary
AlignmentOriginConstraint()
          Create an instanace of an AlignmentOriginConstraint.
AlignmentOriginConstraint(double lf, int l, double tf, int t, double laf, double taf)
          Create an instance of an AlignmentOriginConstraint given the left fraction, the left offset, the top fraction, the top offset, the left alignment fraction, and the top alignment fraction.
 
Method Summary
protected  int adjustedAlignmentLeft(Dimension componentSize)
          Given a component size, figure out the appropriate horizontal offset
protected  int adjustedAlignmentTop(Dimension componentSize)
          Given a component size, figure out the appropriate vertical offset
 Rectangle adjustedRectangle(Dimension containerSize, Dimension componentSize)
          Given the size of a container and the component size, return a Rectangle which appropriately bounds the component given this constraint.
 Dimension containSize(Dimension componentSize)
          Given the size of a component, return the smallest size container which could contain it given this constraint.
 
Methods inherited from class org.arch4j.ui.layout.OriginConstraint
adjustedLeft, adjustedTop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

leftAlignmentFraction

public double leftAlignmentFraction
A number between 0.0 and 1.0 which represents the inset of the location point from the left edge of the component.


topAlignmentFraction

public double topAlignmentFraction
A number between 0.0 and 1.0 which represents the inset of the location point from the top edge of the component.

Constructor Detail

AlignmentOriginConstraint

public AlignmentOriginConstraint()
Create an instanace of an AlignmentOriginConstraint. This will place the upper-left corner of the component at the upper-left corner of the container.


AlignmentOriginConstraint

public AlignmentOriginConstraint(double lf,
                                 int l,
                                 double tf,
                                 int t,
                                 double laf,
                                 double taf)
Create an instance of an AlignmentOriginConstraint given the left fraction, the left offset, the top fraction, the top offset, the left alignment fraction, and the top alignment fraction.

Parameters:
lf - the left fraction
l - the left offset
tf - the top fraction
t - the top offset
laf - the left alignment fraction
taf - the top alignment fraction
Method Detail

adjustedAlignmentLeft

protected int adjustedAlignmentLeft(Dimension componentSize)
Given a component size, figure out the appropriate horizontal offset

Parameters:
componentSize - the size of the component
Returns:
the pixel offset value for the left edge of the component

adjustedAlignmentTop

protected int adjustedAlignmentTop(Dimension componentSize)
Given a component size, figure out the appropriate vertical offset

Parameters:
componentSize - the size of the component
Returns:
the pixel offset value for the top edge of the component

adjustedRectangle

public Rectangle adjustedRectangle(Dimension containerSize,
                                   Dimension componentSize)
Given the size of a container and the component size, return a Rectangle which appropriately bounds the component given this constraint.

Overrides:
adjustedRectangle in class OriginConstraint
Parameters:
containerSize - the size of the container
componentSize - the size of the component
Returns:
the containing rectangle

containSize

public Dimension containSize(Dimension componentSize)
Given the size of a component, return the smallest size container which could contain it given this constraint.

Overrides:
containSize in class OriginConstraint
Parameters:
componentSize - the size of a component
Returns:
the minimum size of a container to satisfy this contraint

Arch4J 1.1

Copyright © 2000-2004 SpiderLogic, a service of Wipfli Ullrich Bertelson LLP.