java.lang.Object
org.autogui.swing.prefs.GuiSwingPrefsEditor
- All Implemented Interfaces:
GuiSwingPrefsApplyOptions
a prefs-visitor for constructing prefs-editor GUI
rootPaneis the top component, aggregating all sub-components of visited prefs, creatd byGuiSwingPreferences.RootView.loadPreferences(GuiPreferences, GuiSwingPrefsApplyOptions)contentPaneis the actul aggregation of sub-components, added to the root bycreateRootPane(); While visiting,constructionflag is true.historyValuesPaneholds 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;
updatedListenersreceives those notifications.updatedindicates it has changes. This is used for enabling "Revert" button; the reverting feature is implemented byrevertBackupActionwhich saves preerences asbackupPrefsas on-memory-store, restores it to the rootpreferences. - each preferences adds labels as showing their names; collected as
labelFieldsand 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,
namePathToPanessaves 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 classa list wrapping a map; it supposes that the map never updated the outside of the liststatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classNested classes/interfaces inherited from interface org.autogui.swing.prefs.GuiSwingPrefsApplyOptions
GuiSwingPrefsApplyOptions.PrefsApplyOptionsDefault, GuiSwingPrefsApplyOptions.PrefsApplyOptionsLoadingTargetType -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected GuiPreferencesprotected booleanprotected JComponentstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected List<JTextComponent> static final Stringprotected Map<String, JComponent> static final Stringprotected GuiPreferencesstatic final Stringprotected List<GuiSwingPrefsEditor.PrefsLoader> protected AbstractActionprotected JComponentstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected booleanprotected GuiSwingPrefsHistoryValuesstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from interface org.autogui.swing.prefs.GuiSwingPrefsApplyOptions
APPLY_OPTIONS_DEFAULT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHistoryValue(GuiPreferences.HistoryValueEntry entry, GuiPreferences prefs) voidaddHistoryValuesPane(GuiPreferences prefs, JComponent historyValuesPane) voidaddToContentPane(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) voidapply(GuiSwingViewCollectionTable.TablePreferencesUpdater tablePrefs, GuiPreferences prefs) voidapply(GuiSwingViewObjectPane.SplitPreferencesUpdater splitPrefs, GuiPreferences prefs) voidapply(GuiSwingViewTabbedPane.TabPreferencesUpdater tabPrefs, GuiPreferences prefs) voidapply(GuiSwingPrefsSupports.FileDialogPreferencesUpdater fileDialogPrefs, GuiPreferences prefs) voidapply(GuiSwingPrefsSupports.WindowPreferencesUpdater windowPrefs, GuiPreferences prefs) booleanapplyTo(GuiSwingTableModelCollection.PreferencesForTableColumnOrderStatic orderPrefs, GuiSwingTableModelCollection.GuiSwingTableModelColumns columns, int modelIndex) voidapplyTo(GuiSwingTableModelCollection.PreferencesForTableColumnWidthStatic widthPrefs, ObjectTableColumn column) voidbegin(Object loadingTarget, GuiPreferences prefs, GuiSwingPrefsApplyOptions.PrefsApplyOptionsLoadingTargetType targetType) protected JComponentcreate(BiConsumer<GuiPreferences, GuiSwingPrefsEditor> loader, GuiPreferences prefs) create(GuiSwingPreferences.RootView view, GuiPreferences prefs) create(GuiSwingView.ValuePane<?> view, GuiPreferences prefs) static JComponentcreateBoolean(SettingsWindow.LabelGroup names, String name, Supplier<Boolean> getter, Consumer<Boolean> setter, Consumer<Runnable> validationCheckers) createCurrentValuePane(GuiPreferences prefs, String key, GuiSwingPrefsHistoryValues.HistoryPaneResult jsonPane) static JComponentcreateFile(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 JPanelcreateNamedHorizontal(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 JComponentcreateNumberInt(SettingsWindow.LabelGroup names, String name, Supplier<Integer> getter, Consumer<Integer> setter, Consumer<Runnable> validationCheckers) static DimensioncreateNumberPrefs(GuiReprValueNumberSpinner.NumberType numType, GuiPreferences prefs) static JPanelcreatePane(boolean horizontal) createPrefsInfo(GuiPreferences prefs) createSplitPrefs(GuiPreferences prefs) static JComponentcreateString(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) voidend(Object loadingTarget, GuiPreferences prefs, GuiSwingPrefsApplyOptions.PrefsApplyOptionsLoadingTargetType targetType) static StringgetIntListString(List<Integer> target) static StringgetName(GuiPreferences prefs, String nameOpt) static StringgetName(GuiPreferences prefs, GuiSwingPrefsSupports.PreferencesByJsonEntry prefsObj) booleanhasHistoryValues(GuiPreferences targetPrefs, GuiPreferences ctxPrefs) booleanisInit()booleanbooleanbooleanbooleanloadAndReturnsAsReloader(GuiSwingPrefsSupports.Preferences prefsObj, GuiPreferences prefs) voidvoidloadFrom(GuiSwingViewNumberSpinner.TypedSpinnerNumberModel numModel, GuiPreferences prefs) voidloadFrom(GuiSwingTableModelCollection.PreferencesForTableColumnOrderStatic orderPrefs, GuiPreferences prefs) voidloadFrom(GuiSwingTableModelCollection.PreferencesForTableColumnWidthStatic widthPrefs, GuiPreferences prefs) voidloadFromAndApplyTo(GuiSwingTableColumnString.MultilineColumnTextPane columnEditor, GuiPreferences prefs) booleanloadFromAndApplyTo(GuiSwingTableModelCollection.PreferencesForTableColumnOrder orderPrefs, ObjectTableModelColumns columns, GuiPreferences prefs) voidloadFromAndApplyTo(GuiSwingTableModelCollection.PreferencesForTableColumnWidth columnWidthPrefs, ObjectTableColumn column, GuiPreferences prefs) voidloadFromPrefs(GuiSwingPrefsSupports.WindowPreferencesUpdater windowPrefs, GuiPreferences prefs) static <T> List<T> nonNullList(List<T> list) voidvoidsaveRunner(GuiSwingPrefsSupports.Preferences prefsObj, GuiPreferences prefs) voidsetConstruction(boolean construction) static voidsetIntListString(List<Integer> target, String s) voidsetLastHistoryValueByPrefsJsonSupported(GuiSwingView.ValuePane<Object> pane, GuiPreferences prefs, Object value) voidsetLastHistoryValueBySwingViewHistoryValue(GuiSwingView.ValuePane<Object> pane, GuiPreferences prefs, Object value) voidsetLastHistoryValueBySwingViewHistoryValue(GuiSwingView.ValuePane<Object> pane, GuiPreferences prefs, GuiPreferences.HistoryValueEntry entry) <ValueType>
Consumer<ValueType> setterPrefs(Consumer<ValueType> setter, GuiSwingPrefsSupports.Preferences prefsObj, GuiPreferences prefs) voidsetUpdated(boolean updated) protected voidprotected <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:
-
MULTILINE_COLUMN_PREFS_EDIT_FINISH_BY_ENTER_AND_KEY
- 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:
isInitin interfaceGuiSwingPrefsApplyOptions- Returns:
- true if the loading processing is the initial time; then the window location might be set
-
isSkippingValue
public boolean isSkippingValue()- Specified by:
isSkippingValuein interfaceGuiSwingPrefsApplyOptions- Returns:
- if true, skipping setting object properties
-
hasHistoryValues
- Specified by:
hasHistoryValuesin interfaceGuiSwingPrefsApplyOptions
-
begin
public void begin(Object loadingTarget, GuiPreferences prefs, GuiSwingPrefsApplyOptions.PrefsApplyOptionsLoadingTargetType targetType) - Specified by:
beginin interfaceGuiSwingPrefsApplyOptions
-
end
public void end(Object loadingTarget, GuiPreferences prefs, GuiSwingPrefsApplyOptions.PrefsApplyOptionsLoadingTargetType targetType) - Specified by:
endin interfaceGuiSwingPrefsApplyOptions
-
apply
- Specified by:
applyin interfaceGuiSwingPrefsApplyOptions
-
loadFromPrefs
public void loadFromPrefs(GuiSwingPrefsSupports.WindowPreferencesUpdater windowPrefs, GuiPreferences prefs) - Specified by:
loadFromPrefsin interfaceGuiSwingPrefsApplyOptions
-
apply
- Specified by:
applyin interfaceGuiSwingPrefsApplyOptions
-
apply
- Specified by:
applyin interfaceGuiSwingPrefsApplyOptions
-
apply
public void apply(GuiSwingPrefsSupports.FileDialogPreferencesUpdater fileDialogPrefs, GuiPreferences prefs) - Specified by:
applyin interfaceGuiSwingPrefsApplyOptions
-
loadFrom
- Specified by:
loadFromin interfaceGuiSwingPrefsApplyOptions
-
loadFrom
public void loadFrom(GuiSwingViewNumberSpinner.TypedSpinnerNumberModel numModel, GuiPreferences prefs) - Specified by:
loadFromin interfaceGuiSwingPrefsApplyOptions
-
addHistoryValue
- Specified by:
addHistoryValuein interfaceGuiSwingPrefsApplyOptions
-
setLastHistoryValueBySwingViewHistoryValue
public void setLastHistoryValueBySwingViewHistoryValue(GuiSwingView.ValuePane<Object> pane, GuiPreferences prefs, Object value) - Specified by:
setLastHistoryValueBySwingViewHistoryValuein interfaceGuiSwingPrefsApplyOptions
-
setLastHistoryValueByPrefsJsonSupported
public void setLastHistoryValueByPrefsJsonSupported(GuiSwingView.ValuePane<Object> pane, GuiPreferences prefs, Object value) - Specified by:
setLastHistoryValueByPrefsJsonSupportedin interfaceGuiSwingPrefsApplyOptions
-
setLastHistoryValueBySwingViewHistoryValue
public void setLastHistoryValueBySwingViewHistoryValue(GuiSwingView.ValuePane<Object> pane, GuiPreferences prefs, GuiPreferences.HistoryValueEntry entry) - Specified by:
setLastHistoryValueBySwingViewHistoryValuein interfaceGuiSwingPrefsApplyOptions
-
apply
public void apply(GuiSwingViewCollectionTable.TablePreferencesUpdater tablePrefs, GuiPreferences prefs) - Specified by:
applyin interfaceGuiSwingPrefsApplyOptions
-
isSavingAsCurrentPreferencesInColumns
public boolean isSavingAsCurrentPreferencesInColumns()- Specified by:
isSavingAsCurrentPreferencesInColumnsin interfaceGuiSwingPrefsApplyOptions
-
loadFrom
public void loadFrom(GuiSwingTableModelCollection.PreferencesForTableColumnWidthStatic widthPrefs, GuiPreferences prefs) - Specified by:
loadFromin interfaceGuiSwingPrefsApplyOptions
-
loadFrom
public void loadFrom(GuiSwingTableModelCollection.PreferencesForTableColumnOrderStatic orderPrefs, GuiPreferences prefs) - Specified by:
loadFromin interfaceGuiSwingPrefsApplyOptions
-
applyTo
public void applyTo(GuiSwingTableModelCollection.PreferencesForTableColumnWidthStatic widthPrefs, ObjectTableColumn column) - Specified by:
applyToin interfaceGuiSwingPrefsApplyOptions
-
applyTo
public boolean applyTo(GuiSwingTableModelCollection.PreferencesForTableColumnOrderStatic orderPrefs, GuiSwingTableModelCollection.GuiSwingTableModelColumns columns, int modelIndex) - Specified by:
applyToin interfaceGuiSwingPrefsApplyOptions
-
loadFromAndApplyTo
public void loadFromAndApplyTo(GuiSwingTableModelCollection.PreferencesForTableColumnWidth columnWidthPrefs, ObjectTableColumn column, GuiPreferences prefs) - Specified by:
loadFromAndApplyToin interfaceGuiSwingPrefsApplyOptions
-
loadFromAndApplyTo
public boolean loadFromAndApplyTo(GuiSwingTableModelCollection.PreferencesForTableColumnOrder orderPrefs, ObjectTableModelColumns columns, GuiPreferences prefs) - Specified by:
loadFromAndApplyToin interfaceGuiSwingPrefsApplyOptions
-
loadFromAndApplyTo
public void loadFromAndApplyTo(GuiSwingTableColumnString.MultilineColumnTextPane columnEditor, GuiPreferences prefs) - Specified by:
loadFromAndApplyToin interfaceGuiSwingPrefsApplyOptions- Parameters:
columnEditor- the actual paneprefs- the source prefs
-
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
-
createColumnMultilinne
- Parameters:
prefs- the source prefs- Returns:
- the component for multiline string column settings;
a pane including the checkbox of
MULTILINE_COLUMN_PREFS_EDIT_FINISH_BY_ENTER_AND_KEY - Since:
- 1.8
-
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 BooleanSupplier loadAndReturnsAsReloader(GuiSwingPrefsSupports.Preferences prefsObj, GuiPreferences prefs) -
validationCheckerAdderWithReloader
- Parameters:
reloader- suppose the runner for prefsObj.loadFromAndChanged(prefs)- Returns:
- the appender for
validationCheckerAdd(Runnable)with combining the reloader
-
validationCheckerAdd
-
getName
public static String getName(GuiPreferences prefs, GuiSwingPrefsSupports.PreferencesByJsonEntry prefsObj) -
getName
-
nonNullList
-