com.davisor.graphics
Class BoxModelAttributes

java.lang.Object
  extended bycom.davisor.graphics.BoxModelAttributes
All Implemented Interfaces:
com.davisor.core.Dupable, java.io.Serializable

public class BoxModelAttributes
extends java.lang.Object
implements com.davisor.core.Dupable, java.io.Serializable

BoxModelAttributes represents a generic set of box model attributes. These attributes are base on CSS2 box model.

Each attribute can be set

  1. for top, bottom, left, and right elements OR
  2. for horizontal (left, right) and vertical (top, bottom) elements OR
  3. for all elements OR
  4. for any combination of these.
More accurate values, when given, override the more generic ones.

Since:
JDK1.2
See Also:
Serialized Form

Field Summary
static int BOTTOM
           
static int DEFAULT
           
static int HORIZONTAL
           
static int LEFT
           
protected  java.lang.String M_name
           
protected  java.lang.Object[] M_values
           
static int RIGHT
           
static int SIZE
           
static int TOP
           
static int VERTICAL
           
 
Constructor Summary
BoxModelAttributes(BoxModelAttributes bma)
          Deep copy constructor.
BoxModelAttributes(java.lang.String name)
          Constructs a new BoxModelAttributes instance with a name.
BoxModelAttributes(java.lang.String name, java.lang.Object def, java.lang.Object vertical, java.lang.Object horizontal, java.lang.Object top, java.lang.Object right, java.lang.Object bottom, java.lang.Object left)
          Constructs a new BoxModelAttributes instance and sets all the attribute values.
 
Method Summary
 com.davisor.core.Dupable dup()
          Duplicates this object.
 boolean equals(java.lang.Object object)
          Test if these box model attributes equal to given box model attributes.
 java.lang.Object getBottomValue()
          Return the value for the bottom attribute.
 java.lang.Object getLeftValue()
          Return the value for the left attribute.
 java.lang.Object getRightValue()
          Return the value for the right attribute.
 java.lang.Object getTopValue()
          Return the value for the top attribute.
 java.lang.Object getValue(int attribute)
          Returns the value associated to the exact attibute index.
 void setValue(int attribute, java.lang.Object value)
          Sets the value for the given attribute.
 void setValues(java.lang.Object def)
          Sets the common default value.
 void setValues(java.lang.Object vertical, java.lang.Object horizontal)
          Sets the horizontal and vertical default values.
 void setValues(java.lang.Object top, java.lang.Object horizontal, java.lang.Object bottom)
          Sets the horizontal and vertical default values.
 void setValues(java.lang.Object top, java.lang.Object right, java.lang.Object bottom, java.lang.Object left)
          Sets the horizontal and vertical default values.
 void setValues(java.lang.Object def, java.lang.Object vertical, java.lang.Object horizontal, java.lang.Object top, java.lang.Object right, java.lang.Object bottom, java.lang.Object left)
          Set all the values.
 java.lang.String toString()
          Gets an XML String representation of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT

public static int DEFAULT

VERTICAL

public static int VERTICAL

HORIZONTAL

public static int HORIZONTAL

TOP

public static int TOP

RIGHT

public static int RIGHT

BOTTOM

public static int BOTTOM

LEFT

public static int LEFT

SIZE

public static int SIZE

M_values

protected java.lang.Object[] M_values

M_name

protected java.lang.String M_name
Constructor Detail

BoxModelAttributes

public BoxModelAttributes(java.lang.String name)
Constructs a new BoxModelAttributes instance with a name.

Parameters:
name - attributes name (may be null)

BoxModelAttributes

public BoxModelAttributes(java.lang.String name,
                          java.lang.Object def,
                          java.lang.Object vertical,
                          java.lang.Object horizontal,
                          java.lang.Object top,
                          java.lang.Object right,
                          java.lang.Object bottom,
                          java.lang.Object left)
Constructs a new BoxModelAttributes instance and sets all the attribute values.

Parameters:
name - attributes name (may be null)
def - default value for all attributes and defaults (may be null)
vertical - default value for top and bottom attributes (may be null)
horizontal - default value for right and left attributes (may be null)
top - value for top attribute (may be null)
right - value for right attribute (may be null)
bottom - value for bottom attribute (may be null)
left - value for left attribute (may be null)

BoxModelAttributes

public BoxModelAttributes(BoxModelAttributes bma)
Deep copy constructor.

See Also:
dup()
Method Detail

equals

public boolean equals(java.lang.Object object)
Test if these box model attributes equal to given box model attributes.


toString

public java.lang.String toString()
Gets an XML String representation of this object. Does not use shorthands.


dup

public com.davisor.core.Dupable dup()
Duplicates this object.

Specified by:
dup in interface com.davisor.core.Dupable

getBottomValue

public java.lang.Object getBottomValue()
Return the value for the bottom attribute. Either an exactly given value is returned or and default.

Returns:
value for the bottom attribute (may be null)

getLeftValue

public java.lang.Object getLeftValue()
Return the value for the left attribute. Either an exactly given value is returned or and default.

Returns:
value for the left attribute (may be null)

getRightValue

public java.lang.Object getRightValue()
Return the value for the right attribute. Either an exactly given value is returned or and default.

Returns:
value for the right attribute (may be null)

getTopValue

public java.lang.Object getTopValue()
Return the value for the top attribute. Either an exactly given value is returned or and default.

Returns:
value for the top attribute (may be null)

getValue

public java.lang.Object getValue(int attribute)
Returns the value associated to the exact attibute index.

Parameters:
attribute - index of the attribute (DEFAULT,HORIZONTAL,...)
Returns:
attribute or default value set for the asked indec (may be null)

setValue

public void setValue(int attribute,
                     java.lang.Object value)
Sets the value for the given attribute.

Parameters:
attribute - index of the attribute (DEFAULT,HORIZONTAL,...)
value - attribute value (may be null)

setValues

public void setValues(java.lang.Object def,
                      java.lang.Object vertical,
                      java.lang.Object horizontal,
                      java.lang.Object top,
                      java.lang.Object right,
                      java.lang.Object bottom,
                      java.lang.Object left)
Set all the values. Overrides all prviously set values.

Parameters:
def - default value for all attributes and defaults (may be null)
vertical - default value for top and bottom attributes (may be null)
horizontal - default value for right and left attributes (may be null)
top - value for top attribute (may be null)
right - value for right attribute (may be null)
bottom - value for bottom attribute (may be null)
left - value for left attribute (may be null)
See Also:
setValue(int, java.lang.Object)

setValues

public void setValues(java.lang.Object def)
Sets the common default value. E.g. margin : 2em -- all margins set to 2em

Parameters:
def - default value for all attributes and defaults (may be null)

setValues

public void setValues(java.lang.Object vertical,
                      java.lang.Object horizontal)
Sets the horizontal and vertical default values.

E.g. margin : 1em 2em -- top & bottom = 1em, right & left = 2em

Parameters:
vertical - default value for top and bottom attributes (may be null)
horizontal - default value for right and left attributes (may be null)

setValues

public void setValues(java.lang.Object top,
                      java.lang.Object horizontal,
                      java.lang.Object bottom)
Sets the horizontal and vertical default values.

E.g. margin : 1em 2em 3em -- top=1em, right=2em, bottom=3em, left=2em

Parameters:
top - value for top attribute (may be null)
horizontal - default value for right and left attributes (may be null)
bottom - value for bottom attribute (may be null)

setValues

public void setValues(java.lang.Object top,
                      java.lang.Object right,
                      java.lang.Object bottom,
                      java.lang.Object left)
Sets the horizontal and vertical default values.

E.g. margin : 1em 2em 3em -- top=1em, right=2em, bottom=3em, left=2em

Parameters:
top - value for top attribute (may be null)
right - value for right attribute (may be null)
bottom - value for bottom attribute (may be null)
left - value for left attribute (may be null)


Copyright © 2001-2004 Davisor Oy. All Rights Reserved.