cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject svn commit: r306640 - in /cocoon/whiteboard/guilder: ./ java/ java/org/ java/org/apache/ java/org/apache/cocoon/ java/org/apache/cocoon/builder/ java/org/apache/cocoon/guilder/ java/org/apache/cocoon/guilder/block/ java/org/apache/cocoon/guilder/proper...
Date Thu, 06 Oct 2005 13:30:24 GMT
Author: ugo
Date: Thu Oct  6 06:30:10 2005
New Revision: 306640

URL: http://svn.apache.org/viewcvs?rev=306640&view=rev
Log:
First commit of Guilder (GUI Builder and Console)

Added:
    cocoon/whiteboard/guilder/
    cocoon/whiteboard/guilder/build.xml   (with props)
    cocoon/whiteboard/guilder/guilder.properties   (with props)
    cocoon/whiteboard/guilder/java/
    cocoon/whiteboard/guilder/java/org/
    cocoon/whiteboard/guilder/java/org/apache/
    cocoon/whiteboard/guilder/java/org/apache/cocoon/
    cocoon/whiteboard/guilder/java/org/apache/cocoon/builder/
    cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/
    cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/BlocksPane.java   (with props)
    cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/CommandExecutor.java   (with props)
    cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/Console.java   (with props)
    cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/JettyManager.java   (with props)
    cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/PropertiesPanel.java   (with props)
    cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/
    cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Block.java   (with props)
    cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Blocks.java   (with props)
    cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/BlocksPanelListener.java   (with props)
    cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/gump2xhtml.xsl   (with props)
    cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/properties/
    cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/properties/PropertiesManager.java   (with props)

Added: cocoon/whiteboard/guilder/build.xml
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/guilder/build.xml?rev=306640&view=auto
==============================================================================
--- cocoon/whiteboard/guilder/build.xml (added)
+++ cocoon/whiteboard/guilder/build.xml Thu Oct  6 06:30:10 2005
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  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.
+-->
+
+<!-- Version: $Id$ -->
+
+<project name="guilder" default="install" basedir=".">    
+ 
+  <target name="init">
+    <property file="local.guilder.properties"/>
+    <property file="guilder.properties"/>    
+  </target>   
+
+  <target name="prepare">
+    <mkdir dir="build"/>
+    <mkdir dir="build/classes"/>
+    <mkdir dir="build/dist"/>
+  </target>
+    
+  <target name="compile" depends="init, prepare">
+    <javac srcdir="java" debug="on" deprecation="on" destdir="build/classes" target="1.3" source="1.3"/>
+    <copy 
+      file="java/org/apache/cocoon/guilder/block/gump2xhtml.xsl" 
+      todir="build/classes/org/apache/cocoon/guilder/block"/>
+  </target>
+ 
+  <target name="package" depends="compile">
+    <jar destfile="build/dist/${ant.project.name}-${version}.jar" basedir="build/classes">
+      <manifest>
+        <attribute name="Built-By" value="${user.name}"/>
+        <attribute name="Main-Class" value="org.apache.cocoon.guilder.Console"/>
+        <attribute name="class-path" value="../../lib/endorsed/xercesImpl-2.7.1.jar ../../lib/endorsed/xml-apis-1.3.02.jar"/>
+      </manifest>
+    </jar>
+  </target>
+    
+  <target name="install" depends="package">
+    <copy tofile="${cocoon.project.home}/tools/lib/${ant.project.name}.jar" file="build/dist/${ant.project.name}-${version}.jar"/>
+  </target>
+ 
+  <target name="clean" depends="init">
+    <delete dir="build"/>
+    <delete file="${cocoon.project.home}/tools/lib/${ant.project.name}.jar"/>
+  </target>
+    
+</project>

Propchange: cocoon/whiteboard/guilder/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/guilder/build.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/whiteboard/guilder/guilder.properties
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/guilder/guilder.properties?rev=306640&view=auto
==============================================================================
--- cocoon/whiteboard/guilder/guilder.properties (added)
+++ cocoon/whiteboard/guilder/guilder.properties Thu Oct  6 06:30:10 2005
@@ -0,0 +1,16 @@
+#  Copyright 1999-2005 The Apache Software Foundation
+#
+#  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.
+
+cocoon.project.home=../../branches/BRANCH_2_1_X
+version=1.0-b1

Propchange: cocoon/whiteboard/guilder/guilder.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/guilder/guilder.properties
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/BlocksPane.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/BlocksPane.java?rev=306640&view=auto
==============================================================================
--- cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/BlocksPane.java (added)
+++ cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/BlocksPane.java Thu Oct  6 06:30:10 2005
@@ -0,0 +1,176 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * 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 org.apache.cocoon.guilder;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemListener;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+
+import org.apache.cocoon.guilder.block.Block;
+import org.apache.cocoon.guilder.block.Blocks;
+
+/**
+ * 
+ * Description of BlocksPane.
+ * 
+ * @version CVS $Id$
+ */
+public class BlocksPane extends JPanel {
+
+    private static final long serialVersionUID = 1L;
+    protected ListBlocks list;
+    protected DescBlock desc;
+    
+    private String status;
+    protected Blocks blocks;
+    private ItemListener listener;
+    
+    public BlocksPane(Blocks blocks, ItemListener listener) {
+        this.blocks = blocks;
+        this.listener = listener;            
+        this.setLayout(new BorderLayout());
+    }
+    
+    public void setStatus(String status) {
+        this.status = status;
+    }
+    
+    public String getStatus() {
+        return this.status;
+    }
+    
+    public JPanel getList() {
+        return this.list;
+    }
+    
+    public void createList() {
+        this.desc = new DescBlock();
+        DescriptionListener descListener = new DescriptionListener();
+        this.list = new ListBlocks(this.status, this.blocks, descListener, this.listener);
+        this.list.setName(this.getName() + " Panel");
+        JScrollPane scroll = new JScrollPane(this.list);
+        scroll.setPreferredSize(new Dimension(250, 300));
+        this.add(scroll, BorderLayout.WEST);
+        this.desc.setPreferredSize(new Dimension(250, 300));
+        this.add(this.desc, BorderLayout.EAST);        
+    }
+        
+    private class ListBlocks extends JPanel {
+        
+        private static final long serialVersionUID = 1L;
+        private Map blocksMap;
+
+        public ListBlocks(String status, Blocks blocks, ActionListener buttonListener, ItemListener checkListener) {
+            GridBagConstraints gbc = new GridBagConstraints();
+            
+            this.setLayout(new GridBagLayout());
+            
+            this.blocksMap = blocks.getBlocks();
+            Iterator keys = this.blocksMap.keySet().iterator();
+            for (int i = 0; keys.hasNext(); i++) {
+                String blockName = (String) keys.next();
+                Block block = (Block) this.blocksMap.get(blockName);
+                if (block.getStatus().equals(status)) {
+                    JCheckBox check = new JCheckBox();
+                    check.setName(block.getName());
+                    check.setSelected(block.isSelected());
+                    if (block.getNeed() > 0) {
+                        check.setToolTipText("Block " + block.getName() + " can't be disabled because it depends on");
+                        check.setEnabled(false);
+                    }
+                    check.addItemListener(checkListener);   
+                    
+                    JButton info = new JButton("info");
+                    info.setName(block.getName());
+                    info.setText(block.getName());
+                    info.setSize(10, 5);
+                    info.addActionListener(buttonListener);
+                    
+                    gbc.insets.top=3;
+                    gbc.insets.bottom=3;
+                    gbc.weightx=100;
+                    gbc.fill=GridBagConstraints.HORIZONTAL;
+                    gbc.anchor=GridBagConstraints.FIRST_LINE_START;
+                    
+                    gblAdd(this, info, gbc, 0, i, 1, 1);
+                    gblAdd(this, check, gbc, 1, i, 1, 1);                    
+                }
+            }
+            
+            this.setVisible(true);
+        }
+               
+        /** Adds a component to a container, using the GridBagLayout and associated constraints.
+         *  @param container The container which adding the component to.
+         *  @param comp The component to add.
+         *  @param con Constraints for the component position.
+         *  @param x X position.
+         *  @param y Y position.
+         *  @param w Component width.
+         *  @param h Component height.
+         */
+        private void gblAdd(Container container, Component comp, GridBagConstraints con, int x, int y, int w, int h) {
+            con.gridx=x;
+            con.gridy=y;
+            con.gridwidth=w;
+            con.gridheight=h;
+            container.add(comp,con);
+        }
+    }
+
+    private class DescBlock extends JPanel {
+        
+        private static final long serialVersionUID = 1L;
+        private JLabel label;
+              
+        public DescBlock() {
+            this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
+            this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+            this.label = new JLabel("<html><b><i>Block's description</i></b></html>");
+            this.add(this.label);
+        }
+                
+        public void setLabel(String newLabel) {
+            this.label.setText(newLabel);
+        }
+        
+    }
+    
+    private class DescriptionListener implements ActionListener {
+        public void actionPerformed(ActionEvent e) {
+            Block block = (Block) blocks.getBlocks().get(e.getActionCommand());
+            desc.setLabel(block.getBlockDescription());
+        }
+        
+    }
+    
+}

Propchange: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/BlocksPane.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/BlocksPane.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/CommandExecutor.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/CommandExecutor.java?rev=306640&view=auto
==============================================================================
--- cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/CommandExecutor.java (added)
+++ cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/CommandExecutor.java Thu Oct  6 06:30:10 2005
@@ -0,0 +1,40 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * 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 org.apache.cocoon.guilder;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+/**
+ * 
+ * Description of CommandExecutor.
+ * 
+ * @version CVS $Id$
+ */
+public class CommandExecutor {
+    
+    public Process executeCommand(String command) throws IOException {
+        Process process = Runtime.getRuntime().exec(command);
+        BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+        String line;
+        while ((line = reader.readLine()) != null) {
+            System.out.println(line);
+        }
+        return process;
+    }
+    
+}

Propchange: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/CommandExecutor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/CommandExecutor.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/Console.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/Console.java?rev=306640&view=auto
==============================================================================
--- cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/Console.java (added)
+++ cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/Console.java Thu Oct  6 06:30:10 2005
@@ -0,0 +1,228 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * 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 org.apache.cocoon.guilder;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.io.IOException;
+
+import javax.swing.AbstractButton;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JTabbedPane;
+import javax.swing.SwingUtilities;
+
+import org.apache.cocoon.guilder.block.Block;
+import org.apache.cocoon.guilder.block.Blocks;
+import org.apache.cocoon.guilder.block.BlocksPanelListener;
+
+/**
+ * 
+ * Description of CocoonBuilder.
+ * 
+ * @version CVS $Id$
+ */
+public class Console extends JPanel implements ActionListener, ItemListener {
+
+    private Blocks blocks;
+    private PropertiesPanel propertiesPanel;
+    protected JettyManager jm;
+
+    /**
+     * 
+     */
+    public static void main(String[] args) {
+        //Schedule a job for the event-dispatching thread:
+        //creating and showing this application's GUI.
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                createAndShowGUI();
+            }
+        });        
+    }
+    
+    public Console() {  
+        super(new BorderLayout());
+        this.blocks = new Blocks();
+                
+        JTabbedPane tabbedPane = new JTabbedPane();
+        BlocksPanelListener blocksListener = new BlocksPanelListener(this.blocks.getBlocks(), this.blocks.getProperties());
+
+        BlocksPane stableBlocks = new BlocksPane(this.blocks, blocksListener);
+        stableBlocks.setStatus(Block.STATUS_STABLE);
+        stableBlocks.setName("Stable Blocks");
+        stableBlocks.createList();
+        tabbedPane.addTab(stableBlocks.getName(), stableBlocks);
+        BlocksPane unstableBlocks = new BlocksPane(this.blocks, blocksListener);
+        unstableBlocks.setStatus(Block.STATUS_UNSTABLE);
+        unstableBlocks.setName("Unstable Blocks");
+        unstableBlocks.createList();
+        tabbedPane.addTab(unstableBlocks.getName(), unstableBlocks);
+        BlocksPane deprecatedBlocks = new BlocksPane(this.blocks, blocksListener);
+        deprecatedBlocks.setStatus(Block.STATUS_DEPRECATED);
+        deprecatedBlocks.setName("Deprecated Blocks");
+        deprecatedBlocks.createList();
+        tabbedPane.addTab(deprecatedBlocks.getName(), deprecatedBlocks);
+        propertiesPanel = new PropertiesPanel();
+        propertiesPanel.setName("Properties");
+        tabbedPane.addTab(propertiesPanel.getName(), propertiesPanel);
+        blocksListener.addPanel(stableBlocks.getList());
+        blocksListener.addPanel(unstableBlocks.getList());
+        blocksListener.addPanel(deprecatedBlocks.getList());
+
+        //Add the tabbed pane to this panel.
+        this.add(tabbedPane, BorderLayout.NORTH);
+        
+        //Radio button for blocks selection
+        JPanel radios = new JPanel(new FlowLayout());
+        JRadioButton includeAll = new JRadioButton("include all");
+        includeAll.setActionCommand("includeAll");
+        includeAll.addItemListener(this);
+        JRadioButton excludeAll = new JRadioButton("exclude all");
+        excludeAll.setActionCommand("excludeAll");
+        excludeAll.addItemListener(this);
+        JRadioButton custom = new JRadioButton("custom");
+        custom.setActionCommand("customSelection");
+        custom.addItemListener(this);
+        ButtonGroup group = new ButtonGroup();
+        group.add(includeAll);
+        group.add(excludeAll);
+        group.add(custom);
+        if (this.blocks.getProperties().getProperty("exclude.all.blocks") != null 
+                && this.blocks.getProperties().getProperty("exclude.all.blocks").equals("true")) {
+            excludeAll.setSelected(true);
+        } else if (this.blocks.getProperties().getProperty("include.all.blocks") != null
+                && this.blocks.getProperties().getProperty("include.all.blocks").equals("true")) {
+            includeAll.setSelected(true);
+        } else {
+            custom.setSelected(true);
+        }
+        radios.add(includeAll);
+        radios.add(excludeAll);
+        radios.add(custom);
+        this.add(radios, BorderLayout.CENTER);
+        
+        //Buttons                
+        JPanel buttons = new JPanel(new FlowLayout());
+        JButton save = new JButton("Save");
+        save.addActionListener(this);
+        buttons.add(save);
+        JButton cancel = new JButton("Build");
+        cancel.addActionListener(this);
+        buttons.add(cancel);
+        JButton jettyButton = new JButton("Start Jetty");
+        jettyButton.addActionListener(this);
+        buttons.add(jettyButton);
+        this.add(buttons, BorderLayout.SOUTH);
+    }
+    
+    /**
+     * Create the GUI and show it.  For thread safety,
+     * this method should be invoked from the
+     * event-dispatching thread.
+     */
+    protected static void createAndShowGUI() {
+        //Make sure we have nice window decorations.
+        JFrame.setDefaultLookAndFeelDecorated(true);
+
+        //Create and set up the window.
+        JFrame frame = new JFrame("Guilder");
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setSize(600,600);
+        frame.setResizable(false);
+
+        //Create and set up the content pane.
+        JComponent newContentPane = new Console();
+        newContentPane.setOpaque(true); //content panes must be opaque
+        frame.getContentPane().add(newContentPane,
+                                 BorderLayout.CENTER);
+        //Display the window.
+        frame.pack();
+        frame.setVisible(true);
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        if (e.getActionCommand().equals("Save")) {
+            this.blocks.save();
+            this.propertiesPanel.save();
+        } else if (e.getActionCommand().equals("Build")) {
+            String os = System.getProperty("os.name");
+            String command = null;
+            if (os.equals("Linux") || os.equals("Mac OS X")) {
+                command = "./build.sh";
+            } else if (os.startsWith("Win")) {
+                command = "build.bat";
+            } else {
+                System.out.println("OS: " + os);
+                System.out.println("Your OS is not supported, please report it.");
+            }
+            CommandExecutor ce = new CommandExecutor();
+            try {
+                ce.executeCommand(command);
+            } catch (IOException e1) {
+                e1.printStackTrace();
+            }
+        } else if (e.getActionCommand().equals("Start Jetty")) {
+            JButton start = (JButton) e.getSource();
+            start.setText("Stop Jetty");
+            this.jm = new JettyManager();
+            Runnable runnable = new Runnable() {
+                public void run() {
+                    jm.start();
+                }
+            };
+            new Thread(runnable).start();
+        } else if (e.getActionCommand().equals("Stop Jetty")) {
+            JButton stop = (JButton) e.getSource();
+            stop.setText("Start Jetty");
+            jm.stop();
+        } else {
+            System.out.println("Unknown Command: " + e.getActionCommand());
+        }        
+    }
+
+    public void itemStateChanged(ItemEvent e) {
+        AbstractButton item = (AbstractButton) e.getItem();
+        if (e.getStateChange() == ItemEvent.SELECTED) {
+            if (item.getActionCommand().equals("excludeAll")) {
+                this.blocks.getProperties().put("exclude.all.blocks", "true");
+            } else if (item.getActionCommand().equals("includeAll")) {
+                this.blocks.getProperties().put("include.all.blocks", "true");
+            } else if (item.getActionCommand().equals("customSelection")) {
+            } else {
+                System.out.println("Unknown Command: " + item.getActionCommand());
+            }            
+        } else {
+            if (item.getActionCommand().equals("excludeAll")) {
+                this.blocks.getProperties().remove("exclude.all.blocks");
+            } else if (item.getActionCommand().equals("includeAll")) {
+                this.blocks.getProperties().remove("include.all.blocks");
+            } else if (item.getActionCommand().equals("customSelection")) {
+            } else {
+                System.out.println("Unknown Command: " + item.getActionCommand());
+            }                        
+        }
+    }
+
+}

Propchange: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/Console.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/Console.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/JettyManager.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/JettyManager.java?rev=306640&view=auto
==============================================================================
--- cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/JettyManager.java (added)
+++ cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/JettyManager.java Thu Oct  6 06:30:10 2005
@@ -0,0 +1,84 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * 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 org.apache.cocoon.guilder;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+
+/**
+ * 
+ * Description of JettyManager.
+ * 
+ * @version CVS $Id$
+ */
+public class JettyManager {
+
+    private Process jetty;
+
+    public void start() {
+        String os = System.getProperty("os.name");
+        String command = null;
+        if (os.equals("Linux") || os.equals("Mac OS X")) {
+            command = "./cocoon.sh servlet";
+        } else if (os.startsWith("Win")) {
+            command = "cocoon.bat servlet";
+        } else {
+            System.out.println("OS: " + os);
+            System.out.println("Your OS is not supported, please report it.");
+        }
+        try {
+            this.jetty = Runtime.getRuntime().exec(command);
+            BufferedReader stdinReader = new BufferedReader(new InputStreamReader(
+                    this.jetty.getInputStream()));
+            BufferedReader stderrReader = new BufferedReader(new InputStreamReader(
+                    this.jetty.getErrorStream()));
+            String stdinLine = "";
+            String stderrLine = "";
+            while ((stdinLine = stdinReader.readLine()) != null 
+                    || (stderrLine = stderrReader.readLine()) != null) {
+                if (stdinLine != null && !stdinLine.trim().equals("")) {
+                    System.out.println(stdinLine);                    
+                }
+                if (stderrLine != null && !stderrLine.trim().equals("")) {
+                    System.out.println(stderrLine);
+                }
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void stop() {
+        try {
+            OutputStream os = this.jetty.getOutputStream();
+            //os.write("ctrl+c".getBytes());
+            os.write(0x03);
+            os.write(("\r\n").getBytes());
+            os.flush();
+            os.close();
+            this.jetty.destroy();
+            Thread.sleep(3000);
+            System.out.println("exitcode: " + this.jetty.exitValue());
+        } catch (IOException e) {
+            e.printStackTrace();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+    }
+
+}

Propchange: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/JettyManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/JettyManager.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/PropertiesPanel.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/PropertiesPanel.java?rev=306640&view=auto
==============================================================================
--- cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/PropertiesPanel.java (added)
+++ cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/PropertiesPanel.java Thu Oct  6 06:30:10 2005
@@ -0,0 +1,92 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * 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 org.apache.cocoon.guilder;
+
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.Properties;
+
+import javax.swing.BoxLayout;
+import javax.swing.JCheckBox;
+import javax.swing.JPanel;
+
+import org.apache.cocoon.guilder.properties.PropertiesManager;
+
+/**
+ * 
+ * Description of PropertiesPanel.
+ * 
+ * @version CVS $Id$
+ */
+public class PropertiesPanel extends JPanel implements ItemListener {
+    
+    private static final long serialVersionUID = 1L;
+    
+    public static final String BUILD_PROPERTIES_PATH = "build.properties";
+    public static final String LOCAL_BUILD_PROPERTIES_PATH = "local.build.properties";
+
+    private static Properties properties;
+    
+    public PropertiesPanel() {
+        if (properties == null) {
+            PropertiesManager propertiesManager = new PropertiesManager();
+            properties = propertiesManager.getProperties(BUILD_PROPERTIES_PATH);        
+            propertiesManager = new PropertiesManager(properties);
+            properties = propertiesManager.getProperties(LOCAL_BUILD_PROPERTIES_PATH);
+        }
+        this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
+        this.addComponents();
+    }
+    
+    public Properties getProperties() {
+        return properties;
+    }
+    
+    private void addComponents() {
+        addCheckBox("exclude.webapp.documentation");
+        addCheckBox("exclude.webapp.javadocs");
+        addCheckBox("exclude.webapp.samples");
+        addCheckBox("exclude.deprecated");
+        addCheckBox("exclude.documentation");
+        addCheckBox("exclude.javadocs");
+        addCheckBox("include.sources-in-jars");
+        addCheckBox("exclude.validate.xdocs");
+    }
+    
+    private void addCheckBox(String text) {
+        JCheckBox check = new JCheckBox();
+        check.setText(text);
+        if (properties.getProperty(text) != null && properties.getProperty(text).equals("true")) {
+            check.setSelected(true);
+        }
+        check.addItemListener(this);
+        this.add(check);        
+    }
+
+    public void itemStateChanged(ItemEvent e) {
+        JCheckBox check = (JCheckBox) e.getItem();
+        if (e.getStateChange() == ItemEvent.SELECTED) {            
+            properties.put(check.getText(), "true");
+        } else {
+            properties.remove(check.getText());
+        }
+    }
+    
+    public void save() {
+        new PropertiesManager(properties).writeProperties(LOCAL_BUILD_PROPERTIES_PATH);
+    }
+
+}

Propchange: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/PropertiesPanel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/PropertiesPanel.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Block.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Block.java?rev=306640&view=auto
==============================================================================
--- cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Block.java (added)
+++ cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Block.java Thu Oct  6 06:30:10 2005
@@ -0,0 +1,178 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * 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 org.apache.cocoon.guilder.block;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 
+ * Description of Block.
+ * 
+ * @version CVS $Id$
+ */
+public class Block {
+    
+    public static final String STATUS_STABLE = "stable";
+    public static final String STATUS_UNSTABLE = "unstable";
+    public static final String STATUS_DEPRECATED = "deprecated";
+    
+    private String name;
+    private String description;
+    private String status;
+    private List dependencies;
+    private int need = 0;
+    private boolean selected;
+    
+    public Block() {
+        super();
+    }
+    
+    public Block(String name) {
+        this.setName(name);
+    }
+    
+    /**
+     * @return Returns the dependencies.
+     */
+    public List getDependencies() {
+        return dependencies;
+    }
+
+    /**
+     * @param depends The dependencies to set.
+     */
+    public void setDependencies(List dependencies) {
+        this.dependencies = dependencies;
+    }
+
+    /**
+     * @return Returns the description.
+     */
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * @param description The description to set.
+     */
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * @return Returns the name.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * @param name The name to set.
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * @return Returns the status.
+     */
+    public String getStatus() {
+        return status;
+    }
+
+    /**
+     * @param status The status to set.
+     */
+    public void setStatus(String status) {
+        this.status = status;
+    }
+    
+    public void addDependency(String dependency) {
+        if (this.getDependencies() == null) {
+            this.setDependencies(new ArrayList());            
+        }
+        this.getDependencies().add(dependency);
+    }
+    
+    /**
+     * @return Returns the selected.
+     */
+    public boolean isSelected() {
+        return selected;
+    }
+
+    /**
+     * @param selected The selected to set.
+     */
+    public void setSelected(boolean selected) {
+        this.selected = selected;
+    }
+
+    /**
+     * @return Returns the need.
+     */
+    public int getNeed() {
+        return need;
+    }
+
+    /**
+     * @param need The need to set.
+     */
+    public void setNeed(int need) {
+        this.need = need;
+    }
+    
+    /**
+     * Return an HTML description of this block 
+     * @return
+     */
+    public String getBlockDescription() {
+        StringBuffer sb = new StringBuffer();
+        sb.append("<html>");
+        if (this.getDependencies() != null) {
+            sb.append("<p><b>Depends on:</b> ");
+            for (int i=0; i<this.getDependencies().size(); i++) {
+                sb.append("<i>" + this.getDependencies().get(i) + "</i>");
+                if (i != this.getDependencies().size()-1) {
+                    sb.append(", ");
+                }
+            }
+            sb.append("</p> -oOo-<br>");
+        } 
+        sb.append(this.description);
+        return sb.toString();
+    }
+
+    public String toString() {
+        StringBuffer sb = new StringBuffer();
+        sb.append("<block ");
+        sb.append("name=\"" + this.getName() + "\" ");
+        sb.append("status=\"" + this.getStatus() + "\" ");
+        sb.append("description=\"" + this.getDescription() + "\"");
+        if (this.getDependencies() != null) {
+            sb.append(">");
+            for (int i=0; i<this.getDependencies().size(); i++) {
+                sb.append("\n  <depend>" + this.getDependencies().get(i) + "</depend>");                
+            }
+            sb.append("\n</block>");                    
+        } else {
+            sb.append("/>");
+        }
+        return sb.toString();
+    }
+
+}

Propchange: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Block.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Block.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Blocks.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Blocks.java?rev=306640&view=auto
==============================================================================
--- cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Blocks.java (added)
+++ cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Blocks.java Thu Oct  6 06:30:10 2005
@@ -0,0 +1,200 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * 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 org.apache.cocoon.guilder.block;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.cocoon.guilder.properties.PropertiesManager;
+import org.apache.xml.serialize.OutputFormat;
+import org.apache.xml.serialize.XMLSerializer;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+/**
+ * 
+ * Description of Blocks.
+ * 
+ * @version CVS $Id$
+ */
+public class Blocks {
+
+    public static final String GUMP_FILE_PATH = "gump.xml";
+    public static final String BLOCKS_PROPERTIES_PATH = "blocks.properties";
+    public static final String LOCAL_BLOCKS_PROPERTIES_PATH = "local.blocks.properties";
+    private static Document doc;
+    private static Properties properties;
+    private static Map blocks;
+    
+    public Blocks() {
+        if (doc == null) {
+            doc = getXML();
+        }
+        if (properties == null) {
+            PropertiesManager propertiesManager = new PropertiesManager();
+            properties = propertiesManager.getProperties(BLOCKS_PROPERTIES_PATH);        
+            propertiesManager = new PropertiesManager(properties);
+            properties = propertiesManager.getProperties(LOCAL_BLOCKS_PROPERTIES_PATH);
+        }        
+        if (blocks == null) {
+            this.initBlocks();
+            this.computeDependencies();
+        }        
+    }
+    
+    public Map getBlocks() {
+        return blocks;
+    }
+    
+    public Properties getProperties() {
+        return properties;
+    }
+    
+    private void initBlocks() {
+        blocks = new HashMap();
+        Element root = doc.getDocumentElement();
+        NodeList blocksEl = root.getElementsByTagName("block");
+        for (int i=0; i<blocksEl.getLength(); i++) {
+            //Iterate over project elements
+            Node node = blocksEl.item(i);
+            if (node.getNodeType() == Node.ELEMENT_NODE) {
+                Element blockEl = (Element)node;
+                Block block = new Block();
+                //Get NAME
+                block.setName(blockEl.getAttribute("name"));
+                //Get STATUS
+                block.setStatus(blockEl.getAttribute("status"));
+                //Get DESCRIPTION
+                Element descr = (Element)blockEl.getElementsByTagName("description").item(0);
+                block.setDescription(serializeNode(doc, descr));
+                //Get DEPENDENCIES
+                NodeList deps = blockEl.getElementsByTagName("depend");
+                for (int j=0; j<deps.getLength(); j++) {
+                    Node n2 = deps.item(j);
+                    if (n2.getNodeType() == Node.ELEMENT_NODE) {
+                        Element dep = (Element)n2;
+                        block.addDependency(dep.getAttribute("block"));
+                    }
+                }
+                //Get SELECTED
+                if (properties.getProperty("include.block." + block.getName()) != null 
+                        && properties.getProperty("include.block." + block.getName()).equals("false")) {
+                    block.setSelected(false);                        
+                } else {
+                    block.setSelected(true);
+                }
+                blocks.put(block.getName(), block);
+                //System.out.println(block.toString());
+            }
+        }
+    }
+    
+    private void computeDependencies() {
+        Iterator keys = blocks.keySet().iterator();
+        while (keys.hasNext()) {
+            String key = (String) keys.next();
+            Block block = (Block) blocks.get(key);
+            if (block.isSelected()) {
+                List dependencies = block.getDependencies();
+                if (dependencies != null) {
+                    for (int i=0; i<dependencies.size(); i++) {
+                        String dependency = (String) dependencies.get(i);
+                        Block dependencyBlock = (Block) blocks.get(dependency);
+                        dependencyBlock.setNeed(dependencyBlock.getNeed()+1);
+                    }
+                }
+            }
+        }
+    }
+    
+    public void save() {
+        new PropertiesManager(properties).writeProperties(LOCAL_BLOCKS_PROPERTIES_PATH);
+    }
+
+    private String serializeNode(Document doc, Element node) {
+        StringWriter stringOut = new StringWriter();
+        try {
+            OutputFormat format = new OutputFormat(doc); //Serialize DOM
+            format.setIndenting(false);
+            format.setOmitXMLDeclaration(true);
+            XMLSerializer serial = new XMLSerializer(stringOut, format);
+            serial.asDOMSerializer(); // As a DOM Serializer
+            serial.serialize(node);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        return stringOut.toString();
+    }
+    
+    private Document getXML() {
+        try {
+            Source xmlSource = new StreamSource(new FileInputStream(GUMP_FILE_PATH));
+            Source xsltSource = new StreamSource(
+                    this.getClass().getResourceAsStream("gump2xhtml.xsl"));
+            //Use DOMResult? yes, but don't work :D
+            StreamResult transResult = new StreamResult();
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            transResult.setOutputStream(baos);
+            TransformerFactory tf = TransformerFactory.newInstance();
+            Transformer t = tf.newTransformer(xsltSource);
+            t.transform(xmlSource, transResult);            
+            Document newDoc = null;
+            DocumentBuilderFactory factory =
+                DocumentBuilderFactory.newInstance();
+            DocumentBuilder builder = factory.newDocumentBuilder();
+            ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+            newDoc = builder.parse(bais); 
+            return newDoc;
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (TransformerConfigurationException e) {
+            e.printStackTrace();
+        } catch (TransformerException e) {
+            e.printStackTrace();
+        } catch (ParserConfigurationException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } catch (SAXException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+    
+}

Propchange: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Blocks.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Blocks.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/BlocksPanelListener.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/BlocksPanelListener.java?rev=306640&view=auto
==============================================================================
--- cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/BlocksPanelListener.java (added)
+++ cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/BlocksPanelListener.java Thu Oct  6 06:30:10 2005
@@ -0,0 +1,115 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * 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 org.apache.cocoon.guilder.block;
+
+import java.awt.Component;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.swing.JCheckBox;
+import javax.swing.JPanel;
+
+/**
+ * 
+ * Description of BlocksPanelListener.
+ * 
+ * @version CVS $Id$
+ */
+public class BlocksPanelListener implements ItemListener {
+    
+    private Map panels;
+    private Map blocks;
+    private Properties properties;
+    
+    public BlocksPanelListener(Map blocks, Properties properties) {
+        this.blocks = blocks;
+        this.properties = properties;
+        this.panels = new HashMap();
+    }
+    
+    public void addPanel(JPanel panel) {
+        this.panels.put(panel.getName(), panel);
+    }
+
+    private void check(String selected) {        
+        Block block = (Block) this.blocks.get(selected);
+        this.properties.remove("include.block." + selected);
+        List dependencies = block.getDependencies();
+        if (dependencies != null) {
+            for (int i=0; i<dependencies.size(); i++) {
+                String dependency = (String) dependencies.get(i);
+                Block dependencyBlock = (Block) this.blocks.get(dependency);
+                Iterator panelsKeys = this.panels.keySet().iterator();
+                while (panelsKeys.hasNext()) {
+                    JPanel p = (JPanel) this.panels.get(panelsKeys.next());
+                    Component[] components = p.getComponents();
+                    for (int j=0; j<components.length; j++) {
+                        if (components[j] instanceof JCheckBox  && components[j].getName().equals(dependency)) {
+                            JCheckBox check = (JCheckBox) components[j];
+                            check.setSelected(true);
+                            check.setEnabled(false);
+                            check.setToolTipText("Block " + check.getName() + " can't be disabled because it depends on");
+                            this.check(dependency);
+                            dependencyBlock.setNeed(dependencyBlock.getNeed()+1);
+                        }
+                    }                    
+                }
+            }                
+        }
+    }
+    
+    private void uncheck(String unselected) {
+        Block block = (Block) this.blocks.get(unselected);
+        this.properties.put("include.block." + unselected, "false");
+        List dependencies = block.getDependencies();
+        if (dependencies != null) {
+            for (int i=0; i<dependencies.size(); i++) {
+                String dependency = (String) dependencies.get(i);
+                Block dependencyBlock = (Block) this.blocks.get(dependency);
+                Iterator panelsKeys = this.panels.keySet().iterator();
+                while (panelsKeys.hasNext()) {
+                    JPanel p = (JPanel) this.panels.get(panelsKeys.next());
+                    Component[] components = p.getComponents();
+                    for (int j=0; j<components.length; j++) {                        
+                        if (components[j].getName().equals(dependency) && components[j] instanceof JCheckBox) {
+                            dependencyBlock.setNeed(dependencyBlock.getNeed()-1);
+                            if (dependencyBlock.getNeed() == 0) {
+                                JCheckBox check = (JCheckBox) components[j];
+                                check.setEnabled(true);
+                                check.setToolTipText(null);
+                            }
+                        }
+                    }
+                }
+            }                
+        }
+        
+    }
+
+    public void itemStateChanged(ItemEvent e) {
+        if (e.getStateChange() == ItemEvent.SELECTED) {
+            this.check(((JCheckBox)e.getItem()).getName());
+        } else {
+            this.uncheck(((JCheckBox)e.getItem()).getName());
+        }
+    }
+
+}

Propchange: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/BlocksPanelListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/BlocksPanelListener.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/gump2xhtml.xsl
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/gump2xhtml.xsl?rev=306640&view=auto
==============================================================================
--- cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/gump2xhtml.xsl (added)
+++ cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/gump2xhtml.xsl Thu Oct  6 06:30:10 2005
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  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.
+-->
+
+<!-- Version: $Id$ -->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+  <xsl:template match="/module">
+    <blocks>
+      <xsl:apply-templates select="project"/>
+    </blocks>
+  </xsl:template>
+  
+  <xsl:template match="project">
+    <xsl:if test="starts-with(@name, 'cocoon-block-')">
+      <block>
+        <xsl:attribute name="name"><xsl:value-of select="ant/property[@name='block-name']/@value"/></xsl:attribute>
+        <xsl:attribute name="status"><xsl:value-of select="@status"/></xsl:attribute>
+        <xsl:apply-templates select="description"/>
+        <xsl:apply-templates select="depend"/>
+      </block>
+    </xsl:if>
+  </xsl:template>
+  
+  <xsl:template match="description">
+    <description>
+      <xsl:apply-templates/>
+    </description>
+  </xsl:template>
+  
+  <xsl:template match="link">
+    <a>
+      <xsl:copy-of select="@*"/>
+      <xsl:value-of select="."/>
+    </a>
+  </xsl:template>
+  
+  <xsl:template match="depend">
+    <xsl:if test="starts-with(@project, 'cocoon-block-')">
+      <depend>
+        <xsl:attribute name="block"><xsl:value-of select="substring-after(@project, 'cocoon-block-')"/></xsl:attribute>
+      </depend>
+    </xsl:if>
+  </xsl:template>
+    
+</xsl:stylesheet>
\ No newline at end of file

Propchange: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/gump2xhtml.xsl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/gump2xhtml.xsl
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/properties/PropertiesManager.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/properties/PropertiesManager.java?rev=306640&view=auto
==============================================================================
--- cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/properties/PropertiesManager.java (added)
+++ cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/properties/PropertiesManager.java Thu Oct  6 06:30:10 2005
@@ -0,0 +1,72 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * 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 org.apache.cocoon.guilder.properties;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Properties;
+
+/**
+ * 
+ * Description of PropertiesManager.
+ * 
+ * @version CVS $Id$
+ */
+public class PropertiesManager {
+    
+    private Properties props;
+    
+    public PropertiesManager() {       
+    }
+    
+    public PropertiesManager(Properties oldProps) {
+        this.props = oldProps;
+    }
+    
+    public Properties getProperties(String propertiesPath) {
+        if (this.props == null) {
+            this.props = new Properties();            
+        }
+        try {
+            props.load(new FileInputStream(propertiesPath));
+        } catch (FileNotFoundException e) {
+            //e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return props;
+    }
+    
+    public void writeProperties(String propertiesPath) {
+        try {
+            FileWriter writer = new FileWriter(propertiesPath);
+            Enumeration keys = this.props.keys();
+            while (keys.hasMoreElements()) {
+                String key = (String) keys.nextElement();
+                String value = this.props.getProperty(key);
+                writer.write(key + "=" + value + "\n");
+            }
+            writer.flush();
+            writer.close();            
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+   }
+    
+}
\ No newline at end of file

Propchange: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/properties/PropertiesManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/properties/PropertiesManager.java
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message