public class SizeConfig extends Object implements IPersistable
Modifier and Type | Field and Description |
---|---|
static String |
PERSISTENCE_KEY_DEFAULT_SIZE |
static String |
PERSISTENCE_KEY_DEFAULT_SIZES |
static String |
PERSISTENCE_KEY_PERCENTAGE_SIZING |
static String |
PERSISTENCE_KEY_RESIZABLE_BY_DEFAULT |
static String |
PERSISTENCE_KEY_RESIZABLE_INDEXES |
static String |
PERSISTENCE_KEY_SIZES |
DOT, VALUE_SEPARATOR
Constructor and Description |
---|
SizeConfig(int defaultSize)
Create a new
SizeConfig with the given default size. |
Modifier and Type | Method and Description |
---|---|
void |
calculatePercentages(int space,
int positionCount)
Will calculate the real pixel values for the positions if percentage sizing is enabled.
|
int |
getAggregateSize(int position) |
int |
getSize(int position) |
boolean |
isAllPositionsSameSize() |
boolean |
isPercentageSizing() |
boolean |
isPositionResizable(int position)
Checks if there is a special resizable configuration for the given position.
|
boolean |
isResizableByDefault() |
void |
loadState(String prefix,
Properties properties)
Restore the state out of the given Properties identified by the specified prefix.
|
void |
saveState(String prefix,
Properties properties)
Saves the state to the given Properties using the specified prefix.
|
void |
setDefaultSize(int size) |
void |
setDefaultSize(int position,
int size) |
void |
setPercentage(int position,
int percentage)
Will set the given percentage for the given position if this
SizeConfig
is configured for percentage sizing. |
void |
setPercentageSizing(boolean percentageSizing) |
void |
setPositionResizable(int position,
boolean resizable)
Sets the resizable configuration for the given row/column position.
|
void |
setResizableByDefault(boolean resizableByDefault)
Sets the global resizable configuration.
|
void |
setSize(int position,
int size)
Sets the given size for the given position.
|
public static final String PERSISTENCE_KEY_DEFAULT_SIZE
public static final String PERSISTENCE_KEY_DEFAULT_SIZES
public static final String PERSISTENCE_KEY_SIZES
public static final String PERSISTENCE_KEY_RESIZABLE_BY_DEFAULT
public static final String PERSISTENCE_KEY_RESIZABLE_INDEXES
public static final String PERSISTENCE_KEY_PERCENTAGE_SIZING
public SizeConfig(int defaultSize)
SizeConfig
with the given default size.defaultSize
- The default size to use.public void saveState(String prefix, Properties properties)
IPersistable
saveState
in interface IPersistable
prefix
- The prefix to use for the state keys. Is also used as the state
configuration name.properties
- The Properties instance to save the state to.public void loadState(String prefix, Properties properties)
IPersistable
loadState
in interface IPersistable
prefix
- The prefix to use for the state keys. Is also used as the state
configuration name.properties
- The Properties instance to load the state from.public void setDefaultSize(int size)
public void setDefaultSize(int position, int size)
public int getAggregateSize(int position)
public int getSize(int position)
public void setSize(int position, int size)
DataLayer
and will be called on resizing within the rendered UI. This is why there
is a check for percentage configuration. If this SizeConfig
is configured to not use
percentage sizing, the size is taken as is. If percentage sizing is enabled, the given size
will be calculated to percentage value based on the already known pixel values.
If you want to use percentage sizing you should use setPercentage(int, int)
for manual size configuration to avoid unnecessary calculations.position
- The position for which the size should be set.size
- The size in pixels to set for the given position.public void setPercentage(int position, int percentage)
SizeConfig
is configured for percentage sizing.position
- percentage
- public boolean isResizableByDefault()
SizeConfig
.public boolean isPositionResizable(int position)
position
- The position of the row/column for which the resizable information is requested.true
if the given row/column position is resizable,
false
if not.public void setPositionResizable(int position, boolean resizable)
position
- The position of the row/column for which the resizable configuration should be set.resizable
- true
if the given row/column position should be resizable,
false
if not.public void setResizableByDefault(boolean resizableByDefault)
resizableByDefault
- true
if all rows/columns should be resizable,
false
if no row/column should be resizable.public boolean isAllPositionsSameSize()
public boolean isPercentageSizing()
true
if the size of the positions is interpreted percentaged,
false
if the size of the positions is interpreted by pixel.public void setPercentageSizing(boolean percentageSizing)
percentageSizing
- true
if the size of the positions should be interpreted percentaged,
false
if the size of the positions should be interpreted by pixel.public void calculatePercentages(int space, int positionCount)
space
- The space that is available for rendering.positionCount
- The number of positions that should be handled by this SizeConfig
Copyright © 2013. All Rights Reserved.