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.ObjectSpecifierNothingNested classes/interfaces inherited from interface org.autogui.base.mapping.GuiRepresentation
GuiRepresentation.GuiReprNone, GuiRepresentation.TreeString, GuiRepresentation.TreeStringComposite, GuiRepresentation.TreeStringValue -
Field Summary
Fields inherited from class org.autogui.base.mapping.GuiReprValue
NONE, NONE_WITH_CACHE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHistoryValue(GuiMappingContext context, Object value) fromHumanReadableString(GuiMappingContext context, String str) fromJson(GuiMappingContext context, Object target, Object json) obtain a file-path object from the string jsonbooleanbooleanmatchValueType(Class<?> cls) voidsetSource(GuiMappingContext context, Object value) toHumanReadableStringTree(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 propertyGuiReprPropertyPaneor 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 elementvoidupdateFromGui(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, unwrapNoUpdateMethods 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, fromJsonWithNamed, isTaskRunnerUsedFor, matchAndSetNotifiersAsInit, setNotifiersTree, shutdown, toHumanReadableString, toJsonWithNamed, toStringHeader
-
Constructor Details
-
GuiReprValueFilePathField
public GuiReprValueFilePathField()
-
-
Method Details
-
matchValueType
- Overrides:
matchValueTypein classGuiReprValue
-
toValueFromPath
-
updateFromGui
public void updateFromGui(GuiMappingContext context, Object newValue, GuiReprValue.ObjectSpecifier specifier, GuiTaskClock viewClock) Description copied from class:GuiReprValuecall the setter by editing on GUI, andGuiMappingContext.updateSourceFromGui(Object).- add
newValueto 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:
updateFromGuiin 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:GuiReprValuea table pane updates a specified element- Overrides:
updateCollectionElementin 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:GuiReprValueobtain the parent source byGuiReprValue.getUpdatedSource(GuiMappingContext, GuiReprValue.ObjectSpecifier)and callGuiReprValue.update(GuiMappingContext, GuiMappingContext.GuiSourceValue, Object, GuiReprValue.ObjectSpecifier)- Overrides:
updateWithParentSourcein 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: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
-
addHistoryValue
- Overrides:
addHistoryValuein classGuiReprValue
-
setSource
- Overrides:
setSourcein classGuiReprValue
-
toUpdateValue
Description copied from class:GuiReprValuecalled 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:
toUpdateValuein classGuiReprValue- Parameters:
context- the context of the repr.value- the current value- Returns:
- the updated value
-
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:
- path String
-
fromJson
obtain a file-path object from the string json- Specified by:
fromJsonin interfaceGuiRepresentation- Overrides:
fromJsonin classGuiReprValue- Parameters:
context- the context of the repr.target- unusedjson- suppose aString- Returns:
PathorFile(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
-
toHumanReadableStringTree
public GuiRepresentation.TreeString toHumanReadableStringTree(GuiMappingContext context, Object source) - Parameters:
context- the context of the repr.source- converted to string- Returns:
- a path string
-
fromHumanReadableString
-