Fix EDKT352: Scroll bar should be displayed when the table is out of screen scope
authorjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 28 Sep 2006 10:09:45 +0000 (10:09 +0000)
committerjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 28 Sep 2006 10:09:45 +0000 (10:09 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1638 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java

index 7f06730..c79d772 100644 (file)
@@ -24,6 +24,7 @@ import java.awt.FlowLayout;
 import javax.swing.AbstractAction;\r
 import java.awt.event.ActionEvent;\r
 import java.awt.event.ActionListener;\r
+import java.awt.event.ComponentEvent;\r
 \r
 import javax.swing.DefaultCellEditor;\r
 import javax.swing.JFileChooser;\r
@@ -46,6 +47,7 @@ import javax.swing.table.TableModel;
 \r
 import org.tianocore.PlatformSurfaceAreaDocument;\r
 import org.tianocore.frameworkwizard.common.DataValidation;\r
+import org.tianocore.frameworkwizard.common.Tools;\r
 import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;\r
 import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r
 \r
@@ -57,6 +59,7 @@ import java.util.Set;
 import java.util.Vector;\r
 import java.awt.Dimension;\r
 import javax.swing.JSplitPane;\r
+import java.awt.GridLayout;\r
 \r
 public class FpdBuildOptions extends IInternalFrame {\r
 \r
@@ -194,8 +197,6 @@ public class FpdBuildOptions extends IInternalFrame {
 \r
     private JTable jTableOptions = null;\r
     \r
-    private JLabel jTitle = null;\r
-\r
     private JButton jButtonOptionsAdd = null;\r
 \r
     private JButton jButtonOptionsDel = null;\r
@@ -302,6 +303,10 @@ public class FpdBuildOptions extends IInternalFrame {
 \r
     private JPanel jPanelUserDefCenterN = null;\r
 \r
+    private JPanel jPanelTableOptionsContainer = null;\r
+\r
+    private JLabel jLabelTableOptionsTitle = null;\r
+\r
     /**\r
      * This method initializes jPanel  \r
      *         \r
@@ -394,6 +399,23 @@ public class FpdBuildOptions extends IInternalFrame {
         return jContentPane;\r
     }\r
 \r
+    /**\r
+     * This method initializes jPanelTableOptionsContainer     \r
+     *         \r
+     * @return javax.swing.JPanel      \r
+     */\r
+    private JPanel getJPanelTableOptionsContainer() {\r
+        if (jPanelTableOptionsContainer == null) {\r
+            jLabelTableOptionsTitle = new JLabel();\r
+            jLabelTableOptionsTitle.setText("  Current Option Configuration Lines");\r
+            jPanelTableOptionsContainer = new JPanel();\r
+            jPanelTableOptionsContainer.setLayout(new BorderLayout());\r
+            jPanelTableOptionsContainer.add(jLabelTableOptionsTitle, java.awt.BorderLayout.NORTH);\r
+            jPanelTableOptionsContainer.add(getJScrollPaneOptions(), java.awt.BorderLayout.CENTER);\r
+        }\r
+        return jPanelTableOptionsContainer;\r
+    }\r
+\r
     /**\r
      * @param args\r
      */\r
@@ -1358,15 +1380,17 @@ public class FpdBuildOptions extends IInternalFrame {
             //            FlowLayout flowLayout9 = new FlowLayout();\r
             //            flowLayout9.setAlignment(java.awt.FlowLayout.LEFT);\r
 \r
+            GridLayout gridLayout = new GridLayout();\r
+            gridLayout.setRows(2);\r
             jPanelOptionsTab = new JPanel();\r
+            jPanelOptionsTab.setLayout(gridLayout);\r
             jPanelOptionsTab.setBounds(new java.awt.Rectangle(0, 0, dialogWidth * 2, dialogHeight * 3));\r
             jPanelOptionsTab.setPreferredSize(new java.awt.Dimension(dialogWidth + 10, (dialogHeight * 3) + 10));\r
             jPanelOptionsTab.setAutoscrolls(true);\r
             jPanelOptionsTab.setLocation(0, 0);\r
-            jPanelOptionsTab.setLayout(null);\r
             jPanelOptionsTab.add(getJPanelOptionsContainer(), null);\r
-            jPanelOptionsTab.add(getJScrollPaneOptions(), null);\r
-\r
+//            jPanelOptionsTab.add(getJScrollPaneOptions(), null);\r
+            jPanelOptionsTab.add(getJPanelTableOptionsContainer(), null);\r
         }\r
         return jPanelOptionsTab;\r
     }\r
@@ -1408,8 +1432,6 @@ public class FpdBuildOptions extends IInternalFrame {
 \r
             jPanelOptionsContainer.setLayout(null);\r
             \r
-            jPanelOptionsContainer.setLocation(new java.awt.Point(2, 2));\r
-            jPanelOptionsContainer.setBounds(new java.awt.Rectangle(2, 2, dialogWidth * 2, dialogHeight));\r
             jPanelOptionsContainer.setPreferredSize(new java.awt.Dimension(dialogWidth, dialogHeight));\r
             /*\r
             jPanelOptionsContainer\r
@@ -1701,6 +1723,12 @@ public class FpdBuildOptions extends IInternalFrame {
         return jButtonOptionsDel;\r
     }\r
 \r
+    public void componentResized(ComponentEvent arg0) {\r
+        int intPreferredWidth = 500;\r
+        \r
+        Tools.resizeComponentWidth(this.jScrollPaneOptions, this.getWidth(), intPreferredWidth);\r
+        \r
+    }\r
     /**\r
      * This method initializes jScrollPaneOptions      \r
      *         Contains the Table and is located below the data entry section\r
@@ -1709,10 +1737,6 @@ public class FpdBuildOptions extends IInternalFrame {
     private JScrollPane getJScrollPaneOptions() {\r
         if (jScrollPaneOptions == null) {\r
             jScrollPaneOptions = new JScrollPane();\r
-            jScrollPaneOptions.setPreferredSize(new java.awt.Dimension(dialogWidth, dialogHeight * 2));\r
-            jScrollPaneOptions.setBounds(new java.awt.Rectangle(2, (dialogHeight * 2) + 2, dialogWidth * 2, dialogHeight * 2));\r
-            jScrollPaneOptions.setLocation(new java.awt.Point(2, dialogHeight + 2));\r
-\r
             jScrollPaneOptions.setViewportView(getJTableOptions());\r
         }\r
         return jScrollPaneOptions;\r
@@ -1725,9 +1749,6 @@ public class FpdBuildOptions extends IInternalFrame {
      */\r
     private JTable getJTableOptions() {\r
         if (jTableOptions == null) {\r
-            jTitle = new JLabel();\r
-            jTitle.setText("Current Option Configuration Lines");\r
-            jTitle.setBounds(2, 2, labelWidth, oneRowHeight);\r
             \r
             optionsTableModel = new DefaultTableModel();\r
             jTableOptions = new JTable(optionsTableModel);\r
@@ -1759,7 +1780,7 @@ public class FpdBuildOptions extends IInternalFrame {
             jTableOptions.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor());\r
             \r
             jTableOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
-           jTableOptions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);\r
+               jTableOptions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);\r
             jTableOptions.getSelectionModel().addListSelectionListener(new ListSelectionListener() {\r
                 public void valueChanged(ListSelectionEvent e) {\r
                     selectedRow = -1;\r