public class ContentPanel extends SimpleContainer implements BeforeExpandEvent.HasBeforeExpandHandlers, ExpandEvent.HasExpandHandlers, BeforeCollapseEvent.HasBeforeCollapseHandlers, CollapseEvent.HasCollapseHandlers, Collapsible
addButton(CellButtonBase). The body
contains a single widget, added using SimpleContainer.add(com.google.gwt.user.client.ui.Widget). The widget is resized to
match the size of the container. A content panel provides built-in expandable
and collapsible behavior.
Code snippet:
public void onModuleLoad() {
ContentPanel cp = new ContentPanel();
cp.setHeadingText("Content Panel");
cp.setPixelSize(250, 140);
cp.setPosition(10, 10);
cp.setCollapsible(true);
cp.addTool(new ToolButton(ToolButton.GEAR));
cp.addTool(new ToolButton(ToolButton.CLOSE));
cp.setWidget(new HTML("This is an HTML Widget in a ContentPanel."));
cp.addButton(new TextButton("Ok"));
RootPanel.get().add(cp);
}
| Modifier and Type | Class and Description |
|---|---|
static interface |
ContentPanel.ContentPanelAppearance
The appearance of a content panel.
|
static interface |
ContentPanel.ContentPanelMessages
Provides access to content panel messages.
|
static interface |
ContentPanel.PanelHeaderAppearance
Provides support for deferred binding for the panel header appearance.
|
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabledHasWidgets.ForIsWidgetIndexedPanel.ForIsWidgetDEBUG_ID_PREFIX| Constructor and Description |
|---|
ContentPanel()
Creates a content panel with default appearance.
|
ContentPanel(ContentPanel.ContentPanelAppearance appearance)
Creates a content panel with the specified appearance.
|
| Modifier and Type | Method and Description |
|---|---|
HandlerRegistration |
addBeforeCollapseHandler(BeforeCollapseEvent.BeforeCollapseHandler handler)
Adds a
BeforeCollapseEvent.BeforeCollapseHandler handler for BeforeCollapseEvent
events. |
HandlerRegistration |
addBeforeExpandHandler(BeforeExpandEvent.BeforeExpandHandler handler)
Adds a
BeforeExpandEvent.BeforeExpandHandler handler for BeforeExpandEvent
events. |
void |
addButton(CellButtonBase<?> button)
Adds a button the the panel.
|
HandlerRegistration |
addCollapseHandler(CollapseEvent.CollapseHandler handler)
Adds a
CollapseEvent.CollapseHandler handler for CollapseEvent
events. |
HandlerRegistration |
addExpandHandler(ExpandEvent.ExpandHandler handler)
Adds a
ExpandEvent.ExpandHandler handler for ExpandEvent events. |
void |
addTool(Widget tool)
Adds a Tool to Header
|
void |
collapse()
Collapses the panel body so that it becomes hidden.
|
void |
expand()
Expands the panel body so that it becomes visible.
|
XElement |
getBody()
Returns the panel's body element.
|
BoxLayoutContainer.BoxLayoutPack |
getButtonAlign()
Returns the panel's button alignment.
|
ButtonBar |
getButtonBar()
Returns the content panel button bar.
|
Header |
getHeader()
Returns the content panel header.
|
String |
getHTML()
Returns the HTML displayed in the header.
|
ContentPanel.ContentPanelMessages |
getMessages()
Returns the content panel messages.
|
int |
getMinButtonWidth()
Returns the minimum button width.
|
String |
getText()
Returns the content panel header text set by a previous call to
setHeadingText(String). |
boolean |
isAnimCollapse()
Returns true if animated collapsing is enabled.
|
boolean |
isCollapsed()
Returns true if the panel is collapsed.
|
boolean |
isCollapsible()
Returns true if the panel is collapsible.
|
boolean |
isExpanded()
Returns
true if the panel is expanded. |
boolean |
isHideCollapseTool()
Returns true if the collapse tool is hidden.
|
boolean |
isTitleCollapse()
Returns true if title collapsing has been enabled.
|
void |
onBrowserEvent(Event event) |
void |
setAnimCollapse(boolean animCollapse)
Sets whether expand and collapse is animating (defaults to true).
|
void |
setBodyBorder(boolean border)
Displays or hides the body border.
|
void |
setBodyStyle(String style)
Sets multiple style properties on the body element.
|
void |
setBodyStyleName(String style)
Adds a style class name to the body element.
|
void |
setButtonAlign(BoxLayoutContainer.BoxLayoutPack buttonAlign)
Sets the button alignment of any buttons added to this panel (defaults to
RIGHT, pre-render).
|
void |
setCollapsible(boolean collapsible)
True to make the panel collapsible and have the expand/collapse toggle
button automatically rendered into the header tool button area, false to
keep the panel statically sized with no button (defaults to false,
pre-render).
|
void |
setExpanded(boolean expanded)
Sets the panel's expand state.
|
void |
setHeaderVisible(boolean visible)
Shows or hides the content panel header.
|
void |
setHeadingHtml(SafeHtml html)
Sets the heading HTML to the specified value.
|
void |
setHeadingHtml(String html)
Sets the heading HTML to the specified value.
|
void |
setHeadingText(String text)
Sets the title text for the panel.
|
void |
setHideCollapseTool(boolean hideCollapseTool)
Sets whether the collapse tool should be displayed when the panel is
collapsible.
|
void |
setMessages(ContentPanel.ContentPanelMessages messages)
Sets the content panel messages.
|
void |
setMinButtonWidth(int width)
Sets the minimum button width.
|
void |
setTitleCollapse(boolean titleCollapse)
True to allow expanding and collapsing the panel (when
setCollapsible(boolean) = true) by clicking anywhere in the header
bar, false to allow it only by clicking to tool button (defaults to false). |
add, add, getWidget, isResize, setResize, setWidget, setWidgetforceLayout, isLayoutRunning, isOrWasLayoutRunning, onResizeadd, addAddHandler, addBeforeAddHandler, addBeforeRemoveHandler, addContainerHandler, addRemoveHandler, clear, disable, enable, findWidget, getItemByItemId, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, iterator, remove, remove, removeaddBeforeHideHandler, addBeforeShowContextMenuHandler, addBeforeShowHandler, addBlurHandler, addDisableHandler, addEnableHandler, addFocusHandler, addHideHandler, addMoveHandler, addResizeHandler, addShowContextMenuHandler, addShowHandler, addStyleOnOver, clearSizeCache, disableEvents, enableEvents, fireEvent, focus, getData, getElement, getFocusSupport, getHideMode, getId, getItemId, getOffsetHeight, getOffsetWidth, getShadow, getStateId, getToolTip, hide, hideToolTip, isAllowTextSelection, isAutoHeight, isAutoWidth, isDeferHeight, isEnabled, isRendered, isStateful, isVisible, isVisible, mask, mask, removeHandler, removeToolTip, setAllowTextSelection, setBorders, setBounds, setBounds, setContextMenu, setData, setDeferHeight, setEnabled, setHeight, setHeight, setHideMode, setId, setItemId, setPagePosition, setPixelSize, setPosition, setShadow, setSize, setStateful, setStateId, setTabIndex, setToolTip, setToolTipConfig, setVisible, setWidth, setWidth, show, sync, syncSize, unmaskaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, getLayoutData, getParent, isAttached, removeFromParent, setLayoutData, sinkEventsaddStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, removeStyleName, setStyleDependentName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, sinkBitlessEvent, toString, unsinkEventspublic ContentPanel()
public ContentPanel(ContentPanel.ContentPanelAppearance appearance)
appearance - the appearance of the content panel.public HandlerRegistration addBeforeCollapseHandler(BeforeCollapseEvent.BeforeCollapseHandler handler)
BeforeCollapseEvent.HasBeforeCollapseHandlersBeforeCollapseEvent.BeforeCollapseHandler handler for BeforeCollapseEvent
events.addBeforeCollapseHandler in interface BeforeCollapseEvent.HasBeforeCollapseHandlershandler - the handlerpublic HandlerRegistration addBeforeExpandHandler(BeforeExpandEvent.BeforeExpandHandler handler)
BeforeExpandEvent.HasBeforeExpandHandlersBeforeExpandEvent.BeforeExpandHandler handler for BeforeExpandEvent
events.addBeforeExpandHandler in interface BeforeExpandEvent.HasBeforeExpandHandlershandler - the handler@UiChild public void addButton(CellButtonBase<?> button)
button - the button to addpublic HandlerRegistration addCollapseHandler(CollapseEvent.CollapseHandler handler)
CollapseEvent.HasCollapseHandlersCollapseEvent.CollapseHandler handler for CollapseEvent
events.addCollapseHandler in interface CollapseEvent.HasCollapseHandlershandler - the handlerpublic HandlerRegistration addExpandHandler(ExpandEvent.ExpandHandler handler)
ExpandEvent.HasExpandHandlersExpandEvent.ExpandHandler handler for ExpandEvent events.addExpandHandler in interface ExpandEvent.HasExpandHandlershandler - the handler@UiChild public void addTool(Widget tool)
tool - the tool to addpublic void collapse()
collapse in interface Collapsiblepublic void expand()
public XElement getBody()
public BoxLayoutContainer.BoxLayoutPack getButtonAlign()
public ButtonBar getButtonBar()
public Header getHeader()
public String getHTML()
public ContentPanel.ContentPanelMessages getMessages()
public int getMinButtonWidth()
public String getText()
setHeadingText(String).public boolean isAnimCollapse()
public boolean isCollapsed()
public boolean isCollapsible()
public boolean isExpanded()
true if the panel is expanded.public boolean isHideCollapseTool()
public boolean isTitleCollapse()
public void onBrowserEvent(Event event)
onBrowserEvent in interface EventListeneronBrowserEvent in class Componentpublic void setAnimCollapse(boolean animCollapse)
animCollapse - true to enable animationspublic void setBodyBorder(boolean border)
border - true to display the borderpublic void setBodyStyle(String style)
style - the style(s) to setpublic void setBodyStyleName(String style)
style - the style class namepublic void setButtonAlign(BoxLayoutContainer.BoxLayoutPack buttonAlign)
buttonAlign - the button alignmentpublic void setCollapsible(boolean collapsible)
collapsible - the collapsible to setpublic void setExpanded(boolean expanded)
expanded - true true to expandpublic void setHeaderVisible(boolean visible)
visible - true to show the header.public void setHeadingHtml(SafeHtml html)
html - the HTML to display in the headingpublic void setHeadingHtml(String html)
html - the HTML to display in the headingpublic void setHeadingText(String text)
text - the title textpublic void setHideCollapseTool(boolean hideCollapseTool)
hideCollapseTool - true if the tool is hiddenpublic void setMessages(ContentPanel.ContentPanelMessages messages)
messages - the messagespublic void setMinButtonWidth(int width)
width - the button widthpublic void setTitleCollapse(boolean titleCollapse)
setCollapsible(boolean) = true) by clicking anywhere in the header
bar, false to allow it only by clicking to tool button (defaults to false).titleCollapse - the titleCollapse to setCopyright © 2012. All Rights Reserved.