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 theContainerinterface. 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 aWPanelinstead.- 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 voidadd(WComponent component)Adds the given component as a "shared" child of this component.voidadd(WComponent component, String tag)Deprecated.UseWTemplateinstead.WComponentgetChildAt(int index)Retrieves a child component by its index.intgetChildCount()List<WComponent>getChildren()Retrieves a list of this Container's.intgetIndexOfChild(WComponent childComponent)Retrieves the index of the given child.StringgetNamingContextId()Allow components that implementNamingContextableto selectively disable prepending their ID to their descendent's IDs by breaking the prepending logic into a seperately callable method.booleanisNamingContext()A naming context is only considered active if an Id name has been set.voidremove(WComponent child)Removes the given component from this components "shared" list of children.voidremoveAll()Removes all the "shared" children from this component.voidsetNamingContext(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).voidsetTemplate(Class clazz)Deprecated.usesetTemplate(String).voidsetTemplate(String templateUrl)Deprecated.UseWTemplateinsteadvoidsetTemplateMarkUp(String markUp)Deprecated.UseWTemplateinstead-
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:
addin interfaceMutableContainer- Parameters:
component- the component to add.
-
add
@Deprecated public void add(WComponent component, String tag)
Deprecated.UseWTemplateinstead.
-
getChildAt
public WComponent getChildAt(int index)
Retrieves a child component by its index.- Specified by:
getChildAtin 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:
getChildCountin interfaceContainer- Returns:
- the number of child components currently contained within this component.
-
getChildren
public List<WComponent> getChildren()
Description copied from interface:ContainerRetrieves a list of this Container's.- Specified by:
getChildrenin 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:
removein interfaceMutableContainer- Parameters:
child- the child component to remove
-
removeAll
public void removeAll()
Removes all the "shared" children from this component.- Specified by:
removeAllin interfaceMutableContainer
-
getIndexOfChild
public int getIndexOfChild(WComponent childComponent)
Retrieves the index of the given child.- Specified by:
getIndexOfChildin 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.UseWTemplateinstead
-
setTemplateMarkUp
@Deprecated public void setTemplateMarkUp(String markUp)
Deprecated.UseWTemplateinstead
-
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:
isNamingContextin interfaceNamingContextable- Returns:
- true if active naming context.
-
getNamingContextId
public String getNamingContextId()
Allow components that implementNamingContextableto 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:
getNamingContextIdin interfaceNamingContextable- Returns:
- by default, return getId().
-
-