Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2675 - in development/main/test: . plugins plugins/layout plugins/layout/src plugins/layout/src/main plugins/layout/src/main/net plugins/layout/src/main/net/dpml plugins/layout/src/main/net/dpml/test plugins/layout/src/main/net/dpml/test/layout

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: r2675 - in development/main/test: . plugins plugins/layout plugins/layout/src plugins/layout/src/main plugins/layout/src/main/net plugins/layout/src/main/net/dpml plugins/layout/src/main/net/dpml/test plugins/layout/src/main/net/dpml/test/layout
  • Date: Mon, 30 May 2005 10:00:36 -0400

Author: mcconnell AT dpml.net
Date: Mon May 30 10:00:36 2005
New Revision: 2675

Added:
development/main/test/plugins/
development/main/test/plugins/build.xml
development/main/test/plugins/index.xml
development/main/test/plugins/layout/ (props changed)
development/main/test/plugins/layout/build.xml
development/main/test/plugins/layout/src/
development/main/test/plugins/layout/src/main/
development/main/test/plugins/layout/src/main/net/
development/main/test/plugins/layout/src/main/net/dpml/
development/main/test/plugins/layout/src/main/net/dpml/test/
development/main/test/plugins/layout/src/main/net/dpml/test/layout/

development/main/test/plugins/layout/src/main/net/dpml/test/layout/DemoLayout.java

development/main/test/plugins/layout/src/main/net/dpml/test/layout/DemoLayoutControlPanel.java

development/main/test/plugins/layout/src/main/net/dpml/test/layout/menu.png
(contents, props changed)

development/main/test/plugins/layout/src/main/net/dpml/test/layout/tools.png
(contents, props changed)
Modified:
development/main/test/README.TXT
development/main/test/index.xml
Log:
Add test layout plugin.

Modified: development/main/test/README.TXT
==============================================================================
--- development/main/test/README.TXT (original)
+++ development/main/test/README.TXT Mon May 30 10:00:36 2005
@@ -23,10 +23,15 @@
interfaces, and context management by a managing
component.

- plus - The project contains a component that manages the
+ plus - The project contains a component that manages the
state of another component, and a component that
manages the configuration of another component.

+ test/plugins
+
+ layout - A plugin that provides classic repository layout support
+ used to validate pluggable layout strategies under Transit.
+
test/unit

simple - The test/unit/simple/build.xml contains lots of examples

Modified: development/main/test/index.xml
==============================================================================
--- development/main/test/index.xml (original)
+++ development/main/test/index.xml Mon May 30 10:00:36 2005
@@ -8,6 +8,7 @@
<import uri="${dpml.metro.uri}"/>

<import index="components/index.xml" />
+ <import index="plugins/index.xml" />
<import index="unit/index.xml" />

</index>

Added: development/main/test/plugins/build.xml
==============================================================================
--- (empty file)
+++ development/main/test/plugins/build.xml Mon May 30 10:00:36 2005
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Copyright 2005 Stephen J McConnell
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied.
+
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<project name="dpml-test-plugins" default="default" basedir="."
+ xmlns:transit="antlib:net.dpml.transit">
+
+ <transit:import uri="artifact:template:dpml/magic/reactor"/>
+
+</project>

Added: development/main/test/plugins/index.xml
==============================================================================
--- (empty file)
+++ development/main/test/plugins/index.xml Mon May 30 10:00:36 2005
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<index>
+
+ <import index="../index.xml"/>
+
+ <project basedir="layout">
+ <info>
+ <group>dpml/test</group>
+ <name>dpml-test-layout</name>
+ <types>
+ <type>jar</type>
+ <type>plugin</type>
+ </types>
+ </info>
+ <dependencies>
+ <include key="dpml-transit-main"/>
+ <include key="dpml-depot-prefs"/>
+ </dependencies>
+ </project>
+
+</index>

Added: development/main/test/plugins/layout/build.xml
==============================================================================
--- (empty file)
+++ development/main/test/plugins/layout/build.xml Mon May 30 10:00:36
2005
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="dpml-test-layout" default="install" basedir="."
+ xmlns:transit="antlib:net.dpml.transit"
+ xmlns:x="plugin:dpml/magic/dpml-magic-core">
+
+ <transit:import uri="artifact:template:dpml/magic/standard"/>
+
+ <target name="init" depends="standard.init">
+ <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">
+ <x:export class="net.dpml.test.layout.DemoLayout"/>
+ </target>
+
+</project>

Added:
development/main/test/plugins/layout/src/main/net/dpml/test/layout/DemoLayout.java
==============================================================================
--- (empty file)
+++
development/main/test/plugins/layout/src/main/net/dpml/test/layout/DemoLayout.java
Mon May 30 10:00:36 2005
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2005 Stephen J. McConnell.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.test.layout;
+
+import net.dpml.transit.artifact.Artifact;
+import net.dpml.transit.layout.Layout;
+
+/**
+ * A layout manager used to vaidate plugin layout handlers in Transit.
+ * The implementation is a strait copy of the classic layout handler.
+ */
+public class DemoLayout implements Layout
+{
+ /**
+ * Return the base path for an artifact. The base path is derived from
+ * the artifact group and type. For an artifact group of "metro/cache"
and a
+ * type equal to "jar", the base value will be translated using the
pattern
+ * "[group]/[type]s" to form "metro/cache/jars". The base path value
represents
+ * the directory path relative to a repository root of the directory
containing
+ * this artifact.
+ *
+ * @return the base path
+ */
+ public final String resolveBase( Artifact artifact )
+ {
+ return artifact.getGroup() + "/" + artifact.getType() + "s";
+ }
+
+ /**
+ * Returns the full path of the artifact relative to a logical root
directory.
+ * The full path is equivalent to the base path and artifact filename
using the
+ * pattern "[base]/[filename]". Path values may be used to resolve an
artifact
+ * from a remote repository or local cache relative to the repository or
cache
+ * root. An artifact such as
<code>artifact:jar:metro/cache/dpml-cache-main#1.0.0</code>
+ * would return the path
<code>metro/cache/jars/dpml-cache-main-1.0.0.jar</code>.
+ *
+ * @see #resolveBase
+ * @see #resolveFilename
+ * @return the logical artifact path
+ */
+ public final String resolvePath( Artifact artifact )
+ {
+ return resolveBase( artifact ) + "/" + resolveFilename( artifact );
+ }
+
+ /**
+ * Return the expanded filename of the artifact. The filename is
expressed
+ * as [name]-[version].[type] or in case of a null version simply
[name].[type].
+ *
+ * @return the artifact expanded filename
+ */
+ public String resolveFilename( Artifact artifact )
+ {
+ String ver = artifact.getVersion();
+ if( null == ver )
+ {
+ return artifact.getName() + "." + artifact.getType();
+ }
+ else
+ {
+ return artifact.getName() + "-" + ver + "." + artifact.getType();
+ }
+ }
+
+}

Added:
development/main/test/plugins/layout/src/main/net/dpml/test/layout/DemoLayoutControlPanel.java
==============================================================================
--- (empty file)
+++
development/main/test/plugins/layout/src/main/net/dpml/test/layout/DemoLayoutControlPanel.java
Mon May 30 10:00:36 2005
@@ -0,0 +1,327 @@
+/*
+ * Copyright 2005 Stephen McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.test.layout;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.awt.Dialog;
+import java.awt.Dimension;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import javax.swing.JDialog;
+import javax.swing.border.EmptyBorder;
+import javax.swing.JPanel;
+import javax.swing.Action;
+import javax.swing.AbstractAction;
+import javax.swing.JLabel;
+import javax.swing.JTabbedPane;
+import javax.swing.JButton;
+import javax.swing.BoxLayout;
+import javax.swing.Box;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.TitledBorder;
+import javax.swing.ImageIcon;
+import javax.swing.JTextField;
+
+import net.dpml.transit.manager.LayoutManager;
+
+import net.dpml.depot.prefs.IconHelper;
+
+/**
+ * A registry of descriptions of plugable content handlers. This
implementation
+ * maps user defined preferences to instance of ContentHandlerDescriptor.
+ */
+public class DemoLayoutControlPanel extends JDialog implements
PropertyChangeListener
+{
+
//--------------------------------------------------------------------------
+ // state
+
//--------------------------------------------------------------------------
+
+ private PropertyChangeSupport m_propertyChangeSupport;
+
+ private LayoutManager m_manager;
+
+
//--------------------------------------------------------------------------
+ // constructor
+
//--------------------------------------------------------------------------
+
+ public DemoLayoutControlPanel( Dialog parent, LayoutManager manager )
+ {
+ super( parent );
+
+ m_propertyChangeSupport = new PropertyChangeSupport( this );
+
+ setTitle( "Transit Test Layout Plugin" );
+ setModal( true );
+ setBackground( Color.white );
+
+ // create the header label
+
+ JLabel header = createHeaderLabel();
+
+ // create the body content
+
+ JPanel body = createBodyContent( this );
+ body.setBorder( new EmptyBorder( 0, 7, 7, 7 ) );
+
+ // create the buttons in the footer
+
+ ButtonPanel buttons = new ButtonPanel( this );
+ buttons.setBorder( new EmptyBorder( 0, 7, 7, 7 ) );
+
+ //
+ // package
+ //
+
+ JPanel assembly = new JPanel( new BorderLayout() );
+ assembly.setBackground( Color.white );
+ assembly.add( header, BorderLayout.NORTH );
+ assembly.add( body, BorderLayout.CENTER );
+ assembly.add( buttons, BorderLayout.SOUTH );
+ setContentPane( assembly );
+
+ setSize( new Dimension( 400, 300 ) );
+ 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 layout.
+ */
+ public void propertyChange( PropertyChangeEvent event )
+ {
+ // TODO
+ }
+
+
//--------------------------------------------------------------------------
+ // internals
+
//--------------------------------------------------------------------------
+
+ private JLabel createHeaderLabel()
+ {
+ JLabel label =
+ IconHelper.createImageIconJLabel(
+ getClass().getClassLoader(), TOOLS_ICON_FILENAME, "", "DPML Test
Layout Plugin" );
+ label.setBorder( new EmptyBorder( 15, 10, 10, 10 ) );
+ return label;
+ }
+
+ private JPanel createBodyContent( JDialog parent )
+ {
+ JPanel panel = new JPanel( new BorderLayout() );
+ panel.setBackground( Color.white );
+ JPanel stack = createStack();
+ panel.add( stack, BorderLayout.NORTH );
+ return panel;
+ }
+
+ private JPanel createStack()
+ {
+ JPanel stack = new JPanel();
+ stack.setLayout( new BoxLayout( stack, BoxLayout.Y_AXIS ) );
+ stack.setBackground( Color.white );
+ JPanel spec = createPluginSpecPanel();
+ JPanel name = createFeaturesPanel();
+ stack.add( spec );
+ stack.add( name );
+ 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)
+ )
+ );
+
+ 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 );
+
+ JPanel holder = new JPanel( new BorderLayout() );
+ holder.add( stack, BorderLayout.NORTH );
+ panel.add( holder );
+ return panel;
+ }
+
+ private JPanel createFeaturesPanel()
+ {
+ JPanel panel = new JPanel( new BorderLayout() );
+ panel.setBackground( Color.white );
+ panel.setBorder(
+ new CompoundBorder(
+ new TitledBorder(
+ null, "Layout Features", TitledBorder.LEFT, TitledBorder.TOP),
+ new EmptyBorder( 5, 5, 5, 10)
+ )
+ );
+
+ JPanel stack = new JPanel();
+ stack.setLayout( new BoxLayout( stack, BoxLayout.Y_AXIS ) );
+ JPanel working = createTitlePanel();
+ stack.add( working );
+ panel.add( stack, BorderLayout.NORTH );
+ return panel;
+ }
+
+ private JPanel createTitlePanel()
+ {
+ JPanel panel = new JPanel( new BorderLayout() );
+ panel.setBackground( Color.white );
+
+ JPanel stack = new JPanel();
+ stack.setLayout( new BoxLayout( stack, BoxLayout.Y_AXIS ) );
+ stack.setBackground( Color.white );
+ JLabel dirLabel = new JLabel( "Title:" );
+ 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( "Demo Layout" );
+ stack.add( dirLabelHolder );
+ stack.add( dirValue );
+
+ JPanel holder = new JPanel( new BorderLayout() );
+ holder.add( stack, BorderLayout.NORTH );
+ panel.add( holder );
+ return panel;
+ }
+
+ private class ButtonPanel extends Box
+ {
+ private JButton m_close = new JButton();
+ private JButton m_ok = new JButton();
+ private JButton m_revert = new JButton( new RevertAction( "Undo" ) );
+
+ ButtonPanel( DemoLayoutControlPanel dialog )
+ {
+ super( BoxLayout.Y_AXIS );
+ setBackground( Color.white );
+
+ 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 );
+ }
+
+ JButton getDefaultButton()
+ {
+ return m_close;
+ }
+ }
+
+ private class CancelAction extends AbstractAction
+ {
+ private DemoLayoutControlPanel m_dialog;
+
+ public CancelAction( String label, DemoLayoutControlPanel dialog )
+ {
+ super( label );
+ m_dialog = dialog;
+ }
+
+ /**
+ * Called when the cancel button is trigged.
+ * @param event the action event
+ */
+ public void actionPerformed( ActionEvent event )
+ {
+ m_propertyChangeSupport.removePropertyChangeListener( m_dialog );
+ m_dialog.hide();
+ }
+ }
+
+ private class OKAction extends AbstractAction
+ {
+ private DemoLayoutControlPanel m_dialog;
+
+ OKAction( String name, DemoLayoutControlPanel dialog )
+ {
+ super( name );
+ setEnabled( false );
+ m_dialog = dialog;
+ }
+
+ public void actionPerformed( ActionEvent event )
+ {
+ m_dialog.hide();
+ m_propertyChangeSupport.removePropertyChangeListener( m_dialog );
+ }
+ }
+
+ 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 );
+ }
+ }
+
+
//--------------------------------------------------------------------------
+ // static (utils)
+
//--------------------------------------------------------------------------
+
+ private static String TOOLS_ICON_FILENAME =
"net/dpml/test/layout/tools.png";
+
+ private static String MENU_ICON_FILENAME =
"net/dpml/test/layout/menu.png";
+
+ private static String PLUGIN_VERSION = "@VERSION@";
+
+ private static String PLUGIN_GROUP = "@GROUP@";
+
+ private static String PLUGIN_NAME = "@NAME@";
+}

Added:
development/main/test/plugins/layout/src/main/net/dpml/test/layout/menu.png
==============================================================================
Binary file. No diff available.

Added:
development/main/test/plugins/layout/src/main/net/dpml/test/layout/tools.png
==============================================================================
Binary file. No diff available.



  • svn commit: r2675 - in development/main/test: . plugins plugins/layout plugins/layout/src plugins/layout/src/main plugins/layout/src/main/net plugins/layout/src/main/net/dpml plugins/layout/src/main/net/dpml/test plugins/layout/src/main/net/dpml/test/layout, mcconnell, 05/29/2005

Archive powered by MHonArc 2.6.24.

Top of Page