directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1686844 - in /directory/studio/trunk/plugins: common.ui/src/main/java/org/apache/directory/studio/common/ui/ common.ui/src/main/java/org/apache/directory/studio/common/ui/widgets/ openldap.config.editor/src/main/java/org/apache/directory/s...
Date Mon, 22 Jun 2015 12:14:38 GMT
Author: elecharny
Date: Mon Jun 22 12:14:37 2015
New Revision: 1686844

URL: http://svn.apache.org/r1686844
Log:
o Created some new helper methods into the BaseWidgetUtils class, to ease the initialization
of input fields
o Moved one method from CommonUIUtils to BaseWidgetUtils
o Used those methods in the Options, Tuning, Overview and Security pages

Modified:
    directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/CommonUIUtils.java
    directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/widgets/BaseWidgetUtils.java
    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/OverviewPage.java
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/SecurityPage.java
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/TuningPage.java

Modified: directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/CommonUIUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/CommonUIUtils.java?rev=1686844&r1=1686843&r2=1686844&view=diff
==============================================================================
--- directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/CommonUIUtils.java
(original)
+++ directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/CommonUIUtils.java
Mon Jun 22 12:14:37 2015
@@ -218,24 +218,4 @@ public class CommonUIUtils
         
         return text;
     }
-    
-    
-    /**
-     * Set a value in a Button, if it's not null
-     * 
-     * @param value The Value to set
-     * @param checkBox The Button which will be checked if teh value is not null and set
to True
-     */
-    public static void setValue( Boolean value, Button checkBox )
-    {
-        if ( value != null )
-        {
-            checkBox.setSelection( value );
-        }
-        else
-        {
-            checkBox.setSelection( false );
-        }
-        
-    }
 }

Modified: directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/widgets/BaseWidgetUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/widgets/BaseWidgetUtils.java?rev=1686844&r1=1686843&r2=1686844&view=diff
==============================================================================
--- directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/widgets/BaseWidgetUtils.java
(original)
+++ directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/widgets/BaseWidgetUtils.java
Mon Jun 22 12:14:37 2015
@@ -669,4 +669,63 @@ public class BaseWidgetUtils
 
         return integerText;
     }
+    
+    
+    /**
+     * Set a value in a Button, if it's not null
+     * 
+     * @param value The Value to set
+     * @param checkBox The Button which will be checked if the value is not null and set
to True
+     */
+    public static void setValue( Boolean value, Button checkBox )
+    {
+        if ( value != null )
+        {
+            checkBox.setSelection( value );
+        }
+        else
+        {
+            checkBox.setSelection( false );
+        }
+        
+    }
+    
+    
+    /**
+     * Set a value in a Text, if it's not null
+     * 
+     * @param value The Value to set
+     * @param inputText The Text which will be set if the value is not null
+     */
+    public static void setValue( Integer value, Text inputText )
+    {
+        if ( value != null )
+        {
+            inputText.setText( value.toString() );
+        }
+        else
+        {
+            inputText.setText( "" );
+        }
+    }
+    
+    
+    /**
+     * Set a value in a Text, if it's not null
+     * 
+     * @param value The Value to set
+     * @param checkBox The Text which will be set if the value is not null
+     */
+    public static void setValue( String value, Text inputText )
+    {
+        if ( value != null )
+        {
+            inputText.setText( value );
+        }
+        else
+        {
+            inputText.setText( "" );
+        }
+        
+    }
 }

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=1686844&r1=1686843&r2=1686844&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
Mon Jun 22 12:14:37 2015
@@ -52,7 +52,6 @@ import org.eclipse.swt.layout.GridLayout
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -591,23 +590,6 @@ public class OptionsPage extends OpenLDA
         Section section = createSection( toolkit, parent, 
             Messages.getString( "OpenLDAPOptionsPage.AuthzRewriteRules" ) );
         Composite composite = createSectionComposite( toolkit, section, 2, false );
-
-        /*
-        // Authentication Usernames To DN Rewrite Rule Text
-        toolkit.createLabel( composite, "Authentication rewrite rule to convert simple user
names to an LDAP DN:" );
-        authUsernamesToDnRewriteRuleText = toolkit.createText( composite, "" );
-        authUsernamesToDnRewriteRuleText.setLayoutData( new GridData( SWT.FILL, SWT.NONE,
true, false ) );
-
-        // Proxy Authorization Policy Text
-        toolkit.createLabel( composite, "Proxy authorization policy text:" );
-        proxyAuthorizationPolicyText = toolkit.createText( composite, "" );
-        proxyAuthorizationPolicyText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true,
false ) );
-
-        // Authorization Usernames To DN Regexp Text
-        toolkit.createLabel( composite, "Authorization Regexp to convert simple user names
to an LDAP DN:" );
-        authzUsernamesToDnRegexpText = toolkit.createText( composite, "" );
-        authzUsernamesToDnRegexpText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true,
false ) );
-        */
     }
 
 
@@ -836,40 +818,13 @@ public class OptionsPage extends OpenLDA
             }
 
             // Update the ArgsFileText
-            String argsFile = getConfiguration().getGlobal().getOlcArgsFile();
-            
-            if ( argsFile != null )
-            {
-                argsFileText.setText( argsFile );
-            }
-            else
-            {
-                argsFileText.setText( "" );
-            }
+            BaseWidgetUtils.setValue( global.getOlcArgsFile(), argsFileText );
 
             // Update the PluginLogFileText
-            String pluginLogFile = getConfiguration().getGlobal().getOlcPluginLogFile();
-                
-            if ( pluginLogFile != null )
-            { 
-                pluginLogFileText.setText( getConfiguration().getGlobal().getOlcPluginLogFile()
);
-            }
-            else
-            {
-                pluginLogFileText.setText( "" );
-            }
+            BaseWidgetUtils.setValue( global.getOlcPluginLogFile(), pluginLogFileText );
 
             // Update the ReferralText
-            String referral = getConfiguration().getGlobal().getOlcReferral();
-            
-            if ( referral != null )
-            {
-                referralText.setText( referral );
-            }
-            else
-            {
-                referralText.setText( "" );
-            }
+            BaseWidgetUtils.setValue( global.getOlcReferral(), referralText );
 
             // AuthzPolicyl Combo
             String authzPolicy = global.getOlcAuthzPolicy();
@@ -900,25 +855,16 @@ public class OptionsPage extends OpenLDA
             }
 
             // Update the RootDSEText
-            String rootDse = getConfiguration().getGlobal().getOlcRootDSE();
-            
-            if ( rootDse != null )
-            {
-                rootDseText.setText( rootDse );
-            }
-            else
-            {
-                rootDseText.setText( "" );
-            }
+            BaseWidgetUtils.setValue( global.getOlcRootDSE(), rootDseText );
             
             // Update the GentleHupCheckbox
-            CommonUIUtils.setValue( global.getOlcGentleHUP(), gentleHupCheckbox );
+            BaseWidgetUtils.setValue( global.getOlcGentleHUP(), gentleHupCheckbox );
             
             // Update the ReadOnlyCheckbox
-            CommonUIUtils.setValue( global.getOlcReadOnly(), readOnlyCheckbox );
+            BaseWidgetUtils.setValue( global.getOlcReadOnly(), readOnlyCheckbox );
             
             // Update the GentleHupCheckbox
-            CommonUIUtils.setValue( global.getOlcReverseLookup(), reverseLookupCheckbox );
+            BaseWidgetUtils.setValue( global.getOlcReverseLookup(), reverseLookupCheckbox
);
 
             addListeners();
         }

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OverviewPage.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/OverviewPage.java?rev=1686844&r1=1686843&r2=1686844&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OverviewPage.java
(original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OverviewPage.java
Mon Jun 22 12:14:37 2015
@@ -41,6 +41,7 @@ import org.apache.directory.studio.openl
 import org.apache.directory.studio.openldap.config.editor.wrappers.DatabaseWrapperViewerSorter;
 import org.apache.directory.studio.openldap.config.editor.wrappers.ServerIdDecorator;
 import org.apache.directory.studio.openldap.config.editor.wrappers.ServerIdWrapper;
+import org.apache.directory.studio.openldap.config.model.OlcGlobal;
 import org.apache.directory.studio.openldap.config.model.OlcModuleList;
 import org.apache.directory.studio.openldap.config.model.database.OlcDatabaseConfig;
 import org.eclipse.jface.viewers.ArrayContentProvider;
@@ -779,79 +780,67 @@ public class OverviewPage extends OpenLD
         { 
             removeListeners();
 
-            // Update the ServerIDText
-            // Update the DatabaseTableViewer
-            serverIdWrappers.clear();
+            // Getting the global configuration object
+            OlcGlobal global = getConfiguration().getGlobal();
 
-            for ( String serverIdWrapper : getConfiguration().getGlobal().getOlcServerID()
)
+            if ( global != null )
             {
-                serverIdWrappers.add( new ServerIdWrapper( serverIdWrapper ) );
-            }
-
-            serverIdTableWidget.setElements( serverIdWrappers );
-            
-            // Update the ConfigDirText
-            String configDir = getConfiguration().getGlobal().getOlcConfigDir();
-            
-            if ( configDir != null )
-            {
-                configDirText.setText( configDir );
-            }
-            else
-            {
-                configDirText.setText( "" );
-            }
-
-            // Update the LogFIleText
-            String logFile = getConfiguration().getGlobal().getOlcLogFile();
-            
-            if ( logFile != null )
-            {
-                logFileText.setText( logFile );
-            }
-            else
-            {
-                logFileText.setText( "<stderr>" );
-            }
-
-            // Update the DatabaseTableViewer
-            databaseWrappers.clear();
-
-            for ( OlcDatabaseConfig database : getConfiguration().getDatabases() )
-            {
-                databaseWrappers.add( new DatabaseWrapper( database ) );
-            }
-
-            databaseViewer.setInput( databaseWrappers );
-
-            // Update the OverlaysTableViewer
-            moduleWrappers.clear();
-            
-            for ( OlcModuleList moduleList : getConfiguration().getModules() )
-            {
-                List<String> modules = moduleList.getOlcModuleLoad();
-                int index = OpenLdapConfigurationPluginUtils.getOrderingPostfix( moduleList.getCn().get(
0 ) );
+                // Update the ServerIDText
+                // Update the DatabaseTableViewer
+                serverIdWrappers.clear();
+        
+                for ( String serverIdWrapper : global.getOlcServerID() )
+                {
+                    serverIdWrappers.add( new ServerIdWrapper( serverIdWrapper ) );
+                }
+        
+                serverIdTableWidget.setElements( serverIdWrappers );
                 
-                if ( modules != null )
+                // Update the ConfigDirText
+                BaseWidgetUtils.setValue( global.getOlcConfigDir(), configDirText );
+        
+                // Update the LogFIleText
+                BaseWidgetUtils.setValue( global.getOlcLogFile(), logFileText );
+        
+                // Update the DatabaseTableViewer
+                databaseWrappers.clear();
+        
+                for ( OlcDatabaseConfig database : getConfiguration().getDatabases() )
                 {
-                    for ( String module : modules )
+                    databaseWrappers.add( new DatabaseWrapper( database ) );
+                }
+        
+                databaseViewer.setInput( databaseWrappers );
+        
+                // Update the OverlaysTableViewer
+                moduleWrappers.clear();
+                
+                for ( OlcModuleList moduleList : getConfiguration().getModules() )
+                {
+                    List<String> modules = moduleList.getOlcModuleLoad();
+                    int index = OpenLdapConfigurationPluginUtils.getOrderingPostfix( moduleList.getCn().get(
0 ) );
+                    
+                    if ( modules != null )
                     {
-                        int order = OpenLdapConfigurationPluginUtils.getOrderingPrefix( module
);
-                        String strippedModule = OpenLdapConfigurationPluginUtils.stripOrderingPrefix(
module );
-                        String strippedModuleListName = OpenLdapConfigurationPluginUtils.stripOrderingPostfix(
moduleList.getCn().get( 0 ) );
-                        moduleWrappers.add( new ModuleWrapper( strippedModuleListName, index,
strippedModule, moduleList.
-                            getOlcModulePath(), order ) );
+                        for ( String module : modules )
+                        {
+                            int order = OpenLdapConfigurationPluginUtils.getOrderingPrefix(
module );
+                            String strippedModule = OpenLdapConfigurationPluginUtils.stripOrderingPrefix(
module );
+                            String strippedModuleListName = OpenLdapConfigurationPluginUtils.stripOrderingPostfix(
moduleList.getCn().get( 0 ) );
+                            moduleWrappers.add( new ModuleWrapper( strippedModuleListName,
index, strippedModule, moduleList.
+                                getOlcModulePath(), order ) );
+                        }
                     }
                 }
+        
+                moduleViewer.setInput( moduleWrappers );
+                
+                // Update the LogLevelWidget
+                String logLevels = getLogLevel();
+                logLevelText.setText( logLevels );
+        
+                addListeners();
             }
-
-            moduleViewer.setInput( moduleWrappers );
-            
-            // Update the LogLevelWidget
-            String logLevels = getLogLevel();
-            logLevelText.setText( logLevels );
-
-            addListeners();
         }
     }
 

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/SecurityPage.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/SecurityPage.java?rev=1686844&r1=1686843&r2=1686844&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/SecurityPage.java
(original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/SecurityPage.java
Mon Jun 22 12:14:37 2015
@@ -803,124 +803,34 @@ public class SecurityPage extends OpenLD
             //
 
             // Authentication Auxprop Plugins Text
-            String authenticationAuxpropPlugins = global.getOlcSaslAuxprops();
-
-            if ( authenticationAuxpropPlugins != null )
-            {
-                saslAuxPropsText.setText( authenticationAuxpropPlugins );
-            }
-            else
-            {
-                saslAuxPropsText.setText( "" );
-            }
+            BaseWidgetUtils.setValue( global.getOlcSaslAuxprops(), saslAuxPropsText );
 
             // SASL Host Text
-            String saslHost = global.getOlcSaslHost();
-
-            if ( saslHost != null )
-            {
-                saslHostText.setText( saslHost );
-            }
-            else
-            {
-                saslHostText.setText( "" );
-            }
+            BaseWidgetUtils.setValue( global.getOlcSaslHost(), saslHostText );
 
             // SASL Realm Text
-            String saslRealm = global.getOlcSaslRealm();
-
-            if ( saslRealm != null )
-            {
-                saslRealmText.setText( saslRealm );
-            }
-            else
-            {
-                saslRealmText.setText( "" );
-            }
+            BaseWidgetUtils.setValue( global.getOlcSaslRealm(), saslRealmText );
 
             // SASL Security Properties Text
-            String saslSecurityProperties = global.getOlcSaslSecProps();
-
-            if ( saslSecurityProperties != null )
-            {
-                saslSecPropsText.setText( saslSecurityProperties );
-            }
-            else
-            {
-                saslSecPropsText.setText( "" );
-            }
+            BaseWidgetUtils.setValue( global.getOlcSaslSecProps(), saslSecPropsText );
 
             // TLS CA Certificate File Text
-            String tlsCaCertificateFile = global.getOlcTLSCACertificateFile();
-
-            if ( tlsCaCertificateFile != null )
-            {
-                tlsCaCertificateFileText.setText( tlsCaCertificateFile );
-            }
-            else
-            {
-                tlsCaCertificateFileText.setText( "" );
-            }
+            BaseWidgetUtils.setValue( global.getOlcTLSCACertificateFile(), tlsCaCertificateFileText
);
 
             // TLS CA Certificate Path Text
-            String tlsCaCertificatePath = global.getOlcTLSCACertificatePath();
-
-            if ( tlsCaCertificatePath != null )
-            {
-                tlsCaCertificatePathText.setText( tlsCaCertificatePath );
-            }
-            else
-            {
-                tlsCaCertificatePathText.setText( "" );
-            }
+            BaseWidgetUtils.setValue( global.getOlcTLSCACertificatePath(), tlsCaCertificatePathText
);
 
             // TLS Certificate File Text
-            String tlsCertificateFile = global.getOlcTLSCertificateFile();
-
-            if ( tlsCertificateFile != null )
-            {
-                tlsCertificateFileText.setText( tlsCertificateFile );
-            }
-            else
-            {
-                tlsCertificateFileText.setText( "" );
-            }
+            BaseWidgetUtils.setValue( global.getOlcTLSCertificateFile(), tlsCertificateFileText
);
 
             // TLS Certificate Key File Text
-            String tlsCertificateKeyFile = global.getOlcTLSCertificateKeyFile();
-
-            if ( tlsCertificateKeyFile != null )
-            {
-                tlsCertificateKeyFileText.setText( tlsCertificateKeyFile );
-            }
-            else
-            {
-                tlsCertificateKeyFileText.setText( "" );
-            }
+            BaseWidgetUtils.setValue( global.getOlcTLSCertificateKeyFile(), tlsCertificateKeyFileText
);
 
             // Cipher Suite Text
-            String tlsCipherSuite = global.getOlcTLSCipherSuite();
-
-            if ( tlsCipherSuite != null )
-            {
-                tlsCipherSuiteText.setText( tlsCipherSuite );
-            }
-            else
-            {
-                tlsCipherSuiteText.setText( "" );
-            }
+            BaseWidgetUtils.setValue( global.getOlcTLSCipherSuite(), tlsCipherSuiteText );
 
             // Certificate Revocation List File Text
-            String tlsCrlFile = global.getOlcTLSCRLFile();
-
-            if ( tlsCrlFile != null )
-            {
-                tlsCrlFileText.setText( tlsCrlFile );
-            }
-            else
-            {
-                tlsCrlFileText.setText( "" );
-            }
+            BaseWidgetUtils.setValue( global.getOlcTLSCRLFile(), tlsCrlFileText );
 
             // Certificate Check List Level Combo
             String tlsCrlCheck = global.getOlcTLSCRLCheck();
@@ -951,28 +861,10 @@ public class SecurityPage extends OpenLD
             }
 
             // Diffie-Hellman Parameters File Text
-            String tlsDhParamFile = global.getOlcTLSDHParamFile();
-
-            if ( tlsDhParamFile != null )
-            {
-                tlsDhParamFileText.setText( tlsDhParamFile );
-            }
-            else
-            {
-                tlsDhParamFileText.setText( "" );
-            }
+            BaseWidgetUtils.setValue( global.getOlcTLSDHParamFile(), tlsDhParamFileText );
 
             // TLS Random Bits File Text
-            String tlsRandFile = global.getOlcTLSRandFile();
-
-            if ( tlsRandFile != null )
-            {
-                tlsRandFileText.setText( tlsRandFile );
-            }
-            else
-            {
-                tlsRandFileText.setText( "" );
-            }
+            BaseWidgetUtils.setValue( global.getOlcTLSRandFile(), tlsRandFileText );
 
             // TLS Incoming Certificates Verification Level Combo
             String tlsVerifyClient = global.getOlcTLSVerifyClient();
@@ -1031,28 +923,10 @@ public class SecurityPage extends OpenLD
             }
 
             // Local SSF Text
-            Integer localSsf = global.getOlcLocalSSF();
-
-            if ( localSsf != null )
-            {
-                localSsfText.setText( localSsf.toString() );
-            }
-            else
-            {
-                localSsfText.setText( "" );
-            }
+            BaseWidgetUtils.setValue( global.getOlcLocalSSF(), localSsfText );
 
             // Password Crypt Format Text
-            String passwordCryptSaltFormat = global.getOlcPasswordCryptSaltFormat();
-
-            if ( passwordCryptSaltFormat != null )
-            {
-                passwordCryptSaltFormatText.setText( passwordCryptSaltFormat );
-            }
-            else
-            {
-                passwordCryptSaltFormatText.setText( "" );
-            }
+            BaseWidgetUtils.setValue( global.getOlcPasswordCryptSaltFormat(), passwordCryptSaltFormatText
);
 
             // Password Hash Table Widget
             List<String> passwordHashes = global.getOlcPasswordHash();

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/TuningPage.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/TuningPage.java?rev=1686844&r1=1686843&r2=1686844&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/TuningPage.java
(original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/TuningPage.java
Mon Jun 22 12:14:37 2015
@@ -52,6 +52,7 @@ import org.apache.directory.studio.openl
 import org.apache.directory.studio.openldap.config.editor.dialogs.TimeLimitDialog;
 import org.apache.directory.studio.openldap.config.editor.wrappers.TcpBufferDecorator;
 import org.apache.directory.studio.openldap.config.editor.wrappers.TcpBufferWrapper;
+import org.apache.directory.studio.openldap.config.model.OlcGlobal;
 
 
 /**
@@ -1126,148 +1127,77 @@ public class TuningPage extends OpenLDAP
     {
         removeListeners();
 
-        // TCPBuffer Text
-        List<TcpBufferWrapper> tcpBufferList = createTcpBufferList( getConfiguration().getGlobal().getOlcTCPBuffer()
);
-        tcpBufferTableWidget.setElements( tcpBufferList );
+        // Getting the global configuration object
+        OlcGlobal global = getConfiguration().getGlobal();
 
-        // Socket Buffer Max Incoming Text
-        Integer sockbufMaxIncomingString = getConfiguration().getGlobal().getOlcSockbufMaxIncoming();
-        
-        if ( sockbufMaxIncomingString != null )
-        {
-            sockbufMaxIncomingText.setText( sockbufMaxIncomingString.toString() );
-        }
-
-        // Socket Buffer Max Incoming Text
-        String sockbufMaxIncomingAuthString = getConfiguration().getGlobal().getOlcSockbufMaxIncomingAuth();
-        
-        if ( sockbufMaxIncomingAuthString != null )
-        {
-            sockbufMaxIncomingAuthText.setText( sockbufMaxIncomingAuthString );
-        }
-
-        // Concurrency Text
-        Integer concurrency = getConfiguration().getGlobal().getOlcConcurrency();
-        
-        if ( concurrency != null )
-        {
-            concurrencyText.setText( concurrency.toString() );
-        }
-
-        // ConnMaxPending Text
-        Integer connMaxPending = getConfiguration().getGlobal().getOlcConnMaxPending();
-        
-        if ( connMaxPending != null )
-        {
-            connMaxPendingText.setText( connMaxPending.toString() );
-        }
-
-        // ConnMaxPendingAuth Text
-        Integer connMaxPendingAuth = getConfiguration().getGlobal().getOlcConnMaxPendingAuth();
-        
-        if ( connMaxPendingAuth != null )
-        {
-            connMaxPendingAuthText.setText( connMaxPendingAuth.toString() );
-        }
-
-        // ListenerThreads Text
-        Integer listenerThreads = getConfiguration().getGlobal().getOlcListenerThreads();
-        
-        if ( listenerThreads != null )
-        {
-            listenerThreadsText.setText( listenerThreads.toString() );
-        }
-
-        // Threads Text
-        Integer threads = getConfiguration().getGlobal().getOlcThreads();
-        
-        if ( threads != null )
-        {
-            threadsText.setText( threads.toString() );
-        }
-
-        // ToolThreads Text
-        Integer toolThreads = getConfiguration().getGlobal().getOlcToolThreads();
-        
-        if ( toolThreads != null )
-        {
-            toolThreadsText.setText( toolThreads.toString() );
-        }
-
-        // IndexIntLen Text
-        Integer indexIntLen = getConfiguration().getGlobal().getOlcIndexIntLen();
-        
-        if ( indexIntLen != null )
-        {
-            indexIntLenText.setText( indexIntLen.toString() );
-        }
-
-        // IndexSubstrAnyLen Text
-        Integer indexSubstrAnyLen = getConfiguration().getGlobal().getOlcIndexSubstrAnyLen();
-        
-        if ( indexSubstrAnyLen != null )
-        {
-            indexSubstrAnyLenText.setText( indexSubstrAnyLen.toString() );
-        }
-
-        // IndexSubstrAnyStep Text
-        Integer indexSubstrAnyStep = getConfiguration().getGlobal().getOlcIndexSubstrAnyStep();
-        
-        if ( indexSubstrAnyStep != null )
-        {
-            indexSubstrAnyStepText.setText( indexSubstrAnyStep.toString() );
-        }
-
-        // IndexSubstrIfMaxLen Text
-        Integer indexSubstrIfMaxLen = getConfiguration().getGlobal().getOlcIndexSubstrIfMaxLen();
-        
-        if ( indexSubstrIfMaxLen != null )
+        if ( global != null )
         {
-            indexSubstrIfMaxLenText.setText( indexSubstrIfMaxLen.toString() );
-        }
-
-        // IndexSubstrIfMinLen Text
-        Integer indexSubstrIfMinLen = getConfiguration().getGlobal().getOlcIndexSubstrIfMinLen();
-        
-        if ( indexSubstrIfMinLen != null )
-        {
-            indexSubstrIfMinLenText.setText( indexSubstrIfMinLen.toString() );
-        }
-
-        // IndexSubstrIfMinLen Text
-        Integer writeTimeout = getConfiguration().getGlobal().getOlcWriteTimeout();
-        
-        if ( writeTimeout != null )
-        {
-            writeTimeoutText.setText( writeTimeout.toString() );
-        }
-
-        // IdleTiemout Text
-        Integer idleTimeout = getConfiguration().getGlobal().getOlcIdleTimeout();
-        
-        if ( idleTimeout != null )
-        {
-            idleTimeoutText.setText( idleTimeout.toString() );
-        }
-
-        // SizeLimit Text
-        String sizeLimitString = getConfiguration().getGlobal().getOlcSizeLimit();
-        
-        if ( sizeLimitString != null )
-        {
-            sizeLimitText.setText( sizeLimitString );
-        }
-
-        // TimeLimit Text Text
-        List<String> timeLimitList = getConfiguration().getGlobal().getOlcTimeLimit();
-        
-        if ( ( timeLimitList != null ) && ( timeLimitList.size() > 0 ) )
-        {
-            timeLimitText.setText( timeLimitList.get( 0 ) );
-        }
-        else
-        {
-            timeLimitText.setText( "" );
+            //
+            // Assigning values to UI Controls
+            //
+            // TCPBuffer Text
+            List<TcpBufferWrapper> tcpBufferList = createTcpBufferList( global.getOlcTCPBuffer()
);
+            tcpBufferTableWidget.setElements( tcpBufferList );
+    
+            // Socket Buffer Max Incoming Text
+            BaseWidgetUtils.setValue( global.getOlcSockbufMaxIncoming(), sockbufMaxIncomingText
);
+    
+            // Socket Buffer Max Incoming Text
+            BaseWidgetUtils.setValue( global.getOlcSockbufMaxIncomingAuth(), sockbufMaxIncomingAuthText
);
+    
+            // Concurrency Text
+            BaseWidgetUtils.setValue( global.getOlcConcurrency(), concurrencyText );
+    
+            // ConnMaxPending Text
+            BaseWidgetUtils.setValue( global.getOlcConnMaxPending(), connMaxPendingText );
+    
+            // ConnMaxPendingAuth Text
+            BaseWidgetUtils.setValue( global.getOlcConnMaxPendingAuth(), connMaxPendingAuthText
);
+    
+            // ListenerThreads Text
+            BaseWidgetUtils.setValue( global.getOlcListenerThreads(), listenerThreadsText
);
+    
+            // Threads Text
+            BaseWidgetUtils.setValue( global.getOlcThreads(), threadsText );
+    
+            // ToolThreads Text
+            BaseWidgetUtils.setValue( global.getOlcToolThreads(), toolThreadsText );
+    
+            // IndexIntLen Text
+            BaseWidgetUtils.setValue( global.getOlcIndexIntLen(), indexIntLenText );
+    
+            // IndexSubstrAnyLen Text
+            BaseWidgetUtils.setValue( global.getOlcIndexSubstrAnyLen(), indexSubstrAnyLenText
);
+    
+            // IndexSubstrAnyStep Text
+            BaseWidgetUtils.setValue( global.getOlcIndexSubstrAnyStep(), indexSubstrAnyStepText
);
+    
+            // IndexSubstrIfMaxLen Text
+            BaseWidgetUtils.setValue( global.getOlcIndexSubstrIfMaxLen(), indexSubstrIfMaxLenText
);
+    
+            // IndexSubstrIfMinLen Text
+            BaseWidgetUtils.setValue( global.getOlcIndexSubstrIfMinLen(), indexSubstrIfMinLenText
);
+    
+            // IndexSubstrIfMinLen Text
+            BaseWidgetUtils.setValue( global.getOlcWriteTimeout(), writeTimeoutText );
+    
+            // IdleTiemout Text
+            BaseWidgetUtils.setValue( global.getOlcIdleTimeout(), idleTimeoutText );
+    
+            // SizeLimit Text
+            BaseWidgetUtils.setValue( global.getOlcSizeLimit(), sizeLimitText );
+    
+            // TimeLimit Text Text
+            List<String> timeLimitList = getConfiguration().getGlobal().getOlcTimeLimit();
+            
+            if ( ( timeLimitList != null ) && ( timeLimitList.size() > 0 ) )
+            {
+                timeLimitText.setText( timeLimitList.get( 0 ) );
+            }
+            else
+            {
+                timeLimitText.setText( "" );
+            }
         }
         
         addListeners();



Mime
View raw message