Package com.vaadin.data

Examples of com.vaadin.data.Container$Ordered


    final String descriptions[] = { "Picking up guests from airport",
        "Sightseeing with the guests",
        "Moving new servers from A to B", "Shopping",
        "Customer meeting", "Guests arriving at harbour",
        "Moving furniture", "Taking guests to see town" };
    final Container cat = getCategories();
    final Collection<?> cIds = cat.getItemIds();
    for (final Iterator<?> it = cIds.iterator(); it.hasNext();) {
      final Object id = it.next();
      final Item ci = cat.getItem(id);
      final String c = (String) ci.getItemProperty(
          Resource.PROPERTY_ID_CATEGORY).getValue();
      final Container resources = getResources(c);
      final Collection<?> rIds = resources.getItemIds();
      final Calendar cal = Calendar.getInstance();
      cal.set(Calendar.MINUTE, 0);
      cal.set(Calendar.SECOND, 0);
      cal.set(Calendar.MILLISECOND, 0);
      final int hourNow = new Date().getHours();
      // cal.add(Calendar.DAY_OF_MONTH, -days);
      for (int i = 0; i < days; i++) {
        int r = 3;
        for (final Iterator<?> rit = rIds.iterator(); rit.hasNext()
            && r > 0; r--) {
          final Object rid = rit.next();
          final Item resource = resources.getItem(rid);
          final int s = hourNow - 6
              + (int) Math.round(Math.random() * 6.0);
          final int e = s + 1 + (int) Math.round(Math.random() * 4.0);
          final Date start = new Date(cal.getTimeInMillis());
          start.setHours(s);
View Full Code Here


     *      boolean[])
     *
     */
    public void sort(Object[] propertyId, boolean[] ascending)
            throws UnsupportedOperationException {
        final Container c = getContainerDataSource();
        if (c instanceof Container.Sortable) {
            final int pageIndex = getCurrentPageFirstItemIndex();
            ((Container.Sortable) c).sort(propertyId, ascending);
            setCurrentPageFirstItemIndex(pageIndex);
            resetPageBuffer();
View Full Code Here

     * Gets the container property IDs, which can be used to sort the item.
     *
     * @see com.vaadin.data.Container.Sortable#getSortableContainerPropertyIds()
     */
    public Collection getSortableContainerPropertyIds() {
        final Container c = getContainerDataSource();
        if (c instanceof Container.Sortable && !isSortDisabled()) {
            return ((Container.Sortable) c).getSortableContainerPropertyIds();
        } else {
            return new LinkedList();
        }
View Full Code Here

     *            the Collection containing the options.
     */
    public AbstractSelect(String caption, Collection options) {

        // Creates the options container and add given options to it
        final Container c = new IndexedContainer();
        if (options != null) {
            for (final Iterator i = options.iterator(); i.hasNext();) {
                c.addItem(i.next());
            }
        }

        setCaption(caption);
        setContainerDataSource(c);
View Full Code Here

     *      boolean[])
     *
     */
    public void sort(Object[] propertyId, boolean[] ascending)
            throws UnsupportedOperationException {
        final Container c = getContainerDataSource();
        if (c instanceof Container.Sortable) {
            final int pageIndex = getCurrentPageFirstItemIndex();
            ((Container.Sortable) c).sort(propertyId, ascending);
            setCurrentPageFirstItemIndex(pageIndex);
            resetPageBuffer();
View Full Code Here

     * Gets the container property IDs, which can be used to sort the item.
     *
     * @see com.vaadin.data.Container.Sortable#getSortableContainerPropertyIds()
     */
    public Collection getSortableContainerPropertyIds() {
        final Container c = getContainerDataSource();
        if (c instanceof Container.Sortable && !isSortDisabled()) {
            return ((Container.Sortable) c).getSortableContainerPropertyIds();
        } else {
            return new LinkedList();
        }
View Full Code Here

     *      boolean[])
     *
     */
    public void sort(Object[] propertyId, boolean[] ascending)
            throws UnsupportedOperationException {
        final Container c = getContainerDataSource();
        if (c instanceof Container.Sortable) {
            final int pageIndex = getCurrentPageFirstItemIndex();
            ((Container.Sortable) c).sort(propertyId, ascending);
            setCurrentPageFirstItemIndex(pageIndex);
            refreshRowCache();
View Full Code Here

     * Gets the container property IDs, which can be used to sort the item.
     *
     * @see com.vaadin.data.Container.Sortable#getSortableContainerPropertyIds()
     */
    public Collection<?> getSortableContainerPropertyIds() {
        final Container c = getContainerDataSource();
        if (c instanceof Container.Sortable && !isSortDisabled()) {
            return ((Container.Sortable) c).getSortableContainerPropertyIds();
        } else {
            return new LinkedList<Object>();
        }
View Full Code Here

     * @param needNullSelectOption
     * @return filtered list of options (may be empty) or null if cannot use
     *         container filters
     */
    protected List<?> getOptionsWithFilter(boolean needNullSelectOption) {
        Container container = getContainerDataSource();

        if (pageLength == 0) {
            // no paging: return all items
            filteredSize = container.size();
            return new ArrayList<Object>(container.getItemIds());
        }

        if (!(container instanceof Filterable)
                || !(container instanceof Indexed)
                || getItemCaptionMode() != ITEM_CAPTION_MODE_PROPERTY) {
            return null;
        }

        Filterable filterable = (Filterable) container;

        Filter filter = buildFilter(filterstring, filteringMode);

        // adding and removing filters leads to extraneous item set
        // change events from the underlying container, but the ComboBox does
        // not process or propagate them based on the flag filteringContainer
        if (filter != null) {
            filteringContainer = true;
            filterable.addContainerFilter(filter);
        }

        Indexed indexed = (Indexed) container;

        int indexToEnsureInView = -1;

        // if not an option request (item list when user changes page), go
        // to page with the selected item after filtering if accepted by
        // filter
        Object selection = getValue();
        if (isScrollToSelectedItem() && !optionRequest && !isMultiSelect()
                && selection != null) {
            // ensure proper page
            indexToEnsureInView = indexed.indexOfId(selection);
        }

        filteredSize = container.size();
        currentPage = adjustCurrentPage(currentPage, needNullSelectOption,
                indexToEnsureInView, filteredSize);
        int first = getFirstItemIndexOnCurrentPage(needNullSelectOption,
                filteredSize);
        int last = getLastItemIndexOnCurrentPage(needNullSelectOption,
View Full Code Here

     * @param needNullSelectOption
     * @return filtered list of options (may be empty) or null if cannot use
     *         container filters
     */
    protected List<?> getOptionsWithFilter(boolean needNullSelectOption) {
        Container container = getContainerDataSource();

        if (pageLength == 0) {
            // no paging: return all items
            filteredSize = container.size();
            return new ArrayList<Object>(container.getItemIds());
        }

        if (!(container instanceof Filterable)
                || !(container instanceof Indexed)
                || getItemCaptionMode() != ITEM_CAPTION_MODE_PROPERTY) {
            return null;
        }

        Filterable filterable = (Filterable) container;

        Filter filter = buildFilter(filterstring, filteringMode);

        // adding and removing filters leads to extraneous item set
        // change events from the underlying container, but the ComboBox does
        // not process or propagate them based on the flag filteringContainer
        if (filter != null) {
            filteringContainer = true;
            filterable.addContainerFilter(filter);
        }

        Indexed indexed = (Indexed) container;

        int indexToEnsureInView = -1;

        // if not an option request (item list when user changes page), go
        // to page with the selected item after filtering if accepted by
        // filter
        Object selection = getValue();
        if (isScrollToSelectedItem() && !optionRequest && !isMultiSelect()
                && selection != null) {
            // ensure proper page
            indexToEnsureInView = indexed.indexOfId(selection);
        }

        filteredSize = container.size();
        currentPage = adjustCurrentPage(currentPage, needNullSelectOption,
                indexToEnsureInView, filteredSize);
        int first = getFirstItemIndexOnCurrentPage(needNullSelectOption,
                filteredSize);
        int last = getLastItemIndexOnCurrentPage(needNullSelectOption,
View Full Code Here

TOP

Related Classes of com.vaadin.data.Container$Ordered

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.