|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.nebula.widgets.nattable.layer.SizeConfig
public class SizeConfig
This class stores the size configuration of rows/columns within the NatTable.
Mixed mode (fixed/percentage sizing):
The mixed mode is only working if percentage sizing is enabled globally, and
the fixed sized positions are marked separately.
| Field Summary | |
|---|---|
protected Map<Integer,Integer> |
aggregatedSizeCacheMap
Map that contains the cached aggregated sizes. |
protected int |
availableSpace
The available space needed for percentage calculation on resizing. |
protected int |
defaultSize
The global default size of this SizeConfig. |
protected Map<Integer,Integer> |
defaultSizeMap
Map that contains default sizes per column. |
protected IDpiConverter |
dpiConverter
The IDpiConverter that is used for scaling DPI conversion. |
protected boolean |
isAggregatedSizeCacheValid
Flag that indicates if the aggregated size cache is valid or if it needs to get recalculated. |
protected boolean |
percentageSizing
Flag to tell whether the sizing is done for pixel or percentage values. |
protected Map<Integer,Boolean> |
percentageSizingMap
Map that contains the percentage sizing information per row/column. |
static String |
PERSISTENCE_KEY_DEFAULT_SIZE
|
static String |
PERSISTENCE_KEY_DEFAULT_SIZES
|
static String |
PERSISTENCE_KEY_PERCENTAGE_SIZING
|
static String |
PERSISTENCE_KEY_PERCENTAGE_SIZING_INDEXES
|
static String |
PERSISTENCE_KEY_RESIZABLE_BY_DEFAULT
|
static String |
PERSISTENCE_KEY_RESIZABLE_INDEXES
|
static String |
PERSISTENCE_KEY_SIZES
|
protected Map<Integer,Integer> |
realSizeMap
Map that contains the real pixel size. |
protected boolean |
resizableByDefault
The global resizable information of this SizeConfig. |
protected Map<Integer,Boolean> |
resizablesMap
Map that contains the resizable information per row/column. |
protected Map<Integer,Integer> |
sizeMap
Map that contains sizes per column. |
| Fields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable |
|---|
DOT, VALUE_SEPARATOR |
| Constructor Summary | |
|---|---|
SizeConfig(int defaultSize)
Create a new SizeConfig with the given default size. |
|
| Method Summary | |
|---|---|
protected int |
calculateAvailableSpace(int space)
Calculates the available space for percentage size calculation. |
void |
calculatePercentages(int space,
int positionCount)
Will calculate the real pixel values for the positions if percentage sizing is enabled. |
protected int[] |
correctPercentageValues(int sum,
int positionCount)
This method is used to correct the calculated percentage values in case a user configured more than 100 percent. |
protected int |
downScale(int value)
Calculates the size value dependent on a possible configured scaling from DPI to pixel value. |
int |
getAggregateSize(int position)
|
int |
getDefaultSize()
|
int |
getSize(int position)
|
boolean |
isAllPositionsSameSize()
|
boolean |
isPercentageSizing()
|
boolean |
isPercentageSizing(int position)
Checks if there is a special percentage sizing configuration for the given position. |
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)
Set the default size that should be used in case there is no position based size configured. |
void |
setDefaultSize(int position,
int size)
|
void |
setDpiConverter(IDpiConverter dpiConverter)
|
void |
setPercentage(int position,
int percentage)
Will set the given percentage size information for the given position and will set the given position to be sized via percentage value. |
void |
setPercentageSizing(boolean percentageSizing)
|
void |
setPercentageSizing(int position,
boolean percentageSizing)
Sets the percentage sizing configuration for the given row/column position. |
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. |
void |
updatePercentageValues(int positionCount)
Recalculate the percentage values for the given amount of columns. |
protected int |
upScale(int value)
Calculates the size value dependent on a possible configured scaling from pixel to DPI value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
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 static final String PERSISTENCE_KEY_PERCENTAGE_SIZING_INDEXES
protected int defaultSize
SizeConfig.
protected final Map<Integer,Integer> defaultSizeMap
protected final Map<Integer,Integer> sizeMap
protected final Map<Integer,Boolean> resizablesMap
protected boolean resizableByDefault
SizeConfig.
protected final Map<Integer,Boolean> percentageSizingMap
protected boolean percentageSizing
protected int availableSpace
protected final Map<Integer,Integer> realSizeMap
protected final Map<Integer,Integer> aggregatedSizeCacheMap
protected boolean isAggregatedSizeCacheValid
protected IDpiConverter dpiConverter
IDpiConverter that is used for scaling DPI conversion.
| Constructor Detail |
|---|
public SizeConfig(int defaultSize)
SizeConfig with the given default size.
defaultSize - The default size to use.| Method Detail |
|---|
public void saveState(String prefix,
Properties properties)
IPersistable
saveState in interface IPersistableprefix - 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 IPersistableprefix - 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)
size - The default size to set.public int getDefaultSize()
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)
position - The positions whose percentage sizing information should be
set.percentage - The percentage value to set, always dependent on the available
space for percentage sizing, which can be less than the real
available space in case there are also positions that are
configured for fixed size.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 at least one position is
interpreted in percentage, false if the size of all
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 boolean isPercentageSizing(int position)
position - The position of the row/column for which the percentage sizing
information is requested.
true if the given row/column position is sized by
percentage value, false if not.
public void setPercentageSizing(int position,
boolean percentageSizing)
position - The position of the row/column for which the percentage sizing
configuration should be set.percentageSizing - true if the given row/column position should be
interpreted in percentage, false if not.
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
SizeConfigprotected int calculateAvailableSpace(int space)
space - The whole available space for rendering.
protected int[] correctPercentageValues(int sum,
int positionCount)
sum - The sum of all configured percentage sized positions.positionCount - The number of positions to check.
null in case no
correction happened.public void updatePercentageValues(int positionCount)
positionCount - The number of columns that should be used to calculate the
percentage values.protected int upScale(int value)
value - The value that should be up scaled.
IDpiConverter is configured, the
value itself if no IDpiConverter is set.IDpiConverter.convertPixelToDpi(int)protected int downScale(int value)
This method is used for percentage sizing calculations.
value - The value that should be down scaled.
IDpiConverter is configured, the
value itself if no IDpiConverter is set.public void setDpiConverter(IDpiConverter dpiConverter)
dpiConverter - The IDpiConverter to use for size scaling.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||