Class Padding
java.lang.Object
uk.ac.starlink.ttools.plot2.Padding
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the required bottom margin.getLeft()Returns the required left margin.getRight()Returns the required right margin.getTop()Returns the required top margin.inthashCode()booleanReturns true if all the members of this padding object are non-null.overrideInsets(Insets insets) Applies the requirements specified by this object to an existing Insets object.static InsetsReturns a non-null insets object based on a supplied Insets which will be modified by the state of a supplied Padding.Returns the insets object corresponding to this padding object if all the members are non-null, and null otherwise.
-
Constructor Details
-
Padding
public Padding()Constructs an empty padding object (no preferences). -
Padding
Constructs a padding object with preferences for all dimensions. Any of the arguments may be null.- Parameters:
top- required top margin in pixels, or nullleft- required left margin in pixels, or nullbottom- required bottom margin in pixels, or nullright- required right margin in pixels, or null
-
-
Method Details
-
getTop
Returns the required top margin.- Returns:
- top margin in pixels, or null for no preference
-
getLeft
Returns the required left margin.- Returns:
- left margin in pixels, or null for no preference
-
getBottom
Returns the required bottom margin.- Returns:
- bottom margin in pixels, or null for no preference
-
getRight
Returns the required right margin.- Returns:
- right margin in pixels, or null for no preference
-
overrideInsets
Applies the requirements specified by this object to an existing Insets object. The members of the returned insets object are those of this object where they are non-null, and those of the supplied insets otherwise.- Parameters:
insets- input insets object, not null- Returns:
- new insets object with values taken from this padding where available
-
isDefinite
public boolean isDefinite()Returns true if all the members of this padding object are non-null.- Returns:
- true iff all margins have definite values
-
toDefiniteInsets
Returns the insets object corresponding to this padding object if all the members are non-null, and null otherwise.- Returns:
- insets if
isDefinite(), otherwise null
-
hashCode
-
equals
-
padInsets
Returns a non-null insets object based on a supplied Insets which will be modified by the state of a supplied Padding.This convenience method calls
overrideInsets(Insets)ifpaddingis non-null, otherwise it returns the inputinsets.- Parameters:
padding- padding to override insets value, may be nullinsets- default insets, not null- Returns:
- effective insets
-