directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r610923 - in /directory/studio/trunk: studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/properties/ studio-connection-ui/src/main/java/...
Date Thu, 10 Jan 2008 20:41:57 GMT
Author: seelmann
Date: Thu Jan 10 12:41:56 2008
New Revision: 610923

URL: http://svn.apache.org/viewvc?rev=610923&view=rev
Log:
Fixed a problem with the NewConnectionWizard, the listeners weren't initialized.

Modified:
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/AbstractConnectionParameterPage.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPage.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/properties/ConnectionPropertyPage.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/AuthenticationParameterPage.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/NetworkParameterPage.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizardPage.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/connection/BrowserParameterPage.java

Modified: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/AbstractConnectionParameterPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/AbstractConnectionParameterPage.java?rev=610923&r1=610922&r2=610923&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/AbstractConnectionParameterPage.java
(original)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/AbstractConnectionParameterPage.java
Thu Jan 10 12:41:56 2008
@@ -22,6 +22,7 @@
 
 import org.apache.directory.studio.connection.core.ConnectionParameter;
 import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.swt.widgets.Composite;
 
 
 /**
@@ -38,13 +39,13 @@
 
     /** The page name. */
     protected String pageName;
-    
+
     /** The page description. */
     protected String pageDescription;
 
     /** The page id this page depends on. */
     protected String pageDependsOnId;
-    
+
     /** The runnable context. */
     protected IRunnableContext runnableContext;
 
@@ -56,7 +57,7 @@
 
     /** The error message. */
     protected String errorMessage;
-    
+
     protected String infoMessage;
 
     /** The connection parameter. */
@@ -72,7 +73,9 @@
 
 
     /**
-     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#setConnectionParameterPageModifyListener(org.apache.directory.studio.connection.ui.ConnectionParameterPageModifyListener)
+     * Sets the connection parameter page modify listener.
+     * 
+     * @param listener the connection parameter page modify listener
      */
     public void setConnectionParameterPageModifyListener( ConnectionParameterPageModifyListener
listener )
     {
@@ -200,8 +203,64 @@
     }
 
 
-	public String getInfoMessage() {
-		return infoMessage;
-	}
+    public String getInfoMessage()
+    {
+        return infoMessage;
+    }
+
+
+    public final void init( Composite parent, ConnectionParameterPageModifyListener listener,
+        ConnectionParameter parameter )
+    {
+        createComposite( parent );
+        if ( listener != null )
+        {
+            setConnectionParameterPageModifyListener( listener );
+        }
+        if ( parameter != null )
+        {
+            loadParameters( parameter );
+        }
+        initListeners();
+        connectionPageModified();
+    }
+
+
+    /**
+     * Called when an input field was modified.
+     */
+    protected final void connectionPageModified()
+    {
+        validate();
+        fireConnectionPageModified();
+    }
+
+
+    /**
+     * Creates the composite.
+     * 
+     * @param parent the parent
+     */
+    protected abstract void createComposite( Composite parent );
+
+
+    /**
+     * Validates the input fields.
+     */
+    protected abstract void validate();
+
+
+    /**
+     * Initializes the fields with the given parameters.
+     * 
+     * @param parameter the connection parameter
+     */
+    protected abstract void loadParameters( ConnectionParameter parameter );
+
+
+    /**
+     * Initializes the listeners.
+     */
+    protected abstract void initListeners();
 
 }

Modified: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPage.java?rev=610923&r1=610922&r2=610923&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPage.java
(original)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPage.java
Thu Jan 10 12:41:56 2008
@@ -36,14 +36,6 @@
 {
 
     /**
-     * Initializes the fields with the given parameters.
-     * 
-     * @param parameter the parameter
-     */
-    public void loadParameters( ConnectionParameter parameter );
-
-
-    /**
      * Save the fields to the parameters.
      * 
      * @param parameter the parameter
@@ -90,11 +82,13 @@
 
 
     /**
-     * Creates the composite.
+     * Initializes the connection parameter page.
      * 
      * @param parent the parent
+     * @param listener the connection parameter page modify listener
+     * @param parameter the initial connection parameter
      */
-    public void createComposite( Composite parent );
+    public void init( Composite parent, ConnectionParameterPageModifyListener listener, ConnectionParameter
parameter );
 
 
     /**
@@ -104,14 +98,6 @@
 
 
     /**
-     * Sets the connection parameter page modify listener.
-     * 
-     * @param listener the connection parameter page modify listener
-     */
-    public void setConnectionParameterPageModifyListener( ConnectionParameterPageModifyListener
listener );
-
-
-    /**
      * Sets the runnable context.
      * 
      * @param runnableContext the runnable context
@@ -133,32 +119,32 @@
      * @return the page id
      */
     public String getPageId();
-    
-    
+
+
     /**
      * Sets the page name.
      * 
      * @param pageName the page name
      */
     public void setPageName( String pageName );
-    
-    
+
+
     /**
      * Gets the page name.
      * 
      * @return the page name
      */
     public String getPageName();
-    
-    
+
+
     /**
      * Sets the page description.
      * 
      * @param pageDescription the page description
      */
     public void setPageDescription( String pageDescription );
-    
-    
+
+
     /**
      * Gets the page description.
      * 
@@ -181,8 +167,8 @@
      * @return the page id this page depends on
      */
     public String getPageDependsOnId();
-    
-    
+
+
     /**
      * Sets the focus.
      */

Modified: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/properties/ConnectionPropertyPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/properties/ConnectionPropertyPage.java?rev=610923&r1=610922&r2=610923&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/properties/ConnectionPropertyPage.java
(original)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/properties/ConnectionPropertyPage.java
Thu Jan 10 12:41:56 2008
@@ -176,10 +176,7 @@
                 GridLayout gl = new GridLayout( 1, false );
                 composite.setLayout( gl );
                 
-                pages[i].createComposite( composite );
-                pages[i].setRunnableContext( null );
-                pages[i].setConnectionParameterPageModifyListener( this );
-                pages[i].loadParameters( connection.getConnectionParameter() );
+                pages[i].init( composite, this, connection.getConnectionParameter() );
                 
                 tabs[i] = new TabItem( tabFolder, SWT.NONE );
                 tabs[i].setText( pages[i].getPageName() );

Modified: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/AuthenticationParameterPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/AuthenticationParameterPage.java?rev=610923&r1=610922&r2=610923&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/AuthenticationParameterPage.java
(original)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/AuthenticationParameterPage.java
Thu Jan 10 12:41:56 2008
@@ -156,9 +156,9 @@
 
 
     /**
-     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#createComposite(org.eclipse.swt.widgets.Composite)
+     * @see org.apache.directory.studio.connection.ui.AbstractConnectionParameterPage#createComposite(org.eclipse.swt.widgets.Composite)
      */
-    public void createComposite( Composite parent )
+    protected void createComposite( Composite parent )
     {
         Composite composite1 = BaseWidgetUtils.createColumnContainer( parent, 1, 1 );
 
@@ -199,19 +199,9 @@
 
 
     /**
-     * Called when an input field was modified.
+     * @see org.apache.directory.studio.connection.ui.AbstractConnectionParameterPage#validate()
      */
-    private void connectionPageModified()
-    {
-        validate();
-        fireConnectionPageModified();
-    }
-
-
-    /**
-     * Validates the input fields after each modification.
-     */
-    private void validate()
+    protected void validate()
     {
         // set enabled/disabled state of fields and buttons
         bindPrincipalCombo.setEnabled( isPrincipalPasswordEnabled() );
@@ -273,9 +263,9 @@
 
 
     /**
-     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#loadParameters(org.apache.directory.studio.connection.core.ConnectionParameter)
+     * @see org.apache.directory.studio.connection.ui.AbstractConnectionParameterPage#loadParameters(org.apache.directory.studio.connection.core.ConnectionParameter)
      */
-    public void loadParameters( ConnectionParameter parameter )
+    protected void loadParameters( ConnectionParameter parameter )
     {
         this.connectionParameter = parameter;
 
@@ -288,17 +278,13 @@
         bindPasswordText.setText( parameter.getBindPassword() != null ? parameter.getBindPassword()
: "" );
         saveBindPasswordButton.setSelection( parameter.getBindPassword() != null );
         saslRealmText.setText( parameter.getSaslRealm() != null ? parameter.getSaslRealm()
: "" );
-
-        initListeners();
-
-        connectionPageModified();
     }
 
 
     /**
-     * Initializes the listeners.
+     * @see org.apache.directory.studio.connection.ui.AbstractConnectionParameterPage#initListeners()
      */
-    private void initListeners()
+    protected void initListeners()
     {
         authenticationMethodCombo.addSelectionListener( new SelectionAdapter()
         {

Modified: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/NetworkParameterPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/NetworkParameterPage.java?rev=610923&r1=610922&r2=610923&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/NetworkParameterPage.java
(original)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/NetworkParameterPage.java
Thu Jan 10 12:41:56 2008
@@ -147,9 +147,9 @@
 
 
     /**
-     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#createComposite(org.eclipse.swt.widgets.Composite)
+     * @see org.apache.directory.studio.connection.ui.AbstractConnectionParameterPage#createComposite(org.eclipse.swt.widgets.Composite)
      */
-    public void createComposite( Composite parent )
+    protected void createComposite( Composite parent )
     {
         Composite composite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 );
 
@@ -195,19 +195,9 @@
 
 
     /**
-     * Called when an input field was modified.
+     * @see org.apache.directory.studio.connection.ui.AbstractConnectionParameterPage#validate()
      */
-    private void connectionPageModified()
-    {
-        validate();
-        fireConnectionPageModified();
-    }
-
-
-    /**
-     * Validates the input fields after each modification.
-     */
-    private void validate()
+    protected void validate()
     {
         // set enabled/disabled state of check connection button
         checkConnectionButton.setEnabled( !hostCombo.getText().equals( "" ) && !portCombo.getText().equals(
"" ) );
@@ -236,9 +226,9 @@
 
 
     /**
-     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#loadParameters(org.apache.directory.studio.connection.core.ConnectionParameter)
+     * @see org.apache.directory.studio.connection.ui.AbstractConnectionParameterPage#loadParameters(org.apache.directory.studio.connection.core.ConnectionParameter)
      */
-    public void loadParameters( ConnectionParameter parameter )
+    protected void loadParameters( ConnectionParameter parameter )
     {
         connectionParameter = parameter;
 
@@ -248,17 +238,13 @@
         int index = parameter.getEncryptionMethod() == EncryptionMethod.LDAPS ? 1
             : parameter.getEncryptionMethod() == EncryptionMethod.START_TLS ? 2 : 0;
         encryptionMethodCombo.select( index );
-
-        initListeners();
-
-        connectionPageModified();
     }
 
 
     /**
-     * Initializes the listeners.
+     * @see org.apache.directory.studio.connection.ui.AbstractConnectionParameterPage#initListeners()
      */
-    private void initListeners()
+    protected void initListeners()
     {
         nameText.addModifyListener( new ModifyListener()
         {

Modified: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizardPage.java?rev=610923&r1=610922&r2=610923&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizardPage.java
(original)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizardPage.java
Thu Jan 10 12:41:56 2008
@@ -63,7 +63,6 @@
             ConnectionUIConstants.IMG_CONNECTION_WIZARD ) );
         setPageComplete( false );
 
-        page.setConnectionParameterPageModifyListener( this );
         page.setRunnableContext( getContainer() );
 
         this.wizard = wizard;
@@ -93,7 +92,7 @@
         Composite composite = new Composite( parent, SWT.NONE );
         GridLayout gl = new GridLayout( 1, false );
         composite.setLayout( gl );
-        page.createComposite( composite );
+        page.init( composite, this, null );
         setControl( composite );
     }
 
@@ -103,10 +102,10 @@
      */
     public void connectionParameterPageModified()
     {
-    	//only one of the messages can be shown
-    	//warning messages are more important 
-    	//than info messages
-    	if ( page.getMessage() != null )
+        //only one of the messages can be shown
+        //warning messages are more important 
+        //than info messages
+        if ( page.getMessage() != null )
         {
             setMessage( page.getMessage() );
         }
@@ -120,7 +119,11 @@
         }
         setErrorMessage( page.getErrorMessage() );
         setPageComplete( page.isValid() );
-        getContainer().updateButtons();
+
+        if ( getContainer() != null && getContainer().getCurrentPage() != null )
+        {
+            getContainer().updateButtons();
+        }
     }
 
 

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/connection/BrowserParameterPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/connection/BrowserParameterPage.java?rev=610923&r1=610922&r2=610923&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/connection/BrowserParameterPage.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/connection/BrowserParameterPage.java
Thu Jan 10 12:41:56 2008
@@ -166,9 +166,9 @@
 
 
     /**
-     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#createComposite(org.eclipse.swt.widgets.Composite)
+     * @see org.apache.directory.studio.connection.ui.AbstractConnectionParameterPage#createComposite(org.eclipse.swt.widgets.Composite)
      */
-    public void createComposite( Composite parent )
+    protected void createComposite( Composite parent )
     {
         addBaseDNInput( parent );
         addLimitInput( parent );
@@ -224,19 +224,9 @@
 
 
     /**
-     * Called when an input field was modified.
+     * @see org.apache.directory.studio.connection.ui.AbstractConnectionParameterPage#validate()
      */
-    private void connectionPageModified()
-    {
-        validate();
-        fireConnectionPageModified();
-    }
-
-
-    /**
-     * Validates the input fields after each modification.
-     */
-    private void validate()
+    protected void validate()
     {
         // set enabled/disabled state of fields and buttons
         baseDNCombo.setEnabled( !isAutoFetchBaseDns() );
@@ -255,9 +245,9 @@
 
 
     /**
-     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#loadParameters(org.apache.directory.studio.connection.core.ConnectionParameter)
+     * @see org.apache.directory.studio.connection.ui.AbstractConnectionParameterPage#loadParameters(org.apache.directory.studio.connection.core.ConnectionParameter)
      */
-    public void loadParameters( ConnectionParameter parameter )
+    protected void loadParameters( ConnectionParameter parameter )
     {
         this.connectionParameter = parameter;
 
@@ -283,17 +273,13 @@
         Connection.AliasDereferencingMethod aliasesDereferencingMethod = Connection.AliasDereferencingMethod
             .getByOrdinal( aliasesDereferencingMethodOrdinal );
         aliasesDereferencingWidget.setAliasesDereferencingMethod( aliasesDereferencingMethod
);
-
-        initListeners();
-
-        connectionPageModified();
     }
 
 
     /**
-     * Initializes the listeners.
+     * @see org.apache.directory.studio.connection.ui.AbstractConnectionParameterPage#initListeners()
      */
-    private void initListeners()
+    protected void initListeners()
     {
         autoFetchBaseDnsButton.addSelectionListener( new SelectionAdapter()
         {



Mime
View raw message