[izpack-changes] r1509 - in izpack-src/trunk: . src/dist-files src/lib/com/izforge/izpack/gui src/tests/com/izforge/izpack

noreply at berlios.de noreply at berlios.de
Sun Jul 30 06:16:44 CEST 2006


Author: jponge
Date: 2006-07-30 06:16:20 +0200 (Sun, 30 Jul 2006)
New Revision: 1509

Added:
   izpack-src/trunk/src/tests/com/izforge/izpack/TwoColumnLayoutTest.java
Modified:
   izpack-src/trunk/IzPack-head.iml
   izpack-src/trunk/IzPack-head.ipr
   izpack-src/trunk/Thanks.txt
   izpack-src/trunk/Versions.txt
   izpack-src/trunk/src/dist-files/IzPack-install-reg.xml
   izpack-src/trunk/src/dist-files/IzPack-install.xml
   izpack-src/trunk/src/lib/com/izforge/izpack/gui/TwoColumnLayout.java
Log:
TwoColumnLayout fix (Amit Bhayani @JBoss/RedHat)

Modified: izpack-src/trunk/IzPack-head.iml
===================================================================
--- izpack-src/trunk/IzPack-head.iml	2006-07-25 14:26:28 UTC (rev 1508)
+++ izpack-src/trunk/IzPack-head.iml	2006-07-30 04:16:20 UTC (rev 1509)
@@ -6,7 +6,7 @@
     <exclude-output />
     <content url="file://$MODULE_DIR$">
       <sourceFolder url="file://$MODULE_DIR$/src/lib" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/tests" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/tests" isTestSource="true" />
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
@@ -28,7 +28,7 @@
         <SOURCES />
       </library>
     </orderEntry>
-    <orderEntry type="library" name="Junit" level="application" />
+    <orderEntry type="library" name="JUnit" level="application" />
     <orderEntryProperties />
   </component>
 </module>

Modified: izpack-src/trunk/IzPack-head.ipr
===================================================================
--- izpack-src/trunk/IzPack-head.ipr	2006-07-25 14:26:28 UTC (rev 1508)
+++ izpack-src/trunk/IzPack-head.ipr	2006-07-30 04:16:20 UTC (rev 1509)
@@ -188,7 +188,7 @@
       <module fileurl="file://$PROJECT_DIR$/IzPack-head.iml" filepath="$PROJECT_DIR$/IzPack-head.iml" />
     </modules>
   </component>
-  <component name="ProjectRootManager" version="2" assert-keyword="true" jdk-15="false" project-jdk-name="1.5.0_05" />
+  <component name="ProjectRootManager" version="2" assert-keyword="true" jdk-15="false" project-jdk-name="1.5" />
   <component name="RmicSettings">
     <option name="IS_EANABLED" value="false" />
     <option name="DEBUGGING_INFO" value="true" />

Modified: izpack-src/trunk/Thanks.txt
===================================================================
--- izpack-src/trunk/Thanks.txt	2006-07-25 14:26:28 UTC (rev 1508)
+++ izpack-src/trunk/Thanks.txt	2006-07-30 04:16:20 UTC (rev 1509)
@@ -105,4 +105,5 @@
 - Hal Vaughan: for the patches
 - Eric Rose: for the patch related to the logfile of AntActions.
 - Ryan Shillington: for the patches
+- Amit Bhayani & JBoss: for the patches
 

Modified: izpack-src/trunk/Versions.txt
===================================================================
--- izpack-src/trunk/Versions.txt	2006-07-25 14:26:28 UTC (rev 1508)
+++ izpack-src/trunk/Versions.txt	2006-07-30 04:16:20 UTC (rev 1509)
@@ -30,7 +30,8 @@
 - MAC OS: Launcher is built as universal (ie, i386/ppc) binary  (Julien Ponge)
 - MAC OS: Qt is embedded in the application bundle  (Julien Ponge)
 - Added a variable for install log, InstallerFrame.logfilePath (Klaus Bartz)
-- Added the docu for install log (Fabrice Mirabile)
+- Added the docu for install log (Fabrice Mirabile).
+- TwoColumnLayout fix (Amit Bhayani @JBoss/RedHat).
 
   > 3.8.1 (build 2006.01.06)
 - Added Greek language support (Fabrice Mirabile, thanks to Panayotis

Modified: izpack-src/trunk/src/dist-files/IzPack-install-reg.xml
===================================================================
--- izpack-src/trunk/src/dist-files/IzPack-install-reg.xml	2006-07-25 14:26:28 UTC (rev 1508)
+++ izpack-src/trunk/src/dist-files/IzPack-install-reg.xml	2006-07-30 04:16:20 UTC (rev 1509)
@@ -29,10 +29,13 @@
 
             <author email="" name="Klaus Bartz (developer)"/>
             <author email="" name="Fabrice Mirabile (developer)"/>
+            <author email="" name="Marc Eppelmann (developer)" />
 
             <author email="" name="Oliver Kiddle (contributor)"/>
             <author email="" name="Cesar Martinez Izquierdo (contributor)"/>
-            <author email="" name="(Ryan Shillington" />
+            <author email="" name="Ryan Shillington (contributor)" />
+            <author email="" name="Eric Rose (contributor)" />
+            <author email="" name="Amit Bhayani @JBoss/RedHat (contributors)" />
 
             <author email=""
                 name="... the many other developers and contributors to the previous releases (see Thanks.txt)" />

Modified: izpack-src/trunk/src/dist-files/IzPack-install.xml
===================================================================
--- izpack-src/trunk/src/dist-files/IzPack-install.xml	2006-07-25 14:26:28 UTC (rev 1508)
+++ izpack-src/trunk/src/dist-files/IzPack-install.xml	2006-07-30 04:16:20 UTC (rev 1509)
@@ -29,10 +29,13 @@
 
             <author email="" name="Klaus Bartz (developer)"/>
             <author email="" name="Fabrice Mirabile (developer)"/>
+            <author email="" name="Marc Eppelmann (developer)" />
 
             <author email="" name="Oliver Kiddle (contributor)"/>
             <author email="" name="Cesar Martinez Izquierdo (contributor)"/>
-            <author email="" name="(Ryan Shillington" />
+            <author email="" name="Ryan Shillington (contributor)" />
+            <author email="" name="Eric Rose (contributor)" />
+            <author email="" name="Amit Bhayani @JBoss/RedHat (contributors)" />
 
             <author email=""
                     name="... the many other developers and contributors to the previous releases (see Thanks.txt)"/>

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/gui/TwoColumnLayout.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/gui/TwoColumnLayout.java	2006-07-25 14:26:28 UTC (rev 1508)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/gui/TwoColumnLayout.java	2006-07-30 04:16:20 UTC (rev 1509)
@@ -21,14 +21,7 @@
 
 package com.izforge.izpack.gui;
 
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.LayoutManager2;
-import java.awt.Stroke;
+import java.awt.*;
 import java.util.Vector;
 
 /**
@@ -875,12 +868,52 @@
     }
 
     /**
-     * This functionality is not supported
+     * This functionality removes the TwoColumnConstraints from Vectors
+     * so that alignment of components on UserInputPanel doesn't get
+     * dirty
      * 
      * @param comp the component to be removed
      */
     public void removeLayoutComponent(Component comp)
     {
+        Vector left = components[LEFT];
+        Vector right = components[RIGHT];
+
+        for (int i = 0; i < left.size(); i++)
+        {
+            TwoColumnConstraints constraints = (TwoColumnConstraints) left.get(i);
+            if (constraints == null)
+            {
+                continue;
+            }
+            Component ctemp = constraints.component;
+            if (ctemp != null && ctemp.equals(comp))
+            {
+                if (constraints.position == TwoColumnConstraints.BOTH || constraints.position == TwoColumnConstraints.WESTONLY)
+                {
+                    right.remove(i);
+                }
+                break;
+            }
+        }
+
+        for (int j = 0; j < right.size(); j++)
+        {
+            TwoColumnConstraints constraints = (TwoColumnConstraints) right.get(j);
+            if (constraints == null)
+            {
+                continue;
+            }
+            Component ctemp = constraints.component;
+            if (ctemp != null && ctemp.equals(comp))
+            {
+                if (constraints.position == TwoColumnConstraints.BOTH || constraints.position == TwoColumnConstraints.EASTONLY)
+                {
+                    left.remove(j);
+                }
+                break;
+            }
+        }
     }
 
     /**

Added: izpack-src/trunk/src/tests/com/izforge/izpack/TwoColumnLayoutTest.java
===================================================================
--- izpack-src/trunk/src/tests/com/izforge/izpack/TwoColumnLayoutTest.java	2006-07-25 14:26:28 UTC (rev 1508)
+++ izpack-src/trunk/src/tests/com/izforge/izpack/TwoColumnLayoutTest.java	2006-07-30 04:16:20 UTC (rev 1509)
@@ -0,0 +1,160 @@
+/*
+ * IzPack - Copyright 2001-2006 Julien Ponge, All Rights Reserved.
+ *
+ * http://www.izforge.com/izpack/
+ * http://developer.berlios.de/projects/izpack/
+ *
+ * Copyright 2006 Amit Bhayani / JBoss
+ *
+ * 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 com.izforge.izpack;
+
+/**
+ * TwoColumnLayoutTest.java is a 1.4 application that 
+ * demonstrates the use of JButton, JTextField and
+ * JLabel.  It requires no other files.
+ * @author abhayani Amit Bhayani
+ */
+
+import com.izforge.izpack.gui.TwoColumnConstraints;
+import com.izforge.izpack.gui.TwoColumnLayout;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+public class TwoColumnLayoutTest implements ActionListener
+{
+    JFrame converterFrame;
+    JPanel converterPanel;
+    JTextField tempText;
+    JLabel label;
+    JButton addRow;
+    JButton removeRow;
+
+    boolean removed = false;
+
+    public TwoColumnLayoutTest()
+    {
+        //Create and set up the window.
+        converterFrame = new JFrame("TwoColumnLayoutTest");
+        converterFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        converterFrame.setSize(new Dimension(240, 80));
+
+        TwoColumnLayout layout = new TwoColumnLayout(10, 5, 30, 25, TwoColumnLayout.LEFT);
+
+        //Create and set up the panel.
+        converterPanel = new JPanel();
+        converterPanel.setLayout(layout);
+
+        //Add the widgets.
+        addWidgets();
+
+        //Set the default button.
+        converterFrame.getRootPane().setDefaultButton(addRow);
+
+        //Add the panel to the window.
+        converterFrame.getContentPane().add(converterPanel, BorderLayout.CENTER);
+
+        //Display the window.
+        converterFrame.pack();
+        converterFrame.setVisible(true);
+    }
+
+    /**
+     * Create and add the widgets.
+     */
+    private void addWidgets()
+    {
+        //Create widgets.
+        tempText = new JTextField("10", 30);
+        TwoColumnConstraints constraints = new TwoColumnConstraints();
+        constraints.position = TwoColumnConstraints.EAST;
+
+        label = new JLabel("Label : ");
+        TwoColumnConstraints constraints1 = new TwoColumnConstraints();
+        constraints1.position = TwoColumnConstraints.WEST;
+
+        addRow = new JButton("Add Row");
+        TwoColumnConstraints constraints2 = new TwoColumnConstraints();
+        constraints2.position = TwoColumnConstraints.BOTH;
+
+        //Listen to events from the Convert button.
+        addRow.addActionListener(this);
+
+        //Add the widgets to the container.
+        converterPanel.add(tempText, constraints);
+        converterPanel.add(label, constraints1);
+        converterPanel.add(addRow, constraints2);
+
+
+        label.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
+
+    }
+
+    public void actionPerformed(ActionEvent event)
+    {
+
+        if (!removed)
+        {
+
+            converterPanel.remove(tempText);
+            converterPanel.remove(label);
+            removed = true;
+
+        }
+        else
+        {
+            TwoColumnConstraints constraints = new TwoColumnConstraints();
+            constraints.position = TwoColumnConstraints.EAST;
+            converterPanel.add(tempText, constraints);
+
+            TwoColumnConstraints constraints1 = new TwoColumnConstraints();
+            constraints1.position = TwoColumnConstraints.WEST;
+            converterPanel.add(label, constraints1);
+            removed = false;
+
+        }
+        converterPanel.repaint();
+
+    }
+
+    /**
+     * Create the GUI and show it.  For thread safety,
+     * this method should be invoked from the
+     * event-dispatching thread.
+     */
+    private static void createAndShowGUI()
+    {
+        //Make sure we have nice window decorations.
+        JFrame.setDefaultLookAndFeelDecorated(true);
+
+        TwoColumnLayoutTest converter = new TwoColumnLayoutTest();
+    }
+
+    public static void main(String[] args)
+    {
+        //Schedule a job for the event-dispatching thread:
+        //creating and showing this application's GUI.
+        javax.swing.SwingUtilities.invokeLater(new Runnable()
+        {
+            public void run()
+            {
+                createAndShowGUI();
+            }
+        });
+    }
+}




More information about the izpack-changes mailing list