Package com.vaadin.data

Examples of com.vaadin.data.Property


                caption = itemId.toString();
            }
            break;

        case ITEM_CAPTION_MODE_PROPERTY:
            final Property p = getContainerProperty(itemId,
                    getItemCaptionPropertyId());
            if (p != null) {
                caption = p.toString();
            }
            break;
        }

        // All items must have some captions
View Full Code Here


        if (getItemIconPropertyId() == null) {
            return null;
        }

        final Property ip = getContainerProperty(itemId,
                getItemIconPropertyId());
        if (ip == null) {
            return null;
        }
        final Object icon = ip.getValue();
        if (icon instanceof Resource) {
            return (Resource) icon;
        }

        return null;
View Full Code Here

                    captionChangeNotifiers.add(i);
                }
                Collection<?> pids = i.getItemPropertyIds();
                if (pids != null) {
                    for (Iterator<?> it = pids.iterator(); it.hasNext();) {
                        Property p = i.getItemProperty(it.next());
                        if (p != null
                                && p instanceof Property.ValueChangeNotifier) {
                            ((Property.ValueChangeNotifier) p)
                                    .addListener(getCaptionChangeListener());
                            captionChangeNotifiers.add(p);
                        }
                    }

                }
                break;
            case ITEM_CAPTION_MODE_PROPERTY:
                final Property p = getContainerProperty(itemId,
                        getItemCaptionPropertyId());
                if (p != null && p instanceof Property.ValueChangeNotifier) {
                    ((Property.ValueChangeNotifier) p)
                            .addListener(getCaptionChangeListener());
                    captionChangeNotifiers.add(p);
                }
                break;

            }
            if (getItemIconPropertyId() != null) {
                final Property p = getContainerProperty(itemId,
                        getItemIconPropertyId());
                if (p != null && p instanceof Property.ValueChangeNotifier) {
                    ((Property.ValueChangeNotifier) p)
                            .addListener(getCaptionChangeListener());
                    captionChangeNotifiers.add(p);
View Full Code Here

    convertNullProperties = dontSkip;
  }


   public Property getItemProperty (Object pid) throws IllegalStateException {
    Property replace = instances.get(pid);

    if (replace != null) {
      final Property property = item.getItemProperty(pid);
      if (property == null && !convertNullProperties) {
        return null;//not found
      }

      if (replace instanceof PropertyConverter) {
View Full Code Here

      formatNullProperties = dontSkip;
    }


    public Property getItemProperty(Object pid) throws IllegalStateException {
        final Property property = item.getItemProperty(pid);
        if (property == null && !formatNullProperties) {
          return null;
        }//not exists

        PropertyFormatter propertyFormatter = instances.get(pid);
View Full Code Here


  /** Get first {@link Property} by pid */
  public Property getItemProperty (Object pid) {
    for (Item i : items) {
      Property p = i.getItemProperty(pid);
      if (p != null) {
        return p;
      }
    }
    return null;//not found
View Full Code Here

      for (final Iterator<?> it = dataSource.getItemIds().iterator(); it
          .hasNext();) {
        final Object itemId = it.next();
        final Item item = dataSource.getItem(itemId);
        Property p = item.getItemProperty(itemStartPropertyId);
        Date start = (Date) p.getValue();
        Date end = start; // assume same day
        if (itemEndPropertyId != null) {
          p = item.getItemProperty(itemEndPropertyId);
          end = (Date) p.getValue();
          if (end == null) {
            end = start;
          } else if (end.before(start)) {
            final Date tmp = start;
            start = end;
            end = tmp;
          }
        }

        // TODO half-done lazyloading logic (hence broken)

        if (start != null) {
          if ((start.getMonth() <= month || end.getMonth() >= month)) {
            target.startTag("item");
            // TODO different id?
            target.addAttribute("id", itemId.hashCode());
            if (itemStyleNamePropertyId != null) {
              p = item.getItemProperty(itemStyleNamePropertyId);
              final String styleName = (String) p.getValue();
              target.addAttribute("styleName", styleName);
            }
            SimpleDateFormat sdf = new SimpleDateFormat(
                "d MM yyyy HH:mm:ss Z");

            target.addAttribute("Z", start.getTimezoneOffset());

            target.addAttribute("start", "" + sdf.format(start));

            if (end != start) {
              target.addAttribute("end", "" + sdf.format(end));
            }
            if (itemTitlePropertyId != null) {
              p = item.getItemProperty(itemTitlePropertyId);
              final Object val = p.getValue();
              if (val != null) {
                target.addAttribute("title", val.toString());
              }
            }
            if (itemDescriptionPropertyId != null) {
              p = item.getItemProperty(itemDescriptionPropertyId);
              final Object val = p.getValue();
              if (val != null) {
                target.addAttribute("description", val
                    .toString());
              }
            }
            if (itemNotimePropertyId != null) {
              p = item.getItemProperty(itemNotimePropertyId);
              final Object val = p.getValue();
              if (val != null) {
                target.addAttribute("notime", ((Boolean) val)
                    .booleanValue());
              }
            }
View Full Code Here

     */
    protected int compareProperty(Object propertyId, boolean sortDirection,
            Item item1, Item item2) {

        // Get the properties to compare
        final Property property1 = item1.getItemProperty(propertyId);
        final Property property2 = item2.getItemProperty(propertyId);

        // Get the values to compare
        final Object value1 = (property1 == null) ? null : property1.getValue();
        final Object value2 = (property2 == null) ? null : property2.getValue();

        // Result of the comparison
        int r = 0;
        if (sortDirection) {
            r = propertyValueComparator.compare(value1, value2);
View Full Code Here

     *            The {@link Item} that contains the property
     * @param propertyId
     *            The id of the property
     */
    private void addValueChangeListener(Item item, Object propertyId) {
        Property property = item.getItemProperty(propertyId);
        if (property instanceof ValueChangeNotifier) {
            // avoid multiple notifications for the same property if
            // multiple filters are in use
            ValueChangeNotifier notifier = (ValueChangeNotifier) property;
            notifier.removeListener(this);
View Full Code Here

     *            The {@link Item} that contains the property
     * @param propertyId
     *            The id of the property
     */
    private void removeValueChangeListener(Item item, Object propertyId) {
        Property property = item.getItemProperty(propertyId);
        if (property instanceof ValueChangeNotifier) {
            ((ValueChangeNotifier) property).removeListener(this);
        }
    }
View Full Code Here

TOP

Related Classes of com.vaadin.data.Property

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.