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.ObjectSpecifierNothingNested classes/interfaces inherited from interface org.autogui.base.mapping.GuiRepresentation
GuiRepresentation.GuiReprNone, GuiRepresentation.TreeString, GuiRepresentation.TreeStringComposite, GuiRepresentation.TreeStringValue -
Field Summary
FieldsFields inherited from class org.autogui.base.mapping.GuiReprValue
NONE, NONE_WITH_CACHE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckAndUpdateSource(GuiMappingContext context) nothing happenbooleancontinueCheckAndUpdateSourceForChildren(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) intgetFixedColumnIndex(GuiMappingContext context, GuiMappingContext columnContext) intgetFixedColumnSize(GuiMappingContext context) getValue(GuiMappingContext context, GuiMappingContext.GuiSourceValue parentSource, GuiReprValue.ObjectSpecifier specifier, GuiMappingContext.GuiSourceValue prev) obtain the property value from parentSource as an owner.intgetValueCollectionSize(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.booleanbooleanbooleanmatch(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 *toHumanReadableStringTree(GuiMappingContext context, Object source) toJson(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 propertyGuiReprPropertyPaneor 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, updateWithParentSourceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.autogui.base.mapping.GuiRepresentation
fromJsonWithNamed, isTaskRunnerUsedFor, matchAndSetNotifiersAsInit, setNotifiersTree, shutdown, toHumanReadableString, toJsonWithNamed, toStringHeader
-
Field Details
-
representation
-
-
Constructor Details
-
GuiReprCollectionElement
-
-
Method Details
-
getRepresentation
-
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- Overrides:
matchin classGuiReprValue- Parameters:
context- the context of the repr.- Returns:
- the matching result
-
isHistoryValueSupported
public boolean isHistoryValueSupported()- Overrides:
isHistoryValueSupportedin 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:
checkAndUpdateSourcein interfaceGuiRepresentation- Overrides:
checkAndUpdateSourcein 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:GuiReprValueobtains the value type from the context. the implementation checks the context is a property, or an element value- Overrides:
getValueTypein 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:GuiReprValueobtain the property value from parentSource as an owner.In this class, support following cases:
- the type is a
GuiTypeMemberProperty - other types: use methods of
GuiTypeValuewith prev and parentSource as the inherited value
- Overrides:
getValuein 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_UPDATEif 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:GuiReprValuea table pane returns the size of a collection- Overrides:
getValueCollectionSizein 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:GuiReprValueset 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
GuiReprPropertyPaneor 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:
updatein 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:GuiRepresentationconvert the source into JSON format- Specified by:
toJsonin interfaceGuiRepresentation- Overrides:
toJsonin 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: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- Overrides:
fromJsonin classGuiReprValue- 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.
-
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
-
toHumanReadableStringTree
public GuiRepresentation.TreeString toHumanReadableStringTree(GuiMappingContext context, Object source) - Parameters:
context- the context of the reprsource- convert to string- Returns:
- tree string of source, can be encoded by
Object.toString()(used byGuiRepresentation.toHumanReadableString(GuiMappingContext, Object)
-
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:
toStringin classGuiReprValue
-