java.lang.Object
org.autogui.base.mapping.GuiReprValue
org.autogui.base.mapping.GuiReprObjectPane
- All Implemented Interfaces:
GuiRepresentation
- Direct Known Subclasses:
GuiReprObjectTabbedPane
an object representation composing member sub-representations
@GuiIncluded public class C { @GuiIncluded public String prop; String v; @GuiIncluded public String getValue() { return v; }; @GuiIncluded public void setValue(String v) { this.v = v; }; @GuiIncluded public void action() {...}; ... }
-
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 TypeMethodDescriptionfromHumanReadableString
(GuiMappingContext context, String str) static Object
fromHumanReadableStringToObject
(GuiMappingContext context, String str) fromJson
(GuiMappingContext context, Object target, Object json) static Object
fromJsonToObject
(GuiMappingContext context, Object target, Object json) constructing an object or setting up the target object from the JSON.static BiConsumer
<GuiMappingContext, Object> static GuiReprValue
boolean
isHistoryValueStored
(Object value) 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 *protected boolean
matchWithoutSetting
(GuiMappingContext context) static void
runSubCollectionValue
(GuiMappingContext subContext, Object source, BiConsumer<GuiMappingContext, Object> subAndNext) static void
runSubPropertyValue
(GuiMappingContext subContext, Object source, BiConsumer<GuiMappingContext, Object> subAndNext) void
shutdown
(GuiMappingContext context, Object source) do shutting-down process if the target object is an AutoCloseable.toHumanReadableString
(GuiMappingContext context, Object source) static String
toHumanReadableStringFromObject
(GuiMappingContext context, Object source) constructing a human-readable string representation of the object.toJson
(GuiMappingContext context, Object source) static Object
toJsonFromObject
(GuiMappingContext context, Object source) toString()
static Object
unwrapPropertyMap
(GuiMappingContext s, Object subObj) Methods inherited from class org.autogui.base.mapping.GuiReprValue
addHistoryValue, castOrMake, checkAndUpdateSource, convertLog, createNewValue, errorWhileAddHistoryValue, fromSource, fromSourceUpdated, getNoneSupplier, getParentSource, getUpdatedSource, getUpdatedValue, getUpdatedValueWithoutNoUpdate, getValue, getValueCollectionElement, getValueCollectionSize, getValueType, getValueWithoutNoUpdate, isEditable, isFromJsonTakingMapWithContextNameEntry, isHistoryValueStored, isHistoryValueSupported, isUpdateContextSourceByUpdateFromGui, matchValueType, notifyUpdateWithParentSourceNone, setSource, toParentSource, toSource, toUpdateValue, unwrapNoUpdate, update, 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
continueCheckAndUpdateSourceForChildren, fromJsonWithNamed, isJsonSetter, isTaskRunnerUsedFor, matchAndSetNotifiersAsInit, setNotifiersTree, toJsonWithNamed, toStringHeader
-
Field Details
-
subRepresentation
-
-
Constructor Details
-
GuiReprObjectPane
-
GuiReprObjectPane
public GuiReprObjectPane()
-
-
Method Details
-
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
-
matchWithoutSetting
-
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.
-
isHistoryValueStored
- Overrides:
isHistoryValueStored
in classGuiReprValue
- Parameters:
value
- the tested value, or null at loading- Returns:
- if true, actually the value is stored to the preferences store
-
toJson
- Specified by:
toJson
in interfaceGuiRepresentation
- Overrides:
toJson
in classGuiReprValue
- Parameters:
context
- a context holds the representationsource
- the converted object- Returns:
- Map: { propertyName: propertyJson }
-
toJsonFromObject
- Parameters:
context
- the context of the caller's repr.source
- the converted object- Returns:
- a map object (
LinkedHashMap
), with entries based on the child contexts. a member is constructed withGuiRepresentation.toJsonWithNamed(GuiMappingContext, Object)
. Special case: if the map has only 1 collection entry, then it will return the entry value (list) instead of the map. This is because the entry name will be the type name and useless.
-
unwrapPropertyMap
-
fromJson
- Specified by:
fromJson
in interfaceGuiRepresentation
- Overrides:
fromJson
in classGuiReprValue
- Parameters:
context
- a context holds the representationtarget
- the target object or nulljson
- the source JSON- Returns:
- the target or newly created object
-
fromJsonToObject
constructing an object or setting up the target object from the JSON. to set properties, it relies onGuiMappingContext.execute(Callable)
.- Parameters:
context
- the context of the caller's reprtarget
- the target object, may be null, and then it creates a new object by 0-args constructor of the value type of the representation (supposingGuiReprValue
)json
- the JSON object- Returns:
- the target or newly created object
-
getReprValue
-
toHumanReadableString
- Parameters:
context
- the context of the repr.source
- converted to string- Returns:
- the representation of the source
-
toHumanReadableStringFromObject
constructing a human-readable string representation of the object. the contents consist of members of the object (listed by the context). each of them is processed byrunSubPropertyValue(GuiMappingContext, Object, BiConsumer)
if it is a property. For obtaining the value of the property, it relies onGuiMappingContext.execute(Callable)
. if it is a collection element, then it will be processed byrunSubCollectionValue(GuiMappingContext, Object, BiConsumer)
.- Parameters:
context
- the context associated with the caller's reprsource
- the source object- Returns:
- the representation of the source
-
getAddingHumanReadableStringToList
public static BiConsumer<GuiMappingContext,Object> getAddingHumanReadableStringToList(List<String> list) -
runSubPropertyValue
public static void runSubPropertyValue(GuiMappingContext subContext, Object source, BiConsumer<GuiMappingContext, Object> subAndNext) -
runSubCollectionValue
public static void runSubCollectionValue(GuiMappingContext subContext, Object source, BiConsumer<GuiMappingContext, Object> subAndNext) -
fromHumanReadableString
-
fromHumanReadableStringToObject
-
shutdown
Description copied from interface:GuiRepresentation
do shutting-down process if the target object is an AutoCloseable.- Parameters:
context
- the context of the repr.source
- the target object, obtained from source value of the context
-
toString
- Overrides:
toString
in classGuiReprValue
-