directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r822686 - in /directory/studio/trunk: aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/model/ aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/ ldapbrowser-common/src/main/java/org/apac...
Date Wed, 07 Oct 2009 12:13:19 GMT
Author: seelmann
Date: Wed Oct  7 12:13:19 2009
New Revision: 822686

URL: http://svn.apache.org/viewvc?rev=822686&view=rev
Log:
Fix for DIRSTUDIO-549 (subtree userClass editor does not keep full DN for base component upon
its selection)
o Added useLocalName flag

Modified:
    directory/studio/trunk/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/model/UserClassWrapperFactory.java
    directory/studio/trunk/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/ExclusionDialog.java
    directory/studio/trunk/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeSpecificationDialog.java
    directory/studio/trunk/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeValueEditor.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java

Modified: directory/studio/trunk/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/model/UserClassWrapperFactory.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/model/UserClassWrapperFactory.java?rev=822686&r1=822685&r2=822686&view=diff
==============================================================================
--- directory/studio/trunk/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/model/UserClassWrapperFactory.java
(original)
+++ directory/studio/trunk/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/model/UserClassWrapperFactory.java
Wed Oct  7 12:13:19 2009
@@ -72,7 +72,7 @@
                 // subtree
                 new UserClassWrapper( UserClass.Subtree.class, "", //$NON-NLS-1$
                     "", //$NON-NLS-1$
-                    new SubtreeValueEditor( false )
+                    new SubtreeValueEditor( false, false )
                 ) };
 
         return userClassWrappers;

Modified: directory/studio/trunk/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/ExclusionDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/ExclusionDialog.java?rev=822686&r1=822685&r2=822686&view=diff
==============================================================================
--- directory/studio/trunk/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/ExclusionDialog.java
(original)
+++ directory/studio/trunk/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/ExclusionDialog.java
Wed Oct  7 12:13:19 2009
@@ -170,12 +170,12 @@
         typeCombo.setLayoutData( gridData );
 
         BaseWidgetUtils.createLabel( composite, Messages.getString( "ExclusionValueEditor.label.rdn"
), 1 ); //$NON-NLS-1$
-        entryWidget = new EntryWidget( connection, null, base );
+        entryWidget = new EntryWidget( connection, null, base, true );
         entryWidget.createWidget( composite );
         try
         {
             LdapDN dn = new LdapDN( initalDN );
-            entryWidget.setInput( connection, dn, base );
+            entryWidget.setInput( connection, dn, base, true );
         }
         catch ( InvalidNameException e )
         {

Modified: directory/studio/trunk/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeSpecificationDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeSpecificationDialog.java?rev=822686&r1=822685&r2=822686&view=diff
==============================================================================
--- directory/studio/trunk/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeSpecificationDialog.java
(original)
+++ directory/studio/trunk/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeSpecificationDialog.java
Wed Oct  7 12:13:19 2009
@@ -31,8 +31,8 @@
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecificationParser;
 import org.apache.directory.studio.aciitemeditor.Activator;
 import org.apache.directory.studio.connection.core.DnUtils;
-import org.apache.directory.studio.ldapbrowser.common.dialogs.TextDialog;
 import org.apache.directory.studio.connection.ui.widgets.BaseWidgetUtils;
+import org.apache.directory.studio.ldapbrowser.common.dialogs.TextDialog;
 import org.apache.directory.studio.ldapbrowser.common.widgets.WidgetModifyEvent;
 import org.apache.directory.studio.ldapbrowser.common.widgets.WidgetModifyListener;
 import org.apache.directory.studio.ldapbrowser.common.widgets.search.EntryWidget;
@@ -84,6 +84,9 @@
     /** Flag indicating if the refinement or filter widget should be visible */
     private boolean refinementOrFilterVisible;
 
+    /** Flag indicating if a local name should be used for the base */
+    private boolean useLocalName;
+
     /** The initial SubtreeSpecification */
     private SubtreeSpecification subtreeSpecification;
 
@@ -120,14 +123,17 @@
      *      the initial SubtreeSpecification
      * @param refinementOrFilterVisible
      *      true if the refinement of filter widget should be visible
+     * @param useLocalName 
+     *      true to use local name for the base
      */
     SubtreeSpecificationDialog( Shell shell, IBrowserConnection connection, LdapDN subentryDN,
-        String initialSubtreeSpecification, boolean refinementOrFilterVisible )
+        String initialSubtreeSpecification, boolean refinementOrFilterVisible, boolean useLocalName
)
     {
         super( shell );
         this.connection = connection;
         this.subentryDN = subentryDN;
         this.refinementOrFilterVisible = refinementOrFilterVisible;
+        this.useLocalName = useLocalName;
 
         // parse
         try
@@ -146,17 +152,15 @@
         }
 
         exclusions = new ArrayList<String>();
-        Set chopBeforeExclusions = subtreeSpecification.getChopBeforeExclusions();
-        for ( Object chopBeforeExclusion : chopBeforeExclusions )
+        Set<LdapDN> chopBeforeExclusions = subtreeSpecification.getChopBeforeExclusions();
+        for ( LdapDN dn : chopBeforeExclusions )
         {
-            LdapDN dn = ( LdapDN ) chopBeforeExclusion;
             exclusions.add( "chopBefore: \"" + dn.toNormName() + "\"" ); //$NON-NLS-1$ //$NON-NLS-2$
         }
 
-        Set chopAfterExclusions = subtreeSpecification.getChopAfterExclusions();
-        for ( Object chopAfterExclusion : chopAfterExclusions )
+        Set<LdapDN> chopAfterExclusions = subtreeSpecification.getChopAfterExclusions();
+        for ( LdapDN dn : chopAfterExclusions )
         {
-            LdapDN dn = ( LdapDN ) chopAfterExclusion;
             exclusions.add( "chopAfter: \"" + dn.toNormName() + "\"" ); //$NON-NLS-1$ //$NON-NLS-2$
         }
 
@@ -213,7 +217,7 @@
 
         LdapDN base = subtreeSpecification.getBase();
         LdapDN suffix = subentryDN != null ? DnUtils.getParent( subentryDN ) : null;
-        entryWidget = new EntryWidget( connection, base, suffix );
+        entryWidget = new EntryWidget( connection, base, suffix, useLocalName );
         entryWidget.createWidget( composite );
         entryWidget.addWidgetModifyListener( new WidgetModifyListener()
         {
@@ -648,7 +652,7 @@
     private void addValueExclusionsTable()
     {
         LdapDN chopBase = subtreeSpecification.getBase();
-        if ( subentryDN != null && DnUtils.getParent( subentryDN ) != null )
+        if ( useLocalName && subentryDN != null && DnUtils.getParent( subentryDN
) != null )
         {
             LdapDN suffix = subentryDN != null ? DnUtils.getParent( subentryDN ) : null;
             chopBase = DnUtils.composeDn( chopBase, suffix );
@@ -675,7 +679,7 @@
         if ( oldValue != null )
         {
             LdapDN chopBase = subtreeSpecification.getBase();
-            if ( subentryDN != null && DnUtils.getParent( subentryDN ) != null )
+            if ( useLocalName && subentryDN != null && DnUtils.getParent(
subentryDN ) != null )
             {
                 LdapDN suffix = subentryDN != null ? DnUtils.getParent( subentryDN ) : null;
                 chopBase = DnUtils.composeDn( chopBase, suffix );

Modified: directory/studio/trunk/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeValueEditor.java?rev=822686&r1=822685&r2=822686&view=diff
==============================================================================
--- directory/studio/trunk/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeValueEditor.java
(original)
+++ directory/studio/trunk/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeValueEditor.java
Wed Oct  7 12:13:19 2009
@@ -41,6 +41,8 @@
     static final String EMPTY = ""; //$NON-NLS-1$
 
     private boolean refinementOrFilterVisible;
+    
+    private boolean useLocalName;
 
 
     /**
@@ -49,6 +51,7 @@
     public SubtreeValueEditor()
     {
         this.refinementOrFilterVisible = true;
+        this.useLocalName = true;
     }
 
 
@@ -56,10 +59,12 @@
      * Default constructor, used by the {@link ValueEditorManager}.
      *
      * @param refinementOrFilterVisible true if the refinement or filter widget should be
visible
+     * @param useLocalName true to use local name for the base
      */
-    public SubtreeValueEditor( boolean refinementOrFilterVisible )
+    public SubtreeValueEditor( boolean refinementOrFilterVisible, boolean useLocalName )
     {
         this.refinementOrFilterVisible = refinementOrFilterVisible;
+        this.useLocalName = useLocalName;
     }
 
 
@@ -74,7 +79,7 @@
             SubtreeSpecificationValueWrapper wrapper = ( SubtreeSpecificationValueWrapper
) value;
 
             SubtreeSpecificationDialog dialog = new SubtreeSpecificationDialog( shell, wrapper.connection,
-                wrapper.subentryDN, wrapper.subtreeSpecification, refinementOrFilterVisible
);
+                wrapper.subentryDN, wrapper.subtreeSpecification, refinementOrFilterVisible,
useLocalName );
             if ( dialog.open() == TextDialog.OK && dialog.getSubtreeSpecificationValue()
!= null )
             {
                 setValue( dialog.getSubtreeSpecificationValue() );

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java?rev=822686&r1=822685&r2=822686&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java
Wed Oct  7 12:13:19 2009
@@ -80,6 +80,9 @@
     /** The suffix. */
     private LdapDN suffix;
 
+    /** Flag indicating if using local name for the dn */
+    boolean useLocalName;
+
 
     /**
      * Creates a new instance of EntryWidget.
@@ -99,7 +102,7 @@
      */
     public EntryWidget( IBrowserConnection browserConnection, LdapDN dn )
     {
-        this( browserConnection, dn, null );
+        this( browserConnection, dn, null, false );
     }
 
 
@@ -109,12 +112,14 @@
      * @param browserConnection the connection
      * @param dn the initial DN
      * @param suffix the suffix
+     * @param useLocalName true to use local name for the DN
      */
-    public EntryWidget( IBrowserConnection browserConnection, LdapDN dn, LdapDN suffix )
+    public EntryWidget( IBrowserConnection browserConnection, LdapDN dn, LdapDN suffix, boolean
useLocalName )
     {
         this.browserConnection = browserConnection;
         this.dn = dn;
         this.suffix = suffix;
+        this.useLocalName = useLocalName;
     }
 
 
@@ -197,7 +202,7 @@
 
                     // calculate initial DN
                     LdapDN initialDN = dn;
-                    if( suffix != null && suffix.size() > 0 )
+                    if( useLocalName && suffix != null && suffix.size() >
0 )
                     {
                         if( initialDN != null && initialDN.size() > 0 )
                         {
@@ -227,7 +232,7 @@
                     if ( selectedEntry != null )
                     {
                         dn = selectedEntry.getDn();
-                        if( suffix != null && suffix.size() > 0 )
+                        if( useLocalName && suffix != null && suffix.size()
> 0 )
                         {
                             dn = DnUtils.getPrefixName( dn, suffix );
                         }
@@ -334,7 +339,7 @@
      */
     public void setInput( IBrowserConnection browserConnection, LdapDN dn )
     {
-        setInput( browserConnection, dn, null );
+        setInput( browserConnection, dn, null, false );
     }
 
 
@@ -344,14 +349,16 @@
      * @param browserConnection the connection
      * @param dn the DN
      * @param suffix the suffix
+     * @param useLocalName true to use local name for the DN
      */
-    public void setInput( IBrowserConnection browserConnection, LdapDN dn, LdapDN suffix
)
+    public void setInput( IBrowserConnection browserConnection, LdapDN dn, LdapDN suffix,
boolean useLocalName )
     {
         if ( this.browserConnection != browserConnection || this.dn != dn || this.suffix
!= suffix )
         {
             this.browserConnection = browserConnection;
             this.dn = dn;
             this.suffix = suffix;
+            this.useLocalName = useLocalName;
             dnChanged();
         }
     }



Mime
View raw message