- All Known Implementing Classes:
GuiReprAction
,GuiReprActionList
,GuiReprCollectionElement
,GuiReprCollectionTable
,GuiReprEmbeddedComponent
,GuiRepresentation.GuiReprNone
,GuiReprObjectPane
,GuiReprObjectTabbedPane
,GuiReprPropertyPane
,GuiReprSet
,GuiReprValue
,GuiReprValueBooleanCheckBox
,GuiReprValueDocumentEditor
,GuiReprValueEnumComboBox
,GuiReprValueFilePathField
,GuiReprValueImagePane
,GuiReprValueLabel
,GuiReprValueNumberSpinner
,GuiReprValueStringField
public interface GuiRepresentation
abstract GUI component:
most methods of the interface always take a
GuiMappingContext
,
this is because an instance of the interface might be a singleton instance.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
the empty implementation of the representation -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final GuiRepresentation.GuiReprNone
the empty definition of representation -
Method Summary
Modifier and TypeMethodDescriptionboolean
checkAndUpdateSource
(GuiMappingContext context) invoke the associated method and check the returned value whether it is updated or not.default boolean
continueCheckAndUpdateSourceForChildren
(GuiMappingContext context, boolean parentUpdate) static GuiReprAction
static GuiReprActionList
static GuiReprCollectionElement
static GuiReprCollectionTable
static GuiReprObjectPane
static GuiReprObjectTabbedPane
static GuiReprPropertyPane
static GuiReprValue
the repr type is abstract for any values and it will not be directly included in the default set.static GuiReprValueBooleanCheckBox
static GuiReprValueEnumComboBox
static GuiReprValueFilePathField
static GuiReprValueLabel
static GuiReprValueNumberSpinner
static GuiReprValueNumberSpinner
static GuiReprValueStringField
default Object
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.default Object
fromJsonWithNamed
(GuiMappingContext context, Object target, Object json) static GuiReprSet
default boolean
default boolean
isTaskRunnerUsedFor
(Supplier<?> task) 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 *default boolean
match(GuiMappingContext)
andsetNotifiersTree(GuiMappingContext)
as initialization processdefault void
setNotifiersTree
(GuiMappingContext context) sets notifiers for the entire tree byGuiMappingContext.setNotifiers(Object)
default void
shutdown
(GuiMappingContext context, Object target) do shutting-down process if the target object is an AutoCloseable.default String
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 formatdefault Object
toJsonWithNamed
(GuiMappingContext context, Object source) the source might be aGuiReprValue.NamedValue
, then it unwraps the named value, callstoJson(GuiMappingContext, Object)
, and it returns Map with the name.default String
-
Field Details
-
NONE
the empty definition of representation
-
-
Method Details
-
match
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 *- Parameters:
context
- the context of the repr.- Returns:
- the matching result
-
matchAndSetNotifiersAsInit
match(GuiMappingContext)
andsetNotifiersTree(GuiMappingContext)
as initialization process- Parameters:
context
- the context of the repr.- Returns:
- the matching result
- Since:
- 1.2
-
setNotifiersTree
sets notifiers for the entire tree byGuiMappingContext.setNotifiers(Object)
- Parameters:
context
- the context of the repr.- Since:
- 1.2
-
checkAndUpdateSource
invoke the associated method and check the returned value whether it is updated or not. if updated, set the source of context to the value. This is non-recursive operation;GuiMappingContext
recursively calls this method. The source of parent is already updated by the order of the calls.- Parameters:
context
- the context of the repr.- Returns:
- the representation is updated or not
-
continueCheckAndUpdateSourceForChildren
default boolean continueCheckAndUpdateSourceForChildren(GuiMappingContext context, boolean parentUpdate) -
toJsonWithNamed
the source might be aGuiReprValue.NamedValue
, then it unwraps the named value, callstoJson(GuiMappingContext, Object)
, and it returns Map with the name. otherwise, it simply calls toJson and returns the result.- Parameters:
context
- context of the repr.source
- the source of returned JSON- Returns:
- JSON object
-
fromJsonWithNamed
- Parameters:
context
- the context of the repr. In most cases, the type of the context will be a property.target
- the target object. if it isGuiReprValue.NamedValue
, then it obtains the value. nullablejson
- aMap
with containing an entry for the name of the context- Returns:
- the returned value
fromJson(GuiMappingContext, Object, Object)
. if the target is a NamedValue, the returned value will also be a NamedValue.
-
toJson
convert the source into JSON format -
fromJson
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 byisJsonSetter()
. -
isJsonSetter
default boolean isJsonSetter()- Returns:
- true means
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
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
-
getDefaultSet
- Returns:
- the set of default representations. it does not include swing-based representations. Instead, GuiSwingMapperSet includes all representations.
-
createCollectionElement
- Parameters:
owner
- the owner which can contains the returned repr itself- Returns:
- new representation
- Since:
- 1.7
-
createValueBooleanCheckBox
- Returns:
- new representation
- Since:
- 1.7
-
createValueEnumComboBox
- Returns:
- new representation
- Since:
- 1.7
-
createValueFilePathField
- Returns:
- new representation
- Since:
- 1.7
-
createValueNumberSpinner
- Returns:
- new representation wihtout a number-type;
GuiReprValueNumberSpinner.match(GuiMappingContext)
can determine the number-type from the type of the given context. AlsoGuiReprValueNumberSpinner.createNumberSpinner(GuiReprValueNumberSpinner.NumberType)
can re-create with concretizing the number-type. - Since:
- 1.7
- See Also:
-
createValueNumberSpinner
static GuiReprValueNumberSpinner createValueNumberSpinner(GuiReprValueNumberSpinner.NumberType numType) - Parameters:
numType
- the number-type defined inGuiReprValueNumberSpinner
, likeGuiReprValueNumberSpinner.INT
- Returns:
- new representation with the number-type
-
createValueStringField
- Returns:
- new representation
- Since:
- 1.7
-
createCollectionTable
- Parameters:
owner
- the owner which can contains the returned repr itself- Returns:
- new representation
- Since:
- 1.7
-
createObjectTabbedPane
- Parameters:
owner
- the owner which can contains the returned repr itself- Returns:
- new representation
- Since:
- 1.7
-
createObjectPane
- Parameters:
owner
- the owner which can contains the returned repr itself- Returns:
- new representation
- Since:
- 1.7
-
createPropertyPane
- Parameters:
owner
- the owner which can contains the returned repr itself- Returns:
- new representation
- Since:
- 1.7
-
createAction
- Returns:
- new representation
- Since:
- 1.7
-
createActionList
- Returns:
- new representation
- Since:
- 1.7
-
createValueLabel
- Returns:
- new representation
- Since:
- 1.7
-
createValue
the repr type is abstract for any values and it will not be directly included in the default set.- Returns:
- new representation
- Since:
- 1.7
-
toStringHeader
-
isTaskRunnerUsedFor
- Parameters:
task
- the tested task- Returns:
- true if the task can be executed under the task-runner of a context. the method can be used for the cases that the task is dispatched to a custom task-runner mechanism
-
shutdown
do shutting-down process if the target object is an AutoCloseable.- Parameters:
context
- the context of the repr.target
- the target object, obtained from source value of the context
-