Class AbstractComponent<CC extends Component>
- All Implemented Interfaces:
Component
- Direct Known Subclasses:
AbstractLabeledComponent
WHEN SUBCLASSING:
you need to override mapAllAttributesTo(Component) and implement newInstanceForCopy(Component)!
WHEN ADDING NEW ATTRIBUTES here or in subclasses:
you need to copy them in mapAllAttributesTo(Component)!
-
Nested Class Summary
Nested classes/interfaces inherited from interface Component
Component.ComponentFilter, Component.DataNavigationType, Component.DisplayType, Component.Position -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractComponent(boolean acceptChildren, @Nullable Component parent) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddComponent(Component component) Deprecated.Not final anymore, at least DefaultTable overrides this.voidaddComponent(Component component, int index) Deprecated.Adds a child component to the child-list of this component at the specified index.Deprecated.voidDeprecated.Internal method for recursive loops.final CCDeprecated.Do not remove the final modifier! Instead use the template method property.final CCcreateCopy(Component newParent) Deprecated.Do not remove the final modifier! Instead use the template method property.booleanDeprecated.find(Component.ComponentFilter filter) Deprecated.Returns all components that match the given filter.findByName(String pattern) Deprecated.Walks through the component tree and compares the component's name with thepattern.findByType(Class<? extends Component> type) Deprecated.//TODO this impl is untested.@Nullable ComponentfindFirst(Component.ComponentFilter filter) Deprecated.Returns the first component that match the given filter.@Nullable ComponentfindFirstByName(String pattern) Deprecated.Deprecated.@Nullable ComponentDeprecated.Returns the child with the given name, or null.Collection<? extends Component> Deprecated.Previously final, but wanted specialized return type.Deprecated.Deprecated.Deprecated.@Nullable FormgetForm()Deprecated.Returns the parent form, if any.final StringgetName()Deprecated.final @Nullable ComponentDeprecated.Every component has a reference to its parent except for the root-components (forms, templates).final ComponentDeprecated.Returns the parent, or an exception for root components (forms, templates).final Component.PositionDeprecated.final StringDeprecated.Get the name of the component this component has its relative-position to.Deprecated.Returns the scopes as defined in the component, or an empty set if none were defined which means that this component is meant for all scopes.getType()Deprecated.inthashCode()Deprecated.final booleanDeprecated.booleanDeprecated.final booleanisLeaf()Deprecated.Tells if this component is at an end of the tree.booleanDeprecated.protected voidmapAllAttributesTo(Component comp) Deprecated.Copies the attributes of this component into the passed component.protected abstract CCnewInstanceForCopy(Component parent) Deprecated.Will be called when a copy is requestedComponent.createCopy()! Create a new instanc of this component, copy the properties and return it.voidoverrideParent(@Nullable Component parent) Deprecated.Overrides the parent.final booleanremoveComponent(String name) Deprecated.Removes a component by its name, return false if the component couldn't be foundvoidreplaceComponent(Component oldComponent, Component newComponent) Deprecated.Replaces oldComponent with newComponent.voidreplaceComponent(String oldComponentName, Component newComponent) Deprecated.voidsetAttributeProps(Map<String, Object> attributeProps) Deprecated.final voidsetChildren(Collection<Component> setChildren) Deprecated.Set the children explicitvoidsetDisplayType(Component.DisplayType displayType) Deprecated.voidsetEventHandler(@Nullable String eventHandler) Deprecated.voidsetExtProps(Map<String, Object> extProps) Deprecated.voidsetForceEditable(boolean forceEditable) Deprecated.voidDeprecated.final voidDeprecated.final voidDeprecated.voidsetReplace(boolean replace) Deprecated.voidDeprecated.toString()Deprecated.Methods inherited from interface Component
getDataNavigationType, wrap
-
Field Details
-
name
-
extProps
-
attributeProps
-
-
Constructor Details
-
AbstractComponent
Deprecated.- Parameters:
acceptChildren- set this explicit in your constructor. If true, the implementation will accept children, (For exaple an group-component), otherwise not (For example a textfield-component).parent- The parent of this component, null if none.
-
-
Method Details
-
findByName
Deprecated.Description copied from interface:ComponentWalks through the component tree and compares the component's name with thepattern.- Specified by:
findByNamein interfaceComponent- Parameters:
pattern- The name of the component we search (regular expressions are supported)- Returns:
- ordered list of components (flat structure).
-
findFirstByName
Deprecated.- Specified by:
findFirstByNamein interfaceComponent
-
findByType
Deprecated.//TODO this impl is untested.- Specified by:
findByTypein interfaceComponent- Parameters:
type- component type, eg InputComponent.class- Returns:
- ordered list of components (flat structure) it may be, that you
can access components in the list through the
Component.getChildren()method aswell.
-
find
Deprecated.Description copied from interface:ComponentReturns all components that match the given filter.Iterates the component tree, doing children recursively of each item first.
-
findFirst
Deprecated.Description copied from interface:ComponentReturns the first component that match the given filter.Iterates the component tree, doing children recursively of each item first.
-
getParent
Deprecated.Description copied from interface:ComponentEvery component has a reference to its parent except for the root-components (forms, templates).
So this condition has to be true:
for(Compoent child : parent.getChildren())
assert child.getParent().equals(parent);
} -
overrideParent
Deprecated.Description copied from interface:ComponentOverrides the parent.Originally this was not possible, the parent was final. But it is required for dynamically wrapping components in other components, see the table as an example which wraps fields in columns.
- Specified by:
overrideParentin interfaceComponent- Parameters:
parent- The new one.
-
getParentOrEx
Deprecated.Description copied from interface:ComponentReturns the parent, or an exception for root components (forms, templates).- Specified by:
getParentOrExin interfaceComponent- Returns:
- The parent, or an ex if it is null.
- See Also:
-
hasParent
-
getForm
-
getName
-
createCopy
Deprecated.Do not remove the final modifier! Instead use the template method property. You need to overridenewInstanceForCopy(Component)andmapAllAttributesTo(Component).- Specified by:
createCopyin interfaceComponent- Returns:
- the copy
-
createCopy
Deprecated.Do not remove the final modifier! Instead use the template method property. You need to overridenewInstanceForCopy(Component)andmapAllAttributesTo(Component).- Specified by:
createCopyin interfaceComponent- Parameters:
newParent- the new parent- Returns:
- the copy
-
mapAllAttributesTo
Deprecated.Copies the attributes of this component into the passed component.This is used to copy the attributes collected by the xml reading process from "general" field tags into datatype-specific customized fields (mapped by FieldComponentConverter). And also for copying instances, kind of like cloning.
Override this in your subclasses. Also, subclasses are required to let their anchestors do their work using
super.copyOtherFields(cpy).- Parameters:
comp- The new field into which everything needs to be copied.
-
newInstanceForCopy
Deprecated.Will be called when a copy is requestedComponent.createCopy()! Create a new instanc of this component, copy the properties and return it. You don't have to copy the properties which are inherited from the abstract implmentation. Only copy the properties from the concrete implementation.
The parent has to be the parent given in the argument parent- Parameters:
parent- the parent to set- Returns:
- the new instance
-
getType
-
isLeaf
public final boolean isLeaf()Deprecated.Description copied from interface:ComponentTells if this component is at an end of the tree.More precise, it means the component has no children. It also returns true if the component is not meant to be a leaf, but happens to have no children, or the children are disabled or something (wrapper). This could even happen to a Form component.
-
getDisplayType
Deprecated.- Specified by:
getDisplayTypein interfaceComponent
-
isForceEditable
-
isReplace
-
getChildren
Deprecated.Previously final, but wanted specialized return type.- Specified by:
getChildrenin interfaceComponent- Returns:
- iterator
-
collectDataParts
-
collectDataParts
-
setChildren
Deprecated.Description copied from interface:ComponentSet the children explicit- Specified by:
setChildrenin interfaceComponent- Parameters:
setChildren- childern
-
setName
-
addComponent
Deprecated.Description copied from interface:ComponentAdds a child component to the child-list of this component at the specified index.- Specified by:
addComponentin interfaceComponent
-
addComponent
Deprecated.Not final anymore, at least DefaultTable overrides this.- Specified by:
addComponentin interfaceComponent- Parameters:
component- Child to add.- Throws:
IllegalArgumentException
-
removeComponent
Deprecated.Description copied from interface:ComponentRemoves a component by its name, return false if the component couldn't be found- Specified by:
removeComponentin interfaceComponent- Parameters:
name- The component-name
-
getChild
-
replaceComponent
Deprecated.Description copied from interface:ComponentReplaces oldComponent with newComponent.- Specified by:
replaceComponentin interfaceComponent- Parameters:
oldComponent- Component to remove.newComponent- Component to add (on position of the old one)
-
replaceComponent
Deprecated.- Specified by:
replaceComponentin interfaceComponent
-
setDisplayType
Deprecated.- Specified by:
setDisplayTypein interfaceComponent
-
setForceEditable
public void setForceEditable(boolean forceEditable) Deprecated.- Specified by:
setForceEditablein interfaceComponent
-
setReplace
-
toString
-
setPosition
Deprecated.- Specified by:
setPositionin interfaceComponent
-
setRelativeToPositionName
Deprecated.- Specified by:
setRelativeToPositionNamein interfaceComponent
-
getPosition
Deprecated.- Specified by:
getPositionin interfaceComponent- Returns:
- the position
-
getRelativeToPositionName
Deprecated.Description copied from interface:ComponentGet the name of the component this component has its relative-position to.- Specified by:
getRelativeToPositionNamein interfaceComponent- Returns:
- name or null.
-
getExtProps
Deprecated.- Specified by:
getExtPropsin interfaceComponent
-
setExtProps
Deprecated.- Specified by:
setExtPropsin interfaceComponent
-
getAttributeProps
Deprecated.- Specified by:
getAttributePropsin interfaceComponent
-
setAttributeProps
Deprecated.- Specified by:
setAttributePropsin interfaceComponent
-
getEventHandler
-
setEventHandler
Deprecated.- Specified by:
setEventHandlerin interfaceComponent
-
equals
-
hashCode
-
setScopes
-
getScopes
Deprecated.Description copied from interface:ComponentReturns the scopes as defined in the component, or an empty set if none were defined which means that this component is meant for all scopes.
-