com.vaadin.client.ui.orderedlayout
Class Slot

java.lang.Object
  extended by SimplePanel
      extended by com.vaadin.client.ui.orderedlayout.Slot

public class Slot
extends SimplePanel

Represents a slot which contains the actual widget in the layout.


Field Summary
static java.lang.String SLOT_CLASSNAME
           
 
Constructor Summary
Slot()
          Constructs a slot.
Slot(VAbstractOrderedLayout layout, Widget widget)
          Deprecated. use GWT#create(Class), setWidget(Widget) and setLayout(VAbstractOrderedLayout) instead
 
Method Summary
 com.vaadin.shared.ui.AlignmentInfo getAlignment()
          Returns the alignment for the slot
 com.google.gwt.user.client.Element getCaptionElement()
          Get the slots caption element
 CaptionPosition getCaptionPosition()
          Get the position of the caption relative to the slot
 ElementResizeListener getCaptionResizeListener()
           
protected  com.google.gwt.user.client.Element getContainerElement()
           
 double getExpandRatio()
          Get the expand ratio for the slot.
protected  int getHorizontalSpacing()
          Get the horizontal amount of pixels of the spacing
 com.google.gwt.user.client.Element getSpacingElement()
          Get the element which is added to make the spacing
 ElementResizeListener getSpacingResizeListener()
           
protected  int getVerticalSpacing()
          Get the vertical amount in pixels of the spacing
 ElementResizeListener getWidgetResizeListener()
           
 boolean hasCaption()
          Does the slot have a caption
 boolean hasRelativeHeight()
           
 boolean hasRelativeWidth()
           
 boolean hasSpacing()
          Does the slot have spacing
 boolean isRelativeInDirection(boolean vertical)
           
protected  void onAttach()
           
 void onBrowserEvent(Event event)
           
protected  void onDetach()
           
 boolean remove(Widget w)
           
 void setAlignment(com.vaadin.shared.ui.AlignmentInfo alignment)
          Sets how the widget is aligned inside the slot
 void setCaption(java.lang.String captionText, Icon icon, java.util.List<java.lang.String> styles, java.lang.String error, boolean showError, boolean required, boolean enabled)
          Set the caption of the slot as text
 void setCaption(java.lang.String captionText, Icon icon, java.util.List<java.lang.String> styles, java.lang.String error, boolean showError, boolean required, boolean enabled, boolean captionAsHtml)
          Set the caption of the slot
 void setCaption(java.lang.String captionText, java.lang.String iconUrl, java.util.List<java.lang.String> styles, java.lang.String error, boolean showError, boolean required, boolean enabled)
          Deprecated. Use setCaption(String, Icon, List, String, boolean, boolean, boolean) instead
 void setCaptionPosition(CaptionPosition captionPosition)
          Set the position of the caption relative to the slot
 void setCaptionResizeListener(ElementResizeListener captionResizeListener)
           
 void setExpandRatio(double expandRatio)
          Set how the slot should be expanded relative to the other slots.
 void setLayout(VAbstractOrderedLayout layout)
          Set the layout in which this slot is.
 void setRelativeHeight(boolean relativeHeight)
          Set if the slot has a relative height
 void setRelativeWidth(boolean relativeWidth)
          Set if the slot has a relative width
 void setSpacing(boolean spacing)
          Set the spacing for the slot.
 void setSpacingResizeListener(ElementResizeListener spacingResizeListener)
           
protected  void setStyleNames(java.lang.String... stylenames)
          Sets the style names for the slot containing the widget
 void setWidget(Widget w)
           
 void setWidgetResizeListener(ElementResizeListener widgetResizeListener)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SLOT_CLASSNAME

public static final java.lang.String SLOT_CLASSNAME
See Also:
Constant Field Values
Constructor Detail

Slot

public Slot()
Constructs a slot. When using this constructor, the layout and widget must be set before any other operations are performed on the slot.

Since:
7.6

Slot

@Deprecated
public Slot(VAbstractOrderedLayout layout,
                       Widget widget)
Deprecated. use GWT#create(Class), setWidget(Widget) and setLayout(VAbstractOrderedLayout) instead

Constructs a slot.

Parameters:
layout - The layout to which this slot belongs
widget - The widget to put in the slot
Method Detail

setLayout

public void setLayout(VAbstractOrderedLayout layout)
Set the layout in which this slot is. This method must be called exactly once at slot construction time when using the default constructor. The method should normally only be called by VAbstractOrderedLayout.createSlot(Widget).

Parameters:
layout - the layout containing the slot
Since:
7.6

remove

public boolean remove(Widget w)

setWidget

public void setWidget(Widget w)

getCaptionResizeListener

public ElementResizeListener getCaptionResizeListener()

setCaptionResizeListener

public void setCaptionResizeListener(ElementResizeListener captionResizeListener)

getWidgetResizeListener

public ElementResizeListener getWidgetResizeListener()

setWidgetResizeListener

public void setWidgetResizeListener(ElementResizeListener widgetResizeListener)

getSpacingResizeListener

public ElementResizeListener getSpacingResizeListener()

setSpacingResizeListener

public void setSpacingResizeListener(ElementResizeListener spacingResizeListener)

getAlignment

public com.vaadin.shared.ui.AlignmentInfo getAlignment()
Returns the alignment for the slot


setStyleNames

protected void setStyleNames(java.lang.String... stylenames)
Sets the style names for the slot containing the widget

Parameters:
stylenames - The style names for the slot

setAlignment

public void setAlignment(com.vaadin.shared.ui.AlignmentInfo alignment)
Sets how the widget is aligned inside the slot

Parameters:
alignment - The alignment inside the slot

setExpandRatio

public void setExpandRatio(double expandRatio)
Set how the slot should be expanded relative to the other slots. 0 means that the slot should not participate in the division of space based on the expand ratios but instead be allocated space based on its natural size. Other values causes the slot to get a share of the otherwise unallocated space in proportion to the slot's expand ratio value.

Parameters:
expandRatio - The ratio of the space the slot should occupy

getExpandRatio

public double getExpandRatio()
Get the expand ratio for the slot. The expand ratio describes how the slot should be resized compared to other slots in the layout

Returns:
the expand ratio of the slot
See Also:
setExpandRatio(double)

setSpacing

public void setSpacing(boolean spacing)
Set the spacing for the slot. The spacing determines if there should be empty space around the slot when the slot.

Parameters:
spacing - Should spacing be enabled

getSpacingElement

public com.google.gwt.user.client.Element getSpacingElement()
Get the element which is added to make the spacing

Returns:

hasSpacing

public boolean hasSpacing()
Does the slot have spacing


getVerticalSpacing

protected int getVerticalSpacing()
Get the vertical amount in pixels of the spacing


getHorizontalSpacing

protected int getHorizontalSpacing()
Get the horizontal amount of pixels of the spacing

Returns:

setCaptionPosition

public void setCaptionPosition(CaptionPosition captionPosition)
Set the position of the caption relative to the slot

Parameters:
captionPosition - The position of the caption

getCaptionPosition

public CaptionPosition getCaptionPosition()
Get the position of the caption relative to the slot


setCaption

@Deprecated
public void setCaption(java.lang.String captionText,
                                  java.lang.String iconUrl,
                                  java.util.List<java.lang.String> styles,
                                  java.lang.String error,
                                  boolean showError,
                                  boolean required,
                                  boolean enabled)
Deprecated. Use setCaption(String, Icon, List, String, boolean, boolean, boolean) instead

Set the caption of the slot

Parameters:
captionText - The text of the caption
iconUrl - The icon URL, must already be run trough translateVaadinUri()
styles - The style names
error - The error message
showError - Should the error message be shown
required - Is the (field) required
enabled - Is the component enabled

setCaption

public void setCaption(java.lang.String captionText,
                       Icon icon,
                       java.util.List<java.lang.String> styles,
                       java.lang.String error,
                       boolean showError,
                       boolean required,
                       boolean enabled)
Set the caption of the slot as text

Parameters:
captionText - The text of the caption
icon - The icon
styles - The style names
error - The error message
showError - Should the error message be shown
required - Is the (field) required
enabled - Is the component enabled

setCaption

public void setCaption(java.lang.String captionText,
                       Icon icon,
                       java.util.List<java.lang.String> styles,
                       java.lang.String error,
                       boolean showError,
                       boolean required,
                       boolean enabled,
                       boolean captionAsHtml)
Set the caption of the slot

Parameters:
captionText - The text of the caption
icon - The icon
styles - The style names
error - The error message
showError - Should the error message be shown
required - Is the (field) required
enabled - Is the component enabled
captionAsHtml - true if the caption should be rendered as HTML, false otherwise

hasCaption

public boolean hasCaption()
Does the slot have a caption


getCaptionElement

public com.google.gwt.user.client.Element getCaptionElement()
Get the slots caption element


setRelativeWidth

public void setRelativeWidth(boolean relativeWidth)
Set if the slot has a relative width

Parameters:
relativeWidth - True if slot uses relative width, false if the slot has a static width

hasRelativeWidth

public boolean hasRelativeWidth()

setRelativeHeight

public void setRelativeHeight(boolean relativeHeight)
Set if the slot has a relative height

Parameters:
relativeHeight - True if the slot uses a relative height, false if the slot has a static height

hasRelativeHeight

public boolean hasRelativeHeight()

onBrowserEvent

public void onBrowserEvent(Event event)

getContainerElement

protected com.google.gwt.user.client.Element getContainerElement()

onDetach

protected void onDetach()

onAttach

protected void onAttach()

isRelativeInDirection

public boolean isRelativeInDirection(boolean vertical)


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