Class ActionGroupModelImpl
java.lang.Object
ch.tocco.nice2.netui.impl.actions.ActionModelImpl
ch.tocco.nice2.netui.impl.actions.ActionGroupModelImpl
- All Implemented Interfaces:
ActionGroupModel,ActionModel,Serializable,Iterable<ActionModel>
An action group model specifies all properties for an action group.
- See Also:
-
Field Summary
Fields inherited from interface ch.tocco.nice2.netui.api.actions.ActionGroupModel
NO_DEFAULT_ACTION, UNSPECIFIED_DEFAULT_ACTION -
Constructor Summary
ConstructorsConstructorDescriptionActionGroupModelImpl(String id, String name, @Nullable ActionModel... actions) ActionGroupModelImpl(String id, String name, @Nullable Collection<ActionModel> actions) -
Method Summary
Modifier and TypeMethodDescriptionReturns the child actions of this group as an unmodifiable list.voidaddAction(ActionModel action) Adds the specified action unmodified to this action array.deepCopy()Creates a deep copy of this group.booleanfindActionModel(String propertyName, String propertyValue) findActionModels(String propertyName, String propertyValue) Finds an Action within the action tree of this group using the specified action-id.voidIf this group has no default action set, it finds the first enabled action in this group and sets it as the default action.intinthashCode()booleanisEmpty()Returns whether this group has any actions.booleanisGroup()booleaniterator()Iterator for looping through all child actions in preorder.voidmergeGroup(ActionGroupModel group) Merges the actions from the specified group into this group.voidpreserveOrder(boolean overwrite) Adds position objects to the child actions that reflect their current order.booleanremoveAction(ActionModel action) Removes the specified action from this group.voidremoveActions(Predicate<ActionModel> predicate) Removes all actions which match the given predicate.voidRecursively removes all empty action groups from this group.voidremoveEntry(int index) Removes the action at the specified index.voidreplaceAction(ActionModel modelToReplace, ActionModel newActionModel) protected voidsetActions(@Nullable Collection<ActionModel> actions) voidsetDefaultAction(int defaultAction) voidsetMutualExclusive(boolean mutualExclusive) voidsort()Recursively sorts this groups children with respect to itsActionModel.getPosition()property.toString()Methods inherited from class ch.tocco.nice2.netui.impl.actions.ActionModelImpl
getIcon, getId, getName, getPosition, getProperties, getProperty, getRelativePosition, getRelativePositionProperty, getShortDescription, isEnabled, isToggle, setEnabled, setIcon, setName, setPosition, setProperties, setProperty, setRelativePosition, setShortDescription, setToggleMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface ch.tocco.nice2.netui.api.actions.ActionModel
getIcon, getId, getName, getPosition, getProperty, getRelativePosition, getRelativePositionProperty, getShortDescription, isEnabled, isToggle, setEnabled, setIcon, setName, setPosition, setProperty, setRelativePosition, setShortDescription, setToggleMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ActionGroupModelImpl
-
ActionGroupModelImpl
public ActionGroupModelImpl(String id, String name, @Nullable @Nullable Collection<ActionModel> actions) -
ActionGroupModelImpl
-
-
Method Details
-
getDefaultAction
public int getDefaultAction()- Specified by:
getDefaultActionin interfaceActionGroupModel
-
setDefaultAction
public void setDefaultAction(int defaultAction) - Specified by:
setDefaultActionin interfaceActionGroupModel
-
isMutualExclusive
public boolean isMutualExclusive()- Specified by:
isMutualExclusivein interfaceActionGroupModel
-
setMutualExclusive
public void setMutualExclusive(boolean mutualExclusive) - Specified by:
setMutualExclusivein interfaceActionGroupModel
-
isGroup
public boolean isGroup()- Overrides:
isGroupin classActionModelImpl
-
findById
Finds an Action within the action tree of this group using the specified action-id.- Specified by:
findByIdin interfaceActionGroupModel
-
getActions
-
setActions
-
iterator
Iterator for looping through all child actions in preorder.Note that this action group is not visited, only its children.
- Specified by:
iteratorin interfaceIterable<ActionModel>
-
removeEntry
public void removeEntry(int index) Removes the action at the specified index.
If you are iterating through an action group, please consider the remove() method if the iterator!
-
removeAction
Description copied from interface:ActionGroupModelRemoves the specified action from this group.
Only remove from root action array. This method does not iterate recursively through all actions.
- Specified by:
removeActionin interfaceActionGroupModel- Parameters:
action- action in this action array to remove
-
removeActions
Description copied from interface:ActionGroupModelRemoves all actions which match the given predicate. Not only root actions are removed; this method iterates recursively through all actions.- Specified by:
removeActionsin interfaceActionGroupModel- Parameters:
predicate- the predicate to apply.
-
replaceAction
- Specified by:
replaceActionin interfaceActionGroupModel
-
addAction
Description copied from interface:ActionGroupModelAdds the specified action unmodified to this action array.- Specified by:
addActionin interfaceActionGroupModel
-
actionList
Returns the child actions of this group as an unmodifiable list.- Specified by:
actionListin interfaceActionGroupModel- Returns:
- child actions of this group
-
findDefaultAction
public void findDefaultAction()Description copied from interface:ActionGroupModelIf this group has no default action set, it finds the first enabled action in this group and sets it as the default action. Does this recursively for any other action group encountered.- Specified by:
findDefaultActionin interfaceActionGroupModel
-
deepCopy
Description copied from interface:ActionGroupModelCreates a deep copy of this group.- Specified by:
deepCopyin interfaceActionGroupModel- Specified by:
deepCopyin interfaceActionModel- Overrides:
deepCopyin classActionModelImpl- Returns:
- a new this
-
isEmpty
public boolean isEmpty()Description copied from interface:ActionGroupModelReturns whether this group has any actions.- Specified by:
isEmptyin interfaceActionGroupModel- Returns:
- true if there is at least one action in this group, false if there are none
-
mergeGroup
Description copied from interface:ActionGroupModelMerges the actions from the specified group into this group.
The properties of the given group itself are discarded. Only their containing actions are added to the actions of this group. If the given action contains a group that is already defined in here, their actions will be added to the existing group, such that no doublet groups arise.
- Specified by:
mergeGroupin interfaceActionGroupModel- Throws:
IllegalStateException
-
sort
public void sort()Description copied from interface:ActionGroupModelRecursively sorts this groups children with respect to itsActionModel.getPosition()property.- Specified by:
sortin interfaceActionGroupModel
-
findActionModel
- Specified by:
findActionModelin interfaceActionGroupModel
-
findActionModels
- Specified by:
findActionModelsin interfaceActionGroupModel- Parameters:
propertyName- name of a propertypropertyValue- value for property- Returns:
- all action models contained in this model with the specified property
-
collectActionModels
- Specified by:
collectActionModelsin interfaceActionGroupModel- Returns:
- all action models contained in this model
-
removeEmptyGroups
public void removeEmptyGroups()Description copied from interface:ActionGroupModelRecursively removes all empty action groups from this group.- Specified by:
removeEmptyGroupsin interfaceActionGroupModel
-
preserveOrder
public void preserveOrder(boolean overwrite) Description copied from interface:ActionGroupModelAdds position objects to the child actions that reflect their current order. This method does not step into any child group.- Specified by:
preserveOrderin interfaceActionGroupModel- Parameters:
overwrite- if true overwrite existing position entries
-
equals
- Overrides:
equalsin classActionModelImpl
-
hashCode
public int hashCode()- Overrides:
hashCodein classActionModelImpl
-
toString
- Overrides:
toStringin classActionModelImpl
-