Package org.jdesktop.binding.metadata

Examples of org.jdesktop.binding.metadata.MetaData


        }
    }

    private MetaData createMetaData(PropertyDescriptor prop) {
       
        MetaData metaData = null;
        // JW: cannot cope with indexedPropertyTypes (?)
        // they seem to return null for getPropertyType
        if (Number.class.isAssignableFrom(prop.getPropertyType())) {
            metaData = new NumberMetaData(
                    prop.getName(),
                    prop.getPropertyType(),
                    prop.getDisplayName());
        } else if (isNumberType(prop))
        {
            // convert the primitive types to their boxed types
            // this makes the binding code happier in
            // AbstractBinding#convertToModelType
             metaData = new NumberMetaData(
                            prop.getName(),
                            primitivesToBoxed.get(prop.getPropertyType()),
                            prop.getDisplayName());
            // JW: really??
            metaData.setRequired(true);
        } else {
            Class type = prop.getPropertyType();
            if (primitivesToBoxed.get(type) != null) {
                type = primitivesToBoxed.get(type);
            }
            metaData = new MetaData(prop.getName(), type, prop
                                .getDisplayName());
               
        }
        return metaData;
    }
View Full Code Here


    public abstract String[] getFieldNames();

    public MetaData[] getMetaData() {
        String fieldNames[] = getFieldNames();
        MetaData metaData[] = new MetaData[fieldNames.length];
        for(int i = 0; i < fieldNames.length; i++) {
            metaData[i] = getMetaData(fieldNames[i]);
        }
        return metaData;
    }
View Full Code Here

        }
       
    }

    public Class getColumnClass(int columnIndex) {
        MetaData metaData = getMetaData(columnIndex);
        return metaData.getElementClass();
    }
View Full Code Here

        //its possible that the meta data hasn't shown up yet. In this
        //case, use the field name until the meta data arrives
        // JW: when would that be the case?
//        MetaData md = dm.getMetaData(fieldNames[column]);
//        return md == null ? fieldNames[column] : md.getLabel();
        MetaData md = getMetaData(column);
        return md.getLabel();
    }
View Full Code Here

        MetaData md = getMetaData(column);
        return md.getLabel();
    }
   
    public boolean isCellEditable(int rowIndex, int columnIndex) {
        MetaData md = getMetaData(columnIndex);
        return !md.isReadOnly();
    }
View Full Code Here

        return cachedMetaData == null ? new MetaData[0] : cachedMetaData;
    }

    public MetaData getMetaData(String dataID) {
        if (cachedMetaData == null) {
            return new MetaData(dataID);
        }
        for (MetaData md : cachedMetaData) {
            if (md.getName().equals(dataID)) {
                return md;
            }
View Full Code Here

        cachedMetaData = new MetaData[cols.size()];
        cachedFieldNames = new String[cachedMetaData.length];
        for (int i=0; i<cachedMetaData.length; i++) {
            DataColumn col = cols.get(i);
            //TODO if the column name changes, my cache is invalidated!!!
            cachedMetaData[i] = new MetaData(col.getName(), col.getType());
            cachedFieldNames[i] = col.getName();
        }
    }
View Full Code Here

        }
    }

    public void configureTableColumn(MetaDataProvider provider,
            TableColumnExt column) {
        MetaData metaData = provider
                .getMetaData(provider.getFieldNames()[column.getModelIndex()]);
        column.setIdentifier(metaData.getName());
        column.setHeaderValue(metaData.getLabel());
        if (metaData.getElementClass() == String.class) {

            if (metaData.getDisplayWidth() > 0) {
                StringBuffer buf = new StringBuffer(metaData.getDisplayWidth());
                for (int i = 0; i < metaData.getDisplayWidth(); i++) {
                    buf.append("r");

                }
                column.setPrototypeValue(buf.toString());
            }
        } else if (metaData.getElementClass() == Number.class) {
            if (metaData.getDisplayWidth() > 0) {
                StringBuffer buf = new StringBuffer(metaData.getDisplayWidth());
                for (int i = 0; i < metaData.getDisplayWidth(); i++) {
                    buf.append("1");

                }
                column.setPrototypeValue(buf.toString());
               
View Full Code Here

TOP

Related Classes of org.jdesktop.binding.metadata.MetaData

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.