Class DecoratorPanel
- All Implemented Interfaces:
HasAttachHandlers
,HasHandlers
,EventListener
,AcceptsOneWidget
,HasOneWidget
,HasVisibility
,HasWidgets
,HasWidgets.ForIsWidget
,IsWidget
,Iterable<Widget>
A SimplePanel
that wraps its contents in stylized boxes, which can be
used to add rounded corners to a Widget
.
This widget will only work in quirks mode in most cases. Specifically, setting the height or width of the DecoratorPanel will result in rendering issues.
Wrapping a Widget
in a "9-box" allows users to specify images in each
of the corners and along the four borders. This method allows the content
within the DecoratorPanel
to resize without disrupting the look of
the border. In addition, rounded corners can generally be combined into a
single image file, which reduces the number of downloaded files at startup.
This class also simplifies the process of using AlphaImageLoaders to support
8-bit transparencies (anti-aliasing and shadows) in ie6, which does not
support them normally.
Setting the Size:
If you set the width or height of the DecoratorPanel
, you need to
set the height and width of the middleCenter cell to 100% so that the
middleCenter cell takes up all of the available space. If you do not set the
width and height of the DecoratorPanel
, it will wrap its contents
tightly.
.gwt-DecoratorPanel .middleCenter { height: 100%; width: 100%; }
CSS Style Rules
- .gwt-DecoratorPanel { the panel }
- .gwt-DecoratorPanel .top { the top row }
- .gwt-DecoratorPanel .topLeft { the top left cell }
- .gwt-DecoratorPanel .topLeftInner { the inner element of the cell }
- .gwt-DecoratorPanel .topCenter { the top center cell }
- .gwt-DecoratorPanel .topCenterInner { the inner element of the cell }
- .gwt-DecoratorPanel .topRight { the top right cell }
- .gwt-DecoratorPanel .topRightInner { the inner element of the cell }
- .gwt-DecoratorPanel .middle { the middle row }
- .gwt-DecoratorPanel .middleLeft { the middle left cell }
- .gwt-DecoratorPanel .middleLeftInner { the inner element of the cell }
- .gwt-DecoratorPanel .middleCenter { the middle center cell }
- .gwt-DecoratorPanel .middleCenterInner { the inner element of the cell }
- .gwt-DecoratorPanel .middleRight { the middle right cell }
- .gwt-DecoratorPanel .middleRightInner { the inner element of the cell }
- .gwt-DecoratorPanel .bottom { the bottom row }
- .gwt-DecoratorPanel .bottomLeft { the bottom left cell }
- .gwt-DecoratorPanel .bottomLeftInner { the inner element of the cell }
- .gwt-DecoratorPanel .bottomCenter { the bottom center cell }
- .gwt-DecoratorPanel .bottomCenterInner { the inner element of the cell }
- .gwt-DecoratorPanel .bottomRight { the bottom right cell }
- .gwt-DecoratorPanel .bottomRightInner { the inner element of the cell }
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
HasWidgets.ForIsWidget
-
Field Summary
Fields inherited from class com.google.gwt.user.client.ui.SimplePanel
widget
Fields inherited from class com.google.gwt.user.client.ui.Widget
eventsToSink
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR
-
Constructor Summary
ConstructorDescriptionCreate a newDecoratorPanel
.DecoratorPanel
(String[] rowStyles, int containerIndex) Creates a new panel using the specified style names to apply to each row. -
Method Summary
Modifier and TypeMethodDescription(package private) static Element
Create a new row with a specific style name.protected Element
getCellElement
(int row, int cell) Get a specific Element from the panel.protected Element
Override this method to specify that an element other than the root element be the container for the panel's child widget.Methods inherited from class com.google.gwt.user.client.ui.SimplePanel
add, getWidget, iterator, remove, setWidget, setWidget
Methods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, clear, doAttachChildren, doDetachChildren, orphan, remove
Methods 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, unsinkEvents
Methods 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, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
DecoratorPanel
public DecoratorPanel()Create a newDecoratorPanel
. -
DecoratorPanel
DecoratorPanel(String[] rowStyles, int containerIndex) Creates a new panel using the specified style names to apply to each row. Each row will contain three cells (Left, Center, and Right). The Center cell in the containerIndex row will contain theWidget
.- Parameters:
rowStyles
- an array of style names to apply to each rowcontainerIndex
- the index of the container row
-
-
Method Details
-
createTR
Create a new row with a specific style name. The row will contain three cells (Left, Center, and Right), each prefixed with the specified style name. This method allows Widgets to reuse the code on a DOM level, without creating a DecoratorPanel Widget.- Parameters:
styleName
- the style name- Returns:
- the new row
Element
-
getCellElement
Get a specific Element from the panel.- Parameters:
row
- the row indexcell
- the cell index- Returns:
- the Element at the given row and cell
-
getContainerElement
Description copied from class:SimplePanel
Override this method to specify that an element other than the root element be the container for the panel's child widget. This can be useful when you want to create a simple panel that decorates its contents. Note that this method continues to return theElement
class defined in theUser
module to maintain backwards compatibility.- Overrides:
getContainerElement
in classSimplePanel
- Returns:
- the element to be used as the panel's container
-