public class Panel extends AbstractSingleComponentContainer implements Scrollable, Action.Notifier, Component.Focusable, LegacyComponent
Component.ErrorEvent, Component.Event, Component.Focusable, Component.ListenerClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListenerSizeable.UnitHasComponents.ComponentAttachDetachNotifier, HasComponents.ComponentAttachEvent, HasComponents.ComponentAttachListener, HasComponents.ComponentDetachEvent, HasComponents.ComponentDetachListener| Modifier and Type | Field and Description |
|---|---|
protected ActionManager |
actionManager
Keeps track of the Actions added to this component, and manages the
painting and handling as well.
|
DESIGN_ATTR_PLAIN_TEXTSIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS| Constructor and Description |
|---|
Panel()
Creates a new empty panel.
|
Panel(Component content)
Creates a new empty panel which contains the given content.
|
Panel(String caption)
Creates a new empty panel with caption.
|
Panel(String caption,
Component content)
Creates a new empty panel with the given caption and content.
|
| Modifier and Type | Method and Description |
|---|---|
<T extends Action & Action.Listener> |
addAction(T action) |
void |
addActionHandler(Action.Handler actionHandler)
Registers a new action handler for this container
|
Registration |
addClickListener(MouseEvents.ClickListener listener)
Add a click listener to the Panel.
|
void |
changeVariables(Object source,
Map<String,Object> variables)
Called when one or more variables handled by the implementing class are
changed.
|
void |
focus()
Moves keyboard focus to the component.
|
protected ActionManager |
getActionManager()
Gets the
ActionManager used to manage the
ShortcutListeners added to this component. |
protected Collection<String> |
getCustomAttributes()
Returns a collection of attributes that should not be handled by the
basic implementation of the
AbstractComponent.readDesign(Element, DesignContext)
and AbstractComponent.writeDesign(Element, DesignContext) methods. |
int |
getScrollLeft()
Gets scroll left offset.
|
int |
getScrollTop()
Gets scroll top offset.
|
protected PanelState |
getState()
Returns the shared state bean with information to be sent from the server
to the client.
|
protected PanelState |
getState(boolean markAsDirty)
Returns the shared state for this connector.
|
int |
getTabIndex()
Gets the tabulator index of the
Focusable component. |
void |
paintContent(PaintTarget target)
Paints the Paintable into a UIDL stream.
|
void |
readDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
Reads the component state from the given design.
|
<T extends Action & Action.Listener> |
removeAction(T action) |
void |
removeActionHandler(Action.Handler actionHandler)
Removes a previously registered action handler for the contents of
this container.
|
void |
removeAllActionHandlers()
Removes all action handlers
|
void |
removeClickListener(MouseEvents.ClickListener listener)
Deprecated.
As of 8.0, replaced by
Registration.remove() in the
registration object returned from
#addClickListener(ClickListener). |
void |
setCaption(String caption)
Sets the caption of the panel.
|
void |
setScrollLeft(int scrollLeft)
Sets scroll left offset.
|
void |
setScrollTop(int scrollTop)
Sets scroll top offset.
|
void |
setTabIndex(int tabIndex)
Sets the tabulator index of the
Focusable component. |
void |
writeDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
Writes the component state to the given design.
|
addComponentAttachListener, addComponentDetachListener, fireComponentAttachEvent, fireComponentDetachEvent, getComponentCount, getContent, iterator, readDesignChildren, removeComponentAttachListener, removeComponentDetachListener, removeFromParent, setContent, setHeight, setWidthaddContextClickListener, addListener, addShortcutListener, addStyleName, attach, beforeClientResponse, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorMessage, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isOrHasAncestor, isReadOnly, isRequiredIndicatorVisible, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setDescription, setEnabled, setHeight, setHeightUndefined, setIcon, setId, setLocale, setParent, setPrimaryStyleName, setReadOnly, setRequiredIndicatorVisible, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setStyleName, setVisible, setWidth, setWidthUndefinedaddAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstateclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitmarkAsDirtyisEnabledaddListener, addStyleName, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isVisible, removeListener, removeStyleName, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setStyleName, setVisibleaddAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandlergetConnectorIdgetHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthUndefinedforEach, spliteratorprotected ActionManager actionManager
public Panel()
public Panel(Component content)
content - the content for the panel.public Panel(String caption)
caption - the caption used in the panel (HTML).public void setCaption(String caption)
setCaption in interface ComponentsetCaption in class AbstractComponentcaption - the new caption String for the component.AbstractComponent.setCaption(String)public void paintContent(PaintTarget target) throws PaintException
LegacyComponentPaints the Paintable into a UIDL stream. This method creates the UIDL sequence describing it and outputs it to the given UIDL stream.
It is called when the contents of the component should be painted in response to the component first being shown or having been altered so that its visual representation is changed.
paintContent in interface LegacyComponenttarget - the target UIDL stream where the component should paint itself
to.PaintException - if the paint operation failed.public void changeVariables(Object source, Map<String,Object> variables)
changeVariables in interface VariableOwnersource - the Source of the variable change. This is the origin of the
event. For example in Web Adapter this is the request.variables - the Mapping from variable names to new variable values.VariableOwner.changeVariables(Object, Map)public int getScrollLeft()
ScrollableScrolling offset is the number of pixels this scrollable has been scrolled right.
getScrollLeft in interface Scrollablepublic int getScrollTop()
ScrollableScrolling offset is the number of pixels this scrollable has been scrolled down.
getScrollTop in interface Scrollablepublic void setScrollLeft(int scrollLeft)
ScrollableScrolling offset is the number of pixels this scrollable has been scrolled right.
setScrollLeft in interface ScrollablescrollLeft - the xOffset.public void setScrollTop(int scrollTop)
ScrollableScrolling offset is the number of pixels this scrollable has been scrolled down.
The scrolling position is limited by the current height of the content area. If the position is below the height, it is scrolled to the bottom. However, if the same response also adds height to the content area, scrolling to bottom only scrolls to the bottom of the previous content area.
setScrollTop in interface ScrollablescrollTop - the yOffset.protected ActionManager getActionManager()
AbstractComponentActionManager used to manage the
ShortcutListeners added to this component.getActionManager in class AbstractComponentpublic <T extends Action & Action.Listener> void addAction(T action)
addAction in interface Action.Notifierpublic <T extends Action & Action.Listener> void removeAction(T action)
removeAction in interface Action.Notifierpublic void addActionHandler(Action.Handler actionHandler)
Action.ContaineraddActionHandler in interface Action.ContaineractionHandler - the new handler to be added.public void removeActionHandler(Action.Handler actionHandler)
Action.ContainerremoveActionHandler in interface Action.ContaineractionHandler - the handler to be removed.public void removeAllActionHandlers()
public Registration addClickListener(MouseEvents.ClickListener listener)
listener - The listener to add, not nullRegistration@Deprecated public void removeClickListener(MouseEvents.ClickListener listener)
Registration.remove() in the
registration object returned from
#addClickListener(ClickListener).#addClickListener(ClickListener).listener - The listener to removepublic int getTabIndex()
Focusable component.getTabIndex in interface Component.FocusableFocusable componentComponent.Focusable.setTabIndex(int)public void setTabIndex(int tabIndex)
Focusable component.
The tab index property is used to specify the order in which the
fields are focused when the user presses the Tab key. Components with
a defined tab index are focused sequentially first, and then the
components with no tab index.
Form loginBox = new Form();
loginBox.setCaption("Login");
layout.addComponent(loginBox);
// Create the first field which will be focused
TextField username = new TextField("User name");
loginBox.addField("username", username);
// Set focus to the user name
username.focus();
TextField password = new TextField("Password");
loginBox.addField("password", password);
Button login = new Button("Login");
loginBox.getFooter().addComponent(login);
// An additional component which natural focus order would
// be after the button.
CheckBox remember = new CheckBox("Remember me");
loginBox.getFooter().addComponent(remember);
username.setTabIndex(1);
password.setTabIndex(2);
remember.setTabIndex(3); // Different than natural place
login.setTabIndex(4);
After all focusable user interface components are done, the browser can begin again from the component with the smallest tab index, or it can take the focus out of the page, for example, to the location bar.
If the tab index is not set (is set to zero), the default tab order is used. The order is somewhat browser-dependent, but generally follows the HTML structure of the page.
A negative value means that the component is completely removed from the tabulation order and can not be reached by pressing the Tab key at all.
setTabIndex in interface Component.FocusabletabIndex - the tab order of this component. Indexes usually start
from 1. Zero means that default tab order should be used.
A negative value means that the field should not be
included in the tabbing sequence.Component.Focusable.getTabIndex()public void focus()
Component.Focusable.focus()focus in interface Component.Focusablefocus in class AbstractComponentFieldEvents,
FieldEvents.FocusEvent,
FieldEvents.FocusListener,
FieldEvents.BlurEvent,
FieldEvents.BlurListenerprotected PanelState getState()
AbstractComponentgetState in class AbstractSingleComponentContainerprotected PanelState getState(boolean markAsDirty)
AbstractClientConnectorgetState in class AbstractSingleComponentContainermarkAsDirty - true if the connector should automatically be marked dirty,
false otherwiseAbstractClientConnector.getState()public void readDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
ComponentThe component is responsible not only for updating its own state but also for ensuring that its children update their state based on the design.
It is assumed that the component is in its default state when this method is called. Reading should only take into consideration attributes specified in the design and not reset any unspecified attributes to their defaults.
This method must not modify the design.
readDesign in interface ComponentreadDesign in class AbstractSingleComponentContainerdesign - The element to obtain the state fromdesignContext - The DesignContext instance used for parsing the designprotected Collection<String> getCustomAttributes()
AbstractComponentAbstractComponent.readDesign(Element, DesignContext)
and AbstractComponent.writeDesign(Element, DesignContext) methods. Typically these
are handled in a custom way in the overridden versions of the above
methodsgetCustomAttributes in class AbstractComponentpublic void writeDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
ComponentThe component is responsible not only for writing its own state but also for ensuring that its children write their state to the design.
This method must not modify the component state.
writeDesign in interface ComponentwriteDesign in class AbstractSingleComponentContainerdesign - The element to write the component state to. Any previous
attributes or child nodes are not cleared.designContext - The DesignContext instance used for writing the designCopyright © 2017 Vaadin Ltd. All rights reserved.