Package com.vaadin.data.util

Examples of com.vaadin.data.util.IndexedContainer


  /*
   * create a graph container with a month of random data
   */
  public Container.Indexed createGraphDataSource()
  {
    Container.Indexed container = new IndexedContainer();
   
    container.addContainerProperty(Timeline.PropertyId.TIMESTAMP, Date.class, null);
    container.addContainerProperty(Timeline.PropertyId.VALUE, Float.class, 0f);
   
    //add random data to container
    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.YEAR, -1);
    java.util.Date today = new java.util.Date();
    Random generator = new Random();
   
    while(cal.getTime().before(today))
    {
      //create a point in time
      Item item = container.addItem(cal.getTime());
     
      //set the time stamp property
      item.getItemProperty(Timeline.PropertyId.TIMESTAMP).setValue(cal.getTime());
     
      //set the value property
View Full Code Here


  /*
   * Creates a marker container with a marker for each seven days
   */
  public Container.Indexed createmarkerDataSource()
  {
    Container.Indexed container = new IndexedContainer();
   
    container.addContainerProperty(Timeline.PropertyId.TIMESTAMP, Date.class, null);
    container.addContainerProperty(Timeline.PropertyId.CAPTION, String.class, "our marker symbol");
    container.addContainerProperty(Timeline.PropertyId.VALUE, String.class, "Our description");
   
    //add a marker for every 7 days
    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.MONTH, -1);
    java.util.Date today = new java.util.Date();
    SimpleDateFormat formatter = new SimpleDateFormat("EEE, MMM d, ''yy");
   
    while(cal.getTime().before(today))
    {
      //create a point in time
      Item item = container.addItem(cal.getTime());
     
      //set the time stamp property
      item.getItemProperty(Timeline.PropertyId.TIMESTAMP).setValue(cal.getTime());
     
      //set the caption property
View Full Code Here

  /*
   * Creates an event container with a marker for each Sunday
   */
  public Container.Indexed createEventDateSource()
  {
    Container.Indexed container = new IndexedContainer();
   
    container.addContainerProperty(Timeline.PropertyId.TIMESTAMP, Date.class, null);
    container.addContainerProperty(Timeline.PropertyId.CAPTION, String.class, "our marker symbol");
   
    //add a marker for every 7 days
    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.YEAR, -1);
    java.util.Date today = new java.util.Date();
   
    while (cal.getTime().before(today))
    {
      if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)
      {
        //create a point in time
        Item item = container.addItem(cal.getTime());
       
        //set the time stamp property
        item.getItemProperty(Timeline.PropertyId.TIMESTAMP).setValue(cal.getTime());
       
        //set the caption property
View Full Code Here

    public void setContainerDataSource(Container newDataSource) {
        if (newDataSource == null) {
            // Note: using wrapped IndexedContainer to match constructor (super
            // creates an IndexedContainer, which is then wrapped).
            newDataSource = new ContainerHierarchicalWrapper(
                    new IndexedContainer());
        }

        // Assure that the data source is ordered by making unordered
        // containers ordered by wrapping them
        if (Container.Hierarchical.class.isAssignableFrom(newDataSource
View Full Code Here

    /**
     * Creates an empty Select. The caption is not used.
     */
    public AbstractSelect() {
        setContainerDataSource(new IndexedContainer());
    }
View Full Code Here

    /**
     * Creates an empty Select with caption.
     */
    public AbstractSelect(String caption) {
        setContainerDataSource(new IndexedContainer());
        setCaption(caption);
    }
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 newDataSource
     *            the new data source.
     */
    public void setContainerDataSource(Container newDataSource) {
        if (newDataSource == null) {
            newDataSource = new IndexedContainer();
        }

        getCaptionChangeListener().clear();

        if (items != newDataSource) {
View Full Code Here

    public void setContainerDataSource(Container newDataSource) {

        disableContentRefreshing();

        if (newDataSource == null) {
            newDataSource = new IndexedContainer();
        }

        // Assures that the data source is ordered by making unordered
        // containers ordered by wrapping them
        if (newDataSource instanceof Container.Ordered) {
View Full Code Here

            throw new IllegalArgumentException(
                    "PagedTable can only use containers that implement Container.Indexed");
        }
        Container.Indexed realContainer = (Container.Indexed) newDataSource;
        this.realContainer = realContainer;
        shownContainer = new IndexedContainer();
        for (Object object : realContainer.getContainerPropertyIds()) {
            shownContainer.addContainerProperty(object,
                    realContainer.getType(object), null);
        }
        fillVisibleContainer(0);
View Full Code Here

TOP

Related Classes of com.vaadin.data.util.IndexedContainer

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.