3 The file is used to create, update Package Definitions of Spd file
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 package org
.tianocore
.frameworkwizard
.packaging
.ui
;
17 import javax
.swing
.JPanel
;
18 import javax
.swing
.JLabel
;
19 import javax
.swing
.JComboBox
;
20 import java
.awt
.Dimension
;
22 import org
.tianocore
.PackageSurfaceAreaDocument
;
23 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningPackageType
;
24 import org
.tianocore
.frameworkwizard
.common
.ui
.IInternalFrame
;
25 import org
.tianocore
.frameworkwizard
.common
.ui
.StarLabel
;
27 public class SpdPackageDefinitions
extends IInternalFrame
{
32 private static final long serialVersionUID
= 1L;
33 private JPanel jContentPane
= null;
34 private JLabel jLabelRdOnly
= null;
35 private JComboBox jComboBoxReadOnly
= null;
36 private JLabel jLabelRePkg
= null;
37 private JComboBox jComboBoxRePackage
= null;
38 private StarLabel starLabel
= null;
39 private StarLabel starLabel1
= null;
40 private SpdFileContents sfc
= null;
41 private OpeningPackageType docConsole
= null;
44 * This is the default constructor
46 public SpdPackageDefinitions() {
51 public SpdPackageDefinitions(PackageSurfaceAreaDocument
.PackageSurfaceArea inPsa
){
53 sfc
= new SpdFileContents(inPsa
);
57 public SpdPackageDefinitions(OpeningPackageType opt
) {
58 this(opt
.getXmlSpd());
62 private void init(SpdFileContents sfc
) {
63 if (sfc
.getSpdPkgDefsRdOnly() != null) {
64 jComboBoxReadOnly
.setSelectedItem(sfc
.getSpdPkgDefsRdOnly());
66 if (sfc
.getSpdPkgDefsRePkg() != null) {
67 jComboBoxRePackage
.setSelectedItem(sfc
.getSpdPkgDefsRePkg());
69 this.setVisible(true);
72 * This method initializes this
76 private void initialize() {
77 this.setSize(300, 200);
78 this.setTitle("Package Definitions");
79 this.setContentPane(getJContentPane());
83 * This method initializes jContentPane
85 * @return javax.swing.JPanel
87 private JPanel
getJContentPane() {
88 if (jContentPane
== null) {
89 starLabel1
= new StarLabel();
90 starLabel1
.setBounds(new java
.awt
.Rectangle(4,62,10,20));
91 starLabel1
.setVisible(true);
92 starLabel
= new StarLabel();
93 starLabel
.setBounds(new java
.awt
.Rectangle(4,22,10,20));
94 jLabelRePkg
= new JLabel();
95 jLabelRePkg
.setPreferredSize(new java
.awt
.Dimension(65,20));
96 jLabelRePkg
.setLocation(new java
.awt
.Point(22,62));
97 jLabelRePkg
.setSize(new java
.awt
.Dimension(65,20));
98 jLabelRePkg
.setText("RePackage");
99 jLabelRdOnly
= new JLabel();
100 jLabelRdOnly
.setPreferredSize(new java
.awt
.Dimension(57,20));
101 jLabelRdOnly
.setLocation(new java
.awt
.Point(22,22));
102 jLabelRdOnly
.setSize(new java
.awt
.Dimension(57,20));
103 jLabelRdOnly
.setText("Read Only");
104 jContentPane
= new JPanel();
105 jContentPane
.setLayout(null);
106 jContentPane
.add(jLabelRdOnly
, null);
107 jContentPane
.add(getJComboBox(), null);
108 jContentPane
.add(jLabelRePkg
, null);
109 jContentPane
.add(getJComboBox1(), null);
110 jContentPane
.add(starLabel
, null);
111 jContentPane
.add(starLabel1
, null);
117 * This method initializes jComboBox
119 * @return javax.swing.JComboBox
121 private JComboBox
getJComboBox() {
122 if (jComboBoxReadOnly
== null) {
123 jComboBoxReadOnly
= new JComboBox();
124 jComboBoxReadOnly
.setBounds(new java
.awt
.Rectangle(95,22,117,20));
125 jComboBoxReadOnly
.setPreferredSize(new Dimension(80, 20));
126 jComboBoxReadOnly
.addItem("true");
127 jComboBoxReadOnly
.addItem("false");
128 jComboBoxReadOnly
.setSelectedIndex(1);
129 jComboBoxReadOnly
.addItemListener(new java
.awt
.event
.ItemListener() {
130 public void itemStateChanged(java
.awt
.event
.ItemEvent e
) {
131 if (jComboBoxReadOnly
.getSelectedItem().equals(sfc
.getSpdPkgDefsRdOnly())) {
134 if (docConsole
!= null) {
135 docConsole
.setSaved(false);
137 sfc
.setSpdPkgDefsRdOnly(jComboBoxReadOnly
.getSelectedItem()+"");
141 return jComboBoxReadOnly
;
145 * This method initializes jComboBox1
147 * @return javax.swing.JComboBox
149 private JComboBox
getJComboBox1() {
150 if (jComboBoxRePackage
== null) {
151 jComboBoxRePackage
= new JComboBox();
152 jComboBoxRePackage
.setBounds(new java
.awt
.Rectangle(95,62,116,20));
153 jComboBoxRePackage
.setPreferredSize(new Dimension(80, 20));
154 jComboBoxRePackage
.addItem("false");
155 jComboBoxRePackage
.addItem("true");
156 jComboBoxRePackage
.setSelectedIndex(0);
157 jComboBoxRePackage
.addItemListener(new java
.awt
.event
.ItemListener() {
158 public void itemStateChanged(java
.awt
.event
.ItemEvent e
) {
159 if (jComboBoxRePackage
.getSelectedItem().equals(sfc
.getSpdPkgDefsRePkg())) {
162 if (docConsole
!= null) {
163 docConsole
.setSaved(false);
165 sfc
.setSpdPkgDefsRePkg(jComboBoxRePackage
.getSelectedItem()+"");
169 return jComboBoxRePackage
;