Package org.springframework.beans.support

Examples of org.springframework.beans.support.PropertyComparator


        else if (matcherEditor != null)
            eventList = new FilterList(eventList, matcherEditor);

        String sortProperty = getColumnPropertyNames()[0];
        SortedList sortedList = new SortedList(eventList,
                new PropertyComparator(sortProperty, true, true));
        eventList = sortedList;

        // Install this new event list configuration (sorting and filtering)
        installEventList(eventList);
View Full Code Here


    public List<User> searchUsers(final UsersSearchCriteria searchCriteria, final int firstResult, final int maxResults, final String sortProperty, final boolean ascending){
        final String searchTerm = searchCriteria != null? searchCriteria.getSearchTerm() : null;
        final List<User> users = userManager.search(searchTerm);
        if(StringUtils.isNotEmpty(sortProperty)) {
            log.debug(String.format("Sorting usersList by property='%s', ascending='%s'", sortProperty, ascending));
            Collections.sort(users, new PropertyComparator(sortProperty, true, ascending));
        }
        final int fromIndex = Math.min(firstResult, users.size());
        final int toIndex = Math.min(fromIndex + maxResults, users.size());
        log.debug(String.format("searchUsers(%d,%d) %d-%d [%d]", firstResult, maxResults, fromIndex, toIndex, users.size()));
        return users.subList(fromIndex, toIndex);
View Full Code Here

    @SuppressWarnings( "unchecked" )
    private List<Person> createSortedPersonList( Collection<Person> people )
    {
        final List<Person> list = new ArrayList<Person>(people);
        Collections.sort(list, new PropertyComparator("ssn", true, true));
        return list;
    }
View Full Code Here

      // Construct the event list of all our data and layer on the sorting
      EventList rawList = GlazedLists.eventList(Arrays.asList(data));
      int initialSortColumn = getInitialSortColumn();
      if (initialSortColumn >= 0) {
        String sortProperty = getColumnPropertyNames()[initialSortColumn];
        baseList = new SortedList(rawList, new PropertyComparator(sortProperty, false, true));
      }
      else {
        baseList = new SortedList(rawList);
      }
    }
View Full Code Here

        context.put(SELECTABLE_ITEMS_HOLDER_KEY, selectableItemsHolder);

        if( renderedProperty != null ) {
            context.put(RENDERER_KEY, new BeanPropertyValueListRenderer(renderedProperty));
            context.put(COMPARATOR_KEY, new PropertyComparator(renderedProperty, true, true));
        }

        return context;
    }
View Full Code Here

    public Binding createBoundComboBox(String formProperty, Object selectableItems, String renderedProperty) {
        Map context = createContext(ComboBoxBinder.SELECTABLE_ITEMS_KEY, selectableItems);
        context.put(ComboBoxBinder.RENDERER_KEY, new BeanPropertyValueListRenderer(renderedProperty));
        context.put(ComboBoxBinder.EDITOR_KEY, new BeanPropertyEditorClosure(renderedProperty));
        context.put(ComboBoxBinder.COMPARATOR_KEY, new PropertyComparator(renderedProperty, true, true));
        return createBinding(JComboBox.class, formProperty, context);
    }
View Full Code Here

            context.put(ListBinder.SELECTION_MODE_KEY, forceSelectMode);
        }
        context.put(ListBinder.SELECTABLE_ITEMS_KEY, selectableItems);
        if (renderedProperty != null) {
            context.put(ListBinder.RENDERER_KEY, new BeanPropertyValueListRenderer(renderedProperty));
            context.put(ListBinder.COMPARATOR_KEY, new PropertyComparator(renderedProperty, true, true));
        }
        return createBinding(JList.class, selectionFormProperty, context);
    }
View Full Code Here

     * table.
     *
     * @param propertyName Name of the property on which to sort.
     */
    public void setSortProperty(String propertyName) {
        setSortComparator( new PropertyComparator( propertyName, true, true ) );
    }
View Full Code Here

        selectableItems = Arrays.asList(new Object[] {new Item("A"), new Item("B"), new Item("C"), new Item("D"),
                new Item("E")});

        context.put(ListBinder.SELECTABLE_ITEMS_KEY, selectableItems);
        context.put(ListBinder.RENDERER_KEY, new BeanPropertyValueListRenderer("name"));
        context.put(ListBinder.COMPARATOR_KEY, new PropertyComparator("name", true, false));

        return "listProperty";
    }
View Full Code Here

    dog.setNickName("mace");

    Dog dog2 = new Dog();
    dog2.setNickName("biscy");

    PropertyComparator c = new PropertyComparator("nickName", false, true);
    assertTrue(c.compare(dog, dog2) > 0);
    assertTrue(c.compare(dog, dog) == 0);
    assertTrue(c.compare(dog2, dog) < 0);
  }
View Full Code Here

TOP

Related Classes of org.springframework.beans.support.PropertyComparator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.