Results 1 to 3 of 3

Thread: List and ComboBoxBinder.COMPARATOR_KEY

  1. #1
    Join Date
    Mar 2005
    Location
    Brazil
    Posts
    40

    Default 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. #2
    Join Date
    Apr 2006
    Location
    Germany, Berlin
    Posts
    61

    Default

    Thanks for the hint. I've fixed this.
    ___
    Mathias

  3. #3
    Join Date
    Mar 2005
    Location
    Brazil
    Posts
    40

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •