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 classWPanel.PanelModeThe available types of panel mode.static classWPanel.PanelModelA class used to hold the list of options for this component.static classWPanel.TypeAn 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.PLAINWPanel.WPanel(WPanel.Type type)Creates a WPanel of the specified type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(WComponent component, Serializable constraints)Adds the given component as a child of this component.voidadd(WComponent component, Serializable... constraints)Adds the given component as a child of this component.chargetAccessKey()protected WPanel.PanelModelgetComponentModel()Returns the effective component model for this component.WButtongetDefaultSubmitButton()LayoutManagergetLayout()SerializablegetLayoutConstraints(WComponent child)Retrieves the layout constraints for the given component, if they have been set.MargingetMargin()Get the margin for the component, or null if not set.WPanel.PanelModegetMode()protected WPanel.PanelModelgetOrCreateComponentModel()Retrieves the model for this component so that it can be modified.StringgetTitleText()WPanel.TypegetType()protected WPanel.PanelModelnewComponentModel()Creates a new component model appropriate for this component.voidremove(WComponent aChild)Removes the given component from this component's list of children.voidsetAccessKey(char accessKey)Set the access key on the component.voidsetDefaultSubmitButton(WButton defaultSubmitButton)Sets the button that should be submitted when the user hits enter key and cursor is inside this panel.voidsetLayout(LayoutManager layout)Sets the panel layout manager.voidsetMargin(Margin margin)Set the margin for the component, or null for no margin.voidsetMode(WPanel.PanelMode mode)Sets this WPanel's mode of operation.voidsetTitleText(String title, Serializable... args)Sets the panel title.voidsetType(WPanel.Type type)Sets the panel type.StringtoString()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.PLAINWPanel.
-
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:AccessKeyableSet the access key on the component.- Specified by:
setAccessKeyin interfaceAccessKeyable- Parameters:
accessKey- the key that will form a keyboard shortcut to the component.
-
getAccessKey
public char getAccessKey()
- Specified by:
getAccessKeyin 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, usingMessageFormatsyntax.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:
setMarginin 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:
getMarginin 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
LayoutManagerif 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
LayoutManagerif 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:
removein interfaceMutableContainer- Overrides:
removein classWContainer- Parameters:
aChild- the child component to remove
-
toString
public String toString()
Creates a String representation of this component; usually for debugging purposes.- Overrides:
toStringin 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:
getComponentModelin 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:
getOrCreateComponentModelin classWBeanComponent- Returns:
- the model for this component
-
newComponentModel
protected WPanel.PanelModel newComponentModel()
Creates a new component model appropriate for this component.- Overrides:
newComponentModelin classWBeanComponent- Returns:
- a new PanelModel.
-
-