From 778d35c92a569812c3b2f6d0b913315bdce4c874 Mon Sep 17 00:00:00 2001 From: alfred Date: Tue, 22 Aug 2006 05:45:43 +0000 Subject: [PATCH] new look git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1346 6f19259b-4bc3-4df7-8a09-765794883524 --- .../org/tianocore/migration/FirstPanel.java | 83 +++++++++++++++++-- .../tianocore/migration/MigrationTool.java | 12 +++ .../tianocore/migration/MsaTreeEditor.java | 2 - 3 files changed, 86 insertions(+), 11 deletions(-) diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/FirstPanel.java b/Tools/Source/MigrationTools/org/tianocore/migration/FirstPanel.java index 8c07783cd4..8c428087d6 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/FirstPanel.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/FirstPanel.java @@ -18,7 +18,7 @@ import java.io.*; import java.util.*; import javax.swing.*; -public final class FirstPanel extends JPanel implements ActionListener, UI { +public final class FirstPanel extends JPanel implements ActionListener, ItemListener, UI { /** * Define class Serial Version UID */ @@ -31,12 +31,17 @@ public final class FirstPanel extends JPanel implements ActionListener, UI { private JTextField moduletext; private JTextArea log; private JFileChooser fc; - private JCheckBox filebox, screenbox; + private JCheckBox filebox, screenbox, mibox, criticbox, defaultpathbox; private boolean tofile = true, toscreen = true; private PrintWriter logfile; FirstPanel() throws Exception { + GridBagLayout gridbag = new GridBagLayout(); + setLayout(gridbag); + + GridBagConstraints cst = new GridBagConstraints(); + goButton = new JButton("Go"); goButton.addActionListener(this); goButton.setActionCommand("go"); @@ -53,22 +58,53 @@ public final class FirstPanel extends JPanel implements ActionListener, UI { moduletext = new JTextField(30); filebox = new JCheckBox("Output to logfile", true); + filebox.addItemListener(this); screenbox = new JCheckBox("Specify logfile", false); + screenbox.addItemListener(this); + mibox = new JCheckBox("Show ModuleInfo", false); + mibox.addItemListener(this); + criticbox = new JCheckBox("Run Critic", true); + criticbox.addItemListener(this); + defaultpathbox = new JCheckBox("Use Default Output Path", true); + defaultpathbox.addItemListener(this); JPanel modulePanel = new JPanel(); modulePanel.add(moduleButton); modulePanel.add(moduletext); - modulePanel.add(filebox); - modulePanel.add(screenbox); modulePanel.add(goButton); //modulePanel.add(msaEditorButton); - modulePanel.add(criticButton); + cst.gridx = 0; + cst.gridy = 0; + //cst.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints(modulePanel, cst); add(modulePanel); - log = new JTextArea(20,25); + cst.gridx = 1; + cst.gridy = 0; + gridbag.setConstraints(criticButton, cst); + add(criticButton); + + JPanel checkboxPanel = new JPanel(); + checkboxPanel.setLayout(new BoxLayout(checkboxPanel, BoxLayout.Y_AXIS)); + checkboxPanel.add(filebox); + checkboxPanel.add(screenbox); + checkboxPanel.add(mibox); + checkboxPanel.add(criticbox); + checkboxPanel.add(defaultpathbox); + cst.gridx = 1; + cst.gridy = 1; + //cst.gridheight = 2; + gridbag.setConstraints(checkboxPanel, cst); + add(checkboxPanel); + + log = new JTextArea(10,20); log.setMargin(new Insets(5,5,5,5)); log.setEditable(false); JScrollPane logScrollPane = new JScrollPane(log); + cst.gridx = 0; + cst.gridy = 1; + cst.fill = GridBagConstraints.BOTH; + gridbag.setConstraints(logScrollPane, cst); add(logScrollPane); fc = new JFileChooser(); @@ -155,8 +191,36 @@ public final class FirstPanel extends JPanel implements ActionListener, UI { } public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.DESELECTED) { - System.out.println("changed"); + if (e.getSource() == filebox) { + if (e.getStateChange() == ItemEvent.DESELECTED) { + System.out.println("filebox DESELECTED"); + } else if (e.getStateChange() == ItemEvent.SELECTED) { + System.out.println("filebox SELECTED"); + } + } else if (e.getSource() == screenbox) { + if (e.getStateChange() == ItemEvent.DESELECTED) { + System.out.println("screenbox DESELECTED"); + } else if (e.getStateChange() == ItemEvent.SELECTED) { + System.out.println("screenbox SELECTED"); + } + } else if (e.getSource() == mibox) { + if (e.getStateChange() == ItemEvent.DESELECTED) { + System.out.println("mibox DESELECTED"); + } else if (e.getStateChange() == ItemEvent.SELECTED) { + System.out.println("mibox SELECTED"); + } + } else if (e.getSource() == criticbox) { + if (e.getStateChange() == ItemEvent.DESELECTED) { + System.out.println("criticbox DESELECTED"); + } else if (e.getStateChange() == ItemEvent.SELECTED) { + System.out.println("criticbox SELECTED"); + } + } else if (e.getSource() == defaultpathbox) { + if (e.getStateChange() == ItemEvent.DESELECTED) { + System.out.println("defaultpathbox DESELECTED"); + } else if (e.getStateChange() == ItemEvent.SELECTED) { + System.out.println("defaultpathbox SELECTED"); + } } } @@ -175,7 +239,8 @@ public final class FirstPanel extends JPanel implements ActionListener, UI { frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); FirstPanel fp = new FirstPanel(); - fp.setLayout(new BoxLayout(fp, BoxLayout.Y_AXIS)); + //fp.setLayout(new GridBagLayout()); + //fp.setLayout(new BoxLayout(fp, BoxLayout.Y_AXIS)); fp.setOpaque(true); frame.setContentPane(fp); diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java b/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java index 0d48be52eb..d6119e6e45 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java @@ -1,3 +1,15 @@ +/** @file + + Copyright (c) 2006, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + **/ package org.tianocore.migration; public class MigrationTool { diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/MsaTreeEditor.java b/Tools/Source/MigrationTools/org/tianocore/migration/MsaTreeEditor.java index 5eb688ce0e..7bdf028119 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/MsaTreeEditor.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/MsaTreeEditor.java @@ -5,8 +5,6 @@ import java.awt.event.*; import javax.swing.*; import javax.swing.tree.*; -import org.tianocore.ModuleSurfaceAreaDocument; - public class MsaTreeEditor extends JPanel { /** * Define class Serial Version UID -- 2.39.2