Oxygen XML Editor 12.2 Author API

ro.sync.ecss.extensions.api
Class WidthRepresentation

java.lang.Object
  extended by ro.sync.ecss.extensions.api.WidthRepresentation

public class WidthRepresentation
extends java.lang.Object

Specifies the fixed and relative width determined from the value of width/colwidth attribute of the col.


Nested Class Summary
static class WidthRepresentation.Unit
          The fixed width unit.
 
Field Summary
static WidthRepresentation DEFAULT_WIDTH_REPRESENTATION
          The default width representation.
 
Constructor Summary
WidthRepresentation(float fixedWidthValue, WidthRepresentation.Unit fixedWidthUnit, float relativeWidth, boolean isRelativeToParent)
          Constructor.
WidthRepresentation(java.lang.String widthString, boolean acceptPercents)
          Constructor.
 
Method Summary
 float getFixedWidth()
           
 WidthRepresentation.Unit getFixedWidthUnit()
           
 float getRelativeWidth()
           
 java.lang.String getWidthRepresentation()
           
 boolean isApplicable()
           
 boolean isRelativeToParent()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_WIDTH_REPRESENTATION

public static WidthRepresentation DEFAULT_WIDTH_REPRESENTATION
The default width representation.

Constructor Detail

WidthRepresentation

public WidthRepresentation(float fixedWidthValue,
                           WidthRepresentation.Unit fixedWidthUnit,
                           float relativeWidth,
                           boolean isRelativeToParent)
Constructor.

Parameters:
fixedWidthValue - The fixed width value. Ex: 2.5
fixedWidthUnit - The unit of fixed width. Defaults to PIXEL.
relativeWidth - The relative width part. Ex: 0.33
isRelativeToParent - If true then the relative width represents a percentage of the parent table width, otherwise the relative value represent a proportional width which is evaluated taking into account the proportional values of the other columns.
For example, if there are two columns with 70% and 30% relative widths then the table total width will be divided according with this values.
If the relative widths for the two columns are specified in proportional units and, for example, have the values 1 for the first column and 2 for the second column then the second column will be twice as large as the first one.

WidthRepresentation

public WidthRepresentation(java.lang.String widthString,
                           boolean acceptPercents)
Constructor. Create a ColWidth corresponding to the given width representation.

Parameters:
widthString - The string representation of the Width. The representation format must be a sum of terms with the following format: n(*|%|units). If there are more that one terms with the same form (fixed or relative) then corresponding width (fixed or relative) will be reseted.
acceptPercents - If true then percentage values are accepted
Method Detail

getFixedWidth

public float getFixedWidth()
Returns:
Returns the fixed width part of the width representation. Ex: 2.5

getFixedWidthUnit

public WidthRepresentation.Unit getFixedWidthUnit()
Returns:
Returns the fixed width unit. Ex: Unit.CENTIMETER

getRelativeWidth

public float getRelativeWidth()
Returns:
Returns the relative width part of the width representation.

isRelativeToParent

public boolean isRelativeToParent()
Returns:
Returns true if the relative part of the width is expressed relative to the parent width, false if is expressed relative to other siblings.

isApplicable

public boolean isApplicable()
Returns:
true if the current width representation should be taken into account when building the layout.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

getWidthRepresentation

public java.lang.String getWidthRepresentation()
Returns:
The string representation of the width. The format of the width is
[fixed_width][fixed_width_unit] + [relative_width %|*]

Oxygen XML Editor 12.2 Author API

© Copyright SyncRO Soft SRL 2002 - 2010.