|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecteu.webtoolkit.jwt.WObject
eu.webtoolkit.jwt.WLayout
public abstract class WLayout
An abstract base class for layout managers.
This class is the abstract base class for any layout manager. A layout manager is associated with a container widget, and manages the layout of children inside the whole space available to the container widget.
The implementation of the layout manager depends on the container widget to which it is set, and is therefore deferred to WLayoutImpl.
A layout never assumes ownership of contained items, instead these are owned by the parent widget to which the layout is applied.
Note: When applying a layout manager to a WContainerWidget,
you may not define any padding for the container widget. Instead, use
setContentsMargins().
| Constructor Summary | |
|---|---|
protected |
WLayout()
Create a layout. |
| Method Summary | |
|---|---|
abstract void |
addItem(WLayoutItem item)
Adds a layout item. |
void |
addWidget(WWidget w)
Adds the given widget to the layout. |
abstract void |
clear()
Removes and deletes all child widgets and nested layouts. |
protected void |
clearLayoutItem(WLayoutItem item)
|
WWidgetItem |
findWidgetItem(WWidget widget)
Finds the widget item associated with the given widget. |
int |
getContentsMargin(Side side)
Returns a contents margin. |
abstract int |
getCount()
Returns the number of items in this layout. |
WLayoutItemImpl |
getImpl()
Returns the implementation for this layout item. |
abstract WLayoutItem |
getItemAt(int index)
Returns the layout item at a specific index. |
WLayout |
getLayout()
Returns the layout that implements this WLayoutItem. |
WLayout |
getParentLayout()
Returns the layout in which this item is contained. |
WWidget |
getWidget()
Returns the widget that is held by this WLayoutItem. |
int |
indexOf(WLayoutItem item)
Returns the index of a given item. |
abstract void |
removeItem(WLayoutItem item)
Removes a layout item (widget or nested layout). |
boolean |
removeWidget(WWidget w)
Removes the given widget from the layout. |
void |
setContentsMargins(int left,
int top,
int right,
int bottom)
Set contents margins (in pixels). |
void |
setLayoutHint(java.lang.String name,
java.lang.String value)
Provides a hint to the layout implementation. |
protected void |
setLayoutInParent(WWidget parent)
Set the layout in the parent. |
void |
setParentLayout(WLayout layout)
Internal method. |
void |
setParentWidget(WWidget parent)
Internal method. |
protected void |
update()
Update the layout. |
protected void |
update(WLayoutItem item)
Update the layout. |
protected void |
updateAddItem(WLayoutItem item)
Update the layout, adding the given layout item. |
protected void |
updateRemoveItem(WLayoutItem item)
Update the layout, remove the given layout item. |
| Methods inherited from class eu.webtoolkit.jwt.WObject |
|---|
addChild, getId, getObjectName, remove, setObjectName, tr |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected WLayout()
| Method Detail |
|---|
public abstract void addItem(WLayoutItem item)
The item may be a widget or nested layout.
How the item is layed out with respect to siblings is implementation specific to the layout manager. In some cases, a layout manager will overload this method with extra arguments that specify layout options.
removeItem(WLayoutItem item),
addWidget(WWidget w)public void addWidget(WWidget w)
This method wraps the widget in a WWidgetItem and calls
addItem().
How the widget is layed out with respect to siblings is implementation specific to the layout manager. In some cases, a layout manager will overload this method with extra arguments that specify layout options.
removeWidget(WWidget w),
addItem(WLayoutItem item)public abstract void removeItem(WLayoutItem item)
addItem(WLayoutItem item),
removeWidget(WWidget w)public boolean removeWidget(WWidget w)
This method finds the corresponding WWidgetItem and calls
removeItem(). The widget
itself is not destroyed.
Returns true if succesful.
addWidget(WWidget w),
removeItem(WLayoutItem item)public abstract int getCount()
This may be a theoretical number, which is greater than the actual number
of items. It can be used to iterate over the items in the layout, in
conjunction with getItemAt().
public abstract WLayoutItem getItemAt(int index)
If there is no item at the index, null is
returned.
indexOf(WLayoutItem item),
getCount()public int indexOf(WLayoutItem item)
The default implementation loops over all items, and returns the index
for which itemAt(index) equals item.
getItemAt(int index)public WWidgetItem findWidgetItem(WWidget widget)
findWidgetItem in interface WLayoutItem
public void setLayoutHint(java.lang.String name,
java.lang.String value)
In some cases, a layout implementation may require some hints for rendering its contents. Possible hints are indicated in the reference documentation for each layout manager.
public WWidget getWidget()
WLayoutItemWLayoutItem.
This implements a type-safe upcasting mechanism to a WWidgetItem.
getWidget in interface WLayoutItempublic WLayout getLayout()
WLayoutItemWLayoutItem.
This implements a type-safe upcasting mechanism to a WLayout.
getLayout in interface WLayoutItempublic WLayout getParentLayout()
WLayoutItem
getParentLayout in interface WLayoutItempublic WLayoutItemImpl getImpl()
WLayoutItemThe implementation of a layout item depends on the kind of container for which the layout does layout management.
getImpl in interface WLayoutItem
public void setContentsMargins(int left,
int top,
int right,
int bottom)
The default contents margins are 9 pixels in all directions.
Note: Only used when the layout manager is applied to a
WContainerWidget.
setContentsMargins(int left, int top, int right, int bottom)public int getContentsMargin(Side side)
setContentsMargins(int left, int top, int right, int bottom)public abstract void clear()
This is similar to WContainerWidget#clear(), with the exception that the layout itself is
not deleted.
protected void update(WLayoutItem item)
Must be called whenever some properties of the layout have changed.
protected final void update()
Calls update((WLayoutItem)null)
protected void updateAddItem(WLayoutItem item)
Must be called from the implementation of
addItem()
protected void updateRemoveItem(WLayoutItem item)
Must be called from the implementation of
removeItem()
protected void setLayoutInParent(WWidget parent)
Must be called from the constructor after the layout has been fully
created (since it will call virtual methods getCount() and getItemAt()).
protected void clearLayoutItem(WLayoutItem item)
public void setParentWidget(WWidget parent)
WLayoutItem
setParentWidget in interface WLayoutItempublic void setParentLayout(WLayout layout)
WLayoutItem
setParentLayout in interface WLayoutItem
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||