java.lang.Object
org.autogui.base.mapping.GuiReprActionList
- All Implemented Interfaces:
GuiRepresentation
the abstract action definition for a list (an action taking a list as its argument)
@GuiIncluded
public class C {
@GuiIncluded
public List<String> list = new ArrayList<>();
@GuiIncluded
void action(List<String> selectedItemsInList) {
...
}
}
actions taking List<Integer> will receive indices of selected rows.
@GuiIncluded
public class C {
@GuiIncluded
public List<String> list = new ArrayList<>();
@GuiIncluded
void action(List<Integer> selectedRowsInList) {
...
}
}
For tables of List<Integer>, the action will always take indices of selected rows.
in order to handle multiple lists, the action can take the second argument for receiving the name of the target list.
@GuiIncluded
public List<String> listA = new ArrayList<>();
@GuiIncluded
public List<String> listB = new ArrayList<>();
@GuiIncluded
void action(List<String> selectedItemsInList, String name) {
if (name.equals("listA") {
...
} else {
...
}
}
automatic selection callback: the action with GuiListSelectionCallback
will be automatically invoked when a user selects some items in the list.
@GuiListSelectionCallback
@GuiIncluded
public void action(List<String> items) {
...
}
list selection changer: the action with GuiListSelectionUpdater
can specify the next selected items after execution of the action.
@GuiListSelectionUpdater
@GuiIncluded
public List<String> action(List<String> items) {
...
}
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.autogui.base.mapping.GuiRepresentation
GuiRepresentation.GuiReprNone, GuiRepresentation.TreeString, GuiRepresentation.TreeStringComposite, GuiRepresentation.TreeStringValue -
Field Summary
Fields inherited from interface org.autogui.base.mapping.GuiRepresentation
NONE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckAndUpdateSource(GuiMappingContext context) invoke the associated method and check the returned value whether it is updated or not.executeActionForList(GuiMappingContext context, Object target, List<?> selection, String targetName) executeActionForList(GuiMappingContext context, List<?> selection, String targetName, GuiReprValue.ObjectSpecifier targetSpecifier) the action executor relying onGuiMappingContext.execute(Callable).fromJson(GuiMappingContext context, Object target, Object json) create a new value object from the JSON with treating the target as an old value, or update the target with the JSON contents.static GuiTypeElementbooleanstatic booleanisCollectionType(GuiTypeElement testedCollectionType, GuiTypeElement elementType) booleanisSelectionAction(GuiMappingContext context, GuiMappingContext tableContext) //@GuiListSelectionCallback(index=true) //for automatic selection public void select(List<E> list) {...} public void select(List<E> list, String propName) {...}booleanisSelectionChangeAction(GuiMappingContext context, GuiMappingContext tableContext) @GuiListSelectionUpdater public Collection<E> select(List<E> items) { ...static booleanisSelectionChangeActionForActions(GuiMappingContext context, GuiMappingContext tableContext) @GuiListSelectionUpdater public Collection<E> select(...) { ...boolean@GuiListSelectionUpdater(index=true) public Collection<int[]> select(List<int[]> indices) { ...static booleanboolean@GuiListSelectionUpdater(index=true) public Collection<Integer> select(List<Integer> rows) { ...static booleanstatic booleanisSelectionChangeTargetForActions(GuiMappingContext context, GuiMappingContext tableContext) matching the action target name with the table property name (parent of the tableContext)boolean//@GuiListSelectionCallback(index=true) //for automatic selection public void select(List<int[]> rows) {...} public void select(List<int[]> rows, String propName) {...}boolean//@GuiListSelectionCallback(index=true) //for automatic selection public void select(List<Integer> rows) {...} public void select(List<Integer> rows, String propName) {...}booleanmatch(GuiMappingContext context) match the representation with the typeElement of the context, and if succeeded, it sets this representation to the context, and it might create sub-contexts for recursive matches *toJson(GuiMappingContext context, Object source) convert the source into JSON formattoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.autogui.base.mapping.GuiRepresentation
continueCheckAndUpdateSourceForChildren, fromHumanReadableString, fromJsonWithNamed, isJsonSetter, isTaskRunnerUsedFor, matchAndSetNotifiersAsInit, setNotifiersTree, shutdown, toHumanReadableString, toHumanReadableStringTree, toJsonWithNamed, toStringHeader
-
Constructor Details
-
GuiReprActionList
public GuiReprActionList()
-
-
Method Details
-
match
Description copied from interface:GuiRepresentationmatch the representation with the typeElement of the context, and if succeeded, it sets this representation to the context, and it might create sub-contexts for recursive matches *- Specified by:
matchin interfaceGuiRepresentation- Parameters:
context- the context of the repr.- Returns:
- the matching result
-
checkAndUpdateSource
Description copied from interface:GuiRepresentationinvoke the associated method and check the returned value whether it is updated or not. if updated, set the source of context to the value. This is non-recursive operation;GuiMappingContextrecursively calls this method. The source of parent is already updated by the order of the calls.- Specified by:
checkAndUpdateSourcein interfaceGuiRepresentation- Parameters:
context- the context of the repr.- Returns:
- the representation is updated or not
-
executeActionForList
public Object executeActionForList(GuiMappingContext context, List<?> selection, String targetName, GuiReprValue.ObjectSpecifier targetSpecifier) the action executor relying onGuiMappingContext.execute(Callable).- Parameters:
context- the contextselection- the parametertargetName- the name of the target listtargetSpecifier- the specifier for the target object- Returns:
- result of execution or null
-
executeActionForList
public Object executeActionForList(GuiMappingContext context, Object target, List<?> selection, String targetName) -
toJson
Description copied from interface:GuiRepresentationconvert the source into JSON format -
fromJson
Description copied from interface:GuiRepresentationcreate a new value object from the JSON with treating the target as an old value, or update the target with the JSON contents. the behavior can be varied by each representation, confirmed byGuiRepresentation.isJsonSetter().- Specified by:
fromJsonin interfaceGuiRepresentation- Parameters:
context- a context holds the representationtarget- the target object or nulljson- JSON objects representing the targetString,Number,Boolean,List,Mapor null- Returns:
- created object from the json, target if provided, or null.
-
isAutomaticSelectionAction
-
isSelectionAction
//@GuiListSelectionCallback(index=true) //for automatic selection public void select(List<E> list) {...} public void select(List<E> list, String propName) {...}- Parameters:
context- the action contexttableContext- context for the target element of list- Returns:
- true if the action is taking a list of selected row values
-
isSelectionRowIndicesAction
//@GuiListSelectionCallback(index=true) //for automatic selection public void select(List<Integer> rows) {...} public void select(List<Integer> rows, String propName) {...}- Parameters:
context- the action context- Returns:
- true if the action is automatic selection and taking a list of row indices
-
isSelectionRowAndColumnIndicesAction
//@GuiListSelectionCallback(index=true) //for automatic selection public void select(List<int[]> rows) {...} public void select(List<int[]> rows, String propName) {...}- Parameters:
context- the action context- Returns:
- true if the action is automatic selection and taking a list of row and column pair indices
-
getRowAndColumnIndicesType
-
isSelectionChangeAction
@GuiListSelectionUpdater public Collection<E> select(List<E> items) { ... }- Parameters:
context- context of the actiontableContext- table context- Returns:
- true if matched
-
isSelectionChangeRowIndicesAction
@GuiListSelectionUpdater(index=true) public Collection<Integer> select(List<Integer> rows) { ... }- Parameters:
context- context of the action- Returns:
- true if matched
-
isSelectionChangeRowAndColumnIndicesAction
@GuiListSelectionUpdater(index=true) public Collection<int[]> select(List<int[]> indices) { ... }- Parameters:
context- context of the action- Returns:
- true if matched
-
isSelectionChangeActionForActions
public static boolean isSelectionChangeActionForActions(GuiMappingContext context, GuiMappingContext tableContext) @GuiListSelectionUpdater public Collection<E> select(...) { ... }- Parameters:
context- context of the actiontableContext- table context- Returns:
- true if matched
-
isCollectionType
public static boolean isCollectionType(GuiTypeElement testedCollectionType, GuiTypeElement elementType) -
isSelectionChangeRowIndicesActionForActions
-
isSelectionChangeRowAndColumnIndicesActionForActions
public static boolean isSelectionChangeRowAndColumnIndicesActionForActions(GuiMappingContext context) -
isSelectionChangeTargetForActions
public static boolean isSelectionChangeTargetForActions(GuiMappingContext context, GuiMappingContext tableContext) matching the action target name with the table property name (parent of the tableContext)- Parameters:
context- the action contexttableContext- the target table-context- Returns:
- the target-name of the context (obtained from
GuiListSelectionUpdater.target()or the method name "select...") is equals to the table property name (parent name of the tableContext) - Since:
- 1.5
-
toString
-