Class WContainer
- java.lang.Object
-
- com.github.bordertech.wcomponents.AbstractWComponent
-
- com.github.bordertech.wcomponents.WBeanComponent
-
- com.github.bordertech.wcomponents.WContainer
-
- All Implemented Interfaces:
BeanAware
,BeanBound
,BeanProviderBound
,Container
,DataBound
,MutableContainer
,NamingContextable
,WComponent
,WebComponent
,Serializable
- Direct Known Subclasses:
WBeanContainer
,WDataRenderer
,WNamingContext
,WPanel
public class WContainer extends WBeanComponent implements MutableContainer
A default implementation of theContainer
interface. This can be used as a generic container for components which do not need to be referenced together. If you need to target a collection of components for use in e.g. AJAX, you should use aWPanel
instead.- Since:
- 1.0.0
- Author:
- Yiannis Paschalidis
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
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 WContainer()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
add(WComponent component)
Adds the given component as a "shared" child of this component.void
add(WComponent component, String tag)
Deprecated.UseWTemplate
instead.WComponent
getChildAt(int index)
Retrieves a child component by its index.int
getChildCount()
List<WComponent>
getChildren()
Retrieves a list of this Container's.int
getIndexOfChild(WComponent childComponent)
Retrieves the index of the given child.String
getNamingContextId()
Allow components that implementNamingContextable
to selectively disable prepending their ID to their descendent's IDs by breaking the prepending logic into a seperately callable method.boolean
isNamingContext()
A naming context is only considered active if an Id name has been set.void
remove(WComponent child)
Removes the given component from this components "shared" list of children.void
removeAll()
Removes all the "shared" children from this component.void
setNamingContext(boolean context)
A naming context is only considered active if it has been set active viasetNamingContext(boolean)
and also has an id name set viaAbstractWComponent.setIdName(String)
.void
setTemplate(Class clazz)
Deprecated.usesetTemplate(String)
.void
setTemplate(String templateUrl)
Deprecated.UseWTemplate
insteadvoid
setTemplateMarkUp(String markUp)
Deprecated.UseWTemplate
instead-
Methods inherited from class com.github.bordertech.wcomponents.WBeanComponent
addBeanToScratchMap, doUpdateBeanValue, getBean, getBeanFromScratchMap, getBeanId, getBeanProperty, getBeanProvider, getBeanScratchMap, getBeanValue, getComponentModel, getData, getOrCreateComponentModel, isBeanInScratchMap, isChanged, isSearchAncestors, isUseRequestScopeScratchMap, newComponentModel, 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, toString, 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.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
-
-
-
-
Method Detail
-
add
public void add(WComponent component)
Adds the given component as a "shared" child of this component.- Specified by:
add
in interfaceMutableContainer
- Parameters:
component
- the component to add.
-
add
@Deprecated public void add(WComponent component, String tag)
Deprecated.UseWTemplate
instead.
-
getChildAt
public WComponent getChildAt(int index)
Retrieves a child component by its index.- Specified by:
getChildAt
in interfaceContainer
- Parameters:
index
- the index of the child component to be retrieved.- Returns:
- the child component at the given index.
-
getChildCount
public int getChildCount()
- Specified by:
getChildCount
in interfaceContainer
- Returns:
- the number of child components currently contained within this component.
-
getChildren
public List<WComponent> getChildren()
Description copied from interface:Container
Retrieves a list of this Container's.- Specified by:
getChildren
in interfaceContainer
- Returns:
- an immutable list of this Container.
-
remove
public void remove(WComponent child)
Removes the given component from this components "shared" list of children.- Specified by:
remove
in interfaceMutableContainer
- Parameters:
child
- the child component to remove
-
removeAll
public void removeAll()
Removes all the "shared" children from this component.- Specified by:
removeAll
in interfaceMutableContainer
-
getIndexOfChild
public int getIndexOfChild(WComponent childComponent)
Retrieves the index of the given child.- Specified by:
getIndexOfChild
in interfaceContainer
- Parameters:
childComponent
- the child component to retrieve the index for.- Returns:
- the index of the given child component, or -1 if the component is not a child of this component.
-
setTemplate
@Deprecated public void setTemplate(String templateUrl)
Deprecated.UseWTemplate
instead
-
setTemplateMarkUp
@Deprecated public void setTemplateMarkUp(String markUp)
Deprecated.UseWTemplate
instead
-
setTemplate
@Deprecated public void setTemplate(Class clazz)
Deprecated.usesetTemplate(String)
.Associates a velocity template with this component. A simple mapping is applied to the given class to derive the name of a velocity template.For instance, com.github.bordertech.wcomponents.WTextField would map to the template com/github/bordertech/wcomponents/WTextField.vm
- Parameters:
clazz
- the class to use to retrieve the template.
-
setNamingContext
public void setNamingContext(boolean context)
A naming context is only considered active if it has been set active viasetNamingContext(boolean)
and also has an id name set viaAbstractWComponent.setIdName(String)
.- Parameters:
context
- set true if this is a naming context.
-
isNamingContext
public boolean isNamingContext()
A naming context is only considered active if an Id name has been set.- Specified by:
isNamingContext
in interfaceNamingContextable
- Returns:
- true if active naming context.
-
getNamingContextId
public String getNamingContextId()
Allow components that implementNamingContextable
to selectively disable prepending their ID to their descendent's IDs by breaking the prepending logic into a seperately callable method.See
WComponent.getId()
for usage.By default, this method will call through to
WComponent.getId()
and return the result.- Specified by:
getNamingContextId
in interfaceNamingContextable
- Returns:
- by default, return getId().
-
-