java.lang.Object
org.autogui.base.mapping.GuiReprValue
org.autogui.base.mapping.GuiReprValueFilePathField
- All Implemented Interfaces:
GuiRepresentation
-
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
Fields inherited from class org.autogui.base.mapping.GuiReprValue
NONE, NONE_WITH_CACHE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addHistoryValue
(GuiMappingContext context, Object value) fromHumanReadableString
(GuiMappingContext context, String str) fromJson
(GuiMappingContext context, Object target, Object json) obtain a file-path object from the string jsonboolean
boolean
matchValueType
(Class<?> cls) void
setSource
(GuiMappingContext context, Object value) toHumanReadableString
(GuiMappingContext context, Object source) toJson
(GuiMappingContext context, Object source) convert the source into JSON formattoUpdateValue
(GuiMappingContext context, Object value) called from a GUI element in order to update its value.toValueFromPath
(GuiMappingContext context, Path path) 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.updateCollectionElement
(GuiMappingContext context, GuiMappingContext.GuiSourceValue collection, Object newValue, GuiReprValue.ObjectSpecifier elementSpecifier) a table pane updates a specified elementvoid
updateFromGui
(GuiMappingContext context, Object newValue, GuiReprValue.ObjectSpecifier specifier, GuiTaskClock viewClock) call the setter by editing on GUI, andGuiMappingContext.updateSourceFromGui(Object)
.updateWithParentSource
(GuiMappingContext context, Object newValue, GuiReprValue.ObjectSpecifier specifier) Methods inherited from class org.autogui.base.mapping.GuiReprValue
castOrMake, checkAndUpdateSource, convertLog, createNewValue, errorWhileAddHistoryValue, fromSource, fromSourceUpdated, getNoneSupplier, getParentSource, getUpdatedSource, getUpdatedValue, getUpdatedValueWithoutNoUpdate, getValue, getValueCollectionElement, getValueCollectionSize, getValueType, getValueWithoutNoUpdate, isEditable, isFromJsonTakingMapWithContextNameEntry, isHistoryValueStored, isHistoryValueStored, isHistoryValueSupported, isHistoryValueSupported, isUpdateContextSourceByUpdateFromGui, match, notifyUpdateWithParentSourceNone, toParentSource, toSource, toString, unwrapNoUpdate
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
continueCheckAndUpdateSourceForChildren, fromJsonWithNamed, isTaskRunnerUsedFor, matchAndSetNotifiersAsInit, setNotifiersTree, shutdown, toJsonWithNamed, toStringHeader
-
Constructor Details
-
GuiReprValueFilePathField
public GuiReprValueFilePathField()
-
-
Method Details
-
matchValueType
- Overrides:
matchValueType
in classGuiReprValue
-
toValueFromPath
-
updateFromGui
public void updateFromGui(GuiMappingContext context, Object newValue, GuiReprValue.ObjectSpecifier specifier, GuiTaskClock viewClock) Description copied from class:GuiReprValue
call the setter by editing on GUI, andGuiMappingContext.updateSourceFromGui(Object)
.- add
newValue
to the history byGuiReprValue.addHistoryValue(GuiMappingContext, Object)
- obtain parent source and update
GuiReprValue.updateWithParentSource(GuiMappingContext, Object, ObjectSpecifier)
- check
GuiReprValue.isUpdateContextSourceByUpdateFromGui(GuiMappingContext)
andGuiMappingContext.updateSourceFromGui(Object)
: update the source and notify to listeners
- Overrides:
updateFromGui
in classGuiReprValue
- Parameters:
context
- the context of this repr.newValue
- the updated property valuespecifier
- the specifier of the valueviewClock
- the clock value of sender view
- add
-
updateCollectionElement
public Object updateCollectionElement(GuiMappingContext context, GuiMappingContext.GuiSourceValue collection, Object newValue, GuiReprValue.ObjectSpecifier elementSpecifier) throws Throwable Description copied from class:GuiReprValue
a table pane updates a specified element- Overrides:
updateCollectionElement
in classGuiReprValue
- Parameters:
context
- the context of the reprcollection
- a collection targetnewValue
- an element valueelementSpecifier
- an element index i.e.GuiReprValue.ObjectSpecifierIndex
- Returns:
- the updated value
- Throws:
Throwable
- an error while updating
-
updateWithParentSource
public Object updateWithParentSource(GuiMappingContext context, Object newValue, GuiReprValue.ObjectSpecifier specifier) throws Throwable Description copied from class:GuiReprValue
obtain the parent source byGuiReprValue.getUpdatedSource(GuiMappingContext, GuiReprValue.ObjectSpecifier)
and callGuiReprValue.update(GuiMappingContext, GuiMappingContext.GuiSourceValue, Object, GuiReprValue.ObjectSpecifier)
- Overrides:
updateWithParentSource
in classGuiReprValue
- Parameters:
context
- the target contextnewValue
- a new value to be set to the propertyspecifier
- the specifier of the value- Returns:
- the returned value by updating
- Throws:
Throwable
- an error while getParentSource or update
-
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
-
addHistoryValue
- Overrides:
addHistoryValue
in classGuiReprValue
-
setSource
- Overrides:
setSource
in classGuiReprValue
-
toUpdateValue
Description copied from class:GuiReprValue
called from a GUI element in order to update its value. subclass can change to returned type and convert the value to the type. a typical use case is just down-casting and converting null to an empty object.- Overrides:
toUpdateValue
in classGuiReprValue
- Parameters:
context
- the context of the repr.value
- the current value- Returns:
- the updated value
-
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:
- path String
-
fromJson
obtain a file-path object from the string json- Specified by:
fromJson
in interfaceGuiRepresentation
- Overrides:
fromJson
in classGuiReprValue
- Parameters:
context
- the context of the repr.target
- unusedjson
- suppose aString
- Returns:
Path
orFile
(determined by the context type), 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
- Parameters:
context
- the context of the repr.source
- converted to string- Returns:
- a path string
-
fromHumanReadableString
-