notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r2727 - development/main/depot/prefs/src/main/net/dpml/depot/prefs
- From: mcconnell AT dpml.net
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r2727 - development/main/depot/prefs/src/main/net/dpml/depot/prefs
- Date: Sun, 05 Jun 2005 18:09:37 -0400
Author: mcconnell AT dpml.net
Date: Sun Jun 5 18:09:37 2005
New Revision: 2727
Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ClassicCredentialsPanel.java
development/main/depot/prefs/src/main/net/dpml/depot/prefs/HostManagerPanel.java
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ProxyFeaturesPanel.java
Log:
Updates that improve the handling of undo operations on host and proxy
credentials.
Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ClassicCredentialsPanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ClassicCredentialsPanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ClassicCredentialsPanel.java
Sun Jun 5 18:09:37 2005
@@ -83,11 +83,11 @@
* @param parent the parent dialog
*/
public ClassicCredentialsPanel(
- JDialog parent, PasswordAuthentication auth,
+ JDialog parent, PasswordAuthentication authentication,
PasswordAuthentication auth,
PasswordAuthenticationListener listener ) throws Exception
{
m_parent = parent;
- m_authentication = auth;
+ m_authentication = authentication;
m_auth = auth;
m_listener = listener;
Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/HostManagerPanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/HostManagerPanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/HostManagerPanel.java
Sun Jun 5 18:09:37 2005
@@ -562,6 +562,8 @@
private class CredentialsAction extends AbstractAction implements
PasswordAuthenticationListener
{
+ private ClassicDialog m_credentialsDialog;
+
CredentialsAction( String name )
{
super( name );
@@ -569,17 +571,23 @@
public void actionPerformed( ActionEvent event )
{
+ if( m_credentialsDialog != null )
+ {
+ m_credentialsDialog.setVisible( true );
+ return;
+ }
try
{
final String title = "Credentials: " +
m_manager.getHostName();
final Dimension size = new Dimension( 300, 280 );
ClassicDialog dialog = ClassicDialog.createDialog( m_parent,
title, size );
ClassicCredentialsPanel panel =
- new ClassicCredentialsPanel( dialog, m_auth, this );
+ new ClassicCredentialsPanel( dialog,
m_manager.getAuthentication(), m_auth, this );
dialog.getBody().add( panel );
dialog.setLocationRelativeTo( (Component) event.getSource()
);
dialog.setResizable( false );
dialog.setVisible( true );
+ m_credentialsDialog = dialog;
}
catch( Throwable e )
{
@@ -592,6 +600,11 @@
}
}
+ public void revert()
+ {
+ m_credentialsDialog = null;
+ }
+
/**
* Notify a consumer of a change to the host priority.
* @param event the host event
@@ -635,6 +648,7 @@
m_strategy.setSelectedItem( m_manager.getLayoutModel() );
m_base.setText( getBasePath() );
m_auth = m_manager.getAuthentication();
+ m_credentials.revert();
PropertyChangeEvent e =
new PropertyChangeEvent(
this, "revert", null, null );
Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ProxyFeaturesPanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ProxyFeaturesPanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ProxyFeaturesPanel.java
Sun Jun 5 18:09:37 2005
@@ -97,7 +97,6 @@
m_ok = new JButton( new OKAction( "OK" ) );
m_revert = new JButton( new RevertAction( "Undo" ) );
m_credentials = new CredentialsAction( "Credentials" );
- m_credentials.setEnabled( false == "".equals( m_host ) );
m_close = new JButton( new CloseAction( "Close" ) );
// add a text field containing the host url
@@ -189,10 +188,39 @@
public void propertyChange( PropertyChangeEvent event )
{
String base = m_base.getText();
+
+ System.out.println( "# base: " + base );
+ System.out.println( "# host: " + m_host );
+
boolean flag = ( false == m_host.equals( base ) );
+ System.out.println( "# flag/1: " + flag );
+
+ PasswordAuthentication auth = m_manager.getAuthentication();
+ if( null == m_auth )
+ {
+ if( null != auth )
+ {
+ flag = true;
+ }
+ }
+ else if( false == m_auth.equals( auth ) )
+ {
+ flag = true;
+ }
+
+ System.out.println( "# flag/2: " + flag );
+
m_ok.setEnabled( flag );
m_revert.setEnabled( flag );
- m_credentials.setEnabled( false == "".equals( base ) );
+
+ if( m_manager.getAuthentication() != null )
+ {
+ m_credentials.setEnabled( true );
+ }
+ else
+ {
+ m_credentials.setEnabled( flag );
+ }
if( flag )
{
getRootPane().setDefaultButton( m_ok );
@@ -246,8 +274,10 @@
{
String old = m_base.getText();
m_base.setText( m_host );
+ m_auth = m_manager.getAuthentication();
+ m_credentials.revert();
PropertyChangeEvent e =
- new PropertyChangeEvent( this, "uri", old, m_host );
+ new PropertyChangeEvent( this, "undo", null, null );
m_propertyChangeSupport.firePropertyChange( e );
}
}
@@ -290,6 +320,8 @@
private class CredentialsAction extends AbstractAction implements
PasswordAuthenticationListener
{
+ private ClassicDialog m_credentialsDialog;
+
CredentialsAction( String name )
{
super( name );
@@ -297,17 +329,24 @@
public void actionPerformed( ActionEvent event )
{
+ if( m_credentialsDialog != null )
+ {
+ m_credentialsDialog.setVisible( true );
+ return;
+ }
+
try
{
final String title = "Proxy Credentials";
final Dimension size = new Dimension( 300, 280 );
ClassicDialog dialog = ClassicDialog.createDialog( m_parent,
title, size );
ClassicCredentialsPanel panel =
- new ClassicCredentialsPanel( dialog, m_auth, this );
+ new ClassicCredentialsPanel( dialog,
m_manager.getAuthentication(), m_auth, this );
dialog.getBody().add( panel );
dialog.setLocationRelativeTo( (Component) event.getSource()
);
dialog.setResizable( false );
dialog.setVisible(true);
+ m_credentialsDialog = dialog;
}
catch( Throwable e )
{
@@ -320,6 +359,11 @@
}
}
+ public void revert()
+ {
+ m_credentialsDialog = null;
+ }
+
/**
* Notify a consumer of a change to the host priority.
* @param event the host event
@@ -327,7 +371,10 @@
public void passwordAuthenticationChanged(
PasswordAuthenticationEvent event )
{
m_auth = event.getPasswordAuthentication();
- m_manager.setAuthentication( m_auth );
+ PropertyChangeEvent e =
+ new PropertyChangeEvent(
+ this, "auth", m_manager.getAuthentication(), m_auth );
+ m_propertyChangeSupport.firePropertyChange( e );
}
}
- svn commit: r2727 - development/main/depot/prefs/src/main/net/dpml/depot/prefs, mcconnell, 06/05/2005
Archive powered by MHonArc 2.6.24.