notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r2496 - development/main/transit/core/handler/src/main/net/dpml/transit/prefs
- From: mcconnell AT dpml.net
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r2496 - development/main/transit/core/handler/src/main/net/dpml/transit/prefs
- Date: Tue, 10 May 2005 15:30:56 +0000
Author: mcconnell AT dpml.net
Date: Tue May 10 15:30:56 2005
New Revision: 2496
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/prefs/ContentHandlerControllerPanel.java
Log:
add hooks for custom controller control panels
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/prefs/ContentHandlerControllerPanel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/prefs/ContentHandlerControllerPanel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/prefs/ContentHandlerControllerPanel.java
Tue May 10 15:30:56 2005
@@ -20,6 +20,7 @@
import java.io.IOException;
import java.awt.Color;
+import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
@@ -130,7 +131,8 @@
add( panel, BorderLayout.NORTH );
}
- // add a test field containing the content handler artifact uri
+ // add a test field containing the content handler artifact uri and
a
+ // button for optional controller configuration
{
JPanel holder = new JPanel();
@@ -142,6 +144,8 @@
panel.setBackground( Color.white );
panel.setBorder( new EmptyBorder( 10, 10, 10, 10 ) );
{
+ // add the text field
+
JPanel padding = new JPanel();
padding.setBackground( Color.white );
padding.setLayout( new BorderLayout() );
@@ -154,6 +158,8 @@
panel.add( padding );
}
{
+ // add the optional controller settings button
+
JPanel settingsPanel = new JPanel();
settingsPanel.setBorder(
new CompoundBorder(
@@ -172,7 +178,7 @@
add( holder, BorderLayout.CENTER );
}
- // add controls for modification of the registry controller
+ // add revert, ok, and cancel
{
JPanel panel = new JPanel();
@@ -265,16 +271,65 @@
private class SettingsAction extends AbstractAction
{
+ private Dialog m_dialog;
+
SettingsAction( String name )
{
super( name );
- setEnabled( false );
+ String controllerPath = getControllerPathFromPreferences();
+ if( null == controllerPath )
+ {
+ setEnabled( false );
+ }
+ else
+ {
+ try
+ {
+ URI uri = new URI( controllerPath );
+ String classname = getControllerClassname( uri );
+ String controlClassname = classname + "ControlPanel";
+ Class c = getControllerClass( uri );
+ Preferences system = Preferences.systemNodeForPackage( c
);
+ Preferences user = Preferences.userNodeForPackage( c );
+ String cpPath =
+ user.get( "control-panel-plugin-uri",
+ system.get( "control-panel-plugin-uri", null ) );
+ if( null != cpPath )
+ {
+ URL url = new URL( uri.toString() );
+ m_dialog = (Dialog) url.getContent();
+ setEnabled( true );
+ }
+ else
+ {
+ setEnabled( false );
+ }
+
+ }
+ catch( Exception e )
+ {
+ setEnabled( false );
+ }
+ }
}
public void actionPerformed( ActionEvent event )
{
}
+
+ private String getControllerClassname( URI uri ) throws Exception
+ {
+ URL url = new URL( uri.toString() );
+ Plugin plugin = (Plugin) url.getContent( new Class[]{
Plugin.class } );
+ return plugin.getClassname();
+ }
+
+ private Class getControllerClass( URI uri ) throws Exception
+ {
+ URL url = new URL( uri.toString() );
+ return (Class) url.getContent( new Class[]{ Class.class } );
+ }
}
private class RevertAction extends AbstractAction
- svn commit: r2496 - development/main/transit/core/handler/src/main/net/dpml/transit/prefs, mcconnell, 05/10/2005
Archive powered by MHonArc 2.6.24.