Class AbstractComponent<CC extends Component>
- All Implemented Interfaces:
Component
- Direct Known Subclasses:
AbstractLabeledComponent
WHEN SUBCLASSING:
you need to override mapAllAttributesTo(ch.tocco.nice2.model.form.api.components.Component)
and implement newInstanceForCopy(ch.tocco.nice2.model.form.api.components.Component)
!
WHEN ADDING NEW ATTRIBUTES here or in subclasses:
you need to copy them in mapAllAttributesTo(ch.tocco.nice2.model.form.api.components.Component)
!
-
Nested Class Summary
Nested classes/interfaces inherited from interface ch.tocco.nice2.model.form.api.components.Component
Component.ComponentFilter, Component.DataNavigationType, Component.DisplayType, Component.Position
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractComponent
(boolean acceptChildren, @Nullable Component parent) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addComponent
(Component component) Deprecated.Not final anymore, at least DefaultTable overrides this.void
addComponent
(Component component, int index) Deprecated.Adds a child component to the child-list of this component at the specified index.Deprecated.void
Deprecated.Internal method for recursive loops.final CC
Deprecated.Do not remove the final modifier! Instead use the template method property.final CC
createCopy
(Component newParent) Deprecated.Do not remove the final modifier! Instead use the template method property.boolean
Deprecated.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 Component
findFirst
(Component.ComponentFilter filter) Deprecated.Returns the first component that match the given filter.@Nullable Component
findFirstByName
(String pattern) Deprecated.Deprecated.@Nullable Component
Deprecated.Returns the child with the given name, or null.Collection
<? extends Component> Deprecated.Previously final, but wanted specialized return type.Deprecated.Deprecated.Deprecated.@Nullable Form
getForm()
Deprecated.Returns the parent form, if any.final String
getName()
Deprecated.final @Nullable Component
Deprecated.Every component has a reference to its parent except for the root-components (forms, templates).final Component
Deprecated.Returns the parent, or an exception for root components (forms, templates).final Component.Position
Deprecated.final String
Deprecated.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.int
hashCode()
Deprecated.final boolean
Deprecated.boolean
Deprecated.final boolean
isLeaf()
Deprecated.Tells if this component is at an end of the tree.boolean
Deprecated.protected void
mapAllAttributesTo
(Component comp) Deprecated.Copies the attributes of this component into the passed component.protected abstract CC
newInstanceForCopy
(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.void
overrideParent
(@Nullable Component parent) Deprecated.Overrides the parent.final boolean
removeComponent
(String name) Deprecated.Removes a component by its name, return false if the component couldn't be foundvoid
replaceComponent
(Component oldComponent, Component newComponent) Deprecated.Replaces oldComponent with newComponent.void
replaceComponent
(String oldComponentName, Component newComponent) Deprecated.void
setAttributeProps
(Map<String, Object> attributeProps) Deprecated.final void
setChildren
(Collection<Component> setChildren) Deprecated.Set the children explicitvoid
setDisplayType
(Component.DisplayType displayType) Deprecated.void
setEventHandler
(@Nullable String eventHandler) Deprecated.void
setExtProps
(Map<String, Object> extProps) Deprecated.void
setForceEditable
(boolean forceEditable) Deprecated.void
Deprecated.final void
Deprecated.final void
Deprecated.void
setReplace
(boolean replace) Deprecated.void
Deprecated.toString()
Deprecated.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.tocco.nice2.model.form.api.components.Component
getDataNavigationType, wrap
-
Field Details
-
name
Deprecated.the name of the component -
extProps
Deprecated. -
attributeProps
Deprecated.
-
-
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:Component
Walks through the component tree and compares the component's name with thepattern
.- Specified by:
findByName
in 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:
findFirstByName
in interfaceComponent
-
findByType
Deprecated.//TODO this impl is untested.- Specified by:
findByType
in 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:Component
Returns all components that match the given filter.Iterates the component tree, doing children recursively of each item first.
-
findFirst
Deprecated.Description copied from interface:Component
Returns 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:Component
Every 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:Component
Overrides 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:
overrideParent
in interfaceComponent
- Parameters:
parent
- The new one.
-
getParentOrEx
Deprecated.Description copied from interface:Component
Returns the parent, or an exception for root components (forms, templates).- Specified by:
getParentOrEx
in interfaceComponent
- Returns:
- The parent, or an ex if it is null.
- See Also:
-
hasParent
public final boolean hasParent()Deprecated. -
getForm
Deprecated.Description copied from interface:Component
Returns the parent form, if any. This loops all all parents until it either finds a form, or arrives at the top. -
getName
Deprecated. -
createCopy
Deprecated.Do not remove the final modifier! Instead use the template method property. You need to overridenewInstanceForCopy(ch.tocco.nice2.model.form.api.components.Component)
andmapAllAttributesTo(ch.tocco.nice2.model.form.api.components.Component)
.- Specified by:
createCopy
in interfaceComponent
- Returns:
- the copy
-
createCopy
Deprecated.Do not remove the final modifier! Instead use the template method property. You need to overridenewInstanceForCopy(ch.tocco.nice2.model.form.api.components.Component)
andmapAllAttributesTo(ch.tocco.nice2.model.form.api.components.Component)
.- Specified by:
createCopy
in 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
Deprecated. -
isLeaf
public final boolean isLeaf()Deprecated.Description copied from interface:Component
Tells 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:
getDisplayType
in interfaceComponent
-
isForceEditable
public boolean isForceEditable()Deprecated.- Specified by:
isForceEditable
in interfaceComponent
-
isReplace
public boolean isReplace()Deprecated. -
getChildren
Deprecated.Previously final, but wanted specialized return type.- Specified by:
getChildren
in interfaceComponent
- Returns:
- iterator
-
collectDataParts
Deprecated.- Specified by:
collectDataParts
in interfaceComponent
-
collectDataParts
Deprecated.Description copied from interface:Component
Internal method for recursive loops.- Specified by:
collectDataParts
in interfaceComponent
- Parameters:
path
- .collector
- .
-
setChildren
Deprecated.Description copied from interface:Component
Set the children explicit- Specified by:
setChildren
in interfaceComponent
- Parameters:
setChildren
- childern
-
setName
Deprecated. -
addComponent
Deprecated.Description copied from interface:Component
Adds a child component to the child-list of this component at the specified index.- Specified by:
addComponent
in interfaceComponent
-
addComponent
Deprecated.Not final anymore, at least DefaultTable overrides this.- Specified by:
addComponent
in interfaceComponent
- Parameters:
component
- Child to add.- Throws:
IllegalArgumentException
-
removeComponent
Deprecated.Description copied from interface:Component
Removes a component by its name, return false if the component couldn't be found- Specified by:
removeComponent
in interfaceComponent
- Parameters:
name
- The component-name
-
getChild
Deprecated.Description copied from interface:Component
Returns the child with the given name, or null. -
replaceComponent
Deprecated.Description copied from interface:Component
Replaces oldComponent with newComponent.- Specified by:
replaceComponent
in interfaceComponent
- Parameters:
oldComponent
- Component to remove.newComponent
- Component to add (on position of the old one)
-
replaceComponent
Deprecated.- Specified by:
replaceComponent
in interfaceComponent
-
setDisplayType
Deprecated.- Specified by:
setDisplayType
in interfaceComponent
-
setForceEditable
public void setForceEditable(boolean forceEditable) Deprecated.- Specified by:
setForceEditable
in interfaceComponent
-
setReplace
public void setReplace(boolean replace) Deprecated.- Specified by:
setReplace
in interfaceComponent
-
toString
Deprecated. -
setPosition
Deprecated.- Specified by:
setPosition
in interfaceComponent
-
setRelativeToPositionName
Deprecated.- Specified by:
setRelativeToPositionName
in interfaceComponent
-
getPosition
Deprecated.- Specified by:
getPosition
in interfaceComponent
- Returns:
- the position
-
getRelativeToPositionName
Deprecated.Description copied from interface:Component
Get the name of the component this component has its relative-position to.- Specified by:
getRelativeToPositionName
in interfaceComponent
- Returns:
- name or null.
-
getExtProps
Deprecated.- Specified by:
getExtProps
in interfaceComponent
-
setExtProps
Deprecated.- Specified by:
setExtProps
in interfaceComponent
-
getAttributeProps
Deprecated.- Specified by:
getAttributeProps
in interfaceComponent
-
setAttributeProps
Deprecated.- Specified by:
setAttributeProps
in interfaceComponent
-
getEventHandler
Deprecated.- Specified by:
getEventHandler
in interfaceComponent
-
setEventHandler
Deprecated.- Specified by:
setEventHandler
in interfaceComponent
-
equals
Deprecated. -
hashCode
public int hashCode()Deprecated. -
setScopes
Deprecated. -
getScopes
Deprecated.Description copied from interface:Component
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.
-