Package com.vaadin.data

Examples of com.vaadin.data.Property


        final Field field = fields.get(id);
        if (field == null) {
            // field does not exist or it is not (yet) created for this property
            return ownProperties.get(id);
        }
        final Property property = field.getPropertyDataSource();

        if (property != null) {
            return property;
        } else {
            return field;
View Full Code Here


        }

        // Adds all the properties to this form
        for (final Iterator<?> i = propertyIds.iterator(); i.hasNext();) {
            final Object id = i.next();
            final Property property = itemDatasource.getItemProperty(id);
            if (id != null && property != null) {
                final Field f = fieldFactory.createField(itemDatasource, id,
                        this);
                if (f != null) {
                    f.setPropertyDataSource(property);
View Full Code Here

                        descriptions[i].toString());
            }
        }

        // Sets the property data source
        final Property property = oldField.getPropertyDataSource();
        oldField.setPropertyDataSource(null);
        newField.setPropertyDataSource(property);

        // Replaces the old field with new one
        layout.replaceComponent(oldField, newField);
View Full Code Here

            for (int j = 0; j < cols; j++) {
                if (isColumnCollapsed(colids[j])) {
                    continue;
                }
                Property p = null;
                Object value = "";
                boolean isGeneratedRow = generatedRow != null;
                boolean isGeneratedColumn = columnGenerators
                        .containsKey(colids[j]);
                boolean isGenerated = isGeneratedRow || isGeneratedColumn;

                if (!isGenerated) {
                    p = getContainerProperty(id, colids[j]);
                }

                if (isGeneratedRow) {
                    if (generatedRow.isSpanColumns() && j > 0) {
                        value = null;
                    } else if (generatedRow.isSpanColumns() && j == 0
                            && generatedRow.getValue() instanceof Component) {
                        value = generatedRow.getValue();
                    } else if (generatedRow.getText().length > j) {
                        value = generatedRow.getText()[j];
                    }
                } else {
                    // check in current pageBuffer already has row
                    int index = firstIndex + i;
                    if (p != null || isGenerated) {
                        int indexInOldBuffer = index - pageBufferFirstIndex;
                        if (index < firstIndexNotInCache
                                && index >= pageBufferFirstIndex
                                && pageBuffer[CELL_GENERATED_ROW][indexInOldBuffer] == null
                                && pageBuffer[CELL_ITEMID][indexInOldBuffer] == id) {
                            // we already have data in our cache,
                            // recycle it instead of fetching it via
                            // getValue/getPropertyValue
                            value = pageBuffer[CELL_FIRSTCOL + j][indexInOldBuffer];
                            if (!isGeneratedColumn && iscomponent[j]
                                    || !(value instanceof Component)) {
                                listenProperty(p, oldListenedProperties);
                            }
                        } else {
                            if (isGeneratedColumn) {
                                ColumnGenerator cg = columnGenerators
                                        .get(colids[j]);
                                value = cg.generateCell(this, id, colids[j]);
                                if (value != null
                                        && !(value instanceof Component)
                                        && !(value instanceof String)) {
                                    // Avoid errors if a generator returns
                                    // something
                                    // other than a Component or a String
                                    value = value.toString();
                                }
                            } else if (iscomponent[j]) {
                                value = p.getValue();
                                listenProperty(p, oldListenedProperties);
                            } else if (p != null) {
                                value = getPropertyValue(id, colids[j], p);
                                /*
                                 * If returned value is Component (via
View Full Code Here

                        if (cellVal instanceof Component
                                && visibleComponents.contains(cellVal)) {
                            visibleComponents.remove(cellVal);
                            unregisterComponent((Component) cellVal);
                        } else {
                            Property p = getContainerProperty(
                                    pageBuffer[CELL_ITEMID][i + ix], colids[c]);
                            if (p instanceof ValueChangeNotifier
                                    && listenedProperties.contains(p)) {
                                listenedProperties.remove(p);
                                ((ValueChangeNotifier) p).removeListener(this);
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

         * Also remove property data sources to unregister listeners keeping the
         * fields in memory.
         */
        if (component instanceof Field) {
            Field field = (Field) component;
            Property associatedProperty = associatedProperties
                    .remove(component);
            if (associatedProperty != null
                    && field.getPropertyDataSource() == associatedProperty) {
                // Remove the property data source only if it's the one we
                // added in getPropertyValue
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

            if (null == pd) {
                throw new IllegalStateException("Property " + propertyId
                        + " not found");
            }
            try {
                Property property = pd.createProperty(bean);
                return (IDTYPE) property.getValue();
            } catch (MethodException e) {
                throw new IllegalArgumentException(e);
            }
        }
View Full Code Here

        final Field field = fields.get(id);
        if (field == null) {
            // field does not exist or it is not (yet) created for this property
            return ownProperties.get(id);
        }
        final Property property = field.getPropertyDataSource();

        if (property != null) {
            return property;
        } else {
            return field;
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.