Announcement Announcement Module
Collapse
No announcement yet.
List and ComboBoxBinder.COMPARATOR_KEY Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • List and ComboBoxBinder.COMPARATOR_KEY

    Hello,

    The SwingBindingFactory is creating BoundComboBox and BoundList with inverse order of elements.
    I'm a bit confused but I think the constructor of PropertyComparator is inverting the idea of ascending/descending.

    If PropertyComparator is right, wouldn't be better to create the List and Combo with elements in descending order (from A to Z)?

    Code:
        public Binding createBoundComboBox(String formProperty,
            ValueModel selectableItemsHolder, String renderedProperty)
        {
            Map context = createContext(ComboBoxBinder.SELECTABLE_ITEMS_KEY,
                selectableItemsHolder);
            //ommited
            context.put(ComboBoxBinder.COMPARATOR_KEY, new PropertyComparator(
                renderedProperty, true, true)); //previously false
            return createBinding(JComboBox.class, formProperty, context);
        }
    
        public Binding createBoundList(String selectionFormProperty,
            Object selectableItems, String renderedProperty, Integer forceSelectMode)
        {
            final Map context = new HashMap();
            //ommited
            if (renderedProperty != null)
            {
                context.put(ListBinder.RENDERER_KEY,
                    new BeanPropertyValueListRenderer(renderedProperty));
                context.put(ListBinder.COMPARATOR_KEY, new PropertyComparator(
                    renderedProperty, true, true)); //previously false
            }
            //ommited
        }
    Thanks,

    Mauro.

  • #2
    Thanks for the hint. I've fixed this.

    Comment


    • #3
      Hi Mathias,

      Thanks for the quick fixes!
      Could you please take a lot at http://forum.springframework.org/showthread.php?t=28656 ?
      Some tip about it?

      Thanks,

      Mauro.

      Comment

      Working...
      X