public class Size extends Object
Size
is used by a LayoutBlock
to describe the layout
that fits to some size.Size
is. They are used in different cases:
type
is a hard restraint, it is used to filter layouts. Layouts with an odd mix of
preferred and minimum sizes are not legal and will never be applied. An example would: if the menu for overflowing
Dockable
s has a mimimum size, the list of tabs must have a minimum size as well.getScore()
is a soft restraint, it is used to order different layouts and to find the one layout
that fits best. Modifier and Type | Class and Description |
---|---|
static class |
Size.Type
What type of size a
Size describes. |
Constructor and Description |
---|
Size(Size.Type type,
Dimension size,
double score)
Creates a new size
|
Size(Size.Type type,
int width,
int height,
double score)
Creates a new size.
|
Modifier and Type | Method and Description |
---|---|
int |
getHeight()
Gets the vertical amount of pixels.
|
double |
getScore()
Tells how much this size is liked, a value of
1.0 indicates that
this is the best possible size, while a value of 0.0 indicates that this
size is as good as unusable |
Size.Type |
getType()
Gets the type of this size.
|
int |
getWidth()
Gets the horizontal amount of pixels.
|
boolean |
isMinimum()
Tells whether this
Size describes the minimum size
some component requires. |
boolean |
isPreferred()
Tells whether this
Size describes the preferred size
some component requires. |
Dimension |
toDimension()
Returns this size as
Dimension . |
String |
toString() |
public Size(Size.Type type, int width, int height, double score)
type
- what kind of size this describeswidth
- horizontal amount of pixelsheight
- vertical amount of pixelsscore
- how much this size is liked, a value of 1.0
indicates that
this is the best possible size, while a value of 0.0
indicates that this
size is as good as unusablepublic Size(Size.Type type, Dimension size, double score)
type
- what kind of size this describessize
- the amount of pixelsscore
- how much this size is liked, a value of 1.0
indicates that
this is the best possible size, while a value of 0.0
indicates that this
size is as good as unusablepublic boolean isMinimum()
Size
describes the minimum size
some component requires.true
if this is a minimum sizepublic boolean isPreferred()
Size
describes the preferred size
some component requires.true
if this is a preferred sizepublic Size.Type getType()
null
public int getWidth()
public int getHeight()
public double getScore()
1.0
indicates that
this is the best possible size, while a value of 0.0
indicates that this
size is as good as unusable