Package com.privatejgoodies.forms.layout
Class PrototypeSize
- java.lang.Object
-
- com.privatejgoodies.forms.layout.PrototypeSize
-
- All Implemented Interfaces:
Size,java.io.Serializable
public final class PrototypeSize extends java.lang.Object implements Size, java.io.Serializable
ASizeimplementation that computes its width and height by a prototype String.Examples:
new PrototypeSize("123-456-789"); new FormLayout("p, 2dlu, 'MMMM'");- Since:
- 1.2
- Version:
- $Revision: 1.7 $
- Author:
- Karsten Lentzsch
- See Also:
Size,Sizes, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PrototypeSize(java.lang.String prototype)Constructs a PrototypeSize for the given String.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancompressible()Describes if this Size can be compressed, if container space gets scarce.java.lang.Stringencode()Returns a parseable string representation of this prototype size.booleanequals(java.lang.Object o)Indicates whether some other ConstantSize is "equal to" this one.java.lang.StringgetPrototype()Returns this size's prototype string.inthashCode()Returns a hash code value for the object.intmaximumSize(java.awt.Container container, java.util.List components, FormLayout.Measure minMeasure, FormLayout.Measure prefMeasure, FormLayout.Measure defaultMeasure)Computes and returns the width of this Size's prototype in pixel.java.lang.StringtoString()Returns a string representation of this size object.
-
-
-
Method Detail
-
getPrototype
public java.lang.String getPrototype()
Returns this size's prototype string.- Returns:
- the prototype string
-
maximumSize
public int maximumSize(java.awt.Container container, java.util.List components, FormLayout.Measure minMeasure, FormLayout.Measure prefMeasure, FormLayout.Measure defaultMeasure)Computes and returns the width of this Size's prototype in pixel. Ignores the component list and measures. Obtains the FontMetrics from the given layoutcontainerfor the default dialog font provided byDefaultUnitConverter.getDefaultDialogFont().Invoked by
FormSpecto determine the size of a column or row.- Specified by:
maximumSizein interfaceSize- Parameters:
container- the layout containercomponents- the list of components used to compute the sizeminMeasure- the measure that determines the minimum sizesprefMeasure- the measure that determines the preferred sizesdefaultMeasure- the measure that determines the default sizes- Returns:
- the
stringWidthfor this size's prototype string computed by thecontainer's FontMetrics for theDefaultUnitConverter's default dialog font
-
compressible
public boolean compressible()
Describes if this Size can be compressed, if container space gets scarce. Used by the FormLayout size computations in#compressedSizesto check whether a column or row can be compressed or not.PrototypeSizes are incompressible.
- Specified by:
compressiblein interfaceSize- Returns:
false
-
encode
public java.lang.String encode()
Returns a parseable string representation of this prototype size.
-
equals
public boolean equals(java.lang.Object o)
Indicates whether some other ConstantSize is "equal to" this one.- Overrides:
equalsin classjava.lang.Object- Parameters:
o- the Object with which to compare- Returns:
trueif this object is the same as the obj argument;falseotherwise.- See Also:
Object.hashCode(),Hashtable
-
hashCode
public int hashCode()
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided byjava.util.Hashtable.- Overrides:
hashCodein classjava.lang.Object- Returns:
- a hash code value for this object.
- See Also:
Object.equals(java.lang.Object),Hashtable
-
toString
public java.lang.String toString()
Returns a string representation of this size object. Note: This string representation may change at any time. It is intended for debugging purposes. For parsing, useencode()instead.- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of the constant size
-
-