|
||||||||||
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 |
---|
Nested classes/interfaces inherited from class org.zkoss.zk.ui.HtmlBasedComponent |
---|
HtmlBasedComponent.ExtraCtrl |
Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent |
---|
AbstractComponent.Children |
Field Summary |
---|
Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent |
---|
_height, _left, _top, _width, _zclass |
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 |
Fields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl |
---|
CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE |
Constructor Summary | |
---|---|
Panel()
|
Method Summary | |
---|---|
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". |
void |
beforeChildAdded(Component newChild,
Component refChild)
Default: does nothing. |
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. |
int |
getMinheight()
Returns the minimum height. |
int |
getMinwidth()
Returns the minimum width. |
Panelchildren |
getPanelchildren()
Returns the panelchildren of this panel. |
Panelchildren |
getPanelchildrenApi()
Returns the panelchildren of this panel. |
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. |
boolean |
isSizable()
Returns whether the panel is sizable. |
void |
onChildRemoved(Component child)
Default: does nothing. |
void |
onClose()
Process the onClose event sent when the close button is pressed. |
protected void |
renderProperties(ContentRenderer renderer)
Renders the content of this component, excluding the enclosing tags and children. |
void |
service(AuRequest request,
boolean everError)
Processes an AU request. |
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 |
setMinheight(int minheight)
Sets the minimum height in pixels allowed for this panel. |
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 |
setMinwidth(int minwidth)
Sets the minimum width in pixels allowed for this panel. |
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 |
setSizable(boolean sizable)
Sets whether the panel is sizable. |
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, getContext, getCtrlKeys, getPopup, getTooltip, setAction, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip |
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent |
---|
focus, getDraggable, getDroppable, getHeight, getHflex, getLeft, getSclass, getStyle, getTooltiptext, getTop, getVflex, getWidth, getZindex, getZIndex, newExtraCtrl, setClass, setDraggable, setDroppable, setFocus, setHeight, setHflex, setLeft, setSclass, setStyle, setTooltiptext, setTop, setVflex, 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 |
Methods inherited from interface org.zkoss.zk.ui.ext.Scope |
---|
addScopeListener, getAttribute, hasAttribute, removeAttribute, removeScopeListener, setAttribute |
Constructor Detail |
---|
public Panel()
Method Detail |
---|
public boolean isOpen()
Default: true.
isOpen
in interface Panel
public void setOpen(boolean open)
setOpen
in interface Panel
public boolean isFramable()
Default: false.
isFramable
in interface Panel
public void setFramable(boolean framable)
Default: false.
setFramable
in interface Panel
public void setMovable(boolean movable)
Default: false;
Note that this method only applied when isFloatable()
is true.
setMovable
in interface Panel
public boolean isMovable()
Default: false.
isMovable
in interface Panel
public boolean isFloatable()
Default: false.
isFloatable
in interface Panel
public boolean setVisible(boolean visible)
Component
setVisible
in interface Component
setVisible
in class AbstractComponent
public 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 Panel
public boolean isMaximized()
isMaximized
in interface Panel
isMaximized
in interface Framable
public 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 Panel
UiException
- if isMaximizable()
is false.public boolean isMaximizable()
Default: false.
isMaximizable
in interface Panel
isMaximizable
in interface Framable
public void setMaximizable(boolean maximizable)
Default: false.
Note: the maximize button won't be displayed if no title or caption at all.
setMaximizable
in interface Panel
public boolean isMinimized()
Default: false.
isMinimized
in interface Panel
public void setMinimized(boolean minimized)
Default: false.
setMinimized
in interface Panel
UiException
- if isMinimizable()
is false.public boolean isMinimizable()
Default: false.
isMinimizable
in interface Panel
isMinimizable
in interface Framable
public void setMinimizable(boolean minimizable)
Default: false.
Note: the maximize button won't be displayed if no title or caption at all.
setMinimizable
in interface Panel
MinimizeEvent
public boolean isCollapsible()
Default: false.
isCollapsible
in interface Panel
isCollapsible
in interface Framable
public void setCollapsible(boolean collapsible)
Default: false.
Note: the toggle button won't be displayed if no title or caption at all.
setCollapsible
in interface Panel
public boolean isClosable()
isClosable
in interface Panel
isClosable
in interface Framable
public 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 Panel
public void setMinheight(int minheight)
Default: 100.
Note: Only applies when isSizable()
= true.
setMinheight
in interface Panel
public int getMinheight()
Default: 100.
getMinheight
in interface Panel
public void setMinwidth(int minwidth)
Default: 200.
Note: Only applies when isSizable()
= true.
setMinwidth
in interface Panel
public int getMinwidth()
Default: 200.
getMinwidth
in interface Panel
public boolean isSizable()
isSizable
in interface Panel
public void setSizable(boolean sizable)
Default: false.
setSizable
in interface Panel
public Caption getCaption()
public Caption getCaptionApi()
getCaptionApi
in interface Panel
public java.lang.String getBorder()
HtmlBasedComponent.getSclass()
.
In fact, the name of the border (except "normal") is generate as part of
the style class used for the content block.
Refer to HtmlBasedComponent.getSclass()
for more details.
Default: "none".
getBorder
in interface Panel
public void setBorder(java.lang.String border)
setBorder
in interface Panel
border
- the border. If null or "0", "none" is assumed.public java.lang.String getTitle()
Caption
to define
a more sophisticated caption (aka., title).
If a panel has a caption whose label (LabelElement.getLabel()
)
is not empty, then this attribute is ignored.
Default: empty.
getTitle
in interface Panel
getTitle
in interface Framable
public 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 Panel
toolbarApi
- assume as a Toolbar
name
- "tbar", "bbar", and "fbar".public void onClose()
Default: detach itself.
public Toolbar getTopToolbar()
public Toolbar getTopToolbarApi()
getTopToolbarApi
in interface Panel
public Toolbar getBottomToolbar()
public Toolbar getBottomToolbarApi()
getBottomToolbarApi
in interface Panel
public Toolbar getFootToolbar()
public Toolbar getFootToolbarApi()
getFootToolbarApi
in interface Panel
public Panelchildren getPanelchildren()
public Panelchildren getPanelchildrenApi()
getPanelchildrenApi
in interface Panel
public java.lang.String getZclass()
HtmlBasedComponent
Default: 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 HtmlBasedComponent
getZclass
in class HtmlBasedComponent
HtmlBasedComponent.getSclass()
public void beforeChildAdded(Component newChild, Component refChild)
AbstractComponent
beforeChildAdded
in interface ComponentCtrl
beforeChildAdded
in class AbstractComponent
newChild
- the child to be added (never null).refChild
- another child component that the new child
will be inserted before it. If null, the new child will be the
last child.ComponentCtrl.beforeChildAdded(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
public boolean insertBefore(Component newChild, Component refChild)
Component
You 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 Component
insertBefore
in class AbstractComponent
newChild
- 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 ComponentCtrl
onChildRemoved
in class AbstractComponent
ComponentCtrl.onChildRemoved(org.zkoss.zk.ui.Component)
public java.lang.Object clone()
Component
clone
in interface Component
clone
in class AbstractComponent
protected void renderProperties(ContentRenderer renderer) throws java.io.IOException
HtmlBasedComponent
See also Render Special Properties
renderProperties
in class XulElement
java.io.IOException
public void service(AuRequest request, boolean everError)
Default: in addition to what are handled by HtmlBasedComponent.service(org.zkoss.zk.au.AuRequest, boolean)
,
it also handles onOpen.
service
in interface ComponentCtrl
service
in class HtmlBasedComponent
everError
- whether any error ever occured before
processing this request.AbstractComponent.setAuService(org.zkoss.zk.au.AuService)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |