Module org.autogui

Interface GuiSwingView.ValuePane<ValueType>

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, 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 Details

    • getSwingViewValue

      ValueType getSwingViewValue()
      Returns:
      basically, the source value of the context, held by the component without touching the context.
    • setSwingViewValue

      void setSwingViewValue(ValueType value)
      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

      default void setSwingViewValueForTable(JTable table, Object value, int row, int column)
      update GUI display as a table-cell. the default impl. is just calling setSwingViewValue(Object)
      Parameters:
      table - the table
      value - the table row value as Object
      row - the view row index
      column - the view column index
      Since:
      1.6
    • setSwingViewValue

      void setSwingViewValue(ValueType value, GuiTaskClock clock)
      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 value
      clock - the clock of the value: if the clock is newer than the current view-clock of the pane, it can update
    • setSwingViewValueWithUpdate

      void setSwingViewValueWithUpdate(ValueType value)
      update the GUI display and the model. processed under the event thread. also increment the view-clock
      Parameters:
      value - the new value
    • setSwingViewValueWithUpdate

      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. the view-clock becomes the given clock.
      Parameters:
      value - the new value
      clock - 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 calls GuiMappingContext.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 calls GuiMappingContext.updateSourceFromRoot().
      Since:
      1.1
    • addSwingEditFinishHandler

      default void addSwingEditFinishHandler(Runnable eventHandler)
      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,
                                          new PopupCategorized(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-bar
      horizontalAlways - 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

      default GuiSwingViewPropertyPane.PropertyPane wrapSwingProperty()
    • wrapSwingNamed

    • asSwingViewComponent

      default JComponent asSwingViewComponent()
      Returns:
      this
    • saveSwingPreferences

      default void saveSwingPreferences(GuiPreferences prefs)
      only save the component itself, not including children. it can use GuiSwingView.savePreferencesDefault(JComponent, GuiPreferences)
      Parameters:
      prefs - target prefs or ancestor of the target; actual target can be obtained by GuiPreferences.getDescendant(GuiMappingContext)
    • loadSwingPreferences

      default void loadSwingPreferences(GuiPreferences prefs)
      loadSwingPreferences(GuiPreferences, GuiSwingPreferences.PrefsApplyOptions) with GuiSwingPreferences.APPLY_OPTIONS_DEFAULT. Do not override the method, instead, implements the same method with options version
      Parameters:
      prefs - target prefs
    • loadSwingPreferences

      default void loadSwingPreferences(GuiPreferences prefs, GuiSwingPreferences.PrefsApplyOptions options)
      a sub-class which wraps another value-pane should overrides the method in order to omit needless value setting. it can use GuiSwingView.loadPreferencesDefault(JComponent, GuiPreferences)
      Parameters:
      prefs - target prefs or ancestor of the target; actual target can be obtained by GuiPreferences.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

      default KeyStroke getSwingFocusKeyStroke()
      Returns:
      creates a key-stroke from it's context. for wrapping panes, returns null
    • getDescendantByContext

      default GuiSwingView.ValuePane<Object> getDescendantByContext(GuiMappingContext context)
      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

      default GuiSwingView.ValuePane<Object> getDescendantByValue(Object value)
      Parameters:
      value - the searched value
      Returns:
      a descendant value pane holding the value, or null. wrappers holding the same context are avoided.
    • getDescendantByValueIf

      default GuiSwingView.ValuePane<Object> getDescendantByValueIf(Predicate<Object> valuePredicate)
      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

      default GuiSwingView.ValuePane<Object> getChildByName(String name)
      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

      default GuiSwingActionDefault.ExecutionAction getActionByName(String name)
      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

      default GuiSwingActionDefault.ExecutionAction getActionByContext(GuiMappingContext context)
    • getDescendantActionByContext

      default GuiSwingActionDefault.ExecutionAction getDescendantActionByContext(GuiMappingContext context)
    • getSpecifier

      Returns:
      the specifier for the context value, typically obtained from GuiSwingView.SpecifierManager
    • requestSwingViewFocus

      default void requestSwingViewFocus()
    • setKeyStrokeString

      default void setKeyStrokeString(String keyStrokeString)
      set the key-stroke info. to the pane as a guide
      Parameters:
      keyStrokeString - the key stroke info to be set.
    • setSwingViewHistoryValue

      default void setSwingViewHistoryValue(Object value)
      called from a value history menu. the default impl. just calls setSwingViewValueWithUpdate(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 task
      afterTask - 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

      default Object getPrefsJsonSupported()
      Returns:
      prefs JSON
      Since:
      1.5
    • setPrefsJsonSupported

      default void setPrefsJsonSupported(Object json)
      Parameters:
      json - prefs JSON
      Since:
      1.5