java.lang.Object
org.autogui.swing.prefs.GuiSwingPrefsEditor
- All Implemented Interfaces:
GuiSwingPrefsApplyOptions
a prefs-visitor for constructing prefs-editor GUI
rootPane
is the top component, aggregating all sub-components of visited prefs, creatd byGuiSwingPreferences.RootView.loadPreferences(GuiPreferences, GuiSwingPrefsApplyOptions)
contentPane
is the actul aggregation of sub-components, added to the root bycreateRootPane()
; While visiting,construction
flag is true.historyValuesPane
holds the current pane for history-values while construction- creating of actual pane for history-values is done by
GuiSwingPrefsHistoryValues
- all sub-components have ability to notify own changes;
updatedListeners
receives those notifications.updated
indicates it has changes. This is used for enabling "Revert" button; the reverting feature is implemented byrevertBackupAction
which saves preerences asbackupPrefs
as on-memory-store, restores it to the rootpreferences
. - each preferences adds labels as showing their names; collected as
labelFields
and those can be searchedSearchFilterTextField
- each sub-components have updating feature as collected into
validationCheckers
;revalidate()
updates all displayis of sub-components from the current preferences; Note references of those preferences are never changed. - while construction,
namePathToPanes
saves a prefs-path to a created pane; sometimes multiple history-store are visited for same prefs-path. This can avoid creation of duplicated panes
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
a list wrapping a map; it supposes that the map never updated the outside of the liststatic class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
Nested classes/interfaces inherited from interface org.autogui.swing.prefs.GuiSwingPrefsApplyOptions
GuiSwingPrefsApplyOptions.PrefsApplyOptionsDefault, GuiSwingPrefsApplyOptions.PrefsApplyOptionsLoadingTargetType
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected GuiPreferences
protected boolean
protected JComponent
static final String
static final String
static final String
static final String
protected List
<JTextComponent> protected Map
<String, JComponent> static final String
protected GuiPreferences
static final String
protected List
<GuiSwingPrefsEditor.PrefsLoader> protected AbstractAction
protected JComponent
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
protected boolean
protected GuiSwingPrefsHistoryValues
static final String
static final String
static final String
static final String
Fields inherited from interface org.autogui.swing.prefs.GuiSwingPrefsApplyOptions
APPLY_OPTIONS_DEFAULT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addHistoryValue
(GuiPreferences.HistoryValueEntry entry, GuiPreferences prefs) void
addHistoryValuesPane
(GuiPreferences prefs, JComponent historyValuesPane) void
addToContentPane
(JComponent component) <PaneType extends JComponent>
PaneTypeaddToContentPaneIfFirst
(String name, Supplier<PaneType> paneFactory) <PaneType extends JComponent>
PaneTypeaddToContentPaneIfFirst
(GuiPreferences prefs, String key, Function<GuiPreferences, PaneType> paneFactory) addToContentPaneIfFirst
(GuiPreferences prefs, Supplier<? extends GuiSwingPrefsSupports.PreferencesByJsonEntry> prefsObjFactory) 1.<PaneType extends JComponent>
PaneTypeaddToContentPaneIfFirst
(GuiPreferences prefs, GuiSwingPrefsSupports.PreferencesByJsonEntry prefsObj, Function<GuiPreferences, PaneType> paneFactory) addUpdatedListener
(Consumer<Boolean> listener) void
apply
(GuiSwingViewCollectionTable.TablePreferencesUpdater tablePrefs, GuiPreferences prefs) void
apply
(GuiSwingViewObjectPane.SplitPreferencesUpdater splitPrefs, GuiPreferences prefs) void
apply
(GuiSwingViewTabbedPane.TabPreferencesUpdater tabPrefs, GuiPreferences prefs) void
apply
(GuiSwingPrefsSupports.FileDialogPreferencesUpdater fileDialogPrefs, GuiPreferences prefs) void
apply
(GuiSwingPrefsSupports.WindowPreferencesUpdater windowPrefs, GuiPreferences prefs) boolean
applyTo
(GuiSwingTableModelCollection.PreferencesForTableColumnOrderStatic orderPrefs, GuiSwingTableModelCollection.GuiSwingTableModelColumns columns, int modelIndex) void
applyTo
(GuiSwingTableModelCollection.PreferencesForTableColumnWidthStatic widthPrefs, ObjectTableColumn column) void
begin
(Object loadingTarget, GuiPreferences prefs, GuiSwingPrefsApplyOptions.PrefsApplyOptionsLoadingTargetType targetType) protected JComponent
create
(BiConsumer<GuiPreferences, GuiSwingPrefsEditor> loader, GuiPreferences prefs) create
(GuiSwingPreferences.RootView view, GuiPreferences prefs) create
(GuiSwingView.ValuePane<?> view, GuiPreferences prefs) static JComponent
createBoolean
(SettingsWindow.LabelGroup names, String name, Supplier<Boolean> getter, Consumer<Boolean> setter, Consumer<Runnable> validationCheckers) createCurrentValuePane
(GuiPreferences prefs, String key, GuiSwingPrefsHistoryValues.HistoryPaneResult jsonPane) static JComponent
createFile
(SettingsWindow.LabelGroup names, String name, Supplier<Path> getter, Consumer<Path> setter, Consumer<Runnable> validationCheckers) createLastHistoryValueBySwingViewHistoryValue
(GuiPreferences prefs, GuiPreferences.HistoryValueEntry entry) createNamed
(String name, JComponent contentPane) static JPanel
createNamedHorizontal
(SettingsWindow.LabelGroup names, String name, JComponent contentPane) static <NumType extends Number>
JComponentcreateNumber
(SettingsWindow.LabelGroup names, String name, Class<NumType> type, Supplier<NumType> getter, Consumer<NumType> setter, Consumer<Runnable> validationCheckers) static JComponent
createNumberInt
(SettingsWindow.LabelGroup names, String name, Supplier<Integer> getter, Consumer<Integer> setter, Consumer<Runnable> validationCheckers) static Dimension
createNumberPrefs
(GuiReprValueNumberSpinner.NumberType numType, GuiPreferences prefs) static JPanel
createPane
(boolean horizontal) createPrefsInfo
(GuiPreferences prefs) createSplitPrefs
(GuiPreferences prefs) static JComponent
createString
(SettingsWindow.LabelGroup names, String name, Supplier<String> getter, Consumer<String> setter, Consumer<Runnable> validationCheckers) createTablePrefs
(GuiPreferences prefs) createTabPrefs
(GuiPreferences prefs) createWindowPrefs
(String key, GuiPreferences prefs) void
end
(Object loadingTarget, GuiPreferences prefs, GuiSwingPrefsApplyOptions.PrefsApplyOptionsLoadingTargetType targetType) static String
getIntListString
(List<Integer> target) static String
getName
(GuiPreferences prefs, String nameOpt) static String
getName
(GuiPreferences prefs, GuiSwingPrefsSupports.PreferencesByJsonEntry prefsObj) boolean
hasHistoryValues
(GuiPreferences targetPrefs, GuiPreferences ctxPrefs) boolean
isInit()
boolean
boolean
boolean
boolean
loadAndReturnsAsReloader
(GuiSwingPrefsSupports.Preferences prefsObj, GuiPreferences prefs) void
void
loadFrom
(GuiSwingViewNumberSpinner.TypedSpinnerNumberModel numModel, GuiPreferences prefs) void
loadFrom
(GuiSwingTableModelCollection.PreferencesForTableColumnOrderStatic orderPrefs, GuiPreferences prefs) void
loadFrom
(GuiSwingTableModelCollection.PreferencesForTableColumnWidthStatic widthPrefs, GuiPreferences prefs) boolean
loadFromAndApplyTo
(GuiSwingTableModelCollection.PreferencesForTableColumnOrder orderPrefs, ObjectTableModelColumns columns, GuiPreferences prefs) void
loadFromAndApplyTo
(GuiSwingTableModelCollection.PreferencesForTableColumnWidth columnWidthPrefs, ObjectTableColumn column, GuiPreferences prefs) void
loadFromPrefs
(GuiSwingPrefsSupports.WindowPreferencesUpdater windowPrefs, GuiPreferences prefs) static <T> List
<T> nonNullList
(List<T> list) void
void
saveRunner
(GuiSwingPrefsSupports.Preferences prefsObj, GuiPreferences prefs) void
setConstruction
(boolean construction) static void
setIntListString
(List<Integer> target, String s) void
setLastHistoryValueByPrefsJsonSupported
(GuiSwingView.ValuePane<Object> pane, GuiPreferences prefs, Object value) void
setLastHistoryValueBySwingViewHistoryValue
(GuiSwingView.ValuePane<Object> pane, GuiPreferences prefs, Object value) void
setLastHistoryValueBySwingViewHistoryValue
(GuiSwingView.ValuePane<Object> pane, GuiPreferences prefs, GuiPreferences.HistoryValueEntry entry) <ValueType>
Consumer<ValueType> setterPrefs
(Consumer<ValueType> setter, GuiSwingPrefsSupports.Preferences prefsObj, GuiPreferences prefs) void
setUpdated
(boolean updated) protected void
validationCheckerAdderWithReloader
(Runnable reloader) protected <Pane extends ValueListPane<?,
?>>
Panestatic <Pane extends GuiSwingView.ValuePane<?>>
Pane
-
Field Details
-
rootPane
-
contentPane
-
historyValuesPane
-
valuePaneFactory
-
updatedListeners
-
construction
protected boolean construction -
updated
protected boolean updated -
labelFields
-
revertBackupAction
-
preferences
-
backupPrefs
-
validationCheckers
-
prefsLoaders
-
namePathToPanes
-
WINDOW_PREFS_PROP_X
- See Also:
-
WINDOW_PREFS_PROP_Y
- See Also:
-
WINDOW_PREFS_PROP_WIDTH
- See Also:
-
WINDOW_PREFS_PROP_HEIGHT
- See Also:
-
TAB_PREFS_PROP_SELECTED
- See Also:
-
FILE_DIALOG_PREFS_PROP_BACK_PATH
- See Also:
-
FILE_DIALOG_PREFS_PROP_CURRENT_DIRECTORY
- See Also:
-
FILE_DIALOG_PREFS_PROP_FILE_LIST
- See Also:
-
SPLIT_PREFS_PROP_DIVIDER
- See Also:
-
SPLIT_PREFS_PROP_HORIZONTAL
- See Also:
-
TABLE_PREFS_COLUMN_ORDER
- See Also:
-
TABLE_PREFS_COLUMN_WIDTH
- See Also:
-
TABLE_PREFS_ROW_HEIGHT
- See Also:
-
TABLE_PREFS_ROW_CUSTOM
- See Also:
-
TABLE_PREFS_ROW_FIT_TO_CONTENT
- See Also:
-
TABLE_PREFS_ROW_SORT
- See Also:
-
TABLE_PREFS_COLUMN_INDEX
- See Also:
-
TABLE_PREFS_COLUMN_ORDER_MODEL_INDEX
- See Also:
-
TABLE_PREFS_COLUMN_ORDER_VIEW_INDEX
- See Also:
-
PREFS_CURRENT_VALUE
- See Also:
-
DOCUMENT_PREFS_KEY
- See Also:
-
NUMBER_PREFS_KEY
- See Also:
-
-
Constructor Details
-
GuiSwingPrefsEditor
public GuiSwingPrefsEditor()
-
-
Method Details
-
addUpdatedListener
-
isUpdated
public boolean isUpdated() -
setUpdated
public void setUpdated(boolean updated) -
setConstruction
public void setConstruction(boolean construction) -
isNotConstruction
public boolean isNotConstruction() -
getRootPaneAfterInit
-
getContentPane
-
getRootPane
-
getRevertBackupAction
-
create
-
create
-
create
protected JComponent create(BiConsumer<GuiPreferences, GuiSwingPrefsEditor> loader, GuiPreferences prefs) -
getBackupPrefs
-
revertBackupPrefs
public void revertBackupPrefs() -
revalidate
public void revalidate() -
isInit
public boolean isInit()- Specified by:
isInit
in interfaceGuiSwingPrefsApplyOptions
- Returns:
- true if the loading processing is the initial time; then the window location might be set
-
isSkippingValue
public boolean isSkippingValue()- Specified by:
isSkippingValue
in interfaceGuiSwingPrefsApplyOptions
- Returns:
- if true, skipping setting object properties
-
hasHistoryValues
- Specified by:
hasHistoryValues
in interfaceGuiSwingPrefsApplyOptions
-
begin
public void begin(Object loadingTarget, GuiPreferences prefs, GuiSwingPrefsApplyOptions.PrefsApplyOptionsLoadingTargetType targetType) - Specified by:
begin
in interfaceGuiSwingPrefsApplyOptions
-
end
public void end(Object loadingTarget, GuiPreferences prefs, GuiSwingPrefsApplyOptions.PrefsApplyOptionsLoadingTargetType targetType) - Specified by:
end
in interfaceGuiSwingPrefsApplyOptions
-
apply
- Specified by:
apply
in interfaceGuiSwingPrefsApplyOptions
-
loadFromPrefs
public void loadFromPrefs(GuiSwingPrefsSupports.WindowPreferencesUpdater windowPrefs, GuiPreferences prefs) - Specified by:
loadFromPrefs
in interfaceGuiSwingPrefsApplyOptions
-
apply
- Specified by:
apply
in interfaceGuiSwingPrefsApplyOptions
-
apply
- Specified by:
apply
in interfaceGuiSwingPrefsApplyOptions
-
apply
public void apply(GuiSwingPrefsSupports.FileDialogPreferencesUpdater fileDialogPrefs, GuiPreferences prefs) - Specified by:
apply
in interfaceGuiSwingPrefsApplyOptions
-
loadFrom
- Specified by:
loadFrom
in interfaceGuiSwingPrefsApplyOptions
-
loadFrom
public void loadFrom(GuiSwingViewNumberSpinner.TypedSpinnerNumberModel numModel, GuiPreferences prefs) - Specified by:
loadFrom
in interfaceGuiSwingPrefsApplyOptions
-
addHistoryValue
- Specified by:
addHistoryValue
in interfaceGuiSwingPrefsApplyOptions
-
setLastHistoryValueBySwingViewHistoryValue
public void setLastHistoryValueBySwingViewHistoryValue(GuiSwingView.ValuePane<Object> pane, GuiPreferences prefs, Object value) - Specified by:
setLastHistoryValueBySwingViewHistoryValue
in interfaceGuiSwingPrefsApplyOptions
-
setLastHistoryValueByPrefsJsonSupported
public void setLastHistoryValueByPrefsJsonSupported(GuiSwingView.ValuePane<Object> pane, GuiPreferences prefs, Object value) - Specified by:
setLastHistoryValueByPrefsJsonSupported
in interfaceGuiSwingPrefsApplyOptions
-
setLastHistoryValueBySwingViewHistoryValue
public void setLastHistoryValueBySwingViewHistoryValue(GuiSwingView.ValuePane<Object> pane, GuiPreferences prefs, GuiPreferences.HistoryValueEntry entry) - Specified by:
setLastHistoryValueBySwingViewHistoryValue
in interfaceGuiSwingPrefsApplyOptions
-
apply
public void apply(GuiSwingViewCollectionTable.TablePreferencesUpdater tablePrefs, GuiPreferences prefs) - Specified by:
apply
in interfaceGuiSwingPrefsApplyOptions
-
isSavingAsCurrentPreferencesInColumns
public boolean isSavingAsCurrentPreferencesInColumns()- Specified by:
isSavingAsCurrentPreferencesInColumns
in interfaceGuiSwingPrefsApplyOptions
-
loadFrom
public void loadFrom(GuiSwingTableModelCollection.PreferencesForTableColumnWidthStatic widthPrefs, GuiPreferences prefs) - Specified by:
loadFrom
in interfaceGuiSwingPrefsApplyOptions
-
loadFrom
public void loadFrom(GuiSwingTableModelCollection.PreferencesForTableColumnOrderStatic orderPrefs, GuiPreferences prefs) - Specified by:
loadFrom
in interfaceGuiSwingPrefsApplyOptions
-
applyTo
public void applyTo(GuiSwingTableModelCollection.PreferencesForTableColumnWidthStatic widthPrefs, ObjectTableColumn column) - Specified by:
applyTo
in interfaceGuiSwingPrefsApplyOptions
-
applyTo
public boolean applyTo(GuiSwingTableModelCollection.PreferencesForTableColumnOrderStatic orderPrefs, GuiSwingTableModelCollection.GuiSwingTableModelColumns columns, int modelIndex) - Specified by:
applyTo
in interfaceGuiSwingPrefsApplyOptions
-
loadFromAndApplyTo
public void loadFromAndApplyTo(GuiSwingTableModelCollection.PreferencesForTableColumnWidth columnWidthPrefs, ObjectTableColumn column, GuiPreferences prefs) - Specified by:
loadFromAndApplyTo
in interfaceGuiSwingPrefsApplyOptions
-
loadFromAndApplyTo
public boolean loadFromAndApplyTo(GuiSwingTableModelCollection.PreferencesForTableColumnOrder orderPrefs, ObjectTableModelColumns columns, GuiPreferences prefs) - Specified by:
loadFromAndApplyTo
in interfaceGuiSwingPrefsApplyOptions
-
createRootPane
-
createHistoryValuesPane
public GuiSwingPrefsEditor.ValueListPaneHistoryValueEntry createHistoryValuesPane(GuiPreferences prefs) -
addToContentPaneIfFirst
public JComponent addToContentPaneIfFirst(GuiPreferences prefs, Supplier<? extends GuiSwingPrefsSupports.PreferencesByJsonEntry> prefsObjFactory) 1. create a JSON editor viaGuiSwingPrefsHistoryValues.createJsonEntrySource(GuiPreferences, Supplier)
2. register the editor for the updating mechanism bycreateCurrentValuePane(GuiPreferences, String, GuiSwingPrefsHistoryValues.HistoryPaneResult)
3. add the editor to the contentPane byaddToContentPaneIfFirst(GuiPreferences, String, Function)
- Parameters:
prefs
- the target source-prefsprefsObjFactory
- a constructor for the temporary prefs-object; using for obtaining key, loading and saving in the editor- Returns:
- the created pane
-
addToContentPaneIfFirst
public <PaneType extends JComponent> PaneType addToContentPaneIfFirst(GuiPreferences prefs, GuiSwingPrefsSupports.PreferencesByJsonEntry prefsObj, Function<GuiPreferences, PaneType> paneFactory) -
addToContentPaneIfFirst
public <PaneType extends JComponent> PaneType addToContentPaneIfFirst(GuiPreferences prefs, String key, Function<GuiPreferences, PaneType> paneFactory) -
addToContentPaneIfFirst
public <PaneType extends JComponent> PaneType addToContentPaneIfFirst(String name, Supplier<PaneType> paneFactory) -
addHistoryValuesPane
-
addToContentPane
-
createPrefsInfo
-
createWindowPrefs
-
createTabPrefs
-
createSplitPrefs
-
createFileDialogPrefs
-
createDocumentSettingPrefs
-
createNumberPrefs
public JComponent createNumberPrefs(GuiReprValueNumberSpinner.NumberType numType, GuiPreferences prefs) -
createLastHistoryValueBySwingViewHistoryValue
-
createLastHistoryValueBySwingViewHistoryValue
public JComponent createLastHistoryValueBySwingViewHistoryValue(GuiPreferences prefs, GuiPreferences.HistoryValueEntry entry) -
createCurrentValuePane
public JComponent createCurrentValuePane(GuiPreferences prefs, String key, GuiSwingPrefsHistoryValues.HistoryPaneResult jsonPane) -
createTablePrefs
-
createTableColumnWidthStatic
-
createTableColumnOrderStatic
-
createTableColumnWidth
-
createTableColumnOrder
-
createSearchTextField
-
getLabelFields
-
getIntListString
-
setIntListString
-
setterPrefs
public <ValueType> Consumer<ValueType> setterPrefs(Consumer<ValueType> setter, GuiSwingPrefsSupports.Preferences prefsObj, GuiPreferences prefs) -
saveRunner
-
saveRunnerForHistory
-
createPane
-
createNamed
-
createNamedHorizontal
public static JPanel createNamedHorizontal(SettingsWindow.LabelGroup names, String name, JComponent contentPane) -
createNumberInt
public static JComponent createNumberInt(SettingsWindow.LabelGroup names, String name, Supplier<Integer> getter, Consumer<Integer> setter, Consumer<Runnable> validationCheckers) -
createNumber
public static <NumType extends Number> JComponent createNumber(SettingsWindow.LabelGroup names, String name, Class<NumType> type, Supplier<NumType> getter, Consumer<NumType> setter, Consumer<Runnable> validationCheckers) -
createString
public static JComponent createString(SettingsWindow.LabelGroup names, String name, Supplier<String> getter, Consumer<String> setter, Consumer<Runnable> validationCheckers) -
createBoolean
public static JComponent createBoolean(SettingsWindow.LabelGroup names, String name, Supplier<Boolean> getter, Consumer<Boolean> setter, Consumer<Runnable> validationCheckers) -
createNumberPreferredSize
-
createFile
public static JComponent createFile(SettingsWindow.LabelGroup names, String name, Supplier<Path> getter, Consumer<Path> setter, Consumer<Runnable> validationCheckers) -
valuePane
public static <Pane extends GuiSwingView.ValuePane<?>> Pane valuePane(Pane p, Consumer<Runnable> validationCheckers) -
valueList
protected <Pane extends ValueListPane<?,?>> Pane valueList(Pane list, Consumer<Runnable> validationCheckAdder) -
loadAndReturnsAsReloader
public Runnable loadAndReturnsAsReloader(GuiSwingPrefsSupports.Preferences prefsObj, GuiPreferences prefs) -
validationCheckerAdderWithReloader
- Parameters:
reloader
- suppose the runner for prefsObj.loadFrom(prefs)- Returns:
- the appender for
validationCheckerAdd(Runnable)
with combining the reloader
-
validationCheckerAdd
-
getName
public static String getName(GuiPreferences prefs, GuiSwingPrefsSupports.PreferencesByJsonEntry prefsObj) -
getName
-
nonNullList
-