Class WFieldSet
-
- All Implemented Interfaces:
AjaxTarget,Container,Diagnosable,DropZone,Mandatable,Marginable,MultiInputComponent,MutableContainer,NamingContextable,SubordinateTarget,WComponent,WebComponent,Serializable
public class WFieldSet extends AbstractMutableContainer implements AjaxTarget, SubordinateTarget, Mandatable, Marginable, DropZone, MultiInputComponent, Diagnosable
WFieldSet is used to logically group together input fields. It can be used to optionally render a border and title around the fields.- Since:
- 1.0.0
- Author:
- Yiannis Paschalidis
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWFieldSet.FieldSetModelHolds the extrinsic state information of the component.static classWFieldSet.FrameTypeDescribes how the field set's frame is rendered.-
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 WFieldSet(WComponent title)Creates a WFieldSet.WFieldSet(String title)Creates a WFieldSet.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DiagnosticcreateMandatoryDiagnostic()This method is called by validateComponent to create the mandatory diagnostic error message if the mandatory validation check does not pass.protected WFieldSet.FieldSetModelgetComponentModel()Returns the effective component model for this component.List<Diagnostic>getDiagnostics(int severity)WFieldSet.FrameTypegetFrameType()MargingetMargin()Get the margin for the component, or null if not set.protected WFieldSet.FieldSetModelgetOrCreateComponentModel()Retrieves the model for this component so that it can be modified.WDecoratedLabelgetTitle()booleanisMandatory()Indicates whether this fieldset is mandatory in the given context.protected WFieldSet.FieldSetModelnewComponentModel()Creates a new Component model.voidsetFrameType(WFieldSet.FrameType frameType)voidsetMandatory(boolean mandatory)Set whether or not this field set is mandatory.voidsetMandatory(boolean mandatory, String message)Set whether or not this field set is mandatory, and customise the error message that will be displayed.voidsetMargin(Margin margin)Set the margin for the component, or null for no margin.voidsetTitle(WComponent title)voidsetTitle(String title)protected voidshowErrorIndicatorsForComponent(List<Diagnostic> diags)This does not affect the diag list at all.protected voidshowWarningIndicatorsForComponent(List<Diagnostic> diags)This does not affect the diag list at all.StringtoString()Creates a String representation of this component; usually for debugging purposes.protected voidvalidateComponent(List<Diagnostic> diags)Subclasses may override to provide validation.-
Methods inherited from class com.github.bordertech.wcomponents.AbstractMutableContainer
add, add, remove, removeAll
-
Methods inherited from class com.github.bordertech.wcomponents.AbstractNamingContextContainer
getNamingContextId, isNamingContext, setNamingContext
-
Methods inherited from class com.github.bordertech.wcomponents.AbstractContainer
getChildAt, getChildCount, getChildren, getIndexOfChild
-
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, showWarningIndicators, tidyUpUIContext, tidyUpUIContextForTree, validate, 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.Container
getChildAt, getChildCount, getChildren, getIndexOfChild
-
Methods inherited from interface com.github.bordertech.wcomponents.NamingContextable
getNamingContextId, isNamingContext
-
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
-
WFieldSet
public WFieldSet(String title)
Creates a WFieldSet.- Parameters:
title- the fieldset title.
-
WFieldSet
public WFieldSet(WComponent title)
Creates a WFieldSet.- Parameters:
title- the fieldset title.
-
-
Method Detail
-
getFrameType
public WFieldSet.FrameType getFrameType()
- Returns:
- Returns the frameType.
-
setFrameType
public void setFrameType(WFieldSet.FrameType frameType)
- Parameters:
frameType- The frameType to set.
-
getTitle
public WDecoratedLabel getTitle()
- Returns:
- Returns the title.
-
setTitle
public void setTitle(String title)
- Parameters:
title- The title to set.
-
setTitle
public void setTitle(WComponent title)
- Parameters:
title- The title to set.
-
setMandatory
public void setMandatory(boolean mandatory, String message)Set whether or not this field set is mandatory, and customise the error message that will be displayed.- Parameters:
mandatory- true for mandatory, false for optional.message- the message to display to the user on mandatory validation failure.
-
setMandatory
public void setMandatory(boolean mandatory)
Set whether or not this field set is mandatory.- Specified by:
setMandatoryin interfaceMandatable- Parameters:
mandatory- if true, the fieldset is mandatory.
-
isMandatory
public boolean isMandatory()
Indicates whether this fieldset is mandatory in the given context.- Specified by:
isMandatoryin interfaceMandatable- Returns:
- true if this fieldset is mandatory in the given context.
-
validateComponent
protected void validateComponent(List<Diagnostic> diags)
Subclasses may override to provide validation.- Overrides:
validateComponentin classAbstractWComponent- Parameters:
diags- the list into which any validation diagnostics are added.
-
createMandatoryDiagnostic
protected Diagnostic createMandatoryDiagnostic()
This method is called by validateComponent to create the mandatory diagnostic error message if the mandatory validation check does not pass.
Subclasses may override this method to customise the message, however in most cases it is easier to supply a custom error message pattern to the setMandatory method.
- Returns:
- a new diagnostic for when mandatory validation fails.
-
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
-
toString
public String toString()
Description copied from class:AbstractWComponentCreates a String representation of this component; usually for debugging purposes.- Overrides:
toStringin classAbstractWComponent- Returns:
- a String representation of this component, for debugging purposes.
-
showErrorIndicatorsForComponent
protected final void showErrorIndicatorsForComponent(List<Diagnostic> diags)
This does not affect the diag list at all. The ValidatableComponent should visually mark any fields or blocks that have errors in the given diag list.
- Overrides:
showErrorIndicatorsForComponentin classAbstractWComponent- Parameters:
diags- the list of diagnostics for this component.
-
showWarningIndicatorsForComponent
protected final void showWarningIndicatorsForComponent(List<Diagnostic> diags)
This does not affect the diag list at all. The ValidatableComponent should visually mark any fields or blocks that have warnings in the given diag list.
- Overrides:
showWarningIndicatorsForComponentin classAbstractWComponent- Parameters:
diags- the list of diagnostics for this component.
-
getDiagnostics
public List<Diagnostic> getDiagnostics(int severity)
- Specified by:
getDiagnosticsin interfaceDiagnosable- Parameters:
severity- the diagnostic level we are interested in- Returns:
- the list of diagnostics for the component.
-
newComponentModel
protected WFieldSet.FieldSetModel newComponentModel()
Creates a new Component model.- Overrides:
newComponentModelin classAbstractWComponent- Returns:
- a new FieldSetModel.
-
getComponentModel
protected WFieldSet.FieldSetModel 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 classAbstractWComponent- Returns:
- the effective component model
-
getOrCreateComponentModel
protected WFieldSet.FieldSetModel 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 classAbstractWComponent- Returns:
- the model for this component
-
-