Package org.apache.directory.ldapstudio.browser.core.model.schema

Examples of org.apache.directory.ldapstudio.browser.core.model.schema.AttributeTypeDescription


        {
            return this.userSelectedValueEditor;
        }

        // check attribute preferences
        AttributeTypeDescription atd = schema.getAttributeTypeDescription( attributeType );
        Map attributeValueEditorMap = BrowserCommonActivator.getDefault().getValueEditorsPreferences().getAttributeValueEditorMap();
        if ( atd.getNumericOID() != null && attributeValueEditorMap.containsKey( atd.getNumericOID().toLowerCase() ) )
        {
            return ( IValueEditor ) this.class2ValueEditors.get( attributeValueEditorMap.get( atd.getNumericOID()
                .toLowerCase() ) );
        }
        String[] names = atd.getNames();
        for ( int i = 0; i < names.length; i++ )
        {
            if ( attributeValueEditorMap.containsKey( names[i].toLowerCase() ) )
            {
                return ( IValueEditor ) this.class2ValueEditors.get( attributeValueEditorMap.get( names[i]
                    .toLowerCase() ) );
            }
        }

        // check syntax preferences
        LdapSyntaxDescription lsd = atd.getSyntaxDescription();
        Map syntaxValueEditorMap = BrowserCommonActivator.getDefault().getValueEditorsPreferences().getSyntaxValueEditorMap();
        if ( lsd.getNumericOID() != null && syntaxValueEditorMap.containsKey( lsd.getNumericOID().toLowerCase() ) )
        {
            return ( IValueEditor ) this.class2ValueEditors.get( syntaxValueEditorMap.get( lsd.getNumericOID()
                .toLowerCase() ) );
View Full Code Here


     */
    public IValueEditor[] getAlternativeValueEditors( Schema schema, String attributeName )
    {
        List<IValueEditor> alternativeList = new ArrayList<IValueEditor>();

        AttributeTypeDescription atd = schema.getAttributeTypeDescription( attributeName );

        if ( atd.getSyntaxDescription().isBinary() )
        {
            alternativeList.add( this.defaultBinaryValueEditor );
            alternativeList.add( this.defaultStringSingleLineValueEditor );
            alternativeList.add( this.defaultStringMultiLineValueEditor );
        }
        else if ( atd.getSyntaxDescription().isString() )
        {
            alternativeList.add( this.defaultStringSingleLineValueEditor );
            alternativeList.add( this.defaultStringMultiLineValueEditor );
            alternativeList.add( this.defaultBinaryValueEditor );
        }
View Full Code Here

                {
                    if ( relation.getAttributeNumericOidOrType() != null )
                    {
                        if ( attributeTypes2AtdMap.containsKey( relation.getAttributeNumericOidOrType() ) )
                        {
                            AttributeTypeDescription atd = ( AttributeTypeDescription ) attributeTypes2AtdMap
                                .get( relation.getAttributeNumericOidOrType() );
                            String s = atd.getNumericOID();
                            for ( int i = 0; i < atd.getNames().length; i++ )
                            {
                                if ( !relation.getAttributeNumericOidOrType().equals( atd.getNames()[i] ) )
                                {
                                    s += ", " + atd.getNames()[i];
                                }
                            }
                            return s;
                        }
                        else if ( attributeOid2AtdMap.containsKey( relation.getAttributeNumericOidOrType() ) )
                        {
                            AttributeTypeDescription atd = ( AttributeTypeDescription ) attributeOid2AtdMap
                                .get( relation.getAttributeNumericOidOrType() );
                            return atd.toString();
                        }
                    }
                }
                else if ( index == 2 )
                {
View Full Code Here

                {
                    if ( attribute.getAttributeNumericOidOrName() != null )
                    {
                        if ( attributeNames2AtdMap.containsKey( attribute.getAttributeNumericOidOrName() ) )
                        {
                            AttributeTypeDescription atd = ( AttributeTypeDescription ) attributeNames2AtdMap
                                .get( attribute.getAttributeNumericOidOrName() );
                            String s = atd.getNumericOID();
                            for ( int i = 0; i < atd.getNames().length; i++ )
                            {
                                if ( !attribute.getAttributeNumericOidOrName().equals( atd.getNames()[i] ) )
                                {
                                    s += ", " + atd.getNames()[i];
                                }
                            }
                            return s;
                        }
                        else if ( attributeOid2AtdMap.containsKey( attribute.getAttributeNumericOidOrName() ) )
                        {
                            AttributeTypeDescription atd = ( AttributeTypeDescription ) attributeOid2AtdMap
                                .get( attribute.getAttributeNumericOidOrName() );
                            return atd.toString();
                        }
                    }
                }
            }
            return null;
View Full Code Here

                mustLinks = new Hyperlink[names.length];
                for ( int i = 0; i < names.length; i++ )
                {
                    if ( ocd.getSchema().hasAttributeTypeDescription( names[i] ) )
                    {
                        AttributeTypeDescription mustAtd = ocd.getSchema().getAttributeTypeDescription( names[i] );
                        mustLinks[i] = toolkit.createHyperlink( mustClient, mustAtd.toString(), SWT.WRAP );
                        mustLinks[i].setHref( mustAtd );
                        mustLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
                        mustLinks[i].setUnderlined( true );
                        mustLinks[i].setEnabled( true );
                        mustLinks[i].addHyperlinkListener( this );
View Full Code Here

                mayLinks = new Hyperlink[names.length];
                for ( int i = 0; i < names.length; i++ )
                {
                    if ( ocd.getSchema().hasAttributeTypeDescription( names[i] ) )
                    {
                        AttributeTypeDescription mayAtd = ocd.getSchema().getAttributeTypeDescription( names[i] );
                        mayLinks[i] = toolkit.createHyperlink( mayClient, mayAtd.toString(), SWT.WRAP );
                        mayLinks[i].setHref( mayAtd );
                        mayLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
                        mayLinks[i].setUnderlined( true );
                        mayLinks[i].setEnabled( true );
                        mayLinks[i].addHyperlinkListener( this );
View Full Code Here

         */
        public boolean select( Viewer viewer, Object parentElement, Object element )
        {
            if ( element instanceof AttributeTypeDescription )
            {
                AttributeTypeDescription atd = ( AttributeTypeDescription ) element;
                boolean matched = false;

                if ( !matched )
                    matched = atd.toString().toLowerCase().indexOf( filterText.getText().toLowerCase() ) != -1;
                if ( !matched )
                    matched = atd.getNumericOID().toLowerCase().indexOf( filterText.getText().toLowerCase() ) != -1;

                return matched;
            }
            return false;
        }
View Full Code Here

            attributeSizeText.setText( Utils.formatBytes( bytes ) );

            if ( attribute.getEntry().getConnection().getSchema().hasAttributeTypeDescription(
                attribute.getDescription() ) )
            {
                AttributeTypeDescription atd = attribute.getEntry().getConnection().getSchema()
                    .getAttributeTypeDescription( attribute.getDescription() );

                atdOidText.setText( atd.getNumericOID() );
                String atdNames = Arrays.asList( atd.getNames() ).toString();
                atdNamesText.setText( atdNames.substring( 1, atdNames.length() - 1 ) );
                atdDescText.setText( Utils.getNonNullString( atd.getDesc() ) );
                atdUsageText.setText( Utils.getNonNullString( atd.getUsage() ) );

                singleValuedFlag.setSelection( atd.isSingleValued() );
                noUserModificationFlag.setSelection( atd.isNoUserModification() );
                collectiveFlag.setSelection( atd.isCollective() );
                obsoleteFlag.setSelection( atd.isObsolete() );

                syntaxOidText.setText( Utils.getNonNullString( atd.getSyntaxDescriptionNumericOIDTransitive() ) );
                syntaxDescText.setText( Utils.getNonNullString( atd.getSyntaxDescription().getDesc() ) );
                syntaxLengthText.setText( Utils.getNonNullString( atd.getSyntaxDescriptionLengthTransitive() ) );

                equalityMatchingRuleText.setText( Utils.getNonNullString( atd
                    .getEqualityMatchingRuleDescriptionOIDTransitive() ) );
                substringMatchingRuleText.setText( Utils.getNonNullString( atd
                    .getSubstringMatchingRuleDescriptionOIDTransitive() ) );
                orderingMatchingRuleText.setText( Utils.getNonNullString( atd
                    .getOrderingMatchingRuleDescriptionOIDTransitive() ) );
            }
        }

        return parent;
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void setInput( Object input )
    {
        AttributeTypeDescription atd = null;
        if ( input instanceof AttributeTypeDescription )
        {
            atd = ( AttributeTypeDescription ) input;
        }

        // create main content
        createMainContent( atd );

        // set flags
        singleValuedText.setEnabled( atd != null && atd.isSingleValued() );
        isObsoleteText.setEnabled( atd != null && atd.isObsolete() );
        collectiveText.setEnabled( atd != null && atd.isCollective() );
        noUserModificationText.setEnabled( atd != null && atd.isNoUserModification() );
        flagSection.layout();

        // set syntax content
        String lsdOid = null;
        LdapSyntaxDescription lsd = null;
        String lsdLength = null;
        if ( atd != null )
        {
            lsdOid = atd.getSyntaxDescriptionNumericOIDTransitive();
            if ( lsdOid != null && atd.getSchema().hasLdapSyntaxDescription( lsdOid ) )
            {
                lsd = atd.getSchema().getLdapSyntaxDescription( lsdOid );
            }
            lsdLength = atd.getSyntaxDescriptionLengthTransitive();
        }
        syntaxLink.setText( getNonNullString( lsd != null ? lsd.getNumericOID() : lsdOid ) );
        syntaxLink.setHref( lsd );
        syntaxLink.setUnderlined( lsd != null );
        syntaxLink.setEnabled( lsd != null );
        syntaxDescText.setText( getNonNullString( lsd != null ? lsd.getDesc() : null ) );
        lengthText.setText( getNonNullString( lsdLength ) );
        syntaxSection.layout();

        // set matching rules content
        String emrOid = null;
        MatchingRuleDescription emr = null;
        if ( atd != null )
        {
            emrOid = atd.getEqualityMatchingRuleDescriptionOIDTransitive();
            if ( emrOid != null && atd.getSchema().hasMatchingRuleDescription( emrOid ) )
            {
                emr = atd.getSchema().getMatchingRuleDescription( emrOid );
            }
        }
        equalityLink.setText( getNonNullString( emr != null ? emr.toString() : emrOid ) );
        equalityLink.setHref( emr );
        equalityLink.setUnderlined( emr != null );
        equalityLink.setEnabled( emr != null );

        String smrOid = null;
        MatchingRuleDescription smr = null;
        if ( atd != null )
        {
            smrOid = atd.getSubstringMatchingRuleDescriptionOIDTransitive();
            if ( smrOid != null && atd.getSchema().hasMatchingRuleDescription( smrOid ) )
            {
                smr = atd.getSchema().getMatchingRuleDescription( smrOid );
            }
        }
        substringLink.setText( getNonNullString( smr != null ? smr.toString() : smrOid ) );
        substringLink.setHref( smr );
        substringLink.setUnderlined( smr != null );
        substringLink.setEnabled( smr != null );

        String omrOid = null;
        MatchingRuleDescription omr = null;
        if ( atd != null )
        {
            omrOid = atd.getOrderingMatchingRuleDescriptionOIDTransitive();
            if ( omrOid != null && atd.getSchema().hasMatchingRuleDescription( omrOid ) )
            {
                omr = atd.getSchema().getMatchingRuleDescription( omrOid );
            }
        }
        orderingLink.setText( getNonNullString( omr != null ? omr.toString() : omrOid ) );
        orderingLink.setHref( omr );
        orderingLink.setUnderlined( omr != null );
View Full Code Here

            if ( superName != null )
            {
                supertypeSection.setText( "Supertype (" + "1" + ")" );
                if ( atd.getSchema().hasAttributeTypeDescription( superName ) )
                {
                    AttributeTypeDescription supAtd = atd.getSchema().getAttributeTypeDescription( superName );
                    superLink = toolkit.createHyperlink( superClient, supAtd.toString(), SWT.WRAP );
                    superLink.setHref( supAtd );
                    superLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
                    superLink.setUnderlined( true );
                    superLink.setEnabled( true );
                    superLink.addHyperlinkListener( this );
View Full Code Here

TOP

Related Classes of org.apache.directory.ldapstudio.browser.core.model.schema.AttributeTypeDescription

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.