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 jLabel
= null;
35 private JComboBox jComboBoxReadOnly
= null;
36 private JLabel jLabel1
= 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 jLabel1
= new JLabel();
95 jLabel1
.setPreferredSize(new java
.awt
.Dimension(65,20));
96 jLabel1
.setLocation(new java
.awt
.Point(22,62));
97 jLabel1
.setSize(new java
.awt
.Dimension(65,20));
98 jLabel1
.setText("RePackage");
99 jLabel
= new JLabel();
100 jLabel
.setPreferredSize(new java
.awt
.Dimension(57,20));
101 jLabel
.setLocation(new java
.awt
.Point(22,22));
102 jLabel
.setSize(new java
.awt
.Dimension(57,20));
103 jLabel
.setText("Read Only");
104 jContentPane
= new JPanel();
105 jContentPane
.setLayout(null);
106 jContentPane
.add(jLabel
, null);
107 jContentPane
.add(getJComboBox(), null);
108 jContentPane
.add(jLabel1
, 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 (docConsole
!= null) {
132 docConsole
.setSaved(false);
134 sfc
.setSpdPkgDefsRdOnly(jComboBoxReadOnly
.getSelectedItem()+"");
138 return jComboBoxReadOnly
;
142 * This method initializes jComboBox1
144 * @return javax.swing.JComboBox
146 private JComboBox
getJComboBox1() {
147 if (jComboBoxRePackage
== null) {
148 jComboBoxRePackage
= new JComboBox();
149 jComboBoxRePackage
.setBounds(new java
.awt
.Rectangle(95,62,116,20));
150 jComboBoxRePackage
.setPreferredSize(new Dimension(80, 20));
151 jComboBoxRePackage
.addItem("false");
152 jComboBoxRePackage
.addItem("true");
153 jComboBoxRePackage
.setSelectedIndex(0);
154 jComboBoxRePackage
.addItemListener(new java
.awt
.event
.ItemListener() {
155 public void itemStateChanged(java
.awt
.event
.ItemEvent e
) {
156 if (docConsole
!= null) {
157 docConsole
.setSaved(false);
159 sfc
.setSpdPkgDefsRePkg(jComboBoxRePackage
.getSelectedItem()+"");
163 return jComboBoxRePackage
;