/** @file\r
\r
- The file is used to create, update Library Class Definition of MSA/MBD file\r
+ The file is used to create, update Library Class Definition section of the MSA file\r
\r
Copyright (c) 2006, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
import org.tianocore.frameworkwizard.common.ui.IFrame;\r
import org.tianocore.frameworkwizard.common.ui.StarLabel;\r
import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;\r
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassIdentification;\r
+import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r
\r
/**\r
- The class is used to create, update Library Class Definition of MSA/MBD file\r
- It extends IInternalFrame\r
- \r
- **/\r
+ * The class is used to create, update Library Class Definition section of the MSA file\r
+ * \r
+ * It extends IDialog\r
+ * \r
+ */\r
public class LibraryClassDefsDlg extends IDialog {\r
\r
///\r
private JTextField jTextFieldHelpText = null;\r
\r
private ArchCheckBox jArchCheckBox = null;\r
- \r
+\r
private JButton jButtonOk = null;\r
\r
private JButton jButtonCancel = null;\r
private JComboBox getJComboBoxLibraryClassName() {\r
if (jComboBoxLibraryClassName == null) {\r
jComboBoxLibraryClassName = new JComboBox();\r
- jComboBoxLibraryClassName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
+ jComboBoxLibraryClassName.setBounds(new java.awt.Rectangle(168, 12, 320, 20));\r
jComboBoxLibraryClassName.setPreferredSize(new Dimension(320, 20));\r
jComboBoxLibraryClassName.setEnabled(true);\r
}\r
private JComboBox getJComboBoxUsage() {\r
if (jComboBoxUsage == null) {\r
jComboBoxUsage = new JComboBox();\r
- jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20));\r
+ jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 37, 320, 20));\r
jComboBoxUsage.setPreferredSize(new Dimension(320, 20));\r
}\r
return jComboBoxUsage;\r
private JButton getJButtonGenerateGuid() {\r
if (jButtonGenerateGuid == null) {\r
jButtonGenerateGuid = new JButton();\r
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 110, 65, 20));\r
+ jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 112, 65, 20));\r
jButtonGenerateGuid.setPreferredSize(new java.awt.Dimension(65, 20));\r
jButtonGenerateGuid.setText("GEN");\r
jButtonGenerateGuid.setVisible(false);\r
private JTextField getJTextFieldFeatureFlag() {\r
if (jTextFieldFeatureFlag == null) {\r
jTextFieldFeatureFlag = new JTextField();\r
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 85, 320, 20));\r
+ jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168,197,320,20));\r
jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));\r
+ jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");\r
+ jTextFieldFeatureFlag.setEnabled(false);\r
}\r
return jTextFieldFeatureFlag;\r
}\r
private JScrollPane getJScrollPaneModuleList() {\r
if (jScrollPaneModuleList == null) {\r
jScrollPaneModuleList = new JScrollPane();\r
- jScrollPaneModuleList.setBounds(new java.awt.Rectangle(160, 135, 320, 80));\r
+ jScrollPaneModuleList.setBounds(new java.awt.Rectangle(168, 112, 320, 80));\r
jScrollPaneModuleList.setPreferredSize(new java.awt.Dimension(320, 80));\r
jScrollPaneModuleList.setViewportView(getICheckBoxListSupModuleList());\r
}\r
private JTextField getJTextFieldHelpText() {\r
if (jTextFieldHelpText == null) {\r
jTextFieldHelpText = new JTextField();\r
- jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 60, 320, 20));\r
+ jTextFieldHelpText.setBounds(new java.awt.Rectangle(168, 62, 320, 20));\r
jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));\r
}\r
return jTextFieldHelpText;\r
private JButton getJButtonOk() {\r
if (jButtonOk == null) {\r
jButtonOk = new JButton();\r
- jButtonOk.setBounds(new java.awt.Rectangle(290, 225, 90, 20));\r
+ jButtonOk.setBounds(new java.awt.Rectangle(300, 232, 90, 20));\r
jButtonOk.setText("Ok");\r
jButtonOk.addActionListener(this);\r
}\r
private JButton getJButtonCancel() {\r
if (jButtonCancel == null) {\r
jButtonCancel = new JButton();\r
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 225, 90, 20));\r
+ jButtonCancel.setBounds(new java.awt.Rectangle(400, 232, 90, 20));\r
jButtonCancel.setText("Cancel");\r
jButtonCancel.addActionListener(this);\r
}\r
This is the default constructor\r
\r
**/\r
- public LibraryClassDefsDlg(LibraryClassIdentification inLibraryClassIdentification, IFrame iFrame) {\r
+ public LibraryClassDefsDlg(LibraryClassIdentification inLibraryClassIdentification, IFrame iFrame, ModuleIdentification mid) {\r
super(iFrame, true);\r
- init(inLibraryClassIdentification);\r
+ init(inLibraryClassIdentification, mid);\r
}\r
\r
/**\r
private void init() {\r
this.setContentPane(getJScrollPane());\r
this.setTitle("Library Class Definitions");\r
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 295));\r
+ this.setBounds(new java.awt.Rectangle(0, 0, 505, 305));\r
initFrame();\r
this.setViewMode(false);\r
this.centerWindow();\r
This method initializes this\r
\r
**/\r
- private void init(LibraryClassIdentification inLibraryClassIdentification) {\r
+ private void init(LibraryClassIdentification inLibraryClassIdentification, ModuleIdentification mid) {\r
init();\r
this.lcid = inLibraryClassIdentification;\r
+ \r
+ Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);\r
+ if (vpid.size() <= 0) {\r
+ Log.wrn("Init Library Class", "This module hasn't defined any package dependency, so there is no library class can be added");\r
+ }\r
+ \r
+ Tools.generateComboBoxByVector(this.jComboBoxLibraryClassName,\r
+ wt.getAllLibraryClassDefinitionsFromPackages(wt.getPackageDependenciesOfModule(mid)));\r
+\r
if (lcid != null) {\r
this.jComboBoxLibraryClassName.setSelectedItem(lcid.getLibraryClassName());\r
this.jComboBoxUsage.setSelectedItem(lcid.getUsage());\r
private JPanel getJContentPane() {\r
if (jContentPane == null) {\r
jArchCheckBox = new ArchCheckBox();\r
- jArchCheckBox.setBounds(new java.awt.Rectangle(160, 110, 320, 20));\r
+ jArchCheckBox.setBounds(new java.awt.Rectangle(168, 87, 320, 20));\r
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));\r
jLabelHelpText = new JLabel();\r
- jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 140, 20));\r
+ jLabelHelpText.setBounds(new java.awt.Rectangle(12, 62, 168, 20));\r
jLabelHelpText.setText("Help Text");\r
jLabelModuleList = new JLabel();\r
- jLabelModuleList.setBounds(new java.awt.Rectangle(15, 135, 140, 20));\r
- jLabelModuleList.setText("Sup Module List");\r
+ jLabelModuleList.setBounds(new java.awt.Rectangle(12, 112, 168, 20));\r
+ jLabelModuleList.setText("Supported Module Types");\r
jLabelArch = new JLabel();\r
- jLabelArch.setBounds(new java.awt.Rectangle(15, 110, 140, 20));\r
- jLabelArch.setText("Sup Arch List");\r
+ jLabelArch.setBounds(new java.awt.Rectangle(12, 87, 168, 20));\r
+ jLabelArch.setText("Supported Architectures");\r
jLabelFeatureFlag = new JLabel();\r
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
- jLabelFeatureFlag.setText("Feature Flag");\r
+ jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12,197,168,20));\r
+ jLabelFeatureFlag.setText("Feature Flag Expression");\r
+ jLabelFeatureFlag.setEnabled(false);\r
jLabelRecommendedInstanceGuid = new JLabel();\r
- jLabelRecommendedInstanceGuid.setBounds(new java.awt.Rectangle(15, 110, 200, 20));\r
+ jLabelRecommendedInstanceGuid.setBounds(new java.awt.Rectangle(12, 87, 200, 20));\r
jLabelRecommendedInstanceGuid.setText("Recommended Instance Guid");\r
jLabelRecommendedInstanceGuid.setVisible(false);\r
jLabelRecommendedInstanceVersion = new JLabel();\r
- jLabelRecommendedInstanceVersion.setBounds(new java.awt.Rectangle(15, 85, 200, 20));\r
+ jLabelRecommendedInstanceVersion.setBounds(new java.awt.Rectangle(12, 87, 200, 20));\r
jLabelRecommendedInstanceVersion.setText("Recommended Instance Version");\r
jLabelRecommendedInstanceVersion.setVisible(false);\r
jLabelLibraryClassName = new JLabel();\r
- jLabelLibraryClassName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
+ jLabelLibraryClassName.setBounds(new java.awt.Rectangle(12, 12, 168, 20));\r
jLabelLibraryClassName.setText("Library Class Name");\r
jLabelUsage = new JLabel();\r
- jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
+ jLabelUsage.setBounds(new java.awt.Rectangle(12, 37, 168, 20));\r
jLabelUsage.setText("Usage");\r
jContentPane = new JPanel();\r
jContentPane.setLayout(null);\r
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 245));\r
+ jContentPane.setPreferredSize(new java.awt.Dimension(495, 255));\r
\r
jContentPane.add(getJComboBoxLibraryClassName(), null);\r
jContentPane.add(jLabelUsage, null);\r
jContentPane.add(getJTextFieldFeatureFlag(), null);\r
jContentPane.add(jLabelArch, null);\r
jStarLabel1 = new StarLabel();\r
- jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
+ jStarLabel1.setLocation(new java.awt.Point(2, 10));\r
jStarLabel2 = new StarLabel();\r
- jStarLabel2.setLocation(new java.awt.Point(0, 35));\r
+ jStarLabel2.setLocation(new java.awt.Point(2, 35));\r
\r
jContentPane.add(jStarLabel1, null);\r
jContentPane.add(jStarLabel2, null);\r
\r
**/\r
private void initFrame() {\r
- Tools.generateComboBoxByVector(jComboBoxLibraryClassName, wt.getAllLibraryClassDefinitionsFromWorkspace());\r
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVLibraryUsage());\r
this.iCheckBoxListModule.setAllItems(ed.getVFrameworkModuleTypes());\r
}\r
// Check LibraryClass\r
//\r
if (this.jComboBoxLibraryClassName.getSelectedItem() == null) {\r
- Log.err("No Library Class can be added");\r
+ Log.wrn("Update Library Class Definitions", "Please select one Library Class");\r
return false;\r
}\r
if (!DataValidation.isLibraryClass(this.jComboBoxLibraryClassName.getSelectedItem().toString())) {\r
- Log.err("Incorrect data type for Library Class");\r
+ Log.wrn("Update Library Class Definitions", "Incorrect data type for Library Class");\r
return false;\r
}\r
\r
//\r
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {\r
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {\r
- Log.err("Incorrect data type for Feature Flag");\r
+ Log.wrn("Update Library Class Definitions", "Incorrect data type for Feature Flag");\r
return false;\r
}\r
}\r