Class WPanel
- java.lang.Object
-
- com.github.bordertech.wcomponents.AbstractWComponent
-
- com.github.bordertech.wcomponents.WBeanComponent
-
- com.github.bordertech.wcomponents.WContainer
-
- com.github.bordertech.wcomponents.WPanel
-
- All Implemented Interfaces:
AccessKeyable
,AjaxInternalTrigger
,AjaxTarget
,BeanAware
,BeanBound
,BeanProviderBound
,Container
,DataBound
,DropZone
,Marginable
,MutableContainer
,NamingContextable
,SubordinateTarget
,WComponent
,WebComponent
,Serializable
- Direct Known Subclasses:
WAjaxPollingRegion
,WMessages
public class WPanel extends WContainer implements AjaxInternalTrigger, AjaxTarget, SubordinateTarget, Marginable, DropZone, AccessKeyable
A WPanel is used to group components together. It can optionally provide additional styling for the group, for example to display a titled border. Layouts can be used to arrange components within the panel.
Users can add a
WButton
(setDefaultSubmitButton(WButton)
) to this component that will submit when the user hits the Enter key and the cursor is in an input field inside the panel.- Since:
- 1.0.0
- Author:
- Christina Harris, Yiannis Paschalidis
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WPanel.PanelMode
The available types of panel mode.static class
WPanel.PanelModel
A class used to hold the list of options for this component.static class
WPanel.Type
An enumeration of available panel types.-
Nested classes/interfaces inherited from class com.github.bordertech.wcomponents.AbstractWComponent
AbstractWComponent.WComponentRef
-
-
Field Summary
-
Fields inherited from interface com.github.bordertech.wcomponents.WComponent
DEFAULT_APPLICATION_ID, DEFAULT_INTERNAL_ID, DEFAULT_NO_ID, ID_CONTEXT_SEPERATOR, ID_FRAMEWORK_ASSIGNED_SEPERATOR, ID_VALIDATION_PATTERN
-
-
Constructor Summary
Constructors Constructor Description WPanel()
Creates aWPanel.Type.PLAIN
WPanel.WPanel(WPanel.Type type)
Creates a WPanel of the specified type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(WComponent component, Serializable constraints)
Adds the given component as a child of this component.void
add(WComponent component, Serializable... constraints)
Adds the given component as a child of this component.char
getAccessKey()
protected WPanel.PanelModel
getComponentModel()
Returns the effective component model for this component.WButton
getDefaultSubmitButton()
LayoutManager
getLayout()
Serializable
getLayoutConstraints(WComponent child)
Retrieves the layout constraints for the given component, if they have been set.Margin
getMargin()
Get the margin for the component, or null if not set.WPanel.PanelMode
getMode()
protected WPanel.PanelModel
getOrCreateComponentModel()
Retrieves the model for this component so that it can be modified.String
getTitleText()
WPanel.Type
getType()
protected WPanel.PanelModel
newComponentModel()
Creates a new component model appropriate for this component.void
remove(WComponent aChild)
Removes the given component from this component's list of children.void
setAccessKey(char accessKey)
Set the access key on the component.void
setDefaultSubmitButton(WButton defaultSubmitButton)
Sets the button that should be submitted when the user hits enter key and cursor is inside this panel.void
setLayout(LayoutManager layout)
Sets the panel layout manager.void
setMargin(Margin margin)
Set the margin for the component, or null for no margin.void
setMode(WPanel.PanelMode mode)
Sets this WPanel's mode of operation.void
setTitleText(String title, Serializable... args)
Sets the panel title.void
setType(WPanel.Type type)
Sets the panel type.String
toString()
Creates a String representation of this component; usually for debugging purposes.-
Methods inherited from class com.github.bordertech.wcomponents.WContainer
add, add, getChildAt, getChildCount, getChildren, getIndexOfChild, getNamingContextId, isNamingContext, removeAll, setNamingContext, setTemplate, setTemplate, setTemplateMarkUp
-
Methods inherited from class com.github.bordertech.wcomponents.WBeanComponent
addBeanToScratchMap, doUpdateBeanValue, getBean, getBeanFromScratchMap, getBeanId, getBeanProperty, getBeanProvider, getBeanScratchMap, getBeanValue, getData, isBeanInScratchMap, isChanged, isSearchAncestors, isUseRequestScopeScratchMap, removeBeanFromScratchMap, resetData, setBean, setBeanId, setBeanProperty, setBeanProvider, setData, setSearchAncestors, updateBeanValue
-
Methods inherited from class com.github.bordertech.wcomponents.AbstractWComponent
addHtmlClass, addHtmlClass, addNotify, afterPaint, assertAddSupported, beforePaint, createErrorDiagnostic, createErrorDiagnostic, forward, getAccessibleText, getAttribute, getBaseUrl, getDefaultModel, getEnvironment, getHeaders, getHtmlClass, getHtmlClasses, getId, getIdName, getInternalId, getLabel, getName, getParent, getScratchMap, getTabIndex, getTag, getTemplate, getTemplateMarkUp, getToolTip, handleRequest, hasNoComponentModel, hasTabIndex, initialiseComponentModel, invokeLater, invokeLaters, isDebugStructure, isDefaultState, isFlagSet, isHidden, isInitialised, isLocked, isTracking, isTrackingEnabled, isValidate, isVisible, paint, paintComponent, preparePaint, preparePaintComponent, removeAttribute, removeComponentModel, removeHtmlClass, removeHtmlClass, removeNotify, replaceWComponent, reset, serviceRequest, setAccessibleText, setAttribute, setEnvironment, setFlag, setFocussed, setHidden, setHtmlClass, setHtmlClass, setIdName, setInitialised, setLocked, setTag, setToolTip, setTrackingEnabled, setValidate, setVisible, showErrorIndicators, showErrorIndicatorsForComponent, showWarningIndicators, showWarningIndicatorsForComponent, tidyUpUIContext, tidyUpUIContextForTree, validate, validateComponent, writeReplace
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.github.bordertech.wcomponents.AccessKeyable
getAccessKeyAsString
-
Methods inherited from interface com.github.bordertech.wcomponents.WComponent
addHtmlClass, addHtmlClass, forward, getAccessibleText, getAttribute, getBaseUrl, getEnvironment, getHeaders, getHtmlClass, getHtmlClasses, getId, getIdName, getInternalId, getLabel, getName, getParent, getTabIndex, getTag, getToolTip, handleRequest, hasTabIndex, invokeLater, isDefaultState, isHidden, isInitialised, isLocked, isTracking, isTrackingEnabled, isValidate, isVisible, paint, preparePaint, removeAttribute, removeHtmlClass, removeHtmlClass, reset, serviceRequest, setAccessibleText, setAttribute, setEnvironment, setFocussed, setHtmlClass, setHtmlClass, setIdName, setInitialised, setLocked, setTag, setToolTip, setTrackingEnabled, setValidate, setVisible, showErrorIndicators, showWarningIndicators, tidyUpUIContextForTree, validate
-
-
-
-
Constructor Detail
-
WPanel
public WPanel()
Creates aWPanel.Type.PLAIN
WPanel.
-
WPanel
public WPanel(WPanel.Type type)
Creates a WPanel of the specified type.- Parameters:
type
- the type of panel to create.
-
-
Method Detail
-
setDefaultSubmitButton
public void setDefaultSubmitButton(WButton defaultSubmitButton)
Sets the button that should be submitted when the user hits enter key and cursor is inside this panel.- Parameters:
defaultSubmitButton
- the default submit button.
-
getDefaultSubmitButton
public WButton getDefaultSubmitButton()
- Returns:
- The button that will be submitted if the user hits the enter key when the cursor is in this field.
-
getType
public WPanel.Type getType()
- Returns:
- the panel type.
-
setType
public void setType(WPanel.Type type)
Sets the panel type.- Parameters:
type
- the default panel type.
-
getMode
public WPanel.PanelMode getMode()
- Returns:
- this WPanel's mode of operation
-
setMode
public void setMode(WPanel.PanelMode mode)
Sets this WPanel's mode of operation.- Parameters:
mode
- the mode of operation.
-
setAccessKey
public void setAccessKey(char accessKey)
Description copied from interface:AccessKeyable
Set the access key on the component.- Specified by:
setAccessKey
in interfaceAccessKeyable
- Parameters:
accessKey
- the key that will form a keyboard shortcut to the component.
-
getAccessKey
public char getAccessKey()
- Specified by:
getAccessKey
in interfaceAccessKeyable
- Returns:
- the component's access key.
-
setTitleText
public void setTitleText(String title, Serializable... args)
Sets the panel title.- Parameters:
title
- the panel title to set, usingMessageFormat
syntax.args
- optional arguments for the message format string.
-
getTitleText
public String getTitleText()
- Returns:
- the panel title.
-
setMargin
public void setMargin(Margin margin)
Set the margin for the component, or null for no margin.- Specified by:
setMargin
in interfaceMarginable
- Parameters:
margin
- the margin for the component
-
getMargin
public Margin getMargin()
Get the margin for the component, or null if not set.- Specified by:
getMargin
in interfaceMarginable
- Returns:
- the margin for the component, or null if not set
-
setLayout
public void setLayout(LayoutManager layout)
Sets the panel layout manager.- Parameters:
layout
- the panel layout manager.
-
getLayout
public LayoutManager getLayout()
- Returns:
- the panel layout manager.
-
add
public void add(WComponent component, Serializable... constraints)
Adds the given component as a child of this component. The constraints are made available to the
LayoutManager
if it requires them.- Parameters:
component
- the component to add.constraints
- the layout constraints
-
add
public void add(WComponent component, Serializable constraints)
Adds the given component as a child of this component. The constraints are made available to the
LayoutManager
if it requires them.- Parameters:
component
- the component to add.constraints
- the layout constraints
-
remove
public void remove(WComponent aChild)
Removes the given component from this component's list of children. This method has been overriden to remove any associated layout constraints.- Specified by:
remove
in interfaceMutableContainer
- Overrides:
remove
in classWContainer
- Parameters:
aChild
- the child component to remove
-
toString
public String toString()
Creates a String representation of this component; usually for debugging purposes.- Overrides:
toString
in classAbstractWComponent
- Returns:
- a String representation of this component.
-
getLayoutConstraints
public Serializable getLayoutConstraints(WComponent child)
Retrieves the layout constraints for the given component, if they have been set.- Parameters:
child
- the child component to retrieve the constraints for.- Returns:
- the layout constraints for the given child, if set.
-
getComponentModel
protected WPanel.PanelModel getComponentModel()
Returns the effective component model for this component. Subclass may override this method to narrow the return type to their specific model type.- Overrides:
getComponentModel
in classWBeanComponent
- Returns:
- the effective component model
-
getOrCreateComponentModel
protected WPanel.PanelModel getOrCreateComponentModel()
Retrieves the model for this component so that it can be modified. If this method is called during request processing, and a session specific model does not yet exist, then a new model is created. Subclasses may override this method to narrow the return type to their specific model type.- Overrides:
getOrCreateComponentModel
in classWBeanComponent
- Returns:
- the model for this component
-
newComponentModel
protected WPanel.PanelModel newComponentModel()
Creates a new component model appropriate for this component.- Overrides:
newComponentModel
in classWBeanComponent
- Returns:
- a new PanelModel.
-
-