Oxygen XML Editor 12.2 Author API

ro.sync.ecss.css
Class RelativeLength

java.lang.Object
  extended by ro.sync.ecss.css.RelativeLength

public class RelativeLength
extends java.lang.Object

A length that may be expressed as an absolute or relative value, or as an "auto" value, that is to be computed at later time, by the layout engine.


Method Summary
static RelativeLength createAbsolute(int value)
          Create an absolute value length.
static RelativeLength createAuto()
          Create an automatic relative length.
static RelativeLength createRelative(float percentage)
          Create a relative length representing a relative value.
 boolean equals(java.lang.Object obj)
           
 int get(int referenceLength)
          Return the evaluated value of the RelativeLength given a reference value.
 int hashCode()
           
 boolean isAuto()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

createAbsolute

public static RelativeLength createAbsolute(int value)
Create an absolute value length.

Parameters:
value - The value of the absolute length.
Returns:
The new absolute value RelativeLength.

createRelative

public static RelativeLength createRelative(float percentage)
Create a relative length representing a relative value.

Parameters:
percentage - The percentage from the value this length will refer to. (e.g: 50%)
Returns:
The new relative value RelativeLength.

createAuto

public static RelativeLength createAuto()
Create an automatic relative length. This is just an immutable constant marker.

Returns:
The "auto" relative length. Always the same object.

get

public int get(int referenceLength)
Return the evaluated value of the RelativeLength given a reference value. If this object represents an absolute value, that value is simply returned. Otherwise, returns the given reference length multiplied by the given percentage divided to 100 and rounded to the nearest integer.

Parameters:
referenceLength - Reference length for percentage lengths.
Returns:
The actual value.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

toString

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

isAuto

public boolean isAuto()
Returns:
True if the relative length is automatic.

Oxygen XML Editor 12.2 Author API

© Copyright SyncRO Soft SRL 2002 - 2010.