- Type Parameters:
ValueType
- the type of the bound value
- All Known Subinterfaces:
GuiSwingViewWrapper.ValuePaneWrapper<ValueType>
- All Known Implementing Classes:
GuiSwingTableColumn.ValueWrappingPaneForEditor
,GuiSwingTableColumnBoolean.ColumnCheckBox
,GuiSwingTableColumnEmbeddedComponent.ColumnEditEmbeddedPane
,GuiSwingTableColumnEmbeddedComponent.ColumnEmbeddedPane
,GuiSwingTableColumnEnum.ColumnEditEnumComboBox
,GuiSwingTableColumnEnum.ColumnEnumPane
,GuiSwingTableColumnFilePath.ColumnEditFilePathPane
,GuiSwingTableColumnFilePath.ColumnFilePathPane
,GuiSwingTableColumnImage.ColumnEditImagePane
,GuiSwingTableColumnLabel.PropertyLabelColumn
,GuiSwingTableColumnNumber.ColumnEditNumberSpinner
,GuiSwingTableColumnNumber.ColumnNumberPane
,GuiSwingTableColumnString.ColumnEditTextPane
,GuiSwingTableColumnString.ColumnTextPane
,GuiSwingTableColumnString.MultilineColumnTextPane
,GuiSwingTableColumnString.MultilineColumnTextPane.MultilineColumnScrollPane
,GuiSwingTableColumnString.MultilineColumnTextViewPane
,GuiSwingTableColumnString.MultilineColumnWrappingPane
,GuiSwingViewBooleanCheckBox.PropertyCheckBox
,GuiSwingViewCollectionTable.CollectionTable
,GuiSwingViewDocumentEditor.PropertyDocumentEditorPane
,GuiSwingViewDocumentEditor.PropertyDocumentTextPane
,GuiSwingViewEmbeddedComponent.PropertyEmbeddedPane
,GuiSwingViewEnumComboBox.PropertyEnumComboBox
,GuiSwingViewEnumComboBox.PropertyLabelEnum
,GuiSwingViewFilePathField.PropertyFilePathPane
,GuiSwingViewImagePane.PropertyImagePane
,GuiSwingViewLabel.PropertyLabel
,GuiSwingViewNumberSpinner.PropertyLabelNumber
,GuiSwingViewNumberSpinner.PropertyNumberSpinner
,GuiSwingViewObjectPane.ObjectPane
,GuiSwingViewPropertyPane.NamedPropertyPane
,GuiSwingViewPropertyPane.PropertyPane
,GuiSwingViewPropertyPane.PropertyWrapperPane
,GuiSwingViewStringField.PropertyStringPane
,GuiSwingViewTabbedPane.ObjectTabbedPane
,GuiSwingViewWrapper.ValueScrollPane
,GuiSwingViewWrapper.ValueWrappingPane
,LambdaProperty.LambdaBooleanCheckBox
,LambdaProperty.LambdaCollectionTable
,LambdaProperty.LambdaDocumentPlainEditorPane
,LambdaProperty.LambdaDocumentTextPane
,LambdaProperty.LambdaEnumComboBox
,LambdaProperty.LambdaFilePathPane
,LambdaProperty.LambdaImagePane
,LambdaProperty.LambdaLabel
,LambdaProperty.LambdaNumberSpinner
,LambdaProperty.LambdaStringPane
- Enclosing interface:
GuiSwingView
public static interface GuiSwingView.ValuePane<ValueType>
the base mixin interface to a
JComponent
bound to an object or a property via a context (getSwingViewContext()
).
a pane will need to manage a GuiTaskClock
as the view-clock.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
addSwingEditFinishHandler
(Runnable eventHandler) the method is used for table cell-editors, in order to observe the completion of editing.default JComponent
default <RetType> GuiSwingTaskRunner.ContextTaskResult
<RetType> executeContextTask
(Supplier<RetType> task, Consumer<GuiSwingTaskRunner.ContextTaskResult<RetType>> afterTask) getActionByContext
(GuiMappingContext context) getActionByName
(String name) default GuiSwingView.ValuePane
<Object> getChildByName
(String name) default GuiSwingView.ValuePane
<Object> getDescendantByContext
(GuiMappingContext context) default GuiSwingView.ValuePane
<Object> getDescendantByValue
(Object value) default GuiSwingView.ValuePane
<Object> getDescendantByValueIf
(Predicate<Object> valuePredicate) default Object
default KeyStroke
a typical implementation if there are no dynamic items becomes like the following code:a typical implementation becomes like the following code:default boolean
default boolean
default void
default void
loadSwingPreferences
(GuiPreferences prefs, GuiSwingPrefsApplyOptions options) a sub-class which wraps another value-pane should overrides the method in order to omit needless value setting.void
for each component, the method is called before refreshing in order to clear the view-clock.default void
prepare, clear and update via the contextdefault void
default void
only save the component itself, not including children.default void
setKeyStrokeString
(String keyStrokeString) set the key-stroke info.default void
setPrefsJsonSupported
(Object json) default void
setSwingViewHistoryValue
(Object value) called from a value history menu.void
setSwingViewValue
(ValueType value) update GUI display, and it does NOT update the target model value.void
setSwingViewValue
(ValueType value, GuiTaskClock clock) update if the clock is newer than the current view-clock of the pane.default void
setSwingViewValueForTable
(JTable table, Object value, int row, int column) update GUI display as a table-cell.void
update the GUI display and the model.void
setSwingViewValueWithUpdate
(ValueType value, GuiTaskClock clock) update the GUI display and the model if the clock is newer than the current view-clock of the pane.default void
for each component, at the end of the process, this method will be calleddefault void
notifies property update to the component.default void
notifies property update to the component and enclosing other components.wrapSwingScrollPane
(boolean verticalAlways, boolean horizontalAlways)
-
Method Details
-
getSwingViewValue
ValueType getSwingViewValue()- Returns:
- basically, the source value of the context, held by the component without touching the context.
-
setSwingViewValue
update GUI display, and it does NOT update the target model value. processed under the event thread. also increment the view-clock.- Parameters:
value
- the new value
-
setSwingViewValueForTable
update GUI display as a table-cell. the default impl. is just callingsetSwingViewValue(Object)
- Parameters:
table
- the tablevalue
- the table row value as Objectrow
- the view row indexcolumn
- the view column index- Since:
- 1.6
-
setSwingViewValue
update if the clock is newer than the current view-clock of the pane. the view-clock becomes the given clock. Note: instead,setSwingViewValue(Object)
increments the current clock- Parameters:
value
- the new valueclock
- the clock of the value: if the clock is newer than the current view-clock of the pane, it can update
-
setSwingViewValueWithUpdate
update the GUI display and the model. processed under the event thread. also increment the view-clock- Parameters:
value
- the new value
-
setSwingViewValueWithUpdate
update the GUI display and the model if the clock is newer than the current view-clock of the pane. the view-clock becomes the given clock.- Parameters:
value
- the new valueclock
- the clock of the value
-
updateSwingViewSource
default void updateSwingViewSource()notifies property update to the component. getter will be called and GUI display will be updated. the method just callsGuiMappingContext.updateSourceSubTree()
.- Since:
- 1.1
-
updateSwingViewSourceFromRoot
default void updateSwingViewSourceFromRoot()notifies property update to the component and enclosing other components. For single case,updateSwingViewSource()
is sufficient. If the component is part of tree of value-panes, the method will be effective. the method just callsGuiMappingContext.updateSourceFromRoot()
.- Since:
- 1.1
-
addSwingEditFinishHandler
the method is used for table cell-editors, in order to observe the completion of editing. the default impl. is empty.- Parameters:
eventHandler
- the handler called when the editing is finished
-
getSwingStaticMenuItems
List<PopupCategorized.CategorizedMenuItem> getSwingStaticMenuItems()a typical implementation becomes like the following code:if (menuItems == null) { menuItems =
PopupCategorized
.getMenuItems(actions, menus); } return menuItems;the method returns original menu items for the pane. so, if a wrapper pane has a wrapped sub-pane added as a child component, it should not include items of the wrapped sub-pane.
- Returns:
- a list of actions (or menu-components) statically determined, that should be always same instances
-
getSwingMenuBuilder
PopupExtension.PopupMenuBuilder getSwingMenuBuilder()a typical implementation if there are no dynamic items becomes like the following code:if (popup == null) { popup = new
PopupExtension
(this, newPopupCategorized
(this::getSwingStaticMenuItems)); } return popup.getMenuBuilder();- Returns:
- a menu builder
-
wrapSwingScrollPane
default GuiSwingViewWrapper.ValueScrollPane<ValueType> wrapSwingScrollPane(boolean verticalAlways, boolean horizontalAlways) - Parameters:
verticalAlways
- the flag of showing the vertical scroll-barhorizontalAlways
- the flag of showing the horizontal scroll-bar- Returns:
- a
GuiSwingViewWrapper.ValueScrollPane
which wraps the pane
-
wrapSwingPane
- Returns:
- a
GuiSwingViewWrapper.ValueWrappingPane
which wraps the pane
-
getSwingViewContext
GuiMappingContext getSwingViewContext() -
wrapSwingProperty
-
wrapSwingNamed
-
asSwingViewComponent
- Returns:
- this
-
saveSwingPreferences
only save the component itself, not including children. it can useGuiSwingView.savePreferencesDefault(JComponent, GuiPreferences)
- Parameters:
prefs
- target prefs or ancestor of the target; actual target can be obtained byGuiPreferences.getDescendant(GuiMappingContext)
-
loadSwingPreferences
loadSwingPreferences(GuiPreferences, GuiSwingPrefsApplyOptions)
withGuiSwingPrefsApplyOptions.APPLY_OPTIONS_DEFAULT
. Do not override the method, instead, implements the same method with options version- Parameters:
prefs
- target prefs
-
loadSwingPreferences
a sub-class which wraps another value-pane should overrides the method in order to omit needless value setting. it can useGuiSwingView.loadPreferencesDefault(JComponent, GuiPreferences)
- Parameters:
prefs
- target prefs or ancestor of the target; actual target can be obtained byGuiPreferences.getDescendant(GuiMappingContext)
options
- options for applying- Since:
- 1.4
-
shutdownSwingView
default void shutdownSwingView()for each component, at the end of the process, this method will be called -
isSwingEditable
default boolean isSwingEditable() -
getSwingFocusKeyStroke
- Returns:
- creates a key-stroke from it's context. for wrapping panes, returns null
-
getDescendantByContext
- Parameters:
context
- the searched context, a descendant child of the context of the pane- Returns:
- a descendant value pane holding the context, or null. wrappers holding the same context are avoided.
-
getDescendantByValue
- Parameters:
value
- the searched value- Returns:
- a descendant value pane holding the value, or null. wrappers holding the same context are avoided.
-
getDescendantByValueIf
- Parameters:
valuePredicate
- the condition holds the searched value- Returns:
- a first descendant value pane holding a value matched by the predicate, or null. wrappers holding the same context are avoided.
-
getChildByName
- Parameters:
name
- the searched context name- Returns:
- a child (or descendant for wrappers) value pane holding the named context, or null. wrappers holding the same context are avoided.
-
getActionByName
- Parameters:
name
- the context name of the action- Returns:
- an action defined in the context of the pane. as the default implementation,
it searches
getSwingStaticMenuItems()
-
getActionByContext
-
getDescendantActionByContext
default GuiSwingActionDefault.ExecutionAction getDescendantActionByContext(GuiMappingContext context) -
getSpecifier
GuiReprValue.ObjectSpecifier getSpecifier()- Returns:
- the specifier for the context value, typically obtained from
GuiSwingView.SpecifierManager
-
requestSwingViewFocus
default void requestSwingViewFocus() -
setKeyStrokeString
set the key-stroke info. to the pane as a guide- Parameters:
keyStrokeString
- the key stroke info to be set.
-
setSwingViewHistoryValue
called from a value history menu. the default impl. just callssetSwingViewValueWithUpdate(Object)
.- Parameters:
value
- the new value. usually a ValueType.
-
prepareForRefresh
void prepareForRefresh()for each component, the method is called before refreshing in order to clear the view-clock. -
isSwingCurrentValueSupported
default boolean isSwingCurrentValueSupported() -
executeContextTask
default <RetType> GuiSwingTaskRunner.ContextTaskResult<RetType> executeContextTask(Supplier<RetType> task, Consumer<GuiSwingTaskRunner.ContextTaskResult<RetType>> afterTask) - Type Parameters:
RetType
- the value type- Parameters:
task
- the taskafterTask
- the task executed for deferred value- Returns:
GuiSwingTaskRunner.executeContextTask(Supplier, Consumer)
-
refreshByContext
default void refreshByContext()prepare, clear and update via the context- Since:
- 1.5
-
getPrefsJsonSupported
- Returns:
- prefs JSON
- Since:
- 1.5
-
setPrefsJsonSupported
- Parameters:
json
- prefs JSON- Since:
- 1.5
-