Examples of AttributeDescriptor


Examples of org.apache.commons.betwixt.AttributeDescriptor

            }
            if ( useAttributesForPrimitives ) {
                if (log.isTraceEnabled()) {
                    log.trace( "Adding property as attribute: " + name );
                }
                nodeDescriptor = new AttributeDescriptor();
            } else {
                if (log.isTraceEnabled()) {
                    log.trace( "Adding property as element: " + name );
                }
                nodeDescriptor = new ElementDescriptor(true);
View Full Code Here

Examples of org.apache.commons.betwixt.AttributeDescriptor

                // iterate through all attributes       
                AttributeDescriptor[] attributeDescriptors
                    = typeDescriptor.getAttributeDescriptors();
                if ( attributeDescriptors != null ) {
                    for ( int i = 0, size = attributeDescriptors.length; i < size; i++ ) {
                        AttributeDescriptor attributeDescriptor = attributeDescriptors[i];
                       
                        // The following isn't really the right way to find the attribute
                        // but it's quite robust.
                        // The idea is that you try both namespace and local name first
                        // and if this returns null try the qName.
                        String value = attributes.getValue(
                            attributeDescriptor.getURI(),
                            attributeDescriptor.getLocalName()
                        );
                       
                        if (value == null) {
                            value = attributes.getValue(attributeDescriptor.getQualifiedName());
                        }
                       
                        if (log.isTraceEnabled()) {
                            log.trace("Attr URL:" + attributeDescriptor.getURI());
                            log.trace("Attr LocalName:" + attributeDescriptor.getLocalName() );
                            log.trace(value);
                        }
                       
                        Updater updater = attributeDescriptor.getUpdater();
                        log.trace(updater);
                        if ( updater != null && value != null ) {
                            updater.update( context, value );
                        }
                    }
View Full Code Here

Examples of org.apache.commons.betwixt.AttributeDescriptor

     * @throws SAXException 1. If the attribute tag is not inside an element tag.
     * 2. If the name attribute is not valid XML attribute name.
     */
    public void begin(Attributes attributes) throws SAXException {
       
        AttributeDescriptor descriptor = new AttributeDescriptor();
        String name = attributes.getValue( "name" );

        // check that name is well formed
        if ( !XMLUtils.isWellFormedXMLName( name ) ) {
            throw new SAXException("'" + name + "' would not be a well formed xml attribute name.");
        }
       
        descriptor.setQualifiedName( name );
        descriptor.setLocalName( name );
        String uri = attributes.getValue( "uri" );
        if ( uri != null ) {
            descriptor.setURI( uri );       
        }
        String propertyName = attributes.getValue( "property" );
        descriptor.setPropertyName( propertyName );
        descriptor.setPropertyType( loadClass( attributes.getValue( "type" ) ) );
       
        if ( propertyName != null && propertyName.length() > 0 ) {
            configureDescriptor(descriptor);
        } else {
            String value = attributes.getValue( "value" );
            if ( value != null ) {
                descriptor.setTextExpression( new ConstantExpression( value ) );
            }
        }

        Object top = digester.peek();
        if ( top instanceof ElementDescriptor ) {
View Full Code Here

Examples of org.apache.commons.betwixt.AttributeDescriptor

                // iterate through all attributes       
                AttributeDescriptor[] attributeDescriptors
                    = typeDescriptor.getAttributeDescriptors();
                if ( attributeDescriptors != null ) {
                    for ( int i = 0, size = attributeDescriptors.length; i < size; i++ ) {
                        AttributeDescriptor attributeDescriptor = attributeDescriptors[i];
                       
                        // The following isn't really the right way to find the attribute
                        // but it's quite robust.
                        // The idea is that you try both namespace and local name first
                        // and if this returns null try the qName.
                        String value = attributes.getValue(
                            attributeDescriptor.getURI(),
                            attributeDescriptor.getLocalName()
                        );
                       
                        if ( value == null ) {
                            value = attributes.getValue(
                                attributeDescriptor.getQualifiedName());
                        }
                       
                        if ( log.isTraceEnabled() ) {
                            log.trace("Attr URL:" + attributeDescriptor.getURI());
                            log.trace(
                                        "Attr LocalName:"
                                        + attributeDescriptor.getLocalName() );
                            log.trace(value);
                        }
                       
                        Updater updater = attributeDescriptor.getUpdater();
                        if ( log.isTraceEnabled() ) {
                            log.trace("Updater : "+updater);
                        }
                        if ( updater != null && value != null ) {
                            updater.update( context, value );
View Full Code Here

Examples of org.apache.commons.betwixt.AttributeDescriptor

        XMLBeanInfo beanInfo = introspector.introspect(TuneBean.class);
        ElementDescriptor tuneBeanDescriptor = beanInfo.getElementDescriptor();
       
        AttributeDescriptor[] tuneBeanAttributes = tuneBeanDescriptor.getAttributeDescriptors();
        assertEquals("Only expect one attribute", 1, tuneBeanAttributes.length);
        AttributeDescriptor recordedAttribute = tuneBeanAttributes[0];
        assertEquals("Expected recorded to be bound as an attribute", "recorded", recordedAttribute.getLocalName());
       
        ElementDescriptor[] tuneBeanChildElements = tuneBeanDescriptor.getElementDescriptors();
        assertEquals("Expected three child elements", 3 , tuneBeanChildElements.length);
       
        int bits = 0;
View Full Code Here

Examples of org.apache.commons.betwixt.AttributeDescriptor

        AttributeDescriptor[] attributeDescriptors = beanInfo
                .getElementDescriptor().getAttributeDescriptors();
        assertEquals("Need 2 attribute descriptors", 2,
                attributeDescriptors.length);

        AttributeDescriptor attribute1Descriptor = beanInfo
                .getElementDescriptor().getAttributeDescriptor("attribute1");
        log.info("attribute1Descriptor: " + attribute1Descriptor);
        debugOptions(attribute1Descriptor.getOptions());
        assertNotNull(attribute1Descriptor);
        assertEquals("2", attribute1Descriptor.getOptions().getValue(
                "version-from"));
        assertNull(attribute1Descriptor.getOptions().getValue("version-until"));

        AttributeDescriptor attribute2Descriptor = beanInfo
                .getElementDescriptor().getAttributeDescriptor("attribute2");
        log.info("attribute2Descriptor: " + attribute2Descriptor);
        debugOptions(attribute2Descriptor.getOptions());
        assertNotNull(attribute2Descriptor);
        assertEquals("1", attribute2Descriptor.getOptions().getValue(
                "version-from"));
        assertEquals("2", attribute2Descriptor.getOptions().getValue(
                "version-until"));

        log.info("testIntrospection() complete");
    }
View Full Code Here

Examples of org.carrot2.util.attribute.AttributeDescriptor

        final Map<String, AttributeEditorInfo> editorInfos = Maps.newHashMap();

        int maxColumns = 1;
        for (String key : sortedKeys)
        {
            final AttributeDescriptor descriptor = attributeDescriptors.get(key);

            IAttributeEditor editor = null;
            try
            {
                editor = EditorFactory.getEditorFor(this.componentClazz, descriptor);
                final AttributeEditorInfo info = editor.init(bindable, descriptor,
                    globalEventsProvider, currentValues);

                editorInfos.put(key, info);
                maxColumns = Math.max(maxColumns, info.columns);
            }
            catch (EditorNotFoundException ex)
            {
                Utils.logError("No editor for attribute: "
                    + descriptor.key + " (class: " + descriptor.type + ")", false);

                /*
                 * Skip editor.
                 */
                editor = null;
            }

            editors.put(key, editor);
        }

        /*
         * Prepare the layout for this editor.
         */
        final GridLayout layout = GUIFactory.zeroMarginGridLayout();
        layout.makeColumnsEqualWidth = false;

        layout.numColumns = maxColumns;
        this.setLayout(layout);

        /*
         * Create visual components for editors.
         */
        final GridDataFactory labelFactory = GridDataFactory.fillDefaults().span(
            maxColumns, 1);

        boolean firstEditor = true;
        for (String key : sortedKeys)
        {
            final AttributeDescriptor descriptor = attributeDescriptors.get(key);
            final IAttributeEditor editor = editors.get(key);
            final AttributeEditorInfo editorInfo = editorInfos.get(key);

            if (editor == null)
            {
View Full Code Here

Examples of org.opengis.feature.type.AttributeDescriptor

    private List<String> obtainQueryAttributesForFeatureTable( final SimpleFeatureType schema ) {
        final List<String> queryAtts=new ArrayList<String>();
       
        for( int i = 0; i < schema.getAttributeCount(); i++ ) {
            AttributeDescriptor attr = schema.getDescriptor(i);
            if( !(attr instanceof GeometryDescriptor) ){
                queryAtts.add(attr.getName().getLocalPart());
            }
        }
        return queryAtts;
    }
View Full Code Here

Examples of org.opengis.feature.type.AttributeDescriptor

        SimpleFeatureType schema = features.getSchema();
        org.eclipse.jface.viewers.CellEditor[] editors = new org.eclipse.jface.viewers.CellEditor[schema
                .getAttributeCount() + 1];

        for( int i = 0; i < schema.getAttributeCount(); i++ ) {
            AttributeDescriptor aType = schema.getDescriptor(i);
            Class< ? extends Object> concreteType = aType.getType().getBinding();
            Composite control = (Composite) tableViewer.getControl();
            if (concreteType.isAssignableFrom(String.class)) {
                BasicTypeCellEditor textCellEditor = new BasicTypeCellEditor(control, String.class);
                editors[i + 1] = textCellEditor;
            } else if (concreteType.isAssignableFrom(Integer.class)) {
View Full Code Here

Examples of org.opengis.feature.type.AttributeDescriptor

            column.addListener(SWT.Selection, new AttributeColumnSortListener(this,
                    FEATURE_ID_COLUMN_PROPERTY));

            for( int i = 0; i < schema.getAttributeCount(); i++ ) {
                AttributeDescriptor aType = schema.getDescriptor(i);
                column = new TableColumn(table, SWT.CENTER | SWT.BORDER);
                if (Geometry.class.isAssignableFrom(aType.getType().getBinding())) { // was
                                                                                     // aType.isGeometry()
                    // jg: wot is this maddness? jd: paul said so
                    column.setText("GEOMETRY"); //$NON-NLS-1$
                } else
                    column.setText(aType.getName().getLocalPart());

                layout.addColumnData(new ColumnWeightData(1, 100, true));
                column.setMoveable(true);

                column.addListener(SWT.Selection, new AttributeColumnSortListener(this, aType
                        .getName().getLocalPart()));
            }

        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.