You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by mi...@apache.org on 2006/05/15 12:27:18 UTC

svn commit: r406604 - /lenya/trunk/tools/configure/src/java/org/apache/lenya/config/impl/ConfigureGUI.java

Author: michi
Date: Mon May 15 03:27:18 2006
New Revision: 406604

URL: http://svn.apache.org/viewcvs?rev=406604&view=rev
Log:
combo bug workaround

Modified:
    lenya/trunk/tools/configure/src/java/org/apache/lenya/config/impl/ConfigureGUI.java

Modified: lenya/trunk/tools/configure/src/java/org/apache/lenya/config/impl/ConfigureGUI.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/tools/configure/src/java/org/apache/lenya/config/impl/ConfigureGUI.java?rev=406604&r1=406603&r2=406604&view=diff
==============================================================================
--- lenya/trunk/tools/configure/src/java/org/apache/lenya/config/impl/ConfigureGUI.java (original)
+++ lenya/trunk/tools/configure/src/java/org/apache/lenya/config/impl/ConfigureGUI.java Mon May 15 03:27:18 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright  1999-2004 The Apache Software Foundation
+ * Copyright  1999-2006 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.
@@ -23,11 +23,11 @@
 import java.awt.GridBagConstraints;
 import java.awt.GridBagLayout;
 import java.awt.Insets;
+import java.awt.Toolkit;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseListener;
-import java.util.Vector;
 
 import javax.swing.BoxLayout;
 import javax.swing.ButtonGroup;
@@ -38,159 +38,154 @@
 import javax.swing.JLabel;
 import javax.swing.JOptionPane;
 import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
 import javax.swing.JRadioButton;
 import javax.swing.JTextField;
 
-import org.apache.lenya.config.core.Configuration;
 import org.apache.lenya.config.core.FileConfiguration;
+import org.apache.lenya.config.core.ContextEventQueue;
 import org.apache.lenya.config.core.Parameter;
 
 /**
- *  A GUI tool to configure Lenya 1.4 build
+ * A GUI tool to configure Lenya 1.4 build
  */
 public class ConfigureGUI {
+    
     protected static final Component Next = null;
-
     protected static final Component Previous = null;
-
+    
+    private JFrame frame;
+    
     private JPanel contentPanel;
-
     private JPanel checkBoxPanel;
-
     private JPanel buttonPanel;
-
+    
     private JCheckBox[] checkBoxes;
-
+    
     private JLabel defaultValueLabel;
-
     private JLabel localValueLabel;
-
     private JLabel newLocalValueLabel;
-
+    
+    private JLabel stepsLabel;
+    private JLabel paraValueLabel;
+    
+    private JLabel warning1;
+    private JLabel warning2;
+    private JLabel saveMessage;
+    
     private JRadioButton radioButton1;
-
     private JRadioButton radioButton2;
-
     private JRadioButton radioButton3;
-
-    private JLabel stepsLabel;
-
-    private JLabel paraValueLabel;
-
+    
     private JTextField localValueTextField;
-
     private JTextField defaultValueTextField;
-
     private JTextField newLocalValueTextField;
-
+    
     private JComboBox defaultValueComboBox;
     private JComboBox localValueComboBox;
     private JComboBox newLocalValueComboBox;
-
+    
     private JButton cancelButton;
-
     private JButton backButton;
-
     private JButton nextButton;
-
     private JButton saveButton;
-
     private JButton yesButton;
-
     private JButton noButton;
-    
     private JButton exitButton;
-
-    private Parameter[] params;
     
+    private JPopupMenu pop;
+    
+    private Parameter[] params;
     private Parameter[] tmpParams;
-
-    private JFrame frame;
-
-    private JLabel warning1;
-
-    private JLabel warning2;
-
-    private JLabel saveMessage;
-
-    private int steps = 0;
+    private Parameter[] subParams; 
     
+    private int steps = 0;
+    private int comboPlaceD = 0;
+    private int comboPlaceL = 0;
+    private int comboPlaceN = 0;
     private String rootDir;
-
+    
     public final static boolean RIGHT_TO_LEFT = false;
-
+    
     private FileConfiguration buildProperties;
     private FileConfiguration tmpBuildProperties;
-
+    
+    /**
+     * Main method which creates the GUI 
+     * @param args
+     */
     public static void main(String[] args) {
-
+        
         System.out
-                .println("\nWelcome to the GUI to configure the building process of Apache Lenya");
-
+        .println("\nWelcome to the GUI to configure the building process of Apache Lenya");
+        
         if (args.length != 1) {
-
+            
             System.err
-                    .println("No root dir specified (e.g. /home/USERNAME/src/lenya/trunk)!");
+            .println("No root dir specified (e.g. /home/USERNAME/src/lenya/trunk)!");
             return;
         }
         String rootDir = args[0];
-
+        
         new ConfigureGUI(rootDir);
     }
-
+    
+    /**
+     * .ctor
+     * @param rootDir
+     */
     public ConfigureGUI(String rootDir) {
-
+        
+        // pushes the eventQueue which will take care of copy/paste operations
+        Toolkit.getDefaultToolkit().getSystemEventQueue().push(
+                new ContextEventQueue());
+        
         this.rootDir = rootDir;
         System.out.println("Starting GUI ...");
-
+        
         buildProperties = new BuildPropertiesConfiguration();
         buildProperties.setFilenameDefault(rootDir + "/build.properties");
         buildProperties.setFilenameLocal(rootDir + "/local.build.properties");
-
+        
         buildProperties.read();
         params = buildProperties.getConfigurableParameters();
-
+        
         tmpBuildProperties = new BuildPropertiesConfiguration();
         tmpBuildProperties.setFilenameDefault(rootDir + "/build.properties");
         tmpBuildProperties.setFilenameLocal(rootDir + "/local.build.properties");
         tmpBuildProperties.read();
         tmpParams = tmpBuildProperties.getConfigurableParameters();
         // Empty temporary local fields of temporary parameters
-        for (int k = 0; k < tmpParams.length; k ++) {
+        for (int k = 0; k < tmpParams.length; k++) {
             tmpParams[k].setLocalValue("");
         }
         
-
         JFrame.setDefaultLookAndFeelDecorated(true);
         frame = new JFrame("Apache Lenya Configuration");
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         frame.getContentPane().setLayout(new FlowLayout(FlowLayout.LEFT));
-
+        
         contentPanel = new JPanel();
         checkBoxPanel = new JPanel();
         buttonPanel = new JPanel();
-
+        
         defaultValueLabel = new JLabel();
         localValueLabel = new JLabel();
         newLocalValueLabel = new JLabel();
-
+        
         defaultValueTextField = new JTextField(20);
         localValueTextField = new JTextField(20);
         newLocalValueTextField = new JTextField(20);
-
+        
         defaultValueComboBox = new JComboBox();
-        // TODO: Add Listener (to change radio, tmpParams)
         localValueComboBox = new JComboBox();
-        // TODO: Add Listener (to change radio, tmpParams)
         newLocalValueComboBox = new JComboBox();
-        // TODO: Add Listener (to change radio, tmpParams)
-        // tmpParams[getStep()].setLocalValue(newLocalValueComboBox ...);
-
+        
         radioButton1 = new JRadioButton();
         radioButton2 = new JRadioButton();
         radioButton3 = new JRadioButton();
         ButtonGroup g = new ButtonGroup();
-
+        
         cancelButton = new JButton();
         backButton = new JButton();
         nextButton = new JButton();
@@ -198,38 +193,34 @@
         noButton = new JButton();
         yesButton = new JButton();
         exitButton = new JButton();
-
+        
         warning1 = new JLabel();
         warning2 = new JLabel();
-
+        
         saveMessage = new JLabel();
         
         Container contentPane = frame.getContentPane();
         contentPane.setLayout(new FlowLayout(FlowLayout.LEFT));
-
-        //TODO: Somehow this doesn't work
-        //contentPane.setPreferredSize(new java.awt.Dimension(380, 182));
-
+        
         contentPanel.setLayout(new GridBagLayout());
         GridBagConstraints c = new GridBagConstraints();
-
+        
         stepsLabel = new JLabel();
         stepsLabel.setText("Parameters  ");
         c.gridx = 0;
         c.gridy = 0;
         contentPanel.add(stepsLabel, c);
-
+        
         checkBoxPanel = new JPanel();
         checkBoxPanel.setLayout(new BoxLayout(checkBoxPanel, BoxLayout.Y_AXIS));
-
         c.gridx = 0;
         c.gridy = 1;
         c.gridheight = 4;
         c.ipadx = 20;
         contentPanel.add(checkBoxPanel, c);
-
+        
         checkBoxes = new JCheckBox[params.length];
-
+        
         for (int i = 0; i < params.length; ++i) {
             checkBoxes[i] = new JCheckBox();
             checkBoxes[i].setEnabled(false);
@@ -237,7 +228,7 @@
             checkBoxes[0].setSelected(true);
             checkBoxPanel.add(checkBoxes[i]);
         }
-
+        
         paraValueLabel = new JLabel();
         c.gridx = 1;
         c.gridy = 0;
@@ -245,7 +236,7 @@
         c.gridheight = 1;
         paraValueLabel = new JLabel("Parameter: " + params[0].getName());
         contentPanel.add(paraValueLabel, c);
-
+        
         defaultValueLabel.setText("Default Value:");
         contentPanel.add(defaultValueLabel, new GridBagConstraints(1, 1, 1, 1,
                 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
@@ -255,29 +246,20 @@
                 GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
         defaultValueTextField.setText(params[0].getDefaultValue());
         defaultValueTextField.addMouseListener(new MouseListener() {
-
             public void mouseClicked(MouseEvent event) {
                 radioButton1.setSelected(true);
-            }
-
-            public void mousePressed(MouseEvent event) {
-            }
-
-            public void mouseReleased(MouseEvent event) {
-            }
-
-            public void mouseEntered(MouseEvent event) {
-            }
-
-            public void mouseExited(MouseEvent event) {
-            }
+            }            
+            public void mousePressed(MouseEvent event) {}
+            public void mouseReleased(MouseEvent event) {}            
+            public void mouseEntered(MouseEvent event) {}
+            public void mouseExited(MouseEvent event) {}
         });
-
+        
         contentPanel.add(radioButton1, new GridBagConstraints(3, 1, 1, 1, 0.0,
                 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
                 new Insets(0, 0, 0, 0), 0, 0));
         g.add(radioButton1);
-
+        
         localValueLabel.setText("Local Value:");
         contentPanel.add(localValueLabel, new GridBagConstraints(1, 2, 1, 1,
                 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
@@ -287,30 +269,21 @@
                 GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
         localValueTextField.setText(params[0].getLocalValue());
         localValueTextField.addMouseListener(new MouseListener() {
-
-            public void mouseClicked(MouseEvent event) {
-            }
-
+            public void mouseClicked(MouseEvent event) {}            
             public void mousePressed(MouseEvent event) {
                 radioButton2.setSelected(true);
             }
-
-            public void mouseReleased(MouseEvent event) {
-            }
-
-            public void mouseEntered(MouseEvent event) {
-            }
-
-            public void mouseExited(MouseEvent event) {
-            }
+            public void mouseReleased(MouseEvent event) {}            
+            public void mouseEntered(MouseEvent event) {}
+            public void mouseExited(MouseEvent event) {}
         });
-
+        
         contentPanel.add(radioButton2, new GridBagConstraints(3, 2, 1, 1, 0.0,
                 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
                 new Insets(0, 0, 0, 0), 0, 0));
         g.add(radioButton2);
         radioButton2.setSelected(true);
-
+        
         newLocalValueLabel.setText("New Local Value:");
         contentPanel.add(newLocalValueLabel, new GridBagConstraints(1, 3, 1, 1,
                 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
@@ -319,29 +292,20 @@
                 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                 GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
         newLocalValueTextField.addMouseListener(new MouseListener() {
-
-            public void mouseClicked(MouseEvent event) {
-            }
-
+            public void mouseClicked(MouseEvent event) {}            
             public void mousePressed(MouseEvent event) {
                 radioButton3.setSelected(true);
             }
-
-            public void mouseEntered(MouseEvent event) {
-            }
-
-            public void mouseExited(MouseEvent event) {
-            }
-
-            public void mouseReleased(MouseEvent event) {
-            }
+            public void mouseEntered(MouseEvent event) {}            
+            public void mouseExited(MouseEvent event) {}
+            public void mouseReleased(MouseEvent event) {}
         });
-
+        
         contentPanel.add(radioButton3, new GridBagConstraints(3, 3, 1, 1, 0.0,
                 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
                 new Insets(0, 0, 0, 0), 0, 0));
         g.add(radioButton3);
-
+        
         buttonPanel = new JPanel();
         cancelButton.setText("Cancel");
         contentPanel.add(cancelButton, new GridBagConstraints(1, 4, 1, 1, 0.0,
@@ -349,44 +313,46 @@
                 new Insets(0, 0, 0, 0), 0, 0));
         cancelButton.setPreferredSize(new java.awt.Dimension(74, 22));
         cancelButton.addActionListener(new ActionListener() {
-
+            
             public void actionPerformed(ActionEvent evt) {
                 int n = JOptionPane
-                        .showConfirmDialog((Component) null,
-                                "Do you want to Exit?", "Exit...",
-                                JOptionPane.YES_NO_OPTION,
-                                JOptionPane.QUESTION_MESSAGE);
+                .showConfirmDialog((Component) null,
+                        "Do you want to Exit?", "Exit...",
+                        JOptionPane.YES_NO_OPTION,
+                        JOptionPane.QUESTION_MESSAGE);
                 if (n == JOptionPane.YES_OPTION) {
                     System.exit(0);
                 }
             }
         });
-
+        
         backButton.setText("<Back");
         contentPanel.add(backButton, new GridBagConstraints(2, 4, 1, 1, 0.0,
                 0.0, GridBagConstraints.SOUTH, GridBagConstraints.PAGE_END,
                 new Insets(0, 0, 0, 0), 0, 0));
         backButton.setPreferredSize(new java.awt.Dimension(74, 22));
         backButton.addActionListener(new ActionListener() {
+            
             public void actionPerformed(ActionEvent e) {
                 backButton.setEnabled(true);
                 if (contentPanel.isVisible())
                     backButton.setEnabled(true);
-                if (steps != params.length) {
+                if (getStep() != params.length) {
                     saveButton.setVisible(false);
                 }
                 moveBack();
             }
         });
-
+        
         backButton.setEnabled(false);
-
+        
         nextButton.setText("Next>");
         contentPanel.add(nextButton, new GridBagConstraints(3, 4, 1, 1, 0.0,
                 0.0, GridBagConstraints.SOUTH, GridBagConstraints.PAGE_END,
                 new Insets(0, 0, 0, 0), 0, 0));
         nextButton.setPreferredSize(new java.awt.Dimension(74, 22));
         nextButton.addActionListener(new ActionListener() {
+            
             public void actionPerformed(ActionEvent e) {
                 backButton.setEnabled(true);
                 if (contentPanel.isVisible())
@@ -394,7 +360,7 @@
                 moveNext();
             }
         });
-
+        
         buttonPanel.add(cancelButton);
         buttonPanel.add(backButton);
         buttonPanel.add(nextButton);
@@ -402,16 +368,15 @@
         contentPanel.add(buttonPanel, new GridBagConstraints(2, 4, 1, 1, 0.0,
                 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
                 new Insets(0, 0, 0, 0), 0, 0));
-
+        
         frame.pack();
-/*
-        int frameWidth = 570;
-        int frameHeight = 250;
-        frame.setSize(frameWidth, frameHeight);
-*/
-        frame.setVisible(true); 
+        frame.setVisible(true);
     }
-
+    
+    /**
+     * Controls behavior if back button is pressed
+     *
+     */
     public void moveBack() {
         steps--;
         frame.repaint();
@@ -421,15 +386,20 @@
         showNormalOptions();
         comboBox();
         checkLast();
-
+        
         newLocalValueTextField.setText(tmpParams[getStep()].getLocalValue());
 
-	setRadioButton();
+        pop.setVisible(false);
+        setRadioButton();
     }
-
+    
+    /**
+     * Controls behavior if next button is pressed
+     *
+     */
     public void moveNext() {
         setLocalValue();
-
+        
         steps++;
         frame.repaint();
         checkFirst();
@@ -437,12 +407,13 @@
         showNormalOptions();
         comboBox();
         checkLast();
-
-        newLocalValueTextField.setText(tmpParams[getStep()].getLocalValue());
-
-	setRadioButton();
+        
+        newLocalValueTextField.setText(tmpParams[getStep()].getLocalValue()); 
+        
+        setRadioButton();
+        
     }
-
+    
     /**
      * Set radio button
      */
@@ -455,33 +426,44 @@
             radioButton1.setSelected(true);
         }
     }
-
+    
     /**
      * Set local value depending on chosen value
      */
     public void setLocalValue() {
         String[] av = params[getStep()].getAvailableValues();
-
+        
         if (av == null) {
             if (radioButton1.isSelected()) {
-                tmpParams[steps].setLocalValue(defaultValueTextField.getText());
+                tmpParams[getStep()].setLocalValue(defaultValueTextField.getText());
                 System.out.print("Default Value: ");
             } else if (radioButton2.isSelected()) {
-                tmpParams[steps].setLocalValue(localValueTextField.getText());
+                tmpParams[getStep()].setLocalValue(localValueTextField.getText());
                 System.out.print("Local Value: ");
             } else if (radioButton3.isSelected()) {
-                tmpParams[steps].setLocalValue(newLocalValueTextField.getText());
+                tmpParams[getStep()]
+                          .setLocalValue(newLocalValueTextField.getText());
                 System.out.print("New Local Value: ");
             } else {
                 System.err.println("Fatal Error 0123456789!");
             }
-
+            
             System.out.println(tmpParams[getStep()].getLocalValue());
         } else {
-            System.out.println("Combo Box: " + tmpParams[getStep()].getLocalValue());
+            comboPlaceD = defaultValueComboBox.getSelectedIndex();
+            comboPlaceL = localValueComboBox.getSelectedIndex();
+            comboPlaceN = newLocalValueComboBox.getSelectedIndex();
+            System.out.println("ComboBox: " + tmpParams[getStep()].getLocalValue());
+
+            checkSubParameters();
         }
     }
-
+    
+    /**
+     * Takes care about the steps progress (list on left side)
+     * 
+     * @param direction
+     */
     public void currentStep(String direction) {
         if (direction.equals("up")) {
             for (int i = 1; i <= getStep(); ++i) {
@@ -492,67 +474,86 @@
             checkBoxes[getStep() + 1].setSelected(false);
         }
     }
-
+    
+    /**
+     * Checks if its first step and disables the back button
+     *
+     */
     public void checkFirst() {
-
+        
         if (getStep() == 0) {
             backButton.setEnabled(false);
         } else {
             backButton.setEnabled(true);
         }
     }
-
+    
+    /**
+     * Checks if its last step and disables next button but adding a save button
+     *
+     */
     public void checkLast() {
         saveButton = new JButton("Save");
-
+        
         warning1 = new JLabel("WARNING: Local configuration already exists!");
         warning2 = new JLabel("Do you want to overwrite?");
         if (getStep() == params.length - 1) {
             nextButton.setEnabled(false);
             nextButton.setVisible(false);
-
+            
             buttonPanel.add(saveButton);
             contentPanel.add(buttonPanel, new GridBagConstraints(2, 4, 1, 1,
                     0.0, 0.0, GridBagConstraints.CENTER,
                     GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
-
+            
             saveButton.setPreferredSize(new java.awt.Dimension(74, 22));
             saveButton.addActionListener(new ActionListener() {
+                
                 public void actionPerformed(ActionEvent e) {
                     setLocalValue();
                     showSaveScreen();
                     showWarningScreen();
                 }
-
+                
             });
-
+            
         } else {
             nextButton.setEnabled(true);
             warning1.setVisible(false);
             warning2.setVisible(false);
-
+            
         }
     }
-
+    
+    /**
+     * Shows the normal options (paramaters)
+     *
+     */
     public void showNormalOptions() {
-
-        if (steps < params.length) {
-            defaultValueTextField.setText(params[steps].getDefaultValue());
-            localValueTextField.setText(params[steps].getLocalValue());
-            paraValueLabel.setText(params[steps].getName());
+        
+        if (getStep() < params.length) {
+            defaultValueTextField.setText(params[getStep()].getDefaultValue());
+            localValueTextField.setText(params[getStep()].getLocalValue());
+            paraValueLabel.setText(params[getStep()].getName());
         }
-
+        
     }
-
+    
+    /**
+     * Shows the save screen
+     *
+     */
     private void showSaveScreen() {
-
+        
         paraValueLabel.setVisible(false);
         defaultValueLabel.setVisible(false);
         localValueLabel.setVisible(false);
         newLocalValueLabel.setVisible(false);
+        
         defaultValueTextField.setVisible(false);
         localValueTextField.setVisible(false);
         newLocalValueTextField.setVisible(false);
+        
         radioButton1.setVisible(false);
         radioButton2.setVisible(false);
         radioButton3.setVisible(false);
@@ -560,16 +561,18 @@
         nextButton.setVisible(false);
         backButton.setVisible(false);
         saveButton.setVisible(false);
-
+        
         yesButton.setVisible(true);
         noButton.setVisible(true);
-
+        
         warning1.setVisible(true);
         warning2.setVisible(true);
-
-
     }
-
+    
+    /**
+     * Shows the Warning screen
+     *
+     */
     private void showWarningScreen() {
         contentPanel.add(warning1, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
                 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
@@ -583,62 +586,77 @@
                 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
                 new Insets(0, 0, 0, 0), 0, 0));
         yesButton.addActionListener(new ActionListener() {
+            
             public void actionPerformed(ActionEvent e) {
-
+                
                 showYesScreen();
-
+                
             }
         });
-
+        
         noButton.setText("no");
         buttonPanel.add(noButton);
         contentPanel.add(buttonPanel, new GridBagConstraints(2, 4, 1, 1, 0.0,
                 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
                 new Insets(0, 0, 0, 0), 0, 0));
         noButton.addActionListener(new ActionListener() {
+            
             public void actionPerformed(ActionEvent e) {
-
+                
                 showNoScreen();
-
+                
             }
         });
-
+        
     }
-
+    
+    /**
+     * Screen if Yes is pressed
+     *
+     */
     private void showYesScreen() {
+        
+        // TODO: Why doesn't it work with the reference only?
+        for (int k = 0; k < tmpParams.length; k++) {
+            tmpBuildProperties.setParameter(tmpParams[k]);
+        }
         tmpBuildProperties.writeLocal();
+        
 
-
-        saveMessage.setText("Successful saved to: " + rootDir + "/local.build.properties");
+        saveMessage.setText("Successful saved to: " + rootDir
+                + "/local.build.properties");
         contentPanel.add(saveMessage, new GridBagConstraints(2, 2, 1, 1, 0.0,
                 0.0, GridBagConstraints.SOUTH, GridBagConstraints.PAGE_END,
                 new Insets(0, 0, 0, 0), 0, 0));
         saveMessage.setVisible(true);
-
+        
         yesButton.setVisible(false);
         noButton.setVisible(false);
         warning1.setVisible(false);
         warning2.setVisible(false);
         exitButton.setPreferredSize(new java.awt.Dimension(74, 22));
         exitButton.setText("Exit");
-        contentPanel.add(exitButton, new GridBagConstraints(2, 3 , 1, 1, 0.0,
+        contentPanel.add(exitButton, new GridBagConstraints(2, 3, 1, 1, 0.0,
                 0.0, GridBagConstraints.SOUTH, GridBagConstraints.PAGE_END,
                 new Insets(0, 0, 0, 0), 0, 0));
         exitButton.addActionListener(new ActionListener() {
-
+            
             public void actionPerformed(ActionEvent evt) {
                 
-                    System.exit(0);
-                }
+                System.exit(0);
+            }
         });
         
         contentPanel.revalidate();
         contentPanel.repaint();
     }
-
     
+    /**
+     * Screen if No is pressed
+     *
+     */
     private void showNoScreen() {
-
+        
         saveMessage.setVisible(false);
         paraValueLabel.setVisible(true);
         defaultValueLabel.setVisible(true);
@@ -647,79 +665,182 @@
         defaultValueTextField.setVisible(true);
         localValueTextField.setVisible(true);
         newLocalValueTextField.setVisible(true);
-
+        
         radioButton1.setVisible(true);
         radioButton2.setVisible(true);
         radioButton3.setVisible(true);
         cancelButton.setVisible(true);
         nextButton.setVisible(false);
-
+        
         backButton.setVisible(true);
         saveButton.setVisible(true);
-
+        
         yesButton.setVisible(false);
         noButton.setVisible(false);
-
+        
         saveMessage.setVisible(false);
-
+        
     }
     
-
-
+    /**
+     * Method to create the Comboboxes
+     *
+     */
     public void comboBox() {
         String[] availableValues = params[getStep()].getAvailableValues();
-
+        
         if (availableValues != null && availableValues.length > 0) {
             warning1.setVisible(false);
             warning2.setVisible(false);
-
+            
             defaultValueTextField.setVisible(false);
             localValueTextField.setVisible(false);
             newLocalValueTextField.setVisible(false);
-
+            
             String[] labels = new String[availableValues.length];
-            for (int i = 0; i < availableValues.length; i ++) {
+            for (int i = 0; i < availableValues.length; i++) {
                 labels[i] = availableValues[i];
             }
-
+            
             defaultValueComboBox = new JComboBox(labels);
-            // TODO: Show lable according to params.getDefaultValue
+            defaultValueComboBox.setSelectedIndex(comboPlaceD);      
+            tmpParams[getStep()].setLocalValue("Jetty");
+            
+            
+            // MouseListener takes care to place radio button
+            defaultValueComboBox.addMouseListener(new MouseListener() {
+                public void mouseClicked(MouseEvent event) {
+                    radioButton1.setSelected(true);
+                }                
+                public void mousePressed(MouseEvent event) {}
+                public void mouseReleased(MouseEvent event) {}                
+                public void mouseEntered(MouseEvent event) {}
+                public void mouseExited(MouseEvent event) {}
+            });
+            // ActionListener which looks what is selected in the Dropdown list
+            defaultValueComboBox.addActionListener(new ActionListener() {
+                                    
+                public void actionPerformed(ActionEvent event) {
+                    JComboBox cb = (JComboBox) event.getSource();
+                    tmpParams[getStep()].setLocalValue(cb.getSelectedItem()
+                            .toString());
+                    subParams = params[getStep()].getSubsequentParameters(cb.getSelectedItem().toString(),tmpBuildProperties);
+                    
+               }
+            });
+            
             defaultValueComboBox.setMaximumRowCount(availableValues.length);
+            
             contentPanel.add(defaultValueComboBox, new GridBagConstraints(2, 1,
                     1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                     GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
-
+            
             localValueComboBox = new JComboBox(labels);
-            // TODO: Show lable according to params.getLocalValue, params.getDefaultValue
+            localValueComboBox.setSelectedIndex(comboPlaceL);
+            tmpParams[getStep()].setLocalValue("Jetty");
+            
+            localValueComboBox.addMouseListener(new MouseListener() {                
+                public void mouseClicked(MouseEvent event) {
+                    radioButton2.setSelected(true);
+                }                
+                public void mousePressed(MouseEvent event) {}
+                public void mouseReleased(MouseEvent event) {}                
+                public void mouseEntered(MouseEvent event) {}
+                public void mouseExited(MouseEvent event) {}
+            });
+            // ActionListener which looks what is selected in the Dropdown list
+            localValueComboBox.addActionListener(new ActionListener() {
+                
+                public void actionPerformed(ActionEvent event) {
+                    JComboBox cb = (JComboBox) event.getSource();
+                    tmpParams[getStep()].setLocalValue(cb.getSelectedItem()
+                            .toString());
+                    subParams = params[getStep()].getSubsequentParameters(cb.getSelectedItem().toString(), tmpBuildProperties);
+               
+                }
+            });
             localValueComboBox.setMaximumRowCount(availableValues.length);
             contentPanel.add(localValueComboBox, new GridBagConstraints(2, 2,
                     1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                     GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
-
+            
             newLocalValueComboBox = new JComboBox(labels);
-            // TODO: Show lable according to tmpParams.getLocalValue, params.getLocalValue, params.getDefaultValue
+            newLocalValueComboBox.setSelectedIndex(comboPlaceN);
+            tmpParams[getStep()].setLocalValue("Jetty");
+            
+            newLocalValueComboBox.addMouseListener(new MouseListener() {
+                public void mouseClicked(MouseEvent event) {}
+                public void mousePressed(MouseEvent event) {
+                    radioButton3.setSelected(true);
+                }                
+                public void mouseEntered(MouseEvent event) {}
+                public void mouseExited(MouseEvent event) {}               
+                public void mouseReleased(MouseEvent event) {}
+            });
+            // ActionListener which looks what is selected in the Dropdown list
+            newLocalValueComboBox.addActionListener(new ActionListener() {
+                
+                public void actionPerformed(ActionEvent event) {
+                    JComboBox cb = (JComboBox) event.getSource();
+                    tmpParams[getStep()].setLocalValue(cb.getSelectedItem()
+                            .toString());
+                    subParams = params[getStep()].getSubsequentParameters(cb.getSelectedItem().toString(),tmpBuildProperties);                    
+                }
+            });
             newLocalValueComboBox.setMaximumRowCount(availableValues.length);
-            contentPanel.add(newLocalValueComboBox, new GridBagConstraints(2, 3,
-                    1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
+            contentPanel.add(newLocalValueComboBox, new GridBagConstraints(2,
+                    3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                     GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
-
+            
             contentPanel.revalidate();
         } else {
             defaultValueComboBox.setVisible(false);
             localValueComboBox.setVisible(false);
             newLocalValueComboBox.setVisible(false);
-
             defaultValueTextField.setVisible(true);
             localValueTextField.setVisible(true);
             newLocalValueTextField.setVisible(true);
-
+            
             warning1.setVisible(false);
             warning2.setVisible(false);
         }
     }
 
+    public void checkSubParameters() {
+
+        pop = new JPopupMenu();
+        pop.setLocation(contentPanel.getX(),contentPanel.getY());
+        
+        
+        if (subParams != null) {
+            String sp = "";
+
+            for (int j = 0; j < subParams.length; j++) {
+                sp = sp + subParams[j].getName();
+                if (j != subParams.length -1) sp = sp + ", ";
+            }
+
+            pop.add(new JLabel("WARNING: " + subParams.length + " subsequent parameters to be set!"));
+
+            System.out.println("  " + subParams.length + " Subsequent Params  : " + sp);
+
+            JButton popClose = new JButton("Close");
+            popClose.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent e) {
+                    pop.setVisible(false);                    
+                }                
+            });
+            pop.add(popClose);
+            pop.setVisible(true);    
+        }
+    }
+       
+    /**
+     * Returns the current step
+     * @return steps
+     */
     public int getStep() {
         return steps;
     }
-
+    
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org