directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1691689 - in /directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor: databases/ dialogs/ wrappers/
Date Sat, 18 Jul 2015 06:11:57 GMT
Author: elecharny
Date: Sat Jul 18 06:11:56 2015
New Revision: 1691689

URL: http://svn.apache.org/r1691689
Log:
o Removed the OrderedSize/TimeWrapper : those elements are not ordered !
o Made the LimitsWrapper class implement Ordered 
o Removed useless import
o Updated the LimitsWrapper with the size/time values
o Saved the olcLimits content in the database config

Removed:
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/OrderedSizeLimitWrapper.java
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/OrderedTimeLimitWrapper.java
Modified:
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/DatabasesDetailsPage.java
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/LimitsDialog.java
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/SizeTimeLimitDialog.java
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/LimitDecorator.java
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/LimitsWrapper.java

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/DatabasesDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/DatabasesDetailsPage.java?rev=1691689&r1=1691688&r2=1691689&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/DatabasesDetailsPage.java
(original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/DatabasesDetailsPage.java
Sat Jul 18 06:11:56 2015
@@ -47,6 +47,7 @@ import org.apache.directory.studio.openl
 import org.apache.directory.studio.openldap.config.editor.wrappers.DnWrapper;
 import org.apache.directory.studio.openldap.config.editor.wrappers.LimitsDecorator;
 import org.apache.directory.studio.openldap.config.editor.wrappers.LimitsWrapper;
+import org.apache.directory.studio.openldap.config.editor.wrappers.OrderedStringValueWrapper;
 import org.apache.directory.studio.openldap.config.model.OlcOverlayConfig;
 import org.apache.directory.studio.openldap.config.model.database.OlcBdbConfig;
 import org.apache.directory.studio.openldap.config.model.database.OlcDatabaseConfig;
@@ -994,7 +995,7 @@ public class DatabasesDetailsPage implem
 
         limitsTableWidget.createOrderedWidgetWithEdit( composite, toolkit );
         limitsTableWidget.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE, true,
false, 5, 1 ) );
-        //addModifyListener( limitsTableWidget, limitsListener );
+        addModifyListener( limitsTableWidget, limitsListener );
     }
 
 
@@ -2085,6 +2086,27 @@ public class DatabasesDetailsPage implem
             widget.addWidgetModifyListener( listener );
         }
     }
+    
+    
+    /**
+     * The olcLimits listener
+     */
+    private WidgetModifyListener limitsListener = new WidgetModifyListener()
+    {
+        public void widgetModified( WidgetModifyEvent e )
+        {
+            List<String> limits = new ArrayList<String>();
+            
+            for ( LimitsWrapper limitWrapper : limitsTableWidget.getElements() )
+            {
+                limits.add( limitWrapper.toString() );
+            }
+            
+            OlcDatabaseConfig databaseConfig = databaseWrapper.getDatabase();
+
+            databaseConfig.setOlcLimits( limits );
+        }
+    };
 
 
     /**

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/LimitsDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/LimitsDialog.java?rev=1691689&r1=1691688&r2=1691689&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/LimitsDialog.java
(original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/LimitsDialog.java
Sat Jul 18 06:11:56 2015
@@ -20,9 +20,14 @@
 package org.apache.directory.studio.openldap.config.editor.dialogs;
 
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.directory.studio.common.ui.AddEditDialog;
 import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
 import org.apache.directory.studio.common.ui.widgets.TableWidget;
+import org.apache.directory.studio.common.ui.widgets.WidgetModifyEvent;
+import org.apache.directory.studio.common.ui.widgets.WidgetModifyListener;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
@@ -45,6 +50,7 @@ import org.apache.directory.studio.openl
 import org.apache.directory.studio.openldap.config.editor.wrappers.LimitDecorator;
 import org.apache.directory.studio.openldap.config.editor.wrappers.LimitWrapper;
 import org.apache.directory.studio.openldap.config.editor.wrappers.LimitsWrapper;
+import org.apache.directory.studio.openldap.config.model.database.OlcDatabaseConfig;
 
 
 /**
@@ -307,6 +313,20 @@ public class LimitsDialog extends AddEdi
             limitsText.setText( getEditedElement().toString() );
         }
     };
+    
+    
+    /**
+     * The olcLimits listener
+     */
+    private WidgetModifyListener limitsTableWidgetListener = new WidgetModifyListener()
+    {
+        public void widgetModified( WidgetModifyEvent e )
+        {
+            getEditedElement().setLimits( limitsTableWidget.getElements() );
+            limitsText.setText( getEditedElement().toString() );
+        }
+    };
+    
 
     /**
      * Create a new instance of the LimitsDialog
@@ -522,9 +542,9 @@ public class LimitsDialog extends AddEdi
         limitsTableWidget = new TableWidget<LimitWrapper>( 
             new LimitDecorator( parent.getShell() , "Limit") );
 
-        limitsTableWidget.createOrderedWidgetWithEdit( selectorGroup, null );
+        limitsTableWidget.createWidgetWithEdit( selectorGroup, null );
         limitsTableWidget.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE, true,
false, 2, 1 ) );
-        //addModifyListener( authIdRewriteTableWidget, authIdRewriteListener );
+        limitsTableWidget.addWidgetModifyListener( limitsTableWidgetListener );
     }
 
 

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/SizeTimeLimitDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/SizeTimeLimitDialog.java?rev=1691689&r1=1691688&r2=1691689&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/SizeTimeLimitDialog.java
(original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/SizeTimeLimitDialog.java
Sat Jul 18 06:11:56 2015
@@ -39,8 +39,8 @@ import org.eclipse.swt.widgets.Group;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
 import org.apache.directory.studio.openldap.config.editor.wrappers.LimitWrapper;
-import org.apache.directory.studio.openldap.config.editor.wrappers.OrderedSizeLimitWrapper;
-import org.apache.directory.studio.openldap.config.editor.wrappers.OrderedTimeLimitWrapper;
+import org.apache.directory.studio.openldap.config.editor.wrappers.SizeLimitWrapper;
+import org.apache.directory.studio.openldap.config.editor.wrappers.TimeLimitWrapper;
 
 
 /**
@@ -146,7 +146,7 @@ public class SizeTimeLimitDialog extends
                 {
                     if ( button.getSelection() )
                     {
-                        setEditedElement( new OrderedSizeLimitWrapper( "" ) );
+                        setEditedElement( new SizeLimitWrapper( "" ) );
 
                         // Enable the SizeLimit elements, disable the TimeLimit ones
                         sizeLimitEditButton.setEnabled( true );
@@ -158,7 +158,7 @@ public class SizeTimeLimitDialog extends
                 }
                 else
                 {
-                    setEditedElement( new OrderedTimeLimitWrapper( "" ) );
+                    setEditedElement( new TimeLimitWrapper( "" ) );
                     
                     // Enable the TimeLimit elements, disable the SizeLimit ones
                     timeLimitEditButton.setEnabled( true );
@@ -231,7 +231,7 @@ public class SizeTimeLimitDialog extends
             // The String must be a valid SizeLimit
             String sizeLimitStr = sizeLimitText.getText();
             
-            OrderedSizeLimitWrapper sizeLimitWrapper = new OrderedSizeLimitWrapper( sizeLimitStr
);
+            SizeLimitWrapper sizeLimitWrapper = new SizeLimitWrapper( sizeLimitStr );
             
             if ( sizeLimitWrapper.isValid() )
             {
@@ -263,7 +263,7 @@ public class SizeTimeLimitDialog extends
             // The String must be a valid TimeLimit
             String timeLimitStr = timeLimitText.getText();
             
-            OrderedTimeLimitWrapper timeLimitWrapper = new OrderedTimeLimitWrapper( timeLimitStr
);
+            TimeLimitWrapper timeLimitWrapper = new TimeLimitWrapper( timeLimitStr );
             
             if ( timeLimitWrapper.isValid() )
             {
@@ -404,7 +404,7 @@ public class SizeTimeLimitDialog extends
         
         if ( editedElement != null )
         {
-            if ( editedElement instanceof OrderedSizeLimitWrapper )
+            if ( editedElement instanceof SizeLimitWrapper )
             {
                 sizeLimitButton.setSelection( true );
                 

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/LimitDecorator.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/LimitDecorator.java?rev=1691689&r1=1691688&r2=1691689&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/LimitDecorator.java
(original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/LimitDecorator.java
Sat Jul 18 06:11:56 2015
@@ -20,7 +20,6 @@
 package org.apache.directory.studio.openldap.config.editor.wrappers;
 
 import org.apache.directory.studio.common.ui.TableDecorator;
-import org.apache.directory.studio.openldap.config.editor.dialogs.LimitsDialog;
 import org.apache.directory.studio.openldap.config.editor.dialogs.SizeTimeLimitDialog;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.widgets.Shell;

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/LimitsWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/LimitsWrapper.java?rev=1691689&r1=1691688&r2=1691689&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/LimitsWrapper.java
(original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/LimitsWrapper.java
Sat Jul 18 06:11:56 2015
@@ -23,6 +23,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.directory.api.util.Strings;
+import org.apache.directory.studio.common.ui.widgets.OrderedElement;
 import org.apache.directory.studio.openldap.common.ui.model.DnSpecStyleEnum;
 import org.apache.directory.studio.openldap.common.ui.model.DnSpecTypeEnum;
 import org.apache.directory.studio.openldap.common.ui.model.LimitSelectorEnum;
@@ -50,7 +51,7 @@ import org.apache.directory.studio.openl
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class LimitsWrapper implements Cloneable, Comparable<LimitsWrapper>
+public class LimitsWrapper implements Cloneable, Comparable<LimitsWrapper>, OrderedElement
 {
     /** Prefix, as the Limits are ordered */
     private int prefix;
@@ -455,7 +456,7 @@ public class LimitsWrapper implements Cl
                 return ERROR;
             }
             
-            OrderedTimeLimitWrapper timeLimitWrapper = new OrderedTimeLimitWrapper( limitStr.substring(
0, i ) );
+            TimeLimitWrapper timeLimitWrapper = new TimeLimitWrapper( limitStr.substring(
0, i ) );
             
             if ( timeLimitWrapper.isValid() )
             {
@@ -483,7 +484,7 @@ public class LimitsWrapper implements Cl
                 return ERROR;
             }
             
-            OrderedSizeLimitWrapper sizeLimitWrapper = new OrderedSizeLimitWrapper( limitStr.substring(
0, i ) );
+            SizeLimitWrapper sizeLimitWrapper = new SizeLimitWrapper( limitStr.substring(
0, i ) );
             
             if ( sizeLimitWrapper.isValid() )
             {



Mime
View raw message