Package com.vaadin.data

Examples of com.vaadin.data.Property$ReadOnlyStatusChangeNotifier


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


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

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

                        // check in current pageBuffer already has row
                        int index = firstIndex + i;
                        if (p != null || isGenerated) {
                            if (index < firstIndexNotInCache
                                    && index >= pageBufferFirstIndex) {
                                // we have data already in our cache,
                                // recycle it instead of fetching it via
                                // getValue/getPropertyValue
                                int indexInOldBuffer = index
                                        - pageBufferFirstIndex;
                                value = pageBuffer[CELL_FIRSTCOL + j][indexInOldBuffer];
                                if (!isGenerated && iscomponent[j]
                                        || !(value instanceof Component)) {
                                    listenProperty(p, oldListenedProperties);
                                }
                            } else {
                                if (isGenerated) {
                                    ColumnGenerator cg = columnGenerators
                                            .get(colids[j]);
                                    value = cg
                                            .generateCell(this, id, colids[j]);

                                } 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

        for (Iterator<?> i = ids.iterator(); i.hasNext(); row++) {
            Object rid = i.next();
            int col = 0;
            for (Iterator<?> j = cols.iterator(); j.hasNext(); col++) {
                Object cid = j.next();
                Property p = container.getContainerProperty(rid, cid);
                if (p != null) {
                    res[row][col] = getFormattedValue(p);
                }
            }
        }
View Full Code Here

                }
                break;

            }
            if (getItemIconPropertyId() != null) {
                final Property p = getContainerProperty(itemId,
                        getItemIconPropertyId());
                if (p != null && p instanceof Property.ValueChangeNotifier) {
                    ((Property.ValueChangeNotifier) p)
                            .addValueChangeListener(getCaptionChangeListener());
                    captionChangeNotifiers.add(p);
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) {
                    try {
                        p = getContainerProperty(id, colids[j]);
                    } catch (Exception e) {
                        exceptionsDuringCachePopulation.add(e);
                        value = null;
                    }

                }

                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
                                && id.equals(pageBuffer[CELL_ITEMID][indexInOldBuffer])) {
                            // 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]);
                                try {
                                    value = cg
                                            .generateCell(this, id, colids[j]);
                                } catch (Exception e) {
                                    exceptionsDuringCachePopulation.add(e);
                                    value = null;
                                }

                                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]) {
                                try {
                                    value = p.getValue();
                                } catch (Exception e) {
                                    exceptionsDuringCachePopulation.add(e);
                                    value = null;
                                }
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

         * 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

        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) {
                    bindPropertyToField(id, property, f);
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

TOP

Related Classes of com.vaadin.data.Property$ReadOnlyStatusChangeNotifier

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.