Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2664 - development/main/depot/prefs/src/main/net/dpml/depot/prefs

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT dpml.net
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r2664 - development/main/depot/prefs/src/main/net/dpml/depot/prefs
  • Date: Tue, 24 May 2005 08:44:36 +0000

Author: mcconnell AT dpml.net
Date: Tue May 24 08:44:32 2005
New Revision: 2664

Modified:

development/main/depot/prefs/src/main/net/dpml/depot/prefs/CacheManagerPanel.java

development/main/depot/prefs/src/main/net/dpml/depot/prefs/PluginManagerPanel.java

development/main/depot/prefs/src/main/net/dpml/depot/prefs/RegistryManagerPanel.java
Log:
Move cache modiciation actions under the controller settings.

Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/CacheManagerPanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/CacheManagerPanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/CacheManagerPanel.java
Tue May 24 08:44:32 2005
@@ -51,6 +51,7 @@
import net.dpml.transit.util.ExceptionHelper;
import net.dpml.transit.manager.CacheManager;
import net.dpml.transit.manager.HostManager;
+import net.dpml.transit.cache.CacheHandler;

/**
* Runnable plugin that handles DPML environment setup.
@@ -77,6 +78,7 @@
private JButton m_delete;
private String m_selection; // selected hostname
private CacheManager m_manager;
+ private CacheAction m_cache;

//--------------------------------------------------------------
// constructor
@@ -92,14 +94,15 @@
m_editAction = new EditAction( "Edit" );
m_edit = new JButton( m_editAction );
m_delete = new JButton( new DeleteAction( "Delete" ) );
+ m_cache = new CacheAction( "Cache" );

JLabel label =
IconHelper.createImageIconJLabel(
- getClass().getClassLoader(), CACHE_IMG_PATH,
- "Cache", "Cache handler properties and settings." );
+ getClass().getClassLoader(), MISC_IMG_PATH,
+ "Artifact", "Cache Controller settings." );
label.setBorder( new EmptyBorder( 0, 5, 0, 0 ) );
- CacheAction action = new CacheAction( "Cache" );
- getHeader().addEntry( label, "Local Cache", new JButton( action ) );
+ ControllerAction controller = new ControllerAction( "Controller" );
+ getHeader().addEntry( label, "Cache Controller", new JButton(
controller ) );

JPanel hostPanel = new JPanel();
hostPanel.setBackground( Color.white );
@@ -188,6 +191,40 @@
}
}

+ private class ControllerAction extends AbstractAction
+ {
+ ControllerAction( String name )
+ {
+ super( name );
+ }
+
+ public void actionPerformed( ActionEvent event )
+ {
+ try
+ {
+ final String title = "Cache Controller";
+ final Dimension size = new Dimension( 400, 240 );
+ ClassicDialog dialog = ClassicDialog.createDialog( m_parent,
title, size );
+ PluginManagerPanel panel =
+ new PluginManagerPanel( dialog, m_manager, m_cache,
CacheHandler.class );
+ dialog.getBody().add( panel );
+ dialog.setLocationRelativeTo( (Component) event.getSource()
);
+ dialog.setResizable( false );
+ dialog.setVisible(true);
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Unexpected error while attempting to handle the
'Controller' action. "
+ + "\nCODEBASE: "
+ +
getClass().getProtectionDomain().getCodeSource().getLocation().toString();
+ String message = ExceptionHelper.packException( error, e,
true );
+ System.err.println( message );
+ }
+ }
+ }
+
+
//--------------------------------------------------------------
// utilities
//--------------------------------------------------------------
@@ -363,5 +400,6 @@
}

private static String CACHE_IMG_PATH =
"net/dpml/depot/prefs/images/cache.jpg";
+ private static String MISC_IMG_PATH =
"net/dpml/depot/prefs/images/misc.png";

}

Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/PluginManagerPanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/PluginManagerPanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/PluginManagerPanel.java
Tue May 24 08:44:32 2005
@@ -34,6 +34,7 @@
import java.net.URISyntaxException;
import java.net.URL;

+import javax.swing.Action;
import javax.swing.AbstractAction;
import javax.swing.BoxLayout;
import javax.swing.JButton;
@@ -74,6 +75,7 @@
private SettingsAction m_settings;
private PluginManager m_manager;
private PropertyChangeSupport m_propertyChangeSupport;
+ private Action m_action;

//--------------------------------------------------------------
// constructor
@@ -90,16 +92,40 @@
* establishment.
*
* @param parent the parent dialog
- * @param prefs the user preferences for the node
net/dpml/transit/content/[type]
+ * @param manager the plugin manager
* @param service the class that a plugin controller must implement
*/
- public PluginManagerPanel( JDialog parent, PluginManager manager, Class
service ) throws Exception
+ public PluginManagerPanel(
+ JDialog parent, PluginManager manager, Class service ) throws
Exception
+ {
+ this( parent, manager, null, service );
+ }
+
+ /**
+ * Creation of a standard plugin setup panel containing
+ * a user modifiable plugin artifact uri and a controller
+ * parameters button. If a class named [classname]ControlPanel
+ * exists (where [classname] is the plugin classname), the control
+ * panel class will be used to construct a dialog for the selected
+ * plugin. If a class named [classname]Installer exists, the
+ * installer will be instantiated as part of plugin dialog
+ * establishment.
+ *
+ * @param parent the parent dialog
+ * @param manager the plugin manager
+ * @param action a possibly null action object to be assigned to the
controller button
+ * when not plugin uri is specificed
+ * @param service the class that a plugin controller must implement
+ */
+ public PluginManagerPanel(
+ JDialog parent, PluginManager manager, Action action, Class service )
throws Exception
{
super();

m_parent = parent;
m_propertyChangeSupport = new PropertyChangeSupport( this );
m_manager = manager;
+ m_action = action;

m_ok = new JButton( new OKAction( "Install", service ) );
m_revert = new JButton( new RevertAction( "Undo" ) );
@@ -236,7 +262,7 @@
}
else
{
- m_settings.setEnabled( false );
+ m_settings.setEnabled( null != m_action );
}
}

@@ -314,7 +340,7 @@
String controllerPath = getControllerPath();
if( null == controllerPath )
{
- setEnabled( false );
+ setEnabled( m_action != null );
}
else
{
@@ -347,7 +373,14 @@
{
m_dialog.setLocationRelativeTo( (Component)
event.getSource() );
m_dialog.setVisible( true );
- }
+ }
+ else
+ {
+ if( null != m_action )
+ {
+ m_action.actionPerformed( event );
+ }
+ }
}

private String getControllerClassname( URI uri ) throws Exception

Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/RegistryManagerPanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/RegistryManagerPanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/RegistryManagerPanel.java
Tue May 24 08:44:32 2005
@@ -160,38 +160,6 @@
// utilities
//--------------------------------------------------------------

- private JPanel createContentHandlerControllerPanel( Window parent )
- {
- JLabel label =
- IconHelper.createImageIconJLabel(
- getClass().getClassLoader(),
- "net/dpml/depot/prefs/images/misc.png",
- "Artifact",
- "Content Handler Controller settings." );
- label.setBorder( new EmptyBorder( 0, 5, 0, 0 ) );
-
- JPanel holder = new JPanel();
- holder.setLayout( new BoxLayout( holder, BoxLayout.Y_AXIS ) );
- holder.setBorder( new EmptyBorder( 0, 6, 0, 6 ) );
- holder.setBackground( Color.white );
-
- JPanel panel = new JPanel();
- panel.setBackground( Color.white );
- panel.setLayout( new BorderLayout() );
- panel.add( label, BorderLayout.WEST );
- panel.setBorder(
- new CompoundBorder(
- new TitledBorder( null, "Controller", TitledBorder.LEFT,
TitledBorder.TOP), border5 ) );
- JButton button = new JButton( new ControllerAction( "Controller" ) );
- JPanel buttons = new JPanel();
- buttons.setBackground( Color.white );
- buttons.setLayout( new BorderLayout() );
- buttons.add( button, BorderLayout.SOUTH );
- panel.add( buttons, BorderLayout.EAST );
- holder.add( panel );
- return holder;
- }
-
private class ControllerAction extends AbstractAction
{
ControllerAction( String name )



  • svn commit: r2664 - development/main/depot/prefs/src/main/net/dpml/depot/prefs, mcconnell, 05/24/2005

Archive powered by MHonArc 2.6.24.

Top of Page