Package com.vaadin.data

Examples of com.vaadin.data.Container


     *      boolean[])
     *
     */
    public void sort(Object[] propertyId, boolean[] ascending)
            throws UnsupportedOperationException {
        final Container c = getContainerDataSource();
        if (c instanceof Container.Sortable) {
            final int pageIndex = getCurrentPageFirstItemIndex();
            boolean refreshingPreviouslyEnabled = disableContentRefreshing();
            ((Container.Sortable) c).sort(propertyId, ascending);
            setCurrentPageFirstItemIndex(pageIndex);
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

     *            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

     * @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) {
            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

     *      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<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

     *            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

     *            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

      return null;
    }
  }

  private void refreshReservations() {
    final Container reservations = db.getReservations(resourcePanel
        .getSelectedResources());
    reservedFrom.setContainerDataSource(reservations);
    reservedTo.setContainerDataSource(reservations);
    final Container allReservations = db.getReservations(null);
    allTable.setContainerDataSource(allReservations);
    if (allReservations != null && allReservations.size() > 0) {
      allTable.setVisibleColumns(new Object[] {
          ReservationsDB.Reservation.PROPERTY_ID_RESERVED_FROM,
          ReservationsDB.Reservation.PROPERTY_ID_RESERVED_TO,
          ReservationsDB.Resource.PROPERTY_ID_NAME,
          ReservationsDB.Resource.PROPERTY_ID_DESCRIPTION,
View Full Code Here

TOP

Related Classes of com.vaadin.data.Container

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.