java.lang.Object
org.autogui.base.mapping.GuiReprValue
org.autogui.base.mapping.GuiReprCollectionElement
- All Implemented Interfaces:
GuiRepresentation
elements in a collection table
GuiReprCollectionTable
.
value obtaining and updating in this class are intended to operate an element in a collection.
- the class overrides
getValue(GuiMappingContext, GuiMappingContext.GuiSourceValue, ObjectSpecifier, GuiMappingContext.GuiSourceValue)
andupdate(GuiMappingContext, GuiMappingContext.GuiSourceValue, Object, ObjectSpecifier)
. - Those methods delegate to the parent
GuiReprCollectionTable
's collection methods (i.e.GuiReprValue.getValueCollectionElement(GuiMappingContext, GuiMappingContext.GuiSourceValue, ObjectSpecifier, GuiMappingContext.GuiSourceValue)
, andGuiReprValue.updateCollectionElement(GuiMappingContext, GuiMappingContext.GuiSourceValue, Object, ObjectSpecifier)
). - Those methods take an indexed specifier (
GuiReprValue.ObjectSpecifierIndex
) for specifying an element in a collection.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.autogui.base.mapping.GuiReprValue
GuiReprValue.NamedValue, GuiReprValue.ObjectSpecifier, GuiReprValue.ObjectSpecifierIndex, GuiReprValue.ObjectSpecifierNothing
Nested classes/interfaces inherited from interface org.autogui.base.mapping.GuiRepresentation
GuiRepresentation.GuiReprNone
-
Field Summary
FieldsFields inherited from class org.autogui.base.mapping.GuiReprValue
NONE, NONE_WITH_CACHE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
checkAndUpdateSource
(GuiMappingContext context) nothing happenboolean
continueCheckAndUpdateSourceForChildren
(GuiMappingContext context, boolean parentUpdate) createElement
(GuiRepresentation wrapped) fromHumanReadableString
(GuiMappingContext context, String str) 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.getElementChild
(GuiMappingContext context) int
getFixedColumnIndex
(GuiMappingContext context, GuiMappingContext columnContext) int
getFixedColumnSize
(GuiMappingContext context) getValue
(GuiMappingContext context, GuiMappingContext.GuiSourceValue parentSource, GuiReprValue.ObjectSpecifier specifier, GuiMappingContext.GuiSourceValue prev) obtain the property value from parentSource as an owner.int
getValueCollectionSize
(GuiMappingContext context, GuiMappingContext.GuiSourceValue collection, GuiReprValue.ObjectSpecifier specifier) a table pane returns the size of a collectionClass
<?> getValueType
(GuiMappingContext context) obtains the value type from the context.boolean
boolean
boolean
match
(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 *toHumanReadableString
(GuiMappingContext context, Object source) method for constructing "toString" copy operations: the returned string will be separated by tabs and new-linestoJson
(GuiMappingContext context, Object source) convert the source into JSON formattoString()
update
(GuiMappingContext context, GuiMappingContext.GuiSourceValue parentSource, Object newValue, GuiReprValue.ObjectSpecifier specifier) set a new value to a property of an object, which specified by the context usingGuiMappingContext.execute(Callable)
if the type is aGuiTypeMemberProperty
, update the property byGuiTypeMemberProperty.executeSet(Object, Object)
if parent is a propertyGuiReprPropertyPane
or a collection elementGuiReprCollectionElement
, obtain the parent source of the parent, and update the parent with the source and newValue.Methods inherited from class org.autogui.base.mapping.GuiReprValue
addHistoryValue, castOrMake, convertLog, createNewValue, errorWhileAddHistoryValue, fromSource, fromSourceUpdated, getNoneSupplier, getParentSource, getUpdatedSource, getUpdatedValue, getUpdatedValueWithoutNoUpdate, getValueCollectionElement, getValueWithoutNoUpdate, isEditable, isFromJsonTakingMapWithContextNameEntry, isHistoryValueStored, isHistoryValueStored, isHistoryValueSupported, isUpdateContextSourceByUpdateFromGui, matchValueType, notifyUpdateWithParentSourceNone, setSource, toParentSource, toSource, toUpdateValue, unwrapNoUpdate, updateCollectionElement, updateFromGui, updateWithParentSource
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.autogui.base.mapping.GuiRepresentation
fromJsonWithNamed, isTaskRunnerUsedFor, matchAndSetNotifiersAsInit, setNotifiersTree, shutdown, toJsonWithNamed, toStringHeader
-
Field Details
-
representation
-
-
Constructor Details
-
GuiReprCollectionElement
-
-
Method Details
-
getRepresentation
-
match
Description copied from interface:GuiRepresentation
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 *- Specified by:
match
in interfaceGuiRepresentation
- Overrides:
match
in classGuiReprValue
- Parameters:
context
- the context of the repr.- Returns:
- the matching result
-
isHistoryValueSupported
public boolean isHistoryValueSupported()- Overrides:
isHistoryValueSupported
in classGuiReprValue
- Returns:
- if true,
GuiReprValue.updateFromGui(GuiMappingContext, Object, ObjectSpecifier, GuiTaskClock)
automatically add the value to the preferences. the default impl. returns true.
-
createElement
-
getElementChild
- Parameters:
context
- the target context- Returns:
- the child context whose repr is the wrapped representation of the element
-
checkAndUpdateSource
nothing happen- Specified by:
checkAndUpdateSource
in interfaceGuiRepresentation
- Overrides:
checkAndUpdateSource
in classGuiReprValue
- Parameters:
context
- the context of the repr.- Returns:
- always false
-
continueCheckAndUpdateSourceForChildren
public boolean continueCheckAndUpdateSourceForChildren(GuiMappingContext context, boolean parentUpdate) - Parameters:
context
- the context of the repr.parentUpdate
- ignored- Returns:
- always false
-
getValueType
Description copied from class:GuiReprValue
obtains the value type from the context. the implementation checks the context is a property, or an element value- Overrides:
getValueType
in classGuiReprValue
- Parameters:
context
- the context- Returns:
- a property type class, an element value class, or null
-
getValue
public GuiUpdatedValue getValue(GuiMappingContext context, GuiMappingContext.GuiSourceValue parentSource, GuiReprValue.ObjectSpecifier specifier, GuiMappingContext.GuiSourceValue prev) throws Throwable Description copied from class:GuiReprValue
obtain the property value from parentSource as an owner.In this class, support following cases:
- the type is a
GuiTypeMemberProperty
- other types: use methods of
GuiTypeValue
with prev and parentSource as the inherited value
- Overrides:
getValue
in classGuiReprValue
- Parameters:
context
- the context holding the repr.parentSource
- the property owner. if no value then nothing will happen for propertiesspecifier
- the specifier of the valueprev
- a previous value compared to the obtained value- Returns:
- an obtained property value (nullable) or
GuiUpdatedValue.NO_UPDATE
if the value is equivalent to the previous value. - Throws:
Throwable
- might be caused by executing method invocations.
- the type is a
-
getValueCollectionSize
public int getValueCollectionSize(GuiMappingContext context, GuiMappingContext.GuiSourceValue collection, GuiReprValue.ObjectSpecifier specifier) throws Throwable Description copied from class:GuiReprValue
a table pane returns the size of a collection- Overrides:
getValueCollectionSize
in classGuiReprValue
- Parameters:
context
- the context of the reprcollection
- a collection targetspecifier
- the specifier of the collection- Returns:
- the size of the collection, default is 1
- Throws:
Throwable
- an error while getting
-
update
public Object update(GuiMappingContext context, GuiMappingContext.GuiSourceValue parentSource, Object newValue, GuiReprValue.ObjectSpecifier specifier) throws Throwable Description copied from class:GuiReprValue
set a new value to a property of an object, which specified by the context- using
GuiMappingContext.execute(Callable)
- if the type is a
GuiTypeMemberProperty
, update the property byGuiTypeMemberProperty.executeSet(Object, Object)
- if parent is a property
GuiReprPropertyPane
or a collection elementGuiReprCollectionElement
, obtain the parent source of the parent, and update the parent with the source and newValue. This will be done by parent'sGuiReprValue.updateWithParentSource(GuiMappingContext, Object, ObjectSpecifier)
- otherwise call
GuiTypeValue.writeValue(Object, Object)
or a similar method
- Overrides:
update
in classGuiReprValue
- Parameters:
context
- the target contextparentSource
- the property ownernewValue
- a new value to be set to the propertyspecifier
- the specifier of the value- Returns:
- newValue which will need to be passed to
GuiMappingContext.updateSourceFromGui(Object)
, or null if error - Throws:
Throwable
- an error while updating
- using
-
toJson
Description copied from interface:GuiRepresentation
convert the source into JSON format- Specified by:
toJson
in interfaceGuiRepresentation
- Overrides:
toJson
in classGuiReprValue
- Parameters:
context
- a context holds the representationsource
- the converted object- Returns:
- List (
ArrayList
): [ elementJson, ... ]. Note: null elements are skipped.
-
fromJson
Description copied from interface:GuiRepresentation
create 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:
fromJson
in interfaceGuiRepresentation
- Overrides:
fromJson
in classGuiReprValue
- Parameters:
context
- a context holds the representationtarget
- the target object or nulljson
- JSON objects representing the targetString
,Number
,Boolean
,List
,Map
or null- Returns:
- created object from the json, target if provided, or null.
-
isJsonSetter
public boolean isJsonSetter()- Returns:
- true means
GuiRepresentation.fromJson(GuiMappingContext, Object, Object)
takes a target object and set json properties to the target. otherwise, the method will return a new value, thus the target can be null
-
toHumanReadableString
Description copied from interface:GuiRepresentation
method for constructing "toString" copy operations: the returned string will be separated by tabs and new-lines- Parameters:
context
- the context of the repr.source
- converted to string- Returns:
- a string representation of the source
-
fromHumanReadableString
-
getFixedColumnSize
- Parameters:
context
- the context of the repr.- Returns:
- the size of columns which is equivalent to the size of the children, or -1 which means that the number of columns might be dynamic.
-
getFixedColumnIndex
-
toString
- Overrides:
toString
in classGuiReprValue
-