Announcement Announcement Module
Collapse
No announcement yet.
Possible bug in FilteredListModel Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Possible bug in FilteredListModel

    I have a bounded ListModel which I pass to FilteredListModel. Then I create a JList using this FilteredListModel. The problem is when the Form object gets set, ListModel changes but filter model is not getting updated?

    Here is what I am trying to do,

    Code:
      final ListListModel listModel = (ListListModel)getFormModel().createBoundListModel(GlobalUser.AVAILABLE_ROLES_PROPERTIES);
            final FilteredListModel filteredModel = new FilteredListModel(listModel, new Constraint() {
                public boolean test(Object object) {
                    if (object instanceof Role) {
                        return!getSelectedListModel().contains(object);
                    }
                    return false;
                }
            });
    
            list.setModel(filteredModel);
    I think the problem is in FilteredListModel

    Code:
        public void contentsChanged(ListDataEvent e) {
            super.contentsChanged(e);
        }
    Should be

    Amad
    Code:
     public void contentsChanged(ListDataEvent e) {
            reallocateIndexes();
            super.contentsChanged(e);
        }
Working...
X