Modifier and Type | Field and Description |
---|---|
static int |
MAX_EXTRA_FIELDS
The maximum number of extra fields.
|
Constructor and Description |
---|
EditableStyle()
Creates an editable style from the default style.
|
EditableStyle(EditableStyle style)
Creates an editable style from an other one.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
Background |
getBackground()
Gets the background.
|
Outline |
getBorder()
Gets the border.
|
int |
getColor()
Gets the color.
|
Dimension |
getDimension()
Gets the dimension.
|
float |
getExtraFloat(int fieldId,
float defaultValue)
Gets an extra field as a float.
|
int |
getExtraInt(int fieldId,
int defaultValue)
Gets an extra field as an int.
|
<T> T |
getExtraObject(int fieldId,
Class<T> clazz,
T defaultValue)
Gets an extra field as an object of the given type.
|
Font |
getFont()
Gets the font.
|
int |
getHorizontalAlignment()
Gets the horizontal alignment.
|
Outline |
getMargin()
Gets the margin.
|
Outline |
getPadding()
Gets the padding.
|
int |
getVerticalAlignment()
Gets the vertical alignment.
|
int |
hashCode()
Returns a hash code value for the object.
|
void |
setBackground(Background background)
Sets the background.
|
void |
setBorder(Outline border)
Sets the border.
|
void |
setColor(int color)
Sets the color.
|
void |
setDimension(Dimension dimension)
Sets the dimension.
|
void |
setExtraFloat(int fieldId,
float fieldValue)
Sets an extra field to the given float value.
|
void |
setExtraInt(int fieldId,
int fieldValue)
Sets an extra field to the given int value.
|
void |
setExtraObject(int fieldId,
Object fieldValue)
Sets an extra field to the given object value.
|
void |
setFont(Font font)
Sets the font.
|
void |
setHorizontalAlignment(int horizontalAlignment)
Sets the horizontal alignment.
|
void |
setMargin(Outline margin)
Sets the margin.
|
void |
setPadding(Outline padding)
Sets the padding.
|
void |
setVerticalAlignment(int verticalAlignment)
Sets the vertical alignment.
|
protected static void |
validateExtraFieldId(int fieldId)
Validates that the extra field ID is correct.
|
public static final int MAX_EXTRA_FIELDS
public EditableStyle()
public EditableStyle(EditableStyle style)
style
- the editable style to copy.public boolean equals(@Nullable Object obj)
Object
The equals
method implements an equivalence relation on non-null object references:
x
, x.equals(x)
should return true
.
x
and y
,
x.equals(y)
should return true
if and only if y.equals(x)
returns
true
.
x
, y
, and
z
, if x.equals(y)
returns true
and y.equals(z)
returns
true
, then x.equals(z)
should return true
.
x
and y
, multiple
invocations of x.equals(y)
consistently return true
or consistently return
false
, provided no information used in equals
comparisons on the objects is
modified.
x
, x.equals(null)
should return
false
.
The equals
method for class Object
implements the most discriminating possible
equivalence relation on objects; that is, for any non-null reference values x
and
y
, this method returns true
if and only if x
and y
refer to the
same object (x == y
has the value true
).
Note that it is generally necessary to override the hashCode
method whenever this method
is overridden, so as to maintain the general contract for the hashCode
method, which
states that equal objects must have equal hash codes.
equals
in class Object
obj
- the reference object with which to compare.true
if this object is the same as the obj argument; false
otherwise.Object.hashCode()
,
HashMap
public Background getBackground()
Style
getBackground
in interface Style
public int getColor()
Style
public Dimension getDimension()
Style
getDimension
in interface Style
public float getExtraFloat(int fieldId, float defaultValue)
Style
getExtraFloat
in interface Style
fieldId
- the ID of the extra field.defaultValue
- the value to return if the extra field is not set or if it is not a float.public int getExtraInt(int fieldId, int defaultValue)
Style
getExtraInt
in interface Style
fieldId
- the ID of the extra field.defaultValue
- the value to return if the extra field is not set or if it is not an integer.public <T> T getExtraObject(int fieldId, Class<T> clazz, T defaultValue)
Style
getExtraObject
in interface Style
T
- the type of the extra field.fieldId
- the ID of the extra field.clazz
- the type of the extra field.defaultValue
- the value to return if the extra field is not set or if it does not match the given type.public int getHorizontalAlignment()
Style
getHorizontalAlignment
in interface Style
public Outline getPadding()
Style
getPadding
in interface Style
public int getVerticalAlignment()
Style
getVerticalAlignment
in interface Style
public int hashCode()
Object
HashMap
.
The general contract of hashCode
is:
hashCode
method must consistently return the same integer, provided no
information used in equals
comparisons on the object is modified. This integer need not
remain consistent from one execution of an application to another execution of the same
application.
equals(Object)
method, then calling the
hashCode
method on each of the two objects must produce the same integer result.
Object.equals(java.lang.Object)
method, then calling the hashCode
method on each of the two objects must produce distinct integer results. However, the programmer
should be aware that producing distinct integer results for unequal objects may improve the
performance of hash tables.
As much as is reasonably practical, the hashCode method defined by class Object
does
return distinct integers for distinct objects. (This is typically implemented by converting the
internal address of the object into an integer, but this implementation technique is not required
by the JavaTM programming language.)
hashCode
in class Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public void setBackground(Background background)
background
- the background to set.public void setBorder(Outline border)
border
- the border to set.public void setColor(int color)
color
- the color to set.public void setDimension(Dimension dimension)
dimension
- the dimension to set.public void setExtraFloat(int fieldId, float fieldValue)
fieldId
- the ID of the extra field to set.fieldValue
- the value of the extra field to set.IllegalArgumentException
- if the given ID is not within the [0, 6] interval.public void setExtraInt(int fieldId, int fieldValue)
fieldId
- the ID of the extra field to set.fieldValue
- the value of the extra field to set.IllegalArgumentException
- if the given ID is not within the [0, 6] interval.public void setExtraObject(int fieldId, Object fieldValue)
fieldId
- the ID of the extra field to set.fieldValue
- the value of the extra field to set.IllegalArgumentException
- if the given ID is not within the [0, 6] interval.public void setFont(Font font)
font
- the font to set.public void setHorizontalAlignment(int horizontalAlignment)
Alignment.LEFT
,
Alignment.HCENTER
or Alignment.RIGHT
).horizontalAlignment
- the horizontal alignment to set.IllegalArgumentException
- if the horizontal alignment is not valid.Alignment.validateHorizontalAlignment(int)
public void setMargin(Outline margin)
margin
- the margin to set.public void setPadding(Outline padding)
padding
- the padding to set.public void setVerticalAlignment(int verticalAlignment)
Alignment.TOP
,
Alignment.VCENTER
or Alignment.BOTTOM
).verticalAlignment
- the vertical alignment to set.IllegalArgumentException
- if the vertical alignment is not valid.Alignment.validateVerticalAlignment(int)
protected static void validateExtraFieldId(int fieldId)
fieldId
- the ID to validate.IllegalArgumentException
- if the given ID is not within the [0, 6] interval.