Class GridColumn
- java.lang.Object
-
- org.eclipse.nebula.paperclips.core.grid.GridColumn
-
public class GridColumn extends java.lang.ObjectDescribes the properties of a column in a GridPrint.
-
-
Field Summary
Fields Modifier and Type Field Description intalignThe default alignment for Prints in this column.private static java.util.regex.PatternANY_ALIGN_PATTERNprivate static java.util.regex.PatternCENTER_ALIGN_PATTERNstatic intDEFAULT_ALIGNThe default alignment used when alignment is not specified.static intDEFAULT_SIZEThe default size used when size is not specified.private static java.util.regex.PatternDEFAULT_SIZE_PATTERNstatic intDEFAULT_WEIGHTThe default weight used when weight is not specified.private static java.util.regex.PatternEXPLICIT_SIZE_PATTERNprivate static java.util.regex.PatternLEFT_ALIGN_PATTERNprivate static java.util.regex.PatternPREFERRED_SIZE_PATTERNprivate static java.util.regex.PatternRIGHT_ALIGN_PATTERNintsizeThe size property for this GridColumn.intweightThe weight of this column.private static java.util.regex.PatternWEIGHTED_PATTERNprivate static java.util.regex.PatternWEIGHTLESS_PATTERN
-
Constructor Summary
Constructors Constructor Description GridColumn(int align, int size, int weight)Constructs a GridColumn.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static intcheckAlign(int align)private static intcheckSize(int size)private static intcheckWeight(int grow)private static doubleconvertToPoints(double value, java.lang.String unit)(package private) GridColumncopy()booleanequals(java.lang.Object obj)inthashCode()private static booleanisAlign(java.lang.String alignmentString)static GridColumnparse(java.lang.String spec)Parses the given column spec and returns a GridColumn matching that spec.private static intparseAlign(java.lang.String alignmentString)private static intparseSize(java.lang.String sizeString)private static intparseWeight(java.lang.String weightString)
-
-
-
Field Detail
-
DEFAULT_ALIGN
public static final int DEFAULT_ALIGN
The default alignment used when alignment is not specified. Value is SWT.LEFT.- See Also:
- Constant Field Values
-
DEFAULT_SIZE
public static final int DEFAULT_SIZE
The default size used when size is not specified. Value is SWT.DEFAULT.- See Also:
- Constant Field Values
-
DEFAULT_WEIGHT
public static final int DEFAULT_WEIGHT
The default weight used when weight is not specified. Value is 0.- See Also:
- Constant Field Values
-
size
public final int size
The size property for this GridColumn. Possible values:- GridPrint.PREFERRED - indicates that the column should be as wide as the preferred width of its widest element.
- SWT.DEFAULT - Similar to GridPrint.PREFERRED, except that the column may shrink down to its minimum width if space is scarce.
- A value > 0 indicates that the column should be
sizepoints wide (72pts = 1").
-
align
public final int align
The default alignment for Prints in this column. Possible values are SWT.LEFT, SWT.CENTER, SWT.RIGHT, or SWT.DEFAULT. Note that alignment affects the placement of PrintPieces within the grid's cell--the alignment elements of the PrintPiece themselves are not affected. Thus, in order to achieve the desired effect, a Print having an alignment property should be set to the same alignment as the grid cell it is added to. For example, a TextPrint in a right-aligned grid cell should be set to right alignment as well.Cells that span multiple columns use the alignment of the left-most cell in the cell span.
-
weight
public final int weight
The weight of this column. If the available print space is wider than the grid's preferred width, this field determines how much of that extra space should be given to this column. A larger weight causes the column to receive more of the extra width. A value of 0 indicates that the column should not be given any excess width.
-
LEFT_ALIGN_PATTERN
private static final java.util.regex.Pattern LEFT_ALIGN_PATTERN
-
CENTER_ALIGN_PATTERN
private static final java.util.regex.Pattern CENTER_ALIGN_PATTERN
-
RIGHT_ALIGN_PATTERN
private static final java.util.regex.Pattern RIGHT_ALIGN_PATTERN
-
ANY_ALIGN_PATTERN
private static final java.util.regex.Pattern ANY_ALIGN_PATTERN
-
DEFAULT_SIZE_PATTERN
private static final java.util.regex.Pattern DEFAULT_SIZE_PATTERN
-
PREFERRED_SIZE_PATTERN
private static final java.util.regex.Pattern PREFERRED_SIZE_PATTERN
-
EXPLICIT_SIZE_PATTERN
private static final java.util.regex.Pattern EXPLICIT_SIZE_PATTERN
-
WEIGHTLESS_PATTERN
private static final java.util.regex.Pattern WEIGHTLESS_PATTERN
-
WEIGHTED_PATTERN
private static final java.util.regex.Pattern WEIGHTED_PATTERN
-
-
Method Detail
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
checkAlign
private static int checkAlign(int align)
-
checkSize
private static int checkSize(int size)
-
checkWeight
private static int checkWeight(int grow)
-
parse
public static GridColumn parse(java.lang.String spec)
Parses the given column spec and returns a GridColumn matching that spec.Format:
[align:]size[:grow] align = L | LEFT | C | CENTER | R | RIGHT size = P | PREF | PREFERRED | D | DEF | DEFAULT | (Positive number)[PT|IN|INCH|CM|MM] weight = N | NONE | G | GROW | G(#) | GROW(#)The default alignment is LEFT. Theweightargument expresses the weight property: NONE indicates a weight of 0; GROW indicates a weight of 1; and GROW(3) indicates a weight of 3. The default weight (ifweightis omitted) is 0.Examples:
LEFT:DEFAULT:GROW // left-aligned, default size, weight=1 R:72PT:N // light-aligned, 72 points (1") wide, weight=0 right:72 // identical to previous line c:pref:none // center-aligned, preferred size, weight=0 p // left-aligned (default), preferred size, weight=0 r:2inch // right-aligned, 2 inches (50.8mm) r:50.8mm // right-aligned, 50.8 mm (2")
-
isAlign
private static boolean isAlign(java.lang.String alignmentString)
-
parseAlign
private static int parseAlign(java.lang.String alignmentString)
-
parseSize
private static int parseSize(java.lang.String sizeString)
-
convertToPoints
private static double convertToPoints(double value, java.lang.String unit)
-
parseWeight
private static int parseWeight(java.lang.String weightString)
-
copy
GridColumn copy()
-
-