directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1686690 - in /directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor: pages/ wrappers/
Date Sun, 21 Jun 2015 07:48:47 GMT
Author: elecharny
Date: Sun Jun 21 07:48:46 2015
New Revision: 1686690

URL: http://svn.apache.org/r1686690
Log:
Added the support of the olcDisallows parameter

Added:
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/DisallowFeatureDecorator.java
Modified:
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages.properties
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_de.properties
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_fr.properties

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java?rev=1686690&r1=1686689&r2=1686690&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java
(original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java
Sun Jun 21 07:48:46 2015
@@ -34,6 +34,7 @@ import org.apache.directory.studio.openl
 import org.apache.directory.studio.openldap.config.editor.wrappers.AllowFeatureDecorator;
 import org.apache.directory.studio.openldap.config.editor.wrappers.AuthIdRewriteWrapper;
 import org.apache.directory.studio.openldap.config.editor.wrappers.AuthzRegexpWrapper;
+import org.apache.directory.studio.openldap.config.editor.wrappers.DisallowFeatureDecorator;
 import org.apache.directory.studio.openldap.config.model.OlcGlobal;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridData;
@@ -186,7 +187,7 @@ public class OptionsPage extends OpenLDA
     
     
     /**
-     * The olcAllowFeature listener
+     * The olcAllows listener
      */
     private WidgetModifyListener allowFeatureListener = new WidgetModifyListener()
     {
@@ -202,6 +203,25 @@ public class OptionsPage extends OpenLDA
             getConfiguration().getGlobal().setOlcAllows( allowFeatures );
         }
     };
+    
+    
+    /**
+     * The olcDisallows listener
+     */
+    private WidgetModifyListener disallowFeatureListener = new WidgetModifyListener()
+    {
+        public void widgetModified( WidgetModifyEvent e )
+        {
+            List<String> disallowFeatures = new ArrayList<String>();
+            
+            for ( DisallowFeatureEnum disallowFeature : disallowFeatureTableWidget.getElements()
)
+            {
+                disallowFeatures.add( disallowFeature.getName() );
+            }
+            
+            getConfiguration().getGlobal().setOlcDisallows( disallowFeatures );
+        }
+    };
 
     /**
      * Creates a new instance of OptionsPage.
@@ -250,19 +270,34 @@ public class OptionsPage extends OpenLDA
     private void createFeaturesAndOperationsSection( FormToolkit toolkit, Composite parent
)
     {
         // The Features & Operations section, which can be expanded or compacted
-        Section section = createSection( toolkit, parent, Messages.getString( "OptionsPage.FeaturesAndOperationsSection"
) );
-        Composite composite = createSectionComposite( toolkit, section, 2, false );
+        Section section = createSection( toolkit, parent, 
+            Messages.getString( "OpenLDAPOptionsPage.FeaturesAndOperationsSection" ) );
+        Composite composite = createSectionComposite( toolkit, section, 4, false );
+
+        // The olcAllows parameter label
+        Label allowFeatureLabel = toolkit.createLabel( composite, 
+            Messages.getString( "OpenLDAPOptionsPage.AllowFeature" ) ); //$NON-NLS-1$
+        allowFeatureLabel.setLayoutData( new GridData( SWT.FILL, SWT.FILL, false, false,
2, 1 ) );
+
+        // The olcDisallows parameter label
+        Label disallowFeatureLabel = toolkit.createLabel( composite,
+            Messages.getString( "OpenLDAPOptionsPage.DisallowFeature" ) ); //$NON-NLS-1$
+        disallowFeatureLabel.setLayoutData( new GridData( SWT.FILL, SWT.FILL, false, false,
2, 1 ) );
 
-        // The olcAllowFeature parameter
-        Label passwordHashLabel = toolkit.createLabel( composite, Messages.getString( "OptionsPage.AllowFeature"
) ); //$NON-NLS-1$
-        passwordHashLabel.setLayoutData( new GridData( SWT.FILL, SWT.FILL, false, false,
2, 1 ) );
-        
+        // The olcAllows parameter table
         allowFeatureTableWidget = new TableWidget<AllowFeatureEnum>( new AllowFeatureDecorator(
composite.getShell() ) );
 
         allowFeatureTableWidget.createWidgetNoEdit( composite, toolkit );
-        allowFeatureTableWidget.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE,
true, false, 4, 1 ) );
+        allowFeatureTableWidget.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE,
true, false, 2, 1 ) );
         addModifyListener( allowFeatureTableWidget, allowFeatureListener );
 
+        // The olcDisallows parameter table
+        disallowFeatureTableWidget = new TableWidget<DisallowFeatureEnum>( new DisallowFeatureDecorator(
composite.getShell() ) );
+
+        disallowFeatureTableWidget.createWidgetNoEdit( composite, toolkit );
+        disallowFeatureTableWidget.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE,
true, false, 2, 1 ) );
+        addModifyListener( disallowFeatureTableWidget, disallowFeatureListener );
+
         // Plugin Log File Text
         toolkit.createLabel( composite, "Plugin Log File:" );
         pluginLogFileText = toolkit.createText( composite, "" );
@@ -306,6 +341,7 @@ public class OptionsPage extends OpenLDA
     private void addListeners()
     {
         addDirtyListener( allowFeatureTableWidget );
+        addDirtyListener( disallowFeatureTableWidget );
     }
 
     
@@ -315,6 +351,7 @@ public class OptionsPage extends OpenLDA
     private void removeListeners()
     {
         removeDirtyListener( allowFeatureTableWidget );
+        removeDirtyListener( disallowFeatureTableWidget );
     }
     
 
@@ -353,6 +390,25 @@ public class OptionsPage extends OpenLDA
                 allowFeatureTableWidget.setElements( new ArrayList<AllowFeatureEnum>()
);
             }
 
+            // Disallow Feature Table Widget
+            List<String> disallowedFeatures = global.getOlcDisallows();
+
+            if ( disallowedFeatures != null )
+            {
+                List<DisallowFeatureEnum> disalloweds = new ArrayList<DisallowFeatureEnum>();
+                
+                for ( String disallowedFeature : disallowedFeatures )
+                {
+                    disalloweds.add( DisallowFeatureEnum.getFeature( disallowedFeature )
);
+                }
+                
+                disallowFeatureTableWidget.setElements( disalloweds );
+            }
+            else
+            {
+                disallowFeatureTableWidget.setElements( new ArrayList<DisallowFeatureEnum>()
);
+            }
+
             addListeners();
         }
     }

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages.properties?rev=1686690&r1=1686689&r2=1686690&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages.properties
(original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages.properties
Sun Jun 21 07:48:46 2015
@@ -143,7 +143,9 @@ OpenLDAPSecurityPage.EditLogLevels=Edit
 #---------------------------------------------------------------------------------------
 OpenLDAPOptionsPage.Title=Options
 
-OptionsPage.FeaturesAndOperationsSection=Features & Operations
+OpenLDAPOptionsPage.FeaturesAndOperationsSection=Features & Operations
+OpenLDAPOptionsPage.AllowFeature=Allowed :
+OpenLDAPOptionsPage.DisallowFeature=Disallowed :
 
 
 #---------------------------------------------------------------------------------------

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_de.properties?rev=1686690&r1=1686689&r2=1686690&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_de.properties
(original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_de.properties
Sun Jun 21 07:48:46 2015
@@ -143,7 +143,9 @@ OpenLDAPSecurityPage.EditLogLevels=Edit
 #---------------------------------------------------------------------------------------
 OpenLDAPOptionsPage.Title=Options
 
-OptionsPage.FeaturesAndOperationsSection=Features & Operations
+OpenLDAPOptionsPage.FeaturesAndOperationsSection=Features & Operations
+OpenLDAPOptionsPage.AllowFeature=Allowed :
+OpenLDAPOptionsPage.DisallowFeature=Disallowed :
 
 #---------------------------------------------------------------------------------------
 # The Database page

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_fr.properties?rev=1686690&r1=1686689&r2=1686690&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_fr.properties
(original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_fr.properties
Sun Jun 21 07:48:46 2015
@@ -143,7 +143,9 @@ OpenLDAPSecurityPage.EditLogLevels=Editi
 #---------------------------------------------------------------------------------------
 OpenLDAPOptionsPage.Title=Options
 
-OptionsPage.FeaturesAndOperationsSection=Fonctions & Operations
+OpenLDAPOptionsPage.FeaturesAndOperationsSection=Fonctions & Operations
+OpenLDAPOptionsPage.AllowFeature=Autoris\u0E9 :
+OpenLDAPOptionsPage.DisallowFeature=D\u0E9sactif :
 
 #---------------------------------------------------------------------------------------
 # The Database page

Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/DisallowFeatureDecorator.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/DisallowFeatureDecorator.java?rev=1686690&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/DisallowFeatureDecorator.java
(added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/DisallowFeatureDecorator.java
Sun Jun 21 07:48:46 2015
@@ -0,0 +1,99 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.openldap.config.editor.wrappers;
+
+import org.apache.directory.studio.common.ui.TableDecorator;
+import org.apache.directory.studio.openldap.common.ui.model.DisallowFeatureEnum;
+import org.apache.directory.studio.openldap.config.editor.dialogs.DisallowFeatureDialog;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * A decorator for the DisallowFeature table.
+ *  
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class DisallowFeatureDecorator extends TableDecorator<DisallowFeatureEnum>
+{
+    /**
+     * Create a new instance of DisallowFeatureDecorator
+     * @param parentShell The parent Shell
+     */
+    public DisallowFeatureDecorator( Shell parentShell )
+    {
+        setDialog( new DisallowFeatureDialog( parentShell ) );
+    }
+
+    /**
+     * Construct the label for an DisallowFeature.
+     * 
+     */
+    public String getText( Object element )
+    {
+        if ( element instanceof DisallowFeatureEnum )
+        {
+            String disallowFeature = ( ( DisallowFeatureEnum ) element ).toString();
+
+            return disallowFeature;
+        }
+
+        return super.getText( element );
+    };
+
+
+    /**
+     * Get the image. We have none
+     */
+    public Image getImage( Object element )
+    {
+        return null;
+    };
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int compare( DisallowFeatureEnum e1, DisallowFeatureEnum e2 )
+    {
+        if ( e1 != null )
+        {
+            if ( e2 == null )
+            {
+                return 1;
+            }
+            else
+            {
+                return e1.getName().compareTo( e2.getName() );
+            }
+        }
+        else
+        {
+            if ( e2 == null )
+            {
+                return 0;
+            }
+            else
+            {
+                return 1;
+            }
+        }
+    }
+}



Mime
View raw message