+++ /dev/null
-Manifest-Version: 1.0\r
-Main-Class: org.tianocore.packaging.module.ui.ModuleMain\r
+++ /dev/null
-<?xml version="1.0"?>\r
-<!--\r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
--->\r
-<project name="ModuleEditor" default="all" basedir=".">\r
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>\r
- <property environment="env"/>\r
- <property name="WORKSPACE" value="${env.WORKSPACE}"/>\r
- <path id="classpath">\r
- <fileset dir="${WORKSPACE}/Tools/Jars" includes="*.jar"/>\r
- <fileset dir="${env.XMLBEANS_HOME}/lib" includes="*.jar"/>\r
- </path>\r
- <property name="buildDir" value="build"/>\r
- <property name="installLocation" value="${WORKSPACE}/Tools/bin"/>\r
- <target name="all" depends="install"/>\r
- <target name="source">\r
- <mkdir dir="${buildDir}"/>\r
- <javac srcdir="src" destdir="${buildDir}">\r
- <classpath refid="classpath"/>\r
- <!-- <compilerarg value="-Xlint"/> -->\r
- </javac>\r
- </target>\r
- <target name="clean">\r
- <delete dir="${buildDir}"/>\r
- </target>\r
- <target name="cleanall">\r
- <delete dir="${buildDir}"/>\r
- <delete file="${installLocation}/ModuleEditor.jar"/>\r
- </target>\r
- <target name="install" depends="source">\r
- <jar destfile="${installLocation}/ModuleEditor.jar"\r
- basedir="${buildDir}"\r
- includes="**"\r
- manifest="MANIFEST.MF"\r
- />\r
- </target>\r
-</project>\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to define all used final variables\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
- **/\r
-package org.tianocore.common;\r
-\r
-/**\r
- The class is used to define all used final variables\r
- \r
- @since ModuleEditor 1.0\r
-\r
-**/\r
-public class DataType {\r
-\r
- /**\r
- \r
- @param args\r
- \r
- **/\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
- \r
- //\r
- // Define all used final variables\r
- //\r
- public static final String DOS_LINE_SEPARATOR = "\r\n";\r
-\r
- public static final String UNXI_LINE_SEPARATOR = "\n";\r
- \r
- public static final String EMPTY_SELECT_ITEM = "----";\r
-\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to provides all kinds of Data Validation interface \r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
- **/\r
-\r
-package org.tianocore.common;\r
-\r
-import java.util.regex.Matcher;\r
-import java.util.regex.Pattern;\r
-\r
-/**\r
- The class is used to provides all kinds of data validation interface\r
-\r
- <p>All provided interfaces are in static mode</p>\r
- \r
- @since ModuleEditor 1.0\r
- \r
- **/\r
-public class DataValidation {\r
-\r
- /**\r
- Reserved for test\r
- \r
- @param args\r
- \r
- **/\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- //\r
- // The below is used to check common data types\r
- //\r
-\r
- /**\r
- Check if the imput data is int\r
- \r
- @param strInt The input string which needs validation\r
- \r
- @retval true - The input is Int\r
- @retval false - The input is not Int\r
- \r
- **/\r
- public static boolean isInt(String strInt) {\r
- return isMatch("^-?[0-9]\\d*$", strInt);\r
- }\r
-\r
- /**\r
- Check if the input data is int and it is in the valid scope\r
- The scope is provided by String\r
- \r
- @param strNumber The input string which needs validation\r
- @param BeginNumber The left boundary of the scope\r
- @param EndNumber The right boundary of the scope\r
- \r
- @retval true - The input is Int and in the scope;\r
- @retval false - The input is not Int or not in the scope\r
- \r
- **/\r
- public static boolean isInt(String strNumber, int BeginNumber, int EndNumber) {\r
- //\r
- //Check if the input data is int first\r
- //\r
- if (!isInt(strNumber)) {\r
- return false;\r
- }\r
- //\r
- //And then check if the data is between the scope\r
- //\r
- Integer intTemp = new Integer(strNumber);\r
- if ((intTemp.intValue() < BeginNumber) || (intTemp.intValue() > EndNumber)) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- /**\r
- Check if the input data is int and it is in the valid scope\r
- The scope is provided by String\r
- \r
- @param strNumber The input string which needs validation\r
- @param strBeginNumber The left boundary of the scope\r
- @param strEndNumber The right boundary of the scope\r
- \r
- @retval true - The input is Int and in the scope;\r
- @retval false - The input is not Int or not in the scope\r
- \r
- **/\r
- public static boolean isInt(String strNumber, String strBeginNumber, String strEndNumber) {\r
- //\r
- //Check if all input data are int\r
- //\r
- if (!isInt(strNumber)) {\r
- return false;\r
- }\r
- if (!isInt(strBeginNumber)) {\r
- return false;\r
- }\r
- if (!isInt(strEndNumber)) {\r
- return false;\r
- }\r
- //\r
- //And then check if the data is between the scope\r
- //\r
- Integer intI = new Integer(strNumber);\r
- Integer intJ = new Integer(strBeginNumber);\r
- Integer intK = new Integer(strEndNumber);\r
- if ((intI.intValue() < intJ.intValue()) || (intI.intValue() > intK.intValue())) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- /**\r
- Use regex to check if the input data is in valid format\r
- \r
- @param strPattern The input regex\r
- @param strMatcher The input data need be checked\r
- \r
- @retval true - The data matches the regex\r
- @retval false - The data doesn't match the regex\r
- \r
- **/\r
- public static boolean isMatch(String strPattern, String strMatcher) {\r
- Pattern pattern = Pattern.compile(strPattern);\r
- Matcher matcher = pattern.matcher(strMatcher);\r
-\r
- return matcher.find();\r
- }\r
-\r
- //\r
- // The below is used to check common customized data types\r
- //\r
-\r
- /**\r
- Check if the input data is BaseNameConvention\r
- \r
- @param strBaseNameConvention The input string need be checked\r
- \r
- @retval true - The input is BaseNameConvention\r
- @retval false - The input is not BaseNameConvention\r
- \r
- **/\r
- public static boolean isBaseNameConvention(String strBaseNameConvention) {\r
- return isMatch("[A-Z]([a-zA-Z0-9])*(_)?([a-zA-Z0-9])*", strBaseNameConvention);\r
- }\r
-\r
- /**\r
- Check if the input data is GuidArrayType\r
- \r
- @param strGuidArrayType The input string need be checked\r
- \r
- @retval true - The input is GuidArrayType\r
- @retval false - The input is not GuidArrayType\r
- \r
- **/\r
- public static boolean isGuidArrayType(String strGuidArrayType) {\r
- return isMatch(\r
- "0x[a-fA-F0-9]{1,8},( )*0x[a-fA-F0-9]{1,4},( )*0x[a-fA-F0-9]{1,4}(,( )*\\{)?(,?( )*0x[a-fA-F0-9]{1,2}){8}( )*(\\})?",\r
- strGuidArrayType);\r
- }\r
-\r
- /**\r
- Check if the input data is GuidNamingConvention\r
- \r
- @param strGuidNamingConvention The input string need be checked\r
- \r
- @retval true - The input is GuidNamingConvention\r
- @retval false - The input is not GuidNamingConvention\r
- \r
- **/\r
- public static boolean isGuidNamingConvention(String strGuidNamingConvention) {\r
- return isMatch("[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}",\r
- strGuidNamingConvention);\r
- }\r
-\r
- /**\r
- Check if the input data is GuidType \r
- \r
- @param strGuidType The input string need be checked\r
- \r
- @retval true - The input is GuidType\r
- @reture false is not GuidType\r
- \r
- **/\r
- public static boolean isGuidType(String strGuidType) {\r
- return (isGuidArrayType(strGuidType) || isGuidNamingConvention(strGuidType));\r
- }\r
-\r
- /**\r
- Check if the input data is Guid \r
- \r
- @param strGuid The input string need be checked\r
- \r
- @retval true - The input is Guid\r
- @retval false - The input is not Guid\r
- \r
- **/\r
- public static boolean isGuid(String strGuid) {\r
- return isGuidType(strGuid);\r
- }\r
-\r
- /**\r
- Check if the input data is Sentence\r
- \r
- @param strSentence The input string need be checked\r
- \r
- @retval true - The input is Sentence\r
- @retval false - The input is not Sentence\r
- \r
- **/\r
- public static boolean isSentence(String strSentence) {\r
- return isMatch("(\\w+\\W*)+( )+(\\W*\\w*\\W*\\s*)*", strSentence);\r
- }\r
-\r
- /**\r
- Check if the input data is DateType\r
- \r
- @param strDateType The input string need be checked\r
- \r
- @retval true - The input is DateType\r
- @retval false - The input is not DateType\r
- \r
- **/\r
- public static boolean isDateType(String strDateType) {\r
- return isMatch("[1-9][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9] [0-2][0-9]:[0-5][0-9]", strDateType);\r
- }\r
-\r
- /**\r
- Check if the input data is DosPath\r
- \r
- @param strDosPath The input string need be checked\r
- \r
- @retval true - The input is DosPath\r
- @retval false - The input is not DosPath\r
- \r
- **/\r
- public static boolean isDosPath(String strDosPath) {\r
- return isMatch("([a-zA-Z]:\\\\)?(((\\\\?_*-*.*[a-zA-Z0-9]*)*(_*-*.*[a-zA-Z0-9])*)+(\\\\)?)*", strDosPath);\r
- }\r
-\r
- /**\r
- Check if the input data is UnixPath\r
- \r
- @param strUnixPath The input string need be checked\r
- \r
- @retval true - The input is UnixPath\r
- @retval false - The input is not UnixPath\r
- \r
- **/\r
- public static boolean isUnixPath(String strUnixPath) {\r
- return isMatch("(\\/)?(((_*-*.*[a-zA-Z0-9]*)*(_*-*.*[a-zA-Z0-9])*)+(\\/)?)*", strUnixPath);\r
- }\r
-\r
- /**\r
- Check if the input data is DirectoryNamingConvention\r
- \r
- @param strDirectoryNamingConvention The input string need be checked\r
- \r
- @retval true - The input is DirectoryNamingConvention\r
- @retval false - The input is not DirectoryNamingConvention\r
- \r
- **/\r
- public static boolean isDirectoryNamingConvention(String strDirectoryNamingConvention) {\r
- return (isDosPath(strDirectoryNamingConvention) || isUnixPath(strDirectoryNamingConvention));\r
- }\r
-\r
- /**\r
- Check if the input data is HexDoubleWordDataType\r
- \r
- @param strHexDoubleWordDataType The input string need be checked\r
- \r
- @retval true - The input is HexDoubleWordDataType\r
- @retval false - The input is not HexDoubleWordDataType\r
- \r
- **/\r
- public static boolean isHexDoubleWordDataType(String strHexDoubleWordDataType) {\r
- return isMatch("0x[a-fA-F0-9]{1,8}", strHexDoubleWordDataType);\r
- }\r
-\r
- /**\r
- Check if the input data is V1\r
- \r
- @param strV1 The input string need be checked\r
- \r
- @retval true - The input is V1\r
- @retval false - The input is not V1\r
- \r
- **/\r
- public static boolean isV1(String strV1) {\r
- return isMatch("((%[A-Z](_*[A-Z0-9]*)*%)+((((\\\\)?_*-*.*[a-zA-Z0-9]*)*(_*-*.*[a-zA-Z0-9])*)+(\\\\)?)*)", strV1);\r
- }\r
-\r
- /**\r
- Check if the input data is V2\r
- \r
- @param strV2 The input string need be checked\r
- \r
- @retval true - The input is V2\r
- @retval false - The input is not V2\r
- \r
- **/\r
- public static boolean isV2(String strV2) {\r
- return isMatch(\r
- "(($[A-Z](_*[A-Z0-9]*)*)+||($\\([A-Z](_*[A-Z0-9]*)*\\))+||($\\{[A-Z](_*[A-Z0-9]*)*\\})+)+(\\/)?(((((_*-*.*[a-zA-Z0-9]*)*(_*-*.*[a-zA-Z0-9])*)+(\\/)?)*)*)",\r
- strV2);\r
- }\r
-\r
- /**\r
- Check if the input data is VariableConvention\r
- \r
- @param strVariableConvention The input string need be checked\r
- \r
- @retval true - The input is VariableConvention\r
- @retval false - The input is not VariableConvention\r
- \r
- **/\r
- public static boolean isVariableConvention(String strVariableConvention) {\r
- return (isV1(strVariableConvention) || isV2(strVariableConvention));\r
- }\r
-\r
- /**\r
- Check if the input data is UCName\r
- \r
- @param strUCName The input string need be checked\r
- \r
- @retval true - The input is UCName\r
- @retval false - The input is not UCName\r
- \r
- **/\r
- public static boolean isUCName(String strUCName) {\r
- return isMatch("[A-Z]+(_*[A-Z0-9]*( )*)*", strUCName);\r
- }\r
-\r
- /**\r
- Check if the input data is HexByteDataType\r
- \r
- @param strHex64BitDataType The input string need be checked \r
- \r
- @retval true - The input is HexByteDataType\r
- @retval false - The input is not HexByteDataType\r
- \r
- **/\r
- public static boolean isHexByteDataType(String strHex64BitDataType) {\r
- return isMatch("(0x)?[a-fA-F0-9]{1,2}", strHex64BitDataType);\r
- }\r
-\r
- /**\r
- Check if the input data is Hex64BitDataType\r
- \r
- @param strHex64BitDataType The input string need be checked\r
- \r
- @retval true - The input is Hex64BitDataType\r
- @retval false - The input is not Hex64BitDataType\r
- \r
- **/\r
- public static boolean isHex64BitDataType(String strHex64BitDataType) {\r
- return isMatch("(0x)?[a-fA-F0-9]{1,16}", strHex64BitDataType);\r
- }\r
-\r
- /**\r
- Check if the input data is HexWordDataType\r
- \r
- @param strHexWordDataType The input string need be checked\r
- \r
- @retval true - The input is HexWordDataType\r
- @retval false - The input is not HexWordDataType\r
- \r
- **/\r
- public static boolean isHexWordDataType(String strHexWordDataType) {\r
- return isMatch("0x[a-fA-F0-9]{1,4}", strHexWordDataType);\r
- }\r
-\r
- /**\r
- Check if the input data is CName\r
- \r
- @param strCName The input string need be checked\r
- \r
- @retval true - The input is CName\r
- @retval false - The input is not CName\r
- \r
- **/\r
- public static boolean isCName(String strCName) {\r
- return isMatch("((_)*([a-zA-Z])+((_)*[a-zA-Z0-9]*))*", strCName);\r
- }\r
-\r
- /**\r
- Check if the input data is OverrideID\r
- \r
- @param strOverrideID The input string need be checked\r
- \r
- @retval true - The input is OverrideID\r
- @retval false - The input is not OverrideID\r
- \r
- **/\r
- public static boolean isOverrideID(String strOverrideID) {\r
- return isInt(strOverrideID);\r
- }\r
-\r
- //\r
- //The below is used to check msaheader data type\r
- //\r
-\r
- /**\r
- Check if the input data is BaseName\r
- \r
- @param strBaseName The input string need be checked\r
- \r
- @retval true - The input is BaseName\r
- @retval false - The input is not BaseName\r
- \r
- **/\r
- public static boolean isBaseName(String strBaseName) {\r
- return isBaseNameConvention(strBaseName);\r
- }\r
-\r
- /**\r
- Check if the input data is Abstract\r
- \r
- @param strAbstract The input string need be checked\r
- \r
- @retval true - The input is Abstract\r
- @retval false - The input is not Abstract\r
- \r
- **/\r
- public static boolean isAbstract(String strAbstract) {\r
- return isSentence(strAbstract);\r
- }\r
-\r
- /**\r
- Check if the input data is Copyright\r
- \r
- @param strCopyright The input string need be checked\r
- \r
- @retval true - The input is Copyright\r
- @retval false - The input is not Copyright\r
- \r
- **/\r
- public static boolean isCopyright(String strCopyright) {\r
- return isSentence(strCopyright);\r
- }\r
-\r
- /**\r
- Check if the input data is Created\r
- \r
- @param strCreated The input string need be checked\r
- \r
- @retval true - The input is Created\r
- @retval false - The input is not Created\r
- \r
- **/\r
- public static boolean isCreated(String strCreated) {\r
- return isDateType(strCreated);\r
- }\r
-\r
- /**\r
- Check if the input data is Updated\r
- \r
- @param strUpdated The input string need be checked\r
- \r
- @retval true - The input is Updated\r
- @retval false - The input is not Updated\r
- \r
- **/\r
- public static boolean isUpdated(String strUpdated) {\r
- return isDateType(strUpdated);\r
- }\r
-\r
- //\r
- // The below is used to check LibraryClass data types\r
- //\r
-\r
- /**\r
- Check if the input data is LibraryClass\r
- \r
- @param strLibraryClass The input string need be checked\r
- \r
- @retval true - The input is LibraryClass\r
- @retval false - The input is not LibraryClass\r
- \r
- **/\r
- public static boolean isLibraryClass(String strLibraryClass) {\r
- return isBaseNameConvention(strLibraryClass);\r
- }\r
-\r
- //\r
- // The below is used to check sourcefiles data types\r
- //\r
-\r
- /**\r
- Check if the input data is Path\r
- \r
- @param strPath The input string need be checked\r
- \r
- @retval true - The input is Path\r
- @retval false - The input is not Path\r
- \r
- **/\r
- public static boolean isPath(String strPath) {\r
- return isDirectoryNamingConvention(strPath);\r
- }\r
-\r
- /**\r
- Check if the input data is FileName\r
- \r
- @param strFileName The input string need be checked\r
- \r
- @retval true - The input is FileName\r
- @retval false - The input is not FileName\r
- \r
- **/\r
- public static boolean isFileName(String strFileName) {\r
- return isVariableConvention(strFileName);\r
- }\r
-\r
- //\r
- // The below is used to check includes data types\r
- //\r
-\r
- /**\r
- Check if the input data is UpdatedDate\r
- \r
- @param strUpdatedDate The input string need be checked\r
- \r
- @retval true - The input is UpdatedDate\r
- @retval false - The input is not UpdatedDate\r
- \r
- **/\r
- public static boolean isUpdatedDate(String strUpdatedDate) {\r
- return isDateType(strUpdatedDate);\r
- }\r
-\r
- /**\r
- Check if the input data is PackageName\r
- \r
- @param strPackageName The input string need be checked\r
- \r
- @retval true - The input is PackageName\r
- @retval false - The input is not PackageName\r
- \r
- **/\r
- public static boolean isPackageName(String strPackageName) {\r
- return isBaseNameConvention(strPackageName);\r
- }\r
-\r
- //\r
- // The below is used to check protocols data types\r
- //\r
-\r
- /**\r
- Check if the input data is ProtocolName\r
- \r
- @param strProtocolName The input string need be checked\r
- \r
- @retval true - The input is ProtocolName\r
- @retval false - The input is not ProtocolName\r
- \r
- **/\r
- public static boolean isProtocolName(String strProtocolName) {\r
- return isCName(strProtocolName);\r
- }\r
-\r
- /**\r
- Check if the input data is ProtocolNotifyName\r
- \r
- @param strProtocolNotifyName The input string need be checked\r
- \r
- @retval true - The input is ProtocolNotifyName\r
- @retval false - The input is not ProtocolNotifyName\r
- \r
- **/\r
- public static boolean isProtocolNotifyName(String strProtocolNotifyName) {\r
- return isCName(strProtocolNotifyName);\r
- }\r
-\r
- //\r
- // The below is used to check ppis data types\r
- //\r
-\r
- /**\r
- Check if the input data is PpiName\r
- \r
- @param strPpiName The input string need be checked\r
- \r
- @retval true - The input is PpiName\r
- @retval false - The input is not PpiName\r
- \r
- **/\r
- public static boolean isPpiName(String strPpiName) {\r
- return isCName(strPpiName);\r
- }\r
-\r
- /**\r
- Check if the input data is PpiNotifyName\r
- \r
- @param strPpiNotifyName The input string need be checked\r
- \r
- @retval true - The input is PpiNotifyName\r
- @retval false - The input is not PpiNotifyName\r
- \r
- **/\r
- public static boolean isPpiNotifyName(String strPpiNotifyName) {\r
- return isCName(strPpiNotifyName);\r
- }\r
-\r
- /**\r
- Check if the input data is FeatureFlag\r
- \r
- @param strFeatureFlag The input string need be checked\r
- \r
- @retval true - The input is FeatureFlag\r
- @retval false - The input is not FeatureFlag\r
- \r
- **/\r
- public static boolean isFeatureFlag(String strFeatureFlag) {\r
- return isCName(strFeatureFlag);\r
- }\r
-\r
- //\r
- // The below is used to check variable data types\r
- //\r
-\r
- /**\r
- Check if the input data is ByteOffset\r
- \r
- @param strByteOffset The input string need be checked\r
- \r
- @retval true - The input is ByteOffset\r
- @retval false - The input is not ByteOffset\r
- \r
- **/\r
- public static boolean isByteOffset(String strByteOffset) {\r
- return isByteOffset(strByteOffset);\r
- }\r
-\r
- /**\r
- Check if the input data is BitOffset\r
- \r
- @param strBitOffset The input string need be checked\r
- \r
- @retval true - The input is BitOffset\r
- @retval false - The input is not BitOffset\r
- \r
- **/\r
- public static boolean isBitOffset(String strBitOffset) {\r
- return isInt(strBitOffset, 0, 8);\r
- }\r
-\r
- /**\r
- Check if the input data is OffsetBitSize\r
- \r
- @param strOffsetBitSize The input string need be checked\r
- \r
- @retval true - The input is OffsetBitSize\r
- @retval false - The input is not OffsetBitSize\r
- \r
- **/\r
- public static boolean isOffsetBitSize(String strOffsetBitSize) {\r
- return isInt(strOffsetBitSize, 0, 7);\r
- }\r
-\r
- //\r
- // The below is used to check formsets data types\r
- //\r
-\r
- /**\r
- Check if the input data is Formsets\r
- \r
- @param strFormsets The input string need be checked\r
- \r
- @retval true - The input is Formsets\r
- @retval false - The input is not Formsets\r
- \r
- **/\r
- public static boolean isFormsets(String strFormsets) {\r
- return isCName(strFormsets);\r
- }\r
-\r
- //\r
- // The below is used to check externs data types\r
- //\r
-\r
- /**\r
- Check if the input data is Constructor\r
- \r
- @param strConstructor The input string need be checked\r
- \r
- @retval true - The input is Constructor\r
- @retval false - The input is not Constructor\r
- \r
- **/\r
- public static boolean isConstructor(String strConstructor) {\r
- return isCName(strConstructor);\r
- }\r
-\r
- /**\r
- Check if the input data is Destructor\r
- \r
- @param strDestructor The input string need be checked\r
- \r
- @retval true - The input is Destructor\r
- @retval false - The input is not Destructor\r
- \r
- **/\r
- public static boolean isDestructor(String strDestructor) {\r
- return isCName(strDestructor);\r
- }\r
-\r
- /**\r
- Check if the input data is DriverBinding\r
- \r
- @param strDriverBinding The input string need be checked\r
- \r
- @retval true - The input is DriverBinding\r
- @retval false - The input is not DriverBinding\r
- \r
- **/\r
- public static boolean isDriverBinding(String strDriverBinding) {\r
- return isCName(strDriverBinding);\r
- }\r
-\r
- /**\r
- Check if the input data is ComponentName\r
- \r
- @param strComponentName The input string need be checked\r
- \r
- @retval true - The input is ComponentName\r
- @retval false - The input is not ComponentName\r
- \r
- **/\r
- public static boolean isComponentName(String strComponentName) {\r
- return isCName(strComponentName);\r
- }\r
-\r
- /**\r
- Check if the input data is DriverConfig\r
- \r
- @param strDriverConfig The input string need be checked\r
- \r
- @retval true - The input is DriverConfig\r
- @retval false - The input is not DriverConfig\r
- \r
- **/\r
- public static boolean isDriverConfig(String strDriverConfig) {\r
- return isCName(strDriverConfig);\r
- }\r
-\r
- /**\r
- Check if the input data is DriverDiag\r
- \r
- @param strDriverDiag The input string need be checked\r
- \r
- @retval true - The input is DriverDiag\r
- @retval false - The input is not DriverDiag\r
- \r
- **/\r
- public static boolean isDriverDiag(String strDriverDiag) {\r
- return isCName(strDriverDiag);\r
- }\r
-\r
- /**\r
- Check if the input data is SetVirtualAddressMapCallBack\r
- \r
- @param strSetVirtualAddressMapCallBack The input string need be checked\r
- \r
- @retval true - The input is SetVirtualAddressMapCallBack\r
- @retval false - The input is not SetVirtualAddressMapCallBack\r
- \r
- **/\r
- public static boolean isSetVirtualAddressMapCallBack(String strSetVirtualAddressMapCallBack) {\r
- return isCName(strSetVirtualAddressMapCallBack);\r
- }\r
-\r
- /**\r
- Check if the input data is ExitBootServicesCallBack\r
- \r
- @param strExitBootServicesCallBack The input string need be checked\r
- \r
- @retval true - The input is ExitBootServicesCallBack\r
- @retval false - The input is not ExitBootServicesCallBack\r
- \r
- **/\r
- public static boolean isExitBootServicesCallBack(String strExitBootServicesCallBack) {\r
- return isCName(strExitBootServicesCallBack);\r
- }\r
-\r
- /**\r
- Check if the input data is UserDefined\r
- \r
- @param strUserDefined The input string need be checked\r
- \r
- @retval true - The input is UserDefined\r
- @retval false - The input is not UserDefined\r
- \r
- **/\r
- public static boolean isUserDefined(String strUserDefined) {\r
- return isCName(strUserDefined);\r
- }\r
-\r
- //\r
- // The below is used to check PCDs data types\r
- //\r
-\r
- /**\r
- Check if the input data is Token\r
- \r
- @param strToken The input string need be checked\r
- \r
- @retval true - The input is Token\r
- @retval false - The input is not Token\r
- \r
- **/\r
- public static boolean isToken(String strToken) {\r
- return isHexDoubleWordDataType(strToken);\r
- }\r
-\r
- /**\r
- Check if the input data is MaxSku\r
- \r
- @param strMaxSku The input string need be checked\r
- \r
- @retval true - The input is MaxSku\r
- @retval false - The input is not MaxSku\r
- \r
- **/\r
- public static boolean isMaxSku(String strMaxSku) {\r
- return isHexByteDataType(strMaxSku);\r
- }\r
-\r
- /**\r
- Check if the input data is SkuId\r
- \r
- @param strSkuId The input string need be checked\r
- \r
- @retval true - The input is SkuId\r
- @retval false - The input is not SkuId\r
- \r
- **/\r
- public static boolean isSkuId(String strSkuId) {\r
- return isHexByteDataType(strSkuId);\r
- }\r
-\r
- /**\r
- Check if the input data is DatumSize\r
- \r
- @param strDatumSize The input string need be checked\r
- \r
- @retval true - The input is DatumSize\r
- @retval false - The input is not DatumSize\r
- \r
- **/\r
- public static boolean isDatumSize(String strDatumSize) {\r
- return isInt(strDatumSize, 1, 16777215);\r
- }\r
-\r
- /**\r
- Check if the input data is VariableGuid\r
- \r
- @param strVariableGuid The input string need be checked\r
- \r
- @retval true - The input is VariableGuid\r
- @retval false - The input is not VariableGuid\r
- \r
- **/\r
- public static boolean isVariableGuid(String strVariableGuid) {\r
- return (isGuid(strVariableGuid) || strVariableGuid.equals("0"));\r
- }\r
-\r
- /**\r
- Check if the input data is DataOffset\r
- \r
- @param strDataOffset The input string need be checked\r
- \r
- @retval true - The input is DataOffset\r
- @retval false - The input is not DataOffset\r
- \r
- **/\r
- public static boolean isDataOffset(String strDataOffset) {\r
- return isHex64BitDataType(strDataOffset);\r
- }\r
-\r
- /**\r
- Check if the input data is GuidOffset\r
- \r
- @param strGuidOffset The input string need be checked\r
- \r
- @retval true - The input is GuidOffset\r
- @retval false - The input is not GuidOffset\r
- \r
- **/\r
- public static boolean isGuidOffset(String strGuidOffset) {\r
- return isHex64BitDataType(strGuidOffset);\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to override FileFilter to provides customized interfaces \r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-\r
-package org.tianocore.common;\r
-\r
-import java.io.File;\r
-\r
-import javax.swing.filechooser.FileFilter;\r
-\r
-/**\r
- The class is used to override FileFilter to provides customized interfaces\r
- \r
- @since ModuleEditor 1.0\r
- \r
- **/\r
-public class IFileFilter extends FileFilter {\r
-\r
- private String strExt;\r
-\r
- /**\r
- Reserved for test\r
- \r
- @param args\r
- \r
- **/\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- @param ext\r
- \r
- **/\r
- public IFileFilter(String ext) {\r
- this.strExt = ext;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see javax.swing.filechooser.FileFilter#accept(java.io.File)\r
- * \r
- * Override method "accept"\r
- * \r
- */\r
- public boolean accept(File file) {\r
- if (file.isDirectory()) {\r
- return true;\r
- }\r
- String strFileName = file.getName();\r
- int intIndex = strFileName.lastIndexOf('.');\r
- if (intIndex > 0 && intIndex < strFileName.length() - 1) {\r
- String strExtension = strFileName.substring(intIndex + 1).toLowerCase();\r
- if (strExtension.equals(strExt))\r
- return true;\r
- }\r
- return false;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see javax.swing.filechooser.FileFilter#getDescription()\r
- * \r
- * Override method "getDescription" to config description via different file type \r
- * \r
- */\r
- public String getDescription() {\r
- if (strExt.equals("msa"))\r
- return "Module Surface Area File(*.msa)";\r
- if (strExt.equals("mbd"))\r
- return "Module Build Description File(*.mbd)";\r
- return "";\r
- }\r
-\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to provides static interfaces to save log and error information \r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-\r
-package org.tianocore.common;\r
-\r
-import java.io.File;\r
-import java.io.FileNotFoundException;\r
-import java.io.FileOutputStream;\r
-import java.io.IOException;\r
-\r
-import javax.swing.JOptionPane;\r
-\r
-/**\r
- The class is used to provides static interfaces to save log and error information\r
- \r
- @since ModuleEditor 1.0\r
- \r
- **/\r
-public class Log {\r
-\r
- //\r
- //Log file\r
- //\r
- private static File fleLogFile = null;\r
-\r
- //\r
- //Err file\r
- //\r
- private static File fleErrFile = null;\r
-\r
- //\r
- //Log file name\r
- //\r
- static String strLogFileName = "Log.log";\r
-\r
- //\r
- //Err file name\r
- //\r
- static String strErrFileName = "Err.log";\r
-\r
- /**\r
- Main class, used for test\r
- \r
- @param args\r
- \r
- **/\r
- public static void main(String[] args) {\r
- try {\r
- Log.log("Test", "test");\r
- Log.err("Test1", "test1");\r
- Log.err("sdfsdfsd fsdfsdfsdfsdfj dsfksdjflsdjf sdkfjsdklfjsdkf dskfsjdkfjks dskfjsdklfjsdkf sdkfjsdlf sdkfjsdk kdfjskdf sdkfjsdkf ksdjfksdfjskdf sdkfsjdfksd fskdfjsdf", "dfsdf sdfksdf sd sdfksd fsdf");\r
- } catch (Exception e) {\r
- e.printStackTrace();\r
- }\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- Do nothing\r
- \r
- **/\r
- public Log() {\r
- }\r
-\r
- /**\r
- Call writeToLogFile to save log item and log information to log file\r
- \r
- @param strItem The log item\r
- @param strLog The log information\r
- \r
- **/\r
- public static void log(String strItem, String strLog) {\r
- try {\r
- writeToLogFile(strItem + ":" + strLog);\r
- } catch (IOException e) {\r
- e.printStackTrace();\r
- }\r
- }\r
-\r
- /**\r
- Call writeToLogFile to save log information to log file\r
- \r
- @param strLog The log information\r
- \r
- **/\r
- public static void log(String strLog) {\r
- try {\r
- writeToLogFile(strLog);\r
- } catch (IOException e) {\r
- e.printStackTrace();\r
- }\r
- }\r
-\r
- /**\r
- Call writeToErrFile to save err item and err information to err file\r
- \r
- @param strItem The err item\r
- @param strLog The err information\r
- \r
- **/\r
- public static void err(String strItem, String strErr) {\r
- try {\r
- writeToErrFile("Error when " + strItem + "::" + strErr);\r
- showErrMessage("Error when " + strItem + "::" + strErr);\r
- } catch (IOException e) {\r
- e.printStackTrace();\r
- }\r
- }\r
-\r
- /**\r
- Call writeToErrFile to save err information to err file\r
- \r
- @param strLog The err information\r
- \r
- **/\r
- public static void err(String strErr) {\r
- try {\r
- writeToErrFile("Error::" + strErr);\r
- showErrMessage("Error::" + strErr);\r
- } catch (IOException e) {\r
- e.printStackTrace();\r
- }\r
- }\r
-\r
- /**\r
- Brings up a dialog to show err message\r
- When the message's length > defined max length, wrap the text to the next line.\r
- \r
- @param strErr The input data of err message\r
- \r
- **/\r
- private static void showErrMessage(String strErr) {\r
- int intMaxLength = 40;\r
- String strReturn = "";\r
- String strTemp = "";\r
- while (strErr.length() > 0) {\r
- if (strErr.length() > intMaxLength) {\r
- strTemp = strErr.substring(0, intMaxLength);\r
- strErr = strErr.substring(strTemp.length());\r
- strReturn = strReturn + strTemp + DataType.UNXI_LINE_SEPARATOR;\r
- \r
- } else if (strErr.length() <= intMaxLength) {\r
- strReturn = strReturn + strErr;\r
- strErr = "";\r
- }\r
- }\r
- JOptionPane.showConfirmDialog(null, strReturn, "Error", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE);\r
- }\r
-\r
- /**\r
- Open log file and write log information\r
- \r
- @param strLog The log information\r
- @throws IOException\r
- \r
- **/\r
- private static void writeToLogFile(String strLog) throws IOException {\r
- try {\r
- if (fleLogFile == null) {\r
- fleLogFile = new File(strLogFileName);\r
- fleLogFile.createNewFile();\r
- }\r
- FileOutputStream fos = new FileOutputStream(fleLogFile, true);\r
- fos.write((Tools.getCurrentDateTime() + DataType.DOS_LINE_SEPARATOR).getBytes());\r
- fos.write((strLog + DataType.DOS_LINE_SEPARATOR).getBytes());\r
- fos.flush();\r
- fos.close();\r
- } catch (FileNotFoundException e) {\r
- e.printStackTrace();\r
- } catch (IOException e) {\r
- e.printStackTrace();\r
- }\r
- }\r
-\r
- /**\r
- Open err file and write err information\r
- \r
- @param strLog The log information\r
- @throws IOException\r
- \r
- **/\r
- private static void writeToErrFile(String strLog) throws IOException {\r
- try {\r
- if (fleErrFile == null) {\r
- fleErrFile = new File(strErrFileName);\r
- fleErrFile.createNewFile();\r
- }\r
- FileOutputStream fos = new FileOutputStream(fleErrFile, true);\r
- fos.write((Tools.getCurrentDateTime() + DataType.DOS_LINE_SEPARATOR).getBytes());\r
- fos.write((strLog + DataType.DOS_LINE_SEPARATOR).getBytes());\r
- fos.flush();\r
- fos.close();\r
- } catch (FileNotFoundException e) {\r
- e.printStackTrace();\r
- } catch (IOException e) {\r
- e.printStackTrace();\r
- }\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to provides some useful interfaces \r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-\r
-package org.tianocore.common;\r
-\r
-import java.io.File;\r
-import java.text.SimpleDateFormat;\r
-import java.util.Date;\r
-import java.util.UUID;\r
-\r
-/**\r
- The class is used to provides some useful interfaces \r
- \r
- @since ModuleEditor 1.0\r
- \r
- **/\r
-public class Tools {\r
-\r
- /**\r
- Used for test\r
- \r
- @param args\r
- \r
- **/\r
- public static void main(String[] args) {\r
- System.out.println(getCurrentDateTime());\r
- }\r
-\r
- /**\r
- Get current date and time and format it as "yyyy-MM-dd HH:mm"\r
- \r
- @return formatted current date and time\r
- \r
- **/\r
- public static String getCurrentDateTime() {\r
- Date now = new Date(System.currentTimeMillis());\r
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");\r
- return sdf.format(now);\r
- }\r
-\r
- /**\r
- Delete a folder and all its files\r
- \r
- @param fleFolderName The name of the folder which need be deleted\r
- \r
- @retval true - Delete successfully\r
- @retval false - Delete successfully\r
- \r
- **/\r
- public static boolean deleteFolder(File fleFolderName) {\r
- boolean blnIsDeleted = true;\r
- File[] aryAllFiles = fleFolderName.listFiles();\r
-\r
- for (int indexI = 0; indexI < aryAllFiles.length; indexI++) {\r
- if (blnIsDeleted) {\r
- if (aryAllFiles[indexI].isDirectory()) {\r
- //\r
- //If is a directory, recursively call this function to delete sub folders\r
- //\r
- blnIsDeleted = deleteFolder(aryAllFiles[indexI]);\r
- } else if (aryAllFiles[indexI].isFile()) {\r
- //\r
- //If is a file, delete it\r
- //\r
- if (!aryAllFiles[indexI].delete()) {\r
- blnIsDeleted = false;\r
- }\r
- }\r
- }\r
- }\r
- if (blnIsDeleted) {\r
- fleFolderName.delete();\r
- }\r
- return blnIsDeleted;\r
- }\r
-\r
- /**\r
- Generate a UUID\r
- \r
- @return the created UUID\r
- \r
- **/\r
- public static String generateUuidString() {\r
- return UUID.randomUUID().toString();\r
- }\r
-\r
- /**\r
- Get all system properties and output to the console\r
- \r
- **/\r
- public static void getSystemProperties() {\r
- System.out.println(System.getProperty("java.class.version"));\r
- System.out.println(System.getProperty("java.class.path"));\r
- System.out.println(System.getProperty("java.ext.dirs"));\r
- System.out.println(System.getProperty("os.name"));\r
- System.out.println(System.getProperty("os.arch"));\r
- System.out.println(System.getProperty("os.version"));\r
- System.out.println(System.getProperty("file.separator"));\r
- System.out.println(System.getProperty("path.separator"));\r
- System.out.println(System.getProperty("line.separator"));\r
- System.out.println(System.getProperty("user.name"));\r
- System.out.println(System.getProperty("user.home"));\r
- System.out.println(System.getProperty("user.dir"));\r
- System.out.println(System.getProperty("PATH"));\r
-\r
- System.out.println(System.getenv("PROCESSOR_REVISION"));\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to popup a exit confirmation window when program exists\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-\r
-package org.tianocore.packaging.common.ui;\r
-\r
-import java.awt.Dimension;\r
-import java.awt.Toolkit;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ActionListener;\r
-import java.awt.event.WindowEvent;\r
-import java.awt.event.WindowListener;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.JDialog;\r
-import javax.swing.JFrame;\r
-import javax.swing.JLabel;\r
-import javax.swing.JPanel;\r
-\r
-/**\r
- The class is used to popup a exit confirmation window when program exists\r
- It extends JDialog and implements ActionListener and WindowListener\r
- \r
- @since ModuleEditor 1.0\r
- \r
- **/\r
-public class ExitConfirm extends JDialog implements ActionListener, WindowListener {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -5875921789385911029L;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JLabel jLabelMessage = null;\r
-\r
- private JLabel jLabelResume = null;\r
-\r
- private JLabel jLabelExit = null;\r
-\r
- private JButton jButtonResume = null;\r
-\r
- private JButton jButtonExit = null;\r
-\r
- public boolean isCancel = false;\r
-\r
- /**\r
- This method initializes jButtonResume\r
- \r
- @return javax.swing.JButton jButtonResume\r
- \r
- **/\r
- private JButton getJButtonResume() {\r
- if (jButtonResume == null) {\r
- jButtonResume = new JButton();\r
- jButtonResume.setText("Resume");\r
- jButtonResume.setSize(new java.awt.Dimension(90, 20));\r
- jButtonResume.setLocation(new java.awt.Point(150, 105));\r
- jButtonResume.setMnemonic('R');\r
- jButtonResume.addActionListener(this);\r
- }\r
- return jButtonResume;\r
- }\r
-\r
- /**\r
- This method initializes jButtonExit\r
- \r
- @return javax.swing.JButton jButtonExit\r
- \r
- **/\r
- private JButton getJButtonExit() {\r
- if (jButtonExit == null) {\r
- jButtonExit = new JButton();\r
- jButtonExit.setText("Exit");\r
- jButtonExit.setSize(new java.awt.Dimension(90, 20));\r
- jButtonExit.setLocation(new java.awt.Point(260, 105));\r
- jButtonExit.setMnemonic('x');\r
- jButtonExit.addActionListener(this);\r
- }\r
- return jButtonExit;\r
- }\r
-\r
- /**\r
- Main clasee, reserved for test\r
- \r
- @param args\r
- \r
- **/\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public ExitConfirm(IFrame parentFrame, boolean modal) {\r
- super(parentFrame, modal);\r
- initialize();\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @return void\r
- \r
- **/\r
- private void initialize() {\r
- this.setSize(500, 170);\r
- this.setTitle("Exit");\r
- this.setResizable(false);\r
- this.setContentPane(getJContentPane());\r
- this.addWindowListener(this);\r
- //\r
- //Set DO_NOTHING_ON_CLOSE when click Close button on title bar\r
- //\r
- this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);\r
- centerWindow();\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel jContentPane\r
- \r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabelExit = new JLabel();\r
- jLabelExit.setSize(new java.awt.Dimension(450, 20));\r
- jLabelExit.setLocation(new java.awt.Point(25, 70));\r
- jLabelResume = new JLabel();\r
- jLabelResume.setSize(new java.awt.Dimension(450, 20));\r
- jLabelResume.setLocation(new java.awt.Point(25, 40));\r
- jLabelMessage = new JLabel();\r
- jLabelMessage.setSize(new java.awt.Dimension(450, 20));\r
- jLabelMessage.setLocation(new java.awt.Point(25, 10));\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(jLabelMessage, null);\r
- jContentPane.add(jLabelResume, null);\r
- jContentPane.add(jLabelExit, null);\r
- jContentPane.add(getJButtonResume(), null);\r
- jContentPane.add(getJButtonExit(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- Call setWarningMessage to set messages of frame when it is used for Setup\r
- \r
- **/\r
- public void setSetupMessage() {\r
- String strTitle = "Exit Setup";\r
- String strMessage = "Setup is not complete. If you quit now, the program will not be installed.";\r
- String strResume = "You may run the setup program at a later time to complete the installation.";\r
- String strExit = "To continue installing, click Resume. To quit the Setup program, click Exit.";\r
- setWarningMessage(strTitle, strMessage, strResume, strExit);\r
- }\r
-\r
- /**\r
- Call setWarningMessage to set messages of frame when it is used for Module Main GUI\r
- \r
- **/\r
- public void setModuleMessage() {\r
- String strTitle = "Exit";\r
- String strMessage = "Do you really want to quit now?";\r
- String strResume = "All unsaved module information will be lost.";\r
- String strExit = "To continue editing module, click Resume. To quit the program, click Exit.";\r
- setWarningMessage(strTitle, strMessage, strResume, strExit);\r
- }\r
-\r
- /**\r
- Set message information via input data\r
- \r
- @param strTitle The title value\r
- @param strMessage The main message value\r
- @param strResume The resume message value\r
- @param strExit The exit message value\r
- \r
- **/\r
- private void setWarningMessage(String strTitle, String strMessage, String strResume, String strExit) {\r
- this.setTitle(strTitle);\r
- jLabelMessage.setText(strMessage);\r
- jLabelResume.setText(strResume);\r
- jLabelExit.setText(strExit);\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- * \r
- * Override actionPerformed to listern all actions\r
- * \r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- //\r
- //Set isCancel true when click button "Exit"\r
- //\r
- Object obj = arg0.getSource();\r
- if (obj == jButtonResume) {\r
- isCancel = false;\r
- }\r
- if (obj == jButtonExit) {\r
- isCancel = true;\r
- }\r
- this.setVisible(false);\r
- }\r
-\r
- /**\r
- Make the window in the center of the screen\r
- \r
- **/\r
- private void centerWindow() {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);\r
- }\r
-\r
- public void windowActivated(WindowEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public void windowClosed(WindowEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public void windowClosing(WindowEvent arg0) {\r
- isCancel = false;\r
- this.setVisible(false);\r
- }\r
-\r
- public void windowDeactivated(WindowEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public void windowDeiconified(WindowEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public void windowIconified(WindowEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public void windowOpened(WindowEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to override JComboBox to provides customized interfaces \r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-package org.tianocore.packaging.common.ui;\r
-\r
-import java.awt.event.FocusEvent;\r
-import java.awt.event.FocusListener;\r
-import java.awt.event.KeyEvent;\r
-import java.awt.event.KeyListener;\r
-import java.awt.event.MouseEvent;\r
-import java.awt.event.MouseListener;\r
-\r
-import javax.swing.JComboBox;\r
-import javax.swing.JFrame;\r
-import javax.swing.JPanel;\r
-\r
-/**\r
- The class is used to override JComboBox to provides customized interfaces\r
- It extends JComboBox implements KeyListener, MouseListener and FocusListener\r
- \r
- @since ModuleEditor 1.0\r
- \r
- **/\r
-public class IComboBox extends JComboBox implements KeyListener, MouseListener, FocusListener {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -1940262568168458911L;\r
-\r
- public void focusGained(FocusEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.FocusListener#focusLost(java.awt.event.FocusEvent)\r
- * \r
- * Override focusLost to exit edit mode\r
- * \r
- */\r
- public void focusLost(FocusEvent arg0) {\r
- this.closeEdit();\r
- }\r
-\r
- /**\r
- Main class, used for test\r
- \r
- @param args\r
- \r
- **/\r
- public static void main(String[] args) {\r
- JFrame jf = new JFrame();\r
- jf.setSize(500, 200);\r
- JPanel jp = new JPanel();\r
- jp.setLayout(null);\r
- IComboBox icb = new IComboBox();\r
- jp.add(icb, null);\r
- jf.setContentPane(jp);\r
- jf.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public IComboBox() {\r
- super();\r
- init();\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void init() {\r
- this.setSize(320, 20);\r
- this.setEditable(false);\r
- this.editor.addActionListener(this);\r
- this.addMouseListener(this);\r
- this.addKeyListener(this);\r
- this.getEditor().getEditorComponent().addKeyListener(this);\r
- this.getEditor().getEditorComponent().addFocusListener(this);\r
- }\r
-\r
- public void keyPressed(KeyEvent arg0) {\r
- // TODO Auto-generated method stub\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent)\r
- * \r
- * Override keyReleased to listen key action\r
- * \r
- */\r
- public void keyReleased(KeyEvent arg0) {\r
- //\r
- //Add new item to list when press ENTER\r
- //\r
- if (arg0.getSource() == this.getEditor().getEditorComponent()) {\r
- if (arg0.getKeyCode() == KeyEvent.VK_ENTER) {\r
- String strCurrentText = this.getEditor().getItem().toString().trim();\r
- if (strCurrentText.length() == 0) {\r
- if (this.getItemCount() > 0) {\r
- this.setSelectedIndex(0);\r
- }\r
- } else {\r
- this.addItem(strCurrentText);\r
- this.setSelectedItem(strCurrentText);\r
- }\r
- this.setEditable(false);\r
- }\r
- if (arg0.getKeyCode() == KeyEvent.VK_ESCAPE) {\r
- closeEdit();\r
- }\r
- }\r
-\r
- if (arg0.getSource() == this) {\r
- //\r
- //Remove item from the list when press DEL\r
- //\r
- if (arg0.getKeyCode() == KeyEvent.VK_DELETE) {\r
- int intSelected = this.getSelectedIndex();\r
- if (intSelected > -1) {\r
- this.removeItemAt(this.getSelectedIndex());\r
- if (this.getItemCount() > 0) {\r
- this.setSelectedIndex(0);\r
- } else {\r
- this.removeAllItems();\r
- }\r
- }\r
- }\r
- }\r
- }\r
-\r
- public void keyTyped(KeyEvent arg0) {\r
- // TODO Auto-generated method stub\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)\r
- * \r
- * Override mouseClicked to enter edit mode when double click mouse\r
- * \r
- */\r
- public void mouseClicked(MouseEvent arg0) {\r
- if (arg0.getClickCount() == 2) {\r
- this.setEditable(true);\r
- this.getEditor().setItem("");\r
- }\r
-\r
- }\r
-\r
- public void mouseEntered(MouseEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public void mouseExited(MouseEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public void mousePressed(MouseEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public void mouseReleased(MouseEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- /**\r
- Exit edit mode\r
- \r
- **/\r
- private void closeEdit() {\r
- this.setEditable(false);\r
- this.getEditor().setItem("");\r
- if (this.getItemCount() > 0) {\r
- this.setSelectedIndex(0);\r
- }\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- \r
- The file is used to override DefaultMutableTreeNode to provides customized interfaces \r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-\r
-package org.tianocore.packaging.common.ui;\r
-\r
-import javax.swing.tree.DefaultMutableTreeNode;\r
-\r
-/**\r
- The class is used to override DefaultMutableTreeNode to provides customized interfaces\r
- It extends DefaultMutableTreeNode\r
- \r
- @since ModuleEditor 1.0\r
- \r
- **/\r
-public class IDefaultMutableTreeNode extends DefaultMutableTreeNode {\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -1947340717458069548L;\r
-\r
- //\r
- //Static final definitions for all kinds of node\r
- //\r
- public static final int MSA_HEADER = 0;\r
-\r
- public static final int LIBRARYCLASSDEFINITIONS = 1;\r
-\r
- public static final int SOURCEFILES = 2;\r
-\r
- public static final int INCLUDES = 3;\r
-\r
- public static final int PROTOCOLS = 4;\r
-\r
- public static final int EVENTS = 5;\r
-\r
- public static final int HOBS = 6;\r
-\r
- public static final int PPIS = 7;\r
-\r
- public static final int VARIABLES = 8;\r
-\r
- public static final int BOOTMODES = 9;\r
-\r
- public static final int SYSTEMTABLES = 10;\r
-\r
- public static final int DATAHUBS = 11;\r
-\r
- public static final int FORMSETS = 12;\r
-\r
- public static final int GUIDS = 13;\r
-\r
- public static final int EXTERNS = 14;\r
-\r
- public static final int PCDS = 15;\r
-\r
- public static final int MBD_HEADER = 20;\r
-\r
- public static final int MLSA_HEADER = 21;\r
-\r
- public static final int MLBD_HEADER = 22;\r
-\r
- public static final int LIBRARIES = 23;\r
-\r
- public static final int LIBRARY_CLASS_DEFINITION = 101;\r
-\r
- public static final int SOURCEFILES_FILENAME = 210;\r
-\r
- public static final int SOURCEFILES_FILENAME_ITEM = 211;\r
-\r
- public static final int SOURCEFILES_ARCH = 220;\r
-\r
- public static final int SOURCEFILES_ARCH_ITEM = 221;\r
-\r
- public static final int INCLUDES_PACKAGENAME = 310;\r
-\r
- public static final int INCLUDES_PACKAGENAME_ITEM = 311;\r
-\r
- public static final int INCLUDES_ARCH = 320;\r
-\r
- public static final int INCLUDES_ARCH_ITEM = 321;\r
-\r
- public static final int PROTOCOLS_PROTOCOL = 410;\r
-\r
- public static final int PROTOCOLS_PROTOCOL_ITEM = 411;\r
-\r
- public static final int PROTOCOLS_PROTOCOLNOTIFY = 420;\r
-\r
- public static final int PROTOCOLS_PROTOCOLNOTIFY_ITEM = 421;\r
-\r
- public static final int EVENTS_CREATEEVENTS = 510;\r
-\r
- public static final int EVENTS_CREATEEVENTS_ITEM = 511;\r
-\r
- public static final int EVENTS_SIGNALEVENTS = 520;\r
-\r
- public static final int EVENTS_SIGNALEVENTS_ITEM = 521;\r
-\r
- public static final int HOBS_HOB_ITEM = 611;\r
-\r
- public static final int PPIS_PPI = 710;\r
-\r
- public static final int PPIS_PPI_ITEM = 711;\r
-\r
- public static final int PPIS_PPINOTIFY = 720;\r
-\r
- public static final int PPIS_PPINOTIFY_ITEM = 721;\r
-\r
- public static final int VARIABLES_VARIABLE_ITEM = 811;\r
-\r
- public static final int BOOTMODES_BOOTMODE_ITEM = 911;\r
-\r
- public static final int SYSTEMTABLES_SYSTEMTABLE_ITEM = 1011;\r
-\r
- public static final int DATAHUBS_DATAHUB_ITEM = 1111;\r
-\r
- public static final int FORMSETS_FORMSET_ITEM = 1211;\r
-\r
- public static final int GUIDS_GUIDENTRY_ITEM = 1311;\r
-\r
- public static final int EXTERNS_EXTERN_ITEM = 1411;\r
-\r
- public static final int PCDS_PCDDATA_ITEM = 1511;\r
-\r
- public static final int LIBRARIES_LIBRARY = 2310;\r
-\r
- public static final int LIBRARIES_LIBRARY_ITEM = 2311;\r
-\r
- public static final int LIBRARIES_ARCH = 2320;\r
-\r
- public static final int LIBRARIES_ARCH_ITEM = 2321;\r
-\r
- //\r
- //Static final definitions for operation\r
- //\r
- public static final int OPERATION_NULL = 0;\r
-\r
- public static final int OPERATION_ADD = 1;\r
-\r
- public static final int OPERATION_UPDATE = 2;\r
-\r
- public static final int OPERATION_DELETE = 4;\r
-\r
- public static final int OPERATION_ADD_UPDATE = 3;\r
-\r
- public static final int OPERATION_ADD_DELETE = 5;\r
-\r
- public static final int OPERATION_UPDATE_DELETE = 6;\r
-\r
- public static final int OPERATION_ADD_UPDATE_DELETE = 7;\r
-\r
- //\r
- //Define 4 node attributes\r
- //\r
- private int category = 0;\r
-\r
- private int operation = 0;\r
-\r
- private int location = 0;\r
-\r
- private String nodeName = "";\r
-\r
- /**\r
- Main class, reserved for test\r
- \r
- @param args\r
- \r
- **/\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public IDefaultMutableTreeNode() {\r
- super();\r
- }\r
-\r
- /**\r
- This is the overrided constructor\r
- Init clase members with input data\r
- \r
- @param strNodeName The name of node\r
- @param intCategory The category of node\r
- @param intOperation The operation of node\r
- \r
- **/\r
- public IDefaultMutableTreeNode(String strNodeName, int intCategory, int intOperation) {\r
- super(strNodeName);\r
- this.nodeName = strNodeName;\r
- this.category = intCategory;\r
- this.operation = intOperation;\r
- }\r
-\r
- /**\r
- This is the overrided constructor\r
- Init clase members with input data\r
- \r
- @param strNodeName The name of node\r
- @param intCategory The category of node\r
- @param intOperation The operation of node\r
- @param intLocation The location of node\r
- \r
- **/\r
- public IDefaultMutableTreeNode(String strNodeName, int intCategory, int intOperation, int intLocation) {\r
- super(strNodeName);\r
- this.nodeName = strNodeName;\r
- this.category = intCategory;\r
- this.operation = intOperation;\r
- this.location = intLocation;\r
- }\r
-\r
- /**\r
- Get category of node \r
- \r
- @return The category of node\r
- \r
- **/\r
- public int getCategory() {\r
- return category;\r
- }\r
-\r
- /**\r
- Set category of node\r
- \r
- @param category The input data of node category\r
- \r
- **/\r
- public void setCategory(int category) {\r
- this.category = category;\r
- }\r
-\r
- /**\r
- Get name of node\r
- \r
- @return The name of node\r
- \r
- **/\r
- public String getNodeName() {\r
- return nodeName;\r
- }\r
-\r
- /**\r
- Set name of node\r
- \r
- @param nodeName The input data of node name\r
- \r
- **/\r
- public void setNodeName(String nodeName) {\r
- this.nodeName = nodeName;\r
- }\r
-\r
- /**\r
- Get operation of node\r
- \r
- @return The operation of node\r
- \r
- **/\r
- public int getOperation() {\r
- return operation;\r
- }\r
-\r
- /**\r
- Set operation of node\r
- \r
- @param operation The input data of node operation\r
- \r
- **/\r
- public void setOperation(int operation) {\r
- this.operation = operation;\r
- }\r
-\r
- /**\r
- Get location of node\r
- \r
- @return The location of node\r
- \r
- **/\r
- public int getLocation() {\r
- return location;\r
- }\r
-\r
- /**\r
- Set location of node\r
- \r
- @param location The input data of node location\r
- \r
- **/\r
- public void setLocation(int location) {\r
- this.location = location;\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to override DefaultDesktopManager to provides customized interfaces \r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-\r
-package org.tianocore.packaging.common.ui;\r
-\r
-import javax.swing.DefaultDesktopManager;\r
-import javax.swing.JComponent;\r
-\r
-/**\r
- The class is used to override DefaultDesktopManager to provides customized interfaces\r
- It extends DefaultDesktopManager\r
- \r
- @since ModuleEditor 1.0\r
- \r
- **/\r
-public class IDesktopManager extends DefaultDesktopManager {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -4596986878722011062L;\r
-\r
- /**\r
- Main class, reserved for test\r
- \r
- @param args\r
- \r
- **/\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see javax.swing.DesktopManager#dragFrame(javax.swing.JComponent, int, int)\r
- * \r
- * Override dragFrame to do nothing to forbid internalframe to be draged \r
- * \r
- */\r
- public void dragFrame(JComponent f, int newX, int newY) {\r
-\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see javax.swing.DesktopManager#endDraggingFrame(javax.swing.JComponent)\r
- * \r
- * Override endDraggingFrame to do nothing to forbid internalframe to be draged\r
- * \r
- */\r
- public void endDraggingFrame(JComponent f) {\r
-\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see javax.swing.DesktopManager#beginResizingFrame(javax.swing.JComponent, int)\r
- * \r
- * Override beginResizingFrame to do nothing to forbid internalframe to be draged\r
- * \r
- */\r
- public void beginResizingFrame(JComponent f, int direction) {\r
-\r
- }\r
-\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to override Dialog to provides customized interfaces \r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-\r
-package org.tianocore.packaging.common.ui;\r
-\r
-import java.awt.Dimension;\r
-import java.awt.Toolkit;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ActionListener;\r
-\r
-import javax.swing.JDialog;\r
-\r
-/**\r
- The class is used to override Dialog to provides customized interfaces\r
- It extends JDialog implements ActionListener\r
- \r
- @since ModuleEditor 1.0\r
- \r
- **/\r
-public class IDialog extends JDialog implements ActionListener {\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -7692623863358631984L;\r
- //\r
- //Define class members\r
- //\r
- private boolean isEdited = false;\r
-\r
- public void actionPerformed(ActionEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- /**\r
- Main class, used for test\r
- \r
- @param args\r
- \r
- **/\r
- public static void main(String[] args) {\r
- IDialog id = new IDialog();\r
- id.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- **/\r
- public IDialog() {\r
- super();\r
- initialize();\r
- }\r
-\r
- /**\r
- * This is the override constructor\r
- */\r
- /**\r
- This is the override constructor\r
- \r
- @param parentFrame The parent frame which open the dialog\r
- @param modal true means the dialog is modal dialog; false means the dialog is not modal dialog\r
- **/\r
- public IDialog(IFrame parentFrame, boolean modal) {\r
- super(parentFrame, modal);\r
- initialize();\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void initialize() {\r
- this.setResizable(false);\r
- }\r
-\r
- /**\r
- Start the dialog at the center of screen\r
- \r
- @param intWidth The width of the dialog\r
- @param intHeight The height of the dialog\r
- \r
- **/\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the dialog at the center of screen\r
- \r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
-\r
- /**\r
- Get if the dialog has been edited\r
- \r
- @retval true - The dialog has been edited\r
- @retval false - The dialog hasn't been edited\r
- \r
- **/\r
- public boolean isEdited() {\r
- return isEdited;\r
- }\r
-\r
- /**\r
- Set if the dialog has been edited\r
- \r
- @param isEdited The input data which identify if the dialog has been edited\r
- \r
- **/\r
- public void setEdited(boolean isEdited) {\r
- this.isEdited = isEdited;\r
- }\r
-\r
- /**\r
- Check the input data is empty or not\r
- \r
- @param strValue The input data which need be checked\r
- \r
- @retval true - The input data is empty\r
- @retval fals - The input data is not empty\r
- \r
- **/\r
- public boolean isEmpty(String strValue) {\r
- if (strValue.length() > 0) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to override Frame to provides customized interfaces \r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-\r
-package org.tianocore.packaging.common.ui;\r
-\r
-import java.awt.Dimension;\r
-import java.awt.Toolkit;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ActionListener;\r
-import java.awt.event.WindowEvent;\r
-import java.awt.event.WindowListener;\r
-\r
-import javax.swing.JFrame;\r
-\r
-/**\r
- The class is used to override Frame to provides customized interfaces \r
- It extends JFrame implements ActionListener and WindowListener\r
- \r
- @since ModuleEditor 1.0\r
- \r
- **/\r
-public class IFrame extends JFrame implements ActionListener, WindowListener {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -3324138961029300427L;\r
-\r
- //\r
- //Define class members\r
- //\r
- private ExitConfirm ec = null;\r
-\r
- //\r
- // To indicate the status while quit\r
- // 0 - When setup (Default)\r
- // 1 - Whne editing module\r
- //\r
- private int intExitType = 0;\r
-\r
- /**\r
- Main class, used for test\r
- \r
- @param args\r
- \r
- **/\r
- public static void main(String[] args) {\r
- IFrame i = new IFrame();\r
- i.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public IFrame() {\r
- super();\r
- initialize();\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- public void initialize() {\r
- this.setResizable(false);\r
- this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);\r
- this.addWindowListener(this);\r
- }\r
-\r
- /**\r
- Start the dialog at the center of screen\r
- \r
- @param intWidth The width of the dialog\r
- @param intHeight The height of the dialog\r
- \r
- **/\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the dialog at the center of screen\r
- \r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
-\r
- /**\r
- Set the exit window type\r
- \r
- @param ExitType The input data of ExitType\r
- \r
- **/\r
- protected void setExitType(int ExitType) {\r
- this.intExitType = ExitType;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)\r
- *\r
- * Override windowClosing to call this.onDisvisible()\r
- * \r
- */\r
- public void windowClosing(WindowEvent arg0) {\r
- this.onDisvisible();\r
- }\r
-\r
- public void windowOpened(WindowEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public void windowClosed(WindowEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public void windowIconified(WindowEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public void windowDeiconified(WindowEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public void windowActivated(WindowEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public void windowDeactivated(WindowEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public void actionPerformed(ActionEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- /**\r
- Define the actions when exit\r
- \r
- **/\r
- public void onExit() {\r
- ec = new ExitConfirm(this, true);\r
- //\r
- //Show different warning message via different ExitType\r
- //\r
- switch (intExitType) {\r
- case 0:\r
- ec.setSetupMessage();\r
- break;\r
- case 1:\r
- ec.setModuleMessage();\r
- break;\r
- }\r
- ec.setVisible(true);\r
- if (ec.isCancel) {\r
- this.dispose();\r
- System.exit(0);\r
- }\r
- }\r
-\r
- /**\r
- Define the actions when disvisible\r
- \r
- **/\r
- public void onDisvisible() {\r
- ec = new ExitConfirm(this, true);\r
- //\r
- //Show different warning message via different ExitType\r
- //\r
- switch (intExitType) {\r
- case 0:\r
- ec.setSetupMessage();\r
- break;\r
- case 1:\r
- ec.setModuleMessage();\r
- break;\r
- }\r
- ec.setVisible(true);\r
- if (ec.isCancel) {\r
- this.dispose();\r
- }\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to override JInternalFrame to provides customized interfaces \r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-\r
-package org.tianocore.packaging.common.ui;\r
-\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ActionListener;\r
-\r
-import javax.swing.JInternalFrame;\r
-\r
-/**\r
- The class is used to override JInternalFrame to provides customized interfaces\r
- It extends JInternalFrame implements ActionListener\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class IInternalFrame extends JInternalFrame implements ActionListener {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -609841772384875886L;\r
- //\r
- //Define class members\r
- //\r
- private boolean isEdited = false;\r
-\r
- /**\r
- Main class, reserved for test\r
- \r
- @param args\r
- \r
- **/\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public IInternalFrame() {\r
- super();\r
- initialize();\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void initialize() {\r
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 500));\r
- }\r
-\r
- /**\r
- Get if the InternalFrame has been edited\r
- \r
- @retval true - The InternalFrame has been edited\r
- @retval false - The InternalFrame hasn't been edited\r
- \r
- **/\r
- public boolean isEdited() {\r
- return isEdited;\r
- }\r
-\r
- /**\r
- Set if the InternalFrame has been edited\r
- \r
- @param isEdited The input data which identify if the InternalFrame has been edited\r
- \r
- **/\r
- public void setEdited(boolean isEdited) {\r
- this.isEdited = isEdited;\r
- }\r
-\r
- /**\r
- Check the input data is empty or not\r
- \r
- @param strValue The input data which need be checked\r
- \r
- @retval true - The input data is empty\r
- @retval fals - The input data is not empty\r
- \r
- **/\r
- public boolean isEmpty(String strValue) {\r
- if (strValue.length() > 0) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- public void actionPerformed(ActionEvent arg0) {\r
- // TODO Auto-generated method stub\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to override JTree to provides customized interfaces \r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-\r
-package org.tianocore.packaging.common.ui;\r
-\r
-import javax.swing.JTree;\r
-import javax.swing.tree.DefaultMutableTreeNode;\r
-import javax.swing.tree.DefaultTreeModel;\r
-import javax.swing.tree.TreeNode;\r
-import javax.swing.tree.TreePath;\r
-\r
-/**\r
- The class is used to override JTree to provides customized interfaces \r
- It extends JTree\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class ITree extends JTree {\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -7907086164518295327L;\r
- \r
- //\r
- // Define class members\r
- //\r
- DefaultTreeModel treeModel = null;\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public ITree() {\r
- super();\r
- }\r
-\r
- /**\r
- This is the overrided constructor\r
- Init class members with input data\r
- \r
- @param iDmtRoot The root node of the tree\r
- \r
- **/\r
- public ITree(IDefaultMutableTreeNode iDmtRoot) {\r
- super(iDmtRoot);\r
- }\r
-\r
- /**\r
- Get category of selected node\r
- \r
- @return The category of selected node\r
- \r
- **/\r
- public int getSelectCategory() {\r
- int intCategory = 0;\r
- TreePath path = this.getSelectionPath();\r
- IDefaultMutableTreeNode node = (IDefaultMutableTreeNode) path.getLastPathComponent();\r
- intCategory = node.getCategory();\r
- return intCategory;\r
- }\r
-\r
- /**\r
- Get operation of selected node\r
- \r
- @return The operation of selected node\r
- \r
- **/\r
- public int getSelectOperation() {\r
- int intOperation = 0;\r
- TreePath path = this.getSelectionPath();\r
- IDefaultMutableTreeNode node = (IDefaultMutableTreeNode) path.getLastPathComponent();\r
- intOperation = node.getOperation();\r
- return intOperation;\r
- }\r
-\r
- /**\r
- Get selectLoaction of selected node\r
- \r
- @return The selectLoaction of selected node\r
- \r
- **/\r
- public int getSelectLoaction() {\r
- int intLocation = 0;\r
- TreePath path = this.getSelectionPath();\r
- IDefaultMutableTreeNode node = (IDefaultMutableTreeNode) path.getLastPathComponent();\r
- intLocation = node.getLocation();\r
- return intLocation;\r
- }\r
-\r
- /**\r
- Main class, reserved for test\r
- \r
- @param args\r
- \r
- **/\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
- }\r
-\r
- /**\r
- Add input node as child node for current selected node\r
- \r
- @param strNewNode The name of the node which need be added\r
- \r
- **/\r
- public void addNode(String strNewNode) {\r
- DefaultMutableTreeNode parentNode = null;\r
- DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(strNewNode);\r
- newNode.setAllowsChildren(true);\r
- TreePath parentPath = this.getSelectionPath();\r
-\r
- /**\r
- * Get parent node of new node\r
- */\r
- parentNode = (DefaultMutableTreeNode) (parentPath.getLastPathComponent());\r
-\r
- /**\r
- * Insert new node\r
- */\r
- treeModel.insertNodeInto(newNode, parentNode, parentNode.getChildCount());\r
- this.scrollPathToVisible(new TreePath(newNode.getPath()));\r
- }\r
-\r
- /**\r
- Add input node as child node for current selected node\r
- \r
- @param newNode The node need be added\r
- \r
- **/\r
- public void addNode(IDefaultMutableTreeNode newNode) {\r
- IDefaultMutableTreeNode parentNode = null;\r
- newNode.setAllowsChildren(true);\r
- TreePath parentPath = this.getSelectionPath();\r
- parentNode = (IDefaultMutableTreeNode) (parentPath.getLastPathComponent());\r
- treeModel.insertNodeInto(newNode, parentNode, parentNode.getChildCount());\r
- this.scrollPathToVisible(new TreePath(newNode.getPath()));\r
- }\r
-\r
- /**\r
- Remove current selectd node\r
- \r
- **/\r
- public void removeNode() {\r
- TreePath treepath = this.getSelectionPath();\r
- if (treepath != null) {\r
- DefaultMutableTreeNode selectionNode = (DefaultMutableTreeNode) treepath.getLastPathComponent();\r
- TreeNode parent = (TreeNode) selectionNode.getParent();\r
- if (parent != null) {\r
- treeModel.removeNodeFromParent(selectionNode);\r
- }\r
- }\r
- }\r
-\r
- /**\r
- Remove all node on a same level\r
- \r
- **/\r
- public void removeNodeOnSameLevel() {\r
- TreePath treepath = this.getSelectionPath();\r
- IDefaultMutableTreeNode parentNode = (IDefaultMutableTreeNode) treepath.getLastPathComponent();\r
- parentNode.removeAllChildren();\r
- treeModel.reload();\r
- }\r
-\r
- /**\r
- Remove the input node by name\r
- \r
- @param strRemovedNode\r
- \r
- **/\r
- public void removeNode(String strRemovedNode) {\r
- TreePath treepath = this.getSelectionPath();\r
- if (treepath != null) {\r
- DefaultMutableTreeNode selectionNode = (DefaultMutableTreeNode) treepath.getLastPathComponent();\r
- TreeNode parent = (TreeNode) selectionNode.getParent();\r
- if (parent != null) {\r
- treeModel.removeNodeFromParent(selectionNode);\r
- }\r
- }\r
- }\r
-\r
- /**\r
- Remove all nodes of the tree\r
- \r
- **/\r
- public void removeAllNode() {\r
- DefaultMutableTreeNode rootNode = (DefaultMutableTreeNode) treeModel.getRoot();\r
- rootNode.removeAllChildren();\r
- treeModel.reload();\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to override JLabel to provides customized interfaces \r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-\r
-package org.tianocore.packaging.common.ui;\r
-\r
-import javax.swing.JLabel;\r
-\r
-/**\r
- The class is used to override JLabel to provides customized interfaces \r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class StarLabel extends JLabel {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -6702981027831543919L;\r
-\r
- /**\r
- Main class, reserved for test\r
- \r
- @param args\r
- \r
- **/\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public StarLabel() {\r
- super();\r
- init();\r
- }\r
-\r
- /**\r
- To create a RED, BOLD and 14 size "*"\r
- \r
- **/\r
- private void init() {\r
- this.setText("*");\r
- this.setSize(new java.awt.Dimension(10, 20));\r
- this.setForeground(java.awt.Color.red);\r
- this.setFont(new java.awt.Font("DialogInput", java.awt.Font.BOLD, 14));\r
- this.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- This file is used to create, update MbdHeader of a MBD file\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-\r
-package org.tianocore.packaging.module.ui;\r
-\r
-import java.awt.event.ActionEvent;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.JLabel;\r
-import javax.swing.JPanel;\r
-import javax.swing.JScrollPane;\r
-import javax.swing.JTextArea;\r
-import javax.swing.JTextField;\r
-\r
-import org.tianocore.BaseNameDocument;\r
-import org.tianocore.GuidDocument;\r
-import org.tianocore.LicenseDocument;\r
-import org.tianocore.MbdHeaderDocument;\r
-import org.tianocore.common.DataValidation;\r
-import org.tianocore.common.Log;\r
-import org.tianocore.common.Tools;\r
-import org.tianocore.packaging.common.ui.IInternalFrame;\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-\r
-/**\r
- This class is used to create, update MbdHeader of a MBD file\r
- It extends IInternalFrame\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class MbdHeader extends IInternalFrame {\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -2015726615436197378L;\r
-\r
- //\r
- // Define class members\r
- //\r
- private JPanel jContentPane = null;\r
-\r
- private JLabel jLabelBaseName = null;\r
-\r
- private JTextField jTextFieldBaseName = null;\r
-\r
- private JLabel jLabelGuid = null;\r
-\r
- private JTextField jTextFieldGuid = null;\r
-\r
- private JLabel jLabelVersion = null;\r
-\r
- private JTextField jTextFieldVersion = null;\r
-\r
- private JButton jButtonGenerateGuid = null;\r
-\r
- private JLabel jLabelLicense = null;\r
-\r
- private JTextArea jTextAreaLicense = null;\r
-\r
- private JLabel jLabelCopyright = null;\r
-\r
- private JLabel jLabelDescription = null;\r
-\r
- private JTextArea jTextAreaDescription = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JScrollPane jScrollPaneLicense = null;\r
-\r
- private JScrollPane jScrollPaneDescription = null;\r
-\r
- private StarLabel jStarLabel1 = null;\r
-\r
- private StarLabel jStarLabel2 = null;\r
-\r
- private StarLabel jStarLabel3 = null;\r
-\r
- private StarLabel jStarLabel4 = null;\r
-\r
- private StarLabel jStarLabel5 = null;\r
-\r
- private StarLabel jStarLabel6 = null;\r
-\r
- private MbdHeaderDocument.MbdHeader mbdHeader = null;\r
-\r
- private JTextField jTextFieldCopyright = null;\r
-\r
- /**\r
- This method initializes jTextFieldBaseName\r
- \r
- @return javax.swing.JTextField jTextFieldBaseName\r
- \r
- **/\r
- private JTextField getJTextFieldBaseName() {\r
- if (jTextFieldBaseName == null) {\r
- jTextFieldBaseName = new JTextField();\r
- jTextFieldBaseName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
- }\r
- return jTextFieldBaseName;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldGuid \r
- \r
- @return javax.swing.JTextField jTextFieldGuid\r
- \r
- **/\r
- private JTextField getJTextFieldGuid() {\r
- if (jTextFieldGuid == null) {\r
- jTextFieldGuid = new JTextField();\r
- jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 35, 250, 20));\r
- }\r
- return jTextFieldGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldVersion \r
- \r
- @return javax.swing.JTextField jTextFieldVersion\r
- \r
- **/\r
- private JTextField getJTextFieldVersion() {\r
- if (jTextFieldVersion == null) {\r
- jTextFieldVersion = new JTextField();\r
- jTextFieldVersion.setBounds(new java.awt.Rectangle(160, 60, 320, 20));\r
- }\r
- return jTextFieldVersion;\r
- }\r
-\r
- /**\r
- This method initializes jButtonGenerateGuid \r
- \r
- @return javax.swing.JButton jButtonGenerateGuid\r
- \r
- **/\r
- private JButton getJButtonGenerateGuid() {\r
- if (jButtonGenerateGuid == null) {\r
- jButtonGenerateGuid = new JButton();\r
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 35, 65, 20));\r
- jButtonGenerateGuid.setText("GEN");\r
- jButtonGenerateGuid.addActionListener(this);\r
- }\r
- return jButtonGenerateGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextAreaLicense \r
- \r
- @return javax.swing.JTextArea jTextAreaLicense\r
- \r
- **/\r
- private JTextArea getJTextAreaLicense() {\r
- if (jTextAreaLicense == null) {\r
- jTextAreaLicense = new JTextArea();\r
- jTextAreaLicense.setText("");\r
- jTextAreaLicense.setLineWrap(true);\r
- }\r
- return jTextAreaLicense;\r
- }\r
-\r
- /**\r
- This method initializes jTextAreaDescription \r
- \r
- @return javax.swing.JTextArea jTextAreaDescription\r
- \r
- **/\r
- private JTextArea getJTextAreaDescription() {\r
- if (jTextAreaDescription == null) {\r
- jTextAreaDescription = new JTextArea();\r
- jTextAreaDescription.setLineWrap(true);\r
- }\r
- return jTextAreaDescription;\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton jButtonOk\r
- \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("OK");\r
- jButtonOk.setBounds(new java.awt.Rectangle(290, 345, 90, 20));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton jButtonCancel\r
- \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 345, 90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPaneLicense \r
- \r
- @return javax.swing.JScrollPane jScrollPaneLicense\r
- \r
- **/\r
- private JScrollPane getJScrollPaneLicense() {\r
- if (jScrollPaneLicense == null) {\r
- jScrollPaneLicense = new JScrollPane();\r
- jScrollPaneLicense.setBounds(new java.awt.Rectangle(160, 85, 320, 80));\r
- jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r
- jScrollPaneLicense.setViewportView(getJTextAreaLicense());\r
- }\r
- return jScrollPaneLicense;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPaneDescription \r
- \r
- @return javax.swing.JScrollPane jScrollPaneDescription\r
- \r
- **/\r
- private JScrollPane getJScrollPaneDescription() {\r
- if (jScrollPaneDescription == null) {\r
- jScrollPaneDescription = new JScrollPane();\r
- jScrollPaneDescription.setBounds(new java.awt.Rectangle(160, 195, 320, 80));\r
- jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r
- jScrollPaneDescription.setViewportView(getJTextAreaDescription());\r
- }\r
- return jScrollPaneDescription;\r
- }\r
-\r
- /**\r
- * This method initializes jTextFieldCopyright \r
- * \r
- * @return javax.swing.JTextField \r
- */\r
- private JTextField getJTextFieldCopyright() {\r
- if (jTextFieldCopyright == null) {\r
- jTextFieldCopyright = new JTextField();\r
- jTextFieldCopyright.setBounds(new java.awt.Rectangle(160,170,320,20));\r
- }\r
- return jTextFieldCopyright;\r
- }\r
-\r
- public static void main(String[] args) {\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public MbdHeader() {\r
- super();\r
- init();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- **/\r
- public MbdHeader(MbdHeaderDocument.MbdHeader inMbdHeader) {\r
- super();\r
- init(inMbdHeader);\r
- this.setVisible(true);\r
- this.setViewMode(false);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void init() {\r
- this.setSize(500, 515);\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Module Build Description Header");\r
- initFrame();\r
- }\r
-\r
- /**\r
- This method initializes this\r
- Fill values to all fields if these values are not empty\r
- \r
- @param inMbdHeader The input MbdHeaderDocument.MbdHeader\r
- \r
- **/\r
- private void init(MbdHeaderDocument.MbdHeader inMbdHeader) {\r
- init();\r
- setMbdHeader(inMbdHeader);\r
- if (inMbdHeader != null) {\r
- if (this.mbdHeader.getBaseName() != null) {\r
- this.jTextFieldBaseName.setText(this.mbdHeader.getBaseName().getStringValue());\r
- }\r
- if (this.mbdHeader.getGuid() != null) {\r
- this.jTextFieldGuid.setText(this.mbdHeader.getGuid().getStringValue());\r
- }\r
- if (this.mbdHeader.getVersion() != null) {\r
- this.jTextFieldVersion.setText(this.mbdHeader.getVersion());\r
- }\r
- if (this.mbdHeader.getLicense() != null) {\r
- this.jTextAreaLicense.setText(this.mbdHeader.getLicense().getStringValue());\r
- }\r
- if (this.mbdHeader.getCopyright() != null) {\r
- this.jTextFieldCopyright.setText(this.mbdHeader.getCopyright());\r
- }\r
- if (this.mbdHeader.getDescription() != null) {\r
- this.jTextAreaDescription.setText(this.mbdHeader.getDescription());\r
- }\r
- }\r
- }\r
-\r
- /**\r
- Disable all components when the mode is view\r
- \r
- @param isView true - The view mode; false - The non-view mode\r
- \r
- **/\r
- public void setViewMode(boolean isView) {\r
- this.jButtonOk.setVisible(false);\r
- this.jButtonCancel.setVisible(false);\r
- if (isView) {\r
- this.jTextFieldBaseName.setEnabled(!isView);\r
- this.jTextFieldGuid.setEnabled(!isView);\r
- this.jTextFieldVersion.setEnabled(!isView);\r
- this.jTextAreaLicense.setEnabled(!isView);\r
- this.jTextFieldCopyright.setEnabled(!isView);\r
- this.jTextAreaDescription.setEnabled(!isView);\r
- this.jButtonCancel.setEnabled(!isView);\r
- this.jButtonGenerateGuid.setEnabled(!isView);\r
- this.jButtonOk.setEnabled(!isView);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel jContentPane\r
- \r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabelDescription = new JLabel();\r
- jLabelDescription.setText("Description");\r
- jLabelDescription.setBounds(new java.awt.Rectangle(15, 195, 140, 20));\r
- jLabelCopyright = new JLabel();\r
- jLabelCopyright.setText("Copyright");\r
- jLabelCopyright.setBounds(new java.awt.Rectangle(15, 170, 140, 20));\r
- jLabelLicense = new JLabel();\r
- jLabelLicense.setText("License");\r
- jLabelLicense.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
- jLabelVersion = new JLabel();\r
- jLabelVersion.setText("Version");\r
- jLabelVersion.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
- jLabelGuid = new JLabel();\r
- jLabelGuid.setPreferredSize(new java.awt.Dimension(25, 15));\r
- jLabelGuid.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
- jLabelGuid.setText("Guid");\r
- jLabelBaseName = new JLabel();\r
- jLabelBaseName.setText("Base Name");\r
- jLabelBaseName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.setLocation(new java.awt.Point(0, 0));\r
- jContentPane.setSize(new java.awt.Dimension(500, 524));\r
- jContentPane.add(jLabelBaseName, null);\r
- jContentPane.add(getJTextFieldBaseName(), null);\r
- jContentPane.add(jLabelGuid, null);\r
- jContentPane.add(getJTextFieldGuid(), null);\r
- jContentPane.add(jLabelVersion, null);\r
- jContentPane.add(getJTextFieldVersion(), null);\r
- jContentPane.add(getJButtonGenerateGuid(), null);\r
- jContentPane.add(jLabelLicense, null);\r
- jContentPane.add(jLabelCopyright, null);\r
- jContentPane.add(jLabelDescription, null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJScrollPaneLicense(), null);\r
- jContentPane.add(getJScrollPaneDescription(), null);\r
-\r
- jStarLabel1 = new StarLabel();\r
- jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
- jStarLabel2 = new StarLabel();\r
- jStarLabel2.setLocation(new java.awt.Point(0, 35));\r
- jStarLabel3 = new StarLabel();\r
- jStarLabel3.setLocation(new java.awt.Point(0, 60));\r
- jStarLabel4 = new StarLabel();\r
- jStarLabel4.setLocation(new java.awt.Point(0, 85));\r
- jStarLabel5 = new StarLabel();\r
- jStarLabel5.setLocation(new java.awt.Point(0, 170));\r
- jStarLabel6 = new StarLabel();\r
- jStarLabel6.setLocation(new java.awt.Point(0, 195));\r
-\r
- jContentPane.add(jStarLabel1, null);\r
- jContentPane.add(jStarLabel2, null);\r
- jContentPane.add(jStarLabel3, null);\r
- jContentPane.add(jStarLabel4, null);\r
- jContentPane.add(jStarLabel5, null);\r
- jContentPane.add(jStarLabel6, null);\r
- jContentPane.add(getJTextFieldCopyright(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- *\r
- * Override actionPerformed to listen all actions\r
- * \r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.dispose();\r
- this.save();\r
- this.setEdited(true);\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- this.setEdited(false);\r
- }\r
- //\r
- // Generate GUID\r
- //\r
- if (arg0.getSource() == jButtonGenerateGuid) {\r
- jTextFieldGuid.setText(Tools.generateUuidString());\r
- }\r
- }\r
-\r
- /**\r
- Data validation for all fields\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean check() {\r
- //\r
- // Check if all required fields are not empty\r
- //\r
- if (isEmpty(this.jTextFieldBaseName.getText())) {\r
- Log.err("Base Name couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextFieldGuid.getText())) {\r
- Log.err("Guid couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextFieldVersion.getText())) {\r
- Log.err("Version couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextAreaLicense.getText())) {\r
- Log.err("License couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextFieldCopyright.getText())) {\r
- Log.err("Copyright couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextAreaDescription.getText())) {\r
- Log.err("Description couldn't be empty");\r
- return false;\r
- }\r
-\r
- //\r
- // Check if all fields have correct data types \r
- //\r
- if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {\r
- Log.err("Incorrect data type for Base Name");\r
- return false;\r
- }\r
- if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {\r
- Log.err("Incorrect data type for Guid");\r
- return false;\r
- }\r
- if (!DataValidation.isCopyright(this.jTextFieldCopyright.getText())) {\r
- Log.err("Incorrect data type for Copyright");\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- /**\r
- Save all components of Mbd Header\r
- if exists mbdHeader, set the value directly\r
- if not exists mbdHeader, new an instance first\r
- \r
- **/\r
- public void save() {\r
- try {\r
- if (this.mbdHeader == null) {\r
- mbdHeader = MbdHeaderDocument.MbdHeader.Factory.newInstance();\r
- }\r
- if (this.mbdHeader.getBaseName() != null) {\r
- this.mbdHeader.getBaseName().setStringValue(this.jTextFieldBaseName.getText());\r
- } else {\r
- BaseNameDocument.BaseName mBaseName = BaseNameDocument.BaseName.Factory.newInstance();\r
- mBaseName.setStringValue(this.jTextFieldBaseName.getText());\r
- this.mbdHeader.setBaseName(mBaseName);\r
- }\r
-\r
- if (this.mbdHeader.getGuid() != null) {\r
- this.mbdHeader.getGuid().setStringValue(this.jTextFieldGuid.getText());\r
- } else {\r
- GuidDocument.Guid mGuid = GuidDocument.Guid.Factory.newInstance();\r
- mGuid.setStringValue(this.jTextFieldGuid.getText());\r
- this.mbdHeader.setGuid(mGuid);\r
- }\r
-\r
- this.mbdHeader.setVersion(this.jTextFieldVersion.getText());\r
-\r
- if (this.mbdHeader.getLicense() != null) {\r
- this.mbdHeader.getLicense().setStringValue(this.jTextAreaLicense.getText());\r
- } else {\r
- LicenseDocument.License mLicense = LicenseDocument.License.Factory.newInstance();\r
- mLicense.setStringValue(this.jTextAreaLicense.getText());\r
- this.mbdHeader.setLicense(mLicense);\r
- }\r
-\r
- this.mbdHeader.setCopyright(this.jTextFieldCopyright.getText());\r
- this.mbdHeader.setDescription(this.jTextAreaDescription.getText());\r
-\r
- if (this.mbdHeader.getCreated() == null) {\r
- this.mbdHeader.setCreated(Tools.getCurrentDateTime());\r
- } else {\r
- this.mbdHeader.setModified(Tools.getCurrentDateTime());\r
- }\r
-\r
- } catch (Exception e) {\r
- Log.err("Save Module Buid Description", e.getMessage());\r
- }\r
- }\r
-\r
- /**\r
- This method initializes module type and compontent type\r
- \r
- **/\r
- private void initFrame() {\r
-\r
- }\r
-\r
- /**\r
- Get MbdHeaderDocument.MbdHeader\r
- \r
- @return MbdHeaderDocument.MbdHeader mbdHeader\r
- \r
- **/\r
- public MbdHeaderDocument.MbdHeader getMbdHeader() {\r
- return mbdHeader;\r
- }\r
-\r
- /**\r
- Set MbdHeaderDocument.MbdHeader\r
- \r
- @param mbdHeader The input MbdHeaderDocument.MbdHeader\r
- \r
- **/\r
- public void setMbdHeader(MbdHeaderDocument.MbdHeader mbdHeader) {\r
- this.mbdHeader = mbdHeader;\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to create, update MbdLibHeader of a MBD file\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-package org.tianocore.packaging.module.ui;\r
-\r
-import java.awt.event.ActionEvent;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.JLabel;\r
-import javax.swing.JPanel;\r
-import javax.swing.JScrollPane;\r
-import javax.swing.JTextArea;\r
-import javax.swing.JTextField;\r
-\r
-import org.tianocore.BaseNameDocument;\r
-import org.tianocore.GuidDocument;\r
-import org.tianocore.LicenseDocument;\r
-import org.tianocore.MbdLibHeaderDocument;\r
-import org.tianocore.common.DataValidation;\r
-import org.tianocore.common.Log;\r
-import org.tianocore.common.Tools;\r
-import org.tianocore.packaging.common.ui.IInternalFrame;\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-\r
-/**\r
- The class is used to create, update MbdLibHeader of a MBD file\r
- It extends IInternalFrame\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class MbdLibHeader extends IInternalFrame {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -4881447351274201866L;\r
-\r
- //\r
- //Define class members\r
- //\r
- private JPanel jContentPane = null;\r
-\r
- private JLabel jLabelBaseName = null;\r
-\r
- private JTextField jTextFieldBaseName = null;\r
-\r
- private JLabel jLabelGuid = null;\r
-\r
- private JTextField jTextFieldGuid = null;\r
-\r
- private JLabel jLabelVersion = null;\r
-\r
- private JTextField jTextFieldVersion = null;\r
-\r
- private JButton jButtonGenerateGuid = null;\r
-\r
- private JLabel jLabelLicense = null;\r
-\r
- private JTextArea jTextAreaLicense = null;\r
-\r
- private JLabel jLabelCopyright = null;\r
-\r
- private JLabel jLabelDescription = null;\r
-\r
- private JTextArea jTextAreaDescription = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JScrollPane jScrollPaneLicense = null;\r
-\r
- private JScrollPane jScrollPaneDescription = null;\r
-\r
- private StarLabel jStarLabel1 = null;\r
-\r
- private StarLabel jStarLabel2 = null;\r
-\r
- private StarLabel jStarLabel3 = null;\r
-\r
- private StarLabel jStarLabel4 = null;\r
-\r
- private StarLabel jStarLabel5 = null;\r
-\r
- private StarLabel jStarLabel6 = null;\r
-\r
- private MbdLibHeaderDocument.MbdLibHeader mbdLibHeader = null;\r
-\r
- private JTextField jTextFieldCopyright = null;\r
-\r
- /**\r
- This method initializes jTextFieldBaseName \r
- \r
- @return javax.swing.JTextField jTextFieldBaseName\r
- \r
- **/\r
- private JTextField getJTextFieldBaseName() {\r
- if (jTextFieldBaseName == null) {\r
- jTextFieldBaseName = new JTextField();\r
- jTextFieldBaseName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
- }\r
- return jTextFieldBaseName;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldGuid \r
- \r
- @return javax.swing.JTextField jTextFieldGuid\r
- \r
- **/\r
- private JTextField getJTextFieldGuid() {\r
- if (jTextFieldGuid == null) {\r
- jTextFieldGuid = new JTextField();\r
- jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 35, 250, 20));\r
- }\r
- return jTextFieldGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldVersion \r
- \r
- @return javax.swing.JTextField jTextFieldVersion\r
- \r
- **/\r
- private JTextField getJTextFieldVersion() {\r
- if (jTextFieldVersion == null) {\r
- jTextFieldVersion = new JTextField();\r
- jTextFieldVersion.setBounds(new java.awt.Rectangle(160, 60, 320, 20));\r
- }\r
- return jTextFieldVersion;\r
- }\r
-\r
- /**\r
- This method initializes jButtonGenerateGuid \r
- \r
- @return javax.swing.JButton jButtonGenerateGuid\r
- \r
- **/\r
- private JButton getJButtonGenerateGuid() {\r
- if (jButtonGenerateGuid == null) {\r
- jButtonGenerateGuid = new JButton();\r
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 35, 65, 20));\r
- jButtonGenerateGuid.setText("GEN");\r
- jButtonGenerateGuid.addActionListener(this);\r
- }\r
- return jButtonGenerateGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextAreaLicense \r
- \r
- @return javax.swing.JTextArea jTextAreaLicense\r
- \r
- **/\r
- private JTextArea getJTextAreaLicense() {\r
- if (jTextAreaLicense == null) {\r
- jTextAreaLicense = new JTextArea();\r
- jTextAreaLicense.setText("");\r
- jTextAreaLicense.setLineWrap(true);\r
- }\r
- return jTextAreaLicense;\r
- }\r
-\r
- /**\r
- This method initializes jTextAreaDescription \r
- \r
- @return javax.swing.JTextArea jTextAreaDescription\r
- \r
- **/\r
- private JTextArea getJTextAreaDescription() {\r
- if (jTextAreaDescription == null) {\r
- jTextAreaDescription = new JTextArea();\r
- jTextAreaDescription.setLineWrap(true);\r
- }\r
- return jTextAreaDescription;\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton jButtonOk\r
- \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("OK");\r
- jButtonOk.setBounds(new java.awt.Rectangle(290, 345, 90, 20));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton jButtonCancel\r
- \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 345, 90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPaneLicense \r
- \r
- @return javax.swing.JScrollPane jScrollPaneLicense \r
- \r
- **/\r
- private JScrollPane getJScrollPaneLicense() {\r
- if (jScrollPaneLicense == null) {\r
- jScrollPaneLicense = new JScrollPane();\r
- jScrollPaneLicense.setBounds(new java.awt.Rectangle(160, 85, 320, 80));\r
- jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r
- jScrollPaneLicense.setViewportView(getJTextAreaLicense());\r
- }\r
- return jScrollPaneLicense;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPaneDescription \r
- \r
- @return javax.swing.JScrollPane jScrollPaneDescription\r
- \r
- **/\r
- private JScrollPane getJScrollPaneDescription() {\r
- if (jScrollPaneDescription == null) {\r
- jScrollPaneDescription = new JScrollPane();\r
- jScrollPaneDescription.setBounds(new java.awt.Rectangle(160, 195, 320, 80));\r
- jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r
- jScrollPaneDescription.setViewportView(getJTextAreaDescription());\r
- }\r
- return jScrollPaneDescription;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldCopyright \r
- \r
- @return javax.swing.JTextField jTextFieldCopyright\r
- \r
- **/\r
- private JTextField getJTextFieldCopyright() {\r
- if (jTextFieldCopyright == null) {\r
- jTextFieldCopyright = new JTextField();\r
- jTextFieldCopyright.setBounds(new java.awt.Rectangle(160,170,320,20));\r
- }\r
- return jTextFieldCopyright;\r
- }\r
-\r
- public static void main(String[] args) {\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public MbdLibHeader() {\r
- super();\r
- init();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inMbdLibHeader The input MbdLibHeaderDocument.MbdLibHeader\r
- \r
- **/\r
- public MbdLibHeader(MbdLibHeaderDocument.MbdLibHeader inMbdLibHeader) {\r
- super();\r
- init(inMbdLibHeader);\r
- this.setVisible(true);\r
- this.setViewMode(false);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void init() {\r
- this.setSize(500, 515);\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Library Module Build Description Header");\r
- initFrame();\r
- }\r
-\r
- /**\r
- This method initializes this\r
- Fill values to all fields if these values are not empty\r
- \r
- @param inMbdLibHeader The input MbdLibHeaderDocument.MbdLibHeader\r
- \r
- **/\r
- private void init(MbdLibHeaderDocument.MbdLibHeader inMbdLibHeader) {\r
- init();\r
- setMbdLibHeader(inMbdLibHeader);\r
- if (inMbdLibHeader != null) {\r
- if (this.mbdLibHeader.getBaseName() != null) {\r
- this.jTextFieldBaseName.setText(this.mbdLibHeader.getBaseName().getStringValue());\r
- }\r
- if (this.mbdLibHeader.getGuid() != null) {\r
- this.jTextFieldGuid.setText(this.mbdLibHeader.getGuid().getStringValue());\r
- }\r
- if (this.mbdLibHeader.getVersion() != null) {\r
- this.jTextFieldVersion.setText(this.mbdLibHeader.getVersion());\r
- }\r
- if (this.mbdLibHeader.getLicense() != null) {\r
- this.jTextAreaLicense.setText(this.mbdLibHeader.getLicense().getStringValue());\r
- }\r
- if (this.mbdLibHeader.getCopyright() != null) {\r
- this.jTextFieldCopyright.setText(this.mbdLibHeader.getCopyright());\r
- }\r
- if (this.mbdLibHeader.getDescription() != null) {\r
- this.jTextAreaDescription.setText(this.mbdLibHeader.getDescription());\r
- }\r
- }\r
- }\r
-\r
- /**\r
- Disable all components when the mode is view\r
- \r
- @param isView true - The view mode; false - The non-view mode\r
- \r
- **/\r
- public void setViewMode(boolean isView) {\r
- this.jButtonOk.setVisible(false);\r
- this.jButtonCancel.setVisible(false);\r
- if (isView) {\r
- this.jTextFieldBaseName.setEnabled(!isView);\r
- this.jTextFieldGuid.setEnabled(!isView);\r
- this.jTextFieldVersion.setEnabled(!isView);\r
- this.jTextAreaLicense.setEnabled(!isView);\r
- this.jTextFieldCopyright.setEnabled(!isView);\r
- this.jTextAreaDescription.setEnabled(!isView);\r
- this.jButtonCancel.setEnabled(!isView);\r
- this.jButtonGenerateGuid.setEnabled(!isView);\r
- this.jButtonOk.setEnabled(!isView);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel jContentPane\r
- \r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabelDescription = new JLabel();\r
- jLabelDescription.setText("Description");\r
- jLabelDescription.setBounds(new java.awt.Rectangle(15, 195, 140, 20));\r
- jLabelCopyright = new JLabel();\r
- jLabelCopyright.setText("Copyright");\r
- jLabelCopyright.setBounds(new java.awt.Rectangle(15, 170, 140, 20));\r
- jLabelLicense = new JLabel();\r
- jLabelLicense.setText("License");\r
- jLabelLicense.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
- jLabelVersion = new JLabel();\r
- jLabelVersion.setText("Version");\r
- jLabelVersion.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
- jLabelGuid = new JLabel();\r
- jLabelGuid.setPreferredSize(new java.awt.Dimension(25, 15));\r
- jLabelGuid.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
- jLabelGuid.setText("Guid");\r
- jLabelBaseName = new JLabel();\r
- jLabelBaseName.setText("Base Name");\r
- jLabelBaseName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.setLocation(new java.awt.Point(0, 0));\r
- jContentPane.setSize(new java.awt.Dimension(500, 524));\r
- jContentPane.add(jLabelBaseName, null);\r
- jContentPane.add(getJTextFieldBaseName(), null);\r
- jContentPane.add(jLabelGuid, null);\r
- jContentPane.add(getJTextFieldGuid(), null);\r
- jContentPane.add(jLabelVersion, null);\r
- jContentPane.add(getJTextFieldVersion(), null);\r
- jContentPane.add(getJButtonGenerateGuid(), null);\r
- jContentPane.add(jLabelLicense, null);\r
- jContentPane.add(jLabelCopyright, null);\r
- jContentPane.add(jLabelDescription, null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJScrollPaneLicense(), null);\r
- jContentPane.add(getJScrollPaneDescription(), null);\r
-\r
- jStarLabel1 = new StarLabel();\r
- jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
- jStarLabel2 = new StarLabel();\r
- jStarLabel2.setLocation(new java.awt.Point(0, 35));\r
- jStarLabel3 = new StarLabel();\r
- jStarLabel3.setLocation(new java.awt.Point(0, 60));\r
- jStarLabel4 = new StarLabel();\r
- jStarLabel4.setLocation(new java.awt.Point(0, 85));\r
- jStarLabel5 = new StarLabel();\r
- jStarLabel5.setLocation(new java.awt.Point(0, 170));\r
- jStarLabel6 = new StarLabel();\r
- jStarLabel6.setLocation(new java.awt.Point(0, 195));\r
-\r
- jContentPane.add(jStarLabel1, null);\r
- jContentPane.add(jStarLabel2, null);\r
- jContentPane.add(jStarLabel3, null);\r
- jContentPane.add(jStarLabel4, null);\r
- jContentPane.add(jStarLabel5, null);\r
- jContentPane.add(jStarLabel6, null);\r
- jContentPane.add(getJTextFieldCopyright(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- *\r
- * Override actionPerformed to listen all actions\r
- * \r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.dispose();\r
- this.save();\r
- this.setEdited(true);\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- this.setEdited(false);\r
- }\r
- if (arg0.getSource() == jButtonGenerateGuid) {\r
- jTextFieldGuid.setText(Tools.generateUuidString());\r
- }\r
- }\r
-\r
- /**\r
- Data validation for all fields\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean check() {\r
- //\r
- // Check if all required fields are not empty\r
- //\r
- if (isEmpty(this.jTextFieldBaseName.getText())) {\r
- Log.err("Base Name couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextFieldGuid.getText())) {\r
- Log.err("Guid couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextFieldVersion.getText())) {\r
- Log.err("Version couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextAreaLicense.getText())) {\r
- Log.err("License couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextFieldCopyright.getText())) {\r
- Log.err("Copyright couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextAreaDescription.getText())) {\r
- Log.err("Description couldn't be empty");\r
- return false;\r
- }\r
-\r
- //\r
- // Check if all fields have correct data types \r
- //\r
- if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {\r
- Log.err("Incorrect data type for Base Name");\r
- return false;\r
- }\r
- if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {\r
- Log.err("Incorrect data type for Guid");\r
- return false;\r
- }\r
- if (!DataValidation.isCopyright(this.jTextFieldCopyright.getText())) {\r
- Log.err("Incorrect data type for Copyright");\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- /**\r
- Save all components of Mbd Lib Header\r
- if exists mbdLibHeader, set the value directly\r
- if not exists mbdLibHeader, new an instance first\r
- \r
- **/\r
- public void save() {\r
- try {\r
- if (this.mbdLibHeader == null) {\r
- mbdLibHeader = MbdLibHeaderDocument.MbdLibHeader.Factory.newInstance();\r
- }\r
- if (this.mbdLibHeader.getBaseName() != null) {\r
- this.mbdLibHeader.getBaseName().setStringValue(this.jTextFieldBaseName.getText());\r
- } else {\r
- BaseNameDocument.BaseName mBaseName = BaseNameDocument.BaseName.Factory.newInstance();\r
- mBaseName.setStringValue(this.jTextFieldBaseName.getText());\r
- this.mbdLibHeader.setBaseName(mBaseName);\r
- }\r
-\r
- if (this.mbdLibHeader.getGuid() != null) {\r
- this.mbdLibHeader.getGuid().setStringValue(this.jTextFieldGuid.getText());\r
- } else {\r
- GuidDocument.Guid mGuid = GuidDocument.Guid.Factory.newInstance();\r
- mGuid.setStringValue(this.jTextFieldGuid.getText());\r
- this.mbdLibHeader.setGuid(mGuid);\r
- }\r
-\r
- this.mbdLibHeader.setVersion(this.jTextFieldVersion.getText());\r
-\r
- if (this.mbdLibHeader.getLicense() != null) {\r
- this.mbdLibHeader.getLicense().setStringValue(this.jTextAreaLicense.getText());\r
- } else {\r
- LicenseDocument.License mLicense = LicenseDocument.License.Factory.newInstance();\r
- mLicense.setStringValue(this.jTextAreaLicense.getText());\r
- this.mbdLibHeader.setLicense(mLicense);\r
- }\r
-\r
- this.mbdLibHeader.setCopyright(this.jTextFieldCopyright.getText());\r
- this.mbdLibHeader.setDescription(this.jTextAreaDescription.getText());\r
-\r
- if (this.mbdLibHeader.getCreated() == null) {\r
- this.mbdLibHeader.setCreated(Tools.getCurrentDateTime());\r
- } else {\r
- this.mbdLibHeader.setModified(Tools.getCurrentDateTime());\r
- }\r
- } catch (Exception e) {\r
- Log.err("Save Module Buid Description", e.getMessage());\r
- }\r
- }\r
-\r
- /**\r
- This method initializes module type and compontent type\r
- \r
- **/\r
- private void initFrame() {\r
- }\r
-\r
- /**\r
- Get MbdLibHeaderDocument.MbdLibHeader\r
- \r
- @return MbdLibHeaderDocument.MbdLibHeader\r
- \r
- **/\r
- public MbdLibHeaderDocument.MbdLibHeader getMbdLibHeader() {\r
- return mbdLibHeader;\r
- }\r
-\r
- /**\r
- Set MbdLibHeaderDocument.MbdLibHeader\r
- \r
- @param mbdLibHeader The input MbdLibHeaderDocument.MbdLibHeader\r
- \r
- **/\r
- public void setMbdLibHeader(MbdLibHeaderDocument.MbdLibHeader mbdLibHeader) {\r
- this.mbdLibHeader = mbdLibHeader;\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to create, update MbdLibraries of a MBD file\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-package org.tianocore.packaging.module.ui;\r
-\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ItemEvent;\r
-import java.awt.event.ItemListener;\r
-import java.util.Vector;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.JCheckBox;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JLabel;\r
-import javax.swing.JPanel;\r
-import javax.swing.JTextField;\r
-\r
-import org.tianocore.LibrariesDocument;\r
-import org.tianocore.LibraryUsage;\r
-import org.tianocore.SupportedArchitectures;\r
-import org.tianocore.common.DataValidation;\r
-import org.tianocore.common.Log;\r
-import org.tianocore.common.Tools;\r
-import org.tianocore.packaging.common.ui.IDefaultMutableTreeNode;\r
-import org.tianocore.packaging.common.ui.IInternalFrame;\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-\r
-/**\r
- The class is used to create, update MbdLibraries of a MBD file\r
- It extends IInternalFrame\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class MbdLibraries extends IInternalFrame implements ItemListener {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = 8042998899875417568L;\r
-\r
- //\r
- //Define class members\r
- //\r
- private LibrariesDocument.Libraries libraries = null;\r
-\r
- private int location = -1;\r
- \r
- private int intSelectedItemId = 0;\r
-\r
- //\r
- //1 - Add; 2 - Update\r
- //\r
- private int operation = -1;\r
-\r
- private Vector<String> vName = new Vector<String>();\r
-\r
- private Vector<String> vGuid = new Vector<String>();\r
-\r
- private Vector<String> vLibraryClass = new Vector<String>();\r
-\r
- private Vector<String> vClassGuid = new Vector<String>();\r
-\r
- private Vector<String> vVersion = new Vector<String>();\r
-\r
- private Vector<String> vUsage = new Vector<String>();\r
-\r
- private Vector<String> vOverrideID = new Vector<String>();\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JLabel jLabelName = null;\r
-\r
- private JTextField jTextFieldFileName = null;\r
-\r
- private JLabel jLabelGuid = null;\r
-\r
- private JTextField jTextFieldGuid = null;\r
-\r
- private JButton jButtonGenerateGuid = null;\r
-\r
- private JComboBox jComboBoxArch = null;\r
-\r
- private JLabel jLabelLibraryClass = null;\r
-\r
- private JTextField jTextFieldLibraryClass = null;\r
-\r
- private JLabel jLabelUsage = null;\r
-\r
- private JLabel jLabelClassGuid = null;\r
-\r
- private JTextField jTextFieldClassGuid = null;\r
-\r
- private JLabel jLabelOverrideID = null;\r
-\r
- private JTextField jTextFieldOverrideID = null;\r
-\r
- private JComboBox jComboBoxUsage = null;\r
-\r
- private StarLabel jStarLabel1 = null;\r
-\r
- private JComboBox jComboBoxFileList = null;\r
-\r
- private JButton jButtonAdd = null;\r
-\r
- private JButton jButtonRemove = null;\r
-\r
- private JButton jButtonUpdate = null;\r
-\r
- private JCheckBox jCheckBoxArch = null;\r
-\r
- private JButton jButtonGenerateGuid2 = null;\r
-\r
- private JLabel jLabelVersion = null;\r
-\r
- private JTextField jTextFieldVersion = null;\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton jButtonOk \r
- \r
- **/\r
- private JButton getJButton() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("OK");\r
- jButtonOk.setBounds(new java.awt.Rectangle(290, 240, 90, 20));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- *This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton jButtonCancel\r
- \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 240, 90, 20));\r
- jButtonCancel.setPreferredSize(new java.awt.Dimension(90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldFileName \r
- \r
- @return javax.swing.JTextField jTextFieldFileName\r
- \r
- **/\r
- private JTextField getJTextFieldSourceFilesDirectory() {\r
- if (jTextFieldFileName == null) {\r
- jTextFieldFileName = new JTextField();\r
- jTextFieldFileName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
- }\r
- return jTextFieldFileName;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldGuid \r
- \r
- @return javax.swing.JTextField jTextFieldGuid\r
- \r
- **/\r
- private JTextField getJTextFieldGuid() {\r
- if (jTextFieldGuid == null) {\r
- jTextFieldGuid = new JTextField();\r
- jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 35, 250, 20));\r
- }\r
- return jTextFieldGuid;\r
- }\r
-\r
- /**\r
- This method initializes jButtonGenerateGuid \r
- \r
- @return javax.swing.JButton jButtonGenerateGuid\r
- \r
- **/\r
- private JButton getJButtonGenerateGuid() {\r
- if (jButtonGenerateGuid == null) {\r
- jButtonGenerateGuid = new JButton();\r
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 35, 65, 20));\r
- jButtonGenerateGuid.setText("GEN");\r
- jButtonGenerateGuid.addActionListener(this);\r
- }\r
- return jButtonGenerateGuid;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxArch \r
- \r
- @return javax.swing.JComboBox jComboBoxArch\r
- \r
- **/\r
- private JComboBox getJComboBoxArch() {\r
- if (jComboBoxArch == null) {\r
- jComboBoxArch = new JComboBox();\r
- jComboBoxArch.setBounds(new java.awt.Rectangle(140, 210, 340, 20));\r
- jComboBoxArch.setEnabled(false);\r
- }\r
- return jComboBoxArch;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldLibraryClass \r
- \r
- @return javax.swing.JTextField jTextFieldLibraryClass\r
- \r
- **/\r
- private JTextField getJTextFieldLibraryClass() {\r
- if (jTextFieldLibraryClass == null) {\r
- jTextFieldLibraryClass = new JTextField();\r
- jTextFieldLibraryClass.setBounds(new java.awt.Rectangle(160, 60, 320, 20));\r
- }\r
- return jTextFieldLibraryClass;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldClassGuid \r
- \r
- @return javax.swing.JTextField jTextFieldClassGuid\r
- \r
- **/\r
- private JTextField getJTextFieldClassGuid() {\r
- if (jTextFieldClassGuid == null) {\r
- jTextFieldClassGuid = new JTextField();\r
- jTextFieldClassGuid.setBounds(new java.awt.Rectangle(160, 85, 250, 20));\r
- }\r
- return jTextFieldClassGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldOverrideID \r
- \r
- @return javax.swing.JTextField jTextFieldOverrideID\r
- \r
- **/\r
- private JTextField getJTextFieldOverrideID() {\r
- if (jTextFieldOverrideID == null) {\r
- jTextFieldOverrideID = new JTextField();\r
- jTextFieldOverrideID.setBounds(new java.awt.Rectangle(160, 160, 50, 20));\r
- }\r
- return jTextFieldOverrideID;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxUsage \r
- \r
- @return javax.swing.JComboBox jComboBoxUsage\r
- \r
- **/\r
- private JComboBox getJComboBoxUsage() {\r
- if (jComboBoxUsage == null) {\r
- jComboBoxUsage = new JComboBox();\r
- jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 135, 320, 20));\r
- }\r
- return jComboBoxUsage;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxFileList \r
- \r
- @return javax.swing.JComboBox jComboBoxFileList\r
- \r
- **/\r
- private JComboBox getJComboBoxFileList() {\r
- if (jComboBoxFileList == null) {\r
- jComboBoxFileList = new JComboBox();\r
- jComboBoxFileList.setBounds(new java.awt.Rectangle(15, 185, 210, 20));\r
- jComboBoxFileList.addItemListener(this);\r
- jComboBoxFileList.addActionListener(this);\r
- }\r
- return jComboBoxFileList;\r
- }\r
-\r
- /**\r
- This method initializes jButtonAdd \r
- \r
- @return javax.swing.JButton jButtonAdd \r
- \r
- **/\r
- private JButton getJButtonAdd() {\r
- if (jButtonAdd == null) {\r
- jButtonAdd = new JButton();\r
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 185, 80, 20));\r
- jButtonAdd.setText("Add");\r
- jButtonAdd.addActionListener(this);\r
- }\r
- return jButtonAdd;\r
- }\r
-\r
- /**\r
- This method initializes jButtonRemove \r
- \r
- @return javax.swing.JButton jButtonRemove\r
- \r
- **/\r
- private JButton getJButtonRemove() {\r
- if (jButtonRemove == null) {\r
- jButtonRemove = new JButton();\r
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 185, 80, 20));\r
- jButtonRemove.setText("Remove");\r
- jButtonRemove.addActionListener(this);\r
- }\r
- return jButtonRemove;\r
- }\r
-\r
- /**\r
- This method initializes jButtonUpdate \r
- \r
- @return javax.swing.JButton jButtonUpdate\r
- \r
- **/\r
- private JButton getJButtonUpdate() {\r
- if (jButtonUpdate == null) {\r
- jButtonUpdate = new JButton();\r
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 185, 80, 20));\r
- jButtonUpdate.setText("Update");\r
- jButtonUpdate.addActionListener(this);\r
- }\r
- return jButtonUpdate;\r
- }\r
-\r
- /**\r
- This method initializes jCheckBoxArch \r
- \r
- @return javax.swing.JCheckBox jCheckBoxArch\r
- \r
- **/\r
- private JCheckBox getJCheckBoxArch() {\r
- if (jCheckBoxArch == null) {\r
- jCheckBoxArch = new JCheckBox();\r
- jCheckBoxArch.setBounds(new java.awt.Rectangle(10, 210, 119, 20));\r
- jCheckBoxArch.setText("Specific Arch");\r
- jCheckBoxArch.addActionListener(this);\r
- }\r
- return jCheckBoxArch;\r
- }\r
-\r
- /**\r
- This method initializes jButtonGenerateGuid2 \r
- \r
- @return javax.swing.JButton jButtonGenerateGuid2\r
- \r
- **/\r
- private JButton getJButtonGenerateGuid2() {\r
- if (jButtonGenerateGuid2 == null) {\r
- jButtonGenerateGuid2 = new JButton();\r
- jButtonGenerateGuid2.setBounds(new java.awt.Rectangle(415, 85, 65, 20));\r
- jButtonGenerateGuid2.setText("GEN");\r
- jButtonGenerateGuid2.addActionListener(this);\r
- }\r
- return jButtonGenerateGuid2;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldVersion \r
- \r
- @return javax.swing.JTextField jTextFieldVersion\r
- \r
- **/\r
- private JTextField getJTextFieldVersion() {\r
- if (jTextFieldVersion == null) {\r
- jTextFieldVersion = new JTextField();\r
- jTextFieldVersion.setBounds(new java.awt.Rectangle(160, 110, 320, 20));\r
- }\r
- return jTextFieldVersion;\r
- }\r
-\r
- public static void main(String[] args) {\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public MbdLibraries() {\r
- super();\r
- init();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inLibraries The input LibrariesDocument.Libraries\r
- \r
- **/\r
- public MbdLibraries(LibrariesDocument.Libraries inLibraries) {\r
- super();\r
- init(inLibraries);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inLibraries The input LibrariesDocument.Libraries\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- public MbdLibraries(LibrariesDocument.Libraries inLibraries, int type, int index) {\r
- super();\r
- init(inLibraries);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inLibraries The input LibrariesDocument.Libraries\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- @param inOperation The input data of operation type\r
- \r
- **/\r
- public MbdLibraries(LibrariesDocument.Libraries inLibraries, int type, int index, int inOperation) {\r
- super();\r
- init(inLibraries, type, index, inOperation);\r
- this.operation = inOperation;\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @param inLibraries LibrariesDocument.Libraries\r
- \r
- **/\r
- private void init(LibrariesDocument.Libraries inLibraries) {\r
- init();\r
- this.setLibraries(inLibraries);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- Fill values to all fields if these values are not empty\r
- \r
- @param inLibraries LibrariesDocument.Libraries\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- @param inOperation The input data of operation type\r
- \r
- **/\r
- private void init(LibrariesDocument.Libraries inLibraries, int type, int index, int inOperation) {\r
- init(inLibraries);\r
- this.location = index;\r
- this.operation = inOperation;\r
-\r
- if (operation == 2) {\r
- this.jCheckBoxArch.setEnabled(false);\r
- this.jComboBoxArch.setEnabled(false);\r
-\r
- if (type == IDefaultMutableTreeNode.LIBRARIES_LIBRARY) {\r
- if (this.libraries.getLibraryList().size() > 0) {\r
- for (int indexI = 0; indexI < this.libraries.getLibraryList().size(); indexI++) {\r
- if (this.libraries.getLibraryArray(indexI).getStringValue() != null) {\r
- vName.addElement(this.libraries.getLibraryArray(indexI).getStringValue());\r
- } else {\r
- vName.addElement("");\r
- }\r
- if (this.libraries.getLibraryArray(indexI).getGuid() != null) {\r
- vGuid.addElement(this.libraries.getLibraryArray(indexI).getGuid());\r
- } else {\r
- vGuid.addElement("");\r
- }\r
- if (this.libraries.getLibraryArray(indexI).getLibraryClass() != null) {\r
- vLibraryClass.addElement(this.libraries.getLibraryArray(indexI).getLibraryClass());\r
- } else {\r
- vLibraryClass.addElement("");\r
- }\r
- if (this.libraries.getLibraryArray(indexI).getClassGuid() != null) {\r
- vClassGuid.addElement(this.libraries.getLibraryArray(indexI).getClassGuid());\r
- } else {\r
- vClassGuid.addElement("");\r
- }\r
- if (this.libraries.getLibraryArray(indexI).getVersion() != null) {\r
- vVersion.addElement(this.libraries.getLibraryArray(indexI).getVersion());\r
- } else {\r
- vVersion.addElement("");\r
- }\r
- if (this.libraries.getLibraryArray(indexI).getUsage() != null) {\r
- vUsage.addElement(this.libraries.getLibraryArray(indexI).getUsage().toString());\r
- } else {\r
- vUsage.addElement("ALWAYS_CONSUMED");\r
- }\r
- vOverrideID.addElement(String.valueOf(this.libraries.getLibraryArray(indexI).getOverrideID()));\r
- jComboBoxFileList.addItem(this.libraries.getLibraryArray(indexI).getStringValue());\r
- }\r
- }\r
- }\r
- if (type == IDefaultMutableTreeNode.LIBRARIES_ARCH_ITEM) {\r
- this.jCheckBoxArch.setSelected(true);\r
- this.jComboBoxArch.setSelectedItem(this.libraries.getArchArray(index).getArchType().toString());\r
- for (int indexI = 0; indexI < this.libraries.getArchArray(index).getLibraryList().size(); indexI++) {\r
- if (this.libraries.getArchArray(index).getLibraryArray(indexI).getStringValue() != null) {\r
- vName.addElement(this.libraries.getArchArray(index).getLibraryArray(indexI).getStringValue());\r
- } else {\r
- vName.addElement("");\r
- }\r
- if (this.libraries.getArchArray(index).getLibraryArray(indexI).getGuid() != null) {\r
- vGuid.addElement(this.libraries.getArchArray(index).getLibraryArray(indexI).getGuid());\r
- } else {\r
- vGuid.addElement("");\r
- }\r
- if (this.libraries.getArchArray(index).getLibraryArray(indexI).getLibraryClass() != null) {\r
- vLibraryClass.addElement(this.libraries.getArchArray(index).getLibraryArray(indexI)\r
- .getLibraryClass());\r
- } else {\r
- vLibraryClass.addElement("");\r
- }\r
- if (this.libraries.getArchArray(index).getLibraryArray(indexI).getClassGuid() != null) {\r
- vClassGuid\r
- .addElement(this.libraries.getArchArray(index).getLibraryArray(indexI).getClassGuid());\r
- } else {\r
- vClassGuid.addElement("");\r
- }\r
- if (this.libraries.getArchArray(index).getLibraryArray(indexI).getVersion() != null) {\r
- vVersion.addElement(this.libraries.getArchArray(index).getLibraryArray(indexI).getVersion());\r
- } else {\r
- vVersion.addElement("");\r
- }\r
- if (this.libraries.getArchArray(index).getLibraryArray(indexI).getUsage() != null) {\r
- vUsage.addElement(this.libraries.getArchArray(index).getLibraryArray(indexI).getUsage()\r
- .toString());\r
- } else {\r
- vUsage.addElement("");\r
- }\r
- vOverrideID.addElement(String.valueOf(this.libraries.getArchArray(index).getLibraryArray(indexI).getOverrideID()));\r
- jComboBoxFileList.addItem(this.libraries.getArchArray(index).getLibraryArray(indexI)\r
- .getStringValue());\r
- }\r
- }\r
- }\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void init() {\r
- this.setSize(500, 515);\r
- this.setName("JFrame");\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Source Files");\r
- initFrame();\r
- this.setViewMode(false);\r
- }\r
-\r
- /**\r
- Disable all components when the mode is view\r
- \r
- @param isView true - The view mode; false - The non-view mode\r
- \r
- **/\r
- public void setViewMode(boolean isView) {\r
- this.jButtonOk.setVisible(false);\r
- this.jButtonCancel.setVisible(false);\r
- if (isView) {\r
- this.jTextFieldFileName.setEnabled(!isView);\r
- this.jTextFieldGuid.setEnabled(!isView);\r
- this.jButtonGenerateGuid.setEnabled(!isView);\r
- this.jComboBoxArch.setEnabled(!isView);\r
- this.jTextFieldLibraryClass.setEnabled(!isView);\r
- this.jTextFieldClassGuid.setEnabled(!isView);\r
- this.jTextFieldOverrideID.setEnabled(!isView);\r
- this.jComboBoxUsage.setEnabled(!isView);\r
- this.jButtonAdd.setEnabled(!isView);\r
- this.jButtonRemove.setEnabled(!isView);\r
- this.jButtonUpdate.setEnabled(!isView);\r
- this.jCheckBoxArch.setEnabled(!isView);\r
- this.jTextFieldVersion.setEnabled(!isView);\r
-\r
- this.jButtonOk.setEnabled(!isView);\r
- this.jButtonCancel.setEnabled(!isView);\r
- this.jButtonGenerateGuid.setEnabled(!isView);\r
- this.jButtonGenerateGuid2.setEnabled(!isView);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel jContentPane\r
- \r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabelVersion = new JLabel();\r
- jLabelVersion.setBounds(new java.awt.Rectangle(15, 110, 140, 20));\r
- jLabelVersion.setText("Version");\r
- jLabelOverrideID = new JLabel();\r
- jLabelOverrideID.setBounds(new java.awt.Rectangle(15, 160, 140, 20));\r
- jLabelOverrideID.setText("Override ID");\r
- jLabelClassGuid = new JLabel();\r
- jLabelClassGuid.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
- jLabelClassGuid.setText("Class Guid");\r
- jLabelUsage = new JLabel();\r
- jLabelUsage.setBounds(new java.awt.Rectangle(15, 135, 140, 20));\r
- jLabelUsage.setText("Usage");\r
- jLabelLibraryClass = new JLabel();\r
- jLabelLibraryClass.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
- jLabelLibraryClass.setText("Library Class");\r
- jLabelGuid = new JLabel();\r
- jLabelGuid.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
- jLabelGuid.setText("Guid");\r
- jLabelName = new JLabel();\r
- jLabelName.setText("Name");\r
- jLabelName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(getJButton(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(jLabelName, null);\r
- jContentPane.add(getJTextFieldSourceFilesDirectory(), null);\r
- jContentPane.add(jLabelGuid, null);\r
- jContentPane.add(getJTextFieldGuid(), null);\r
- jContentPane.add(getJButtonGenerateGuid(), null);\r
- jContentPane.add(getJComboBoxArch(), null);\r
- jContentPane.add(jLabelLibraryClass, null);\r
- jContentPane.add(getJTextFieldLibraryClass(), null);\r
- jContentPane.add(jLabelUsage, null);\r
- jContentPane.add(jLabelClassGuid, null);\r
- jContentPane.add(getJTextFieldClassGuid(), null);\r
- jContentPane.add(getJButtonGenerateGuid2(), null);\r
- jContentPane.add(jLabelVersion, null);\r
- jContentPane.add(getJTextFieldVersion(), null);\r
- jContentPane.add(jLabelOverrideID, null);\r
- jContentPane.add(getJTextFieldOverrideID(), null);\r
- jContentPane.add(getJComboBoxUsage(), null);\r
-\r
- jStarLabel1 = new StarLabel();\r
- jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
-\r
- jContentPane.add(jStarLabel1, null);\r
- jContentPane.add(getJComboBoxFileList(), null);\r
- jContentPane.add(getJButtonAdd(), null);\r
- jContentPane.add(getJButtonRemove(), null);\r
- jContentPane.add(getJButtonUpdate(), null);\r
- jContentPane.add(getJCheckBoxArch(), null);\r
-\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- *\r
- * Override actionPerformed to listen all actions\r
- * \r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.setEdited(true);\r
- this.save();\r
- this.dispose();\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- }\r
- if (arg0.getSource() == jButtonGenerateGuid) {\r
- jTextFieldGuid.setText(Tools.generateUuidString());\r
- }\r
- if (arg0.getSource() == jButtonGenerateGuid2) {\r
- jTextFieldClassGuid.setText(Tools.generateUuidString());\r
- }\r
- if (arg0.getSource() == jButtonAdd) {\r
- if (!checkAdd()) {\r
- return;\r
- }\r
- addToList();\r
- }\r
- if (arg0.getSource() == jButtonRemove) {\r
- removeFromList();\r
- }\r
- if (arg0.getSource() == jButtonUpdate) {\r
- if (!checkAdd()) {\r
- return;\r
- }\r
- updateForList();\r
- }\r
- if (arg0.getSource() == jCheckBoxArch) {\r
- if (this.jCheckBoxArch.isSelected()) {\r
- this.jComboBoxArch.setEnabled(true);\r
- } else {\r
- this.jComboBoxArch.setEnabled(false);\r
- }\r
- }\r
- }\r
-\r
- /**\r
- Init the items of Usage and Arch\r
- \r
- **/\r
- private void initFrame() {\r
- jComboBoxUsage.addItem("ALWAYS_CONSUMED");\r
- jComboBoxUsage.addItem("SOMETIMES_CONSUMED");\r
- jComboBoxUsage.addItem("ALWAYS_PRODUCED");\r
- jComboBoxUsage.addItem("SOMETIMES_PRODUCED");\r
- jComboBoxUsage.addItem("DEFAULT");\r
- jComboBoxUsage.addItem("PRIVATE");\r
-\r
- jComboBoxArch.addItem("ALL");\r
- jComboBoxArch.addItem("EBC");\r
- jComboBoxArch.addItem("ARM");\r
- jComboBoxArch.addItem("IA32");\r
- jComboBoxArch.addItem("X64");\r
- jComboBoxArch.addItem("IPF");\r
- jComboBoxArch.addItem("PPC");\r
- }\r
-\r
- /**\r
- Add current item to Vector\r
- \r
- **/\r
- private void addToList() {\r
- intSelectedItemId = vName.size();\r
- vName.addElement(this.jTextFieldFileName.getText());\r
- vGuid.addElement(this.jTextFieldGuid.getText());\r
- vLibraryClass.addElement(this.jTextFieldLibraryClass.getText());\r
- vClassGuid.addElement(this.jTextFieldClassGuid.getText());\r
- vVersion.addElement(this.jTextFieldVersion.getText());\r
- vUsage.addElement(this.jComboBoxUsage.getSelectedItem().toString());\r
- vOverrideID.addElement(this.jTextFieldOverrideID.getText());\r
- jComboBoxFileList.addItem(this.jTextFieldFileName.getText());\r
- jComboBoxFileList.setSelectedItem(this.jTextFieldFileName.getText());\r
- \r
- //\r
- // Reset select item index\r
- //\r
- intSelectedItemId = vName.size();\r
- \r
- //\r
- // Reload all fields of selected item\r
- //\r
- reloadFromList();\r
- }\r
-\r
- /**\r
- Remove current item from Vector\r
- \r
- **/\r
- private void removeFromList() {\r
- int intTempIndex = intSelectedItemId;\r
- if (vName.size() < 1) {\r
- return;\r
- }\r
- \r
- jComboBoxFileList.removeItemAt(intSelectedItemId);\r
- \r
- vName.removeElementAt(intTempIndex);\r
- vGuid.removeElementAt(intTempIndex);\r
- vLibraryClass.removeElementAt(intTempIndex);\r
- vClassGuid.removeElementAt(intTempIndex);\r
- vVersion.removeElementAt(intTempIndex);\r
- vUsage.removeElementAt(intTempIndex);\r
- vOverrideID.removeElementAt(intTempIndex);\r
- \r
- //\r
- // Reload all fields of selected item\r
- //\r
- reloadFromList();\r
- }\r
-\r
- /**\r
- Update current item of Vector\r
- \r
- **/\r
- private void updateForList() {\r
- //\r
- // Backup selected item index\r
- //\r
- int intTempIndex = intSelectedItemId;\r
- vName.setElementAt(this.jTextFieldFileName.getText(), intSelectedItemId);\r
- vGuid.setElementAt(this.jTextFieldGuid.getText(), intSelectedItemId);\r
- vLibraryClass.setElementAt(this.jTextFieldLibraryClass.getText(), intSelectedItemId);\r
- vClassGuid.setElementAt(this.jTextFieldClassGuid.getText(), intSelectedItemId);\r
- vVersion.setElementAt(this.jTextFieldVersion.getText(), intSelectedItemId);\r
- vUsage.setElementAt(this.jComboBoxUsage.getSelectedItem().toString(), intSelectedItemId);\r
- vOverrideID.setElementAt(this.jTextFieldOverrideID.getText(), intSelectedItemId);\r
- \r
- jComboBoxFileList.removeAllItems();\r
- for (int index = 0; index < vName.size(); index++) {\r
- jComboBoxFileList.addItem(vName.elementAt(index));\r
- }\r
- \r
- //\r
- // Restore selected item index\r
- //\r
- intSelectedItemId = intTempIndex;\r
- \r
- //\r
- // Reset select item index\r
- //\r
- jComboBoxFileList.setSelectedIndex(intSelectedItemId);\r
- \r
- //\r
- // Reload all fields of selected item\r
- //\r
- reloadFromList();\r
- }\r
-\r
- /**\r
- Refresh all fields' values of selected item of Vector\r
- \r
- **/\r
- private void reloadFromList() {\r
- if (vName.size() > 0) {\r
- //\r
- // Get selected item index\r
- //\r
- intSelectedItemId = jComboBoxFileList.getSelectedIndex();\r
- \r
- this.jTextFieldFileName.setText(vName.elementAt(intSelectedItemId).toString());\r
- this.jComboBoxUsage.setSelectedItem(vUsage.elementAt(intSelectedItemId).toString());\r
- this.jTextFieldGuid.setText(vGuid.elementAt(intSelectedItemId).toString());\r
- this.jTextFieldLibraryClass.setText(vLibraryClass.elementAt(intSelectedItemId).toString());\r
- this.jTextFieldClassGuid.setText(vClassGuid.elementAt(intSelectedItemId).toString());\r
- this.jTextFieldVersion.setText(vVersion.elementAt(intSelectedItemId).toString());\r
- this.jTextFieldOverrideID.setText(vOverrideID.elementAt(intSelectedItemId).toString());\r
- } else {\r
- this.jTextFieldFileName.setText("");\r
- this.jComboBoxUsage.setSelectedIndex(0);\r
- this.jTextFieldGuid.setText("");\r
- this.jTextFieldLibraryClass.setText("");\r
- this.jTextFieldClassGuid.setText("");\r
- this.jTextFieldVersion.setText("");\r
- this.jTextFieldOverrideID.setText("");\r
- }\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)\r
- *\r
- * Reflesh the frame when selected item changed \r
- */\r
- public void itemStateChanged(ItemEvent arg0) {\r
- if (arg0.getStateChange() == ItemEvent.SELECTED) {\r
- reloadFromList();\r
- }\r
- }\r
-\r
- /**\r
- Data validation for all fields before save\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean check() {\r
- if (this.jComboBoxFileList.getItemCount() < 1) {\r
- Log.err("Must have one Library at least!");\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- /**\r
- Data validation for all fields before add current item to Vector\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean checkAdd() {\r
- //\r
- // Check if all required fields are not empty\r
- //\r
- if (isEmpty(this.jTextFieldFileName.getText())) {\r
- Log.err("File Name couldn't be empty");\r
- return false;\r
- }\r
-\r
- //\r
- // Check if all fields have correct data types \r
- //\r
- if (!DataValidation.isBaseName(this.jTextFieldFileName.getText())) {\r
- Log.err("Incorrect data type for Name");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldGuid.getText()) && !DataValidation.isGuid(this.jTextFieldGuid.getText())) {\r
- Log.err("Incorrect data type for Guid");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldLibraryClass.getText())\r
- && !DataValidation.isPath(this.jTextFieldLibraryClass.getText())) {\r
- Log.err("Incorrect data type for Path");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldClassGuid.getText()) && !DataValidation.isGuid(this.jTextFieldClassGuid.getText())) {\r
- Log.err("Incorrect data type for Guid");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())\r
- && !DataValidation.isOverrideID(this.jTextFieldOverrideID.getText())) {\r
- Log.err("Incorrect data type for Override ID");\r
- return false;\r
- }\r
-\r
- return true;\r
- }\r
-\r
- /**\r
- Save all components of Mbd Libraries\r
- if exists libraries, set the value directly\r
- if not exists libraries, new an instance first\r
- \r
- **/\r
- public void save() {\r
- try {\r
- if (this.libraries == null) {\r
- libraries = LibrariesDocument.Libraries.Factory.newInstance();\r
- }\r
- //\r
- //Save as file name\r
- //\r
- if (!this.jCheckBoxArch.isSelected()) {\r
- if (this.operation == 2) { //Add new filename\r
- //\r
- //First remove all existed filename\r
- //\r
- if (libraries.getLibraryList().size() > 0) {\r
- for (int index = libraries.getLibraryList().size() - 1; index >= 0; index--) {\r
- libraries.removeLibrary(index);\r
- }\r
- }\r
- }\r
- LibrariesDocument.Libraries.Library library = LibrariesDocument.Libraries.Library.Factory.newInstance();\r
- for (int index = 0; index < vName.size(); index++) {\r
- if (!isEmpty(vName.elementAt(index).toString())) {\r
- library.setStringValue(vName.elementAt(index).toString());\r
- }\r
- if (!isEmpty(vGuid.elementAt(index).toString())) {\r
- library.setGuid(vGuid.elementAt(index).toString());\r
- }\r
- if (!isEmpty(vLibraryClass.elementAt(index).toString())) {\r
- library.setLibraryClass(vLibraryClass.elementAt(index).toString());\r
- }\r
- if (!isEmpty(vClassGuid.elementAt(index).toString())) {\r
- library.setClassGuid(vClassGuid.elementAt(index).toString());\r
- }\r
- if (!isEmpty(vVersion.elementAt(index).toString())) {\r
- library.setVersion(vVersion.elementAt(index).toString());\r
- }\r
- if (!isEmpty(vUsage.elementAt(index).toString())) {\r
- library.setUsage(LibraryUsage.Enum.forString(vUsage.elementAt(index).toString()));\r
- }\r
- if (!isEmpty(vOverrideID.elementAt(index).toString())) {\r
- library.setOverrideID(Integer.parseInt(vOverrideID.elementAt(index).toString()));\r
- }\r
- libraries.addNewLibrary();\r
- libraries.setLibraryArray(libraries.getLibraryList().size() - 1, library);\r
- }\r
- }\r
- //\r
- //Save as Arch\r
- //\r
- if (this.jCheckBoxArch.isSelected()) {\r
- LibrariesDocument.Libraries.Arch arch = LibrariesDocument.Libraries.Arch.Factory.newInstance();\r
- if (this.operation == 2) {\r
- //First remove all existed filename\r
- for (int index = libraries.getArchArray(location).getLibraryList().size() - 1; index >= 0; index--) {\r
- libraries.getArchArray(location).removeLibrary(index);\r
- }\r
- }\r
- for (int index = 0; index < vName.size(); index++) {\r
- LibrariesDocument.Libraries.Arch.Library library = LibrariesDocument.Libraries.Arch.Library.Factory.newInstance();\r
- if (!isEmpty(vName.elementAt(index).toString())) {\r
- library.setStringValue(vName.elementAt(index).toString());\r
- }\r
- if (!isEmpty(vGuid.elementAt(index).toString())) {\r
- library.setGuid(vGuid.elementAt(index).toString());\r
- }\r
- if (!isEmpty(vLibraryClass.elementAt(index).toString())) {\r
- library.setLibraryClass(vLibraryClass.elementAt(index).toString());\r
- }\r
- if (!isEmpty(vClassGuid.elementAt(index).toString())) {\r
- library.setClassGuid(vClassGuid.elementAt(index).toString());\r
- }\r
- if (!isEmpty(vVersion.elementAt(index).toString())) {\r
- library.setVersion(vVersion.elementAt(index).toString());\r
- }\r
- if (!isEmpty(vUsage.elementAt(index).toString())) {\r
- library.setUsage(LibraryUsage.Enum.forString(vUsage.elementAt(index).toString()));\r
- }\r
- if (!isEmpty(vOverrideID.elementAt(index).toString())) {\r
- library.setOverrideID(Integer.parseInt(vOverrideID.elementAt(index).toString()));\r
- }\r
- arch.addNewLibrary();\r
- arch.setLibraryArray(arch.getLibraryList().size() - 1, library);\r
- }\r
- arch\r
- .setArchType(SupportedArchitectures.Enum.forString(this.jComboBoxArch.getSelectedItem().toString()));\r
- if (location > -1) {\r
- libraries.setArchArray(location, arch);\r
- } else {\r
- libraries.addNewArch();\r
- libraries.setArchArray(libraries.getArchList().size() - 1, arch);\r
- }\r
- }\r
- } catch (Exception e) {\r
- Log.err("Update Source Files", e.getMessage());\r
- }\r
- }\r
-\r
- /**\r
- Get LibrariesDocument.Libraries\r
- \r
- @return LibrariesDocument.Libraries\r
- \r
- **/\r
- public LibrariesDocument.Libraries getLibraries() {\r
- return libraries;\r
- }\r
-\r
- /**\r
- Set LibrariesDocument.Libraries\r
- \r
- @param libraries The input LibrariesDocument.Libraries\r
- \r
- **/\r
- public void setLibraries(LibrariesDocument.Libraries libraries) {\r
- this.libraries = libraries;\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- To show a about window with copyright information\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-\r
-package org.tianocore.packaging.module.ui;\r
-\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.WindowEvent;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.JLabel;\r
-import javax.swing.JPanel;\r
-\r
-import org.tianocore.packaging.common.ui.IDialog;\r
-\r
-/**\r
- The class is used to show a about window with copyright information\r
- It extends IDialog\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class ModuleAbout extends IDialog {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = 2958136136667310962L;\r
-\r
- //\r
- //Define class members\r
- //\r
- private JPanel jContentPane = null;\r
-\r
- private JLabel jLabel = null;\r
-\r
- private JLabel jLabel1 = null;\r
-\r
- private JLabel jLabel2 = null;\r
-\r
- private JButton jButtonOK = null;\r
-\r
- /**\r
- This method initializes jButtonOK \r
- \r
- @return javax.swing.JButton jButtonOK\r
- \r
- **/\r
- private JButton getJButtonOK() {\r
- if (jButtonOK == null) {\r
- jButtonOK = new JButton();\r
- jButtonOK.setBounds(new java.awt.Rectangle(105, 120, 90, 20));\r
- jButtonOK.setText("OK");\r
- jButtonOK.addActionListener(this);\r
- }\r
- return jButtonOK;\r
- }\r
-\r
- public static void main(String[] args) {\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public ModuleAbout() {\r
- super();\r
- init();\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void init() {\r
- this.setSize(300, 200);\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("About...");\r
- this.getRootPane().setDefaultButton(jButtonOK);\r
- this.centerWindow();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel jContentPane\r
- \r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabel2 = new JLabel();\r
- jLabel2.setBounds(new java.awt.Rectangle(15, 80, 270, 20));\r
- jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);\r
- jLabel2.setText("All rights reserved");\r
- jLabel1 = new JLabel();\r
- jLabel1.setBounds(new java.awt.Rectangle(15, 50, 270, 20));\r
- jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);\r
- jLabel1.setText("Copyright (c) 2006, Intel Corporation");\r
- jLabel = new JLabel();\r
- jLabel.setToolTipText("");\r
- jLabel.setBounds(new java.awt.Rectangle(15, 20, 270, 20));\r
- jLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);\r
- jLabel.setText("Framework Development Package System 1.0");\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(jLabel, null);\r
- jContentPane.add(jLabel1, null);\r
- jContentPane.add(jLabel2, null);\r
- jContentPane.add(getJButtonOK(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- * \r
- * Override actionPerformed to listen all actions\r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOK) {\r
- this.dispose();\r
- }\r
- }\r
-\r
- /**\r
- Dispose when windows is closing\r
- \r
- @param arg0\r
- \r
- **/\r
- public void windowClosing(WindowEvent arg0) {\r
- this.dispose();\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to create, update BootModes of MSA/MBD file\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-\r
-package org.tianocore.packaging.module.ui;\r
-\r
-import java.awt.event.ActionEvent;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JLabel;\r
-import javax.swing.JPanel;\r
-import javax.swing.JTextField;\r
-\r
-import org.tianocore.BootModeNames;\r
-import org.tianocore.BootModeUsage;\r
-import org.tianocore.BootModesDocument;\r
-import org.tianocore.common.DataValidation;\r
-import org.tianocore.common.Log;\r
-import org.tianocore.common.Tools;\r
-import org.tianocore.packaging.common.ui.IInternalFrame;\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-\r
-/**\r
- The class is used to create, update BootModes of MSA/MBD file\r
- It extends IInternalFrame\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class ModuleBootModes extends IInternalFrame {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -3888558623432442561L;\r
-\r
- //\r
- //Define class members\r
- //\r
- private BootModesDocument.BootModes bootModes = null;\r
-\r
- private int location = -1;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JLabel jLabelGuid = null;\r
-\r
- private JTextField jTextFieldGuid = null;\r
-\r
- private JLabel jLabelBootModeName = null;\r
-\r
- private JComboBox jComboBoxBootModeName = null;\r
-\r
- private JLabel jLabelUsage = null;\r
-\r
- private JComboBox jComboBoxUsage = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JLabel jLabelOverrideID = null;\r
-\r
- private JTextField jTextFieldOverrideID = null;\r
-\r
- private JButton jButtonGenerateGuid = null;\r
-\r
- private StarLabel jStarLabel1 = null;\r
-\r
- /**\r
- This method initializes jTextFieldGuid \r
- \r
- @return javax.swing.JTextField jTextFieldGuid \r
- \r
- **/\r
- private JTextField getJTextFieldGuid() {\r
- if (jTextFieldGuid == null) {\r
- jTextFieldGuid = new JTextField();\r
- jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 35, 250, 20));\r
- }\r
- return jTextFieldGuid;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxBootModeName \r
- \r
- @return javax.swing.JComboBox jComboBoxBootModeName\r
- \r
- **/\r
- private JComboBox getJComboBoxBootModeName() {\r
- if (jComboBoxBootModeName == null) {\r
- jComboBoxBootModeName = new JComboBox();\r
- jComboBoxBootModeName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
- }\r
- return jComboBoxBootModeName;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxUsage \r
- \r
- @return javax.swing.JComboBox jComboBoxUsage\r
- \r
- **/\r
- private JComboBox getJComboBoxUsage() {\r
- if (jComboBoxUsage == null) {\r
- jComboBoxUsage = new JComboBox();\r
- jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20));\r
- }\r
- return jComboBoxUsage;\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton jButtonOk\r
- \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("OK");\r
- jButtonOk.setBounds(new java.awt.Rectangle(280, 115, 90, 20));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton jButtonCancel\r
- \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 115, 90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldOverrideID \r
- \r
- @return javax.swing.JTextField jTextFieldOverrideID\r
- \r
- **/\r
- private JTextField getJTextFieldOverrideID() {\r
- if (jTextFieldOverrideID == null) {\r
- jTextFieldOverrideID = new JTextField();\r
- jTextFieldOverrideID.setBounds(new java.awt.Rectangle(160, 85, 50, 20));\r
- }\r
- return jTextFieldOverrideID;\r
- }\r
-\r
- /**\r
- This method initializes jButtonGenerateGuid \r
- \r
- @return javax.swing.JButton jButtonGenerateGuid\r
- \r
- **/\r
- private JButton getJButtonGenerateGuid() {\r
- if (jButtonGenerateGuid == null) {\r
- jButtonGenerateGuid = new JButton();\r
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 35, 65, 20));\r
- jButtonGenerateGuid.setText("GEN");\r
- jButtonGenerateGuid.addActionListener(this);\r
- }\r
- return jButtonGenerateGuid;\r
- }\r
-\r
- public static void main(String[] args) {\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public ModuleBootModes() {\r
- super();\r
- init();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inBootModes The input BootModesDocument.BootModes\r
- \r
- **/\r
- public ModuleBootModes(BootModesDocument.BootModes inBootModes) {\r
- super();\r
- init(inBootModes);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inBootModes The input BootModesDocument.BootModes\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- public ModuleBootModes(BootModesDocument.BootModes inBootModes, int type, int index) {\r
- super();\r
- init(inBootModes, type, index);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This method initializes this\r
-\r
- @param inBootModes BootModesDocument.BootModes\r
- \r
- **/\r
- private void init(BootModesDocument.BootModes inBootModes) {\r
- init();\r
- this.setBootModes(inBootModes);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- Fill values to all fields if these values are not empty\r
- \r
- @param inBootModes The input BootModesDocument.BootModes\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- private void init(BootModesDocument.BootModes inBootModes, int type, int index) {\r
- init(inBootModes);\r
- this.location = index;\r
- if (this.bootModes.getBootModeList().size() > 0) {\r
- if (this.bootModes.getBootModeArray(index).getBootModeName() != null) {\r
- this.jComboBoxBootModeName.setSelectedItem(this.bootModes.getBootModeArray(index).getBootModeName()\r
- .toString());\r
- }\r
- if (this.bootModes.getBootModeArray(index).getGuid() != null) {\r
- this.jTextFieldGuid.setText(this.bootModes.getBootModeArray(index).getGuid());\r
- }\r
- if (this.bootModes.getBootModeArray(index).getUsage() != null) {\r
- this.jComboBoxUsage.setSelectedItem(this.bootModes.getBootModeArray(index).getUsage().toString());\r
- }\r
- this.jTextFieldOverrideID.setText(String.valueOf(this.bootModes.getBootModeArray(index).getOverrideID()));\r
- }\r
- }\r
-\r
- /**\r
- * This method initializes this\r
- * \r
- * @return void\r
- */\r
- private void init() {\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Boot Mode");\r
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 515));\r
- initFrame();\r
- this.setViewMode(false);\r
- }\r
-\r
- /**\r
- Disable all components when the mode is view\r
- \r
- @param isView true - The view mode; false - The non-view mode\r
- \r
- **/\r
- public void setViewMode(boolean isView) {\r
- this.jButtonOk.setVisible(false);\r
- this.jButtonCancel.setVisible(false);\r
- if (isView) {\r
- this.jComboBoxBootModeName.setEnabled(!isView);\r
- this.jTextFieldGuid.setEnabled(!isView);\r
- this.jComboBoxUsage.setEnabled(!isView);\r
- this.jTextFieldOverrideID.setEnabled(!isView);\r
- this.jButtonCancel.setEnabled(!isView);\r
- this.jButtonGenerateGuid.setEnabled(!isView);\r
- this.jButtonOk.setEnabled(!isView);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel jContentPane\r
- \r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabelOverrideID = new JLabel();\r
- jLabelOverrideID.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
- jLabelOverrideID.setText("Override ID");\r
- jLabelUsage = new JLabel();\r
- jLabelUsage.setText("Usage");\r
- jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
- jLabelBootModeName = new JLabel();\r
- jLabelBootModeName.setText("Boot Mode Name");\r
- jLabelBootModeName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
- jLabelGuid = new JLabel();\r
- jLabelGuid.setText("Guid");\r
- jLabelGuid.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(jLabelGuid, null);\r
- jContentPane.add(getJTextFieldGuid(), null);\r
- jContentPane.add(jLabelBootModeName, null);\r
- jContentPane.add(getJComboBoxBootModeName(), null);\r
- jContentPane.add(jLabelUsage, null);\r
- jContentPane.add(getJComboBoxUsage(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(jLabelOverrideID, null);\r
- jContentPane.add(getJTextFieldOverrideID(), null);\r
- jContentPane.add(getJButtonGenerateGuid(), null);\r
-\r
- jStarLabel1 = new StarLabel();\r
- jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
-\r
- jContentPane.add(jStarLabel1, null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes BootModeName groups and Usage type\r
- \r
- **/\r
- private void initFrame() {\r
- jComboBoxUsage.addItem("ALWAYS_CONSUMED");\r
- jComboBoxUsage.addItem("SOMETIMES_CONSUMED");\r
- jComboBoxUsage.addItem("ALWAYS_PRODUCED");\r
- jComboBoxUsage.addItem("SOMETIMES_PRODUCED");\r
-\r
- jComboBoxBootModeName.addItem("FULL");\r
- jComboBoxBootModeName.addItem("MINIMAL");\r
- jComboBoxBootModeName.addItem("NO_CHANGE");\r
- jComboBoxBootModeName.addItem("DIAGNOSTICS");\r
- jComboBoxBootModeName.addItem("DEFAULT");\r
- jComboBoxBootModeName.addItem("S2_RESUME");\r
- jComboBoxBootModeName.addItem("S3_RESUME");\r
- jComboBoxBootModeName.addItem("S4_RESUME");\r
- jComboBoxBootModeName.addItem("S5_RESUME");\r
- jComboBoxBootModeName.addItem("FLASH_UPDATE");\r
- jComboBoxBootModeName.addItem("RECOVERY");\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- *\r
- * Override actionPerformed to listen all actions\r
- * \r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.setEdited(true);\r
- this.save();\r
- this.dispose();\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- }\r
-\r
- if (arg0.getSource() == jButtonGenerateGuid) {\r
- jTextFieldGuid.setText(Tools.generateUuidString());\r
- }\r
- }\r
-\r
- /**\r
- Get BootModesDocument.BootModes\r
- \r
- @return BootModesDocument.BootModes\r
- \r
- **/\r
- public BootModesDocument.BootModes getBootModes() {\r
- return bootModes;\r
- }\r
-\r
- /**\r
- Set BootModesDocument.BootModes\r
- \r
- @param bootModes BootModesDocument.BootModes\r
- \r
- **/\r
- public void setBootModes(BootModesDocument.BootModes bootModes) {\r
- this.bootModes = bootModes;\r
- }\r
-\r
- /**\r
- Data validation for all fields\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean check() {\r
- //\r
- // Check if all fields have correct data types \r
- //\r
- if (!isEmpty(this.jTextFieldGuid.getText()) && !DataValidation.isGuid(this.jTextFieldGuid.getText())) {\r
- Log.err("Incorrect data type for Guid");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())\r
- && !DataValidation.isOverrideID(this.jTextFieldOverrideID.getText())) {\r
- Log.err("Incorrect data type for Override ID");\r
- return false;\r
- }\r
-\r
- return true;\r
- }\r
-\r
- /**\r
- Save all components of Mbd Header\r
- if exists bootModes, set the value directly\r
- if not exists bootModes, new an instance first\r
- \r
- **/\r
- public void save() {\r
- try {\r
- if (this.bootModes == null) {\r
- bootModes = BootModesDocument.BootModes.Factory.newInstance();\r
- }\r
- BootModesDocument.BootModes.BootMode bootMode = BootModesDocument.BootModes.BootMode.Factory.newInstance();\r
- bootMode.setBootModeName(BootModeNames.Enum.forString(jComboBoxBootModeName.getSelectedItem().toString()));\r
- if (!isEmpty(this.jTextFieldGuid.getText())) {\r
- bootMode.setGuid(this.jTextFieldGuid.getText());\r
- }\r
- bootMode.setUsage(BootModeUsage.Enum.forString(jComboBoxUsage.getSelectedItem().toString()));\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())) {\r
- bootMode.setOverrideID(Integer.parseInt(this.jTextFieldOverrideID.getText()));\r
- }\r
- if (location > -1) {\r
- bootModes.setBootModeArray(location, bootMode);\r
- } else {\r
- bootModes.addNewBootMode();\r
- bootModes.setBootModeArray(bootModes.getBootModeList().size() - 1, bootMode);\r
- }\r
- } catch (Exception e) {\r
- Log.err("Update Boot Modes", e.getMessage());\r
- }\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to create, update DataHub of MSA/MBD file\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-\r
-package org.tianocore.packaging.module.ui;\r
-\r
-import java.awt.event.ActionEvent;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JLabel;\r
-import javax.swing.JPanel;\r
-import javax.swing.JTextField;\r
-\r
-import org.tianocore.DataHubUsage;\r
-import org.tianocore.DataHubsDocument;\r
-import org.tianocore.common.DataValidation;\r
-import org.tianocore.common.Log;\r
-import org.tianocore.common.Tools;\r
-import org.tianocore.packaging.common.ui.IInternalFrame;\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-\r
-/**\r
- The class is used to create, update DataHub of MSA/MBD file\r
- It extends IInternalFrame\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class ModuleDataHubs extends IInternalFrame {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -3667906991966638892L;\r
-\r
- //\r
- //Define class members\r
- //\r
- private DataHubsDocument.DataHubs dataHubs = null;\r
-\r
- private int location = -1;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JLabel jLabelGuid = null;\r
-\r
- private JTextField jTextFieldGuid = null;\r
-\r
- private JLabel jLabelUsage = null;\r
-\r
- private JComboBox jComboBoxUsage = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JLabel jLabelDataHubRecord = null;\r
-\r
- private JTextField jTextFieldDataHubRecord = null;\r
-\r
- private JButton jButtonGenerateGuid = null;\r
-\r
- private JLabel jLabelOverrideID = null;\r
-\r
- private JTextField jTextFieldOverrideID = null;\r
-\r
- private StarLabel jStarLabel1 = null;\r
-\r
- /**\r
- This method initializes jTextFieldGuid \r
- \r
- @return javax.swing.JTextField jTextFieldGuid\r
- \r
- **/\r
- private JTextField getJTextFieldGuid() {\r
- if (jTextFieldGuid == null) {\r
- jTextFieldGuid = new JTextField();\r
- jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 35, 250, 20));\r
- }\r
- return jTextFieldGuid;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxUsage \r
- \r
- @return javax.swing.JComboBox jComboBoxUsage\r
- \r
- **/\r
- private JComboBox getJComboBoxUsage() {\r
- if (jComboBoxUsage == null) {\r
- jComboBoxUsage = new JComboBox();\r
- jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20));\r
- }\r
- return jComboBoxUsage;\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton jButtonOk\r
- \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("OK");\r
- jButtonOk.setBounds(new java.awt.Rectangle(280, 115, 90, 20));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton jButtonCancel\r
- \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 115, 90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldDataHubRecord \r
- \r
- @return javax.swing.JTextField jTextFieldDataHubRecord\r
- \r
- **/\r
- private JTextField getJTextFieldDataHubRecord() {\r
- if (jTextFieldDataHubRecord == null) {\r
- jTextFieldDataHubRecord = new JTextField();\r
- jTextFieldDataHubRecord.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
- }\r
- return jTextFieldDataHubRecord;\r
- }\r
-\r
- /**\r
- This method initializes jButtonGenerateGuid \r
- \r
- @return javax.swing.JButton jButtonGenerateGuid\r
- \r
- **/\r
- private JButton getJButtonGenerateGuid() {\r
- if (jButtonGenerateGuid == null) {\r
- jButtonGenerateGuid = new JButton();\r
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 35, 65, 20));\r
- jButtonGenerateGuid.setText("GEN");\r
- jButtonGenerateGuid.addActionListener(this);\r
- }\r
- return jButtonGenerateGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldOverrideID \r
- \r
- @return javax.swing.JTextField jTextFieldOverrideID\r
- \r
- **/\r
- private JTextField getJTextFieldOverrideID() {\r
- if (jTextFieldOverrideID == null) {\r
- jTextFieldOverrideID = new JTextField();\r
- jTextFieldOverrideID.setBounds(new java.awt.Rectangle(160, 85, 50, 20));\r
- }\r
- return jTextFieldOverrideID;\r
- }\r
-\r
- public static void main(String[] args) {\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public ModuleDataHubs() {\r
- super();\r
- init();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inDataHubs The input DataHubsDocument.DataHubs\r
- \r
- **/\r
- public ModuleDataHubs(DataHubsDocument.DataHubs inDataHubs) {\r
- super();\r
- init(inDataHubs);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inDataHubs DataHubsDocument.DataHubs\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- public ModuleDataHubs(DataHubsDocument.DataHubs inDataHubs, int type, int index) {\r
- super();\r
- init(inDataHubs, type, index);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @param inDataHubs The input DataHubsDocument.DataHubs\r
- \r
- **/\r
- private void init(DataHubsDocument.DataHubs inDataHubs) {\r
- init();\r
- this.setDataHubs(inDataHubs);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- Fill values to all fields if these values are not empty\r
- \r
- @param inDataHubs The input DataHubsDocument.DataHubs\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- private void init(DataHubsDocument.DataHubs inDataHubs, int type, int index) {\r
- init(inDataHubs);\r
- this.location = index;\r
- if (this.dataHubs.getDataHubRecordList().size() > 0) {\r
- if (this.dataHubs.getDataHubRecordArray(index).getStringValue() != null) {\r
- this.jTextFieldDataHubRecord.setText(this.dataHubs.getDataHubRecordArray(index).getStringValue()\r
- .toString());\r
- }\r
- if (this.dataHubs.getDataHubRecordArray(index).getGuid() != null) {\r
- this.jTextFieldGuid.setText(this.dataHubs.getDataHubRecordArray(index).getGuid());\r
- }\r
- if (this.dataHubs.getDataHubRecordArray(index).getUsage() != null) {\r
- this.jComboBoxUsage.setSelectedItem(this.dataHubs.getDataHubRecordArray(index).getUsage().toString());\r
- }\r
- this.jTextFieldOverrideID\r
- .setText(String\r
- .valueOf(this.dataHubs.getDataHubRecordArray(index).getOverrideID()));\r
- }\r
- }\r
-\r
- /**\r
- Disable all components when the mode is view\r
- \r
- @param isView true - The view mode; false - The non-view mode\r
- \r
- **/\r
- public void setViewMode(boolean isView) {\r
- this.jButtonOk.setVisible(false);\r
- this.jButtonCancel.setVisible(false);\r
- if (isView) {\r
- this.jTextFieldDataHubRecord.setEnabled(!isView);\r
- this.jTextFieldGuid.setEnabled(!isView);\r
- this.jComboBoxUsage.setEnabled(!isView);\r
- this.jTextFieldOverrideID.setEnabled(!isView);\r
- this.jButtonCancel.setEnabled(!isView);\r
- this.jButtonGenerateGuid.setEnabled(!isView);\r
- this.jButtonOk.setEnabled(!isView);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void init() {\r
- this.setSize(500, 515);\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Data Hubs");\r
- initFrame();\r
- this.setViewMode(false);\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel jContentPane\r
- \r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabelOverrideID = new JLabel();\r
- jLabelOverrideID.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
- jLabelOverrideID.setText("Override ID");\r
- jLabelDataHubRecord = new JLabel();\r
- jLabelDataHubRecord.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
- jLabelDataHubRecord.setText("Data Hub Record");\r
- jLabelGuid = new JLabel();\r
- jLabelGuid.setText("Guid");\r
- jLabelGuid.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
- jLabelUsage = new JLabel();\r
- jLabelUsage.setText("Usage");\r
- jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(jLabelGuid, null);\r
- jContentPane.add(getJTextFieldGuid(), null);\r
- jContentPane.add(jLabelUsage, null);\r
- jContentPane.add(getJComboBoxUsage(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(jLabelDataHubRecord, null);\r
- jContentPane.add(getJTextFieldDataHubRecord(), null);\r
- jContentPane.add(getJButtonGenerateGuid(), null);\r
- jContentPane.add(jLabelOverrideID, null);\r
- jContentPane.add(getJTextFieldOverrideID(), null);\r
-\r
- jStarLabel1 = new StarLabel();\r
- jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
-\r
- jContentPane.add(jStarLabel1, null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes Usage type\r
- \r
- **/\r
- private void initFrame() {\r
- jComboBoxUsage.addItem("ALWAYS_CONSUMED");\r
- jComboBoxUsage.addItem("SOMETIMES_CONSUMED");\r
- jComboBoxUsage.addItem("ALWAYS_PRODUCED");\r
- jComboBoxUsage.addItem("SOMETIMES_PRODUCED");\r
- jComboBoxUsage.addItem("PRIVATE");\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- *\r
- * Override actionPerformed to listen all actions\r
- * \r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.setEdited(true);\r
- this.save();\r
- this.dispose();\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- }\r
-\r
- if (arg0.getSource() == jButtonGenerateGuid) {\r
- jTextFieldGuid.setText(Tools.generateUuidString());\r
- }\r
- }\r
-\r
- /**\r
- Get DataHubsDocument.DataHubs\r
- \r
- @return DataHubsDocument.DataHubs\r
- \r
- **/\r
- public DataHubsDocument.DataHubs getDataHubs() {\r
- return dataHubs;\r
- }\r
-\r
- /**\r
- Set DataHubsDocument.DataHubs\r
- \r
- @param dataHubs DataHubsDocument.DataHubs\r
- \r
- **/\r
- public void setDataHubs(DataHubsDocument.DataHubs dataHubs) {\r
- this.dataHubs = dataHubs;\r
- }\r
-\r
- /**\r
- Data validation for all fields\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean check() {\r
- //\r
- // Check if all required fields are not empty\r
- //\r
- if (isEmpty(this.jTextFieldDataHubRecord.getText())) {\r
- Log.err("Data Hub Record couldn't be empty");\r
- return false;\r
- }\r
-\r
- //\r
- // Check if all fields have correct data types \r
- //\r
- if (!isEmpty(this.jTextFieldGuid.getText()) && !DataValidation.isGuid(this.jTextFieldGuid.getText())) {\r
- Log.err("Incorrect data type for Guid");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())\r
- && !DataValidation.isOverrideID(this.jTextFieldOverrideID.getText())) {\r
- Log.err("Incorrect data type for Override ID");\r
- return false;\r
- }\r
-\r
- return true;\r
- }\r
-\r
- /**\r
- Save all components of DataHubs\r
- if exists dataHubs, set the value directly\r
- if not exists dataHubs, new an instance first\r
- \r
- **/\r
- public void save() {\r
- try {\r
- if (this.dataHubs == null) {\r
- dataHubs = DataHubsDocument.DataHubs.Factory.newInstance();\r
- }\r
- DataHubsDocument.DataHubs.DataHubRecord dataHubRecord = DataHubsDocument.DataHubs.DataHubRecord.Factory\r
- .newInstance();\r
- if (!isEmpty(this.jTextFieldDataHubRecord.getText())) {\r
- dataHubRecord.setStringValue(this.jTextFieldDataHubRecord.getText());\r
- }\r
- if (!isEmpty(this.jTextFieldGuid.getText())) {\r
- dataHubRecord.setGuid(this.jTextFieldGuid.getText());\r
- }\r
- dataHubRecord.setUsage(DataHubUsage.Enum.forString(jComboBoxUsage.getSelectedItem().toString()));\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())) {\r
- dataHubRecord.setOverrideID(Integer.parseInt(this.jTextFieldOverrideID.getText()));\r
- }\r
- if (location > -1) {\r
- dataHubs.setDataHubRecordArray(location, dataHubRecord);\r
- } else {\r
- dataHubs.addNewDataHubRecord();\r
- dataHubs.setDataHubRecordArray(dataHubs.getDataHubRecordList().size() - 1, dataHubRecord);\r
- }\r
- } catch (Exception e) {\r
- Log.err("Update Data Hubs", e.getMessage());\r
- }\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to create, update Event of MSA/MBD file\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-package org.tianocore.packaging.module.ui;\r
-\r
-import java.awt.Dimension;\r
-import java.awt.event.ActionEvent;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JLabel;\r
-import javax.swing.JPanel;\r
-import javax.swing.JRadioButton;\r
-import javax.swing.JTextField;\r
-\r
-import org.tianocore.EventTypes;\r
-import org.tianocore.EventUsage;\r
-import org.tianocore.EventsDocument;\r
-import org.tianocore.GuidDocument;\r
-import org.tianocore.common.DataValidation;\r
-import org.tianocore.common.Log;\r
-import org.tianocore.common.Tools;\r
-import org.tianocore.packaging.common.ui.IDefaultMutableTreeNode;\r
-import org.tianocore.packaging.common.ui.IInternalFrame;\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-\r
-/**\r
- The class is used to create, update Event of MSA/MBD file\r
- It extends IInternalFrame\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class ModuleEvents extends IInternalFrame {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -4396143706422842331L;\r
-\r
- //\r
- //Define class members\r
- //\r
- private EventsDocument.Events events = null;\r
-\r
- private EventsDocument.Events.CreateEvents createEvent = null;\r
-\r
- private EventsDocument.Events.SignalEvents signalEvent = null;\r
-\r
- private int location = -1;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JLabel jLabelEventType = null;\r
-\r
- private JRadioButton jRadioButtonEventCreate = null;\r
-\r
- private JRadioButton jRadioButtonEventSignal = null;\r
-\r
- private JLabel jLabelC_Name = null;\r
-\r
- private JTextField jTextFieldC_Name = null;\r
-\r
- private JLabel jLabelGuid = null;\r
-\r
- private JTextField jTextFieldGuid = null;\r
-\r
- private JLabel jLabelEventGroup = null;\r
-\r
- private JComboBox jComboBoxEventGroup = null;\r
-\r
- private JLabel jLabelUsage = null;\r
-\r
- private JComboBox jComboBoxUsage = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JButton jButtonGenerateGuid = null;\r
-\r
- private JLabel jLabelOverrideID = null;\r
-\r
- private JTextField jTextFieldOverrideID = null;\r
-\r
- private StarLabel jStarLabel1 = null;\r
-\r
- private StarLabel jStarLabel2 = null;\r
-\r
- /**\r
- This method initializes jRadioButtonEnentType \r
- \r
- @return javax.swing.JRadioButton jRadioButtonEventCreate\r
- \r
- **/\r
- private JRadioButton getJRadioButtonEventCreate() {\r
- if (jRadioButtonEventCreate == null) {\r
- jRadioButtonEventCreate = new JRadioButton();\r
- jRadioButtonEventCreate.setText("Create");\r
- jRadioButtonEventCreate.setBounds(new java.awt.Rectangle(160, 10, 90, 20));\r
- jRadioButtonEventCreate.addActionListener(this);\r
- jRadioButtonEventCreate.setSelected(true);\r
- }\r
- return jRadioButtonEventCreate;\r
- }\r
-\r
- /**\r
- This method initializes jRadioButtonEventSignal \r
- \r
- @return javax.swing.JRadioButton jRadioButtonEventSignal\r
- \r
- **/\r
- private JRadioButton getJRadioButtonEventSignal() {\r
- if (jRadioButtonEventSignal == null) {\r
- jRadioButtonEventSignal = new JRadioButton();\r
- jRadioButtonEventSignal.setText("Signal");\r
- jRadioButtonEventSignal.setBounds(new java.awt.Rectangle(320, 10, 90, 20));\r
- jRadioButtonEventSignal.addActionListener(this);\r
- }\r
- return jRadioButtonEventSignal;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldC_Name \r
- \r
- @return javax.swing.JTextField jTextFieldC_Name\r
- \r
- **/\r
- private JTextField getJTextFieldC_Name() {\r
- if (jTextFieldC_Name == null) {\r
- jTextFieldC_Name = new JTextField();\r
- jTextFieldC_Name.setBounds(new java.awt.Rectangle(160, 35, 320, 20));\r
- }\r
- return jTextFieldC_Name;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldGuid \r
- \r
- @return javax.swing.JTextField jTextFieldGuid\r
- \r
- **/\r
- private JTextField getJTextFieldGuid() {\r
- if (jTextFieldGuid == null) {\r
- jTextFieldGuid = new JTextField();\r
- jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 60, 250, 20));\r
- }\r
- return jTextFieldGuid;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxEventGroup \r
- \r
- @return javax.swing.JComboBox jComboBoxEventGroup\r
- \r
- **/\r
- private JComboBox getJComboBoxEventGroup() {\r
- if (jComboBoxEventGroup == null) {\r
- jComboBoxEventGroup = new JComboBox();\r
- jComboBoxEventGroup.setBounds(new java.awt.Rectangle(160, 85, 320, 20));\r
- }\r
- return jComboBoxEventGroup;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxUsage \r
- \r
- @return javax.swing.JComboBox jComboBoxUsage\r
- \r
- **/\r
- private JComboBox getJComboBoxUsage() {\r
- if (jComboBoxUsage == null) {\r
- jComboBoxUsage = new JComboBox();\r
- jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 110, 320, 20));\r
- }\r
- return jComboBoxUsage;\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton jButtonOk\r
- \r
- **/\r
- private JButton getJButton() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("OK");\r
- jButtonOk.setBounds(new java.awt.Rectangle(290, 165, 90, 20));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton jButtonCancel\r
- \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 165, 90, 20));\r
- jButtonCancel.setPreferredSize(new Dimension(90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jButtonGenerateGuid \r
- \r
- @return javax.swing.JButton jButtonGenerateGuid\r
- \r
- **/\r
- private JButton getJButtonGenerateGuid() {\r
- if (jButtonGenerateGuid == null) {\r
- jButtonGenerateGuid = new JButton();\r
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 60, 65, 20));\r
- jButtonGenerateGuid.setText("GEN");\r
- jButtonGenerateGuid.addActionListener(this);\r
- }\r
- return jButtonGenerateGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldOverrideID \r
- \r
- @return javax.swing.JTextField jTextFieldOverrideID\r
- \r
- **/\r
- private JTextField getJTextFieldOverrideID() {\r
- if (jTextFieldOverrideID == null) {\r
- jTextFieldOverrideID = new JTextField();\r
- jTextFieldOverrideID.setBounds(new java.awt.Rectangle(160, 135, 50, 20));\r
- }\r
- return jTextFieldOverrideID;\r
- }\r
-\r
- public static void main(String[] args) {\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public ModuleEvents() {\r
- super();\r
- init();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inEvents The input EventsDocument.Events\r
- \r
- **/\r
- public ModuleEvents(EventsDocument.Events inEvents) {\r
- super();\r
- init(inEvents);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inEvents The input EventsDocument.Events\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- public ModuleEvents(EventsDocument.Events inEvents, int type, int index) {\r
- super();\r
- init(inEvents, type, index);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @param inEvents The input EventsDocument.Events\r
- \r
- **/\r
- private void init(EventsDocument.Events inEvents) {\r
- init();\r
- this.setEvents(inEvents);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- Fill values to all fields if these values are not empty\r
- \r
- @param inEvents EventsDocument.Events\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- private void init(EventsDocument.Events inEvents, int type, int index) {\r
- init(inEvents);\r
- this.location = index;\r
- if (type == IDefaultMutableTreeNode.EVENTS_CREATEEVENTS_ITEM) {\r
- this.jRadioButtonEventCreate.setSelected(true);\r
- this.jRadioButtonEventSignal.setSelected(false);\r
- if (this.events.getCreateEvents().getEventArray(index).getCName() != null) {\r
- this.jTextFieldC_Name.setText(this.events.getCreateEvents().getEventArray(index).getCName());\r
- }\r
- if (this.events.getCreateEvents().getEventArray(index).getGuid() != null) {\r
- this.jTextFieldGuid.setText(this.events.getCreateEvents().getEventArray(index).getGuid()\r
- .getStringValue());\r
- }\r
- if (this.events.getCreateEvents().getEventArray(index).getEventGroup() != null) {\r
- this.jComboBoxEventGroup.setSelectedItem(this.events.getCreateEvents().getEventArray(index)\r
- .getEventGroup().toString());\r
- }\r
- if (this.events.getCreateEvents().getEventArray(index).getUsage() != null) {\r
- this.jComboBoxUsage.setSelectedItem(this.events.getCreateEvents().getEventArray(index).getUsage()\r
- .toString());\r
- }\r
- this.jTextFieldOverrideID.setText(String.valueOf(this.events.getCreateEvents().getEventArray(index)\r
- .getOverrideID()));\r
- } else if (type == IDefaultMutableTreeNode.EVENTS_SIGNALEVENTS_ITEM) {\r
- this.jRadioButtonEventCreate.setSelected(false);\r
- this.jRadioButtonEventSignal.setSelected(true);\r
- this.jComboBoxUsage.setEnabled(false);\r
- if (this.events.getSignalEvents().getEventArray(index).getCName() != null) {\r
- this.jTextFieldC_Name.setText(this.events.getSignalEvents().getEventArray(index).getCName());\r
- }\r
- if (this.events.getSignalEvents().getEventArray(index).getGuid() != null) {\r
- this.jTextFieldGuid.setText(this.events.getSignalEvents().getEventArray(index).getGuid().toString());\r
- }\r
- if (this.events.getSignalEvents().getEventArray(index).getEventGroup() != null) {\r
- this.jComboBoxEventGroup.setSelectedItem(this.events.getSignalEvents().getEventArray(index)\r
- .getEventGroup().toString());\r
- }\r
- if (this.events.getSignalEvents().getEventArray(index).getUsage() != null) {\r
- this.jComboBoxUsage.setSelectedItem(this.events.getSignalEvents().getEventArray(index).getUsage()\r
- .toString());\r
- }\r
- this.jTextFieldOverrideID.setText(String.valueOf(this.events.getSignalEvents().getEventArray(index)\r
- .getOverrideID()));\r
- }\r
- this.jRadioButtonEventCreate.setEnabled(false);\r
- this.jRadioButtonEventSignal.setEnabled(false);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void init() {\r
- this.setSize(500, 515);\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Events");\r
- initFrame();\r
- this.setViewMode(false);\r
- }\r
-\r
- /**\r
- Disable all components when the mode is view\r
- \r
- @param isView true - The view mode; false - The non-view mode\r
- \r
- **/\r
- public void setViewMode(boolean isView) {\r
- this.jButtonOk.setVisible(false);\r
- this.jButtonCancel.setVisible(false);\r
- if (isView) {\r
- this.jRadioButtonEventCreate.setEnabled(!isView);\r
- this.jRadioButtonEventSignal.setEnabled(!isView);\r
- this.jTextFieldC_Name.setEnabled(!isView);\r
- this.jTextFieldGuid.setEnabled(!isView);\r
- this.jComboBoxEventGroup.setEnabled(!isView);\r
- this.jComboBoxUsage.setEnabled(!isView);\r
- this.jTextFieldOverrideID.setEnabled(!isView);\r
- this.jButtonCancel.setEnabled(!isView);\r
- this.jButtonGenerateGuid.setEnabled(!isView);\r
- this.jButtonOk.setEnabled(!isView);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel jContentPane\r
- \r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabelOverrideID = new JLabel();\r
- jLabelOverrideID.setBounds(new java.awt.Rectangle(15, 135, 140, 20));\r
- jLabelOverrideID.setText("Override ID");\r
- jLabelUsage = new JLabel();\r
- jLabelUsage.setText("Usage");\r
- jLabelUsage.setBounds(new java.awt.Rectangle(15, 110, 140, 20));\r
- jLabelEventGroup = new JLabel();\r
- jLabelEventGroup.setText("Event Group");\r
- jLabelEventGroup.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
- jLabelGuid = new JLabel();\r
- jLabelGuid.setText("Guid");\r
- jLabelGuid.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
- jLabelC_Name = new JLabel();\r
- jLabelC_Name.setText("C_Name");\r
- jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
- jLabelEventType = new JLabel();\r
- jLabelEventType.setText("Event Type");\r
- jLabelEventType.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(jLabelEventType, null);\r
- jContentPane.add(getJRadioButtonEventCreate(), null);\r
- jContentPane.add(getJRadioButtonEventSignal(), null);\r
- jContentPane.add(jLabelC_Name, null);\r
- jContentPane.add(getJTextFieldC_Name(), null);\r
- jContentPane.add(jLabelGuid, null);\r
- jContentPane.add(getJTextFieldGuid(), null);\r
- jContentPane.add(jLabelEventGroup, null);\r
- jContentPane.add(getJComboBoxEventGroup(), null);\r
- jContentPane.add(jLabelUsage, null);\r
- jContentPane.add(getJComboBoxUsage(), null);\r
- jContentPane.add(getJButton(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJButtonGenerateGuid(), null);\r
- jContentPane.add(jLabelOverrideID, null);\r
- jContentPane.add(getJTextFieldOverrideID(), null);\r
-\r
- jStarLabel1 = new StarLabel();\r
- jStarLabel1.setBounds(new java.awt.Rectangle(0, 10, 10, 20));\r
- jStarLabel2 = new StarLabel();\r
- jStarLabel2.setBounds(new java.awt.Rectangle(0, 35, 10, 20));\r
-\r
- jContentPane.add(jStarLabel1, null);\r
- jContentPane.add(jStarLabel2, null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes events groups and usage type\r
- \r
- **/\r
- private void initFrame() {\r
- jComboBoxEventGroup.addItem("EVENT_GROUP_EXIT_BOOT_SERVICES");\r
- jComboBoxEventGroup.addItem("EVENT_GROUP_VIRTUAL_ADDRESS_CHANGE");\r
- jComboBoxEventGroup.addItem("EVENT_GROUP_MEMORY_MAP_CHANGE");\r
- jComboBoxEventGroup.addItem("EVENT_GROUP_READY_TO_BOOT");\r
- jComboBoxEventGroup.addItem("EVENT_GROUP_LEGACY_BOOT");\r
-\r
- jComboBoxUsage.addItem("ALWAYS_CONSUMED");\r
- jComboBoxUsage.addItem("SOMETIMES_CONSUMED");\r
- jComboBoxUsage.addItem("ALWAYS_PRODUCED");\r
- jComboBoxUsage.addItem("SOMETIMES_PRODUCED");\r
- jComboBoxUsage.addItem("PRIVATE");\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- *\r
- * Override actionPerformed to listen all actions\r
- * \r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.setEdited(true);\r
- this.save();\r
- this.dispose();\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- }\r
-\r
- if (arg0.getSource() == jRadioButtonEventCreate) {\r
- if (jRadioButtonEventCreate.isSelected()) {\r
- jRadioButtonEventSignal.setSelected(false);\r
- }\r
- if (!jRadioButtonEventSignal.isSelected() && !jRadioButtonEventCreate.isSelected()) {\r
- jRadioButtonEventCreate.setSelected(true);\r
- }\r
- }\r
-\r
- if (arg0.getSource() == jRadioButtonEventSignal) {\r
- if (jRadioButtonEventSignal.isSelected()) {\r
- jRadioButtonEventCreate.setSelected(false);\r
- }\r
- if (!jRadioButtonEventSignal.isSelected() && !jRadioButtonEventCreate.isSelected()) {\r
- jRadioButtonEventSignal.setSelected(true);\r
- }\r
- }\r
-\r
- if (arg0.getSource() == jButtonGenerateGuid) {\r
- jTextFieldGuid.setText(Tools.generateUuidString());\r
- }\r
- }\r
-\r
- public EventsDocument.Events getEvents() {\r
- return events;\r
- }\r
-\r
- public void setEvents(EventsDocument.Events events) {\r
- this.events = events;\r
- }\r
-\r
- /**\r
- Data validation for all fields\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean check() {\r
- //\r
- // Check if all required fields are not empty\r
- //\r
- if (isEmpty(this.jTextFieldC_Name.getText())) {\r
- Log.err("C_Name couldn't be empty");\r
- return false;\r
- }\r
-\r
- //\r
- // Check if all fields have correct data types \r
- //\r
- if (!DataValidation.isCName(this.jTextFieldC_Name.getText())) {\r
- Log.err("Incorrect data type for C_Name");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldGuid.getText()) && !DataValidation.isGuid(this.jTextFieldGuid.getText())) {\r
- Log.err("Incorrect data type for Guid");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())\r
- && !DataValidation.isOverrideID(this.jTextFieldOverrideID.getText())) {\r
- Log.err("Incorrect data type for Override ID");\r
- return false;\r
- }\r
-\r
- return true;\r
- }\r
-\r
- /**\r
- Save all components of Events\r
- if exists events, set the value directly\r
- if not exists events, new an instance first\r
- \r
- **/\r
- public void save() {\r
- try {\r
- if (this.events == null) {\r
- events = EventsDocument.Events.Factory.newInstance();\r
- createEvent = EventsDocument.Events.CreateEvents.Factory.newInstance();\r
- signalEvent = EventsDocument.Events.SignalEvents.Factory.newInstance();\r
- } else {\r
- if (events.getCreateEvents() != null) {\r
- createEvent = events.getCreateEvents();\r
- } else {\r
- createEvent = EventsDocument.Events.CreateEvents.Factory.newInstance();\r
- }\r
- if (events.getSignalEvents() != null) {\r
- signalEvent = events.getSignalEvents();\r
- } else {\r
- signalEvent = EventsDocument.Events.SignalEvents.Factory.newInstance();\r
- }\r
-\r
- }\r
- if (this.jRadioButtonEventCreate.isSelected()) {\r
- EventsDocument.Events.CreateEvents.Event event = EventsDocument.Events.CreateEvents.Event.Factory\r
- .newInstance();\r
- event.setCName(this.jTextFieldC_Name.getText());\r
- if (!isEmpty(this.jTextFieldGuid.getText())) {\r
- GuidDocument.Guid guid = GuidDocument.Guid.Factory.newInstance();\r
- guid.setStringValue(this.jTextFieldGuid.getText());\r
- event.setGuid(guid);\r
- }\r
- event.setEventGroup(EventTypes.Enum.forString(jComboBoxEventGroup.getSelectedItem().toString()));\r
- event.setUsage(EventUsage.Enum.forString(jComboBoxUsage.getSelectedItem().toString()));\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())) {\r
- event.setOverrideID(Integer.parseInt(this.jTextFieldOverrideID.getText()));\r
- }\r
- if (location > -1) {\r
- createEvent.setEventArray(location, event);\r
- } else {\r
- createEvent.addNewEvent();\r
- createEvent.setEventArray(createEvent.getEventList().size() - 1, event);\r
- }\r
- events.setCreateEvents(createEvent);\r
- }\r
- if (this.jRadioButtonEventSignal.isSelected()) {\r
- EventsDocument.Events.SignalEvents.Event event = EventsDocument.Events.SignalEvents.Event.Factory\r
- .newInstance();\r
- event.setCName(this.jTextFieldC_Name.getText());\r
- if (!isEmpty(this.jTextFieldGuid.getText())) {\r
- GuidDocument.Guid guid = GuidDocument.Guid.Factory.newInstance();\r
- guid.setStringValue(this.jTextFieldGuid.getText());\r
- event.setGuid(guid);\r
- }\r
- event.setEventGroup(EventTypes.Enum.forString(jComboBoxEventGroup.getSelectedItem().toString()));\r
- event.setUsage(EventUsage.Enum.forString(jComboBoxUsage.getSelectedItem().toString()));\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())) {\r
- event.setOverrideID(Integer.parseInt(this.jTextFieldOverrideID.getText()));\r
- }\r
- if (location > -1) {\r
- signalEvent.setEventArray(location, event);\r
- } else {\r
- signalEvent.addNewEvent();\r
- signalEvent.setEventArray(signalEvent.getEventList().size() - 1, event);\r
- }\r
- events.setSignalEvents(signalEvent);\r
- }\r
- } catch (Exception e) {\r
- Log.err("Update Events", e.getMessage());\r
- }\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to create, update DataHub of MSA/MBD file\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-package org.tianocore.packaging.module.ui;\r
-\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ItemEvent;\r
-import java.awt.event.ItemListener;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JLabel;\r
-import javax.swing.JPanel;\r
-import javax.swing.JTextField;\r
-\r
-import org.tianocore.ExternUsage;\r
-import org.tianocore.ExternsDocument;\r
-import org.tianocore.common.DataValidation;\r
-import org.tianocore.common.Log;\r
-import org.tianocore.packaging.common.ui.IComboBox;\r
-import org.tianocore.packaging.common.ui.IInternalFrame;\r
-\r
-/**\r
- The class is used to create, update DataHub of MSA/MBD file \r
- It extends IInternalFrame\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class ModuleExterns extends IInternalFrame implements ItemListener {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -7382008402932047191L;\r
-\r
- //\r
- //Define class members\r
- //\r
- private ExternsDocument.Externs externs = null;\r
-\r
- private int location = -1;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JLabel jLabelName = null;\r
-\r
- private JLabel jLabelUsage = null;\r
-\r
- private JComboBox jComboBoxUsage = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JLabel jLabelOverrideID = null;\r
-\r
- private JTextField jTextFieldOverrideID = null;\r
-\r
- private JPanel jPanelType1 = null;\r
-\r
- private JLabel jLabelModuleEntryPoint = null;\r
-\r
- private JLabel jLabelModuleUnloadImage = null;\r
-\r
- private IComboBox iComboBoxModuleEntryPoint = null;\r
-\r
- private IComboBox iComboBoxModuleUnloadImage = null;\r
-\r
- private JPanel jPanelType2 = null;\r
-\r
- private JLabel jLabelConstructor = null;\r
-\r
- private JTextField jTextFieldConstructor = null;\r
-\r
- private JLabel jLabelDestructor = null;\r
-\r
- private JTextField jTextFieldDestructor = null;\r
-\r
- private JComboBox jComboBoxType = null;\r
-\r
- private JPanel jPanelType3 = null;\r
-\r
- private JLabel jLabelDriverBinding = null;\r
-\r
- private JLabel jLabelComponentName = null;\r
-\r
- private IComboBox iComboBoxComponentName = null;\r
-\r
- private IComboBox iComboBoxDriverBinding = null;\r
-\r
- private JLabel jLabelDriverConfig = null;\r
-\r
- private JLabel jLabelDriverDiag = null;\r
-\r
- private IComboBox iComboBoxDriverDiag = null;\r
-\r
- private IComboBox iComboBoxDriverConfig = null;\r
-\r
- private JPanel jPanelType4 = null;\r
-\r
- private JLabel jLabelSetVirtualAddressMapCallBack = null;\r
-\r
- private IComboBox iComboBoxSetVirtualAddressMapCallBack = null;\r
-\r
- private JLabel jLabelExitBootServicesCallBack = null;\r
-\r
- private IComboBox iComboBoxExitBootServicesCallBack = null;\r
-\r
- private JPanel jPanelType5 = null;\r
-\r
- private JLabel jLabelUserDefined = null;\r
-\r
- private IComboBox iComboBoxUserDefined = null;\r
-\r
- /**\r
- This method initializes jComboBoxUsage \r
- \r
- @return javax.swing.JComboBox jComboBoxUsage\r
- \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
- }\r
- return jComboBoxUsage;\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton jButtonOk\r
- \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("OK");\r
- jButtonOk.setLocation(new java.awt.Point(290, 215));\r
- jButtonOk.setSize(new java.awt.Dimension(90, 20));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton jButtonCancel\r
- \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setLocation(new java.awt.Point(390, 215));\r
- jButtonCancel.setSize(new java.awt.Dimension(90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldOverrideID \r
- \r
- @return javax.swing.JTextField jTextFieldOverrideID\r
- \r
- **/\r
- private JTextField getJTextFieldOverrideID() {\r
- if (jTextFieldOverrideID == null) {\r
- jTextFieldOverrideID = new JTextField();\r
- jTextFieldOverrideID.setBounds(new java.awt.Rectangle(160, 60, 50, 20));\r
- }\r
- return jTextFieldOverrideID;\r
- }\r
-\r
- /**\r
- This method initializes jPanelType1 \r
- \r
- @return javax.swing.JPanel jPanelType1\r
- \r
- **/\r
- private JPanel getJPanelType1() {\r
- if (jPanelType1 == null) {\r
- jLabelModuleUnloadImage = new JLabel();\r
- jLabelModuleUnloadImage.setBounds(new java.awt.Rectangle(15, 30, 140, 20));\r
- jLabelModuleUnloadImage.setText("Module Unload Image");\r
- jLabelModuleEntryPoint = new JLabel();\r
- jLabelModuleEntryPoint.setBounds(new java.awt.Rectangle(15, 5, 140, 20));\r
- jLabelModuleEntryPoint.setText("Module Entry Point");\r
- jPanelType1 = new JPanel();\r
- jPanelType1.setLayout(null);\r
- jPanelType1.setBounds(new java.awt.Rectangle(0, 105, 490, 55));\r
- jPanelType1.add(jLabelModuleEntryPoint, null);\r
- jPanelType1.add(jLabelModuleUnloadImage, null);\r
- jPanelType1.add(getIComboBoxModuleUnloadImage(), null);\r
- jPanelType1.add(getIComboBoxModuleEntryPoint(), null);\r
- }\r
- return jPanelType1;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxModuleEntryPoint \r
- \r
- @return javax.swing.JComboBox iComboBoxModuleEntryPoint\r
- \r
- **/\r
- private IComboBox getIComboBoxModuleEntryPoint() {\r
- if (iComboBoxModuleEntryPoint == null) {\r
- iComboBoxModuleEntryPoint = new IComboBox();\r
- iComboBoxModuleEntryPoint.setBounds(new java.awt.Rectangle(160, 5, 320, 20));\r
- }\r
- return iComboBoxModuleEntryPoint;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxModuleUnloadImage \r
- \r
- @return javax.swing.JComboBox iComboBoxModuleUnloadImage\r
- \r
- **/\r
- private IComboBox getIComboBoxModuleUnloadImage() {\r
- if (iComboBoxModuleUnloadImage == null) {\r
- iComboBoxModuleUnloadImage = new IComboBox();\r
- iComboBoxModuleUnloadImage.setBounds(new java.awt.Rectangle(160, 30, 320, 20));\r
- }\r
- return iComboBoxModuleUnloadImage;\r
- }\r
-\r
- /**\r
- This method initializes jPanelType2 \r
- \r
- @return javax.swing.JPanel jPanelType2\r
- \r
- **/\r
- private JPanel getJPanelType2() {\r
- if (jPanelType2 == null) {\r
- jLabelDestructor = new JLabel();\r
- jLabelDestructor.setBounds(new java.awt.Rectangle(15, 30, 140, 20));\r
- jLabelDestructor.setText("Destructor");\r
- jLabelConstructor = new JLabel();\r
- jLabelConstructor.setBounds(new java.awt.Rectangle(15, 5, 140, 20));\r
- jLabelConstructor.setText("Constructor");\r
- jPanelType2 = new JPanel();\r
- jPanelType2.setLayout(null);\r
- jPanelType2.setBounds(new java.awt.Rectangle(0, 105, 490, 55));\r
- jPanelType2.add(jLabelConstructor, null);\r
- jPanelType2.add(getJTextFieldConstructor(), null);\r
- jPanelType2.add(jLabelDestructor, null);\r
- jPanelType2.add(getJTextFieldDestructor(), null);\r
- }\r
- return jPanelType2;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldConstructor \r
- \r
- @return javax.swing.JTextField jTextFieldConstructor\r
- \r
- **/\r
- private JTextField getJTextFieldConstructor() {\r
- if (jTextFieldConstructor == null) {\r
- jTextFieldConstructor = new JTextField();\r
- jTextFieldConstructor.setBounds(new java.awt.Rectangle(160, 5, 320, 20));\r
- }\r
- return jTextFieldConstructor;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldDestructor \r
- \r
- @return javax.swing.JTextField jTextFieldDestructor\r
- \r
- **/\r
- private JTextField getJTextFieldDestructor() {\r
- if (jTextFieldDestructor == null) {\r
- jTextFieldDestructor = new JTextField();\r
- jTextFieldDestructor.setBounds(new java.awt.Rectangle(160, 30, 320, 20));\r
- }\r
- return jTextFieldDestructor;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxType \r
- \r
- @return javax.swing.JComboBox jComboBoxType\r
- \r
- **/\r
- private JComboBox getJComboBoxType() {\r
- if (jComboBoxType == null) {\r
- jComboBoxType = new JComboBox();\r
- jComboBoxType.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
- jComboBoxType.addItemListener(this);\r
- }\r
- return jComboBoxType;\r
- }\r
-\r
- /**\r
- This method initializes jPanelType3 \r
- \r
- @return javax.swing.JPanel jPanelType3\r
- \r
- **/\r
- private JPanel getJPanelType3() {\r
- if (jPanelType3 == null) {\r
- jLabelDriverDiag = new JLabel();\r
- jLabelDriverDiag.setBounds(new java.awt.Rectangle(15, 80, 140, 20));\r
- jLabelDriverDiag.setText("Driver Diag");\r
- jLabelDriverConfig = new JLabel();\r
- jLabelDriverConfig.setBounds(new java.awt.Rectangle(15, 55, 140, 20));\r
- jLabelDriverConfig.setText("Driver Config");\r
- jLabelComponentName = new JLabel();\r
- jLabelComponentName.setBounds(new java.awt.Rectangle(15, 30, 140, 20));\r
- jLabelComponentName.setText("Component Name");\r
- jLabelDriverBinding = new JLabel();\r
- jLabelDriverBinding.setBounds(new java.awt.Rectangle(15, 5, 140, 20));\r
- jLabelDriverBinding.setText("Driver Binding");\r
- jPanelType3 = new JPanel();\r
- jPanelType3.setLayout(null);\r
- jPanelType3.setBounds(new java.awt.Rectangle(0, 105, 490, 105));\r
- jPanelType3.add(jLabelDriverBinding, null);\r
- jPanelType3.add(jLabelComponentName, null);\r
- jPanelType3.add(getIComboBoxComponentName(), null);\r
- jPanelType3.add(getIComboBoxDriverBinding(), null);\r
- jPanelType3.add(jLabelDriverConfig, null);\r
- jPanelType3.add(jLabelDriverDiag, null);\r
- jPanelType3.add(getIComboBoxDriverDiag(), null);\r
- jPanelType3.add(getIComboBoxDriverConfig(), null);\r
- }\r
- return jPanelType3;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxComponentName \r
- \r
- @return javax.swing.JComboBox iComboBoxComponentName\r
- \r
- **/\r
- private IComboBox getIComboBoxComponentName() {\r
- if (iComboBoxComponentName == null) {\r
- iComboBoxComponentName = new IComboBox();\r
- iComboBoxComponentName.setBounds(new java.awt.Rectangle(160, 30, 320, 20));\r
- }\r
- return iComboBoxComponentName;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxDriverBinding \r
- \r
- @return javax.swing.JComboBox iComboBoxDriverBinding\r
- \r
- **/\r
- private IComboBox getIComboBoxDriverBinding() {\r
- if (iComboBoxDriverBinding == null) {\r
- iComboBoxDriverBinding = new IComboBox();\r
- iComboBoxDriverBinding.setBounds(new java.awt.Rectangle(160, 5, 320, 20));\r
- }\r
- return iComboBoxDriverBinding;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxDriverDiag \r
- \r
- @return javax.swing.JComboBox iComboBoxDriverDiag\r
- \r
- **/\r
- private IComboBox getIComboBoxDriverDiag() {\r
- if (iComboBoxDriverDiag == null) {\r
- iComboBoxDriverDiag = new IComboBox();\r
- iComboBoxDriverDiag.setBounds(new java.awt.Rectangle(160, 80, 320, 20));\r
- }\r
- return iComboBoxDriverDiag;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxDriverConfig \r
- \r
- @return javax.swing.JComboBox iComboBoxDriverConfig\r
- \r
- */\r
- private IComboBox getIComboBoxDriverConfig() {\r
- if (iComboBoxDriverConfig == null) {\r
- iComboBoxDriverConfig = new IComboBox();\r
- iComboBoxDriverConfig.setBounds(new java.awt.Rectangle(160, 55, 320, 20));\r
- }\r
- return iComboBoxDriverConfig;\r
- }\r
-\r
- /**\r
- This method initializes jPanelType4 \r
- \r
- @return javax.swing.JPanel jPanelType4\r
- \r
- **/\r
- private JPanel getJPanelType4() {\r
- if (jPanelType4 == null) {\r
- jLabelExitBootServicesCallBack = new JLabel();\r
- jLabelExitBootServicesCallBack.setBounds(new java.awt.Rectangle(15, 30, 200, 20));\r
- jLabelExitBootServicesCallBack.setText("Exit Boot Services Call Back");\r
- jLabelSetVirtualAddressMapCallBack = new JLabel();\r
- jLabelSetVirtualAddressMapCallBack.setBounds(new java.awt.Rectangle(15, 5, 200, 20));\r
- jLabelSetVirtualAddressMapCallBack.setText("Set Virtual Address Map Call Back");\r
- jPanelType4 = new JPanel();\r
- jPanelType4.setLayout(null);\r
- jPanelType4.setBounds(new java.awt.Rectangle(0, 105, 490, 55));\r
- jPanelType4.add(jLabelSetVirtualAddressMapCallBack, null);\r
- jPanelType4.add(getIComboBoxSetVirtualAddressMapCallBack(), null);\r
- jPanelType4.add(jLabelExitBootServicesCallBack, null);\r
- jPanelType4.add(getIComboBoxExitBootServicesCallBack(), null);\r
- }\r
- return jPanelType4;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxSetVirtualAddressMapCallBack \r
- \r
- @return javax.swing.JComboBox iComboBoxSetVirtualAddressMapCallBack\r
- \r
- **/\r
- private IComboBox getIComboBoxSetVirtualAddressMapCallBack() {\r
- if (iComboBoxSetVirtualAddressMapCallBack == null) {\r
- iComboBoxSetVirtualAddressMapCallBack = new IComboBox();\r
- iComboBoxSetVirtualAddressMapCallBack.setBounds(new java.awt.Rectangle(220, 5, 260, 20));\r
- }\r
- return iComboBoxSetVirtualAddressMapCallBack;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxExitBootServicesCallBack \r
- \r
- @return javax.swing.JComboBox iComboBoxExitBootServicesCallBack\r
- \r
- **/\r
- private IComboBox getIComboBoxExitBootServicesCallBack() {\r
- if (iComboBoxExitBootServicesCallBack == null) {\r
- iComboBoxExitBootServicesCallBack = new IComboBox();\r
- iComboBoxExitBootServicesCallBack.setBounds(new java.awt.Rectangle(220, 30, 260, 20));\r
- }\r
- return iComboBoxExitBootServicesCallBack;\r
- }\r
-\r
- /**\r
- This method initializes jPanelType5 \r
- \r
- @return javax.swing.JPanel jPanelType5\r
- \r
- **/\r
- private JPanel getJPanelType5() {\r
- if (jPanelType5 == null) {\r
- jLabelUserDefined = new JLabel();\r
- jLabelUserDefined.setBounds(new java.awt.Rectangle(15, 5, 140, 20));\r
- jLabelUserDefined.setText("User Defined");\r
- jPanelType5 = new JPanel();\r
- jPanelType5.setLayout(null);\r
- jPanelType5.setBounds(new java.awt.Rectangle(0, 105, 490, 30));\r
- jPanelType5.add(jLabelUserDefined, null);\r
- jPanelType5.add(getIComboBoxUserDefined(), null);\r
- }\r
- return jPanelType5;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxUserDefined \r
- \r
- @return javax.swing.JComboBox iComboBoxUserDefined\r
- \r
- **/\r
- private IComboBox getIComboBoxUserDefined() {\r
- if (iComboBoxUserDefined == null) {\r
- iComboBoxUserDefined = new IComboBox();\r
- iComboBoxUserDefined.setBounds(new java.awt.Rectangle(160, 5, 320, 20));\r
- }\r
- return iComboBoxUserDefined;\r
- }\r
-\r
- public static void main(String[] args) {\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public ModuleExterns() {\r
- super();\r
- init();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inExterns The input data of ExternsDocument.Externs\r
- \r
- **/\r
- public ModuleExterns(ExternsDocument.Externs inExterns) {\r
- super();\r
- init(inExterns);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inExterns The input data of ExternsDocument.Externs\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- public ModuleExterns(ExternsDocument.Externs inExterns, int type, int index) {\r
- super();\r
- init(inExterns, type, index);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @param inExterns The input data of ExternsDocument.Externs\r
- \r
- **/\r
- private void init(ExternsDocument.Externs inExterns) {\r
- init();\r
- this.setExterns(inExterns);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- Fill values to all fields if these values are not empty\r
- \r
- @param inExterns The input data of ExternsDocument.Externs\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- private void init(ExternsDocument.Externs inExterns, int type, int index) {\r
- init(inExterns);\r
- this.location = index;\r
- if (this.externs.getExternList().size() > 0) {\r
- //\r
- //Get common fields\r
- //\r
- if (this.externs.getExternArray(index).getUsage() != null) {\r
- this.jComboBoxUsage.setSelectedItem(this.externs.getExternArray(index).getUsage().toString());\r
- }\r
- this.jTextFieldOverrideID.setText(String.valueOf(this.externs.getExternArray(index).getOverrideID()));\r
- //\r
- //Type 1\r
- //\r
- if (this.externs.getExternArray(index).getModuleEntryPointList().size() > 0) {\r
- this.jComboBoxType.setSelectedIndex(0);\r
- for (int indexI = 0; indexI < this.externs.getExternArray(index).getModuleEntryPointList().size(); indexI++) {\r
- this.iComboBoxModuleEntryPoint.addItem(this.externs.getExternArray(index)\r
- .getModuleEntryPointArray(indexI));\r
- }\r
- }\r
- if (this.externs.getExternArray(index).getModuleUnloadImageList().size() > 0) {\r
- this.jComboBoxType.setSelectedIndex(0);\r
- for (int indexI = 0; indexI < this.externs.getExternArray(index).getModuleUnloadImageList().size(); indexI++) {\r
- this.iComboBoxModuleUnloadImage.addItem(this.externs.getExternArray(index)\r
- .getModuleUnloadImageArray(indexI));\r
- }\r
- }\r
-\r
- //\r
- //Type 2\r
- //\r
- if (this.externs.getExternArray(index).getConstructor() != null) {\r
- this.jComboBoxType.setSelectedIndex(1);\r
- this.jTextFieldConstructor.setText(this.externs.getExternArray(index).getConstructor());\r
- }\r
- if (this.externs.getExternArray(index).getDestructor() != null) {\r
- this.jComboBoxType.setSelectedIndex(1);\r
- this.jTextFieldDestructor.setText(this.externs.getExternArray(index).getDestructor());\r
- }\r
-\r
- //\r
- //Type 3\r
- //\r
- if (this.externs.getExternArray(index).getDriverBindingList().size() > 0) {\r
- this.jComboBoxType.setSelectedIndex(2);\r
- for (int indexI = 0; indexI < this.externs.getExternArray(index).getDriverBindingList().size(); indexI++) {\r
- this.iComboBoxDriverBinding.addItem(this.externs.getExternArray(index)\r
- .getDriverBindingArray(indexI));\r
- }\r
- }\r
- if (this.externs.getExternArray(index).getComponentNameList().size() > 0) {\r
- this.jComboBoxType.setSelectedIndex(2);\r
- for (int indexI = 0; indexI < this.externs.getExternArray(index).getComponentNameList().size(); indexI++) {\r
- this.iComboBoxComponentName.addItem(this.externs.getExternArray(index)\r
- .getComponentNameArray(indexI));\r
- }\r
- }\r
- if (this.externs.getExternArray(index).getDriverConfigList().size() > 0) {\r
- this.jComboBoxType.setSelectedIndex(2);\r
- for (int indexI = 0; indexI < this.externs.getExternArray(index).getDriverConfigList().size(); indexI++) {\r
- this.iComboBoxDriverConfig.addItem(this.externs.getExternArray(index).getDriverConfigArray(indexI));\r
- }\r
- }\r
- if (this.externs.getExternArray(index).getDriverDiagList().size() > 0) {\r
- this.jComboBoxType.setSelectedIndex(2);\r
- for (int indexI = 0; indexI < this.externs.getExternArray(index).getDriverDiagList().size(); indexI++) {\r
- this.iComboBoxDriverDiag.addItem(this.externs.getExternArray(index).getDriverDiagArray(indexI));\r
- }\r
- }\r
-\r
- //\r
- //Type 4\r
- //\r
- if (this.externs.getExternArray(index).getSetVirtualAddressMapCallBackList().size() > 0) {\r
- this.jComboBoxType.setSelectedIndex(3);\r
- for (int indexI = 0; indexI < this.externs.getExternArray(index).getSetVirtualAddressMapCallBackList()\r
- .size(); indexI++) {\r
- this.iComboBoxSetVirtualAddressMapCallBack\r
- .addItem(this.externs\r
- .getExternArray(index)\r
- .getSetVirtualAddressMapCallBackArray(\r
- indexI));\r
- }\r
- }\r
- if (this.externs.getExternArray(index).getExitBootServicesCallBackList().size() > 0) {\r
- this.jComboBoxType.setSelectedIndex(3);\r
- for (int indexI = 0; indexI < this.externs.getExternArray(index).getExitBootServicesCallBackList()\r
- .size(); indexI++) {\r
- this.iComboBoxExitBootServicesCallBack\r
- .addItem(this.externs\r
- .getExternArray(index)\r
- .getExitBootServicesCallBackArray(indexI));\r
- }\r
- }\r
-\r
- //\r
- //Type 5\r
- //\r
- if (this.externs.getExternArray(index).getUserDefinedList().size() > 0) {\r
- this.jComboBoxType.setSelectedIndex(4);\r
- for (int indexI = 0; indexI < this.externs.getExternArray(index).getUserDefinedList().size(); indexI++) {\r
- this.iComboBoxUserDefined.addItem(this.externs.getExternArray(index).getUserDefinedArray(indexI));\r
- }\r
- }\r
-\r
- this.jComboBoxType.setEnabled(false);\r
- switchType();\r
- }\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void init() {\r
- this.setSize(500, 515);\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Externs");\r
- initFrame();\r
- this.setViewMode(false);\r
- }\r
-\r
- /**\r
- Disable all components when the mode is view\r
- \r
- @param isView true - The view mode; false - The non-view mode\r
- \r
- **/\r
- public void setViewMode(boolean isView) {\r
- this.jButtonOk.setVisible(false);\r
- this.jButtonCancel.setVisible(false);\r
- if (isView) {\r
- this.jComboBoxUsage.setEnabled(!isView);\r
- this.jTextFieldOverrideID.setEnabled(!isView);\r
- //\r
- //Type 1\r
- //\r
- this.iComboBoxModuleEntryPoint.setEnabled(!isView);\r
- this.iComboBoxModuleUnloadImage.setEnabled(!isView);\r
-\r
- //\r
- //Type 2\r
- //\r
- this.jTextFieldConstructor.setEnabled(!isView);\r
- this.jTextFieldDestructor.setEnabled(!isView);\r
-\r
- //\r
- //Type 3\r
- //\r
- this.iComboBoxDriverBinding.setEnabled(!isView);\r
- this.iComboBoxComponentName.setEnabled(!isView);\r
- this.iComboBoxDriverConfig.setEnabled(!isView);\r
- this.iComboBoxDriverDiag.setEnabled(!isView);\r
-\r
- //\r
- //Type 4\r
- //\r
- this.iComboBoxSetVirtualAddressMapCallBack.setEnabled(!isView);\r
- this.iComboBoxExitBootServicesCallBack.setEnabled(!isView);\r
-\r
- //\r
- //Type 5\r
- //\r
- this.iComboBoxUserDefined.setEnabled(!isView);\r
-\r
- this.jComboBoxType.setEnabled(!isView);\r
- this.jButtonCancel.setEnabled(!isView);\r
- this.jButtonOk.setEnabled(!isView);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel jContentPane\r
- \r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabelOverrideID = new JLabel();\r
- jLabelOverrideID.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
- jLabelOverrideID.setText("Override ID");\r
- jLabelUsage = new JLabel();\r
- jLabelUsage.setText("Usage");\r
- jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
- jLabelName = new JLabel();\r
- jLabelName.setText("Choose Type");\r
- jLabelName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.setSize(new java.awt.Dimension(490, 244));\r
- jContentPane.add(getJPanelType2(), null);\r
- jContentPane.add(jLabelName, null);\r
- jContentPane.add(getJComboBoxType(), null);\r
- jContentPane.add(getJPanelType3(), null);\r
- jContentPane.add(getJPanelType4(), null);\r
- jContentPane.add(getJPanelType5(), null);\r
- jContentPane.add(jLabelUsage, null);\r
- jContentPane.add(getJComboBoxUsage(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(jLabelOverrideID, null);\r
- jContentPane.add(getJTextFieldOverrideID(), null);\r
-\r
- jContentPane.add(getJPanelType1(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes Usage type and Externs type\r
- \r
- **/\r
- private void initFrame() {\r
- jComboBoxUsage.addItem("ALWAYS_CONSUMED");\r
- jComboBoxUsage.addItem("ALWAYS_PRODUCED");\r
-\r
- jComboBoxType.addItem("Entry/Unload");\r
- jComboBoxType.addItem("Library");\r
- jComboBoxType.addItem("Driver Bindings");\r
- jComboBoxType.addItem("Call Backs");\r
- jComboBoxType.addItem("Other");\r
-\r
- jPanelType1.setVisible(true);\r
- jPanelType2.setVisible(false);\r
- jPanelType3.setVisible(false);\r
- jPanelType4.setVisible(false);\r
- jPanelType5.setVisible(false);\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- *\r
- * Override actionPerformed to listen all actions\r
- * \r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.setEdited(true);\r
- this.save();\r
- this.dispose();\r
- }\r
-\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- }\r
- }\r
-\r
- public void itemStateChanged(ItemEvent arg0) {\r
- if (arg0.getSource() == jComboBoxType) {\r
- if (arg0.getStateChange() == ItemEvent.SELECTED) {\r
- switchType();\r
- }\r
- }\r
- }\r
-\r
- /**\r
- Show/Hide relevant fields via select different types\r
- \r
- **/\r
- private void switchType() {\r
- if (jComboBoxType.getSelectedIndex() == 0) {\r
- jPanelType1.setVisible(true);\r
- jPanelType2.setVisible(false);\r
- jPanelType3.setVisible(false);\r
- jPanelType4.setVisible(false);\r
- jPanelType5.setVisible(false);\r
- }\r
- if (jComboBoxType.getSelectedIndex() == 1) {\r
- jPanelType1.setVisible(false);\r
- jPanelType2.setVisible(true);\r
- jPanelType3.setVisible(false);\r
- jPanelType4.setVisible(false);\r
- jPanelType5.setVisible(false);\r
- }\r
- if (jComboBoxType.getSelectedIndex() == 2) {\r
- jPanelType1.setVisible(false);\r
- jPanelType2.setVisible(false);\r
- jPanelType3.setVisible(true);\r
- jPanelType4.setVisible(false);\r
- jPanelType5.setVisible(false);\r
- }\r
- if (jComboBoxType.getSelectedIndex() == 3) {\r
- jPanelType1.setVisible(false);\r
- jPanelType2.setVisible(false);\r
- jPanelType3.setVisible(false);\r
- jPanelType4.setVisible(true);\r
- jPanelType5.setVisible(false);\r
- }\r
- if (jComboBoxType.getSelectedIndex() == 4) {\r
- jPanelType1.setVisible(false);\r
- jPanelType2.setVisible(false);\r
- jPanelType3.setVisible(false);\r
- jPanelType4.setVisible(false);\r
- jPanelType5.setVisible(true);\r
- }\r
- }\r
-\r
- /**\r
- Set ExternsDocument.Externs\r
- \r
- @return ExternsDocument.Externs\r
- \r
- \r
- **/\r
- public ExternsDocument.Externs getExterns() {\r
- return externs;\r
- }\r
-\r
- /**\r
- Get ExternsDocument.Externs\r
- \r
- @param externs The input ExternsDocument.Externs\r
- \r
- **/\r
- public void setExterns(ExternsDocument.Externs externs) {\r
- this.externs = externs;\r
- }\r
-\r
- /**\r
- Data validation for all fields\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean check() {\r
- //\r
- // Check if all fields have correct data types \r
- //\r
- if (this.jComboBoxType.getSelectedIndex() == 1) {\r
- if (!isEmpty(this.jTextFieldConstructor.getText())\r
- && !DataValidation.isConstructor(this.jTextFieldConstructor.getText())) {\r
- Log.err("Incorrect data type for Constructor");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldDestructor.getText())\r
- && !DataValidation.isDestructor(this.jTextFieldDestructor.getText())) {\r
- Log.err("Incorrect data type for Destructor");\r
- return false;\r
- }\r
- }\r
-\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())\r
- && !DataValidation.isOverrideID(this.jTextFieldOverrideID.getText())) {\r
- Log.err("Incorrect data type for Override ID");\r
- return false;\r
- }\r
-\r
- return true;\r
- }\r
-\r
- /**\r
- Save all components of Externs\r
- if exists externs, set the value directly\r
- if not exists externs, new an instance first\r
- \r
- **/\r
- public void save() {\r
- try {\r
- if (this.externs == null) {\r
- externs = ExternsDocument.Externs.Factory.newInstance();\r
- }\r
- ExternsDocument.Externs.Extern extern = ExternsDocument.Externs.Extern.Factory.newInstance();\r
- //\r
- //Save common fields\r
- //\r
- extern.setUsage(ExternUsage.Enum.forString(jComboBoxUsage.getSelectedItem().toString()));\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())) {\r
- extern.setOverrideID(Integer.parseInt(this.jTextFieldOverrideID.getText()));\r
- }\r
-\r
- //\r
- //Save type 1\r
- //\r
- if (this.jComboBoxType.getSelectedIndex() == 0) {\r
- if (this.iComboBoxModuleEntryPoint.getItemCount() > 0) {\r
- for (int index = 0; index < this.iComboBoxModuleEntryPoint.getItemCount(); index++) {\r
- extern.addNewModuleEntryPoint();\r
- extern.setModuleEntryPointArray(index, this.iComboBoxModuleEntryPoint.getItemAt(index)\r
- .toString());\r
- }\r
- }\r
- if (this.iComboBoxModuleEntryPoint.getItemCount() > 0) {\r
- for (int index = 0; index < this.iComboBoxModuleUnloadImage.getItemCount(); index++) {\r
- extern.addNewModuleUnloadImage();\r
- extern.setModuleUnloadImageArray(index, this.iComboBoxModuleUnloadImage.getItemAt(index)\r
- .toString());\r
- }\r
- }\r
- }\r
-\r
- //\r
- //Save type 2\r
- //\r
- if (this.jComboBoxType.getSelectedIndex() == 1) {\r
- if (!isEmpty(this.jTextFieldConstructor.getText())) {\r
- extern.setConstructor(this.jTextFieldConstructor.getText());\r
- }\r
- if (!isEmpty(this.jTextFieldDestructor.getText())) {\r
- extern.setDestructor(this.jTextFieldDestructor.getText());\r
- }\r
- }\r
-\r
- //\r
- //Save type 3\r
- //\r
- if (this.jComboBoxType.getSelectedIndex() == 2) {\r
- if (this.iComboBoxDriverBinding.getItemCount() > 0) {\r
- for (int index = 0; index < this.iComboBoxDriverBinding.getItemCount(); index++) {\r
- extern.addNewDriverBinding();\r
- extern.setDriverBindingArray(index, this.iComboBoxDriverBinding.getItemAt(index).toString());\r
- }\r
- }\r
- if (this.iComboBoxComponentName.getItemCount() > 0) {\r
- for (int index = 0; index < this.iComboBoxComponentName.getItemCount(); index++) {\r
- extern.addNewComponentName();\r
- extern.setComponentNameArray(index, this.iComboBoxComponentName.getItemAt(index).toString());\r
- }\r
- }\r
- if (this.iComboBoxDriverConfig.getItemCount() > 0) {\r
- for (int index = 0; index < this.iComboBoxDriverConfig.getItemCount(); index++) {\r
- extern.addNewDriverConfig();\r
- extern.setDriverConfigArray(index, this.iComboBoxDriverConfig.getItemAt(index).toString());\r
- }\r
- }\r
- if (this.iComboBoxDriverDiag.getItemCount() > 0) {\r
- for (int index = 0; index < this.iComboBoxDriverDiag.getItemCount(); index++) {\r
- extern.addNewDriverDiag();\r
- extern.setDriverDiagArray(index, this.iComboBoxDriverDiag.getItemAt(index).toString());\r
- }\r
- }\r
- }\r
-\r
- //\r
- //Save type 4\r
- //\r
- if (this.jComboBoxType.getSelectedIndex() == 3) {\r
- if (this.iComboBoxSetVirtualAddressMapCallBack.getItemCount() > 0) {\r
- for (int index = 0; index < this.iComboBoxSetVirtualAddressMapCallBack.getItemCount(); index++) {\r
- extern.addNewSetVirtualAddressMapCallBack();\r
- extern\r
- .setSetVirtualAddressMapCallBackArray(\r
- index,\r
- this.iComboBoxSetVirtualAddressMapCallBack\r
- .getItemAt(\r
- index)\r
- .toString());\r
- }\r
- }\r
- if (this.iComboBoxExitBootServicesCallBack.getItemCount() > 0) {\r
- for (int index = 0; index < this.iComboBoxExitBootServicesCallBack.getItemCount(); index++) {\r
- extern.addNewExitBootServicesCallBack();\r
- extern.setExitBootServicesCallBackArray(index,\r
- this.iComboBoxExitBootServicesCallBack.getItemAt(index)\r
- .toString());\r
- }\r
- }\r
- }\r
- //\r
- //Save type 5\r
- //\r
- if (this.jComboBoxType.getSelectedIndex() == 4) {\r
- if (this.iComboBoxUserDefined.getItemCount() > 0) {\r
- for (int index = 0; index < this.iComboBoxUserDefined.getItemCount(); index++) {\r
- extern.addNewUserDefined();\r
- extern.setUserDefinedArray(index, this.iComboBoxUserDefined.getItemAt(index).toString());\r
- }\r
- }\r
- }\r
-\r
- if (location > -1) {\r
- externs.setExternArray(location, extern);\r
- } else {\r
- externs.addNewExtern();\r
- externs.setExternArray(externs.getExternList().size() - 1, extern);\r
- }\r
- } catch (Exception e) {\r
- Log.err("Update Externs", e.getMessage());\r
- }\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to create, update Formset of MSA/MBD file\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-package org.tianocore.packaging.module.ui;\r
-\r
-import java.awt.event.ActionEvent;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JLabel;\r
-import javax.swing.JPanel;\r
-import javax.swing.JTextField;\r
-\r
-import org.tianocore.FormSetUsage;\r
-import org.tianocore.FormsetsDocument;\r
-import org.tianocore.common.DataValidation;\r
-import org.tianocore.common.Log;\r
-import org.tianocore.common.Tools;\r
-import org.tianocore.packaging.common.ui.IInternalFrame;\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-\r
-/**\r
- The class is used to create, update Formset of MSA/MBD file\r
- It extends IInternalFrame\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class ModuleFormsets extends IInternalFrame {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -6851574146786158116L;\r
-\r
- //\r
- //Define class members\r
- //\r
- private FormsetsDocument.Formsets formsets = null;\r
-\r
- private int location = -1;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JLabel jLabelName = null;\r
-\r
- private JTextField jTextFieldName = null;\r
-\r
- private JLabel jLabelGuid = null;\r
-\r
- private JTextField jTextFieldGuid = null;\r
-\r
- private JLabel jLabelUsage = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JComboBox jComboBoxUsage = null;\r
-\r
- private JButton jButtonGenerateGuid = null;\r
-\r
- private JLabel jLabelOverrideID = null;\r
-\r
- private JTextField jTextFieldOverrideID = null;\r
-\r
- private StarLabel jStarLabel1 = null;\r
-\r
- /**\r
- This method initializes jTextFieldName \r
- \r
- @return javax.swing.JTextField jTextFieldName\r
- \r
- **/\r
- private JTextField getJTextFieldName() {\r
- if (jTextFieldName == null) {\r
- jTextFieldName = new JTextField();\r
- jTextFieldName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
- }\r
- return jTextFieldName;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldGuid \r
- \r
- @return javax.swing.JTextField jTextFieldGuid\r
- \r
- **/\r
- private JTextField getJTextFieldGuid() {\r
- if (jTextFieldGuid == null) {\r
- jTextFieldGuid = new JTextField();\r
- jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 35, 250, 20));\r
- }\r
- return jTextFieldGuid;\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton jButtonOk\r
- \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("OK");\r
- jButtonOk.setBounds(new java.awt.Rectangle(280, 115, 90, 20));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton jButtonCancel\r
- \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 115, 90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxUsage \r
- \r
- @return javax.swing.JComboBox jComboBoxUsage\r
- \r
- **/\r
- private JComboBox getJComboBoxUsage() {\r
- if (jComboBoxUsage == null) {\r
- jComboBoxUsage = new JComboBox();\r
- jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20));\r
- }\r
- return jComboBoxUsage;\r
- }\r
-\r
- /**\r
- This method initializes jButtonGenerateGuid \r
- \r
- @return javax.swing.JButton jButtonGenerateGuid\r
- \r
- **/\r
- private JButton getJButtonGenerateGuid() {\r
- if (jButtonGenerateGuid == null) {\r
- jButtonGenerateGuid = new JButton();\r
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 35, 65, 20));\r
- jButtonGenerateGuid.setText("GEN");\r
- jButtonGenerateGuid.addActionListener(this);\r
- }\r
- return jButtonGenerateGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldOverrideID \r
- \r
- @return javax.swing.JTextField jTextFieldOverrideID\r
- \r
- **/\r
- private JTextField getJTextFieldOverrideID() {\r
- if (jTextFieldOverrideID == null) {\r
- jTextFieldOverrideID = new JTextField();\r
- jTextFieldOverrideID.setBounds(new java.awt.Rectangle(160, 85, 50, 20));\r
- }\r
- return jTextFieldOverrideID;\r
- }\r
-\r
- public static void main(String[] args) {\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public ModuleFormsets() {\r
- super();\r
- init();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- * \r
- */\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inFormsets The input data of FormsetsDocument.Formsets\r
- \r
- **/\r
- public ModuleFormsets(FormsetsDocument.Formsets inFormsets) {\r
- super();\r
- init(inFormsets);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inFormsets The input data of FormsetsDocument.Formsets\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- public ModuleFormsets(FormsetsDocument.Formsets inFormsets, int type, int index) {\r
- super();\r
- init(inFormsets, type, index);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @param inFormsets The input data of FormsetsDocument.Formsets\r
- \r
- **/\r
- private void init(FormsetsDocument.Formsets inFormsets) {\r
- init();\r
- this.setFormsets(inFormsets);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- Fill values to all fields if these values are not empty\r
- \r
- @param inFormsets The input data of FormsetsDocument.Formsets\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- private void init(FormsetsDocument.Formsets inFormsets, int type, int index) {\r
- init(inFormsets);\r
- this.location = index;\r
- if (this.formsets.getFormsetList().size() > 0) {\r
- if (this.formsets.getFormsetArray(index).getStringValue() != null) {\r
- this.jTextFieldName.setText(this.formsets.getFormsetArray(index).getStringValue().toString());\r
- }\r
- if (this.formsets.getFormsetArray(index).getGuid() != null) {\r
- this.jTextFieldGuid.setText(this.formsets.getFormsetArray(index).getGuid());\r
- }\r
- if (this.formsets.getFormsetArray(index).getUsage() != null) {\r
- this.jComboBoxUsage.setSelectedItem(this.formsets.getFormsetArray(index).getUsage().toString());\r
- }\r
- this.jTextFieldOverrideID.setText(String.valueOf(this.formsets.getFormsetArray(index).getOverrideID()));\r
- }\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void init() {\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Form Sets");\r
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 515));\r
- initFrame();\r
- this.setViewMode(false);\r
- }\r
-\r
- /**\r
- Disable all components when the mode is view\r
- \r
- @param isView true - The view mode; false - The non-view mode\r
- \r
- **/\r
- public void setViewMode(boolean isView) {\r
- this.jButtonOk.setVisible(false);\r
- this.jButtonCancel.setVisible(false);\r
- if (isView) {\r
- this.jTextFieldName.setEnabled(!isView);\r
- this.jTextFieldGuid.setEnabled(!isView);\r
- this.jComboBoxUsage.setEnabled(!isView);\r
- this.jTextFieldOverrideID.setEnabled(!isView);\r
- this.jButtonCancel.setEnabled(!isView);\r
- this.jButtonGenerateGuid.setEnabled(!isView);\r
- this.jButtonOk.setEnabled(!isView);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel jContentPane\r
- \r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabelOverrideID = new JLabel();\r
- jLabelOverrideID.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
- jLabelOverrideID.setText("Override ID");\r
- jLabelUsage = new JLabel();\r
- jLabelUsage.setText("Usage");\r
- jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
- jLabelGuid = new JLabel();\r
- jLabelGuid.setText("Guid");\r
- jLabelGuid.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
- jLabelName = new JLabel();\r
- jLabelName.setText("Name");\r
- jLabelName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(jLabelName, null);\r
- jContentPane.add(getJTextFieldName(), null);\r
- jContentPane.add(jLabelGuid, null);\r
- jContentPane.add(getJTextFieldGuid(), null);\r
- jContentPane.add(jLabelUsage, null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJComboBoxUsage(), null);\r
- jContentPane.add(getJButtonGenerateGuid(), null);\r
- jContentPane.add(jLabelOverrideID, null);\r
- jContentPane.add(getJTextFieldOverrideID(), null);\r
-\r
- jStarLabel1 = new StarLabel();\r
- jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
-\r
- jContentPane.add(jStarLabel1, null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes Usage type\r
- \r
- **/\r
- private void initFrame() {\r
- jComboBoxUsage.addItem("ALWAYS_PRODUCED");\r
- jComboBoxUsage.addItem("SOMETIMES_PRODUCED");\r
- jComboBoxUsage.addItem("PRIVATE");\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- *\r
- * Override actionPerformed to listen all actions\r
- * \r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.setEdited(true);\r
- this.save();\r
- this.dispose();\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- }\r
-\r
- if (arg0.getSource() == jButtonGenerateGuid) {\r
- jTextFieldGuid.setText(Tools.generateUuidString());\r
- }\r
- }\r
-\r
- /**\r
- Set FormsetsDocument.Formsets\r
- \r
- @return FormsetsDocument.Formsets\r
- \r
- **/\r
- public FormsetsDocument.Formsets getFormsets() {\r
- return formsets;\r
- }\r
-\r
- /**\r
- Get FormsetsDocument.Formsets\r
- \r
- @param formsets The input FormsetsDocument.Formsets\r
- \r
- **/\r
- public void setFormsets(FormsetsDocument.Formsets formsets) {\r
- this.formsets = formsets;\r
- }\r
-\r
- /**\r
- Data validation for all fields\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean check() {\r
- //\r
- // Check if all required fields are not empty\r
- //\r
- if (isEmpty(this.jTextFieldName.getText())) {\r
- Log.err("Name couldn't be empty");\r
- return false;\r
- }\r
-\r
- //\r
- // Check if all fields have correct data types \r
- //\r
- if (!DataValidation.isCName(this.jTextFieldName.getText())) {\r
- Log.err("Incorrect data type for Name");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldGuid.getText()) && !DataValidation.isGuid(this.jTextFieldGuid.getText())) {\r
- Log.err("Incorrect data type for Guid");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())\r
- && !DataValidation.isOverrideID(this.jTextFieldOverrideID.getText())) {\r
- Log.err("Incorrect data type for Override ID");\r
- return false;\r
- }\r
-\r
- return true;\r
- }\r
-\r
- /**\r
- Save all components of Formsets\r
- if exists formset, set the value directly\r
- if not exists formset, new an instance first\r
- \r
- **/\r
- public void save() {\r
- try {\r
- if (this.formsets == null) {\r
- formsets = FormsetsDocument.Formsets.Factory.newInstance();\r
- }\r
- FormsetsDocument.Formsets.Formset formset = FormsetsDocument.Formsets.Formset.Factory.newInstance();\r
- if (!isEmpty(this.jTextFieldName.getText())) {\r
- formset.setStringValue(this.jTextFieldName.getText());\r
- }\r
- if (!isEmpty(this.jTextFieldGuid.getText())) {\r
- formset.setGuid(this.jTextFieldGuid.getText());\r
- }\r
- formset.setUsage(FormSetUsage.Enum.forString(jComboBoxUsage.getSelectedItem().toString()));\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())) {\r
- formset.setOverrideID(Integer.parseInt(this.jTextFieldOverrideID.getText()));\r
- }\r
- if (location > -1) {\r
- formsets.setFormsetArray(location, formset);\r
- } else {\r
- formsets.addNewFormset();\r
- formsets.setFormsetArray(formsets.getFormsetList().size() - 1, formset);\r
- }\r
- } catch (Exception e) {\r
- Log.err("Update Formsets", e.getMessage());\r
- }\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to create, update Guids of MSA/MBD file\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-package org.tianocore.packaging.module.ui;\r
-\r
-import java.awt.event.ActionEvent;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JLabel;\r
-import javax.swing.JPanel;\r
-import javax.swing.JRadioButton;\r
-import javax.swing.JTextField;\r
-\r
-import org.tianocore.ConditionalExpressionDocument;\r
-import org.tianocore.DefaultValueDocument;\r
-import org.tianocore.GuidUsage;\r
-import org.tianocore.GuidsDocument;\r
-import org.tianocore.common.DataValidation;\r
-import org.tianocore.common.Log;\r
-import org.tianocore.common.Tools;\r
-import org.tianocore.packaging.common.ui.IComboBox;\r
-import org.tianocore.packaging.common.ui.IInternalFrame;\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-\r
-/**\r
- The class is used to create, update Guids of MSA/MBD file\r
- It extends IInternalFrame\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class ModuleGuids extends IInternalFrame {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = 6710858997766979803L;\r
-\r
- //\r
- //Define class members\r
- //\r
- private GuidsDocument.Guids guids = null;\r
-\r
- private int location = -1;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JLabel jLabelC_Name = null;\r
-\r
- private JTextField jTextFieldC_Name = null;\r
-\r
- private JLabel jLabelGuidValue = null;\r
-\r
- private JTextField jTextFieldGuidValue = null;\r
-\r
- private JLabel jLabelFeatureFlag = null;\r
-\r
- private IComboBox iComboBoxFeatureFlag = null;\r
-\r
- private JLabel jLabelConditionalExpression = null;\r
-\r
- private IComboBox iComboBoxConditionalExpression = null;\r
-\r
- private JLabel jLabelDefault = null;\r
-\r
- private JTextField jTextFieldDefaultValue = null;\r
-\r
- private JLabel jLabelHelpText = null;\r
-\r
- private JTextField jTextFieldHelpText = null;\r
-\r
- private JLabel jLabelEnableFeature = null;\r
-\r
- private JRadioButton jRadioButtonEnableFeature = null;\r
-\r
- private JRadioButton jRadioButtonDisableFeature = null;\r
-\r
- private JLabel jLabelUsage = null;\r
-\r
- private JComboBox jComboBoxUsage = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JButton jButtonGenerateGuid = null;\r
-\r
- private JLabel jLabelOverrideID = null;\r
-\r
- private JTextField jTextFieldOverrideID = null;\r
-\r
- /**\r
- This method initializes jTextFieldC_Name \r
- \r
- @return javax.swing.JTextField jTextFieldC_Name\r
- \r
- **/\r
- private JTextField getJTextFieldC_Name() {\r
- if (jTextFieldC_Name == null) {\r
- jTextFieldC_Name = new JTextField();\r
- jTextFieldC_Name.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
- }\r
- return jTextFieldC_Name;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldGuidValsue \r
- \r
- @return javax.swing.JTextField jTextFieldGuidValue\r
- \r
- **/\r
- private JTextField getJTextFieldGuidValsue() {\r
- if (jTextFieldGuidValue == null) {\r
- jTextFieldGuidValue = new JTextField();\r
- jTextFieldGuidValue.setBounds(new java.awt.Rectangle(160, 35, 250, 20));\r
- }\r
- return jTextFieldGuidValue;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldFeatureFlag \r
- \r
- @return javax.swing.JTextField iComboBoxFeatureFlag\r
- \r
- **/\r
- private IComboBox getIComboBoxFeatureFlag() {\r
- if (iComboBoxFeatureFlag == null) {\r
- iComboBoxFeatureFlag = new IComboBox();\r
- iComboBoxFeatureFlag.setBounds(new java.awt.Rectangle(160, 60, 320, 20));\r
- }\r
- return iComboBoxFeatureFlag;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldConditionalExpression \r
- \r
- @return javax.swing.JTextField iComboBoxConditionalExpression\r
- \r
- **/\r
- private IComboBox getIComboBoxConditionalExpression() {\r
- if (iComboBoxConditionalExpression == null) {\r
- iComboBoxConditionalExpression = new IComboBox();\r
- iComboBoxConditionalExpression.setBounds(new java.awt.Rectangle(160, 85, 320, 20));\r
- }\r
- return iComboBoxConditionalExpression;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldDefault \r
- \r
- @return javax.swing.JTextField jTextFieldDefaultValue\r
- \r
- **/\r
- private JTextField getJTextFieldDefaultValue() {\r
- if (jTextFieldDefaultValue == null) {\r
- jTextFieldDefaultValue = new JTextField();\r
- jTextFieldDefaultValue.setBounds(new java.awt.Rectangle(160, 110, 320, 20));\r
- }\r
- return jTextFieldDefaultValue;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldHelpText \r
- \r
- @return javax.swing.JTextField jTextFieldHelpText\r
- \r
- **/\r
- private JTextField getJTextFieldHelpText() {\r
- if (jTextFieldHelpText == null) {\r
- jTextFieldHelpText = new JTextField();\r
- jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 135, 320, 20));\r
- }\r
- return jTextFieldHelpText;\r
- }\r
-\r
- /**\r
- This method initializes jRadioButtonEnableFeature \r
- \r
- @return javax.swing.JRadioButton jRadioButtonEnableFeature\r
- \r
- **/\r
- private JRadioButton getJRadioButtonEnableFeature() {\r
- if (jRadioButtonEnableFeature == null) {\r
- jRadioButtonEnableFeature = new JRadioButton();\r
- jRadioButtonEnableFeature.setText("Enable");\r
- jRadioButtonEnableFeature.setBounds(new java.awt.Rectangle(160, 160, 90, 20));\r
- jRadioButtonEnableFeature.setSelected(true);\r
- jRadioButtonEnableFeature.addActionListener(this);\r
- }\r
- return jRadioButtonEnableFeature;\r
- }\r
-\r
- /**\r
- This method initializes jRadioButtonDisableFeature \r
- \r
- @return javax.swing.JRadioButton jRadioButtonDisableFeature\r
- \r
- **/\r
- private JRadioButton getJRadioButtonDisableFeature() {\r
- if (jRadioButtonDisableFeature == null) {\r
- jRadioButtonDisableFeature = new JRadioButton();\r
- jRadioButtonDisableFeature.setText("Disable");\r
- jRadioButtonDisableFeature.setBounds(new java.awt.Rectangle(320, 160, 90, 20));\r
- jRadioButtonDisableFeature.addActionListener(this);\r
- }\r
- return jRadioButtonDisableFeature;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxUsage \r
- \r
- @return javax.swing.JComboBox jComboBoxUsage\r
- \r
- **/\r
- private JComboBox getJComboBoxUsage() {\r
- if (jComboBoxUsage == null) {\r
- jComboBoxUsage = new JComboBox();\r
- jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 185, 320, 20));\r
- }\r
- return jComboBoxUsage;\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton jButtonOk\r
- \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("OK");\r
- jButtonOk.setBounds(new java.awt.Rectangle(290, 240, 90, 20));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton jButtonCancel\r
- \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 240, 90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jButtonGenerateGuid \r
- \r
- @return javax.swing.JButton jButtonGenerateGuid\r
- \r
- **/\r
- private JButton getJButtonGenerateGuid() {\r
- if (jButtonGenerateGuid == null) {\r
- jButtonGenerateGuid = new JButton();\r
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 35, 65, 20));\r
- jButtonGenerateGuid.setText("GEN");\r
- jButtonGenerateGuid.addActionListener(this);\r
- }\r
- return jButtonGenerateGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldOverrideID \r
- \r
- @return javax.swing.JTextField jTextFieldOverrideID\r
- \r
- **/\r
- private JTextField getJTextFieldOverrideID() {\r
- if (jTextFieldOverrideID == null) {\r
- jTextFieldOverrideID = new JTextField();\r
- jTextFieldOverrideID.setBounds(new java.awt.Rectangle(160, 210, 50, 20));\r
- }\r
- return jTextFieldOverrideID;\r
- }\r
-\r
- public static void main(String[] args) {\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public ModuleGuids() {\r
- super();\r
- init();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inGuids The input data of GuidsDocument.Guids\r
- \r
- **/\r
- public ModuleGuids(GuidsDocument.Guids inGuids) {\r
- super();\r
- init(inGuids);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inGuids The input data of GuidsDocument.Guids\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- public ModuleGuids(GuidsDocument.Guids inGuids, int type, int index) {\r
- super();\r
- init(inGuids, type, index);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @param inGuids The input data of GuidsDocument.Guids\r
- \r
- **/\r
- private void init(GuidsDocument.Guids inGuids) {\r
- init();\r
- this.setGuids(inGuids);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- Fill values to all fields if these values are not empty\r
- \r
- @param inGuids The input data of GuidsDocument.Guids\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- private void init(GuidsDocument.Guids inGuids, int type, int index) {\r
- init(inGuids);\r
- this.location = index;\r
- if (this.guids.getGuidEntryList().size() > 0) {\r
- if (this.guids.getGuidEntryArray(index).getCName() != null) {\r
- this.jTextFieldC_Name.setText(this.guids.getGuidEntryArray(index).getCName());\r
- }\r
- if (this.guids.getGuidEntryArray(index).getGuidValue() != null) {\r
- this.jTextFieldGuidValue.setText(this.guids.getGuidEntryArray(index).getGuidValue());\r
- }\r
- if (this.guids.getGuidEntryArray(index).getFeatureFlagList().size() > 0) {\r
- for (int indexI = 0; indexI < this.guids.getGuidEntryArray(index).getFeatureFlagList().size(); indexI++) {\r
- this.iComboBoxFeatureFlag.addItem(this.guids.getGuidEntryArray(index).getFeatureFlagArray(indexI));\r
- }\r
- }\r
- if (this.guids.getGuidEntryArray(index).getConditionalExpressionList().size() > 0) {\r
- for (int indexI = 0; indexI < this.guids.getGuidEntryArray(index).getConditionalExpressionArray(0)\r
- .getConditionList().size(); indexI++) {\r
- this.iComboBoxConditionalExpression.addItem(this.guids.getGuidEntryArray(index)\r
- .getConditionalExpressionArray(0)\r
- .getConditionArray(indexI));\r
- }\r
- }\r
- if (this.guids.getGuidEntryArray(index).getDefaultValue() != null) {\r
- this.jTextFieldDefaultValue.setText(this.guids.getGuidEntryArray(index).getDefaultValue()\r
- .getStringValue());\r
- }\r
- if (this.guids.getGuidEntryArray(index).getHelpText() != null) {\r
- this.jTextFieldHelpText.setText(this.guids.getGuidEntryArray(index).getHelpText());\r
- }\r
- if (this.guids.getGuidEntryArray(index).getUsage() != null) {\r
- this.jComboBoxUsage.setSelectedItem(this.guids.getGuidEntryArray(index).getUsage().toString());\r
- }\r
- this.jRadioButtonEnableFeature.setSelected(this.guids.getGuidEntryArray(index).getEnableFeature());\r
- this.jRadioButtonDisableFeature.setSelected(!this.guids.getGuidEntryArray(index).getEnableFeature());\r
- this.jTextFieldOverrideID.setText(String.valueOf(this.guids.getGuidEntryArray(index).getOverrideID()));\r
- }\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void init() {\r
- this.setSize(500, 515);\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Guids");\r
- initFrame();\r
- this.setViewMode(false);\r
- }\r
-\r
- /**\r
- Disable all components when the mode is view\r
- \r
- @param isView true - The view mode; false - The non-view mode\r
- \r
- **/\r
- public void setViewMode(boolean isView) {\r
- this.jButtonOk.setVisible(false);\r
- this.jButtonCancel.setVisible(false);\r
- if (isView) {\r
- this.jTextFieldC_Name.setEnabled(!isView);\r
- this.jTextFieldGuidValue.setEnabled(!isView);\r
- this.iComboBoxFeatureFlag.setEnabled(!isView);\r
- this.iComboBoxConditionalExpression.setEnabled(!isView);\r
- this.jTextFieldDefaultValue.setEnabled(!isView);\r
- this.jTextFieldHelpText.setEnabled(!isView);\r
- this.jComboBoxUsage.setEnabled(!isView);\r
- this.jRadioButtonEnableFeature.setEnabled(!isView);\r
- this.jRadioButtonDisableFeature.setEnabled(!isView);\r
- this.jTextFieldOverrideID.setEnabled(!isView);\r
- this.jButtonCancel.setEnabled(!isView);\r
- this.jButtonGenerateGuid.setEnabled(!isView);\r
- this.jButtonOk.setEnabled(!isView);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel jContentPane\r
- \r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabelOverrideID = new JLabel();\r
- jLabelOverrideID.setBounds(new java.awt.Rectangle(15, 210, 140, 20));\r
- jLabelOverrideID.setText("Override ID");\r
- jLabelUsage = new JLabel();\r
- jLabelUsage.setText("Usage");\r
- jLabelUsage.setBounds(new java.awt.Rectangle(15, 185, 140, 20));\r
- jLabelEnableFeature = new JLabel();\r
- jLabelEnableFeature.setText("Enable Feature");\r
- jLabelEnableFeature.setBounds(new java.awt.Rectangle(15, 160, 140, 20));\r
- jLabelHelpText = new JLabel();\r
- jLabelHelpText.setText("Help Text");\r
- jLabelHelpText.setBounds(new java.awt.Rectangle(15, 135, 140, 20));\r
- jLabelDefault = new JLabel();\r
- jLabelDefault.setText("Default Value");\r
- jLabelDefault.setBounds(new java.awt.Rectangle(15, 110, 140, 20));\r
- jLabelConditionalExpression = new JLabel();\r
- jLabelConditionalExpression.setText("Conditional Expression");\r
- jLabelConditionalExpression.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
- jLabelFeatureFlag = new JLabel();\r
- jLabelFeatureFlag.setText("Feature Flag");\r
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
- jLabelGuidValue = new JLabel();\r
- jLabelGuidValue.setText("Guid Value");\r
- jLabelGuidValue.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
- jLabelC_Name = new JLabel();\r
- jLabelC_Name.setText("C_Name");\r
- jLabelC_Name.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(jLabelC_Name, null);\r
- jContentPane.add(getJTextFieldC_Name(), null);\r
- jContentPane.add(jLabelGuidValue, null);\r
- jContentPane.add(getJTextFieldGuidValsue(), null);\r
- jContentPane.add(jLabelFeatureFlag, null);\r
- jContentPane.add(getIComboBoxFeatureFlag(), null);\r
- jContentPane.add(jLabelConditionalExpression, null);\r
- jContentPane.add(getIComboBoxConditionalExpression(), null);\r
- jContentPane.add(jLabelDefault, null);\r
- jContentPane.add(getJTextFieldDefaultValue(), null);\r
- jContentPane.add(jLabelHelpText, null);\r
- jContentPane.add(getJTextFieldHelpText(), null);\r
- jContentPane.add(jLabelEnableFeature, null);\r
- jContentPane.add(getJRadioButtonEnableFeature(), null);\r
- jContentPane.add(getJRadioButtonDisableFeature(), null);\r
- jContentPane.add(jLabelUsage, null);\r
- jContentPane.add(getJComboBoxUsage(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJButtonGenerateGuid(), null);\r
- jContentPane.add(jLabelOverrideID, null);\r
- jContentPane.add(getJTextFieldOverrideID(), null);\r
-\r
- StarLabel jStarLabel1 = new StarLabel();\r
- jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
-\r
- jContentPane.add(jStarLabel1, null);\r
-\r
- initFrame();\r
-\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes Usage type\r
- \r
- **/\r
- private void initFrame() {\r
- jComboBoxUsage.addItem("ALWAYS_CONSUMED");\r
- jComboBoxUsage.addItem("SOMETIMES_CONSUMED");\r
- jComboBoxUsage.addItem("ALWAYS_PRODUCED");\r
- jComboBoxUsage.addItem("SOMETIMES_PRODUCED");\r
- jComboBoxUsage.addItem("DEFAULT");\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- *\r
- * Override actionPerformed to listen all actions\r
- * \r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.setEdited(true);\r
- this.save();\r
- this.dispose();\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- }\r
-\r
- if (arg0.getSource() == jButtonGenerateGuid) {\r
- jTextFieldGuidValue.setText(Tools.generateUuidString());\r
- }\r
-\r
- //\r
- //Contorl the selected status when click RadionButton\r
- //Do not use Radio Button Group\r
- //\r
- if (arg0.getSource() == jRadioButtonEnableFeature) {\r
- if (jRadioButtonEnableFeature.isSelected()) {\r
- jRadioButtonDisableFeature.setSelected(false);\r
- }\r
- if (!jRadioButtonDisableFeature.isSelected() && !jRadioButtonEnableFeature.isSelected()) {\r
- jRadioButtonEnableFeature.setSelected(true);\r
- }\r
- }\r
-\r
- if (arg0.getSource() == jRadioButtonDisableFeature) {\r
- if (jRadioButtonDisableFeature.isSelected()) {\r
- jRadioButtonEnableFeature.setSelected(false);\r
- }\r
- if (!jRadioButtonDisableFeature.isSelected() && !jRadioButtonEnableFeature.isSelected()) {\r
- jRadioButtonDisableFeature.setSelected(true);\r
- }\r
- }\r
- }\r
-\r
- /**\r
- Get GuidsDocument.Guids\r
- \r
- @return GuidsDocument.Guids\r
- \r
- **/\r
- public GuidsDocument.Guids getGuids() {\r
- return guids;\r
- }\r
-\r
- /**\r
- Set GuidsDocument.Guids\r
- \r
- @param guids The input GuidsDocument.Guids\r
- \r
- **/\r
- public void setGuids(GuidsDocument.Guids guids) {\r
- this.guids = guids;\r
- }\r
-\r
- /**\r
- Data validation for all fields\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean check() {\r
- //\r
- // Check if all required fields are not empty\r
- //\r
- if (isEmpty(this.jTextFieldC_Name.getText())) {\r
- Log.err("C_Name couldn't be empty");\r
- return false;\r
- }\r
-\r
- //\r
- // Check if all fields have correct data types \r
- //\r
- if (!DataValidation.isCName(this.jTextFieldC_Name.getText())) {\r
- Log.err("Incorrect data type for C_Name");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldGuidValue.getText()) && !DataValidation.isGuid(this.jTextFieldGuidValue.getText())) {\r
- Log.err("Incorrect data type for Guid Value");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())\r
- && !DataValidation.isOverrideID(this.jTextFieldOverrideID.getText())) {\r
- Log.err("Incorrect data type for Override ID");\r
- return false;\r
- }\r
-\r
- return true;\r
- }\r
-\r
- /**\r
- Save all components of Guids\r
- if exists guids, set the value directly\r
- if not exists guids, new an instance first\r
- \r
- **/\r
- public void save() {\r
- try {\r
- if (this.guids == null) {\r
- guids = GuidsDocument.Guids.Factory.newInstance();\r
- }\r
- GuidsDocument.Guids.GuidEntry guid = GuidsDocument.Guids.GuidEntry.Factory.newInstance();\r
- if (!isEmpty(this.jTextFieldC_Name.getText())) {\r
- guid.setCName(this.jTextFieldC_Name.getText());\r
- }\r
- if (!isEmpty(this.jTextFieldGuidValue.getText())) {\r
- guid.setGuidValue(this.jTextFieldGuidValue.getText());\r
- }\r
- if (this.iComboBoxFeatureFlag.getItemCount() > 0) {\r
- for (int index = 0; index < this.iComboBoxFeatureFlag.getItemCount(); index++) {\r
- guid.addNewFeatureFlag();\r
- guid.setFeatureFlagArray(index, this.iComboBoxFeatureFlag.getItemAt(index).toString());\r
- }\r
- }\r
- if (this.iComboBoxConditionalExpression.getItemCount() > 0) {\r
- ConditionalExpressionDocument.ConditionalExpression ce = ConditionalExpressionDocument.ConditionalExpression.Factory\r
- .newInstance();\r
- for (int index = 0; index < this.iComboBoxConditionalExpression.getItemCount(); index++) {\r
- ce.addCondition(this.iComboBoxConditionalExpression.getItemAt(index).toString());\r
- }\r
- if (guid.getConditionalExpressionList().size() < 1) {\r
- guid.addNewConditionalExpression();\r
- }\r
- guid.setConditionalExpressionArray(0, ce);\r
- }\r
- if (!isEmpty(this.jTextFieldDefaultValue.getText())) {\r
- DefaultValueDocument.DefaultValue dv = DefaultValueDocument.DefaultValue.Factory.newInstance();\r
- dv.setStringValue(this.jTextFieldDefaultValue.getText());\r
- guid.setDefaultValue(dv);\r
- }\r
- if (!isEmpty(this.jTextFieldHelpText.getText())) {\r
- guid.setHelpText(this.jTextFieldHelpText.getText());\r
- }\r
- guid.setUsage(GuidUsage.Enum.forString(jComboBoxUsage.getSelectedItem().toString()));\r
- guid.setEnableFeature(this.jRadioButtonEnableFeature.isSelected());\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())) {\r
- guid.setOverrideID(Integer.parseInt(this.jTextFieldOverrideID.getText()));\r
- }\r
-\r
- if (location > -1) {\r
- guids.setGuidEntryArray(location, guid);\r
- } else {\r
- guids.addNewGuidEntry();\r
- guids.setGuidEntryArray(guids.getGuidEntryList().size() - 1, guid);\r
- }\r
- } catch (Exception e) {\r
- Log.err("Update Guids", e.getMessage());\r
- }\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to create, update Hob of MSA/MBD file\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-package org.tianocore.packaging.module.ui;\r
-\r
-import java.awt.event.ActionEvent;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JLabel;\r
-import javax.swing.JPanel;\r
-import javax.swing.JRadioButton;\r
-import javax.swing.JTextField;\r
-\r
-import org.tianocore.GuidDocument;\r
-import org.tianocore.HobTypes;\r
-import org.tianocore.HobUsage;\r
-import org.tianocore.HobsDocument;\r
-import org.tianocore.common.DataValidation;\r
-import org.tianocore.common.Log;\r
-import org.tianocore.common.Tools;\r
-import org.tianocore.packaging.common.ui.IInternalFrame;\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-\r
-/**\r
- The class is used to create, update Hob of MSA/MBD file\r
- It extends IInternalFrame\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class ModuleHobs extends IInternalFrame {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -553473437579358325L;\r
-\r
- //\r
- //Define class members\r
- //\r
- private HobsDocument.Hobs hobs = null;\r
-\r
- private int location = -1;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JLabel jLabel = null;\r
-\r
- private JTextField jTextFieldC_Name = null;\r
-\r
- private JLabel jLabelGuid = null;\r
-\r
- private JTextField jTextFieldGuid = null;\r
-\r
- private JLabel jLabelName = null;\r
-\r
- private JTextField jTextFieldName = null;\r
-\r
- private JLabel jLabelUsage = null;\r
-\r
- private JLabel jLabelHobType = null;\r
-\r
- private JComboBox jComboBoxUsage = null;\r
-\r
- private JComboBox jComboBoxHobType = null;\r
-\r
- private JLabel jLabelHobEnabled = null;\r
-\r
- private JRadioButton jRadioButtonHobEnable = null;\r
-\r
- private JRadioButton jRadioButtonHobDisable = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JButton jButtonGenerateGuid = null;\r
-\r
- private JLabel jLabelOverrideID = null;\r
-\r
- private JTextField jTextFieldOverrideID = null;\r
-\r
- private StarLabel jStarLabel1 = null;\r
-\r
- /**\r
- This method initializes jTextField \r
- \r
- @return javax.swing.JTextField jTextFieldC_Name\r
- \r
- **/\r
- private JTextField getJTextFieldC_Name() {\r
- if (jTextFieldC_Name == null) {\r
- jTextFieldC_Name = new JTextField();\r
- jTextFieldC_Name.setBounds(new java.awt.Rectangle(160, 35, 320, 20));\r
- }\r
- return jTextFieldC_Name;\r
- }\r
-\r
- /**\r
- This method initializes jTextField \r
- \r
- @return javax.swing.JTextField jTextFieldGuid\r
- \r
- **/\r
- private JTextField getJTextFieldGuid() {\r
- if (jTextFieldGuid == null) {\r
- jTextFieldGuid = new JTextField();\r
- jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 60, 250, 20));\r
- }\r
- return jTextFieldGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldName \r
- \r
- @return javax.swing.JTextField jTextFieldName\r
- \r
- **/\r
- private JTextField getJTextFieldName() {\r
- if (jTextFieldName == null) {\r
- jTextFieldName = new JTextField();\r
- jTextFieldName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
- }\r
- return jTextFieldName;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxUsage \r
- \r
- @return javax.swing.JComboBox jComboBoxUsage\r
- \r
- **/\r
- private JComboBox getJComboBoxUsage() {\r
- if (jComboBoxUsage == null) {\r
- jComboBoxUsage = new JComboBox();\r
- jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 85, 320, 20));\r
- }\r
- return jComboBoxUsage;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxHobType \r
- \r
- @return javax.swing.JComboBox jComboBoxHobType\r
- \r
- **/\r
- private JComboBox getJComboBoxHobType() {\r
- if (jComboBoxHobType == null) {\r
- jComboBoxHobType = new JComboBox();\r
- jComboBoxHobType.setBounds(new java.awt.Rectangle(160, 110, 320, 20));\r
- }\r
- return jComboBoxHobType;\r
- }\r
-\r
- /**\r
- This method initializes jRadioButtonEnable \r
- \r
- @return javax.swing.JRadioButton jRadioButtonHobEnable\r
- \r
- **/\r
- private JRadioButton getJRadioButtonHobEnable() {\r
- if (jRadioButtonHobEnable == null) {\r
- jRadioButtonHobEnable = new JRadioButton();\r
- jRadioButtonHobEnable.setText("Enable");\r
- jRadioButtonHobEnable.setBounds(new java.awt.Rectangle(160, 135, 90, 20));\r
- jRadioButtonHobEnable.setSelected(true);\r
- jRadioButtonHobEnable.addActionListener(this);\r
- }\r
- return jRadioButtonHobEnable;\r
- }\r
-\r
- /**\r
- This method initializes jRadioButtonDisable \r
- \r
- @return javax.swing.JRadioButton jRadioButtonHobDisable\r
- \r
- **/\r
- private JRadioButton getJRadioButtonHobDisable() {\r
- if (jRadioButtonHobDisable == null) {\r
- jRadioButtonHobDisable = new JRadioButton();\r
- jRadioButtonHobDisable.setText("Disable");\r
- jRadioButtonHobDisable.setBounds(new java.awt.Rectangle(320, 135, 90, 20));\r
- jRadioButtonHobDisable.addActionListener(this);\r
- }\r
- return jRadioButtonHobDisable;\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton jButtonOk\r
- \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("OK");\r
- jButtonOk.setBounds(new java.awt.Rectangle(290, 190, 90, 20));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton jButtonCancel\r
- \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 190, 90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jButtonGenerateGuid \r
- \r
- @return javax.swing.JButton jButtonGenerateGuid\r
- \r
- **/\r
- private JButton getJButtonGenerateGuid() {\r
- if (jButtonGenerateGuid == null) {\r
- jButtonGenerateGuid = new JButton();\r
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 60, 65, 20));\r
- jButtonGenerateGuid.setText("GEN");\r
- jButtonGenerateGuid.addActionListener(this);\r
- }\r
- return jButtonGenerateGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldOverrideID \r
- \r
- @return javax.swing.JTextField jTextFieldOverrideID\r
- \r
- **/\r
- private JTextField getJTextFieldOverrideID() {\r
- if (jTextFieldOverrideID == null) {\r
- jTextFieldOverrideID = new JTextField();\r
- jTextFieldOverrideID.setBounds(new java.awt.Rectangle(160, 160, 50, 20));\r
- }\r
- return jTextFieldOverrideID;\r
- }\r
-\r
- public static void main(String[] args) {\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public ModuleHobs() {\r
- super();\r
- init();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inHobs The input data of HobsDocument.Hobs\r
- \r
- **/\r
- public ModuleHobs(HobsDocument.Hobs inHobs) {\r
- super();\r
- init(inHobs);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inHobs The input data of HobsDocument.Hobs\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- public ModuleHobs(HobsDocument.Hobs inHobs, int type, int index) {\r
- super();\r
- init(inHobs, type, index);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @param inHobs The input data of HobsDocument.Hobs\r
- \r
- **/\r
- private void init(HobsDocument.Hobs inHobs) {\r
- init();\r
- this.setHobs(inHobs);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- Fill values to all fields if these values are not empty\r
- \r
- @param inHobs The input data of HobsDocument.Hobs\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- private void init(HobsDocument.Hobs inHobs, int type, int index) {\r
- init(inHobs);\r
- this.location = index;\r
- if (this.hobs.getHobList().size() > 0) {\r
- if (this.hobs.getHobArray(index).getName() != null) {\r
- this.jTextFieldName.setText(this.hobs.getHobArray(index).getName());\r
- }\r
- if (this.hobs.getHobArray(index).getCName() != null) {\r
- this.jTextFieldC_Name.setText(this.hobs.getHobArray(index).getCName());\r
- }\r
- if (this.hobs.getHobArray(index).getGuid() != null) {\r
- this.jTextFieldGuid.setText(this.hobs.getHobArray(index).getGuid().getStringValue());\r
- }\r
- if (this.hobs.getHobArray(index).getUsage() != null) {\r
- this.jComboBoxUsage.setSelectedItem(this.hobs.getHobArray(index).getUsage().toString());\r
- }\r
- this.jRadioButtonHobEnable.setSelected(this.hobs.getHobArray(index).getHobEnabled());\r
- this.jRadioButtonHobDisable.setSelected(!this.hobs.getHobArray(index).getHobEnabled());\r
- this.jTextFieldOverrideID.setText(String.valueOf(this.hobs.getHobArray(index).getOverrideID()));\r
- }\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void init() {\r
- this.setSize(500, 515);\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Hobs");\r
- initFrame();\r
- this.setViewMode(false);\r
- }\r
-\r
- /**\r
- Disable all components when the mode is view\r
- \r
- @param isView true - The view mode; false - The non-view mode\r
- \r
- **/\r
- public void setViewMode(boolean isView) {\r
- this.jButtonOk.setVisible(false);\r
- this.jButtonCancel.setVisible(false);\r
- if (isView) {\r
- this.jTextFieldName.setEnabled(!isView);\r
- this.jTextFieldC_Name.setEnabled(!isView);\r
- this.jTextFieldGuid.setEnabled(!isView);\r
- this.jComboBoxUsage.setEnabled(!isView);\r
- this.jComboBoxHobType.setEnabled(!isView);\r
- this.jRadioButtonHobEnable.setEnabled(!isView);\r
- this.jRadioButtonHobDisable.setEnabled(!isView);\r
- this.jTextFieldOverrideID.setEnabled(!isView);\r
- this.jButtonCancel.setEnabled(!isView);\r
- this.jButtonGenerateGuid.setEnabled(!isView);\r
- this.jButtonOk.setEnabled(!isView);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel jContentPane\r
- \r
- **/\r
- public JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabelOverrideID = new JLabel();\r
- jLabelOverrideID.setBounds(new java.awt.Rectangle(15, 160, 140, 20));\r
- jLabelOverrideID.setText("Override ID");\r
- jLabelHobEnabled = new JLabel();\r
- jLabelHobEnabled.setText("Hob Enabled");\r
- jLabelHobEnabled.setBounds(new java.awt.Rectangle(15, 135, 140, 20));\r
- jLabelHobType = new JLabel();\r
- jLabelHobType.setText("Hob Type");\r
- jLabelHobType.setBounds(new java.awt.Rectangle(15, 110, 140, 20));\r
- jLabelUsage = new JLabel();\r
- jLabelUsage.setText("Usage");\r
- jLabelUsage.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
- jLabelName = new JLabel();\r
- jLabelName.setText("Name");\r
- jLabelName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
- jLabelGuid = new JLabel();\r
- jLabelGuid.setText("Guid");\r
- jLabelGuid.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
- jLabel = new JLabel();\r
- jLabel.setText("C_Name");\r
- jLabel.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(jLabel, null);\r
- jContentPane.add(getJTextFieldC_Name(), null);\r
- jContentPane.add(getJTextFieldGuid(), null);\r
- jContentPane.add(jLabelUsage, null);\r
- jContentPane.add(jLabelName, null);\r
- jContentPane.add(getJTextFieldName(), null);\r
- jContentPane.add(jLabelGuid, null);\r
- jContentPane.add(jLabelHobType, null);\r
- jContentPane.add(getJComboBoxUsage(), null);\r
- jContentPane.add(getJComboBoxHobType(), null);\r
- jContentPane.add(jLabelHobEnabled, null);\r
- jContentPane.add(getJRadioButtonHobEnable(), null);\r
- jContentPane.add(getJRadioButtonHobDisable(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJButtonGenerateGuid(), null);\r
- jContentPane.add(jLabelOverrideID, null);\r
- jContentPane.add(getJTextFieldOverrideID(), null);\r
-\r
- jStarLabel1 = new StarLabel();\r
- jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
- jContentPane.add(jStarLabel1, null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes Usage type and Hob type\r
- \r
- **/\r
- private void initFrame() {\r
- jComboBoxHobType.addItem("PHIT");\r
- jComboBoxHobType.addItem("MEMORY_ALLOCATION");\r
- jComboBoxHobType.addItem("RESOURCE_DESCRIPTOR");\r
- jComboBoxHobType.addItem("GUID_EXTENSION");\r
- jComboBoxHobType.addItem("FIRMWARE_VOLUME");\r
- jComboBoxHobType.addItem("CPU");\r
- jComboBoxHobType.addItem("POOL");\r
- jComboBoxHobType.addItem("CAPSULE_VOLUME");\r
-\r
- jComboBoxUsage.addItem("ALWAYS_CONSUMED");\r
- jComboBoxUsage.addItem("SOMETIMES_CONSUMED");\r
- jComboBoxUsage.addItem("ALWAYS_PRODUCED");\r
- jComboBoxUsage.addItem("SOMETIMES_PRODUCED");\r
- jComboBoxUsage.addItem("PRIVATE");\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- *\r
- * Override actionPerformed to listen all actions\r
- * \r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.setEdited(true);\r
- this.save();\r
- this.dispose();\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- }\r
-\r
- //\r
- // Contorl the selected status when click RadionButton\r
- // Do not use Radio Button Group\r
- //\r
- if (arg0.getSource() == jRadioButtonHobEnable) {\r
- if (jRadioButtonHobEnable.isSelected()) {\r
- jRadioButtonHobDisable.setSelected(false);\r
- }\r
- if (!jRadioButtonHobDisable.isSelected() && !jRadioButtonHobEnable.isSelected()) {\r
- jRadioButtonHobEnable.setSelected(true);\r
- }\r
- }\r
-\r
- if (arg0.getSource() == jRadioButtonHobDisable) {\r
- if (jRadioButtonHobDisable.isSelected()) {\r
- jRadioButtonHobEnable.setSelected(false);\r
- }\r
- if (!jRadioButtonHobDisable.isSelected() && !jRadioButtonHobEnable.isSelected()) {\r
- jRadioButtonHobDisable.setSelected(true);\r
- }\r
- }\r
-\r
- if (arg0.getSource() == jButtonGenerateGuid) {\r
- jTextFieldGuid.setText(Tools.generateUuidString());\r
- }\r
- }\r
-\r
- /**\r
- Get HobsDocument.Hobs\r
- \r
- @return HobsDocument.Hobs\r
- \r
- **/\r
- public HobsDocument.Hobs getHobs() {\r
- return hobs;\r
- }\r
-\r
- /**\r
- Set HobsDocument.Hobs\r
- \r
- @param hobs The input data of HobsDocument.Hobs\r
- \r
- **/\r
- public void setHobs(HobsDocument.Hobs hobs) {\r
- this.hobs = hobs;\r
- }\r
-\r
- /**\r
- Data validation for all fields\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean check() {\r
- //\r
- // Check if all required fields are not empty\r
- //\r
- if (isEmpty(this.jTextFieldName.getText())) {\r
- Log.err("Name couldn't be empty");\r
- return false;\r
- }\r
-\r
- //\r
- // Check if all fields have correct data types \r
- //\r
- if (!DataValidation.isCName(this.jTextFieldC_Name.getText())) {\r
- Log.err("Incorrect data type for C_Name");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldGuid.getText()) && !DataValidation.isGuid(this.jTextFieldGuid.getText())) {\r
- Log.err("Incorrect data type for Guid");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())\r
- && !DataValidation.isOverrideID(this.jTextFieldOverrideID.getText())) {\r
- Log.err("Incorrect data type for Override ID");\r
- return false;\r
- }\r
-\r
- return true;\r
- }\r
-\r
- /**\r
- Save all components of Hobs\r
- if exists hobs, set the value directly\r
- if not exists hobs, new an instance first\r
- \r
- **/\r
- public void save() {\r
- try {\r
- if (this.hobs == null) {\r
- hobs = HobsDocument.Hobs.Factory.newInstance();\r
- }\r
- HobsDocument.Hobs.Hob hob = HobsDocument.Hobs.Hob.Factory.newInstance();\r
- if (!isEmpty(this.jTextFieldName.getText())) {\r
- hob.setName(this.jTextFieldName.getText());\r
- }\r
- if (!isEmpty(this.jTextFieldC_Name.getText())) {\r
- hob.setCName(this.jTextFieldC_Name.getText());\r
- }\r
- if (!isEmpty(this.jTextFieldGuid.getText())) {\r
- GuidDocument.Guid guid = GuidDocument.Guid.Factory.newInstance();\r
- guid.setStringValue(this.jTextFieldGuid.getText());\r
- hob.setGuid(guid);\r
- }\r
- hob.setUsage(HobUsage.Enum.forString(jComboBoxUsage.getSelectedItem().toString()));\r
- hob.setHobType(HobTypes.Enum.forString(jComboBoxHobType.getSelectedItem().toString()));\r
- hob.setHobEnabled(this.jRadioButtonHobEnable.isSelected());\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())) {\r
- hob.setOverrideID(Integer.parseInt(this.jTextFieldOverrideID.getText()));\r
- }\r
- if (location > -1) {\r
- hobs.setHobArray(location, hob);\r
- } else {\r
- hobs.addNewHob();\r
- hobs.setHobArray(hobs.getHobList().size() - 1, hob);\r
- }\r
- } catch (Exception e) {\r
- Log.err("Update Hobs", e.getMessage());\r
- }\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to create, update Include of MSA/MBD file\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-package org.tianocore.packaging.module.ui;\r
-\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ItemEvent;\r
-import java.awt.event.ItemListener;\r
-import java.util.Vector;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.JCheckBox;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JLabel;\r
-import javax.swing.JPanel;\r
-import javax.swing.JTextField;\r
-\r
-import org.tianocore.IncludesDocument;\r
-import org.tianocore.PackageNameDocument;\r
-import org.tianocore.PackageType;\r
-import org.tianocore.PackageUsage;\r
-import org.tianocore.SupportedArchitectures;\r
-import org.tianocore.common.DataValidation;\r
-import org.tianocore.common.Log;\r
-import org.tianocore.packaging.common.ui.IDefaultMutableTreeNode;\r
-import org.tianocore.packaging.common.ui.IInternalFrame;\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-import org.tianocore.packaging.workspace.common.Workspace;\r
-\r
-/**\r
- The class is used to create, update Include of MSA/MBD file\r
- It extends IInternalFrame\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class ModuleIncludes extends IInternalFrame implements ItemListener {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = 3465193035145152131L;\r
-\r
- //\r
- //Define class members\r
- //\r
- private IncludesDocument.Includes includes = null;\r
-\r
- private int location = -1;\r
- \r
- private int intSelectedItemId = 0;\r
-\r
- //\r
- // 1 - Add; 2 - Update\r
- //\r
- private int operation = -1;\r
-\r
- private Vector<String> vPackageName = new Vector<String>();\r
-\r
- private Vector<String> vUsage = new Vector<String>();\r
-\r
- private Vector<String> vPackageType = new Vector<String>();\r
-\r
- private Vector<String> vUpdatedDate = new Vector<String>();\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JLabel jLabelPackageName = null;\r
-\r
- private JLabel jLabelPackageType = null;\r
-\r
- private JComboBox jComboBoxPackageType = null;\r
-\r
- private JLabel jLabelUsage = null;\r
-\r
- private JComboBox jComboBoxUsage = null;\r
-\r
- private StarLabel jStarLabel1 = null;\r
-\r
- private JComboBox jComboBoxFileList = null;\r
-\r
- private JButton jButtonAdd = null;\r
-\r
- private JButton jButtonUpdate = null;\r
-\r
- private JButton jButtonRemove = null;\r
-\r
- private JLabel jLabelUpdatedDate = null;\r
-\r
- private JTextField jTextFieldUpdatedDate = null;\r
-\r
- private JCheckBox jCheckBoxArch = null;\r
-\r
- private JComboBox jComboBoxArch = null;\r
-\r
- private JComboBox jComboBoxPackageName = null;\r
- \r
- private Workspace ws = null;\r
- \r
- private Vector vecPackageName = null;\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton jButtonOk\r
- \r
- **/\r
- private JButton getJButton() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("OK");\r
- jButtonOk.setBounds(new java.awt.Rectangle(290, 165, 90, 20));\r
- jButtonOk.addActionListener(this);\r
-\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton jButtonCancel\r
- \r
- **/\r
- private JButton getJButton1() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 165, 90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxPackageType \r
- \r
- @return javax.swing.JComboBox jComboBoxPackageType\r
- \r
- **/\r
- private JComboBox getJComboBoxPackageType() {\r
- if (jComboBoxPackageType == null) {\r
- jComboBoxPackageType = new JComboBox();\r
- jComboBoxPackageType.setBounds(new java.awt.Rectangle(160, 35, 320, 20));\r
- }\r
- return jComboBoxPackageType;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxUsage \r
- \r
- @return javax.swing.JComboBox jComboBoxUsage\r
- \r
- **/\r
- private JComboBox getJComboBoxUsage() {\r
- if (jComboBoxUsage == null) {\r
- jComboBoxUsage = new JComboBox();\r
- jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20));\r
- }\r
- return jComboBoxUsage;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxFileList \r
- \r
- @return javax.swing.JComboBox jComboBoxFileList\r
- \r
- **/\r
- private JComboBox getJComboBoxFileList() {\r
- if (jComboBoxFileList == null) {\r
- jComboBoxFileList = new JComboBox();\r
- jComboBoxFileList.setBounds(new java.awt.Rectangle(15, 110, 210, 20));\r
- jComboBoxFileList.addActionListener(this);\r
- jComboBoxFileList.addItemListener(this);\r
- }\r
- return jComboBoxFileList;\r
- }\r
-\r
- /**\r
- This method initializes jButtonAdd \r
- \r
- @return javax.swing.JButton jButtonAdd\r
- \r
- **/\r
- private JButton getJButtonAdd() {\r
- if (jButtonAdd == null) {\r
- jButtonAdd = new JButton();\r
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 110, 80, 20));\r
- jButtonAdd.setText("Add");\r
- jButtonAdd.addActionListener(this);\r
- }\r
- return jButtonAdd;\r
- }\r
-\r
- /**\r
- This method initializes jButtonUpdate \r
- \r
- @return javax.swing.JButton jButtonUpdate\r
- \r
- **/\r
- private JButton getJButtonUpdate() {\r
- if (jButtonUpdate == null) {\r
- jButtonUpdate = new JButton();\r
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 110, 80, 20));\r
- jButtonUpdate.setText("Update");\r
- jButtonUpdate.addActionListener(this);\r
- }\r
- return jButtonUpdate;\r
- }\r
-\r
- /**\r
- This method initializes jButtonRemove \r
- \r
- @return javax.swing.JButton jButtonRemove\r
- \r
- **/\r
- private JButton getJButtonRemove() {\r
- if (jButtonRemove == null) {\r
- jButtonRemove = new JButton();\r
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 110, 80, 20));\r
- jButtonRemove.setText("Remove");\r
- jButtonRemove.addActionListener(this);\r
- }\r
- return jButtonRemove;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldUpdatedDate \r
- \r
- @return javax.swing.JTextField jTextFieldUpdatedDate\r
- \r
- **/\r
- private JTextField getJTextFieldUpdatedDate() {\r
- if (jTextFieldUpdatedDate == null) {\r
- jTextFieldUpdatedDate = new JTextField();\r
- jTextFieldUpdatedDate.setBounds(new java.awt.Rectangle(160, 85, 320, 20));\r
- }\r
- return jTextFieldUpdatedDate;\r
- }\r
-\r
- /**\r
- This method initializes jCheckBoxArch \r
- \r
- @return javax.swing.JCheckBox jCheckBoxArch\r
- \r
- **/\r
- private JCheckBox getJCheckBoxArch() {\r
- if (jCheckBoxArch == null) {\r
- jCheckBoxArch = new JCheckBox();\r
- jCheckBoxArch.setBounds(new java.awt.Rectangle(10, 135, 120, 20));\r
- jCheckBoxArch.setText("Specific Arch");\r
- jCheckBoxArch.addActionListener(this);\r
- }\r
- return jCheckBoxArch;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxArch \r
- \r
- @return javax.swing.JComboBox jComboBoxArch\r
- \r
- **/\r
- private JComboBox getJComboBoxArch() {\r
- if (jComboBoxArch == null) {\r
- jComboBoxArch = new JComboBox();\r
- jComboBoxArch.setBounds(new java.awt.Rectangle(140, 135, 340, 20));\r
- jComboBoxArch.setEnabled(false);\r
- }\r
- return jComboBoxArch;\r
- }\r
-\r
- /**\r
- * This method initializes jComboBoxPackageName \r
- * \r
- * @return javax.swing.JComboBox \r
- */\r
- private JComboBox getJComboBoxPackageName() {\r
- if (jComboBoxPackageName == null) {\r
- jComboBoxPackageName = new JComboBox();\r
- jComboBoxPackageName.setBounds(new java.awt.Rectangle(160,10,320,20));\r
- }\r
- return jComboBoxPackageName;\r
- }\r
-\r
- public static void main(String[] args) {\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public ModuleIncludes() {\r
- super();\r
- init();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inIncludes The input data of IncludesDocument.Includes\r
- \r
- **/\r
- public ModuleIncludes(IncludesDocument.Includes inIncludes) {\r
- super();\r
- init(inIncludes);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inIncludes The input data of IncludesDocument.Includes\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- public ModuleIncludes(IncludesDocument.Includes inIncludes, int type, int index) {\r
- super();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inIncludes The input data of IncludesDocument.Includes\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- @param inOperation The input data of current operation type\r
- \r
- **/\r
- public ModuleIncludes(IncludesDocument.Includes inIncludes, int type, int index, int inOperation) {\r
- super();\r
- init(inIncludes, type, index, inOperation);\r
- this.operation = inOperation;\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @param inIncludes\r
- \r
- **/\r
- private void init(IncludesDocument.Includes inIncludes) {\r
- init();\r
- this.setIncludes(inIncludes);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- Fill values to all fields if these values are not empty\r
- \r
- @param inIncludes The input data of IncludesDocument.Includes\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- @param inOperation The input data of current operation type\r
- \r
- **/\r
- private void init(IncludesDocument.Includes inIncludes, int type, int index, int inOperation) {\r
- init(inIncludes);\r
- this.location = index;\r
- this.operation = inOperation;\r
-\r
- if (operation == 2) {\r
- this.jCheckBoxArch.setEnabled(false);\r
- this.jComboBoxArch.setEnabled(false);\r
-\r
- if (type == IDefaultMutableTreeNode.INCLUDES_PACKAGENAME) {\r
- if (this.includes.getPackageNameList().size() > 0) {\r
- for (int indexI = 0; indexI < this.includes.getPackageNameList().size(); indexI++) {\r
- if (this.includes.getPackageNameArray(indexI).getStringValue() != null) {\r
- vPackageName.addElement(this.includes.getPackageNameArray(indexI).getStringValue());\r
- } else {\r
- vPackageName.addElement("");\r
- }\r
- if (this.includes.getPackageNameArray(indexI).getUsage() != null) {\r
- vUsage.addElement(this.includes.getPackageNameArray(indexI).getUsage().toString());\r
- } else {\r
- vUsage.addElement("ALWAYS_CONSUMED");\r
- }\r
- if (this.includes.getPackageNameArray(indexI).getPackageType() != null) {\r
- vPackageType.addElement(this.includes.getPackageNameArray(indexI).getPackageType()\r
- .toString());\r
- } else {\r
- vPackageType.addElement("SOURCE");\r
- }\r
- if (this.includes.getPackageNameArray(indexI).getUpdatedDate() != null) {\r
- vUpdatedDate.addElement(this.includes.getPackageNameArray(indexI).getUpdatedDate());\r
- } else {\r
- vUpdatedDate.addElement("");\r
- }\r
- jComboBoxFileList.addItem(this.includes.getPackageNameArray(indexI).getStringValue());\r
- }\r
- }\r
- }\r
- if (type == IDefaultMutableTreeNode.INCLUDES_ARCH_ITEM) {\r
- this.jCheckBoxArch.setSelected(true);\r
- this.jComboBoxArch.setSelectedItem(this.includes.getArchArray(index).getArchType().toString());\r
- for (int indexI = 0; indexI < this.includes.getArchArray(index).getPackageNameList().size(); indexI++) {\r
- if (this.includes.getArchArray(index).getPackageNameArray(indexI).getStringValue() != null) {\r
- vPackageName.addElement(this.includes.getArchArray(index).getPackageNameArray(indexI)\r
- .getStringValue());\r
- } else {\r
- vPackageName.addElement("");\r
- }\r
- if (this.includes.getArchArray(index).getPackageNameArray(indexI).getUsage() != null) {\r
- vUsage.addElement(this.includes.getArchArray(index).getPackageNameArray(indexI).getUsage()\r
- .toString());\r
- } else {\r
- vUsage.addElement("");\r
- }\r
- if (this.includes.getArchArray(index).getPackageNameArray(indexI).getPackageType() != null) {\r
- vPackageType.addElement(this.includes.getArchArray(index).getPackageNameArray(indexI)\r
- .getPackageType().toString());\r
- } else {\r
- vPackageType.addElement("");\r
- }\r
- if (this.includes.getArchArray(index).getPackageNameArray(indexI).getUpdatedDate() != null) {\r
- vUpdatedDate.addElement(this.includes.getArchArray(index).getPackageNameArray(indexI)\r
- .getUpdatedDate());\r
- } else {\r
- vUpdatedDate.addElement("");\r
- }\r
- jComboBoxFileList.addItem(this.includes.getArchArray(index).getPackageNameArray(indexI)\r
- .getStringValue());\r
- }\r
- }\r
- }\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void init() {\r
- this.setSize(500, 515);\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Includes");\r
- initFrame();\r
- this.setViewMode(false);\r
- }\r
-\r
- /**\r
- Disable all components when the mode is view\r
- \r
- @param isView true - The view mode; false - The non-view mode\r
- \r
- **/\r
- public void setViewMode(boolean isView) {\r
- this.jButtonOk.setVisible(false);\r
- this.jButtonCancel.setVisible(false);\r
- if (isView) {\r
- this.jComboBoxPackageType.setEnabled(!isView);\r
- this.jComboBoxUsage.setEnabled(!isView);\r
- this.jComboBoxPackageName.setEnabled(!isView);\r
- this.jButtonAdd.setEnabled(!isView);\r
- this.jButtonUpdate.setEnabled(!isView);\r
- this.jButtonRemove.setEnabled(!isView);\r
- this.jTextFieldUpdatedDate.setEnabled(!isView);\r
- this.jCheckBoxArch.setEnabled(!isView);\r
- this.jComboBoxArch.setEnabled(!isView);\r
-\r
- this.jButtonCancel.setEnabled(!isView);\r
- this.jButtonOk.setEnabled(!isView);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel jContentPane\r
- \r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabelUpdatedDate = new JLabel();\r
- jLabelUpdatedDate.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
- jLabelUpdatedDate.setText("Updated Date");\r
- jLabelUsage = new JLabel();\r
- jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
- jLabelUsage.setText("Usage");\r
- jLabelPackageType = new JLabel();\r
- jLabelPackageType.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
- jLabelPackageType.setText("Package Type");\r
- jLabelPackageName = new JLabel();\r
- jLabelPackageName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
- jLabelPackageName.setText("Package Name");\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(getJButton(), null);\r
- jContentPane.add(getJButton1(), null);\r
- jContentPane.add(jLabelPackageName, null);\r
- jContentPane.add(jLabelPackageType, null);\r
- jContentPane.add(getJComboBoxPackageType(), null);\r
- jContentPane.add(jLabelUsage, null);\r
- jContentPane.add(getJComboBoxUsage(), null);\r
-\r
- jStarLabel1 = new StarLabel();\r
- jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
-\r
- jContentPane.add(jStarLabel1, null);\r
- jContentPane.add(getJComboBoxFileList(), null);\r
- jContentPane.add(getJButtonAdd(), null);\r
- jContentPane.add(getJButtonUpdate(), null);\r
- jContentPane.add(getJButtonRemove(), null);\r
- jContentPane.add(jLabelUpdatedDate, null);\r
- jContentPane.add(getJTextFieldUpdatedDate(), null);\r
- jContentPane.add(getJCheckBoxArch(), null);\r
- jContentPane.add(getJComboBoxArch(), null);\r
- jContentPane.add(getJComboBoxPackageName(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- *\r
- * Override actionPerformed to listen all actions\r
- * \r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.setEdited(true);\r
- this.save();\r
- this.dispose();\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- }\r
- if (arg0.getSource() == jButtonAdd) {\r
- if (!checkAdd()) {\r
- return;\r
- }\r
- addToList();\r
- }\r
- if (arg0.getSource() == jButtonRemove) {\r
- removeFromList();\r
- }\r
- if (arg0.getSource() == jButtonUpdate) {\r
- if (!checkAdd()) {\r
- return;\r
- }\r
- updateForList();\r
- }\r
-\r
- //\r
- //When and only when checked Arch box then can choose different arch types\r
- //\r
- if (arg0.getSource() == jCheckBoxArch) {\r
- if (this.jCheckBoxArch.isSelected()) {\r
- this.jComboBoxArch.setEnabled(true);\r
- } else {\r
- this.jComboBoxArch.setEnabled(false);\r
- }\r
- }\r
- }\r
-\r
- /**\r
- This method initializes Usage type, Package type and Arch type\r
- \r
- **/\r
- private void initFrame() {\r
- ws = new Workspace();\r
- vecPackageName = ws.getAllPackageName();\r
- for (int index = 0; index < vecPackageName.size(); index++) {\r
- jComboBoxPackageName.addItem(vecPackageName.elementAt(index));\r
- }\r
- \r
- jComboBoxUsage.addItem("ALWAYS_CONSUMED");\r
- jComboBoxUsage.addItem("ALWAYS_PRODUCED");\r
- jComboBoxUsage.addItem("DEFAULT");\r
-\r
- jComboBoxPackageType.addItem("SOURCE");\r
- jComboBoxPackageType.addItem("BINARY");\r
- jComboBoxPackageType.addItem("MIXED");\r
-\r
- jComboBoxArch.addItem("ALL");\r
- jComboBoxArch.addItem("EBC");\r
- jComboBoxArch.addItem("ARM");\r
- jComboBoxArch.addItem("IA32");\r
- jComboBoxArch.addItem("X64");\r
- jComboBoxArch.addItem("IPF");\r
- jComboBoxArch.addItem("PPC");\r
- }\r
-\r
- /**\r
- Add current item to Vector\r
- \r
- **/\r
- private void addToList() {\r
- intSelectedItemId = vPackageName.size();\r
- vPackageName.addElement(this.jComboBoxPackageName.getSelectedItem().toString());\r
- vUsage.addElement(this.jComboBoxUsage.getSelectedItem().toString());\r
- vPackageType.addElement(this.jComboBoxPackageType.getSelectedItem().toString());\r
- vUpdatedDate.addElement(this.jTextFieldUpdatedDate.getText());\r
- jComboBoxFileList.addItem(this.jComboBoxPackageName.getSelectedItem().toString());\r
- jComboBoxFileList.setSelectedItem(this.jComboBoxPackageName.getSelectedItem().toString());\r
- \r
- //\r
- // Reset select item index\r
- //\r
- intSelectedItemId = vPackageName.size();\r
- \r
- //\r
- // Reload all fields of selected item\r
- //\r
- reloadFromList();\r
- }\r
-\r
- /**\r
- Remove item from Vector\r
- \r
- **/\r
- private void removeFromList() {\r
- int intTempIndex = intSelectedItemId;\r
- if (vPackageName.size() < 1) {\r
- return;\r
- }\r
- \r
- jComboBoxFileList.removeItemAt(intSelectedItemId);\r
- \r
- vPackageName.removeElementAt(intTempIndex);\r
- vUsage.removeElementAt(intTempIndex);\r
- vPackageType.removeElementAt(intTempIndex);\r
- vUpdatedDate.removeElementAt(intTempIndex);\r
- \r
- //\r
- // Reload all fields of selected item\r
- //\r
- reloadFromList();\r
- }\r
-\r
- /**\r
- Update current item of Vector\r
- \r
- **/\r
- private void updateForList() {\r
- //\r
- // Backup selected item index\r
- //\r
- int intTempIndex = intSelectedItemId;\r
- \r
- vPackageName.setElementAt(this.jComboBoxPackageName.getSelectedItem().toString(), intSelectedItemId);\r
- vUsage.setElementAt(this.jComboBoxUsage.getSelectedItem().toString(), intSelectedItemId);\r
- vPackageType.setElementAt(this.jComboBoxPackageType.getSelectedItem().toString(), intSelectedItemId);\r
- vUpdatedDate.setElementAt(this.jTextFieldUpdatedDate.getText(), intSelectedItemId);\r
- \r
- jComboBoxFileList.removeAllItems();\r
- for (int index = 0; index < vPackageName.size(); index++) {\r
- jComboBoxFileList.addItem(vPackageName.elementAt(index));\r
- }\r
- \r
- //\r
- // Restore selected item index\r
- //\r
- intSelectedItemId = intTempIndex;\r
- \r
- //\r
- // Reset select item index\r
- //\r
- jComboBoxFileList.setSelectedIndex(intSelectedItemId);\r
- \r
- //\r
- // Reload all fields of selected item\r
- //\r
- reloadFromList();\r
- }\r
-\r
- /**\r
- Refresh all fields' values of selected item of Vector\r
- \r
- **/\r
- private void reloadFromList() {\r
- if (vPackageName.size() > 0) {\r
- //\r
- // Get selected item index\r
- //\r
- intSelectedItemId = jComboBoxFileList.getSelectedIndex();\r
- \r
- this.jComboBoxPackageName.setSelectedItem(vPackageName.elementAt(intSelectedItemId).toString());\r
- this.jComboBoxUsage.setSelectedItem(vUsage.elementAt(intSelectedItemId).toString());\r
- this.jComboBoxPackageType.setSelectedItem(vPackageType.elementAt(intSelectedItemId).toString());\r
- this.jTextFieldUpdatedDate.setText(vUpdatedDate.elementAt(intSelectedItemId).toString());\r
- } else {\r
- this.jComboBoxPackageName.setSelectedIndex(0);\r
- this.jComboBoxUsage.setSelectedIndex(0);\r
- this.jComboBoxPackageType.setSelectedIndex(0);\r
- this.jTextFieldUpdatedDate.setText("");\r
- }\r
- }\r
-\r
- /**\r
- Get IncludesDocument.Includes\r
- \r
- @return IncludesDocument.Includes\r
- \r
- **/\r
- public IncludesDocument.Includes getIncludes() {\r
- return includes;\r
- }\r
-\r
- /**\r
- Set IncludesDocument.Includes\r
- \r
- @param includes IncludesDocument.Includes\r
- \r
- **/\r
- public void setIncludes(IncludesDocument.Includes includes) {\r
- this.includes = includes;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)\r
- *\r
- * Reflesh the frame when selected item changed\r
- * \r
- */\r
- public void itemStateChanged(ItemEvent arg0) {\r
- if (arg0.getStateChange() == ItemEvent.SELECTED) {\r
- reloadFromList();\r
- }\r
- }\r
-\r
- /**\r
- Data validation for all fields\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean check() {\r
- if (this.jComboBoxFileList.getItemCount() < 1) {\r
- Log.err("Must have one include at least!");\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- /**\r
- Data validation for all fields before add current item to Vector\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean checkAdd() {\r
- //\r
- // Check if all fields have correct data types \r
- //\r
- if (!isEmpty(this.jTextFieldUpdatedDate.getText())\r
- && !DataValidation.isDateType(this.jTextFieldUpdatedDate.getText())) {\r
- Log.err("Incorrect data type for Update Date");\r
- return false;\r
- }\r
-\r
- return true;\r
- }\r
-\r
- /**\r
- Save all components of Includes\r
- if exists includes, set the value directly\r
- if not exists includes, new an instance first\r
- \r
- **/\r
- public void save() {\r
- try {\r
- if (this.includes == null) {\r
- includes = IncludesDocument.Includes.Factory.newInstance();\r
- }\r
- //\r
- //Save as file name\r
- //\r
- if (!this.jCheckBoxArch.isSelected()) {\r
- if (this.operation == 2) { //Add new packageName\r
- //\r
- //First remove all existed packageName\r
- //\r
- if (includes.getPackageNameList().size() > 0) {\r
- for (int index = includes.getPackageNameList().size() - 1; index >= 0; index--) {\r
- includes.removePackageName(index);\r
- }\r
- }\r
- }\r
- for (int index = 0; index < vPackageName.size(); index++) {\r
- PackageNameDocument.PackageName packageName = PackageNameDocument.PackageName.Factory.newInstance();\r
- if (!isEmpty(vPackageName.elementAt(index).toString())) {\r
- packageName.setStringValue(vPackageName.elementAt(index).toString());\r
- }\r
- if (!isEmpty(vUsage.elementAt(index).toString())) {\r
- packageName.setUsage(PackageUsage.Enum.forString(vUsage.elementAt(index).toString()));\r
- }\r
- if (!isEmpty(vPackageType.elementAt(index).toString())) {\r
- packageName\r
- .setPackageType(PackageType.Enum.forString(vPackageType.elementAt(index).toString()));\r
- }\r
- if (!isEmpty(vUpdatedDate.elementAt(index).toString())) {\r
- packageName.setUpdatedDate(vUpdatedDate.elementAt(index).toString());\r
- }\r
- includes.addNewPackageName();\r
- includes.setPackageNameArray(includes.getPackageNameList().size() - 1, packageName);\r
- }\r
- }\r
- //\r
- //Save as Arch\r
- //\r
- if (this.jCheckBoxArch.isSelected()) {\r
- IncludesDocument.Includes.Arch arch = IncludesDocument.Includes.Arch.Factory.newInstance();\r
- if (this.operation == 2) {\r
- //\r
- //First remove all existed filename\r
- //\r
- for (int index = includes.getArchArray(location).getPackageNameList().size() - 1; index >= 0; index--) {\r
- includes.getArchArray(location).removePackageName(index);\r
- }\r
- }\r
-\r
- for (int index = 0; index < vPackageName.size(); index++) {\r
- PackageNameDocument.PackageName packageName = PackageNameDocument.PackageName.Factory.newInstance();\r
- if (!isEmpty(vPackageName.elementAt(index).toString())) {\r
- packageName.setStringValue(vPackageName.elementAt(index).toString());\r
- }\r
- if (!isEmpty(vUsage.elementAt(index).toString())) {\r
- packageName.setUsage(PackageUsage.Enum.forString(vUsage.elementAt(index).toString()));\r
- }\r
- if (!isEmpty(vPackageType.elementAt(index).toString())) {\r
- packageName\r
- .setPackageType(PackageType.Enum.forString(vPackageType.elementAt(index).toString()));\r
- }\r
- if (!isEmpty(vUpdatedDate.elementAt(index).toString())) {\r
- packageName.setUpdatedDate(vUpdatedDate.elementAt(index).toString());\r
- }\r
- arch.addNewPackageName();\r
- arch.setPackageNameArray(arch.getPackageNameList().size() - 1, packageName);\r
- }\r
- arch\r
- .setArchType(SupportedArchitectures.Enum.forString(this.jComboBoxArch.getSelectedItem().toString()));\r
- if (location > -1) {\r
- includes.setArchArray(location, arch);\r
- } else {\r
- includes.addNewArch();\r
- includes.setArchArray(includes.getArchList().size() - 1, arch);\r
- }\r
- }\r
- } catch (Exception e) {\r
- Log.err("Update Source Files", e.getMessage());\r
- }\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to create, update Library Class Definition of MSA/MBD file\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-package org.tianocore.packaging.module.ui;\r
-\r
-import java.awt.event.ActionEvent;\r
-\r
-import javax.swing.DefaultListModel;\r
-import javax.swing.JButton;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JLabel;\r
-import javax.swing.JList;\r
-import javax.swing.JPanel;\r
-import javax.swing.JRadioButton;\r
-import javax.swing.JScrollPane;\r
-import javax.swing.JTextField;\r
-\r
-import org.tianocore.LibraryClassDefinitionsDocument;\r
-import org.tianocore.LibraryClassDocument;\r
-import org.tianocore.LibraryUsage;\r
-import org.tianocore.common.DataValidation;\r
-import org.tianocore.common.Log;\r
-import org.tianocore.packaging.common.ui.IInternalFrame;\r
-\r
-/**\r
- The class is used to create, update Library Class Definition of MSA/MBD file\r
- It extends IInternalFrame\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class ModuleLibraryClassDefinitions extends IInternalFrame {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -1743248695411382857L;\r
-\r
- //\r
- //Define class members\r
- //\r
- private static String Separator = "::";\r
-\r
- private DefaultListModel listItem = new DefaultListModel();\r
-\r
- private LibraryClassDefinitionsDocument.LibraryClassDefinitions libraryClassDefinitions = null;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JRadioButton jRadioButtonAdd = null;\r
-\r
- private JRadioButton jRadioButtonSelect = null;\r
-\r
- private JTextField jTextFieldAdd = null;\r
-\r
- private JComboBox jComboBoxSelect = null;\r
-\r
- private JLabel jLabelUsage = null;\r
-\r
- private JComboBox jComboBoxUsage = null;\r
-\r
- private JScrollPane jScrollPane = null;\r
-\r
- private JList jListLibraryClassDefinitions = null;\r
-\r
- private JButton jButtonAdd = null;\r
-\r
- private JButton jButtonRemove = null;\r
-\r
- private JButton jButtonClearAll = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- /**\r
- This method initializes jRadioButtonAdd \r
- \r
- @return javax.swing.JRadioButton jRadioButtonAdd\r
- \r
- **/\r
- private JRadioButton getJRadioButtonAdd() {\r
- if (jRadioButtonAdd == null) {\r
- jRadioButtonAdd = new JRadioButton();\r
- jRadioButtonAdd.setBounds(new java.awt.Rectangle(15, 35, 205, 20));\r
- jRadioButtonAdd.setText("Add a new Library Class");\r
- jRadioButtonAdd.addActionListener(this);\r
- jRadioButtonAdd.setSelected(false);\r
- }\r
- return jRadioButtonAdd;\r
- }\r
-\r
- /**\r
- This method initializes jRadioButtonSelect \r
- \r
- @return javax.swing.JRadioButton jRadioButtonSelect\r
- \r
- **/\r
- private JRadioButton getJRadioButtonSelect() {\r
- if (jRadioButtonSelect == null) {\r
- jRadioButtonSelect = new JRadioButton();\r
- jRadioButtonSelect.setBounds(new java.awt.Rectangle(15, 10, 205, 20));\r
- jRadioButtonSelect.setText("Select an existing Library Class");\r
- jRadioButtonSelect.addActionListener(this);\r
- jRadioButtonSelect.setSelected(true);\r
- }\r
- return jRadioButtonSelect;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldAdd \r
- \r
- @return javax.swing.JTextField jTextFieldAdd\r
- \r
- **/\r
- private JTextField getJTextFieldAdd() {\r
- if (jTextFieldAdd == null) {\r
- jTextFieldAdd = new JTextField();\r
- jTextFieldAdd.setBounds(new java.awt.Rectangle(220, 35, 260, 20));\r
- jTextFieldAdd.setEnabled(false);\r
- }\r
- return jTextFieldAdd;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxSelect \r
- \r
- @return javax.swing.JComboBox jComboBoxSelect\r
- \r
- **/\r
- private JComboBox getJComboBoxSelect() {\r
- if (jComboBoxSelect == null) {\r
- jComboBoxSelect = new JComboBox();\r
- jComboBoxSelect.setBounds(new java.awt.Rectangle(220, 10, 260, 20));\r
- jComboBoxSelect.setEnabled(true);\r
- }\r
- return jComboBoxSelect;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxUsage \r
- \r
- @return javax.swing.JComboBox jComboBoxUsage\r
- \r
- **/\r
- private JComboBox getJComboBoxUsage() {\r
- if (jComboBoxUsage == null) {\r
- jComboBoxUsage = new JComboBox();\r
- jComboBoxUsage.setBounds(new java.awt.Rectangle(220, 60, 260, 20));\r
- }\r
- return jComboBoxUsage;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPane \r
- \r
- @return javax.swing.JScrollPane jScrollPane\r
- \r
- **/\r
- private JScrollPane getJScrollPane() {\r
- if (jScrollPane == null) {\r
- jScrollPane = new JScrollPane();\r
- jScrollPane.setBounds(new java.awt.Rectangle(15, 95, 350, 200));\r
- jScrollPane.setViewportView(getJListLibraryClassDefinitions());\r
- }\r
- return jScrollPane;\r
- }\r
-\r
- /**\r
- This method initializes jListLibraryClassDefinitions \r
- \r
- @return javax.swing.JList jListLibraryClassDefinitions\r
- \r
- **/\r
- private JList getJListLibraryClassDefinitions() {\r
- if (jListLibraryClassDefinitions == null) {\r
- jListLibraryClassDefinitions = new JList(listItem);\r
- }\r
- return jListLibraryClassDefinitions;\r
- }\r
-\r
- /**\r
- This method initializes jButtonAdd \r
- \r
- @return javax.swing.JButton jButtonAdd\r
- \r
- **/\r
- private JButton getJButtonAdd() {\r
- if (jButtonAdd == null) {\r
- jButtonAdd = new JButton();\r
- jButtonAdd.setBounds(new java.awt.Rectangle(380, 115, 90, 20));\r
- jButtonAdd.setText("Add");\r
- jButtonAdd.addActionListener(this);\r
- }\r
- return jButtonAdd;\r
- }\r
-\r
- /**\r
- This method initializes jButtonRemove\r
- \r
- @return javax.swing.JButton jButtonRemove \r
- \r
- **/\r
- private JButton getJButtonRemove() {\r
- if (jButtonRemove == null) {\r
- jButtonRemove = new JButton();\r
- jButtonRemove.setBounds(new java.awt.Rectangle(380, 230, 90, 20));\r
- jButtonRemove.setText("Remove");\r
- jButtonRemove.addActionListener(this);\r
- }\r
- return jButtonRemove;\r
- }\r
-\r
- /**\r
- This method initializes jButtonRemoveAll \r
- \r
- @return javax.swing.JButton jButtonClearAll\r
- \r
- **/\r
- private JButton getJButtonClearAll() {\r
- if (jButtonClearAll == null) {\r
- jButtonClearAll = new JButton();\r
- jButtonClearAll.setBounds(new java.awt.Rectangle(380, 260, 90, 20));\r
- jButtonClearAll.setText("Clear All");\r
- jButtonClearAll.addActionListener(this);\r
- }\r
- return jButtonClearAll;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton jButtonCancel\r
- \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setPreferredSize(new java.awt.Dimension(90, 20));\r
- jButtonCancel.setLocation(new java.awt.Point(390, 305));\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setSize(new java.awt.Dimension(90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton jButtonOk\r
- \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setSize(new java.awt.Dimension(90, 20));\r
- jButtonOk.setText("OK");\r
- jButtonOk.setLocation(new java.awt.Point(290, 305));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- public static void main(String[] args) {\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public ModuleLibraryClassDefinitions() {\r
- super();\r
- init();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inLibraryClassDefinitions The input data of LibraryClassDefinitionsDocument.LibraryClassDefinitions\r
- \r
- **/\r
- public ModuleLibraryClassDefinitions(\r
- LibraryClassDefinitionsDocument.LibraryClassDefinitions inLibraryClassDefinitions) {\r
- super();\r
- init(inLibraryClassDefinitions);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- Fill values to all fields if these values are not empty\r
- \r
- @param inLibraryClassDefinitions The input data of LibraryClassDefinitionsDocument.LibraryClassDefinitions\r
- \r
- **/\r
- private void init(LibraryClassDefinitionsDocument.LibraryClassDefinitions inLibraryClassDefinitions) {\r
- init();\r
- this.setLibraryClassDefinitions(inLibraryClassDefinitions);\r
- if (this.libraryClassDefinitions != null) {\r
- if (this.libraryClassDefinitions.getLibraryClassList().size() > 0) {\r
- for (int index = 0; index < this.libraryClassDefinitions.getLibraryClassList().size(); index++) {\r
- listItem.addElement(this.libraryClassDefinitions.getLibraryClassArray(index).getUsage().toString()\r
- + ModuleLibraryClassDefinitions.Separator\r
- + this.libraryClassDefinitions.getLibraryClassArray(index).getStringValue());\r
- this.libraryClassDefinitions.getLibraryClassList();\r
- }\r
- }\r
- }\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void init() {\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Library Class Definitions");\r
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 515));\r
- //this.centerWindow();\r
- initFrame();\r
- this.setViewMode(false);\r
- }\r
-\r
- /**\r
- Disable all components when the mode is view\r
- \r
- @param isView true - The view mode; false - The non-view mode\r
- \r
- **/\r
- public void setViewMode(boolean isView) {\r
- this.jButtonOk.setVisible(false);\r
- this.jButtonCancel.setVisible(false);\r
- if (isView) {\r
- this.jRadioButtonAdd.setEnabled(!isView);\r
- this.jRadioButtonSelect.setEnabled(!isView);\r
- this.jTextFieldAdd.setEnabled(!isView);\r
- this.jComboBoxSelect.setEnabled(!isView);\r
- this.jComboBoxUsage.setEnabled(!isView);\r
- this.jButtonAdd.setEnabled(!isView);\r
- this.jButtonRemove.setEnabled(!isView);\r
- this.jButtonClearAll.setEnabled(!isView);\r
- this.jButtonCancel.setEnabled(!isView);\r
- this.jButtonOk.setEnabled(!isView);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel jContentPane\r
- \r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabelUsage = new JLabel();\r
- jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 205, 20));\r
- jLabelUsage.setText("Usage");\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(getJRadioButtonAdd(), null);\r
- jContentPane.add(getJRadioButtonSelect(), null);\r
- jContentPane.add(getJTextFieldAdd(), null);\r
- jContentPane.add(getJComboBoxSelect(), null);\r
- jContentPane.add(jLabelUsage, null);\r
- jContentPane.add(getJComboBoxUsage(), null);\r
- jContentPane.add(getJScrollPane(), null);\r
- jContentPane.add(getJButtonAdd(), null);\r
- jContentPane.add(getJButtonRemove(), null);\r
- jContentPane.add(getJButtonClearAll(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes all existing libraries and usage types\r
- \r
- **/\r
- private void initFrame() {\r
- jComboBoxSelect.addItem("BaseCpuICacheFlush");\r
- jComboBoxSelect.addItem("BaseDebugLibNull");\r
- jComboBoxSelect.addItem("BaseDebugLibReportStatusCode");\r
- jComboBoxSelect.addItem("BaseIoLibIntrinsic");\r
- jComboBoxSelect.addItem("BaseLib");\r
- jComboBoxSelect.addItem("BaseMemoryLib");\r
- jComboBoxSelect.addItem("BaseMemoryLibMmx");\r
- jComboBoxSelect.addItem("BaseMemoryLibSse2");\r
- jComboBoxSelect.addItem("BasePeCoffGetEntryPointLib");\r
- jComboBoxSelect.addItem("BasePeCoffLib");\r
- jComboBoxSelect.addItem("BasePrintLib");\r
- jComboBoxSelect.addItem("BaseReportStatusCodeLibNull");\r
- jComboBoxSelect.addItem("CommonPciCf8Lib");\r
- jComboBoxSelect.addItem("CommonPciExpressLib");\r
- jComboBoxSelect.addItem("CommonPciLibCf8");\r
- jComboBoxSelect.addItem("CommonPciLibPciExpress");\r
- jComboBoxSelect.addItem("DxeCoreEntryPoint");\r
- jComboBoxSelect.addItem("DxeHobLib");\r
- jComboBoxSelect.addItem("DxeIoLibCpuIo");\r
- jComboBoxSelect.addItem("DxeLib");\r
- jComboBoxSelect.addItem("DxePcdLib");\r
- jComboBoxSelect.addItem("DxeReportStatusCodeLib");\r
- jComboBoxSelect.addItem("DxeServicesTableLib");\r
- jComboBoxSelect.addItem("PeiCoreEntryPoint");\r
- jComboBoxSelect.addItem("PeiMemoryLib");\r
- jComboBoxSelect.addItem("PeimEntryPoint");\r
- jComboBoxSelect.addItem("PeiReportStatusCodeLib");\r
- jComboBoxSelect.addItem("PeiServicesTablePointerLib");\r
- jComboBoxSelect.addItem("PeiServicesTablePointerLibMm7");\r
- jComboBoxSelect.addItem("UefiDebugLibConOut");\r
- jComboBoxSelect.addItem("UefiDebugLibStdErr");\r
- jComboBoxSelect.addItem("UefiDriverEntryPointMultiple");\r
- jComboBoxSelect.addItem("UefiDriverEntryPointSingle");\r
- jComboBoxSelect.addItem("UefiDriverEntryPointSingleUnload");\r
- jComboBoxSelect.addItem("UefiDriverModelLib");\r
- jComboBoxSelect.addItem("UefiDriverModelLibNoConfigNoDiag");\r
- jComboBoxSelect.addItem("UefiLib");\r
- jComboBoxSelect.addItem("UefiMemoryLib");\r
-\r
- jComboBoxUsage.addItem("ALWAYS_CONSUMED");\r
- jComboBoxUsage.addItem("SOMETIMES_CONSUMED");\r
- jComboBoxUsage.addItem("ALWAYS_PRODUCED");\r
- jComboBoxUsage.addItem("SOMETIMES_PRODUCED");\r
- jComboBoxUsage.addItem("DEFAULT");\r
- jComboBoxUsage.addItem("PRIVATE");\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- *\r
- * Override actionPerformed to listen all actions\r
- * \r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.dispose();\r
- this.setEdited(true);\r
- this.save();\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- this.setEdited(false);\r
- }\r
-\r
- //\r
- // Add current Library and its usage to the list\r
- //\r
- if (arg0.getSource() == jButtonAdd) {\r
- if (!checkAdd()) {\r
- return;\r
- }\r
- String strLibClass = "";\r
- String strUsage = "";\r
- if (jRadioButtonAdd.isSelected()) {\r
- strLibClass = jTextFieldAdd.getText();\r
- }\r
- if (jRadioButtonSelect.isSelected()) {\r
- strLibClass = jComboBoxSelect.getSelectedItem().toString();\r
- }\r
- strUsage = jComboBoxUsage.getSelectedItem().toString();\r
- listItem.addElement(strUsage + ModuleLibraryClassDefinitions.Separator + strLibClass);\r
- }\r
-\r
- //\r
- // Remove current Library and its usage of the list\r
- //\r
- if (arg0.getSource() == jButtonRemove) {\r
- int intSelected[] = jListLibraryClassDefinitions.getSelectedIndices();\r
- if (intSelected.length > 0) {\r
- for (int index = intSelected.length - 1; index > -1; index--) {\r
- listItem.removeElementAt(intSelected[index]);\r
- }\r
- }\r
- jListLibraryClassDefinitions.getSelectionModel().clearSelection();\r
- }\r
-\r
- if (arg0.getSource() == jButtonClearAll) {\r
- listItem.removeAllElements();\r
- }\r
-\r
- //\r
- // Contorl the selected status when click RadionButton\r
- // Do not use Radio Button Group\r
- //\r
- if (arg0.getSource() == jRadioButtonAdd) {\r
- if (jRadioButtonAdd.isSelected()) {\r
- jRadioButtonSelect.setSelected(false);\r
- jTextFieldAdd.setEnabled(true);\r
- jComboBoxSelect.setEnabled(false);\r
- }\r
- if (!jRadioButtonSelect.isSelected() && !jRadioButtonAdd.isSelected()) {\r
- jRadioButtonAdd.setSelected(true);\r
- jTextFieldAdd.setEnabled(true);\r
- jComboBoxSelect.setEnabled(false);\r
- }\r
- }\r
-\r
- if (arg0.getSource() == jRadioButtonSelect) {\r
- if (jRadioButtonSelect.isSelected()) {\r
- jRadioButtonAdd.setSelected(false);\r
- jTextFieldAdd.setEnabled(false);\r
- jComboBoxSelect.setEnabled(true);\r
- }\r
- if (!jRadioButtonSelect.isSelected() && !jRadioButtonAdd.isSelected()) {\r
- jRadioButtonSelect.setSelected(true);\r
- jTextFieldAdd.setEnabled(false);\r
- jComboBoxSelect.setEnabled(true);\r
- }\r
- }\r
- }\r
-\r
- /**\r
- Data validation for all fields\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean check() {\r
- if (listItem.getSize() < 1) {\r
- Log.err("Must have one Library Class at least!");\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- /**\r
- Data validation for all fields\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean checkAdd() {\r
- //\r
- // Check if all required fields are not empty\r
- //\r
- if (this.jRadioButtonAdd.isSelected() && isEmpty(this.jTextFieldAdd.getText())) {\r
- Log.err("Library Class couldn't be empty");\r
- return false;\r
- }\r
-\r
- //\r
- // Check if all fields have correct data types \r
- //\r
- if (this.jRadioButtonAdd.isSelected() && !DataValidation.isLibraryClass(this.jTextFieldAdd.getText())) {\r
- Log.err("Incorrect data type for Library Class");\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- /**\r
- Save all components of Mbd Header\r
- if exists mbdHeader, set the value directly\r
- if not exists mbdHeader, new an instance first\r
- \r
- **/\r
- public void save() {\r
- try {\r
- int intLibraryCount = listItem.getSize();\r
-\r
- if (this.libraryClassDefinitions == null) {\r
- libraryClassDefinitions = LibraryClassDefinitionsDocument.LibraryClassDefinitions.Factory.newInstance();\r
- }\r
-\r
- if (intLibraryCount > 0) {\r
- LibraryClassDocument.LibraryClass mLibraryClass = LibraryClassDocument.LibraryClass.Factory\r
- .newInstance();\r
- for (int index = this.libraryClassDefinitions.getLibraryClassList().size() - 1; index > -1; index--) {\r
- this.libraryClassDefinitions.removeLibraryClass(index);\r
- }\r
- for (int index = 0; index < intLibraryCount; index++) {\r
- String strAll = listItem.get(index).toString();\r
- String strUsage = strAll.substring(0, strAll.indexOf(ModuleLibraryClassDefinitions.Separator));\r
- String strLibraryClass = strAll.substring(strAll.indexOf(ModuleLibraryClassDefinitions.Separator)\r
- + ModuleLibraryClassDefinitions.Separator.length());\r
- mLibraryClass.setStringValue(strLibraryClass);\r
- mLibraryClass.setUsage(LibraryUsage.Enum.forString(strUsage));\r
- this.libraryClassDefinitions.addNewLibraryClass();\r
- this.libraryClassDefinitions.setLibraryClassArray(index, mLibraryClass);\r
- }\r
- } else {\r
- this.libraryClassDefinitions.setNil();\r
- }\r
- } catch (Exception e) {\r
- Log.err("Update Library Class Definitions", e.getMessage());\r
- }\r
- }\r
-\r
- /**\r
- Get LibraryClassDefinitionsDocument.LibraryClassDefinitions\r
- \r
- @return LibraryClassDefinitionsDocument.LibraryClassDefinitions\r
- \r
- **/\r
- public LibraryClassDefinitionsDocument.LibraryClassDefinitions getLibraryClassDefinitions() {\r
- return libraryClassDefinitions;\r
- }\r
-\r
- /**\r
- Set LibraryClassDefinitionsDocument.LibraryClassDefinitions\r
- \r
- @param libraryClassDefinitions The input data of LibraryClassDefinitionsDocument.LibraryClassDefinitions\r
- \r
- **/\r
- public void setLibraryClassDefinitions(\r
- LibraryClassDefinitionsDocument.LibraryClassDefinitions libraryClassDefinitions) {\r
- this.libraryClassDefinitions = libraryClassDefinitions;\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The main GUI for module editor. \r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-\r
-package org.tianocore.packaging.module.ui;\r
-\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.MouseEvent;\r
-import java.awt.event.MouseListener;\r
-import java.awt.event.WindowEvent;\r
-import java.io.File;\r
-import java.io.IOException;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.JDesktopPane;\r
-import javax.swing.JFileChooser;\r
-import javax.swing.JInternalFrame;\r
-import javax.swing.JMenu;\r
-import javax.swing.JMenuBar;\r
-import javax.swing.JMenuItem;\r
-import javax.swing.JOptionPane;\r
-import javax.swing.JPanel;\r
-import javax.swing.JPopupMenu;\r
-import javax.swing.JScrollPane;\r
-import javax.swing.border.BevelBorder;\r
-import javax.swing.event.TreeSelectionEvent;\r
-import javax.swing.event.TreeSelectionListener;\r
-\r
-import org.apache.xmlbeans.XmlCursor;\r
-import org.apache.xmlbeans.XmlException;\r
-import org.apache.xmlbeans.XmlObject;\r
-import org.apache.xmlbeans.XmlOptions;\r
-import org.tianocore.BootModesDocument;\r
-import org.tianocore.BuildOptionsDocument;\r
-import org.tianocore.DataHubsDocument;\r
-import org.tianocore.EventsDocument;\r
-import org.tianocore.ExternsDocument;\r
-import org.tianocore.FormsetsDocument;\r
-import org.tianocore.GuidsDocument;\r
-import org.tianocore.HobsDocument;\r
-import org.tianocore.IncludesDocument;\r
-import org.tianocore.LibrariesDocument;\r
-import org.tianocore.LibraryClassDefinitionsDocument;\r
-import org.tianocore.LibraryModuleBuildDescriptionDocument;\r
-import org.tianocore.LibraryModuleSurfaceAreaDocument;\r
-import org.tianocore.MbdHeaderDocument;\r
-import org.tianocore.MbdLibHeaderDocument;\r
-import org.tianocore.ModuleBuildDescriptionDocument;\r
-import org.tianocore.ModuleSurfaceAreaDocument;\r
-import org.tianocore.MsaHeaderDocument;\r
-import org.tianocore.MsaLibHeaderDocument;\r
-import org.tianocore.PCDsDocument;\r
-import org.tianocore.PPIsDocument;\r
-import org.tianocore.ProtocolsDocument;\r
-import org.tianocore.SourceFilesDocument;\r
-import org.tianocore.SystemTablesDocument;\r
-import org.tianocore.VariablesDocument;\r
-import org.tianocore.common.IFileFilter;\r
-import org.tianocore.common.Log;\r
-import org.tianocore.packaging.common.ui.IDefaultMutableTreeNode;\r
-import org.tianocore.packaging.common.ui.IDesktopManager;\r
-import org.tianocore.packaging.common.ui.IFrame;\r
-import org.tianocore.packaging.common.ui.ITree;\r
-import org.tianocore.packaging.workspace.common.Workspace;\r
-\r
-/**\r
- The class is used to show main GUI of ModuleEditor\r
- It extends IFrame implements MouseListener, TreeSelectionListener\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class ModuleMain extends IFrame implements MouseListener, TreeSelectionListener {\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -7103240960573031772L;\r
-\r
- //\r
- //Define class members\r
- //\r
- private String currentModule = "";\r
-\r
- private String saveFileName = "";\r
-\r
- ///\r
- /// 0 - reserved; 1 - msa; 2 - mbd; 3 - lmsa; 4 - lmbd;\r
- ///\r
- private int currentModuleType = 0;\r
-\r
- private int currentNodeType = -1;\r
-\r
- private String windowTitle = "ModuleEditor 1.0 ";\r
-\r
- private ModuleSurfaceAreaDocument xmlMsaDoc = null;\r
-\r
- private ModuleBuildDescriptionDocument xmlMbdDoc = null;\r
-\r
- private LibraryModuleSurfaceAreaDocument xmlMlsaDoc = null;\r
-\r
- private LibraryModuleBuildDescriptionDocument xmlMlbdDoc = null;\r
-\r
- private MsaHeaderDocument.MsaHeader xmlmh = null;\r
-\r
- private MbdHeaderDocument.MbdHeader xmlmbdh = null;\r
-\r
- private MsaLibHeaderDocument.MsaLibHeader xmlmlh = null;\r
-\r
- private MbdLibHeaderDocument.MbdLibHeader xmlmlbdh = null;\r
-\r
- private LibraryClassDefinitionsDocument.LibraryClassDefinitions xmllcd = null;\r
-\r
- private LibrariesDocument.Libraries xmllib = null;\r
-\r
- private SourceFilesDocument.SourceFiles xmlsf = null;\r
-\r
- private IncludesDocument.Includes xmlic = null;\r
-\r
- private ProtocolsDocument.Protocols xmlpl = null;\r
-\r
- private EventsDocument.Events xmlen = null;\r
-\r
- private HobsDocument.Hobs xmlhob = null;\r
-\r
- private PPIsDocument.PPIs xmlppi = null;\r
-\r
- private VariablesDocument.Variables xmlvb = null;\r
-\r
- private BootModesDocument.BootModes xmlbm = null;\r
-\r
- private SystemTablesDocument.SystemTables xmlst = null;\r
-\r
- private DataHubsDocument.DataHubs xmldh = null;\r
-\r
- private FormsetsDocument.Formsets xmlfs = null;\r
-\r
- private GuidsDocument.Guids xmlgu = null;\r
-\r
- private ExternsDocument.Externs xmlet = null;\r
-\r
- private PCDsDocument.PCDs xmlpcd = null;\r
-\r
- private BuildOptionsDocument.BuildOptions xmlbo = null;\r
-\r
- IDefaultMutableTreeNode dmtnRoot = null;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JMenuBar jMenuBar = null;\r
-\r
- private JMenu jMenuModule = null;\r
-\r
- private JMenu jMenuModuleNew = null;\r
-\r
- private JMenuItem jMenuItemModuleNewModule = null;\r
-\r
- private JMenuItem jMenuItemModuleSaveAs = null;\r
-\r
- private JMenuItem jMenuItemModuleExit = null;\r
-\r
- private JMenu jMenuEdit = null;\r
-\r
- private JMenuItem jMenuItemEditAddLibraryClassDefinitions = null;\r
-\r
- private JMenuItem jMenuItemEditAddSourceFiles = null;\r
-\r
- private JMenuItem jMenuItemEditAddIncludes = null;\r
-\r
- private JMenuItem jMenuItemEditAddProtocols = null;\r
-\r
- private JMenuItem jMenuItemEditAddEvents = null;\r
-\r
- private JMenuItem jMenuItemEditAddHobs = null;\r
-\r
- private JMenuItem jMenuItemEditAddPPIs = null;\r
-\r
- private JMenuItem jMenuItemEditAddVariables = null;\r
-\r
- private JMenuItem jMenuItemEditAddBootModes = null;\r
-\r
- private JMenuItem jMenuItemEditAddSystemTables = null;\r
-\r
- private JMenuItem jMenuItemEditAddDataHubs = null;\r
-\r
- private JMenuItem jMenuItemEditAddFormsets = null;\r
-\r
- private JMenuItem jMenuItemEditAddGuids = null;\r
-\r
- private JMenuItem jMenuItemEditAddExterns = null;\r
-\r
- private JMenuItem jMenuItemEditAddPCDs = null;\r
-\r
- private JDesktopPane jDesktopPane = null;\r
-\r
- private IDesktopManager iDesktopManager = new IDesktopManager();\r
-\r
- private JScrollPane jScrollPaneTree = null;\r
-\r
- private ITree iTree = null;\r
-\r
- private JMenu jMenuHelp = null;\r
-\r
- private JMenuItem jMenuItemHelpAbout = null;\r
-\r
- private JMenu jMenuEditAdd = null;\r
-\r
- private JMenuItem jMenuItemEditDelete = null;\r
-\r
- private JMenuItem jMenuItemEditUpdate = null;\r
-\r
- private JPopupMenu jPopupMenu = null;\r
-\r
- private JMenuItem jMenuItemPopupAdd = null;\r
-\r
- private JMenuItem jMenuItemPopupUpdate = null;\r
-\r
- private JMenuItem jMenuItemPopupDelete = null;\r
-\r
- private Workspace ws = new Workspace();\r
-\r
- private static final int OPENED = 0;\r
-\r
- private static final int CLOSED = 1;\r
-\r
- private static final int NEW_WITHOUT_CHANGE = 2;\r
-\r
- private static final int NEW_WITH_CHANGE = 3;\r
-\r
- private static final int UPDATE_WITHOUT_CHANGE = 4;\r
-\r
- private static final int UPDATE_WITH_CHANGE = 5;\r
-\r
- private static final int SAVE_WITHOUT_CHANGE = 6;\r
-\r
- private static final int SAVE_WITH_CHANGE = 7;\r
-\r
- private static final int ADD = 1;\r
-\r
- private static final int UPDATE = 2;\r
-\r
- //private static final int DELETE = 3;\r
-\r
- private static final int VIEW = 4;\r
-\r
- private MsaHeader msa = null;\r
-\r
- private MbdHeader mbd = null;\r
-\r
- private MsaLibHeader mlsa = null;\r
-\r
- private MbdLibHeader mlbd = null;\r
-\r
- private ModuleLibraryClassDefinitions mlcd = null;\r
-\r
- private MbdLibraries mlib = null;\r
-\r
- private ModuleSourceFiles msf = null;\r
-\r
- private ModuleIncludes mic = null;\r
-\r
- private ModuleProtocols mp = null;\r
-\r
- private ModuleEvents mev = null;\r
-\r
- private ModuleHobs mh = null;\r
-\r
- private ModulePpis mpp = null;\r
-\r
- private ModuleVariables mv = null;\r
-\r
- private ModuleBootModes mbm = null;\r
-\r
- private ModuleSystemTables mst = null;\r
-\r
- private ModuleDataHubs mdh = null;\r
-\r
- private ModuleFormsets mf = null;\r
-\r
- private ModuleGuids mg = null;\r
-\r
- private ModuleExterns met = null;\r
-\r
- private ModulePCDs mpcd = null;\r
-\r
- private JMenuItem jMenuItemModuleOpenModule = null;\r
-\r
- private JMenuItem jMenuItemModuleNewModuleBuildDescription = null;\r
-\r
- private JMenuItem jMenuItemModuleNewLibraryModule = null;\r
-\r
- private JMenuItem jMenuItemModuleNewLibraryModuleBuildDescription = null;\r
-\r
- private JMenu jMenuModuleOpen = null;\r
-\r
- private JMenuItem jMenuItemModuleOpenModuleBuildDescription = null;\r
-\r
- private JMenuItem jMenuItemModuleOpenLibraryModule = null;\r
-\r
- private JMenuItem jMenuItemModuleOpenLibraryModuleBuildDescription = null;\r
-\r
- private JMenuItem jMenuItemModuleSave = null;\r
-\r
- private JMenuItem jMenuItemModuleClose = null;\r
-\r
- private JMenu jMenuTools = null;\r
-\r
- private JMenu jMenuWindow = null;\r
-\r
- private JMenuItem jMenuItemEditAddLibraries = null;\r
-\r
- private JPanel jPanelOperation = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- /**\r
- This method initializes jMenuBar \r
- \r
- @return javax.swing.JMenuBar Main menu bar for the entire GUI\r
- \r
- **/\r
- private JMenuBar getjJMenuBar() {\r
- if (jMenuBar == null) {\r
- jMenuBar = new JMenuBar();\r
- jMenuBar.setPreferredSize(new java.awt.Dimension(0, 18));\r
- jMenuBar.add(getJMenuModule());\r
- jMenuBar.add(getJMenuEdit());\r
- jMenuBar.add(getJMenuTools());\r
- jMenuBar.add(getJMenuWindow());\r
- jMenuBar.add(getJMenuHelp());\r
- }\r
- return jMenuBar;\r
- }\r
-\r
- /**\r
- This method initializes jMenuFile \r
- \r
- @return javax.swing.JMenu jMenuModule\r
- \r
- **/\r
- private JMenu getJMenuModule() {\r
- if (jMenuModule == null) {\r
- jMenuModule = new JMenu();\r
- jMenuModule.setText("Module");\r
- jMenuModule.add(getJMenuModuleNew());\r
- jMenuModule.addSeparator();\r
- jMenuModule.add(getJMenuModuleOpen());\r
- jMenuModule.addSeparator();\r
- jMenuModule.add(getJMenuItemModuleSave());\r
- jMenuModule.add(getJMenuItemModuleSaveAs());\r
- jMenuModule.addSeparator();\r
- jMenuModule.add(getJMenuItemModuleClose());\r
- jMenuModule.addSeparator();\r
- jMenuModule.add(getJMenuItemModuleExit());\r
- }\r
- return jMenuModule;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemModuleNewModule \r
- \r
- @return javax.swing.JMenuItem jMenuItemModuleNewModule\r
- \r
- **/\r
- private JMenuItem getJMenuItemModuleNewModule() {\r
- if (jMenuItemModuleNewModule == null) {\r
- jMenuItemModuleNewModule = new JMenuItem();\r
- jMenuItemModuleNewModule.setText("Module (.msa)");\r
- jMenuItemModuleNewModule.addActionListener(this);\r
- }\r
- return jMenuItemModuleNewModule;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemModuleSaveAs \r
- \r
- @return javax.swing.JMenuItem jMenuItemModuleSaveAs\r
- \r
- **/\r
- private JMenuItem getJMenuItemModuleSaveAs() {\r
- if (jMenuItemModuleSaveAs == null) {\r
- jMenuItemModuleSaveAs = new JMenuItem();\r
- jMenuItemModuleSaveAs.setText("Save As...");\r
- jMenuItemModuleSaveAs.addActionListener(this);\r
- jMenuItemModuleSaveAs.setEnabled(false);\r
- }\r
- return jMenuItemModuleSaveAs;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemModuleExit \r
- \r
- @return javax.swing.JMenuItem jMenuItemModuleExit\r
- \r
- **/\r
- private JMenuItem getJMenuItemModuleExit() {\r
- if (jMenuItemModuleExit == null) {\r
- jMenuItemModuleExit = new JMenuItem();\r
- jMenuItemModuleExit.setText("Exit");\r
- jMenuItemModuleExit.addActionListener(this);\r
- }\r
- return jMenuItemModuleExit;\r
- }\r
-\r
- /**\r
- This method initializes jMenuEdit \r
- \r
- @return javax.swing.JMenu jMenuEdit\r
- \r
- **/\r
- private JMenu getJMenuEdit() {\r
- if (jMenuEdit == null) {\r
- jMenuEdit = new JMenu();\r
- jMenuEdit.setText("Edit");\r
- jMenuEdit.add(getJMenu());\r
- jMenuEdit.add(getJMenuItemEditUpdate());\r
- jMenuEdit.add(getJMenuItemEditDelete());\r
- }\r
- return jMenuEdit;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemEditAddLibraryClassDefinitions \r
- \r
- @return javax.swing.JMenuItem jMenuItemEditAddLibraryClassDefinitions\r
- \r
- **/\r
- private JMenuItem getJMenuItemEditAddLibraryClassDefinitions() {\r
- if (jMenuItemEditAddLibraryClassDefinitions == null) {\r
- jMenuItemEditAddLibraryClassDefinitions = new JMenuItem();\r
- jMenuItemEditAddLibraryClassDefinitions.setText("Library Class Definitions");\r
- jMenuItemEditAddLibraryClassDefinitions.addActionListener(this);\r
- }\r
- return jMenuItemEditAddLibraryClassDefinitions;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemEditAddSourceFiles \r
- \r
- @return javax.swing.JMenuItem jMenuItemEditAddSourceFiles\r
- \r
- **/\r
- private JMenuItem getJMenuItemEditAddSourceFiles() {\r
- if (jMenuItemEditAddSourceFiles == null) {\r
- jMenuItemEditAddSourceFiles = new JMenuItem();\r
- jMenuItemEditAddSourceFiles.setText("Source Files");\r
- jMenuItemEditAddSourceFiles.addActionListener(this);\r
- }\r
- return jMenuItemEditAddSourceFiles;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemEditAddIncludes \r
- \r
- @return javax.swing.JMenuItem jMenuItemEditAddIncludes\r
- \r
- **/\r
- private JMenuItem getJMenuItemEditAddIncludes() {\r
- if (jMenuItemEditAddIncludes == null) {\r
- jMenuItemEditAddIncludes = new JMenuItem();\r
- jMenuItemEditAddIncludes.setText("Includes");\r
- jMenuItemEditAddIncludes.addActionListener(this);\r
- }\r
- return jMenuItemEditAddIncludes;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemEditAddProtocols \r
- \r
- @return javax.swing.JMenuItem jMenuItemEditAddProtocols\r
- \r
- **/\r
- private JMenuItem getJMenuItemEditAddProtocols() {\r
- if (jMenuItemEditAddProtocols == null) {\r
- jMenuItemEditAddProtocols = new JMenuItem();\r
- jMenuItemEditAddProtocols.setText("Protocols");\r
- jMenuItemEditAddProtocols.addActionListener(this);\r
- }\r
- return jMenuItemEditAddProtocols;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemEditAddEvents \r
- \r
- @return javax.swing.JMenuItem jMenuItemEditAddEvents\r
- \r
- **/\r
- private JMenuItem getJMenuItemEditAddEvents() {\r
- if (jMenuItemEditAddEvents == null) {\r
- jMenuItemEditAddEvents = new JMenuItem();\r
- jMenuItemEditAddEvents.setText("Events");\r
- jMenuItemEditAddEvents.addActionListener(this);\r
- }\r
- return jMenuItemEditAddEvents;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemEditAddHobs \r
- \r
- @return javax.swing.JMenuItem jMenuItemEditAddHobs\r
- \r
- **/\r
- private JMenuItem getJMenuItemEditAddHobs() {\r
- if (jMenuItemEditAddHobs == null) {\r
- jMenuItemEditAddHobs = new JMenuItem();\r
- jMenuItemEditAddHobs.setText("Hobs");\r
- jMenuItemEditAddHobs.addActionListener(this);\r
- }\r
- return jMenuItemEditAddHobs;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemEditAddPPIs \r
- \r
- @return javax.swing.JMenuItem jMenuItemEditAddPPIs\r
- \r
- **/\r
- private JMenuItem getJMenuItemEditAddPPIs() {\r
- if (jMenuItemEditAddPPIs == null) {\r
- jMenuItemEditAddPPIs = new JMenuItem();\r
- jMenuItemEditAddPPIs.setText("PPIs");\r
- jMenuItemEditAddPPIs.addActionListener(this);\r
- }\r
- return jMenuItemEditAddPPIs;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemEditAddVariables \r
- \r
- @return javax.swing.JMenuItem jMenuItemEditAddVariables\r
- \r
- **/\r
- private JMenuItem getJMenuItemEditAddVariables() {\r
- if (jMenuItemEditAddVariables == null) {\r
- jMenuItemEditAddVariables = new JMenuItem();\r
- jMenuItemEditAddVariables.setText("Variables");\r
- jMenuItemEditAddVariables.addActionListener(this);\r
- }\r
- return jMenuItemEditAddVariables;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemEditAddBootModes \r
- \r
- @return javax.swing.JMenuItem jMenuItemEditAddBootModes\r
- \r
- **/\r
- private JMenuItem getJMenuItemAddBootModes() {\r
- if (jMenuItemEditAddBootModes == null) {\r
- jMenuItemEditAddBootModes = new JMenuItem();\r
- jMenuItemEditAddBootModes.setText("Boot Modes");\r
- jMenuItemEditAddBootModes.addActionListener(this);\r
- }\r
- return jMenuItemEditAddBootModes;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemEditAddSystemTables \r
- \r
- @return javax.swing.JMenuItem jMenuItemEditAddSystemTables\r
- \r
- **/\r
- private JMenuItem getJMenuItemAddSystemTables() {\r
- if (jMenuItemEditAddSystemTables == null) {\r
- jMenuItemEditAddSystemTables = new JMenuItem();\r
- jMenuItemEditAddSystemTables.setText("System Tables");\r
- jMenuItemEditAddSystemTables.addActionListener(this);\r
- }\r
- return jMenuItemEditAddSystemTables;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemEditAddDataHubs \r
- \r
- @return javax.swing.JMenuItem jMenuItemEditAddDataHubs\r
- \r
- **/\r
- private JMenuItem getJMenuItemEditAddDataHubs() {\r
- if (jMenuItemEditAddDataHubs == null) {\r
- jMenuItemEditAddDataHubs = new JMenuItem();\r
- jMenuItemEditAddDataHubs.setText("Data Hubs");\r
- jMenuItemEditAddDataHubs.addActionListener(this);\r
- }\r
- return jMenuItemEditAddDataHubs;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemEditAddFormsets \r
- \r
- @return javax.swing.JMenuItem jMenuItemEditAddFormsets\r
- \r
- **/\r
- private JMenuItem getJMenuItemEditAddFormsets() {\r
- if (jMenuItemEditAddFormsets == null) {\r
- jMenuItemEditAddFormsets = new JMenuItem();\r
- jMenuItemEditAddFormsets.setText("Formsets");\r
- jMenuItemEditAddFormsets.addActionListener(this);\r
- }\r
- return jMenuItemEditAddFormsets;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemEditAddGuids \r
- \r
- @return javax.swing.JMenuItem jMenuItemEditAddGuids\r
- \r
- **/\r
- private JMenuItem getJMenuItemEditAddGuids() {\r
- if (jMenuItemEditAddGuids == null) {\r
- jMenuItemEditAddGuids = new JMenuItem();\r
- jMenuItemEditAddGuids.setText("Guids");\r
- jMenuItemEditAddGuids.addActionListener(this);\r
- }\r
- return jMenuItemEditAddGuids;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemEditAddExterns \r
- \r
- @return javax.swing.JMenuItem jMenuItemEditAddExterns\r
- \r
- **/\r
- private JMenuItem getJMenuItemEditAddExterns() {\r
- if (jMenuItemEditAddExterns == null) {\r
- jMenuItemEditAddExterns = new JMenuItem();\r
- jMenuItemEditAddExterns.setText("Externs");\r
- jMenuItemEditAddExterns.addActionListener(this);\r
- }\r
- return jMenuItemEditAddExterns;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemEditAddPCDs \r
- \r
- @return javax.swing.JMenuItem jMenuItemEditAddPCDs\r
- \r
- **/\r
- private JMenuItem getJMenuItemEditAddPCDs() {\r
- if (jMenuItemEditAddPCDs == null) {\r
- jMenuItemEditAddPCDs = new JMenuItem();\r
- jMenuItemEditAddPCDs.setText("PCDs");\r
- jMenuItemEditAddPCDs.addActionListener(this);\r
- }\r
- return jMenuItemEditAddPCDs;\r
- }\r
-\r
- /**\r
- This method initializes jDesktopPane \r
- \r
- @return javax.swing.JDesktopPane jDesktopPane\r
- \r
- **/\r
- private JDesktopPane getJDesktopPane() {\r
- if (jDesktopPane == null) {\r
- jDesktopPane = new JDesktopPane();\r
- jDesktopPane.setBounds(new java.awt.Rectangle(295, 1, 500, 515));\r
- jDesktopPane.setDesktopManager(iDesktopManager);\r
- }\r
- return jDesktopPane;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPaneTree \r
- \r
- @return javax.swing.JScrollPane jScrollPaneTree\r
- \r
- **/\r
- private JScrollPane getJScrollPaneTree() {\r
- if (jScrollPaneTree == null) {\r
- jScrollPaneTree = new JScrollPane();\r
- jScrollPaneTree.setBounds(new java.awt.Rectangle(0, 1, 290, 545));\r
- jScrollPaneTree.setViewportView(getITree());\r
- }\r
- return jScrollPaneTree;\r
- }\r
-\r
- /**\r
- This method initializes iTree \r
- \r
- @return org.tianocore.packaging.common.ui.ITree iTree\r
- \r
- **/\r
- private ITree getITree() {\r
- //\r
- //Before open a real module, use an empty root node for the tree\r
- //\r
- IDefaultMutableTreeNode root = new IDefaultMutableTreeNode("No Msa/Mbd file opened", -1, -1);\r
- iTree = new ITree(root);\r
- return iTree;\r
- }\r
-\r
- /**\r
- This method initializes jMenuHelp \r
- \r
- @return javax.swing.JMenu jMenuHelp\r
- \r
- **/\r
- private JMenu getJMenuHelp() {\r
- if (jMenuHelp == null) {\r
- jMenuHelp = new JMenu();\r
- jMenuHelp.setText("Help");\r
- jMenuHelp.add(getJMenuItemHelpAbout());\r
- }\r
- return jMenuHelp;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemHelpAbout \r
- \r
- @return javax.swing.JMenuItem jMenuItemHelpAbout\r
- \r
- **/\r
- private JMenuItem getJMenuItemHelpAbout() {\r
- if (jMenuItemHelpAbout == null) {\r
- jMenuItemHelpAbout = new JMenuItem();\r
- jMenuItemHelpAbout.setText("About...");\r
- jMenuItemHelpAbout.addActionListener(this);\r
- }\r
- return jMenuItemHelpAbout;\r
- }\r
-\r
- /**\r
- This method initializes jMenuEditAdd \r
- \r
- @return javax.swing.JMenu jMenuEditAdd\r
- \r
- **/\r
- private JMenu getJMenu() {\r
- if (jMenuEditAdd == null) {\r
- jMenuEditAdd = new JMenu();\r
- jMenuEditAdd.setText("Add");\r
- //\r
- //Add all menu items of menu "Add"\r
- //\r
- jMenuEditAdd.add(getJMenuItemEditAddLibraries());\r
- jMenuEditAdd.add(getJMenuItemEditAddLibraryClassDefinitions());\r
- jMenuEditAdd.add(getJMenuItemEditAddSourceFiles());\r
- jMenuEditAdd.add(getJMenuItemEditAddIncludes());\r
- jMenuEditAdd.add(getJMenuItemEditAddProtocols());\r
- jMenuEditAdd.add(getJMenuItemEditAddEvents());\r
- jMenuEditAdd.add(getJMenuItemEditAddHobs());\r
- jMenuEditAdd.add(getJMenuItemEditAddPPIs());\r
- jMenuEditAdd.add(getJMenuItemEditAddVariables());\r
- jMenuEditAdd.add(getJMenuItemAddBootModes());\r
- jMenuEditAdd.add(getJMenuItemAddSystemTables());\r
- jMenuEditAdd.add(getJMenuItemEditAddDataHubs());\r
- jMenuEditAdd.add(getJMenuItemEditAddFormsets());\r
- jMenuEditAdd.add(getJMenuItemEditAddGuids());\r
- jMenuEditAdd.add(getJMenuItemEditAddExterns());\r
- jMenuEditAdd.add(getJMenuItemEditAddPCDs());\r
- jMenuEditAdd.setEnabled(false);\r
- }\r
- return jMenuEditAdd;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemEditDelete \r
- \r
- @return javax.swing.JMenuItem jMenuItemEditDelete\r
- \r
- **/\r
- private JMenuItem getJMenuItemEditDelete() {\r
- if (jMenuItemEditDelete == null) {\r
- jMenuItemEditDelete = new JMenuItem();\r
- jMenuItemEditDelete.setText("Delete");\r
- jMenuItemEditDelete.addActionListener(this);\r
- //\r
- //Disabled when no module is open\r
- //\r
- jMenuItemEditDelete.setEnabled(false);\r
- }\r
- return jMenuItemEditDelete;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemEditUpdate \r
- \r
- @return javax.swing.JMenuItem jMenuItemEditUpdate\r
- \r
- **/\r
- private JMenuItem getJMenuItemEditUpdate() {\r
- if (jMenuItemEditUpdate == null) {\r
- jMenuItemEditUpdate = new JMenuItem();\r
- jMenuItemEditUpdate.setText("Update");\r
- jMenuItemEditUpdate.addActionListener(this);\r
- //\r
- //Disabled when no module is open\r
- //\r
- jMenuItemEditUpdate.setEnabled(false);\r
- }\r
- return jMenuItemEditUpdate;\r
- }\r
-\r
- /**\r
- This method initializes jPopupMenu \r
- \r
- @return javax.swing.JPopupMenu jPopupMenu\r
- \r
- **/\r
- private JPopupMenu getJPopupMenu() {\r
- if (jPopupMenu == null) {\r
- jPopupMenu = new JPopupMenu();\r
- //\r
- //Add menu items of popup menu\r
- //\r
- jPopupMenu.add(getJMenuItemPopupAdd());\r
- jPopupMenu.add(getJMenuItemPopupUpdate());\r
- jPopupMenu.add(getJMenuItemPopupDelete());\r
- jPopupMenu.setBorder(new BevelBorder(BevelBorder.RAISED));\r
- jPopupMenu.addMouseListener(this);\r
- }\r
- return jPopupMenu;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemPopupAdd \r
- \r
- @return javax.swing.JMenuItem jMenuItemPopupAdd\r
- \r
- **/\r
- private JMenuItem getJMenuItemPopupAdd() {\r
- if (jMenuItemPopupAdd == null) {\r
- jMenuItemPopupAdd = new JMenuItem();\r
- jMenuItemPopupAdd.setText("Add");\r
- jMenuItemPopupAdd.addActionListener(this);\r
- jMenuItemPopupAdd.setEnabled(false);\r
- }\r
- return jMenuItemPopupAdd;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemPopupUpdate \r
- \r
- @return javax.swing.JMenuItem jMenuItemPopupUpdate\r
- \r
- **/\r
- private JMenuItem getJMenuItemPopupUpdate() {\r
- if (jMenuItemPopupUpdate == null) {\r
- jMenuItemPopupUpdate = new JMenuItem();\r
- jMenuItemPopupUpdate.setText("Update");\r
- jMenuItemPopupUpdate.addActionListener(this);\r
- jMenuItemPopupUpdate.setEnabled(false);\r
- }\r
- return jMenuItemPopupUpdate;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemPopupDelete \r
- \r
- @return javax.swing.JMenuItem jMenuItemPopupDelete\r
- \r
- **/\r
- private JMenuItem getJMenuItemPopupDelete() {\r
- if (jMenuItemPopupDelete == null) {\r
- jMenuItemPopupDelete = new JMenuItem();\r
- jMenuItemPopupDelete.setText("Delete");\r
- jMenuItemPopupDelete.addActionListener(this);\r
- jMenuItemPopupDelete.setEnabled(false);\r
- }\r
- return jMenuItemPopupDelete;\r
- }\r
-\r
- /**\r
- This method initializes jMenuModuleNew \r
- \r
- @return javax.swing.JMenu jMenuModuleNew\r
- \r
- **/\r
- private JMenu getJMenuModuleNew() {\r
- if (jMenuModuleNew == null) {\r
- jMenuModuleNew = new JMenu();\r
- jMenuModuleNew.setText("New");\r
- jMenuModuleNew.add(getJMenuItemModuleNewModule());\r
- jMenuModuleNew.add(getJMenuItemModuleNewModuleBuildDescription());\r
- jMenuModuleNew.add(getJMenuItemModuleNewLibraryModule());\r
- jMenuModuleNew.add(getJMenuItemModuleNewLibraryModuleBuildDescription());\r
- }\r
- return jMenuModuleNew;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemModuleOpenModule \r
- \r
- @return javax.swing.JMenuItem jMenuItemModuleOpenModule\r
- \r
- **/\r
- private JMenuItem getJMenuItemModuleOpenModule() {\r
- if (jMenuItemModuleOpenModule == null) {\r
- jMenuItemModuleOpenModule = new JMenuItem();\r
- jMenuItemModuleOpenModule.setText("Module (.msa)");\r
- jMenuItemModuleOpenModule.addActionListener(this);\r
- }\r
- return jMenuItemModuleOpenModule;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemFileNewModuleBuildDescription \r
- \r
- @return javax.swing.JMenuItem jMenuItemModuleNewModuleBuildDescription\r
- \r
- **/\r
- private JMenuItem getJMenuItemModuleNewModuleBuildDescription() {\r
- if (jMenuItemModuleNewModuleBuildDescription == null) {\r
- jMenuItemModuleNewModuleBuildDescription = new JMenuItem();\r
- jMenuItemModuleNewModuleBuildDescription.setText("Module Build Description (.mbd)");\r
- jMenuItemModuleNewModuleBuildDescription.addActionListener(this);\r
- }\r
- return jMenuItemModuleNewModuleBuildDescription;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemFileNewLibraryModule \r
- \r
- @return javax.swing.JMenuItem jMenuItemModuleNewLibraryModule\r
- \r
- **/\r
- private JMenuItem getJMenuItemModuleNewLibraryModule() {\r
- if (jMenuItemModuleNewLibraryModule == null) {\r
- jMenuItemModuleNewLibraryModule = new JMenuItem();\r
- jMenuItemModuleNewLibraryModule.setText("Library Module (*.msa)");\r
- jMenuItemModuleNewLibraryModule.addActionListener(this);\r
- }\r
- return jMenuItemModuleNewLibraryModule;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemFileNewLibraryModuleBuildDescription \r
- \r
- @return javax.swing.JMenuItem jMenuItemModuleNewLibraryModuleBuildDescription\r
- \r
- **/\r
- private JMenuItem getJMenuItemModuleNewLibraryModuleBuildDescription() {\r
- if (jMenuItemModuleNewLibraryModuleBuildDescription == null) {\r
- jMenuItemModuleNewLibraryModuleBuildDescription = new JMenuItem();\r
- jMenuItemModuleNewLibraryModuleBuildDescription.setText("Library Module Build Description (.mbd)");\r
- jMenuItemModuleNewLibraryModuleBuildDescription.addActionListener(this);\r
- }\r
- return jMenuItemModuleNewLibraryModuleBuildDescription;\r
- }\r
-\r
- /**\r
- This method initializes jMenuOpen \r
- \r
- @return javax.swing.JMenu jMenuModuleOpen\r
- \r
- **/\r
- private JMenu getJMenuModuleOpen() {\r
- if (jMenuModuleOpen == null) {\r
- jMenuModuleOpen = new JMenu();\r
- jMenuModuleOpen.setText("Open");\r
- jMenuModuleOpen.add(getJMenuItemModuleOpenModule());\r
- jMenuModuleOpen.add(getJMenuItemModuleOpenModuleBuildDescription());\r
- jMenuModuleOpen.add(getJMenuItemModuleOpenLibraryModule());\r
- jMenuModuleOpen.add(getJMenuItemModuleOpenLibraryModuleBuildDescription());\r
- }\r
- return jMenuModuleOpen;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemFileOpenModuleBuildDescription \r
- \r
- @return javax.swing.JMenuItem jMenuItemModuleOpenModuleBuildDescription\r
- \r
- **/\r
- private JMenuItem getJMenuItemModuleOpenModuleBuildDescription() {\r
- if (jMenuItemModuleOpenModuleBuildDescription == null) {\r
- jMenuItemModuleOpenModuleBuildDescription = new JMenuItem();\r
- jMenuItemModuleOpenModuleBuildDescription.setText("Module Build Description (.mbd)");\r
- jMenuItemModuleOpenModuleBuildDescription.addActionListener(this);\r
- }\r
- return jMenuItemModuleOpenModuleBuildDescription;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemFileOpenLibraryModule \r
- \r
- @return javax.swing.JMenuItem jMenuItemModuleOpenLibraryModule\r
- \r
- **/\r
- private JMenuItem getJMenuItemModuleOpenLibraryModule() {\r
- if (jMenuItemModuleOpenLibraryModule == null) {\r
- jMenuItemModuleOpenLibraryModule = new JMenuItem();\r
- jMenuItemModuleOpenLibraryModule.setText("Library Module (.msa)");\r
- jMenuItemModuleOpenLibraryModule.addActionListener(this);\r
- }\r
- return jMenuItemModuleOpenLibraryModule;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemFileOpenLibraryModuleBuildDescription \r
- \r
- @return javax.swing.JMenuItem jMenuItemModuleOpenLibraryModuleBuildDescription\r
- \r
- **/\r
- private JMenuItem getJMenuItemModuleOpenLibraryModuleBuildDescription() {\r
- if (jMenuItemModuleOpenLibraryModuleBuildDescription == null) {\r
- jMenuItemModuleOpenLibraryModuleBuildDescription = new JMenuItem();\r
- jMenuItemModuleOpenLibraryModuleBuildDescription.setText("Library Module Build Description (.mbd)");\r
- jMenuItemModuleOpenLibraryModuleBuildDescription.addActionListener(this);\r
- }\r
- return jMenuItemModuleOpenLibraryModuleBuildDescription;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemFileSave \r
- \r
- @return javax.swing.JMenuItem jMenuItemModuleSave\r
- \r
- **/\r
- private JMenuItem getJMenuItemModuleSave() {\r
- if (jMenuItemModuleSave == null) {\r
- jMenuItemModuleSave = new JMenuItem();\r
- jMenuItemModuleSave.setText("Save");\r
- jMenuItemModuleSave.addActionListener(this);\r
- jMenuItemModuleSave.setEnabled(false);\r
- }\r
- return jMenuItemModuleSave;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemModuleClose \r
- \r
- @return javax.swing.JMenuItem jMenuItemModuleClose\r
- \r
- **/\r
- private JMenuItem getJMenuItemModuleClose() {\r
- if (jMenuItemModuleClose == null) {\r
- jMenuItemModuleClose = new JMenuItem();\r
- jMenuItemModuleClose.setText("Close");\r
- jMenuItemModuleClose.setEnabled(false);\r
- jMenuItemModuleClose.addActionListener(this);\r
- }\r
- return jMenuItemModuleClose;\r
- }\r
-\r
- /**\r
- This method initializes jMenuTools\r
- Reserved \r
- \r
- @return javax.swing.JMenu jMenuTools\r
- \r
- **/\r
- private JMenu getJMenuTools() {\r
- if (jMenuTools == null) {\r
- jMenuTools = new JMenu();\r
- jMenuTools.setText("Tools");\r
- jMenuTools.addActionListener(this);\r
- jMenuTools.setEnabled(false);\r
- }\r
- return jMenuTools;\r
- }\r
-\r
- /**\r
- This method initializes jMenuWindow \r
- Reserved\r
- \r
- @return javax.swing.JMenu jMenuWindow\r
- \r
- **/\r
- private JMenu getJMenuWindow() {\r
- if (jMenuWindow == null) {\r
- jMenuWindow = new JMenu();\r
- jMenuWindow.setText("Window");\r
- jMenuWindow.setEnabled(false);\r
- jMenuWindow.addActionListener(this);\r
- }\r
- return jMenuWindow;\r
- }\r
-\r
- /**\r
- This method initializes jMenuItemEditAddLibraries \r
- \r
- @return javax.swing.JMenuItem jMenuItemEditAddLibraries\r
- \r
- **/\r
- private JMenuItem getJMenuItemEditAddLibraries() {\r
- if (jMenuItemEditAddLibraries == null) {\r
- jMenuItemEditAddLibraries = new JMenuItem();\r
- jMenuItemEditAddLibraries.setText("Libraries");\r
- jMenuItemEditAddLibraries.addActionListener(this);\r
- }\r
- return jMenuItemEditAddLibraries;\r
- }\r
-\r
- /**\r
- This method initializes jPanelOperation \r
- \r
- @return javax.swing.JPanel jPanelOperation\r
- \r
- **/\r
- private JPanel getJPanelOperation() {\r
- if (jPanelOperation == null) {\r
- jPanelOperation = new JPanel();\r
- jPanelOperation.setLayout(null);\r
- jPanelOperation.setBounds(new java.awt.Rectangle(295, 520, 500, 25));\r
- jPanelOperation.add(getJButtonOk(), null);\r
- jPanelOperation.add(getJButtonCancel(), null);\r
- }\r
- return jPanelOperation;\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton jButtonOk\r
- \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setBounds(new java.awt.Rectangle(395, 2, 90, 20));\r
- jButtonOk.setText("Ok");\r
- jButtonOk.setEnabled(false);\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton jButtonCancel\r
- \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setBounds(new java.awt.Rectangle(395, 2, 90, 20));\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setEnabled(false);\r
- jButtonCancel.addActionListener(this);\r
- jButtonCancel.setVisible(false);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see org.tianocore.packaging.common.ui.IFrame#main(java.lang.String[])\r
- *\r
- * Main class, start the GUI\r
- * \r
- */\r
- public static void main(String[] args) {\r
- ModuleMain module = new ModuleMain();\r
- module.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public ModuleMain() {\r
- super();\r
- init();\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- \r
- **/\r
- private void init() {\r
- //\r
- // Check if exists WORKSPACE\r
- // \r
- //\r
- if (!ws.checkCurrentWorkspace()) {\r
- JOptionPane.showConfirmDialog(null, "You haven't a workspace yet. Please setup first.", "Warning",\r
- JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE);\r
- this.dispose();\r
- System.exit(0);\r
- }\r
-\r
- this.setSize(800, 600);\r
- this.setResizable(false);\r
- this.setJMenuBar(getjJMenuBar());\r
- this.setContentPane(getJContentPane());\r
- this.setTitle(windowTitle + "- [" + ws.getCurrentWorkspace() + "]");\r
- this.setExitType(1);\r
- this.centerWindow();\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel jContentPane\r
- \r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(getJPanelOperation(), null);\r
- jContentPane.add(getJDesktopPane(), null);\r
- jContentPane.add(getJScrollPaneTree(), null);\r
- jContentPane.add(getJPopupMenu(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- *\r
- * Override actionPerformed to listen all actions\r
- *\r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- //\r
- // Open relevant frame via clicking different menu items\r
- //\r
- if (arg0.getSource() == jMenuItemHelpAbout) {\r
- ModuleAbout ma = new ModuleAbout();\r
- ma.setEdited(false);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemEditAddLibraries) {\r
- showLibraries(ModuleMain.ADD, IDefaultMutableTreeNode.LIBRARIES, -1);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemEditAddLibraryClassDefinitions) {\r
- showLibraryClassDefinitions(ModuleMain.ADD, IDefaultMutableTreeNode.LIBRARYCLASSDEFINITIONS);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemEditAddSourceFiles) {\r
- showSourceFiles(ModuleMain.ADD, IDefaultMutableTreeNode.SOURCEFILES, -1);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemEditAddIncludes) {\r
- showIncludes(ModuleMain.ADD, IDefaultMutableTreeNode.INCLUDES, -1);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemEditAddProtocols) {\r
- showProtocols(ModuleMain.ADD, IDefaultMutableTreeNode.PROTOCOLS, -1);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemEditAddEvents) {\r
- showEvents(ModuleMain.ADD, IDefaultMutableTreeNode.EVENTS, -1);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemEditAddHobs) {\r
- showHobs(ModuleMain.ADD, IDefaultMutableTreeNode.HOBS, -1);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemEditAddPPIs) {\r
- showPpis(ModuleMain.ADD, IDefaultMutableTreeNode.PPIS, -1);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemEditAddVariables) {\r
- showVariables(ModuleMain.ADD, IDefaultMutableTreeNode.VARIABLES, -1);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemEditAddBootModes) {\r
- showBootModes(ModuleMain.ADD, IDefaultMutableTreeNode.BOOTMODES, -1);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemEditAddSystemTables) {\r
- showSystemTables(ModuleMain.ADD, IDefaultMutableTreeNode.SYSTEMTABLES, -1);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemEditAddDataHubs) {\r
- showDataHubs(ModuleMain.ADD, IDefaultMutableTreeNode.DATAHUBS, -1);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemEditAddFormsets) {\r
- showFormsets(ModuleMain.ADD, IDefaultMutableTreeNode.FORMSETS, -1);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemEditAddGuids) {\r
- showGuids(ModuleMain.ADD, IDefaultMutableTreeNode.GUIDS, -1);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemEditAddExterns) {\r
- showExterns(ModuleMain.ADD, IDefaultMutableTreeNode.EXTERNS, -1);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemEditAddPCDs) {\r
- showPCDs(ModuleMain.ADD, IDefaultMutableTreeNode.PCDS, -1);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemModuleNewModule) {\r
- this.closeCurrentModule();\r
- showMsaHeader(ModuleMain.ADD);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemModuleNewModuleBuildDescription) {\r
- this.closeCurrentModule();\r
- showMbdHeader(ModuleMain.ADD);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemModuleNewLibraryModule) {\r
- this.closeCurrentModule();\r
- showMlsaHeader(ModuleMain.ADD);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemModuleNewLibraryModuleBuildDescription) {\r
- this.closeCurrentModule();\r
- showMlbdHeader(ModuleMain.ADD);\r
- }\r
-\r
- //\r
- // Open Msa, Mbd, Lmsa and Lmbd\r
- //\r
- if (arg0.getSource() == jMenuItemModuleOpenModule) {\r
- openFile(1, 1);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemModuleOpenModuleBuildDescription) {\r
- openFile(1, 2);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemModuleOpenLibraryModule) {\r
- openFile(1, 3);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemModuleOpenLibraryModuleBuildDescription) {\r
- openFile(1, 4);\r
- }\r
-\r
- //\r
- // Listen popup menu items\r
- //\r
- if (arg0.getSource() == jMenuItemPopupAdd) {\r
- int intCategory = iTree.getSelectCategory();\r
- int intLocation = iTree.getSelectLoaction();\r
- addCurrentModule(intCategory, intLocation);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemPopupUpdate || arg0.getSource() == jMenuItemEditUpdate) {\r
- int intCategory = iTree.getSelectCategory();\r
- int intLocation = iTree.getSelectLoaction();\r
- updateCurrentModule(intCategory, intLocation);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemPopupDelete || arg0.getSource() == jMenuItemEditDelete) {\r
- int intCategory = iTree.getSelectCategory();\r
- int intLocation = iTree.getSelectLoaction();\r
- deleteCurrentModule(intCategory, intLocation);\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemModuleExit) {\r
- this.onExit();\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemModuleClose) {\r
- closeCurrentModule();\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemModuleSaveAs) {\r
- saveAsCurrentModule();\r
- }\r
-\r
- if (arg0.getSource() == jMenuItemModuleSave) {\r
- saveCurrentModule();\r
- }\r
-\r
- if (arg0.getSource() == jButtonOk) {\r
- save();\r
- }\r
-\r
- if (arg0.getSource() == jButtonCancel) {\r
-\r
- }\r
- }\r
-\r
- /**\r
- Open file\r
- \r
- @param intOperationType Open - 1 or Save - 2\r
- @param intFileType Msa - 1, Mbd - 2, Lmsa - 3, Lmbd - 4\r
- @return opened file path\r
- \r
- **/\r
- private void openFile(int intOperationType, int intFileType) {\r
- String strCurrentPath = "";\r
- if (this.currentModule == "") {\r
- strCurrentPath = ws.getCurrentWorkspace();\r
- } else {\r
- strCurrentPath = this.currentModule\r
- .substring(\r
- 0,\r
- this.currentModule\r
- .lastIndexOf(System\r
- .getProperty("file.separator")));\r
- }\r
-\r
- JFileChooser fc = new JFileChooser(strCurrentPath);\r
- fc.setAcceptAllFileFilterUsed(false);\r
- switch (intOperationType) {\r
- case 1:\r
- fc.setDialogTitle("Open");\r
- break;\r
- case 2:\r
- fc.setDialogTitle("Save As");\r
- break;\r
- }\r
- //\r
- // Config File Filter via different file types\r
- //\r
- switch (intFileType) {\r
- case 1:\r
- fc.addChoosableFileFilter(new IFileFilter("msa"));\r
- break;\r
- case 2:\r
- fc.addChoosableFileFilter(new IFileFilter("mbd"));\r
- break;\r
- case 3:\r
- fc.addChoosableFileFilter(new IFileFilter("msa"));\r
- break;\r
- case 4:\r
- fc.addChoosableFileFilter(new IFileFilter("mbd"));\r
- break;\r
- }\r
-\r
- int result = fc.showOpenDialog(new JPanel());\r
- //\r
- // Open relevanf file after click "OK"\r
- //\r
- if (result == JFileChooser.APPROVE_OPTION) {\r
- switch (intOperationType) {\r
- case 1:\r
- closeCurrentModule();\r
- switch (intFileType) {\r
- case 1:\r
- openMsaFile(fc.getSelectedFile().getPath());\r
- break;\r
- case 2:\r
- openMbdFile(fc.getSelectedFile().getPath());\r
- break;\r
- case 3:\r
- openMlsaFile(fc.getSelectedFile().getPath());\r
- break;\r
- case 4:\r
- openMlbdFile(fc.getSelectedFile().getPath());\r
- break;\r
- }\r
- break;\r
- case 2:\r
- switch (intFileType) {\r
- case 1:\r
- this.saveFileName = fc.getSelectedFile().getPath();\r
- break;\r
- case 2:\r
- this.saveFileName = fc.getSelectedFile().getPath();\r
- break;\r
- case 3:\r
- this.saveFileName = fc.getSelectedFile().getPath();\r
- break;\r
- case 4:\r
- this.saveFileName = fc.getSelectedFile().getPath();\r
- break;\r
- }\r
- break;\r
- }\r
- } else {\r
- if (intOperationType == 2) {\r
- this.saveFileName = "";\r
- }\r
- }\r
- }\r
-\r
- /**\r
- Open specificed Msa file and read its content\r
- \r
- @param strMsaFilePath The input data of Msa File Path\r
- \r
- **/\r
- private void openMsaFile(String strMsaFilePath) {\r
- Log.log("Open Msa", strMsaFilePath);\r
- try {\r
- File msaFile = new File(strMsaFilePath);\r
- xmlMsaDoc = (ModuleSurfaceAreaDocument) XmlObject.Factory.parse(msaFile);\r
- this.currentModule = strMsaFilePath;\r
- this.saveFileName = strMsaFilePath;\r
- this.currentModuleType = 1;\r
- } catch (IOException e) {\r
- Log.err("Open Msa " + strMsaFilePath, e.getMessage());\r
- return;\r
- } catch (XmlException e) {\r
- Log.err("Open Msa " + strMsaFilePath, e.getMessage());\r
- return;\r
- } catch (Exception e) {\r
- Log.err("Open Msa " + strMsaFilePath, "Invalid file type");\r
- return;\r
- }\r
-\r
- xmlmh = xmlMsaDoc.getModuleSurfaceArea().getMsaHeader();\r
- xmllcd = xmlMsaDoc.getModuleSurfaceArea().getLibraryClassDefinitions();\r
- xmlsf = xmlMsaDoc.getModuleSurfaceArea().getSourceFiles();\r
- xmlic = xmlMsaDoc.getModuleSurfaceArea().getIncludes();\r
- xmlpl = xmlMsaDoc.getModuleSurfaceArea().getProtocols();\r
- xmlen = xmlMsaDoc.getModuleSurfaceArea().getEvents();\r
- xmlhob = xmlMsaDoc.getModuleSurfaceArea().getHobs();\r
- xmlppi = xmlMsaDoc.getModuleSurfaceArea().getPPIs();\r
- xmlvb = xmlMsaDoc.getModuleSurfaceArea().getVariables();\r
- xmlbm = xmlMsaDoc.getModuleSurfaceArea().getBootModes();\r
- xmlst = xmlMsaDoc.getModuleSurfaceArea().getSystemTables();\r
- xmldh = xmlMsaDoc.getModuleSurfaceArea().getDataHubs();\r
- xmlfs = xmlMsaDoc.getModuleSurfaceArea().getFormsets();\r
- xmlgu = xmlMsaDoc.getModuleSurfaceArea().getGuids();\r
- xmlet = xmlMsaDoc.getModuleSurfaceArea().getExterns();\r
- xmlpcd = xmlMsaDoc.getModuleSurfaceArea().getPCDs();\r
- xmlbo = xmlMsaDoc.getModuleSurfaceArea().getBuildOptions();\r
-\r
- this.showMsaHeader(ModuleMain.VIEW);\r
- reloadTreeAndTable(ModuleMain.OPENED);\r
- jMenuEditAdd.setEnabled(true);\r
- }\r
-\r
- /**\r
- Open specificed Mbd file and read its content\r
- \r
- @param strMbdFilePath The input data of Mbd File Path\r
- \r
- **/\r
- private void openMbdFile(String strMbdFilePath) {\r
- Log.log("Open Mbd", strMbdFilePath);\r
- try {\r
- File mbdFile = new File(strMbdFilePath);\r
- xmlMbdDoc = (ModuleBuildDescriptionDocument) XmlObject.Factory.parse(mbdFile);\r
- this.currentModule = strMbdFilePath;\r
- this.saveFileName = strMbdFilePath;\r
- this.currentModuleType = 2;\r
- } catch (IOException e) {\r
- Log.err("Open Mbd " + strMbdFilePath, e.getMessage());\r
- return;\r
- } catch (XmlException e) {\r
- Log.err("Open Mbd " + strMbdFilePath, e.getMessage());\r
- return;\r
- } catch (Exception e) {\r
- Log.err("Open Mbd " + strMbdFilePath, "Invalid file type");\r
- return;\r
- }\r
-\r
- xmlmbdh = xmlMbdDoc.getModuleBuildDescription().getMbdHeader();\r
- xmllib = xmlMbdDoc.getModuleBuildDescription().getLibraries();\r
- xmlsf = xmlMbdDoc.getModuleBuildDescription().getSourceFiles();\r
- xmlic = xmlMbdDoc.getModuleBuildDescription().getIncludes();\r
- xmlpl = xmlMbdDoc.getModuleBuildDescription().getProtocols();\r
- xmlen = xmlMbdDoc.getModuleBuildDescription().getEvents();\r
- xmlhob = xmlMbdDoc.getModuleBuildDescription().getHobs();\r
- xmlppi = xmlMbdDoc.getModuleBuildDescription().getPPIs();\r
- xmlvb = xmlMbdDoc.getModuleBuildDescription().getVariables();\r
- xmlbm = xmlMbdDoc.getModuleBuildDescription().getBootModes();\r
- xmlst = xmlMbdDoc.getModuleBuildDescription().getSystemTables();\r
- xmldh = xmlMbdDoc.getModuleBuildDescription().getDataHubs();\r
- xmlfs = xmlMbdDoc.getModuleBuildDescription().getFormsets();\r
- xmlgu = xmlMbdDoc.getModuleBuildDescription().getGuids();\r
- xmlet = xmlMbdDoc.getModuleBuildDescription().getExterns();\r
- xmlpcd = xmlMbdDoc.getModuleBuildDescription().getPCDs();\r
- xmlbo = xmlMbdDoc.getModuleBuildDescription().getBuildOptions();\r
-\r
- this.showMbdHeader(ModuleMain.VIEW);\r
- reloadTreeAndTable(ModuleMain.OPENED);\r
- jMenuEditAdd.setEnabled(true);\r
- }\r
-\r
- /**\r
- Open specificed Mlsa file and read its content\r
- \r
- @param strMlsaFilePath The input data of Mlsa File Path\r
- \r
- **/\r
- private void openMlsaFile(String strMlsaFilePath) {\r
- Log.log("Open Mlsa", strMlsaFilePath);\r
- try {\r
- File mlsaFile = new File(strMlsaFilePath);\r
- xmlMlsaDoc = (LibraryModuleSurfaceAreaDocument) XmlObject.Factory.parse(mlsaFile);\r
- this.currentModule = strMlsaFilePath;\r
- this.saveFileName = strMlsaFilePath;\r
- this.currentModuleType = 3;\r
- } catch (IOException e) {\r
- Log.err("Open Mlsa " + strMlsaFilePath, e.getMessage());\r
- return;\r
- } catch (XmlException e) {\r
- Log.err("Open Mlsa " + strMlsaFilePath, e.getMessage());\r
- return;\r
- } catch (Exception e) {\r
- Log.err("Open Mlsa " + strMlsaFilePath, "Invalid file type");\r
- return;\r
- }\r
-\r
- xmlmlh = xmlMlsaDoc.getLibraryModuleSurfaceArea().getMsaLibHeader();\r
- xmllcd = xmlMlsaDoc.getLibraryModuleSurfaceArea().getLibraryClassDefinitions();\r
- xmlsf = xmlMlsaDoc.getLibraryModuleSurfaceArea().getSourceFiles();\r
- xmlic = xmlMlsaDoc.getLibraryModuleSurfaceArea().getIncludes();\r
- xmlpl = xmlMlsaDoc.getLibraryModuleSurfaceArea().getProtocols();\r
- xmlen = xmlMlsaDoc.getLibraryModuleSurfaceArea().getEvents();\r
- xmlhob = xmlMlsaDoc.getLibraryModuleSurfaceArea().getHobs();\r
- xmlppi = xmlMlsaDoc.getLibraryModuleSurfaceArea().getPPIs();\r
- xmlvb = xmlMlsaDoc.getLibraryModuleSurfaceArea().getVariables();\r
- xmlbm = xmlMlsaDoc.getLibraryModuleSurfaceArea().getBootModes();\r
- xmlst = xmlMlsaDoc.getLibraryModuleSurfaceArea().getSystemTables();\r
- xmldh = xmlMlsaDoc.getLibraryModuleSurfaceArea().getDataHubs();\r
- xmlfs = xmlMlsaDoc.getLibraryModuleSurfaceArea().getFormsets();\r
- xmlgu = xmlMlsaDoc.getLibraryModuleSurfaceArea().getGuids();\r
- xmlet = xmlMlsaDoc.getLibraryModuleSurfaceArea().getExterns();\r
- xmlpcd = xmlMlsaDoc.getLibraryModuleSurfaceArea().getPCDs();\r
- xmlbo = xmlMlsaDoc.getLibraryModuleSurfaceArea().getBuildOptions();\r
-\r
- this.showMlsaHeader(ModuleMain.VIEW);\r
- reloadTreeAndTable(ModuleMain.OPENED);\r
- jMenuEditAdd.setEnabled(true);\r
- }\r
-\r
- /**\r
- Open specificed Mlbd file and read its content\r
- \r
- @param strMlbdFilePath The input data of Mlbd File Path\r
- \r
- **/\r
- private void openMlbdFile(String strMlbdFilePath) {\r
- Log.log("Open Mlbd", strMlbdFilePath);\r
- try {\r
- File mlbdFile = new File(strMlbdFilePath);\r
- xmlMlbdDoc = (LibraryModuleBuildDescriptionDocument) XmlObject.Factory.parse(mlbdFile);\r
- this.currentModule = strMlbdFilePath;\r
- this.saveFileName = strMlbdFilePath;\r
- this.currentModuleType = 4;\r
- } catch (IOException e) {\r
- Log.err("Open Mlbd " + strMlbdFilePath, e.getMessage());\r
- return;\r
- } catch (XmlException e) {\r
- Log.err("Open Mlbd " + strMlbdFilePath, e.getMessage());\r
- return;\r
- } catch (Exception e) {\r
- Log.err("Open Mlbd " + strMlbdFilePath, "Invalid file type");\r
- return;\r
- }\r
-\r
- xmlmlbdh = xmlMlbdDoc.getLibraryModuleBuildDescription().getMbdLibHeader();\r
- xmllib = xmlMlbdDoc.getLibraryModuleBuildDescription().getLibraries();\r
- xmlsf = xmlMlbdDoc.getLibraryModuleBuildDescription().getSourceFiles();\r
- xmlic = xmlMlbdDoc.getLibraryModuleBuildDescription().getIncludes();\r
- xmlpl = xmlMlbdDoc.getLibraryModuleBuildDescription().getProtocols();\r
- xmlen = xmlMlbdDoc.getLibraryModuleBuildDescription().getEvents();\r
- xmlhob = xmlMlbdDoc.getLibraryModuleBuildDescription().getHobs();\r
- xmlppi = xmlMlbdDoc.getLibraryModuleBuildDescription().getPPIs();\r
- xmlvb = xmlMlbdDoc.getLibraryModuleBuildDescription().getVariables();\r
- xmlbm = xmlMlbdDoc.getLibraryModuleBuildDescription().getBootModes();\r
- xmlst = xmlMlbdDoc.getLibraryModuleBuildDescription().getSystemTables();\r
- xmldh = xmlMlbdDoc.getLibraryModuleBuildDescription().getDataHubs();\r
- xmlfs = xmlMlbdDoc.getLibraryModuleBuildDescription().getFormsets();\r
- xmlgu = xmlMlbdDoc.getLibraryModuleBuildDescription().getGuids();\r
- xmlet = xmlMlbdDoc.getLibraryModuleBuildDescription().getExterns();\r
- xmlpcd = xmlMlbdDoc.getLibraryModuleBuildDescription().getPCDs();\r
- xmlbo = xmlMlbdDoc.getLibraryModuleBuildDescription().getBuildOptions();\r
-\r
- this.showMlbdHeader(ModuleMain.VIEW);\r
- reloadTreeAndTable(ModuleMain.OPENED);\r
- jMenuEditAdd.setEnabled(true);\r
- }\r
-\r
- /**\r
- Create an empty tree if no file is open\r
- \r
- **/\r
- private void makeEmptyTree() {\r
- dmtnRoot = new IDefaultMutableTreeNode("No Msa/Mbd file opened", -1, -1);\r
- iTree = new ITree(dmtnRoot);\r
- jScrollPaneTree.setViewportView(iTree);\r
- }\r
-\r
- /**\r
- Create the tree to display all components of current open file.\r
- First to check if the component is null or not\r
- If not null, hangs it to the tree\r
- If null, skip it\r
- \r
- **/\r
- private void makeTree() {\r
- iTree.removeAll();\r
-\r
- //\r
- //Make an empty tree when closing\r
- //\r
- if (this.currentModuleType == 0) {\r
- makeEmptyTree();\r
- return;\r
- }\r
-\r
- //\r
- //Msa File\r
- //\r
- if (this.currentModuleType == 1) {\r
- //\r
- //Add MsaHeader Node\r
- //\r
- if (xmlmh != null) {\r
- dmtnRoot = new IDefaultMutableTreeNode(xmlmh.getBaseName().getStringValue(),\r
- IDefaultMutableTreeNode.MSA_HEADER,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE);\r
- } else {\r
- makeEmptyTree();\r
- return;\r
- }\r
-\r
- //\r
- //Add LibraryClassDefinitions Node\r
- //\r
- if (xmllcd != null && xmllcd.getLibraryClassList().size() > 0) {\r
- IDefaultMutableTreeNode libraryClassDefinitions = new IDefaultMutableTreeNode(\r
- "Library Class Definitions",\r
- IDefaultMutableTreeNode.LIBRARYCLASSDEFINITIONS,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE);\r
- for (int indexI = 0; indexI < xmllcd.getLibraryClassList().size(); indexI++) {\r
- libraryClassDefinitions\r
- .add(new IDefaultMutableTreeNode(\r
- xmllcd.getLibraryClassArray(indexI)\r
- .getStringValue(),\r
- IDefaultMutableTreeNode.LIBRARY_CLASS_DEFINITION,\r
- IDefaultMutableTreeNode.OPERATION_NULL));\r
- }\r
- dmtnRoot.add(libraryClassDefinitions);\r
- }\r
- }\r
-\r
- //\r
- //Mbd File\r
- //\r
- if (this.currentModuleType == 2) {\r
- //\r
- //Add MsaHeader Node\r
- //\r
- if (xmlmbdh != null) {\r
- dmtnRoot = new IDefaultMutableTreeNode(xmlmbdh.getBaseName().getStringValue(),\r
- IDefaultMutableTreeNode.MBD_HEADER,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE);\r
- } else {\r
- makeEmptyTree();\r
- return;\r
- }\r
-\r
- //\r
- //Add Libraries Node\r
- //\r
- if (xmllib != null) {\r
- IDefaultMutableTreeNode libraries = new IDefaultMutableTreeNode(\r
- "Libraries",\r
- IDefaultMutableTreeNode.LIBRARIES,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- if (xmllib.getArchList().size() > 0) {\r
- IDefaultMutableTreeNode librariesArch = new IDefaultMutableTreeNode(\r
- "Arch",\r
- IDefaultMutableTreeNode.LIBRARIES_ARCH,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- for (int indexI = 0; indexI < xmllib.getArchList().size(); indexI++) {\r
- librariesArch.add(new IDefaultMutableTreeNode(xmllib.getArchArray(indexI).getArchType()\r
- .toString(),\r
- IDefaultMutableTreeNode.LIBRARIES_ARCH_ITEM,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,\r
- indexI));\r
- }\r
- libraries.add(librariesArch);\r
- }\r
- if (xmllib.getLibraryList().size() > 0) {\r
- IDefaultMutableTreeNode library = new IDefaultMutableTreeNode(\r
- "Library",\r
- IDefaultMutableTreeNode.LIBRARIES_LIBRARY,\r
- IDefaultMutableTreeNode.OPERATION_ADD_UPDATE_DELETE);\r
- for (int indexI = 0; indexI < xmllib.getLibraryList().size(); indexI++) {\r
- library.add(new IDefaultMutableTreeNode(xmllib.getLibraryArray(indexI).getStringValue(),\r
- IDefaultMutableTreeNode.LIBRARIES_LIBRARY_ITEM,\r
- IDefaultMutableTreeNode.OPERATION_DELETE));\r
- }\r
- libraries.add(library);\r
- }\r
- dmtnRoot.add(libraries);\r
- }\r
- }\r
-\r
- //\r
- //MLsa File\r
- //\r
- if (this.currentModuleType == 3) {\r
- //\r
- //Add MsaHeader Node\r
- //\r
- if (xmlmlh != null) {\r
- dmtnRoot = new IDefaultMutableTreeNode(xmlmlh.getBaseName().getStringValue(),\r
- IDefaultMutableTreeNode.MLSA_HEADER,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE);\r
- } else {\r
- makeEmptyTree();\r
- return;\r
- }\r
-\r
- //\r
- //Add LibraryClassDefinitions Node\r
- //\r
- if (xmllcd != null && xmllcd.getLibraryClassList().size() > 0) {\r
- IDefaultMutableTreeNode libraryClassDefinitions = new IDefaultMutableTreeNode(\r
- "Library Class Definitions",\r
- IDefaultMutableTreeNode.LIBRARYCLASSDEFINITIONS,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE);\r
- for (int indexI = 0; indexI < xmllcd.getLibraryClassList().size(); indexI++) {\r
- libraryClassDefinitions\r
- .add(new IDefaultMutableTreeNode(\r
- xmllcd.getLibraryClassArray(indexI)\r
- .getStringValue(),\r
- IDefaultMutableTreeNode.LIBRARY_CLASS_DEFINITION,\r
- IDefaultMutableTreeNode.OPERATION_NULL));\r
- }\r
- dmtnRoot.add(libraryClassDefinitions);\r
- }\r
- }\r
-\r
- //\r
- //Mlbd File\r
- //\r
- if (this.currentModuleType == 4) {\r
- //\r
- //Add MsaHeader Node\r
- //\r
- if (xmlmlbdh != null) {\r
- dmtnRoot = new IDefaultMutableTreeNode(xmlmlbdh.getBaseName().getStringValue(),\r
- IDefaultMutableTreeNode.MLBD_HEADER,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE);\r
- } else {\r
- makeEmptyTree();\r
- return;\r
- }\r
-\r
- //\r
- //Add Libraries Node\r
- //\r
- if (xmllib != null) {\r
- IDefaultMutableTreeNode libraries = new IDefaultMutableTreeNode(\r
- "Libraries",\r
- IDefaultMutableTreeNode.LIBRARIES,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- if (xmllib.getArchList().size() > 0) {\r
- IDefaultMutableTreeNode librariesArch = new IDefaultMutableTreeNode(\r
- "Arch",\r
- IDefaultMutableTreeNode.LIBRARIES_ARCH,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- for (int indexI = 0; indexI < xmllib.getArchList().size(); indexI++) {\r
- librariesArch.add(new IDefaultMutableTreeNode(xmllib.getArchArray(indexI).getArchType()\r
- .toString(),\r
- IDefaultMutableTreeNode.LIBRARIES_ARCH_ITEM,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,\r
- indexI));\r
- }\r
- libraries.add(librariesArch);\r
- }\r
- if (xmllib.getLibraryList().size() > 0) {\r
- IDefaultMutableTreeNode library = new IDefaultMutableTreeNode(\r
- "Library",\r
- IDefaultMutableTreeNode.LIBRARIES_LIBRARY,\r
- IDefaultMutableTreeNode.OPERATION_ADD_UPDATE_DELETE);\r
- for (int indexI = 0; indexI < xmllib.getLibraryList().size(); indexI++) {\r
- library.add(new IDefaultMutableTreeNode(xmllib.getLibraryArray(indexI).getStringValue(),\r
- IDefaultMutableTreeNode.LIBRARIES_LIBRARY_ITEM,\r
- IDefaultMutableTreeNode.OPERATION_DELETE));\r
- }\r
- libraries.add(library);\r
- }\r
- dmtnRoot.add(libraries);\r
- }\r
- }\r
-\r
- //\r
- //Add SourceFiles Node\r
- //\r
- if (xmlsf != null) {\r
- IDefaultMutableTreeNode sourceFiles = new IDefaultMutableTreeNode(\r
- "Source Files",\r
- IDefaultMutableTreeNode.SOURCEFILES,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- if (xmlsf.getArchList().size() > 0) {\r
- IDefaultMutableTreeNode sourceFilesArch = new IDefaultMutableTreeNode(\r
- "Arch",\r
- IDefaultMutableTreeNode.SOURCEFILES_ARCH,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- for (int indexI = 0; indexI < xmlsf.getArchList().size(); indexI++) {\r
- sourceFilesArch\r
- .add(new IDefaultMutableTreeNode(\r
- xmlsf.getArchArray(indexI).getArchType().toString(),\r
- IDefaultMutableTreeNode.SOURCEFILES_ARCH_ITEM,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,\r
- indexI));\r
- }\r
- sourceFiles.add(sourceFilesArch);\r
- }\r
- if (xmlsf.getFilenameList().size() > 0) {\r
- IDefaultMutableTreeNode sourceFilesFileName = new IDefaultMutableTreeNode(\r
- "File Name",\r
- IDefaultMutableTreeNode.SOURCEFILES_FILENAME,\r
- IDefaultMutableTreeNode.OPERATION_ADD_UPDATE_DELETE);\r
- for (int indexI = 0; indexI < xmlsf.getFilenameList().size(); indexI++) {\r
- sourceFilesFileName\r
- .add(new IDefaultMutableTreeNode(\r
- xmlsf.getFilenameArray(indexI).getStringValue(),\r
- IDefaultMutableTreeNode.SOURCEFILES_FILENAME_ITEM,\r
- IDefaultMutableTreeNode.OPERATION_DELETE));\r
- }\r
- sourceFiles.add(sourceFilesFileName);\r
- }\r
- dmtnRoot.add(sourceFiles);\r
- }\r
-\r
- //\r
- //Add includes\r
- //\r
- if (xmlic != null) {\r
- IDefaultMutableTreeNode includes = new IDefaultMutableTreeNode("Includes",\r
- IDefaultMutableTreeNode.INCLUDES,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- if (xmlic.getArchList().size() > 0) {\r
- IDefaultMutableTreeNode includesArch = new IDefaultMutableTreeNode(\r
- "Arch",\r
- IDefaultMutableTreeNode.INCLUDES_ARCH,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- for (int indexI = 0; indexI < xmlic.getArchList().size(); indexI++) {\r
- includesArch.add(new IDefaultMutableTreeNode(xmlic.getArchArray(indexI).getArchType().toString(),\r
- IDefaultMutableTreeNode.INCLUDES_ARCH_ITEM,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,\r
- indexI));\r
- }\r
- includes.add(includesArch);\r
- }\r
- if (xmlic.getPackageNameList().size() > 0) {\r
- IDefaultMutableTreeNode includesPackageName = new IDefaultMutableTreeNode(\r
- "Package Name",\r
- IDefaultMutableTreeNode.INCLUDES_PACKAGENAME,\r
- IDefaultMutableTreeNode.OPERATION_ADD_UPDATE_DELETE);\r
- for (int indexI = 0; indexI < xmlic.getPackageNameList().size(); indexI++) {\r
- includesPackageName\r
- .add(new IDefaultMutableTreeNode(\r
- xmlic.getPackageNameArray(indexI)\r
- .getStringValue(),\r
- IDefaultMutableTreeNode.INCLUDES_PACKAGENAME_ITEM,\r
- IDefaultMutableTreeNode.OPERATION_DELETE));\r
- }\r
- includes.add(includesPackageName);\r
- }\r
- dmtnRoot.add(includes);\r
- }\r
-\r
- //\r
- //Add protocols\r
- //\r
- if (xmlpl != null) {\r
- IDefaultMutableTreeNode dmtnProtocols = new IDefaultMutableTreeNode(\r
- "Protocols",\r
- IDefaultMutableTreeNode.PROTOCOLS,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- IDefaultMutableTreeNode dmtnProtocol = new IDefaultMutableTreeNode(\r
- "Protocol",\r
- IDefaultMutableTreeNode.PROTOCOLS_PROTOCOL,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- IDefaultMutableTreeNode dmtnProtocolNotify = new IDefaultMutableTreeNode(\r
- "Protocol Notify",\r
- IDefaultMutableTreeNode.PROTOCOLS_PROTOCOLNOTIFY,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- if (xmlpl.getProtocolList().size() > 0) {\r
- for (int indexI = 0; indexI < xmlpl.getProtocolList().size(); indexI++) {\r
- dmtnProtocol.add(new IDefaultMutableTreeNode(xmlpl.getProtocolArray(indexI).getStringValue(),\r
- IDefaultMutableTreeNode.PROTOCOLS_PROTOCOL_ITEM,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,\r
- indexI));\r
- }\r
- dmtnProtocols.add(dmtnProtocol);\r
- }\r
- if (xmlpl.getProtocolNotifyList().size() > 0) {\r
- for (int indexI = 0; indexI < xmlpl.getProtocolNotifyList().size(); indexI++) {\r
- dmtnProtocolNotify\r
- .add(new IDefaultMutableTreeNode(\r
- xmlpl.getProtocolNotifyArray(indexI)\r
- .getStringValue(),\r
- IDefaultMutableTreeNode.PROTOCOLS_PROTOCOLNOTIFY_ITEM,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,\r
- indexI));\r
- }\r
- dmtnProtocols.add(dmtnProtocolNotify);\r
- }\r
- dmtnRoot.add(dmtnProtocols);\r
- }\r
-\r
- //\r
- //Add events\r
- //\r
- if (xmlen != null) {\r
- IDefaultMutableTreeNode dmtnEvents = new IDefaultMutableTreeNode(\r
- "Events",\r
- IDefaultMutableTreeNode.EVENTS,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- IDefaultMutableTreeNode dmtnCreateEvents = new IDefaultMutableTreeNode(\r
- "Create",\r
- IDefaultMutableTreeNode.EVENTS_CREATEEVENTS,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- IDefaultMutableTreeNode dmtnSignalEvents = new IDefaultMutableTreeNode(\r
- "Signal",\r
- IDefaultMutableTreeNode.EVENTS_SIGNALEVENTS,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- if (xmlen.getCreateEvents() != null && xmlen.getCreateEvents().getEventList().size() > 0) {\r
- for (int indexI = 0; indexI < xmlen.getCreateEvents().getEventList().size(); indexI++) {\r
- dmtnCreateEvents.add(new IDefaultMutableTreeNode(xmlen.getCreateEvents().getEventArray(indexI)\r
- .getCName(),\r
- IDefaultMutableTreeNode.EVENTS_CREATEEVENTS_ITEM,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,\r
- indexI));\r
- }\r
- dmtnEvents.add(dmtnCreateEvents);\r
- }\r
- if (xmlen.getSignalEvents() != null && xmlen.getSignalEvents().getEventList().size() > 0) {\r
- for (int indexI = 0; indexI < xmlen.getSignalEvents().getEventList().size(); indexI++) {\r
- dmtnSignalEvents.add(new IDefaultMutableTreeNode(xmlen.getSignalEvents().getEventArray(indexI)\r
- .getCName(),\r
- IDefaultMutableTreeNode.EVENTS_SIGNALEVENTS_ITEM,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,\r
- indexI));\r
- }\r
- dmtnEvents.add(dmtnSignalEvents);\r
- }\r
- dmtnRoot.add(dmtnEvents);\r
- }\r
-\r
- //\r
- //Add hobs\r
- //\r
- if (xmlhob != null) {\r
- IDefaultMutableTreeNode dmtnHobs = new IDefaultMutableTreeNode("Hobs", IDefaultMutableTreeNode.HOBS,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- if (xmlhob.getHobList().size() > 0) {\r
- for (int indexI = 0; indexI < xmlhob.getHobList().size(); indexI++) {\r
- dmtnHobs.add(new IDefaultMutableTreeNode(xmlhob.getHobArray(indexI).getName(),\r
- IDefaultMutableTreeNode.HOBS_HOB_ITEM,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE, indexI));\r
- }\r
- }\r
- dmtnRoot.add(dmtnHobs);\r
- }\r
-\r
- //\r
- //Add ppis\r
- //\r
- if (xmlppi != null) {\r
- IDefaultMutableTreeNode dmtnPpis = new IDefaultMutableTreeNode("Ppis", IDefaultMutableTreeNode.PPIS,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- IDefaultMutableTreeNode dmtnPpi = new IDefaultMutableTreeNode("Ppi", IDefaultMutableTreeNode.PPIS_PPI,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- IDefaultMutableTreeNode dmtnPpiNotify = new IDefaultMutableTreeNode(\r
- "Ppi Notify",\r
- IDefaultMutableTreeNode.PPIS_PPINOTIFY,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- if (xmlppi.getPpiList().size() > 0) {\r
- for (int indexI = 0; indexI < xmlppi.getPpiList().size(); indexI++) {\r
- dmtnPpi.add(new IDefaultMutableTreeNode(xmlppi.getPpiArray(indexI).getStringValue(),\r
- IDefaultMutableTreeNode.PPIS_PPI_ITEM,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE, indexI));\r
- }\r
- dmtnPpis.add(dmtnPpi);\r
- }\r
- if (xmlppi.getPpiNotifyList().size() > 0) {\r
- for (int indexI = 0; indexI < xmlppi.getPpiNotifyList().size(); indexI++) {\r
- dmtnPpiNotify.add(new IDefaultMutableTreeNode(xmlppi.getPpiNotifyArray(indexI).getStringValue(),\r
- IDefaultMutableTreeNode.PPIS_PPINOTIFY_ITEM,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,\r
- indexI));\r
- }\r
- dmtnPpis.add(dmtnPpiNotify);\r
- }\r
- dmtnRoot.add(dmtnPpis);\r
- }\r
-\r
- //\r
- //Add variables\r
- //\r
- if (xmlvb != null) {\r
- IDefaultMutableTreeNode dmtnVariables = new IDefaultMutableTreeNode(\r
- "Variables",\r
- IDefaultMutableTreeNode.VARIABLES,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- if (xmlvb.getVariableList().size() > 0) {\r
- for (int indexI = 0; indexI < xmlvb.getVariableList().size(); indexI++) {\r
- dmtnVariables.add(new IDefaultMutableTreeNode(xmlvb.getVariableArray(indexI).getString(),\r
- IDefaultMutableTreeNode.VARIABLES_VARIABLE_ITEM,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,\r
- indexI));\r
- }\r
- }\r
- dmtnRoot.add(dmtnVariables);\r
- }\r
-\r
- //\r
- //Add bootmodes\r
- //\r
- if (xmlbm != null) {\r
- IDefaultMutableTreeNode dmtnBootModes = new IDefaultMutableTreeNode(\r
- "BootModes",\r
- IDefaultMutableTreeNode.BOOTMODES,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- if (xmlbm.getBootModeList().size() > 0) {\r
- for (int indexI = 0; indexI < xmlbm.getBootModeList().size(); indexI++) {\r
- dmtnBootModes.add(new IDefaultMutableTreeNode(xmlbm.getBootModeArray(indexI).getBootModeName()\r
- .toString(),\r
- IDefaultMutableTreeNode.BOOTMODES_BOOTMODE_ITEM,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,\r
- indexI));\r
- }\r
- }\r
- dmtnRoot.add(dmtnBootModes);\r
- }\r
-\r
- //\r
- //Add systemtables\r
- //\r
- if (xmlst != null) {\r
- IDefaultMutableTreeNode dmtnSystemTables = new IDefaultMutableTreeNode(\r
- "SystemTables",\r
- IDefaultMutableTreeNode.SYSTEMTABLES,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- if (xmlst.getSystemTableList().size() > 0) {\r
- for (int indexI = 0; indexI < xmlst.getSystemTableList().size(); indexI++) {\r
- dmtnSystemTables\r
- .add(new IDefaultMutableTreeNode(\r
- xmlst.getSystemTableArray(indexI).getEntryList().get(0),\r
- IDefaultMutableTreeNode.SYSTEMTABLES_SYSTEMTABLE_ITEM,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,\r
- indexI));\r
- }\r
- }\r
- dmtnRoot.add(dmtnSystemTables);\r
- }\r
-\r
- //\r
- //Add datahubs\r
- //\r
- if (xmldh != null) {\r
- IDefaultMutableTreeNode dmtnDataHubs = new IDefaultMutableTreeNode(\r
- "DataHubs",\r
- IDefaultMutableTreeNode.DATAHUBS,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- if (xmldh.getDataHubRecordList().size() > 0) {\r
- for (int indexI = 0; indexI < xmldh.getDataHubRecordList().size(); indexI++) {\r
- dmtnDataHubs.add(new IDefaultMutableTreeNode(xmldh.getDataHubRecordArray(indexI).getStringValue(),\r
- IDefaultMutableTreeNode.DATAHUBS_DATAHUB_ITEM,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,\r
- indexI));\r
- }\r
- }\r
- dmtnRoot.add(dmtnDataHubs);\r
- }\r
-\r
- //\r
- //Add formsets\r
- //\r
- if (xmlfs != null) {\r
- IDefaultMutableTreeNode dmtnFormsets = new IDefaultMutableTreeNode(\r
- "Formsets",\r
- IDefaultMutableTreeNode.FORMSETS,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- if (xmlfs.getFormsetList().size() > 0) {\r
- for (int indexI = 0; indexI < xmlfs.getFormsetList().size(); indexI++) {\r
- dmtnFormsets.add(new IDefaultMutableTreeNode(xmlfs.getFormsetArray(indexI).getStringValue(),\r
- IDefaultMutableTreeNode.FORMSETS_FORMSET_ITEM,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,\r
- indexI));\r
- }\r
- }\r
- dmtnRoot.add(dmtnFormsets);\r
- }\r
-\r
- //\r
- //Add guids\r
- //\r
- if (xmlgu != null) {\r
- IDefaultMutableTreeNode dmtnGuids = new IDefaultMutableTreeNode(\r
- "Guids",\r
- IDefaultMutableTreeNode.GUIDS,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- if (xmlgu.getGuidEntryList().size() > 0) {\r
- for (int indexI = 0; indexI < xmlgu.getGuidEntryList().size(); indexI++) {\r
- dmtnGuids.add(new IDefaultMutableTreeNode(xmlgu.getGuidEntryArray(indexI).getCName(),\r
- IDefaultMutableTreeNode.GUIDS_GUIDENTRY_ITEM,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE, indexI));\r
- }\r
- }\r
- dmtnRoot.add(dmtnGuids);\r
- }\r
-\r
- //\r
- //Add externs\r
- //\r
- if (xmlet != null) {\r
- IDefaultMutableTreeNode dmtnExterns = new IDefaultMutableTreeNode(\r
- "Externs",\r
- IDefaultMutableTreeNode.EXTERNS,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- if (xmlet.getExternList().size() > 0) {\r
- for (int indexI = 0; indexI < xmlet.getExternList().size(); indexI++) {\r
- dmtnExterns\r
- .add(new IDefaultMutableTreeNode("Extern " + Integer.valueOf(indexI + 1),\r
- IDefaultMutableTreeNode.EXTERNS_EXTERN_ITEM,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE, indexI));\r
- }\r
- }\r
- dmtnRoot.add(dmtnExterns);\r
- }\r
-\r
- //\r
- //Add pcds\r
- //\r
- if (xmlpcd != null) {\r
- IDefaultMutableTreeNode dmtnPCDs = new IDefaultMutableTreeNode("PCDs", IDefaultMutableTreeNode.PCDS,\r
- IDefaultMutableTreeNode.OPERATION_ADD_DELETE);\r
- if (xmlpcd.getPcdDataList().size() > 0) {\r
- for (int indexI = 0; indexI < xmlpcd.getPcdDataList().size(); indexI++) {\r
- dmtnPCDs.add(new IDefaultMutableTreeNode(xmlpcd.getPcdDataArray(indexI).getCName(),\r
- IDefaultMutableTreeNode.PCDS_PCDDATA_ITEM,\r
- IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE, indexI));\r
- }\r
- }\r
- dmtnRoot.add(dmtnPCDs);\r
- }\r
-\r
- iTree = new ITree(dmtnRoot);\r
- iTree.addMouseListener(this);\r
- iTree.addTreeSelectionListener(this);\r
- jScrollPaneTree.setViewportView(iTree);\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)\r
- *\r
- * Override windowClosing to popup warning message to confirm quit\r
- * \r
- */\r
- public void windowClosing(WindowEvent arg0) {\r
- this.onExit();\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)\r
- * \r
- * Override mouseClicked to check if need display popup menu\r
- * \r
- */\r
- public void mouseClicked(MouseEvent arg0) {\r
- if (arg0.getButton() == MouseEvent.BUTTON1) {\r
-\r
- }\r
- if (arg0.getButton() == MouseEvent.BUTTON3) {\r
- jPopupMenu.show(arg0.getComponent(), arg0.getX(), arg0.getY());\r
- }\r
- }\r
-\r
- public void mouseEntered(MouseEvent arg0) {\r
- // TODO Auto-generated method stub\r
- }\r
-\r
- public void mouseExited(MouseEvent arg0) {\r
- // TODO Auto-generated method stub\r
- }\r
-\r
- public void mousePressed(MouseEvent arg0) {\r
- // TODO Auto-generated method stub\r
- }\r
-\r
- public void mouseReleased(MouseEvent arg0) {\r
- // TODO Auto-generated method stub\r
- }\r
-\r
- /**\r
- Init popup menu\r
- \r
- **/\r
- public void valueChanged(TreeSelectionEvent arg0) {\r
- int intOperation = iTree.getSelectOperation();\r
- if (intOperation == IDefaultMutableTreeNode.OPERATION_NULL) {\r
- setMenuItemAddEnabled(false);\r
- setMenuItemUpdateEnabled(false);\r
- setMenuItemDeleteEnabled(false);\r
- }\r
- if (intOperation == IDefaultMutableTreeNode.OPERATION_ADD) {\r
- setMenuItemAddEnabled(true);\r
- setMenuItemUpdateEnabled(false);\r
- setMenuItemDeleteEnabled(false);\r
- }\r
- if (intOperation == IDefaultMutableTreeNode.OPERATION_UPDATE) {\r
- setMenuItemAddEnabled(false);\r
- setMenuItemUpdateEnabled(true);\r
- setMenuItemDeleteEnabled(false);\r
- }\r
- if (intOperation == IDefaultMutableTreeNode.OPERATION_DELETE) {\r
- setMenuItemAddEnabled(false);\r
- setMenuItemUpdateEnabled(false);\r
- setMenuItemDeleteEnabled(true);\r
- }\r
- if (intOperation == IDefaultMutableTreeNode.OPERATION_ADD_UPDATE) {\r
- setMenuItemAddEnabled(true);\r
- setMenuItemUpdateEnabled(true);\r
- setMenuItemDeleteEnabled(false);\r
- }\r
- if (intOperation == IDefaultMutableTreeNode.OPERATION_ADD_DELETE) {\r
- setMenuItemAddEnabled(true);\r
- setMenuItemUpdateEnabled(false);\r
- setMenuItemDeleteEnabled(true);\r
- }\r
- if (intOperation == IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE) {\r
- setMenuItemAddEnabled(false);\r
- setMenuItemUpdateEnabled(true);\r
- setMenuItemDeleteEnabled(true);\r
- }\r
- if (intOperation == IDefaultMutableTreeNode.OPERATION_ADD_UPDATE_DELETE) {\r
- setMenuItemAddEnabled(true);\r
- setMenuItemUpdateEnabled(true);\r
- setMenuItemDeleteEnabled(true);\r
- }\r
- viewCurrentModule();\r
- }\r
-\r
- /**\r
- Enable/Disable add menu item\r
- \r
- **/\r
- private void setMenuItemAddEnabled(boolean isEnable) {\r
- jMenuItemPopupAdd.setEnabled(isEnable);\r
- }\r
-\r
- /**\r
- Enable/Disable update menu item\r
- \r
- **/\r
- private void setMenuItemUpdateEnabled(boolean isEnable) {\r
- jMenuItemPopupUpdate.setEnabled(isEnable);\r
- jMenuItemEditUpdate.setEnabled(isEnable);\r
- }\r
-\r
- /**\r
- Enable/Disable delete menu item\r
- \r
- **/\r
- private void setMenuItemDeleteEnabled(boolean isEnable) {\r
- jMenuItemPopupDelete.setEnabled(isEnable);\r
- jMenuItemEditDelete.setEnabled(isEnable);\r
- }\r
-\r
- /**\r
- Close current open module\r
-\r
- **/\r
- private void closeCurrentModule() {\r
- cleanAllXml();\r
-\r
- reloadTreeAndTable(ModuleMain.CLOSED);\r
- setMenuItemAddEnabled(false);\r
- setMenuItemUpdateEnabled(false);\r
- setMenuItemDeleteEnabled(false);\r
- cleanDesktopPane();\r
- }\r
-\r
- /**\r
- Remove all Internal Frame of Desktop Pane\r
- \r
- **/\r
- private void cleanDesktopPane() {\r
- JInternalFrame[] iif = this.jDesktopPane.getAllFrames();\r
- for (int index = 0; index < iif.length; index++) {\r
- iif[index].dispose();\r
- }\r
- }\r
-\r
- /**\r
- Set all xml document null\r
- \r
- **/\r
- private void cleanAllXml() {\r
- this.currentModule = "";\r
- this.saveFileName = "";\r
- this.currentModuleType = 0;\r
- this.currentNodeType = 0;\r
-\r
- xmlMsaDoc = null;\r
- xmlMbdDoc = null;\r
- xmlMlsaDoc = null;\r
- xmlMlbdDoc = null;\r
- xmlmh = null;\r
- xmllcd = null;\r
- xmllib = null;\r
- xmlsf = null;\r
- xmlic = null;\r
- xmlpl = null;\r
- xmlen = null;\r
- xmlhob = null;\r
- xmlppi = null;\r
- xmlvb = null;\r
- xmlbm = null;\r
- xmlst = null;\r
- xmldh = null;\r
- xmlfs = null;\r
- xmlgu = null;\r
- xmlet = null;\r
- xmlpcd = null;\r
- xmlbo = null;\r
- }\r
-\r
- /**\r
- Execute add operation for current node \r
- \r
- @param intCategory The category of current node\r
- @param intLocation The location of current node\r
- \r
- **/\r
- private void addCurrentModule(int intCategory, int intLocation) {\r
- //\r
- //Add new libraries\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.LIBRARIES\r
- || intCategory == IDefaultMutableTreeNode.LIBRARIES_LIBRARY\r
- || intCategory == IDefaultMutableTreeNode.LIBRARIES_ARCH) {\r
- showLibraries(ModuleMain.ADD, intCategory, -1);\r
- }\r
-\r
- //\r
- //Add new sourcefiles\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.SOURCEFILES\r
- || intCategory == IDefaultMutableTreeNode.SOURCEFILES_FILENAME\r
- || intCategory == IDefaultMutableTreeNode.SOURCEFILES_ARCH) {\r
- showSourceFiles(ModuleMain.ADD, intCategory, -1);\r
- }\r
-\r
- //\r
- //Add new includes\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.INCLUDES\r
- || intCategory == IDefaultMutableTreeNode.INCLUDES_PACKAGENAME\r
- || intCategory == IDefaultMutableTreeNode.INCLUDES_ARCH) {\r
- showIncludes(ModuleMain.ADD, intCategory, -1);\r
- }\r
-\r
- //\r
- //Add new protocols\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.PROTOCOLS\r
- || intCategory == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOL\r
- || intCategory == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOLNOTIFY) {\r
- showProtocols(ModuleMain.ADD, intCategory, -1);\r
- }\r
-\r
- //\r
- //Add new events\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.EVENTS || intCategory == IDefaultMutableTreeNode.EVENTS_CREATEEVENTS\r
- || intCategory == IDefaultMutableTreeNode.EVENTS_SIGNALEVENTS) {\r
- showEvents(ModuleMain.ADD, intCategory, -1);\r
- }\r
-\r
- //\r
- //Add new hobs\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.HOBS || intCategory == IDefaultMutableTreeNode.HOBS_HOB_ITEM) {\r
- showHobs(ModuleMain.ADD, intCategory, -1);\r
- }\r
-\r
- //\r
- //Add new ppis\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.PPIS || intCategory == IDefaultMutableTreeNode.PPIS_PPI\r
- || intCategory == IDefaultMutableTreeNode.PPIS_PPINOTIFY) {\r
- showPpis(ModuleMain.ADD, intCategory, -1);\r
- }\r
-\r
- //\r
- //Add new variables\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.VARIABLES\r
- || intCategory == IDefaultMutableTreeNode.VARIABLES_VARIABLE_ITEM) {\r
- showVariables(ModuleMain.ADD, intCategory, -1);\r
- }\r
-\r
- //\r
- //Add new BootModes\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.BOOTMODES\r
- || intCategory == IDefaultMutableTreeNode.BOOTMODES_BOOTMODE_ITEM) {\r
- showBootModes(ModuleMain.ADD, intCategory, -1);\r
- }\r
-\r
- //\r
- //Add new SystemTables\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.SYSTEMTABLES\r
- || intCategory == IDefaultMutableTreeNode.SYSTEMTABLES_SYSTEMTABLE_ITEM) {\r
- showSystemTables(ModuleMain.ADD, intCategory, -1);\r
- }\r
-\r
- //\r
- //Add new DataHubs\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.DATAHUBS\r
- || intCategory == IDefaultMutableTreeNode.DATAHUBS_DATAHUB_ITEM) {\r
- showDataHubs(ModuleMain.ADD, intCategory, -1);\r
- }\r
-\r
- //\r
- //Add new Formsets\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.FORMSETS\r
- || intCategory == IDefaultMutableTreeNode.FORMSETS_FORMSET_ITEM) {\r
- showFormsets(ModuleMain.ADD, intCategory, -1);\r
- }\r
-\r
- //\r
- //Add new Guids\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.GUIDS || intCategory == IDefaultMutableTreeNode.GUIDS_GUIDENTRY_ITEM) {\r
- showGuids(ModuleMain.ADD, intCategory, -1);\r
- }\r
-\r
- //\r
- //Add new Externs\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.EXTERNS\r
- || intCategory == IDefaultMutableTreeNode.EXTERNS_EXTERN_ITEM) {\r
- showExterns(ModuleMain.ADD, intCategory, -1);\r
- }\r
-\r
- //\r
- //Add new PCDs\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.PCDS || intCategory == IDefaultMutableTreeNode.PCDS_PCDDATA_ITEM) {\r
- showPCDs(ModuleMain.ADD, intCategory, -1);\r
- }\r
- }\r
-\r
- /**\r
- Execute delete operation of current node\r
- \r
- @param intCategory The category of current node\r
- @param intLocation The location of current node\r
- \r
- **/\r
- private void deleteCurrentModule(int intCategory, int intLocation) {\r
- //\r
- // Delete Msa Header\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.MSA_HEADER || intCategory == IDefaultMutableTreeNode.MBD_HEADER\r
- || intCategory == IDefaultMutableTreeNode.MLSA_HEADER || intCategory == IDefaultMutableTreeNode.MLBD_HEADER) {\r
- if (JOptionPane.showConfirmDialog(null, "The module will be deleted permanently, do you want to continue?") == JOptionPane.YES_OPTION) {\r
- try {\r
- File f = new File(currentModule);\r
- f.delete();\r
- closeCurrentModule();\r
- } catch (Exception e) {\r
- Log.err("Delete " + currentModule, e.getMessage());\r
- }\r
- } else {\r
- return;\r
- }\r
- }\r
-\r
- //\r
- //Delete LIBRARY CLASS DEFINITIONS\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.LIBRARYCLASSDEFINITIONS) {\r
- xmllcd = null;\r
- }\r
-\r
- //\r
- //Delete Libraries\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.LIBRARIES) {\r
- xmllib = null;\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.LIBRARIES_LIBRARY) {\r
- for (int indexI = xmllib.getLibraryList().size() - 1; indexI > -1; indexI--) {\r
- xmllib.removeLibrary(indexI);\r
- }\r
- if (xmllib.getArchList().size() < 1 && xmllib.getLibraryList().size() < 1) {\r
- xmllib = null;\r
- }\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.LIBRARIES_ARCH) {\r
- for (int indexI = xmllib.getArchList().size() - 1; indexI > -1; indexI--) {\r
- xmllib.removeArch(indexI);\r
- }\r
- if (xmllib.getArchList().size() < 1 && xmllib.getLibraryList().size() < 1) {\r
- xmllib = null;\r
- }\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.LIBRARIES_ARCH_ITEM) {\r
- xmllib.removeArch(intLocation);\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.LIBRARIES_LIBRARY_ITEM) {\r
- xmllib.removeLibrary(intLocation);\r
- }\r
-\r
- //\r
- //Delete SourceFiles\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.SOURCEFILES) {\r
- xmlsf = null;\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.SOURCEFILES_FILENAME) {\r
- for (int indexI = xmlsf.getFilenameList().size() - 1; indexI > -1; indexI--) {\r
- xmlsf.removeFilename(indexI);\r
- }\r
- if (xmlsf.getArchList().size() < 1 && xmlsf.getFilenameList().size() < 1) {\r
- xmlsf = null;\r
- }\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.SOURCEFILES_ARCH) {\r
- for (int indexI = xmlsf.getArchList().size() - 1; indexI > -1; indexI--) {\r
- xmlsf.removeArch(indexI);\r
- }\r
- if (xmlsf.getArchList().size() < 1 && xmlsf.getFilenameList().size() < 1) {\r
- xmlsf = null;\r
- }\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.SOURCEFILES_ARCH_ITEM) {\r
- xmlsf.removeArch(intLocation);\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.SOURCEFILES_FILENAME_ITEM) {\r
- xmlsf.removeFilename(intLocation);\r
- }\r
-\r
- //\r
- //Delete Includes\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.INCLUDES) {\r
- xmlic = null;\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.INCLUDES_PACKAGENAME) {\r
- for (int indexI = xmlic.getPackageNameList().size() - 1; indexI > -1; indexI--) {\r
- xmlic.removePackageName(indexI);\r
- }\r
- if (xmlic.getArchList().size() < 1 && xmlic.getPackageNameList().size() < 1) {\r
- xmlic = null;\r
- }\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.INCLUDES_ARCH) {\r
- for (int indexI = xmlic.getArchList().size() - 1; indexI > -1; indexI--) {\r
- xmlic.removeArch(indexI);\r
- }\r
- if (xmlic.getArchList().size() < 1 && xmlic.getPackageNameList().size() < 1) {\r
- xmlic = null;\r
- }\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.INCLUDES_ARCH_ITEM) {\r
- xmlic.removeArch(intLocation);\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.INCLUDES_PACKAGENAME_ITEM) {\r
- xmlic.removePackageName(intLocation);\r
- }\r
-\r
- //\r
- //Delete Protocols\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.PROTOCOLS) {\r
- xmlpl = null;\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOL) {\r
- for (int indexI = xmlpl.getProtocolList().size() - 1; indexI > -1; indexI--) {\r
- xmlpl.removeProtocol(indexI);\r
- }\r
- if (xmlpl.getProtocolList().size() < 1 && xmlpl.getProtocolNotifyList().size() < 1) {\r
- xmlpl = null;\r
- }\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOLNOTIFY) {\r
- for (int indexI = xmlpl.getProtocolList().size() - 1; indexI > -1; indexI--) {\r
- xmlpl.removeProtocolNotify(indexI);\r
- }\r
- if (xmlpl.getProtocolList().size() < 1 && xmlpl.getProtocolNotifyList().size() < 1) {\r
- xmlpl = null;\r
- }\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOL_ITEM) {\r
- xmlpl.removeProtocol(intLocation);\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOLNOTIFY_ITEM) {\r
- xmlpl.removeProtocolNotify(intLocation);\r
- }\r
-\r
- //\r
- //Delete Events\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.EVENTS) {\r
- xmlen = null;\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.EVENTS_CREATEEVENTS) {\r
- for (int indexI = xmlen.getCreateEvents().getEventList().size() - 1; indexI > -1; indexI--) {\r
- xmlen.getCreateEvents().removeEvent(indexI);\r
- }\r
- if (xmlen.getCreateEvents().getEventList().size() < 1 && xmlen.getSignalEvents().getEventList().size() < 1) {\r
- xmlen = null;\r
- }\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.EVENTS_SIGNALEVENTS) {\r
- for (int indexI = xmlen.getSignalEvents().getEventList().size() - 1; indexI > -1; indexI--) {\r
- xmlen.getSignalEvents().removeEvent(indexI);\r
- }\r
- if (xmlen.getCreateEvents().getEventList().size() < 1 && xmlen.getSignalEvents().getEventList().size() < 1) {\r
- xmlen = null;\r
- }\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.EVENTS_CREATEEVENTS_ITEM) {\r
- xmlen.getCreateEvents().removeEvent(intLocation);\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.EVENTS_SIGNALEVENTS_ITEM) {\r
- xmlen.getSignalEvents().removeEvent(intLocation);\r
- }\r
-\r
- //\r
- //Delete Hobs\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.HOBS) {\r
- xmlhob = null;\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.HOBS_HOB_ITEM) {\r
- xmlhob.removeHob(intLocation);\r
- if (xmlhob.getHobList().size() < 1) {\r
- xmlhob = null;\r
- }\r
- }\r
-\r
- //\r
- //Delete Ppis\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.PPIS) {\r
- xmlppi = null;\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.PPIS_PPI) {\r
- for (int indexI = xmlppi.getPpiList().size() - 1; indexI > -1; indexI--) {\r
- xmlppi.removePpi(indexI);\r
- }\r
- if (xmlppi.getPpiList().size() < 1 && xmlppi.getPpiNotifyList().size() < 1) {\r
- xmlppi = null;\r
- }\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.PPIS_PPINOTIFY) {\r
- for (int indexI = xmlppi.getPpiNotifyList().size() - 1; indexI > -1; indexI--) {\r
- xmlppi.removePpiNotify(indexI);\r
- }\r
- if (xmlppi.getPpiList().size() < 1 && xmlppi.getPpiNotifyList().size() < 1) {\r
- xmlppi = null;\r
- }\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.PPIS_PPI_ITEM) {\r
- xmlppi.removePpi(intLocation);\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.PPIS_PPINOTIFY_ITEM) {\r
- xmlppi.removePpiNotify(intLocation);\r
- }\r
-\r
- //\r
- //Delete Variables\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.VARIABLES) {\r
- xmlvb = null;\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.VARIABLES_VARIABLE_ITEM) {\r
- xmlvb.removeVariable(intLocation);\r
- if (xmlvb.getVariableList().size() < 1) {\r
- xmlvb = null;\r
- }\r
- }\r
-\r
- //\r
- //Delete BootModes\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.BOOTMODES) {\r
- xmlbm = null;\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.BOOTMODES_BOOTMODE_ITEM) {\r
- xmlbm.removeBootMode(intLocation);\r
- if (xmlbm.getBootModeList().size() < 1) {\r
- xmlbm = null;\r
- }\r
- }\r
-\r
- //\r
- //Delete SystemTables\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.SYSTEMTABLES) {\r
- xmlst = null;\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.SYSTEMTABLES_SYSTEMTABLE_ITEM) {\r
- xmlst.removeSystemTable(intLocation);\r
- if (xmlst.getSystemTableList().size() < 1) {\r
- xmlst = null;\r
- }\r
- }\r
-\r
- //\r
- //Delete DataHubs\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.DATAHUBS) {\r
- xmldh = null;\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.DATAHUBS_DATAHUB_ITEM) {\r
- xmldh.removeDataHubRecord(intLocation);\r
- if (xmldh.getDataHubRecordList().size() < 1) {\r
- xmldh = null;\r
- }\r
- }\r
-\r
- //\r
- //Delete Formsets\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.FORMSETS) {\r
- xmlfs = null;\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.FORMSETS_FORMSET_ITEM) {\r
- xmlfs.removeFormset(intLocation);\r
- if (xmlfs.getFormsetList().size() < 1) {\r
- xmlfs = null;\r
- }\r
- }\r
-\r
- //\r
- //Delete Guids\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.GUIDS) {\r
- xmlgu = null;\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.GUIDS_GUIDENTRY_ITEM) {\r
- xmlgu.removeGuidEntry(intLocation);\r
- if (xmlgu.getGuidEntryList().size() < 1) {\r
- xmlgu = null;\r
- }\r
- }\r
-\r
- //\r
- //Delete Externs\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.EXTERNS) {\r
- xmlet = null;\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.EXTERNS_EXTERN_ITEM) {\r
- xmlet.removeExtern(intLocation);\r
- if (xmlet.getExternList().size() < 1) {\r
- xmlet = null;\r
- }\r
- }\r
-\r
- //\r
- //Delete PCDs\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.PCDS) {\r
- xmlpcd = null;\r
- }\r
- if (intCategory == IDefaultMutableTreeNode.PCDS_PCDDATA_ITEM) {\r
- xmlpcd.removePcdData(intLocation);\r
- if (xmlpcd.getPcdDataList().size() < 1) {\r
- xmlpcd = null;\r
- }\r
- }\r
- this.cleanDesktopPane();\r
- reloadTreeAndTable(UPDATE_WITH_CHANGE);\r
- }\r
-\r
- /**\r
- View current Module\r
- \r
- **/\r
- private void viewCurrentModule() {\r
- int intCategory = iTree.getSelectCategory();\r
- int intLocation = iTree.getSelectLoaction();\r
- //\r
- //View Msa Header\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.MSA_HEADER) {\r
- showMsaHeader(ModuleMain.VIEW);\r
- }\r
-\r
- //\r
- //View Mbd Header\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.MBD_HEADER) {\r
- showMbdHeader(ModuleMain.VIEW);\r
- }\r
-\r
- //\r
- //View Msa Lib Header\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.MLSA_HEADER) {\r
- showMlsaHeader(ModuleMain.VIEW);\r
- }\r
-\r
- //\r
- //View Mbd Lib Header\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.MLBD_HEADER) {\r
- showMlbdHeader(ModuleMain.VIEW);\r
- }\r
-\r
- //\r
- //View Libraries\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.LIBRARIES_LIBRARY\r
- || intCategory == IDefaultMutableTreeNode.LIBRARIES_ARCH_ITEM) {\r
- showLibraries(ModuleMain.VIEW, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //View LIBRARY CLASS DEFINITIONS\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.LIBRARYCLASSDEFINITIONS) {\r
- showLibraryClassDefinitions(ModuleMain.VIEW, intCategory);\r
- }\r
-\r
- //\r
- //View Source Files\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.SOURCEFILES_FILENAME\r
- || intCategory == IDefaultMutableTreeNode.SOURCEFILES_ARCH_ITEM) {\r
- showSourceFiles(ModuleMain.VIEW, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //View Includes\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.INCLUDES_PACKAGENAME\r
- || intCategory == IDefaultMutableTreeNode.INCLUDES_ARCH_ITEM) {\r
- showIncludes(ModuleMain.VIEW, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //View Protocols\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOL_ITEM\r
- || intCategory == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOLNOTIFY_ITEM) {\r
- showProtocols(ModuleMain.VIEW, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //View Hobs\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.HOBS_HOB_ITEM) {\r
- showHobs(ModuleMain.VIEW, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //View Events\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.EVENTS_CREATEEVENTS_ITEM\r
- || intCategory == IDefaultMutableTreeNode.EVENTS_SIGNALEVENTS_ITEM) {\r
- showEvents(ModuleMain.VIEW, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //View Ppis\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.PPIS_PPI_ITEM\r
- || intCategory == IDefaultMutableTreeNode.PPIS_PPINOTIFY_ITEM) {\r
- showPpis(ModuleMain.VIEW, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //View Variables\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.VARIABLES_VARIABLE_ITEM) {\r
- showVariables(ModuleMain.VIEW, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //View BootModes\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.BOOTMODES_BOOTMODE_ITEM) {\r
- showBootModes(ModuleMain.VIEW, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //View SystemTables\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.SYSTEMTABLES_SYSTEMTABLE_ITEM) {\r
- showSystemTables(ModuleMain.VIEW, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //View DataHubs\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.DATAHUBS_DATAHUB_ITEM) {\r
- showDataHubs(ModuleMain.VIEW, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //View Formsets\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.FORMSETS_FORMSET_ITEM) {\r
- showFormsets(ModuleMain.VIEW, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //View Guids\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.GUIDS_GUIDENTRY_ITEM) {\r
- showGuids(ModuleMain.VIEW, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //View Externs\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.EXTERNS_EXTERN_ITEM) {\r
- showExterns(ModuleMain.VIEW, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //View PCDs\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.PCDS_PCDDATA_ITEM) {\r
- showPCDs(ModuleMain.VIEW, intCategory, intLocation);\r
- }\r
- }\r
-\r
- /**\r
- Execute update operation of current module\r
- \r
- @param intCategory The category of current node\r
- @param intLocation The location of current node\r
- \r
- **/\r
- private void updateCurrentModule(int intCategory, int intLocation) {\r
- //\r
- //Update Msa Header\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.MSA_HEADER) {\r
- showMsaHeader(ModuleMain.UPDATE);\r
- }\r
-\r
- //\r
- //Update Mbd Header\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.MBD_HEADER) {\r
- showMbdHeader(ModuleMain.UPDATE);\r
- }\r
-\r
- //\r
- //Update Msa Lib Header\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.MLSA_HEADER) {\r
- showMlsaHeader(ModuleMain.UPDATE);\r
- }\r
-\r
- //\r
- //Update Mbd Lib Header\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.MLBD_HEADER) {\r
- showMlbdHeader(ModuleMain.UPDATE);\r
- }\r
-\r
- //\r
- //Update Libraries\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.LIBRARIES_LIBRARY\r
- || intCategory == IDefaultMutableTreeNode.LIBRARIES_ARCH_ITEM) {\r
- showLibraries(ModuleMain.UPDATE, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //Update LIBRARY CLASS DEFINITIONS\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.LIBRARYCLASSDEFINITIONS) {\r
- showLibraryClassDefinitions(ModuleMain.UPDATE, intCategory);\r
- }\r
-\r
- //\r
- //Update Source Files\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.SOURCEFILES_FILENAME\r
- || intCategory == IDefaultMutableTreeNode.SOURCEFILES_ARCH_ITEM) {\r
- showSourceFiles(ModuleMain.UPDATE, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //Update Includes\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.INCLUDES_PACKAGENAME\r
- || intCategory == IDefaultMutableTreeNode.INCLUDES_ARCH_ITEM) {\r
- showIncludes(ModuleMain.UPDATE, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //Update Protocols\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOL_ITEM\r
- || intCategory == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOLNOTIFY_ITEM) {\r
- showProtocols(ModuleMain.UPDATE, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //Update Hobs\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.HOBS_HOB_ITEM) {\r
- showHobs(ModuleMain.UPDATE, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //Update Events\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.EVENTS_CREATEEVENTS_ITEM\r
- || intCategory == IDefaultMutableTreeNode.EVENTS_SIGNALEVENTS_ITEM) {\r
- showEvents(ModuleMain.UPDATE, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //Update Ppis\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.PPIS_PPI_ITEM\r
- || intCategory == IDefaultMutableTreeNode.PPIS_PPINOTIFY_ITEM) {\r
- showPpis(ModuleMain.UPDATE, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //Update Variables\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.VARIABLES_VARIABLE_ITEM) {\r
- showVariables(ModuleMain.UPDATE, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //Update BootModes\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.BOOTMODES_BOOTMODE_ITEM) {\r
- showBootModes(ModuleMain.UPDATE, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //Update SystemTables\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.SYSTEMTABLES_SYSTEMTABLE_ITEM) {\r
- showSystemTables(ModuleMain.UPDATE, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //Update DataHubs\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.DATAHUBS_DATAHUB_ITEM) {\r
- showDataHubs(ModuleMain.UPDATE, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //Update Formsets\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.FORMSETS_FORMSET_ITEM) {\r
- showFormsets(ModuleMain.UPDATE, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //Update Guids\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.GUIDS_GUIDENTRY_ITEM) {\r
- showGuids(ModuleMain.UPDATE, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //Update Externs\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.EXTERNS_EXTERN_ITEM) {\r
- showExterns(ModuleMain.UPDATE, intCategory, intLocation);\r
- }\r
-\r
- //\r
- //Update PCDs\r
- //\r
- if (intCategory == IDefaultMutableTreeNode.PCDS_PCDDATA_ITEM) {\r
- showPCDs(ModuleMain.UPDATE, intCategory, intLocation);\r
- }\r
- }\r
-\r
- /**\r
- Save current module\r
- Call relevant function via different file types\r
- \r
- **/\r
- private void saveCurrentModule() {\r
- if (this.saveFileName == "") {\r
- openFile(2, this.currentModuleType);\r
- }\r
- if (this.saveFileName == "") {\r
- this.saveFileName = this.currentModule;\r
- return;\r
- } else {\r
- switch (this.currentModuleType) {\r
- case 1:\r
- saveMsa();\r
- break;\r
- case 2:\r
- saveMbd();\r
- break;\r
- case 3:\r
- saveMlsa();\r
- break;\r
- case 4:\r
- saveMlbd();\r
- break;\r
- }\r
-\r
- }\r
-\r
- reloadTreeAndTable(SAVE_WITH_CHANGE);\r
- }\r
-\r
- /**\r
- Save current module as\r
- \r
- **/\r
- private void saveAsCurrentModule() {\r
- this.saveFileName = "";\r
- saveCurrentModule();\r
- }\r
-\r
- /**\r
- Save file as msa\r
- \r
- **/\r
- private void saveMsa() {\r
- File f = new File(this.saveFileName);\r
- ModuleSurfaceAreaDocument msaDoc = ModuleSurfaceAreaDocument.Factory.newInstance();\r
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = ModuleSurfaceAreaDocument.ModuleSurfaceArea.Factory\r
- .newInstance();\r
-\r
- //\r
- //Add all components into xml doc file\r
- //\r
- if (xmlmh != null) {\r
- msa.setMsaHeader(xmlmh);\r
- }\r
- if (xmllcd != null) {\r
- msa.setLibraryClassDefinitions(xmllcd);\r
- }\r
- if (xmlsf != null) {\r
- msa.setSourceFiles(xmlsf);\r
- }\r
- if (xmlic != null) {\r
- msa.setIncludes(xmlic);\r
- }\r
- if (xmlpl != null) {\r
- msa.setProtocols(xmlpl);\r
- }\r
- if (xmlen != null) {\r
- msa.setEvents(xmlen);\r
- }\r
- if (xmlhob != null) {\r
- msa.setHobs(xmlhob);\r
- }\r
- if (xmlppi != null) {\r
- msa.setPPIs(xmlppi);\r
- }\r
- if (xmlvb != null) {\r
- msa.setVariables(xmlvb);\r
- }\r
- if (xmlbm != null) {\r
- msa.setBootModes(xmlbm);\r
- }\r
- if (xmlst != null) {\r
- msa.setSystemTables(xmlst);\r
- }\r
- if (xmldh != null) {\r
- msa.setDataHubs(xmldh);\r
- }\r
- if (xmlfs != null) {\r
- msa.setFormsets(xmlfs);\r
- }\r
- if (xmlgu != null) {\r
- msa.setGuids(xmlgu);\r
- }\r
- if (xmlet != null) {\r
- msa.setExterns(xmlet);\r
- }\r
- if (xmlpcd != null) {\r
- msa.setPCDs(xmlpcd);\r
- }\r
- if (xmlbo != null) {\r
- msa.setBuildOptions(xmlbo);\r
- }\r
- //\r
- //Init namespace\r
- //\r
- XmlCursor cursor = msa.newCursor();\r
- String uri = "http://www.TianoCore.org/2006/Edk2.0";\r
- cursor.push();\r
- cursor.toNextToken();\r
- cursor.insertNamespace("", uri);\r
- cursor.insertNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");\r
- cursor.pop();\r
-\r
- //\r
- //Config file format\r
- //\r
- XmlOptions options = new XmlOptions();\r
- options.setCharacterEncoding("UTF-8");\r
- options.setSavePrettyPrint();\r
- options.setSavePrettyPrintIndent(2);\r
-\r
- //\r
- //Create finial doc\r
- //\r
- msaDoc.addNewModuleSurfaceArea();\r
- msaDoc.setModuleSurfaceArea((ModuleSurfaceAreaDocument.ModuleSurfaceArea) cursor.getObject());\r
- try {\r
- //\r
- //Save the file\r
- //\r
- msaDoc.save(f, options);\r
- this.currentModule = this.saveFileName;\r
- } catch (Exception e) {\r
- Log.err("Save Msa", e.getMessage());\r
- }\r
- }\r
-\r
- /**\r
- Save file as mbd\r
- \r
- **/\r
- private void saveMbd() {\r
- File f = new File(this.saveFileName);\r
- ModuleBuildDescriptionDocument mbdDoc = ModuleBuildDescriptionDocument.Factory.newInstance();\r
- ModuleBuildDescriptionDocument.ModuleBuildDescription mbd = ModuleBuildDescriptionDocument.ModuleBuildDescription.Factory\r
- .newInstance();\r
- //\r
- //Add all components into xml doc file\r
- //\r
- if (xmlmbdh != null) {\r
- mbd.setMbdHeader(xmlmbdh);\r
- }\r
- if (xmllib != null) {\r
- mbd.setLibraries(xmllib);\r
- }\r
- if (xmlsf != null) {\r
- mbd.setSourceFiles(xmlsf);\r
- }\r
- if (xmlic != null) {\r
- mbd.setIncludes(xmlic);\r
- }\r
- if (xmlpl != null) {\r
- mbd.setProtocols(xmlpl);\r
- }\r
- if (xmlen != null) {\r
- mbd.setEvents(xmlen);\r
- }\r
- if (xmlhob != null) {\r
- mbd.setHobs(xmlhob);\r
- }\r
- if (xmlppi != null) {\r
- mbd.setPPIs(xmlppi);\r
- }\r
- if (xmlvb != null) {\r
- mbd.setVariables(xmlvb);\r
- }\r
- if (xmlbm != null) {\r
- mbd.setBootModes(xmlbm);\r
- }\r
- if (xmlst != null) {\r
- mbd.setSystemTables(xmlst);\r
- }\r
- if (xmldh != null) {\r
- mbd.setDataHubs(xmldh);\r
- }\r
- if (xmlfs != null) {\r
- mbd.setFormsets(xmlfs);\r
- }\r
- if (xmlgu != null) {\r
- mbd.setGuids(xmlgu);\r
- }\r
- if (xmlet != null) {\r
- mbd.setExterns(xmlet);\r
- }\r
- if (xmlpcd != null) {\r
- mbd.setPCDs(xmlpcd);\r
- }\r
- if (xmlbo != null) {\r
- mbd.setBuildOptions(xmlbo);\r
- }\r
- //\r
- //Init namespace\r
- //\r
- XmlCursor cursor = mbd.newCursor();\r
- String uri = "http://www.TianoCore.org/2006/Edk2.0";\r
- cursor.push();\r
- cursor.toNextToken();\r
- cursor.insertNamespace("", uri);\r
- cursor.insertNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");\r
- cursor.pop();\r
-\r
- //\r
- //Config file format\r
- //\r
- XmlOptions options = new XmlOptions();\r
- options.setCharacterEncoding("UTF-8");\r
- options.setSavePrettyPrint();\r
- options.setSavePrettyPrintIndent(2);\r
-\r
- //\r
- //Create finial doc\r
- //\r
- mbdDoc.addNewModuleBuildDescription();\r
- mbdDoc.setModuleBuildDescription((ModuleBuildDescriptionDocument.ModuleBuildDescription) cursor.getObject());\r
- try {\r
- //\r
- //Save the file\r
- //\r
- mbdDoc.save(f, options);\r
- this.currentModule = this.saveFileName;\r
- } catch (Exception e) {\r
- Log.err("Save Mbd", e.getMessage());\r
- }\r
- }\r
-\r
- /**\r
- Save file as mlsa\r
- \r
- **/\r
- private void saveMlsa() {\r
- File f = new File(this.saveFileName);\r
- LibraryModuleSurfaceAreaDocument mlsaDoc = LibraryModuleSurfaceAreaDocument.Factory.newInstance();\r
- LibraryModuleSurfaceAreaDocument.LibraryModuleSurfaceArea mlsa = LibraryModuleSurfaceAreaDocument.LibraryModuleSurfaceArea.Factory\r
- .newInstance();\r
- //\r
- //Add all components into xml doc file\r
- //\r
- if (xmlmlh != null) {\r
- mlsa.setMsaLibHeader(xmlmlh);\r
- }\r
- if (xmllcd != null) {\r
- mlsa.setLibraryClassDefinitions(xmllcd);\r
- }\r
- if (xmlsf != null) {\r
- mlsa.setSourceFiles(xmlsf);\r
- }\r
- if (xmlic != null) {\r
- mlsa.setIncludes(xmlic);\r
- }\r
- if (xmlpl != null) {\r
- mlsa.setProtocols(xmlpl);\r
- }\r
- if (xmlen != null) {\r
- mlsa.setEvents(xmlen);\r
- }\r
- if (xmlhob != null) {\r
- mlsa.setHobs(xmlhob);\r
- }\r
- if (xmlppi != null) {\r
- mlsa.setPPIs(xmlppi);\r
- }\r
- if (xmlvb != null) {\r
- mlsa.setVariables(xmlvb);\r
- }\r
- if (xmlbm != null) {\r
- mlsa.setBootModes(xmlbm);\r
- }\r
- if (xmlst != null) {\r
- mlsa.setSystemTables(xmlst);\r
- }\r
- if (xmldh != null) {\r
- mlsa.setDataHubs(xmldh);\r
- }\r
- if (xmlfs != null) {\r
- mlsa.setFormsets(xmlfs);\r
- }\r
- if (xmlgu != null) {\r
- mlsa.setGuids(xmlgu);\r
- }\r
- if (xmlet != null) {\r
- mlsa.setExterns(xmlet);\r
- }\r
- if (xmlpcd != null) {\r
- mlsa.setPCDs(xmlpcd);\r
- }\r
- if (xmlbo != null) {\r
- mlsa.setBuildOptions(xmlbo);\r
- }\r
- //\r
- //Init namespace\r
- //\r
- XmlCursor cursor = mlsa.newCursor();\r
- String uri = "http://www.TianoCore.org/2006/Edk2.0";\r
- cursor.push();\r
- cursor.toNextToken();\r
- cursor.insertNamespace("", uri);\r
- cursor.insertNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");\r
- cursor.pop();\r
-\r
- //\r
- //Config file format\r
- //\r
- XmlOptions options = new XmlOptions();\r
- options.setCharacterEncoding("UTF-8");\r
- options.setSavePrettyPrint();\r
- options.setSavePrettyPrintIndent(2);\r
-\r
- //\r
- //Create finial doc\r
- //\r
- mlsaDoc.addNewLibraryModuleSurfaceArea();\r
- mlsaDoc\r
- .setLibraryModuleSurfaceArea((LibraryModuleSurfaceAreaDocument.LibraryModuleSurfaceArea) cursor\r
- .getObject());\r
- try {\r
- //\r
- //Save the file\r
- //\r
- mlsaDoc.save(f, options);\r
- this.currentModule = this.saveFileName;\r
- } catch (Exception e) {\r
- Log.err("Save Mlsa", e.getMessage());\r
- }\r
- }\r
-\r
- /**\r
- Save file as mbd\r
- \r
- **/\r
- private void saveMlbd() {\r
- File f = new File(this.saveFileName);\r
- LibraryModuleBuildDescriptionDocument mlbdDoc = LibraryModuleBuildDescriptionDocument.Factory.newInstance();\r
- LibraryModuleBuildDescriptionDocument.LibraryModuleBuildDescription mlbd = LibraryModuleBuildDescriptionDocument.LibraryModuleBuildDescription.Factory\r
- .newInstance();\r
- //\r
- //Add all components into xml doc file\r
- //\r
- if (xmlmlbdh != null) {\r
- mlbd.setMbdLibHeader(xmlmlbdh);\r
- }\r
- if (xmllib != null) {\r
- mlbd.setLibraries(xmllib);\r
- }\r
- if (xmlsf != null) {\r
- mlbd.setSourceFiles(xmlsf);\r
- }\r
- if (xmlic != null) {\r
- mlbd.setIncludes(xmlic);\r
- }\r
- if (xmlpl != null) {\r
- mlbd.setProtocols(xmlpl);\r
- }\r
- if (xmlen != null) {\r
- mlbd.setEvents(xmlen);\r
- }\r
- if (xmlhob != null) {\r
- mlbd.setHobs(xmlhob);\r
- }\r
- if (xmlppi != null) {\r
- mlbd.setPPIs(xmlppi);\r
- }\r
- if (xmlvb != null) {\r
- mlbd.setVariables(xmlvb);\r
- }\r
- if (xmlbm != null) {\r
- mlbd.setBootModes(xmlbm);\r
- }\r
- if (xmlst != null) {\r
- mlbd.setSystemTables(xmlst);\r
- }\r
- if (xmldh != null) {\r
- mlbd.setDataHubs(xmldh);\r
- }\r
- if (xmlfs != null) {\r
- mlbd.setFormsets(xmlfs);\r
- }\r
- if (xmlgu != null) {\r
- mlbd.setGuids(xmlgu);\r
- }\r
- if (xmlet != null) {\r
- mlbd.setExterns(xmlet);\r
- }\r
- if (xmlpcd != null) {\r
- mlbd.setPCDs(xmlpcd);\r
- }\r
- if (xmlbo != null) {\r
- mlbd.setBuildOptions(xmlbo);\r
- }\r
- //\r
- //Init namespace\r
- //\r
- XmlCursor cursor = mlbd.newCursor();\r
- String uri = "http://www.TianoCore.org/2006/Edk2.0";\r
- cursor.push();\r
- cursor.toNextToken();\r
- cursor.insertNamespace("", uri);\r
- cursor.insertNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");\r
- cursor.pop();\r
-\r
- //\r
- //Config file format\r
- //\r
- XmlOptions options = new XmlOptions();\r
- options.setCharacterEncoding("UTF-8");\r
- options.setSavePrettyPrint();\r
- options.setSavePrettyPrintIndent(2);\r
-\r
- //\r
- //Create finial doc\r
- //\r
- mlbdDoc.addNewLibraryModuleBuildDescription();\r
- mlbdDoc\r
- .setLibraryModuleBuildDescription((LibraryModuleBuildDescriptionDocument.LibraryModuleBuildDescription) cursor\r
- .getObject());\r
- try {\r
- //\r
- //Save the file\r
- //\r
- mlbdDoc.save(f, options);\r
- this.currentModule = this.saveFileName;\r
- } catch (Exception e) {\r
- Log.err("Save Mbd", e.getMessage());\r
- }\r
- }\r
-\r
- /**\r
- Reflash the tree via current value of xml documents.\r
- \r
- @param intMode The input data of current operation type\r
- \r
- **/\r
- private void reloadTreeAndTable(int intMode) {\r
- makeTree();\r
- if (intMode == ModuleMain.OPENED) {\r
- this.jMenuItemModuleClose.setEnabled(true);\r
- this.jMenuItemModuleSaveAs.setEnabled(true);\r
- this.jMenuEditAdd.setEnabled(true);\r
- this.setTitle(windowTitle + "- [" + this.currentModule + "]");\r
- this.jButtonOk.setEnabled(false);\r
- this.jButtonCancel.setEnabled(false);\r
- }\r
- if (intMode == ModuleMain.CLOSED) {\r
- this.jMenuItemModuleClose.setEnabled(false);\r
- this.jMenuItemModuleSave.setEnabled(false);\r
- this.jMenuItemModuleSaveAs.setEnabled(false);\r
- this.jMenuEditAdd.setEnabled(false);\r
- this.setTitle(windowTitle + "- [" + ws.getCurrentWorkspace() + "]");\r
- this.setButtonEnable(false);\r
- }\r
- if (intMode == ModuleMain.NEW_WITHOUT_CHANGE) {\r
-\r
- }\r
-\r
- if (intMode == ModuleMain.NEW_WITH_CHANGE) {\r
- this.jMenuItemModuleClose.setEnabled(true);\r
- this.jMenuItemModuleSave.setEnabled(true);\r
- this.jMenuItemModuleSaveAs.setEnabled(true);\r
- this.jMenuEditAdd.setEnabled(true);\r
- setButtonEnable(false);\r
- }\r
- if (intMode == ModuleMain.UPDATE_WITHOUT_CHANGE) {\r
-\r
- }\r
- if (intMode == ModuleMain.UPDATE_WITH_CHANGE) {\r
- this.jMenuItemModuleClose.setEnabled(true);\r
- this.jMenuItemModuleSave.setEnabled(true);\r
- this.jMenuItemModuleSaveAs.setEnabled(true);\r
- }\r
- if (intMode == ModuleMain.SAVE_WITHOUT_CHANGE) {\r
- this.jMenuItemModuleClose.setEnabled(true);\r
- this.jMenuItemModuleSave.setEnabled(true);\r
- this.jMenuItemModuleSaveAs.setEnabled(true);\r
- this.jButtonOk.setEnabled(false);\r
- this.jButtonCancel.setEnabled(false);\r
- }\r
- if (intMode == ModuleMain.SAVE_WITH_CHANGE) {\r
- this.jMenuItemModuleClose.setEnabled(true);\r
- this.jMenuItemModuleSave.setEnabled(false);\r
- this.jMenuItemModuleSaveAs.setEnabled(true);\r
- this.jMenuItemEditUpdate.setEnabled(false);\r
- this.jMenuItemEditDelete.setEnabled(false);\r
- this.setTitle(windowTitle + "- [" + this.currentModule + "]");\r
- this.jButtonOk.setEnabled(false);\r
- this.jButtonCancel.setEnabled(false);\r
- }\r
-\r
- if (this.currentModuleType == 1 || this.currentModuleType == 3) {\r
- this.jMenuItemEditAddLibraries.setEnabled(false);\r
- this.jMenuItemEditAddLibraryClassDefinitions.setEnabled(true);\r
- }\r
- if (this.currentModuleType == 2 || this.currentModuleType == 4) {\r
- this.jMenuItemEditAddLibraries.setEnabled(true);\r
- this.jMenuItemEditAddLibraryClassDefinitions.setEnabled(false);\r
- }\r
- }\r
-\r
- /**\r
- Enable/Disable button Ok and Cancel\r
- \r
- @param isEnabled The input data to indicate if button is enabled or not\r
- \r
- **/\r
- private void setButtonEnable(boolean isEnabled) {\r
- this.jButtonCancel.setEnabled(isEnabled);\r
- this.jButtonOk.setEnabled(isEnabled);\r
- }\r
-\r
- /**\r
- Show msa header\r
- When the operation is VIEW, disable all fields of internal frame\r
- \r
- @param type The input data of operation type\r
- \r
- **/\r
- private void showMsaHeader(int type) {\r
- msa = null;\r
- msa = new MsaHeader(this.xmlmh);\r
- this.jDesktopPane.removeAll();\r
- this.jDesktopPane.add(msa, 1);\r
- this.currentNodeType = IDefaultMutableTreeNode.MSA_HEADER;\r
- this.currentModuleType = 1;\r
- if (type == ModuleMain.VIEW) {\r
- setButtonEnable(false);\r
- msa.setViewMode(true);\r
- } else {\r
- setButtonEnable(true);\r
- }\r
- }\r
-\r
- /**\r
- Show MbdHeader\r
- When the operation is VIEW, disable all fields of internal frame\r
- \r
- @param type The input data of operation type\r
- \r
- **/\r
- private void showMbdHeader(int type) {\r
- mbd = null;\r
- mbd = new MbdHeader(this.xmlmbdh);\r
- this.jDesktopPane.removeAll();\r
- this.jDesktopPane.add(mbd, 1);\r
- this.currentNodeType = IDefaultMutableTreeNode.MBD_HEADER;\r
- this.currentModuleType = 2;\r
- if (type == ModuleMain.VIEW) {\r
- setButtonEnable(false);\r
- mbd.setViewMode(true);\r
- } else {\r
- setButtonEnable(true);\r
- }\r
- }\r
-\r
- /**\r
- Show MlsaHeader\r
- When the operation is VIEW, disable all fields of internal frame\r
- \r
- @param type The input data of operation type\r
- \r
- **/\r
- private void showMlsaHeader(int type) {\r
- mlsa = null;\r
- mlsa = new MsaLibHeader(this.xmlmlh);\r
- this.jDesktopPane.removeAll();\r
- this.jDesktopPane.add(mlsa, 1);\r
- this.currentNodeType = IDefaultMutableTreeNode.MLSA_HEADER;\r
- this.currentModuleType = 3;\r
- if (type == ModuleMain.VIEW) {\r
- setButtonEnable(false);\r
- mlsa.setViewMode(true);\r
- } else {\r
- setButtonEnable(true);\r
- }\r
- }\r
-\r
- /**\r
- Show MlbdHeader\r
- When the operation is VIEW, disable all fields of internal frame\r
- \r
- @param type The input data of operation type\r
- \r
- **/\r
- private void showMlbdHeader(int type) {\r
- mlbd = null;\r
- mlbd = new MbdLibHeader(this.xmlmlbdh);\r
- this.jDesktopPane.removeAll();\r
- this.jDesktopPane.add(mlbd, 1);\r
- this.currentNodeType = IDefaultMutableTreeNode.MLBD_HEADER;\r
- this.currentModuleType = 4;\r
- if (type == ModuleMain.VIEW) {\r
- setButtonEnable(false);\r
- mlbd.setViewMode(true);\r
- } else {\r
- setButtonEnable(true);\r
- }\r
- }\r
-\r
- /**\r
- Show Libraries\r
- When the operation is VIEW, disable all fields of internal frame\r
- \r
- @param type The input data of operation type\r
- \r
- **/\r
- private void showLibraries(int operationType, int nodeType, int location) {\r
- mlib = null;\r
- if (operationType == ModuleMain.ADD) {\r
- mlib = new MbdLibraries(this.xmllib, -1, -1, 1);\r
- }\r
- if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {\r
- mlib = new MbdLibraries(this.xmllib, nodeType, location, 2);\r
- }\r
- this.jDesktopPane.removeAll();\r
- this.jDesktopPane.add(mlib, 1);\r
- this.currentNodeType = nodeType;\r
- if (operationType == ModuleMain.VIEW) {\r
- setButtonEnable(false);\r
- mlib.setViewMode(true);\r
- } else {\r
- setButtonEnable(true);\r
- }\r
- }\r
-\r
- /**\r
- Show LibraryClassDefinitions\r
- When the operation is VIEW, disable all fields of internal frame\r
- \r
- @param type The input data of operation type\r
- \r
- **/\r
- private void showLibraryClassDefinitions(int operationType, int nodeType) {\r
- mlcd = null;\r
- if (operationType == ModuleMain.ADD) {\r
- mlcd = new ModuleLibraryClassDefinitions(this.xmllcd);\r
- }\r
- if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {\r
- mlcd = new ModuleLibraryClassDefinitions(this.xmllcd);\r
- }\r
- this.jDesktopPane.removeAll();\r
- this.jDesktopPane.add(mlcd, 1);\r
- this.currentNodeType = nodeType;\r
- if (operationType == ModuleMain.VIEW) {\r
- setButtonEnable(false);\r
- mlcd.setViewMode(true);\r
- } else {\r
- setButtonEnable(true);\r
- }\r
- }\r
-\r
- /**\r
- Show SourceFiles\r
- When the operation is VIEW, disable all fields of internal frame\r
- \r
- @param type The input data of operation type\r
- \r
- **/\r
- private void showSourceFiles(int operationType, int nodeType, int location) {\r
- msf = null;\r
- if (operationType == ModuleMain.ADD) {\r
- msf = new ModuleSourceFiles(this.xmlsf, -1, -1, 1);\r
- }\r
- if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {\r
- msf = new ModuleSourceFiles(this.xmlsf, nodeType, location, 2);\r
- }\r
- this.jDesktopPane.removeAll();\r
- this.jDesktopPane.add(msf, 1);\r
- this.currentNodeType = nodeType;\r
- if (operationType == ModuleMain.VIEW) {\r
- setButtonEnable(false);\r
- msf.setViewMode(true);\r
- } else {\r
- setButtonEnable(true);\r
- }\r
- }\r
-\r
- /**\r
- Show Includes\r
- When the operation is VIEW, disable all fields of internal frame\r
- \r
- @param type The input data of operation type\r
- \r
- **/\r
- private void showIncludes(int operationType, int nodeType, int location) {\r
- mic = null;\r
- if (operationType == ModuleMain.ADD) {\r
- mic = new ModuleIncludes(this.xmlic, -1, -1, 1);\r
- }\r
- if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {\r
- mic = new ModuleIncludes(this.xmlic, nodeType, location, 2);\r
- }\r
- this.jDesktopPane.removeAll();\r
- this.jDesktopPane.add(mic, 1);\r
- this.currentNodeType = nodeType;\r
- if (operationType == ModuleMain.VIEW) {\r
- setButtonEnable(false);\r
- mic.setViewMode(true);\r
- } else {\r
- setButtonEnable(true);\r
- }\r
- }\r
-\r
- /**\r
- Show Protocols\r
- When the operation is VIEW, disable all fields of internal frame\r
- \r
- @param type The input data of operation type\r
- \r
- **/\r
- private void showProtocols(int operationType, int nodeType, int location) {\r
- mp = null;\r
- if (operationType == ModuleMain.ADD) {\r
- mp = new ModuleProtocols(this.xmlpl);\r
- }\r
- if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {\r
- mp = new ModuleProtocols(this.xmlpl, nodeType, location);\r
- }\r
- this.jDesktopPane.removeAll();\r
- this.jDesktopPane.add(mp, 1);\r
- this.currentNodeType = nodeType;\r
- if (operationType == ModuleMain.VIEW) {\r
- setButtonEnable(false);\r
- mp.setViewMode(true);\r
- } else {\r
- setButtonEnable(true);\r
- }\r
- }\r
-\r
- /**\r
- Show Events\r
- When the operation is VIEW, disable all fields of internal frame\r
- \r
- @param type The input data of operation type\r
- \r
- **/\r
- private void showEvents(int operationType, int nodeType, int location) {\r
- mev = null;\r
- if (operationType == ModuleMain.ADD) {\r
- mev = new ModuleEvents(this.xmlen);\r
- }\r
- if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {\r
- mev = new ModuleEvents(this.xmlen, nodeType, location);\r
- }\r
- this.jDesktopPane.removeAll();\r
- this.jDesktopPane.add(mev, 1);\r
- this.currentNodeType = nodeType;\r
- if (operationType == ModuleMain.VIEW) {\r
- setButtonEnable(false);\r
- mev.setViewMode(true);\r
- } else {\r
- setButtonEnable(true);\r
- }\r
- }\r
-\r
- /**\r
- Show Hobs\r
- When the operation is VIEW, disable all fields of internal frame\r
- \r
- @param type The input data of operation type\r
- \r
- **/\r
- private void showHobs(int operationType, int nodeType, int location) {\r
- mh = null;\r
- if (operationType == ModuleMain.ADD) {\r
- mh = new ModuleHobs(this.xmlhob);\r
- }\r
- if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {\r
- mh = new ModuleHobs(this.xmlhob, nodeType, location);\r
- }\r
- this.jDesktopPane.removeAll();\r
- this.jDesktopPane.add(mh, 1);\r
- this.currentNodeType = nodeType;\r
- if (operationType == ModuleMain.VIEW) {\r
- setButtonEnable(false);\r
- mh.setViewMode(true);\r
- } else {\r
- setButtonEnable(true);\r
- }\r
- }\r
-\r
- /**\r
- Show Ppis\r
- When the operation is VIEW, disable all fields of internal frame\r
- \r
- @param type The input data of operation type\r
- \r
- **/\r
- private void showPpis(int operationType, int nodeType, int location) {\r
- mpp = null;\r
- if (operationType == ModuleMain.ADD) {\r
- mpp = new ModulePpis(this.xmlppi);\r
- }\r
- if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {\r
- mpp = new ModulePpis(this.xmlppi, nodeType, location);\r
- }\r
- this.jDesktopPane.removeAll();\r
- this.jDesktopPane.add(mpp, 1);\r
- this.currentNodeType = nodeType;\r
- if (operationType == ModuleMain.VIEW) {\r
- setButtonEnable(false);\r
- mpp.setViewMode(true);\r
- } else {\r
- setButtonEnable(true);\r
- }\r
- }\r
-\r
- /**\r
- Show Variables\r
- When the operation is VIEW, disable all fields of internal frame\r
- \r
- @param type The input data of operation type\r
- \r
- **/\r
- private void showVariables(int operationType, int nodeType, int location) {\r
- mv = null;\r
- if (operationType == ModuleMain.ADD) {\r
- mv = new ModuleVariables(this.xmlvb);\r
- }\r
- if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {\r
- mv = new ModuleVariables(this.xmlvb, nodeType, location);\r
- }\r
- this.jDesktopPane.removeAll();\r
- this.jDesktopPane.add(mv, 1);\r
- this.currentNodeType = nodeType;\r
- if (operationType == ModuleMain.VIEW) {\r
- setButtonEnable(false);\r
- mv.setViewMode(true);\r
- } else {\r
- setButtonEnable(true);\r
- }\r
- }\r
-\r
- /**\r
- Show BootModes\r
- When the operation is VIEW, disable all fields of internal frame\r
- \r
- @param type The input data of operation type\r
- \r
- **/\r
- private void showBootModes(int operationType, int nodeType, int location) {\r
- mbm = null;\r
- if (operationType == ModuleMain.ADD) {\r
- mbm = new ModuleBootModes(this.xmlbm);\r
- }\r
- if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {\r
- mbm = new ModuleBootModes(this.xmlbm, nodeType, location);\r
- }\r
- this.jDesktopPane.removeAll();\r
- this.jDesktopPane.add(mbm, 1);\r
- this.currentNodeType = nodeType;\r
- if (operationType == ModuleMain.VIEW) {\r
- setButtonEnable(false);\r
- mbm.setViewMode(true);\r
- } else {\r
- setButtonEnable(true);\r
- }\r
- }\r
-\r
- /**\r
- Show SystemTables\r
- When the operation is VIEW, disable all fields of internal frame\r
- \r
- @param type The input data of operation type\r
- \r
- **/\r
- private void showSystemTables(int operationType, int nodeType, int location) {\r
- mst = null;\r
- if (operationType == ModuleMain.ADD) {\r
- mst = new ModuleSystemTables(this.xmlst);\r
- }\r
- if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {\r
- mst = new ModuleSystemTables(this.xmlst, nodeType, location);\r
- }\r
- this.jDesktopPane.removeAll();\r
- this.jDesktopPane.add(mst, 1);\r
- this.currentNodeType = nodeType;\r
- if (operationType == ModuleMain.VIEW) {\r
- setButtonEnable(false);\r
- mst.setViewMode(true);\r
- } else {\r
- setButtonEnable(true);\r
- }\r
- }\r
-\r
- /**\r
- Show DataHubs\r
- When the operation is VIEW, disable all fields of internal frame\r
- \r
- @param type The input data of operation type\r
- \r
- **/\r
- private void showDataHubs(int operationType, int nodeType, int location) {\r
- mdh = null;\r
- if (operationType == ModuleMain.ADD) {\r
- mdh = new ModuleDataHubs(this.xmldh);\r
- }\r
- if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {\r
- mdh = new ModuleDataHubs(this.xmldh, nodeType, location);\r
- }\r
- this.jDesktopPane.removeAll();\r
- this.jDesktopPane.add(mdh, 1);\r
- this.currentNodeType = nodeType;\r
- if (operationType == ModuleMain.VIEW) {\r
- setButtonEnable(false);\r
- mdh.setViewMode(true);\r
- } else {\r
- setButtonEnable(true);\r
- }\r
- }\r
-\r
- /**\r
- Show Formsets\r
- When the operation is VIEW, disable all fields of internal frame\r
- \r
- @param type The input data of operation type\r
- \r
- **/\r
- private void showFormsets(int operationType, int nodeType, int location) {\r
- mf = null;\r
- if (operationType == ModuleMain.ADD) {\r
- mf = new ModuleFormsets(this.xmlfs);\r
- }\r
- if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {\r
- mf = new ModuleFormsets(this.xmlfs, nodeType, location);\r
- }\r
- this.jDesktopPane.removeAll();\r
- this.jDesktopPane.add(mf, 1);\r
- this.currentNodeType = nodeType;\r
- if (operationType == ModuleMain.VIEW) {\r
- setButtonEnable(false);\r
- mf.setViewMode(true);\r
- } else {\r
- setButtonEnable(true);\r
- }\r
- }\r
-\r
- /**\r
- Show Show Guids\r
- When the operation is VIEW, disable all fields of internal frame\r
- \r
- @param type The input data of operation type\r
- \r
- **/\r
- private void showGuids(int operationType, int nodeType, int location) {\r
- mg = null;\r
- if (operationType == ModuleMain.ADD || operationType == ModuleMain.VIEW) {\r
- mg = new ModuleGuids(this.xmlgu);\r
- }\r
- if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {\r
- mg = new ModuleGuids(this.xmlgu, nodeType, location);\r
- }\r
- this.jDesktopPane.removeAll();\r
- this.jDesktopPane.add(mg, 1);\r
- this.currentNodeType = nodeType;\r
- if (operationType == ModuleMain.VIEW) {\r
- setButtonEnable(false);\r
- mg.setViewMode(true);\r
- } else {\r
- setButtonEnable(true);\r
- }\r
- }\r
-\r
- /**\r
- Show Externs\r
- When the operation is VIEW, disable all fields of internal frame\r
- \r
- @param type The input data of operation type\r
- \r
- **/\r
- private void showExterns(int operationType, int nodeType, int location) {\r
- met = null;\r
- if (operationType == ModuleMain.ADD) {\r
- met = new ModuleExterns(this.xmlet);\r
- }\r
- if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {\r
- met = new ModuleExterns(this.xmlet, nodeType, location);\r
- }\r
- this.jDesktopPane.removeAll();\r
- this.jDesktopPane.add(met, 1);\r
- this.currentNodeType = nodeType;\r
- if (operationType == ModuleMain.VIEW) {\r
- setButtonEnable(false);\r
- met.setViewMode(true);\r
- } else {\r
- setButtonEnable(true);\r
- }\r
- }\r
-\r
- /**\r
- Show PCDs\r
- When the operation is VIEW, disable all fields of internal frame\r
- \r
- @param type The input data of operation type\r
- \r
- **/\r
- private void showPCDs(int operationType, int nodeType, int location) {\r
- mpcd = null;\r
- if (operationType == ModuleMain.ADD) {\r
- mpcd = new ModulePCDs(this.xmlpcd);\r
- }\r
- if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {\r
- mpcd = new ModulePCDs(this.xmlpcd, nodeType, location);\r
- }\r
- this.jDesktopPane.removeAll();\r
- this.jDesktopPane.add(mpcd, 1);\r
- this.currentNodeType = nodeType;\r
- if (operationType == ModuleMain.VIEW) {\r
- setButtonEnable(false);\r
- mpcd.setViewMode(true);\r
- } else {\r
- setButtonEnable(true);\r
- }\r
- }\r
-\r
- /**\r
- Save currentModule when press button OK\r
- \r
- **/\r
- private void save() {\r
- if (this.currentNodeType == IDefaultMutableTreeNode.MSA_HEADER) {\r
- if (!msa.check()) {\r
- return;\r
- }\r
- msa.save();\r
- msa.setViewMode(true);\r
- this.xmlmh = msa.getMsaHeader();\r
- }\r
-\r
- if (this.currentNodeType == IDefaultMutableTreeNode.MBD_HEADER) {\r
- if (!mbd.check()) {\r
- return;\r
- }\r
- mbd.save();\r
- mbd.setViewMode(true);\r
- this.xmlmbdh = mbd.getMbdHeader();\r
- }\r
-\r
- if (this.currentNodeType == IDefaultMutableTreeNode.MLSA_HEADER) {\r
- if (!mlsa.check()) {\r
- return;\r
- }\r
- mlsa.save();\r
- mlsa.setViewMode(true);\r
- this.xmlmlh = mlsa.getMsaLibHeader();\r
- }\r
-\r
- if (this.currentNodeType == IDefaultMutableTreeNode.MLBD_HEADER) {\r
- if (!mlbd.check()) {\r
- return;\r
- }\r
- mlbd.save();\r
- mlbd.setViewMode(true);\r
- this.xmlmlbdh = mlbd.getMbdLibHeader();\r
- }\r
-\r
- if (this.currentNodeType == IDefaultMutableTreeNode.LIBRARIES\r
- || this.currentNodeType == IDefaultMutableTreeNode.LIBRARIES_ARCH\r
- || this.currentNodeType == IDefaultMutableTreeNode.LIBRARIES_ARCH_ITEM\r
- || this.currentNodeType == IDefaultMutableTreeNode.LIBRARIES_LIBRARY\r
- || this.currentNodeType == IDefaultMutableTreeNode.LIBRARIES_LIBRARY_ITEM) {\r
- if (!mlib.check()) {\r
- return;\r
- }\r
- mlib.save();\r
- mlib.setViewMode(true);\r
- this.xmllib = mlib.getLibraries();\r
- }\r
-\r
- if (this.currentNodeType == IDefaultMutableTreeNode.LIBRARYCLASSDEFINITIONS\r
- || this.currentNodeType == IDefaultMutableTreeNode.LIBRARY_CLASS_DEFINITION) {\r
- if (!mlcd.check()) {\r
- return;\r
- }\r
- mlcd.save();\r
- mlcd.setViewMode(true);\r
- this.xmllcd = mlcd.getLibraryClassDefinitions();\r
- }\r
-\r
- if (this.currentNodeType == IDefaultMutableTreeNode.SOURCEFILES\r
- || this.currentNodeType == IDefaultMutableTreeNode.SOURCEFILES_ARCH\r
- || this.currentNodeType == IDefaultMutableTreeNode.SOURCEFILES_ARCH_ITEM\r
- || this.currentNodeType == IDefaultMutableTreeNode.SOURCEFILES_FILENAME\r
- || this.currentNodeType == IDefaultMutableTreeNode.SOURCEFILES_FILENAME_ITEM) {\r
- if (!msf.check()) {\r
- return;\r
- }\r
- msf.save();\r
- msf.setViewMode(true);\r
- this.xmlsf = msf.getSourceFiles();\r
- }\r
-\r
- if (this.currentNodeType == IDefaultMutableTreeNode.INCLUDES\r
- || this.currentNodeType == IDefaultMutableTreeNode.INCLUDES_ARCH\r
- || this.currentNodeType == IDefaultMutableTreeNode.INCLUDES_ARCH_ITEM\r
- || this.currentNodeType == IDefaultMutableTreeNode.INCLUDES_PACKAGENAME\r
- || this.currentNodeType == IDefaultMutableTreeNode.INCLUDES_PACKAGENAME_ITEM) {\r
- if (!mic.check()) {\r
- return;\r
- }\r
- mic.save();\r
- mic.setViewMode(true);\r
- this.xmlic = mic.getIncludes();\r
- }\r
-\r
- if (this.currentNodeType == IDefaultMutableTreeNode.PROTOCOLS\r
- || this.currentNodeType == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOL\r
- || this.currentNodeType == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOL_ITEM\r
- || this.currentNodeType == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOLNOTIFY\r
- || this.currentNodeType == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOLNOTIFY_ITEM) {\r
- if (!mp.check()) {\r
- return;\r
- }\r
- mp.save();\r
- mp.setViewMode(true);\r
- this.xmlpl = mp.getProtocols();\r
- }\r
-\r
- if (this.currentNodeType == IDefaultMutableTreeNode.EVENTS\r
- || this.currentNodeType == IDefaultMutableTreeNode.EVENTS_CREATEEVENTS\r
- || this.currentNodeType == IDefaultMutableTreeNode.EVENTS_CREATEEVENTS_ITEM\r
- || this.currentNodeType == IDefaultMutableTreeNode.EVENTS_SIGNALEVENTS\r
- || this.currentNodeType == IDefaultMutableTreeNode.EVENTS_SIGNALEVENTS_ITEM) {\r
- if (!mev.check()) {\r
- return;\r
- }\r
- mev.save();\r
- mev.setViewMode(true);\r
- this.xmlen = mev.getEvents();\r
- }\r
-\r
- if (this.currentNodeType == IDefaultMutableTreeNode.HOBS\r
- || this.currentNodeType == IDefaultMutableTreeNode.HOBS_HOB_ITEM) {\r
- if (!mh.check()) {\r
- return;\r
- }\r
- mh.save();\r
- mh.setViewMode(true);\r
- this.xmlhob = mh.getHobs();\r
- }\r
-\r
- if (this.currentNodeType == IDefaultMutableTreeNode.PPIS\r
- || this.currentNodeType == IDefaultMutableTreeNode.PPIS_PPI\r
- || this.currentNodeType == IDefaultMutableTreeNode.PPIS_PPI_ITEM\r
- || this.currentNodeType == IDefaultMutableTreeNode.PPIS_PPINOTIFY\r
- || this.currentNodeType == IDefaultMutableTreeNode.PPIS_PPINOTIFY_ITEM) {\r
- if (!mpp.check()) {\r
- return;\r
- }\r
- mpp.save();\r
- mpp.setViewMode(true);\r
- this.xmlppi = mpp.getPpis();\r
- }\r
-\r
- if (this.currentNodeType == IDefaultMutableTreeNode.VARIABLES\r
- || this.currentNodeType == IDefaultMutableTreeNode.VARIABLES_VARIABLE_ITEM) {\r
- if (!mv.check()) {\r
- return;\r
- }\r
- mv.save();\r
- mv.setViewMode(true);\r
- this.xmlvb = mv.getVariables();\r
- }\r
-\r
- if (this.currentNodeType == IDefaultMutableTreeNode.BOOTMODES\r
- || this.currentNodeType == IDefaultMutableTreeNode.BOOTMODES_BOOTMODE_ITEM) {\r
- if (!mbm.check()) {\r
- return;\r
- }\r
- mbm.save();\r
- mbm.setViewMode(true);\r
- this.xmlbm = mbm.getBootModes();\r
- }\r
-\r
- if (this.currentNodeType == IDefaultMutableTreeNode.SYSTEMTABLES\r
- || this.currentNodeType == IDefaultMutableTreeNode.SYSTEMTABLES_SYSTEMTABLE_ITEM) {\r
- if (!mst.check()) {\r
- return;\r
- }\r
- mst.save();\r
- mst.setViewMode(true);\r
- this.xmlst = mst.getSystemTables();\r
- }\r
-\r
- if (this.currentNodeType == IDefaultMutableTreeNode.DATAHUBS\r
- || this.currentNodeType == IDefaultMutableTreeNode.DATAHUBS_DATAHUB_ITEM) {\r
- if (!mdh.check()) {\r
- return;\r
- }\r
- mdh.save();\r
- mdh.setViewMode(true);\r
- this.xmldh = mdh.getDataHubs();\r
- }\r
-\r
- if (this.currentNodeType == IDefaultMutableTreeNode.FORMSETS\r
- || this.currentNodeType == IDefaultMutableTreeNode.FORMSETS_FORMSET_ITEM) {\r
- if (!mf.check()) {\r
- return;\r
- }\r
- mf.save();\r
- mf.setViewMode(true);\r
- this.xmlfs = mf.getFormsets();\r
- }\r
-\r
- if (this.currentNodeType == IDefaultMutableTreeNode.GUIDS\r
- || this.currentNodeType == IDefaultMutableTreeNode.GUIDS_GUIDENTRY_ITEM) {\r
- if (!mg.check()) {\r
- return;\r
- }\r
- mg.save();\r
- mg.setViewMode(true);\r
- this.xmlgu = mg.getGuids();\r
- }\r
-\r
- if (this.currentNodeType == IDefaultMutableTreeNode.EXTERNS\r
- || this.currentNodeType == IDefaultMutableTreeNode.EXTERNS_EXTERN_ITEM) {\r
- if (!met.check()) {\r
- return;\r
- }\r
- met.save();\r
- met.setViewMode(true);\r
- this.xmlet = met.getExterns();\r
- }\r
-\r
- if (this.currentNodeType == IDefaultMutableTreeNode.PCDS\r
- || this.currentNodeType == IDefaultMutableTreeNode.PCDS_PCDDATA_ITEM) {\r
- if (!mpcd.check()) {\r
- return;\r
- }\r
- mpcd.save();\r
- mpcd.setViewMode(true);\r
- this.xmlpcd = mpcd.getPcds();\r
- }\r
-\r
- reloadTreeAndTable(NEW_WITH_CHANGE);\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to create, update PCD of MSA/MBD file\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-package org.tianocore.packaging.module.ui;\r
-\r
-import java.awt.event.ActionEvent;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JLabel;\r
-import javax.swing.JPanel;\r
-import javax.swing.JTextField;\r
-\r
-import org.tianocore.PCDsDocument;\r
-import org.tianocore.PcdDataTypes;\r
-import org.tianocore.PcdItemTypes;\r
-import org.tianocore.PcdUsage;\r
-import org.tianocore.common.DataValidation;\r
-import org.tianocore.common.Log;\r
-import org.tianocore.packaging.common.ui.IInternalFrame;\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-\r
-/**\r
- The class is used to create, update PCD of MSA/MBD file\r
- It extends IInternalFrame\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class ModulePCDs extends IInternalFrame {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = 2227717658188438696L;\r
-\r
- //\r
- //Define class members\r
- //\r
- private PCDsDocument.PCDs pcds = null;\r
-\r
- private int location = -1;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JLabel jLabelItemType = null;\r
-\r
- private JLabel jLabelC_Name = null;\r
-\r
- private JComboBox jComboBoxItemType = null;\r
-\r
- private JTextField jTextFieldC_Name = null;\r
-\r
- private JLabel jLabelToken = null;\r
-\r
- private JTextField jTextFieldToken = null;\r
-\r
- private JLabel jLabelDefaultValue = null;\r
-\r
- private JTextField jTextFieldDefaultValue = null;\r
-\r
- private JLabel jLabelUsage = null;\r
-\r
- private JComboBox jComboBoxUsage = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JLabel jLabelDatumType = null;\r
-\r
- private JComboBox jComboBoxDatumType = null;\r
-\r
- private StarLabel jStarLabel1 = null;\r
-\r
- private StarLabel jStarLabel2 = null;\r
-\r
- private StarLabel jStarLabel3 = null;\r
-\r
- private StarLabel jStarLabel4 = null;\r
- \r
- /**\r
- This method initializes jComboBoxItemType \r
- \r
- @return javax.swing.JComboBox jComboBoxItemType\r
- \r
- **/\r
- private JComboBox getJComboBoxItemType() {\r
- if (jComboBoxItemType == null) {\r
- jComboBoxItemType = new JComboBox();\r
- jComboBoxItemType.setBounds(new java.awt.Rectangle(160, 110, 320, 20));\r
- }\r
- return jComboBoxItemType;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldC_Name \r
- \r
- @return javax.swing.JTextField jTextFieldC_Name\r
- \r
- **/\r
- private JTextField getJTextFieldC_Name() {\r
- if (jTextFieldC_Name == null) {\r
- jTextFieldC_Name = new JTextField();\r
- jTextFieldC_Name.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
- }\r
- return jTextFieldC_Name;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldToken \r
- \r
- @return javax.swing.JTextField jTextFieldToken\r
- \r
- **/\r
- private JTextField getJTextFieldToken() {\r
- if (jTextFieldToken == null) {\r
- jTextFieldToken = new JTextField();\r
- jTextFieldToken.setBounds(new java.awt.Rectangle(160, 35, 320, 20));\r
- }\r
- return jTextFieldToken;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldDefaultValue \r
- \r
- @return javax.swing.JTextField jTextFieldDefaultValue\r
- \r
- **/\r
- private JTextField getJTextFieldDefaultValue() {\r
- if (jTextFieldDefaultValue == null) {\r
- jTextFieldDefaultValue = new JTextField();\r
- jTextFieldDefaultValue.setBounds(new java.awt.Rectangle(160, 85, 320, 20));\r
- }\r
- return jTextFieldDefaultValue;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxUsage \r
- \r
- @return javax.swing.JComboBox jComboBoxUsage\r
- \r
- **/\r
- private JComboBox getJComboBoxUsage() {\r
- if (jComboBoxUsage == null) {\r
- jComboBoxUsage = new JComboBox();\r
- jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 135, 320, 20));\r
- }\r
- return jComboBoxUsage;\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton jButtonOk\r
- \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("OK");\r
- jButtonOk.setBounds(new java.awt.Rectangle(280, 290, 90, 20));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton jButtonCancel\r
- \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 290, 90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldDatumType \r
- \r
- @return javax.swing.JTextField jComboBoxDatumType\r
- \r
- **/\r
- private JComboBox getJComboBoxDatumType() {\r
- if (jComboBoxDatumType == null) {\r
- jComboBoxDatumType = new JComboBox();\r
- jComboBoxDatumType.setBounds(new java.awt.Rectangle(160, 60, 320, 20));\r
- }\r
- return jComboBoxDatumType;\r
- }\r
-\r
- public static void main(String[] args) {\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public ModulePCDs() {\r
- super();\r
- init();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inPcds The input data of PCDsDocument.PCDs\r
- \r
- **/\r
- public ModulePCDs(PCDsDocument.PCDs inPcds) {\r
- super();\r
- init(inPcds);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inPcds The input data of PCDsDocument.PCDs\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- public ModulePCDs(PCDsDocument.PCDs inPcds, int type, int index) {\r
- super();\r
- init(inPcds, type, index);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @param inPcds The input data of PCDsDocument.PCDs\r
- \r
- **/\r
- private void init(PCDsDocument.PCDs inPcds) {\r
- init();\r
- this.setPcds(inPcds);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- Fill values to all fields if these values are not empty\r
- \r
- @param inPcds The input data of PCDsDocument.PCDs\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- private void init(PCDsDocument.PCDs inPcds, int type, int index) {\r
- init(inPcds);\r
- this.location = index;\r
- if (this.pcds.getPcdDataList().size() > 0) {\r
- if (this.pcds.getPcdDataArray(index).getCName() != null) {\r
- this.jTextFieldC_Name.setText(this.pcds.getPcdDataArray(index).getCName());\r
- }\r
- if (this.pcds.getPcdDataArray(index).getToken() != null) {\r
- this.jTextFieldToken.setText(this.pcds.getPcdDataArray(index).getToken());\r
- }\r
- if (this.pcds.getPcdDataArray(index).getDatumType() != null) {\r
- this.jComboBoxDatumType.setSelectedItem(this.pcds.getPcdDataArray(index).getDatumType().toString());\r
- }\r
- if (this.pcds.getPcdDataArray(index).getDefaultValue() != null) {\r
- this.jTextFieldDefaultValue.setText(this.pcds.getPcdDataArray(index).getDefaultValue());\r
- }\r
- if (this.pcds.getPcdDataArray(index).getPcdUsage() != null) {\r
- this.jComboBoxUsage.setSelectedItem(this.pcds.getPcdDataArray(index).getPcdUsage().toString());\r
- }\r
- if (this.pcds.getPcdDataArray(index).getItemType() != null) {\r
- this.jComboBoxItemType.setSelectedItem(this.pcds.getPcdDataArray(index).getItemType().toString());\r
- }\r
- }\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void init() {\r
- this.setSize(500, 515);\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("PCDs");\r
- initFrame();\r
- this.setViewMode(false);\r
- }\r
-\r
- /**\r
- Disable all components when the mode is view\r
- \r
- @param isView true - The view mode; false - The non-view mode\r
- \r
- **/\r
- public void setViewMode(boolean isView) {\r
- this.jButtonOk.setVisible(false);\r
- this.jButtonCancel.setVisible(false);\r
- if (isView) {\r
- this.jTextFieldC_Name.setEnabled(!isView);\r
- this.jTextFieldToken.setEnabled(!isView);\r
- this.jComboBoxDatumType.setEnabled(!isView);\r
- this.jTextFieldDefaultValue.setEnabled(!isView);\r
- this.jComboBoxUsage.setEnabled(!isView);\r
- this.jComboBoxItemType.setEnabled(!isView);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel jContentPane\r
- \r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabelDatumType = new JLabel();\r
- jLabelDatumType.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
- jLabelDatumType.setText("Datum Type");\r
- jLabelC_Name = new JLabel();\r
- jLabelC_Name.setText("C_Name");\r
- jLabelC_Name.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
- jLabelUsage = new JLabel();\r
- jLabelUsage.setText("Usage");\r
- jLabelUsage.setBounds(new java.awt.Rectangle(15, 135, 140, 20));\r
- jLabelDefaultValue = new JLabel();\r
- jLabelDefaultValue.setText("Default Value");\r
- jLabelDefaultValue.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
- jLabelToken = new JLabel();\r
- jLabelToken.setText("Token");\r
- jLabelToken.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
- jLabelItemType = new JLabel();\r
- jLabelItemType.setText("Item Type");\r
- jLabelItemType.setBounds(new java.awt.Rectangle(15, 110, 140, 20));\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.setSize(new java.awt.Dimension(480,336));\r
- jContentPane.add(jLabelItemType, null);\r
- jContentPane.add(jLabelC_Name, null);\r
- jContentPane.add(getJTextFieldC_Name(), null);\r
- jContentPane.add(jLabelToken, null);\r
- jContentPane.add(getJTextFieldToken(), null);\r
- jContentPane.add(jLabelDefaultValue, null);\r
- jContentPane.add(getJTextFieldDefaultValue(), null);\r
- jContentPane.add(jLabelUsage, null);\r
- jContentPane.add(getJComboBoxUsage(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJComboBoxItemType(), null);\r
- jContentPane.add(jLabelDatumType, null);\r
- jContentPane.add(getJComboBoxDatumType(), null);\r
-\r
- jStarLabel1 = new StarLabel();\r
- jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
- jStarLabel2 = new StarLabel();\r
- jStarLabel2.setLocation(new java.awt.Point(0, 35));\r
- jStarLabel3 = new StarLabel();\r
- jStarLabel3.setLocation(new java.awt.Point(0, 60));\r
- jStarLabel4 = new StarLabel();\r
- jStarLabel4.setLocation(new java.awt.Point(0, 110));\r
-\r
- jContentPane.add(jStarLabel1, null);\r
- jContentPane.add(jStarLabel2, null);\r
- jContentPane.add(jStarLabel3, null);\r
- jContentPane.add(jStarLabel4, null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes Usage type, Item type and Datum type\r
- \r
- **/\r
- private void initFrame() {\r
- jComboBoxUsage.addItem("ALWAYS_CONSUMED");\r
- jComboBoxUsage.addItem("SOMETIMES_CONSUMED");\r
- jComboBoxUsage.addItem("ALWAYS_PRODUCED");\r
- jComboBoxUsage.addItem("SOMETIMES_PRODUCED");\r
- jComboBoxUsage.addItem("DEFAULT");\r
-\r
- jComboBoxItemType.addItem("FEATURE_FLAG");\r
- jComboBoxItemType.addItem("FIXED_AT_BUILD");\r
- jComboBoxItemType.addItem("PATCHABLE_IN_MODULE");\r
- jComboBoxItemType.addItem("DYNAMIC");\r
- jComboBoxItemType.addItem("DYNAMIC_EX");\r
-\r
- jComboBoxDatumType.addItem("UINT8");\r
- jComboBoxDatumType.addItem("UINT16");\r
- jComboBoxDatumType.addItem("UINT32");\r
- jComboBoxDatumType.addItem("UINT64");\r
- jComboBoxDatumType.addItem("VOID*");\r
- jComboBoxDatumType.addItem("BOOLEAN");\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- *\r
- * Override actionPerformed to listen all actions\r
- * \r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.setEdited(true);\r
- this.save();\r
- this.dispose();\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- }\r
- }\r
-\r
- /**\r
- Get PCDsDocument.PCDs\r
- \r
- @return PCDsDocument.PCDs\r
- \r
- **/\r
- public PCDsDocument.PCDs getPcds() {\r
- return pcds;\r
- }\r
-\r
- /**\r
- Set PCDsDocument.PCDs\r
- \r
- @param pcds The input data of PCDsDocument.PCDs\r
- \r
- **/\r
- public void setPcds(PCDsDocument.PCDs pcds) {\r
- this.pcds = pcds;\r
- }\r
-\r
- /**\r
- Data validation for all fields\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean check() {\r
- //\r
- // Check if all required fields are not empty\r
- //\r
- if (isEmpty(this.jTextFieldC_Name.getText())) {\r
- Log.err("C_Name couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextFieldToken.getText())) {\r
- Log.err("Token couldn't be empty");\r
- return false;\r
- }\r
-\r
- //\r
- // Check if all fields have correct data types \r
- //\r
- if (!isEmpty(this.jTextFieldC_Name.getText()) && !DataValidation.isCName(this.jTextFieldC_Name.getText())) {\r
- Log.err("Incorrect data type for C_Name");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldToken.getText()) && !DataValidation.isToken(this.jTextFieldToken.getText())) {\r
- Log.err("Incorrect data type for Token");\r
- return false;\r
- }\r
- \r
- return true;\r
- }\r
-\r
- /**\r
- Save all components of PCDs\r
- if exists pcds, set the value directly\r
- if not exists pcds, new an instance first\r
- \r
- **/\r
- public void save() {\r
- try {\r
- if (this.pcds == null) {\r
- pcds = PCDsDocument.PCDs.Factory.newInstance();\r
- }\r
- PCDsDocument.PCDs.PcdData pcdData = PCDsDocument.PCDs.PcdData.Factory.newInstance();\r
- if (!isEmpty(this.jTextFieldC_Name.getText())) {\r
- pcdData.setCName(this.jTextFieldC_Name.getText());\r
- }\r
- if (!isEmpty(this.jTextFieldToken.getText())) {\r
- pcdData.setToken(this.jTextFieldToken.getText());\r
- }\r
- pcdData.setDatumType(PcdDataTypes.Enum.forString(this.jComboBoxDatumType.getSelectedItem().toString()));\r
- if (!isEmpty(this.jTextFieldDefaultValue.getText())) {\r
- pcdData.setDefaultValue(this.jTextFieldDefaultValue.getText());\r
- }\r
- pcdData.setItemType(PcdItemTypes.Enum.forString(this.jComboBoxItemType.getSelectedItem().toString()));\r
- pcdData.setPcdUsage(PcdUsage.Enum.forString(this.jComboBoxUsage.getSelectedItem().toString()));\r
- \r
-\r
- if (location > -1) {\r
- pcds.setPcdDataArray(location, pcdData);\r
- } else {\r
- pcds.addNewPcdData();\r
- pcds.setPcdDataArray(pcds.getPcdDataList().size() - 1, pcdData);\r
- }\r
- } catch (Exception e) {\r
- Log.err("Update Hobs", e.getMessage());\r
- }\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to create, update Ppi of MSA/MBD file\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-package org.tianocore.packaging.module.ui;\r
-\r
-import java.awt.event.ActionEvent;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JLabel;\r
-import javax.swing.JPanel;\r
-import javax.swing.JRadioButton;\r
-import javax.swing.JTextField;\r
-\r
-import org.tianocore.PPIsDocument;\r
-import org.tianocore.PpiNotifyUsage;\r
-import org.tianocore.PpiUsage;\r
-import org.tianocore.common.DataValidation;\r
-import org.tianocore.common.Log;\r
-import org.tianocore.common.Tools;\r
-import org.tianocore.packaging.common.ui.IDefaultMutableTreeNode;\r
-import org.tianocore.packaging.common.ui.IInternalFrame;\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-\r
-/**\r
- The class is used to create, update Ppi of MSA/MBD file\r
- It extends IInternalFrame\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class ModulePpis extends IInternalFrame {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -4284901202357037724L;\r
-\r
- //\r
- //Define class members\r
- //\r
- private PPIsDocument.PPIs ppis = null;\r
-\r
- private int location = -1;\r
-\r
- private static int PPI = 1;\r
-\r
- private static int PPI_NOTIFY = 2;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JRadioButton jRadioButtonPpi = null;\r
-\r
- private JRadioButton jRadioButtonPpiNotify = null;\r
-\r
- private JLabel jLabelC_Name = null;\r
-\r
- private JTextField jTextFieldC_Name = null;\r
-\r
- private JLabel jLabelGuid = null;\r
-\r
- private JTextField jTextFieldGuid = null;\r
-\r
- private JTextField jTextFieldFeatureFlag = null;\r
-\r
- private JLabel jLabelFeatureFlag = null;\r
-\r
- private JLabel jLabelUsage = null;\r
-\r
- private JComboBox jComboBoxUsage = null;\r
-\r
- private JLabel jLabelEnableFeature = null;\r
-\r
- private JRadioButton jRadioButtonEnableFeature = null;\r
-\r
- private JRadioButton jRadioButtonDisableFeature = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JLabel jLabelPpiType = null;\r
-\r
- private JButton jButtonGenerateGuid = null;\r
-\r
- private StarLabel jStarLabel1 = null;\r
-\r
- private StarLabel jStarLabel2 = null;\r
-\r
- private JLabel jLabelOverrideID = null;\r
-\r
- private JTextField jTextFieldOverrideID = null;\r
-\r
- /**\r
- This method initializes jRadioButtonPpi \r
- \r
- @return javax.swing.JRadioButton jRadioButtonPpi\r
- \r
- **/\r
- private JRadioButton getJRadioButtonPpiType() {\r
- if (jRadioButtonPpi == null) {\r
- jRadioButtonPpi = new JRadioButton();\r
- jRadioButtonPpi.setText("Ppi");\r
- jRadioButtonPpi.setBounds(new java.awt.Rectangle(160, 10, 100, 20));\r
- jRadioButtonPpi.addActionListener(this);\r
- jRadioButtonPpi.setSelected(true);\r
- }\r
- return jRadioButtonPpi;\r
- }\r
-\r
- /**\r
- This method initializes jRadioButtonPpiNotify \r
- \r
- @return javax.swing.JRadioButton jRadioButtonPpiNotify\r
- \r
- **/\r
- private JRadioButton getJRadioButtonPpiNotify() {\r
- if (jRadioButtonPpiNotify == null) {\r
- jRadioButtonPpiNotify = new JRadioButton();\r
- jRadioButtonPpiNotify.setText("Ppi Notify");\r
- jRadioButtonPpiNotify.setBounds(new java.awt.Rectangle(320, 10, 100, 20));\r
- jRadioButtonPpiNotify.addActionListener(this);\r
- }\r
- return jRadioButtonPpiNotify;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldC_Name \r
- \r
- @return javax.swing.JTextField jTextFieldC_Name\r
- \r
- **/\r
- private JTextField getJTextFieldC_Name() {\r
- if (jTextFieldC_Name == null) {\r
- jTextFieldC_Name = new JTextField();\r
- jTextFieldC_Name.setBounds(new java.awt.Rectangle(160, 35, 320, 20));\r
- }\r
- return jTextFieldC_Name;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldGuid \r
- \r
- @return javax.swing.JTextField jTextFieldGuid\r
- \r
- **/\r
- private JTextField getJTextFieldGuid() {\r
- if (jTextFieldGuid == null) {\r
- jTextFieldGuid = new JTextField();\r
- jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 60, 250, 20));\r
- }\r
- return jTextFieldGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldFeatureFlag \r
- \r
- @return javax.swing.JTextField jTextFieldFeatureFlag\r
- \r
- **/\r
- private JTextField getJTextFieldFeatureFlag() {\r
- if (jTextFieldFeatureFlag == null) {\r
- jTextFieldFeatureFlag = new JTextField();\r
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 135, 320, 20));\r
- }\r
- return jTextFieldFeatureFlag;\r
- }\r
-\r
- /**\r
- This method initializes jComboBox\r
- \r
- @return javax.swing.JComboBox jComboBoxUsage\r
- \r
- **/\r
- private JComboBox getJComboBox() {\r
- if (jComboBoxUsage == null) {\r
- jComboBoxUsage = new JComboBox();\r
- jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 85, 320, 20));\r
- }\r
- return jComboBoxUsage;\r
- }\r
-\r
- /**\r
- This method initializes jRadioButtonEnableFeature \r
- \r
- @return javax.swing.JRadioButton jRadioButtonEnableFeature\r
- \r
- **/\r
- private JRadioButton getJRadioButtonEnableFeature() {\r
- if (jRadioButtonEnableFeature == null) {\r
- jRadioButtonEnableFeature = new JRadioButton();\r
- jRadioButtonEnableFeature.setText("Enable");\r
- jRadioButtonEnableFeature.setBounds(new java.awt.Rectangle(160, 110, 90, 20));\r
- jRadioButtonEnableFeature.addActionListener(this);\r
- jRadioButtonEnableFeature.setSelected(true);\r
- }\r
- return jRadioButtonEnableFeature;\r
- }\r
-\r
- /**\r
- This method initializes jRadioButtonDisableFeature \r
- \r
- @return javax.swing.JRadioButton jRadioButtonDisableFeature\r
- \r
- **/\r
- private JRadioButton getJRadioButtonDisableFeature() {\r
- if (jRadioButtonDisableFeature == null) {\r
- jRadioButtonDisableFeature = new JRadioButton();\r
- jRadioButtonDisableFeature.setText("Disable");\r
- jRadioButtonDisableFeature.setBounds(new java.awt.Rectangle(320, 110, 90, 20));\r
- jRadioButtonDisableFeature.addActionListener(this);\r
- }\r
- return jRadioButtonDisableFeature;\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton jButtonOk\r
- \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("OK");\r
- jButtonOk.setBounds(new java.awt.Rectangle(290, 190, 90, 20));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton jButtonCancel\r
- \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 190, 90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jButtonGenerateGuid \r
- \r
- @return javax.swing.JButton jButtonGenerateGuid\r
- \r
- **/\r
- private JButton getJButtonGenerateGuid() {\r
- if (jButtonGenerateGuid == null) {\r
- jButtonGenerateGuid = new JButton();\r
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 60, 65, 20));\r
- jButtonGenerateGuid.setText("GEN");\r
- jButtonGenerateGuid.addActionListener(this);\r
- }\r
- return jButtonGenerateGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldOverrideID \r
- \r
- @return javax.swing.JTextField jTextFieldOverrideID\r
- \r
- **/\r
- private JTextField getJTextFieldOverrideID() {\r
- if (jTextFieldOverrideID == null) {\r
- jTextFieldOverrideID = new JTextField();\r
- jTextFieldOverrideID.setBounds(new java.awt.Rectangle(160, 160, 50, 20));\r
- }\r
- return jTextFieldOverrideID;\r
- }\r
-\r
- public static void main(String[] args) {\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public ModulePpis() {\r
- super();\r
- init();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inPpis The input data of PPIsDocument.PPIs\r
- \r
- **/\r
- public ModulePpis(PPIsDocument.PPIs inPpis) {\r
- super();\r
- init(inPpis);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inPpis The input data of PPIsDocument.PPIs\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- public ModulePpis(PPIsDocument.PPIs inPpis, int type, int index) {\r
- super();\r
- init(inPpis, type, index);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @param inPpis The input data of PPIsDocument.PPIs\r
- \r
- **/\r
- private void init(PPIsDocument.PPIs inPpis) {\r
- init();\r
- this.setPpis(inPpis);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- Fill values to all fields if these values are not empty\r
- \r
- @param inPpis The input data of PPIsDocument.PPIs\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- private void init(PPIsDocument.PPIs inPpis, int type, int index) {\r
- init(inPpis);\r
- this.location = index;\r
- if (type == IDefaultMutableTreeNode.PPIS_PPI_ITEM) {\r
- initUsage(ModulePpis.PPI);\r
- this.jRadioButtonPpi.setSelected(true);\r
- this.jRadioButtonPpiNotify.setSelected(false);\r
- if (this.ppis.getPpiArray(index).getStringValue() != null) {\r
- this.jTextFieldC_Name.setText(this.ppis.getPpiArray(index).getStringValue());\r
- }\r
- if (this.ppis.getPpiArray(index).getGuid() != null) {\r
- this.jTextFieldGuid.setText(this.ppis.getPpiArray(index).getGuid());\r
- }\r
- if (this.ppis.getPpiArray(index).getUsage() != null) {\r
- this.jComboBoxUsage.setSelectedItem(this.ppis.getPpiArray(index).getUsage().toString());\r
- }\r
- this.jRadioButtonEnableFeature.setSelected(this.ppis.getPpiArray(index).getEnableFeature());\r
- this.jRadioButtonDisableFeature.setSelected(!this.ppis.getPpiArray(index).getEnableFeature());\r
- if (this.ppis.getPpiArray(index).getFeatureFlag() != null) {\r
- this.jTextFieldFeatureFlag.setText(this.ppis.getPpiArray(index).getFeatureFlag());\r
- }\r
- this.jTextFieldOverrideID.setText(String.valueOf(this.ppis.getPpiArray(index).getOverrideID()));\r
- } else if (type == IDefaultMutableTreeNode.PPIS_PPINOTIFY_ITEM) {\r
- initUsage(ModulePpis.PPI_NOTIFY);\r
- this.jRadioButtonPpi.setSelected(false);\r
- this.jRadioButtonPpiNotify.setSelected(true);\r
- if (this.ppis.getPpiNotifyArray(index).getStringValue() != null) {\r
- this.jTextFieldC_Name.setText(this.ppis.getPpiNotifyArray(index).getStringValue());\r
- }\r
- if (this.ppis.getPpiNotifyArray(index).getGuid() != null) {\r
- this.jTextFieldGuid.setText(this.ppis.getPpiNotifyArray(index).getGuid());\r
- }\r
- if (this.ppis.getPpiNotifyArray(index).getUsage() != null) {\r
- this.jComboBoxUsage.setSelectedItem(this.ppis.getPpiNotifyArray(index).getUsage().toString());\r
- }\r
- this.jRadioButtonEnableFeature.setSelected(this.ppis.getPpiNotifyArray(index).getEnableFeature());\r
- this.jRadioButtonDisableFeature.setSelected(!this.ppis.getPpiNotifyArray(index).getEnableFeature());\r
- if (this.ppis.getPpiNotifyArray(index).getFeatureFlag() != null) {\r
- this.jTextFieldFeatureFlag.setText(this.ppis.getPpiNotifyArray(index).getFeatureFlag());\r
- }\r
- this.jTextFieldOverrideID.setText(String.valueOf(this.ppis.getPpiNotifyArray(index).getOverrideID()));\r
- }\r
- this.jRadioButtonPpi.setEnabled(false);\r
- this.jRadioButtonPpiNotify.setEnabled(false);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void init() {\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Ppis");\r
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 515));\r
- initFrame();\r
- this.setViewMode(false);\r
- }\r
-\r
- /**\r
- Disable all components when the mode is view\r
- \r
- @param isView true - The view mode; false - The non-view mode\r
- \r
- **/\r
- public void setViewMode(boolean isView) {\r
- this.jButtonOk.setVisible(false);\r
- this.jButtonCancel.setVisible(false);\r
- if (isView) {\r
- this.jRadioButtonPpi.setEnabled(!isView);\r
- this.jRadioButtonPpiNotify.setEnabled(!isView);\r
- this.jTextFieldC_Name.setEnabled(!isView);\r
- this.jTextFieldGuid.setEnabled(!isView);\r
- this.jComboBoxUsage.setEnabled(!isView);\r
- this.jRadioButtonEnableFeature.setEnabled(!isView);\r
- this.jRadioButtonDisableFeature.setEnabled(!isView);\r
- this.jTextFieldFeatureFlag.setEnabled(!isView);\r
- this.jTextFieldOverrideID.setEnabled(!isView);\r
- this.jButtonGenerateGuid.setEnabled(!isView);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel jContentPane\r
- \r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabelOverrideID = new JLabel();\r
- jLabelOverrideID.setBounds(new java.awt.Rectangle(15, 160, 140, 20));\r
- jLabelOverrideID.setText("Override ID");\r
- jLabelPpiType = new JLabel();\r
- jLabelPpiType.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
- jLabelPpiType.setText("Ppi Type");\r
- jLabelEnableFeature = new JLabel();\r
- jLabelEnableFeature.setText("Enable Feature");\r
- jLabelEnableFeature.setBounds(new java.awt.Rectangle(15, 110, 140, 20));\r
- jLabelUsage = new JLabel();\r
- jLabelUsage.setText("Usage");\r
- jLabelUsage.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
- jLabelFeatureFlag = new JLabel();\r
- jLabelFeatureFlag.setText("Feature Flag");\r
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 135, 140, 20));\r
- jLabelGuid = new JLabel();\r
- jLabelGuid.setText("Guid");\r
- jLabelGuid.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
- jLabelC_Name = new JLabel();\r
- jLabelC_Name.setText("C_Name");\r
- jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(getJRadioButtonPpiType(), null);\r
- jContentPane.add(jLabelC_Name, null);\r
- jContentPane.add(getJTextFieldC_Name(), null);\r
- jContentPane.add(jLabelGuid, null);\r
- jContentPane.add(getJTextFieldGuid(), null);\r
- jContentPane.add(getJTextFieldFeatureFlag(), null);\r
- jContentPane.add(jLabelFeatureFlag, null);\r
- jContentPane.add(jLabelUsage, null);\r
- jContentPane.add(getJComboBox(), null);\r
- jContentPane.add(jLabelEnableFeature, null);\r
- jContentPane.add(getJRadioButtonEnableFeature(), null);\r
- jContentPane.add(getJRadioButtonDisableFeature(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJRadioButtonPpiNotify(), null);\r
- jContentPane.add(jLabelPpiType, null);\r
- jContentPane.add(getJButtonGenerateGuid(), null);\r
-\r
- jStarLabel1 = new StarLabel();\r
- jStarLabel1.setBounds(new java.awt.Rectangle(0, 10, 10, 20));\r
- jStarLabel2 = new StarLabel();\r
- jStarLabel2.setBounds(new java.awt.Rectangle(0, 35, 10, 20));\r
-\r
- jContentPane.add(jStarLabel1, null);\r
- jContentPane.add(jStarLabel2, null);\r
- jContentPane.add(jLabelOverrideID, null);\r
- jContentPane.add(getJTextFieldOverrideID(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes Usage type\r
- \r
- **/\r
- private void initFrame() {\r
- jComboBoxUsage.addItem("ALWAYS_CONSUMED");\r
- jComboBoxUsage.addItem("SOMETIMES_CONSUMED");\r
- jComboBoxUsage.addItem("ALWAYS_PRODUCED");\r
- jComboBoxUsage.addItem("SOMETIMES_PRODUCED");\r
- jComboBoxUsage.addItem("PRIVATE");\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- *\r
- * Override actionPerformed to listen all actions\r
- * \r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.setEdited(true);\r
- this.save();\r
- this.dispose();\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- }\r
-\r
- //\r
- //Contorl the selected status when click RadionButton\r
- //Do not use Radio Button Group\r
- //\r
- if (arg0.getSource() == jRadioButtonPpi) {\r
- if (jRadioButtonPpi.isSelected()) {\r
- jRadioButtonPpiNotify.setSelected(false);\r
- initUsage(ModulePpis.PPI);\r
- }\r
- if (!jRadioButtonPpiNotify.isSelected() && !jRadioButtonPpi.isSelected()) {\r
- jRadioButtonPpi.setSelected(true);\r
- initUsage(ModulePpis.PPI);\r
- }\r
- }\r
-\r
- if (arg0.getSource() == jRadioButtonPpiNotify) {\r
- if (jRadioButtonPpiNotify.isSelected()) {\r
- jRadioButtonPpi.setSelected(false);\r
- initUsage(ModulePpis.PPI_NOTIFY);\r
- }\r
- if (!jRadioButtonPpiNotify.isSelected() && !jRadioButtonPpi.isSelected()) {\r
- jRadioButtonPpiNotify.setSelected(true);\r
- initUsage(ModulePpis.PPI_NOTIFY);\r
- }\r
- }\r
-\r
- //\r
- //Contorl the selected status when click RadionButton\r
- //Do not use Radio Button Group\r
- //\r
- if (arg0.getSource() == jRadioButtonEnableFeature) {\r
- if (jRadioButtonEnableFeature.isSelected()) {\r
- jRadioButtonDisableFeature.setSelected(false);\r
- }\r
- if (!jRadioButtonDisableFeature.isSelected() && !jRadioButtonEnableFeature.isSelected()) {\r
- jRadioButtonEnableFeature.setSelected(true);\r
- }\r
- }\r
-\r
- if (arg0.getSource() == jRadioButtonDisableFeature) {\r
- if (jRadioButtonDisableFeature.isSelected()) {\r
- jRadioButtonEnableFeature.setSelected(false);\r
- }\r
- if (!jRadioButtonDisableFeature.isSelected() && !jRadioButtonEnableFeature.isSelected()) {\r
- jRadioButtonDisableFeature.setSelected(true);\r
- }\r
- }\r
-\r
- if (arg0.getSource() == jButtonGenerateGuid) {\r
- jTextFieldGuid.setText(Tools.generateUuidString());\r
- }\r
- }\r
-\r
- /**\r
- Get PPIsDocument.PPIs\r
- \r
- @return PPIsDocument.PPIs\r
- \r
- **/\r
- public PPIsDocument.PPIs getPpis() {\r
- return ppis;\r
- }\r
-\r
- /**\r
- Set PPIsDocument.PPIs\r
- \r
- @param ppis The input data of PPIsDocument.PPIs\r
- \r
- **/\r
- public void setPpis(PPIsDocument.PPIs ppis) {\r
- this.ppis = ppis;\r
- }\r
-\r
- /**\r
- Data validation for all fields\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean check() {\r
- //\r
- // Check if all required fields are not empty\r
- //\r
- if (isEmpty(this.jTextFieldC_Name.getText())) {\r
- Log.err("C_Name couldn't be empty");\r
- return false;\r
- }\r
-\r
- //\r
- // Check if all fields have correct data types \r
- //\r
- if (!DataValidation.isCName(this.jTextFieldC_Name.getText())) {\r
- Log.err("Incorrect data type for C_Name");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldGuid.getText()) && !DataValidation.isGuid(this.jTextFieldGuid.getText())) {\r
- Log.err("Incorrect data type for Guid");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())\r
- && !DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {\r
- Log.err("Incorrect data type for Feature Flag");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())\r
- && !DataValidation.isOverrideID(this.jTextFieldOverrideID.getText())) {\r
- Log.err("Incorrect data type for Override ID");\r
- return false;\r
- }\r
-\r
- return true;\r
- }\r
-\r
- /**\r
- Save all components of PPIs\r
- if exists ppis, set the value directly\r
- if not exists ppis, new an instance first\r
- \r
- **/\r
- public void save() {\r
- try {\r
- if (this.ppis == null) {\r
- ppis = PPIsDocument.PPIs.Factory.newInstance();\r
- }\r
- if (this.jRadioButtonPpi.isSelected()) {\r
- PPIsDocument.PPIs.Ppi ppi = PPIsDocument.PPIs.Ppi.Factory.newInstance();\r
- ppi.setStringValue(this.jTextFieldC_Name.getText());\r
- if (!isEmpty(this.jTextFieldGuid.getText())) {\r
- ppi.setGuid(this.jTextFieldGuid.getText());\r
- }\r
- ppi.setUsage(PpiUsage.Enum.forString(jComboBoxUsage.getSelectedItem().toString()));\r
- ppi.setEnableFeature(this.jRadioButtonEnableFeature.isSelected());\r
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {\r
- ppi.setFeatureFlag(this.jTextFieldFeatureFlag.getText());\r
- }\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())) {\r
- ppi.setOverrideID(Integer.parseInt(this.jTextFieldOverrideID.getText()));\r
- }\r
- if (location > -1) {\r
- ppis.setPpiArray(location, ppi);\r
- } else {\r
- ppis.addNewPpi();\r
- ppis.setPpiArray(ppis.getPpiList().size() - 1, ppi);\r
- }\r
- }\r
- if (this.jRadioButtonPpiNotify.isSelected()) {\r
- PPIsDocument.PPIs.PpiNotify ppiNotify = PPIsDocument.PPIs.PpiNotify.Factory.newInstance();\r
- ppiNotify.setStringValue(this.jTextFieldC_Name.getText());\r
- if (!isEmpty(this.jTextFieldGuid.getText())) {\r
- ppiNotify.setGuid(this.jTextFieldGuid.getText());\r
- }\r
- ppiNotify.setUsage(PpiNotifyUsage.Enum.forString(jComboBoxUsage.getSelectedItem().toString()));\r
- ppiNotify.setEnableFeature(this.jRadioButtonEnableFeature.isSelected());\r
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {\r
- ppiNotify.setFeatureFlag(this.jTextFieldFeatureFlag.getText());\r
- }\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())) {\r
- ppiNotify.setOverrideID(Integer.parseInt(this.jTextFieldOverrideID.getText()));\r
- }\r
- if (location > -1) {\r
- ppis.setPpiNotifyArray(location, ppiNotify);\r
- } else {\r
- ppis.addNewPpiNotify();\r
- ppis.setPpiNotifyArray(ppis.getPpiNotifyList().size() - 1, ppiNotify);\r
- }\r
- }\r
- } catch (Exception e) {\r
- Log.err("Update Protocols", e.getMessage());\r
- }\r
- }\r
-\r
- /**\r
- Enable/Disable relevant fields via different PPI types\r
- \r
- @param intType The input data of PPI type\r
- \r
- **/\r
- private void initUsage(int intType) {\r
- jComboBoxUsage.removeAllItems();\r
- if (intType == ModulePpis.PPI) {\r
- jComboBoxUsage.addItem("ALWAYS_CONSUMED");\r
- jComboBoxUsage.addItem("SOMETIMES_CONSUMED");\r
- jComboBoxUsage.addItem("ALWAYS_PRODUCED");\r
- jComboBoxUsage.addItem("SOMETIMES_PRODUCED");\r
- jComboBoxUsage.addItem("PRIVATE");\r
- }\r
- if (intType == ModulePpis.PPI_NOTIFY) {\r
- jComboBoxUsage.addItem("SOMETIMES_CONSUMED");\r
- }\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to create, update Protocol of MSA/MBD file\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-\r
-package org.tianocore.packaging.module.ui;\r
-\r
-import java.awt.Dimension;\r
-import java.awt.event.ActionEvent;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JLabel;\r
-import javax.swing.JPanel;\r
-import javax.swing.JRadioButton;\r
-import javax.swing.JTextField;\r
-\r
-import org.tianocore.ProtocolNotifyUsage;\r
-import org.tianocore.ProtocolUsage;\r
-import org.tianocore.ProtocolsDocument;\r
-import org.tianocore.common.DataValidation;\r
-import org.tianocore.common.Log;\r
-import org.tianocore.common.Tools;\r
-import org.tianocore.packaging.common.ui.IDefaultMutableTreeNode;\r
-import org.tianocore.packaging.common.ui.IInternalFrame;\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-\r
-/**\r
- The class is used to create, update Protocol of MSA/MBD file\r
- It extends IInternalFrame\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class ModuleProtocols extends IInternalFrame {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -9084913640747858848L;\r
-\r
- //\r
- //Define class members\r
- //\r
- private ProtocolsDocument.Protocols protocols = null;\r
-\r
- private int location = -1;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JLabel jLabelC_Name = null;\r
-\r
- private JTextField jTextFieldC_Name = null;\r
-\r
- private JLabel jLabelGuid = null;\r
-\r
- private JTextField jTextFieldGuid = null;\r
-\r
- private JLabel jLabelFeatureFlag = null;\r
-\r
- private JTextField jTextFieldFeatureFlag = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JLabel jLabelUsage = null;\r
-\r
- private JComboBox jComboBoxUsage = null;\r
-\r
- private JLabel jLabelEnableFeature = null;\r
-\r
- private JRadioButton jRadioButtonEnableFeature = null;\r
-\r
- private JRadioButton jRadioButtonDisableFeature = null;\r
-\r
- private JRadioButton jRadioButtonProtocol = null;\r
-\r
- private JRadioButton jRadioButtonProtocolNotify = null;\r
-\r
- private JButton jButtonGenerateGuid = null;\r
-\r
- private JLabel jLabelOverrideID = null;\r
-\r
- private JTextField jTextFieldOverrideID = null;\r
-\r
- private StarLabel jStarLabel1 = null;\r
-\r
- private StarLabel jStarLabel2 = null;\r
-\r
- private JLabel jLabelProtocolType = null;\r
-\r
- /**\r
- This method initializes jTextFieldC_Name \r
- \r
- @return javax.swing.JTextField jTextFieldC_Name\r
- \r
- **/\r
- private JTextField getJTextFieldProtocolName() {\r
- if (jTextFieldC_Name == null) {\r
- jTextFieldC_Name = new JTextField();\r
- jTextFieldC_Name.setBounds(new java.awt.Rectangle(160, 35, 320, 20));\r
- }\r
- return jTextFieldC_Name;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldGuid \r
- \r
- @return javax.swing.JTextField jTextFieldGuid\r
- \r
- **/\r
- private JTextField getJTextFieldGuid() {\r
- if (jTextFieldGuid == null) {\r
- jTextFieldGuid = new JTextField();\r
- jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 60, 250, 20));\r
- }\r
- return jTextFieldGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldFeatureFlag \r
- \r
- @return javax.swing.JTextField jTextFieldFeatureFlag\r
- \r
- **/\r
- private JTextField getJTextFieldFeatureFlag() {\r
- if (jTextFieldFeatureFlag == null) {\r
- jTextFieldFeatureFlag = new JTextField();\r
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 135, 320, 20));\r
- }\r
- return jTextFieldFeatureFlag;\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton jButtonOk\r
- \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("OK");\r
- jButtonOk.setBounds(new java.awt.Rectangle(290, 190, 90, 20));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton jButtonCancel\r
- \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 190, 90, 20));\r
- jButtonCancel.setPreferredSize(new Dimension(90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxUsage \r
- \r
- @return javax.swing.JComboBox jComboBoxUsage\r
- \r
- **/\r
- private JComboBox getJComboBoxProtocolUsage() {\r
- if (jComboBoxUsage == null) {\r
- jComboBoxUsage = new JComboBox();\r
- jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 85, 320, 20));\r
- }\r
- return jComboBoxUsage;\r
- }\r
-\r
- /**\r
- This method initializes jRadioButtonEnableFeature \r
- \r
- @return javax.swing.JRadioButton jRadioButtonEnableFeature\r
- \r
- **/\r
- private JRadioButton getJRadioButtonEnableFeature() {\r
- if (jRadioButtonEnableFeature == null) {\r
- jRadioButtonEnableFeature = new JRadioButton();\r
- jRadioButtonEnableFeature.setText("Enable");\r
- jRadioButtonEnableFeature.setBounds(new java.awt.Rectangle(160, 110, 90, 20));\r
- jRadioButtonEnableFeature.addActionListener(this);\r
- jRadioButtonEnableFeature.setSelected(true);\r
- }\r
- return jRadioButtonEnableFeature;\r
- }\r
-\r
- /**\r
- This method initializes jRadioButtonDisableFeature \r
- \r
- @return javax.swing.JRadioButton jRadioButtonDisableFeature\r
- \r
- **/\r
- private JRadioButton getJRadioButtonDisableFeature() {\r
- if (jRadioButtonDisableFeature == null) {\r
- jRadioButtonDisableFeature = new JRadioButton();\r
- jRadioButtonDisableFeature.setText("Disable");\r
- jRadioButtonDisableFeature.setBounds(new java.awt.Rectangle(320, 110, 90, 20));\r
- jRadioButtonDisableFeature.addActionListener(this);\r
- }\r
- return jRadioButtonDisableFeature;\r
- }\r
-\r
- /**\r
- This method initializes jRadioButtonProtocol \r
- \r
- @return javax.swing.JRadioButton jRadioButtonProtocol\r
- \r
- **/\r
- private JRadioButton getJRadioButtonProtocol() {\r
- if (jRadioButtonProtocol == null) {\r
- jRadioButtonProtocol = new JRadioButton();\r
- jRadioButtonProtocol.setText("Protocol");\r
- jRadioButtonProtocol.setBounds(new java.awt.Rectangle(160, 10, 90, 20));\r
- jRadioButtonProtocol.setSelected(true);\r
- jRadioButtonProtocol.addActionListener(this);\r
- }\r
- return jRadioButtonProtocol;\r
- }\r
-\r
- /**\r
- This method initializes jRadioButtonProtocolNotify \r
- \r
- @return javax.swing.JRadioButton jRadioButtonProtocolNotify\r
- \r
- **/\r
- private JRadioButton getJRadioButtonProtocolNotify() {\r
- if (jRadioButtonProtocolNotify == null) {\r
- jRadioButtonProtocolNotify = new JRadioButton();\r
- jRadioButtonProtocolNotify.setText("Protocol Notify");\r
- jRadioButtonProtocolNotify.setBounds(new java.awt.Rectangle(320, 10, 120, 20));\r
- jRadioButtonProtocolNotify.addActionListener(this);\r
- }\r
- return jRadioButtonProtocolNotify;\r
- }\r
-\r
- /**\r
- This method initializes jButtonGenerateGuid \r
- \r
- @return javax.swing.JButton jButtonGenerateGuid\r
- \r
- **/\r
- private JButton getJButtonGenerateGuid() {\r
- if (jButtonGenerateGuid == null) {\r
- jButtonGenerateGuid = new JButton();\r
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 60, 65, 20));\r
- jButtonGenerateGuid.setText("GEN");\r
- jButtonGenerateGuid.addActionListener(this);\r
- }\r
- return jButtonGenerateGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldOverrideID \r
- \r
- @return javax.swing.JTextField jTextFieldOverrideID\r
- \r
- **/\r
- private JTextField getJTextFieldOverrideID() {\r
- if (jTextFieldOverrideID == null) {\r
- jTextFieldOverrideID = new JTextField();\r
- jTextFieldOverrideID.setBounds(new java.awt.Rectangle(160, 160, 50, 20));\r
- }\r
- return jTextFieldOverrideID;\r
- }\r
-\r
- public static void main(String[] args) {\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public ModuleProtocols() {\r
- super();\r
- init();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inProtocol The input data of ProtocolsDocument.Protocols\r
- \r
- **/\r
- public ModuleProtocols(ProtocolsDocument.Protocols inProtocol) {\r
- super();\r
- init(inProtocol);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inProtocol The input data of ProtocolsDocument.Protocols\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- public ModuleProtocols(ProtocolsDocument.Protocols inProtocol, int type, int index) {\r
- super();\r
- init(inProtocol, type, index);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @param inProtocol The input data of ProtocolsDocument.Protocols\r
- \r
- **/\r
- private void init(ProtocolsDocument.Protocols inProtocol) {\r
- init();\r
- this.setProtocols(inProtocol);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- Fill values to all fields if these values are not empty\r
- \r
- @param inProtocol The input data of ProtocolsDocument.Protocols\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- private void init(ProtocolsDocument.Protocols inProtocol, int type, int index) {\r
- init(inProtocol);\r
- this.location = index;\r
- if (type == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOL_ITEM) {\r
- this.jRadioButtonProtocol.setSelected(true);\r
- this.jRadioButtonProtocolNotify.setSelected(false);\r
- if (this.protocols.getProtocolArray(index).getStringValue() != null) {\r
- this.jTextFieldC_Name.setText(this.protocols.getProtocolArray(index).getStringValue());\r
- }\r
- if (this.protocols.getProtocolArray(index).getGuid() != null) {\r
- this.jTextFieldGuid.setText(this.protocols.getProtocolArray(index).getGuid());\r
- }\r
- if (this.protocols.getProtocolArray(index).getUsage() != null) {\r
- this.jComboBoxUsage.setSelectedItem(this.protocols.getProtocolArray(index).getUsage().toString());\r
- }\r
- this.jRadioButtonEnableFeature.setSelected(this.protocols.getProtocolArray(index).getEnableFeature());\r
- this.jRadioButtonDisableFeature.setSelected(!this.protocols.getProtocolArray(index).getEnableFeature());\r
- if (this.protocols.getProtocolArray(index).getFeatureFlag() != null) {\r
- this.jTextFieldFeatureFlag.setText(this.protocols.getProtocolArray(index).getFeatureFlag());\r
- }\r
- this.jTextFieldOverrideID.setText(String.valueOf(this.protocols.getProtocolArray(index).getOverrideID()));\r
- } else if (type == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOLNOTIFY_ITEM) {\r
- this.jRadioButtonProtocol.setSelected(false);\r
- this.jRadioButtonProtocolNotify.setSelected(true);\r
- this.jTextFieldFeatureFlag.setEditable(false);\r
- this.jRadioButtonDisableFeature.setEnabled(false);\r
- this.jRadioButtonEnableFeature.setEnabled(false);\r
- this.jComboBoxUsage.setEnabled(false);\r
- if (this.protocols.getProtocolNotifyArray(index).getStringValue() != null) {\r
- this.jTextFieldC_Name.setText(this.protocols.getProtocolNotifyArray(index).getStringValue());\r
- }\r
- if (this.protocols.getProtocolNotifyArray(index).getGuid() != null) {\r
- this.jTextFieldGuid.setText(this.protocols.getProtocolNotifyArray(index).getGuid());\r
- }\r
- if (this.protocols.getProtocolNotifyArray(index).getUsage() != null) {\r
- this.jComboBoxUsage.setSelectedItem(this.protocols.getProtocolNotifyArray(index).getUsage().toString());\r
- }\r
- this.jTextFieldOverrideID.setText(String.valueOf(this.protocols.getProtocolNotifyArray(index)\r
- .getOverrideID()));\r
- }\r
- this.jRadioButtonProtocol.setEnabled(false);\r
- this.jRadioButtonProtocolNotify.setEnabled(false);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void init() {\r
- this.setSize(500, 515);\r
- this.setName("JFrame");\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Protocols");\r
- initFrame();\r
- this.setViewMode(false);\r
- }\r
-\r
- /**\r
- Disable all components when the mode is view\r
- \r
- @param isView true - The view mode; false - The non-view mode\r
- \r
- **/\r
- public void setViewMode(boolean isView) {\r
- this.jButtonOk.setVisible(false);\r
- this.jButtonCancel.setVisible(false);\r
- if (isView) {\r
- this.jRadioButtonProtocol.setEnabled(!isView);\r
- this.jRadioButtonProtocolNotify.setEnabled(!isView);\r
- this.jTextFieldC_Name.setEnabled(!isView);\r
- this.jTextFieldGuid.setEnabled(!isView);\r
- this.jComboBoxUsage.setEnabled(!isView);\r
- this.jRadioButtonEnableFeature.setEnabled(!isView);\r
- this.jRadioButtonDisableFeature.setEnabled(!isView);\r
- this.jTextFieldFeatureFlag.setEnabled(!isView);\r
- this.jTextFieldOverrideID.setEnabled(!isView);\r
- this.jButtonGenerateGuid.setEnabled(!isView);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel jContentPane\r
- \r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabelProtocolType = new JLabel();\r
- jLabelProtocolType.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
- jLabelProtocolType.setText("Protocol Type");\r
- jLabelOverrideID = new JLabel();\r
- jLabelOverrideID.setBounds(new java.awt.Rectangle(15, 160, 140, 20));\r
- jLabelOverrideID.setText("Override ID");\r
- jLabelEnableFeature = new JLabel();\r
- jLabelEnableFeature.setText("Enable Feature");\r
- jLabelEnableFeature.setBounds(new java.awt.Rectangle(15, 110, 140, 20));\r
- jLabelUsage = new JLabel();\r
- jLabelUsage.setText("Usage");\r
- jLabelUsage.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
- jLabelFeatureFlag = new JLabel();\r
- jLabelFeatureFlag.setText("Feature Flag");\r
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 135, 140, 20));\r
- jLabelGuid = new JLabel();\r
- jLabelGuid.setText("Guid");\r
- jLabelGuid.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
- jLabelC_Name = new JLabel();\r
- jLabelC_Name.setText("C_Name");\r
- jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(jLabelC_Name, null);\r
- jContentPane.add(getJTextFieldProtocolName(), null);\r
- jContentPane.add(jLabelGuid, null);\r
- jContentPane.add(getJTextFieldGuid(), null);\r
- jContentPane.add(jLabelFeatureFlag, null);\r
- jContentPane.add(getJTextFieldFeatureFlag(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(jLabelUsage, null);\r
- jContentPane.add(getJComboBoxProtocolUsage(), null);\r
- jContentPane.add(jLabelEnableFeature, null);\r
- jContentPane.add(getJRadioButtonEnableFeature(), null);\r
- jContentPane.add(getJRadioButtonDisableFeature(), null);\r
- jContentPane.add(getJRadioButtonProtocol(), null);\r
- jContentPane.add(getJRadioButtonProtocolNotify(), null);\r
- jContentPane.add(getJButtonGenerateGuid(), null);\r
- jContentPane.add(jLabelOverrideID, null);\r
- jContentPane.add(getJTextFieldOverrideID(), null);\r
- jContentPane.add(jLabelProtocolType, null);\r
-\r
- jStarLabel1 = new StarLabel();\r
- jStarLabel1.setBounds(new java.awt.Rectangle(0, 10, 10, 20));\r
- jStarLabel2 = new StarLabel();\r
- jStarLabel2.setBounds(new java.awt.Rectangle(0, 35, 10, 20));\r
-\r
- jContentPane.add(jStarLabel1, null);\r
- jContentPane.add(jStarLabel2, null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes Usage type\r
- \r
- **/\r
- private void initFrame() {\r
- jComboBoxUsage.addItem("ALWAYS_CONSUMED");\r
- jComboBoxUsage.addItem("SOMETIMES_CONSUMED");\r
- jComboBoxUsage.addItem("ALWAYS_PRODUCED");\r
- jComboBoxUsage.addItem("SOMETIMES_PRODUCED");\r
- jComboBoxUsage.addItem("TO_START");\r
- jComboBoxUsage.addItem("BY_START");\r
- jComboBoxUsage.addItem("PRIVATE");\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- *\r
- * Override actionPerformed to listen all actions\r
- * \r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.setEdited(true);\r
- this.save();\r
- this.dispose();\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- }\r
-\r
- //\r
- // Contorl the selected status when click RadionButton\r
- // Do not use Radio Button Group\r
- //\r
- if (arg0.getSource() == jRadioButtonProtocol) {\r
- if (jRadioButtonProtocol.isSelected()) {\r
- jRadioButtonProtocolNotify.setSelected(false);\r
- jRadioButtonEnableFeature.setEnabled(true);\r
- jRadioButtonDisableFeature.setEnabled(true);\r
- jTextFieldFeatureFlag.setEnabled(true);\r
- jComboBoxUsage.setEnabled(true);\r
- }\r
- if (!jRadioButtonProtocolNotify.isSelected() && !jRadioButtonProtocol.isSelected()) {\r
- jRadioButtonProtocol.setSelected(true);\r
- jRadioButtonEnableFeature.setEnabled(true);\r
- jRadioButtonDisableFeature.setEnabled(true);\r
- jTextFieldFeatureFlag.setEnabled(true);\r
- jComboBoxUsage.setEnabled(true);\r
- }\r
- }\r
-\r
- if (arg0.getSource() == jRadioButtonProtocolNotify) {\r
- if (jRadioButtonProtocolNotify.isSelected()) {\r
- jRadioButtonProtocol.setSelected(false);\r
- jRadioButtonEnableFeature.setEnabled(false);\r
- jRadioButtonDisableFeature.setEnabled(false);\r
- jTextFieldFeatureFlag.setEnabled(false);\r
- jComboBoxUsage.setSelectedIndex(1);\r
- jComboBoxUsage.setEnabled(false);\r
- }\r
- if (!jRadioButtonProtocolNotify.isSelected() && !jRadioButtonProtocol.isSelected()) {\r
- jRadioButtonProtocolNotify.setSelected(true);\r
- jRadioButtonEnableFeature.setEnabled(false);\r
- jRadioButtonDisableFeature.setEnabled(false);\r
- jTextFieldFeatureFlag.setEnabled(false);\r
- jComboBoxUsage.setSelectedIndex(1);\r
- jComboBoxUsage.setEnabled(false);\r
- }\r
- }\r
-\r
- //\r
- // Contorl the selected status when click RadionButton\r
- // Do not use Radio Button Group\r
- //\r
- if (arg0.getSource() == jRadioButtonEnableFeature) {\r
- if (jRadioButtonEnableFeature.isSelected()) {\r
- jRadioButtonDisableFeature.setSelected(false);\r
- }\r
- if (!jRadioButtonDisableFeature.isSelected() && !jRadioButtonEnableFeature.isSelected()) {\r
- jRadioButtonEnableFeature.setSelected(true);\r
- }\r
- }\r
-\r
- if (arg0.getSource() == jRadioButtonDisableFeature) {\r
- if (jRadioButtonDisableFeature.isSelected()) {\r
- jRadioButtonEnableFeature.setSelected(false);\r
- }\r
- if (!jRadioButtonDisableFeature.isSelected() && !jRadioButtonEnableFeature.isSelected()) {\r
- jRadioButtonDisableFeature.setSelected(true);\r
- }\r
- }\r
-\r
- if (arg0.getSource() == jButtonGenerateGuid) {\r
- jTextFieldGuid.setText(Tools.generateUuidString());\r
- }\r
- }\r
-\r
- /**\r
- Get ProtocolsDocument.Protocols\r
- \r
- @return ProtocolsDocument.Protocols\r
- \r
- **/\r
- public ProtocolsDocument.Protocols getProtocols() {\r
- return protocols;\r
- }\r
-\r
- /**\r
- Set ProtocolsDocument.Protocols\r
- \r
- @param protocols The input data of ProtocolsDocument.Protocols\r
- \r
- **/\r
- public void setProtocols(ProtocolsDocument.Protocols protocols) {\r
- this.protocols = protocols;\r
- }\r
-\r
- /**\r
- Data validation for all fields\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean check() {\r
- //\r
- // Check if all required fields are not empty\r
- //\r
- if (isEmpty(this.jTextFieldC_Name.getText())) {\r
- Log.err("C_Name couldn't be empty");\r
- return false;\r
- }\r
-\r
- //\r
- // Check if all fields have correct data types \r
- //\r
- if (!DataValidation.isCName(this.jTextFieldC_Name.getText())) {\r
- Log.err("Incorrect data type for C_Name");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldGuid.getText()) && !DataValidation.isGuid(this.jTextFieldGuid.getText())) {\r
- Log.err("Incorrect data type for Guid");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())\r
- && !DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {\r
- Log.err("Incorrect data type for Feature Flag");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())\r
- && !DataValidation.isOverrideID(this.jTextFieldOverrideID.getText())) {\r
- Log.err("Incorrect data type for Override ID");\r
- return false;\r
- }\r
-\r
- return true;\r
- }\r
-\r
- /**\r
- Save all components of Protocols\r
- if exists protocols, set the value directly\r
- if not exists protocols, new an instance first\r
- \r
- **/\r
- public void save() {\r
- try {\r
- if (this.protocols == null) {\r
- protocols = ProtocolsDocument.Protocols.Factory.newInstance();\r
- }\r
- if (this.jRadioButtonProtocol.isSelected()) {\r
- ProtocolsDocument.Protocols.Protocol protocol = ProtocolsDocument.Protocols.Protocol.Factory\r
- .newInstance();\r
- protocol.setStringValue(this.jTextFieldC_Name.getText());\r
- if (!isEmpty(this.jTextFieldGuid.getText())) {\r
- protocol.setGuid(this.jTextFieldGuid.getText());\r
- }\r
- protocol.setUsage(ProtocolUsage.Enum.forString(jComboBoxUsage.getSelectedItem().toString()));\r
- protocol.setEnableFeature(this.jRadioButtonEnableFeature.isSelected());\r
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {\r
- protocol.setFeatureFlag(this.jTextFieldFeatureFlag.getText());\r
- }\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())) {\r
- protocol.setOverrideID(Integer.parseInt(this.jTextFieldOverrideID.getText()));\r
- }\r
- if (location > -1) {\r
- protocols.setProtocolArray(location, protocol);\r
- } else {\r
- protocols.addNewProtocol();\r
- protocols.setProtocolArray(protocols.getProtocolList().size() - 1, protocol);\r
- }\r
- }\r
- if (this.jRadioButtonProtocolNotify.isSelected()) {\r
- ProtocolsDocument.Protocols.ProtocolNotify protocolNofity = ProtocolsDocument.Protocols.ProtocolNotify.Factory\r
- .newInstance();\r
- protocolNofity.setStringValue(this.jTextFieldC_Name.getText());\r
- if (!isEmpty(this.jTextFieldGuid.getText())) {\r
- protocolNofity.setGuid(this.jTextFieldGuid.getText());\r
- }\r
- protocolNofity\r
- .setUsage(ProtocolNotifyUsage.Enum.forString(jComboBoxUsage.getSelectedItem().toString()));\r
-\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())) {\r
- protocolNofity.setOverrideID(Integer.parseInt(this.jTextFieldOverrideID.getText()));\r
- }\r
- if (location > -1) {\r
- protocols.setProtocolNotifyArray(location, protocolNofity);\r
- } else {\r
- protocols.addNewProtocolNotify();\r
- protocols.setProtocolNotifyArray(protocols.getProtocolNotifyList().size() - 1, protocolNofity);\r
- }\r
- }\r
- } catch (Exception e) {\r
- Log.err("Update Protocols", e.getMessage());\r
- }\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to create, update SourceFile of MSA/MBD file\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-package org.tianocore.packaging.module.ui;\r
-\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ItemEvent;\r
-import java.awt.event.ItemListener;\r
-import java.util.Vector;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.JCheckBox;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JFileChooser;\r
-import javax.swing.JLabel;\r
-import javax.swing.JPanel;\r
-import javax.swing.JTextField;\r
-\r
-import org.tianocore.FilenameDocument;\r
-import org.tianocore.SourceFilesDocument;\r
-import org.tianocore.SupportedArchitectures;\r
-import org.tianocore.ToolChains;\r
-import org.tianocore.common.DataType;\r
-import org.tianocore.common.DataValidation;\r
-import org.tianocore.common.Log;\r
-import org.tianocore.common.Tools;\r
-import org.tianocore.packaging.common.ui.IDefaultMutableTreeNode;\r
-import org.tianocore.packaging.common.ui.IInternalFrame;\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-import org.tianocore.packaging.workspace.common.Workspace;\r
-import javax.swing.JScrollPane;\r
-import javax.swing.JTextArea;\r
-\r
-/**\r
- The class is used to create, update SourceFile of MSA/MBD file\r
- It extends IInternalFrame\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class ModuleSourceFiles extends IInternalFrame implements ItemListener {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -6765742852142775378L;\r
-\r
- //\r
- // Define class members\r
- //\r
- private SourceFilesDocument.SourceFiles sourceFiles = null;\r
-\r
- private int location = -1;\r
- \r
- private int intSelectedItemId = 0;\r
-\r
- //\r
- // 1 - Add; 2 - Update\r
- //\r
- private int operation = -1;\r
-\r
- private Workspace ws = new Workspace();\r
-\r
- private Vector<String> vFileName = new Vector<String>();\r
-\r
- private Vector<String> vGuid = new Vector<String>();\r
-\r
- private Vector<String> vPath = new Vector<String>();\r
-\r
- private Vector<String> vFileType = new Vector<String>();\r
-\r
- private Vector<String> vToolChain = new Vector<String>();\r
-\r
- private Vector<String> vOverrideID = new Vector<String>();\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JLabel jLabelFileName = null;\r
-\r
- private JTextField jTextFieldFileName = null;\r
-\r
- private JButton jButtonOpenFile = null;\r
-\r
- private JLabel jLabelGuid = null;\r
-\r
- private JTextField jTextFieldGuid = null;\r
-\r
- private JButton jButtonGenerateGuid = null;\r
-\r
- private JComboBox jComboBoxArch = null;\r
-\r
- private JLabel jLabelPath = null;\r
-\r
- private JTextField jTextFieldPath = null;\r
-\r
- private JLabel jLabelFileType = null;\r
-\r
- private JTextField jTextFieldFileType = null;\r
-\r
- private JLabel jLabelOverrideID = null;\r
-\r
- private JTextField jTextFieldOverrideID = null;\r
-\r
- private StarLabel jStarLabel1 = null;\r
-\r
- private JComboBox jComboBoxFileList = null;\r
-\r
- private JButton jButtonAdd = null;\r
-\r
- private JButton jButtonRemove = null;\r
-\r
- private JButton jButtonUpdate = null;\r
-\r
- private JCheckBox jCheckBoxArch = null;\r
-\r
- private JLabel jLabelToolChain = null;\r
-\r
- private JComboBox jComboBoxToolChain = null;\r
-\r
- private JScrollPane jScrollPaneFileList = null;\r
-\r
- private JTextArea jTextAreaFileList = null;\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton jButtonOk\r
- \r
- **/\r
- private JButton getJButton() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("OK");\r
- jButtonOk.setBounds(new java.awt.Rectangle(290, 340, 90, 20));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton jButtonCancel\r
- \r
- **/\r
- private JButton getJButton1() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 340, 90, 20));\r
- jButtonCancel.setPreferredSize(new java.awt.Dimension(90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldFileName \r
- \r
- @return javax.swing.JTextField jTextFieldFileName\r
- \r
- **/\r
- private JTextField getJTextFieldSourceFilesDirectory() {\r
- if (jTextFieldFileName == null) {\r
- jTextFieldFileName = new JTextField();\r
- jTextFieldFileName.setBounds(new java.awt.Rectangle(140,10,250,20));\r
- }\r
- return jTextFieldFileName;\r
- }\r
-\r
- /**\r
- This method initializes jButtonOpenFile \r
- \r
- @return javax.swing.JButton jButtonOpenFile\r
- \r
- **/\r
- private JButton getJButtonOpenFile() {\r
- if (jButtonOpenFile == null) {\r
- jButtonOpenFile = new JButton();\r
- jButtonOpenFile.setText("Browse");\r
- jButtonOpenFile.setBounds(new java.awt.Rectangle(395,10,85,20));\r
- jButtonOpenFile.addActionListener(this);\r
- }\r
- return jButtonOpenFile;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldGuid \r
- \r
- @return javax.swing.JTextField jTextFieldGuid\r
- \r
- **/\r
- private JTextField getJTextFieldGuid() {\r
- if (jTextFieldGuid == null) {\r
- jTextFieldGuid = new JTextField();\r
- jTextFieldGuid.setBounds(new java.awt.Rectangle(140,35,250,20));\r
- }\r
- return jTextFieldGuid;\r
- }\r
-\r
- /**\r
- This method initializes jButtonGenerateGuid \r
- \r
- @return javax.swing.JButton jButtonGenerateGuid\r
- \r
- **/\r
- private JButton getJButtonGenerateGuid() {\r
- if (jButtonGenerateGuid == null) {\r
- jButtonGenerateGuid = new JButton();\r
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(395,35,85,20));\r
- jButtonGenerateGuid.setText("GEN");\r
- jButtonGenerateGuid.addActionListener(this);\r
- }\r
- return jButtonGenerateGuid;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxArch \r
- \r
- @return javax.swing.JComboBox jComboBoxArch\r
- \r
- **/\r
- private JComboBox getJComboBoxArch() {\r
- if (jComboBoxArch == null) {\r
- jComboBoxArch = new JComboBox();\r
- jComboBoxArch.setBounds(new java.awt.Rectangle(140, 160, 340, 20));\r
- jComboBoxArch.setEnabled(false);\r
- }\r
- return jComboBoxArch;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldPath \r
- \r
- @return javax.swing.JTextField jTextFieldPath\r
- \r
- **/\r
- private JTextField getJTextFieldPath() {\r
- if (jTextFieldPath == null) {\r
- jTextFieldPath = new JTextField();\r
- jTextFieldPath.setBounds(new java.awt.Rectangle(140, 60, 340, 20));\r
- }\r
- return jTextFieldPath;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldFileType \r
- \r
- @return javax.swing.JTextField jTextFieldFileType\r
- \r
- **/\r
- private JTextField getJTextFieldFileType() {\r
- if (jTextFieldFileType == null) {\r
- jTextFieldFileType = new JTextField();\r
- jTextFieldFileType.setBounds(new java.awt.Rectangle(140, 85, 340, 20));\r
- }\r
- return jTextFieldFileType;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldOverrideID \r
- \r
- @return javax.swing.JTextField jTextFieldOverrideID\r
- \r
- **/\r
- private JTextField getJTextFieldOverrideID() {\r
- if (jTextFieldOverrideID == null) {\r
- jTextFieldOverrideID = new JTextField();\r
- jTextFieldOverrideID.setBounds(new java.awt.Rectangle(140, 135, 50, 20));\r
- }\r
- return jTextFieldOverrideID;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxFileList \r
- \r
- @return javax.swing.JComboBox jComboBoxFileList\r
- \r
- **/\r
- private JComboBox getJComboBoxFileList() {\r
- if (jComboBoxFileList == null) {\r
- jComboBoxFileList = new JComboBox();\r
- jComboBoxFileList.setBounds(new java.awt.Rectangle(15, 185, 210, 20));\r
- jComboBoxFileList.addItemListener(this);\r
- jComboBoxFileList.addActionListener(this);\r
- }\r
- return jComboBoxFileList;\r
- }\r
-\r
- /**\r
- This method initializes jButtonAdd \r
- \r
- @return javax.swing.JButton jButtonAdd\r
- \r
- **/\r
- private JButton getJButtonAdd() {\r
- if (jButtonAdd == null) {\r
- jButtonAdd = new JButton();\r
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 185, 80, 20));\r
- jButtonAdd.setText("Add");\r
- jButtonAdd.addActionListener(this);\r
- }\r
- return jButtonAdd;\r
- }\r
-\r
- /**\r
- This method initializes jButtonRemove \r
- \r
- @return javax.swing.JButton jButtonRemove\r
- \r
- **/\r
- private JButton getJButtonRemove() {\r
- if (jButtonRemove == null) {\r
- jButtonRemove = new JButton();\r
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 185, 80, 20));\r
- jButtonRemove.setText("Remove");\r
- jButtonRemove.addActionListener(this);\r
- }\r
- return jButtonRemove;\r
- }\r
-\r
- /**\r
- This method initializes jButtonUpdate \r
- \r
- @return javax.swing.JButton jButtonUpdate\r
- \r
- **/\r
- private JButton getJButtonUpdate() {\r
- if (jButtonUpdate == null) {\r
- jButtonUpdate = new JButton();\r
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 185, 80, 20));\r
- jButtonUpdate.setText("Update");\r
- jButtonUpdate.addActionListener(this);\r
- }\r
- return jButtonUpdate;\r
- }\r
-\r
- /**\r
- This method initializes jCheckBoxArch \r
- \r
- @return javax.swing.JCheckBox jCheckBoxArch\r
- \r
- **/\r
- private JCheckBox getJCheckBoxArch() {\r
- if (jCheckBoxArch == null) {\r
- jCheckBoxArch = new JCheckBox();\r
- jCheckBoxArch.setBounds(new java.awt.Rectangle(15, 160, 120, 20));\r
- jCheckBoxArch.setText("Specific Arch");\r
- jCheckBoxArch.addActionListener(this);\r
- }\r
- return jCheckBoxArch;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxToolChain \r
- \r
- @return javax.swing.JComboBox jComboBoxToolChain\r
- \r
- **/\r
- private JComboBox getJComboBoxToolChain() {\r
- if (jComboBoxToolChain == null) {\r
- jComboBoxToolChain = new JComboBox();\r
- jComboBoxToolChain.setBounds(new java.awt.Rectangle(140, 110, 340, 20));\r
- }\r
- return jComboBoxToolChain;\r
- }\r
-\r
- /**\r
- * This method initializes jScrollPaneFileList \r
- * \r
- * @return javax.swing.JScrollPane \r
- */\r
- private JScrollPane getJScrollPaneFileList() {\r
- if (jScrollPaneFileList == null) {\r
- jScrollPaneFileList = new JScrollPane();\r
- jScrollPaneFileList.setBounds(new java.awt.Rectangle(15,210,465,240));\r
- jScrollPaneFileList.setViewportView(getJTextAreaFileList());\r
- }\r
- return jScrollPaneFileList;\r
- }\r
-\r
- /**\r
- * This method initializes jTextAreaFileList \r
- * \r
- * @return javax.swing.JTextArea \r
- */\r
- private JTextArea getJTextAreaFileList() {\r
- if (jTextAreaFileList == null) {\r
- jTextAreaFileList = new JTextArea();\r
- jTextAreaFileList.setEditable(false);\r
- }\r
- return jTextAreaFileList;\r
- }\r
-\r
- public static void main(String[] args) {\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public ModuleSourceFiles() {\r
- super();\r
- init();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inSourceFiles The input data of SourceFilesDocument.SourceFiles\r
- \r
- **/\r
- public ModuleSourceFiles(SourceFilesDocument.SourceFiles inSourceFiles) {\r
- super();\r
- init(inSourceFiles);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inSourceFiles The input data of SourceFilesDocument.SourceFiles\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- @param inOperation The input data of current operation type\r
- \r
- **/\r
- public ModuleSourceFiles(SourceFilesDocument.SourceFiles inSourceFiles, int type, int index, int inOperation) {\r
- super();\r
- init(inSourceFiles, type, index, inOperation);\r
- this.operation = inOperation;\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @param inSourceFiles The input data of SourceFilesDocument.SourceFiles\r
- \r
- **/\r
- private void init(SourceFilesDocument.SourceFiles inSourceFiles) {\r
- init();\r
- this.setSourceFiles(inSourceFiles);\r
- }\r
-\r
- /** \r
- This method initializes this\r
- Fill values to all fields if these values are not empty\r
- \r
- \r
- @param inSourceFiles The input data of SourceFilesDocument.SourceFiles\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- @param inOperation The input data of current operation type\r
- \r
- **/\r
- private void init(SourceFilesDocument.SourceFiles inSourceFiles, int type, int index, int inOperation) {\r
- init(inSourceFiles);\r
- this.location = index;\r
- this.operation = inOperation;\r
-\r
- //\r
- // When update\r
- //\r
- if (operation == 2) {\r
- this.jCheckBoxArch.setEnabled(false);\r
- this.jComboBoxArch.setEnabled(false);\r
-\r
- if (type == IDefaultMutableTreeNode.SOURCEFILES_FILENAME) {\r
- if (this.sourceFiles.getFilenameList().size() > 0) {\r
- for (int indexI = 0; indexI < this.sourceFiles.getFilenameList().size(); indexI++) {\r
- if (this.sourceFiles.getFilenameArray(indexI).getStringValue() != null) {\r
- vFileName.addElement(this.sourceFiles.getFilenameArray(indexI).getStringValue());\r
- } else {\r
- vFileName.addElement("");\r
- }\r
- if (this.sourceFiles.getFilenameArray(indexI).getGuid() != null) {\r
- vGuid.addElement(this.sourceFiles.getFilenameArray(indexI).getGuid());\r
- } else {\r
- vGuid.addElement("");\r
- }\r
- if (this.sourceFiles.getFilenameArray(indexI).getPath() != null) {\r
- vPath.addElement(this.sourceFiles.getFilenameArray(indexI).getPath());\r
- } else {\r
- vPath.addElement("");\r
- }\r
- if (this.sourceFiles.getFilenameArray(indexI).getFileType() != null) {\r
- vFileType.addElement(this.sourceFiles.getFilenameArray(indexI).getFileType());\r
- } else {\r
- vFileType.addElement("");\r
- }\r
- if (this.sourceFiles.getFilenameArray(indexI).getToolChain() != null) {\r
- vToolChain.addElement(this.sourceFiles.getFilenameArray(indexI).getToolChain().toString());\r
- } else {\r
- vToolChain.addElement(DataType.EMPTY_SELECT_ITEM);\r
- }\r
- vOverrideID.addElement(String.valueOf(this.sourceFiles.getFilenameArray(indexI).getOverrideID()));\r
- jComboBoxFileList.addItem(this.sourceFiles.getFilenameArray(indexI).getStringValue());\r
- }\r
- }\r
- }\r
- if (type == IDefaultMutableTreeNode.SOURCEFILES_ARCH_ITEM) {\r
- this.jCheckBoxArch.setSelected(true);\r
- this.jComboBoxArch.setSelectedItem(this.sourceFiles.getArchArray(index).getArchType().toString());\r
- for (int indexI = 0; indexI < this.sourceFiles.getArchArray(index).getFilenameList().size(); indexI++) {\r
- if (this.sourceFiles.getArchArray(index).getFilenameArray(indexI).getStringValue() != null) {\r
- vFileName.addElement(this.sourceFiles.getArchArray(index).getFilenameArray(indexI)\r
- .getStringValue());\r
- } else {\r
- vFileName.addElement("");\r
- }\r
- if (this.sourceFiles.getArchArray(index).getFilenameArray(indexI).getGuid() != null) {\r
- vGuid.addElement(this.sourceFiles.getArchArray(index).getFilenameArray(indexI).getGuid());\r
- } else {\r
- vGuid.addElement("");\r
- }\r
- if (this.sourceFiles.getArchArray(index).getFilenameArray(indexI).getPath() != null) {\r
- vPath.addElement(this.sourceFiles.getArchArray(index).getFilenameArray(indexI).getPath());\r
- } else {\r
- vPath.addElement("");\r
- }\r
- if (this.sourceFiles.getArchArray(index).getFilenameArray(indexI).getFileType() != null) {\r
- vFileType.addElement(this.sourceFiles.getArchArray(index).getFilenameArray(indexI)\r
- .getFileType());\r
- } else {\r
- vFileType.addElement("");\r
- }\r
- if (this.sourceFiles.getArchArray(index).getFilenameArray(indexI).getToolChain() != null) {\r
- vToolChain.addElement(this.sourceFiles.getArchArray(index).getFilenameArray(indexI)\r
- .getToolChain().toString());\r
- } else {\r
- vToolChain.addElement("");\r
- }\r
- vOverrideID.addElement(String.valueOf(this.sourceFiles.getArchArray(index).getFilenameArray(indexI)\r
- .getOverrideID()));\r
- jComboBoxFileList.addItem(this.sourceFiles.getArchArray(index).getFilenameArray(indexI)\r
- .getStringValue());\r
- }\r
- }\r
- //\r
- // Update the file list\r
- //\r
- reloadFileListArea();\r
- }\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void init() {\r
- this.setSize(500, 515);\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Source Files");\r
- initFrame();\r
- this.setViewMode(false);\r
- }\r
-\r
- /**\r
- Disable all components when the mode is view\r
- \r
- @param isView true - The view mode; false - The non-view mode\r
- \r
- **/\r
- public void setViewMode(boolean isView) {\r
- this.jButtonOk.setVisible(false);\r
- this.jButtonCancel.setVisible(false);\r
- if (isView) {\r
- this.jButtonOk.setEnabled(!isView);\r
- this.jButtonCancel.setEnabled(!isView);\r
- this.jTextFieldFileName.setEnabled(!isView);\r
- this.jButtonOpenFile.setEnabled(!isView);\r
- this.jTextFieldGuid.setEnabled(!isView);\r
- this.jButtonGenerateGuid.setEnabled(!isView);\r
- this.jTextFieldPath.setEnabled(!isView);\r
- this.jTextFieldFileType.setEnabled(!isView);\r
- this.jComboBoxToolChain.setEnabled(!isView);\r
- this.jTextFieldOverrideID.setEnabled(!isView);\r
-\r
- this.jButtonAdd.setEnabled(!isView);\r
- this.jButtonRemove.setEnabled(!isView);\r
- this.jButtonUpdate.setEnabled(!isView);\r
- this.jCheckBoxArch.setEnabled(!isView);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel jContentPane\r
- \r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabelToolChain = new JLabel();\r
- jLabelToolChain.setBounds(new java.awt.Rectangle(15, 110, 120, 20));\r
- jLabelToolChain.setText("Tool Chain");\r
- jLabelOverrideID = new JLabel();\r
- jLabelOverrideID.setBounds(new java.awt.Rectangle(15, 135, 120, 20));\r
- jLabelOverrideID.setText("Override ID");\r
- jLabelFileType = new JLabel();\r
- jLabelFileType.setBounds(new java.awt.Rectangle(15, 85, 120, 20));\r
- jLabelFileType.setText("File Type");\r
- jLabelPath = new JLabel();\r
- jLabelPath.setBounds(new java.awt.Rectangle(15, 60, 120, 20));\r
- jLabelPath.setText("Path");\r
- jLabelGuid = new JLabel();\r
- jLabelGuid.setBounds(new java.awt.Rectangle(15, 35, 120, 20));\r
- jLabelGuid.setText("Guid");\r
- jLabelFileName = new JLabel();\r
- jLabelFileName.setText("File Name");\r
- jLabelFileName.setBounds(new java.awt.Rectangle(15, 10, 120, 20));\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.setSize(new java.awt.Dimension(480,400));\r
- jContentPane.add(getJButton(), null);\r
- jContentPane.add(getJButton1(), null);\r
- jContentPane.add(jLabelFileName, null);\r
- jContentPane.add(getJTextFieldSourceFilesDirectory(), null);\r
- jContentPane.add(getJButtonOpenFile(), null);\r
- jContentPane.add(jLabelGuid, null);\r
- jContentPane.add(getJTextFieldGuid(), null);\r
- jContentPane.add(getJButtonGenerateGuid(), null);\r
- jContentPane.add(getJComboBoxArch(), null);\r
- jContentPane.add(jLabelPath, null);\r
- jContentPane.add(getJTextFieldPath(), null);\r
- jContentPane.add(jLabelFileType, null);\r
- jContentPane.add(getJTextFieldFileType(), null);\r
- jContentPane.add(jLabelOverrideID, null);\r
- jContentPane.add(getJTextFieldOverrideID(), null);\r
- jStarLabel1 = new StarLabel();\r
- jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
-\r
- jContentPane.add(jStarLabel1, null);\r
- jContentPane.add(getJComboBoxFileList(), null);\r
- jContentPane.add(getJButtonAdd(), null);\r
- jContentPane.add(getJButtonRemove(), null);\r
- jContentPane.add(getJButtonUpdate(), null);\r
- jContentPane.add(getJCheckBoxArch(), null);\r
- jContentPane.add(jLabelToolChain, null);\r
- jContentPane.add(getJComboBoxToolChain(), null);\r
-\r
- jContentPane.add(getJScrollPaneFileList(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- *\r
- * Override actionPerformed to listen all actions\r
- * \r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.setEdited(true);\r
- this.save();\r
- this.dispose();\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- }\r
- if (arg0.getSource() == jButtonGenerateGuid) {\r
- jTextFieldGuid.setText(Tools.generateUuidString());\r
- }\r
- if (arg0.getSource() == jButtonOpenFile) {\r
- selectFile();\r
- }\r
- if (arg0.getSource() == jButtonAdd) {\r
- if (!checkAdd()) {\r
- return;\r
- }\r
- addToList();\r
- }\r
- if (arg0.getSource() == jButtonRemove) {\r
- removeFromList();\r
- }\r
- if (arg0.getSource() == jButtonUpdate) {\r
- if (!checkAdd()) {\r
- return;\r
- }\r
- updateForList();\r
- }\r
-\r
- //\r
- //When and only when checked Arch box then can choose different arch types\r
- //\r
- if (arg0.getSource() == jCheckBoxArch) {\r
- if (this.jCheckBoxArch.isSelected()) {\r
- this.jComboBoxArch.setEnabled(true);\r
- } else {\r
- this.jComboBoxArch.setEnabled(false);\r
- }\r
- }\r
- }\r
-\r
- /**\r
- This method initializes Usage type and Arch type\r
- \r
- **/\r
- private void initFrame() {\r
- jComboBoxArch.addItem("ALL");\r
- jComboBoxArch.addItem("EBC");\r
- jComboBoxArch.addItem("ARM");\r
- jComboBoxArch.addItem("IA32");\r
- jComboBoxArch.addItem("X64");\r
- jComboBoxArch.addItem("IPF");\r
- jComboBoxArch.addItem("PPC");\r
-\r
- jComboBoxToolChain.addItem(DataType.EMPTY_SELECT_ITEM);\r
- jComboBoxToolChain.addItem("MSFT");\r
- jComboBoxToolChain.addItem("INTEL");\r
- jComboBoxToolChain.addItem("GCC");\r
- jComboBoxToolChain.addItem("CYGWIN");\r
- }\r
-\r
- /**\r
- Add current item to Vector\r
- \r
- **/\r
- private void addToList() {\r
- intSelectedItemId = vFileName.size();\r
- vFileName.addElement(this.jTextFieldFileName.getText());\r
- vGuid.addElement(this.jTextFieldGuid.getText());\r
- vPath.addElement(this.jTextFieldPath.getText());\r
- vFileType.addElement(this.jTextFieldFileType.getText());\r
- vToolChain.addElement(this.jComboBoxToolChain.getSelectedItem().toString());\r
- vOverrideID.addElement(this.jTextFieldOverrideID.getText());\r
- jComboBoxFileList.addItem(this.jTextFieldFileName.getText());\r
- jComboBoxFileList.setSelectedItem(this.jTextFieldFileName.getText());\r
- \r
- //\r
- // Reset select item index\r
- //\r
- intSelectedItemId = vFileName.size();\r
- \r
- //\r
- // Reload all fields of selected item\r
- //\r
- reloadFromList();\r
- }\r
-\r
- /**\r
- Remove current item from Vector\r
- \r
- **/\r
- private void removeFromList() {\r
- int intTempIndex = intSelectedItemId;\r
- if (vFileName.size() < 1) {\r
- return;\r
- }\r
- \r
- jComboBoxFileList.removeItemAt(intSelectedItemId);\r
- \r
- vFileName.removeElementAt(intTempIndex);\r
- vGuid.removeElementAt(intTempIndex);\r
- vPath.removeElementAt(intTempIndex);\r
- vFileType.removeElementAt(intTempIndex);\r
- vToolChain.removeElementAt(intTempIndex);\r
- vOverrideID.removeElementAt(intTempIndex);\r
- \r
- //\r
- // Reload all fields of selected item\r
- //\r
- reloadFromList();\r
- }\r
-\r
- /**\r
- Update current item of Vector\r
- \r
- **/\r
- private void updateForList() {\r
- //\r
- // Backup selected item index\r
- //\r
- int intTempIndex = intSelectedItemId;\r
- vFileName.setElementAt(this.jTextFieldFileName.getText(), intSelectedItemId);\r
- vGuid.setElementAt(this.jTextFieldGuid.getText(), intSelectedItemId);\r
- vPath.setElementAt(this.jTextFieldPath.getText(), intSelectedItemId);\r
- vFileType.setElementAt(this.jTextFieldFileType.getText(), intSelectedItemId);\r
- vToolChain.setElementAt(this.jComboBoxToolChain.getSelectedItem().toString(), intSelectedItemId);\r
- vOverrideID.setElementAt(this.jTextFieldOverrideID.getText(), intSelectedItemId);\r
- jComboBoxFileList.removeAllItems();\r
- for (int index = 0; index < vFileName.size(); index++) {\r
- jComboBoxFileList.addItem(vFileName.elementAt(index));\r
- }\r
- \r
- //\r
- // Restore selected item index\r
- //\r
- intSelectedItemId = intTempIndex;\r
- \r
- //\r
- // Reset select item index\r
- //\r
- jComboBoxFileList.setSelectedIndex(intSelectedItemId);\r
- \r
- //\r
- // Reload all fields of selected item\r
- //\r
- reloadFromList();\r
- }\r
-\r
- /**\r
- Refresh all fields' values of selected item of Vector\r
- \r
- **/\r
- private void reloadFromList() {\r
- if (vFileName.size() > 0) {\r
- //\r
- // Get selected item index\r
- //\r
- intSelectedItemId = jComboBoxFileList.getSelectedIndex();\r
- \r
- this.jTextFieldFileName.setText(vFileName.elementAt(intSelectedItemId).toString());\r
- this.jTextFieldGuid.setText(vGuid.elementAt(intSelectedItemId).toString());\r
- this.jTextFieldPath.setText(vPath.elementAt(intSelectedItemId).toString());\r
- this.jTextFieldFileType.setText(vFileType.elementAt(intSelectedItemId).toString());\r
- this.jComboBoxToolChain.setSelectedItem(vToolChain.elementAt(intSelectedItemId).toString());\r
- this.jTextFieldOverrideID.setText(vOverrideID.elementAt(intSelectedItemId).toString()); \r
- } else {\r
- this.jTextFieldFileName.setText("");\r
- this.jTextFieldGuid.setText("");\r
- this.jTextFieldPath.setText("");\r
- this.jTextFieldFileType.setText("");\r
- this.jComboBoxToolChain.setSelectedItem(DataType.EMPTY_SELECT_ITEM);\r
- this.jTextFieldOverrideID.setText("");\r
- }\r
- \r
- reloadFileListArea();\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)\r
- *\r
- * Reflesh the frame when selected item changed\r
- * \r
- */\r
- public void itemStateChanged(ItemEvent arg0) {\r
- if (arg0.getStateChange() == ItemEvent.SELECTED) {\r
- reloadFromList();\r
- }\r
- }\r
-\r
- /**\r
- Get SourceFilesDocument.SourceFiles\r
- \r
- @return SourceFilesDocument.SourceFiles\r
- \r
- **/\r
- public SourceFilesDocument.SourceFiles getSourceFiles() {\r
- return sourceFiles;\r
- }\r
-\r
- /**\r
- Set SourceFilesDocument.SourceFiles\r
- \r
- @param sourceFiles The input data of SourceFilesDocument.SourceFiles\r
- \r
- **/\r
- public void setSourceFiles(SourceFilesDocument.SourceFiles sourceFiles) {\r
- this.sourceFiles = sourceFiles;\r
- }\r
-\r
- /**\r
- Data validation for all fields\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean check() {\r
- if (this.jComboBoxFileList.getItemCount() < 1) {\r
- Log.err("Must have one file at least!");\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- /**\r
- Data validation for all fields\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean checkAdd() {\r
- //\r
- // Check if all required fields are not empty\r
- //\r
- if (isEmpty(this.jTextFieldFileName.getText())) {\r
- Log.err("File Name couldn't be empty");\r
- return false;\r
- }\r
-\r
- //\r
- // Check if all fields have correct data types \r
- //\r
- if (!DataValidation.isFileName(this.jTextFieldFileName.getText())) {\r
- Log.err("Incorrect data type for File Name");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldGuid.getText()) && !DataValidation.isGuid(this.jTextFieldGuid.getText())) {\r
- Log.err("Incorrect data type for Guid");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldPath.getText()) && !DataValidation.isPath(this.jTextFieldPath.getText())) {\r
- Log.err("Incorrect data type for Path");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())\r
- && !DataValidation.isOverrideID(this.jTextFieldOverrideID.getText())) {\r
- Log.err("Incorrect data type for Override ID");\r
- return false;\r
- }\r
-\r
- return true;\r
- }\r
-\r
- /**\r
- Save all components of SourceFiles\r
- if exists sourceFiles, set the value directly\r
- if not exists sourceFiles, new an instance first\r
- \r
- **/\r
- public void save() {\r
- try {\r
- if (this.sourceFiles == null) {\r
- sourceFiles = SourceFilesDocument.SourceFiles.Factory.newInstance();\r
- }\r
- //\r
- //Save as file name\r
- //\r
- if (!this.jCheckBoxArch.isSelected()) {\r
- if (this.operation == 2) { //Add new filename\r
- //\r
- //First remove all existed filename\r
- //\r
- if (sourceFiles.getFilenameList().size() > 0) {\r
- for (int index = sourceFiles.getFilenameList().size() - 1; index >= 0; index--) {\r
- sourceFiles.removeFilename(index);\r
- }\r
- }\r
- }\r
- for (int index = 0; index < vFileName.size(); index++) {\r
- FilenameDocument.Filename filename = FilenameDocument.Filename.Factory.newInstance();\r
- if (!isEmpty(vFileName.elementAt(index).toString())) {\r
- filename.setStringValue(vFileName.elementAt(index).toString());\r
- }\r
- if (!isEmpty(vGuid.elementAt(index).toString())) {\r
- filename.setGuid(vGuid.elementAt(index).toString());\r
- }\r
- if (!isEmpty(vPath.elementAt(index).toString())) {\r
- filename.setPath(vPath.elementAt(index).toString());\r
- }\r
- if (!isEmpty(vFileType.elementAt(index).toString())) {\r
- filename.setFileType(vFileType.elementAt(index).toString());\r
- }\r
- if (!vToolChain.elementAt(index).toString().equals(DataType.EMPTY_SELECT_ITEM)) {\r
- filename.setToolChain(ToolChains.Enum.forString(vToolChain.elementAt(index).toString()));\r
- }\r
- if (!isEmpty(vOverrideID.elementAt(index).toString())) {\r
- filename.setOverrideID(Integer.parseInt(vOverrideID.elementAt(index).toString()));\r
- }\r
- sourceFiles.addNewFilename();\r
- sourceFiles.setFilenameArray(sourceFiles.getFilenameList().size() - 1, filename);\r
- }\r
- }\r
- //\r
- //Save as Arch\r
- //\r
- if (this.jCheckBoxArch.isSelected()) {\r
- SourceFilesDocument.SourceFiles.Arch arch = SourceFilesDocument.SourceFiles.Arch.Factory.newInstance();\r
- if (this.operation == 2) {\r
- //\r
- //First remove all existed filename\r
- //\r
- for (int index = sourceFiles.getArchArray(location).getFilenameList().size() - 1; index >= 0; index--) {\r
- sourceFiles.getArchArray(location).removeFilename(index);\r
- }\r
- }\r
- for (int index = 0; index < vFileName.size(); index++) {\r
- FilenameDocument.Filename filename = FilenameDocument.Filename.Factory.newInstance();\r
- if (!isEmpty(vFileName.elementAt(index).toString())) {\r
- filename.setStringValue(vFileName.elementAt(index).toString());\r
- }\r
- if (!isEmpty(vGuid.elementAt(index).toString())) {\r
- filename.setGuid(vGuid.elementAt(index).toString());\r
- }\r
- if (!isEmpty(vPath.elementAt(index).toString())) {\r
- filename.setPath(vPath.elementAt(index).toString());\r
- }\r
- if (!isEmpty(vFileType.elementAt(index).toString())) {\r
- filename.setFileType(vFileType.elementAt(index).toString());\r
- }\r
- if (!vToolChain.elementAt(index).toString().equals(DataType.EMPTY_SELECT_ITEM)) {\r
- filename.setToolChain(ToolChains.Enum.forString(vToolChain.elementAt(index).toString()));\r
- }\r
- if (!isEmpty(vOverrideID.elementAt(index).toString())) {\r
- filename.setOverrideID(Integer.parseInt(vOverrideID.elementAt(index).toString()));\r
- }\r
- arch.addNewFilename();\r
- arch.setFilenameArray(arch.getFilenameList().size() - 1, filename);\r
- }\r
- arch\r
- .setArchType(SupportedArchitectures.Enum.forString(this.jComboBoxArch.getSelectedItem().toString()));\r
- if (location > -1) {\r
- sourceFiles.setArchArray(location, arch);\r
- } else {\r
- sourceFiles.addNewArch();\r
- sourceFiles.setArchArray(sourceFiles.getArchList().size() - 1, arch);\r
- }\r
- }\r
- } catch (Exception e) {\r
- Log.err("Update Source Files", e.getMessage());\r
- }\r
- }\r
-\r
- /**\r
- Display a file open browser to let user select file\r
- \r
- **/\r
- private void selectFile() {\r
- JFileChooser fc = new JFileChooser(ws.getCurrentWorkspace());\r
-\r
- int result = fc.showOpenDialog(new JPanel());\r
- if (result == JFileChooser.APPROVE_OPTION) {\r
- this.jTextFieldFileName.setText(fc.getSelectedFile().getName());\r
- }\r
- }\r
- \r
- /**\r
- Update file list pane via the elements of Vector\r
- \r
- **/\r
- private void reloadFileListArea() {\r
- String strFileList = "";\r
- for (int index = 0; index < vFileName.size(); index++) {\r
- strFileList = strFileList + vFileName.elementAt(index).toString() + DataType.UNXI_LINE_SEPARATOR;\r
- }\r
- this.jTextAreaFileList.setText(strFileList);\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
-\r
- The file is used to create, update SystemTable of MSA/MBD file\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-package org.tianocore.packaging.module.ui;\r
-\r
-import java.awt.event.ActionEvent;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JLabel;\r
-import javax.swing.JPanel;\r
-import javax.swing.JTextField;\r
-\r
-import org.tianocore.SystemTableUsage;\r
-import org.tianocore.SystemTablesDocument;\r
-import org.tianocore.common.DataValidation;\r
-import org.tianocore.common.Log;\r
-import org.tianocore.packaging.common.ui.IInternalFrame;\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-\r
-/**\r
- The class is used to create, update SystemTable of MSA/MBD file\r
- It extends IInternalFrame\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class ModuleSystemTables extends IInternalFrame {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = 7488769180379442276L;\r
-\r
- //\r
- //Define class members\r
- //\r
- private SystemTablesDocument.SystemTables systemTables = null;\r
-\r
- private int location = -1;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JLabel jLabelEntry = null;\r
-\r
- private JTextField jTextFieldEntry = null;\r
-\r
- private JLabel jLabelUsage = null;\r
-\r
- private JComboBox jComboBoxUsage = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JLabel jLabelOverrideID = null;\r
-\r
- private JTextField jTextFieldOverrideID = null;\r
-\r
- private StarLabel jStarLabel1 = null;\r
-\r
- /**\r
- This method initializes jTextFieldEntry \r
- \r
- @return javax.swing.JTextField jTextFieldEntry\r
- \r
- **/\r
- private JTextField getJTextFieldEntry() {\r
- if (jTextFieldEntry == null) {\r
- jTextFieldEntry = new JTextField();\r
- jTextFieldEntry.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
- }\r
- return jTextFieldEntry;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxUsage \r
- \r
- @return javax.swing.JComboBox jComboBoxUsage\r
- \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
- }\r
- return jComboBoxUsage;\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton jButtonOk\r
- \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("OK");\r
- jButtonOk.setBounds(new java.awt.Rectangle(280, 90, 90, 20));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton jButtonCancel\r
- \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 90, 90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldOverrideID \r
- \r
- @return javax.swing.JTextField jTextFieldOverrideID\r
- \r
- **/\r
- private JTextField getJTextFieldOverrideID() {\r
- if (jTextFieldOverrideID == null) {\r
- jTextFieldOverrideID = new JTextField();\r
- jTextFieldOverrideID.setBounds(new java.awt.Rectangle(160, 60, 50, 20));\r
- }\r
- return jTextFieldOverrideID;\r
- }\r
-\r
- public static void main(String[] args) {\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public ModuleSystemTables() {\r
- super();\r
- init();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inSystemTables The input data of SystemTablesDocument.SystemTables\r
- \r
- **/\r
- public ModuleSystemTables(SystemTablesDocument.SystemTables inSystemTables) {\r
- super();\r
- init(inSystemTables);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inSystemTables The input data of SystemTablesDocument.SystemTables\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- public ModuleSystemTables(SystemTablesDocument.SystemTables inSystemTables, int type, int index) {\r
- super();\r
- init(inSystemTables, type, index);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @param inSystemTables The input data of SystemTablesDocument.SystemTables\r
- \r
- **/\r
- private void init(SystemTablesDocument.SystemTables inSystemTables) {\r
- init();\r
- this.setSystemTables(inSystemTables);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- Fill values to all fields if these values are not empty\r
- \r
- @param inSystemTables The input data of SystemTablesDocument.SystemTables\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- private void init(SystemTablesDocument.SystemTables inSystemTables, int type, int index) {\r
- init(inSystemTables);\r
- this.location = index;\r
- if (this.systemTables.getSystemTableList().size() > 0) {\r
- if (this.systemTables.getSystemTableArray(index).getEntryList() != null) {\r
- this.jTextFieldEntry.setText(this.systemTables.getSystemTableArray(index).getEntryList().get(0));\r
- }\r
- if (this.systemTables.getSystemTableArray(index).getUsage() != null) {\r
- this.jComboBoxUsage.setSelectedItem(this.systemTables.getSystemTableArray(index).getUsage().toString());\r
- }\r
- this.jTextFieldOverrideID.setText(String.valueOf(this.systemTables.getSystemTableArray(index)\r
- .getOverrideID()));\r
- }\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @return void\r
- **/\r
- private void init() {\r
- this.setSize(500, 515);\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("System Tables");\r
- initFrame();\r
- this.setViewMode(false);\r
- }\r
-\r
- /**\r
- Disable all components when the mode is view\r
- \r
- @param isView true - The view mode; false - The non-view mode\r
- \r
- **/\r
- public void setViewMode(boolean isView) {\r
- this.jButtonOk.setVisible(false);\r
- this.jButtonCancel.setVisible(false);\r
- if (isView) {\r
- this.jTextFieldEntry.setEnabled(!isView);\r
- this.jComboBoxUsage.setEnabled(!isView);\r
- this.jTextFieldOverrideID.setEnabled(!isView);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel jContentPane\r
- \r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabelOverrideID = new JLabel();\r
- jLabelOverrideID.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
- jLabelOverrideID.setText("Override ID");\r
- jLabelUsage = new JLabel();\r
- jLabelUsage.setText("Usage");\r
- jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
- jLabelEntry = new JLabel();\r
- jLabelEntry.setText("Entry");\r
- jLabelEntry.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(jLabelEntry, null);\r
- jContentPane.add(getJTextFieldEntry(), null);\r
- jContentPane.add(jLabelUsage, null);\r
- jContentPane.add(getJComboBoxUsage(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(jLabelOverrideID, null);\r
- jContentPane.add(getJTextFieldOverrideID(), null);\r
-\r
- jStarLabel1 = new StarLabel();\r
- jStarLabel1.setBounds(new java.awt.Rectangle(0, 10, 10, 20));\r
-\r
- jContentPane.add(jStarLabel1, null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes Usage type\r
- \r
- **/\r
- private void initFrame() {\r
- jComboBoxUsage.addItem("ALWAYS_CONSUMED");\r
- jComboBoxUsage.addItem("SOMETIMES_CONSUMED");\r
- jComboBoxUsage.addItem("ALWAYS_PRODUCED");\r
- jComboBoxUsage.addItem("SOMETIMES_PRODUCED");\r
- jComboBoxUsage.addItem("PRIVATE");\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- *\r
- * Override actionPerformed to listen all actions\r
- * \r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.setEdited(true);\r
- this.save();\r
- this.dispose();\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- }\r
- }\r
-\r
- /**\r
- Get SystemTablesDocument.SystemTables\r
- \r
- @return SystemTablesDocument.SystemTables\r
- \r
- **/\r
- public SystemTablesDocument.SystemTables getSystemTables() {\r
- return systemTables;\r
- }\r
-\r
- /**\r
- Set SystemTablesDocument.SystemTables\r
- \r
- @param systemTables The input data of SystemTablesDocument.SystemTables\r
- \r
- **/\r
- public void setSystemTables(SystemTablesDocument.SystemTables systemTables) {\r
- this.systemTables = systemTables;\r
- }\r
-\r
- /**\r
- Data validation for all fields\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean check() {\r
- //\r
- // Check if all required fields are not empty\r
- //\r
- if (isEmpty(this.jTextFieldEntry.getText())) {\r
- Log.err("Entry couldn't be empty");\r
- return false;\r
- }\r
-\r
- //\r
- // Check if all fields have correct data types \r
- //\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())\r
- && !DataValidation.isOverrideID(this.jTextFieldOverrideID.getText())) {\r
- Log.err("Incorrect data type for Override ID");\r
- return false;\r
- }\r
-\r
- return true;\r
- }\r
-\r
- /**\r
- Save all components of SystemTables\r
- if exists systemTables, set the value directly\r
- if not exists systemTables, new an instance first\r
- \r
- **/\r
- public void save() {\r
- try {\r
- if (this.systemTables == null) {\r
- systemTables = SystemTablesDocument.SystemTables.Factory.newInstance();\r
- }\r
- SystemTablesDocument.SystemTables.SystemTable systemTable = SystemTablesDocument.SystemTables.SystemTable.Factory\r
- .newInstance();\r
- //systemTable.setEntry(this.jTextFieldEntry.getText());\r
-\r
- systemTable.setUsage(SystemTableUsage.Enum.forString(jComboBoxUsage.getSelectedItem().toString()));\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())) {\r
- systemTable.setOverrideID(Integer.parseInt(this.jTextFieldOverrideID.getText()));\r
- }\r
- if (location > -1) {\r
- systemTables.setSystemTableArray(location, systemTable);\r
- } else {\r
- systemTables.addNewSystemTable();\r
- systemTables.setSystemTableArray(systemTables.getSystemTableList().size() - 1, systemTable);\r
- }\r
- } catch (Exception e) {\r
- Log.err("Update System Tables", e.getMessage());\r
- }\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to create, update Variable of MSA/MBD file\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-\r
-package org.tianocore.packaging.module.ui;\r
-\r
-import java.awt.event.ActionEvent;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JLabel;\r
-import javax.swing.JPanel;\r
-import javax.swing.JTextField;\r
-\r
-import org.tianocore.GuidDocument;\r
-import org.tianocore.VariableUsage;\r
-import org.tianocore.VariablesDocument;\r
-import org.tianocore.common.DataValidation;\r
-import org.tianocore.common.Log;\r
-import org.tianocore.common.Tools;\r
-import org.tianocore.packaging.common.ui.IInternalFrame;\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-\r
-/**\r
- The class is used to create, update Variable of MSA/MBD file\r
- It extends IInternalFrame\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class ModuleVariables extends IInternalFrame {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -6998982978030439446L;\r
-\r
- //\r
- //Define class members\r
- //\r
- private VariablesDocument.Variables variables = null;\r
-\r
- private int location = -1;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JLabel jLabelGuid = null;\r
-\r
- private JTextField jTextFieldGuid = null;\r
-\r
- private JLabel jLabelString = null;\r
-\r
- private JTextField jTextFieldString = null;\r
-\r
- private JLabel jLabelBitOffset = null;\r
-\r
- private JTextField jTextFieldBitOffset = null;\r
-\r
- private JLabel jLabelByteOffset = null;\r
-\r
- private JTextField jTextFieldByteOffset = null;\r
-\r
- private JLabel jLabelOffsetBitSize = null;\r
-\r
- private JTextField jTextFieldOffsetBitSize = null;\r
-\r
- private JLabel jLabelUsage = null;\r
-\r
- private JComboBox jComboBoxUsage = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JButton jButtonGenerateGuid = null;\r
-\r
- private JLabel jLabelOverrideID = null;\r
-\r
- private JTextField jTextFieldOverrideID = null;\r
-\r
- private StarLabel jStarLabel1 = null;\r
-\r
- private StarLabel jStarLabel2 = null;\r
-\r
- private JLabel jLabelByteOffsetHint = null;\r
-\r
- private JLabel jLabelBitOffsetHint = null;\r
-\r
- private JLabel jLabelOffsetBitSizeHint = null;\r
-\r
- /**\r
- This method initializes jTextFieldGuid \r
- \r
- @return javax.swing.JTextField jTextFieldGuid\r
- \r
- **/\r
- private JTextField getJTextFieldGuid() {\r
- if (jTextFieldGuid == null) {\r
- jTextFieldGuid = new JTextField();\r
- jTextFieldGuid.setSize(new java.awt.Dimension(250, 20));\r
- jTextFieldGuid.setLocation(new java.awt.Point(160, 35));\r
- }\r
- return jTextFieldGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldString \r
- \r
- @return javax.swing.JTextField jTextFieldString\r
- \r
- **/\r
- private JTextField getJTextFieldString() {\r
- if (jTextFieldString == null) {\r
- jTextFieldString = new JTextField();\r
- jTextFieldString.setSize(new java.awt.Dimension(320, 20));\r
- jTextFieldString.setLocation(new java.awt.Point(160, 10));\r
- }\r
- return jTextFieldString;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldBitOffset \r
- \r
- @return javax.swing.JTextField jTextFieldBitOffset\r
- \r
- **/\r
- private JTextField getJTextFieldBitOffset() {\r
- if (jTextFieldBitOffset == null) {\r
- jTextFieldBitOffset = new JTextField();\r
- jTextFieldBitOffset.setSize(new java.awt.Dimension(80, 20));\r
- jTextFieldBitOffset.setLocation(new java.awt.Point(160, 85));\r
- }\r
- return jTextFieldBitOffset;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldByteOffset \r
- \r
- @return javax.swing.JTextField jTextFieldByteOffset\r
- \r
- **/\r
- private JTextField getJTextFieldByteOffset() {\r
- if (jTextFieldByteOffset == null) {\r
- jTextFieldByteOffset = new JTextField();\r
- jTextFieldByteOffset.setLocation(new java.awt.Point(160, 60));\r
- jTextFieldByteOffset.setSize(new java.awt.Dimension(80, 20));\r
- }\r
- return jTextFieldByteOffset;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldBitSize \r
- \r
- @return javax.swing.JTextField jTextFieldOffsetBitSize\r
- \r
- **/\r
- private JTextField getJTextFieldOffsetBitSize() {\r
- if (jTextFieldOffsetBitSize == null) {\r
- jTextFieldOffsetBitSize = new JTextField();\r
- jTextFieldOffsetBitSize.setSize(new java.awt.Dimension(80, 20));\r
- jTextFieldOffsetBitSize.setLocation(new java.awt.Point(160, 110));\r
- }\r
- return jTextFieldOffsetBitSize;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxUsage \r
- \r
- @return javax.swing.JComboBox jComboBoxUsage\r
- \r
- **/\r
- private JComboBox getJComboBoxUsage() {\r
- if (jComboBoxUsage == null) {\r
- jComboBoxUsage = new JComboBox();\r
- jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 135, 320, 20));\r
- }\r
- return jComboBoxUsage;\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton jButtonOk\r
- \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("Ok");\r
- jButtonOk.setBounds(new java.awt.Rectangle(290, 190, 90, 20));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton jButtonCancel\r
- \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 190, 90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jButtonGenerateGuid \r
- \r
- @return javax.swing.JButton jButtonGenerateGuid\r
- \r
- **/\r
- private JButton getJButtonGenerateGuid() {\r
- if (jButtonGenerateGuid == null) {\r
- jButtonGenerateGuid = new JButton();\r
- jButtonGenerateGuid.setText("GEN");\r
- jButtonGenerateGuid.addActionListener(this);\r
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 35, 65, 20));\r
- }\r
- return jButtonGenerateGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldOverrideID \r
- \r
- @return javax.swing.JTextField jTextFieldOverrideID\r
- \r
- **/\r
- private JTextField getJTextFieldOverrideID() {\r
- if (jTextFieldOverrideID == null) {\r
- jTextFieldOverrideID = new JTextField();\r
- jTextFieldOverrideID.setBounds(new java.awt.Rectangle(160, 160, 50, 20));\r
- }\r
- return jTextFieldOverrideID;\r
- }\r
-\r
- public static void main(String[] args) {\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public ModuleVariables() {\r
- super();\r
- init();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inVariables The input data of VariablesDocument.Variables\r
- \r
- **/\r
- public ModuleVariables(VariablesDocument.Variables inVariables) {\r
- super();\r
- init(inVariables);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inVariables The input data of VariablesDocument.Variables\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- public ModuleVariables(VariablesDocument.Variables inVariables, int type, int index) {\r
- super();\r
- init(inVariables, type, index);\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @param inVariables The input data of VariablesDocument.Variables\r
- \r
- **/\r
- private void init(VariablesDocument.Variables inVariables) {\r
- init();\r
- this.setVariables(inVariables);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- Fill values to all fields if these values are not empty\r
- \r
- @param inVariables The input data of VariablesDocument.Variables\r
- @param type The input data of node type\r
- @param index The input data of node index\r
- \r
- **/\r
- private void init(VariablesDocument.Variables inVariables, int type, int index) {\r
- init(inVariables);\r
- this.location = index;\r
- if (this.variables.getVariableList().size() > 0) {\r
- if (this.variables.getVariableArray(index).getString() != null) {\r
- this.jTextFieldString.setText(this.variables.getVariableArray(index).getString());\r
- }\r
- if (this.variables.getVariableArray(index).getGuid() != null) {\r
- this.jTextFieldGuid.setText(this.variables.getVariableArray(index).getGuid().getStringValue());\r
- }\r
- if (this.variables.getVariableArray(index).getByteOffset() != null) {\r
- this.jTextFieldByteOffset\r
- .setText(String\r
- .valueOf(this.variables.getVariableArray(index).getByteOffset()));\r
- }\r
- if (String.valueOf(this.variables.getVariableArray(index).getBitOffset()) != null) {\r
- this.jTextFieldBitOffset.setText(String.valueOf(this.variables.getVariableArray(index).getBitOffset()));\r
- }\r
- if (String.valueOf(this.variables.getVariableArray(index).getOffsetBitSize()) != null) {\r
- this.jTextFieldOffsetBitSize.setText(String.valueOf(this.variables.getVariableArray(index)\r
- .getOffsetBitSize()));\r
- }\r
- if (this.variables.getVariableArray(index).getUsage() != null) {\r
- this.jComboBoxUsage.setSelectedItem(this.variables.getVariableArray(index).getUsage().toString());\r
- }\r
- this.jTextFieldOverrideID.setText(String.valueOf(this.variables.getVariableArray(index).getOverrideID()));\r
- }\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @return void\r
- **/\r
- private void init() {\r
- this.setSize(500, 515);\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Add Variables");\r
- this.setViewMode(false);\r
- }\r
-\r
- /**\r
- Disable all components when the mode is view\r
- \r
- @param isView true - The view mode; false - The non-view mode\r
- \r
- **/\r
- public void setViewMode(boolean isView) {\r
- this.jButtonOk.setVisible(false);\r
- this.jButtonCancel.setVisible(false);\r
- if (isView) {\r
- this.jTextFieldString.setEnabled(!isView);\r
- this.jTextFieldGuid.setEnabled(!isView);\r
- this.jTextFieldByteOffset.setEnabled(!isView);\r
- this.jTextFieldBitOffset.setEnabled(!isView);\r
- this.jTextFieldOffsetBitSize.setEnabled(!isView);\r
- this.jComboBoxUsage.setEnabled(!isView);\r
- this.jButtonGenerateGuid.setEnabled(!isView);\r
- this.jTextFieldOverrideID.setEnabled(!isView);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel jContentPane\r
- \r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabelByteOffsetHint = new JLabel();\r
- jLabelByteOffsetHint.setBounds(new java.awt.Rectangle(245,60,235,20));\r
- jLabelByteOffsetHint.setText("0x00");\r
- jLabelOffsetBitSizeHint = new JLabel();\r
- jLabelOffsetBitSizeHint.setBounds(new java.awt.Rectangle(245,110,235,20));\r
- jLabelOffsetBitSizeHint.setText("1~7");\r
- jLabelBitOffsetHint = new JLabel();\r
- jLabelBitOffsetHint.setBounds(new java.awt.Rectangle(245,85,235,20));\r
- jLabelBitOffsetHint.setText("0~7");\r
- jLabelOverrideID = new JLabel();\r
- jLabelOverrideID.setText("Override ID");\r
- jLabelOverrideID.setBounds(new java.awt.Rectangle(15, 160, 140, 20));\r
- jLabelUsage = new JLabel();\r
- jLabelUsage.setText("Usage");\r
- jLabelUsage.setBounds(new java.awt.Rectangle(15, 135, 140, 20));\r
- jLabelOffsetBitSize = new JLabel();\r
- jLabelOffsetBitSize.setText("Offset Bit Size");\r
- jLabelOffsetBitSize.setLocation(new java.awt.Point(15, 110));\r
- jLabelOffsetBitSize.setSize(new java.awt.Dimension(140, 20));\r
- jLabelByteOffset = new JLabel();\r
- jLabelByteOffset.setText("Byte Offset");\r
- jLabelByteOffset.setLocation(new java.awt.Point(15, 60));\r
- jLabelByteOffset.setSize(new java.awt.Dimension(140, 20));\r
- jLabelBitOffset = new JLabel();\r
- jLabelBitOffset.setText("Bit Offset");\r
- jLabelBitOffset.setLocation(new java.awt.Point(15, 85));\r
- jLabelBitOffset.setSize(new java.awt.Dimension(140, 20));\r
- jLabelString = new JLabel();\r
- jLabelString.setText("String");\r
- jLabelString.setLocation(new java.awt.Point(15, 10));\r
- jLabelString.setSize(new java.awt.Dimension(140, 20));\r
- jLabelGuid = new JLabel();\r
- jLabelGuid.setText("Guid");\r
- jLabelGuid.setLocation(new java.awt.Point(15, 35));\r
- jLabelGuid.setSize(new java.awt.Dimension(140, 20));\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(getJButtonGenerateGuid(), null);\r
- jContentPane.add(jLabelString, null);\r
- jContentPane.add(getJTextFieldString(), null);\r
- jContentPane.add(jLabelGuid, null);\r
- jContentPane.add(getJTextFieldGuid(), null);\r
- jContentPane.add(jLabelByteOffset, null);\r
- jContentPane.add(getJTextFieldByteOffset(), null);\r
- jContentPane.add(jLabelBitOffset, null);\r
- jContentPane.add(getJTextFieldBitOffset(), null);\r
- jContentPane.add(jLabelOffsetBitSize, null);\r
- jContentPane.add(getJTextFieldOffsetBitSize(), null);\r
- jContentPane.add(jLabelUsage, null);\r
- jContentPane.add(getJComboBoxUsage(), null);\r
- jContentPane.add(jLabelOverrideID, null);\r
- jContentPane.add(getJTextFieldOverrideID(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
-\r
- jStarLabel1 = new StarLabel();\r
- jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
- jStarLabel2 = new StarLabel();\r
- jStarLabel2.setLocation(new java.awt.Point(0, 35));\r
-\r
- jContentPane.add(jStarLabel1, null);\r
- jContentPane.add(jStarLabel2, null);\r
-\r
- jContentPane.add(jLabelByteOffsetHint, null);\r
- jContentPane.add(jLabelBitOffsetHint, null);\r
- jContentPane.add(jLabelOffsetBitSizeHint, null);\r
- initFrame();\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- *\r
- * Override actionPerformed to listen all actions\r
- * \r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.setEdited(true);\r
- this.save();\r
- this.dispose();\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- }\r
-\r
- if (arg0.getSource() == jButtonGenerateGuid) {\r
- jTextFieldGuid.setText(Tools.generateUuidString());\r
- }\r
- }\r
-\r
- /**\r
- This method initializes Usage type\r
- \r
- **/\r
- private void initFrame() {\r
- jComboBoxUsage.addItem("ALWAYS_CONSUMED");\r
- jComboBoxUsage.addItem("SOMETIMES_CONSUMED");\r
- jComboBoxUsage.addItem("ALWAYS_PRODUCED");\r
- jComboBoxUsage.addItem("SOMETIMES_PRODUCED");\r
- jComboBoxUsage.addItem("PRIVATE");\r
- }\r
-\r
- /**\r
- Get VariablesDocument.Variables\r
- \r
- @return VariablesDocument.Variables\r
- \r
- **/\r
- public VariablesDocument.Variables getVariables() {\r
- return variables;\r
- }\r
-\r
- /**\r
- Set VariablesDocument.Variables\r
- \r
- @param variables The input data of VariablesDocument.Variables\r
- \r
- **/\r
- public void setVariables(VariablesDocument.Variables variables) {\r
- this.variables = variables;\r
- }\r
-\r
- /**\r
- Data validation for all fields\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean check() {\r
- //\r
- // Check if all required fields are not empty\r
- //\r
- if (isEmpty(this.jTextFieldString.getText())) {\r
- Log.err("String couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextFieldGuid.getText())) {\r
- Log.err("Guid couldn't be empty");\r
- return false;\r
- }\r
-\r
- //\r
- // Check if all fields have correct data types \r
- //\r
- if (!isEmpty(this.jTextFieldGuid.getText()) && !DataValidation.isGuid(this.jTextFieldGuid.getText())) {\r
- Log.err("Incorrect data type for Guid");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldByteOffset.getText())\r
- && !DataValidation.isByteOffset(this.jTextFieldByteOffset.getText())) {\r
- Log.err("Incorrect data type for Byte Offset");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldBitOffset.getText())\r
- && !DataValidation.isBitOffset(this.jTextFieldBitOffset.getText())) {\r
- Log.err("Incorrect data type for Bit Offset");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldOffsetBitSize.getText())\r
- && !DataValidation.isOffsetBitSize(this.jTextFieldOffsetBitSize.getText())) {\r
- Log.err("Incorrect data type for Bit Offset");\r
- return false;\r
- }\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())\r
- && !DataValidation.isOverrideID(this.jTextFieldOverrideID.getText())) {\r
- Log.err("Incorrect data type for Override ID");\r
- return false;\r
- }\r
-\r
- return true;\r
- }\r
-\r
- /**\r
- Save all components of Variables\r
- if exists variables, set the value directly\r
- if not exists variables, new an instance first\r
- \r
- **/\r
- public void save() {\r
- try {\r
- if (this.variables == null) {\r
- variables = VariablesDocument.Variables.Factory.newInstance();\r
- }\r
- VariablesDocument.Variables.Variable variable = VariablesDocument.Variables.Variable.Factory.newInstance();\r
- if (!isEmpty(this.jTextFieldString.getText())) {\r
- variable.setString(this.jTextFieldString.getText());\r
- }\r
- if (!isEmpty(this.jTextFieldGuid.getText())) {\r
- GuidDocument.Guid guid = GuidDocument.Guid.Factory.newInstance();\r
- guid.setStringValue(this.jTextFieldGuid.getText());\r
- variable.setGuid(guid);\r
- }\r
- if (!isEmpty(this.jTextFieldByteOffset.getText())) {\r
- variable.setByteOffset(this.jTextFieldByteOffset.getText());\r
- }\r
- if (!isEmpty(this.jTextFieldBitOffset.getText())) {\r
- variable.setBitOffset(Integer.parseInt(this.jTextFieldBitOffset.getText()));\r
- }\r
- if (!isEmpty(this.jTextFieldBitOffset.getText())) {\r
- variable.setOffsetBitSize(Integer.parseInt(this.jTextFieldBitOffset.getText()));\r
- }\r
- variable.setUsage(VariableUsage.Enum.forString(jComboBoxUsage.getSelectedItem().toString()));\r
- if (!isEmpty(this.jTextFieldOverrideID.getText())) {\r
- variable.setOverrideID(Integer.parseInt(this.jTextFieldOverrideID.getText()));\r
- }\r
- if (location > -1) {\r
- variables.setVariableArray(location, variable);\r
- } else {\r
- variables.addNewVariable();\r
- variables.setVariableArray(variables.getVariableList().size() - 1, variable);\r
- }\r
- } catch (Exception e) {\r
- Log.err("Update Variables", e.getMessage());\r
- }\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to create, update MsaHeader of MSA file\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-\r
-package org.tianocore.packaging.module.ui;\r
-\r
-import java.awt.event.ActionEvent;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JLabel;\r
-import javax.swing.JPanel;\r
-import javax.swing.JScrollPane;\r
-import javax.swing.JTextArea;\r
-import javax.swing.JTextField;\r
-\r
-import org.tianocore.AbstractDocument;\r
-import org.tianocore.BaseNameDocument;\r
-import org.tianocore.FrameworkComponentTypes;\r
-import org.tianocore.GuidDocument;\r
-import org.tianocore.LicenseDocument;\r
-import org.tianocore.ModuleTypeDef;\r
-import org.tianocore.MsaHeaderDocument;\r
-import org.tianocore.SpecificationDocument;\r
-import org.tianocore.common.DataValidation;\r
-import org.tianocore.common.Log;\r
-import org.tianocore.common.Tools;\r
-import org.tianocore.packaging.common.ui.IInternalFrame;\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-\r
-/**\r
- The class is used to create, update MsaHeader of MSA file\r
- It extends IInternalFrame\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class MsaHeader extends IInternalFrame {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = -8152099582923006900L;\r
-\r
- //\r
- //Define class members\r
- //\r
- private JPanel jContentPane = null;\r
-\r
- private JLabel jLabelBaseName = null;\r
-\r
- private JTextField jTextFieldBaseName = null;\r
-\r
- private JLabel jLabelGuid = null;\r
-\r
- private JTextField jTextFieldGuid = null;\r
-\r
- private JLabel jLabelVersion = null;\r
-\r
- private JTextField jTextFieldVersion = null;\r
-\r
- private JButton jButtonGenerateGuid = null;\r
-\r
- private JLabel jLabelLicense = null;\r
-\r
- private JTextArea jTextAreaLicense = null;\r
-\r
- private JLabel jLabelCopyright = null;\r
-\r
- private JLabel jLabelDescription = null;\r
-\r
- private JTextArea jTextAreaDescription = null;\r
-\r
- private JLabel jLabelSpecification = null;\r
-\r
- private JTextField jTextFieldSpecification = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JScrollPane jScrollPaneLicense = null;\r
-\r
- private JScrollPane jScrollPaneDescription = null;\r
-\r
- private JLabel jLabelAbstract = null;\r
-\r
- private JTextField jTextFieldAbstract = null;\r
-\r
- private JLabel jLabelModuleType = null;\r
-\r
- private JLabel jLabelCompontentType = null;\r
-\r
- private JComboBox jComboBoxCompontentType = null;\r
-\r
- private JComboBox jComboBoxModuleType = null;\r
-\r
- private StarLabel jStarLabel1 = null;\r
-\r
- private StarLabel jStarLabel2 = null;\r
-\r
- private StarLabel jStarLabel3 = null;\r
-\r
- private StarLabel jStarLabel4 = null;\r
-\r
- private StarLabel jStarLabel5 = null;\r
-\r
- private StarLabel jStarLabel6 = null;\r
-\r
- private StarLabel jStarLabel7 = null;\r
-\r
- private StarLabel jStarLabel8 = null;\r
-\r
- private StarLabel jStarLabel9 = null;\r
-\r
- private MsaHeaderDocument.MsaHeader msaHeader = null;\r
-\r
- private JLabel jLabelURL = null;\r
-\r
- private JTextField jTextFieldAbstractURL = null;\r
-\r
- private JTextField jTextFieldCopyright = null;\r
-\r
- /**\r
- This method initializes jTextFieldBaseName \r
- \r
- @return javax.swing.JTextField jTextFieldBaseName\r
- \r
- **/\r
- private JTextField getJTextFieldBaseName() {\r
- if (jTextFieldBaseName == null) {\r
- jTextFieldBaseName = new JTextField();\r
- jTextFieldBaseName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
- }\r
- return jTextFieldBaseName;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldGuid \r
- \r
- @return javax.swing.JTextField jTextFieldGuid\r
- \r
- **/\r
- private JTextField getJTextFieldGuid() {\r
- if (jTextFieldGuid == null) {\r
- jTextFieldGuid = new JTextField();\r
- jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 35, 250, 20));\r
- }\r
- return jTextFieldGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldVersion \r
- \r
- @return javax.swing.JTextField jTextFieldVersion\r
- \r
- **/\r
- private JTextField getJTextFieldVersion() {\r
- if (jTextFieldVersion == null) {\r
- jTextFieldVersion = new JTextField();\r
- jTextFieldVersion.setBounds(new java.awt.Rectangle(160, 60, 320, 20));\r
- }\r
- return jTextFieldVersion;\r
- }\r
-\r
- /**\r
- This method initializes jButtonGenerateGuid \r
- \r
- @return javax.swing.JButton jButtonGenerateGuid\r
- \r
- **/\r
- private JButton getJButtonGenerateGuid() {\r
- if (jButtonGenerateGuid == null) {\r
- jButtonGenerateGuid = new JButton();\r
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 35, 65, 20));\r
- jButtonGenerateGuid.setText("GEN");\r
- jButtonGenerateGuid.addActionListener(this);\r
- }\r
- return jButtonGenerateGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextAreaLicense \r
- \r
- @return javax.swing.JTextArea jTextAreaLicense\r
- \r
- **/\r
- private JTextArea getJTextAreaLicense() {\r
- if (jTextAreaLicense == null) {\r
- jTextAreaLicense = new JTextArea();\r
- jTextAreaLicense.setText("");\r
- jTextAreaLicense.setLineWrap(true);\r
- }\r
- return jTextAreaLicense;\r
- }\r
-\r
- /**\r
- This method initializes jTextAreaDescription \r
- \r
- @return javax.swing.JTextArea jTextAreaDescription\r
- \r
- **/\r
- private JTextArea getJTextAreaDescription() {\r
- if (jTextAreaDescription == null) {\r
- jTextAreaDescription = new JTextArea();\r
- jTextAreaDescription.setLineWrap(true);\r
- }\r
- return jTextAreaDescription;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldSpecification \r
- \r
- @return javax.swing.JTextField jTextFieldSpecification\r
- \r
- **/\r
- private JTextField getJTextFieldSpecification() {\r
- if (jTextFieldSpecification == null) {\r
- jTextFieldSpecification = new JTextField();\r
- jTextFieldSpecification.setBounds(new java.awt.Rectangle(160, 280, 320, 20));\r
- }\r
- return jTextFieldSpecification;\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton jButtonOk\r
- \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("OK");\r
- jButtonOk.setBounds(new java.awt.Rectangle(290, 445, 90, 20));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton jButtonCancel\r
- \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 445, 90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPaneLicense \r
- \r
- @return javax.swing.JScrollPane jScrollPaneLicense\r
- \r
- **/\r
- private JScrollPane getJScrollPaneLicense() {\r
- if (jScrollPaneLicense == null) {\r
- jScrollPaneLicense = new JScrollPane();\r
- jScrollPaneLicense.setBounds(new java.awt.Rectangle(160, 85, 320, 80));\r
- jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r
- jScrollPaneLicense.setViewportView(getJTextAreaLicense());\r
- }\r
- return jScrollPaneLicense;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPaneDescription \r
- \r
- @return javax.swing.JScrollPane jScrollPaneDescription\r
- \r
- **/\r
- private JScrollPane getJScrollPaneDescription() {\r
- if (jScrollPaneDescription == null) {\r
- jScrollPaneDescription = new JScrollPane();\r
- jScrollPaneDescription.setBounds(new java.awt.Rectangle(160, 195, 320, 80));\r
- jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r
- jScrollPaneDescription.setViewportView(getJTextAreaDescription());\r
- }\r
- return jScrollPaneDescription;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldAbstract \r
- \r
- @return javax.swing.JTextField jTextFieldAbstract\r
- \r
- **/\r
- private JTextField getJTextFieldAbstract() {\r
- if (jTextFieldAbstract == null) {\r
- jTextFieldAbstract = new JTextField();\r
- jTextFieldAbstract.setBounds(new java.awt.Rectangle(160, 305, 320, 20));\r
- }\r
- return jTextFieldAbstract;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxCompontentType \r
- \r
- @return javax.swing.JComboBox jComboBoxCompontentType\r
- \r
- **/\r
- private JComboBox getJComboBoxCompontentType() {\r
- if (jComboBoxCompontentType == null) {\r
- jComboBoxCompontentType = new JComboBox();\r
- jComboBoxCompontentType.setBounds(new java.awt.Rectangle(160, 380, 320, 20));\r
- }\r
- return jComboBoxCompontentType;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxModuleType \r
- \r
- @return javax.swing.JComboBox jComboBoxModuleType\r
- \r
- **/\r
- private JComboBox getJComboBoxModuleType() {\r
- if (jComboBoxModuleType == null) {\r
- jComboBoxModuleType = new JComboBox();\r
- jComboBoxModuleType.setBounds(new java.awt.Rectangle(160, 355, 320, 20));\r
- }\r
- return jComboBoxModuleType;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldAbstractURL \r
- \r
- @return javax.swing.JTextField jTextFieldAbstractURL\r
- \r
- **/\r
- private JTextField getJTextFieldAbstractURL() {\r
- if (jTextFieldAbstractURL == null) {\r
- jTextFieldAbstractURL = new JTextField();\r
- jTextFieldAbstractURL.setBounds(new java.awt.Rectangle(160, 330, 320, 20));\r
- }\r
- return jTextFieldAbstractURL;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldCopyright \r
- \r
- @return javax.swing.JTextField jTextFieldCopyright\r
- \r
- **/\r
- private JTextField getJTextFieldCopyright() {\r
- if (jTextFieldCopyright == null) {\r
- jTextFieldCopyright = new JTextField();\r
- jTextFieldCopyright.setBounds(new java.awt.Rectangle(160,170,320, 20));\r
- }\r
- return jTextFieldCopyright;\r
- }\r
-\r
- public static void main(String[] args) {\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public MsaHeader() {\r
- super();\r
- init();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inMsaHeader The input data of MsaHeaderDocument.MsaHeader\r
- \r
- **/\r
- public MsaHeader(MsaHeaderDocument.MsaHeader inMsaHeader) {\r
- super();\r
- init(inMsaHeader);\r
- this.setVisible(true);\r
- this.setViewMode(false);\r
- }\r
-\r
- /**\r
- Disable all components when the mode is view\r
- \r
- @param isView true - The view mode; false - The non-view mode\r
- \r
- **/\r
- public void setViewMode(boolean isView) {\r
- this.jButtonOk.setVisible(false);\r
- this.jButtonCancel.setVisible(false);\r
- if (isView) {\r
- this.jTextFieldBaseName.setEnabled(!isView);\r
- this.jTextFieldGuid.setEnabled(!isView);\r
- this.jTextFieldVersion.setEnabled(!isView);\r
- this.jTextAreaLicense.setEnabled(!isView);\r
- this.jTextFieldCopyright.setEnabled(!isView);\r
- this.jTextAreaDescription.setEnabled(!isView);\r
- this.jTextFieldSpecification.setEnabled(!isView); \r
- this.jTextFieldAbstract.setEnabled(!isView);\r
- this.jTextFieldAbstractURL.setEnabled(!isView);\r
- this.jComboBoxModuleType.setEnabled(!isView);\r
- this.jComboBoxCompontentType.setEnabled(!isView);\r
- this.jButtonCancel.setEnabled(!isView);\r
- this.jButtonGenerateGuid.setEnabled(!isView);\r
- this.jButtonOk.setEnabled(!isView);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void init() {\r
- this.setSize(500, 515);\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Module Surface Area Header");\r
- initFrame();\r
- }\r
-\r
- /**\r
- This method initializes this\r
- Fill values to all fields if these values are not empty\r
- \r
- @param inMsaHeader The input data of MsaHeaderDocument.MsaHeader\r
- \r
- **/\r
- private void init(MsaHeaderDocument.MsaHeader inMsaHeader) {\r
- init();\r
- if (inMsaHeader != null) {\r
- setMsaHeader(inMsaHeader);\r
- if (this.msaHeader.getBaseName() != null) {\r
- this.jTextFieldBaseName.setText(this.msaHeader.getBaseName().getStringValue());\r
- }\r
- if (this.msaHeader.getGuid() != null) {\r
- this.jTextFieldGuid.setText(this.msaHeader.getGuid().getStringValue());\r
- }\r
- if (this.msaHeader.getVersion() != null) {\r
- this.jTextFieldVersion.setText(this.msaHeader.getVersion());\r
- }\r
- if (this.msaHeader.getLicense() != null) {\r
- this.jTextAreaLicense.setText(this.msaHeader.getLicense().getStringValue());\r
- }\r
- if (this.msaHeader.getCopyright() != null) {\r
- this.jTextFieldCopyright.setText(this.msaHeader.getCopyright());\r
- }\r
- if (this.msaHeader.getDescription() != null) {\r
- this.jTextAreaDescription.setText(this.msaHeader.getDescription());\r
- }\r
- if (this.msaHeader.getSpecification() != null) {\r
- this.jTextFieldSpecification.setText(this.msaHeader.getSpecification());\r
- }\r
- if (this.msaHeader.getAbstract() != null) {\r
- this.jTextFieldAbstract.setText(this.msaHeader.getAbstract());\r
- }\r
- if (this.msaHeader.getModuleType() != null) {\r
- this.jComboBoxModuleType.setSelectedItem(this.msaHeader.getModuleType().toString());\r
- }\r
- if (this.msaHeader.getComponentType() != null) {\r
- this.jComboBoxCompontentType.setSelectedItem(this.msaHeader.getComponentType().toString());\r
- }\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel jContentPane\r
- \r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabelURL = new JLabel();\r
- jLabelURL.setBounds(new java.awt.Rectangle(15,330,140,20));\r
- jLabelURL.setText("URL");\r
- jLabelCompontentType = new JLabel();\r
- jLabelCompontentType.setBounds(new java.awt.Rectangle(15, 380, 140, 20));\r
- jLabelCompontentType.setText("Compontent Type");\r
- jLabelModuleType = new JLabel();\r
- jLabelModuleType.setBounds(new java.awt.Rectangle(15, 355, 140, 20));\r
- jLabelModuleType.setText("Module Type");\r
- jLabelAbstract = new JLabel();\r
- jLabelAbstract.setBounds(new java.awt.Rectangle(15, 305, 140, 20));\r
- jLabelAbstract.setText("Abstract");\r
- jLabelSpecification = new JLabel();\r
- jLabelSpecification.setText("Specification");\r
- jLabelSpecification.setBounds(new java.awt.Rectangle(15, 280, 140, 20));\r
- jLabelDescription = new JLabel();\r
- jLabelDescription.setText("Description");\r
- jLabelDescription.setBounds(new java.awt.Rectangle(15, 195, 140, 20));\r
- jLabelCopyright = new JLabel();\r
- jLabelCopyright.setText("Copyright");\r
- jLabelCopyright.setBounds(new java.awt.Rectangle(15, 170, 140, 20));\r
- jLabelLicense = new JLabel();\r
- jLabelLicense.setText("License");\r
- jLabelLicense.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
- jLabelVersion = new JLabel();\r
- jLabelVersion.setText("Version");\r
- jLabelVersion.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
- jLabelGuid = new JLabel();\r
- jLabelGuid.setPreferredSize(new java.awt.Dimension(25, 15));\r
- jLabelGuid.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
- jLabelGuid.setText("Guid");\r
- jLabelBaseName = new JLabel();\r
- jLabelBaseName.setText("Base Name");\r
- jLabelBaseName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.setLocation(new java.awt.Point(0, 0));\r
- jContentPane.setSize(new java.awt.Dimension(500, 524));\r
- jContentPane.add(jLabelBaseName, null);\r
- jContentPane.add(getJTextFieldBaseName(), null);\r
- jContentPane.add(jLabelGuid, null);\r
- jContentPane.add(getJTextFieldGuid(), null);\r
- jContentPane.add(jLabelVersion, null);\r
- jContentPane.add(getJTextFieldVersion(), null);\r
- jContentPane.add(getJButtonGenerateGuid(), null);\r
- jContentPane.add(jLabelLicense, null);\r
- jContentPane.add(jLabelCopyright, null);\r
- jContentPane.add(jLabelDescription, null);\r
- jContentPane.add(jLabelSpecification, null);\r
- jContentPane.add(getJTextFieldSpecification(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJScrollPaneLicense(), null);\r
- jContentPane.add(getJScrollPaneDescription(), null);\r
- jContentPane.add(jLabelAbstract, null);\r
- jContentPane.add(getJTextFieldAbstract(), null);\r
- jContentPane.add(jLabelModuleType, null);\r
- jContentPane.add(jLabelCompontentType, null);\r
- jContentPane.add(getJComboBoxCompontentType(), null);\r
- jContentPane.add(getJComboBoxModuleType(), null);\r
-\r
- jStarLabel1 = new StarLabel();\r
- jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
- jStarLabel2 = new StarLabel();\r
- jStarLabel2.setLocation(new java.awt.Point(0, 35));\r
- jStarLabel3 = new StarLabel();\r
- jStarLabel3.setLocation(new java.awt.Point(0, 60));\r
- jStarLabel4 = new StarLabel();\r
- jStarLabel4.setLocation(new java.awt.Point(0, 85));\r
- jStarLabel5 = new StarLabel();\r
- jStarLabel5.setLocation(new java.awt.Point(0, 170));\r
- jStarLabel6 = new StarLabel();\r
- jStarLabel6.setLocation(new java.awt.Point(0, 195));\r
- jStarLabel7 = new StarLabel();\r
- jStarLabel7.setLocation(new java.awt.Point(0, 305));\r
- jStarLabel8 = new StarLabel();\r
- jStarLabel8.setLocation(new java.awt.Point(0, 355));\r
- jStarLabel9 = new StarLabel();\r
- jStarLabel9.setLocation(new java.awt.Point(0, 380));\r
-\r
- jContentPane.add(jStarLabel1, null);\r
- jContentPane.add(jStarLabel2, null);\r
- jContentPane.add(jStarLabel3, null);\r
- jContentPane.add(jStarLabel4, null);\r
- jContentPane.add(jStarLabel5, null);\r
- jContentPane.add(jStarLabel6, null);\r
- jContentPane.add(jStarLabel7, null);\r
- jContentPane.add(jStarLabel8, null);\r
- jContentPane.add(jStarLabel9, null);\r
- jContentPane.add(jLabelURL, null);\r
- jContentPane.add(getJTextFieldAbstractURL(), null);\r
- jContentPane.add(getJTextFieldCopyright(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- *\r
- * Override actionPerformed to listen all actions\r
- *\r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.save();\r
- this.setEdited(true);\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.setEdited(false);\r
- }\r
- if (arg0.getSource() == jButtonGenerateGuid) {\r
- jTextFieldGuid.setText(Tools.generateUuidString());\r
- }\r
- }\r
-\r
- /**\r
- Data validation for all fields\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean check() {\r
- //\r
- // Check if all required fields are not empty\r
- //\r
- if (isEmpty(this.jTextFieldBaseName.getText())) {\r
- Log.err("Base Name couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextFieldGuid.getText())) {\r
- Log.err("Guid couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextFieldVersion.getText())) {\r
- Log.err("Version couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextAreaLicense.getText())) {\r
- Log.err("License couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextFieldCopyright.getText())) {\r
- Log.err("Copyright couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextAreaDescription.getText())) {\r
- Log.err("Description couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextFieldAbstract.getText())) {\r
- Log.err("Abstract couldn't be empty");\r
- return false;\r
- }\r
-\r
- //\r
- // Check if all fields have correct data types \r
- //\r
- if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {\r
- Log.err("Incorrect data type for Base Name");\r
- return false;\r
- }\r
- if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {\r
- Log.err("Incorrect data type for Guid");\r
- return false;\r
- }\r
- if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) {\r
- Log.err("Incorrect data type for Abstract");\r
- return false;\r
- }\r
- if (!DataValidation.isCopyright(this.jTextFieldCopyright.getText())) {\r
- Log.err("Incorrect data type for Copyright");\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- /**\r
- Save all components of Msa Header\r
- if exists msaHeader, set the value directly\r
- if not exists msaHeader, new an instance first\r
- \r
- **/\r
- public void save() {\r
- try {\r
- if (this.msaHeader == null) {\r
- msaHeader = MsaHeaderDocument.MsaHeader.Factory.newInstance();\r
- }\r
- if (this.msaHeader.getBaseName() != null) {\r
- this.msaHeader.getBaseName().setStringValue(this.jTextFieldBaseName.getText());\r
- } else {\r
- BaseNameDocument.BaseName mBaseName = BaseNameDocument.BaseName.Factory.newInstance();\r
- mBaseName.setStringValue(this.jTextFieldBaseName.getText());\r
- this.msaHeader.setBaseName(mBaseName);\r
- }\r
-\r
- if (this.msaHeader.getGuid() != null) {\r
- this.msaHeader.getGuid().setStringValue(this.jTextFieldGuid.getText());\r
- } else {\r
- GuidDocument.Guid mGuid = GuidDocument.Guid.Factory.newInstance();\r
- mGuid.setStringValue(this.jTextFieldGuid.getText());\r
- this.msaHeader.setGuid(mGuid);\r
- }\r
-\r
- this.msaHeader.setVersion(this.jTextFieldVersion.getText());\r
-\r
- if (this.msaHeader.getLicense() != null) {\r
- this.msaHeader.getLicense().setStringValue(this.jTextAreaLicense.getText());\r
- } else {\r
- LicenseDocument.License mLicense = LicenseDocument.License.Factory.newInstance();\r
- mLicense.setStringValue(this.jTextAreaLicense.getText());\r
- this.msaHeader.setLicense(mLicense);\r
- }\r
-\r
- this.msaHeader.setCopyright(this.jTextFieldCopyright.getText());\r
- this.msaHeader.setDescription(this.jTextAreaDescription.getText());\r
-\r
- if (this.msaHeader.getSpecification() != null) {\r
- this.msaHeader.setSpecification(this.jTextFieldSpecification.getText());\r
- } else {\r
- \r
- this.msaHeader.setSpecification(this.jTextFieldSpecification.getText());\r
- }\r
-\r
- if (this.msaHeader.getAbstract() != null) {\r
- this.msaHeader.setAbstract(this.jTextFieldAbstract.getText());\r
- } else {\r
- \r
- this.msaHeader.setAbstract(this.jTextFieldAbstract.getText());\r
- }\r
- this.msaHeader.setModuleType(ModuleTypeDef.Enum.forString(this.jComboBoxModuleType.getSelectedItem()\r
- .toString()));\r
- this.msaHeader\r
- .setComponentType(FrameworkComponentTypes.Enum\r
- .forString(this.jComboBoxCompontentType\r
- .getSelectedItem()\r
- .toString()));\r
- if (this.msaHeader.getCreated() == null) {\r
- this.msaHeader.setCreated(Tools.getCurrentDateTime());\r
- } else {\r
- this.msaHeader.setUpdated(Tools.getCurrentDateTime());\r
- }\r
-\r
- } catch (Exception e) {\r
- Log.err("Save Module", e.getMessage());\r
- }\r
- }\r
-\r
- /**\r
- This method initializes Module type and Compontent type\r
- \r
- **/\r
- private void initFrame() {\r
- jComboBoxModuleType.addItem("BASE");\r
- jComboBoxModuleType.addItem("SEC");\r
- jComboBoxModuleType.addItem("PEI_CORE");\r
- jComboBoxModuleType.addItem("PEIM");\r
- jComboBoxModuleType.addItem("DXE_CORE");\r
- jComboBoxModuleType.addItem("DXE_DRIVER");\r
- jComboBoxModuleType.addItem("DXE_RUNTIME_DRIVER");\r
- jComboBoxModuleType.addItem("DXE_SAL_DRIVER");\r
- jComboBoxModuleType.addItem("DXE_SMM_DRIVER");\r
- jComboBoxModuleType.addItem("TOOLS");\r
- jComboBoxModuleType.addItem("UEFI_DRIVER");\r
- jComboBoxModuleType.addItem("UEFI_APPLICATION");\r
- jComboBoxModuleType.addItem("USER_DEFINED");\r
-\r
- jComboBoxCompontentType.addItem("APRIORI");\r
- jComboBoxCompontentType.addItem("LIBRARY");\r
- jComboBoxCompontentType.addItem("FV_IMAGE_FILE");\r
- jComboBoxCompontentType.addItem("BS_DRIVER");\r
- jComboBoxCompontentType.addItem("RT_DRIVER");\r
- jComboBoxCompontentType.addItem("SAL_RT_DRIVER");\r
- jComboBoxCompontentType.addItem("PE32_PEIM");\r
- jComboBoxCompontentType.addItem("PIC_PEIM");\r
- jComboBoxCompontentType.addItem("COMBINED_PEIM_DRIVER");\r
- jComboBoxCompontentType.addItem("PEI_CORE");\r
- jComboBoxCompontentType.addItem("DXE_CORE");\r
- jComboBoxCompontentType.addItem("APPLICATION");\r
- jComboBoxCompontentType.addItem("BS_DRIVER_EFI");\r
- jComboBoxCompontentType.addItem("SHELLAPP");\r
- }\r
-\r
- /**\r
- Get MsaHeaderDocument.MsaHeader\r
- \r
- @return MsaHeaderDocument.MsaHeader\r
- \r
- **/\r
- public MsaHeaderDocument.MsaHeader getMsaHeader() {\r
- return msaHeader;\r
- }\r
-\r
- /**\r
- Set MsaHeaderDocument.MsaHeader\r
- \r
- @param msaHeader The input data of MsaHeaderDocument.MsaHeader\r
- \r
- **/\r
- public void setMsaHeader(MsaHeaderDocument.MsaHeader msaHeader) {\r
- this.msaHeader = msaHeader;\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to create, update MsaLibHeader of a MSA file\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-\r
-package org.tianocore.packaging.module.ui;\r
-\r
-import java.awt.event.ActionEvent;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JLabel;\r
-import javax.swing.JPanel;\r
-import javax.swing.JScrollPane;\r
-import javax.swing.JTextArea;\r
-import javax.swing.JTextField;\r
-\r
-import org.tianocore.AbstractDocument;\r
-import org.tianocore.BaseNameDocument;\r
-import org.tianocore.FrameworkComponentTypes;\r
-import org.tianocore.GuidDocument;\r
-import org.tianocore.LicenseDocument;\r
-import org.tianocore.ModuleTypeDef;\r
-import org.tianocore.MsaLibHeaderDocument;\r
-import org.tianocore.SpecificationDocument;\r
-import org.tianocore.common.DataValidation;\r
-import org.tianocore.common.Log;\r
-import org.tianocore.common.Tools;\r
-import org.tianocore.packaging.common.ui.IInternalFrame;\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-\r
-/**\r
- The class is used to create, update MsaLibHeader of a MSA file\r
- It extends IInternalFrame\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class MsaLibHeader extends IInternalFrame {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = 5526729363068526262L;\r
-\r
- //\r
- //Define class members\r
- //\r
- private JPanel jContentPane = null;\r
-\r
- private JLabel jLabelBaseName = null;\r
-\r
- private JTextField jTextFieldBaseName = null;\r
-\r
- private JLabel jLabelGuid = null;\r
-\r
- private JTextField jTextFieldGuid = null;\r
-\r
- private JLabel jLabelVersion = null;\r
-\r
- private JTextField jTextFieldVersion = null;\r
-\r
- private JButton jButtonGenerateGuid = null;\r
-\r
- private JLabel jLabelLicense = null;\r
-\r
- private JTextArea jTextAreaLicense = null;\r
-\r
- private JLabel jLabelCopyright = null;\r
-\r
- private JLabel jLabelDescription = null;\r
-\r
- private JTextArea jTextAreaDescription = null;\r
-\r
- private JLabel jLabelSpecification = null;\r
-\r
- private JTextField jTextFieldSpecification = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JScrollPane jScrollPaneLicense = null;\r
-\r
- private JScrollPane jScrollPaneDescription = null;\r
-\r
- private JLabel jLabelAbstract = null;\r
-\r
- private JTextField jTextFieldAbstract = null;\r
-\r
- private JLabel jLabelModuleType = null;\r
-\r
- private JLabel jLabelCompontentType = null;\r
-\r
- private JComboBox jComboBoxCompontentType = null;\r
-\r
- private JComboBox jComboBoxModuleType = null;\r
-\r
- private StarLabel jStarLabel1 = null;\r
-\r
- private StarLabel jStarLabel2 = null;\r
-\r
- private StarLabel jStarLabel3 = null;\r
-\r
- private StarLabel jStarLabel4 = null;\r
-\r
- private StarLabel jStarLabel5 = null;\r
-\r
- private StarLabel jStarLabel6 = null;\r
-\r
- private StarLabel jStarLabel7 = null;\r
-\r
- private StarLabel jStarLabel8 = null;\r
-\r
- private StarLabel jStarLabel9 = null;\r
-\r
- private MsaLibHeaderDocument.MsaLibHeader msaLibHeader = null;\r
-\r
- private JLabel jLabelURL = null;\r
-\r
- private JTextField jTextFieldAbstractURL = null;\r
-\r
- private JTextField jTextFieldCopyright = null;\r
-\r
- /**\r
- This method initializes jTextFieldBaseName \r
- \r
- @return javax.swing.JTextField jTextFieldBaseName\r
- \r
- **/\r
- private JTextField getJTextFieldBaseName() {\r
- if (jTextFieldBaseName == null) {\r
- jTextFieldBaseName = new JTextField();\r
- jTextFieldBaseName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
- }\r
- return jTextFieldBaseName;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldGuid \r
- \r
- @return javax.swing.JTextField jTextFieldGuid\r
- \r
- **/\r
- private JTextField getJTextFieldGuid() {\r
- if (jTextFieldGuid == null) {\r
- jTextFieldGuid = new JTextField();\r
- jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 35, 250, 20));\r
- }\r
- return jTextFieldGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldVersion \r
- \r
- @return javax.swing.JTextField jTextFieldVersion\r
- \r
- **/\r
- private JTextField getJTextFieldVersion() {\r
- if (jTextFieldVersion == null) {\r
- jTextFieldVersion = new JTextField();\r
- jTextFieldVersion.setBounds(new java.awt.Rectangle(160, 60, 320, 20));\r
- }\r
- return jTextFieldVersion;\r
- }\r
-\r
- /**\r
- This method initializes jButtonGenerateGuid \r
- \r
- @return javax.swing.JButton jButtonGenerateGuid\r
- \r
- **/\r
- private JButton getJButtonGenerateGuid() {\r
- if (jButtonGenerateGuid == null) {\r
- jButtonGenerateGuid = new JButton();\r
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 35, 65, 20));\r
- jButtonGenerateGuid.setText("GEN");\r
- jButtonGenerateGuid.addActionListener(this);\r
- }\r
- return jButtonGenerateGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextAreaLicense \r
- \r
- @return javax.swing.JTextArea jTextAreaLicense\r
- \r
- **/\r
- private JTextArea getJTextAreaLicense() {\r
- if (jTextAreaLicense == null) {\r
- jTextAreaLicense = new JTextArea();\r
- jTextAreaLicense.setText("");\r
- jTextAreaLicense.setLineWrap(true);\r
- }\r
- return jTextAreaLicense;\r
- }\r
-\r
- /**\r
- This method initializes jTextAreaDescription \r
- \r
- @return javax.swing.JTextArea jTextAreaDescription\r
- \r
- **/\r
- private JTextArea getJTextAreaDescription() {\r
- if (jTextAreaDescription == null) {\r
- jTextAreaDescription = new JTextArea();\r
- jTextAreaDescription.setLineWrap(true);\r
- }\r
- return jTextAreaDescription;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldSpecification \r
- \r
- @return javax.swing.JTextField jTextFieldSpecification\r
- \r
- **/\r
- private JTextField getJTextFieldSpecification() {\r
- if (jTextFieldSpecification == null) {\r
- jTextFieldSpecification = new JTextField();\r
- jTextFieldSpecification.setBounds(new java.awt.Rectangle(160, 280, 320, 20));\r
- }\r
- return jTextFieldSpecification;\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton jButtonOk\r
- \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("OK");\r
- jButtonOk.setBounds(new java.awt.Rectangle(290, 445, 90, 20));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton jButtonCancel\r
- \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 445, 90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPaneLicense \r
- \r
- @return javax.swing.JScrollPane jScrollPaneLicense\r
- \r
- **/\r
- private JScrollPane getJScrollPaneLicense() {\r
- if (jScrollPaneLicense == null) {\r
- jScrollPaneLicense = new JScrollPane();\r
- jScrollPaneLicense.setBounds(new java.awt.Rectangle(160, 85, 320, 80));\r
- jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r
- jScrollPaneLicense.setViewportView(getJTextAreaLicense());\r
- }\r
- return jScrollPaneLicense;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPaneDescription \r
- \r
- @return javax.swing.JScrollPane jScrollPaneDescription\r
- \r
- **/\r
- private JScrollPane getJScrollPaneDescription() {\r
- if (jScrollPaneDescription == null) {\r
- jScrollPaneDescription = new JScrollPane();\r
- jScrollPaneDescription.setBounds(new java.awt.Rectangle(160, 195, 320, 80));\r
- jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r
- jScrollPaneDescription.setViewportView(getJTextAreaDescription());\r
- }\r
- return jScrollPaneDescription;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldAbstract \r
- \r
- @return javax.swing.JTextField jTextFieldAbstract\r
- \r
- **/\r
- private JTextField getJTextFieldAbstract() {\r
- if (jTextFieldAbstract == null) {\r
- jTextFieldAbstract = new JTextField();\r
- jTextFieldAbstract.setBounds(new java.awt.Rectangle(160, 305, 320, 20));\r
- }\r
- return jTextFieldAbstract;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxCompontentType \r
- \r
- @return javax.swing.JComboBox jComboBoxCompontentType\r
- \r
- **/\r
- private JComboBox getJComboBoxCompontentType() {\r
- if (jComboBoxCompontentType == null) {\r
- jComboBoxCompontentType = new JComboBox();\r
- jComboBoxCompontentType.setBounds(new java.awt.Rectangle(160, 380, 320, 20));\r
- }\r
- return jComboBoxCompontentType;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxModuleType \r
- \r
- @return javax.swing.JComboBox jComboBoxModuleType\r
- \r
- **/\r
- private JComboBox getJComboBoxModuleType() {\r
- if (jComboBoxModuleType == null) {\r
- jComboBoxModuleType = new JComboBox();\r
- jComboBoxModuleType.setBounds(new java.awt.Rectangle(160, 355, 320, 20));\r
- }\r
- return jComboBoxModuleType;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldAbstractURL \r
- \r
- @return javax.swing.JTextField jTextFieldAbstractURL\r
- \r
- **/\r
- private JTextField getJTextFieldAbstractURL() {\r
- if (jTextFieldAbstractURL == null) {\r
- jTextFieldAbstractURL = new JTextField();\r
- jTextFieldAbstractURL.setBounds(new java.awt.Rectangle(160,330,320,20));\r
- }\r
- return jTextFieldAbstractURL;\r
- }\r
-\r
- /**\r
- * This method initializes jTextFieldCopyright \r
- * \r
- * @return javax.swing.JTextField \r
- */\r
- private JTextField getJTextFieldCopyright() {\r
- if (jTextFieldCopyright == null) {\r
- jTextFieldCopyright = new JTextField();\r
- jTextFieldCopyright.setBounds(new java.awt.Rectangle(160,170,320,20));\r
- }\r
- return jTextFieldCopyright;\r
- }\r
-\r
- public static void main(String[] args) {\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public MsaLibHeader() {\r
- super();\r
- init();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inMsaLibHeader The input data of MsaLibHeaderDocument.MsaLibHeader\r
- \r
- **/\r
- public MsaLibHeader(MsaLibHeaderDocument.MsaLibHeader inMsaLibHeader) {\r
- super();\r
- init(inMsaLibHeader);\r
- this.setVisible(true);\r
- this.setViewMode(false);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void init() {\r
- this.setSize(500, 515);\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Library Module");\r
- initFrame();\r
- }\r
-\r
- /**\r
- This method initializes this\r
- Fill values to all fields if these values are not empty\r
- \r
- @param inMsaLibHeader The input data of MsaLibHeaderDocument.MsaLibHeader\r
- \r
- **/\r
- private void init(MsaLibHeaderDocument.MsaLibHeader inMsaLibHeader) {\r
- init();\r
- this.setMsaLibHeader(inMsaLibHeader);\r
- if (inMsaLibHeader != null) {\r
- if (this.msaLibHeader.getBaseName() != null) {\r
- this.jTextFieldBaseName.setText(this.msaLibHeader.getBaseName().getStringValue());\r
- }\r
- if (this.msaLibHeader.getGuid() != null) {\r
- this.jTextFieldGuid.setText(this.msaLibHeader.getGuid().getStringValue());\r
- }\r
- if (this.msaLibHeader.getVersion() != null) {\r
- this.jTextFieldVersion.setText(this.msaLibHeader.getVersion());\r
- }\r
- if (this.msaLibHeader.getLicense() != null) {\r
- this.jTextAreaLicense.setText(this.msaLibHeader.getLicense().getStringValue());\r
- }\r
- if (this.msaLibHeader.getCopyright() != null) {\r
- this.jTextFieldCopyright.setText(this.msaLibHeader.getCopyright());\r
- }\r
- if (this.msaLibHeader.getDescription() != null) {\r
- this.jTextAreaDescription.setText(this.msaLibHeader.getDescription());\r
- }\r
- if (this.msaLibHeader.getSpecification() != null) {\r
- this.jTextFieldSpecification.setText(this.msaLibHeader.getSpecification());\r
- }\r
- if (this.msaLibHeader.getAbstract() != null) {\r
- this.jTextFieldAbstract.setText(this.msaLibHeader.getAbstract());\r
- }\r
- if (this.msaLibHeader.getModuleType() != null) {\r
- this.jComboBoxModuleType.setSelectedItem(this.msaLibHeader.getModuleType().toString());\r
- }\r
- if (this.msaLibHeader.getComponentType() != null) {\r
- this.jComboBoxCompontentType.setSelectedItem(this.msaLibHeader.getComponentType().toString());\r
- }\r
- }\r
- }\r
-\r
- /**\r
- Disable all components when the mode is view\r
- \r
- @param isView true - The view mode; false - The non-view mode\r
- \r
- **/\r
- public void setViewMode(boolean isView) {\r
- this.jButtonOk.setVisible(false);\r
- this.jButtonCancel.setVisible(false);\r
- if (isView) {\r
- this.jTextFieldBaseName.setEnabled(!isView);\r
- this.jTextFieldGuid.setEnabled(!isView);\r
- this.jTextFieldVersion.setEnabled(!isView);\r
- this.jTextAreaLicense.setEnabled(!isView);\r
- this.jTextFieldCopyright.setEnabled(!isView);\r
- this.jTextAreaDescription.setEnabled(!isView);\r
- this.jTextFieldSpecification.setEnabled(!isView);\r
- this.jTextFieldAbstract.setEnabled(!isView);\r
- this.jTextFieldAbstractURL.setEnabled(!isView);\r
- this.jComboBoxModuleType.setEnabled(!isView);\r
- this.jComboBoxCompontentType.setEnabled(!isView);\r
- this.jButtonCancel.setEnabled(!isView);\r
- this.jButtonGenerateGuid.setEnabled(!isView);\r
- this.jButtonOk.setEnabled(!isView);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel jContentPane\r
- \r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabelURL = new JLabel();\r
- jLabelURL.setBounds(new java.awt.Rectangle(15,330,140,20));\r
- jLabelURL.setText("URL");\r
- jLabelCompontentType = new JLabel();\r
- jLabelCompontentType.setBounds(new java.awt.Rectangle(15, 380, 140, 20));\r
- jLabelCompontentType.setText("Compontent Type");\r
- jLabelModuleType = new JLabel();\r
- jLabelModuleType.setBounds(new java.awt.Rectangle(15, 355, 140, 20));\r
- jLabelModuleType.setText("Module Type");\r
- jLabelAbstract = new JLabel();\r
- jLabelAbstract.setBounds(new java.awt.Rectangle(15, 305, 140, 20));\r
- jLabelAbstract.setText("Abstract");\r
- jLabelSpecification = new JLabel();\r
- jLabelSpecification.setText("Specification");\r
- jLabelSpecification.setBounds(new java.awt.Rectangle(15, 280, 140, 20));\r
- jLabelDescription = new JLabel();\r
- jLabelDescription.setText("Description");\r
- jLabelDescription.setBounds(new java.awt.Rectangle(15, 195, 140, 20));\r
- jLabelCopyright = new JLabel();\r
- jLabelCopyright.setText("Copyright");\r
- jLabelCopyright.setBounds(new java.awt.Rectangle(15, 170, 140, 20));\r
- jLabelLicense = new JLabel();\r
- jLabelLicense.setText("License");\r
- jLabelLicense.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
- jLabelVersion = new JLabel();\r
- jLabelVersion.setText("Version");\r
- jLabelVersion.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
- jLabelGuid = new JLabel();\r
- jLabelGuid.setPreferredSize(new java.awt.Dimension(25, 15));\r
- jLabelGuid.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
- jLabelGuid.setText("Guid");\r
- jLabelBaseName = new JLabel();\r
- jLabelBaseName.setText("Base Name");\r
- jLabelBaseName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.setLocation(new java.awt.Point(0, 0));\r
- jContentPane.setSize(new java.awt.Dimension(500, 524));\r
- jContentPane.add(jLabelBaseName, null);\r
- jContentPane.add(getJTextFieldBaseName(), null);\r
- jContentPane.add(jLabelGuid, null);\r
- jContentPane.add(getJTextFieldGuid(), null);\r
- jContentPane.add(jLabelVersion, null);\r
- jContentPane.add(getJTextFieldVersion(), null);\r
- jContentPane.add(getJButtonGenerateGuid(), null);\r
- jContentPane.add(jLabelLicense, null);\r
- jContentPane.add(jLabelCopyright, null);\r
- jContentPane.add(jLabelDescription, null);\r
- jContentPane.add(jLabelSpecification, null);\r
- jContentPane.add(getJTextFieldSpecification(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJScrollPaneLicense(), null);\r
- jContentPane.add(getJScrollPaneDescription(), null);\r
- jContentPane.add(jLabelAbstract, null);\r
- jContentPane.add(getJTextFieldAbstract(), null);\r
- jContentPane.add(jLabelModuleType, null);\r
- jContentPane.add(jLabelCompontentType, null);\r
- jContentPane.add(getJComboBoxCompontentType(), null);\r
- jContentPane.add(getJComboBoxModuleType(), null);\r
-\r
- jStarLabel1 = new StarLabel();\r
- jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
- jStarLabel2 = new StarLabel();\r
- jStarLabel2.setLocation(new java.awt.Point(0, 35));\r
- jStarLabel3 = new StarLabel();\r
- jStarLabel3.setLocation(new java.awt.Point(0, 60));\r
- jStarLabel4 = new StarLabel();\r
- jStarLabel4.setLocation(new java.awt.Point(0, 85));\r
- jStarLabel5 = new StarLabel();\r
- jStarLabel5.setLocation(new java.awt.Point(0, 170));\r
- jStarLabel6 = new StarLabel();\r
- jStarLabel6.setLocation(new java.awt.Point(0, 195));\r
- jStarLabel7 = new StarLabel();\r
- jStarLabel7.setLocation(new java.awt.Point(0, 305));\r
- jStarLabel8 = new StarLabel();\r
- jStarLabel8.setLocation(new java.awt.Point(0, 355));\r
- jStarLabel9 = new StarLabel();\r
- jStarLabel9.setLocation(new java.awt.Point(0, 380));\r
-\r
- jContentPane.add(jStarLabel1, null);\r
- jContentPane.add(jStarLabel2, null);\r
- jContentPane.add(jStarLabel3, null);\r
- jContentPane.add(jStarLabel4, null);\r
- jContentPane.add(jStarLabel5, null);\r
- jContentPane.add(jStarLabel6, null);\r
- jContentPane.add(jStarLabel7, null);\r
- jContentPane.add(jStarLabel8, null);\r
- jContentPane.add(jStarLabel9, null);\r
- jContentPane.add(jLabelURL, null);\r
- jContentPane.add(getJTextFieldAbstractURL(), null);\r
- jContentPane.add(getJTextFieldCopyright(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- *\r
- * Override actionPerformed to listen all actions\r
- * \r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.dispose();\r
- this.save();\r
- this.setEdited(true);\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- this.setEdited(false);\r
- }\r
- if (arg0.getSource() == jButtonGenerateGuid) {\r
- jTextFieldGuid.setText(Tools.generateUuidString());\r
- }\r
- }\r
-\r
- /**\r
- Data validation for all fields\r
- \r
- @retval true - All datas are valid\r
- @retval false - At least one data is invalid\r
- \r
- **/\r
- public boolean check() {\r
- //\r
- // Check if all required fields are not empty\r
- //\r
- if (isEmpty(this.jTextFieldBaseName.getText())) {\r
- Log.err("Base Name couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextFieldGuid.getText())) {\r
- Log.err("Guid couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextFieldVersion.getText())) {\r
- Log.err("Version couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextAreaLicense.getText())) {\r
- Log.err("License couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextFieldCopyright.getText())) {\r
- Log.err("Copyright couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextAreaDescription.getText())) {\r
- Log.err("Description couldn't be empty");\r
- return false;\r
- }\r
- if (isEmpty(this.jTextFieldAbstract.getText())) {\r
- Log.err("Abstract couldn't be empty");\r
- return false;\r
- }\r
-\r
- //\r
- // Check if all fields have correct data types \r
- //\r
- if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {\r
- Log.err("Incorrect data type for Base Name");\r
- return false;\r
- }\r
- if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {\r
- Log.err("Incorrect data type for Guid");\r
- return false;\r
- }\r
- if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) {\r
- Log.err("Incorrect data type for Abstract");\r
- return false;\r
- }\r
- if (!DataValidation.isCopyright(this.jTextFieldCopyright.getText())) {\r
- Log.err("Incorrect data type for Copyright");\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- /**\r
- Save all components of Msa Lib Header\r
- if exists msaLibHeader, set the value directly\r
- if not exists msaLibHeader, new an instance first\r
- \r
- **/\r
- public void save() {\r
- try {\r
- if (this.msaLibHeader == null) {\r
- msaLibHeader = MsaLibHeaderDocument.MsaLibHeader.Factory.newInstance();\r
- }\r
- if (this.msaLibHeader.getBaseName() != null) {\r
- this.msaLibHeader.getBaseName().setStringValue(this.jTextFieldBaseName.getText());\r
- } else {\r
- BaseNameDocument.BaseName mBaseName = BaseNameDocument.BaseName.Factory.newInstance();\r
- mBaseName.setStringValue(this.jTextFieldBaseName.getText());\r
- this.msaLibHeader.setBaseName(mBaseName);\r
- }\r
-\r
- if (this.msaLibHeader.getGuid() != null) {\r
- this.msaLibHeader.getGuid().setStringValue(this.jTextFieldGuid.getText());\r
- } else {\r
- GuidDocument.Guid mGuid = GuidDocument.Guid.Factory.newInstance();\r
- mGuid.setStringValue(this.jTextFieldGuid.getText());\r
- this.msaLibHeader.setGuid(mGuid);\r
- }\r
-\r
- this.msaLibHeader.setVersion(this.jTextFieldVersion.getText());\r
-\r
- if (this.msaLibHeader.getLicense() != null) {\r
- this.msaLibHeader.getLicense().setStringValue(this.jTextAreaLicense.getText());\r
- } else {\r
- LicenseDocument.License mLicense = LicenseDocument.License.Factory.newInstance();\r
- mLicense.setStringValue(this.jTextAreaLicense.getText());\r
- this.msaLibHeader.setLicense(mLicense);\r
- }\r
-\r
- this.msaLibHeader.setCopyright(this.jTextFieldCopyright.getText());\r
- this.msaLibHeader.setDescription(this.jTextAreaDescription.getText());\r
-\r
- if (this.msaLibHeader.getSpecification() != null) {\r
- this.msaLibHeader.setSpecification(this.jTextFieldSpecification.getText());\r
- } else {\r
- this.msaLibHeader.setSpecification(this.jTextFieldSpecification.getText());\r
- }\r
-\r
- if (this.msaLibHeader.getAbstract() != null) {\r
- this.msaLibHeader.setAbstract(this.jTextFieldAbstract.getText());\r
- } else {\r
- \r
- this.msaLibHeader.setAbstract(this.jTextFieldAbstract.getText());\r
- }\r
-\r
- this.msaLibHeader.setModuleType(ModuleTypeDef.Enum.forString(this.jComboBoxModuleType.getSelectedItem()\r
- .toString()));\r
- this.msaLibHeader\r
- .setComponentType(FrameworkComponentTypes.Enum\r
- .forString(this.jComboBoxCompontentType\r
- .getSelectedItem()\r
- .toString()));\r
-\r
- if (this.msaLibHeader.getCreated() == null) {\r
- this.msaLibHeader.setCreated(Tools.getCurrentDateTime());\r
- } else {\r
- this.msaLibHeader.setUpdated(Tools.getCurrentDateTime());\r
- }\r
- } catch (Exception e) {\r
- Log.err("Save Module", e.getMessage());\r
- }\r
- }\r
-\r
- /**\r
- This method initializes module type and compontent type\r
- \r
- **/\r
- private void initFrame() {\r
- jComboBoxModuleType.addItem("BASE");\r
- jComboBoxModuleType.addItem("SEC");\r
- jComboBoxModuleType.addItem("PEI_CORE");\r
- jComboBoxModuleType.addItem("PEIM");\r
- jComboBoxModuleType.addItem("DXE_CORE");\r
- jComboBoxModuleType.addItem("DXE_DRIVER");\r
- jComboBoxModuleType.addItem("DXE_RUNTIME_DRIVER");\r
- jComboBoxModuleType.addItem("DXE_SMM_DRIVER");\r
- jComboBoxModuleType.addItem("DXE_SAL_DRIVER");\r
- jComboBoxModuleType.addItem("UEFI_DRIVER");\r
- jComboBoxModuleType.addItem("UEFI_APPLICATION");\r
-\r
- jComboBoxCompontentType.addItem("APRIORI");\r
- jComboBoxCompontentType.addItem("LIBRARY");\r
- jComboBoxCompontentType.addItem("FV_IMAGE_FILE");\r
- jComboBoxCompontentType.addItem("BS_DRIVER");\r
- jComboBoxCompontentType.addItem("RT_DRIVER");\r
- jComboBoxCompontentType.addItem("SAL_RT_DRIVER");\r
- jComboBoxCompontentType.addItem("PE32_PEIM");\r
- jComboBoxCompontentType.addItem("PIC_PEIM");\r
- jComboBoxCompontentType.addItem("COMBINED_PEIM_DRIVER");\r
- jComboBoxCompontentType.addItem("PEI_CORE");\r
- jComboBoxCompontentType.addItem("DXE_CORE");\r
- jComboBoxCompontentType.addItem("APPLICATION");\r
- jComboBoxCompontentType.addItem("BS_DRIVER_EFI");\r
- jComboBoxCompontentType.addItem("SHELLAPP");\r
- }\r
-\r
- /**\r
- Get MsaLibHeaderDocument.MsaLibHeader\r
- \r
- @return MsaLibHeaderDocument.MsaLibHeader\r
- \r
- **/\r
- public MsaLibHeaderDocument.MsaLibHeader getMsaLibHeader() {\r
- return msaLibHeader;\r
- }\r
-\r
- /**\r
- Set MsaLibHeaderDocument.MsaLibHeader\r
- \r
- @param msaLibHeader The input data of MsaLibHeaderDocument.MsaLibHeader\r
- \r
- **/\r
- public void setMsaLibHeader(MsaLibHeaderDocument.MsaLibHeader msaLibHeader) {\r
- this.msaLibHeader = msaLibHeader;\r
- }\r
-\r
-}\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to init workspace and get basic information of workspace\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-\r
-package org.tianocore.packaging.workspace.common;\r
-\r
-import java.io.File;\r
-import java.util.Vector;\r
-\r
-import org.apache.xmlbeans.XmlException;\r
-import org.apache.xmlbeans.XmlObject;\r
-import org.tianocore.FrameworkDatabaseDocument;\r
-import org.tianocore.common.Log;\r
-\r
-/**\r
- The file is used to init workspace and get basic information of workspace\r
- \r
- @since ModuleEditor 1.0\r
-\r
- **/\r
-public class Workspace {\r
-\r
- //\r
- // Define class members\r
- //\r
- private String currentWorkspace = null;\r
-\r
- private FrameworkDatabaseDocument xmlFrameworkDbDoc = null;\r
- \r
- //private PackageDocument xmlPackage = null;\r
-\r
- private String strWorkspaceDatabaseFile = System.getProperty("file.separator") + "Tools"\r
- + System.getProperty("file.separator") + "Conf"\r
- + System.getProperty("file.separator") + "FrameworkDatabase.db";\r
-\r
- public static void main(String[] args) {\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- Get current WORKSPACE from system environment variable\r
- \r
- **/\r
- public Workspace() {\r
- this.currentWorkspace = System.getenv("WORKSPACE");\r
- }\r
-\r
- /**\r
- Check if current workspace exists of not\r
- \r
- @retval true - The current WORKSPACE exists\r
- @retval false - The current WORKSPACE doesn't exist\r
- \r
- **/\r
- public boolean checkCurrentWorkspace() {\r
- return checkCurrentWorkspace(getCurrentWorkspace());\r
- }\r
-\r
- /**\r
- Check if current workspace exists or not via input workspace path\r
- \r
- @param strWorkspace The input data of WORKSPACE path\r
- @retval true - The current WORKSPACE exists\r
- @retval false - The current WORKSPACE doesn't exist\r
- \r
- **/\r
- public boolean checkCurrentWorkspace(String strWorkspace) {\r
- if (strWorkspace == null || strWorkspace == "") {\r
- return false;\r
- }\r
- File f = new File(strWorkspace);\r
- if (!f.isDirectory()) {\r
- return false;\r
- }\r
- if (!f.exists()) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- /**\r
- Get Current Workspace\r
- \r
- @return currentWorkspace\r
- \r
- **/\r
- public String getCurrentWorkspace() {\r
- return currentWorkspace;\r
- }\r
-\r
- /**\r
- Set Current Workspace\r
- \r
- @param currentWorkspace The input data of currentWorkspace\r
- \r
- **/\r
- public void setCurrentWorkspace(String currentWorkspace) {\r
- this.currentWorkspace = currentWorkspace;\r
- }\r
-\r
- /**\r
- Open Framework Database file\r
- \r
- **/\r
- private void openFrameworkDb() {\r
- String strFrameworkDbFilePath = this.getCurrentWorkspace() + strWorkspaceDatabaseFile;\r
- File db = new File(strFrameworkDbFilePath);\r
- try {\r
- xmlFrameworkDbDoc = (FrameworkDatabaseDocument) XmlObject.Factory.parse(db);\r
- } catch (XmlException e) {\r
- Log.err("Open Framework Database " + strFrameworkDbFilePath, e.getMessage());\r
- return;\r
- } catch (Exception e) {\r
- Log.err("Open Framework Database " + strFrameworkDbFilePath, "Invalid file type");\r
- return;\r
- }\r
- }\r
-\r
- /**\r
- Get FrameworkDatabaseDocument\r
- \r
- @return FrameworkDatabaseDocument\r
- \r
- **/\r
- public FrameworkDatabaseDocument getXmlFrameworkDbDoc() {\r
- openFrameworkDb();\r
- return xmlFrameworkDbDoc;\r
- }\r
-\r
- /**\r
- Set FrameworkDatabaseDocument\r
- \r
- @param xmlFrameworkDbDoc The input data of FrameworkDatabaseDocument\r
- \r
- **/\r
- public void setXmlFrameworkDbDoc(FrameworkDatabaseDocument xmlFrameworkDbDoc) {\r
- this.xmlFrameworkDbDoc = xmlFrameworkDbDoc;\r
- }\r
-\r
- /**\r
- Get all package name form the FrameworkDatabase.db file\r
- \r
- @return vPackageName A vector includes all package names\r
- \r
- **/\r
- public Vector getAllPackageName() {\r
- Vector<String> vPackageName = new Vector<String>();\r
- openFrameworkDb();\r
-\r
- for (int index = 0; index < xmlFrameworkDbDoc.getFrameworkDatabase().getPackageList().sizeOfPackageArray(); index++) {\r
- vPackageName.addElement(xmlFrameworkDbDoc.getFrameworkDatabase().getPackageList().getPackageArray(index)\r
- .getPackageNameArray(0).getStringValue());\r
- }\r
-\r
- return vPackageName;\r
- }\r
-}\r
+++ /dev/null
-Manifest-Version: 1.0\r
-Main-Class: org.tianocore.packaging.PackagingMain\r
-\r
+++ /dev/null
-<?xml version="1.0"?>\r
-<!--\r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
--->\r
-<project name="PackageEditor" default="all" basedir=".">\r
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>\r
- <property environment="env"/>\r
- <property name="WORKSPACE" value="${env.WORKSPACE}"/>\r
- <path id="classpath">\r
- <fileset dir="${WORKSPACE}/Tools/Jars" includes="*.jar"/>\r
- <fileset dir="${env.XMLBEANS_HOME}/lib" includes="*.jar"/>\r
- </path>\r
- <property name="buildDir" value="build"/>\r
- <property name="installLocation" value="${WORKSPACE}/Tools/bin"/>\r
- <target name="all" depends="install"/>\r
- <target name="source">\r
- <mkdir dir="${buildDir}"/>\r
- <javac srcdir="src" destdir="${buildDir}">\r
- <classpath refid="classpath"/>\r
- <!-- <compilerarg value="-Xlint"/> -->\r
- </javac>\r
- </target>\r
- <target name="clean">\r
- <delete dir="${buildDir}"/>\r
- </target>\r
- <target name="cleanall">\r
- <delete dir="${buildDir}"/>\r
- <delete file="${installLocation}/PackageEditor.jar"/>\r
- </target>\r
- <target name="install" depends="source">\r
- <jar destfile="${installLocation}/PackageEditor.jar"\r
- basedir="${buildDir}"\r
- includes="**"\r
- manifest="MANIFEST.MF"\r
- />\r
- </target>\r
-</project>\r
+++ /dev/null
-/** @file\r
- Java class Tools contains common use procedures.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.common;\r
-\r
-import java.io.File;\r
-import java.text.SimpleDateFormat;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.UUID;\r
-\r
-/**\r
- This class contains static methods for some common operations\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class Tools {\r
- \r
- public static final String guidArrayPat = "0x[a-fA-F0-9]{1,8},( )*0x[a-fA-F0-9]{1,4},( )*0x[a-fA-F0-9]{1,4}(,( )*\\{)?(,?( )*0x[a-fA-F0-9]{1,2}){8}( )*(\\})?";\r
- public static final String guidRegistryPat = "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}";\r
- /**\r
- get current date and time, then return\r
- @return String\r
- **/\r
- public static String getCurrentDateTime() {\r
- Date now = new Date(System.currentTimeMillis());\r
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");\r
- return sdf.format(now);\r
- }\r
- \r
- /**\r
- Delete a folder and all its files\r
- @param strFolderName\r
- @return boolean\r
- **/\r
- public static boolean deleteFolder(File fleFolderName) {\r
- boolean blnIsDeleted = true;\r
- File[] aryAllFiles = fleFolderName.listFiles();\r
- \r
- for (int indexI = 0; indexI < aryAllFiles.length; indexI++) {\r
- if (blnIsDeleted) {\r
- if (aryAllFiles[indexI].isDirectory()) {\r
- blnIsDeleted = deleteFolder(aryAllFiles[indexI]);\r
- } else if (aryAllFiles[indexI].isFile()) {\r
- if (!aryAllFiles[indexI].delete()) {\r
- blnIsDeleted = false;\r
- }\r
- }\r
- }\r
- }\r
- if (blnIsDeleted) {\r
- fleFolderName.delete();\r
- }\r
- return blnIsDeleted;\r
- }\r
- \r
- /**\r
- Get a new GUID\r
- \r
- @return String\r
- **/\r
- public static String generateUuidString() {\r
- return UUID.randomUUID().toString();\r
- }\r
- \r
- public static String formatGuidString (String guidNameConv) {\r
- String[] strList;\r
- String guid = "";\r
- int index = 0;\r
- if (guidNameConv\r
- .matches(Tools.guidRegistryPat)) {\r
- strList = guidNameConv.split("-");\r
- guid = "0x" + strList[0] + ", ";\r
- guid = guid + "0x" + strList[1] + ", ";\r
- guid = guid + "0x" + strList[2] + ", ";\r
-// guid = guid + "{";\r
- guid = guid + "0x" + strList[3].substring(0, 2) + ", ";\r
- guid = guid + "0x" + strList[3].substring(2, 4);\r
-\r
- while (index < strList[4].length()) {\r
- guid = guid + ", ";\r
- guid = guid + "0x" + strList[4].substring(index, index + 2);\r
- index = index + 2;\r
- }\r
-// guid = guid + "}";\r
- return guid;\r
- }\r
- else if (guidNameConv\r
- .matches(Tools.guidArrayPat)) {\r
- strList = guidNameConv.split(",");\r
- \r
- //\r
- // chang ANSI c form to registry form\r
- //\r
- for (int i = 0; i < strList.length; i++){\r
- strList[i] = strList[i].substring(strList[i].lastIndexOf("x") + 1);\r
- }\r
- if (strList[strList.length - 1].endsWith("}")) {\r
- strList[strList.length -1] = strList[strList.length-1].substring(0, strList[strList.length-1].length()-1); \r
- }\r
- //\r
- //inserting necessary leading zeros\r
- //\r
- \r
- int segLen = strList[0].length();\r
- if (segLen < 8){\r
- for (int i = 0; i < 8 - segLen; ++i){\r
- strList[0] = "0" + strList[0];\r
- }\r
- }\r
- \r
- segLen = strList[1].length();\r
- if (segLen < 4){\r
- for (int i = 0; i < 4 - segLen; ++i){\r
- strList[1] = "0" + strList[1];\r
- }\r
- }\r
- segLen = strList[2].length();\r
- if (segLen < 4){\r
- for (int i = 0; i < 4 - segLen; ++i){\r
- strList[2] = "0" + strList[2];\r
- }\r
- }\r
- for (int i = 3; i < 11; ++i) {\r
- segLen = strList[i].length();\r
- if (segLen < 2){\r
- strList[i] = "0" + strList[i];\r
- }\r
- }\r
- \r
- for (int i = 0; i < 3; i++){\r
- guid += strList[i] + "-";\r
- }\r
- \r
- guid += strList[3];\r
- guid += strList[4] + "-";\r
- \r
- for (int i = 5; i < strList.length; ++i){\r
- guid += strList[i];\r
- }\r
- \r
- \r
- return guid;\r
- } else {\r
- \r
- return "0";\r
-\r
- }\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- Java class CreateFdp is used to create a distributable package containing \r
- FDPManifest.xml file in its root directory.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import java.io.*;\r
-import java.util.jar.*;\r
-\r
-/**\r
- This class contains static method create to generate *.fdp format package.\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class CreateFdp {\r
-\r
- /**\r
- recursively add contents under dir into output package.\r
- \r
- @param dir The directory with files that will be put into package\r
- @param jos Stream used to create output package\r
- @param wkDir The position of source directory\r
- @throws Exception Any exception occurred during this process\r
- **/\r
- public static void create(File dir, JarOutputStream jos, String wkDir) throws Exception {\r
- \r
- String[] list = dir.list();\r
- \r
- try {\r
- byte[] buffer = new byte[1024];\r
- int bytesRead;\r
-\r
- //\r
- // Loop through the file names provided.\r
- //\r
- for (int i = 0; i < list.length; i++) {\r
- \r
- File f = new File(dir, list[i]);\r
- if (f.getName().equals("..")) {\r
- continue;\r
- }\r
- if (f.isDirectory()) {\r
- //\r
- // Call this method recursively for directory\r
- //\r
- CreateFdp.create(f, jos, wkDir);\r
- continue;\r
- }\r
-\r
- try {\r
- //\r
- // Open the file\r
- //\r
- FileInputStream fis = new FileInputStream(f);\r
-\r
- try {\r
- //\r
- // Create a Jar entry and add it, keep relative path only.\r
- //\r
- JarEntry entry = new JarEntry(f.getPath().substring(wkDir.length() + 1));\r
- jos.putNextEntry(entry);\r
-\r
- //\r
- // Read the file and write it to the Jar.\r
- //\r
- while ((bytesRead = fis.read(buffer)) != -1) {\r
- jos.write(buffer, 0, bytesRead);\r
- }\r
-\r
- System.out.println(entry.getName() + " added.");\r
- } catch (Exception ex) {\r
- System.out.println(ex);\r
- } finally {\r
- fis.close();\r
- }\r
- } catch (IOException ex) {\r
- System.out.println(ex);\r
- }\r
- }\r
- } finally {\r
- System.out.println(dir.getPath() + " processed.");\r
- }\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- Java class DbFileContents is used to deal with FrameworkDatabase.db file cotents.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import java.io.File;\r
-import java.io.IOException;\r
-import java.util.LinkedList;\r
-import java.util.List;\r
-import java.util.ListIterator;\r
-import java.util.Date;\r
-import java.text.SimpleDateFormat;\r
-\r
-import org.apache.xmlbeans.XmlCursor;\r
-import org.apache.xmlbeans.XmlObject;\r
-import org.apache.xmlbeans.XmlOptions;\r
-\r
-import org.tianocore.*;\r
-\r
-/**\r
- This class provides methods for add, remove, query FrameworkDatabase.db file.\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class DbFileContents {\r
-\r
- ///\r
- /// return values for various conditions. \r
- ///\r
- static final int BASE_PACKAGE_NOT_INSTALLED = 1;\r
-\r
- static final int VERSION_NOT_EQUAL = 2;\r
-\r
- static final int GUID_NOT_EQUAL = 3;\r
-\r
- static final int SAME_ALL = 4;\r
-\r
- private File dbFile = null;\r
-\r
- private FrameworkDatabaseDocument fdd = null;\r
-\r
- private FrameworkDatabaseDocument.FrameworkDatabase fddRoot = null;\r
- \r
- private PackageListDocument.PackageList pkgList = null;\r
-\r
- public DbFileContents() {\r
- super();\r
- // TODO Auto-generated constructor stub\r
- }\r
-\r
- /**\r
- Parse file f, store its xml data in fdd, store root xml element in fddRoot.\r
- \r
- @param f DB file to parse\r
- **/\r
- public DbFileContents(File f) {\r
- try {\r
- dbFile = f;\r
- if (fdd == null) {\r
- fdd = ((FrameworkDatabaseDocument) XmlObject.Factory.parse(dbFile));\r
- }\r
- fddRoot = fdd.getFrameworkDatabase();\r
- } catch (Exception e) {\r
- System.out.println(e.toString());\r
- }\r
- }\r
- \r
- /**\r
- Generate the Package element in FrameworkDatabase.db\r
- \r
- @param baseName Base name of package\r
- @param ver Version of package\r
- @param guid GUID of package\r
- @param path Where the package installed\r
- @param installDate When the package installed\r
- **/\r
- public void genPackage (String baseName, String ver, String guid, String path, String installDate) {\r
- if (getPkgList() == null) {\r
- pkgList = fddRoot.addNewPackageList();\r
- }\r
- PackageListDocument.PackageList.Package p = pkgList.addNewPackage();\r
- p.addNewPackageName().setStringValue(baseName);\r
- p.addNewGuid().setStringValue(guid);\r
- p.addVersion(ver);\r
- p.addNewPath().setStringValue(path);\r
- p.addNewInstalledDate().setStringValue(installDate);\r
- }\r
- \r
- /**\r
- Get PackageList\r
- \r
- @return PackageListDocument.PackageList\r
- **/\r
- public PackageListDocument.PackageList getPkgList() {\r
- if (pkgList == null) {\r
- pkgList = fddRoot.getPackageList();\r
- }\r
- return pkgList;\r
- }\r
- \r
- /**\r
- Remove PackageList and all elements under it.\r
- **/\r
- public void removePackageList() {\r
- XmlObject o = fddRoot.getPackageList();\r
- if (o == null)\r
- return;\r
- XmlCursor cursor = o.newCursor();\r
- cursor.removeXml();\r
- }\r
- /**\r
- Get the number of Package elements.\r
- \r
- @return int\r
- **/\r
- public int getPackageCount () {\r
- return fddRoot.getPackageList().getPackageList().size();\r
- }\r
- \r
- /**\r
- Get all Package contents into String array\r
- \r
- @param pkg Two dimentional array to store Package info.\r
- **/\r
- public void getPackageList(String[][] pkg) {\r
- List<PackageListDocument.PackageList.Package> l = fddRoot.getPackageList().getPackageList();\r
- int i = 0;\r
- ListIterator li = l.listIterator();\r
- while (li.hasNext()) {\r
- PackageListDocument.PackageList.Package p = (PackageListDocument.PackageList.Package) li\r
- .next();\r
- if (p.getPackageNameArray(0)!= null) {\r
- pkg[i][0] = p.getPackageNameArray(0).getStringValue();\r
- }\r
- \r
- pkg[i][1] = p.getVersionArray(0);\r
- \r
- if (p.getGuidArray(0) != null) {\r
- pkg[i][2] = p.getGuidArray(0).getStringValue();\r
- }\r
- if (p.getPathArray(0) != null) {\r
- pkg[i][3] = p.getPathArray(0).getStringValue();\r
- }\r
- if (p.getInstalledDateArray(0) != null) {\r
- pkg[i][4] = p.getInstalledDateArray(0);\r
- }\r
- i++;\r
- }\r
- }\r
- /**\r
- Check whether destDir has been used by one Package\r
- \r
- @param destDir The directory to check.\r
- @retval <1> destDir has been used\r
- @retval <0> destDir has not been used\r
- @return int\r
- **/\r
- public int checkDir(String destDir) {\r
- List<PackageListDocument.PackageList.Package> lp = fddRoot.getPackageList().getPackageList();\r
-\r
- ListIterator lpi = lp.listIterator();\r
- while (lpi.hasNext()) {\r
- PackageListDocument.PackageList.Package p = (PackageListDocument.PackageList.Package) lpi.next();\r
- if (p.getPathArray(0).getStringValue().equals(destDir)) {\r
- return 1;\r
- }\r
- }\r
- return 0;\r
- }\r
-\r
- /**\r
- Find the package info. and store results into list of same base name or list\r
- of same version.\r
- \r
- @param base The base name of package\r
- @param version The version of package\r
- @param guid the GUID of package\r
- @param lpSameBase The list to store package info with the same base name with "base"\r
- @param lpSameVersion The list to store package info from lpSameBase and same version\r
- with "version"\r
- @retval <0> No package installed has base name "base"\r
- @retval <VERSION_NOT_EQUAL> At least one package installed with "base" but no "version"\r
- @retval <GUID_NOT_EQUAL> At least one package installed with "base" and "version" but no "guid"\r
- @retval <SAME_ALL> One installed package has the same base, version and guid\r
- @return int\r
- **/\r
- public int query(String base, String version, String guid,\r
- List<PackageListDocument.PackageList.Package> lpSameBase,\r
- List<PackageListDocument.PackageList.Package> lpSameVersion) {\r
-\r
- List<PackageListDocument.PackageList.Package> lp = fddRoot.getPackageList().getPackageList();\r
-\r
- ListIterator lpi = lp.listIterator();\r
- while (lpi.hasNext()) {\r
- PackageListDocument.PackageList.Package p = (PackageListDocument.PackageList.Package) lpi.next();\r
- if (p.getPackageNameArray(0).getStringValue().equals(base)) {\r
- lpSameBase.add(p);\r
- }\r
- }\r
-\r
- if (lpSameBase.size() == 0) {\r
- return 0;\r
- }\r
-\r
- for (ListIterator li = lpSameBase.listIterator(); li.hasNext();) {\r
- PackageListDocument.PackageList.Package p = (PackageListDocument.PackageList.Package) li.next();\r
- if (p.getVersionArray(0).equals(version)) {\r
- lpSameVersion.add(p);\r
- }\r
- }\r
-\r
- if (lpSameVersion.size() == 0) {\r
- return VERSION_NOT_EQUAL;\r
- }\r
-\r
- for (ListIterator li = lpSameVersion.listIterator(); li.hasNext();) {\r
- PackageListDocument.PackageList.Package p = (PackageListDocument.PackageList.Package) li.next();\r
- if (!p.getGuidArray(0).getStringValue().equals(guid)) {\r
- return GUID_NOT_EQUAL;\r
- }\r
- }\r
-\r
- return SAME_ALL;\r
-\r
- }\r
-\r
- /**\r
- Update package info (name, version, guid) with installDir, newVer, newGuid.\r
- And update install date with current date. if no package info available, add \r
- a new entry.\r
- \r
- @param name Original base name\r
- @param version Original version\r
- @param guid Original GUID\r
- @param installDir original path\r
- @param newVer Version value of package to be installed\r
- @param newGuid GUID value of package to be installed\r
- @throws IOException Exception during file operation\r
- **/\r
- public void updatePkgInfo(String name, String version, String guid, String installDir, String newVer, String newGuid)\r
- throws IOException {\r
- List<PackageListDocument.PackageList.Package> lp = fddRoot.getPackageList().getPackageList();\r
-\r
- ListIterator lpi = lp.listIterator();\r
- while (lpi.hasNext()) {\r
- PackageListDocument.PackageList.Package p = (PackageListDocument.PackageList.Package) lpi.next();\r
- if (p.getPackageNameArray(0).getStringValue().equals(name)) {\r
- if (p.getVersionArray(0).equals(version)) {\r
- if (p.getGuidArray(0).getStringValue().equals(guid)) {\r
- p.setVersionArray(0, newVer);\r
- p.getGuidArray(0).setStringValue(newGuid);\r
- p.getPathArray(0).setStringValue(installDir);\r
- SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");\r
- Date date = new Date();\r
- p.setInstalledDateArray(0, format.format(date));\r
- saveAs();\r
- return;\r
-\r
- }\r
- }\r
- }\r
- }\r
-\r
- addNewPkgInfo(name, newVer, newGuid, installDir);\r
- }\r
-\r
- /**\r
- Add one new package entry.\r
- \r
- @param name Package base name\r
- @param version Package version\r
- @param guid Package Guid\r
- @param installDir Package path\r
- @throws IOException Exception during file operation\r
- **/\r
- public void addNewPkgInfo(String name, String version, String guid, String installDir) throws IOException {\r
-\r
- PackageListDocument.PackageList.Package p = fddRoot.getPackageList().addNewPackage();\r
- p.addNewPackageName().setStringValue(name);\r
- p.addNewGuid().setStringValue(guid);\r
- p.addNewVersion().setStringValue(version);\r
- p.addNewPath().setStringValue(installDir + "/");\r
-\r
- SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");\r
- Date date = new Date();\r
- p.addNewInstalledDate().setStringValue(format.format(date));\r
- saveAs();\r
- }\r
-\r
- /**\r
- Save the fdd into file with format options\r
- **/\r
- public void saveAs() {\r
- XmlOptions options = new XmlOptions();\r
-\r
- options.setCharacterEncoding("UTF-8");\r
- options.setSavePrettyPrint();\r
- options.setSavePrettyPrintIndent(2);\r
- try {\r
- fdd.save(dbFile, options);\r
- } catch (IOException e) {\r
- e.printStackTrace();\r
- }\r
- }\r
-\r
-}\r
+++ /dev/null
-/** @file\r
- Java class ForceInstallPkg is used to install a package without DB check.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import java.io.*;\r
-import java.util.jar.*;\r
-import org.apache.xmlbeans.XmlException;\r
-\r
-/**\r
- Derived class from FrameworkPkg, installation skipping some checks.\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class ForceInstallPkg extends FrameworkPkg {\r
-\r
- private String oldVer = null;\r
-\r
- private String oldGuid = null;\r
-\r
- /**\r
- Constructor with parameters\r
- \r
- @param s Package path to be installed \r
- @param d Destination directory\r
- **/\r
- public ForceInstallPkg(String s, String d) {\r
- super(s, d);\r
- \r
- }\r
-\r
- public void setOldVersion(String v) {\r
- oldVer = v;\r
- }\r
-\r
- public void setOldGuid(String guid) {\r
- oldGuid = guid;\r
- }\r
-\r
- /**\r
- Set jar file to package name to be installed\r
- **/\r
- protected void pre_install() throws DirSame, IOException {\r
- setJf(new JarFile(getPkg()));\r
- \r
- }\r
-\r
- /**\r
- Update database file contents after install\r
- **/\r
- protected void post_install() throws IOException, XmlException {\r
- //\r
- // Get package info. from FDPManifest.xml file\r
- //\r
- setJf(new JarFile(getPkg()));\r
- ManifestContents manFile = new ManifestContents(getManifestInputStream(getJf()));\r
- setBName(manFile.getBaseName());\r
- setPVer(manFile.getVersion());\r
- setPGuid(manFile.getGuid());\r
- getJf().close();\r
-\r
- //\r
- // Add force installed package info. into database file\r
- //\r
- setDbFile(new File(getWkSpace() + System.getProperty("file.separator") + FrameworkPkg.dbConfigFile));\r
- setDfc(new DbFileContents(new File(getWkSpace() + System.getProperty("file.separator") + dbConfigFile)));\r
- getDfc().updatePkgInfo(getBName(), oldVer, oldGuid, getWkDir().substring(getWkSpace().length() + 1), getPVer(),\r
- getPGuid());\r
- }\r
-\r
-}\r
+++ /dev/null
-/** @file\r
- Java class FrameworkPkg is used to do package related operations.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import java.io.*;\r
-import java.util.Enumeration;\r
-import java.util.LinkedList;\r
-import java.util.List;\r
-import java.util.jar.*;\r
-import org.apache.xmlbeans.*;\r
-\r
-import org.tianocore.PackageListDocument;\r
-\r
-/**\r
- This class deals with package related operations\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class FrameworkPkg {\r
-\r
- private String pkg = null;\r
-\r
- private JarFile jf = null;\r
-\r
- ///\r
- /// where the package will be extracted to\r
- /// \r
- private String wkDir = null;\r
-\r
- private String bName = null;\r
-\r
- private String pVer = null;\r
-\r
- private String pGuid = null;\r
-\r
- ///\r
- /// current WORKSPACE location\r
- ///\r
- private String wkSpace = null;\r
-\r
- private File dbFile = null;\r
-\r
- private DbFileContents dfc = null;\r
-\r
- ///\r
- /// relative path of FrameworkDatabase.db file\r
- ///\r
- final static String dbConfigFile = "Tools" + System.getProperty("file.separator") + "Conf"\r
- + System.getProperty("file.separator") + "FrameworkDatabase.db";\r
-\r
-\r
- public FrameworkPkg() {\r
-\r
- }\r
-\r
- public FrameworkPkg(String package_name, String work_space) {\r
- pkg = package_name;\r
- wkSpace = work_space;\r
- }\r
-\r
- /**\r
- install package (*.fdp file) to dir\r
- \r
- @param dir Destination directory\r
- @retval <0> Install successfully\r
- @return int\r
- @throws IOException\r
- @throws XmlException Xml file exception\r
- @throws DirSame One package already installed to dir\r
- @throws BasePkgNotInstalled Some package must be installed first\r
- @throws VerNotEqual At least one package info with same base name but version different\r
- @throws GuidNotEqual At least one package info with same base name and version but guid different\r
- @throws SameAll At least one package info with same base name, version and guid same\r
- **/\r
- public int install(final String dir) throws IOException, XmlException, DirSame, BasePkgNotInstalled, VerNotEqual,\r
- GuidNotEqual, SameAll {\r
- wkDir = dir;\r
- pre_install();\r
- extract(wkDir);\r
- post_install();\r
- return 0;\r
- }\r
-\r
- public int uninstall() {\r
-\r
- return 0;\r
- }\r
-\r
- /**\r
- Check package info. against Frameworkdatabase.db\r
- \r
- @throws IOException\r
- @throws XmlException Xml file exception\r
- @throws DirSame One package already installed to dir\r
- @throws BasePkgNotInstalled Some package must be installed first\r
- @throws VerNotEqual At least one package info with same base name but version different\r
- @throws GuidNotEqual At least one package info with same base name and version but guid different\r
- @throws SameAll At least one package info with same base name, version and guid same\r
- **/\r
- protected void pre_install() throws IOException, XmlException, DirSame, BasePkgNotInstalled, VerNotEqual,\r
- GuidNotEqual, SameAll {\r
-\r
- jf = new JarFile(pkg);\r
-\r
- ManifestContents manFile = new ManifestContents(getManifestInputStream(jf));\r
-\r
- String baseName = manFile.getBaseName();\r
- String pkgVersion = manFile.getVersion();\r
- String pkgGuid = manFile.getGuid();\r
- bName = baseName;\r
- pVer = pkgVersion;\r
- pGuid = pkgGuid;\r
-\r
- if (dbFile == null) {\r
- dbFile = new File(wkSpace + System.getProperty("file.separator") + dbConfigFile);\r
- }\r
- //\r
- // the db file should exist if base packages have been installed\r
- //\r
- if (!dbFile.exists()) {\r
- throw new BasePkgNotInstalled();\r
- }\r
-\r
- if (dfc == null) {\r
- dfc = new DbFileContents(dbFile);\r
- }\r
- if (dfc.checkDir(wkDir) != 0) {\r
- throw new DirSame();\r
- }\r
- \r
- //\r
- // Get database info into lists\r
- //\r
- List<PackageListDocument.PackageList.Package> lpSameBase = new LinkedList<PackageListDocument.PackageList.Package>();\r
- List<PackageListDocument.PackageList.Package> lpSameVersion = new LinkedList<PackageListDocument.PackageList.Package>();\r
- int i = dfc.query(baseName, pkgVersion, pkgGuid, lpSameBase, lpSameVersion);\r
-\r
- //\r
- // throw various kind of exceptions according to query return value.\r
- //\r
- if (i == DbFileContents.VERSION_NOT_EQUAL) {\r
-\r
- jf.close();\r
- throw new VerNotEqual(lpSameBase);\r
- }\r
- if (i == DbFileContents.GUID_NOT_EQUAL) {\r
-\r
- jf.close();\r
- throw new GuidNotEqual(lpSameVersion);\r
- }\r
- if (i == DbFileContents.SAME_ALL) {\r
- jf.close();\r
- throw new SameAll(lpSameVersion);\r
- }\r
-\r
- }\r
-\r
- /**\r
- Add package info into db file.\r
- \r
- @throws IOException\r
- @throws XmlException\r
- **/\r
- protected void post_install() throws IOException, XmlException {\r
-\r
- dfc.addNewPkgInfo(bName, pVer, pGuid, wkDir.substring(wkSpace.length() + 1));\r
-\r
- }\r
-\r
- /**\r
- Extract package to dir\r
- \r
- @param dir Destination directory\r
- @throws DirSame\r
- @throws IOException\r
- **/\r
- private void extract(String dir) throws DirSame, IOException {\r
-\r
- new File(dir).mkdirs();\r
- dir += System.getProperty("file.separator");\r
- try {\r
- for (Enumeration e = jf.entries(); e.hasMoreElements();) {\r
- JarEntry je = (JarEntry) e.nextElement();\r
- \r
- //\r
- // jar entry contains directory only, make these directories\r
- //\r
- if (je.isDirectory()) {\r
- new File(dir + je.getName()).mkdirs();\r
- continue;\r
- }\r
- \r
- //\r
- // jar entry contains relative path and file name, make relative directories\r
- // under destination dir\r
- //\r
- int index = je.getName().lastIndexOf(System.getProperty("file.separator"));\r
- if (index != -1) {\r
- String dirPath = je.getName().substring(0, index);\r
- new File(dir + dirPath).mkdirs();\r
- }\r
- \r
- if (je != null) {\r
- //\r
- // Get an input stream for this entry.\r
- //\r
- InputStream entryStream = jf.getInputStream(je);\r
-\r
- try {\r
- //\r
- // Create the output file (clobbering the file if it exists).\r
- //\r
- FileOutputStream file = new FileOutputStream(dir + je.getName());\r
-\r
- try {\r
-\r
- byte[] buffer = new byte[1024];\r
- int bytesRead;\r
- //\r
- // Read the entry data and write it to the output file.\r
- //\r
- while ((bytesRead = entryStream.read(buffer)) != -1) {\r
- file.write(buffer, 0, bytesRead);\r
- }\r
-\r
- System.out.println(je.getName() + " extracted.");\r
- } finally {\r
- file.close();\r
- }\r
- } finally {\r
- entryStream.close();\r
- }\r
- }\r
-\r
- }\r
-\r
- } finally {\r
- jf.close();\r
-\r
- }\r
-\r
- }\r
-\r
- public String getBName() {\r
- return bName;\r
- }\r
-\r
- public void setBName(String name) {\r
- bName = name;\r
- }\r
-\r
- public File getDbFile() {\r
- return dbFile;\r
- }\r
-\r
- public void setDbFile(File dbFile) {\r
- this.dbFile = dbFile;\r
- }\r
-\r
- public DbFileContents getDfc() {\r
- return dfc;\r
- }\r
-\r
- public void setDfc(DbFileContents dfc) {\r
- this.dfc = dfc;\r
- }\r
-\r
- public String getPGuid() {\r
- return pGuid;\r
- }\r
-\r
- public void setPGuid(String guid) {\r
- pGuid = guid;\r
- }\r
-\r
- public String getPVer() {\r
- return pVer;\r
- }\r
-\r
- public void setPVer(String ver) {\r
- pVer = ver;\r
- }\r
-\r
- public String getWkDir() {\r
- return wkDir;\r
- }\r
-\r
- public void setWkDir(String wkDir) {\r
- this.wkDir = wkDir;\r
- }\r
-\r
- public String getWkSpace() {\r
- return wkSpace;\r
- }\r
-\r
- public void setWkSpace(String wkSpace) {\r
- this.wkSpace = wkSpace;\r
- }\r
-\r
- public JarFile getJf() {\r
- return jf;\r
- }\r
-\r
- public void setJf(JarFile jf) {\r
- this.jf = jf;\r
- }\r
-\r
- public String getPkg() {\r
- return pkg;\r
- }\r
-\r
- public void setPkg(String pkg) {\r
- this.pkg = pkg;\r
- }\r
-\r
- /**\r
- Get the input stream of FDPManifest.xml file from jar entry\r
- \r
- @param jf The Jar file that contains FDPManifest.xml file\r
- @return InputStream\r
- @throws IOException\r
- **/\r
- protected InputStream getManifestInputStream(JarFile jf) throws IOException {\r
- JarEntry je = null;\r
- for (Enumeration e = jf.entries(); e.hasMoreElements();) {\r
- je = (JarEntry) e.nextElement();\r
- if (je.getName().contains("FDPManifest.xml"))\r
- return jf.getInputStream(je);\r
- }\r
-\r
- return null;\r
- }\r
-\r
-}\r
-\r
-\r
-/**\r
- Various Exception classes for what happened when database info and package info\r
- are compared.\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-class DirSame extends Exception {\r
- final static long serialVersionUID = 0;\r
-}\r
-\r
-class BasePkgNotInstalled extends Exception {\r
- final static long serialVersionUID = 0;\r
-}\r
-\r
-class VerNotEqual extends Exception {\r
- final static long serialVersionUID = 0;\r
-\r
- //private String version = null;\r
- List<PackageListDocument.PackageList.Package> lppSameBase = null;\r
-\r
- VerNotEqual(List<PackageListDocument.PackageList.Package> ver) {\r
- lppSameBase = ver;\r
- }\r
-\r
- public List<PackageListDocument.PackageList.Package> getVersion() {\r
- return lppSameBase;\r
- }\r
-}\r
-\r
-class GuidNotEqual extends Exception {\r
- final static long serialVersionUID = 0;\r
-\r
- private List<PackageListDocument.PackageList.Package> lppSameVer = null;\r
-\r
- GuidNotEqual(List<PackageListDocument.PackageList.Package> ver) {\r
- lppSameVer = ver;\r
- }\r
-\r
- public List<PackageListDocument.PackageList.Package> getGuid() {\r
- return lppSameVer;\r
- }\r
-}\r
-\r
-class SameAll extends Exception {\r
- final static long serialVersionUID = 0;\r
-\r
- private List<PackageListDocument.PackageList.Package> version = null;\r
-\r
- SameAll(List<PackageListDocument.PackageList.Package> ver) {\r
- version = ver;\r
- }\r
-\r
- public List<PackageListDocument.PackageList.Package> getVersion() {\r
- return version;\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- Java class GenGuidDialog.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import java.awt.BorderLayout;\r
-import java.awt.Dimension;\r
-import java.awt.Toolkit;\r
-\r
-import javax.swing.JPanel;\r
-import javax.swing.JDialog;\r
-import java.awt.GridLayout;\r
-\r
-import javax.swing.JFrame;\r
-import javax.swing.JOptionPane;\r
-import javax.swing.JTextField;\r
-import javax.swing.JLabel;\r
-import javax.swing.JRadioButton;\r
-import javax.swing.ButtonGroup;\r
-import javax.swing.JButton;\r
-\r
-import org.tianocore.common.Tools;\r
-\r
-import java.awt.FlowLayout;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ActionListener;\r
-import java.awt.event.WindowAdapter;\r
-import java.awt.event.WindowEvent;\r
-\r
-/**\r
- Dialog for GUID generation. \r
- @since PackageEditor 1.0\r
-**/\r
-public class GenGuidDialog extends JDialog implements ActionListener{\r
-\r
- static private JFrame frame;\r
- private JPanel jContentPane = null;\r
- private JPanel jPanel = null;\r
- private JPanel jPanel1 = null;\r
- private JPanel jPanel2 = null;\r
- private JPanel jPanel3 = null;\r
- private JPanel jPanel4 = null;\r
- private JTextField jTextField = null;\r
- private JLabel jLabel = null;\r
- private JRadioButton jRadioButton = null;\r
- private JRadioButton jRadioButton1 = null;\r
- private JButton jButton = null;\r
- private JButton jButton1 = null;\r
- private JButton jButton2 = null;\r
- \r
-// private String guid = null;\r
-\r
- public void actionPerformed(ActionEvent arg0) {\r
- // TODO Auto-generated method stub\r
- if (arg0.getSource() == jButton1){\r
- String uuid = Tools.generateUuidString();\r
- if (jRadioButton1.isSelected()) {\r
- jTextField.setText(uuid);\r
- }\r
- else {\r
- //ToDo: transform to comma-sep guid\r
- String s = Tools.formatGuidString(uuid);\r
- if (s.equals("0")) {\r
- JOptionPane.showMessageDialog(frame, "Check GUID Value, it don't conform to the schema.");\r
- return;\r
- }\r
- jTextField.setText(s);\r
- }\r
- }\r
- \r
- if (arg0.getSource() == jRadioButton1){\r
- \r
- //ToDo: check text field value against RegExp and transform if needed\r
- if (jTextField.getText().matches(Tools.guidRegistryPat)){\r
- return;\r
- }\r
- if (jTextField.getText().matches(Tools.guidArrayPat)) {\r
- jTextField.setText(Tools.formatGuidString(jTextField.getText()));\r
- return;\r
- }\r
- \r
- JOptionPane.showMessageDialog(frame, "Check GUID Value, it don't conform to the schema.");\r
- \r
- }\r
- \r
- if (arg0.getSource() == jRadioButton){\r
- \r
- //ToDo: check text field value against RegExp and transform if needed\r
- if (jTextField.getText().matches(Tools.guidArrayPat)){\r
- return;\r
- }\r
- if (jTextField.getText().matches(Tools.guidRegistryPat)) {\r
- jTextField.setText(Tools.formatGuidString(jTextField.getText()));\r
- return;\r
- }\r
- \r
- JOptionPane.showMessageDialog(frame, "Check GUID Value, it don't conform to the schema.");\r
- \r
- }\r
- \r
- if (arg0.getSource() == jButton2){\r
-// if (jTextField.getText().matches(Tools.guidArrayPat) \r
-// || jTextField.getText().matches(Tools.guidRegistryPat)){\r
-// this.setVisible(false);\r
-// }\r
-// else {\r
-// JOptionPane.showMessageDialog(frame, "Incorrect GUID Value Format.");\r
-// }\r
- this.dispose();\r
- }\r
- \r
- if (arg0.getSource() == jButton){\r
- this.dispose();\r
- }\r
- }\r
-\r
- /**\r
- * This method initializes jPanel \r
- * \r
- * @return javax.swing.JPanel \r
- */\r
- private JPanel getJPanel() {\r
- if (jPanel == null) {\r
- FlowLayout flowLayout = new FlowLayout();\r
- flowLayout.setVgap(10);\r
- jPanel = new JPanel();\r
- jPanel.setLayout(flowLayout);\r
- jPanel.setPreferredSize(new java.awt.Dimension(100,30));\r
- jPanel.add(getJButton1(), null);\r
- jPanel.add(getJButton2(), null);\r
- jPanel.add(getJButton(), null);\r
- }\r
- return jPanel;\r
- }\r
-\r
- /**\r
- * This method initializes jPanel1 \r
- * \r
- * @return javax.swing.JPanel \r
- */\r
- private JPanel getJPanel1() {\r
- if (jPanel1 == null) {\r
- jPanel1 = new JPanel();\r
- }\r
- return jPanel1;\r
- }\r
-\r
- /**\r
- * This method initializes jPanel2 \r
- * \r
- * @return javax.swing.JPanel \r
- */\r
- private JPanel getJPanel2() {\r
- if (jPanel2 == null) {\r
- jPanel2 = new JPanel();\r
- }\r
- return jPanel2;\r
- }\r
-\r
- /**\r
- * This method initializes jPanel3 \r
- * \r
- * @return javax.swing.JPanel \r
- */\r
- private JPanel getJPanel3() {\r
- if (jPanel3 == null) {\r
- jPanel3 = new JPanel();\r
- }\r
- return jPanel3;\r
- }\r
-\r
- /**\r
- * This method initializes jPanel4 \r
- * \r
- * @return javax.swing.JPanel \r
- */\r
- private JPanel getJPanel4() {\r
- if (jPanel4 == null) {\r
- jLabel = new JLabel();\r
- jLabel.setText("GUID Value");\r
- GridLayout gridLayout = new GridLayout();\r
- gridLayout.setRows(4);\r
- jPanel4 = new JPanel();\r
- jPanel4.setLayout(gridLayout);\r
- jPanel4.add(getJRadioButton1(), null);\r
- jPanel4.add(getJRadioButton(), null);\r
- jPanel4.add(jLabel, null);\r
- jPanel4.add(getJTextField(), null);\r
- ButtonGroup bg = new ButtonGroup();\r
- bg.add(jRadioButton1);\r
- bg.add(jRadioButton);\r
- }\r
- return jPanel4;\r
- }\r
-\r
- /**\r
- * This method initializes jTextField \r
- * \r
- * @return javax.swing.JTextField \r
- */\r
- private JTextField getJTextField() {\r
- if (jTextField == null) {\r
- jTextField = new JTextField();\r
- jTextField.setHorizontalAlignment(JTextField.LEADING);\r
- jTextField.setPreferredSize(new java.awt.Dimension(100,20));\r
- }\r
- return jTextField;\r
- }\r
-\r
- /**\r
- * This method initializes jRadioButton \r
- * \r
- * @return javax.swing.JRadioButton \r
- */\r
- private JRadioButton getJRadioButton() {\r
- if (jRadioButton == null) {\r
- jRadioButton = new JRadioButton();\r
- jRadioButton.setText("Comma-Seperated Format");\r
- jRadioButton.addActionListener(this);\r
- }\r
- return jRadioButton;\r
- }\r
-\r
- /**\r
- * This method initializes jRadioButton1 \r
- * \r
- * @return javax.swing.JRadioButton \r
- */\r
- private JRadioButton getJRadioButton1() {\r
- if (jRadioButton1 == null) {\r
- jRadioButton1 = new JRadioButton();\r
- jRadioButton1.setText("Registry Format");\r
- jRadioButton1.setSelected(true);\r
- jRadioButton1.addActionListener(this);\r
- }\r
- return jRadioButton1;\r
- }\r
-\r
- /**\r
- * This method initializes jButton \r
- * \r
- * @return javax.swing.JButton \r
- */\r
- private JButton getJButton() {\r
- if (jButton == null) {\r
- jButton = new JButton();\r
- jButton.setPreferredSize(new java.awt.Dimension(80,20));\r
- jButton.setText("Cancel");\r
- jButton.addActionListener(this);\r
- }\r
- return jButton;\r
- }\r
-\r
- /**\r
- * This method initializes jButton1 \r
- * \r
- * @return javax.swing.JButton \r
- */\r
- private JButton getJButton1() {\r
- if (jButton1 == null) {\r
- jButton1 = new JButton();\r
- jButton1.setPreferredSize(new java.awt.Dimension(80,20));\r
- jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);\r
- jButton1.setText("New");\r
- jButton1.addActionListener(this);\r
- }\r
- return jButton1;\r
- }\r
-\r
- /**\r
- * This method initializes jButton2 \r
- * \r
- * @return javax.swing.JButton \r
- */\r
- private JButton getJButton2() {\r
- if (jButton2 == null) {\r
- jButton2 = new JButton();\r
- jButton2.setPreferredSize(new java.awt.Dimension(80,20));\r
- jButton2.setText("Ok");\r
- jButton2.addActionListener(this);\r
- }\r
- return jButton2;\r
- }\r
-\r
- /**\r
- \r
- @param args\r
- **/\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
- new GenGuidDialog().setVisible(true);\r
- }\r
-\r
- public String getGuid(){\r
- return jTextField.getText();\r
- }\r
- \r
- public void setGuid(String s){\r
- jTextField.setText(s);\r
- }\r
- /**\r
- * This is the default constructor\r
- */\r
- public GenGuidDialog() {\r
- super();\r
- initialize();\r
- }\r
- \r
- public GenGuidDialog(ActionListener i){\r
- super();\r
- initialize();\r
- jButton2.addActionListener(i);\r
- this.addWindowListener(new WindowAdapter(){\r
-\r
- @Override\r
- public void windowActivated(WindowEvent arg0) {\r
- // TODO Auto-generated method stub\r
- super.windowActivated(arg0);\r
- if ((jRadioButton1.isSelected() && jTextField.getText().matches(Tools.guidArrayPat))\r
- || (jRadioButton.isSelected() && jTextField.getText().matches(Tools.guidRegistryPat))) {\r
- jTextField.setText(Tools.formatGuidString(jTextField.getText()));\r
- }\r
- \r
-// if (!jTextField.getText().matches(Tools.guidArrayPat) || !jTextField.getText().matches(Tools.guidRegistryPat)) {\r
-// JOptionPane.showMessageDialog(frame, "InitVal: Incorrect GUID Value Format.");\r
-// return;\r
-// }\r
- }\r
- \r
- });\r
- }\r
-\r
- /**\r
- * This method initializes this\r
- * \r
- * @return void\r
- */\r
- private void initialize() {\r
- this.setSize(466, 157);\r
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
- this.setModal(true);\r
- this.setTitle("Editing GUID Value");\r
- this.setContentPane(getJContentPane());\r
- this.centerWindow();\r
- }\r
-\r
- /**\r
- * This method initializes jContentPane\r
- * \r
- * @return javax.swing.JPanel\r
- */\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(new BorderLayout());\r
- jContentPane.add(getJPanel(), java.awt.BorderLayout.EAST);\r
- jContentPane.add(getJPanel1(), java.awt.BorderLayout.WEST);\r
- jContentPane.add(getJPanel2(), java.awt.BorderLayout.NORTH);\r
- jContentPane.add(getJPanel3(), java.awt.BorderLayout.SOUTH);\r
- jContentPane.add(getJPanel4(), java.awt.BorderLayout.CENTER);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
- \r
-} // @jve:decl-index=0:visual-constraint="10,10"\r
+++ /dev/null
-/** @file\r
- Java class GuiPkgInstall is GUI for package installation.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-\r
-import javax.swing.JPanel;\r
-import javax.swing.JFrame;\r
-import javax.swing.JButton;\r
-import javax.swing.JFileChooser;\r
-import javax.swing.JLabel;\r
-import javax.swing.JOptionPane;\r
-import javax.swing.JTextField;\r
-\r
-import java.awt.Dimension;\r
-import java.awt.GridLayout;\r
-import java.awt.Toolkit;\r
-\r
-import java.awt.FlowLayout;\r
-import java.awt.event.MouseEvent;\r
-import java.awt.event.MouseListener;\r
-import java.awt.event.WindowAdapter;\r
-import java.awt.event.WindowEvent;\r
-\r
-import java.awt.ComponentOrientation;\r
-import java.io.File;\r
-import java.util.Hashtable;\r
-\r
-import javax.swing.SwingConstants;\r
-import javax.swing.JProgressBar;\r
-import javax.swing.filechooser.FileFilter;\r
-\r
-import org.apache.xmlbeans.XmlException;\r
-\r
-\r
-/**\r
- GUI for package installation. \r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class GuiPkgInstall extends JFrame implements MouseListener {\r
-\r
- final static long serialVersionUID = 0;\r
-\r
- static JFrame frame;\r
-\r
- ///\r
- /// backup of "this". As we cannot use "this" to refer outer class inside inner class\r
- ///\r
- private JFrame pThis = null;\r
-\r
- private JFileChooser chooser = null;\r
-\r
- private JPanel jPanel = null;\r
-\r
- private JPanel jPanel1 = null;\r
-\r
- private JTextField jTextField = null;\r
-\r
- private JButton jButton = null;\r
-\r
- private JPanel jPanel2 = null;\r
-\r
- private JLabel jLabel1 = null;\r
-\r
- private JPanel jPanel4 = null;\r
-\r
- private JTextField jTextField1 = null;\r
-\r
- private JButton jButton1 = null;\r
-\r
- private JPanel jPanel5 = null;\r
-\r
- private JPanel jPanel6 = null;\r
-\r
- private JPanel jPanel7 = null;\r
-\r
- private JLabel jLabel2 = null;\r
-\r
- private JTextField jTextField2 = null;\r
-\r
- private JButton jButton2 = null;\r
-\r
- private JButton jButton3 = null;\r
-\r
- private JPanel jPanel3 = null;\r
-\r
- private JLabel jLabel = null;\r
-\r
- private JProgressBar jProgressBar = null;\r
-\r
- private JButton jButton4 = null;\r
-\r
-\r
- public GuiPkgInstall() {\r
- super();\r
- initialize();\r
-\r
- }\r
-\r
- /**\r
- GUI initialization\r
- **/\r
- private void initialize() {\r
- this.setSize(new java.awt.Dimension(454, 313));\r
- this.setContentPane(getJPanel());\r
- this.setTitle("Package Installation");\r
- this.addWindowListener(new GuiPkgInstallAdapter(this));\r
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);\r
- this.centerWindow();\r
- pThis = this;\r
- }\r
-\r
- /**\r
- make window appear center of screen\r
- \r
- @param intWidth\r
- @param intHeight\r
- **/\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
-\r
- /**\r
- This method initializes jPanel\r
- @return javax.swing.JPanel\r
- **/\r
- private JPanel getJPanel() {\r
- if (jPanel == null) {\r
- GridLayout gridLayout = new GridLayout();\r
- gridLayout.setRows(7);\r
- gridLayout.setColumns(1);\r
- jPanel = new JPanel();\r
- jPanel.setLayout(gridLayout);\r
- jPanel.add(getJPanel3(), null);\r
- jPanel.add(getJPanel1(), null);\r
- jPanel.add(getJPanel2(), null);\r
- jPanel.add(getJPanel4(), null);\r
- jPanel.add(getJPanel5(), null);\r
- jPanel.add(getJPanel6(), null);\r
- jPanel.add(getJPanel7(), null);\r
- }\r
- return jPanel;\r
- }\r
-\r
- /**\r
- This method initializes jPanel1 \r
- \r
- @return javax.swing.JPanel \r
- **/\r
- private JPanel getJPanel1() {\r
- if (jPanel1 == null) {\r
- FlowLayout flowLayout = new FlowLayout();\r
- flowLayout.setAlignment(java.awt.FlowLayout.LEFT);\r
- jPanel1 = new JPanel();\r
- jPanel1.setLayout(flowLayout);\r
- jPanel1.add(getJTextField(), null);\r
- jPanel1.add(getJButton(), null);\r
- }\r
- return jPanel1;\r
- }\r
-\r
- /**\r
- This method initializes jTextField \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextField() {\r
- if (jTextField == null) {\r
- jTextField = new JTextField();\r
- jTextField.setHorizontalAlignment(javax.swing.JTextField.LEFT);\r
- jTextField.setPreferredSize(new java.awt.Dimension(350, 20));\r
- }\r
- return jTextField;\r
- }\r
-\r
- /**\r
- This method initializes jButton \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton() {\r
- if (jButton == null) {\r
- jButton = new JButton();\r
- jButton.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);\r
- jButton.setText("Browse");\r
- jButton.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT);\r
- jButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);\r
- jButton.setToolTipText("Where is the package?");\r
- jButton.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 12));\r
-\r
- jButton.setPreferredSize(new java.awt.Dimension(80, 20));\r
- jButton.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- if (chooser == null) {\r
- chooser = new JFileChooser();\r
- }\r
- //\r
- // disable multi-selection, you can only select one item each time.\r
- //\r
- chooser.setMultiSelectionEnabled(false);\r
- chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);\r
- chooser.setFileFilter(new PkgFileFilter("fdp"));\r
- int retval = chooser.showOpenDialog(frame);\r
- if (retval == JFileChooser.APPROVE_OPTION) {\r
-\r
- File theFile = chooser.getSelectedFile();\r
- jTextField.setText(theFile.getPath());\r
- //\r
- // set a default directory for installation (WORKSPACE\PackageFileName)\r
- //\r
- if (jTextField1.getText().length() > 0) {\r
- int indexbegin = jTextField.getText().lastIndexOf(System.getProperty("file.separator"));\r
- int indexend = jTextField.getText().lastIndexOf('.');\r
- if (indexbegin >= 0 && indexend >= 0) {\r
- jTextField2.setText(jTextField1.getText()\r
- + jTextField.getText().substring(indexbegin, indexend));\r
- } else {\r
- JOptionPane.showMessageDialog(frame, "Wrong Path:" + jTextField.getText());\r
- }\r
- }\r
- }\r
- }\r
- });\r
- }\r
- return jButton;\r
- }\r
-\r
- /**\r
- This method initializes jPanel2 \r
- \r
- @return javax.swing.JPanel \r
- **/\r
- private JPanel getJPanel2() {\r
- if (jPanel2 == null) {\r
- FlowLayout flowLayout1 = new FlowLayout();\r
- flowLayout1.setAlignment(java.awt.FlowLayout.LEFT);\r
- flowLayout1.setVgap(20);\r
- jLabel1 = new JLabel();\r
- jLabel1.setText("Enter Workspace Location");\r
- jLabel1.setComponentOrientation(java.awt.ComponentOrientation.UNKNOWN);\r
- jLabel1.setHorizontalTextPosition(javax.swing.SwingConstants.TRAILING);\r
- jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);\r
- jPanel2 = new JPanel();\r
- jPanel2.setLayout(flowLayout1);\r
- jPanel2.add(jLabel1, null);\r
- }\r
- return jPanel2;\r
- }\r
-\r
- /**\r
- This method initializes jPanel4 \r
- \r
- @return javax.swing.JPanel \r
- **/\r
- private JPanel getJPanel4() {\r
- if (jPanel4 == null) {\r
- FlowLayout flowLayout2 = new FlowLayout();\r
- flowLayout2.setAlignment(java.awt.FlowLayout.LEFT);\r
- jPanel4 = new JPanel();\r
- jPanel4.setLayout(flowLayout2);\r
- jPanel4.add(getJTextField1(), null);\r
- jPanel4.add(getJButton1(), null);\r
- }\r
- return jPanel4;\r
- }\r
-\r
- /**\r
- This method initializes jTextField1 \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextField1() {\r
- if (jTextField1 == null) {\r
- jTextField1 = new JTextField();\r
- jTextField1.setPreferredSize(new java.awt.Dimension(350, 20));\r
-\r
- }\r
- //\r
- // default value is WORKSPACE environmental variable value\r
- //\r
- jTextField1.setText(System.getenv("WORKSPACE"));\r
- return jTextField1;\r
- }\r
-\r
- /**\r
- This method initializes jButton1 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton1() {\r
- if (jButton1 == null) {\r
- jButton1 = new JButton();\r
- jButton1.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT);\r
- \r
- jButton1.setHorizontalAlignment(javax.swing.SwingConstants.LEADING);\r
- jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.TRAILING);\r
- jButton1.setText("Browse");\r
- jButton1.setPreferredSize(new java.awt.Dimension(80, 20));\r
- jButton1.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- if (chooser == null) {\r
- chooser = new JFileChooser();\r
- }\r
- //\r
- // only directories can be selected for workspace location.\r
- //\r
- chooser.setMultiSelectionEnabled(false);\r
- chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);\r
-\r
- int retval = chooser.showOpenDialog(frame);\r
- if (retval == JFileChooser.APPROVE_OPTION) {\r
-\r
- File theFile = chooser.getSelectedFile();\r
- jTextField1.setText(theFile.getPath());\r
- //\r
- // set a default directory for installation (WORKSPACE\PackageFileName)\r
- //\r
- if (jTextField.getText().length() > 0) {\r
- int indexbegin = jTextField.getText().lastIndexOf(System.getProperty("file.separator"));\r
- int indexend = jTextField.getText().lastIndexOf('.');\r
- if (indexbegin >= 0 && indexend >= 0) {\r
- jTextField2.setText(jTextField1.getText()\r
- + jTextField.getText().substring(indexbegin, indexend));\r
- } else {\r
- JOptionPane.showMessageDialog(frame, "Wrong Path:" + jTextField.getText());\r
- }\r
- }\r
- }\r
-\r
- }\r
- });\r
- }\r
- return jButton1;\r
- }\r
-\r
- /**\r
- This method initializes jButton4 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton4() {\r
- if (jButton4 == null) {\r
- jButton4 = new JButton();\r
- jButton4.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);\r
- \r
- jButton4.setHorizontalAlignment(SwingConstants.LEADING);\r
- jButton4.setHorizontalTextPosition(SwingConstants.TRAILING);\r
- jButton4.setText("Browse");\r
- jButton4.setPreferredSize(new Dimension(80, 20));\r
- jButton4.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- JFileChooser chooser = new JFileChooser(jTextField1.getText());\r
- \r
- chooser.setMultiSelectionEnabled(false);\r
- chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);\r
-\r
- int retval = chooser.showOpenDialog(frame);\r
- if (retval == JFileChooser.APPROVE_OPTION) {\r
- //\r
- // specify installation directory from file chooser \r
- //\r
- File theFile = chooser.getSelectedFile();\r
- jTextField2.setText(theFile.getPath());\r
- \r
- }\r
- }\r
- });\r
- \r
- }\r
- return jButton4;\r
- }\r
- /**\r
- This method initializes jPanel5 \r
- \r
- @return javax.swing.JPanel \r
- **/\r
- private JPanel getJPanel5() {\r
- if (jPanel5 == null) {\r
- FlowLayout flowLayout3 = new FlowLayout();\r
- flowLayout3.setAlignment(java.awt.FlowLayout.LEFT);\r
- flowLayout3.setVgap(20);\r
- jLabel2 = new JLabel();\r
- jLabel2.setComponentOrientation(java.awt.ComponentOrientation.UNKNOWN);\r
- jLabel2.setHorizontalTextPosition(javax.swing.SwingConstants.TRAILING);\r
- jLabel2.setText("Enter Installation Location Within Workspace");\r
- jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);\r
- jPanel5 = new JPanel();\r
- jPanel5.setLayout(flowLayout3);\r
- jPanel5.add(jLabel2, null);\r
- }\r
- return jPanel5;\r
- }\r
-\r
- /**\r
- This method initializes jPanel6 \r
- \r
- @return javax.swing.JPanel \r
- **/\r
- private JPanel getJPanel6() {\r
- if (jPanel6 == null) {\r
- FlowLayout flowLayout4 = new FlowLayout();\r
- flowLayout4.setAlignment(java.awt.FlowLayout.LEFT);\r
- jPanel6 = new JPanel();\r
- jPanel6.setLayout(flowLayout4);\r
- jPanel6.add(getJTextField2(), null);\r
- jPanel6.add(getJButton4(), null);\r
- }\r
- return jPanel6;\r
- }\r
-\r
- /**\r
- This method initializes jPanel7 \r
- \r
- @return javax.swing.JPanel \r
- **/\r
- private JPanel getJPanel7() {\r
- if (jPanel7 == null) {\r
- FlowLayout flowLayout5 = new FlowLayout();\r
- flowLayout5.setAlignment(java.awt.FlowLayout.RIGHT);\r
- jPanel7 = new JPanel();\r
- jPanel7.setLayout(flowLayout5);\r
- jPanel7.add(getJProgressBar(), null);\r
- jPanel7.add(getJButton2(), null);\r
- jPanel7.add(getJButton3(), null);\r
- }\r
- return jPanel7;\r
- }\r
-\r
- /**\r
- This method initializes jTextField2 \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextField2() {\r
- if (jTextField2 == null) {\r
- jTextField2 = new JTextField();\r
- jTextField2.setPreferredSize(new java.awt.Dimension(350, 20));\r
- }\r
- return jTextField2;\r
- }\r
-\r
- /**\r
- This method initializes jButton2 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton2() {\r
- if (jButton2 == null) {\r
- jButton2 = new JButton();\r
- jButton2.setPreferredSize(new java.awt.Dimension(80, 20));\r
- jButton2.setText("Ok");\r
- jButton2.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- try {\r
- //\r
- // The installation directory must under workspace directory\r
- //\r
- locationcheck(jTextField.getText(), jTextField1.getText(), jTextField2.getText());\r
- } catch (Exception ee) {\r
- JOptionPane.showMessageDialog(frame, "Package Location Error!");\r
- return;\r
- }\r
- \r
- try {\r
- //\r
- // create a new FrameworkPkg object with user-selected package, current workspace location.\r
- // install the package to dest dir from jTextField2\r
- //\r
- int i = new FrameworkPkg(jTextField.getText(), jTextField1.getText())\r
- .install(jTextField2\r
- .getText());\r
- //\r
- // the package is installed smoothly\r
- //\r
- if (i == 0) {\r
- JOptionPane.showMessageDialog(frame, "Package" + jTextField.getText()\r
- + " Installed Successfully!");\r
- }\r
- } catch (BasePkgNotInstalled bpni) {\r
- //\r
- // exception no base package installed\r
- //\r
- JOptionPane\r
- .showMessageDialog(frame,\r
- "The Edk package needs to be installed before installing any other packages.");\r
- } catch (VerNotEqual vne) {\r
- //\r
- // show modal GUI PkgInstallTypeChooser with user selected package name, \r
- // current workspace location and the list of package info with same base name\r
- //\r
- ModalFrameUtil.showAsModal(new PkgInstallTypeChooser(jTextField.getText(),\r
- jTextField1.getText(), vne.getVersion()),\r
- pThis);\r
-\r
- } catch (GuidNotEqual gne) {\r
- //\r
- // show modal GUI PkgInstallTypeChooser with user selected package name, \r
- // current workspace location and the list of package info with same base name and version\r
- //\r
- ModalFrameUtil.showAsModal(new PkgInstallTypeChooser(jTextField.getText(),\r
- jTextField1.getText(), gne.getGuid()),\r
- pThis);\r
-\r
- } catch (SameAll sa) {\r
- //\r
- // the package with same (base, version, guid) already exists. confirm user action.\r
- // quit or replace the original info. (So only one package info entry in db file that may be triple same)\r
- //\r
- int retVal = JOptionPane\r
- .showConfirmDialog(\r
- frame,\r
- "Package already exists. Would you like to replace it?",\r
- "Package Installation", JOptionPane.YES_NO_OPTION);\r
- if (retVal == JOptionPane.YES_OPTION) {\r
- String installDir = sa.getVersion().listIterator().next().getPathArray(0).getStringValue();\r
- try {\r
- ForceInstallPkg f = new ForceInstallPkg(jTextField.getText(), jTextField1.getText());\r
- //\r
- // Get old packag info to meet the calling parameter layout of DbFileContents.updatePkgInfo\r
- // ForceInstallPkg will call it after installation to update package info.\r
- //\r
- f.setOldVersion(sa.getVersion().listIterator().next().getVersionArray(0));\r
- f.setOldGuid(sa.getVersion().listIterator().next().getGuidArray(0).getStringValue());\r
- int i = f.install(jTextField1.getText() + System.getProperty("file.separator") + installDir);\r
- if (i == 0) {\r
- JOptionPane.showMessageDialog(frame, "Package" + jTextField.getText()\r
- + " Installed Successfully!");\r
- }\r
- } catch (Exception sae) {\r
- System.out.println(sae.toString());\r
- JOptionPane.showMessageDialog(frame, "Extraction Error!");\r
- }\r
- }\r
- return;\r
- } catch (XmlException xmle) {\r
- System.out.println(xmle.toString());\r
- JOptionPane.showMessageDialog(frame, "Package Format Error!");\r
- } catch (DirSame ds) {\r
- //\r
- // You cannot install different packages into the same directory.\r
- //\r
- System.out.println(ds.toString());\r
- JOptionPane.showMessageDialog(frame,\r
- "Another Package Exists There, Please Select Another Directory!");\r
- } catch (Exception ext) {\r
- System.out.println(ext.toString());\r
- JOptionPane.showMessageDialog(frame, "Extraction Error!");\r
- }\r
- }\r
- });\r
- }\r
- return jButton2;\r
- }\r
-\r
- /**\r
- * This method initializes jButton3 \r
- * \r
- * @return javax.swing.JButton \r
- */\r
- private JButton getJButton3() {\r
- if (jButton3 == null) {\r
- jButton3 = new JButton();\r
- jButton3.setPreferredSize(new java.awt.Dimension(80, 20));\r
- jButton3.setText("Cancel");\r
- jButton3.addMouseListener(this);\r
- }\r
- return jButton3;\r
-\r
- }\r
-\r
- /**\r
- This method initializes jPanel3 \r
- \r
- @return javax.swing.JPanel \r
- */\r
- private JPanel getJPanel3() {\r
- if (jPanel3 == null) {\r
- jLabel = new JLabel();\r
- jLabel.setComponentOrientation(ComponentOrientation.UNKNOWN);\r
- jLabel.setHorizontalTextPosition(SwingConstants.TRAILING);\r
- jLabel.setText("Enter Package Location");\r
- jLabel.setHorizontalAlignment(SwingConstants.TRAILING);\r
- FlowLayout flowLayout6 = new FlowLayout();\r
- flowLayout6.setVgap(20);\r
- flowLayout6.setAlignment(FlowLayout.LEFT);\r
- jPanel3 = new JPanel();\r
- jPanel3.setLayout(flowLayout6);\r
- jPanel3.add(jLabel, null);\r
- }\r
- return jPanel3;\r
- }\r
-\r
- /**\r
- check user input validity\r
- \r
- @param s package path\r
- @param s1 workspace path\r
- @param s2 installation path\r
- @throws Exception\r
- **/\r
- private void locationcheck(String s, String s1, String s2) throws Exception {\r
- if (new File(s).isFile() == false)\r
- throw new Exception();\r
- if (new File(s1).isDirectory() == false)\r
- throw new Exception();\r
- if (s2.startsWith(s1) == false)\r
- throw new Exception();\r
- }\r
-\r
- \r
- public void mouseClicked(MouseEvent arg0) {\r
- // TODO Auto-generated method stub\r
- int retVal = JOptionPane.showConfirmDialog(frame, "Are you sure to exit?", "Quit", JOptionPane.YES_NO_OPTION);\r
- if (retVal == JOptionPane.YES_OPTION) {\r
- this.dispose();\r
- }\r
- return;\r
- }\r
-\r
- public void mouseEntered(MouseEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public void mouseExited(MouseEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public void mousePressed(MouseEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public void mouseReleased(MouseEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- /**\r
- This method initializes jProgressBar \r
- \r
- @return javax.swing.JProgressBar \r
- **/\r
- private JProgressBar getJProgressBar() {\r
- if (jProgressBar == null) {\r
- jProgressBar = new JProgressBar();\r
- jProgressBar.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT);\r
- jProgressBar.setVisible(false);\r
- }\r
- return jProgressBar;\r
- }\r
-\r
- \r
-\r
-} // @jve:decl-index=0:visual-constraint="24,82"\r
-\r
-/**\r
-Derived from WindowAdapter, Event adapter for windowClosing event\r
- \r
-@since PackageEditor 1.0\r
-**/\r
-class GuiPkgInstallAdapter extends WindowAdapter {\r
-\r
- private JFrame frame = null;\r
-\r
- GuiPkgInstallAdapter(JFrame f) {\r
- super();\r
- frame = f;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.WindowAdapter#windowClosing(java.awt.event.WindowEvent)\r
- */\r
- @Override\r
- public void windowClosing(WindowEvent arg0) {\r
- // TODO Auto-generated method stub\r
- super.windowClosing(arg0);\r
- int retVal = JOptionPane.showConfirmDialog(frame, "Are you sure to exit?", "Quit",\r
- JOptionPane.YES_NO_OPTION);\r
- if (retVal == JOptionPane.YES_OPTION) {\r
- frame.dispose();\r
- }\r
-\r
- }\r
-\r
-}\r
-\r
-/**\r
- Filter out some specific type of file\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-class PkgFileFilter extends FileFilter {\r
-\r
- ///\r
- /// hash table used to store filter info.\r
- ///\r
- private Hashtable<String, String> filters = null;\r
- \r
-\r
- public PkgFileFilter() {\r
- this.filters = new Hashtable<String, String>();\r
- }\r
- \r
- /**\r
- Create filter and add extension to hash table\r
- \r
- @param extension file extension string (e.g. "exe")\r
- **/\r
- public PkgFileFilter(String extension) {\r
- this();\r
- if(extension!=null) {\r
- addExtension(extension);\r
- }\r
- \r
- }\r
-\r
- public PkgFileFilter(String[] fileFilters) {\r
- this();\r
- int i = 0; \r
- while (i < fileFilters.length) {\r
- // add filters one by one\r
- addExtension(fileFilters[i]);\r
- i++;\r
- }\r
- \r
- }\r
-\r
- \r
- /* (non-Javadoc)\r
- * @see javax.swing.filechooser.FileFilter#accept(java.io.File)\r
- */\r
- public boolean accept(File f) {\r
- if (f != null) {\r
- if (f.isDirectory()) {\r
- return true;\r
- }\r
- \r
- if (getExtension(f) != null && filters.get(getExtension(f)) != null) {\r
- return true;\r
- }\r
- }\r
- return false;\r
- }\r
-\r
- \r
- /**\r
- Get the extension string of file\r
- \r
- @param f target file\r
- @return String\r
- **/\r
- public String getExtension(File f) {\r
- if (f != null) {\r
- int i = f.getName().lastIndexOf('.');\r
- if (i>0 && i<f.getName().length()-1) {\r
- return f.getName().substring(i+1).toLowerCase();\r
- }\r
- }\r
- return null;\r
- }\r
-\r
- \r
- /**\r
- Add extension info into hash table\r
- \r
- @param ext extension string for file name\r
- **/\r
- public void addExtension(String ext) {\r
- if (filters == null) {\r
- filters = new Hashtable<String, String>(5);\r
- }\r
- filters.put(ext.toLowerCase(), "ext");\r
- \r
- }\r
- \r
- /* (non-Javadoc)\r
- * @see javax.swing.filechooser.FileFilter#getDescription()\r
- */\r
- public String getDescription() {\r
- return null;\r
- }\r
-\r
-}\r
-\r
+++ /dev/null
-/** @file\r
- Java class GuiPkgUninstall is GUI for package installation.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import javax.swing.JPanel;\r
-import javax.swing.JFrame;\r
-import java.awt.FlowLayout;\r
-//import java.awt.GridLayout;\r
-import javax.swing.JLabel;\r
-import javax.swing.JTextField;\r
-import java.awt.Dimension;\r
-import javax.swing.JButton;\r
-import java.awt.ComponentOrientation;\r
-import java.awt.Font;\r
-import java.awt.Toolkit;\r
-import java.io.File;\r
-\r
-import javax.swing.JFileChooser;\r
-import javax.swing.JOptionPane;\r
-import javax.swing.SwingConstants;\r
-import javax.swing.JList;\r
-import javax.swing.JTextPane;\r
-import javax.swing.JScrollPane;\r
-import javax.swing.JTable;\r
-import javax.swing.table.DefaultTableModel;\r
-\r
-/**\r
- GUI for package uninstallation.\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class GuiPkgUninstall extends JFrame {\r
-\r
- final static long serialVersionUID = 0;\r
- \r
- static JFrame frame;\r
-\r
- private JPanel jPanel = null;\r
-\r
- private JLabel jLabel = null;\r
-\r
- private JTextField jTextField = null;\r
-\r
- private JButton jButton = null;\r
-\r
- private JLabel jLabel1 = null;\r
-\r
- private JPanel jPanel1 = null;\r
-\r
- private JButton jButton1 = null;\r
-\r
- private JButton jButton2 = null;\r
-\r
- private JScrollPane jScrollPane = null;\r
-\r
- private JTable jTable = null;\r
-\r
- private JButton jButton3 = null;\r
- \r
- private PkgRemoveTableModel model = null;\r
- \r
- private DbFileContents dfc = null;\r
- \r
- private JFrame pThis = null;\r
-\r
- \r
- public GuiPkgUninstall() {\r
- super();\r
- initialize();\r
- }\r
-\r
- \r
- private void initialize() {\r
- this.setSize(481, 404);\r
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
- this.setContentPane(getJPanel());\r
- this.setTitle("Package Uninstallation");\r
- this.centerWindow();\r
- pThis = this;\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
-\r
- /**\r
- initialize table contents from db file\r
- \r
- @param f FrameworkDatabase.db file under workspace\r
- **/\r
- protected void loadDB(File f) {\r
- if (!f.exists()) {\r
- JOptionPane.showMessageDialog(frame,\r
- "No FrameworkDatabase.db File!");\r
- return;\r
- }\r
- dfc = new DbFileContents(f);\r
- if (dfc.getPackageCount() == 0) {\r
- return;\r
- }\r
- //\r
- // Get package list info. and add them one by one into table\r
- //\r
- String[][] saa = new String[dfc.getPackageCount()][5];\r
- dfc.getPackageList(saa);\r
- int i = 0;\r
- while (i < saa.length) {\r
- model.addRow(saa[i]);\r
- i++;\r
- }\r
- \r
- }\r
- /**\r
- save package info. from table to db file\r
- **/\r
- protected void save() {\r
- dfc.removePackageList();\r
- int rowCount = jTable.getRowCount();\r
- int i = 0;\r
- while (i < rowCount) {\r
- \r
- dfc.genPackage(jTable.getValueAt(i, 0).toString(), jTable.getValueAt(i, 1).toString(),\r
- jTable.getValueAt(i, 2).toString(), jTable.getValueAt(i, 3).toString(),\r
- jTable.getValueAt(i, 4).toString());\r
- i++;\r
- }\r
- dfc.saveAs();\r
- }\r
- \r
- private JPanel getJPanel() {\r
- if (jPanel == null) {\r
- jLabel1 = new JLabel();\r
- jLabel1.setBounds(new java.awt.Rectangle(20, 83, 141, 16));\r
- jLabel1.setText(" Packages Installed");\r
- jLabel = new JLabel();\r
- jLabel.setBounds(new java.awt.Rectangle(17, 16, 171, 16));\r
- jLabel.setText(" Enter Workspace Location");\r
- jPanel = new JPanel();\r
- jPanel.setLayout(null);\r
- jPanel.add(jLabel, null);\r
- jPanel.add(getJTextField(), null);\r
- jPanel.add(getJButton(), null);\r
- jPanel.add(jLabel1, null);\r
- jPanel.add(getJPanel1(), null);\r
- jPanel.add(getJScrollPane(), null);\r
- }\r
- return jPanel;\r
- }\r
-\r
- /**\r
- This method initializes jTextField \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextField() {\r
- if (jTextField == null) {\r
- jTextField = new JTextField();\r
- jTextField.setBounds(new java.awt.Rectangle(16, 41, 350, 20));\r
- jTextField.setHorizontalAlignment(JTextField.LEFT);\r
- jTextField.setEditable(false);\r
- jTextField.setText(System.getenv("WORKSPACE"));\r
- jTextField.setPreferredSize(new Dimension(350, 20));\r
- }\r
- return jTextField;\r
- }\r
-\r
- /**\r
- This method initializes jButton \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton() {\r
- if (jButton == null) {\r
- jButton = new JButton();\r
- jButton.setBounds(new java.awt.Rectangle(372,40,78,20));\r
- jButton.setFont(new Font("Dialog", Font.BOLD, 12));\r
- jButton.setPreferredSize(new Dimension(80, 20));\r
- jButton.setToolTipText("Where is the package?");\r
- jButton.setHorizontalAlignment(SwingConstants.LEFT);\r
- jButton.setHorizontalTextPosition(SwingConstants.CENTER);\r
- jButton.setText("Browse");\r
- jButton.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- //\r
- // user can select another workspace directory\r
- //\r
- JFileChooser chooser = new JFileChooser();\r
- chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);\r
- chooser.setMultiSelectionEnabled(false);\r
- int retval = chooser.showOpenDialog(frame);\r
- if (retval == JFileChooser.APPROVE_OPTION) {\r
- //\r
- // update table when user selects a new workspace directory\r
- //\r
- jTextField.setText(chooser.getSelectedFile().getPath());\r
- File f = new File(chooser.getSelectedFile(), FrameworkPkg.dbConfigFile);\r
- loadDB(f);\r
- }\r
- }\r
- });\r
- }\r
- return jButton;\r
- }\r
-\r
- /**\r
- This method initializes jPanel1 \r
- \r
- @return javax.swing.JPanel \r
- **/\r
- private JPanel getJPanel1() {\r
- if (jPanel1 == null) {\r
- FlowLayout flowLayout = new FlowLayout();\r
- flowLayout.setAlignment(java.awt.FlowLayout.LEFT);\r
- flowLayout.setHgap(20);\r
- jPanel1 = new JPanel();\r
- jPanel1.setLayout(flowLayout);\r
- jPanel1.setBounds(new java.awt.Rectangle(133,310,318,53));\r
- jPanel1.add(getJButton3(), null);\r
- jPanel1.add(getJButton1(), null);\r
- jPanel1.add(getJButton2(), null);\r
- }\r
- return jPanel1;\r
- }\r
-\r
- /**\r
- This method initializes jButton1 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton1() {\r
- if (jButton1 == null) {\r
- jButton1 = new JButton();\r
- jButton1.setPreferredSize(new java.awt.Dimension(85, 20));\r
- jButton1.setText("Ok");\r
- jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);\r
- jButton1.setEnabled(true);\r
- jButton1.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- if (dfc != null) {\r
- //\r
- // save package info. to file before exit\r
- //\r
- save();\r
- }\r
- pThis.dispose();\r
- }\r
- });\r
- }\r
- return jButton1;\r
- }\r
-\r
- /**\r
- This method initializes jButton2 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton2() {\r
- if (jButton2 == null) {\r
- jButton2 = new JButton();\r
- jButton2.setPreferredSize(new java.awt.Dimension(85, 20));\r
- jButton2.setText("Cancel");\r
- jButton2.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- pThis.dispose();\r
- }\r
- });\r
- }\r
- return jButton2;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPane \r
- \r
- @return javax.swing.JScrollPane \r
- **/\r
- private JScrollPane getJScrollPane() {\r
- if (jScrollPane == null) {\r
- jScrollPane = new JScrollPane();\r
- jScrollPane.setBounds(new java.awt.Rectangle(20,108,431,194));\r
- jScrollPane.setViewportView(getJTable());\r
- }\r
- return jScrollPane;\r
- }\r
-\r
- /**\r
- This method initializes jTable \r
- \r
- @return javax.swing.JTable \r
- **/\r
- private JTable getJTable() {\r
- if (jTable == null) {\r
- model = new PkgRemoveTableModel();\r
- jTable = new JTable(model);\r
- jTable.setRowHeight(20);\r
- jTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);\r
- jTable.setRowSelectionAllowed(true);\r
- model.addColumn("PackageName");\r
- model.addColumn("Version");\r
- model.addColumn("GUID");\r
- model.addColumn("Path");\r
- model.addColumn("InstallDate");\r
- File f = new File(jTextField.getText(), FrameworkPkg.dbConfigFile);\r
- loadDB(f);\r
- }\r
- return jTable;\r
- }\r
-\r
- /**\r
- This method initializes jButton3 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton3() {\r
- if (jButton3 == null) {\r
- jButton3 = new JButton();\r
- jButton3.setText("Remove");\r
- jButton3.setPreferredSize(new java.awt.Dimension(85,20));\r
- jButton3.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- if (model != null){\r
- int index = jTable.getSelectedRow();\r
- if (index > -1) {\r
- model.removeRow(index);\r
- }\r
- }\r
- }\r
- });\r
- }\r
- return jButton3;\r
- }\r
-\r
-} // @jve:decl-index=0:visual-constraint="10,10"\r
-\r
-/**\r
- Derived table model which disables table edit\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-class PkgRemoveTableModel extends DefaultTableModel {\r
- PkgRemoveTableModel() {\r
- super();\r
- }\r
- \r
- public boolean isCellEditable (int row, int col) {\r
- return false;\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- Java class GuidEditor.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import java.awt.Component;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ActionListener;\r
-\r
-import javax.swing.AbstractCellEditor;\r
-import javax.swing.JButton;\r
-import javax.swing.JFrame;\r
-import javax.swing.JOptionPane;\r
-import javax.swing.JTable;\r
-import javax.swing.table.TableCellEditor;\r
-\r
-import org.tianocore.common.Tools;\r
-\r
-/**\r
- Editor for table cell with GUID value.\r
- @since PackageEditor 1.0\r
- **/\r
-public class GuidEditor extends AbstractCellEditor implements TableCellEditor, ActionListener {\r
-\r
- String currentGuid;\r
- JButton button;\r
- static JFrame frame;\r
- GenGuidDialog dialog;\r
- protected static final String EDIT = "edit";\r
-\r
- public GuidEditor() {\r
- \r
- button = new JButton();\r
- button.setActionCommand(EDIT);\r
- button.addActionListener(this);\r
- button.setBorderPainted(false);\r
-\r
- \r
- dialog = new GenGuidDialog(this);\r
- \r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see javax.swing.table.TableCellEditor#getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int)\r
- */\r
- public Component getTableCellEditorComponent(JTable arg0, Object arg1, boolean arg2, int arg3, int arg4) {\r
- // TODO Auto-generated method stub\r
- currentGuid = (String)arg1;\r
- return button;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see javax.swing.CellEditor#getCellEditorValue()\r
- */\r
- public Object getCellEditorValue() {\r
- // TODO Auto-generated method stub\r
- return currentGuid;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- // TODO Auto-generated method stub\r
- if (EDIT.equals(arg0.getActionCommand())) {\r
- //The user has clicked the cell, so\r
- //bring up the dialog.\r
- button.setText(currentGuid);\r
- dialog.setGuid(currentGuid);\r
- dialog.setVisible(true);\r
-\r
- //Make the renderer reappear.\r
- fireEditingStopped();\r
- }\r
- else { //User pressed dialog's "OK" button.\r
- currentGuid = dialog.getGuid();\r
-\r
- }\r
-\r
- }\r
-\r
-}\r
+++ /dev/null
-/** @file\r
- Java class ManifestContents is used to deal with FDPManifest.xml file related\r
- operations.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import org.apache.xmlbeans.XmlException;\r
-\r
-import org.tianocore.*;\r
-import java.io.*;\r
-\r
-/**\r
- This class operates on FDPManifest.xml file\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class ManifestContents {\r
-\r
- ///\r
- /// it is more convenient to get input stream from Jar entry of to-be-installed package file.\r
- /// so i use InputStream instead of File\r
- ///\r
- private InputStream manIs = null;\r
-\r
- FrameworkDevPkgManifestDocument manDoc = null;\r
-\r
- HeaderDocument hdr = null;\r
-\r
- FrameworkDevPkgManifestDocument.FrameworkDevPkgManifest manRoot = null;\r
-\r
- public ManifestContents(InputStream fis) throws XmlException, IOException {\r
-\r
- manIs = fis;\r
- manDoc = FrameworkDevPkgManifestDocument.Factory.parse(manIs);\r
- manRoot = manDoc.getFrameworkDevPkgManifest();\r
-\r
- }\r
-\r
- /**\r
- Get package name from manifest file header.\r
- \r
- @return String\r
- **/\r
- public String getBaseName() {\r
- return manRoot.getHeader().getPackageName().getStringValue();\r
- }\r
-\r
- /**\r
- Get package version from manifest file header.\r
- \r
- @return String\r
- **/\r
- public String getVersion() {\r
- return manRoot.getHeader().getVersion();\r
- }\r
-\r
- /**\r
- Get package GUID from manifest file header.\r
- \r
- @return String\r
- **/\r
- public String getGuid() {\r
- return manRoot.getHeader().getGuid().getStringValue();\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- Java class ModalFrameUtil is used to show modal frame.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import javax.swing.*;\r
-import java.awt.*;\r
-import java.awt.event.WindowAdapter;\r
-import java.awt.event.WindowEvent;\r
-import java.lang.reflect.InvocationHandler;\r
-import java.lang.reflect.Method;\r
-import java.lang.reflect.Proxy;\r
-\r
-/**\r
- This class is used to show modal frame.\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class ModalFrameUtil {\r
- /**\r
- Invocation handler for event threads\r
- \r
- @since PackageEditor 1.0\r
- **/\r
- static class EventPump implements InvocationHandler {\r
- Frame frame;\r
-\r
- public EventPump(Frame frame) {\r
- this.frame = frame;\r
- }\r
-\r
- /**\r
- Invocation handler invoked by Method.invoke\r
- **/\r
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {\r
- //\r
- // return frame showing status for Conditional.evaluate()\r
- //\r
- return frame.isShowing() ? Boolean.TRUE : Boolean.FALSE;\r
- }\r
-\r
- public void start() throws Exception {\r
- Class clazz = Class.forName("java.awt.Conditional");\r
- //\r
- // Conditional proxy instance will invoke "this" InvocationHandler.invoke when calling its methods\r
- //\r
- Object conditional = Proxy.newProxyInstance(clazz.getClassLoader(), new Class[] { clazz }, this);\r
- //\r
- // EventDisaptchThread.pumpEvents will be called under Conditional "conditional"\r
- //\r
- Method pumpMethod = Class.forName("java.awt.EventDispatchThread").getDeclaredMethod("pumpEvents",\r
- new Class[] { clazz });\r
- pumpMethod.setAccessible(true);\r
- //\r
- // pumpEvents when conditional.evaluate() == true (frame.isShowing() in EventPump.invoke)\r
- //\r
- pumpMethod.invoke(Thread.currentThread(), new Object[] { conditional });\r
- }\r
- }\r
-\r
- /**\r
- Show modal frame, return only when frame closed.\r
- \r
- @param frame Frame to be modal\r
- @param owner Parent Frame\r
- **/\r
- public static void showAsModal(final Frame frame, final Frame owner) {\r
- frame.addWindowListener(new WindowAdapter() {\r
- public void windowOpened(WindowEvent e) {\r
- owner.setEnabled(false);\r
- }\r
-\r
- public void windowClosed(WindowEvent e) {\r
- owner.setEnabled(true);\r
- owner.setVisible(true);\r
- owner.removeWindowListener(this);\r
- }\r
- });\r
-\r
- owner.addWindowListener(new WindowAdapter() {\r
- public void windowActivated(WindowEvent e) {\r
- if (frame.isShowing()) {\r
- frame.setExtendedState(JFrame.NORMAL);\r
- frame.toFront();\r
- } else {\r
- owner.removeWindowListener(this);\r
- }\r
- }\r
- });\r
-\r
- frame.setVisible(true);\r
- try {\r
- new EventPump(frame).start();\r
- } catch (Throwable throwable) {\r
- throw new RuntimeException(throwable);\r
- }\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- Java class PackageAction is GUI for create spd file.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import java.awt.BorderLayout;\r
-import java.awt.Dimension;\r
-import java.awt.Toolkit;\r
-\r
-import javax.swing.JFileChooser;\r
-import javax.swing.JOptionPane;\r
-import javax.swing.JPanel;\r
-import javax.swing.JFrame;\r
-import java.awt.GridLayout;\r
-import java.io.File;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.filechooser.FileFilter;\r
-\r
-/**\r
- GUI for create spd file\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class PackageAction extends JFrame {\r
-\r
- static JFrame frame;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JButton jButton = null;\r
-\r
- private JButton jButton1 = null;\r
-\r
- private JButton jButton2 = null;\r
-\r
- private JButton jButton3 = null;\r
-\r
- private JButton jButton4 = null;\r
-\r
- private JButton jButton5 = null;\r
-\r
- private JButton jButton6 = null;\r
-\r
- private JButton jButton7 = null;\r
-\r
- ///\r
- /// SpdFileContents object passed from main\r
- ///\r
- private SpdFileContents sfc = null;\r
-\r
- private JFrame pThis = null; // @jve:decl-index=0:visual-constraint="304,10"\r
-\r
- private JButton jButton8 = null;\r
-\r
- private JButton jButton9 = null; // @jve:decl-index=0:visual-constraint="116,388"\r
-\r
- /**\r
- This is the default constructor\r
- **/\r
- public PackageAction(SpdFileContents sfc) {\r
- super();\r
- initialize();\r
- this.sfc = sfc;\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @return void\r
- **/\r
- private void initialize() {\r
- this.setSize(305, 385);\r
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Please Choose an Action");\r
- this.centerWindow();\r
- this.pThis = this;\r
- \r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel\r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- GridLayout gridLayout = new GridLayout();\r
- gridLayout.setRows(10);\r
- gridLayout.setColumns(1);\r
- jContentPane = new JPanel();\r
- jContentPane.setPreferredSize(new java.awt.Dimension(200,300));\r
- jContentPane.setLayout(gridLayout);\r
- jContentPane.add(getJButton8(), null);\r
- jContentPane.add(getJButton7(), null);\r
- jContentPane.add(getJButton6(), null);\r
- jContentPane.add(getJButton5(), null);\r
- jContentPane.add(getJButton4(), null);\r
- jContentPane.add(getJButton3(), null);\r
- jContentPane.add(getJButton2(), null);\r
- jContentPane.add(getJButton1(), null);\r
- jContentPane.add(getJButton(), null);\r
- jContentPane.add(getJButton9(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes jButton \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton() {\r
- final FileFilter filter = new PkgFileFilter("spd");\r
- \r
- if (jButton == null) {\r
- jButton = new JButton();\r
- jButton.setText("Save");\r
- jButton.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- //\r
- // save sfc contents to file\r
- //\r
- JFileChooser chooser = new JFileChooser(PackagingMain.dirForNewSpd);\r
- chooser.setMultiSelectionEnabled(false);\r
- chooser.setFileFilter(filter);\r
-\r
- int retval = chooser.showSaveDialog(frame);\r
- if (retval == JFileChooser.APPROVE_OPTION) {\r
- try {\r
- File theFile = chooser.getSelectedFile();\r
- if (theFile.exists()) {\r
- int retVal = JOptionPane.showConfirmDialog(frame, "Are you sure to replace the exising one?", "File Exists",\r
- JOptionPane.YES_NO_OPTION);\r
- if (retVal == JOptionPane.NO_OPTION) {\r
- return;\r
- } \r
- }\r
- sfc.saveAs(theFile);\r
-\r
- } catch (Exception ee) {\r
- System.out.println(ee.toString());\r
- }\r
-// pThis.dispose();\r
- }\r
-\r
- }\r
- });\r
- }\r
- return jButton;\r
- }\r
-\r
- /**\r
- This method initializes jButton1 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton1() {\r
- if (jButton1 == null) {\r
- jButton1 = new JButton();\r
- jButton1.setText("Add PCD Information");\r
- jButton1.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- //\r
- // Add PCD frame show modal\r
- //\r
- ModalFrameUtil.showAsModal(new PackagePCD(sfc), pThis);\r
- }\r
- });\r
- }\r
- return jButton1;\r
- }\r
-\r
- /**\r
- This method initializes jButton2 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton2() {\r
- if (jButton2 == null) {\r
- jButton2 = new JButton();\r
- jButton2.setText("Add PPI Declarations");\r
- jButton2.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- //\r
- // Add PPI frame show modal\r
- //\r
- ModalFrameUtil.showAsModal(new PackagePpi(sfc), pThis);\r
- }\r
- });\r
- }\r
- return jButton2;\r
- }\r
-\r
- /**\r
- This method initializes jButton3 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton3() {\r
- if (jButton3 == null) {\r
- jButton3 = new JButton();\r
- jButton3.setText("Add Protocol Declarations");\r
- jButton3.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- ModalFrameUtil.showAsModal(new PackageProtocols(sfc), pThis);\r
- }\r
- });\r
- }\r
- return jButton3;\r
- }\r
-\r
- /**\r
- This method initializes jButton4 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton4() {\r
- if (jButton4 == null) {\r
- jButton4 = new JButton();\r
- jButton4.setText("Add GUID Declarations");\r
- jButton4.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- ModalFrameUtil.showAsModal(new PackageGuids(sfc), pThis);\r
- }\r
- });\r
- }\r
- return jButton4;\r
- }\r
-\r
- /**\r
- This method initializes jButton5 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton5() {\r
- if (jButton5 == null) {\r
- jButton5 = new JButton();\r
- jButton5.setText("Add Package Headers");\r
- jButton5.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- ModalFrameUtil.showAsModal(new PackagePkgHeader(sfc), pThis);\r
- }\r
- });\r
- }\r
- return jButton5;\r
- }\r
-\r
- /**\r
- This method initializes jButton6 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton6() {\r
- if (jButton6 == null) {\r
- jButton6 = new JButton();\r
- jButton6.setText("Add MSA Files");\r
- jButton6.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- ModalFrameUtil.showAsModal(new PackageMsaFile(sfc), pThis);\r
- }\r
- });\r
- }\r
- return jButton6;\r
- }\r
-\r
- /**\r
- This method initializes jButton7 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton7() {\r
- if (jButton7 == null) {\r
- jButton7 = new JButton();\r
- jButton7.setText("Add Library Classes");\r
- jButton7.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- ModalFrameUtil.showAsModal(new PackageLibraryClass(sfc), pThis);\r
- }\r
- });\r
- }\r
- return jButton7;\r
- }\r
-\r
- /**\r
- This method initializes jButton8 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton8() {\r
- if (jButton8 == null) {\r
- jButton8 = new JButton();\r
- jButton8.setText("Add SPD Header");\r
- jButton8.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- ModalFrameUtil.showAsModal(new PackageNew(sfc), pThis);\r
- }\r
- });\r
- }\r
- return jButton8;\r
- }\r
-\r
- /**\r
- This method initializes jButton9 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton9() {\r
- if (jButton9 == null) {\r
- jButton9 = new JButton();\r
- jButton9.setText("Done");\r
- jButton9.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- //\r
- // quit current frame\r
- //\r
- pThis.dispose();\r
- \r
- }\r
- });\r
- }\r
- return jButton9;\r
- }\r
-\r
-} // @jve:decl-index=0:visual-constraint="104,41"\r
+++ /dev/null
-/** @file\r
- Java class PackageGuids is GUI for create GUID elements of spd file.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import java.awt.Dimension;\r
-import java.awt.Toolkit;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ActionListener;\r
-\r
-import javax.swing.DefaultListModel;\r
-import javax.swing.JPanel;\r
-import javax.swing.JLabel;\r
-import javax.swing.JTextField;\r
-import javax.swing.JRadioButton;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JButton;\r
-import javax.swing.JFrame;\r
-\r
-import javax.swing.JScrollPane;\r
-import javax.swing.JList;\r
-\r
-import org.tianocore.common.Tools;\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-\r
-/**\r
- GUI for create GUID elements of spd file\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class PackageGuids extends JFrame implements ActionListener {\r
-\r
- private SpdFileContents sfc = null;\r
-\r
- private static String separator = "::";\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JLabel jLabelC_Name = null;\r
-\r
- private JTextField jTextFieldC_Name = null;\r
-\r
- private JLabel jLabelGuidValue = null;\r
-\r
- private JTextField jTextFieldGuidValue = null;\r
-\r
- private JLabel jLabelHelpText = null;\r
-\r
- private JTextField jTextFieldName = null;\r
-\r
- private JLabel jLabelEnableFeature = null;\r
-\r
- private JRadioButton jRadioButtonEnableFeature = null;\r
-\r
- private JRadioButton jRadioButtonDisableFeature = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JButton jButtonGenerateGuid = null;\r
-\r
- private StarLabel starLabel = null;\r
-\r
- private StarLabel starLabel1 = null;\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void initialize() {\r
- this.setTitle("Guid Declarations");\r
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
-\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldC_Name \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextFieldC_Name() {\r
- if (jTextFieldC_Name == null) {\r
- jTextFieldC_Name = new JTextField();\r
- jTextFieldC_Name.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
- }\r
- return jTextFieldC_Name;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldGuidValsue \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextFieldGuidValsue() {\r
- if (jTextFieldGuidValue == null) {\r
- jTextFieldGuidValue = new JTextField();\r
- jTextFieldGuidValue.setBounds(new java.awt.Rectangle(160, 35, 240, 20));\r
- }\r
- return jTextFieldGuidValue;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldName \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextFieldName() {\r
- if (jTextFieldName == null) {\r
- jTextFieldName = new JTextField();\r
- jTextFieldName.setBounds(new java.awt.Rectangle(160, 70, 320, 20));\r
- }\r
- return jTextFieldName;\r
- }\r
-\r
- /**\r
- This method initializes jRadioButtonEnableFeature \r
- \r
- @return javax.swing.JRadioButton \r
- **/\r
- private JRadioButton getJRadioButtonEnableFeature() {\r
- if (jRadioButtonEnableFeature == null) {\r
- jRadioButtonEnableFeature = new JRadioButton();\r
- jRadioButtonEnableFeature.setText("Enable");\r
- jRadioButtonEnableFeature.setBounds(new java.awt.Rectangle(160, 104, 90, 20));\r
- jRadioButtonEnableFeature.setEnabled(false);\r
- jRadioButtonEnableFeature.setSelected(true);\r
- }\r
- return jRadioButtonEnableFeature;\r
- }\r
-\r
- /**\r
- This method initializes jRadioButtonDisableFeature \r
- \r
- @return javax.swing.JRadioButton \r
- **/\r
- private JRadioButton getJRadioButtonDisableFeature() {\r
- if (jRadioButtonDisableFeature == null) {\r
- jRadioButtonDisableFeature = new JRadioButton();\r
- jRadioButtonDisableFeature.setText("Disable");\r
- jRadioButtonDisableFeature.setEnabled(false);\r
- jRadioButtonDisableFeature.setBounds(new java.awt.Rectangle(250, 104, 90, 20));\r
- }\r
- return jRadioButtonDisableFeature;\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("OK");\r
- jButtonOk.setBounds(new java.awt.Rectangle(300, 240, 75, 20));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 240, 74, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jButtonGenerateGuid \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonGenerateGuid() {\r
- if (jButtonGenerateGuid == null) {\r
- jButtonGenerateGuid = new JButton();\r
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(405, 35, 75, 20));\r
- jButtonGenerateGuid.setText("GEN");\r
- jButtonGenerateGuid.addActionListener(this);\r
- }\r
- return jButtonGenerateGuid;\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- **/\r
- public PackageGuids(SpdFileContents sfc) {\r
- super();\r
- initialize();\r
- init();\r
- this.setVisible(true);\r
- this.sfc = sfc;\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @return void\r
- **/\r
- private void init() {\r
- this.setSize(500, 300);\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Add Guids");\r
- this.centerWindow();\r
- initFrame();\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel\r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- starLabel1 = new StarLabel();\r
- starLabel1.setBounds(new java.awt.Rectangle(5, 34, 10, 20));\r
- starLabel = new StarLabel();\r
- starLabel.setBounds(new java.awt.Rectangle(6, 10, 10, 20));\r
- jLabelEnableFeature = new JLabel();\r
- jLabelEnableFeature.setText("Enable Feature");\r
- jLabelEnableFeature.setEnabled(false);\r
- jLabelEnableFeature.setBounds(new java.awt.Rectangle(15, 104, 140, 20));\r
- jLabelHelpText = new JLabel();\r
- jLabelHelpText.setText("Name");\r
- jLabelHelpText.setBounds(new java.awt.Rectangle(15, 70, 140, 20));\r
- jLabelGuidValue = new JLabel();\r
- jLabelGuidValue.setText("Guid Value");\r
- jLabelGuidValue.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
- jLabelC_Name = new JLabel();\r
- jLabelC_Name.setText("C_Name");\r
- jLabelC_Name.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(jLabelC_Name, null);\r
- jContentPane.add(getJTextFieldC_Name(), null);\r
- jContentPane.add(jLabelGuidValue, null);\r
- jContentPane.add(getJTextFieldGuidValsue(), null);\r
-\r
- jContentPane.add(jLabelHelpText, null);\r
- jContentPane.add(getJTextFieldName(), null);\r
- jContentPane.add(jLabelEnableFeature, null);\r
- jContentPane.add(getJRadioButtonEnableFeature(), null);\r
- jContentPane.add(getJRadioButtonDisableFeature(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJButtonGenerateGuid(), null);\r
-\r
- jContentPane.add(starLabel, null);\r
- jContentPane.add(starLabel1, null);\r
-\r
- initFrame();\r
-\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes events groups and usage type\r
- \r
- **/\r
- private void initFrame() {\r
-\r
- }\r
-\r
- public void actionPerformed(ActionEvent arg0) {\r
- //\r
- // save and exit\r
- //\r
- if (arg0.getSource() == jButtonOk) {\r
-\r
- this.save();\r
- this.dispose();\r
- }\r
- //\r
- // exit\r
- //\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- }\r
- //\r
- // generate a new GUID\r
- //\r
- if (arg0.getSource() == jButtonGenerateGuid) {\r
- jTextFieldGuidValue.setText(Tools.generateUuidString());\r
- }\r
- \r
- if (arg0.getSource() == jRadioButtonEnableFeature) {\r
- if (jRadioButtonEnableFeature.isSelected()) {\r
- jRadioButtonDisableFeature.setSelected(false);\r
- }\r
- if (!jRadioButtonDisableFeature.isSelected() && !jRadioButtonEnableFeature.isSelected()) {\r
- jRadioButtonEnableFeature.setSelected(true);\r
- }\r
- }\r
-\r
- if (arg0.getSource() == jRadioButtonDisableFeature) {\r
- if (jRadioButtonDisableFeature.isSelected()) {\r
- jRadioButtonEnableFeature.setSelected(false);\r
- }\r
- if (!jRadioButtonDisableFeature.isSelected() && !jRadioButtonEnableFeature.isSelected()) {\r
- jRadioButtonDisableFeature.setSelected(true);\r
- }\r
- }\r
- }\r
-\r
- /**\r
- Add GUID entry to SpdFileContents object with element values from jTextFields*\r
- **/\r
- protected void save() {\r
- try {\r
- String strName = jTextFieldName.getText();\r
- String strCName = jTextFieldC_Name.getText();\r
- String strGuid = jTextFieldGuidValue.getText();\r
- sfc.genSpdGuidDeclarations(strName, strCName, strGuid, null);\r
-\r
- } catch (Exception e) {\r
- System.out.println(e.toString());\r
- }\r
- }\r
-} // @jve:decl-index=0:visual-constraint="10,10"\r
+++ /dev/null
-/** @file\r
- Java class PackageLibraryClass is GUI for create library definition elements of spd file.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import java.awt.BorderLayout;\r
-import java.awt.Dimension;\r
-import java.awt.Toolkit;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ActionListener;\r
-import java.io.File;\r
-import java.util.Vector;\r
-\r
-import javax.swing.DefaultListModel;\r
-import javax.swing.JFileChooser;\r
-import javax.swing.JOptionPane;\r
-import javax.swing.JPanel;\r
-import javax.swing.JRadioButton;\r
-import javax.swing.JTextField;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JLabel;\r
-import javax.swing.JList;\r
-import javax.swing.JScrollPane;\r
-import javax.swing.JButton;\r
-import javax.swing.JFrame;\r
-\r
-/**\r
- GUI for create library definition elements of spd file.\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class PackageLibraryClass extends JFrame implements ActionListener {\r
- static JFrame frame;\r
- \r
- private static String Separator = "::";\r
-\r
- private DefaultListModel listItem = new DefaultListModel();\r
-\r
- private SpdFileContents sfc = null;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JRadioButton jRadioButtonAdd = null;\r
-\r
- private JRadioButton jRadioButtonSelect = null;\r
-\r
- private JTextField jTextFieldAdd = null;\r
-\r
- private JComboBox jComboBoxSelect = null;\r
-\r
- private JLabel jLabelUsage = null;\r
-\r
- private JComboBox jComboBoxUsage = null;\r
-\r
- private JScrollPane jScrollPane = null;\r
-\r
- private JList jListLibraryClassDefinitions = null;\r
-\r
- private JButton jButtonAdd = null;\r
-\r
- private JButton jButtonRemove = null;\r
-\r
- private JButton jButtonClearAll = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JLabel jLabel = null;\r
-\r
- private JTextField jTextField = null;\r
-\r
- private JButton jButtonBrowse = null;\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void initialize() {\r
- this.setTitle("Library Declarations");\r
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
-\r
- }\r
-\r
- /**\r
- This method initializes jRadioButtonAdd \r
- \r
- @return javax.swing.JRadioButton \r
- **/\r
- private JRadioButton getJRadioButtonAdd() {\r
- if (jRadioButtonAdd == null) {\r
- jRadioButtonAdd = new JRadioButton();\r
- jRadioButtonAdd.setBounds(new java.awt.Rectangle(10, 35, 205, 20));\r
- jRadioButtonAdd.setText("Add a new Library Class");\r
- jRadioButtonAdd.addActionListener(this);\r
- jRadioButtonAdd.setSelected(false);\r
- }\r
- return jRadioButtonAdd;\r
- }\r
-\r
- /**\r
- This method initializes jRadioButtonSelect \r
- \r
- @return javax.swing.JRadioButton \r
- **/\r
- private JRadioButton getJRadioButtonSelect() {\r
- if (jRadioButtonSelect == null) {\r
- jRadioButtonSelect = new JRadioButton();\r
- jRadioButtonSelect.setBounds(new java.awt.Rectangle(10, 10, 205, 20));\r
- jRadioButtonSelect.setText("Select Existing Library Class");\r
- jRadioButtonSelect.addActionListener(this);\r
- jRadioButtonSelect.setSelected(true);\r
- }\r
- return jRadioButtonSelect;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldAdd \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextFieldAdd() {\r
- if (jTextFieldAdd == null) {\r
- jTextFieldAdd = new JTextField();\r
- jTextFieldAdd.setBounds(new java.awt.Rectangle(220, 35, 260, 20));\r
- jTextFieldAdd.setEnabled(false);\r
- }\r
- return jTextFieldAdd;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxSelect \r
- \r
- @return javax.swing.JComboBox \r
- **/\r
- private JComboBox getJComboBoxSelect() {\r
- if (jComboBoxSelect == null) {\r
- jComboBoxSelect = new JComboBox();\r
- jComboBoxSelect.setBounds(new java.awt.Rectangle(220, 10, 260, 20));\r
- jComboBoxSelect.setEnabled(true);\r
- }\r
- return jComboBoxSelect;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxUsage \r
- \r
- @return javax.swing.JComboBox \r
- **/\r
- private JComboBox getJComboBoxUsage() {\r
- if (jComboBoxUsage == null) {\r
- jComboBoxUsage = new JComboBox();\r
- jComboBoxUsage.setBounds(new java.awt.Rectangle(220, 60, 260, 20));\r
- jComboBoxUsage.setEnabled(false);\r
- }\r
- return jComboBoxUsage;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPane \r
- \r
- @return javax.swing.JScrollPane \r
- **/\r
- private JScrollPane getJScrollPane() {\r
- if (jScrollPane == null) {\r
- jScrollPane = new JScrollPane();\r
- jScrollPane.setBounds(new java.awt.Rectangle(10,149,350,146));\r
- jScrollPane.setViewportView(getJListLibraryClassDefinitions());\r
- }\r
- return jScrollPane;\r
- }\r
-\r
- /**\r
- This method initializes jListLibraryClassDefinitions \r
- \r
- @return javax.swing.JList \r
- **/\r
- private JList getJListLibraryClassDefinitions() {\r
- if (jListLibraryClassDefinitions == null) {\r
- jListLibraryClassDefinitions = new JList(listItem);\r
- }\r
- return jListLibraryClassDefinitions;\r
- }\r
-\r
- /**\r
- This method initializes jButtonAdd \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonAdd() {\r
- if (jButtonAdd == null) {\r
- jButtonAdd = new JButton();\r
- jButtonAdd.setBounds(new java.awt.Rectangle(375,152,90,20));\r
- jButtonAdd.setText("Add");\r
- jButtonAdd.addActionListener(this);\r
- }\r
- return jButtonAdd;\r
- }\r
-\r
- /**\r
- This method initializes jButtonRemove \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonRemove() {\r
- if (jButtonRemove == null) {\r
- jButtonRemove = new JButton();\r
- jButtonRemove.setBounds(new java.awt.Rectangle(375, 230, 90, 20));\r
- jButtonRemove.setText("Remove");\r
- jButtonRemove.addActionListener(this);\r
- }\r
- return jButtonRemove;\r
- }\r
-\r
- /**\r
- This method initializes jButtonRemoveAll \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonClearAll() {\r
- if (jButtonClearAll == null) {\r
- jButtonClearAll = new JButton();\r
- jButtonClearAll.setBounds(new java.awt.Rectangle(375, 260, 90, 20));\r
- jButtonClearAll.setText("Clear All");\r
- jButtonClearAll.addActionListener(this);\r
- }\r
- return jButtonClearAll;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setPreferredSize(new java.awt.Dimension(90, 20));\r
- jButtonCancel.setLocation(new java.awt.Point(390, 305));\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setSize(new java.awt.Dimension(90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jButton \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setSize(new java.awt.Dimension(90, 20));\r
- jButtonOk.setText("OK");\r
- jButtonOk.setLocation(new java.awt.Point(290, 305));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- **/\r
- public PackageLibraryClass(SpdFileContents sfc) {\r
- super();\r
- initialize();\r
- init();\r
- this.sfc = sfc;\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @return void\r
- **/\r
- private void init() {\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Library Class Declarations");\r
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));\r
- this.centerWindow();\r
- initFrame();\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel\r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabel = new JLabel();\r
- jLabel.setBounds(new java.awt.Rectangle(14, 85, 201, 22));\r
- jLabel.setText("Include Header for Selected Class");\r
- jLabelUsage = new JLabel();\r
- jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 200, 20));\r
- jLabelUsage.setEnabled(false);\r
- jLabelUsage.setText("Usage");\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(getJRadioButtonAdd(), null);\r
- jContentPane.add(getJRadioButtonSelect(), null);\r
- jContentPane.add(getJTextFieldAdd(), null);\r
- jContentPane.add(getJComboBoxSelect(), null);\r
- jContentPane.add(jLabelUsage, null);\r
- jContentPane.add(getJComboBoxUsage(), null);\r
- jContentPane.add(getJScrollPane(), null);\r
- jContentPane.add(getJButtonAdd(), null);\r
- jContentPane.add(getJButtonRemove(), null);\r
- jContentPane.add(getJButtonClearAll(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(jLabel, null);\r
- jContentPane.add(getJTextField(), null);\r
- jContentPane.add(getJButtonBrowse(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- fill ComboBoxes with pre-defined contents\r
- **/\r
- private void initFrame() {\r
- jComboBoxSelect.addItem("BaseCpuICacheFlush");\r
- jComboBoxSelect.addItem("BaseDebugLibNull");\r
- jComboBoxSelect.addItem("BaseDebugLibReportStatusCode");\r
- jComboBoxSelect.addItem("BaseIoLibIntrinsic");\r
- jComboBoxSelect.addItem("BaseLib");\r
- jComboBoxSelect.addItem("BaseMemoryLib");\r
- jComboBoxSelect.addItem("BaseMemoryLibMmx");\r
- jComboBoxSelect.addItem("BaseMemoryLibSse2");\r
- jComboBoxSelect.addItem("BasePeCoffGetEntryPointLib");\r
- jComboBoxSelect.addItem("BasePeCoffLib");\r
- jComboBoxSelect.addItem("BasePrintLib");\r
- jComboBoxSelect.addItem("BaseReportStatusCodeLibNull");\r
- jComboBoxSelect.addItem("CommonPciCf8Lib");\r
- jComboBoxSelect.addItem("CommonPciExpressLib");\r
- jComboBoxSelect.addItem("CommonPciLibCf8");\r
- jComboBoxSelect.addItem("CommonPciLibPciExpress");\r
- jComboBoxSelect.addItem("DxeCoreEntryPoint");\r
- jComboBoxSelect.addItem("DxeHobLib");\r
- jComboBoxSelect.addItem("DxeIoLibCpuIo");\r
- jComboBoxSelect.addItem("DxeLib");\r
- jComboBoxSelect.addItem("DxePcdLib");\r
- jComboBoxSelect.addItem("DxeReportStatusCodeLib");\r
- jComboBoxSelect.addItem("DxeServicesTableLib");\r
- jComboBoxSelect.addItem("PeiCoreEntryPoint");\r
- jComboBoxSelect.addItem("PeiMemoryLib");\r
- jComboBoxSelect.addItem("PeimEntryPoint");\r
- jComboBoxSelect.addItem("PeiReportStatusCodeLib");\r
- jComboBoxSelect.addItem("PeiServicesTablePointerLib");\r
- jComboBoxSelect.addItem("PeiServicesTablePointerLibMm7");\r
- jComboBoxSelect.addItem("UefiDebugLibConOut");\r
- jComboBoxSelect.addItem("UefiDebugLibStdErr");\r
- jComboBoxSelect.addItem("UefiDriverEntryPointMultiple");\r
- jComboBoxSelect.addItem("UefiDriverEntryPointSingle");\r
- jComboBoxSelect.addItem("UefiDriverEntryPointSingleUnload");\r
- jComboBoxSelect.addItem("UefiDriverModelLib");\r
- jComboBoxSelect.addItem("UefiDriverModelLibNoConfigNoDiag");\r
- jComboBoxSelect.addItem("UefiLib");\r
- jComboBoxSelect.addItem("UefiMemoryLib");\r
-\r
- jComboBoxUsage.addItem("ALWAYS_CONSUMED");\r
- jComboBoxUsage.addItem("SOMETIMES_CONSUMED");\r
- jComboBoxUsage.addItem("ALWAYS_PRODUCED");\r
- jComboBoxUsage.addItem("SOMETIMES_PRODUCED");\r
- jComboBoxUsage.addItem("DEFAULT");\r
- jComboBoxUsage.addItem("PRIVATE");\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.save();\r
- this.dispose();\r
-\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- }\r
-\r
- if (arg0.getSource() == jButtonAdd) {\r
- String strLibClass = "";\r
- if (jRadioButtonAdd.isSelected()) {\r
- strLibClass = jTextFieldAdd.getText();\r
- }\r
- if (jRadioButtonSelect.isSelected()) {\r
- strLibClass = jComboBoxSelect.getSelectedItem().toString();\r
- }\r
- listItem.addElement(jTextField.getText().replace('\\', '/') + this.Separator + strLibClass);\r
- }\r
- //\r
- // remove selected line\r
- //\r
- if (arg0.getSource() == jButtonRemove) {\r
- int intSelected[] = jListLibraryClassDefinitions.getSelectedIndices();\r
- if (intSelected.length > 0) {\r
- for (int index = intSelected.length - 1; index > -1; index--) {\r
- listItem.removeElementAt(intSelected[index]);\r
- }\r
- }\r
- jListLibraryClassDefinitions.getSelectionModel().clearSelection();\r
- }\r
-\r
- if (arg0.getSource() == jButtonClearAll) {\r
- listItem.removeAllElements();\r
- }\r
-\r
- if (arg0.getSource() == jRadioButtonAdd) {\r
- if (jRadioButtonAdd.isSelected()) {\r
- jRadioButtonSelect.setSelected(false);\r
- jTextFieldAdd.setEnabled(true);\r
- jComboBoxSelect.setEnabled(false);\r
- }\r
- if (!jRadioButtonSelect.isSelected() && !jRadioButtonAdd.isSelected()) {\r
- jRadioButtonAdd.setSelected(true);\r
- jTextFieldAdd.setEnabled(true);\r
- jComboBoxSelect.setEnabled(false);\r
- }\r
- }\r
-\r
- if (arg0.getSource() == jRadioButtonSelect) {\r
- if (jRadioButtonSelect.isSelected()) {\r
- jRadioButtonAdd.setSelected(false);\r
- jTextFieldAdd.setEnabled(false);\r
- jComboBoxSelect.setEnabled(true);\r
- }\r
- if (!jRadioButtonSelect.isSelected() && !jRadioButtonAdd.isSelected()) {\r
- jRadioButtonSelect.setSelected(true);\r
- jTextFieldAdd.setEnabled(false);\r
- jComboBoxSelect.setEnabled(true);\r
- }\r
- }\r
- }\r
-\r
- /**\r
- Add contents in list to sfc\r
- **/\r
- protected void save() {\r
- try {\r
- int intLibraryCount = listItem.getSize();\r
-\r
- if (intLibraryCount > 0) {\r
-\r
- for (int index = 0; index < intLibraryCount; index++) {\r
- String strAll = listItem.get(index).toString();\r
- String strInclude = strAll.substring(0, strAll.indexOf(Separator));\r
- String strLibraryClass = strAll.substring(strAll.indexOf(Separator) + Separator.length());\r
- sfc.genSpdLibClassDeclarations(strLibraryClass, null, strInclude, null, null, null, null, null,\r
- null, null);\r
- }\r
- } else {\r
-\r
- }\r
-\r
- } catch (Exception e) {\r
- System.out.println(e.toString());\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jTextField \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextField() {\r
- if (jTextField == null) {\r
- jTextField = new JTextField();\r
- jTextField.setBounds(new java.awt.Rectangle(12,112,346,21));\r
- }\r
- return jTextField;\r
- }\r
-\r
- /**\r
- This method initializes jButtonBrowse \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonBrowse() {\r
- if (jButtonBrowse == null) {\r
- jButtonBrowse = new JButton();\r
- jButtonBrowse.setBounds(new java.awt.Rectangle(374,111,92,21));\r
- jButtonBrowse.setText("Browse");\r
- jButtonBrowse.setPreferredSize(new java.awt.Dimension(34,20));\r
- jButtonBrowse.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- //\r
- // Select files from current workspace\r
- //\r
- JFileChooser chooser = new JFileChooser(System.getenv("WORKSPACE"));\r
- File theFile = null;\r
- String headerDest = null;\r
- \r
- chooser.setMultiSelectionEnabled(false);\r
- chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);\r
- int retval = chooser.showOpenDialog(frame);\r
- if (retval == JFileChooser.APPROVE_OPTION) {\r
-\r
- theFile = chooser.getSelectedFile();\r
- String file = theFile.getPath();\r
- if (!file.startsWith(System.getenv("WORKSPACE"))) {\r
- JOptionPane.showMessageDialog(frame, "You can only select files in current workspace!");\r
- return;\r
- }\r
- \r
- \r
- }\r
- else {\r
- return;\r
- }\r
- \r
- if (!theFile.getPath().startsWith(PackagingMain.dirForNewSpd)) {\r
- //\r
- //ToDo: copy elsewhere header file to new pkg dir, prompt user to chooser a location\r
- //\r
- JOptionPane.showMessageDialog(frame, "You must copy header file into current package directory!");\r
- return;\r
- }\r
- \r
- headerDest = theFile.getPath();\r
- int fileIndex = headerDest.indexOf(System.getProperty("file.separator"), PackagingMain.dirForNewSpd.length());\r
- \r
- jTextField.setText(headerDest.substring(fileIndex + 1).replace('\\', '/'));\r
- \r
- }\r
- });\r
- }\r
- return jButtonBrowse;\r
- }\r
-\r
-}\r
+++ /dev/null
-/** @file\r
- Java class PackageMsaFile is GUI for create MsaFile elements of spd file.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import java.awt.BorderLayout;\r
-import java.awt.Dimension;\r
-import java.awt.Toolkit;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ActionListener;\r
-import java.io.File;\r
-import java.util.Vector;\r
-\r
-import javax.swing.DefaultListModel;\r
-import javax.swing.JFileChooser;\r
-import javax.swing.JOptionPane;\r
-import javax.swing.JPanel;\r
-import javax.swing.JRadioButton;\r
-import javax.swing.JTextField;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JLabel;\r
-import javax.swing.JList;\r
-import javax.swing.JScrollPane;\r
-import javax.swing.JButton;\r
-import javax.swing.JFrame;\r
-import javax.swing.filechooser.FileFilter;\r
-\r
-/**\r
- GUI for create MsaFile elements of spd file\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class PackageMsaFile extends JFrame implements ActionListener {\r
- static JFrame frame;\r
- \r
- private DefaultListModel listItem = new DefaultListModel();\r
-\r
- private SpdFileContents sfc = null;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JScrollPane jScrollPane = null;\r
-\r
- private JList jListLibraryClassDefinitions = null;\r
-\r
- private JButton jButtonAdd = null;\r
-\r
- private JButton jButtonRemove = null;\r
-\r
- private JButton jButtonClearAll = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JLabel jLabel = null;\r
-\r
- private JTextField jTextField = null;\r
-\r
- private JButton jButton = null;\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void initialize() {\r
- this.setTitle("MSA Files");\r
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
-\r
- }\r
-\r
- /**\r
- This method initializes jScrollPane \r
- \r
- @return javax.swing.JScrollPane \r
- **/\r
- private JScrollPane getJScrollPane() {\r
- if (jScrollPane == null) {\r
- jScrollPane = new JScrollPane();\r
- jScrollPane.setBounds(new java.awt.Rectangle(10, 85, 350, 210));\r
- jScrollPane.setViewportView(getJListLibraryClassDefinitions());\r
- }\r
- return jScrollPane;\r
- }\r
-\r
- /**\r
- This method initializes jListLibraryClassDefinitions \r
- \r
- @return javax.swing.JList \r
- **/\r
- private JList getJListLibraryClassDefinitions() {\r
- if (jListLibraryClassDefinitions == null) {\r
- jListLibraryClassDefinitions = new JList(listItem);\r
- }\r
- return jListLibraryClassDefinitions;\r
- }\r
-\r
- /**\r
- This method initializes jButtonAdd \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonAdd() {\r
- if (jButtonAdd == null) {\r
- jButtonAdd = new JButton();\r
- jButtonAdd.setBounds(new java.awt.Rectangle(375, 132, 90, 20));\r
- jButtonAdd.setText("Add");\r
- jButtonAdd.addActionListener(this);\r
- }\r
- return jButtonAdd;\r
- }\r
-\r
- /**\r
- This method initializes jButtonRemove \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonRemove() {\r
- if (jButtonRemove == null) {\r
- jButtonRemove = new JButton();\r
- jButtonRemove.setBounds(new java.awt.Rectangle(375, 230, 90, 20));\r
- jButtonRemove.setText("Remove");\r
- jButtonRemove.addActionListener(this);\r
- }\r
- return jButtonRemove;\r
- }\r
-\r
- /**\r
- This method initializes jButtonRemoveAll \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonClearAll() {\r
- if (jButtonClearAll == null) {\r
- jButtonClearAll = new JButton();\r
- jButtonClearAll.setBounds(new java.awt.Rectangle(375, 260, 90, 20));\r
- jButtonClearAll.setText("Clear All");\r
- jButtonClearAll.addActionListener(this);\r
- }\r
- return jButtonClearAll;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setPreferredSize(new java.awt.Dimension(90, 20));\r
- jButtonCancel.setLocation(new java.awt.Point(390, 305));\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setSize(new java.awt.Dimension(90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jButton \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setSize(new java.awt.Dimension(90, 20));\r
- jButtonOk.setText("OK");\r
- jButtonOk.setLocation(new java.awt.Point(290, 305));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- **/\r
- public PackageMsaFile(SpdFileContents sfc) {\r
- super();\r
- initialize();\r
- init();\r
- this.sfc = sfc;\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- */\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @return void\r
- **/\r
- private void init() {\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Library Class Declarations");\r
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));\r
- this.centerWindow();\r
- initFrame();\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel\r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabel = new JLabel();\r
- jLabel.setBounds(new java.awt.Rectangle(11,20,143,22));\r
- jLabel.setText("Msa File Path and Name");\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(getJScrollPane(), null);\r
- jContentPane.add(getJButtonAdd(), null);\r
- jContentPane.add(getJButtonRemove(), null);\r
- jContentPane.add(getJButtonClearAll(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(jLabel, null);\r
- jContentPane.add(getJTextField(), null);\r
- jContentPane.add(getJButton(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- private void initFrame() {\r
-\r
- }\r
-\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.dispose();\r
- this.save();\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- }\r
-\r
- if (arg0.getSource() == jButtonAdd) {\r
-\r
- listItem.addElement(jTextField.getText());\r
- }\r
-\r
- if (arg0.getSource() == jButtonRemove) {\r
- int intSelected[] = jListLibraryClassDefinitions.getSelectedIndices();\r
- if (intSelected.length > 0) {\r
- for (int index = intSelected.length - 1; index > -1; index--) {\r
- listItem.removeElementAt(intSelected[index]);\r
- }\r
- }\r
- jListLibraryClassDefinitions.getSelectionModel().clearSelection();\r
- }\r
-\r
- if (arg0.getSource() == jButtonClearAll) {\r
- listItem.removeAllElements();\r
- }\r
-\r
- }\r
-\r
- protected void save() {\r
- try {\r
- int intLibraryCount = listItem.getSize();\r
-\r
- if (intLibraryCount > 0) {\r
-\r
- for (int index = 0; index < intLibraryCount; index++) {\r
- String strAll = listItem.get(index).toString();\r
- sfc.genSpdMsaFiles(strAll, null);\r
- }\r
- } else {\r
-\r
- }\r
-\r
- } catch (Exception e) {\r
- System.out.println(e.toString());\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jTextField \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextField() {\r
- if (jTextField == null) {\r
- jTextField = new JTextField();\r
- jTextField.setBounds(new java.awt.Rectangle(11,44,349,21));\r
- }\r
- return jTextField;\r
- }\r
-\r
- /**\r
- This method initializes jButton \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton() {\r
- final FileFilter filter = new PkgFileFilter("msa");\r
- \r
- if (jButton == null) {\r
- jButton = new JButton();\r
- jButton.setBounds(new java.awt.Rectangle(377,46,89,20));\r
- jButton.setText("Browse");\r
- jButton.setPreferredSize(new java.awt.Dimension(34,20));\r
- jButton.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- JFileChooser chooser = new JFileChooser(System.getenv("WORKSPACE"));\r
- File theFile = null;\r
- String msaDest = null;\r
- \r
- chooser.setMultiSelectionEnabled(false);\r
- chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);\r
- chooser.setFileFilter(filter);\r
- int retval = chooser.showOpenDialog(frame);\r
- if (retval == JFileChooser.APPROVE_OPTION) {\r
-\r
- theFile = chooser.getSelectedFile();\r
- String file = theFile.getPath();\r
- if (!file.startsWith(System.getenv("WORKSPACE"))) {\r
- JOptionPane.showMessageDialog(frame, "You can only select files in current workspace!");\r
- return;\r
- }\r
- \r
- }\r
- else {\r
- return;\r
- }\r
- \r
- if (!theFile.getPath().startsWith(PackagingMain.dirForNewSpd)) {\r
- //\r
- //ToDo: copy elsewhere msa to new pkg dir, prompt user to chooser a location\r
- //\r
- JOptionPane.showMessageDialog(frame, "You must copy msa file into current package directory!");\r
- return;\r
- }\r
- \r
- msaDest = theFile.getPath();\r
- int fileIndex = msaDest.indexOf(System.getProperty("file.separator"), PackagingMain.dirForNewSpd.length());\r
- \r
- jTextField.setText(msaDest.substring(fileIndex + 1).replace('\\', '/'));\r
- }\r
- });\r
- }\r
- return jButton;\r
- }\r
-\r
-}\r
+++ /dev/null
-/** @file\r
- Java class PackageNew is the top level GUI for create spd file.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import java.awt.Dimension;\r
-import java.awt.Toolkit;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ActionListener;\r
-import java.text.SimpleDateFormat;\r
-import java.util.Date;\r
-\r
-import javax.swing.JFrame;\r
-import javax.swing.JPanel;\r
-import javax.swing.JLabel;\r
-import javax.swing.JTextField;\r
-import javax.swing.JButton;\r
-import javax.swing.JTextArea;\r
-import javax.swing.JScrollPane;\r
-import javax.swing.JComboBox;\r
-\r
-import org.tianocore.common.Tools;\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-\r
-/**\r
- This class contains GUI components to show various GUIs for creating spd file elements\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class PackageNew extends JFrame implements ActionListener {\r
-\r
- private JPanel jContentPane = null; // @jve:decl-index=0:visual-constraint="128,4"\r
-\r
- private JLabel jLabelBaseName = null;\r
-\r
- private JTextField jTextFieldBaseName = null;\r
-\r
- private JLabel jLabelGuid = null;\r
-\r
- private JTextField jTextFieldGuid = null;\r
-\r
- private JLabel jLabelVersion = null;\r
-\r
- private JTextField jTextFieldVersion = null;\r
-\r
- private JButton jButtonGenerateGuid = null;\r
-\r
- private JLabel jLabelLicense = null;\r
-\r
- private JTextArea jTextAreaLicense = null;\r
-\r
- private JLabel jLabelCopyright = null;\r
-\r
- private JTextArea jTextAreaCopyright = null;\r
-\r
- private JLabel jLabelDescription = null;\r
-\r
- private JTextArea jTextAreaDescription = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JScrollPane jScrollPaneLicense = null;\r
-\r
- private JScrollPane jScrollPaneDescription = null;\r
-\r
- private JLabel jLabelAbstract = null;\r
-\r
- private JTextField jTextFieldAbstract = null;\r
-\r
- private JLabel jLabelModuleType = null;\r
-\r
- private JLabel jLabelCompontentType = null;\r
-\r
- private JComboBox jComboBox1 = null;\r
-\r
- private JComboBox jComboBoxModuleType = null;\r
-\r
- private StarLabel jStarLabel1 = null;\r
-\r
- private StarLabel jStarLabel2 = null;\r
-\r
- private StarLabel jStarLabel3 = null;\r
-\r
- private StarLabel jStarLabel4 = null;\r
-\r
- private StarLabel jStarLabel5 = null;\r
-\r
- private StarLabel jStarLabel6 = null;\r
-\r
- private StarLabel jStarLabel7 = null;\r
-\r
- private StarLabel jStarLabel8 = null;\r
-\r
- private JLabel jLabelURL = null;\r
-\r
- private JTextField jTextFieldAbstractURL = null;\r
-\r
- private JLabel jLabel = null;\r
-\r
- private JComboBox jComboBox = null;\r
-\r
- private SpdFileContents sfc = null;\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void initialize() {\r
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
-\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldBaseName \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextFieldBaseName() {\r
- if (jTextFieldBaseName == null) {\r
- jTextFieldBaseName = new JTextField();\r
- jTextFieldBaseName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
- }\r
- return jTextFieldBaseName;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldGuid \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextFieldGuid() {\r
- if (jTextFieldGuid == null) {\r
- jTextFieldGuid = new JTextField();\r
- jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 35, 240, 20));\r
- }\r
- return jTextFieldGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldVersion \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextFieldVersion() {\r
- if (jTextFieldVersion == null) {\r
- jTextFieldVersion = new JTextField();\r
- jTextFieldVersion.setBounds(new java.awt.Rectangle(160, 60, 320, 20));\r
- }\r
- return jTextFieldVersion;\r
- }\r
-\r
- /**\r
- This method initializes jButtonGenerateGuid \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonGenerateGuid() {\r
- if (jButtonGenerateGuid == null) {\r
- jButtonGenerateGuid = new JButton();\r
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(405, 35, 75, 20));\r
- jButtonGenerateGuid.setText("GEN");\r
- jButtonGenerateGuid.addActionListener(this);\r
- }\r
- return jButtonGenerateGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextAreaLicense \r
- \r
- @return javax.swing.JTextArea \r
- **/\r
- private JTextArea getJTextAreaLicense() {\r
- if (jTextAreaLicense == null) {\r
- jTextAreaLicense = new JTextArea();\r
- jTextAreaLicense.setText("");\r
- jTextAreaLicense.setLineWrap(true);\r
- }\r
- return jTextAreaLicense;\r
- }\r
-\r
- /**\r
- This method initializes jTextAreaCopyright \r
- \r
- @return javax.swing.JTextArea \r
- **/\r
- private JTextArea getJTextAreaCopyright() {\r
- if (jTextAreaCopyright == null) {\r
- jTextAreaCopyright = new JTextArea();\r
- jTextAreaCopyright.setLineWrap(true);\r
- jTextAreaCopyright.setBounds(new java.awt.Rectangle(160,172,319,20));\r
- }\r
- return jTextAreaCopyright;\r
- }\r
-\r
- /**\r
- This method initializes jTextAreaDescription \r
- \r
- @return javax.swing.JTextArea \r
- **/\r
- private JTextArea getJTextAreaDescription() {\r
- if (jTextAreaDescription == null) {\r
- jTextAreaDescription = new JTextArea();\r
- jTextAreaDescription.setLineWrap(true);\r
- }\r
- return jTextAreaDescription;\r
- }\r
-\r
- /**\r
- This method initializes jButtonNext \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("OK");\r
- jButtonOk.setBounds(new java.awt.Rectangle(290, 481, 90, 20));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 481, 90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPane \r
- \r
- @return javax.swing.JScrollPane \r
- **/\r
- private JScrollPane getJScrollPaneLicense() {\r
- if (jScrollPaneLicense == null) {\r
- jScrollPaneLicense = new JScrollPane();\r
- jScrollPaneLicense.setBounds(new java.awt.Rectangle(160, 85, 320, 80));\r
- jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r
- jScrollPaneLicense.setViewportView(getJTextAreaLicense());\r
- }\r
- return jScrollPaneLicense;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPane2 \r
- \r
- @return javax.swing.JScrollPane \r
- **/\r
- private JScrollPane getJScrollPaneDescription() {\r
- if (jScrollPaneDescription == null) {\r
- jScrollPaneDescription = new JScrollPane();\r
- jScrollPaneDescription.setBounds(new java.awt.Rectangle(160, 322, 320, 80));\r
- jScrollPaneDescription.setViewportView(getJTextAreaDescription());\r
- jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r
- }\r
- return jScrollPaneDescription;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldAbstract \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextFieldAbstract() {\r
- if (jTextFieldAbstract == null) {\r
- jTextFieldAbstract = new JTextField();\r
- jTextFieldAbstract.setBounds(new java.awt.Rectangle(159,218,318,70));\r
- }\r
- return jTextFieldAbstract;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxCompontentType \r
- \r
- @return javax.swing.JComboBox \r
- **/\r
- private JComboBox getJComboBox1() {\r
- if (jComboBox1 == null) {\r
- jComboBox1 = new JComboBox();\r
- jComboBox1.setBounds(new java.awt.Rectangle(160, 465, 91, 20));\r
- }\r
- return jComboBox1;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxModuleType \r
- \r
- @return javax.swing.JComboBox \r
- **/\r
- private JComboBox getJComboBoxModuleType() {\r
- if (jComboBoxModuleType == null) {\r
- jComboBoxModuleType = new JComboBox();\r
- jComboBoxModuleType.setBounds(new java.awt.Rectangle(160, 440, 91, 20));\r
- }\r
- return jComboBoxModuleType;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldAbstractURL \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextFieldAbstractURL() {\r
- if (jTextFieldAbstractURL == null) {\r
- jTextFieldAbstractURL = new JTextField();\r
- jTextFieldAbstractURL.setBounds(new java.awt.Rectangle(159, 414, 320, 20));\r
- }\r
- return jTextFieldAbstractURL;\r
- }\r
-\r
- public PackageNew(SpdFileContents sfc) {\r
- super();\r
- initialize();\r
- init();\r
- this.setVisible(true);\r
- this.sfc = sfc;\r
-\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @return void\r
- **/\r
- private void init() {\r
- this.setSize(500, 560);\r
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("SPD File Header");\r
- this.centerWindow();\r
- //this.getRootPane().setDefaultButton(jButtonOk);\r
- initFrame();\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel\r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabel = new JLabel();\r
- jLabel.setBounds(new java.awt.Rectangle(15, 490, 140, 21));\r
- jLabel.setText("Re-Package");\r
- jLabelURL = new JLabel();\r
- jLabelURL.setBounds(new java.awt.Rectangle(16, 414, 25, 20));\r
- jLabelURL.setText("URL");\r
- jLabelCompontentType = new JLabel();\r
- jLabelCompontentType.setBounds(new java.awt.Rectangle(15, 465, 140, 20));\r
- jLabelCompontentType.setText("Read Only");\r
- jLabelModuleType = new JLabel();\r
- jLabelModuleType.setBounds(new java.awt.Rectangle(15, 440, 140, 20));\r
- jLabelModuleType.setText("Package Type");\r
- jLabelAbstract = new JLabel();\r
- jLabelAbstract.setBounds(new java.awt.Rectangle(15,218,140,20));\r
- jLabelAbstract.setText("Abstract");\r
- jLabelDescription = new JLabel();\r
- jLabelDescription.setText("Description");\r
- jLabelDescription.setBounds(new java.awt.Rectangle(16, 325, 140, 20));\r
- jLabelCopyright = new JLabel();\r
- jLabelCopyright.setText("Copyright");\r
- jLabelCopyright.setBounds(new java.awt.Rectangle(15, 171, 140, 20));\r
- jLabelLicense = new JLabel();\r
- jLabelLicense.setText("License");\r
- jLabelLicense.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
- jLabelVersion = new JLabel();\r
- jLabelVersion.setText("Version");\r
- jLabelVersion.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
- jLabelGuid = new JLabel();\r
- jLabelGuid.setPreferredSize(new java.awt.Dimension(25, 15));\r
- jLabelGuid.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
- jLabelGuid.setText("Guid");\r
- jLabelBaseName = new JLabel();\r
- jLabelBaseName.setText("Package Name");\r
- jLabelBaseName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.setLocation(new java.awt.Point(0, 0));\r
- jContentPane.setSize(new java.awt.Dimension(500, 524));\r
- jContentPane.add(jLabelBaseName, null);\r
- jContentPane.add(getJTextFieldBaseName(), null);\r
- jContentPane.add(jLabelGuid, null);\r
- jContentPane.add(getJTextFieldGuid(), null);\r
- jContentPane.add(jLabelVersion, null);\r
- jContentPane.add(getJTextFieldVersion(), null);\r
- jContentPane.add(getJButtonGenerateGuid(), null);\r
- jContentPane.add(jLabelLicense, null);\r
- jContentPane.add(jLabelCopyright, null);\r
- jContentPane.add(jLabelDescription, null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJScrollPaneLicense(), null);\r
- jContentPane.add(getJScrollPaneDescription(), null);\r
- jContentPane.add(jLabelAbstract, null);\r
- jContentPane.add(getJTextFieldAbstract(), null);\r
- jContentPane.add(jLabelModuleType, null);\r
- jContentPane.add(jLabelCompontentType, null);\r
- jContentPane.add(getJComboBox1(), null);\r
- jContentPane.add(getJComboBoxModuleType(), null);\r
-\r
- jStarLabel1 = new StarLabel();\r
- jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
- jStarLabel2 = new StarLabel();\r
- jStarLabel2.setLocation(new java.awt.Point(0, 35));\r
- jStarLabel3 = new StarLabel();\r
- jStarLabel3.setLocation(new java.awt.Point(0, 60));\r
- jStarLabel4 = new StarLabel();\r
- jStarLabel4.setLocation(new java.awt.Point(0, 85));\r
- jStarLabel5 = new StarLabel();\r
- jStarLabel5.setLocation(new java.awt.Point(0, 171));\r
- jStarLabel6 = new StarLabel();\r
- jStarLabel6.setLocation(new java.awt.Point(1, 325));\r
- jStarLabel7 = new StarLabel();\r
- jStarLabel7.setLocation(new java.awt.Point(0,218));\r
- jStarLabel8 = new StarLabel();\r
- jStarLabel8.setLocation(new java.awt.Point(0, 440));\r
-\r
- jContentPane.add(jStarLabel1, null);\r
- jContentPane.add(jStarLabel2, null);\r
- jContentPane.add(jStarLabel3, null);\r
- jContentPane.add(jStarLabel4, null);\r
- jContentPane.add(jStarLabel5, null);\r
- jContentPane.add(jStarLabel6, null);\r
- jContentPane.add(jStarLabel7, null);\r
- jContentPane.add(jStarLabel8, null);\r
- jContentPane.add(jLabelURL, null);\r
- jContentPane.add(getJTextFieldAbstractURL(), null);\r
- jContentPane.add(jLabel, null);\r
- jContentPane.add(getJComboBox(), null);\r
- jContentPane.add(getJTextAreaCopyright(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.save();\r
- this.dispose();\r
- }\r
-\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- }\r
-\r
- if (arg0.getSource() == jButtonGenerateGuid) {\r
- jTextFieldGuid.setText(Tools.generateUuidString());\r
- }\r
- }\r
-\r
- /**\r
- Save all components of Msa Header\r
- if exist, set the value directly\r
- if not exist, new instance first\r
- \r
- **/\r
- private void save() {\r
- SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");\r
- Date date = new Date();\r
- sfc.genSpdHeader(jTextFieldBaseName.getText(), jTextFieldGuid.getText(), jTextFieldVersion.getText(),\r
- jTextFieldAbstract.getText(), jTextAreaDescription.getText(), jTextAreaCopyright.getText(),\r
- jTextAreaLicense.getText(), format.format(date), format.format(date),\r
- jTextFieldAbstractURL.getText(), jComboBoxModuleType.getSelectedItem().toString(),\r
- jComboBox1.getSelectedItem().toString(), jComboBox.getSelectedItem().toString(), null, null);\r
- }\r
-\r
- /**\r
- This method initializes module type and compontent type\r
- \r
- **/\r
- private void initFrame() {\r
- jComboBoxModuleType.addItem("SOURCE");\r
- jComboBoxModuleType.addItem("BINARY");\r
- jComboBoxModuleType.addItem("MIXED");\r
-\r
- jComboBox1.addItem("true");\r
- jComboBox1.addItem("false");\r
-\r
- jComboBox.addItem("false");\r
- jComboBox.addItem("true");\r
-\r
- }\r
-\r
- /**\r
- This method initializes jComboBox \r
- \r
- @return javax.swing.JComboBox \r
- **/\r
- private JComboBox getJComboBox() {\r
- if (jComboBox == null) {\r
- jComboBox = new JComboBox();\r
- jComboBox.setBounds(new java.awt.Rectangle(160, 490, 90, 20));\r
- }\r
- return jComboBox;\r
- }\r
-\r
-} // @jve:decl-index=0:visual-constraint="38,-22"\r
+++ /dev/null
-/** @file\r
- Java class PackagePCD is GUI for create PCD definition elements of spd file.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import java.awt.Dimension;\r
-import java.awt.Toolkit;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ActionListener;\r
-\r
-import javax.swing.ButtonGroup;\r
-import javax.swing.JPanel;\r
-import javax.swing.JRadioButton;\r
-import javax.swing.JLabel;\r
-import javax.swing.JTextField;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JButton;\r
-import javax.swing.JFrame;\r
-\r
-import org.tianocore.common.Tools;\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-\r
-/**\r
- GUI for create PCD definition elements of spd file\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class PackagePCD extends JFrame implements ActionListener {\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JLabel jLabelItemType = null;\r
-\r
- private JLabel jLabelC_Name = null;\r
-\r
- private JComboBox jComboBoxItemType = null;\r
-\r
- private JTextField jTextFieldC_Name = null;\r
-\r
- private JLabel jLabelToken = null;\r
-\r
- private JTextField jTextFieldToken = null;\r
-\r
- private JLabel jLabelDataType = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JComboBox jComboBoxDataType = null;\r
-\r
- private JLabel jLabelOverrideID = null;\r
-\r
- private JTextField jTextFieldOverrideID = null;\r
-\r
- private ButtonGroup bg1 = null;\r
-\r
- private ButtonGroup bg2 = null;\r
-\r
- private ButtonGroup bg3 = null;\r
-\r
- private StarLabel jStarLabel2 = null;\r
-\r
- private StarLabel jStarLabel3 = null;\r
-\r
- private SpdFileContents sfc = null;\r
-\r
- private StarLabel jStarLabel = null;\r
-\r
- private StarLabel jStarLabel1 = null;\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void initialize() {\r
- this.setTitle("PCD Definition");\r
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
-\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxItemType \r
- \r
- @return javax.swing.JComboBox \r
- **/\r
- private JComboBox getJComboBoxItemType() {\r
- if (jComboBoxItemType == null) {\r
- jComboBoxItemType = new JComboBox();\r
- jComboBoxItemType.setBounds(new java.awt.Rectangle(160, 110, 320, 20));\r
- }\r
- return jComboBoxItemType;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldC_Name \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextFieldC_Name() {\r
- if (jTextFieldC_Name == null) {\r
- jTextFieldC_Name = new JTextField();\r
- jTextFieldC_Name.setBounds(new java.awt.Rectangle(160, 60, 320, 20));\r
- }\r
- return jTextFieldC_Name;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldToken \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextFieldToken() {\r
- if (jTextFieldToken == null) {\r
- jTextFieldToken = new JTextField();\r
- jTextFieldToken.setBounds(new java.awt.Rectangle(160, 135, 320, 20));\r
- }\r
- return jTextFieldToken;\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("OK");\r
- jButtonOk.setBounds(new java.awt.Rectangle(279,247,90,20));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setBounds(new java.awt.Rectangle(389,247,90,20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxDataType \r
- \r
- @return javax.swing.JComboBox \r
- **/\r
- private JComboBox getJComboBoxDataType() {\r
- if (jComboBoxDataType == null) {\r
- jComboBoxDataType = new JComboBox();\r
- jComboBoxDataType.setBounds(new java.awt.Rectangle(160, 160, 320, 20));\r
- }\r
- return jComboBoxDataType;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldOverrideID \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextFieldOverrideID() {\r
- if (jTextFieldOverrideID == null) {\r
- jTextFieldOverrideID = new JTextField();\r
- jTextFieldOverrideID.setBounds(new java.awt.Rectangle(159,198,320,20));\r
- }\r
- return jTextFieldOverrideID;\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- **/\r
- public PackagePCD(SpdFileContents sfc) {\r
- super();\r
- init();\r
- initialize();\r
- this.sfc = sfc;\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @return void\r
- **/\r
- private void init() {\r
- this.setSize(500, 450);\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Add PCDs");\r
- this.centerWindow();\r
- this.getRootPane().setDefaultButton(jButtonOk);\r
- initFrame();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- *\r
- **/\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- *\r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
-\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabelOverrideID = new JLabel();\r
- jLabelOverrideID.setBounds(new java.awt.Rectangle(14,197,140,20));\r
- jLabelOverrideID.setText("Default Value");\r
- jLabelC_Name = new JLabel();\r
- jLabelC_Name.setText("C_Name");\r
- jLabelC_Name.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
- jLabelDataType = new JLabel();\r
- jLabelDataType.setText("Data Type");\r
- jLabelDataType.setBounds(new java.awt.Rectangle(15, 160, 140, 20));\r
- jLabelToken = new JLabel();\r
- jLabelToken.setText("Token");\r
- jLabelToken.setBounds(new java.awt.Rectangle(15, 135, 140, 20));\r
- jLabelItemType = new JLabel();\r
- jLabelItemType.setText("Item Type");\r
- jLabelItemType.setBounds(new java.awt.Rectangle(15, 110, 140, 20));\r
- bg1 = new ButtonGroup();\r
- bg2 = new ButtonGroup();\r
- bg3 = new ButtonGroup();\r
- //bg1.add(getJRadioButtonPCData());\r
- //bg2.add(getJRadioButtonPcdBuildData());\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- //jContentPane.add(bg1);\r
- jContentPane.add(jLabelItemType, null);\r
- jContentPane.add(jLabelC_Name, null);\r
- jContentPane.add(getJTextFieldC_Name(), null);\r
- jContentPane.add(jLabelToken, null);\r
- jContentPane.add(getJTextFieldToken(), null);\r
- jContentPane.add(jLabelDataType, null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJComboBoxItemType(), null);\r
- jContentPane.add(getJComboBoxDataType(), null);\r
- jContentPane.add(jLabelOverrideID, null);\r
- jContentPane.add(getJTextFieldOverrideID(), null);\r
-\r
- jStarLabel = new StarLabel();\r
- jStarLabel1 = new StarLabel();\r
- jStarLabel1.setBounds(new java.awt.Rectangle(6, 59, 10, 20));\r
- jStarLabel2 = new StarLabel();\r
- jStarLabel3 = new StarLabel();\r
- jStarLabel.setLocation(new java.awt.Point(6, 110));\r
- jStarLabel.setLocation(new java.awt.Point(5, 85));\r
- jStarLabel2.setLocation(new java.awt.Point(5, 134));\r
- jStarLabel3.setLocation(new java.awt.Point(5, 159));\r
- jContentPane.add(jStarLabel2, null);\r
- jContentPane.add(jStarLabel3, null);\r
- jContentPane.add(jStarLabel, null);\r
- jContentPane.add(jStarLabel1, null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes comboboxes \r
- \r
- **/\r
- private void initFrame() {\r
-\r
- jComboBoxItemType.addItem("FEATURE_FLAG");\r
- jComboBoxItemType.addItem("FIXED_AT_BUILD");\r
- jComboBoxItemType.addItem("PATCHABLE_IN_MODULE");\r
- jComboBoxItemType.addItem("DYNAMIC");\r
- jComboBoxItemType.addItem("DYNAMIC_EX");\r
-\r
- jComboBoxDataType.addItem("UINT8");\r
- jComboBoxDataType.addItem("UINT16");\r
- jComboBoxDataType.addItem("UINT32");\r
- jComboBoxDataType.addItem("UINT64");\r
- jComboBoxDataType.addItem("VOID*");\r
- jComboBoxDataType.addItem("BOOLEAN");\r
- }\r
-\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- save();\r
- this.dispose();\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- }\r
- \r
-\r
- }\r
-\r
- protected void save() {\r
- \r
- sfc.genSpdPcdDefinitions(jComboBoxItemType.getSelectedItem().toString(), jTextFieldC_Name.getText(),\r
- jTextFieldToken.getText(), jComboBoxDataType.getSelectedItem().toString(), null,\r
- null, null, null, null, null, jTextFieldOverrideID.getText());\r
- }\r
-} // @jve:decl-index=0:visual-constraint="22,11"\r
+++ /dev/null
-/** @file\r
- Java class PackagePkgHeader is GUI for create Package header elements of spd file.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import java.awt.BorderLayout;\r
-import java.awt.Dimension;\r
-import java.awt.Toolkit;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ActionListener;\r
-import java.util.Vector;\r
-\r
-import javax.swing.DefaultListModel;\r
-import javax.swing.JPanel;\r
-import javax.swing.JRadioButton;\r
-import javax.swing.JTextField;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JLabel;\r
-import javax.swing.JList;\r
-import javax.swing.JScrollPane;\r
-import javax.swing.JButton;\r
-import javax.swing.JFrame;\r
-\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-\r
-/**\r
- GUI for create Package header elements of spd file\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class PackagePkgHeader extends JFrame implements ActionListener {\r
- private static String Separator = "::";\r
-\r
- private DefaultListModel listItem = new DefaultListModel();\r
-\r
- private SpdFileContents sfc = null;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JRadioButton jRadioButtonAdd = null;\r
-\r
- private JRadioButton jRadioButtonSelect = null;\r
-\r
- private JTextField jTextFieldAdd = null;\r
-\r
- private JComboBox jComboBoxSelect = null;\r
-\r
- private JScrollPane jScrollPane = null;\r
-\r
- private JList jListLibraryClassDefinitions = null;\r
-\r
- private JButton jButtonAdd = null;\r
-\r
- private JButton jButtonRemove = null;\r
-\r
- private JButton jButtonClearAll = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JLabel jLabel = null;\r
-\r
- private JTextField jTextField = null;\r
-\r
- private StarLabel starLabel = null;\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void initialize() {\r
- this.setTitle("Package Headers");\r
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
-\r
- }\r
-\r
- /**\r
- This method initializes jRadioButtonAdd \r
- \r
- @return javax.swing.JRadioButton \r
- **/\r
- private JRadioButton getJRadioButtonAdd() {\r
- if (jRadioButtonAdd == null) {\r
- jRadioButtonAdd = new JRadioButton();\r
- jRadioButtonAdd.setBounds(new java.awt.Rectangle(10, 35, 205, 20));\r
- jRadioButtonAdd.setText("Add a new Module Type");\r
- jRadioButtonAdd.setEnabled(false);\r
- jRadioButtonAdd.addActionListener(this);\r
- jRadioButtonAdd.setSelected(false);\r
- }\r
- return jRadioButtonAdd;\r
- }\r
-\r
- /**\r
- This method initializes jRadioButtonSelect \r
- \r
- @return javax.swing.JRadioButton \r
- **/\r
- private JRadioButton getJRadioButtonSelect() {\r
- if (jRadioButtonSelect == null) {\r
- jRadioButtonSelect = new JRadioButton();\r
- jRadioButtonSelect.setBounds(new java.awt.Rectangle(10, 10, 205, 20));\r
- jRadioButtonSelect.setText("Select an existed Module Type");\r
- jRadioButtonSelect.setActionCommand("Select an existed Module Type");\r
- jRadioButtonSelect.addActionListener(this);\r
- jRadioButtonSelect.setSelected(true);\r
- }\r
- return jRadioButtonSelect;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldAdd \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextFieldAdd() {\r
- if (jTextFieldAdd == null) {\r
- jTextFieldAdd = new JTextField();\r
- jTextFieldAdd.setBounds(new java.awt.Rectangle(220, 35, 260, 20));\r
- jTextFieldAdd.setEditable(false);\r
- jTextFieldAdd.setEnabled(false);\r
- }\r
- return jTextFieldAdd;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxSelect \r
- \r
- @return javax.swing.JComboBox \r
- **/\r
- private JComboBox getJComboBoxSelect() {\r
- if (jComboBoxSelect == null) {\r
- jComboBoxSelect = new JComboBox();\r
- jComboBoxSelect.setBounds(new java.awt.Rectangle(220, 10, 260, 20));\r
- jComboBoxSelect.setEnabled(true);\r
- }\r
- return jComboBoxSelect;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPane \r
- \r
- @return javax.swing.JScrollPane \r
- **/\r
- private JScrollPane getJScrollPane() {\r
- if (jScrollPane == null) {\r
- jScrollPane = new JScrollPane();\r
- jScrollPane.setBounds(new java.awt.Rectangle(10, 121, 350, 174));\r
- jScrollPane.setViewportView(getJListLibraryClassDefinitions());\r
- }\r
- return jScrollPane;\r
- }\r
-\r
- /**\r
- This method initializes jListLibraryClassDefinitions \r
- \r
- @return javax.swing.JList \r
- **/\r
- private JList getJListLibraryClassDefinitions() {\r
- if (jListLibraryClassDefinitions == null) {\r
- jListLibraryClassDefinitions = new JList(listItem);\r
- }\r
- return jListLibraryClassDefinitions;\r
- }\r
-\r
- /**\r
- This method initializes jButtonAdd \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonAdd() {\r
- if (jButtonAdd == null) {\r
- jButtonAdd = new JButton();\r
- jButtonAdd.setBounds(new java.awt.Rectangle(375, 132, 90, 20));\r
- jButtonAdd.setText("Add");\r
- jButtonAdd.addActionListener(this);\r
- }\r
- return jButtonAdd;\r
- }\r
-\r
- /**\r
- This method initializes jButtonRemove \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonRemove() {\r
- if (jButtonRemove == null) {\r
- jButtonRemove = new JButton();\r
- jButtonRemove.setBounds(new java.awt.Rectangle(375, 230, 90, 20));\r
- jButtonRemove.setText("Remove");\r
- jButtonRemove.addActionListener(this);\r
- }\r
- return jButtonRemove;\r
- }\r
-\r
- /**\r
- This method initializes jButtonRemoveAll \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonClearAll() {\r
- if (jButtonClearAll == null) {\r
- jButtonClearAll = new JButton();\r
- jButtonClearAll.setBounds(new java.awt.Rectangle(375, 260, 90, 20));\r
- jButtonClearAll.setText("Clear All");\r
- jButtonClearAll.addActionListener(this);\r
- }\r
- return jButtonClearAll;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setPreferredSize(new java.awt.Dimension(90, 20));\r
- jButtonCancel.setLocation(new java.awt.Point(390, 305));\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setSize(new java.awt.Dimension(90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jButton \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setSize(new java.awt.Dimension(90, 20));\r
- jButtonOk.setText("OK");\r
- jButtonOk.setLocation(new java.awt.Point(290, 305));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- **/\r
- public PackagePkgHeader(SpdFileContents sfc) {\r
- super();\r
- initialize();\r
- init();\r
- this.sfc = sfc;\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- *\r
- **/\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- *\r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
-\r
- // private void init(LibraryClassDefinitionsDocument.LibraryClassDefinitions inLibraryClassDefinitions) {\r
- // init();\r
- // this.setLibraryClassDefinitions(inLibraryClassDefinitions);\r
- // int intLibraryCount = this.libraryClassDefinitions.getLibraryClassArray().length;\r
- // if (intLibraryCount > 0) {\r
- // for (int index = 0; index < intLibraryCount; index++) {\r
- // listItem.addElement(this.libraryClassDefinitions.getLibraryClassArray(index).getUsage().toString() + \r
- // this.Separator + \r
- // this.libraryClassDefinitions.getLibraryClassArray(index).getStringValue());\r
- // this.libraryClassDefinitions.getLibraryClassArray();\r
- // }\r
- // }\r
- // }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @return void\r
- **/\r
- private void init() {\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Library Class Declarations");\r
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));\r
- this.centerWindow();\r
- initFrame();\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel\r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- starLabel = new StarLabel();\r
- starLabel.setBounds(new java.awt.Rectangle(5, 85, 10, 20));\r
- jLabel = new JLabel();\r
- jLabel.setBounds(new java.awt.Rectangle(14, 85, 201, 22));\r
- jLabel.setText("Include Header for Selected Type");\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(getJRadioButtonAdd(), null);\r
- jContentPane.add(getJRadioButtonSelect(), null);\r
- jContentPane.add(getJTextFieldAdd(), null);\r
- jContentPane.add(getJComboBoxSelect(), null);\r
- jContentPane.add(getJScrollPane(), null);\r
- jContentPane.add(getJButtonAdd(), null);\r
- jContentPane.add(getJButtonRemove(), null);\r
- jContentPane.add(getJButtonClearAll(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(jLabel, null);\r
- jContentPane.add(getJTextField(), null);\r
- jContentPane.add(starLabel, null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- private void initFrame() {\r
- jComboBoxSelect.addItem("BASE");\r
- jComboBoxSelect.addItem("SEC");\r
- jComboBoxSelect.addItem("PEI_CORE");\r
- jComboBoxSelect.addItem("PEIM");\r
- jComboBoxSelect.addItem("DXE_CORE");\r
- jComboBoxSelect.addItem("DXE_DRIVER");\r
- jComboBoxSelect.addItem("DXE_RUNTIME_DRIVER");\r
- jComboBoxSelect.addItem("DXE_SAL_DRIVER");\r
- jComboBoxSelect.addItem("DXE_SMM_DRIVER");\r
- jComboBoxSelect.addItem("TOOLS");\r
- jComboBoxSelect.addItem("UEFI_DRIVER");\r
- jComboBoxSelect.addItem("UEFI_APPLICATION");\r
- jComboBoxSelect.addItem("USER_DEFINED");\r
-\r
- }\r
-\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.save();\r
- this.dispose();\r
-\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- }\r
-\r
- if (arg0.getSource() == jButtonAdd) {\r
- String strLibClass = "";\r
-\r
- if (jRadioButtonAdd.isSelected()) {\r
- strLibClass = jTextFieldAdd.getText();\r
- }\r
- if (jRadioButtonSelect.isSelected()) {\r
- strLibClass = jComboBoxSelect.getSelectedItem().toString();\r
- }\r
-\r
- listItem.addElement(jTextField.getText().replace('\\', '/') + Separator + strLibClass);\r
- }\r
-\r
- if (arg0.getSource() == jButtonRemove) {\r
- int intSelected[] = jListLibraryClassDefinitions.getSelectedIndices();\r
- if (intSelected.length > 0) {\r
- for (int index = intSelected.length - 1; index > -1; index--) {\r
- listItem.removeElementAt(intSelected[index]);\r
- }\r
- }\r
- jListLibraryClassDefinitions.getSelectionModel().clearSelection();\r
- }\r
-\r
- if (arg0.getSource() == jButtonClearAll) {\r
- listItem.removeAllElements();\r
- }\r
-\r
- if (arg0.getSource() == jRadioButtonAdd) {\r
- if (jRadioButtonAdd.isSelected()) {\r
- jRadioButtonSelect.setSelected(false);\r
- jTextFieldAdd.setEnabled(true);\r
- jComboBoxSelect.setEnabled(false);\r
- }\r
- if (!jRadioButtonSelect.isSelected() && !jRadioButtonAdd.isSelected()) {\r
- jRadioButtonAdd.setSelected(true);\r
- jTextFieldAdd.setEnabled(true);\r
- jComboBoxSelect.setEnabled(false);\r
- }\r
- }\r
-\r
- if (arg0.getSource() == jRadioButtonSelect) {\r
- if (jRadioButtonSelect.isSelected()) {\r
- jRadioButtonAdd.setSelected(false);\r
- jTextFieldAdd.setEnabled(false);\r
- jComboBoxSelect.setEnabled(true);\r
- }\r
- if (!jRadioButtonSelect.isSelected() && !jRadioButtonAdd.isSelected()) {\r
- jRadioButtonSelect.setSelected(true);\r
- jTextFieldAdd.setEnabled(false);\r
- jComboBoxSelect.setEnabled(true);\r
- }\r
- }\r
- }\r
-\r
- private void save() {\r
- try {\r
- int intLibraryCount = listItem.getSize();\r
-\r
- if (intLibraryCount > 0) {\r
-\r
- for (int index = 0; index < intLibraryCount; index++) {\r
- String strAll = listItem.get(index).toString();\r
- String strInclude = strAll.substring(0, strAll.indexOf(Separator));\r
- String strType = strAll.substring(strAll.indexOf(Separator) + Separator.length());\r
- sfc.genSpdModuleHeaders(strType, strInclude, null, null, null, null, null, null);\r
- }\r
- } else {\r
-\r
- }\r
-\r
- } catch (Exception e) {\r
- System.out.println(e.toString());\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jTextField \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextField() {\r
- if (jTextField == null) {\r
- jTextField = new JTextField();\r
- jTextField.setBounds(new java.awt.Rectangle(221, 86, 257, 21));\r
- }\r
- return jTextField;\r
- }\r
-\r
-}\r
+++ /dev/null
-/** @file\r
- Java class PackagePpi is GUI for create Ppi definition elements of spd file.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-/**\r
- GUI derived from PackageProtocols class, override save() method\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class PackagePpi extends PackageProtocols {\r
-\r
- private SpdFileContents sfc = null;\r
-\r
- public PackagePpi(SpdFileContents sfc) {\r
- super(sfc);\r
- // TODO Auto-generated constructor stub\r
- this.sfc = sfc;\r
- }\r
-\r
- /**\r
- add ppi definitions from GUI to SpdFileContents object passed in.\r
- **/\r
- protected void save() {\r
- try {\r
- sfc.genSpdPpiDeclarations(getJTextField().getText(), getJTextFieldC_Name().getText(),\r
- getJTextFieldGuid().getText(), null);\r
- } catch (Exception e) {\r
- System.out.println(e.toString());\r
- }\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- Java class PackageProtocols is GUI for create Protocol definition elements of spd file.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import javax.swing.JPanel;\r
-import javax.swing.JLabel;\r
-import javax.swing.JTextField;\r
-import javax.swing.JButton;\r
-import java.awt.Dimension;\r
-import java.awt.Toolkit;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ActionListener;\r
-\r
-import javax.swing.JComboBox;\r
-import javax.swing.JRadioButton;\r
-import javax.swing.JFrame;\r
-\r
-import org.tianocore.common.Tools;\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-\r
-/**\r
- GUI for create Protocol definition elements of spd file.\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class PackageProtocols extends JFrame implements ActionListener {\r
-\r
- private int location = -1;\r
-\r
- private SpdFileContents sfc = null;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JLabel jLabelC_Name = null;\r
-\r
- private JTextField jTextFieldC_Name = null;\r
-\r
- private JLabel jLabelGuid = null;\r
-\r
- private JTextField jTextFieldGuid = null;\r
-\r
- private JLabel jLabelFeatureFlag = null;\r
-\r
- private JTextField jTextFieldFeatureFlag = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JLabel jLabelEnableFeature = null;\r
-\r
- private JRadioButton jRadioButtonEnableFeature = null;\r
-\r
- private JRadioButton jRadioButtonDisableFeature = null;\r
-\r
- private JButton jButtonGenerateGuid = null;\r
-\r
- private StarLabel jStarLabel2 = null;\r
-\r
- private StarLabel starLabel = null;\r
-\r
- private JLabel jLabel = null;\r
-\r
- private JTextField jTextField = null;\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void initialize() {\r
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
-\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldProtocolName \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextFieldProtocolName() {\r
- if (jTextFieldC_Name == null) {\r
- jTextFieldC_Name = new JTextField();\r
- jTextFieldC_Name.setBounds(new java.awt.Rectangle(160, 35, 320, 20));\r
- }\r
- return jTextFieldC_Name;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldGuid \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- public JTextField getJTextFieldGuid() {\r
- if (jTextFieldGuid == null) {\r
- jTextFieldGuid = new JTextField();\r
- jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 60, 240, 20));\r
- }\r
- return jTextFieldGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldFeatureFlag \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextFieldFeatureFlag() {\r
- if (jTextFieldFeatureFlag == null) {\r
- jTextFieldFeatureFlag = new JTextField();\r
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 135, 320, 20));\r
- jTextFieldFeatureFlag.setEnabled(false);\r
- }\r
- return jTextFieldFeatureFlag;\r
- }\r
-\r
- /**\r
- This method initializes jButton \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("OK");\r
- jButtonOk.setBounds(new java.awt.Rectangle(290, 190, 90, 20));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButton1 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 190, 90, 20));\r
- jButtonCancel.setPreferredSize(new Dimension(90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jRadioButtonEnableFeature \r
- \r
- @return javax.swing.JRadioButton \r
- **/\r
- private JRadioButton getJRadioButtonEnableFeature() {\r
- if (jRadioButtonEnableFeature == null) {\r
- jRadioButtonEnableFeature = new JRadioButton();\r
- jRadioButtonEnableFeature.setText("Enable");\r
- jRadioButtonEnableFeature.setBounds(new java.awt.Rectangle(160, 110, 90, 20));\r
- jRadioButtonEnableFeature.setEnabled(false);\r
- jRadioButtonEnableFeature.addActionListener(this);\r
- jRadioButtonEnableFeature.setSelected(true);\r
- }\r
- return jRadioButtonEnableFeature;\r
- }\r
-\r
- /**\r
- This method initializes jRadioButtonDisableFeature \r
- \r
- @return javax.swing.JRadioButton \r
- **/\r
- private JRadioButton getJRadioButtonDisableFeature() {\r
- if (jRadioButtonDisableFeature == null) {\r
- jRadioButtonDisableFeature = new JRadioButton();\r
- jRadioButtonDisableFeature.setText("Disable");\r
- jRadioButtonDisableFeature.setEnabled(false);\r
- jRadioButtonDisableFeature.setBounds(new java.awt.Rectangle(320, 110, 90, 20));\r
- jRadioButtonDisableFeature.addActionListener(this);\r
- }\r
- return jRadioButtonDisableFeature;\r
- }\r
-\r
- /**\r
- This method initializes jButtonGenerateGuid \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonGenerateGuid() {\r
- if (jButtonGenerateGuid == null) {\r
- jButtonGenerateGuid = new JButton();\r
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(405, 60, 75, 20));\r
- jButtonGenerateGuid.setText("GEN");\r
- jButtonGenerateGuid.addActionListener(this);\r
- }\r
- return jButtonGenerateGuid;\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- **/\r
- public PackageProtocols(SpdFileContents sfc) {\r
- super();\r
- initialize();\r
- init();\r
- this.setVisible(true);\r
- this.sfc = sfc;\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @return void\r
- **/\r
- private void init() {\r
- this.setSize(500, 250);\r
- this.setName("JFrame");\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Add Protocols");\r
- this.centerWindow();\r
- //this.getRootPane().setDefaultButton(jButtonOk);\r
- initFrame();\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel\r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabel = new JLabel();\r
- jLabel.setBounds(new java.awt.Rectangle(16, 10, 138, 16));\r
- jLabel.setText("Name");\r
- starLabel = new StarLabel();\r
- starLabel.setBounds(new java.awt.Rectangle(0, 9, 10, 20));\r
- jLabelEnableFeature = new JLabel();\r
- jLabelEnableFeature.setText("Enable Feature");\r
- jLabelEnableFeature.setEnabled(false);\r
- jLabelEnableFeature.setBounds(new java.awt.Rectangle(15, 110, 140, 20));\r
- jLabelFeatureFlag = new JLabel();\r
- jLabelFeatureFlag.setText("Feature Flag");\r
- jLabelFeatureFlag.setEnabled(false);\r
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 135, 140, 20));\r
- jLabelGuid = new JLabel();\r
- jLabelGuid.setText("Guid");\r
- jLabelGuid.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
- jLabelC_Name = new JLabel();\r
- jLabelC_Name.setText("C_Name");\r
- jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(jLabelC_Name, null);\r
- jContentPane.add(getJTextFieldProtocolName(), null);\r
- jContentPane.add(jLabelGuid, null);\r
- jContentPane.add(getJTextFieldGuid(), null);\r
- jContentPane.add(jLabelFeatureFlag, null);\r
- jContentPane.add(getJTextFieldFeatureFlag(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(jLabelEnableFeature, null);\r
- jContentPane.add(getJRadioButtonEnableFeature(), null);\r
- jContentPane.add(getJRadioButtonDisableFeature(), null);\r
- jContentPane.add(getJButtonGenerateGuid(), null);\r
-\r
- jStarLabel2 = new StarLabel();\r
- jStarLabel2.setBounds(new java.awt.Rectangle(0, 35, 10, 20));\r
-\r
- jContentPane.add(jStarLabel2, null);\r
- jContentPane.add(starLabel, null);\r
- jContentPane.add(jLabel, null);\r
- jContentPane.add(getJTextField(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes protocol usage type\r
- \r
- **/\r
- private void initFrame() {\r
-\r
- }\r
-\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
-\r
- this.save();\r
- this.dispose();\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
- }\r
-\r
- if (arg0.getSource() == jRadioButtonEnableFeature) {\r
- if (jRadioButtonEnableFeature.isSelected()) {\r
- jRadioButtonDisableFeature.setSelected(false);\r
- }\r
- if (!jRadioButtonDisableFeature.isSelected() && !jRadioButtonEnableFeature.isSelected()) {\r
- jRadioButtonEnableFeature.setSelected(true);\r
- }\r
- }\r
-\r
- if (arg0.getSource() == jRadioButtonDisableFeature) {\r
- if (jRadioButtonDisableFeature.isSelected()) {\r
- jRadioButtonEnableFeature.setSelected(false);\r
- }\r
- if (!jRadioButtonDisableFeature.isSelected() && !jRadioButtonEnableFeature.isSelected()) {\r
- jRadioButtonDisableFeature.setSelected(true);\r
- }\r
- }\r
-\r
- if (arg0.getSource() == jButtonGenerateGuid) {\r
- jTextFieldGuid.setText(Tools.generateUuidString());\r
- }\r
- }\r
-\r
- protected void save() {\r
- try {\r
- sfc.genSpdProtocolDeclarations(jTextField.getText(), jTextFieldC_Name.getText(), jTextFieldGuid.getText(),\r
- null);\r
- } catch (Exception e) {\r
- System.out.println(e.toString());\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jTextField \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- public JTextField getJTextField() {\r
- if (jTextField == null) {\r
- jTextField = new JTextField();\r
- jTextField.setBounds(new java.awt.Rectangle(160, 8, 319, 23));\r
- }\r
- return jTextField;\r
- }\r
-\r
- public JTextField getJTextFieldC_Name() {\r
- return jTextFieldC_Name;\r
- }\r
-\r
- public void setJTextFieldC_Name(JTextField textFieldC_Name) {\r
- jTextFieldC_Name = textFieldC_Name;\r
- }\r
-\r
- public void setJTextField(JTextField textField) {\r
- jTextField = textField;\r
- }\r
-\r
- public void setJTextFieldGuid(JTextField textFieldGuid) {\r
- jTextFieldGuid = textFieldGuid;\r
- }\r
-} // @jve:decl-index=0:visual-constraint="10,10"\r
+++ /dev/null
-/** @file\r
- Java class PackagingMain is top level GUI for PackageEditor.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import java.awt.BorderLayout;\r
-import java.awt.Dimension;\r
-import java.awt.Toolkit;\r
-\r
-import javax.swing.JFileChooser;\r
-import javax.swing.JOptionPane;\r
-import javax.swing.JPanel;\r
-import javax.swing.JFrame;\r
-import java.awt.FlowLayout;\r
-import javax.swing.JButton;\r
-import java.awt.GridLayout;\r
-import java.io.File;\r
-import java.io.FileOutputStream;\r
-import java.util.jar.JarOutputStream;\r
-\r
-/**\r
- GUI for show various GUI wizards for create, update spd file; install, remove package;\r
- create distributable package file.\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class PackagingMain extends JFrame {\r
-\r
- static JFrame frame;\r
-\r
- static String dirForNewSpd = null;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JButton jButton = null;\r
-\r
- private JButton jButton1 = null;\r
-\r
- private JButton jButton2 = null;\r
-\r
- private JButton jButton3 = null;\r
-\r
- private JButton jButton4 = null;\r
-\r
- private JButton jButton5 = null;\r
-\r
- private JFrame pThis = null;\r
-\r
- /**\r
- This method initializes jButton \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton() {\r
- if (jButton == null) {\r
- jButton = new JButton();\r
- jButton.setEnabled(true);\r
- jButton.setText("Exit");\r
- jButton.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- pThis.dispose();\r
- }\r
- });\r
- }\r
- return jButton;\r
- }\r
-\r
- /**\r
- This method initializes jButton1 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton1() {\r
- if (jButton1 == null) {\r
- jButton1 = new JButton();\r
- jButton1.setText("Create an Installable Package");\r
- jButton1.setEnabled(true);\r
- jButton1.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- File theFile = null;\r
- JFileChooser chooser = new JFileChooser();\r
- //\r
- // select the directory that contains files to be distribute\r
- //\r
- chooser.setMultiSelectionEnabled(false);\r
- chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);\r
- int retval = chooser.showOpenDialog(frame);\r
- if (retval == JFileChooser.APPROVE_OPTION) {\r
- try {\r
- theFile = chooser.getSelectedFile();\r
- //\r
- // find the FDPManifest.xml file that should exist \r
- // in the root directory of package \r
- //\r
- String[] list = theFile.list();\r
- boolean manifestExists = false;\r
- for (int i = 0; i < list.length; i++) {\r
- if (list[i].equals("FDPManifest.xml")) {\r
- manifestExists = true;\r
- break;\r
- }\r
- }\r
- if (!manifestExists) {\r
- JOptionPane.showMessageDialog(frame,\r
- "Please Put the FDPManifest.xml File under the Directory You Selected!");\r
- return;\r
- }\r
- //\r
- // create the distribute package .fdp file in the same directory with \r
- // the package root directory selected above.\r
- //\r
- JarOutputStream jos = new JarOutputStream(new FileOutputStream(theFile.getPath() + ".fdp"));\r
- CreateFdp.create(theFile, jos, theFile.getPath());\r
- jos.close();\r
- JOptionPane.showMessageDialog(frame,\r
- "FDP File Created Successfully!");\r
- \r
- \r
- } catch (Exception ee) {\r
- System.out.println(ee.toString());\r
- } \r
- } else {\r
- return;\r
- }\r
- }\r
- });\r
- }\r
- return jButton1;\r
- }\r
-\r
- /**\r
- This method initializes jButton2 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton2() {\r
- if (jButton2 == null) {\r
- jButton2 = new JButton();\r
- jButton2.setText("Remove Package");\r
- jButton2.setEnabled(true);\r
- jButton2.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- ModalFrameUtil.showAsModal(new GuiPkgUninstall(), pThis);\r
- }\r
- });\r
- }\r
- return jButton2;\r
- }\r
-\r
- /**\r
- This method initializes jButton3 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton3() {\r
- if (jButton3 == null) {\r
- jButton3 = new JButton();\r
- jButton3.setText("Install Package");\r
- jButton3.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- ModalFrameUtil.showAsModal(new GuiPkgInstall(), pThis);\r
- }\r
- });\r
- }\r
- return jButton3;\r
- }\r
-\r
- /**\r
- This method initializes jButton4 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton4() {\r
- if (jButton4 == null) {\r
- jButton4 = new JButton();\r
- jButton4.setText("Update Package Description File");\r
- jButton4.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- File theFile = null;\r
- JFileChooser chooser = new JFileChooser();\r
- //\r
- // select the spd file to be updated first\r
- //\r
- chooser.setMultiSelectionEnabled(false);\r
- chooser.setFileFilter(new PkgFileFilter("spd"));\r
- int retval = chooser.showOpenDialog(frame);\r
- if (retval == JFileChooser.APPROVE_OPTION) {\r
- try {\r
- theFile = chooser.getSelectedFile();\r
- if (!theFile.isFile()) {\r
- JOptionPane.showMessageDialog(frame, "Please Select one Spd File!");\r
- return;\r
- }\r
-\r
- } catch (Exception ee) {\r
- System.out.println(ee.toString());\r
- }\r
- } else {\r
- return;\r
- }\r
- //\r
- // create a SpdFileContents for this file and pass it to GUI\r
- //\r
- SpdFileContents sfc = new SpdFileContents(theFile);\r
- ModalFrameUtil.showAsModal(new UpdateAction(sfc), pThis);\r
- }\r
- });\r
- }\r
- return jButton4;\r
- }\r
-\r
- /**\r
- This method initializes jButton5 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton5() {\r
- if (jButton5 == null) {\r
- jButton5 = new JButton();\r
- jButton5.setText("Create Package Description File");\r
- jButton5.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- JFileChooser chooser = new JFileChooser(System.getenv("WORKSPACE"));\r
- chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);\r
- chooser.setMultiSelectionEnabled(false);\r
- chooser.setDialogTitle("Please specify where to save the new spd file");\r
-\r
- int retval = chooser.showSaveDialog(frame);\r
- if (retval == JFileChooser.APPROVE_OPTION) {\r
- try {\r
- File theFile = chooser.getSelectedFile();\r
- PackagingMain.dirForNewSpd = theFile.getPath();\r
-\r
- } catch (Exception ee) {\r
- System.out.println(ee.toString());\r
- }\r
-// pThis.dispose();\r
- }\r
- else {\r
- return;\r
- }\r
- SpdFileContents sfc = new SpdFileContents();\r
- ModalFrameUtil.showAsModal(new PackageAction(sfc), pThis);\r
- }\r
- });\r
- }\r
- return jButton5;\r
- }\r
-\r
- /**\r
- Main for all package editor\r
- \r
- @param args\r
- **/\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
- new PackagingMain().setVisible(true);\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- **/\r
- public PackagingMain() {\r
- super();\r
- initialize();\r
- pThis = this;\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @return void\r
- **/\r
- private void initialize() {\r
- this.setSize(300, 357);\r
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
- this.setTitle("Packaging");\r
- this.setContentPane(getJContentPane());\r
- this.centerWindow();\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel\r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- GridLayout gridLayout = new GridLayout();\r
- gridLayout.setRows(6);\r
- gridLayout.setColumns(1);\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(gridLayout);\r
- jContentPane.add(getJButton5(), null);\r
- jContentPane.add(getJButton4(), null);\r
- jContentPane.add(getJButton3(), null);\r
- jContentPane.add(getJButton2(), null);\r
- jContentPane.add(getJButton1(), null);\r
- jContentPane.add(getJButton(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
-} // @jve:decl-index=0:visual-constraint="125,31"\r
+++ /dev/null
-/** @file\r
- Java class PkgInstallTypeChooser is GUI for upgrade package installation.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import java.awt.Dimension;\r
-import java.awt.Toolkit;\r
-import java.awt.event.MouseEvent;\r
-import java.awt.event.MouseListener;\r
-import java.io.File;\r
-import java.util.List;\r
-import java.util.ListIterator;\r
-import java.util.Vector;\r
-\r
-import javax.swing.JFileChooser;\r
-import javax.swing.JFrame;\r
-import javax.swing.JOptionPane;\r
-import javax.swing.JPanel;\r
-import javax.swing.JDialog;\r
-import javax.swing.JRadioButton;\r
-import javax.swing.JButton;\r
-\r
-import org.tianocore.PackageListDocument;\r
-import javax.swing.JList;\r
-import javax.swing.JTextField;\r
-import javax.swing.JScrollPane;\r
-\r
-/**\r
- GUI for speicial circumstances of package installation.\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class PkgInstallTypeChooser extends JFrame implements MouseListener {\r
-\r
- final static long serialVersionUID = 0;\r
-\r
- static JFrame frame;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JRadioButton jRadioButton = null;\r
-\r
- private JRadioButton jRadioButton1 = null;\r
-\r
- private JButton jButton = null;\r
-\r
- private JButton jButton1 = null;\r
-\r
- private String pn = null;\r
-\r
- ///\r
- /// list of package info from db file\r
- ///\r
- private List<PackageListDocument.PackageList.Package> dd = null;\r
-\r
- private String wk = null;\r
-\r
- private JList jList = null;\r
- \r
- private JScrollPane jScrollPane = null;\r
-\r
- private JTextField jTextField = null;\r
-\r
- private JButton jButton2 = null;\r
-\r
- private JFileChooser chooser = null;\r
-\r
- /**\r
- This is the default constructor\r
- **/\r
- public PkgInstallTypeChooser(String pkgName, String wkSpace, List<PackageListDocument.PackageList.Package> destDir) {\r
- super();\r
- pn = pkgName;\r
- dd = destDir;\r
- wk = wkSpace;\r
- initialize();\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @return void\r
- **/\r
- private void initialize() {\r
- this.setSize(359, 328);\r
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
- this.setTitle("Chooser Installation Type");\r
- this.setContentPane(getJContentPane());\r
- this.centerWindow();\r
- this.insertList();\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
-\r
- /**\r
- initialize jList with package info. from db file\r
- **/\r
- private void insertList() {\r
-\r
- Vector<String> v = new Vector<String>();\r
-\r
- ListIterator lpi = dd.listIterator();\r
- while (lpi.hasNext()) {\r
- PackageListDocument.PackageList.Package p = (PackageListDocument.PackageList.Package) lpi.next();\r
- v.addElement(p.getPackageNameArray(0).getStringValue() + " " + p.getVersionArray(0) + " "\r
- + p.getGuidArray(0).getStringValue());\r
- }\r
- jList.setListData(v);\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel\r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(getJRadioButton(), null);\r
- jContentPane.add(getJRadioButton1(), null);\r
- jContentPane.add(getJButton(), null);\r
- jContentPane.add(getJButton1(), null);\r
- jContentPane.add(getJScrollPane(), null);\r
- jContentPane.add(getJTextField(), null);\r
- jContentPane.add(getJButton2(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- \r
- private JRadioButton getJRadioButton() {\r
- if (jRadioButton == null) {\r
- jRadioButton = new JRadioButton();\r
- jRadioButton.setBounds(new java.awt.Rectangle(17, 39, 186, 21));\r
- jRadioButton.setSelected(true);\r
- jRadioButton.setText("Reinstall Existing Package");\r
- jRadioButton.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- if (jRadioButton.isSelected()) {\r
- jRadioButton1.setSelected(false);\r
- jButton2.setEnabled(false);\r
- jTextField.setEnabled(false);\r
- jList.setEnabled(true);\r
- return;\r
- }\r
- if (jRadioButton1.isSelected()) {\r
- jRadioButton.setSelected(true);\r
- jRadioButton1.setSelected(false);\r
- jList.setEnabled(true);\r
- return;\r
- }\r
-\r
- }\r
- });\r
- }\r
- return jRadioButton;\r
- }\r
-\r
- private JRadioButton getJRadioButton1() {\r
- if (jRadioButton1 == null) {\r
- jRadioButton1 = new JRadioButton();\r
- jRadioButton1.setBounds(new java.awt.Rectangle(17, 155, 176, 21));\r
- jRadioButton1.setText("Install to Directory");\r
- jRadioButton1.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- if (jRadioButton1.isSelected()) {\r
- jRadioButton.setSelected(false);\r
- jList.setEnabled(false);\r
- jButton2.setEnabled(true);\r
- jTextField.setEnabled(true);\r
- return;\r
- }\r
- if (jRadioButton.isSelected()) {\r
- jRadioButton1.setSelected(true);\r
- jRadioButton.setSelected(false);\r
- jButton2.setEnabled(true);\r
- jTextField.setEnabled(true);\r
- return;\r
- }\r
- }\r
- });\r
- }\r
- return jRadioButton1;\r
- }\r
-\r
- private JButton getJButton() {\r
- if (jButton == null) {\r
- jButton = new JButton();\r
- jButton.setPreferredSize(new java.awt.Dimension(34, 20));\r
- jButton.setSize(new java.awt.Dimension(76, 20));\r
- jButton.setText("Ok");\r
- jButton.setLocation(new java.awt.Point(141, 241));\r
- jButton.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- try {\r
- int i = -1;\r
- //\r
- // user selects replace existing package\r
- //\r
- if (jRadioButton.isSelected()) {\r
- int j = jList.getSelectedIndex();\r
- if (j == -1) {\r
- JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),\r
- "Please Select One Package to Replace!");\r
- return;\r
- }\r
- //\r
- // the sequence of jList is the same with List\r
- //\r
- String destDir = dd.get(j).getPathArray(0).getStringValue();\r
- ForceInstallPkg f = new ForceInstallPkg(pn, wk);\r
- //\r
- // record the package info. to be replaced\r
- //\r
- f.setOldVersion(dd.get(j).getVersionArray(0));\r
- f.setOldGuid(dd.get(j).getGuidArray(0).getStringValue());\r
- i = f.install(wk + System.getProperty("file.separator") + destDir);\r
- } else {\r
- //\r
- // user selects install to another directory\r
- //\r
- File f = new File(wk + System.getProperty("file.separator") + FrameworkPkg.dbConfigFile);\r
- if (new DbFileContents(f).checkDir(jTextField.getText().substring(wk.length() + 1)) != 0) {\r
- throw new DirSame();\r
- }\r
- i = new ForceInstallPkg(pn, wk).install(jTextField.getText());\r
- }\r
- if (i == 0) {\r
- JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Package " + pn\r
- + " Installed Successfully!");\r
- }\r
- } catch (DirSame ds) {\r
- System.out.println(ds.toString());\r
- JOptionPane.showMessageDialog(frame,\r
- "Another Package Exists There, Please Select Another Directory!");\r
- } catch (Exception ee) {\r
- System.out.println(ee.toString());\r
- }\r
- }\r
- });\r
- }\r
- return jButton;\r
- }\r
-\r
- /**\r
- * This method initializes jButton1 \r
- * \r
- * @return javax.swing.JButton \r
- */\r
- private JButton getJButton1() {\r
- if (jButton1 == null) {\r
- jButton1 = new JButton();\r
- jButton1.setBounds(new java.awt.Rectangle(238, 241, 78, 20));\r
- jButton1.setText("Cancel");\r
- jButton1.setPreferredSize(new java.awt.Dimension(34, 20));\r
- jButton1.addMouseListener(this);\r
- }\r
- return jButton1;\r
- }\r
-\r
- public void mouseClicked(MouseEvent arg0) {\r
- // TODO Auto-generated method stub\r
- this.dispose();\r
- }\r
-\r
- public void mouseEntered(MouseEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public void mouseExited(MouseEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public void mousePressed(MouseEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public void mouseReleased(MouseEvent arg0) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- private JScrollPane getJScrollPane() {\r
- if (jScrollPane == null) {\r
- jScrollPane = new JScrollPane();\r
- jScrollPane.setBounds(new java.awt.Rectangle(22, 68, 318, 58));\r
- jScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r
- jScrollPane.setViewportView(getJList());\r
- }\r
- return jScrollPane;\r
- }\r
- \r
- private JList getJList() {\r
- if (jList == null) {\r
- jList = new JList();\r
- \r
- jList.setBounds(new java.awt.Rectangle(22, 68, 318, 58));\r
-\r
- }\r
- return jList;\r
- }\r
-\r
- /**\r
- * This method initializes jTextField \r
- * \r
- * @return javax.swing.JTextField \r
- */\r
- private JTextField getJTextField() {\r
- if (jTextField == null) {\r
- jTextField = new JTextField();\r
- jTextField.setBounds(new java.awt.Rectangle(22, 184, 224, 20));\r
- jTextField.setEnabled(false);\r
- jTextField.setText(wk);\r
- }\r
- return jTextField;\r
- }\r
-\r
- private JButton getJButton2() {\r
- if (jButton2 == null) {\r
- jButton2 = new JButton();\r
- jButton2.setLocation(new java.awt.Point(259, 183));\r
- jButton2.setText("Browse");\r
- jButton2.setEnabled(false);\r
- jButton2.setSize(new java.awt.Dimension(81, 20));\r
- jButton2.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- if (chooser == null) {\r
- chooser = new JFileChooser(wk);\r
- }\r
- chooser.setMultiSelectionEnabled(false);\r
- chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);\r
-\r
- int retval = chooser.showOpenDialog(frame);\r
- if (retval == JFileChooser.APPROVE_OPTION) {\r
- jTextField.setText(chooser.getSelectedFile().getPath());\r
-\r
- }\r
-\r
- }\r
- });\r
- }\r
- return jButton2;\r
- }\r
-\r
-} // @jve:decl-index=0:visual-constraint="134,45"\r
+++ /dev/null
-/** @file\r
- Java class SpdFileContents is used to parse spd xml file.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import java.io.File;\r
-import java.io.IOException;\r
-import java.util.List;\r
-import java.util.ListIterator;\r
-import java.math.*;\r
-import org.apache.xmlbeans.XmlObject;\r
-import org.apache.xmlbeans.XmlOptions;\r
-import org.apache.xmlbeans.XmlCursor;\r
-\r
-import org.tianocore.AbstractDocument;\r
-import org.tianocore.GuidDeclarationsDocument;\r
-import org.tianocore.GuidDocument;\r
-import org.tianocore.IncludeHeaderDocument;\r
-import org.tianocore.LibraryClassDeclarationDocument;\r
-import org.tianocore.LibraryClassDeclarationsDocument;\r
-import org.tianocore.LibraryClassDocument;\r
-import org.tianocore.LibraryUsage;\r
-import org.tianocore.LicenseDocument;\r
-import org.tianocore.ModuleTypeDef;\r
-import org.tianocore.MsaFilesDocument;\r
-import org.tianocore.OutputDirectoryDocument;\r
-import org.tianocore.PackageDependenciesDocument;\r
-import org.tianocore.PackageHeadersDocument;\r
-import org.tianocore.PackageNameDocument;\r
-import org.tianocore.PackageSurfaceAreaDocument;\r
-import org.tianocore.PackageType;\r
-import org.tianocore.PackageUsage;\r
-import org.tianocore.PcdDataTypes;\r
-import org.tianocore.PcdDefinitionsDocument;\r
-import org.tianocore.PcdItemTypes;\r
-import org.tianocore.PpiDeclarationsDocument;\r
-import org.tianocore.ProtocolDeclarationsDocument;\r
-import org.tianocore.SpdHeaderDocument;\r
-import org.tianocore.SpecificationDocument;\r
-import org.tianocore.GuidDeclarationsDocument.GuidDeclarations;\r
-\r
-/**\r
- This class processes spd file contents such as add remove xml elements.\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class SpdFileContents {\r
-\r
- private File file = null;\r
-\r
- private PackageSurfaceAreaDocument psad = null;\r
-\r
- private PackageSurfaceAreaDocument.PackageSurfaceArea psaRoot = null;\r
-\r
- private SpdHeaderDocument.SpdHeader spdHdr = null;\r
-\r
- private String spdHdrPkgName = null;\r
-\r
- private GuidDocument.Guid spdHdrGuid = null;\r
-\r
- private LicenseDocument.License spdHdrLicense = null;\r
-\r
- private OutputDirectoryDocument.OutputDirectory spdHdrOutDir = null;\r
-\r
- private LibraryClassDeclarationsDocument.LibraryClassDeclarations spdLibClassDeclarations = null;\r
-\r
- private PackageDependenciesDocument.PackageDependencies spdPkgDeps = null;\r
-\r
- private MsaFilesDocument.MsaFiles spdMsaFiles = null;\r
-\r
- private PackageHeadersDocument.PackageHeaders spdModHdrs = null;\r
-\r
- private GuidDeclarationsDocument.GuidDeclarations spdGuidDeclarations = null;\r
-\r
- private ProtocolDeclarationsDocument.ProtocolDeclarations spdProtocolDeclarations = null;\r
-\r
- private PpiDeclarationsDocument.PpiDeclarations spdPpiDeclarations = null;\r
-\r
- private PcdDefinitionsDocument.PcdDefinitions spdPcdDefinitions = null;\r
-\r
- /**\r
- Constructor to create a new spd file\r
- **/\r
- public SpdFileContents() {\r
-\r
- psad = PackageSurfaceAreaDocument.Factory.newInstance();\r
- psaRoot = psad.addNewPackageSurfaceArea();\r
-\r
- }\r
-\r
- /**\r
- Constructor based on an existing spd file\r
- \r
- @param f Existing spd file\r
- **/\r
- public SpdFileContents(File f) {\r
- try {\r
- psad = PackageSurfaceAreaDocument.Factory.parse(f);\r
- psaRoot = psad.getPackageSurfaceArea();\r
- file = f;\r
- } catch (Exception e) {\r
- System.out.println(e.toString());\r
- }\r
- }\r
-\r
- /**\r
- Remove existing pcd definitions elements using XmlCursor\r
- **/\r
- public void removeSpdPcdDefinition() {\r
- XmlObject o = psaRoot.getPcdDefinitions();\r
- if (o == null)\r
- return;\r
- XmlCursor cursor = o.newCursor();\r
- cursor.removeXml();\r
- spdPcdDefinitions = null;\r
- }\r
-\r
- /**\r
- Remove existing ppi declarations using XmlCursor\r
- **/\r
- public void removeSpdPpiDeclaration() {\r
- XmlObject o = psaRoot.getPpiDeclarations();\r
- if (o == null)\r
- return;\r
- XmlCursor cursor = o.newCursor();\r
- cursor.removeXml();\r
- spdPpiDeclarations = null;\r
- }\r
-\r
- /**\r
- Remove existing protocols declarations using XmlCursor\r
- **/\r
- public void removeSpdProtocolDeclaration() {\r
- XmlObject o = psaRoot.getProtocolDeclarations();\r
- if (o == null)\r
- return;\r
- XmlCursor cursor = o.newCursor();\r
- cursor.removeXml();\r
- spdProtocolDeclarations = null;\r
- }\r
-\r
- /**\r
- Remove existing GUID declarations using XmlCursor\r
- **/\r
- public void removeSpdGuidDeclaration() {\r
- XmlObject o = psaRoot.getGuidDeclarations();\r
- if (o == null)\r
- return;\r
- XmlCursor cursor = o.newCursor();\r
- cursor.removeXml();\r
- spdGuidDeclarations = null; \r
- }\r
-\r
- /**\r
- Remove existing spd package include files using XmlCursor\r
- **/\r
- public void removeSpdPkgHeader() {\r
- XmlObject o = psaRoot.getPackageHeaders();\r
- if (o == null)\r
- return;\r
- XmlCursor cursor = o.newCursor();\r
- cursor.removeXml();\r
- spdModHdrs = null;\r
- }\r
-\r
- /**\r
- Remove existing msa files using XmlCursor\r
- **/\r
- public void removeSpdMsaFile() {\r
- XmlObject o = psaRoot.getMsaFiles();\r
- if (o == null)\r
- return;\r
- XmlCursor cursor = o.newCursor();\r
- cursor.removeXml();\r
- spdMsaFiles = null;\r
- }\r
-\r
- /**\r
- Remove existing library class declarations using XmlCursor\r
- **/\r
- public void removeSpdLibClass() {\r
- XmlObject o = psaRoot.getLibraryClassDeclarations();\r
- if (o == null)\r
- return;\r
- XmlCursor cursor = o.newCursor();\r
- cursor.removeXml();\r
- spdLibClassDeclarations = null;\r
- }\r
-\r
- /**\r
- Get spd file header contents into String array\r
- \r
- @param s Caller allocated String array\r
- **/\r
- public void getSpdHdrDetails(String[] s) {\r
- if (getSpdHdr() == null) {\r
- spdHdr = psaRoot.addNewSpdHeader();\r
- }\r
- s[0] = getSpdHdrPkgName();\r
- s[1] = getSpdHdrGuid().getStringValue();\r
- s[2] = getSpdHdrVer();\r
- s[3] = getSpdHdrAbs();\r
- s[4] = getSpdHdr().getDescription();\r
- s[5] = getSpdHdr().getCopyright();\r
- s[6] = getSpdHdrLicense().getStringValue();\r
- s[7] = getSpdHdr().getCreated();\r
- s[8] = getSpdHdr().getURL();\r
- if (getSpdHdr().getPackageType() != null) {\r
- s[9] = getSpdHdr().getPackageType().toString();\r
- }\r
- //\r
- // convert boolean to String by adding empty String ""\r
- //\r
- s[10] = getSpdHdr().getReadOnly() + "";\r
- s[11] = getSpdHdr().getReadOnly() + "";\r
- }\r
-\r
- /**\r
- Get the number of library class declarations from the size of List\r
- \r
- @return int\r
- **/\r
- public int getSpdLibClassDeclarationCount() {\r
- if (psaRoot.getLibraryClassDeclarations() == null\r
- || psaRoot.getLibraryClassDeclarations().getLibraryClassDeclarationList() == null) {\r
- return 0;\r
- }\r
- return psaRoot.getLibraryClassDeclarations().getLibraryClassDeclarationList().size();\r
- }\r
-\r
- /**\r
- Get available library class declaration into String array\r
- @param libClass Caller allocated two-dimentional String array\r
- **/\r
- public void getSpdLibClassDeclarations(String[][] libClass) {\r
- if (psaRoot.getLibraryClassDeclarations() == null){\r
- return;\r
- }\r
- List<LibraryClassDeclarationDocument.LibraryClassDeclaration> l = psaRoot.getLibraryClassDeclarations()\r
- .getLibraryClassDeclarationList();\r
- int i = 0;\r
- ListIterator li = l.listIterator();\r
- while (li.hasNext()) {\r
- LibraryClassDeclarationDocument.LibraryClassDeclaration lcd = (LibraryClassDeclarationDocument.LibraryClassDeclaration) li\r
- .next();\r
- if (lcd.getLibraryClass() != null) {\r
- libClass[i][0] = lcd.getLibraryClass().getStringValue();\r
- }\r
- if (lcd.getIncludeHeader() != null) {\r
- libClass[i][1] = lcd.getIncludeHeader().getStringValue();\r
- }\r
-\r
- i++;\r
- }\r
-\r
- }\r
- \r
- /**\r
- Get the number of Msa files from the size of List\r
- \r
- @return int\r
- **/\r
- public int getSpdMsaFileCount() {\r
- if (psaRoot.getMsaFiles() == null || psaRoot.getMsaFiles().getMsaFileList() == null) {\r
- return 0;\r
- }\r
- return psaRoot.getMsaFiles().getMsaFileList().size();\r
- }\r
- \r
- /**\r
- Get available Msa file into String array\r
- \r
- @param msaFile Caller allocated two-dimentional String array\r
- **/\r
- public void getSpdMsaFiles(String[][] msaFile) {\r
- if (psaRoot.getMsaFiles() == null) {\r
- return;\r
- }\r
- List<MsaFilesDocument.MsaFiles.MsaFile> l = psaRoot.getMsaFiles().getMsaFileList();\r
- int i = 0;\r
- ListIterator li = l.listIterator();\r
- while (li.hasNext()) {\r
- MsaFilesDocument.MsaFiles.MsaFile m = (MsaFilesDocument.MsaFiles.MsaFile) li.next();\r
- if (m.getFilename() != null) {\r
- msaFile[i][0] = m.getFilename().getStringValue();\r
- }\r
-\r
- i++;\r
- }\r
- }\r
-\r
- /**\r
- Get the number of include header files in PackageHeaders from the size of List\r
- \r
- @return int\r
- **/\r
- public int getSpdPackageHeaderCount() {\r
- if (psaRoot.getPackageHeaders() == null || psaRoot.getPackageHeaders().getIncludeHeaderList() == null) {\r
- return 0;\r
- }\r
- return psaRoot.getPackageHeaders().getIncludeHeaderList().size();\r
- }\r
-\r
- /**\r
- Get available package header contents into String array\r
- \r
- @param pkgHeader Caller allocated two-dimentional String array\r
- **/\r
- public void getSpdPackageHeaders(String[][] pkgHeader) {\r
- if (psaRoot.getPackageHeaders() == null) {\r
- return;\r
- }\r
-\r
- List<IncludeHeaderDocument.IncludeHeader> l = psaRoot.getPackageHeaders().getIncludeHeaderList();\r
- int i = 0;\r
- ListIterator li = l.listIterator();\r
- while (li.hasNext()) {\r
- IncludeHeaderDocument.IncludeHeader ih = (IncludeHeaderDocument.IncludeHeader) li.next();\r
- if (ih.getModuleType() != null) {\r
- pkgHeader[i][0] = ih.getModuleType().toString();\r
- }\r
-\r
- pkgHeader[i][1] = ih.getStringValue();\r
- i++;\r
- }\r
- }\r
-\r
- /**\r
- Get the number of GUID declarations from the size of List\r
- \r
- @return int\r
- **/\r
- public int getSpdGuidDeclarationCount() {\r
- if (psaRoot.getGuidDeclarations() == null || psaRoot.getGuidDeclarations().getEntryList() == null) {\r
- return 0;\r
- }\r
- return psaRoot.getGuidDeclarations().getEntryList().size();\r
- }\r
-\r
- /**\r
- Get available Guid declaration contents into String array\r
- \r
- @param guid Caller allocated two-dimentional String array\r
- **/\r
- public void getSpdGuidDeclarations(String[][] guid) {\r
- if (psaRoot.getGuidDeclarations() == null) {\r
- return;\r
- }\r
- \r
- List<GuidDeclarationsDocument.GuidDeclarations.Entry> l = psaRoot.getGuidDeclarations().getEntryList();\r
- int i = 0;\r
- ListIterator li = l.listIterator();\r
- while (li.hasNext()) {\r
- GuidDeclarationsDocument.GuidDeclarations.Entry e = (GuidDeclarationsDocument.GuidDeclarations.Entry) li\r
- .next();\r
- guid[i][0] = e.getName();\r
- guid[i][1] = e.getCName();\r
- if (e.getGuid() != null) {\r
- guid[i][2] = e.getGuid().getStringValue();\r
- }\r
- i++;\r
- }\r
- }\r
-\r
- /**\r
- Get the number of protocol declarations from the size of List\r
- \r
- @return int\r
- **/\r
- public int getSpdProtocolDeclarationCount() {\r
- if (psaRoot.getProtocolDeclarations() == null || psaRoot.getProtocolDeclarations().getEntryList() == null) {\r
- return 0;\r
- }\r
- return psaRoot.getProtocolDeclarations().getEntryList().size();\r
- }\r
-\r
- /**\r
- Get available protocol declaration contents into String array\r
- \r
- @param protocol Caller allocated two-dimentional String array\r
- **/\r
- public void getSpdProtocolDeclarations(String[][] protocol) {\r
- if (psaRoot.getProtocolDeclarations() == null) {\r
- return;\r
- }\r
- \r
- List<ProtocolDeclarationsDocument.ProtocolDeclarations.Entry> l = psaRoot.getProtocolDeclarations()\r
- .getEntryList();\r
- int i = 0;\r
- ListIterator li = l.listIterator();\r
- while (li.hasNext()) {\r
- ProtocolDeclarationsDocument.ProtocolDeclarations.Entry e = (ProtocolDeclarationsDocument.ProtocolDeclarations.Entry) li\r
- .next();\r
- protocol[i][0] = e.getName();\r
- protocol[i][1] = e.getCName();\r
- if (e.getGuid() != null) {\r
- protocol[i][2] = e.getGuid().getStringValue();\r
- }\r
- i++;\r
- }\r
- }\r
-\r
- /**\r
- Get the number of Ppi declarations from the size of List\r
- \r
- @return int\r
- **/\r
- public int getSpdPpiDeclarationCount() {\r
- if (psaRoot.getPpiDeclarations() == null || psaRoot.getPpiDeclarations().getEntryList() == null) {\r
- return 0;\r
- }\r
- return psaRoot.getPpiDeclarations().getEntryList().size();\r
- }\r
-\r
- /**\r
- Get available Ppi declaration contents into String array\r
- \r
- @param ppi Caller allocated two-dimentional String array\r
- **/\r
- public void getSpdPpiDeclarations(String[][] ppi) {\r
- if (psaRoot.getPpiDeclarations() == null) {\r
- return;\r
- }\r
- \r
- List<PpiDeclarationsDocument.PpiDeclarations.Entry> l = psaRoot.getPpiDeclarations().getEntryList();\r
- int i = 0;\r
- ListIterator li = l.listIterator();\r
- while (li.hasNext()) {\r
- PpiDeclarationsDocument.PpiDeclarations.Entry e = (PpiDeclarationsDocument.PpiDeclarations.Entry) li.next();\r
- ppi[i][0] = e.getName();\r
- ppi[i][1] = e.getCName();\r
- if (e.getGuid() != null) {\r
- ppi[i][2] = e.getGuid().getStringValue();\r
- }\r
-\r
- i++;\r
- }\r
- }\r
-\r
- /**\r
- Get the number of Pcd definitions from the size of List\r
- \r
- @return int\r
- **/\r
- public int getSpdPcdDefinitionCount() {\r
- if (psaRoot.getPcdDefinitions() == null || psaRoot.getPcdDefinitions().getPcdEntryList() == null) {\r
- return 0;\r
- }\r
- return psaRoot.getPcdDefinitions().getPcdEntryList().size();\r
- }\r
-\r
- /**\r
- Get available Pcd definition contents into String array\r
- \r
- @param pcd Caller allocated two-dimentional String array\r
- **/\r
- public void getSpdPcdDefinitions(String[][] pcd) {\r
- if (psaRoot.getPcdDefinitions() == null) {\r
- return;\r
- }\r
- \r
- List<PcdDefinitionsDocument.PcdDefinitions.PcdEntry> l = psaRoot.getPcdDefinitions().getPcdEntryList();\r
- int i = 0;\r
- ListIterator li = l.listIterator();\r
- while (li.hasNext()) {\r
- PcdDefinitionsDocument.PcdDefinitions.PcdEntry e = (PcdDefinitionsDocument.PcdDefinitions.PcdEntry) li\r
- .next();\r
- if (e.getItemType() != null) {\r
- pcd[i][0] = e.getItemType().toString();\r
- }\r
-\r
- pcd[i][1] = e.getCName();\r
- pcd[i][2] = e.getToken();\r
- if (e.getDatumType() != null) {\r
- pcd[i][3] = e.getDatumType().toString();\r
- }\r
-\r
- if (e.getDefaultValue() != null) {\r
- pcd[i][4] = e.getDefaultValue().toString();\r
- }\r
-\r
- i++;\r
- }\r
- }\r
-\r
- /**\r
- Save the processed xml contents to file\r
- \r
- @param spdFile The file to save xml contents\r
- @throws IOException Exceptions during file operation\r
- **/\r
- public void saveAs(File spdFile) throws IOException {\r
-\r
- XmlOptions options = new XmlOptions();\r
-\r
- options.setCharacterEncoding("UTF-8");\r
- options.setSavePrettyPrint();\r
- options.setSavePrettyPrintIndent(2);\r
- try {\r
- psad.save(spdFile, options);\r
- } catch (IOException e) {\r
- e.printStackTrace();\r
- }\r
-\r
- }\r
-\r
- /**\r
- Generate SpdHeader contents using parameters passed in.\r
- \r
- @param pkgName PackageName \r
- @param pkgGuid Guid\r
- @param pkgVer Version\r
- @param pkgAbs Abstract\r
- @param pkgDes Description\r
- @param pkgCpRight Copyright\r
- @param pkgLicense License\r
- @param pkgCreateDate Created\r
- @param pkgUpdateDate Updated\r
- @param pkgURL URL\r
- @param pkgType PackageType\r
- @param pkgRdOnly ReadOnly\r
- @param pkgRePkg RePackage\r
- @param pkgSpec Reserved\r
- @param pkgOutDir Reserved\r
- **/\r
- public void genSpdHeader(String pkgName, String pkgGuid, String pkgVer, String pkgAbs, String pkgDes,\r
- String pkgCpRight, String pkgLicense, String pkgCreateDate, String pkgUpdateDate,\r
- String pkgURL, String pkgType, String pkgRdOnly, String pkgRePkg, String pkgSpec,\r
- String pkgOutDir) {\r
- if (getSpdHdr() == null) {\r
- spdHdr = psaRoot.addNewSpdHeader();\r
- }\r
-\r
- setSpdHdrPkgName(pkgName);\r
- setSpdHdrGuid(pkgGuid);\r
- setSpdHdrVer(pkgVer);\r
- setSpdHdrAbs(pkgAbs);\r
- setSpdHdrDes(pkgDes);\r
- setSpdHdrCpRit(pkgCpRight);\r
- setSpdHdrLicense(pkgLicense);\r
- setSpdHdrCreateDate(pkgCreateDate);\r
- setSpdHdrUpdateDate(pkgUpdateDate);\r
- setSpdHdrURL(pkgURL);\r
- setSpdHdrPkgType(pkgType);\r
- setSpdHdrRdOnly(pkgRdOnly);\r
- setSpdHdrRePkg(pkgRePkg);\r
- setSpdHdrSpec(pkgSpec);\r
- setSpdHdrOutDir(pkgOutDir);\r
- }\r
-\r
- /**\r
- Generate library class declaration element using parameters passed in\r
- \r
- @param libClassBaseName LibraryClass element value\r
- @param libClassUsage Reserved\r
- @param incHdrFileName IncludeHeader element value\r
- @param incHdrAttribGuid Reserved\r
- @param incHdrAttribArch Reserved\r
- @param incHdrAttribPath Reserved\r
- @param incHdrAttribClass Reserved\r
- @param incHdrAttribVer Reserved\r
- @param incHdrAttribOverrideID Reserved\r
- @param incHdrAttribModuleType Reserved\r
- **/\r
- public void genSpdLibClassDeclarations(String libClassBaseName, String libClassUsage, String incHdrFileName,\r
- String incHdrAttribGuid, String incHdrAttribArch, String incHdrAttribPath,\r
- String incHdrAttribClass, String incHdrAttribVer,\r
- String incHdrAttribOverrideID, String incHdrAttribModuleType) {\r
- if (getSpdLibClassDeclarations() == null) {\r
- spdLibClassDeclarations = psaRoot.addNewLibraryClassDeclarations();\r
- }\r
- //\r
- // add contents under LibraryClassDeclarations tag \r
- //\r
- setSpdLibClassDeclaration(libClassBaseName, libClassUsage, incHdrFileName, incHdrAttribGuid, incHdrAttribArch,\r
- incHdrAttribPath, incHdrAttribClass, incHdrAttribVer, incHdrAttribOverrideID,\r
- incHdrAttribModuleType, spdLibClassDeclarations);\r
- }\r
-\r
- /**\r
- Set library class declaration contents under parent tag\r
- \r
- @param clsName LibraryClass element value\r
- @param clsUsage Reserved\r
- @param hdrFile IncludeHeader element value\r
- @param hdrAttribGuid Reserved\r
- @param hdrAttribArch Reserved\r
- @param hdrAttribPath Reserved\r
- @param hdrAttribClass Reserved\r
- @param hdrAttribVer Reserved\r
- @param hdrAttribOverID Reserved\r
- @param hdrAttribModType Reserved\r
- @param parent The tag under which library class declaration goes to\r
- **/\r
- public void setSpdLibClassDeclaration(String clsName, String clsUsage, String hdrFile, String hdrAttribGuid,\r
- String hdrAttribArch, String hdrAttribPath, String hdrAttribClass,\r
- String hdrAttribVer, String hdrAttribOverID, String hdrAttribModType,\r
- XmlObject parent) {\r
-\r
- LibraryClassDeclarationDocument.LibraryClassDeclaration lcd = ((LibraryClassDeclarationsDocument.LibraryClassDeclarations) parent)\r
- .addNewLibraryClassDeclaration();\r
-\r
- setSpdLibraryClass(clsName, clsUsage, lcd);\r
-\r
- setSpdIncludeHeader(null, hdrFile, hdrAttribGuid, hdrAttribArch, hdrAttribPath, hdrAttribClass, hdrAttribVer,\r
- hdrAttribOverID, lcd);\r
- }\r
-\r
- /**\r
- Set the contents of LibraryClass under parent element\r
- \r
- @param clsName LibraryClass element value \r
- @param clsUsage Reserved\r
- @param parent The tag under which library class declaration goes to\r
- **/\r
- public void setSpdLibraryClass(String clsName, String clsUsage, XmlObject parent) {\r
- LibraryClassDeclarationDocument.LibraryClassDeclaration.LibraryClass lc = ((LibraryClassDeclarationDocument.LibraryClassDeclaration) parent).addNewLibraryClass();\r
- lc.setStringValue(clsName);\r
- }\r
-\r
- /**\r
- Set contents of IncludeHeader under parent element\r
- \r
- @param modType Reserved\r
- @param hdrFile IncludeHeader element value\r
- @param hdrAttribGuid Reserved\r
- @param hdrAttribArch Reserved\r
- @param hdrAttribPath Reserved\r
- @param hdrAttribClass Reserved\r
- @param hdrAttribVer Reserved\r
- @param hdrAttribOverID Reserved\r
- @param parent The tag under which library class declaration goes to\r
- **/\r
- public void setSpdIncludeHeader(String modType, String hdrFile, String hdrAttribGuid, String hdrAttribArch,\r
- String hdrAttribPath, String hdrAttribClass, String hdrAttribVer,\r
- String hdrAttribOverID, XmlObject parent) {\r
- IncludeHeaderDocument.IncludeHeader ih = null;\r
- if (parent instanceof LibraryClassDeclarationDocument.LibraryClassDeclaration) {\r
- ih = ((LibraryClassDeclarationDocument.LibraryClassDeclaration) parent).addNewIncludeHeader();\r
- } else if (parent instanceof PackageHeadersDocument.PackageHeaders) {\r
- ih = ((PackageHeadersDocument.PackageHeaders) parent).addNewIncludeHeader();\r
- } else {\r
- return;\r
- }\r
-\r
- ih.setStringValue(hdrFile);\r
- if (hdrAttribGuid != null) {\r
- ih.setGuid(hdrAttribGuid);\r
- }\r
- if (hdrAttribPath != null) {\r
- ih.setPath(hdrAttribPath);\r
- }\r
- if (hdrAttribClass != null) {\r
- ih.setClass1(hdrAttribClass);\r
- }\r
- if (hdrAttribVer != null) {\r
- ih.setVersion(hdrAttribVer);\r
- }\r
- if (hdrAttribOverID != null) {\r
- ih.setOverrideID(Integer.parseInt(hdrAttribOverID));\r
- }\r
- if (modType != null) {\r
- ih.setModuleType(ModuleTypeDef.Enum.forString(modType));\r
-\r
- }\r
-\r
- }\r
-\r
- /**\r
- Reserved method\r
- \r
- @param pkgDepPkgName\r
- @param pkgDepPkgAttribGuid\r
- @param pkgDepPkgAttribVer\r
- @param pkgDepPkgAttribType\r
- @param pkgDepPkgAttribUsage\r
- @param pkgDepPkgAttribInstallDate\r
- @param pkgDepPkgAttribUpdateDate\r
- @param pkgDepPkgAttribPath\r
- **/\r
- public void genSpdPackageDependencies(String pkgDepPkgName, String pkgDepPkgAttribGuid, String pkgDepPkgAttribVer,\r
- String pkgDepPkgAttribType, String pkgDepPkgAttribUsage,\r
- String pkgDepPkgAttribInstallDate, String pkgDepPkgAttribUpdateDate,\r
- String pkgDepPkgAttribPath) {\r
- if (spdPkgDeps == null) {\r
- spdPkgDeps = psaRoot.addNewPackageDependencies();\r
- }\r
-\r
- setSpdPackageName(pkgDepPkgName, pkgDepPkgAttribGuid, pkgDepPkgAttribVer, pkgDepPkgAttribType,\r
- pkgDepPkgAttribUsage, pkgDepPkgAttribInstallDate, pkgDepPkgAttribUpdateDate,\r
- pkgDepPkgAttribPath, spdPkgDeps);\r
- }\r
-\r
- /**\r
- Reserved method\r
- \r
- @param pkgName\r
- @param pkgAttribGuid\r
- @param pkgAttribVer\r
- @param pkgAttribType\r
- @param pkgAttribUsage\r
- @param pkgAttribInstallDate\r
- @param pkgAttribUpdateDate\r
- @param pkgAttribPath\r
- @param parent\r
- **/\r
- public void setSpdPackageName(String pkgName, String pkgAttribGuid, String pkgAttribVer, String pkgAttribType,\r
- String pkgAttribUsage, String pkgAttribInstallDate, String pkgAttribUpdateDate,\r
- String pkgAttribPath, XmlObject parent) {\r
-\r
- PackageNameDocument.PackageName pn = ((PackageDependenciesDocument.PackageDependencies) parent)\r
- .addNewPackageName();\r
- pn.setStringValue(pkgName);\r
- pn.setPackageType(PackageType.Enum.forString(pkgAttribType));\r
- pn.setUsage(PackageUsage.Enum.forString(pkgAttribUsage));\r
- pn.setUpdatedDate(pkgAttribUpdateDate);\r
- }\r
-\r
- /**\r
- Generate MsaFile element.\r
- \r
- @param msaFileName MsaFile element value\r
- @param archType Reserved\r
- **/\r
- public void genSpdMsaFiles(String msaFileName, String archType) {\r
- if (getSpdMsaFiles() == null) {\r
- spdMsaFiles = psaRoot.addNewMsaFiles();\r
- }\r
- setSpdMsaFile(msaFileName, spdMsaFiles);\r
- \r
- }\r
-\r
- /**\r
- Set MsaFile contents under parent element.\r
- \r
- @param msaFileName MsaFile element value\r
- @param parent Element under which MsaFile goes to\r
- **/\r
- public void setSpdMsaFile(String msaFileName, XmlObject parent) {\r
-\r
- ((MsaFilesDocument.MsaFiles) parent).addNewMsaFile().addNewFilename().setStringValue(msaFileName);\r
- }\r
-\r
- /**\r
- Generate PackageHeader element using parameters passed in.\r
- \r
- @param ModHdrModType ModuleType attribute of IncludeHeader element\r
- @param hdrFile IncludeHeader element value\r
- @param hdrAttribGuid Reserved\r
- @param hdrAttribArch Reserved\r
- @param hdrAttribPath Reserved\r
- @param hdrAttribClass Reserved\r
- @param hdrAttribVer Reserved\r
- @param hdrAttribOverID Reserved\r
- **/\r
- public void genSpdModuleHeaders(String ModHdrModType, String hdrFile, String hdrAttribGuid, String hdrAttribArch,\r
- String hdrAttribPath, String hdrAttribClass, String hdrAttribVer,\r
- String hdrAttribOverID) {\r
- if (getSpdModHdrs() == null) {\r
- spdModHdrs = psaRoot.addNewPackageHeaders();\r
- }\r
-\r
- //\r
- // add IncludeHeader under PackageHeaders element\r
- //\r
- setSpdIncludeHeader(ModHdrModType, hdrFile, hdrAttribGuid, hdrAttribArch, hdrAttribPath, hdrAttribClass,\r
- hdrAttribVer, hdrAttribOverID, spdModHdrs);\r
- }\r
-\r
- /**\r
- Generate GUID declaration element using parameters passed in.\r
- \r
- @param guidDeclEntryName Name attribute of Entry element\r
- @param guidDeclCName CName element value\r
- @param guidDeclGuid Guid element value\r
- @param guidDeclFeatureFlag Reserved\r
- **/\r
- public void genSpdGuidDeclarations(String guidDeclEntryName, String guidDeclCName, String guidDeclGuid,\r
- String guidDeclFeatureFlag) {\r
- if (getSpdGuidDeclarations() == null) {\r
- spdGuidDeclarations = psaRoot.addNewGuidDeclarations();\r
- }\r
-\r
- setSpdEntry(guidDeclEntryName, guidDeclCName, guidDeclGuid, guidDeclFeatureFlag, spdGuidDeclarations);\r
- }\r
-\r
- /**\r
- Generate protocol declaration element using parameters passed in.\r
- \r
- @param protocolDeclEntryName Name attribute of Entry element\r
- @param protocolDeclCName CName element value\r
- @param protocolDeclGuid Guid element value\r
- @param protocolDeclFeatureFlag Reserved\r
- **/\r
- public void genSpdProtocolDeclarations(String protocolDeclEntryName, String protocolDeclCName,\r
- String protocolDeclGuid, String protocolDeclFeatureFlag) {\r
- if (getSpdProtocolDeclarations() == null) {\r
- spdProtocolDeclarations = psaRoot.addNewProtocolDeclarations();\r
- }\r
-\r
- setSpdEntry(protocolDeclEntryName, protocolDeclCName, protocolDeclGuid, protocolDeclFeatureFlag,\r
- spdProtocolDeclarations);\r
- }\r
-\r
- /**\r
- Generate PPI declaration element using parameters passed in.\r
- \r
- @param ppiDeclEntryName Name attribute of Entry element\r
- @param ppiDeclCName CName element value\r
- @param ppiDeclGuid Guid element value\r
- @param ppiDeclFeatureFlag Reserved\r
- **/\r
- public void genSpdPpiDeclarations(String ppiDeclEntryName, String ppiDeclCName, String ppiDeclGuid,\r
- String ppiDeclFeatureFlag) {\r
- if (getSpdPpiDeclarations() == null) {\r
- spdPpiDeclarations = psaRoot.addNewPpiDeclarations();\r
- }\r
-\r
- setSpdEntry(ppiDeclEntryName, ppiDeclCName, ppiDeclGuid, ppiDeclFeatureFlag, spdPpiDeclarations);\r
- }\r
-\r
- /**\r
- Set Entry contents using parameters passed in\r
- \r
- @param entryName Name attribute of Entry element\r
- @param cName CName element value\r
- @param guid Guid element value\r
- @param featureFlag Reserved\r
- @param parent The tag under which Entry element goes to\r
- **/\r
- public void setSpdEntry(String entryName, String cName, String guid, String featureFlag, XmlObject parent) {\r
-\r
- if (parent instanceof GuidDeclarationsDocument.GuidDeclarations) {\r
- GuidDeclarationsDocument.GuidDeclarations.Entry e = ((GuidDeclarations) parent).addNewEntry();\r
- e.setName(entryName);\r
- e.setCName(cName);\r
- e.addNewGuid().setStringValue(guid);\r
- \r
- return;\r
- }\r
- if (parent instanceof ProtocolDeclarationsDocument.ProtocolDeclarations) {\r
- ProtocolDeclarationsDocument.ProtocolDeclarations.Entry pe = ((ProtocolDeclarationsDocument.ProtocolDeclarations) parent)\r
- .addNewEntry();\r
- pe.setName(entryName);\r
- pe.setCName(cName);\r
- pe.addNewGuid().setStringValue(guid);\r
- \r
- }\r
- if (parent instanceof PpiDeclarationsDocument.PpiDeclarations) {\r
- PpiDeclarationsDocument.PpiDeclarations.Entry ppe = ((PpiDeclarationsDocument.PpiDeclarations) parent)\r
- .addNewEntry();\r
- ppe.setName(entryName);\r
- ppe.setCName(cName);\r
- ppe.addNewGuid().setStringValue(guid);\r
- \r
- return;\r
- }\r
-\r
- return;\r
-\r
- }\r
-\r
- /**\r
- Generate Pcd definition using parameters passed in\r
- \r
- @param pcdItemTypes ItemType attribute of PcdEntry element\r
- @param cName C_Name element value\r
- @param token Token element value\r
- @param dataType DatumType element value\r
- @param skuEnable Reserved\r
- @param sku Reserved\r
- @param maxSku Reserved\r
- @param hiiEnable Reserved\r
- @param varGuid Reserved\r
- @param varName Reserved\r
- @param defaultString DefaultString element value\r
- **/\r
- public void genSpdPcdDefinitions(String pcdItemTypes, String cName, String token, String dataType,\r
- String skuEnable, String sku, String maxSku, String hiiEnable, String varGuid,\r
- String varName, String defaultString) {\r
- if (getSpdPcdDefinitions() == null) {\r
- spdPcdDefinitions = psaRoot.addNewPcdDefinitions();\r
- }\r
-\r
- setSpdPcdEntry(pcdItemTypes, cName, token, dataType, skuEnable, sku, maxSku, hiiEnable, varGuid, varName,\r
- defaultString, spdPcdDefinitions);\r
- }\r
-\r
- /**\r
- Set Pcd entry contents under parent tag\r
- \r
- @param pcdItemTypes ItemType attribute of PcdEntry element\r
- @param cName C_Name element value\r
- @param token Token element value\r
- @param dataType DatumType element value\r
- @param skuEnable Reserved\r
- @param sku Reserved\r
- @param maxSku Reserved\r
- @param hiiEnable Reserved\r
- @param varGuid Reserved\r
- @param varName Reserved\r
- @param defaultString DefaultString element value\r
- @param parent Tag under which PcdEntry goes to\r
- **/\r
- public void setSpdPcdEntry(String pcdItemTypes, String cName, String token, String dataType, String skuEnable,\r
- String sku, String maxSku, String hiiEnable, String varGuid, String varName,\r
- String defaultString, XmlObject parent) {\r
-\r
- PcdDefinitionsDocument.PcdDefinitions.PcdEntry pe = ((PcdDefinitionsDocument.PcdDefinitions) parent)\r
- .addNewPcdEntry();\r
- pe.setItemType(PcdItemTypes.Enum.forString(pcdItemTypes));\r
- pe.setCName(cName);\r
- pe.setToken(token);\r
- pe.setDatumType(PcdDataTypes.Enum.forString(dataType));\r
- pe.setDefaultValue(defaultString);\r
- \r
- }\r
-\r
- /**\r
- Get PpiDeclarations element\r
- \r
- @return PpiDeclarationsDocument.PpiDeclarations\r
- **/\r
- public PpiDeclarationsDocument.PpiDeclarations getSpdPpiDeclarations() {\r
- if (spdPpiDeclarations == null) {\r
- spdPpiDeclarations = psaRoot.getPpiDeclarations();\r
- }\r
- return spdPpiDeclarations;\r
- }\r
-\r
- /**\r
- Get ProtocolDeclarations element\r
- \r
- @return ProtocolDeclarationsDocument.ProtocolDeclarations\r
- **/\r
- public ProtocolDeclarationsDocument.ProtocolDeclarations getSpdProtocolDeclarations() {\r
- if (spdProtocolDeclarations == null) {\r
- spdProtocolDeclarations = psaRoot.getProtocolDeclarations();\r
- }\r
- return spdProtocolDeclarations;\r
- }\r
-\r
- /**\r
- Get GuidDeclarations element\r
- \r
- @return GuidDeclarationsDocument.GuidDeclarations\r
- **/\r
- public GuidDeclarationsDocument.GuidDeclarations getSpdGuidDeclarations() {\r
- if (spdGuidDeclarations == null) {\r
- spdGuidDeclarations = psaRoot.getGuidDeclarations();\r
- }\r
- return spdGuidDeclarations;\r
- }\r
-\r
- /**\r
- Get PcdDefinitions element\r
- \r
- @return PcdDefinitionsDocument.PcdDefinitions\r
- **/\r
- public PcdDefinitionsDocument.PcdDefinitions getSpdPcdDefinitions() {\r
- if (spdPcdDefinitions == null) {\r
- spdPcdDefinitions = psaRoot.getPcdDefinitions();\r
- }\r
- return spdPcdDefinitions;\r
- }\r
-\r
- /**\r
- Get PackageHeaders element\r
- \r
- @return PackageHeadersDocument.PackageHeaders\r
- **/\r
- public PackageHeadersDocument.PackageHeaders getSpdModHdrs() {\r
- if (spdModHdrs == null) {\r
- spdModHdrs = psaRoot.getPackageHeaders();\r
- }\r
- return spdModHdrs;\r
- }\r
-\r
- /**\r
- Get MsaFiles element\r
- \r
- @return MsaFilesDocument.MsaFiles\r
- **/\r
- public MsaFilesDocument.MsaFiles getSpdMsaFiles() {\r
- if (spdMsaFiles == null) {\r
- spdMsaFiles = psaRoot.getMsaFiles();\r
- }\r
- return spdMsaFiles;\r
- }\r
-\r
- /**\r
- Get LibraryClassDeclarations element\r
- \r
- @return LibraryClassDeclarationsDocument.LibraryClassDeclarations\r
- **/\r
- public LibraryClassDeclarationsDocument.LibraryClassDeclarations getSpdLibClassDeclarations() {\r
- if (spdLibClassDeclarations == null) {\r
- spdLibClassDeclarations = psaRoot.getLibraryClassDeclarations();\r
- }\r
- return spdLibClassDeclarations;\r
- }\r
-\r
- /**\r
- Get SpdHeader element\r
- \r
- @return SpdHeaderDocument.SpdHeader\r
- **/\r
- public SpdHeaderDocument.SpdHeader getSpdHdr() {\r
- if (spdHdr == null) {\r
- spdHdr = psaRoot.getSpdHeader();\r
- }\r
- return spdHdr;\r
- }\r
-\r
- /**\r
- Get Abstract element under tag SpdHeader\r
- \r
- @return AbstractDocument.Abstract\r
- **/\r
- public String getSpdHdrAbs() {\r
- \r
- return getSpdHdr().getAbstract();\r
- }\r
-\r
- /**\r
- Set value to Abstract element\r
- \r
- @param abs The value set to Abstract element\r
- **/\r
- public void setSpdHdrAbs(String abs) {\r
- getSpdHdr().setAbstract(abs);\r
- }\r
-\r
- /**\r
- Set value to Copyright element\r
- \r
- @param cpRit The value set to Copyright element\r
- **/\r
- public void setSpdHdrCpRit(String cpRit) {\r
-\r
- getSpdHdr().setCopyright(cpRit);\r
-\r
- }\r
-\r
- /**\r
- Set value to Created element\r
- \r
- @param createDate The value set to Created element\r
- **/\r
- public void setSpdHdrCreateDate(String createDate) {\r
-\r
- getSpdHdr().setCreated(createDate);\r
-\r
- }\r
-\r
- /**\r
- Set value to Description element\r
- \r
- @param des The value set to Description element\r
- **/\r
- public void setSpdHdrDes(String des) {\r
- getSpdHdr().setDescription(des);\r
- }\r
-\r
- /**\r
- Get Guid element under SpdHdr\r
- \r
- @return GuidDocument.Guid\r
- **/\r
- public GuidDocument.Guid getSpdHdrGuid() {\r
- if (spdHdrGuid == null) {\r
- spdHdrGuid = getSpdHdr().getGuid();\r
- }\r
- return spdHdrGuid;\r
- }\r
-\r
- /**\r
- Set value to Guid element\r
- \r
- @param guid The value set to Guid element\r
- **/\r
- public void setSpdHdrGuid(String guid) {\r
- if (getSpdHdrGuid() != null) {\r
- getSpdHdrGuid().setStringValue(guid);\r
- } else {\r
- spdHdrGuid = getSpdHdr().addNewGuid();\r
- spdHdrGuid.setStringValue(guid);\r
- }\r
- }\r
-\r
- /**\r
- Get Version element under SpdHdr\r
- \r
- @return String\r
- **/\r
- public String getSpdHdrVer() {\r
- if (spdHdr != null)\r
- return spdHdr.getVersion() + "";\r
- else\r
- return null;\r
- }\r
-\r
- /**\r
- Set value to Version element\r
- \r
- @param ver The value set to Version element\r
- **/\r
- public void setSpdHdrVer(String ver) {\r
- if (spdHdr != null) {\r
- spdHdr.setVersion(ver);\r
- }\r
-\r
- }\r
-\r
- /**\r
- Get License element under SpdHdr\r
- \r
- @return LicenseDocument.License\r
- **/\r
- public LicenseDocument.License getSpdHdrLicense() {\r
- if (spdHdrLicense == null) {\r
- spdHdrLicense = getSpdHdr().getLicense();\r
- }\r
- return spdHdrLicense;\r
- }\r
-\r
- /**\r
- Set value to License element\r
- \r
- @param license The value set to License element\r
- **/\r
- public void setSpdHdrLicense(String license) {\r
- if (getSpdHdrLicense() != null) {\r
- getSpdHdrLicense().setStringValue(license);\r
- } else {\r
- spdHdrLicense = getSpdHdr().addNewLicense();\r
- spdHdrLicense.setStringValue(license);\r
- }\r
- }\r
-\r
- /**\r
- Reserved method\r
- \r
- @return\r
- **/\r
- public OutputDirectoryDocument.OutputDirectory getSpdHdrOutDir() {\r
- return spdHdrOutDir;\r
- }\r
-\r
- /**\r
- Reserved method\r
- \r
- @param outdir\r
- **/\r
- public void setSpdHdrOutDir(String outdir) {\r
- if (outdir == null) {\r
- return;\r
- }\r
- if (getSpdHdrOutDir() != null) {\r
- getSpdHdrOutDir().setStringValue(outdir);\r
- } else {\r
- spdHdrOutDir = getSpdHdr().addNewOutputDirectory();\r
- spdHdrOutDir.setStringValue(outdir);\r
- }\r
- }\r
-\r
- /**\r
- Get PackageName element under SpdHdr\r
- \r
- @return PackageNameDocument.PackageName\r
- **/\r
- public String getSpdHdrPkgName() {\r
- if (spdHdrPkgName == null) {\r
- spdHdrPkgName = getSpdHdr().getPackageName();\r
- }\r
- return spdHdrPkgName;\r
- }\r
-\r
- /**\r
- Set value to PackageName element\r
- \r
- @param pkgName The value set to PackageName element\r
- **/\r
- public void setSpdHdrPkgName(String pkgName) {\r
-\r
- if (getSpdHdrPkgName() != null) {\r
- getSpdHdr().setPackageName(pkgName);\r
- } else {\r
- getSpdHdr().setPackageName(pkgName);\r
- }\r
- }\r
-\r
- \r
- /**\r
- Reserved method\r
- \r
- @param spec \r
- **/\r
- public void setSpdHdrSpec(String spec) {\r
- if (spec == null) {\r
- return;\r
- }\r
- \r
- getSpdHdr().setSpecification(spec);\r
- \r
- }\r
-\r
- /**\r
- Set value to PackageType element\r
- \r
- @param pkgType The value set to PackageType element\r
- **/\r
- public void setSpdHdrPkgType(String pkgType) {\r
- getSpdHdr().setPackageType(PackageType.Enum.forString(pkgType));\r
- }\r
-\r
- /**\r
- Set value to ReadOnly element\r
- \r
- @param rdOnly The value set to ReadOnly element\r
- **/\r
- public void setSpdHdrRdOnly(String rdOnly) {\r
-\r
- getSpdHdr().setReadOnly(new Boolean(rdOnly));\r
- }\r
-\r
- /**\r
- Set value to RePackage element\r
- \r
- @param rePkg The value set to RePackage element\r
- **/\r
- public void setSpdHdrRePkg(String rePkg) {\r
-\r
- getSpdHdr().setRePackage(new Boolean(rePkg));\r
- }\r
-\r
- /**\r
- Set value to Updated element\r
- \r
- @param updateDate The value set to Updated element\r
- **/\r
- public void setSpdHdrUpdateDate(String updateDate) {\r
- getSpdHdr().setUpdated(updateDate);\r
- }\r
-\r
- /**\r
- Set value to URL element\r
- \r
- @param url The value set to URL element\r
- **/\r
- public void setSpdHdrURL(String url) {\r
- getSpdHdr().setURL(url);\r
- }\r
-\r
- /**\r
- Get xml file\r
- \r
- @return File\r
- **/\r
- public File getFile() {\r
- return file;\r
- }\r
-\r
- /**\r
- Set file\r
- \r
- @param file File with xml format\r
- **/\r
- public void setFile(File file) {\r
- this.file = file;\r
- }\r
-\r
-}\r
+++ /dev/null
-/** @file\r
- Java class UpdateAction is GUI for update spd file.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import java.awt.BorderLayout;\r
-import java.awt.Dimension;\r
-import java.awt.Toolkit;\r
-\r
-import javax.swing.JFileChooser;\r
-import javax.swing.JOptionPane;\r
-import javax.swing.JPanel;\r
-import javax.swing.JFrame;\r
-import java.awt.GridLayout;\r
-import java.io.File;\r
-\r
-import javax.swing.JButton;\r
-\r
-/**\r
-GUI for update spd file\r
- \r
-@since PackageEditor 1.0\r
-**/\r
-public class UpdateAction extends JFrame {\r
-\r
- static JFrame frame;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JButton jButton = null;\r
-\r
- private JButton jButton1 = null;\r
-\r
- private JButton jButton2 = null;\r
-\r
- private JButton jButton3 = null;\r
-\r
- private JButton jButton4 = null;\r
-\r
- private JButton jButton5 = null;\r
-\r
- private JButton jButton6 = null;\r
-\r
- private JButton jButton7 = null;\r
-\r
- private SpdFileContents sfc = null;\r
-\r
- private JFrame pThis = null; // @jve:decl-index=0:visual-constraint="322,10"\r
-\r
- private JButton jButton8 = null;\r
- \r
- private JButton jButton9 = null;\r
-\r
- /**\r
- This is the default constructor\r
- **/\r
- public UpdateAction(SpdFileContents sfc) {\r
- super();\r
- initialize();\r
- this.sfc = sfc;\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @return void\r
- **/\r
- private void initialize() {\r
- this.setSize(300, 333);\r
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Please Choose an Action");\r
- this.centerWindow();\r
- this.pThis = this;\r
- pThis.setSize(new java.awt.Dimension(316,399));\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel\r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- GridLayout gridLayout = new GridLayout();\r
- gridLayout.setRows(10);\r
- gridLayout.setColumns(1);\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(gridLayout);\r
- jContentPane.add(getJButton8(), null);\r
- jContentPane.add(getJButton7(), null);\r
- jContentPane.add(getJButton6(), null);\r
- jContentPane.add(getJButton5(), null);\r
- jContentPane.add(getJButton4(), null);\r
- jContentPane.add(getJButton3(), null);\r
- jContentPane.add(getJButton2(), null);\r
- jContentPane.add(getJButton1(), null);\r
- jContentPane.add(getJButton(), null);\r
- jContentPane.add(getJButton9(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes jButton \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton() {\r
- if (jButton == null) {\r
- jButton = new JButton();\r
- jButton.setText("Save");\r
- jButton.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- JFileChooser chooser = new JFileChooser(sfc.getFile());\r
- chooser.setMultiSelectionEnabled(false);\r
-\r
- int retval = chooser.showSaveDialog(frame);\r
- if (retval == JFileChooser.APPROVE_OPTION) {\r
- try {\r
- File theFile = chooser.getSelectedFile();\r
- if (theFile.exists()) {\r
- int retVal = JOptionPane.showConfirmDialog(frame, "Are you sure to replace the exising one?", "File Exists",\r
- JOptionPane.YES_NO_OPTION);\r
- if (retVal == JOptionPane.NO_OPTION) {\r
- return;\r
- } \r
- }\r
- sfc.saveAs(theFile);\r
-\r
- } catch (Exception ee) {\r
- System.out.println(ee.toString());\r
- }\r
-// pThis.dispose();\r
- }\r
-\r
- }\r
- });\r
- }\r
- return jButton;\r
- }\r
-\r
- /**\r
- This method initializes jButton1 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton1() {\r
- if (jButton1 == null) {\r
- jButton1 = new JButton();\r
- jButton1.setText("Update PCD Information");\r
- jButton1.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- ModalFrameUtil.showAsModal(new UpdatePCD(sfc), pThis);\r
- }\r
- });\r
- }\r
- return jButton1;\r
- }\r
-\r
- /**\r
- This method initializes jButton2 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton2() {\r
- if (jButton2 == null) {\r
- jButton2 = new JButton();\r
- jButton2.setText("Update PPI Declarations");\r
- jButton2.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- ModalFrameUtil.showAsModal(new UpdatePpi(sfc), pThis);\r
- }\r
- });\r
- }\r
- return jButton2;\r
- }\r
-\r
- /**\r
- This method initializes jButton3 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton3() {\r
- if (jButton3 == null) {\r
- jButton3 = new JButton();\r
- jButton3.setText("Update Protocol Declarations");\r
- jButton3.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- ModalFrameUtil.showAsModal(new UpdateProtocols(sfc), pThis);\r
- }\r
- });\r
- }\r
- return jButton3;\r
- }\r
-\r
- /**\r
- This method initializes jButton4 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton4() {\r
- if (jButton4 == null) {\r
- jButton4 = new JButton();\r
- jButton4.setText("Update GUID Declarations");\r
- jButton4.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- ModalFrameUtil.showAsModal(new UpdateGuids(sfc), pThis);\r
- }\r
- });\r
- }\r
- return jButton4;\r
- }\r
-\r
- /**\r
- This method initializes jButton5 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton5() {\r
- if (jButton5 == null) {\r
- jButton5 = new JButton();\r
- jButton5.setText("Update Package Headers");\r
- jButton5.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- ModalFrameUtil.showAsModal(new UpdatePkgHeader(sfc), pThis);\r
- }\r
- });\r
- }\r
- return jButton5;\r
- }\r
-\r
- /**\r
- This method initializes jButton6 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton6() {\r
- if (jButton6 == null) {\r
- jButton6 = new JButton();\r
- jButton6.setText("Update MSA Files");\r
- jButton6.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- ModalFrameUtil.showAsModal(new UpdateMsaFile(sfc), pThis);\r
- }\r
- });\r
- }\r
- return jButton6;\r
- }\r
-\r
- /**\r
- This method initializes jButton7 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton7() {\r
- if (jButton7 == null) {\r
- jButton7 = new JButton();\r
- jButton7.setText("Update Library Classes");\r
- jButton7.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- ModalFrameUtil.showAsModal(new UpdateLibraryClass(sfc), pThis);\r
- }\r
- });\r
- }\r
- return jButton7;\r
- }\r
-\r
- /**\r
- This method initializes jButton8 \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton8() {\r
- if (jButton8 == null) {\r
- jButton8 = new JButton();\r
- jButton8.setText("Update SPD Header");\r
- jButton8.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- ModalFrameUtil.showAsModal(new UpdateNew(sfc), pThis);\r
- }\r
- });\r
- }\r
- return jButton8;\r
- }\r
-\r
- private JButton getJButton9() {\r
- if (jButton9 == null) {\r
- jButton9 = new JButton();\r
- jButton9.setText("Done");\r
- jButton9.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mouseClicked(java.awt.event.MouseEvent e) {\r
- \r
- pThis.dispose();\r
- \r
- }\r
- });\r
- }\r
- return jButton9;\r
- }\r
-\r
-} // @jve:decl-index=0:visual-constraint="104,41"\r
+++ /dev/null
-/** @file\r
- Java class UpdateGuids is GUI for update GUID declarations in spd file.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import javax.swing.JPanel;\r
-import javax.swing.JFrame;\r
-import javax.swing.JLabel;\r
-import javax.swing.JTextField;\r
-import javax.swing.JButton;\r
-\r
-import javax.swing.JScrollPane;\r
-import javax.swing.JTable;\r
-import javax.swing.table.*;\r
-\r
-import org.tianocore.common.Tools;\r
-\r
-import java.awt.Dimension;\r
-import java.awt.Toolkit;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ActionListener;\r
-import java.io.*;\r
-\r
-/**\r
- GUI for update GUID declarations in spd file\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class UpdateGuids extends JFrame implements ActionListener {\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JScrollPane jScrollPane = null;\r
-\r
- private JTable jTable = null;\r
-\r
- private SpdFileContents sfc = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private DefaultTableModel model = null;\r
-\r
- private JButton jButton = null;\r
-\r
- /**\r
- This is the default constructor\r
- **/\r
- public UpdateGuids(SpdFileContents sfc) {\r
- super();\r
- this.sfc = sfc;\r
- initialize();\r
-\r
- }\r
-\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.save();\r
- this.dispose();\r
-\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
-\r
- }\r
- if (arg0.getSource() == jButton) {\r
- String[] o = { "", "", "" };\r
- model.addRow(o);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @return void\r
- **/\r
- private void initialize() {\r
- this.setSize(669, 568);\r
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
- this.setTitle("Update GUID Declarations");\r
- this.setContentPane(getJContentPane());\r
- this.centerWindow();\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel\r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(getJScrollPane(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJButton(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPane \r
- \r
- @return javax.swing.JScrollPane \r
- **/\r
- private JScrollPane getJScrollPane() {\r
- if (jScrollPane == null) {\r
- jScrollPane = new JScrollPane();\r
- jScrollPane.setBounds(new java.awt.Rectangle(38,45,586,315));\r
- jScrollPane.setViewportView(getJTable());\r
- }\r
- return jScrollPane;\r
- }\r
-\r
- /**\r
- This method initializes jTable \r
- \r
- @return javax.swing.JTable \r
- **/\r
- private JTable getJTable() {\r
- if (jTable == null) {\r
- model = new DefaultTableModel();\r
- jTable = new JTable(model);\r
- jTable.setRowHeight(20);\r
- model.addColumn("Name");\r
- model.addColumn("C_Name");\r
- model.addColumn("GUID");\r
- if (sfc.getSpdGuidDeclarationCount() == 0) {\r
- return jTable;\r
- }\r
- //\r
- // initialize table using SpdFileContents object\r
- //\r
- String[][] saa = new String[sfc.getSpdGuidDeclarationCount()][3];\r
- sfc.getSpdGuidDeclarations(saa);\r
- int i = 0;\r
- while (i < saa.length) {\r
- model.addRow(saa[i]);\r
- i++;\r
- }\r
-\r
- jTable.getColumnModel().getColumn(2).setCellEditor(new GuidEditor());\r
- }\r
- return jTable;\r
- }\r
-\r
- /**\r
- Remove original GUID declarations before saving updated ones\r
- **/\r
- protected void save() {\r
- if (jTable.isEditing()) {\r
- jTable.getCellEditor().stopCellEditing();\r
- }\r
- sfc.removeSpdGuidDeclaration();\r
- int rowCount = model.getRowCount();\r
- int i = 0;\r
-\r
- while (i < rowCount) {\r
- String name = null;\r
- if (model.getValueAt(i, 0) != null) {\r
- name = model.getValueAt(i, 0).toString();\r
- }\r
- String cName = null;\r
- if (model.getValueAt(i, 1) != null) {\r
- cName = model.getValueAt(i, 1).toString();\r
- }\r
- String guid = null;\r
- if (model.getValueAt(i, 2) != null) {\r
- guid = model.getValueAt(i, 2).toString();\r
- }\r
- sfc.genSpdGuidDeclarations(name, cName, guid, null);\r
- i++;\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("Ok");\r
- jButtonOk.setSize(new java.awt.Dimension(84, 20));\r
- jButtonOk.setLocation(new java.awt.Point(316, 486));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setSize(new java.awt.Dimension(82, 20));\r
- jButtonCancel.setLocation(new java.awt.Point(411, 486));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jButton \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton() {\r
- if (jButton == null) {\r
- jButton = new JButton();\r
- jButton.setBounds(new java.awt.Rectangle(219, 487, 78, 18));\r
- jButton.setText("Insert");\r
- jButton.addActionListener(this);\r
- }\r
- return jButton;\r
- }\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
-} // @jve:decl-index=0:visual-constraint="11,7"\r
+++ /dev/null
-/** @file\r
- Java class UpdateLibraryClass is GUI for update library class in spd file.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import javax.swing.JPanel;\r
-import javax.swing.JFrame;\r
-import javax.swing.JLabel;\r
-import javax.swing.JTextField;\r
-import javax.swing.JButton;\r
-\r
-import javax.swing.JScrollPane;\r
-import javax.swing.JTable;\r
-import javax.swing.table.*;\r
-\r
-import org.tianocore.common.Tools;\r
-\r
-import java.awt.Dimension;\r
-import java.awt.Toolkit;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ActionListener;\r
-import java.io.*;\r
-\r
-/**\r
- GUI for update library class in spd file\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class UpdateLibraryClass extends JFrame implements ActionListener {\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JScrollPane jScrollPane = null;\r
-\r
- private JTable jTable = null;\r
-\r
- private SpdFileContents sfc = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private DefaultTableModel model = null;\r
-\r
- private JButton jButton = null;\r
-\r
- /**\r
- This is the default constructor\r
- **/\r
- public UpdateLibraryClass(SpdFileContents sfc) {\r
- super();\r
- this.sfc = sfc;\r
- initialize();\r
-\r
- }\r
-\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.save();\r
- this.dispose();\r
-\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
-\r
- }\r
-\r
- if (arg0.getSource() == jButton) {\r
- String[] o = { "", "" };\r
- model.addRow(o);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @return void\r
- **/\r
- private void initialize() {\r
- this.setSize(604, 553);\r
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
- this.setTitle("Update Library Class Declarations");\r
- this.setContentPane(getJContentPane());\r
- this.centerWindow();\r
- }\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel\r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(getJScrollPane(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJButton(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPane \r
- \r
- @return javax.swing.JScrollPane \r
- **/\r
- private JScrollPane getJScrollPane() {\r
- if (jScrollPane == null) {\r
- jScrollPane = new JScrollPane();\r
- jScrollPane.setBounds(new java.awt.Rectangle(38, 45, 453, 419));\r
- jScrollPane.setViewportView(getJTable());\r
- }\r
- return jScrollPane;\r
- }\r
-\r
- /**\r
- This method initializes jTable \r
- \r
- @return javax.swing.JTable \r
- **/\r
- private JTable getJTable() {\r
- if (jTable == null) {\r
- model = new DefaultTableModel();\r
- jTable = new JTable(model);\r
- jTable.setRowHeight(20);\r
- model.addColumn("LibraryClass");\r
- model.addColumn("IncludeHeader");\r
- if (sfc.getSpdLibClassDeclarationCount() == 0) {\r
- return jTable;\r
- }\r
- //\r
- // initialize table using SpdFileContents object\r
- //\r
- String[][] saa = new String[sfc.getSpdLibClassDeclarationCount()][2];\r
- sfc.getSpdLibClassDeclarations(saa);\r
- int i = 0;\r
- while (i < saa.length) {\r
- model.addRow(saa[i]);\r
- i++;\r
- }\r
-\r
- }\r
- return jTable;\r
- }\r
-\r
- /**\r
- Remove original library classes before saving updated ones\r
- **/\r
- protected void save() {\r
- if (jTable.isEditing()) {\r
- jTable.getCellEditor().stopCellEditing();\r
- }\r
- sfc.removeSpdLibClass();\r
- int rowCount = model.getRowCount();\r
- int i = 0;\r
- while (i < rowCount) {\r
- String libClass = null;\r
- if (model.getValueAt(i, 0) != null) {\r
- libClass = model.getValueAt(i, 0).toString();\r
- }\r
- String headerFile = null;\r
- if (model.getValueAt(i, 1) != null) {\r
- headerFile = model.getValueAt(i, 1).toString();\r
- }\r
- sfc.genSpdLibClassDeclarations(libClass, null, headerFile, null, null, null, null, null, null, null);\r
- i++;\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("Ok");\r
- jButtonOk.setSize(new java.awt.Dimension(84, 20));\r
- jButtonOk.setLocation(new java.awt.Point(316, 486));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setSize(new java.awt.Dimension(82, 20));\r
- jButtonCancel.setLocation(new java.awt.Point(411, 486));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jButton \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton() {\r
- if (jButton == null) {\r
- jButton = new JButton();\r
- jButton.setBounds(new java.awt.Rectangle(221, 486, 79, 19));\r
- jButton.setText("Insert");\r
- jButton.addActionListener(this);\r
- }\r
- return jButton;\r
- }\r
-} // @jve:decl-index=0:visual-constraint="11,7"\r
+++ /dev/null
-/** @file\r
- Java class UpdateLibraryClass is GUI for msa files in spd file.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import javax.swing.JPanel;\r
-import javax.swing.JFrame;\r
-import javax.swing.JLabel;\r
-import javax.swing.JTextField;\r
-import javax.swing.JButton;\r
-\r
-import javax.swing.JScrollPane;\r
-import javax.swing.JTable;\r
-import javax.swing.table.*;\r
-\r
-import org.tianocore.common.Tools;\r
-\r
-import java.awt.Dimension;\r
-import java.awt.Toolkit;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ActionListener;\r
-\r
-/**\r
- GUI for msa files in spd file\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class UpdateMsaFile extends JFrame implements ActionListener {\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JScrollPane jScrollPane = null;\r
-\r
- private JTable jTable = null;\r
-\r
- private SpdFileContents sfc = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private DefaultTableModel model = null;\r
-\r
- private JButton jButton = null;\r
-\r
- /**\r
- This is the default constructor\r
- **/\r
- public UpdateMsaFile(SpdFileContents sfc) {\r
- super();\r
- this.sfc = sfc;\r
- initialize();\r
-\r
- }\r
-\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.save();\r
- this.dispose();\r
-\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
-\r
- }\r
- if (arg0.getSource() == jButton) {\r
- String[] o = { "" };\r
- model.addRow(o);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @return void\r
- **/\r
- private void initialize() {\r
- this.setSize(604, 553);\r
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
- this.setTitle("Update MSA Files");\r
- this.setContentPane(getJContentPane());\r
- this.centerWindow();\r
- }\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel\r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(getJScrollPane(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJButton(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPane \r
- \r
- @return javax.swing.JScrollPane \r
- **/\r
- private JScrollPane getJScrollPane() {\r
- if (jScrollPane == null) {\r
- jScrollPane = new JScrollPane();\r
- jScrollPane.setBounds(new java.awt.Rectangle(38, 45, 453, 419));\r
- jScrollPane.setViewportView(getJTable());\r
- }\r
- return jScrollPane;\r
- }\r
-\r
- /**\r
- This method initializes jTable \r
- \r
- @return javax.swing.JTable \r
- **/\r
- private JTable getJTable() {\r
- if (jTable == null) {\r
- model = new DefaultTableModel();\r
- jTable = new JTable(model);\r
- jTable.setRowHeight(20);\r
- model.addColumn("MSA File");\r
-\r
- if (sfc.getSpdMsaFileCount() == 0) {\r
- return jTable;\r
- }\r
- //\r
- // initialize table using SpdFileContents object\r
- //\r
- String[][] saa = new String[sfc.getSpdMsaFileCount()][1];\r
- sfc.getSpdMsaFiles(saa); \r
- int i = 0;\r
- while (i < saa.length) {\r
- model.addRow(saa[i]);\r
- i++;\r
- }\r
- }\r
- return jTable;\r
- }\r
-\r
- /**\r
- Remove original Msa files before saving updated ones\r
- **/\r
- protected void save() {\r
- if (jTable.isEditing()) {\r
- jTable.getCellEditor().stopCellEditing();\r
- }\r
- sfc.removeSpdMsaFile();\r
- int rowCount = jTable.getRowCount();\r
- int i = 0;\r
- while (i < rowCount) {\r
- String msaFile = null;\r
- if (jTable.getValueAt(i, 0) != null) {\r
- msaFile = jTable.getValueAt(i, 0).toString();\r
- }\r
- sfc.genSpdMsaFiles(msaFile, null);\r
- i++;\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("Ok");\r
- jButtonOk.setSize(new java.awt.Dimension(84, 20));\r
- jButtonOk.setLocation(new java.awt.Point(316, 486));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setSize(new java.awt.Dimension(82, 20));\r
- jButtonCancel.setLocation(new java.awt.Point(411, 486));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jButton \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton() {\r
- if (jButton == null) {\r
- jButton = new JButton();\r
- jButton.setBounds(new java.awt.Rectangle(219, 486, 79, 19));\r
- jButton.setText("Insert");\r
- jButton.addActionListener(this);\r
- }\r
- return jButton;\r
- }\r
-\r
-} // @jve:decl-index=0:visual-constraint="11,7"\r
-\r
+++ /dev/null
-/** @file\r
- Java class UpdateNew is GUI for SpdHeader in spd file.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import java.awt.Dimension;\r
-import java.awt.Toolkit;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ActionListener;\r
-import java.text.SimpleDateFormat;\r
-import java.util.Date;\r
-\r
-import javax.swing.JFrame;\r
-import javax.swing.JPanel;\r
-import javax.swing.JLabel;\r
-import javax.swing.JTextField;\r
-import javax.swing.JButton;\r
-import javax.swing.JTextArea;\r
-import javax.swing.JScrollPane;\r
-\r
-import javax.swing.JComboBox;\r
-\r
-import org.tianocore.common.Tools;\r
-import org.tianocore.packaging.common.ui.StarLabel;\r
-\r
-/**\r
- GUI for update SpdHeader contents\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class UpdateNew extends JFrame implements ActionListener {\r
-\r
- private JPanel jContentPane = null; // @jve:decl-index=0:visual-constraint="128,4"\r
-\r
- private JLabel jLabelBaseName = null;\r
-\r
- private JTextField jTextFieldBaseName = null;\r
-\r
- private JLabel jLabelGuid = null;\r
-\r
- private JTextField jTextFieldGuid = null;\r
-\r
- private JLabel jLabelVersion = null;\r
-\r
- private JTextField jTextFieldVersion = null;\r
-\r
- private JButton jButtonGenerateGuid = null;\r
-\r
- private JLabel jLabelLicense = null;\r
-\r
- private JTextArea jTextAreaLicense = null;\r
-\r
- private JLabel jLabelCopyright = null;\r
-\r
- private JTextArea jTextAreaCopyright = null;\r
-\r
- private JLabel jLabelDescription = null;\r
-\r
- private JTextArea jTextAreaDescription = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JScrollPane jScrollPaneLicense = null;\r
-\r
- private JScrollPane jScrollPaneCopyright = null;\r
-\r
- private JScrollPane jScrollPaneDescription = null;\r
-\r
- private JLabel jLabelAbstract = null;\r
-\r
- private JTextField jTextFieldAbstract = null;\r
-\r
- private JLabel jLabelModuleType = null;\r
-\r
- private JLabel jLabelCompontentType = null;\r
-\r
- private JComboBox jComboBox1 = null;\r
-\r
- private JComboBox jComboBoxModuleType = null;\r
-\r
- private StarLabel jStarLabel1 = null;\r
-\r
- private StarLabel jStarLabel2 = null;\r
-\r
- private StarLabel jStarLabel3 = null;\r
-\r
- private StarLabel jStarLabel4 = null;\r
-\r
- private StarLabel jStarLabel5 = null;\r
-\r
- private StarLabel jStarLabel6 = null;\r
-\r
- private StarLabel jStarLabel7 = null;\r
-\r
- private StarLabel jStarLabel8 = null;\r
-\r
- private JLabel jLabelURL = null;\r
-\r
- private JTextField jTextFieldAbstractURL = null;\r
-\r
- private JLabel jLabel = null;\r
-\r
- private JComboBox jComboBox = null;\r
-\r
- private SpdFileContents sfc = null;\r
-\r
- private String createTime = null;\r
-\r
- /**\r
- This method initializes this\r
- \r
- **/\r
- private void initialize() {\r
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
-\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldBaseName \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextFieldBaseName() {\r
- if (jTextFieldBaseName == null) {\r
- jTextFieldBaseName = new JTextField();\r
- jTextFieldBaseName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
- }\r
- return jTextFieldBaseName;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldGuid \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextFieldGuid() {\r
- if (jTextFieldGuid == null) {\r
- jTextFieldGuid = new JTextField();\r
- jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 35, 240, 20));\r
- }\r
- return jTextFieldGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldVersion \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextFieldVersion() {\r
- if (jTextFieldVersion == null) {\r
- jTextFieldVersion = new JTextField();\r
- jTextFieldVersion.setBounds(new java.awt.Rectangle(160, 60, 320, 20));\r
- }\r
- return jTextFieldVersion;\r
- }\r
-\r
- /**\r
- This method initializes jButtonGenerateGuid \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonGenerateGuid() {\r
- if (jButtonGenerateGuid == null) {\r
- jButtonGenerateGuid = new JButton();\r
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(405, 35, 75, 20));\r
- jButtonGenerateGuid.setText("GEN");\r
- jButtonGenerateGuid.addActionListener(this);\r
- }\r
- return jButtonGenerateGuid;\r
- }\r
-\r
- /**\r
- This method initializes jTextAreaLicense \r
- \r
- @return javax.swing.JTextArea \r
- **/\r
- private JTextArea getJTextAreaLicense() {\r
- if (jTextAreaLicense == null) {\r
- jTextAreaLicense = new JTextArea();\r
- jTextAreaLicense.setText("");\r
- jTextAreaLicense.setLineWrap(true);\r
- }\r
- return jTextAreaLicense;\r
- }\r
-\r
- /**\r
- This method initializes jTextAreaCopyright \r
- \r
- @return javax.swing.JTextArea \r
- **/\r
- private JTextArea getJTextAreaCopyright() {\r
- if (jTextAreaCopyright == null) {\r
- jTextAreaCopyright = new JTextArea();\r
- jTextAreaCopyright.setLineWrap(true);\r
- }\r
- return jTextAreaCopyright;\r
- }\r
-\r
- /**\r
- This method initializes jTextAreaDescription \r
- \r
- @return javax.swing.JTextArea \r
- **/\r
- private JTextArea getJTextAreaDescription() {\r
- if (jTextAreaDescription == null) {\r
- jTextAreaDescription = new JTextArea();\r
- jTextAreaDescription.setLineWrap(true);\r
- }\r
- return jTextAreaDescription;\r
- }\r
-\r
- /**\r
- This method initializes jButtonNext \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("OK");\r
- jButtonOk.setBounds(new java.awt.Rectangle(290, 481, 90, 20));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 481, 90, 20));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPane \r
- \r
- @return javax.swing.JScrollPane \r
- **/\r
- private JScrollPane getJScrollPaneLicense() {\r
- if (jScrollPaneLicense == null) {\r
- jScrollPaneLicense = new JScrollPane();\r
- jScrollPaneLicense.setBounds(new java.awt.Rectangle(160, 85, 320, 80));\r
- jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r
- jScrollPaneLicense.setViewportView(getJTextAreaLicense());\r
- }\r
- return jScrollPaneLicense;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPane1 \r
- \r
- @return javax.swing.JScrollPane \r
- **/\r
- private JScrollPane getJScrollPaneCopyright() {\r
- if (jScrollPaneCopyright == null) {\r
- jScrollPaneCopyright = new JScrollPane();\r
- jScrollPaneCopyright.setBounds(new java.awt.Rectangle(160,170,320,26));\r
- jScrollPaneCopyright.setViewportView(getJTextAreaCopyright());\r
- jScrollPaneCopyright.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r
- }\r
- return jScrollPaneCopyright;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPane2 \r
- \r
- @return javax.swing.JScrollPane \r
- **/\r
- private JScrollPane getJScrollPaneDescription() {\r
- if (jScrollPaneDescription == null) {\r
- jScrollPaneDescription = new JScrollPane();\r
- jScrollPaneDescription.setBounds(new java.awt.Rectangle(160, 322, 320, 80));\r
- jScrollPaneDescription.setViewportView(getJTextAreaDescription());\r
- jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r
- }\r
- return jScrollPaneDescription;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldAbstract \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextFieldAbstract() {\r
- if (jTextFieldAbstract == null) {\r
- jTextFieldAbstract = new JTextField();\r
- jTextFieldAbstract.setBounds(new java.awt.Rectangle(161,216,318,73));\r
- }\r
- return jTextFieldAbstract;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxCompontentType \r
- \r
- @return javax.swing.JComboBox \r
- **/\r
- private JComboBox getJComboBox1() {\r
- if (jComboBox1 == null) {\r
- jComboBox1 = new JComboBox();\r
- jComboBox1.setBounds(new java.awt.Rectangle(160, 465, 91, 20));\r
- }\r
- return jComboBox1;\r
- }\r
-\r
- /**\r
- This method initializes jComboBoxModuleType \r
- \r
- @return javax.swing.JComboBox \r
- **/\r
- private JComboBox getJComboBoxModuleType() {\r
- if (jComboBoxModuleType == null) {\r
- jComboBoxModuleType = new JComboBox();\r
- jComboBoxModuleType.setBounds(new java.awt.Rectangle(160, 440, 91, 20));\r
- }\r
- return jComboBoxModuleType;\r
- }\r
-\r
- /**\r
- This method initializes jTextFieldAbstractURL \r
- \r
- @return javax.swing.JTextField \r
- **/\r
- private JTextField getJTextFieldAbstractURL() {\r
- if (jTextFieldAbstractURL == null) {\r
- jTextFieldAbstractURL = new JTextField();\r
- jTextFieldAbstractURL.setBounds(new java.awt.Rectangle(159, 414, 320, 20));\r
- }\r
- return jTextFieldAbstractURL;\r
- }\r
-\r
- public UpdateNew(SpdFileContents sfc) {\r
- super();\r
- initialize();\r
- init();\r
- this.setVisible(true);\r
- this.sfc = sfc;\r
- initShow();\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @return void\r
- **/\r
- private void init() {\r
- this.setSize(500, 560);\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("SPD File Header");\r
- this.centerWindow();\r
- //this.getRootPane().setDefaultButton(jButtonOk);\r
- initFrame();\r
- }\r
-\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel\r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabel = new JLabel();\r
- jLabel.setBounds(new java.awt.Rectangle(15, 490, 140, 21));\r
- jLabel.setText("Re-Package");\r
- jLabelURL = new JLabel();\r
- jLabelURL.setBounds(new java.awt.Rectangle(16, 414, 25, 20));\r
- jLabelURL.setText("URL");\r
- jLabelCompontentType = new JLabel();\r
- jLabelCompontentType.setBounds(new java.awt.Rectangle(15, 465, 140, 20));\r
- jLabelCompontentType.setText("Read Only");\r
- jLabelModuleType = new JLabel();\r
- jLabelModuleType.setBounds(new java.awt.Rectangle(15, 440, 140, 20));\r
- jLabelModuleType.setText("Package Type");\r
- jLabelAbstract = new JLabel();\r
- jLabelAbstract.setBounds(new java.awt.Rectangle(17,216,140,20));\r
- jLabelAbstract.setText("Abstract");\r
- jLabelDescription = new JLabel();\r
- jLabelDescription.setText("Description");\r
- jLabelDescription.setBounds(new java.awt.Rectangle(16, 325, 140, 20));\r
- jLabelCopyright = new JLabel();\r
- jLabelCopyright.setText("Copyright");\r
- jLabelCopyright.setBounds(new java.awt.Rectangle(15, 171, 140, 20));\r
- jLabelLicense = new JLabel();\r
- jLabelLicense.setText("License");\r
- jLabelLicense.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
- jLabelVersion = new JLabel();\r
- jLabelVersion.setText("Version");\r
- jLabelVersion.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
- jLabelGuid = new JLabel();\r
- jLabelGuid.setPreferredSize(new java.awt.Dimension(25, 15));\r
- jLabelGuid.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
- jLabelGuid.setText("Guid");\r
- jLabelBaseName = new JLabel();\r
- jLabelBaseName.setText("Package Name");\r
- jLabelBaseName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.setLocation(new java.awt.Point(0, 0));\r
- jContentPane.setSize(new java.awt.Dimension(500, 524));\r
- jContentPane.add(jLabelBaseName, null);\r
- jContentPane.add(getJTextFieldBaseName(), null);\r
- jContentPane.add(jLabelGuid, null);\r
- jContentPane.add(getJTextFieldGuid(), null);\r
- jContentPane.add(jLabelVersion, null);\r
- jContentPane.add(getJTextFieldVersion(), null);\r
- jContentPane.add(getJButtonGenerateGuid(), null);\r
- jContentPane.add(jLabelLicense, null);\r
- jContentPane.add(jLabelCopyright, null);\r
- jContentPane.add(jLabelDescription, null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJScrollPaneLicense(), null);\r
- jContentPane.add(getJScrollPaneCopyright(), null);\r
- jContentPane.add(getJScrollPaneDescription(), null);\r
- jContentPane.add(jLabelAbstract, null);\r
- jContentPane.add(getJTextFieldAbstract(), null);\r
- jContentPane.add(jLabelModuleType, null);\r
- jContentPane.add(jLabelCompontentType, null);\r
- jContentPane.add(getJComboBox1(), null);\r
- jContentPane.add(getJComboBoxModuleType(), null);\r
-\r
- jStarLabel1 = new StarLabel();\r
- jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
- jStarLabel2 = new StarLabel();\r
- jStarLabel2.setLocation(new java.awt.Point(0, 35));\r
- jStarLabel3 = new StarLabel();\r
- jStarLabel3.setLocation(new java.awt.Point(0, 60));\r
- jStarLabel4 = new StarLabel();\r
- jStarLabel4.setLocation(new java.awt.Point(0, 85));\r
- jStarLabel5 = new StarLabel();\r
- jStarLabel5.setLocation(new java.awt.Point(0, 171));\r
- jStarLabel6 = new StarLabel();\r
- jStarLabel6.setLocation(new java.awt.Point(1, 325));\r
- jStarLabel7 = new StarLabel();\r
- jStarLabel7.setLocation(new java.awt.Point(2,216));\r
- jStarLabel8 = new StarLabel();\r
- jStarLabel8.setLocation(new java.awt.Point(0, 440));\r
-\r
- jContentPane.add(jStarLabel1, null);\r
- jContentPane.add(jStarLabel2, null);\r
- jContentPane.add(jStarLabel3, null);\r
- jContentPane.add(jStarLabel4, null);\r
- jContentPane.add(jStarLabel5, null);\r
- jContentPane.add(jStarLabel6, null);\r
- jContentPane.add(jStarLabel7, null);\r
- jContentPane.add(jStarLabel8, null);\r
- jContentPane.add(jLabelURL, null);\r
- jContentPane.add(getJTextFieldAbstractURL(), null);\r
- jContentPane.add(jLabel, null);\r
- jContentPane.add(getJComboBox(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.save();\r
- this.dispose();\r
-\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
-\r
- }\r
- if (arg0.getSource() == jButtonGenerateGuid) {\r
- jTextFieldGuid.setText(Tools.generateUuidString());\r
- }\r
- }\r
-\r
- /**\r
- Save all components of Msa Header, update time modified.\r
- \r
- **/\r
- private void save() {\r
- // sfc.removeSpdHdr();\r
- SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");\r
- Date date = new Date();\r
- sfc.genSpdHeader(jTextFieldBaseName.getText(), jTextFieldGuid.getText(), jTextFieldVersion.getText(),\r
- jTextFieldAbstract.getText(), jTextAreaDescription.getText(), jTextAreaCopyright.getText(),\r
- jTextAreaLicense.getText(), createTime, format.format(date), jTextFieldAbstractURL.getText(),\r
- jComboBoxModuleType.getSelectedItem().toString(), jComboBox1.getSelectedItem().toString(),\r
- jComboBox.getSelectedItem().toString(), null, null);\r
- // ModalFrameUtil.showAsModal(new PackageAction(sfc), pThis);\r
- }\r
-\r
- /**\r
- This method initializes module type and compontent type\r
- \r
- **/\r
- private void initFrame() {\r
- jComboBoxModuleType.addItem("SOURCE");\r
- jComboBoxModuleType.addItem("BINARY");\r
- jComboBoxModuleType.addItem("MIXED");\r
-\r
- jComboBox1.addItem("true");\r
- jComboBox1.addItem("false");\r
-\r
- jComboBox.addItem("false");\r
- jComboBox.addItem("true");\r
-\r
- }\r
-\r
- /**\r
- Display original SpdHeader contents during init\r
- **/\r
- private void initShow() {\r
- String[] s = new String[12];\r
-\r
- sfc.getSpdHdrDetails(s);\r
- jTextFieldBaseName.setText(s[0]);\r
- jTextFieldGuid.setText(s[1]);\r
- jTextFieldVersion.setText(s[2]);\r
- jTextFieldAbstract.setText(s[3]);\r
- jTextAreaDescription.setText(s[4]);\r
- jTextAreaCopyright.setText(s[5]);\r
- jTextAreaLicense.setText(s[6]);\r
- createTime = s[7];\r
- jTextFieldAbstractURL.setText(s[8]);\r
- jComboBoxModuleType.setSelectedItem(s[9]);\r
- jComboBox1.setSelectedIndex(s[10].equals("true") ? 0 : 1);\r
- jComboBox.setSelectedIndex(s[11].equals("true") ? 0 : 1);\r
-\r
- }\r
-\r
- /**\r
- This method initializes jComboBox \r
- \r
- @return javax.swing.JComboBox \r
- **/\r
- private JComboBox getJComboBox() {\r
- if (jComboBox == null) {\r
- jComboBox = new JComboBox();\r
- jComboBox.setBounds(new java.awt.Rectangle(160, 490, 90, 20));\r
- }\r
- return jComboBox;\r
- }\r
-\r
-} // @jve:decl-index=0:visual-constraint="38,-22"\r
+++ /dev/null
-/** @file\r
- Java class UpdatePCD is GUI for update PCD definitions in spd file.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import javax.swing.DefaultCellEditor;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JPanel;\r
-import javax.swing.JFrame;\r
-import javax.swing.JLabel;\r
-import javax.swing.JTextField;\r
-import javax.swing.JButton;\r
-\r
-import javax.swing.JScrollPane;\r
-import javax.swing.JTable;\r
-import javax.swing.table.*;\r
-\r
-import org.tianocore.common.Tools;\r
-\r
-import java.awt.Dimension;\r
-import java.awt.Toolkit;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ActionListener;\r
-import java.io.*;\r
-\r
-/**\r
- GUI for update PCD definitions in spd file\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class UpdatePCD extends JFrame implements ActionListener {\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private SpdFileContents sfc = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private DefaultTableModel model = null;\r
-\r
- private String[][] saa = null;\r
-\r
- private JScrollPane jScrollPane = null;\r
-\r
- private JTable jTable = null;\r
-\r
- private JButton jButton = null;\r
-\r
- /**\r
- This is the default constructor\r
- **/\r
- public UpdatePCD(SpdFileContents sfc) {\r
- super();\r
- this.sfc = sfc;\r
- initialize();\r
-\r
- }\r
-\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.save();\r
- this.dispose();\r
-\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
-\r
- }\r
- if (arg0.getSource() == jButton) {\r
- String[] o = { "FEATURE_FLAG", "", "", "UINT8", "0" };\r
- model.addRow(o);\r
- }\r
-\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @return void\r
- **/\r
- private void initialize() {\r
- this.setSize(916, 486);\r
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
- this.setTitle("Update PCD Definitions");\r
- this.setContentPane(getJContentPane());\r
- this.centerWindow();\r
- }\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel\r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJScrollPane(), null);\r
- jContentPane.add(getJButton(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- Remove original Pcd definitions before saving updated ones\r
- **/\r
- protected void save() {\r
- if (jTable.isEditing()) {\r
- jTable.getCellEditor().stopCellEditing();\r
- }\r
- sfc.removeSpdPcdDefinition();\r
- int rowCount = model.getRowCount();\r
- int i = 0;\r
- while (i < rowCount) {\r
- String cName = null;\r
- if (model.getValueAt(i, 1) != null) {\r
- cName = model.getValueAt(i, 1).toString();\r
- }\r
- String token = null;\r
- if (model.getValueAt(i, 2) != null) {\r
- token = model.getValueAt(i, 2).toString();\r
- }\r
- String defaultVal = null;\r
- if (model.getValueAt(i, 4) != null) {\r
- defaultVal = model.getValueAt(i, 4).toString();\r
- }\r
- sfc.genSpdPcdDefinitions(model.getValueAt(i, 0).toString(), cName, token,\r
- model.getValueAt(i, 3).toString(), null, null, null, null, null, null, defaultVal);\r
- i++;\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("Ok");\r
- jButtonOk.setSize(new java.awt.Dimension(84, 20));\r
- jButtonOk.setLocation(new java.awt.Point(605, 404));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setSize(new java.awt.Dimension(82, 20));\r
- jButtonCancel.setLocation(new java.awt.Point(712, 404));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPane \r
- \r
- @return javax.swing.JScrollPane \r
- **/\r
- private JScrollPane getJScrollPane() {\r
- if (jScrollPane == null) {\r
- jScrollPane = new JScrollPane();\r
- jScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);\r
- jScrollPane.setBounds(new java.awt.Rectangle(51, 62, 782, 304));\r
- jScrollPane.setViewportView(getJTable2());\r
- }\r
- return jScrollPane;\r
- }\r
-\r
- /**\r
- This method initializes jTable \r
- \r
- @return javax.swing.JTable \r
- **/\r
- private JTable getJTable2() {\r
- if (jTable == null) {\r
- model = new DefaultTableModel();\r
- jTable = new JTable(model);\r
- jTable.setRowHeight(20);\r
- model.addColumn("ItemType");\r
- model.addColumn("C_Name");\r
- model.addColumn("Token");\r
- model.addColumn("DataType");\r
- model.addColumn("DefaultValue");\r
- //\r
- // Using combobox to display ItemType in table\r
- //\r
- JComboBox jComboBoxItemType = new JComboBox();\r
- jComboBoxItemType.addItem("FEATURE_FLAG");\r
- jComboBoxItemType.addItem("FIXED_AT_BUILD");\r
- jComboBoxItemType.addItem("PATCHABLE_IN_MODULE");\r
- jComboBoxItemType.addItem("DYNAMIC");\r
- jComboBoxItemType.addItem("DYNAMIC_EX");\r
- TableColumn itemTypeColumn = jTable.getColumnModel().getColumn(0);\r
- itemTypeColumn.setCellEditor(new DefaultCellEditor(jComboBoxItemType));\r
- //\r
- // Using combobox to display data type in table\r
- //\r
- JComboBox jComboBoxDataType = new JComboBox();\r
- jComboBoxDataType.addItem("UINT8");\r
- jComboBoxDataType.addItem("UINT16");\r
- jComboBoxDataType.addItem("UINT32");\r
- jComboBoxDataType.addItem("UINT64");\r
- jComboBoxDataType.addItem("VOID*");\r
- jComboBoxDataType.addItem("BOOLEAN");\r
- TableColumn dataTypeColumn = jTable.getColumnModel().getColumn(3);\r
- dataTypeColumn.setCellEditor(new DefaultCellEditor(jComboBoxDataType));\r
-\r
- if (sfc.getSpdPcdDefinitionCount() == 0) {\r
-\r
- return jTable;\r
- }\r
- saa = new String[sfc.getSpdPcdDefinitionCount()][5];\r
- sfc.getSpdPcdDefinitions(saa);\r
- int i = 0;\r
- while (i < saa.length) {\r
- model.addRow(saa[i]);\r
- i++;\r
- }\r
-\r
- }\r
- return jTable;\r
- }\r
-\r
- /**\r
- This method initializes jButton \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton() {\r
- if (jButton == null) {\r
- jButton = new JButton();\r
- jButton.setBounds(new java.awt.Rectangle(499, 404, 77, 20));\r
- jButton.setText("Insert");\r
- jButton.addActionListener(this);\r
- }\r
- return jButton;\r
- }\r
-} // @jve:decl-index=0:visual-constraint="11,7"\r
+++ /dev/null
-/** @file\r
- Java class UpdatePkgHeader is GUI for update Package Header in spd file.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import javax.swing.DefaultCellEditor;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JPanel;\r
-import javax.swing.JFrame;\r
-import javax.swing.JLabel;\r
-import javax.swing.JTextField;\r
-import javax.swing.JButton;\r
-\r
-import javax.swing.JScrollPane;\r
-import javax.swing.JTable;\r
-import javax.swing.table.*;\r
-\r
-import org.tianocore.common.Tools;\r
-\r
-import java.awt.Dimension;\r
-import java.awt.Toolkit;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ActionListener;\r
-import java.io.*;\r
-\r
-/**\r
- GUI for update Package Header in spd file\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class UpdatePkgHeader extends JFrame implements ActionListener {\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JScrollPane jScrollPane = null;\r
-\r
- private JTable jTable = null;\r
-\r
- private SpdFileContents sfc = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private DefaultTableModel model = null;\r
-\r
- private JButton jButton = null;\r
-\r
- /**\r
- This is the default constructor\r
- **/\r
- public UpdatePkgHeader(SpdFileContents sfc) {\r
- super();\r
- this.sfc = sfc;\r
- initialize();\r
-\r
- }\r
-\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.save();\r
- this.dispose();\r
-\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
-\r
- }\r
-\r
- if (arg0.getSource() == jButton) {\r
- String[] o = { "BASE", "" };\r
- model.addRow(o);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @return void\r
- **/\r
- private void initialize() {\r
- this.setSize(604, 553);\r
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
- this.setTitle("Update Package Headers");\r
- this.setContentPane(getJContentPane());\r
- this.centerWindow();\r
- }\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel\r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(getJScrollPane(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJButton(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPane \r
- \r
- @return javax.swing.JScrollPane \r
- **/\r
- private JScrollPane getJScrollPane() {\r
- if (jScrollPane == null) {\r
- jScrollPane = new JScrollPane();\r
- jScrollPane.setBounds(new java.awt.Rectangle(38, 45, 453, 419));\r
- jScrollPane.setViewportView(getJTable());\r
- }\r
- return jScrollPane;\r
- }\r
-\r
- /**\r
- This method initializes jTable \r
- \r
- @return javax.swing.JTable \r
- **/\r
- private JTable getJTable() {\r
- if (jTable == null) {\r
- model = new DefaultTableModel();\r
- jTable = new JTable(model);\r
- jTable.setRowHeight(20);\r
- model.addColumn("ModuleType");\r
- model.addColumn("IncludeHeader");\r
- //\r
- // Using combobox to display ModuleType in table\r
- //\r
- TableColumn typeColumn = jTable.getColumnModel().getColumn(0);\r
- JComboBox jComboBoxSelect = new JComboBox();\r
- jComboBoxSelect.addItem("BASE");\r
- jComboBoxSelect.addItem("SEC");\r
- jComboBoxSelect.addItem("PEI_CORE");\r
- jComboBoxSelect.addItem("PEIM");\r
- jComboBoxSelect.addItem("DXE_CORE");\r
- jComboBoxSelect.addItem("DXE_DRIVER");\r
- jComboBoxSelect.addItem("DXE_RUNTIME_DRIVER");\r
- jComboBoxSelect.addItem("DXE_SAL_DRIVER");\r
- jComboBoxSelect.addItem("DXE_SMM_DRIVER");\r
- jComboBoxSelect.addItem("TOOLS");\r
- jComboBoxSelect.addItem("UEFI_DRIVER");\r
- jComboBoxSelect.addItem("UEFI_APPLICATION");\r
- jComboBoxSelect.addItem("USER_DEFINED");\r
- typeColumn.setCellEditor(new DefaultCellEditor(jComboBoxSelect));\r
-\r
- if (sfc.getSpdPackageHeaderCount() == 0) {\r
- return jTable;\r
- }\r
- String[][] saa = new String[sfc.getSpdPackageHeaderCount()][2];\r
- sfc.getSpdPackageHeaders(saa);\r
- int i = 0;\r
- while (i < saa.length) {\r
- model.addRow(saa[i]);\r
- i++;\r
- }\r
-\r
- }\r
- return jTable;\r
- }\r
-\r
- /**\r
- Remove original package headers before saving updated ones\r
- **/\r
- protected void save() {\r
- if (jTable.isEditing()) {\r
- jTable.getCellEditor().stopCellEditing();\r
- }\r
- sfc.removeSpdPkgHeader();\r
- int rowCount = model.getRowCount();\r
- int i = 0;\r
- while (i < rowCount) {\r
- String headFile = null;\r
- if (model.getValueAt(i, 1) != null) {\r
- headFile = model.getValueAt(i, 1).toString();\r
- }\r
- sfc.genSpdModuleHeaders(model.getValueAt(i, 0).toString(), headFile, null, null, null, null, null, null);\r
- i++;\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("Ok");\r
- jButtonOk.setSize(new java.awt.Dimension(84, 20));\r
- jButtonOk.setLocation(new java.awt.Point(316, 486));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setSize(new java.awt.Dimension(82, 20));\r
- jButtonCancel.setLocation(new java.awt.Point(411, 486));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jButton \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton() {\r
- if (jButton == null) {\r
- jButton = new JButton();\r
- jButton.setBounds(new java.awt.Rectangle(220, 486, 85, 20));\r
- jButton.setText("Insert");\r
- jButton.addActionListener(this);\r
- }\r
- return jButton;\r
- }\r
-} // @jve:decl-index=0:visual-constraint="11,7"\r
+++ /dev/null
-/** @file\r
- Java class UpdatePpi is GUI for update Ppi declarations in spd file.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import javax.swing.JPanel;\r
-import javax.swing.JFrame;\r
-import javax.swing.JLabel;\r
-import javax.swing.JTextField;\r
-import javax.swing.JButton;\r
-\r
-import javax.swing.JScrollPane;\r
-import javax.swing.JTable;\r
-import javax.swing.table.*;\r
-\r
-import org.tianocore.common.Tools;\r
-\r
-import java.awt.Dimension;\r
-import java.awt.Toolkit;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ActionListener;\r
-import java.io.*;\r
-\r
-/**\r
- GUI for update Ppi declarations in spd file.\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class UpdatePpi extends JFrame implements ActionListener {\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JScrollPane jScrollPane = null;\r
-\r
- private JTable jTable = null;\r
-\r
- private SpdFileContents sfc = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private DefaultTableModel model = null;\r
-\r
- private JButton jButton = null;\r
-\r
- /**\r
- This is the default constructor\r
- **/\r
- public UpdatePpi(SpdFileContents sfc) {\r
- super();\r
- this.sfc = sfc;\r
- initialize();\r
-\r
- }\r
-\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.save();\r
- this.dispose();\r
-\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
-\r
- }\r
-\r
- if (arg0.getSource() == jButton) {\r
- String[] o = { "", "", "" };\r
- model.addRow(o);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @return void\r
- **/\r
- private void initialize() {\r
- this.setSize(604, 553);\r
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
- this.setTitle("Update PPI Declarations");\r
- this.setContentPane(getJContentPane());\r
- this.centerWindow();\r
- }\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel\r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(getJScrollPane(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJButton(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPane \r
- \r
- @return javax.swing.JScrollPane \r
- **/\r
- private JScrollPane getJScrollPane() {\r
- if (jScrollPane == null) {\r
- jScrollPane = new JScrollPane();\r
- jScrollPane.setBounds(new java.awt.Rectangle(38, 45, 453, 419));\r
- jScrollPane.setViewportView(getJTable());\r
- }\r
- return jScrollPane;\r
- }\r
-\r
- /**\r
- This method initializes jTable \r
- \r
- @return javax.swing.JTable \r
- **/\r
- private JTable getJTable() {\r
- if (jTable == null) {\r
- model = new DefaultTableModel();\r
- jTable = new JTable(model);\r
- jTable.setRowHeight(20);\r
- model.addColumn("Name");\r
- model.addColumn("C_Name");\r
- model.addColumn("GUID");\r
- //\r
- // initialize table using SpdFileContents object\r
- //\r
- if (sfc.getSpdPpiDeclarationCount() == 0) {\r
- return jTable;\r
- }\r
- String[][] saa = new String[sfc.getSpdPpiDeclarationCount()][3];\r
- sfc.getSpdPpiDeclarations(saa);\r
- int i = 0;\r
- while (i < saa.length) {\r
- model.addRow(saa[i]);\r
- i++;\r
- }\r
-\r
- jTable.getColumnModel().getColumn(2).setCellEditor(new GuidEditor());\r
- }\r
- return jTable;\r
- }\r
-\r
- /**\r
- Remove original ppi declarations before saving updated ones\r
- **/\r
- protected void save() {\r
- if (jTable.isEditing()) {\r
- jTable.getCellEditor().stopCellEditing();\r
- }\r
- sfc.removeSpdPpiDeclaration();\r
- int rowCount = model.getRowCount();\r
- int i = 0;\r
- while (i < rowCount) {\r
- String name = null;\r
- if (model.getValueAt(i, 0) != null) {\r
- name = model.getValueAt(i, 0).toString();\r
- }\r
- String cName = null;\r
- if (model.getValueAt(i, 1) != null) {\r
- cName = model.getValueAt(i, 1).toString();\r
- }\r
- String guid = null;\r
- if (model.getValueAt(i, 2) != null) {\r
- guid = model.getValueAt(i, 2).toString();\r
- }\r
- sfc.genSpdPpiDeclarations(name, cName, guid, null);\r
- i++;\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("Ok");\r
- jButtonOk.setSize(new java.awt.Dimension(84, 20));\r
- jButtonOk.setLocation(new java.awt.Point(316, 486));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setSize(new java.awt.Dimension(82, 20));\r
- jButtonCancel.setLocation(new java.awt.Point(411, 486));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jButton \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton() {\r
- if (jButton == null) {\r
- jButton = new JButton();\r
- jButton.setBounds(new java.awt.Rectangle(224, 488, 72, 18));\r
- jButton.setText("Insert");\r
- jButton.addActionListener(this);\r
- }\r
- return jButton;\r
- }\r
-} // @jve:decl-index=0:visual-constraint="11,7"\r
+++ /dev/null
-/** @file\r
- Java class UpdateProtocols is GUI for update protocol declarations in spd file.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging;\r
-\r
-import javax.swing.JPanel;\r
-import javax.swing.JFrame;\r
-import javax.swing.JLabel;\r
-import javax.swing.JTextField;\r
-import javax.swing.JButton;\r
-\r
-import javax.swing.JScrollPane;\r
-import javax.swing.JTable;\r
-import javax.swing.table.*;\r
-\r
-import org.tianocore.common.Tools;\r
-\r
-import java.awt.Dimension;\r
-import java.awt.Toolkit;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ActionListener;\r
-import java.io.*;\r
-\r
-/**\r
- GUI for update protocol declarations in spd file\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class UpdateProtocols extends JFrame implements ActionListener {\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JScrollPane jScrollPane = null;\r
-\r
- private JTable jTable = null;\r
-\r
- private SpdFileContents sfc = null;\r
-\r
- private JButton jButtonOk = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private DefaultTableModel model = null;\r
-\r
- private JButton jButton = null;\r
-\r
- /**\r
- This is the default constructor\r
- **/\r
- public UpdateProtocols(SpdFileContents sfc) {\r
- super();\r
- this.sfc = sfc;\r
- initialize();\r
-\r
- }\r
-\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonOk) {\r
- this.save();\r
- this.dispose();\r
-\r
- }\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.dispose();\r
-\r
- }\r
-\r
- if (arg0.getSource() == jButton) {\r
- String[] o = { "", "", "" };\r
- model.addRow(o);\r
- }\r
- }\r
-\r
- /**\r
- This method initializes this\r
- \r
- @return void\r
- **/\r
- private void initialize() {\r
- this.setSize(604, 553);\r
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
- this.setTitle("Update Protocol Declarations");\r
- this.setContentPane(getJContentPane());\r
- this.centerWindow();\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow(int intWidth, int intHeight) {\r
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
- }\r
-\r
- /**\r
- Start the window at the center of screen\r
- \r
- **/\r
- protected void centerWindow() {\r
- centerWindow(this.getSize().width, this.getSize().height);\r
- }\r
- /**\r
- This method initializes jContentPane\r
- \r
- @return javax.swing.JPanel\r
- **/\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(getJScrollPane(), null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJButton(), null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPane \r
- \r
- @return javax.swing.JScrollPane \r
- **/\r
- private JScrollPane getJScrollPane() {\r
- if (jScrollPane == null) {\r
- jScrollPane = new JScrollPane();\r
- jScrollPane.setBounds(new java.awt.Rectangle(38, 45, 453, 419));\r
- jScrollPane.setViewportView(getJTable());\r
- }\r
- return jScrollPane;\r
- }\r
-\r
- /**\r
- This method initializes jTable \r
- \r
- @return javax.swing.JTable \r
- **/\r
- private JTable getJTable() {\r
- if (jTable == null) {\r
- model = new DefaultTableModel();\r
- jTable = new JTable(model);\r
- jTable.setRowHeight(20);\r
- model.addColumn("Name");\r
- model.addColumn("C_Name");\r
- model.addColumn("GUID");\r
- //\r
- // initialize table using SpdFileContents object\r
- //\r
- if (sfc.getSpdProtocolDeclarationCount() == 0) {\r
- return jTable;\r
- }\r
- String[][] saa = new String[sfc.getSpdProtocolDeclarationCount()][3];\r
- sfc.getSpdProtocolDeclarations(saa);\r
- int i = 0;\r
- while (i < saa.length) {\r
- model.addRow(saa[i]);\r
- i++;\r
- }\r
-\r
- jTable.getColumnModel().getColumn(2).setCellEditor(new GuidEditor());\r
-\r
- }\r
- return jTable;\r
- }\r
-\r
- /**\r
- Remove original protocol declarations before saving updated ones\r
- **/\r
- protected void save() {\r
- if (jTable.isEditing()) {\r
- jTable.getCellEditor().stopCellEditing();\r
- }\r
- sfc.removeSpdProtocolDeclaration();\r
- int rowCount = model.getRowCount();\r
- int i = 0;\r
- while (i < rowCount) {\r
- String name = null;\r
- if (model.getValueAt(i, 0) != null) {\r
- name = model.getValueAt(i, 0).toString();\r
- }\r
- String cName = null;\r
- if (model.getValueAt(i, 1) != null) {\r
- cName = model.getValueAt(i, 1).toString();\r
- }\r
- String guid = null;\r
- if (model.getValueAt(i, 2) != null) {\r
- guid = model.getValueAt(i, 2).toString();\r
- }\r
- sfc.genSpdProtocolDeclarations(name, cName, guid, null);\r
- i++;\r
- }\r
- }\r
-\r
- /**\r
- This method initializes jButtonOk \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonOk() {\r
- if (jButtonOk == null) {\r
- jButtonOk = new JButton();\r
- jButtonOk.setText("Ok");\r
- jButtonOk.setSize(new java.awt.Dimension(84, 20));\r
- jButtonOk.setLocation(new java.awt.Point(316, 486));\r
- jButtonOk.addActionListener(this);\r
- }\r
- return jButtonOk;\r
- }\r
-\r
- /**\r
- This method initializes jButtonCancel \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.setSize(new java.awt.Dimension(82, 20));\r
- jButtonCancel.setLocation(new java.awt.Point(411, 486));\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- This method initializes jButton \r
- \r
- @return javax.swing.JButton \r
- **/\r
- private JButton getJButton() {\r
- if (jButton == null) {\r
- jButton = new JButton();\r
- jButton.setBounds(new java.awt.Rectangle(232, 486, 71, 19));\r
- jButton.setText("Insert");\r
- jButton.addActionListener(this);\r
- }\r
- return jButton;\r
- }\r
-} // @jve:decl-index=0:visual-constraint="11,7"\r
+++ /dev/null
-/** @file\r
- Java class StarLabel is used to create star label.\r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.packaging.common.ui;\r
-\r
-import javax.swing.JLabel;\r
-\r
-/**\r
- Derived from JLabel class to have a red star on it.\r
- \r
- @since PackageEditor 1.0\r
-**/\r
-public class StarLabel extends JLabel{\r
- /**\r
- * This is the default constructor\r
- */\r
- public StarLabel() {\r
- super();\r
- init();\r
- }\r
- \r
- /**\r
- Create a label with red star * appear on it\r
- **/\r
- private void init() {\r
- this.setText("*");\r
- this.setSize(new java.awt.Dimension(10,20));\r
- this.setForeground(java.awt.Color.red);\r
- this.setFont(new java.awt.Font("DialogInput", java.awt.Font.BOLD, 14));\r
- this.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);\r
- }\r
-}\r