Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2553 - in development/main/metro/composition/unit: . src/main/net/dpml/composition/unit src/main/net/dpml/composition/unit/images

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: r2553 - in development/main/metro/composition/unit: . src/main/net/dpml/composition/unit src/main/net/dpml/composition/unit/images
  • Date: Fri, 13 May 2005 23:39:33 +0000

Author: mcconnell AT dpml.net
Date: Fri May 13 23:39:30 2005
New Revision: 2553

Added:

development/main/metro/composition/unit/src/main/net/dpml/composition/unit/images/source.png
(contents, props changed)

development/main/metro/composition/unit/src/main/net/dpml/composition/unit/images/temp.png
(contents, props changed)

development/main/metro/composition/unit/src/main/net/dpml/composition/unit/images/working.png
(contents, props changed)
Modified:
development/main/metro/composition/unit/build.xml

development/main/metro/composition/unit/src/main/net/dpml/composition/unit/CompositionContentHandlerControlPanel.java
Log:
more on the control panel

Modified: development/main/metro/composition/unit/build.xml
==============================================================================
--- development/main/metro/composition/unit/build.xml (original)
+++ development/main/metro/composition/unit/build.xml Fri May 13 23:39:30
2005
@@ -7,6 +7,9 @@

<target name="init" depends="standard.init">
<x:filter key="dpml-system-impl" feature="plugin"
token="SYSTEM-PLUGIN-URI"/>
+ <x:filter feature="name" token="NAME"/>
+ <x:filter feature="version" token="VERSION"/>
+ <x:filter feature="group" token="GROUP"/>
</target>

<target name="package" depends="standard.package">

Modified:
development/main/metro/composition/unit/src/main/net/dpml/composition/unit/CompositionContentHandlerControlPanel.java
==============================================================================
---
development/main/metro/composition/unit/src/main/net/dpml/composition/unit/CompositionContentHandlerControlPanel.java
(original)
+++
development/main/metro/composition/unit/src/main/net/dpml/composition/unit/CompositionContentHandlerControlPanel.java
Fri May 13 23:39:30 2005
@@ -18,6 +18,9 @@

package net.dpml.composition.unit;

+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.BorderLayout;
@@ -36,21 +39,38 @@
import javax.swing.Box;
import javax.swing.border.CompoundBorder;
import javax.swing.border.TitledBorder;
+import javax.swing.ImageIcon;
+import javax.swing.JTextField;

/**
* A registry of descriptions of plugable content handlers. This
implementation
* maps user defined preferences to instance of ContentHandlerDescriptor.
*/
-public class CompositionContentHandlerControlPanel extends JDialog
+public class CompositionContentHandlerControlPanel extends JDialog
implements PropertyChangeListener
{
- /**
- * The DPML icon.
- */
private static String METRO_ICON_FILENAME =
"net/dpml/composition/unit/images/setup.png";

+ private static String SOURCE_ICON_FILENAME =
"net/dpml/composition/unit/images/source.png";
+
+ private static String WORK_ICON_FILENAME =
"net/dpml/composition/unit/images/working.png";
+
+ private static String TEMP_ICON_FILENAME =
"net/dpml/composition/unit/images/temp.png";
+
+ private static String PLUGIN_VERSION = "@VERSION@";
+
+ private static String PLUGIN_GROUP = "@GROUP@";
+
+ private static String PLUGIN_NAME = "@NAME@";
+
+ private PropertyChangeSupport m_propertyChangeSupport;
+
+
public CompositionContentHandlerControlPanel( Dialog parent )
{
super( parent );
+
+ m_propertyChangeSupport = new PropertyChangeSupport( this );
+
setTitle( "Metro FT Content Controller" );
setModal( true );
setBackground( Color.white );
@@ -80,8 +100,26 @@
assembly.add( buttons, BorderLayout.SOUTH );
setContentPane( assembly );

- setSize( new Dimension( 400,400 ) );
+ setSize( new Dimension( 400, 360 ) );
getRootPane().setDefaultButton( buttons.getDefaultButton() );
+
+ m_propertyChangeSupport.addPropertyChangeListener( this );
+
+ }
+
+ //--------------------------------------------------------------
+ // PropertyChangeListener
+ //--------------------------------------------------------------
+
+ /**
+ * The actions dealing with changes to the dialog raise change events
that
+ * are captured here. This listener checks changes and enables or
disabled
+ * the ok and undo buttons based on the state of controls relative to the
+ * underlying preferences for this host.
+ */
+ public void propertyChange( PropertyChangeEvent event )
+ {
+ // TODO
}

private JLabel createHeaderLabel()
@@ -105,39 +143,161 @@
private JPanel createStack()
{
JPanel stack = new JPanel();
- stack.setBackground( Color.white );
stack.setLayout( new BoxLayout( stack, BoxLayout.Y_AXIS ) );
- stack.setBorder(
+ stack.setBackground( Color.white );
+ JPanel spec = createPluginSpecPanel();
+ JPanel dirs = createDirectoryPanel();
+ stack.add( spec );
+ stack.add( dirs );
+ return stack;
+ }
+
+ private JPanel createPluginSpecPanel()
+ {
+ JPanel panel = new JPanel( new BorderLayout() );
+ panel.setBackground( Color.white );
+ panel.setBorder(
new CompoundBorder(
new TitledBorder(
null, "Plugin", TitledBorder.LEFT, TitledBorder.TOP),
new EmptyBorder( 5, 5, 5, 10)
- )
+ )
);

- JLabel group = new JLabel( "Group: dpml/tools" );
- JLabel name = new JLabel( "Name: dpml-composition-unit" );
- JLabel version = new JLabel( "Version: 123" );
+ /*
+ ImageIcon label =
+ IconHelper.createImageIcon(
+ getClass().getClassLoader(), SOURCE_ICON_FILENAME, "Plugin" );
+ JPanel labelHolder = new JPanel( new BorderLayout() );
+ labelHolder.setBackground( Color.white );
+ labelHolder.setBorder( new EmptyBorder( 3, 0, 0, 10 ) );
+ labelHolder.add( new JLabel( label ), BorderLayout.NORTH );
+ panel.add( labelHolder, BorderLayout.WEST );
+ */
+
+ JPanel stack = new JPanel();
+ stack.setLayout( new BoxLayout( stack, BoxLayout.Y_AXIS ) );
+ stack.setBackground( Color.white );
+ JLabel group = new JLabel( "Group: " + PLUGIN_GROUP );
+ JLabel name = new JLabel( "Name: " + PLUGIN_NAME );
+ JLabel version = new JLabel( "Version: " + PLUGIN_VERSION );
stack.add( group );
stack.add( name );
stack.add( version );
- return stack;
+
+ JPanel holder = new JPanel( new BorderLayout() );
+ holder.add( stack, BorderLayout.NORTH );
+ panel.add( holder );
+ return panel;
+ }
+
+ private JPanel createDirectoryPanel()
+ {
+ JPanel panel = new JPanel( new BorderLayout() );
+ panel.setBackground( Color.white );
+ panel.setBorder(
+ new CompoundBorder(
+ new TitledBorder(
+ null, "Directories", TitledBorder.LEFT, TitledBorder.TOP),
+ new EmptyBorder( 5, 5, 5, 10)
+ )
+ );
+
+ JPanel stack = new JPanel();
+ stack.setLayout( new BoxLayout( stack, BoxLayout.Y_AXIS ) );
+ JPanel working = createWorkingDirectoryPanel();
+ JPanel temp = createTempDirectoryPanel();
+ stack.add( working );
+ stack.add( temp );
+ panel.add( stack, BorderLayout.NORTH );
+ return panel;
+ }
+
+ private JPanel createWorkingDirectoryPanel()
+ {
+ JPanel panel = new JPanel( new BorderLayout() );
+ panel.setBackground( Color.white );
+
+ ImageIcon label =
+ IconHelper.createImageIcon(
+ getClass().getClassLoader(), WORK_ICON_FILENAME, "Working
Directory" );
+ JPanel labelHolder = new JPanel( new BorderLayout() );
+ labelHolder.setBackground( Color.white );
+ labelHolder.setBorder( new EmptyBorder( 3, 0, 0, 10 ) );
+ labelHolder.add( new JLabel( label ), BorderLayout.SOUTH );
+ panel.add( labelHolder, BorderLayout.WEST );
+
+ JPanel stack = new JPanel();
+ stack.setLayout( new BoxLayout( stack, BoxLayout.Y_AXIS ) );
+ stack.setBackground( Color.white );
+ JLabel dirLabel = new JLabel( "Working Directory:" );
+ JPanel dirLabelHolder = new JPanel( new BorderLayout() );
+ dirLabelHolder.add( dirLabel, BorderLayout.WEST );
+ dirLabelHolder.setBackground( Color.white );
+ dirLabelHolder.setBorder( new EmptyBorder( 0, 0, 3, 0 ) );
+ JTextField dirValue = new JTextField( "${user.dir}" );
+ stack.add( dirLabelHolder );
+ stack.add( dirValue );
+
+ JPanel holder = new JPanel( new BorderLayout() );
+ holder.add( stack, BorderLayout.NORTH );
+ panel.add( holder );
+ return panel;
+ }
+
+ private JPanel createTempDirectoryPanel()
+ {
+ JPanel panel = new JPanel( new BorderLayout() );
+ panel.setBackground( Color.white );
+ panel.setBorder( new EmptyBorder( 10, 0, 5, 0 ) );
+
+ ImageIcon label =
+ IconHelper.createImageIcon(
+ getClass().getClassLoader(), TEMP_ICON_FILENAME, "Temp
Directory" );
+ JPanel labelHolder = new JPanel( new BorderLayout() );
+ labelHolder.setBackground( Color.white );
+ labelHolder.setBorder( new EmptyBorder( 3, 0, 0, 10 ) );
+ labelHolder.add( new JLabel( label ), BorderLayout.SOUTH );
+ panel.add( labelHolder, BorderLayout.WEST );
+
+ JPanel stack = new JPanel();
+ stack.setLayout( new BoxLayout( stack, BoxLayout.Y_AXIS ) );
+ stack.setBackground( Color.white );
+ JLabel dirLabel = new JLabel( "Temporary Directory:" );
+ JPanel dirLabelHolder = new JPanel( new BorderLayout() );
+ dirLabelHolder.add( dirLabel, BorderLayout.WEST );
+ dirLabelHolder.setBackground( Color.white );
+ dirLabelHolder.setBorder( new EmptyBorder( 0, 0, 3, 0 ) );
+ JTextField dirValue = new JTextField( "${java.temp.dir}" );
+ stack.add( dirLabelHolder );
+ stack.add( dirValue );
+
+ JPanel holder = new JPanel( new BorderLayout() );
+ holder.add( stack, BorderLayout.NORTH );
+ panel.add( holder );
+ return panel;
}

- private static class ButtonPanel extends Box
+ private class ButtonPanel extends Box
{
- private JButton m_close;
+ private JButton m_close = new JButton();
+ private JButton m_ok = new JButton();
+ private JButton m_revert = new JButton( new RevertAction( "Undo" ) );

- ButtonPanel( JDialog dialog )
+ ButtonPanel( CompositionContentHandlerControlPanel dialog )
{
super( BoxLayout.Y_AXIS );
setBackground( Color.white );

- m_close = new JButton( );
+ OKAction ok = new OKAction( "OK", dialog );
+ m_ok.setAction( ok );
Action closeAction = new CancelAction( "Close", dialog );
m_close.setAction( closeAction );
+
JPanel buttonPanel = new JPanel( new FlowLayout(
FlowLayout.RIGHT ) );
buttonPanel.setBackground( Color.white );
+ buttonPanel.add( m_revert );
+ buttonPanel.add( m_ok );
buttonPanel.add( m_close );
add( buttonPanel );
}
@@ -148,11 +308,11 @@
}
}

- private static class CancelAction extends AbstractAction
+ private class CancelAction extends AbstractAction
{
- private JDialog m_dialog;
+ private CompositionContentHandlerControlPanel m_dialog;

- public CancelAction( String label, JDialog dialog )
+ public CancelAction( String label,
CompositionContentHandlerControlPanel dialog )
{
super( label );
m_dialog = dialog;
@@ -164,8 +324,46 @@
*/
public void actionPerformed( ActionEvent event )
{
+ m_propertyChangeSupport.removePropertyChangeListener( m_dialog );
m_dialog.hide();
}
}

+ private class OKAction extends AbstractAction
+ {
+ private CompositionContentHandlerControlPanel m_dialog;
+
+ OKAction( String name, CompositionContentHandlerControlPanel dialog )
+ {
+ super( name );
+ setEnabled( false );
+ m_dialog = dialog;
+ }
+
+ // TODO: we need a solution in place under which we log
+ // information about preference changes
+
+ public void actionPerformed( ActionEvent event )
+ {
+ m_propertyChangeSupport.removePropertyChangeListener( m_dialog );
+ m_dialog.hide();
+ }
+ }
+
+ private class RevertAction extends AbstractAction
+ {
+ RevertAction( String name )
+ {
+ super( name );
+ setEnabled( false );
+ }
+
+ public void actionPerformed( ActionEvent event )
+ {
+ PropertyChangeEvent e =
+ new PropertyChangeEvent(
+ this, "revert", null, null );
+ m_propertyChangeSupport.firePropertyChange( e );
+ }
+ }
}

Added:
development/main/metro/composition/unit/src/main/net/dpml/composition/unit/images/source.png
==============================================================================
Binary file. No diff available.

Added:
development/main/metro/composition/unit/src/main/net/dpml/composition/unit/images/temp.png
==============================================================================
Binary file. No diff available.

Added:
development/main/metro/composition/unit/src/main/net/dpml/composition/unit/images/working.png
==============================================================================
Binary file. No diff available.



  • svn commit: r2553 - in development/main/metro/composition/unit: . src/main/net/dpml/composition/unit src/main/net/dpml/composition/unit/images, mcconnell, 05/13/2005

Archive powered by MHonArc 2.6.24.

Top of Page