directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1478356 - in /directory/studio/trunk/plugins/apacheds.configuration.v2: resources/icons/ src/main/java/org/apache/directory/studio/apacheds/configuration/v2/ src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/
Date Thu, 02 May 2013 13:00:38 GMT
Author: pamarcelot
Date: Thu May  2 13:00:38 2013
New Revision: 1478356

URL: http://svn.apache.org/r1478356
Log:
Added implementation for the Password Policy details page.

Added:
    directory/studio/trunk/plugins/apacheds.configuration.v2/resources/icons/password_policy.gif   (with props)
    directory/studio/trunk/plugins/apacheds.configuration.v2/resources/icons/password_policy_default.gif   (with props)
Modified:
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/ApacheDS2ConfigurationPluginConstants.java
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PasswordPoliciesMasterDetailsBlock.java
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PasswordPoliciesPage.java
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PasswordPolicyDetailsPage.java
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ReplicationDetailsPage.java
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditorUtils.java

Added: directory/studio/trunk/plugins/apacheds.configuration.v2/resources/icons/password_policy.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/resources/icons/password_policy.gif?rev=1478356&view=auto
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/plugins/apacheds.configuration.v2/resources/icons/password_policy.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/studio/trunk/plugins/apacheds.configuration.v2/resources/icons/password_policy_default.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/resources/icons/password_policy_default.gif?rev=1478356&view=auto
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/plugins/apacheds.configuration.v2/resources/icons/password_policy_default.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/ApacheDS2ConfigurationPluginConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/ApacheDS2ConfigurationPluginConstants.java?rev=1478356&r1=1478355&r2=1478356&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/ApacheDS2ConfigurationPluginConstants.java (original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/ApacheDS2ConfigurationPluginConstants.java Thu May  2 13:00:38 2013
@@ -44,8 +44,8 @@ public interface ApacheDS2ConfigurationP
     public static final String IMG_NEW_SERVER_CONFIGURATION_FILE_WIZARD = "resources/icons/new_server_configuration_file_wizard.gif"; //$NON-NLS-1$
     public static final String IMG_PARTITION = "resources/icons/partition.gif"; //$NON-NLS-1$
     public static final String IMG_PARTITION_SYSTEM = "resources/icons/partition_system.gif"; //$NON-NLS-1$
-    public static final String IMG_PASSWORD_POLICY = "resources/icons/password_policy_default.gif"; //$NON-NLS-1$
-    public static final String IMG_PASSWORD_POLICY_DEFAULT = "resources/icons/password_policy.gif"; //$NON-NLS-1$
+    public static final String IMG_PASSWORD_POLICY = "resources/icons/password_policy.gif"; //$NON-NLS-1$
+    public static final String IMG_PASSWORD_POLICY_DEFAULT = "resources/icons/password_policy_default.gif"; //$NON-NLS-1$
     public static final String IMG_REPLICATION_CONSUMER = "resources/icons/replication_consumer.gif"; //$NON-NLS-1$
     public static final String IMG_VERTICAL_ORIENTATION = "resources/icons/vertical_orientation.gif"; //$NON-NLS-1$
 }

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PasswordPoliciesMasterDetailsBlock.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PasswordPoliciesMasterDetailsBlock.java?rev=1478356&r1=1478355&r2=1478356&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PasswordPoliciesMasterDetailsBlock.java (original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PasswordPoliciesMasterDetailsBlock.java Thu May  2 13:00:38 2013
@@ -21,7 +21,6 @@ package org.apache.directory.studio.apac
 
 
 import org.apache.directory.server.config.beans.AuthenticationInterceptorBean;
-import org.apache.directory.server.config.beans.DirectoryServiceBean;
 import org.apache.directory.server.config.beans.InterceptorBean;
 import org.apache.directory.server.config.beans.PasswordPolicyBean;
 import org.apache.directory.studio.apacheds.configuration.v2.ApacheDS2ConfigurationPlugin;
@@ -90,6 +89,16 @@ public class PasswordPoliciesMasterDetai
         this.page = page;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public void createContent( IManagedForm managedForm )
+    {
+        super.createContent( managedForm );
+
+        this.sashForm.setWeights( new int[]
+            { 40, 60 } );
+    }
 
     /**
      * {@inheritDoc}
@@ -137,8 +146,15 @@ public class PasswordPoliciesMasterDetai
                 if ( element instanceof PasswordPolicyBean )
                 {
                     PasswordPolicyBean passwordPolicy = ( PasswordPolicyBean ) element;
-
-                    return NLS.bind( "{0}", passwordPolicy.getPwdId() ); //$NON-NLS-1$
+                    
+                    if ( passwordPolicy.isEnabled() )
+                    {
+                        return NLS.bind( "{0} (enabled)", passwordPolicy.getPwdId() );
+                    }
+                    else
+                    {
+                        return NLS.bind( "{0} (disabled)", passwordPolicy.getPwdId() );
+                    }
                 }
 
                 return super.getText( element );

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PasswordPoliciesPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PasswordPoliciesPage.java?rev=1478356&r1=1478355&r2=1478356&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PasswordPoliciesPage.java (original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PasswordPoliciesPage.java Thu May  2 13:00:38 2013
@@ -24,19 +24,8 @@ import org.apache.directory.server.confi
 import org.apache.directory.server.config.beans.DirectoryServiceBean;
 import org.apache.directory.server.config.beans.InterceptorBean;
 import org.apache.directory.server.config.beans.PasswordPolicyBean;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.forms.widgets.TableWrapData;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
 
 
 /**
@@ -55,30 +44,6 @@ public class PasswordPoliciesPage extend
     /** The Page Title */
     private static final String TITLE = Messages.getString( "PasswordPoliciesPage.PasswordPolicies" ); //$NON-NLS-1$
 
-    // UI Widgets
-    private ComboViewer checkQualityComboViewer;
-    private Button minimumLengthCheckbox;
-    private Text minimumLengthText;
-    private Button maximumLengthCheckbox;
-    private Text maximumLengthText;
-    private Text minimumAgeText;
-    private Text maximumAgeText;
-    private Button expireWarningCheckbox;
-    private Text expireWarningText;
-    private Button graceAuthenticationLimitCheckbox;
-    private Text graceAuthenticationLimitText;
-    private Button graceExpireCheckbox;
-    private Text graceExpireText;
-    private Button mustChangeCheckbox;
-    private Button allowUserChangeCheckbox;
-    private Button safeModifyCheckbox;
-    private Button lockoutCheckbox;
-    private Text lockoutDurationText;
-    private Text maxFailureText;
-    private Text failureCountIntervalText;
-    private Button inHistoryCheckbox;
-    private Text inHistoryText;
-
 
     /**
      * Creates a new instance of GeneralPage.
@@ -105,292 +70,9 @@ public class PasswordPoliciesPage extend
     /**
      * {@inheritDoc}
      */
-    protected void createFormContent2( Composite parent, FormToolkit toolkit )
-    {
-        TableWrapLayout twl = new TableWrapLayout();
-        twl.numColumns = 2;
-        parent.setLayout( twl );
-
-        // Left Composite
-        Composite leftComposite = toolkit.createComposite( parent );
-        leftComposite.setLayout( new GridLayout() );
-        TableWrapData leftCompositeTableWrapData = new TableWrapData( TableWrapData.FILL, TableWrapData.TOP );
-        leftCompositeTableWrapData.grabHorizontal = true;
-        leftComposite.setLayoutData( leftCompositeTableWrapData );
-
-        // Right Composite
-        Composite rightComposite = toolkit.createComposite( parent );
-        rightComposite.setLayout( new GridLayout() );
-        TableWrapData rightCompositeTableWrapData = new TableWrapData( TableWrapData.FILL, TableWrapData.TOP );
-        rightCompositeTableWrapData.grabHorizontal = true;
-        rightComposite.setLayoutData( rightCompositeTableWrapData );
-
-        // Creating the sections
-        createQualitySection( toolkit, leftComposite );
-        createExpirationSection( toolkit, leftComposite );
-        createOptionsSection( toolkit, rightComposite );
-        createLockoutSection( toolkit, rightComposite );
-
-        //        // Attribute (pwdAttribute)
-        //        Text attributeText = toolkit.createText( composite, "" );
-        //        attributeText.setLayoutData( new GridData( SWT.BEGINNING, SWT.CENTER, false, false, 2, 1 ) );
-
-    }
-
-
-    /**
-     * Creates the Quality section.
-     *
-     * @param toolkit the toolkit to use
-     * @param parent the parent composite
-     */
-    private void createQualitySection( FormToolkit toolkit, Composite parent )
-    {
-        // Creation of the section
-        Section section = toolkit.createSection( parent, Section.TITLE_BAR );
-        section.setText( "Quality" );
-        section.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
-        Composite composite = toolkit.createComposite( section );
-        toolkit.paintBordersFor( composite );
-        GridLayout gridLayout = new GridLayout( 3, false );
-        gridLayout.marginHeight = gridLayout.marginWidth = 0;
-        composite.setLayout( gridLayout );
-        section.setClient( composite );
-
-        // Check Quality (pwdCheckQuality)
-        toolkit.createLabel( composite, "Check Quality:" );
-        checkQualityComboViewer = new ComboViewer( composite );
-        checkQualityComboViewer.setContentProvider( new ArrayContentProvider() );
-        checkQualityComboViewer.setInput( new CheckQuality[]
-            { CheckQuality.DISABLED, CheckQuality.RELAXED, CheckQuality.STRICT } );
-        checkQualityComboViewer.getControl().setLayoutData(
-            new GridData( SWT.BEGINNING, SWT.CENTER, false, false, 2, 1 ) );
-
-        // Minimum Length (pwdMinLength)
-        minimumLengthCheckbox = toolkit.createButton( composite, "Enable Mimimum Length", SWT.CHECK );
-        minimumLengthCheckbox.setLayoutData( new GridData( SWT.BEGINNING, SWT.CENTER, false, false, 3, 1 ) );
-
-        toolkit.createLabel( composite, "   " );
-        minimumLengthText = toolkit.createText( composite, "" );
-
-        // Maximum Length (pwdMaxLength)
-        maximumLengthCheckbox = toolkit.createButton( composite, "Enable Maximum Length", SWT.CHECK );
-        maximumLengthCheckbox.setLayoutData( new GridData( SWT.BEGINNING, SWT.CENTER, false, false, 3, 1 ) );
-
-        toolkit.createLabel( composite, "   " );
-        maximumLengthText = toolkit.createText( composite, "" );
-    }
-
-
-    /**
-     * Creates the Expiration section.
-     *
-     * @param toolkit the toolkit to use
-     * @param parent the parent composite
-     */
-    private void createExpirationSection( FormToolkit toolkit, Composite parent )
-    {
-        // Creation of the section
-        Section section = toolkit.createSection( parent, Section.TITLE_BAR );
-        section.setText( "Expiration" );
-        section.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
-        Composite composite = toolkit.createComposite( section );
-        toolkit.paintBordersFor( composite );
-        GridLayout gridLayout = new GridLayout( 3, false );
-        gridLayout.marginHeight = gridLayout.marginWidth = 0;
-        composite.setLayout( gridLayout );
-        section.setClient( composite );
-
-        // Minimum Age (pwdMinAge)
-        toolkit.createLabel( composite, "Mimimum Age:" );
-        minimumAgeText = toolkit.createText( composite, "" );
-        minimumAgeText.setLayoutData( new GridData( SWT.BEGINNING, SWT.CENTER, false, false, 2, 1 ) );
-
-        // Maximum Age (pwdMaxAge)
-        toolkit.createLabel( composite, "Maximum Age:" );
-        maximumAgeText = toolkit.createText( composite, "" );
-        maximumAgeText.setLayoutData( new GridData( SWT.BEGINNING, SWT.CENTER, false, false, 2, 1 ) );
-
-        // Expire Warning (pwdExpireWarning)
-        expireWarningCheckbox = toolkit.createButton( composite, "Enable Expire Warning", SWT.CHECK );
-        expireWarningCheckbox.setLayoutData( new GridData( SWT.BEGINNING, SWT.CENTER, false, false, 3, 1 ) );
-
-        toolkit.createLabel( composite, "   " );
-        expireWarningText = toolkit.createText( composite, "" );
-
-        // Grace Authentication Limit (pwdGraceAuthNLimit)
-        graceAuthenticationLimitCheckbox = toolkit.createButton( composite, "Enable Grace Authentication Limit",
-            SWT.CHECK );
-        graceAuthenticationLimitCheckbox.setLayoutData( new GridData( SWT.BEGINNING, SWT.CENTER, false, false, 3, 1 ) );
-
-        toolkit.createLabel( composite, "   " );
-        graceAuthenticationLimitText = toolkit.createText( composite, "" );
-
-        // Grace Expire (pwdGraceExpire)
-        graceExpireCheckbox = toolkit.createButton( composite, "Enable Grace Expire", SWT.CHECK );
-        graceExpireCheckbox.setLayoutData( new GridData( SWT.BEGINNING, SWT.CENTER, false, false, 3, 1 ) );
-
-        toolkit.createLabel( composite, "   " );
-        graceExpireText = toolkit.createText( composite, "" );
-    }
-
-
-    /**
-     * Creates the Options section.
-     *
-     * @param toolkit the toolkit to use
-     * @param parent the parent composite
-     */
-    private void createOptionsSection( FormToolkit toolkit, Composite parent )
-    {
-        // Creation of the section
-        Section section = toolkit.createSection( parent, Section.TITLE_BAR );
-        section.setText( "Options" );
-        section.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
-        Composite composite = toolkit.createComposite( section );
-        toolkit.paintBordersFor( composite );
-        GridLayout gridLayout = new GridLayout( 2, false );
-        gridLayout.marginHeight = gridLayout.marginWidth = 0;
-        composite.setLayout( gridLayout );
-        section.setClient( composite );
-
-        // Must Change (pwdMustChange)
-        mustChangeCheckbox = toolkit.createButton( composite, "Enable Must Change", SWT.CHECK );
-        mustChangeCheckbox.setLayoutData( new GridData( SWT.BEGINNING, SWT.CENTER, false, false, 2, 1 ) );
-
-        // Allow User Change (pwdAllowUserChange)
-        allowUserChangeCheckbox = toolkit.createButton( composite, "Enable Allow User Change", SWT.CHECK );
-        allowUserChangeCheckbox.setLayoutData( new GridData( SWT.BEGINNING, SWT.CENTER, false, false, 2, 1 ) );
-
-        // Safe Modify (pwdSafeModify)
-        safeModifyCheckbox = toolkit.createButton( composite, "Enable Safe Modify", SWT.CHECK );
-        safeModifyCheckbox.setLayoutData( new GridData( SWT.BEGINNING, SWT.CENTER, false, false, 2, 1 ) );
-    }
-
-
-    /**
-     * Creates the Lockout section.
-     *
-     * @param toolkit the toolkit to use
-     * @param parent the parent composite
-     */
-    private void createLockoutSection( FormToolkit toolkit, Composite parent )
-    {
-        // Creation of the section
-        Section section = toolkit.createSection( parent, Section.TITLE_BAR );
-        section.setText( "Lockout" );
-        section.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
-        Composite composite = toolkit.createComposite( section );
-        toolkit.paintBordersFor( composite );
-        GridLayout gridLayout = new GridLayout( 3, false );
-        gridLayout.marginHeight = gridLayout.marginWidth = 0;
-        composite.setLayout( gridLayout );
-        section.setClient( composite );
-
-        // Lockout (pwdLockout)
-        lockoutCheckbox = toolkit.createButton( composite, "Enable Lockout", SWT.CHECK );
-        lockoutCheckbox.setLayoutData( new GridData( SWT.BEGINNING, SWT.CENTER, false, false, 3, 1 ) );
-
-        // Lockout Duration (pwdLockoutDuration)
-        toolkit.createLabel( composite, "Lockout Duration:" );
-        lockoutDurationText = toolkit.createText( composite, "" );
-        lockoutDurationText.setLayoutData( new GridData( SWT.BEGINNING, SWT.CENTER, false, false, 2, 1 ) );
-
-        // Max Failure (pwdMaxFailure)
-        toolkit.createLabel( composite, "Max Failure:" );
-        maxFailureText = toolkit.createText( composite, "" );
-        maxFailureText.setLayoutData( new GridData( SWT.BEGINNING, SWT.CENTER, false, false, 2, 1 ) );
-
-        // Failure Count Interval (pwdFailureCountInterval)
-        toolkit.createLabel( composite, "Failure Count Interval:" );
-        failureCountIntervalText = toolkit.createText( composite, "" );
-        failureCountIntervalText.setLayoutData( new GridData( SWT.BEGINNING, SWT.CENTER, false, false, 2, 1 ) );
-
-        // In History (pwdInHistory)
-        inHistoryCheckbox = toolkit.createButton( composite, "Enable In History", SWT.CHECK );
-        inHistoryCheckbox.setLayoutData( new GridData( SWT.BEGINNING, SWT.CENTER, false, false, 3, 1 ) );
-
-        toolkit.createLabel( composite, "   " );
-        inHistoryText = toolkit.createText( composite, "" );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
     protected void refreshUI()
     {
-        PasswordPolicyBean passwordPolicy = getPasswordPolicy();
-
-//        // Check Quality
-//        checkQualityComboViewer.setSelection( new StructuredSelection( CheckQuality.valueOf( passwordPolicy
-//            .getPwdCheckQuality() ) ) );
-//
-//        // Miminum Length
-//        int minimumLength = passwordPolicy.getPwdMinLength();
-//        minimumLengthCheckbox.setSelection( minimumLength != 0 );
-//        minimumLengthText.setText( "" + minimumLength );
-//
-//        // Maximum Length
-//        int maximumLength = passwordPolicy.getPwdMaxLength();
-//        maximumLengthCheckbox.setSelection( maximumLength != 0 );
-//        maximumLengthText.setText( "" + maximumLength );
-//
-//        // Minimum Age
-//        minimumAgeText.setText( "" + passwordPolicy.getPwdMinAge() );
-//
-//        // Maximum Age
-//        maximumAgeText.setText( "" + passwordPolicy.getPwdMaxAge() );
-//
-//        // Expire Warning
-//        expireWarningCheckbox.setSelection( passwordPolicy.getPwdExpireWarning() == 0 );
-//        expireWarningText.setText( "" + passwordPolicy.getPwdExpireWarning() );
-//
-//        // Grace Authentication Limit
-//        int graceAuthenticationLimit = passwordPolicy.getPwdGraceAuthNLimit();
-//        graceAuthenticationLimitCheckbox.setSelection( graceAuthenticationLimit != 0 );
-//        graceAuthenticationLimitText.setText( "" + graceAuthenticationLimit );
-//
-//        // Grace Expire
-//        int graceExpire = passwordPolicy.getPwdGraceExpire();
-//        graceExpireCheckbox.setSelection( graceExpire != 0 );
-//        graceExpireText.setText( "" + graceExpire );
-//
-//        // Must Change
-//        mustChangeCheckbox.setSelection( passwordPolicy.isPwdMustChange() );
-//
-//        // Allow User Change
-//        allowUserChangeCheckbox.setSelection( passwordPolicy.isPwdAllowUserChange() );
-//
-//        // Safe Modify
-//        safeModifyCheckbox.setSelection( passwordPolicy.isPwdSafeModify() );
-//
-//        // Lockout
-//        lockoutCheckbox.setSelection( passwordPolicy.isPwdLockout() );
-//
-//        // Lockout Duration
-//        lockoutDurationText.setText( "" + passwordPolicy.getPwdLockoutDuration() );
-//
-//        // Max Failure
-//        maxFailureText.setText( "" + passwordPolicy.getPwdMaxFailure() );
-//
-//        // Failure Count Interval
-//        failureCountIntervalText.setText( "" + passwordPolicy.getPwdFailureCountInterval() );
-//
-//        // In History
-//        inHistoryCheckbox.setSelection( passwordPolicy.getPwdInHistory() != 0 );
-//        inHistoryText.setText( "" + passwordPolicy.getPwdInHistory() );
-    }
-
-
-    /**
-     * Gets the Password Policy bean.
-     *
-     * @return the Password Policy bean
-     */
-    private PasswordPolicyBean getPasswordPolicy()
-    {
-        return getPasswordPolicyBean( getDirectoryServiceBean() );
+        // Nothing to do.
     }
 
 
@@ -489,6 +171,7 @@ public class PasswordPoliciesPage extend
 
             // Configuring the password policy
             passwordPolicy.setPwdId( PASSWORD_POLICY_ID_DEFAULT );
+
             // TODO add other parameters
 
             // Adding the password policy to the authentication interceptor
@@ -496,76 +179,6 @@ public class PasswordPoliciesPage extend
         }
     }
 
-    /**
-     * This enum is used for the check quality value.
-     *
-     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
-     */
-    private enum CheckQuality
-    {
-        DISABLED(0),
-        RELAXED(1),
-        STRICT(2);
-
-        /** The value */
-        private int value;
-
-
-        /**
-         * Creates a new instance of CheckQuality.
-         *
-         * @param value the value
-         */
-        private CheckQuality( int value )
-        {
-            this.value = value;
-        }
-
-
-        /**
-         * Gets the value.
-         *
-         * @return the value
-         */
-        public int getValue()
-        {
-            return value;
-        }
-
-
-        public static CheckQuality valueOf( int value )
-        {
-            for ( CheckQuality checkQuality : CheckQuality.class.getEnumConstants() )
-            {
-                if ( checkQuality.getValue() == value )
-                {
-                    return checkQuality;
-                }
-            }
-
-            throw new IllegalArgumentException( "There is no CheckQuality value for :" + value );
-        }
-
-
-        /**
-         * {@inheritDoc}
-         */
-        public String toString()
-        {
-            switch ( this )
-            {
-                case DISABLED:
-                    return "Disabled";
-                case RELAXED:
-                    return "Relaxed";
-                case STRICT:
-                    return "Strict";
-            }
-
-            return super.toString();
-        }
-    }
-
 
     /**
      * Indicates if the given password policy is the default one.

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PasswordPolicyDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PasswordPolicyDetailsPage.java?rev=1478356&r1=1478355&r2=1478356&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PasswordPolicyDetailsPage.java (original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PasswordPolicyDetailsPage.java Thu May  2 13:00:38 2013
@@ -24,8 +24,18 @@ import org.apache.directory.server.confi
 import org.eclipse.jface.viewers.ArrayContentProvider;
 import org.eclipse.jface.viewers.ComboViewer;
 import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
@@ -54,9 +64,12 @@ public class PasswordPolicyDetailsPage i
     private IManagedForm mform;
 
     /** The input password policy */
-    private PasswordPolicyBean input;
+    private PasswordPolicyBean passwordPolicy;
 
     // UI Widgets
+    private Button enabledCheckbox;
+    private Text idText;
+    private Text descriptionText;
     private ComboViewer checkQualityComboViewer;
     private Button minimumLengthCheckbox;
     private Text minimumLengthText;
@@ -80,8 +93,48 @@ public class PasswordPolicyDetailsPage i
     private Button inHistoryCheckbox;
     private Text inHistoryText;
 
-
     // Listeners
+    /** The Text Modify Listener */
+    private ModifyListener textModifyListener = new ModifyListener()
+    {
+        public void modifyText( ModifyEvent e )
+        {
+            commit( true );
+            masterDetailsBlock.setEditorDirty();
+        }
+    };
+
+    /** The button Selection Listener */
+    private SelectionListener buttonSelectionListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            commit( true );
+            masterDetailsBlock.setEditorDirty();
+        }
+    };
+
+    /** The viewer Selection Changed Listener */
+    private ISelectionChangedListener viewerSelectionChangedListener = new ISelectionChangedListener()
+    {
+        public void selectionChanged( SelectionChangedEvent event )
+        {
+            commit( true );
+            masterDetailsBlock.setEditorDirty();
+        }
+    };
+
+    private VerifyListener integerVerifyListener = new VerifyListener()
+    {
+        public void verifyText( VerifyEvent e )
+        {
+            if ( !e.text.matches( "[0-9]*" ) ) //$NON-NLS-1$
+            {
+                e.doit = false;
+            }
+        }
+    };
+
 
     /**
      * Creates a new instance of PartitionDetailsPage.
@@ -108,17 +161,51 @@ public class PasswordPolicyDetailsPage i
         layout.bottomMargin = 2;
         parent.setLayout( layout );
 
-        // Composite
-        Composite composite = toolkit.createComposite( parent );
-        composite.setLayout( new GridLayout() );
-        TableWrapData compositeTableWrapData = new TableWrapData( TableWrapData.FILL, TableWrapData.TOP );
-        compositeTableWrapData.grabHorizontal = true;
-        composite.setLayoutData( compositeTableWrapData );
-
-        createQualitySection( toolkit, composite );
-        createExpirationSection( toolkit, composite );
-        createOptionsSection( toolkit, composite );
-        createLockoutSection( toolkit, composite );
+        createDetailsSection( toolkit, parent );
+        createQualitySection( toolkit, parent );
+        createExpirationSection( toolkit, parent );
+        createOptionsSection( toolkit, parent );
+        createLockoutSection( toolkit, parent );
+    }
+
+
+    /**
+     * Creates the Details Section
+     *
+     * @param parent
+     *      the parent composite
+     * @param toolkit
+     *      the toolkit to use
+     */
+    private void createDetailsSection( FormToolkit toolkit, Composite parent )
+    {
+        // Creation of the section
+        Section section = toolkit.createSection( parent, Section.DESCRIPTION | Section.TITLE_BAR );
+        section.marginWidth = 10;
+        section.setText( "Replication Consumer Details" );
+        section.setDescription( "Set the properties of the replication consumer." );
+        TableWrapData td = new TableWrapData( TableWrapData.FILL, TableWrapData.TOP );
+        td.grabHorizontal = true;
+        section.setLayoutData( td );
+        Composite client = toolkit.createComposite( section );
+        toolkit.paintBordersFor( client );
+        GridLayout glayout = new GridLayout( 2, false );
+        client.setLayout( glayout );
+        section.setClient( client );
+
+        // Enabled Checkbox
+        enabledCheckbox = toolkit.createButton( client, "Enabled", SWT.CHECK );
+        enabledCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
+
+        // ID Text
+        toolkit.createLabel( client, "ID:" );
+        idText = toolkit.createText( client, "" );
+        idText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Description Text
+        toolkit.createLabel( client, "Description:" );
+        descriptionText = toolkit.createText( client, "" );
+        descriptionText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
     }
 
 
@@ -132,8 +219,11 @@ public class PasswordPolicyDetailsPage i
     {
         // Creation of the section
         Section section = toolkit.createSection( parent, Section.TITLE_BAR );
+        section.marginWidth = 10;
         section.setText( "Quality" );
-        section.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        TableWrapData td = new TableWrapData( TableWrapData.FILL, TableWrapData.TOP );
+        td.grabHorizontal = true;
+        section.setLayoutData( td );
         Composite composite = toolkit.createComposite( section );
         toolkit.paintBordersFor( composite );
         GridLayout gridLayout = new GridLayout( 3, false );
@@ -176,8 +266,11 @@ public class PasswordPolicyDetailsPage i
     {
         // Creation of the section
         Section section = toolkit.createSection( parent, Section.TITLE_BAR );
+        section.marginWidth = 10;
         section.setText( "Expiration" );
-        section.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        TableWrapData td = new TableWrapData( TableWrapData.FILL, TableWrapData.TOP );
+        td.grabHorizontal = true;
+        section.setLayoutData( td );
         Composite composite = toolkit.createComposite( section );
         toolkit.paintBordersFor( composite );
         GridLayout gridLayout = new GridLayout( 3, false );
@@ -229,8 +322,11 @@ public class PasswordPolicyDetailsPage i
     {
         // Creation of the section
         Section section = toolkit.createSection( parent, Section.TITLE_BAR );
+        section.marginWidth = 10;
         section.setText( "Options" );
-        section.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        TableWrapData td = new TableWrapData( TableWrapData.FILL, TableWrapData.TOP );
+        td.grabHorizontal = true;
+        section.setLayoutData( td );
         Composite composite = toolkit.createComposite( section );
         toolkit.paintBordersFor( composite );
         GridLayout gridLayout = new GridLayout( 2, false );
@@ -262,8 +358,11 @@ public class PasswordPolicyDetailsPage i
     {
         // Creation of the section
         Section section = toolkit.createSection( parent, Section.TITLE_BAR );
+        section.marginWidth = 10;
         section.setText( "Lockout" );
-        section.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        TableWrapData td = new TableWrapData( TableWrapData.FILL, TableWrapData.TOP );
+        td.grabHorizontal = true;
+        section.setLayoutData( td );
         Composite composite = toolkit.createComposite( section );
         toolkit.paintBordersFor( composite );
         GridLayout gridLayout = new GridLayout( 3, false );
@@ -304,6 +403,43 @@ public class PasswordPolicyDetailsPage i
      */
     private void addListeners()
     {
+        enabledCheckbox.addSelectionListener( buttonSelectionListener );
+        idText.addModifyListener( textModifyListener );
+        descriptionText.addModifyListener( textModifyListener );
+        checkQualityComboViewer.addSelectionChangedListener( viewerSelectionChangedListener );
+        minimumLengthCheckbox.addSelectionListener( buttonSelectionListener );
+        minimumLengthText.addModifyListener( textModifyListener );
+        minimumLengthText.addVerifyListener( integerVerifyListener );
+        maximumLengthCheckbox.addSelectionListener( buttonSelectionListener );
+        maximumLengthText.addModifyListener( textModifyListener );
+        maximumLengthText.addVerifyListener( integerVerifyListener );
+        minimumAgeText.addModifyListener( textModifyListener );
+        minimumAgeText.addVerifyListener( integerVerifyListener );
+        maximumAgeText.addModifyListener( textModifyListener );
+        maximumAgeText.addVerifyListener( integerVerifyListener );
+        expireWarningCheckbox.addSelectionListener( buttonSelectionListener );
+        expireWarningText.addModifyListener( textModifyListener );
+        expireWarningText.addVerifyListener( integerVerifyListener );
+        graceAuthenticationLimitCheckbox.addSelectionListener( buttonSelectionListener );
+        graceAuthenticationLimitText.addModifyListener( textModifyListener );
+        graceAuthenticationLimitText.addVerifyListener( integerVerifyListener );
+        graceExpireCheckbox.addSelectionListener( buttonSelectionListener );
+        graceExpireText.addModifyListener( textModifyListener );
+        graceExpireText.addVerifyListener( integerVerifyListener );
+        mustChangeCheckbox.addSelectionListener( buttonSelectionListener );
+        allowUserChangeCheckbox.addSelectionListener( buttonSelectionListener );
+        safeModifyCheckbox.addSelectionListener( buttonSelectionListener );
+        lockoutCheckbox.addSelectionListener( buttonSelectionListener );
+        lockoutDurationText.addModifyListener( textModifyListener );
+        lockoutDurationText.addVerifyListener( integerVerifyListener );
+        maxFailureText.addModifyListener( textModifyListener );
+        maxFailureText.addVerifyListener( integerVerifyListener );
+        failureCountIntervalText.addModifyListener( textModifyListener );
+        failureCountIntervalText.addVerifyListener( integerVerifyListener );
+        inHistoryText.addVerifyListener( integerVerifyListener );
+        inHistoryCheckbox.addSelectionListener( buttonSelectionListener );
+        inHistoryText.addModifyListener( textModifyListener );
+        inHistoryText.addVerifyListener( integerVerifyListener );
     }
 
 
@@ -312,6 +448,43 @@ public class PasswordPolicyDetailsPage i
      */
     private void removeListeners()
     {
+        enabledCheckbox.removeSelectionListener( buttonSelectionListener );
+        idText.removeModifyListener( textModifyListener );
+        descriptionText.removeModifyListener( textModifyListener );
+        checkQualityComboViewer.removeSelectionChangedListener( viewerSelectionChangedListener );
+        minimumLengthCheckbox.removeSelectionListener( buttonSelectionListener );
+        minimumLengthText.removeModifyListener( textModifyListener );
+        minimumLengthText.removeVerifyListener( integerVerifyListener );
+        maximumLengthCheckbox.removeSelectionListener( buttonSelectionListener );
+        maximumLengthText.removeModifyListener( textModifyListener );
+        maximumLengthText.removeVerifyListener( integerVerifyListener );
+        minimumAgeText.removeModifyListener( textModifyListener );
+        minimumAgeText.removeVerifyListener( integerVerifyListener );
+        maximumAgeText.removeModifyListener( textModifyListener );
+        maximumAgeText.removeVerifyListener( integerVerifyListener );
+        expireWarningCheckbox.removeSelectionListener( buttonSelectionListener );
+        expireWarningText.removeModifyListener( textModifyListener );
+        expireWarningText.removeVerifyListener( integerVerifyListener );
+        graceAuthenticationLimitCheckbox.removeSelectionListener( buttonSelectionListener );
+        graceAuthenticationLimitText.removeModifyListener( textModifyListener );
+        graceAuthenticationLimitText.removeVerifyListener( integerVerifyListener );
+        graceExpireCheckbox.removeSelectionListener( buttonSelectionListener );
+        graceExpireText.removeModifyListener( textModifyListener );
+        graceExpireText.removeVerifyListener( integerVerifyListener );
+        mustChangeCheckbox.removeSelectionListener( buttonSelectionListener );
+        allowUserChangeCheckbox.removeSelectionListener( buttonSelectionListener );
+        safeModifyCheckbox.removeSelectionListener( buttonSelectionListener );
+        lockoutCheckbox.removeSelectionListener( buttonSelectionListener );
+        lockoutDurationText.removeModifyListener( textModifyListener );
+        lockoutDurationText.removeVerifyListener( integerVerifyListener );
+        maxFailureText.removeModifyListener( textModifyListener );
+        maxFailureText.removeVerifyListener( integerVerifyListener );
+        failureCountIntervalText.removeModifyListener( textModifyListener );
+        failureCountIntervalText.removeVerifyListener( integerVerifyListener );
+        inHistoryText.removeVerifyListener( integerVerifyListener );
+        inHistoryCheckbox.removeSelectionListener( buttonSelectionListener );
+        inHistoryText.removeModifyListener( textModifyListener );
+        inHistoryText.removeVerifyListener( integerVerifyListener );
     }
 
 
@@ -323,11 +496,11 @@ public class PasswordPolicyDetailsPage i
         IStructuredSelection ssel = ( IStructuredSelection ) selection;
         if ( ssel.size() == 1 )
         {
-            input = ( PasswordPolicyBean ) ssel.getFirstElement();
+            passwordPolicy = ( PasswordPolicyBean ) ssel.getFirstElement();
         }
         else
         {
-            input = null;
+            passwordPolicy = null;
         }
         refresh();
     }
@@ -338,14 +511,209 @@ public class PasswordPolicyDetailsPage i
      */
     public void commit( boolean onSave )
     {
-        if ( input != null )
+        if ( passwordPolicy != null )
         {
-            // TODO
+            // Enabled
+            passwordPolicy.setEnabled( enabledCheckbox.getSelection() );
+
+            // ID
+            passwordPolicy.setPwdId( ServerConfigurationEditorUtils.checkEmptyString( idText.getText() ) );
+
+            // Description
+            passwordPolicy
+                .setDescription( ServerConfigurationEditorUtils.checkEmptyString( descriptionText.getText() ) );
+
+            // Check Quality
+            passwordPolicy.setPwdCheckQuality( getPwdCheckQuality() );
+
+            // Miminum Length
+            if ( minimumLengthCheckbox.getSelection() )
+            {
+                try
+                {
+                    passwordPolicy.setPwdMinLength( Integer.parseInt( minimumLengthText.getText() ) );
+                }
+                catch ( NumberFormatException e )
+                {
+                    passwordPolicy.setPwdMinLength( 0 );
+                }
+            }
+            else
+            {
+                passwordPolicy.setPwdMinLength( 0 );
+            }
+
+            // Maximum Length
+            if ( maximumLengthCheckbox.getSelection() )
+            {
+                try
+                {
+                    passwordPolicy.setPwdMaxLength( Integer.parseInt( maximumLengthText.getText() ) );
+                }
+                catch ( NumberFormatException e )
+                {
+                    passwordPolicy.setPwdMaxLength( 0 );
+                }
+            }
+            else
+            {
+                passwordPolicy.setPwdMaxLength( 0 );
+            }
+
+            // Minimum Age
+            try
+            {
+                passwordPolicy.setPwdMinAge( Integer.parseInt( minimumAgeText.getText() ) );
+            }
+            catch ( NumberFormatException e )
+            {
+                passwordPolicy.setPwdMinAge( 0 );
+            }
+
+            // Maximum Age
+            try
+            {
+                passwordPolicy.setPwdMaxAge( Integer.parseInt( maximumAgeText.getText() ) );
+            }
+            catch ( NumberFormatException e )
+            {
+                passwordPolicy.setPwdMaxAge( 0 );
+            }
+
+            // Expire Warning
+            if ( expireWarningCheckbox.getSelection() )
+            {
+                try
+                {
+                    passwordPolicy.setPwdExpireWarning( Integer.parseInt( expireWarningText.getText() ) );
+                }
+                catch ( NumberFormatException e )
+                {
+                    passwordPolicy.setPwdExpireWarning( 0 );
+                }
+            }
+            else
+            {
+                passwordPolicy.setPwdExpireWarning( 0 );
+            }
+
+            // Grace Authentication Limit
+            if ( graceAuthenticationLimitCheckbox.getSelection() )
+            {
+                try
+                {
+                    passwordPolicy.setPwdGraceAuthNLimit( Integer.parseInt( graceAuthenticationLimitText.getText() ) );
+                }
+                catch ( NumberFormatException e )
+                {
+                    passwordPolicy.setPwdGraceAuthNLimit( 0 );
+                }
+            }
+            else
+            {
+                passwordPolicy.setPwdGraceAuthNLimit( 0 );
+            }
+
+            // Grace Expire
+            if ( graceExpireCheckbox.getSelection() )
+            {
+                try
+                {
+                    passwordPolicy.setPwdGraceExpire( Integer.parseInt( graceExpireText.getText() ) );
+                }
+                catch ( NumberFormatException e )
+                {
+                    passwordPolicy.setPwdGraceExpire( 0 );
+                }
+            }
+            else
+            {
+                passwordPolicy.setPwdGraceExpire( 0 );
+            }
+
+            // Must Change
+            passwordPolicy.setPwdMustChange( mustChangeCheckbox.getSelection() );
+
+            // Allow User Change
+            passwordPolicy.setPwdAllowUserChange( allowUserChangeCheckbox.getSelection() );
+
+            // Safe Modify
+            passwordPolicy.setPwdSafeModify( safeModifyCheckbox.getSelection() );
+
+            // Lockout
+            passwordPolicy.setPwdLockout( lockoutCheckbox.getSelection() );
+
+            // Lockout Duration
+            try
+            {
+                passwordPolicy.setPwdLockoutDuration( Integer.parseInt( lockoutDurationText.getText() ) );
+            }
+            catch ( NumberFormatException e )
+            {
+                passwordPolicy.setPwdLockoutDuration( 0 );
+            }
+
+            // Max Failure
+            try
+            {
+                passwordPolicy.setPwdMaxFailure( Integer.parseInt( maxFailureText.getText() ) );
+            }
+            catch ( NumberFormatException e )
+            {
+                passwordPolicy.setPwdMaxFailure( 0 );
+            }
+
+            // Failure Count Interval
+            try
+            {
+                passwordPolicy.setPwdFailureCountInterval( Integer.parseInt( failureCountIntervalText.getText() ) );
+            }
+            catch ( NumberFormatException e )
+            {
+                passwordPolicy.setPwdFailureCountInterval( 0 );
+            }
+
+            // In History
+            if ( inHistoryCheckbox.getSelection() )
+            {
+                try
+                {
+                    passwordPolicy.setPwdInHistory( Integer.parseInt( inHistoryText.getText() ) );
+                }
+                catch ( NumberFormatException e )
+                {
+                    passwordPolicy.setPwdInHistory( 0 );
+                }
+            }
+            else
+            {
+                passwordPolicy.setPwdInHistory( 0 );
+            }
         }
     }
 
 
     /**
+     * Gets the password policy check quality.
+     *
+     * @return the password policy check quality
+     */
+    private int getPwdCheckQuality()
+    {
+        IStructuredSelection selection = ( StructuredSelection ) checkQualityComboViewer.getSelection();
+
+        if ( !selection.isEmpty() )
+        {
+            CheckQuality checkQuality = ( CheckQuality ) selection.getFirstElement();
+
+            return checkQuality.getValue();
+        }
+
+        return CheckQuality.DISABLED.getValue();
+    }
+
+
+    /**
      * {@inheritDoc}
      */
     public void dispose()
@@ -387,7 +755,82 @@ public class PasswordPolicyDetailsPage i
     {
         removeListeners();
 
-        // TODO
+        if ( passwordPolicy != null )
+        {
+            // Checking if this is the default password policy
+            boolean isDefaultPasswordPolicy = PasswordPoliciesPage.isDefaultPasswordPolicy( passwordPolicy );
+            
+            // Enabled
+            enabledCheckbox.setSelection( passwordPolicy.isEnabled() );
+
+            // ID
+            idText.setText( ServerConfigurationEditorUtils.checkNull( passwordPolicy.getPwdId() ) );
+            idText.setEnabled( !isDefaultPasswordPolicy );
+
+            // Description
+            descriptionText.setText( ServerConfigurationEditorUtils.checkNull( passwordPolicy.getDescription() ) );
+            descriptionText.setEnabled( !isDefaultPasswordPolicy );
+
+            // Check Quality
+            checkQualityComboViewer.setSelection( new StructuredSelection( CheckQuality.valueOf( passwordPolicy
+                .getPwdCheckQuality() ) ) );
+
+            // Miminum Length
+            int minimumLength = passwordPolicy.getPwdMinLength();
+            minimumLengthCheckbox.setSelection( minimumLength != 0 );
+            minimumLengthText.setText( "" + minimumLength );
+
+            // Maximum Length
+            int maximumLength = passwordPolicy.getPwdMaxLength();
+            maximumLengthCheckbox.setSelection( maximumLength != 0 );
+            maximumLengthText.setText( "" + maximumLength );
+
+            // Minimum Age
+            minimumAgeText.setText( "" + passwordPolicy.getPwdMinAge() );
+
+            // Maximum Age
+            maximumAgeText.setText( "" + passwordPolicy.getPwdMaxAge() );
+
+            // Expire Warning
+            int expireWarning = passwordPolicy.getPwdExpireWarning();
+            expireWarningCheckbox.setSelection( expireWarning != 0 );
+            expireWarningText.setText( "" + expireWarning );
+
+            // Grace Authentication Limit
+            int graceAuthenticationLimit = passwordPolicy.getPwdGraceAuthNLimit();
+            graceAuthenticationLimitCheckbox.setSelection( graceAuthenticationLimit != 0 );
+            graceAuthenticationLimitText.setText( "" + graceAuthenticationLimit );
+
+            // Grace Expire
+            int graceExpire = passwordPolicy.getPwdGraceExpire();
+            graceExpireCheckbox.setSelection( graceExpire != 0 );
+            graceExpireText.setText( "" + graceExpire );
+
+            // Must Change
+            mustChangeCheckbox.setSelection( passwordPolicy.isPwdMustChange() );
+
+            // Allow User Change
+            allowUserChangeCheckbox.setSelection( passwordPolicy.isPwdAllowUserChange() );
+
+            // Safe Modify
+            safeModifyCheckbox.setSelection( passwordPolicy.isPwdSafeModify() );
+
+            // Lockout
+            lockoutCheckbox.setSelection( passwordPolicy.isPwdLockout() );
+
+            // Lockout Duration
+            lockoutDurationText.setText( "" + passwordPolicy.getPwdLockoutDuration() );
+
+            // Max Failure
+            maxFailureText.setText( "" + passwordPolicy.getPwdMaxFailure() );
+
+            // Failure Count Interval
+            failureCountIntervalText.setText( "" + passwordPolicy.getPwdFailureCountInterval() );
+
+            // In History
+            inHistoryCheckbox.setSelection( passwordPolicy.getPwdInHistory() != 0 );
+            inHistoryText.setText( "" + passwordPolicy.getPwdInHistory() );
+        }
 
         addListeners();
     }

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ReplicationDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ReplicationDetailsPage.java?rev=1478356&r1=1478355&r2=1478356&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ReplicationDetailsPage.java (original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ReplicationDetailsPage.java Thu May  2 13:00:38 2013
@@ -767,10 +767,10 @@ public class ReplicationDetailsPage impl
             input.setEnabled( enabledCheckbox.getSelection() );
 
             // ID
-            input.setReplConsumerId( checkEmptyString( idText.getText() ) );
+            input.setReplConsumerId( ServerConfigurationEditorUtils.checkEmptyString( idText.getText() ) );
 
             // Description
-            input.setDescription( checkEmptyString( descriptionText.getText() ) );
+            input.setDescription( ServerConfigurationEditorUtils.checkEmptyString( descriptionText.getText() ) );
 
             // Refresh Mode
             input.setReplRefreshNPersist( refreshAndPersistModeButton.getSelection() );
@@ -786,7 +786,7 @@ public class ReplicationDetailsPage impl
             }
 
             // Remote Host
-            input.setReplProvHostName( checkEmptyString( remoteHostText.getText() ) );
+            input.setReplProvHostName( ServerConfigurationEditorUtils.checkEmptyString( remoteHostText.getText() ) );
 
             // Remote Port
             try
@@ -799,10 +799,10 @@ public class ReplicationDetailsPage impl
             }
 
             // Bind DN
-            input.setReplUserDn( checkEmptyString( bindDnText.getText() ) );
+            input.setReplUserDn( ServerConfigurationEditorUtils.checkEmptyString( bindDnText.getText() ) );
 
             // Bind Password
-            String password = checkEmptyString( bindPasswordText.getText() );
+            String password = ServerConfigurationEditorUtils.checkEmptyString( bindPasswordText.getText() );
 
             if ( password != null )
             {
@@ -841,7 +841,7 @@ public class ReplicationDetailsPage impl
 
             if ( baseDn != null )
             {
-                input.setSearchBaseDn( checkEmptyString( baseDn.toString() ) );
+                input.setSearchBaseDn( ServerConfigurationEditorUtils.checkEmptyString( baseDn.toString() ) );
             }
             else
             {
@@ -849,7 +849,7 @@ public class ReplicationDetailsPage impl
             }
 
             // Search Filter
-            input.setReplSearchFilter( checkEmptyString( filterWidget.getFilter() ) );
+            input.setReplSearchFilter( ServerConfigurationEditorUtils.checkEmptyString( filterWidget.getFilter() ) );
 
             // Search Scope
             SearchScope scope = getSearchScope();
@@ -937,24 +937,6 @@ public class ReplicationDetailsPage impl
 
 
     /**
-     * Checks if the string is <code>null</code>
-     * and returns an empty string in that case.
-     *
-     * @param s the string
-     * @return a non-<code>null</code> string
-     */
-    private String checkEmptyString( String s )
-    {
-        if ( "".equals( s ) )
-        {
-            return null;
-        }
-
-        return s;
-    }
-
-
-    /**
      * {@inheritDoc}
      */
     public void dispose()
@@ -1002,10 +984,10 @@ public class ReplicationDetailsPage impl
             enabledCheckbox.setSelection( input.isEnabled() );
 
             // ID
-            idText.setText( checkNull( input.getReplConsumerId() ) );
+            idText.setText( ServerConfigurationEditorUtils.checkNull( input.getReplConsumerId() ) );
 
             // Description
-            descriptionText.setText( checkNull( input.getDescription() ) );
+            descriptionText.setText( ServerConfigurationEditorUtils.checkNull( input.getDescription() ) );
 
             // Refresh And Persist
             refreshAndPersistModeButton.setSelection( input.isReplRefreshNPersist() );
@@ -1014,23 +996,26 @@ public class ReplicationDetailsPage impl
             refreshOnlyModeButton.setSelection( !input.isReplRefreshNPersist() );
 
             // Refresh Interval
-            refreshIntervalText.setText( checkNull( String.valueOf( input.getReplRefreshInterval() ) ) );
+            refreshIntervalText.setText( ServerConfigurationEditorUtils.checkNull( String.valueOf( input
+                .getReplRefreshInterval() ) ) );
 
             // Remote Host
-            remoteHostText.setText( checkNull( input.getReplProvHostName() ) );
+            remoteHostText.setText( ServerConfigurationEditorUtils.checkNull( input.getReplProvHostName() ) );
 
             // Remote Port
-            remotePortText.setText( checkNull( String.valueOf( input.getReplProvPort() ) ) );
+            remotePortText
+                .setText( ServerConfigurationEditorUtils.checkNull( String.valueOf( input.getReplProvPort() ) ) );
 
             // Bind DN
-            bindDnText.setText( checkNull( input.getReplUserDn() ) );
+            bindDnText.setText( ServerConfigurationEditorUtils.checkNull( input.getReplUserDn() ) );
 
             // Bind Password
             byte[] bindPassword = input.getReplUserPassword();
 
             if ( ( bindPassword != null ) && ( bindPassword.length > 0 ) )
             {
-                bindPasswordText.setText( checkNull( new String( input.getReplUserPassword() ) ) );
+                bindPasswordText.setText( ServerConfigurationEditorUtils.checkNull( new String( input
+                    .getReplUserPassword() ) ) );
             }
             else
             {
@@ -1038,10 +1023,12 @@ public class ReplicationDetailsPage impl
             }
 
             // Size Limit
-            sizeLimitText.setText( checkNull( String.valueOf( input.getReplSearchSizeLimit() ) ) );
+            sizeLimitText.setText( ServerConfigurationEditorUtils.checkNull( String.valueOf( input
+                .getReplSearchSizeLimit() ) ) );
 
             // Time Limit
-            timeLimitText.setText( checkNull( String.valueOf( input.getReplSearchTimeout() ) ) );
+            timeLimitText.setText( ServerConfigurationEditorUtils.checkNull( String.valueOf( input
+                .getReplSearchTimeout() ) ) );
 
             // Use Start TLS
             useStartTlsCheckbox.setSelection( input.isReplUseTls() );
@@ -1057,7 +1044,7 @@ public class ReplicationDetailsPage impl
             }
 
             // Search Filter
-            filterWidget.setFilter( checkNull( input.getReplSearchFilter() ) );
+            filterWidget.setFilter( ServerConfigurationEditorUtils.checkNull( input.getReplSearchFilter() ) );
 
             // Search Scope
             SearchScope scope = null;
@@ -1164,24 +1151,6 @@ public class ReplicationDetailsPage impl
 
 
     /**
-     * Checks if the string is <code>null</code>
-     * and returns an empty string in that case.
-     *
-     * @param s the string
-     * @return a non-<code>null</code> string
-     */
-    private String checkNull( String s )
-    {
-        if ( s == null )
-        {
-            return "";
-        }
-
-        return s;
-    }
-
-
-    /**
      * {@inheritDoc}
      */
     public void setFocus()

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditorUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditorUtils.java?rev=1478356&r1=1478355&r2=1478356&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditorUtils.java (original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditorUtils.java Thu May  2 13:00:38 2013
@@ -416,4 +416,40 @@ public class ServerConfigurationEditorUt
     {
         saveConfiguration( new File( path ), configWriter );
     }
+
+
+    /**
+     * Checks if the string is <code>null</code>
+     * and returns an empty string in that case.
+     *
+     * @param s the string
+     * @return a non-<code>null</code> string
+     */
+    public static String checkNull( String s )
+    {
+        if ( s == null )
+        {
+            return "";
+        }
+
+        return s;
+    }
+
+
+    /**
+     * Checks if the string is <code>null</code>
+     * and returns an empty string in that case.
+     *
+     * @param s the string
+     * @return a non-<code>null</code> string
+     */
+    public static String checkEmptyString( String s )
+    {
+        if ( "".equals( s ) )
+        {
+            return null;
+        }
+
+        return s;
+    }
 }



Mime
View raw message