|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zul.impl.XulElement
org.zkoss.zul.Panel
public class Panel
Panel is a container that has specific functionality and structural components
that make it the perfect building block for application-oriented user interfaces.
The Panel contains bottom, top, and foot toolbars, along with separate header,
footer and body sections. It also provides built-in collapsible, closable,
maximizable, and minimizable behavior, along with a variety of pre-built tool
buttons that can be wired up to provide other customized behavior. Panels can
be easily embedded into any kind of ZUL component that is allowed to have children
or layout component. Panels also provide specific features like float and move.
Unlike Window, Panels can only be floated and moved inside its parent
node, which is not using zk.setVParent() function at client side. In other words,
if Panel's parent node is an relative position, the floated panel is only inside
its parent, not the whole page.
The second difference of Window is that Panel is not an independent ID
space (by implementing IdSpace), so the ID of each child can be used
throughout the panel.
Events:
onMove, onOpen, onZIndex, onMaximize, onMinimize, and onClose.
Default getZclass(): z-panel.
| Nested Class Summary | |
|---|---|
protected class |
Panel.ExtraCtrl
A utility class to implement AbstractComponent.getExtraCtrl(). |
| Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent |
|---|
AbstractComponent.Children |
| Field Summary |
|---|
| Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent |
|---|
_zclass, RS_NO_DISPLAY, RS_NO_HEIGHT, RS_NO_WIDTH |
| Fields inherited from class org.zkoss.zk.ui.AbstractComponent |
|---|
_visible |
| Fields inherited from interface org.zkoss.zk.ui.Component |
|---|
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE |
| Constructor Summary | |
|---|---|
Panel()
|
|
| Method Summary | |
|---|---|
protected void |
addMoved(Component oldparent,
Page oldpg,
Page newpg)
Called when this component is moved from the specified parent and/or page to the new page. |
boolean |
addToolbar(java.lang.String name,
Toolbar toolbar)
Adds the toolbar of the panel by these names, "tbar", "bbar", and "fbar". |
boolean |
addToolbarApi(java.lang.String name,
Toolbar toolbarApi)
Adds the toolbar of the panel by these names, "tbar", "bbar", and "fbar". |
java.lang.Object |
clone()
Clones the component. |
java.lang.String |
getBorder()
Returns the border. |
Toolbar |
getBottomToolbar()
Returns the bottom toolbar of this panel. |
Toolbar |
getBottomToolbarApi()
Returns the bottom toolbar of this panel. |
Caption |
getCaption()
Returns the caption of this panel. |
Caption |
getCaptionApi()
Returns the caption of this panel. |
Toolbar |
getFootToolbar()
Returns the foot toolbar of this panel. |
Toolbar |
getFootToolbarApi()
Returns the foot toolbar of this panel. |
java.lang.String |
getOuterAttrs()
Returns the exterior attributes for generating the enclosing HTML tag; never return null. |
Panelchildren |
getPanelchildren()
Returns the panelchildren of this panel. |
Panelchildren |
getPanelchildrenApi()
Returns the panelchildren of this panel. |
protected java.lang.String |
getRealSclass()
Returns the real style class that will be generated to the client (when HtmlBasedComponent.getOuterAttrs() is called). |
java.lang.String |
getTitle()
Returns the title. |
Toolbar |
getTopToolbar()
Returns the top toolbar of this panel. |
Toolbar |
getTopToolbarApi()
Returns the top toolbar of this panel. |
java.lang.String |
getZclass()
Returns the ZK Cascading Style class(es) for this component. |
boolean |
insertBefore(Component newChild,
Component refChild)
Inserts a child before the reference child. |
boolean |
isClosable()
Returns whether to show a close button on the title bar. |
boolean |
isCollapsible()
Returns whether to show a toggle button on the title bar. |
boolean |
isFloatable()
Returns whether to float the panel to display it inline where it is rendered. |
boolean |
isFramable()
Returns whether to render the panel with custom rounded borders. |
boolean |
isMaximizable()
Returns whether to display the maximizing button and allow the user to maximize the panel. |
boolean |
isMaximized()
Returns whether the panel is maximized. |
boolean |
isMinimizable()
Returns whether to display the minimizing button and allow the user to minimize the panel. |
boolean |
isMinimized()
Returns whether the panel is minimized. |
boolean |
isMovable()
Returns whether to move the panel to display it inline where it is rendered. |
boolean |
isOpen()
Returns whether this Panel is open. |
protected java.lang.Object |
newExtraCtrl()
Used by AbstractComponent.getExtraCtrl() to create a client control. |
void |
onChildRemoved(Component child)
Default: does nothing. |
void |
onClose()
Process the onClose event sent when the close button is pressed. |
void |
setBorder(java.lang.String border)
Sets the border (either none or normal). |
void |
setClosable(boolean closable)
Sets whether to show a close button on the title bar. |
void |
setCollapsible(boolean collapsible)
Sets whether to show a toggle button on the title bar. |
void |
setFloatable(boolean floatable)
Sets whether to float the panel to display it inline where it is rendered. |
void |
setFramable(boolean framable)
Sets whether to render the panel with custom rounded borders. |
void |
setMaximizable(boolean maximizable)
Sets whether to display the maximizing button and allow the user to maximize the panel, when a panel is maximized, the button will automatically change to a restore button with the appropriate behavior already built-in that will restore the panel to its previous size. |
void |
setMaximized(boolean maximized)
Sets whether the panel is maximized, and then the size of the panel will depend on it to show a appropriate size. |
void |
setMinimizable(boolean minimizable)
Sets whether to display the minimizing button and allow the user to minimize the panel. |
void |
setMinimized(boolean minimized)
Sets whether the panel is minimized. |
void |
setMovable(boolean movable)
Sets whether to move the panel to display it inline where it is rendered. |
void |
setOpen(boolean open)
Opens or closes this Panel. |
void |
setTitle(java.lang.String title)
Sets the title. |
boolean |
setVisible(boolean visible)
Sets whether this component is visible. |
| Methods inherited from class org.zkoss.zul.impl.XulElement |
|---|
getAction, getActionAttrs, getAllOnClickAttrs, getContext, getCtrlKeys, getInnerAttrs, getPopup, getTooltip, setAction, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip |
| Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent |
|---|
focus, getAllOnClickAttrs, getDraggable, getDroppable, getHeight, getLeft, getMoldSclass, getRealStyle, getRealStyleFlags, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZindex, getZIndex, redraw, setClass, setDraggable, setDroppable, setFocus, setHeight, setLeft, setMoldSclass, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.zkoss.zul.impl.api.XulElement |
|---|
getAction, getContext, getCtrlKeys, getPopup, getTooltip, setAction, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip |
| Methods inherited from interface org.zkoss.zk.ui.api.HtmlBasedComponent |
|---|
focus, getHeight, getLeft, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZindex, getZIndex, setDraggable, setDroppable, setFocus, setHeight, setLeft, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex |
| Constructor Detail |
|---|
public Panel()
| Method Detail |
|---|
public boolean isOpen()
Default: true.
isOpen in interface Panelpublic void setOpen(boolean open)
setOpen in interface Panelpublic boolean isFramable()
Default: false.
isFramable in interface Panelpublic void setFramable(boolean framable)
Default: false.
setFramable in interface Panelpublic void setMovable(boolean movable)
Default: false;
Note that this method only applied when isFloatable() is true.
setMovable in interface Panelpublic boolean isMovable()
Default: false.
isMovable in interface Panelpublic boolean isFloatable()
Default: false.
isFloatable in interface Panelpublic boolean setVisible(boolean visible)
Component
setVisible in interface ComponentsetVisible in class AbstractComponentpublic void setFloatable(boolean floatable)
Note that by default, setting floatable to true will cause the
panel to display at default offsets, which depend on the offsets of
the embedded panel from its element to document.body -- because the panel
is absolute positioned, the position must be set explicitly by HtmlBasedComponent.setTop(String)
and HtmlBasedComponent.setLeft(String). Also, when floatable a panel you should always
assign a fixed width, otherwise it will be auto width and will expand to fill
to the right edge of the viewport.
setFloatable in interface Panelpublic boolean isMaximized()
isMaximized in interface Panelpublic void setMaximized(boolean maximized)
isFloatable()) or its parent node. Otherwise, its size
will be original size. Note that the maximized effect will run at client's
sizing phase not initial phase.
Default: false.
setMaximized in interface PanelUiException - if isMaximizable() is false.public boolean isMaximizable()
Default: false.
isMaximizable in interface Panelpublic void setMaximizable(boolean maximizable)
Default: false.
Note: the maximize button won't be displayed if no title or caption at all.
setMaximizable in interface Panelpublic boolean isMinimized()
Default: false.
isMinimized in interface Panelpublic void setMinimized(boolean minimized)
Default: false.
setMinimized in interface PanelUiException - if isMinimizable() is false.public boolean isMinimizable()
Default: false.
isMinimizable in interface Panelpublic void setMinimizable(boolean minimizable)
Default: false.
Note: the maximize button won't be displayed if no title or caption at all.
setMinimizable in interface PanelMinimizeEventpublic boolean isCollapsible()
Default: false.
isCollapsible in interface Panelpublic void setCollapsible(boolean collapsible)
Default: false.
Note: the toggle button won't be displayed if no title or caption at all.
setCollapsible in interface Panelpublic boolean isClosable()
isClosable in interface Panelpublic void setClosable(boolean closable)
Default: false.
You can intercept the default behavior by either overriding
onClose(), or listening the onClose event.
Note: the close button won't be displayed if no title or caption at all.
setClosable in interface Panelpublic Caption getCaption()
public Caption getCaptionApi()
getCaptionApi in interface Panelpublic java.lang.String getBorder()
Panelchildren.getRealSclass().
In fact, the name of the border (except "normal") is generate as part of
the style class used for the content block.
Refer to Panelchildren.getRealSclass() for more details.
Default: "none".
getBorder in interface Panelpublic void setBorder(java.lang.String border)
setBorder in interface Panelborder - the border. If null or "0", "none" is assumed.public java.lang.String getTitle()
Caption to define
a more sophiscated caption (aka., title).
If a window has a caption whose label (LabelElement.getLabel())
is not empty, then this attribute is ignored.
Default: empty.
getTitle in interface Panelpublic void setTitle(java.lang.String title)
setTitle in interface Panel
public boolean addToolbar(java.lang.String name,
Toolbar toolbar)
name - "tbar", "bbar", and "fbar".
public boolean addToolbarApi(java.lang.String name,
Toolbar toolbarApi)
addToolbarApi in interface PaneltoolbarApi - assume as a Toolbarname - "tbar", "bbar", and "fbar".public void onClose()
Default: detach itself.
public Toolbar getTopToolbar()
public Toolbar getTopToolbarApi()
getTopToolbarApi in interface Panelpublic Toolbar getBottomToolbar()
public Toolbar getBottomToolbarApi()
getBottomToolbarApi in interface Panelpublic Toolbar getFootToolbar()
public Toolbar getFootToolbarApi()
getFootToolbarApi in interface Panelpublic Panelchildren getPanelchildren()
public Panelchildren getPanelchildrenApi()
getPanelchildrenApi in interface Panelprotected java.lang.String getRealSclass()
HtmlBasedComponentHtmlBasedComponent.getOuterAttrs() is called).
Default: it simply returns the catenation of HtmlBasedComponent.getSclass()
and HtmlBasedComponent.getZclass() (since 3.5.0).
Derived classes might override it to provide, say, dual style classes. For example,
final String sclass = getSclass();
return sclass != null ? sclass + " my-addon": "myaddon";
getRealSclass in class HtmlBasedComponentHtmlBasedComponent.getZclass()public java.lang.String getZclass()
HtmlBasedComponentDefault: null (the default value depends on element).
HtmlBasedComponent.setZclass(java.lang.String)) will completely replace the default style
of a component. In other words, the default style of a component
is associated with the default value of HtmlBasedComponent.getZclass().
Once it is changed, the default style won't be applied at all.
If you want to perform small adjustments, use HtmlBasedComponent.setSclass(java.lang.String)
instead.
getZclass in interface HtmlBasedComponentgetZclass in class HtmlBasedComponentHtmlBasedComponent.getSclass(),
HtmlBasedComponent.getRealSclass()public java.lang.String getOuterAttrs()
HtmlBasedComponentUsed only by component developers.
Default: Generates the tooltip text, style, sclass, draggable
and droppable attribute if necessary.
In other words, the corresponding attribute is generated if
HtmlBasedComponent.getTooltiptext(), HtmlBasedComponent.getRealStyle(),
HtmlBasedComponent.getSclass(), HtmlBasedComponent.getDraggable(), HtmlBasedComponent.getDroppable()
are defined.
You have to call both HtmlBasedComponent.getOuterAttrs() and
HtmlBasedComponent.getInnerAttrs() to generate complete attributes.
For simple components that all attributes are put on the outest HTML element, all you need is as follows.
<xx id="${self.uuid}"${self.outerAttrs}${self.innerAttrs}>
If you want to put attributes in a nested HTML element, you
shall use the following pattern. Notice: if HtmlBasedComponent.getInnerAttrs()
in a different tag, the tag must be named with "${self.uuid}!real".
<xx id="${self.uuid}"${self.outerAttrs}>
<yy id="${self.uuid}!real"${self.innerAttrs}>...
Note: This class handles non-deferrable event listeners automatically.
However, you have to invoke AbstractComponent.appendAsapAttr(java.lang.StringBuffer, java.lang.String) for each event
the component handles in HtmlBasedComponent.getOuterAttrs() as follows.
appendAsapAttr(sb, Events.ON_OPEN);
appendAsapAttr(sb, Events.ON_CHANGE);
Theorectically, you could put any attributes in either
HtmlBasedComponent.getInnerAttrs() or HtmlBasedComponent.getOuterAttrs().
However, zkau.js assumes all attributes are put at the outer one.
If you want something different, you have to provide your own
setAttr (refer to how checkbox is implemented).
getOuterAttrs in class XulElement
public boolean insertBefore(Component newChild,
Component refChild)
ComponentYou could use Component.setParent(org.zkoss.zk.ui.Component) or Component.appendChild(org.zkoss.zk.ui.Component)
instead of this method, unless
you want to control where to put the child.
Note: Component.setParent(org.zkoss.zk.ui.Component) always calls back Component.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
and/or Component.removeChild(org.zkoss.zk.ui.Component),
while Component.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component) and Component.removeChild(org.zkoss.zk.ui.Component)
always calls back Component.setParent(org.zkoss.zk.ui.Component),
if the parent is changed. Thus, you don't need to override
both Component.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component) and Component.setParent(org.zkoss.zk.ui.Component), if you want
to customize the behavior.
insertBefore in interface ComponentinsertBefore in class AbstractComponentnewChild - the new child to be inserted.refChild - the child before which you want the new child
being inserted. If null, the new child is append to the end.
public void onChildRemoved(Component child)
AbstractComponent
onChildRemoved in interface ComponentCtrlonChildRemoved in class AbstractComponentComponentCtrl.onChildRemoved(org.zkoss.zk.ui.Component)public java.lang.Object clone()
Component
clone in interface Componentclone in class AbstractComponentprotected java.lang.Object newExtraCtrl()
HtmlBasedComponentAbstractComponent.getExtraCtrl() to create a client control.
It is used only by component developers.
Defaut: creates an instance of HtmlBasedComponent.ExtraCtrl.
newExtraCtrl in class HtmlBasedComponent
protected void addMoved(Component oldparent,
Page oldpg,
Page newpg)
AbstractComponentDefault: it notifies UiEngine to update the component
at the client (usually remove-and-add).
It is designed to let derived classes overriding this method to disable this update. However, you rarely need to override it. One possible but rare case: the component's visual part at the client updates the visual representation at the client and then notify the component at the server to update its children accordingly. In this case, it is redudant if we ask UI Engine to send the updates to client.
addMoved in class AbstractComponentoldparent - the parent before moved.
The new parent can be found by calling AbstractComponent.getParent().oldpg - the parent before moved.newpg - the new page. AbstractComponent.getPage() might return
the old page.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||