public class Panel extends XulElement implements Framable
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.
HtmlBasedComponent.ExtraCtrl
AbstractComponent.Children
_zclass
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
Constructor and Description |
---|
Panel() |
Modifier and Type | Method and Description |
---|---|
boolean |
addToolbar(java.lang.String name,
Toolbar toolbar)
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.
|
Caption |
getCaption()
Returns the caption of this panel.
|
Toolbar |
getFootToolbar()
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.
|
java.lang.String |
getTitle()
Returns the title.
|
Toolbar |
getTopToolbar()
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()
Deprecated.
As of release 5.0.6, replaced with
getBorder() .
Returns whether to render the panel with custom rounded borders.
Default: false. |
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(boolean border)
Enables or disables the border.
|
void |
setBorder(java.lang.String border)
Sets the border.
|
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)
Deprecated.
As of release 5.0.6, replaced with
setBorder(java.lang.String) .
Sets whether to render the panel with custom rounded borders.
Default: false. |
void |
setHflex(java.lang.String flex)
Sets horizontal flex hint of this component.
|
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.
|
void |
setVflex(java.lang.String flex)
Sets vertical flexibility hint of this component.
|
boolean |
setVisible(boolean visible)
Sets whether this component is visible.
|
getContext, getCtrlKeys, getPopup, getPropertyAccess, getTooltip, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip
focus, getAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTooltiptext, getTop, getVflex, getWidth, getZindex, getZIndex, setAction, setClass, setDraggable, setDroppable, setFocus, setHeight, setHeightDirectly, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTooltiptext, setTop, setTopDirectly, setWidth, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly
addAnnotation, addAnnotation, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildRemoved, beforeParentChanged, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, enableBindingAnnotation, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowRoots, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, invalidate, isChildable, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
public boolean isOpen()
Default: true.
public void setOpen(boolean open)
public boolean isFramable()
getBorder()
.
Returns whether to render the panel with custom rounded borders.
Default: false.
public void setFramable(boolean framable)
setBorder(java.lang.String)
.
Sets whether to render the panel with custom rounded borders.
Default: false.
public void setMovable(boolean movable)
Default: false;
Note that this method only applied when isFloatable()
is true.
public boolean isMovable()
Default: false.
public boolean isFloatable()
Default: false.
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.
public boolean isMaximized()
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.
UiException
- if isMaximizable()
is false.public boolean isMaximizable()
Default: false.
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.
public boolean isMinimized()
Default: false.
public void setMinimized(boolean minimized)
Default: false.
UiException
- if isMinimizable()
is false.public boolean isMinimizable()
Default: false.
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.
MinimizeEvent
public boolean isCollapsible()
Default: false.
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.
Note: onOpen event will be sent when you click the toggle button
public boolean isClosable()
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.
public void setMinheight(int minheight)
Default: 100.
Note: Only applies when isSizable()
= true.
public int getMinheight()
Default: 100.
public void setMinwidth(int minwidth)
Default: 200.
Note: Only applies when isSizable()
= true.
public int getMinwidth()
Default: 200.
public void setHflex(java.lang.String flex)
HtmlBasedComponent
Number flex indicates how this component's container distributes remaining empty space among its children horizontally. Flexible component grow and shrink to fit their given space. Flexible components with larger flex values will be made larger than components with lower flex values, at the ratio determined by all flexible components. The actual flex value is not relevant unless there are other flexible components within the same container. Once the default sizes of components in a container are calculated, the remaining space in the container is divided among the flexible components, according to their flex ratios.
Specify a flex value of negative value, 0, or "false" has the same effect as leaving the flex attribute out entirely. Specify a flex value of "true" has the same effect as a flex value of 1.
Special flex hint, "min", indicates that the minimum space shall be given to this flexible component to enclose all of its children components. That is, the flexible component grow and shrink to fit its children components.
setHflex
in class HtmlBasedComponent
flex
- horizontal flex hint of this component.HtmlBasedComponent.setVflex(java.lang.String)
,
HtmlBasedComponent.getHflex()
public void setVflex(java.lang.String flex)
HtmlBasedComponent
Number flex indicates how this component's container distributes remaining empty space among its children vertically. Flexible component grow and shrink to fit their given space. Flexible components with larger flex values will be made larger than components with lower flex values, at the ratio determined by all flexible components. The actual flex value is not relevant unless there are other flexible components within the same container. Once the default sizes of components in a container are calculated, the remaining space in the container is divided among the flexible components, according to their flex ratios.
Specify a flex value of negative value, 0, or "false" has the same effect as leaving the flex attribute out entirely. Specify a flex value of "true" has the same effect as a flex value of 1.
Special flex hint, "min", indicates that the minimum space shall be given to this flexible component to enclose all of its children components. That is, the flexible component grow and shrink to fit its children components.
setVflex
in class HtmlBasedComponent
flex
- the vertical flex hint.HtmlBasedComponent.setHflex(java.lang.String)
,
HtmlBasedComponent.getVflex()
public boolean isSizable()
public void setSizable(boolean sizable)
Default: false.
public Caption getCaption()
public java.lang.String getBorder()
Default: "none".
public void setBorder(java.lang.String border)
none
(default), normal
,
rounded
and rounded+
.
For more information, please refer to
ZK Component Reference: Panel.border
- the border. If null, "0" or "false", "none" is assumed.
If "true", "normal" is assumed (since 5.0.8).public void setBorder(boolean border)
border
- whether to have a border. If true is specified,
it is the same as setBorder("normal")
.public java.lang.String getTitle()
Caption
to define
a more sophisticated caption (a.k.a., title).
If a panel has a caption whose label (LabelElement.getLabel()
)
is not empty, then this attribute is ignored.
Default: empty.
public void setTitle(java.lang.String title)
public boolean addToolbar(java.lang.String name, Toolbar toolbar)
name
- "tbar", "bbar", and "fbar".public void onClose()
Default: detach itself.
public Toolbar getTopToolbar()
public Toolbar getBottomToolbar()
public Toolbar getFootToolbar()
public Panelchildren getPanelchildren()
public java.lang.String getZclass()
HtmlBasedComponent
AbstractComponent.getMold()
).
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 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.
If you would like to monitor if a component is attached or detached
from a page, you could register a desktop listener implementing
UiLifeCycle
.
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 XulElement
protected void renderProperties(ContentRenderer renderer) throws java.io.IOException
HtmlBasedComponent
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 occurred before
processing this request.AbstractComponent.setAuService(org.zkoss.zk.au.AuService)
Copyright © 2005-2011 Potix Corporation. All Rights Reserved.