com.vaadin.shared.ui
Class MarginInfo

java.lang.Object
  extended by com.vaadin.shared.ui.MarginInfo
All Implemented Interfaces:
java.io.Serializable

public class MarginInfo
extends java.lang.Object
implements java.io.Serializable

Describes the margin settings for each edge of a Component.

Author:
Vaadin Ltd
See Also:
Serialized Form

Constructor Summary
MarginInfo(boolean enabled)
          Creates a MarginInfo object with all edges set to either enabled or disabled.
MarginInfo(boolean vertical, boolean horizontal)
           
MarginInfo(boolean top, boolean right, boolean bottom, boolean left)
          Creates a MarginInfo object by having each edge specified in clockwise order (analogous to CSS).
MarginInfo(int bitMask)
          Creates a MarginInfo object from a bit mask.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 int getBitMask()
          Returns the current bit mask that make up the margin settings.
 boolean hasAll()
          Checks if this MarginInfo object has margins on all edges enabled.
 boolean hasBottom()
          Checks if this MarginInfo object has the bottom edge margin enabled.
 int hashCode()
           
 boolean hasLeft()
          Checks if this MarginInfo object has the left edge margin enabled.
 boolean hasRight()
          Checks if this MarginInfo object has the right edge margin enabled.
 boolean hasTop()
          Checks if this MarginInfo object has the top edge margin enabled.
 void setMargins(boolean enabled)
          Enables or disables margins on all edges simultaneously.
 void setMargins(boolean top, boolean right, boolean bottom, boolean left)
          Sets margins on all edges individually.
 void setMargins(MarginInfo marginInfo)
          Copies margin values from another MarginInfo object.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MarginInfo

public MarginInfo(boolean enabled)
Creates a MarginInfo object with all edges set to either enabled or disabled.

Parameters:
enabled - the value to set for all edges

MarginInfo

public MarginInfo(int bitMask)
Creates a MarginInfo object from a bit mask.

Parameters:
bitMask - bits to set

MarginInfo

public MarginInfo(boolean top,
                  boolean right,
                  boolean bottom,
                  boolean left)
Creates a MarginInfo object by having each edge specified in clockwise order (analogous to CSS).

Parameters:
top - enable or disable top margin
right - enable or disable right margin
bottom - enable or disable bottom margin
left - enable or disable left margin

MarginInfo

public MarginInfo(boolean vertical,
                  boolean horizontal)
Method Detail

setMargins

public void setMargins(boolean enabled)
Enables or disables margins on all edges simultaneously.

Parameters:
enabled - if true, enables margins on all edges. If false, disables margins on all edges.

setMargins

public void setMargins(boolean top,
                       boolean right,
                       boolean bottom,
                       boolean left)
Sets margins on all edges individually.

Parameters:
top - enable or disable top margin
right - enable or disable right margin
bottom - enable or disable bottom margin
left - enable or disable left margin

setMargins

public void setMargins(MarginInfo marginInfo)
Copies margin values from another MarginInfo object.

Parameters:
marginInfo - another marginInfo object

hasAll

public boolean hasAll()
Checks if this MarginInfo object has margins on all edges enabled.

Returns:
true if all edges have margins enabled
Since:
7.5.0

hasLeft

public boolean hasLeft()
Checks if this MarginInfo object has the left edge margin enabled.

Returns:
true if left edge margin is enabled

hasRight

public boolean hasRight()
Checks if this MarginInfo object has the right edge margin enabled.

Returns:
true if right edge margin is enabled

hasTop

public boolean hasTop()
Checks if this MarginInfo object has the top edge margin enabled.

Returns:
true if top edge margin is enabled

hasBottom

public boolean hasBottom()
Checks if this MarginInfo object has the bottom edge margin enabled.

Returns:
true if bottom edge margin is enabled

getBitMask

public int getBitMask()
Returns the current bit mask that make up the margin settings.

Returns:
an integer bit mask

equals

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

hashCode

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

toString

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


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.