Package com.google.gwt.user.client.ui
Class HorizontalPanel
java.lang.Object
com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Panel
com.google.gwt.user.client.ui.ComplexPanel
com.google.gwt.user.client.ui.CellPanel
com.google.gwt.user.client.ui.HorizontalPanel
- All Implemented Interfaces:
HasAttachHandlers,HasHandlers,EventListener,HasAlignment,HasHorizontalAlignment,HasVerticalAlignment,HasVisibility,HasWidgets,HasWidgets.ForIsWidget,IndexedPanel,IndexedPanel.ForIsWidget,InsertPanel,InsertPanel.ForIsWidget,IsWidget,Iterable<Widget>
A panel that lays all of its widgets out in a single horizontal column.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabledNested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasHorizontalAlignment
HasHorizontalAlignment.AutoHorizontalAlignmentConstant, HasHorizontalAlignment.HorizontalAlignmentConstantNested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasVerticalAlignment
HasVerticalAlignment.VerticalAlignmentConstantNested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
HasWidgets.ForIsWidgetNested classes/interfaces inherited from interface com.google.gwt.user.client.ui.IndexedPanel
IndexedPanel.ForIsWidgetNested classes/interfaces inherited from interface com.google.gwt.user.client.ui.InsertPanel
InsertPanel.ForIsWidget -
Field Summary
Fields inherited from class com.google.gwt.user.client.ui.Widget
eventsToSinkFields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERRORFields inherited from interface com.google.gwt.user.client.ui.HasHorizontalAlignment
ALIGN_CENTER, ALIGN_DEFAULT, ALIGN_JUSTIFY, ALIGN_LEFT, ALIGN_LOCALE_END, ALIGN_LOCALE_START, ALIGN_RIGHTFields inherited from interface com.google.gwt.user.client.ui.HasVerticalAlignment
ALIGN_BOTTOM, ALIGN_MIDDLE, ALIGN_TOP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a child widget.Gets the horizontal alignment.Gets the vertical alignment.voidvoidInserts a child widget before the specified index.protected voidonEnsureDebugId(String baseID) Affected Elements: -# = the cell at the given index.booleanRemoves a child widget.voidSets the default horizontal alignment to be used for widgets added to this panel.voidSets the default vertical alignment to be used for widgets added to this panel.Methods inherited from class com.google.gwt.user.client.ui.CellPanel
getBody, getSpacing, getTable, getWidgetTd, setBorderWidth, setCellHeight, setCellHeight, setCellHorizontalAlignment, setCellHorizontalAlignment, setCellHorizontalAlignment, setCellHorizontalAlignment, setCellVerticalAlignment, setCellVerticalAlignment, setCellVerticalAlignment, setCellVerticalAlignment, setCellWidth, setCellWidth, setSpacingMethods inherited from class com.google.gwt.user.client.ui.ComplexPanel
add, add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, doLogicalClear, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, removeMethods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, clear, doAttachChildren, doDetachChildren, orphan, removeMethods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, ensureHandlers, fireEvent, getHandlerCount, getHandlerManager, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, replaceElement, setLayoutData, setParent, sinkEvents, unsinkEventsMethods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.gwt.user.client.ui.IndexedPanel
getWidget, getWidgetCount, getWidgetIndex, removeMethods inherited from interface com.google.gwt.user.client.ui.IndexedPanel.ForIsWidget
getWidgetIndexMethods inherited from interface com.google.gwt.user.client.ui.InsertPanel.ForIsWidget
addMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
HorizontalPanel
public HorizontalPanel()Creates an empty horizontal panel.
-
-
Method Details
-
add
Description copied from class:PanelAdds a child widget.How to Override this Method
There are several important things that must take place in the correct order to properly add or insert a Widget to a Panel. Not all of these steps will be relevant to every Panel, but all of the steps must be considered.
- Validate: Perform any sanity checks to ensure the Panel can accept a new Widget. Examples: checking for a valid index on insertion; checking that the Panel is not full if there is a max capacity.
- Adjust for Reinsertion: Some Panels need to handle the case
where the Widget is already a child of this Panel. Example: when performing
a reinsert, the index might need to be adjusted to account for the Widget's
removal. See
ComplexPanel.adjustIndex(Widget, int). - Detach Child: Remove the Widget from its existing parent, if
any. Most Panels will simply call
Widget.removeFromParent()on the Widget. - Logical Attach: Any state variables of the Panel should be
updated to reflect the addition of the new Widget. Example: the Widget is
added to the Panel's
WidgetCollectionat the appropriate index. - Physical Attach: The Widget's Element must be physically attached to the Panel's Element, either directly or indirectly.
- Adopt: Call
Panel.adopt(Widget)to finalize the add as the very last step.
- Specified by:
addin interfaceHasWidgets- Specified by:
addin interfaceInsertPanel- Overrides:
addin classPanel- Parameters:
w- the widget to be added- See Also:
-
getHorizontalAlignment
Description copied from interface:HasHorizontalAlignmentGets the horizontal alignment.- Specified by:
getHorizontalAlignmentin interfaceHasHorizontalAlignment- Returns:
- the current horizontal alignment (
HasHorizontalAlignment.ALIGN_LEFT,HasHorizontalAlignment.ALIGN_CENTER,HasHorizontalAlignment.ALIGN_RIGHT,HasHorizontalAlignment.ALIGN_JUSTIFY, or null).
-
getVerticalAlignment
Description copied from interface:HasVerticalAlignmentGets the vertical alignment.- Specified by:
getVerticalAlignmentin interfaceHasVerticalAlignment- Returns:
- the current vertical alignment.
-
insert
- Specified by:
insertin interfaceInsertPanel.ForIsWidget
-
insert
Description copied from interface:InsertPanelInserts a child widget before the specified index. If the widget is already a child of this panel, it will be moved to the specified index.- Specified by:
insertin interfaceInsertPanel- Parameters:
w- the child widget to be insertedbeforeIndex- the index before which it will be inserted
-
remove
Description copied from class:PanelRemoves a child widget.How to Override this Method
There are several important things that must take place in the correct order to properly remove a Widget from a Panel. Not all of these steps will be relevant to every Panel, but all of the steps must be considered.
- Validate: Make sure this Panel is actually the parent of the
child Widget; return
falseif it is not. - Orphan: Call
Panel.orphan(Widget)first while the child Widget is still attached. - Physical Detach: Adjust the DOM to account for the removal of the child Widget. The Widget's Element must be physically removed from the DOM.
- Logical Detach: Update the Panel's state variables to reflect
the removal of the child Widget. Example: the Widget is removed from the
Panel's
WidgetCollection.
- Specified by:
removein interfaceHasWidgets- Overrides:
removein classComplexPanel- Parameters:
w- the widget to be removed- Returns:
trueif the child was present
- Validate: Make sure this Panel is actually the parent of the
child Widget; return
-
setHorizontalAlignment
Sets the default horizontal alignment to be used for widgets added to this panel. It only applies to widgets added after this property is set.- Specified by:
setHorizontalAlignmentin interfaceHasHorizontalAlignment- Parameters:
align- the horizontal alignment (HasHorizontalAlignment.ALIGN_LEFT,HasHorizontalAlignment.ALIGN_CENTER,HasHorizontalAlignment.ALIGN_RIGHT,HasHorizontalAlignment.ALIGN_JUSTIFY,HasHorizontalAlignment.ALIGN_LOCALE_START, orHasHorizontalAlignment.ALIGN_LOCALE_END).- See Also:
-
setVerticalAlignment
Sets the default vertical alignment to be used for widgets added to this panel. It only applies to widgets added after this property is set.- Specified by:
setVerticalAlignmentin interfaceHasVerticalAlignment- Parameters:
align- the vertical alignment (HasVerticalAlignment.ALIGN_TOP,HasVerticalAlignment.ALIGN_MIDDLE, orHasVerticalAlignment.ALIGN_BOTTOM).- See Also:
-
onEnsureDebugId
Affected Elements:- -# = the cell at the given index.
- Overrides:
onEnsureDebugIdin classUIObject- Parameters:
baseID- the base ID used by the main element- See Also:
-