Class DataTypeSelectionEditor

  • All Implemented Interfaces:
    java.io.Serializable, javax.swing.CellEditor

    public class DataTypeSelectionEditor
    extends javax.swing.AbstractCellEditor
    An editor that is used to show the DropDownSelectionTextField for the entering of data types by name and offers the user of a completion window. This editor also provides a browse button that when pressed will show a data type tree so that the user may browse a tree of known data types.

    The typical usage of this class is in conjunction with the DataTypeChooserDialog. The dialog uses this editor as part of its DataType selection process. Users seeking a dialog that allows users to choose DataTypes are encouraged to use that dialog. If you wish to add this editor to a widget directly, then see below.

    Stand Alone Usage
    In order to use this component directly you need to call getEditorComponent(). This will give you a Component for editing.

    In order to know when changes are made to the component you need to add a DocumentListener via the addDocumentListener(DocumentListener) method. The added listener will be notified as the user enters text into the editor's text field. Then, to determine when there is as valid DataType in the field you may call validateUserSelection().

    See Also:
    Serialized Form
    • Method Detail

      • setPreferredDataTypeManager

        public void setPreferredDataTypeManager​(DataTypeManager dataTypeManager)
        Sets the DataTypeManager to use when the chooser is forced to parse the given data type text to resolve the data type. If the users chooses a type, then this value is not used. Note that setting this value does not restrict the parser to just the given value, but rather the given value is the preferred manager and is thus searched first.
        Parameters:
        dataTypeManager - the preferred data type manager
      • getCellEditorValue

        public java.lang.Object getCellEditorValue()
        See Also:
        CellEditor.getCellEditorValue()
      • getCellEditorValueAsDataType

        public DataType getCellEditorValueAsDataType()
      • getCellEditorValueAsText

        public java.lang.String getCellEditorValueAsText()
        Returns the text value of the editor's text field.
        Returns:
        the text value of the editor's text field.
      • getEditorComponent

        public javax.swing.JComponent getEditorComponent()
        Returns the component that allows the user to edit.
        Returns:
        the component that allows the user to edit.
      • getBrowseButton

        public javax.swing.JButton getBrowseButton()
      • setDefaultSelectedTreePath

        public void setDefaultSelectedTreePath​(javax.swing.tree.TreePath path)
        Sets the initially selected node in the data type tree that the user can choose to show.
        Parameters:
        path - The path to set
      • requestFocus

        public void requestFocus()
      • setCellEditorValue

        public void setCellEditorValue​(DataType dataType)
        Sets the value to be edited on this cell editor.
        Parameters:
        dataType - The data type which is to be edited.
      • setCellEditorValueAsText

        public void setCellEditorValueAsText​(java.lang.String text)
      • addDocumentListener

        public void addDocumentListener​(javax.swing.event.DocumentListener listener)
        Adds a document listener to the text field editing component of this editor so that users can be notified when the text contents of the editor change. You may verify whether the text changes represent a valid DataType by calling validateUserSelection().
        Parameters:
        listener - the listener to add.
        See Also:
        validateUserSelection()
      • removeDocumentListener

        public void removeDocumentListener​(javax.swing.event.DocumentListener listener)
        Removes a previously added document listener.
        Parameters:
        listener - the listener to remove.s
      • addFocusListener

        public void addFocusListener​(java.awt.event.FocusListener listener)
      • removeFocusListener

        public void removeFocusListener​(java.awt.event.FocusListener listener)
      • setTabCommitsEdit

        public void setTabCommitsEdit​(boolean doesCommit)
      • getNavigationDirection

        public NavigationDirection getNavigationDirection()
        Returns the direction of the user triggered navigation; null if the user did not trigger navigation out of this component.
      • validateUserSelection

        public boolean validateUserSelection()
                                      throws InvalidDataTypeException
        Returns true if the current value of the data type editor is a know data type.
        Returns:
        true if the current value of the data type editor is a know data type.
        Throws:
        InvalidDataTypeException - If the current text in the editor's text field could not be parsed into a valid DataType
      • containsValidDataType

        public boolean containsValidDataType()