swingx
  1. swingx
  2. SWINGX-1470

AutoCompleteDecorator fails to undecorate

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Works as designed
    • Affects Version/s: 1.6.1
    • Fix Version/s: 1.6.5
    • Component/s: Autocomplete
    • Labels:
      None
    • Environment:

      Windows XP, Java SE 6

      Description

      Calling AutoCompleteDecorator.decorate on a JTextField does not remove previous decorations.
      This results in the AutoComplete list shrinking to nothing when the argument Lists are disjunctive.

      Code example:

      class MyEditor extends DefaultCellEditor {

      public MyEditor() {
      super(new JTextField());
      }

      public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
      JTextField field = (JTextField) super.getTableCellEditorComponent(table, value, isSelected, row, column);

      List<String> suggestions = this.getSuggestions(column, value);

      if (column == 2)

      { AutoCompleteDecorator.decorate(field, suggestions, true); }

      if (column == 3)

      { AutoCompleteDecorator.decorate(field, suggestions, false); }

      return field;
      }

      Now, when the editor is called on column 2, field is decorated. When it is subsequently called on column 3, there are no suggestions in the list.

      This may be worked around by making AutoCompleteDecorator.undecorate() accessible.

        Activity

        Hide
        Karl Schaefer added a comment -

        Do you can a runnable test case?

        Show
        Karl Schaefer added a comment - Do you can a runnable test case?
        Hide
        Karl Schaefer added a comment -

        You need to use a separate editor for each column.

        Show
        Karl Schaefer added a comment - You need to use a separate editor for each column.

          People

          • Assignee:
            Karl Schaefer
            Reporter:
            MikeAdler
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: