commit 35f3a8cf3f6cd4bcf4d030f41273937a91baf596 Author: xiongcz Date: Fri Jun 6 13:43:57 2025 +0800 1 diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..d277373 --- /dev/null +++ b/.classpath @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..aac7329 --- /dev/null +++ b/.project @@ -0,0 +1,28 @@ + + + com.connor.zf + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..0c68a61 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF new file mode 100644 index 0000000..6935759 --- /dev/null +++ b/META-INF/MANIFEST.MF @@ -0,0 +1,105 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Zf +Bundle-SymbolicName: com.connor.zf;singleton:=true +Bundle-Version: 1.0.0 +Bundle-Vendor: CONNOR +Require-Bundle: org.eclipse.ui, + com.teamcenter.rac.common;bundle-version="13000.1.0", + com.teamcenter.rac.kernel;bundle-version="13000.1.0", + com.teamcenter.rac.tcapps;bundle-version="13000.1.0", + com.teamcenter.rac.aifrcp;bundle-version="13000.1.0", + com.teamcenter.rac.util;bundle-version="13000.1.0", + org.eclipse.core.runtime;bundle-version="3.15.100", + TcSoaCoreLoose;bundle-version="13000.1.0", + TcSoaCoreRac;bundle-version="13000.1.0", + TcSoaCoreTypes;bundle-version="13000.1.0", + com.teamcenter.rac.external;bundle-version="13000.1.0" +Automatic-Module-Name: com.connor.zf +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-ClassPath: ., + lib/ojdbc7.jar, + lib/jfxrt.jar, + lib/jfxswt.jar, + axis2_lib/activation-1.1.jar, + axis2_lib/antlr-2.7.7.jar, + axis2_lib/apache-mime4j-core-0.7.2.jar, + axis2_lib/axiom-api-1.2.13.jar, + axis2_lib/axiom-dom-1.2.13.jar, + axis2_lib/axiom-impl-1.2.13.jar, + axis2_lib/axis2-adb-1.6.2.jar, + axis2_lib/axis2-adb-codegen-1.6.2.jar, + axis2_lib/axis2-ant-plugin-1.6.2.jar, + axis2_lib/axis2-clustering-1.6.2.jar, + axis2_lib/axis2-codegen-1.6.2.jar, + axis2_lib/axis2-corba-1.6.2.jar, + axis2_lib/axis2-fastinfoset-1.6.2.jar, + axis2_lib/axis2-java2wsdl-1.6.2.jar, + axis2_lib/axis2-jaxbri-1.6.2.jar, + axis2_lib/axis2-jaxws-1.6.2.jar, + axis2_lib/axis2-jibx-1.6.2.jar, + axis2_lib/axis2-json-1.6.2.jar, + axis2_lib/axis2-kernel-1.6.2.jar, + axis2_lib/axis2-metadata-1.6.2.jar, + axis2_lib/axis2-mtompolicy-1.6.2.jar, + axis2_lib/axis2-saaj-1.6.2.jar, + axis2_lib/axis2-soapmonitor-servlet-1.6.2.jar, + axis2_lib/axis2-spring-1.6.2.jar, + axis2_lib/axis2-transport-http-1.6.2.jar, + axis2_lib/axis2-transport-local-1.6.2.jar, + axis2_lib/axis2-xmlbeans-1.6.2.jar, + axis2_lib/bcel-5.1.jar, + axis2_lib/commons-cli-1.2.jar, + axis2_lib/commons-codec-1.3.jar, + axis2_lib/commons-fileupload-1.2.jar, + axis2_lib/commons-httpclient-3.1.jar, + axis2_lib/commons-io-1.4.jar, + axis2_lib/commons-logging-1.1.1.jar, + axis2_lib/geronimo-annotation_1.0_spec-1.1.jar, + axis2_lib/geronimo-jaxws_2.2_spec-1.0.jar, + axis2_lib/geronimo-jta_1.1_spec-1.1.jar, + axis2_lib/geronimo-saaj_1.3_spec-1.0.1.jar, + axis2_lib/geronimo-stax-api_1.0_spec-1.0.1.jar, + axis2_lib/geronimo-ws-metadata_2.0_spec-1.1.2.jar, + axis2_lib/httpcore-4.0.jar, + axis2_lib/hutool-all-5.0.7.jar, + axis2_lib/jalopy-1.5rc3.jar, + axis2_lib/jaxb-api-2.1.jar, + axis2_lib/jaxb-impl-2.1.7.jar, + axis2_lib/jaxb-xjc-2.1.7.jar, + axis2_lib/jaxen-1.1.1.jar, + axis2_lib/jaxws-tools-2.1.3.jar, + axis2_lib/jettison-1.0-RC2.jar, + axis2_lib/jibx-bind-1.2.jar, + axis2_lib/jibx-run-1.2.jar, + axis2_lib/jsr311-api-1.0.jar, + axis2_lib/juli-6.0.16.jar, + axis2_lib/log4j-1.2.15.jar, + axis2_lib/mail-1.4.jar, + axis2_lib/mex-1.6.2-impl.jar, + axis2_lib/neethi-3.0.2.jar, + axis2_lib/regexp-1.2.jar, + axis2_lib/tribes-6.0.16.jar, + axis2_lib/woden-api-1.0M9.jar, + axis2_lib/woden-impl-commons-1.0M9.jar, + axis2_lib/woden-impl-dom-1.0M9.jar, + axis2_lib/wsdl4j-1.6.2.jar, + axis2_lib/wstx-asl-3.2.9.jar, + axis2_lib/xalan-2.7.0.jar, + axis2_lib/xml-resolver-1.2.jar, + axis2_lib/xmlbeans-2.3.0.jar, + axis2_lib/XmlSchema-1.4.7.jar, + jsonlib/commons-beanutils-1.7.0.jar, + jsonlib/commons-collections-3.2.jar, + jsonlib/commons-lang-2.4.jar, + jsonlib/commons-logging-1.1.jar, + jsonlib/ezmorph-1.0.4.jar, + jsonlib/fastjson-1.2.9-javadoc.jar, + jsonlib/fastjson-1.2.9-sources.jar, + jsonlib/fastjson-1.2.9.jar, + jsonlib/jdom.jar, + jsonlib/json-lib-2.2.2-jdk15.jar, + jsonlib/json-lib-2.2.3-jdk13.jar, + lib/k.util_1.0.0.jar, + lib/sqljdbc4.jar +Export-Package: com.connor.zf.dbom2ebom diff --git a/axis2_lib/XmlSchema-1.4.7.jar b/axis2_lib/XmlSchema-1.4.7.jar new file mode 100644 index 0000000..79251c6 Binary files /dev/null and b/axis2_lib/XmlSchema-1.4.7.jar differ diff --git a/axis2_lib/activation-1.1.jar b/axis2_lib/activation-1.1.jar new file mode 100644 index 0000000..53f82a1 Binary files /dev/null and b/axis2_lib/activation-1.1.jar differ diff --git a/axis2_lib/antlr-2.7.7.jar b/axis2_lib/antlr-2.7.7.jar new file mode 100644 index 0000000..5e5f14b Binary files /dev/null and b/axis2_lib/antlr-2.7.7.jar differ diff --git a/axis2_lib/apache-mime4j-core-0.7.2.jar b/axis2_lib/apache-mime4j-core-0.7.2.jar new file mode 100644 index 0000000..b5c225b Binary files /dev/null and b/axis2_lib/apache-mime4j-core-0.7.2.jar differ diff --git a/axis2_lib/axiom-api-1.2.13.jar b/axis2_lib/axiom-api-1.2.13.jar new file mode 100644 index 0000000..84cb42c Binary files /dev/null and b/axis2_lib/axiom-api-1.2.13.jar differ diff --git a/axis2_lib/axiom-dom-1.2.13.jar b/axis2_lib/axiom-dom-1.2.13.jar new file mode 100644 index 0000000..4890bb2 Binary files /dev/null and b/axis2_lib/axiom-dom-1.2.13.jar differ diff --git a/axis2_lib/axiom-impl-1.2.13.jar b/axis2_lib/axiom-impl-1.2.13.jar new file mode 100644 index 0000000..a959b28 Binary files /dev/null and b/axis2_lib/axiom-impl-1.2.13.jar differ diff --git a/axis2_lib/axis2-adb-1.6.2.jar b/axis2_lib/axis2-adb-1.6.2.jar new file mode 100644 index 0000000..6234fdb Binary files /dev/null and b/axis2_lib/axis2-adb-1.6.2.jar differ diff --git a/axis2_lib/axis2-adb-codegen-1.6.2.jar b/axis2_lib/axis2-adb-codegen-1.6.2.jar new file mode 100644 index 0000000..7d037d4 Binary files /dev/null and b/axis2_lib/axis2-adb-codegen-1.6.2.jar differ diff --git a/axis2_lib/axis2-ant-plugin-1.6.2.jar b/axis2_lib/axis2-ant-plugin-1.6.2.jar new file mode 100644 index 0000000..771b222 Binary files /dev/null and b/axis2_lib/axis2-ant-plugin-1.6.2.jar differ diff --git a/axis2_lib/axis2-clustering-1.6.2.jar b/axis2_lib/axis2-clustering-1.6.2.jar new file mode 100644 index 0000000..e45be99 Binary files /dev/null and b/axis2_lib/axis2-clustering-1.6.2.jar differ diff --git a/axis2_lib/axis2-codegen-1.6.2.jar b/axis2_lib/axis2-codegen-1.6.2.jar new file mode 100644 index 0000000..f742f19 Binary files /dev/null and b/axis2_lib/axis2-codegen-1.6.2.jar differ diff --git a/axis2_lib/axis2-corba-1.6.2.jar b/axis2_lib/axis2-corba-1.6.2.jar new file mode 100644 index 0000000..ee3c78e Binary files /dev/null and b/axis2_lib/axis2-corba-1.6.2.jar differ diff --git a/axis2_lib/axis2-fastinfoset-1.6.2.jar b/axis2_lib/axis2-fastinfoset-1.6.2.jar new file mode 100644 index 0000000..d10c36a Binary files /dev/null and b/axis2_lib/axis2-fastinfoset-1.6.2.jar differ diff --git a/axis2_lib/axis2-java2wsdl-1.6.2.jar b/axis2_lib/axis2-java2wsdl-1.6.2.jar new file mode 100644 index 0000000..0bb869d Binary files /dev/null and b/axis2_lib/axis2-java2wsdl-1.6.2.jar differ diff --git a/axis2_lib/axis2-jaxbri-1.6.2.jar b/axis2_lib/axis2-jaxbri-1.6.2.jar new file mode 100644 index 0000000..616eec9 Binary files /dev/null and b/axis2_lib/axis2-jaxbri-1.6.2.jar differ diff --git a/axis2_lib/axis2-jaxws-1.6.2.jar b/axis2_lib/axis2-jaxws-1.6.2.jar new file mode 100644 index 0000000..064351a Binary files /dev/null and b/axis2_lib/axis2-jaxws-1.6.2.jar differ diff --git a/axis2_lib/axis2-jibx-1.6.2.jar b/axis2_lib/axis2-jibx-1.6.2.jar new file mode 100644 index 0000000..75f9d1a Binary files /dev/null and b/axis2_lib/axis2-jibx-1.6.2.jar differ diff --git a/axis2_lib/axis2-json-1.6.2.jar b/axis2_lib/axis2-json-1.6.2.jar new file mode 100644 index 0000000..edd7936 Binary files /dev/null and b/axis2_lib/axis2-json-1.6.2.jar differ diff --git a/axis2_lib/axis2-kernel-1.6.2.jar b/axis2_lib/axis2-kernel-1.6.2.jar new file mode 100644 index 0000000..3ae5f7a Binary files /dev/null and b/axis2_lib/axis2-kernel-1.6.2.jar differ diff --git a/axis2_lib/axis2-metadata-1.6.2.jar b/axis2_lib/axis2-metadata-1.6.2.jar new file mode 100644 index 0000000..492f1ac Binary files /dev/null and b/axis2_lib/axis2-metadata-1.6.2.jar differ diff --git a/axis2_lib/axis2-mtompolicy-1.6.2.jar b/axis2_lib/axis2-mtompolicy-1.6.2.jar new file mode 100644 index 0000000..561e84a Binary files /dev/null and b/axis2_lib/axis2-mtompolicy-1.6.2.jar differ diff --git a/axis2_lib/axis2-saaj-1.6.2.jar b/axis2_lib/axis2-saaj-1.6.2.jar new file mode 100644 index 0000000..c14531d Binary files /dev/null and b/axis2_lib/axis2-saaj-1.6.2.jar differ diff --git a/axis2_lib/axis2-soapmonitor-servlet-1.6.2.jar b/axis2_lib/axis2-soapmonitor-servlet-1.6.2.jar new file mode 100644 index 0000000..276dac7 Binary files /dev/null and b/axis2_lib/axis2-soapmonitor-servlet-1.6.2.jar differ diff --git a/axis2_lib/axis2-spring-1.6.2.jar b/axis2_lib/axis2-spring-1.6.2.jar new file mode 100644 index 0000000..30b9baa Binary files /dev/null and b/axis2_lib/axis2-spring-1.6.2.jar differ diff --git a/axis2_lib/axis2-transport-http-1.6.2.jar b/axis2_lib/axis2-transport-http-1.6.2.jar new file mode 100644 index 0000000..b1dad78 Binary files /dev/null and b/axis2_lib/axis2-transport-http-1.6.2.jar differ diff --git a/axis2_lib/axis2-transport-local-1.6.2.jar b/axis2_lib/axis2-transport-local-1.6.2.jar new file mode 100644 index 0000000..34a7073 Binary files /dev/null and b/axis2_lib/axis2-transport-local-1.6.2.jar differ diff --git a/axis2_lib/axis2-xmlbeans-1.6.2.jar b/axis2_lib/axis2-xmlbeans-1.6.2.jar new file mode 100644 index 0000000..58fba9b Binary files /dev/null and b/axis2_lib/axis2-xmlbeans-1.6.2.jar differ diff --git a/axis2_lib/bcel-5.1.jar b/axis2_lib/bcel-5.1.jar new file mode 100644 index 0000000..524e375 Binary files /dev/null and b/axis2_lib/bcel-5.1.jar differ diff --git a/axis2_lib/commons-cli-1.2.jar b/axis2_lib/commons-cli-1.2.jar new file mode 100644 index 0000000..ce4b9ff Binary files /dev/null and b/axis2_lib/commons-cli-1.2.jar differ diff --git a/axis2_lib/commons-codec-1.3.jar b/axis2_lib/commons-codec-1.3.jar new file mode 100644 index 0000000..957b675 Binary files /dev/null and b/axis2_lib/commons-codec-1.3.jar differ diff --git a/axis2_lib/commons-fileupload-1.2.jar b/axis2_lib/commons-fileupload-1.2.jar new file mode 100644 index 0000000..12539f5 Binary files /dev/null and b/axis2_lib/commons-fileupload-1.2.jar differ diff --git a/axis2_lib/commons-httpclient-3.1.jar b/axis2_lib/commons-httpclient-3.1.jar new file mode 100644 index 0000000..7c59774 Binary files /dev/null and b/axis2_lib/commons-httpclient-3.1.jar differ diff --git a/axis2_lib/commons-io-1.4.jar b/axis2_lib/commons-io-1.4.jar new file mode 100644 index 0000000..133dc6c Binary files /dev/null and b/axis2_lib/commons-io-1.4.jar differ diff --git a/axis2_lib/commons-logging-1.1.1.jar b/axis2_lib/commons-logging-1.1.1.jar new file mode 100644 index 0000000..1deef14 Binary files /dev/null and b/axis2_lib/commons-logging-1.1.1.jar differ diff --git a/axis2_lib/geronimo-annotation_1.0_spec-1.1.jar b/axis2_lib/geronimo-annotation_1.0_spec-1.1.jar new file mode 100644 index 0000000..7a6f529 Binary files /dev/null and b/axis2_lib/geronimo-annotation_1.0_spec-1.1.jar differ diff --git a/axis2_lib/geronimo-jaxws_2.2_spec-1.0.jar b/axis2_lib/geronimo-jaxws_2.2_spec-1.0.jar new file mode 100644 index 0000000..888f839 Binary files /dev/null and b/axis2_lib/geronimo-jaxws_2.2_spec-1.0.jar differ diff --git a/axis2_lib/geronimo-jta_1.1_spec-1.1.jar b/axis2_lib/geronimo-jta_1.1_spec-1.1.jar new file mode 100644 index 0000000..bba9290 Binary files /dev/null and b/axis2_lib/geronimo-jta_1.1_spec-1.1.jar differ diff --git a/axis2_lib/geronimo-saaj_1.3_spec-1.0.1.jar b/axis2_lib/geronimo-saaj_1.3_spec-1.0.1.jar new file mode 100644 index 0000000..b2f6e81 Binary files /dev/null and b/axis2_lib/geronimo-saaj_1.3_spec-1.0.1.jar differ diff --git a/axis2_lib/geronimo-stax-api_1.0_spec-1.0.1.jar b/axis2_lib/geronimo-stax-api_1.0_spec-1.0.1.jar new file mode 100644 index 0000000..ab1ee3b Binary files /dev/null and b/axis2_lib/geronimo-stax-api_1.0_spec-1.0.1.jar differ diff --git a/axis2_lib/geronimo-ws-metadata_2.0_spec-1.1.2.jar b/axis2_lib/geronimo-ws-metadata_2.0_spec-1.1.2.jar new file mode 100644 index 0000000..c8a795a Binary files /dev/null and b/axis2_lib/geronimo-ws-metadata_2.0_spec-1.1.2.jar differ diff --git a/axis2_lib/httpcore-4.0.jar b/axis2_lib/httpcore-4.0.jar new file mode 100644 index 0000000..37eb7d4 Binary files /dev/null and b/axis2_lib/httpcore-4.0.jar differ diff --git a/axis2_lib/hutool-all-5.0.7.jar b/axis2_lib/hutool-all-5.0.7.jar new file mode 100644 index 0000000..0ed0b10 Binary files /dev/null and b/axis2_lib/hutool-all-5.0.7.jar differ diff --git a/axis2_lib/jalopy-1.5rc3.jar b/axis2_lib/jalopy-1.5rc3.jar new file mode 100644 index 0000000..fe51ce2 Binary files /dev/null and b/axis2_lib/jalopy-1.5rc3.jar differ diff --git a/axis2_lib/jaxb-api-2.1.jar b/axis2_lib/jaxb-api-2.1.jar new file mode 100644 index 0000000..be3d6dc Binary files /dev/null and b/axis2_lib/jaxb-api-2.1.jar differ diff --git a/axis2_lib/jaxb-impl-2.1.7.jar b/axis2_lib/jaxb-impl-2.1.7.jar new file mode 100644 index 0000000..034c158 Binary files /dev/null and b/axis2_lib/jaxb-impl-2.1.7.jar differ diff --git a/axis2_lib/jaxb-xjc-2.1.7.jar b/axis2_lib/jaxb-xjc-2.1.7.jar new file mode 100644 index 0000000..ba2ec46 Binary files /dev/null and b/axis2_lib/jaxb-xjc-2.1.7.jar differ diff --git a/axis2_lib/jaxen-1.1.1.jar b/axis2_lib/jaxen-1.1.1.jar new file mode 100644 index 0000000..b633631 Binary files /dev/null and b/axis2_lib/jaxen-1.1.1.jar differ diff --git a/axis2_lib/jaxws-tools-2.1.3.jar b/axis2_lib/jaxws-tools-2.1.3.jar new file mode 100644 index 0000000..1006bfd Binary files /dev/null and b/axis2_lib/jaxws-tools-2.1.3.jar differ diff --git a/axis2_lib/jettison-1.0-RC2.jar b/axis2_lib/jettison-1.0-RC2.jar new file mode 100644 index 0000000..3a00ed2 Binary files /dev/null and b/axis2_lib/jettison-1.0-RC2.jar differ diff --git a/axis2_lib/jibx-bind-1.2.jar b/axis2_lib/jibx-bind-1.2.jar new file mode 100644 index 0000000..c8d3887 Binary files /dev/null and b/axis2_lib/jibx-bind-1.2.jar differ diff --git a/axis2_lib/jibx-run-1.2.jar b/axis2_lib/jibx-run-1.2.jar new file mode 100644 index 0000000..6b467d3 Binary files /dev/null and b/axis2_lib/jibx-run-1.2.jar differ diff --git a/axis2_lib/jsr311-api-1.0.jar b/axis2_lib/jsr311-api-1.0.jar new file mode 100644 index 0000000..2bede66 Binary files /dev/null and b/axis2_lib/jsr311-api-1.0.jar differ diff --git a/axis2_lib/juli-6.0.16.jar b/axis2_lib/juli-6.0.16.jar new file mode 100644 index 0000000..c3fe977 Binary files /dev/null and b/axis2_lib/juli-6.0.16.jar differ diff --git a/axis2_lib/log4j-1.2.15.jar b/axis2_lib/log4j-1.2.15.jar new file mode 100644 index 0000000..c930a6a Binary files /dev/null and b/axis2_lib/log4j-1.2.15.jar differ diff --git a/axis2_lib/mail-1.4.jar b/axis2_lib/mail-1.4.jar new file mode 100644 index 0000000..fd4555b Binary files /dev/null and b/axis2_lib/mail-1.4.jar differ diff --git a/axis2_lib/mex-1.6.2-impl.jar b/axis2_lib/mex-1.6.2-impl.jar new file mode 100644 index 0000000..ed67cf3 Binary files /dev/null and b/axis2_lib/mex-1.6.2-impl.jar differ diff --git a/axis2_lib/neethi-3.0.2.jar b/axis2_lib/neethi-3.0.2.jar new file mode 100644 index 0000000..383efde Binary files /dev/null and b/axis2_lib/neethi-3.0.2.jar differ diff --git a/axis2_lib/regexp-1.2.jar b/axis2_lib/regexp-1.2.jar new file mode 100644 index 0000000..713441c Binary files /dev/null and b/axis2_lib/regexp-1.2.jar differ diff --git a/axis2_lib/tribes-6.0.16.jar b/axis2_lib/tribes-6.0.16.jar new file mode 100644 index 0000000..bb85de1 Binary files /dev/null and b/axis2_lib/tribes-6.0.16.jar differ diff --git a/axis2_lib/woden-api-1.0M9.jar b/axis2_lib/woden-api-1.0M9.jar new file mode 100644 index 0000000..3b07e8e Binary files /dev/null and b/axis2_lib/woden-api-1.0M9.jar differ diff --git a/axis2_lib/woden-impl-commons-1.0M9.jar b/axis2_lib/woden-impl-commons-1.0M9.jar new file mode 100644 index 0000000..f99c8d7 Binary files /dev/null and b/axis2_lib/woden-impl-commons-1.0M9.jar differ diff --git a/axis2_lib/woden-impl-dom-1.0M9.jar b/axis2_lib/woden-impl-dom-1.0M9.jar new file mode 100644 index 0000000..0e3fff5 Binary files /dev/null and b/axis2_lib/woden-impl-dom-1.0M9.jar differ diff --git a/axis2_lib/wsdl4j-1.6.2.jar b/axis2_lib/wsdl4j-1.6.2.jar new file mode 100644 index 0000000..b9ffc36 Binary files /dev/null and b/axis2_lib/wsdl4j-1.6.2.jar differ diff --git a/axis2_lib/wstx-asl-3.2.9.jar b/axis2_lib/wstx-asl-3.2.9.jar new file mode 100644 index 0000000..ffdbd1f Binary files /dev/null and b/axis2_lib/wstx-asl-3.2.9.jar differ diff --git a/axis2_lib/xalan-2.7.0.jar b/axis2_lib/xalan-2.7.0.jar new file mode 100644 index 0000000..007be39 Binary files /dev/null and b/axis2_lib/xalan-2.7.0.jar differ diff --git a/axis2_lib/xml-resolver-1.2.jar b/axis2_lib/xml-resolver-1.2.jar new file mode 100644 index 0000000..e535bdc Binary files /dev/null and b/axis2_lib/xml-resolver-1.2.jar differ diff --git a/axis2_lib/xmlbeans-2.3.0.jar b/axis2_lib/xmlbeans-2.3.0.jar new file mode 100644 index 0000000..ccd8163 Binary files /dev/null and b/axis2_lib/xmlbeans-2.3.0.jar differ diff --git a/bin/com/connor/zf/createTZ/CreateDJGTHandler.class b/bin/com/connor/zf/createTZ/CreateDJGTHandler.class new file mode 100644 index 0000000..ed5f6b9 Binary files /dev/null and b/bin/com/connor/zf/createTZ/CreateDJGTHandler.class differ diff --git a/bin/com/connor/zf/createTZ/CreateLJTHandler.class b/bin/com/connor/zf/createTZ/CreateLJTHandler.class new file mode 100644 index 0000000..3d1072b Binary files /dev/null and b/bin/com/connor/zf/createTZ/CreateLJTHandler.class differ diff --git a/bin/com/connor/zf/createTZ/CreateTZDialog$MyTreeCellRenderer.class b/bin/com/connor/zf/createTZ/CreateTZDialog$MyTreeCellRenderer.class new file mode 100644 index 0000000..1ab86aa Binary files /dev/null and b/bin/com/connor/zf/createTZ/CreateTZDialog$MyTreeCellRenderer.class differ diff --git a/bin/com/connor/zf/createTZ/CreateTZDialog.class b/bin/com/connor/zf/createTZ/CreateTZDialog.class new file mode 100644 index 0000000..f9f9f45 Binary files /dev/null and b/bin/com/connor/zf/createTZ/CreateTZDialog.class differ diff --git a/bin/com/connor/zf/createTZ/CreateTZOperation$WaitingDialog.class b/bin/com/connor/zf/createTZ/CreateTZOperation$WaitingDialog.class new file mode 100644 index 0000000..eb30633 Binary files /dev/null and b/bin/com/connor/zf/createTZ/CreateTZOperation$WaitingDialog.class differ diff --git a/bin/com/connor/zf/createTZ/CreateTZOperation.class b/bin/com/connor/zf/createTZ/CreateTZOperation.class new file mode 100644 index 0000000..5e53f85 Binary files /dev/null and b/bin/com/connor/zf/createTZ/CreateTZOperation.class differ diff --git a/bin/com/connor/zf/createTZ/CreateZCTDialog.class b/bin/com/connor/zf/createTZ/CreateZCTDialog.class new file mode 100644 index 0000000..8e64ab6 Binary files /dev/null and b/bin/com/connor/zf/createTZ/CreateZCTDialog.class differ diff --git a/bin/com/connor/zf/createTZ/CreateZCTHandler.class b/bin/com/connor/zf/createTZ/CreateZCTHandler.class new file mode 100644 index 0000000..604a9a4 Binary files /dev/null and b/bin/com/connor/zf/createTZ/CreateZCTHandler.class differ diff --git a/bin/com/connor/zf/createTZ/CreateZCTOperation$WaitingDialog.class b/bin/com/connor/zf/createTZ/CreateZCTOperation$WaitingDialog.class new file mode 100644 index 0000000..6323f21 Binary files /dev/null and b/bin/com/connor/zf/createTZ/CreateZCTOperation$WaitingDialog.class differ diff --git a/bin/com/connor/zf/createTZ/CreateZCTOperation.class b/bin/com/connor/zf/createTZ/CreateZCTOperation.class new file mode 100644 index 0000000..4c5d5d2 Binary files /dev/null and b/bin/com/connor/zf/createTZ/CreateZCTOperation.class differ diff --git a/bin/com/connor/zf/dbom2ebom/CreateMaterialsBomDialog.class b/bin/com/connor/zf/dbom2ebom/CreateMaterialsBomDialog.class new file mode 100644 index 0000000..e1fdd29 Binary files /dev/null and b/bin/com/connor/zf/dbom2ebom/CreateMaterialsBomDialog.class differ diff --git a/bin/com/connor/zf/dbom2ebom/CreateMaterialsBomHandler.class b/bin/com/connor/zf/dbom2ebom/CreateMaterialsBomHandler.class new file mode 100644 index 0000000..d0b4081 Binary files /dev/null and b/bin/com/connor/zf/dbom2ebom/CreateMaterialsBomHandler.class differ diff --git a/bin/com/connor/zf/dbom2ebom/TableBuilder.class b/bin/com/connor/zf/dbom2ebom/TableBuilder.class new file mode 100644 index 0000000..9b5c96e Binary files /dev/null and b/bin/com/connor/zf/dbom2ebom/TableBuilder.class differ diff --git a/bin/com/connor/zf/desingtopart/DataBaseControl.class b/bin/com/connor/zf/desingtopart/DataBaseControl.class new file mode 100644 index 0000000..0b018c8 Binary files /dev/null and b/bin/com/connor/zf/desingtopart/DataBaseControl.class differ diff --git a/bin/com/connor/zf/desingtopart/DeriveMaterialsDialog$MyTable.class b/bin/com/connor/zf/desingtopart/DeriveMaterialsDialog$MyTable.class new file mode 100644 index 0000000..8709e65 Binary files /dev/null and b/bin/com/connor/zf/desingtopart/DeriveMaterialsDialog$MyTable.class differ diff --git a/bin/com/connor/zf/desingtopart/DeriveMaterialsDialog.class b/bin/com/connor/zf/desingtopart/DeriveMaterialsDialog.class new file mode 100644 index 0000000..9169102 Binary files /dev/null and b/bin/com/connor/zf/desingtopart/DeriveMaterialsDialog.class differ diff --git a/bin/com/connor/zf/desingtopart/DeriveMaterialsHandler.class b/bin/com/connor/zf/desingtopart/DeriveMaterialsHandler.class new file mode 100644 index 0000000..8851406 Binary files /dev/null and b/bin/com/connor/zf/desingtopart/DeriveMaterialsHandler.class differ diff --git a/bin/com/connor/zf/desingtopart/DeriveMaterialsOperation$WaitingDialog.class b/bin/com/connor/zf/desingtopart/DeriveMaterialsOperation$WaitingDialog.class new file mode 100644 index 0000000..b2d9e37 Binary files /dev/null and b/bin/com/connor/zf/desingtopart/DeriveMaterialsOperation$WaitingDialog.class differ diff --git a/bin/com/connor/zf/desingtopart/DeriveMaterialsOperation.class b/bin/com/connor/zf/desingtopart/DeriveMaterialsOperation.class new file mode 100644 index 0000000..0beb70d Binary files /dev/null and b/bin/com/connor/zf/desingtopart/DeriveMaterialsOperation.class differ diff --git a/bin/com/connor/zf/editClassAttr/AutoCompleter.class b/bin/com/connor/zf/editClassAttr/AutoCompleter.class new file mode 100644 index 0000000..c079477 Binary files /dev/null and b/bin/com/connor/zf/editClassAttr/AutoCompleter.class differ diff --git a/bin/com/connor/zf/editClassAttr/EditClassificationDialog.class b/bin/com/connor/zf/editClassAttr/EditClassificationDialog.class new file mode 100644 index 0000000..d0ed3ad Binary files /dev/null and b/bin/com/connor/zf/editClassAttr/EditClassificationDialog.class differ diff --git a/bin/com/connor/zf/editClassAttr/JAutoCompleteComboBox.class b/bin/com/connor/zf/editClassAttr/JAutoCompleteComboBox.class new file mode 100644 index 0000000..91c6ebd Binary files /dev/null and b/bin/com/connor/zf/editClassAttr/JAutoCompleteComboBox.class differ diff --git a/bin/com/connor/zf/editClassAttr/editClassAttrHandler.class b/bin/com/connor/zf/editClassAttr/editClassAttrHandler.class new file mode 100644 index 0000000..3605e8a Binary files /dev/null and b/bin/com/connor/zf/editClassAttr/editClassAttrHandler.class differ diff --git a/bin/com/connor/zf/util/CNClassPropBean.class b/bin/com/connor/zf/util/CNClassPropBean.class new file mode 100644 index 0000000..d1aa4a9 Binary files /dev/null and b/bin/com/connor/zf/util/CNClassPropBean.class differ diff --git a/bin/com/connor/zf/util/ClassPropBean.class b/bin/com/connor/zf/util/ClassPropBean.class new file mode 100644 index 0000000..27c1a21 Binary files /dev/null and b/bin/com/connor/zf/util/ClassPropBean.class differ diff --git a/bin/com/connor/zf/util/ClassProperty.class b/bin/com/connor/zf/util/ClassProperty.class new file mode 100644 index 0000000..f598630 Binary files /dev/null and b/bin/com/connor/zf/util/ClassProperty.class differ diff --git a/bin/com/connor/zf/util/JAutoCompleteComboBox$1.class b/bin/com/connor/zf/util/JAutoCompleteComboBox$1.class new file mode 100644 index 0000000..c4ca0a3 Binary files /dev/null and b/bin/com/connor/zf/util/JAutoCompleteComboBox$1.class differ diff --git a/bin/com/connor/zf/util/JAutoCompleteComboBox$AutoCompleter$1.class b/bin/com/connor/zf/util/JAutoCompleteComboBox$AutoCompleter$1.class new file mode 100644 index 0000000..78de46a Binary files /dev/null and b/bin/com/connor/zf/util/JAutoCompleteComboBox$AutoCompleter$1.class differ diff --git a/bin/com/connor/zf/util/JAutoCompleteComboBox$AutoCompleter.class b/bin/com/connor/zf/util/JAutoCompleteComboBox$AutoCompleter.class new file mode 100644 index 0000000..7185e12 Binary files /dev/null and b/bin/com/connor/zf/util/JAutoCompleteComboBox$AutoCompleter.class differ diff --git a/bin/com/connor/zf/util/JAutoCompleteComboBox.class b/bin/com/connor/zf/util/JAutoCompleteComboBox.class new file mode 100644 index 0000000..1ba9171 Binary files /dev/null and b/bin/com/connor/zf/util/JAutoCompleteComboBox.class differ diff --git a/bin/com/connor/zf/util/JDMethodUtil.class b/bin/com/connor/zf/util/JDMethodUtil.class new file mode 100644 index 0000000..0cdae1c Binary files /dev/null and b/bin/com/connor/zf/util/JDMethodUtil.class differ diff --git a/bin/com/connor/zf/util/MyUtil.class b/bin/com/connor/zf/util/MyUtil.class new file mode 100644 index 0000000..ab174c0 Binary files /dev/null and b/bin/com/connor/zf/util/MyUtil.class differ diff --git a/bin/com/connor/zf/util/RwJComboBox$RwBasicComboPopup.class b/bin/com/connor/zf/util/RwJComboBox$RwBasicComboPopup.class new file mode 100644 index 0000000..19e154c Binary files /dev/null and b/bin/com/connor/zf/util/RwJComboBox$RwBasicComboPopup.class differ diff --git a/bin/com/connor/zf/util/RwJComboBox$RwDefaultComboBoxModel.class b/bin/com/connor/zf/util/RwJComboBox$RwDefaultComboBoxModel.class new file mode 100644 index 0000000..860962c Binary files /dev/null and b/bin/com/connor/zf/util/RwJComboBox$RwDefaultComboBoxModel.class differ diff --git a/bin/com/connor/zf/util/RwJComboBox$RwDefaultListSelectionModel.class b/bin/com/connor/zf/util/RwJComboBox$RwDefaultListSelectionModel.class new file mode 100644 index 0000000..72a8f6c Binary files /dev/null and b/bin/com/connor/zf/util/RwJComboBox$RwDefaultListSelectionModel.class differ diff --git a/bin/com/connor/zf/util/RwJComboBox$RwJCheckBox.class b/bin/com/connor/zf/util/RwJComboBox$RwJCheckBox.class new file mode 100644 index 0000000..bc041fb Binary files /dev/null and b/bin/com/connor/zf/util/RwJComboBox$RwJCheckBox.class differ diff --git a/bin/com/connor/zf/util/RwJComboBox$RwMetalComboBoxUI.class b/bin/com/connor/zf/util/RwJComboBox$RwMetalComboBoxUI.class new file mode 100644 index 0000000..d9de772 Binary files /dev/null and b/bin/com/connor/zf/util/RwJComboBox$RwMetalComboBoxUI.class differ diff --git a/bin/com/connor/zf/util/RwJComboBox$RwMouseAdapter.class b/bin/com/connor/zf/util/RwJComboBox$RwMouseAdapter.class new file mode 100644 index 0000000..29f98da Binary files /dev/null and b/bin/com/connor/zf/util/RwJComboBox$RwMouseAdapter.class differ diff --git a/bin/com/connor/zf/util/RwJComboBox.class b/bin/com/connor/zf/util/RwJComboBox.class new file mode 100644 index 0000000..f597332 Binary files /dev/null and b/bin/com/connor/zf/util/RwJComboBox.class differ diff --git a/bin/com/connor/zf/util/SoaServerUtil.class b/bin/com/connor/zf/util/SoaServerUtil.class new file mode 100644 index 0000000..f5af22e Binary files /dev/null and b/bin/com/connor/zf/util/SoaServerUtil.class differ diff --git a/bin/com/connor/zf/util/StringCreateUtil.class b/bin/com/connor/zf/util/StringCreateUtil.class new file mode 100644 index 0000000..97f6818 Binary files /dev/null and b/bin/com/connor/zf/util/StringCreateUtil.class differ diff --git a/build.properties b/build.properties new file mode 100644 index 0000000..3851ca6 --- /dev/null +++ b/build.properties @@ -0,0 +1,90 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + icons/,\ + lib/ojdbc7.jar,\ + lib/jfxrt.jar,\ + lib/jfxswt.jar,\ + axis2_lib/activation-1.1.jar,\ + axis2_lib/antlr-2.7.7.jar,\ + axis2_lib/apache-mime4j-core-0.7.2.jar,\ + axis2_lib/axiom-api-1.2.13.jar,\ + axis2_lib/axiom-dom-1.2.13.jar,\ + axis2_lib/axiom-impl-1.2.13.jar,\ + axis2_lib/axis2-adb-1.6.2.jar,\ + axis2_lib/axis2-adb-codegen-1.6.2.jar,\ + axis2_lib/axis2-ant-plugin-1.6.2.jar,\ + axis2_lib/axis2-clustering-1.6.2.jar,\ + axis2_lib/axis2-codegen-1.6.2.jar,\ + axis2_lib/axis2-corba-1.6.2.jar,\ + axis2_lib/axis2-fastinfoset-1.6.2.jar,\ + axis2_lib/axis2-java2wsdl-1.6.2.jar,\ + axis2_lib/axis2-jaxbri-1.6.2.jar,\ + axis2_lib/axis2-jaxws-1.6.2.jar,\ + axis2_lib/axis2-jibx-1.6.2.jar,\ + axis2_lib/axis2-json-1.6.2.jar,\ + axis2_lib/axis2-kernel-1.6.2.jar,\ + axis2_lib/axis2-metadata-1.6.2.jar,\ + axis2_lib/axis2-mtompolicy-1.6.2.jar,\ + axis2_lib/axis2-saaj-1.6.2.jar,\ + axis2_lib/axis2-soapmonitor-servlet-1.6.2.jar,\ + axis2_lib/axis2-spring-1.6.2.jar,\ + axis2_lib/axis2-transport-http-1.6.2.jar,\ + axis2_lib/axis2-transport-local-1.6.2.jar,\ + axis2_lib/axis2-xmlbeans-1.6.2.jar,\ + axis2_lib/bcel-5.1.jar,\ + axis2_lib/commons-cli-1.2.jar,\ + axis2_lib/commons-codec-1.3.jar,\ + axis2_lib/commons-fileupload-1.2.jar,\ + axis2_lib/commons-httpclient-3.1.jar,\ + axis2_lib/commons-io-1.4.jar,\ + axis2_lib/commons-logging-1.1.1.jar,\ + axis2_lib/geronimo-annotation_1.0_spec-1.1.jar,\ + axis2_lib/geronimo-jaxws_2.2_spec-1.0.jar,\ + axis2_lib/geronimo-jta_1.1_spec-1.1.jar,\ + axis2_lib/geronimo-saaj_1.3_spec-1.0.1.jar,\ + axis2_lib/geronimo-stax-api_1.0_spec-1.0.1.jar,\ + axis2_lib/geronimo-ws-metadata_2.0_spec-1.1.2.jar,\ + axis2_lib/httpcore-4.0.jar,\ + axis2_lib/hutool-all-5.0.7.jar,\ + axis2_lib/jalopy-1.5rc3.jar,\ + axis2_lib/jaxb-api-2.1.jar,\ + axis2_lib/jaxb-impl-2.1.7.jar,\ + axis2_lib/jaxb-xjc-2.1.7.jar,\ + axis2_lib/jaxen-1.1.1.jar,\ + axis2_lib/jaxws-tools-2.1.3.jar,\ + axis2_lib/jettison-1.0-RC2.jar,\ + axis2_lib/jibx-bind-1.2.jar,\ + axis2_lib/jibx-run-1.2.jar,\ + axis2_lib/jsr311-api-1.0.jar,\ + axis2_lib/juli-6.0.16.jar,\ + axis2_lib/log4j-1.2.15.jar,\ + axis2_lib/mail-1.4.jar,\ + axis2_lib/mex-1.6.2-impl.jar,\ + axis2_lib/neethi-3.0.2.jar,\ + axis2_lib/regexp-1.2.jar,\ + axis2_lib/tribes-6.0.16.jar,\ + axis2_lib/woden-api-1.0M9.jar,\ + axis2_lib/woden-impl-commons-1.0M9.jar,\ + axis2_lib/woden-impl-dom-1.0M9.jar,\ + axis2_lib/wsdl4j-1.6.2.jar,\ + axis2_lib/wstx-asl-3.2.9.jar,\ + axis2_lib/xalan-2.7.0.jar,\ + axis2_lib/xml-resolver-1.2.jar,\ + axis2_lib/xmlbeans-2.3.0.jar,\ + axis2_lib/XmlSchema-1.4.7.jar,\ + jsonlib/commons-beanutils-1.7.0.jar,\ + jsonlib/commons-collections-3.2.jar,\ + jsonlib/commons-lang-2.4.jar,\ + jsonlib/commons-logging-1.1.jar,\ + jsonlib/ezmorph-1.0.4.jar,\ + jsonlib/fastjson-1.2.9-javadoc.jar,\ + jsonlib/fastjson-1.2.9-sources.jar,\ + jsonlib/fastjson-1.2.9.jar,\ + jsonlib/jdom.jar,\ + jsonlib/json-lib-2.2.2-jdk15.jar,\ + jsonlib/json-lib-2.2.3-jdk13.jar,\ + lib/k.util_1.0.0.jar,\ + lib/sqljdbc4.jar diff --git a/icons/sample.png b/icons/sample.png new file mode 100644 index 0000000..02c4b79 Binary files /dev/null and b/icons/sample.png differ diff --git a/icons/sample@2x.png b/icons/sample@2x.png new file mode 100644 index 0000000..c1224d1 Binary files /dev/null and b/icons/sample@2x.png differ diff --git a/jsonlib/commons-beanutils-1.7.0.jar b/jsonlib/commons-beanutils-1.7.0.jar new file mode 100644 index 0000000..b1b89c9 Binary files /dev/null and b/jsonlib/commons-beanutils-1.7.0.jar differ diff --git a/jsonlib/commons-collections-3.2.jar b/jsonlib/commons-collections-3.2.jar new file mode 100644 index 0000000..75580be Binary files /dev/null and b/jsonlib/commons-collections-3.2.jar differ diff --git a/jsonlib/commons-lang-2.4.jar b/jsonlib/commons-lang-2.4.jar new file mode 100644 index 0000000..532939e Binary files /dev/null and b/jsonlib/commons-lang-2.4.jar differ diff --git a/jsonlib/commons-logging-1.1.jar b/jsonlib/commons-logging-1.1.jar new file mode 100644 index 0000000..2ff9bbd Binary files /dev/null and b/jsonlib/commons-logging-1.1.jar differ diff --git a/jsonlib/ezmorph-1.0.4.jar b/jsonlib/ezmorph-1.0.4.jar new file mode 100644 index 0000000..7625af6 Binary files /dev/null and b/jsonlib/ezmorph-1.0.4.jar differ diff --git a/jsonlib/fastjson-1.2.9-javadoc.jar b/jsonlib/fastjson-1.2.9-javadoc.jar new file mode 100644 index 0000000..56710b8 Binary files /dev/null and b/jsonlib/fastjson-1.2.9-javadoc.jar differ diff --git a/jsonlib/fastjson-1.2.9-sources.jar b/jsonlib/fastjson-1.2.9-sources.jar new file mode 100644 index 0000000..47ff40d Binary files /dev/null and b/jsonlib/fastjson-1.2.9-sources.jar differ diff --git a/jsonlib/fastjson-1.2.9.jar b/jsonlib/fastjson-1.2.9.jar new file mode 100644 index 0000000..839cea3 Binary files /dev/null and b/jsonlib/fastjson-1.2.9.jar differ diff --git a/jsonlib/jdom.jar b/jsonlib/jdom.jar new file mode 100644 index 0000000..65a1b3f Binary files /dev/null and b/jsonlib/jdom.jar differ diff --git a/jsonlib/json-lib-2.2.2-jdk15.jar b/jsonlib/json-lib-2.2.2-jdk15.jar new file mode 100644 index 0000000..27e7c7c Binary files /dev/null and b/jsonlib/json-lib-2.2.2-jdk15.jar differ diff --git a/jsonlib/json-lib-2.2.3-jdk13.jar b/jsonlib/json-lib-2.2.3-jdk13.jar new file mode 100644 index 0000000..a6513db Binary files /dev/null and b/jsonlib/json-lib-2.2.3-jdk13.jar differ diff --git a/lib/jfxrt.jar b/lib/jfxrt.jar new file mode 100644 index 0000000..daef9ce Binary files /dev/null and b/lib/jfxrt.jar differ diff --git a/lib/jfxswt.jar b/lib/jfxswt.jar new file mode 100644 index 0000000..4679ef7 Binary files /dev/null and b/lib/jfxswt.jar differ diff --git a/lib/k.util_1.0.0.jar b/lib/k.util_1.0.0.jar new file mode 100644 index 0000000..bc488d1 Binary files /dev/null and b/lib/k.util_1.0.0.jar differ diff --git a/lib/ojdbc7.jar b/lib/ojdbc7.jar new file mode 100644 index 0000000..811da0f Binary files /dev/null and b/lib/ojdbc7.jar differ diff --git a/lib/sqljdbc4.jar b/lib/sqljdbc4.jar new file mode 100644 index 0000000..d6b7f6d Binary files /dev/null and b/lib/sqljdbc4.jar differ diff --git a/plugin.xml b/plugin.xml new file mode 100644 index 0000000..9009145 --- /dev/null +++ b/plugin.xml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/connor/zf/createTZ/CreateDJGTHandler.java b/src/com/connor/zf/createTZ/CreateDJGTHandler.java new file mode 100644 index 0000000..38951dd --- /dev/null +++ b/src/com/connor/zf/createTZ/CreateDJGTHandler.java @@ -0,0 +1,37 @@ +package com.connor.zf.createTZ; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.teamcenter.rac.aif.AbstractAIFUIApplication; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class CreateDJGTHandler extends AbstractHandler{ + + private final static String PREF = "ZF6_DJGTPS_LIST"; + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFUIApplication app = AIFUtility.getCurrentApplication(); + TCSession session = (TCSession) app.getSession(); + InterfaceAIFComponent targetComponent = app.getTargetComponent(); + if(targetComponent instanceof TCComponentItemRevision) { + TCComponentItemRevision rev = (TCComponentItemRevision)targetComponent; + String type = rev.getType(); + if(type.equals("ZF6_LJTRevision")) { + CreateTZDialog dialog = new CreateTZDialog(app, session, rev, PREF); + new Thread(dialog).start(); + }else { + MessageBox.post("ѡͼ汾","",MessageBox.INFORMATION); + } + }else { + MessageBox.post("ѡͼ汾","",MessageBox.INFORMATION); + } + return null; + } + +} diff --git a/src/com/connor/zf/createTZ/CreateLJTHandler.java b/src/com/connor/zf/createTZ/CreateLJTHandler.java new file mode 100644 index 0000000..333d79a --- /dev/null +++ b/src/com/connor/zf/createTZ/CreateLJTHandler.java @@ -0,0 +1,37 @@ +package com.connor.zf.createTZ; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.teamcenter.rac.aif.AbstractAIFUIApplication; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class CreateLJTHandler extends AbstractHandler{ + + private final static String PREF = "ZF6_LJTPS_LIST"; + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFUIApplication app = AIFUtility.getCurrentApplication(); + TCSession session = (TCSession) app.getSession(); + InterfaceAIFComponent targetComponent = app.getTargetComponent(); + if(targetComponent instanceof TCComponentItemRevision) { + TCComponentItemRevision rev = (TCComponentItemRevision)targetComponent; + String type = rev.getType(); + if(type.equals("ZF6_ZCTRevision")) { + CreateTZDialog dialog = new CreateTZDialog(app, session, rev, PREF); + new Thread(dialog).start(); + }else { + MessageBox.post("ѡܳͼ汾","",MessageBox.INFORMATION); + } + }else { + MessageBox.post("ѡܳͼ汾","",MessageBox.INFORMATION); + } + return null; + } + +} diff --git a/src/com/connor/zf/createTZ/CreateTZDialog.java b/src/com/connor/zf/createTZ/CreateTZDialog.java new file mode 100644 index 0000000..b1396b8 --- /dev/null +++ b/src/com/connor/zf/createTZ/CreateTZDialog.java @@ -0,0 +1,642 @@ +package com.connor.zf.createTZ; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Panel; +import java.awt.Point; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.JTree; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.TreeSelectionModel; + +import com.connor.zf.createTZ.CreateTZDialog.MyTreeCellRenderer; +import com.connor.zf.util.CNClassPropBean; +import com.connor.zf.util.ClassProperty; +import com.connor.zf.util.JAutoCompleteComboBox; +import com.connor.zf.util.JDMethodUtil; +import com.connor.zf.util.SoaServerUtil; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.AbstractAIFUIApplication; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCClassificationService; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentFolder; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentItemType; +import com.teamcenter.rac.kernel.TCComponentType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.ics.ICSAdminClass; +import com.teamcenter.rac.kernel.ics.ICSAdminClassAttribute; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + + +public class CreateTZDialog extends AbstractAIFDialog implements ActionListener{ + private AbstractAIFUIApplication app; + private TCSession session; + private String pref; + private TCComponentItemRevision target; + private String type; + private Map> config = new HashMap>(); + private JButton createButton; + private JButton cancelButton; + private DefaultMutableTreeNode root; + private JTree tree; +// private JComboBox unitBox; + private JPanel mainPanel; + private JPanel panel1; + private JPanel panel2; + private JPanel panel3; + private JPanel panel4; + private JPanel panel5; + private JScrollPane scrollPane1; + private JScrollPane scrollPane2; + private JScrollPane scrollPane3; + private List textList = new ArrayList(); + private List textList2 = new ArrayList(); + private List boxList = new ArrayList(); + private List radioButtons = new ArrayList(); + private JComboBox combo; + private static TCClassificationService classService; + private static ICSAdminClass adminClass; + static int xx , yy; + static Point p = new Point(0, 0); + static int w,h; + static boolean b = true; + private TCComponentFolder folder; + private String folderName = "home"; + private Map> lovMap = new HashMap>(); + private final static String PREF = "ZF_Revision_Rule"; + private final static String PREF2 = "ZF_DeriveCreate_Type"; + private JComboBox rev_rule_box; + + public CreateTZDialog(AbstractAIFUIApplication app, TCSession session, TCComponentItemRevision target, String pref) { + this.app = app; + this.session = session; + this.target = target; + try { + AIFComponentContext[] whereReferenced = target.getItem().whereReferenced(); + if(whereReferenced!=null) { + for(AIFComponentContext con:whereReferenced) { + InterfaceAIFComponent component2 = con.getComponent(); + if(component2 instanceof TCComponentFolder) { + TCComponentFolder tempfolder = (TCComponentFolder) component2; + String owning_user = tempfolder.getProperty("owning_user"); + String string = session.getUser().toString(); +// System.out.println("ļߣ"+owning_user); +// System.out.println("ǰû"+string); + if(string.equals(owning_user)) { + folder = tempfolder; + folderName = folder.getStringProperty("object_name"); + System.out.println("ҵļ"+folderName); + break; + } + } + } + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + this.pref = pref; + type = target.getType(); + switch (type) { + case "ZF6_ZCTRevision": + type = "ͼ"; + root = new DefaultMutableTreeNode("ͼ"); + break; + case "ZF6_LJTRevision": + root = new DefaultMutableTreeNode("ͼӹͼ"); + type = "ͼӹͼ"; + break; + + } + } + + @Override + public void run() { + try { + init(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + private void init() throws Exception{ + switch (type) { + case "ͼ": + setTitle("ͼ"); + break; + case "ͼӹͼ": + setTitle("ͼӹͼ"); + break; + } + String[] stringValues = session.getPreferenceService().getStringValues(pref); + if(stringValues!=null&&stringValues.length>0) { + for(String s:stringValues) { + String[] split = s.split(",",-1); + if(split.length==3) { + List list = new ArrayList(); + list.add(split[1]); + list.add(split[2]); + config.put(split[0], list); + root.add(new DefaultMutableTreeNode(split[0])); + }else { + MessageBox.post(pref+"ѡ","",MessageBox.INFORMATION); + return; + } + } + }else { + MessageBox.post("δ"+pref+"ѡ","",MessageBox.INFORMATION); + return; + } + mainPanel = new JPanel(new BorderLayout()); + panel1 = new JPanel(new BorderLayout()); + panel2 = new JPanel(new BorderLayout()); + MyTreeCellRenderer treeCellRenderer = new MyTreeCellRenderer(); + tree = new JTree(root); + tree.setCellRenderer(treeCellRenderer); + tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); + tree.setSelectionRow(1); + tree.addTreeSelectionListener(new TreeSelectionListener() { + + @Override + public void valueChanged(TreeSelectionEvent e) { + // TODO Auto-generated method stub + try { + textList.clear(); + initAttributePanel(scrollPane2); + initClassAttributePanel(scrollPane3); + } catch (Exception e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } + }); + textList.clear(); + scrollPane1 = new JScrollPane(tree); + scrollPane1.setPreferredSize(new Dimension(200,600)); + scrollPane2 = new JScrollPane(); + scrollPane3 = new JScrollPane(); + initAttributePanel(scrollPane2); + initClassAttributePanel(scrollPane3); +// setmouseListener(scrollPane1,mainPanel); +// setmouseListener(scrollPane2,mainPanel); +// setmouseListener(scrollPane3,mainPanel); + panel1.add(scrollPane1,BorderLayout.WEST); + panel1.add(panel2,BorderLayout.CENTER); + panel2.add(scrollPane2,BorderLayout.CENTER); + panel2.add(scrollPane3,BorderLayout.SOUTH); + + mainPanel.add(panel1,BorderLayout.CENTER); + mainPanel.add(initButton(),BorderLayout.SOUTH); + add(mainPanel); + pack(); + setAlwaysOnTop(true); + setLocationRelativeTo(null); + setVisible(true); + + } + +// private void setmouseListener(JComponent comp, JComponent mainPanel) { +// comp.addMouseMotionListener(new MouseMotionListener() { +// public void mouseMoved(MouseEvent e) { +// Cursor cursor = comp.getCursor(); +// if (comp.getSize().width-5<=e.getX()) { +// comp.setCursor(new Cursor(Cursor.E_RESIZE_CURSOR));// +// } else if (5>=e.getX()) { +// comp.setCursor(new Cursor(Cursor.W_RESIZE_CURSOR));// +// } else { +// comp.setCursor(Cursor.getDefaultCursor()); +// } +// if (b) { +// comp.setCursor(cursor); +// } +// }; +// public void mouseDragged(MouseEvent e) { +// p = comp.getLocation(); +// if (comp.getCursor().getType() == Cursor.W_RESIZE_CURSOR) { +// +// Point point = comp.getLocation(); +// p.x = e.getPoint().x + point.x - 0; +// p.y = point.y; +// comp.setLocation(p); +// +// w = comp.getSize().width - e.getPoint().x; +// h = comp.getSize().height; +// comp.setSize(w,h); +// } else if (comp.getCursor().getType() == Cursor.E_RESIZE_CURSOR) { +// +// +// +// w = e.getPoint().x; +// h = comp.getSize().height; +// comp.setSize(w,h); +// +// comp.setLocation(p); +// } else { +// Point point = comp.getLocation(); +// ////////////ƶ +//// p.x = e.getPoint().x + point.x - xx; +//// p.y = e.getPoint().y + point.y - yy; +//// comp.setLocation(e.getPoint().x + point.x - xx,e.getPoint().y + point.y - yy); +// //X᷽ƶ +// p.x = e.getPoint().x + point.x - xx; +// p.y = point.y; +// comp.setLocation(e.getPoint().x + point.x - xx,point.y); +// +// } +// } +// +// }); +// comp.addMouseListener(new MouseListener() { +// public void mouseReleased(MouseEvent arg0) { +// b = false; +// } +// public void mousePressed(MouseEvent mouseEvent) { +// xx = mouseEvent.getX(); +// yy = mouseEvent.getY(); +// w = comp.getSize().width; +// h = comp.getSize().height; +// b = true; +// } +// public void mouseExited(MouseEvent arg0) { +// } +// public void mouseEntered(MouseEvent e) { +// if (comp.getSize().width-8<=e.getX()) { +// comp.setCursor(new Cursor(Cursor.E_RESIZE_CURSOR));// +// } else if (8>=e.getX()) { +// comp.setCursor(new Cursor(Cursor.W_RESIZE_CURSOR));// +// } else { +// comp.setCursor(Cursor.getDefaultCursor()); +// } +// } +// public void mouseClicked(MouseEvent arg0) { +// } +// }); +// } + + private JPanel initButton() { + JPanel panel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + createButton = new JButton(""); + cancelButton = new JButton("ȡ"); + createButton.addActionListener(this); + cancelButton.addActionListener(this); + panel.add(createButton); + panel.add(new JLabel(" ")); + panel.add(cancelButton); + panel.setBorder(BorderFactory.createEtchedBorder()); + return panel; + } + + private JScrollPane initAttributePanel(JScrollPane scrollPane) throws Exception{ + JPanel panel = new JPanel(new PropertyLayout()); + panel.add("1.1.left.left",new JLabel("汾ԣ")); +// JPanel tempPanel1 = new JPanel(new FlowLayout()); +// tempPanel1.add(new JLabel("λ")); +// //λ +// TCComponentType typeComponent = session.getTypeComponent("UnitOfMeasure"); +// TCComponent[] extent = typeComponent.extent(); +// unitBox = new JAutoCompleteComboBox(); +// unitBox.addItem(null); +// for(int ii = 0;ii revAttrMap = new HashMap(); + List list = new ArrayList(); + if(stringValues2!=null) { + switch (type) { + case "ͼ": + for(String s:stringValues2) { + String[] split1 = s.split("[|]"); + if(split1[0].equals("ZF6_LJT")) { + String[] split2 = split1[1].split(";"); + for(String s2:split2) { + String[] split = s2.split("="); + revAttrMap.put(split[0], split[1]); + list.add(split[0]); + } + break; + } + } + break; + case "ͼӹͼ": + for(String s:stringValues2) { + String[] split1 = s.split("[|]"); + if(split1[0].equals("ZF6_DJGT")) { + String[] split2 = split1[1].split(";"); + for(String s2:split2) { + String[] split = s2.split("="); + revAttrMap.put(split[0], split[1]); + list.add(split[0]); + } + break; + } + } + break; + } + }else { + MessageBox.post("δѡ"+PREF2,"",MessageBox.INFORMATION); + return null; + } + int i = 3; + for(;i tempMap = new HashMap(); + for(JTextField t:textList) { + String name = t.getName(); + String text = t.getText(); + tempMap.put(name,text); + if(name.equals("object_name"))item.setStringProperty("object_name", text); + } + //ɫʱȡ +// tempMap.put("zf6_ys",combo.getSelectedItem().toString()); + tempMap.put("zf6_th",th); + for(JRadioButton bu:radioButtons) { + if(bu.isSelected()) { + String text = bu.getText(); + if(text.equals("")) { + System.out.println("zf6_sfdxlbΪtrue"); +// rev.setLogicalProperty("zf6_sfdxlb", true); + tempMap.put("zf6_sfdxlb", "true"); + }else { + System.out.println("zf6_sfdxlbΪfalse"); +// rev.setLogicalProperty("zf6_sfdxlb", false); + tempMap.put("zf6_sfdxlb", "false"); + } + } + } + rev.setProperties(tempMap); + rev.refresh(); + List propList = new ArrayList<>(); + for(JTextField t:textList2) { + String name = t.getName(); + String text = t.getText(); + ClassProperty prop = new ClassProperty(Integer.valueOf(name), text); + propList.add(prop); + } + for(JComboBox t:boxList) { + String name = t.getName(); + String text = lovMap.get(name).get(t.getSelectedItem().toString()); + ClassProperty prop = new ClassProperty(Integer.valueOf(name), text); + propList.add(prop); + } + String json = SoaServerUtil.objectToJson(propList); + String url = JDMethodUtil.getPrefStr("Autocode_SendClassServer_URL", session); + SoaServerUtil.sendToClass(rev.getUid(), classId, json, url); + MessageBox.post(item.getStringProperty("object_string")+"ѳɹ"+folderName+"ļ£", "", MessageBox.INFORMATION); + } + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + Object source = e.getSource(); + if(source == createButton) { + CreateTZOperation operation = new CreateTZOperation(app, session, CreateTZDialog.this, "",folderName); + session.queueOperation(operation); + }else if(source == cancelButton) { + CreateTZDialog.this.dispose(); + } + } + + public class MyTreeCellRenderer extends DefaultTreeCellRenderer { + @Override + public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, + boolean leaf, int row, boolean hasFocus) { + // TODO Auto-generated method stub + Component treeCellRendererComponent = super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); + this.setIcon(null); + return treeCellRendererComponent; + } + } +} diff --git a/src/com/connor/zf/createTZ/CreateTZOperation.java b/src/com/connor/zf/createTZ/CreateTZOperation.java new file mode 100644 index 0000000..9d6cd99 --- /dev/null +++ b/src/com/connor/zf/createTZ/CreateTZOperation.java @@ -0,0 +1,111 @@ +package com.connor.zf.createTZ; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Label; + +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.SwingConstants; + +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.AbstractAIFUIApplication; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class CreateTZOperation extends AbstractAIFOperation{ + private AbstractAIFUIApplication app; + private TCSession session; + private String exeType; + private String path; + private String errInfo = ""; + private CreateTZDialog dialog; + private String folderName; + public CreateTZOperation(AbstractAIFUIApplication app, TCSession session, CreateTZDialog dialog, String exeType,String folderName) { + this.app = app; + this.session = session; + this.dialog = dialog; + this.exeType = exeType; + this.folderName = folderName; + } + @Override + public void executeOperation() throws Exception { + // TODO Auto-generated method stub + new Thread() { + public void run() { + WaitingDialog dia = new WaitingDialog(app.getDesktop(), "INFOMATION", ""+exeType+"......"); + dia.setVisible(true); + try { + + boolean flag = false; + switch (exeType) { + case "": + flag = create(); + if (flag) { + dia.setVisible(false); +// MessageBox.post("ѳɹ"+folderName+"£", "", MessageBox.INFORMATION); + } else { + dia.setVisible(false); + MessageBox.post(errInfo+"ʧܣ", "", MessageBox.INFORMATION); + } + break; + + default: + break; + } + }finally { + dialog.dispose(); + dia.setVisible(false); + dia.dispose(); + } + }; + }.start(); + } + + public boolean create() { + try { + dialog.create(); + }catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + errInfo = errInfo + e.getMessage(); + return false; + } + return true; + } + + class WaitingDialog extends com.teamcenter.rac.aif.AbstractAIFDialog { + private static final long serialVersionUID = 1L; + public JPanel panel; + JProgressBar progressBar = null; + + public WaitingDialog(Frame arg0, String title, String message) { + super(arg0, title); + this.setModal(false); + + panel = new JPanel(new BorderLayout()); + + /* + * JLabel label = new JLabel(message); System.out.println("message:"+message); + * System.out.println("label:"+label); panel.add(label); + */ + + progressBar = new JProgressBar(SwingConstants.HORIZONTAL); + progressBar.setVisible(true); + progressBar.setIndeterminate(true); + + panel.add(BorderLayout.CENTER, new Label(message)); + panel.add(BorderLayout.SOUTH, progressBar); + + panel.setPreferredSize(new Dimension(350, 60)); + + this.getContentPane().add(panel); + + centerToScreen(); + setAlwaysOnTop(true); + pack(); + + } + } +} diff --git a/src/com/connor/zf/createTZ/CreateZCTDialog.java b/src/com/connor/zf/createTZ/CreateZCTDialog.java new file mode 100644 index 0000000..571e94e --- /dev/null +++ b/src/com/connor/zf/createTZ/CreateZCTDialog.java @@ -0,0 +1,424 @@ +package com.connor.zf.createTZ; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import javax.swing.tree.DefaultMutableTreeNode; + +import com.connor.zf.util.CNClassPropBean; +import com.connor.zf.util.ClassProperty; +import com.connor.zf.util.JAutoCompleteComboBox; +import com.connor.zf.util.JDMethodUtil; +import com.connor.zf.util.SoaServerUtil; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.AbstractAIFUIApplication; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCClassificationService; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentFolder; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentItemType; +import com.teamcenter.rac.kernel.TCComponentType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.ics.ICSAdminClass; +import com.teamcenter.rac.kernel.ics.ICSAdminClassAttribute; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + + +public class CreateZCTDialog extends AbstractAIFDialog implements ActionListener{ + private AbstractAIFUIApplication app; + private TCSession session; + private TCComponentItemRevision target; + private TCComponentFolder folder; + private String folderName = "home"; + private JButton createButton; + private JButton cancelButton; + private JPanel mainPanel; + private JPanel panel1; + private JPanel panel2; + private JPanel panel3; + private JScrollPane scrollPane1; + private JScrollPane scrollPane2; + private List textList = new ArrayList(); + private List textList2 = new ArrayList(); + private List boxList = new ArrayList(); + private static TCClassificationService classService; + private static ICSAdminClass adminClass; + private List radioButtons = new ArrayList(); + private JTextField xhmsField; + private Map> lovMap = new HashMap>(); + private final static String PREF = "ZF_Revision_Rule"; + private final static String PREF2 = "ZF_DeriveCreate_Type"; + private JComboBox rev_rule_box; +// private JComboBox unitBox; + + public CreateZCTDialog(AbstractAIFUIApplication app, TCSession session, TCComponentItemRevision target) { + this.app = app; + this.session = session; + this.target = target; + try { + AIFComponentContext[] whereReferenced = target.getItem().whereReferenced(); + if(whereReferenced!=null) { + for(AIFComponentContext con:whereReferenced) { + InterfaceAIFComponent component2 = con.getComponent(); + if(component2 instanceof TCComponentFolder) { + TCComponentFolder tempfolder = (TCComponentFolder) component2; + String owning_user = tempfolder.getProperty("owning_user"); + String string = session.getUser().toString(); +// System.out.println("ļߣ"+owning_user); +// System.out.println("ǰû"+string); + if(string.equals(owning_user)) { + folder = tempfolder; + folderName = folder.getStringProperty("object_name"); + System.out.println("ҵļ"+folderName); + break; + } + } + } + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public void run() { + try { + init(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + private void init() throws Exception{ + setTitle("ܳͼ"); + mainPanel = new JPanel(new BorderLayout()); + panel1 = new JPanel(new BorderLayout()); + scrollPane1 = new JScrollPane(); + scrollPane2 = new JScrollPane(); + initAttributePanel(scrollPane1); + initClassAttributePanel(scrollPane2); + panel1.add(scrollPane1,BorderLayout.CENTER); + panel1.add(scrollPane2,BorderLayout.SOUTH); + mainPanel.add(panel1,BorderLayout.CENTER); + mainPanel.add(initButton(),BorderLayout.SOUTH); + add(mainPanel); + pack(); + setAlwaysOnTop(true); + setLocationRelativeTo(null); + setVisible(true); + } + + public void create() throws Exception{ + String parentId = target.getStringProperty("item_id"); + String zf6_th = target.getStringProperty("zf6_th"); + System.out.println("zf6_th="+zf6_th); +// String postfix1 = config.get(tree.getLastSelectedPathComponent().toString()).get(1); + String classId = target.getClassificationClass(); + String newId = parentId+xhmsField.getText(); +// boolean isExist = true; + TCComponentItemType itemType = (TCComponentItemType)session.getTypeService().getTypeComponent("Item"); + String revId = rev_rule_box.getSelectedItem().toString(); +// String revId = itemType.getNewRev(null); + TCComponentItem item = null; + String th = ""; + String preTH = "Q/JS A-"; + String postTH = "-00"; + int tempIndex = 0; + TCComponent[] search = session.search("ܳͼѯ", new String[] {"ͼ"}, new String[] {preTH+"*"+postTH}); + if(search == null) { + th = preTH + "0" + postTH; + }else { + for(TCComponent comp:search) { + TCComponentItemRevision tempRev = (TCComponentItemRevision)comp; + String tempTH = tempRev.getStringProperty("zf6_th"); + String[] split = tempTH.split("-",-1); + if(split.length == 3) { + Integer nowIndex = Integer.valueOf(split[1]); + if(nowIndex > tempIndex) { + tempIndex = nowIndex; + } + }else { + System.out.println(comp+"ͼŲϹ淶"+tempTH); + } + } + th = preTH + (tempIndex+1) + postTH; + } + item = itemType.create(newId, revId, "ZF6_ZCT", "ܳͼ", "", null); + if(folder!=null) { + folder.add("contents", item); + }else { + System.out.println("ĿϲδҵļУ"+item+"ŵhome"); + session.getUser().getHomeFolder().add("contents", item); + } + //ð汾 + TCComponentItemRevision rev = item.getLatestItemRevision(); + Map tempMap = new HashMap(); + for(JTextField t:textList) { + String name = t.getName(); + String text = t.getText(); + tempMap.put(name,text); + if(name.equals("object_name"))item.setStringProperty("object_name", text); + } + //ɫʱȡ +// tempMap.put("zf6_ys",combo.getSelectedItem().toString()); + tempMap.put("zf6_th",th); + for(JRadioButton bu:radioButtons) { + if(bu.isSelected()) { + String text = bu.getText(); + if(text.equals("")) { + System.out.println("zf6_sfdxlbΪtrue"); +// rev.setLogicalProperty("zf6_sfdxlb", true); + tempMap.put("zf6_sfdxlb", "true"); + }else { + System.out.println("zf6_sfdxlbΪfalse"); +// rev.setLogicalProperty("zf6_sfdxlb", false); + tempMap.put("zf6_sfdxlb", "false"); + } + } + } + rev.setProperties(tempMap); + rev.refresh(); + List propList = new ArrayList<>(); + for(JTextField t:textList2) { + String name = t.getName(); + String text = t.getText(); + ClassProperty prop = new ClassProperty(Integer.valueOf(name), text); + propList.add(prop); + } + for(JComboBox t:boxList) { + String name = t.getName(); + String text = lovMap.get(name).get(t.getSelectedItem().toString()); + ClassProperty prop = new ClassProperty(Integer.valueOf(name), text); + propList.add(prop); + } + String json = SoaServerUtil.objectToJson(propList); + String url = JDMethodUtil.getPrefStr("Autocode_SendClassServer_URL", session); + SoaServerUtil.sendToClass(rev.getUid(), classId, json, url); + MessageBox.post(item.getStringProperty("object_string")+"ѳɹ"+folderName+"ļ£", "", MessageBox.INFORMATION); +} + + private JPanel initRadioPanel() { + JPanel panel = new JPanel(new PropertyLayout()); + ButtonGroup bg = new ButtonGroup(); + radioButtons.clear(); + JRadioButton radioButton1 = new JRadioButton(""); + JRadioButton radioButton2 = new JRadioButton(""); + radioButton1.setSelected(true); + radioButtons.add(radioButton1); + radioButtons.add(radioButton2); + bg.add(radioButton1); + bg.add(radioButton2); + panel.add("1.1.left.left",radioButton1); + panel.add("2.1.left.left",radioButton2); + return panel; + } + + private JPanel initButton() { + JPanel panel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + createButton = new JButton(""); + cancelButton = new JButton("ȡ"); + createButton.addActionListener(this); + cancelButton.addActionListener(this); + panel.add(createButton); + panel.add(new JLabel(" ")); + panel.add(cancelButton); + panel.setBorder(BorderFactory.createEtchedBorder()); + return panel; + } + + private JScrollPane initAttributePanel(JScrollPane scrollPane) throws Exception{ + textList.clear(); + JPanel panel = new JPanel(new PropertyLayout()); + xhmsField = new JTextField(20); + panel.add("1.1.left.left",new JLabel("汾ԣ")); + JPanel tempPanel1 = new JPanel(new FlowLayout()); + tempPanel1.add(new JLabel("ͺ")); + tempPanel1.add(xhmsField); + panel.add("2.1.left.left",tempPanel1); +// JPanel tempPanel2 = new JPanel(new FlowLayout()); +// tempPanel2.add(new JLabel("λ")); +// //λ +// TCComponentType typeComponent = session.getTypeComponent("UnitOfMeasure"); +// TCComponent[] extent = typeComponent.extent(); +// unitBox = new JAutoCompleteComboBox(); +// unitBox.addItem(null); +// for(int ii = 0;ii revAttrMap = new HashMap(); + List list = new ArrayList(); + if(stringValues2!=null) { + for(String s:stringValues2) { + String[] split1 = s.split("[|]"); + if(split1[0].equals("ZF6_ZCT")) { + String[] split2 = split1[1].split(";"); + for(String s2:split2) { + String[] split = s2.split("="); + revAttrMap.put(split[0], split[1]); + list.add(split[0]); + } + } + break; + } + }else { + MessageBox.post("δѡ"+PREF2,"",MessageBox.INFORMATION); + return null; + } + JPanel tempPanel2 = new JPanel(new FlowLayout()); + tempPanel2.add(new JLabel("汾")); + tempPanel2.add(rev_rule_box); + panel.add("3.1.left.left",tempPanel2); + int i = 4; + for(;i> maps; + private TCComponentBOMWindow win; + private List bomlines; + private boolean flag = false; + protected TCSession session; + protected String[] connor_laoShiBao; + protected String[] connor_xinShiBao; + protected String[] drawingtypes; + protected boolean laoShiBao; + protected boolean xinShiBao; + protected String drm03; + protected boolean inDrawingTypes; + protected Set revSet = new HashSet(); + private List filterList = new ArrayList(); + private final static String RPE1 = "zf_d2e_filter_str"; + + public CreateMaterialsBomDialog(AbstractAIFApplication app, + Map> maps, List bomlines) { + this.app = app; + this.maps = maps; + this.bomlines = bomlines; + session = (TCSession) app.getSession(); + String[] stringValues = session.getPreferenceService().getStringValues(RPE1); + if(stringValues==null||stringValues.length<1) { + MessageBox.post("δѡ"+RPE1,"",MessageBox.INFORMATION); + return; + } + for(String s:stringValues) { + filterList.add(s); + } + initUI(); + this.win = createWindow(); + } + + private JLabel label = null; + + private TCComponentBOMWindow createWindow() { + TCComponentBOMWindow window = null; + try { + TCSession session = (TCSession) app.getSession(); + TCTypeService service = session.getTypeService(); + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service.getTypeComponent("BOMWindow"); + window = winType.create(null); + } catch (TCException e) { + e.printStackTrace(); + } + return window; + } + + public void initUI() { + this.setTitle("ͼֽBOMתBOM"); + this.setAutoRequestFocus(true); + this.setSize(new Dimension(650, 320)); + //this.setResizable(false); + JPanel bigJPanel = new JPanel(new BorderLayout()); + bigJPanel.setPreferredSize(new Dimension(650, 320)); + int tempNum = 0; + for (Entry> map : maps.entrySet()) { + if (map.getValue().size() > 0) { + tempNum += 1; + } + } + JPanel panel = new JPanel(new GridLayout(tempNum, 2)); + List jComboBoxs = new ArrayList(); + int count = 1; + List> listMaps = new ArrayList>(); + for (Entry> map : maps.entrySet()) { + System.out.println("ǰ"+map.getKey().toString()); + if (map.getValue().size() > 0) { + try { + label = new JLabel(map.getKey().getProperty("object_string")); +// label.setBounds(200, 40 * count, 100, 25); + TCComponentItemRevision[] itemRevs = new TCComponentItemRevision[map.getValue().size()]; + for (int listlength = 0; listlength < map.getValue().size(); listlength++) { + itemRevs[listlength] = map.getValue().get(listlength); + } + + String[] objectName = new String[itemRevs.length]; + Map itemRevMaps = new HashMap(); + for (int i = 0; i < itemRevs.length; i++) { + objectName[i] = itemRevs[i].getProperty("object_string"); + itemRevMaps.put(objectName[i], itemRevs[i]); + } + JComboBox comboBox = createComboBox(itemRevMaps); +// comboBox.setBounds(350, 40 * count, 200, 25); + ++count; + jComboBoxs.add(comboBox); + listMaps.add(itemRevMaps); + panel.add(label); + panel.add(comboBox); + } catch (Exception e1) { + System.out.println(e1.getMessage()); + } + + } + } + // panelĴСпɱ +// panel.setPreferredSize(new Dimension(650, 40 * (maps.size() + 2))); + JPanel tempPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); + tempPanel.setPreferredSize(new Dimension(650, 40 * (maps.size() + 2))); + tempPanel.add(panel); + JScrollPane sPane = new JScrollPane(tempPanel); + sPane.getVerticalScrollBar().setUnitIncrement(20);// ùٶ + JPanel buttonPanel = new JPanel(new ButtonLayout()); + JButton change = new JButton("ͼֽBOMתBOM"); + change.setBounds(250, 20, 100, 80); + change.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + try { + win.lock(); + create(bomlines.get(0), jComboBoxs, listMaps); + InterfaceAIFComponent targetComponent = app.getTargetComponent(); + TCComponentItemRevision revision = (TCComponentItemRevision) targetComponent; + String type = revision.getType(); +// connor_laoShiBao = session.getPreferenceService().getStringValues("connor_laoshibao"); +// connor_xinShiBao = session.getPreferenceService().getStringValues("connor_xinshibao"); +// drawingtypes = session.getPreferenceService().getStringValues("connor_laoshibao_sb6_DRM03"); +// laoShiBao = Arrays.asList(connor_laoShiBao).contains(type); +// xinShiBao = Arrays.asList(connor_xinShiBao).contains(type); + + if (revSet != null && revSet.size() > 0) { + for (TCComponentItemRevision rev : revSet) { + MessageBox.post(rev.getProperty("object_string") + " ͼֽûжӦ϶", "ʾ", 4); + } + MessageBox.post("תʧ", "ʾ", 2); + } else { +// if (xinShiBao) { + createXin(bomlines.get(0), jComboBoxs, listMaps); +// } else if (laoShiBao) { +// creatBOM2SB(bomlines.get(0), jComboBoxs, listMaps); +// } + MessageBox.post("תɹ", "ʾ", 2); + } + win.unlock(); + win.close(); + } catch (Exception e1) { + System.out.println(e1.getMessage()); + } + } + }); + buttonPanel.add(change); + bigJPanel.add(buttonPanel, BorderLayout.NORTH); + bigJPanel.add(sPane, BorderLayout.CENTER); + this.add(bigJPanel); + int windowWidth = this.getWidth(); //ôڿ + int windowHeight = this.getHeight(); //ôڸ + Toolkit kit = Toolkit.getDefaultToolkit(); //幤߰ + Dimension screenSize = kit.getScreenSize(); //ȡĻijߴ + int screenWidth = screenSize.width; //ȡĻĿ + int screenHeight = screenSize.height; //ȡĻĸ + this.setLocation(screenWidth / 2 - windowWidth / 2, screenHeight / 2 - windowHeight / 2);//ôھʾ + this.pack(); + this.setPreferredSize(new Dimension(1200,600)); + this.validate(); + this.setVisible(true); + + } + + // mapеֵӽJComboBox,֮ȡӦitem + private JComboBox createComboBox(final Map map) { + final JComboBox cbox = new JComboBox(); + for (String objectName : map.keySet()) { + cbox.addItem(objectName); + } + return cbox; + } + + public TCComponentItemRevision getItemRev(JComboBox cbox, Map map) { + TCComponentItemRevision itemRev = null; + String objectName = (String) cbox.getSelectedItem(); + itemRev = map.get(objectName); + return itemRev; + } + + public TCComponentItemRevision getWuLiaoRev(TCComponentItemRevision tuZhiChildRev, List jComboBoxs, + List> listMaps) { + TCComponentItemRevision wuLiaoRev = null; + try { + TCComponent[] components = tuZhiChildRev.getTCProperty("representation_for").getReferenceValueArray(); + List productList = new ArrayList(); + for (int leng = 0; leng < components.length; leng++) { + if (components[leng] instanceof TCComponentItemRevision) { + TCComponentItemRevision mateRevision = (TCComponentItemRevision) components[leng]; + productList.add(mateRevision); + } + } + if (productList.size() <= 0) { + boolean tempbool = true; + for(String s:filterList) { + if(tuZhiChildRev.getProperty("object_string").contains(s)) { + tempbool = false; + break; + } + } + if(tempbool){ + revSet.add(tuZhiChildRev); + } + } + if (productList.size() == 1) { + wuLiaoRev = productList.get(0); + } + if (productList.size() > 1) { + for (int j = 0; j < jComboBoxs.size(); j++) { + TCComponentItemRevision selectItem = getItemRev(jComboBoxs.get(j), listMaps.get(j)); + int find = productList.indexOf(selectItem); + if (find >= 0) { + wuLiaoRev = productList.get(find); + break; + } + } + } +// if (components.length == 0) { +// TCComponent[] view = tuZhiChildRev.getTCProperty("view").getReferenceValueArray(); +// if (view != null) { +// for (int i = 0; i < view.length; i++) { +// TCComponentItem item = (TCComponentItem) view[i]; +// if (item != null) { +// TCComponentItemRevision latestItemRevision = item.getLatestItemRevision(); +// if (latestItemRevision instanceof TCComponentItemRevision) { +// wuLiaoRev = getWuLiaoRev(latestItemRevision, jComboBoxs, listMaps); +// } +// } +// } +// } +// } + + } catch (Exception e) { + e.printStackTrace(); + System.out.println(e.getMessage()); + } + return wuLiaoRev; + } + + public TCComponentItemRevision getWuLiao(TCComponentItemRevision tuZhiChildRev, List jComboBoxs, + List> listMaps) { + TCComponentItemRevision wuLiaoRev = null; + try { + TCComponent[] components = tuZhiChildRev.getTCProperty("representation_for").getReferenceValueArray(); + List productList = new ArrayList(); + for (int leng = 0; leng < components.length; leng++) { + if (components[leng] instanceof TCComponentItemRevision) { + TCComponentItemRevision mateRevision = (TCComponentItemRevision) components[leng]; + productList.add(mateRevision); + } + } + if (productList.size() <= 0) { + boolean tempbool = true; + for(String s:filterList) { + if(tuZhiChildRev.getProperty("object_string").contains(s)) { + tempbool = false; + break; + } + } + if(tempbool){ + revSet.add(tuZhiChildRev); + } + } + if (productList.size() == 1) { + wuLiaoRev = productList.get(0); + } + if (productList.size() > 1) { + for (int j = 0; j < jComboBoxs.size(); j++) { + TCComponentItemRevision selectItem = getItemRev(jComboBoxs.get(j), listMaps.get(j)); + int find = productList.indexOf(selectItem); + if (find >= 0) { + wuLiaoRev = productList.get(find); + break; + } + } + } + TCComponent[] view = tuZhiChildRev.getTCProperty("view").getReferenceValueArray(); + if (view != null) { + for (int i = 0; i < view.length; i++) { + TCComponentItem item = (TCComponentItem) view[i]; + if (item != null) { + TCComponentItemRevision latestItemRevision = item.getLatestItemRevision(); + if (latestItemRevision instanceof TCComponentItemRevision) { + getWuLiaoRev(latestItemRevision, jComboBoxs, listMaps); + } + } + } + } + } catch (Exception e) { + e.printStackTrace(); + System.out.println(e.getMessage()); + } + return wuLiaoRev; + } + + public boolean create(TCComponentBOMLine line, List jComboBoxs, + List> listMaps) { + try { + Map lineMap = new HashMap(); + TCComponentItemRevision tuZhiRev = line.getItemRevision(); + TCComponent[] com = tuZhiRev.getTCProperty("IMAN_master_form_rev").getReferenceValueArray(); +// String isChange = com[0].getProperty("sb6_DRM10"); + TCComponentBOMLine topLine = win.setWindowTopLine(line.getItem(), line.getItemRevision(), null, null); + AIFComponentContext[] children = topLine.getChildren(); +// if ("".equals(isChange) || "true".equals(isChange) || "".equals(isChange) || "Y".equals(isChange)) { + TCComponentItemRevision wuLiaoRev = getWuLiaoRev(tuZhiRev, jComboBoxs, listMaps); + if (wuLiaoRev != null) { + TCComponentBOMWindow window = createWindow(); + TCComponentBOMLine wuLiaoLine = window.setWindowTopLine(wuLiaoRev.getItem(), wuLiaoRev, null, null); + AIFComponentContext[] wuLiaochildren = wuLiaoLine.getChildren(); + if (children != null) { + if (children.length > 0) { + for (AIFComponentContext child : children) { + TCComponentBOMLine lin = (TCComponentBOMLine) child.getComponent(); + TCComponentItemRevision tuZhiChildRev = lin.getItemRevision(); + TCComponentItemRevision wuLiaoChildRev = null; + if (tuZhiChildRev.isTypeOf("Part Revision")) { + System.out.println(tuZhiChildRev+"㲿"); + wuLiaoChildRev = tuZhiChildRev; + } else { + wuLiaoChildRev = getWuLiaoRev(tuZhiChildRev, jComboBoxs, listMaps); + } + if (wuLiaoChildRev != null) { + + } else { + TCComponent[] view = tuZhiChildRev.getTCProperty("view").getReferenceValueArray(); + if (view != null) { + for (int i = 0; i < view.length; i++) { + TCComponentItemRevision item = (TCComponentItemRevision) view[i]; + if (item != null) { + if (item instanceof TCComponentItemRevision) { + wuLiaoRev = getWuLiaoRev(item, jComboBoxs, listMaps); + } + } + } + } + } + } + } + } + window.save(); + window.close(); + } + if (children != null) { + if (children.length > 0) { + for (AIFComponentContext child : children) { + TCComponentBOMLine lin = (TCComponentBOMLine) child.getComponent(); + if (lin != null) { + createXin(lin, jComboBoxs, listMaps); + } + } + } + } +// } + return true; + + } catch (Exception e) { + e.printStackTrace(); + } + return false; + } + + public boolean createXin(TCComponentBOMLine line, List jComboBoxs, + List> listMaps) { + try { + Map lineMap = new HashMap(); + TCComponentItemRevision tuZhiRev = line.getItemRevision(); + TCComponent[] com = tuZhiRev.getReferenceListProperty("IMAN_master_form_rev"); +// String isChange = com[0].getProperty("sb6_DRM10"); + TCComponentBOMLine topLine = win.setWindowTopLine(line.getItem(), line.getItemRevision(), null, null); + + + AIFComponentContext[] children = topLine.getChildren(); + +// if ("".equals(isChange) || "true".equals(isChange) || "".equals(isChange) || "Y".equals(isChange)) { + if(tuZhiRev.isTypeOf("Part Revision")) { + + }else { + // ͼֽӦ + TCComponentItemRevision wuLiaoRev = getWuLiao(tuZhiRev, jComboBoxs, listMaps); + if (wuLiaoRev != null) { + TCComponentBOMWindow window = createWindow(); + TCComponentBOMLine wuLiaoLine = window.setWindowTopLine(wuLiaoRev.getItem(), wuLiaoRev, null, null); + AIFComponentContext[] wuLiaochildren = wuLiaoLine.getChildren(); + // Ƴеbomline + boolean hasChildren = line.hasChildren(); + if (wuLiaochildren != null && hasChildren) { + if (wuLiaochildren.length > 0) { + for (AIFComponentContext child : wuLiaochildren) { + wuLiaoLine.lock(); + wuLiaoLine.remove("", (TCComponent) child.getComponent()); + wuLiaoLine.save(); + wuLiaoLine.unlock(); + } + } + } + if (children != null) { + if (children.length > 0) { +// for (AIFComponentContext child : children) { +// TCComponentBOMLine lin = (TCComponentBOMLine) child.getComponent(); +// lin.unpack(); +// } +// AIFComponentContext[] children2 = topLine.getChildren(); + for (AIFComponentContext child : children) { + TCComponentBOMLine lin = (TCComponentBOMLine) child.getComponent(); + TCComponentItemRevision tuZhiChildRev = lin.getItemRevision(); + TCComponentItemRevision wuLiaoChildRev = null; + if (tuZhiChildRev.isTypeOf("Part Revision")) { + System.out.println(tuZhiChildRev+"㲿"); + wuLiaoChildRev = tuZhiChildRev; + } else { + wuLiaoChildRev = getWuLiao(tuZhiChildRev, jComboBoxs, listMaps); + } + if (wuLiaoChildRev != null) { + wuLiaoLine.lock(); + TCComponentBOMLine wuLiaoChildLine = wuLiaoLine.add(wuLiaoChildRev.getItem(), + wuLiaoChildRev, null, false, ""); + System.out.println(wuLiaoChildRev.getProperty("object_string")); + TCComponent[] refs = wuLiaoChildRev.getReferenceListProperty("TC_Is_Represented_By"); + String bl_quantity = lin.getStringProperty("bl_quantity")!=null?lin.getStringProperty("bl_quantity"):""; + if(bl_quantity.equals(""))bl_quantity = "1"; + + wuLiaoChildLine.setStringProperty("bl_quantity", bl_quantity); + +// TCComponentItemRevision itemRevision=(TCComponentItemRevision)refs[0]; +// String object_name = itemRevision.getProperty("object_string"); +// System.out.println("object_name: "+object_name); +// +// TCTypeService service = session.getTypeService(); +// TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service.getTypeComponent("BOMWindow"); +// TCComponentBOMWindow view = winType.create(null); +// TCComponentBOMLine bomLine = view.setWindowTopLine(itemRevision.getItem(), itemRevision, null, null); +// String quantity = bomLine.getProperty("bl_quantity"); +// System.out.println("quantity: "+quantity); + +// TCComponent[] wuLiao = refs[0].getReferenceListProperty("representation_for"); +// System.out.println(wuLiao.length); +// wuLiaoChildLine.pack(); + wuLiaoChildLine.save(); + wuLiaoLine.save(); + wuLiaoLine.unlock(); + } + } + } + } + window.save(); + window.close(); + } + if (children != null) { + if (children.length > 0) { + for (AIFComponentContext child : children) { + TCComponentBOMLine lin = (TCComponentBOMLine) child.getComponent(); + if (lin != null) { + createXin(lin, jComboBoxs, listMaps); + } + + } + } + } + } + return true; + + } catch (Exception e) { + e.printStackTrace(); + } + return false; + } + + public boolean creatBOM2SB(TCComponentBOMLine line, List jComboBoxs, + List> listMaps) { + try { + TCComponentItemRevision tuZhiRev = line.getItemRevision(); + TCComponent[] com = tuZhiRev.getTCProperty("IMAN_master_form_rev").getReferenceValueArray(); +// String isChange = com[0].getProperty("sb6_DRM10"); + + TCComponentBOMLine topLine = win.setWindowTopLine(line.getItem(), line.getItemRevision(), null, null); + AIFComponentContext[] children = topLine.getChildren(); + +// if ("".equals(isChange) || "true".equals(isChange) || "".equals(isChange) || "Y".equals(isChange)) { + // ͼֽӦ + TCComponentItemRevision wuLiaoRev = getWuLiaoRev(tuZhiRev, jComboBoxs, listMaps); + if (wuLiaoRev != null) { + TCComponentBOMWindow window = createWindow(); + TCComponentBOMLine wuLiaoLine = window.setWindowTopLine(wuLiaoRev.getItem(), wuLiaoRev, null, null); + AIFComponentContext[] wuLiaochildren = wuLiaoLine.getChildren(); + if (wuLiaochildren != null) { + if (wuLiaochildren.length > 0) { + for (AIFComponentContext child : wuLiaochildren) { + wuLiaoLine.lock(); + wuLiaoLine.remove("", (TCComponent) child.getComponent()); + wuLiaoLine.save(); + wuLiaoLine.unlock(); + } + } + } + if (children != null) { + if (children.length > 0) { + for (AIFComponentContext child : children) { + TCComponentBOMLine lin = (TCComponentBOMLine) child.getComponent(); + lin.unpack(); + } + AIFComponentContext[] children2 = topLine.getChildren(); + for (AIFComponentContext child : children2) { + TCComponentBOMLine lin = (TCComponentBOMLine) child.getComponent(); + TCComponentItemRevision tuZhiChildRev = lin.getItemRevision(); + TCComponentItemRevision wuLiaoChildRev = null; + if (tuZhiChildRev.isTypeOf("Part Revision")) { + System.out.println(tuZhiChildRev+"㲿"); + wuLiaoChildRev = tuZhiChildRev; + } else { + wuLiaoChildRev = getWuLiaoRev(tuZhiChildRev, jComboBoxs, listMaps); + } + if (wuLiaoChildRev != null) { + wuLiaoLine.lock(); + TCComponentBOMLine wuLiaoChildLine = wuLiaoLine.add(wuLiaoChildRev.getItem(), + wuLiaoChildRev, null, false, ""); + System.out.println(wuLiaoChildRev.getProperty("object_string")); + TCComponent[] refs = wuLiaoChildRev.getReferenceListProperty("TC_Is_Represented_By"); + TCComponent[] wuLiao = refs[0].getReferenceListProperty("representation_for"); + System.out.println(wuLiao.length); + wuLiaoChildLine.pack(); + wuLiaoChildLine.setProperty("bl_quantity", wuLiao.length+""); + wuLiaoChildLine.save(); + wuLiaoLine.save(); + wuLiaoLine.unlock(); + } else { + TCComponent[] view = tuZhiChildRev.getTCProperty("view").getReferenceValueArray(); + if (view != null) { + for (int i = 0; i < view.length; i++) { + TCComponentItemRevision item = (TCComponentItemRevision) view[i]; + if (item != null) { + if (item instanceof TCComponentItemRevision) { + wuLiaoRev = getWuLiaoRev(item, jComboBoxs, listMaps); + wuLiaoLine.lock(); + TCComponentBOMLine wuLiaoChildLine = wuLiaoLine + .add(wuLiaoRev.getItem(), wuLiaoRev, null, false, ""); + + System.out.println(wuLiaoRev.getProperty("object_string")); + TCComponent[] refs = wuLiaoRev.getReferenceListProperty("TC_Is_Represented_By"); + TCComponent[] wuLiao = refs[0].getReferenceListProperty("representation_for"); + System.out.println(wuLiao.length); + + wuLiaoChildLine.pack(); + //wuLiaoChildLine.setProperty("bl_quantity", wuLiao.length+""); + wuLiaoChildLine.save(); + wuLiaoLine.save(); + wuLiaoLine.unlock(); + } + } + } + } + } + + } + } + } + window.save(); + window.close(); + } +// if (children != null) { +// if (children.length > 0) { +// for (AIFComponentContext child : children) { +// TCComponentBOMLine lin = (TCComponentBOMLine) child.getComponent(); +// if (lin != null) { +// creatBOM2SB(lin, jComboBoxs, listMaps); +// } +// } +// } +// } +// } + return true; + + } catch (Exception e) { + e.printStackTrace(); + } + return false; + } + + private List list = new ArrayList(); + + public void collectAllBomLine(TCComponentBOMLine topBomLine) throws TCException { + if (topBomLine.hasChildren()) { + AIFComponentContext[] childrens = topBomLine.getChildren(); + for (AIFComponentContext aifComponentContext : childrens) { + TCComponentBOMLine bomLine = (TCComponentBOMLine) aifComponentContext.getComponent(); + list.add(bomLine); + collectAllBomLine(bomLine); + } + } + } + +} diff --git a/src/com/connor/zf/dbom2ebom/CreateMaterialsBomHandler.java b/src/com/connor/zf/dbom2ebom/CreateMaterialsBomHandler.java new file mode 100644 index 0000000..d8e3f40 --- /dev/null +++ b/src/com/connor/zf/dbom2ebom/CreateMaterialsBomHandler.java @@ -0,0 +1,111 @@ +package com.connor.zf.dbom2ebom; + +import java.awt.Component; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import com.teamcenter.rac.aif.AbstractAIFUIApplication; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentBOMWindow; +import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class CreateMaterialsBomHandler extends AbstractHandler { + + private TCComponentBOMWindow win; + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFUIApplication app = AIFUtility.getCurrentApplication(); + TCSession session = (TCSession) app.getSession(); + InterfaceAIFComponent component = app.getTargetComponent(); + if (component instanceof TCComponentItemRevision) { + try { + TCComponentType componentType = session.getTypeComponent(component.getType()); + // System.out.println(":"+componentType.getParent().getTypeName()); + TCComponentItemRevision itemRevision = (TCComponentItemRevision) component; + TCComponentBOMWindowType type = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow"); + win = type.create(null); + TCComponentBOMLine line = win.setWindowTopLine(itemRevision.getItem(), itemRevision, null, null); + List bomlines = new ArrayList(); + FindBom(line, bomlines); + win.close(); + if (bomlines.size() == 1) { + MessageBox.post("δҵBOMͼ", "ʾ", 4); + return null; + } + TCComponentItemRevision zcRevision = bomlines.get(0).getItemRevision(); + System.out.println("bomlines.size="+bomlines.size()); + TCComponent[] com = zcRevision.getTCProperty("IMAN_master_form_rev").getReferenceValueArray(); + // ͼֽ󣬺汾¹ϵļе + Map> maps = new HashMap>(); + for (int j = 0; j < bomlines.size(); j++) { + TCComponentBOMLine bomItem = (TCComponentBOMLine) bomlines.get(j); + TCComponentItemRevision bomItemRev = bomItem.getItemRevision(); + +// MessageBox.post(bomItem.getProperty("object_string")+" -- "+j,"bomItem object_string",2);//000098/01;1-45ͼ -- 0 +// MessageBox.post(bomItemRev.getProperty("object_string")+" -- "+j,"bomItemRev object_string",2);//000098/01;1-45 -- 0 + TCComponent[] components = bomItemRev.getTCProperty("representation_for").getReferenceValueArray(); + // ÿһ汾ϵļµжӦ + List productList = new ArrayList(); + for (int i = 0; i < components.length; i++) { + if (components[i] instanceof TCComponentItemRevision) { + TCComponentItemRevision mateRevision = (TCComponentItemRevision) components[i]; + productList.add(mateRevision); + } + } + // key:ͼֽ value:Ӧϵļе + maps.put(bomItemRev, productList); + System.out.println("("+bomItemRev+","+productList+")"); + } + //CreateMaterialsBomDialog cmbd = new CreateMaterialsBomDialog(app, maps, bomlines); + new Thread() { + @Override + public void run() { + + CreateMaterialsBomDialog cmbd = new CreateMaterialsBomDialog(app, maps, bomlines); + + } + }.start(); + //new Thread(cmbd).start(); + } catch (TCException e) { + System.out.println(e.getMessage()); + } + } else { + MessageBox.post("ѡͼֽ汾", "ʾ", MessageBox.INFORMATION); + } + return null; + } + + private void FindBom(TCComponentBOMLine lin, List bomLine) { + try { + System.out.println("type="+lin.getItemRevision().getType()); + if (lin.getItemRevision().isTypeOf("Design Revision")) { + System.out.println(""+lin.getItemRevision()); + bomLine.add(lin); + } + AIFComponentContext[] children = lin.getChildren(); + if (children.length != 0) { + for (AIFComponentContext child : children) { + lin = (TCComponentBOMLine) child.getComponent(); + FindBom(lin, bomLine); + } + } + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } + +} diff --git a/src/com/connor/zf/dbom2ebom/TableBuilder.java b/src/com/connor/zf/dbom2ebom/TableBuilder.java new file mode 100644 index 0000000..5d4d9df --- /dev/null +++ b/src/com/connor/zf/dbom2ebom/TableBuilder.java @@ -0,0 +1,14 @@ +package com.connor.zf.dbom2ebom; + + + + +public class TableBuilder { + + +public static void main(String[] args) { + int []a= {}; + System.out.println(a == null); +} + +} diff --git a/src/com/connor/zf/desingtopart/ChoiceDialog.java b/src/com/connor/zf/desingtopart/ChoiceDialog.java new file mode 100644 index 0000000..fa74c18 --- /dev/null +++ b/src/com/connor/zf/desingtopart/ChoiceDialog.java @@ -0,0 +1,72 @@ +//package com.connor.zf.desingtopart; +// +//import java.awt.GridLayout; +//import java.awt.event.ActionEvent; +//import java.awt.event.ActionListener; +// +//import javax.swing.JButton; +//import javax.swing.JDialog; +// +//import com.teamcenter.rac.kernel.TCComponent; +//import com.teamcenter.rac.kernel.TCComponentItemType; +// +//public class ChoiceDialog extends JDialog{ +// private DeriveMaterialsDialog dialog; +// private TCComponent tz; +// private TCComponent wl; +// private JButton yesButton; +// private JButton noButton; +// private int i; +// private TCComponentItemType itemType; +// public ChoiceDialog(DeriveMaterialsDialog dialog,TCComponent tz,TCComponent wl,int i,TCComponentItemType itemType) { +// this.dialog = dialog; +// this.tz = tz; +// this.wl = wl; +// this.i = i; +// this.itemType = itemType; +// init(); +// } +// +// public void init() { +// dialog.setAlwaysOnTop(false); +// setTitle(tz+"ͼֽѹ"+wl+"ϣǷҪתϣ"); +// setLayout(new GridLayout(1, 2,20,20)); +// yesButton = new JButton("Ҫ"); +// noButton = new JButton("Ҫ"); +// yesButton.addActionListener(new ActionListener() { +// +// @Override +// public void actionPerformed(ActionEvent e) { +// // TODO Auto-generated method stub +// dialog.setContinue(true); +// try { +// dialog.tzMethod(i, itemType); +// } catch (Exception e1) { +// // TODO Auto-generated catch block +// e1.printStackTrace(); +// } +// dialog.setAlwaysOnTop(true); +// ChoiceDialog.this.dispose(); +// } +// }); +// noButton.addActionListener(new ActionListener() { +// +// @Override +// public void actionPerformed(ActionEvent e) { +// // TODO Auto-generated method stub +// dialog.setContinue(false); +// dialog.setAlwaysOnTop(true); +// ChoiceDialog.this.dispose(); +// } +// }); +// add(yesButton); +// add(noButton); +// pack(); +// setDefaultCloseOperation(DISPOSE_ON_CLOSE); +// setLocationRelativeTo(dialog); +// setAlwaysOnTop(true); +// setVisible(true); +// } +// +// +//} diff --git a/src/com/connor/zf/desingtopart/DataBaseControl.java b/src/com/connor/zf/desingtopart/DataBaseControl.java new file mode 100644 index 0000000..897f2a2 --- /dev/null +++ b/src/com/connor/zf/desingtopart/DataBaseControl.java @@ -0,0 +1,256 @@ +package com.connor.zf.desingtopart; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.HashMap; +import java.util.Map; + +import com.teamcenter.rac.util.MessageBox; + +public class DataBaseControl { + + /** ************************ݿ:*********************************** */ + /** + * kelsen .... + */ + Connection conn; + + ResultSet rs; + + PreparedStatement pstmt; + + Statement stmt; + + String strSQLQuery; + + public String str_Information = ""; + + private String strDriver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; + private String strUrl = "jdbc:sqlserver://192.168.188.129:1433; databaseName=TC13"; +// private String strUrl = "jdbc:oracle:thin:@192.168.3.22:1521:tc12"; + private String strUserName = "infodba"; + private String strPassword = "infodba"; + + public DataBaseControl(String strDriver, String strUrl, String strUserName, String strPassword) { + this.strDriver = strDriver; + this.strUrl = strUrl; + this.strUserName = strUserName; + this.strPassword = strPassword; + try { + Class.forName(strDriver); + } catch (ClassNotFoundException cnfe) { + cnfe.printStackTrace(); + } + } + + /** + * ѯ2 + */ + public ResultSet dbQuery2(String strSQLQuery, Object[] strs) { + ResultSet rs_result = null; + if (conn == null) + openDataBase(); + try { + // stmt = conn.createStatement(); + PreparedStatement ps = conn.prepareStatement(strSQLQuery); + for (int i = 0; i < strs.length; i++) { + ps.setObject(i + 1, strs[i]); + } + rs_result = ps.executeQuery(); + + } catch (SQLException sqle2) { + sqle2.printStackTrace(); + } + return rs_result; + } + + /** + * 2 + */ + public void dbModify2(String strSQLQuery, Object[] strs) { + try { + PreparedStatement ps = conn.prepareStatement(strSQLQuery); + for (int i = 0; i < strs.length; i++) { + ps.setObject(i + 1, strs[i]); + } + ps.executeUpdate(); + + } catch (SQLException sqle2) { + sqle2.printStackTrace(); + } + } + + /** + * + * + */ + public void openDataBase() { + try { + if (conn == null || conn.isClosed()) { + conn = DriverManager.getConnection(this.strUrl, this.strUserName, this.strPassword); + } + } catch (SQLException e) { + e.printStackTrace(); + } + } + + /** + * رݿ + */ + public void closeDataBase() { + try { + if (rs != null) { + try { + rs.close(); + } catch (SQLException sqlec) { + sqlec.printStackTrace(); + } + } + if (stmt != null) { + try { + stmt.close(); + } catch (SQLException sqlec) { + sqlec.printStackTrace(); + } + } + if (conn != null && !conn.isClosed()) { + try { + conn.close(); + } catch (SQLException sqlecon) { + sqlecon.printStackTrace(); + } + + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * ˮ + * + * @param type ˮ + * @param prefix ǰ׺ + * @param col ˮλ 4λ"0000" + * @return + * @throws Exception + */ + public String getNewCode(String type, String col) throws Exception { + openDataBase(); + String lshstr = ""; + if (col != null && !"".equals(col)) { + lshstr = col; + } else { + lshstr = "00000000000"; + } + openDataBase(); + // ͼֽͲѯ ǰ׺ ˮ + String query = "select TYPE,PREFIX,LSH from XINSHIBAO where TYPE= ?"; + String query2 = "select LSH from XINSHIBAO where PREFIX = ? "; + String query3 = "select LSH from XINSHIBAO where PREFIX = ? and LSH is not null order by LSH DESC"; + + ResultSet rs = dbQuery2(query, new Object[] { type }); + if (rs.next()) { + String t = rs.getString(1); + String pre = rs.getString(2); + String lsh = rs.getString(3); + + if (pre == null || "".equals(pre) || "null".equals(pre)) { + return "δǰ׺޷ERP"; + } + ResultSet rs2 = dbQuery2(query2, new Object[] { pre }); + boolean flag = rs2.next(); + if (flag) { + lsh = rs2.getString(1); + if (lsh == null || "null".equals(lsh) || "".equals(lsh)) { + int temp = col.length() - pre.length(); + lsh = pre; + while (temp > 0) { + lsh += "0"; + temp--; + } + } else { + ResultSet rs3 = dbQuery2(query3, new Object[] { pre }); + rs3.next(); + lsh = rs3.getString(1); + } + } + long ls = Long.parseLong(lsh) + 1;// µˮ + lshstr = ls + ""; + String upin = "update XINSHIBAO set LSH = ? where TYPE = ? "; + dbModify2(upin, new Object[] { lshstr, t }); + } + closeDataBase(); + return lshstr; + + } + + public String getNewCode(String prefix, String min, String max) throws Exception { + openDataBase(); + String lshstr = ""; + String query = "SELECT LSH FROM T_NumberStorage WHERE PREFIX = ? AND LSHMIN = ?"; + ResultSet rs = dbQuery2(query, new Object[] { prefix, min }); + if (rs.next()) { + String lsh = rs.getString(1); + long parseLong = Long.parseLong(lsh) + 1; + if (parseLong > Long.parseLong(max)) { + return ""; + } + lshstr = parseLong + ""; + if (lshstr.length() < max.length()) { + int temp = max.length() - lshstr.length(); + while (temp > 0) { + lshstr = "0" + lshstr; + temp--; + } + } + String update = "UPDATE T_NumberStorage SET LSH = ? WHERE PREFIX = ? AND LSHMIN = ?"; + dbModify2(update, new Object[] { lshstr, prefix, min }); + } else { + lshstr = min; + String update = "INSERT INTO T_NumberStorage(PREFIX,LSH,LSHMIN) VALUES(?,?,?)"; + dbModify2(update, new Object[] { prefix, min, min }); + } + closeDataBase(); + return lshstr; + } + + public static void main(String args[]) { + try { +// String strDriver = "oracle.jdbc.driver.OracleDriver"; +// String strUrl = "jdbc:oracle:thin:@localhost:1521:tc12"; +// String strUserName = "infodba"; +// String strPassword = "infodba"; +// +// DataBaseControl dbc = new DataBaseControl(strDriver, strUrl, strUserName, strPassword); +// dbc.openDataBase(); +// String newid = dbc.getNewCode("1123456746", "01", "55"); +// System.out.println(newid); +// dbc.closeDataBase(); + +// String min = "099"; +// String max = "999"; +// String lsh = ""; +// long parseLong = Long.parseLong(min)+1; +// System.out.println(parseLong); +// lsh = parseLong + ""; +// if (lsh.length() < max.length()) { +// int temp = max.length() - lsh.length(); +// while (temp > 0) { +// lsh = "0" +lsh; +// temp--; +// } +// } +// System.out.println(lsh); + + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git a/src/com/connor/zf/desingtopart/DeriveMaterialsDialog.java b/src/com/connor/zf/desingtopart/DeriveMaterialsDialog.java new file mode 100644 index 0000000..b497f19 --- /dev/null +++ b/src/com/connor/zf/desingtopart/DeriveMaterialsDialog.java @@ -0,0 +1,2809 @@ +package com.connor.zf.desingtopart; + +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Point; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ComponentEvent; +import java.awt.event.ComponentListener; +import java.awt.event.WindowEvent; +import java.awt.event.WindowStateListener; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import java.awt.Dialog; + +import javax.swing.BorderFactory; +import javax.swing.DefaultCellEditor; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFrame; +//import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.border.Border; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.JTableHeader; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableColumn; +import javax.swing.table.TableColumnModel; + +import com.connor.zf.util.JAutoCompleteComboBox; +import com.connor.zf.util.MyUtil; +import com.connor.zf.util.RwJComboBox; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.AbstractAIFUIApplication; +import com.teamcenter.rac.kernel.ListOfValuesInfo; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentItemType; +import com.teamcenter.rac.kernel.TCComponentListOfValues; +import com.teamcenter.rac.kernel.TCComponentListOfValuesType; +import com.teamcenter.rac.kernel.TCComponentTaskTemplate; +import com.teamcenter.rac.kernel.TCComponentTaskTemplateType; +import com.teamcenter.rac.kernel.TCComponentType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCPropertyDescriptor; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class DeriveMaterialsDialog extends JFrame implements ActionListener,Runnable { + private AbstractAIFUIApplication app; + private TCSession session; + private TCComponent[] targetComps; + private List tzRevs = new ArrayList(); + private List gzRevs = new ArrayList(); + private List bzjRevs = new ArrayList(); + private List yqjRevs = new ArrayList(); + private MyTable tzTable; + private MyTable gzTable; + private MyTable bzjTable; + private MyTable bzjTable2; + private JComboBox tzBox; + private JComboBox gzBox; + private JComboBox bzjBox; + private JComboBox bzjBox2; + private List tzUnitBoxList = new ArrayList(); + private List gzUnitBoxList = new ArrayList(); + private List bzjUnitBoxList = new ArrayList(); + private List bzjUnitBox2List = new ArrayList(); +// private JComboBox tzUnitBox; +// private JComboBox gzUnitBox; +// private JComboBox bzjUnitBox; +// private JComboBox bzjUnitBox2; + private JButton okButton; + private JButton saveButton; + private String[] tzDesc; + private String[] gzDesc; + private String[] bzjDesc; + private String[] bzjDesc2; + private JPanel panel; +// private JPanel panel1; +// private JPanel panel2; +// private JPanel panel3; +// private JScrollPane scrollPane; + private JScrollPane tzTablePanel; + private JScrollPane gzTablePanel; + private JScrollPane bzjTablePanel; + private JScrollPane bzjTablePanel2; + private DefaultTableModel tzModel; + private DefaultTableModel gzModel; + private DefaultTableModel bzjModel; + private DefaultTableModel bzjModel2; + private List tzList = new ArrayList(); + private List gzList = new ArrayList(); + private List bzjList = new ArrayList(); + private List bzjList2 = new ArrayList(); + private List tzpropeprtynameList = new ArrayList();//ʾ + private List tzpropeprtynameList2 = new ArrayList();//λ + private List tzpropeprtynameList3 = new ArrayList();//ʵ + private Map tzpropeprtynameMap = new HashMap();//⴦ʵͣ + private Map tzcomboboxMap = new HashMap();//⴦boxУ + private List gzpropeprtynameList = new ArrayList(); + private List gzpropeprtynameList2 = new ArrayList(); + private List gzpropeprtynameList3 = new ArrayList(); + private Map gzpropeprtynameMap = new HashMap(); + private Map gzcomboboxMap = new HashMap();//⴦boxУ + private List bzjpropeprtynameList = new ArrayList(); + private List bzjpropeprtynameList2 = new ArrayList(); + private List bzjpropeprtynameList3 = new ArrayList(); + private Map bzjpropeprtynameMap = new HashMap(); + private Map bzjcomboboxMap = new HashMap();//⴦boxУ + private List bzjpropeprtyname2List = new ArrayList(); + private List bzjpropeprtyname2List2 = new ArrayList(); + private List bzjpropeprtyname2List3 = new ArrayList(); + private Map bzjpropeprtyname2Map = new HashMap(); + private Map bzjcomboboxMap2 = new HashMap();//⴦boxУ + private List tzListRule = new ArrayList(); + private List gzListRule = new ArrayList(); + private List bzjListRule = new ArrayList(); + private List bzjListRule2 = new ArrayList(); + private List propertyLovs = new ArrayList(); + private Map propertyLovMap = new HashMap(); + private Map propertyNameMap = new HashMap(); + private String[] type = new String[4]; + private List propertyLov = new ArrayList(); + private int maxWidth = 0; + private final int WIDTH = 1000; + private final int HEIGHT = 200; + private final String PREF1 = "ZF6_Productcode"; + private JComboBox daihaoBox = new JComboBox(); + private Map daihaoMap = new HashMap(); + protected String[] dbStrings; + protected DataBaseControl dataBaseControl = null; +// private boolean isContinue = true; +// +// +// public boolean isContinue() { +// return isContinue; +// } +// +// public void setContinue(boolean isContinue) { +// this.isContinue = isContinue; +// } + + public DeriveMaterialsDialog() { + super(); + } + + public DeriveMaterialsDialog(AbstractAIFUIApplication app, TCSession session, TCComponent[] targetComps) { + super(); + this.app = app; + this.session = session; + this.targetComps = targetComps; + } + + @Override + public void run() { + try { + init(); + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public void init() throws TCException { + String[] strings1 = session.getPreferenceService().getStringValues(PREF1); + for(String s:strings1) { + String[] split = s.split(":"); + daihaoBox.addItem(split[1]); + daihaoMap.put(split[1], split[0]); + } + String[] stringV = session.getPreferenceService().getStringValues("connor_design_to_part"); + if(stringV==null||stringV.length==0) { + MessageBox.post("δѡconnor_design_to_part","",MessageBox.INFORMATION); + return; + } + for (String s : stringV) { + String[] split = s.split("[|]"); + String[] split2 = split[0].split("="); + if (split2[0].equals("ZF6_ZCTRevision")) { + type[0] = split2[1]; + } else if (split2[0].equals("ZF6_LJTRevision")) { + type[1] = split2[1]; + } else if (split2[0].equals("ZF6_CJGTRevision")) { + type[2] = split2[1]; + } else if (split2[0].equals("ZF6_DJGTRevision")) { + type[3] = split2[1]; + } + } + String[] lovStringV = session.getPreferenceService().getStringValues("connor_design_to_part_LOV"); + if(lovStringV!=null) { + + for (String s:lovStringV) { + String[] split = s.split("[.]"); + propertyNameMap.put(split[0],split[1]); + } + } + for (TCComponent target : targetComps) { + String itemName = null; + String[] property = null; + String[] temp = null; + String[] rule = null; + TCComponentItemRevision revision = (TCComponentItemRevision) target; + TCComponentItem item = revision.getItem(); + itemName = item.getStringProperty("object_string"); + String type = revision.getType(); + TCComponent[] forms = revision.getReferenceListProperty("IMAN_master_form_rev"); + TCComponent form = forms[0]; + String[] stringValues = session.getPreferenceService().getStringValues("connor_design_to_part"); + if (type.equals("ZF6_ZCTRevision")) { + tzRevs.add(revision); + if (stringValues != null && stringValues.length > 0) { + for (String s : stringValues) { + String s0 = s.substring(0, s.indexOf("|")); + String s1 = s.substring(s.indexOf("|") + 1); + if (s0.split("=").length == 2) { + if (s0.split("=")[0].equals("ZF6_ZCTRevision")) { + String wuliaoItem = s0.split("=")[1]; + property = s1.split(";"); + temp = new String[property.length]; + rule = new String[property.length]; + for (int i = 0; i < temp.length; i++) { + if (i == -1) { + temp[i] = itemName; + } else { + String[] split = property[i].split("=",-1); + if(split[0]!=null&&split[0].length()>0) { + + String[] pre = split[0].split("[.]"); + if(pre.length==2) { + + if (pre[0].equals("R")) { +// temp[i] = revision.getStringProperty(pre[1]) != null +// ? revision.getStringProperty(pre[1]) +// : ""; + temp[i] = MyUtil.getTCProperty(revision.getTCProperty(pre[1])); + } else if (pre[0].equals("RM")) { +// temp[i] = form.getStringProperty(pre[1]) != null +// ? form.getStringProperty(pre[1]) +// : ""; + temp[i] = MyUtil.getTCProperty(form.getTCProperty(pre[1])); + }else if(pre[0].equals("I")) { + TCComponentItem item2 = revision.getItem(); +// temp[i] = item2.getProperty(pre[1])!=null?item2.getProperty(pre[1]):""; + temp[i] = MyUtil.getTCProperty(item2.getTCProperty(pre[1])); + } + }else { + temp[i] = ""; + } + }else { + temp[i] = ""; + } + String[] post = split[1].split("[.]"); + if (post[1].charAt(post[1].length() - 1) == '!') { + rule[i] = "!"; + System.out.println("ȡһɱ༭"); + String nameString = post[1].substring(0, post[1].length() - 1); + post[1] = post[1].substring(0, post[1].length() - 1); + String displayName = null; + if (post[0].equals("R")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "Revision"); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + }else if(post[0].equals("I")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + } else if(post[0].equals("RM")){ + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "RevisionMaster"); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + } + if (!tzpropeprtynameList.contains(displayName)) { + tzpropeprtynameList.add(displayName); + tzpropeprtynameList2.add(post[0]); + tzpropeprtynameList3.add(nameString); + } + } else if (post[1].charAt(post[1].length() - 1) == '*') { + rule[i] = "*"; + System.out.println("ȡһ"); + String nameString = post[1].substring(0, post[1].length() - 1); + post[1] = post[1].substring(0, post[1].length() - 1); + String displayName = null; + if (post[0].equals("R")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "Revision"); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + }else if(post[0].equals("I")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + } else if(post[0].equals("RM")){ + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "RevisionMaster"); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + } + if (!tzpropeprtynameList.contains(displayName)) { + tzpropeprtynameList.add(displayName); + tzpropeprtynameList2.add(post[0]); + tzpropeprtynameList3.add(nameString); + } + } else { + rule[i] = "0"; + String displayName = null; + if (post[0].equals("R")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "Revision"); + signProperty(post[1], typeComponent); + displayName = typeComponent.getPropertyDescriptor(post[1]) + .getDisplayName(); + }else if(post[0].equals("I")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem); + signProperty(post[1], typeComponent); + displayName = typeComponent.getPropertyDescriptor(post[1]) + .getDisplayName(); + } else if(post[0].equals("RM")){ + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "RevisionMaster"); + signProperty(post[1], typeComponent); + displayName = typeComponent.getPropertyDescriptor(post[1]) + .getDisplayName(); + } + if (!tzpropeprtynameList.contains(displayName)) { + tzpropeprtynameList.add(displayName); + tzpropeprtynameList2.add(post[0]); + tzpropeprtynameList3.add(post[1]); + } + } + //2022/11/18⴦Ͳ + if(post.length ==3) { + tzpropeprtynameMap.put(post[1], post[2]); + } + } + } + tzList.add(temp); + tzListRule.add(rule); + break; + } + } + } + } else { + MessageBox.post("ϵԱconnor_design_to_partѡ", "", MessageBox.INFORMATION); + } +// if (tzDesc == null) { +// tzDesc = session.getPreferenceService().getStringValues("connor_design_to_part_option"); +// if(tzDesc==null||tzDesc.length==0) { +// MessageBox.post("δѡconnor_design_to_part_option","",MessageBox.INFORMATION); +// return; +// } +// } + + } else if (type.equals("ZF6_LJTRevision")) { + gzRevs.add(revision); + if (stringValues != null && stringValues.length > 0) { + for (String s : stringValues) { + String s0 = s.substring(0, s.indexOf("|")); + String s1 = s.substring(s.indexOf("|") + 1); + if (s0.split("=").length == 2) { + if (s0.split("=")[0].equals("ZF6_LJTRevision")) { + String wuliaoItem = s0.split("=")[1]; + property = s1.split(";"); + temp = new String[property.length]; + rule = new String[property.length]; + for (int i = 0; i < temp.length; i++) { + if (i == -1) { + temp[i] = itemName; + } else { + String[] split = property[i].split("=",-1); + String[] pre = split[0].split("[.]"); + if(split[0]!=null&&split[0].length()>0) { + + if (pre[0].equals("R")) { +// temp[i] = revision.getStringProperty(pre[1]) != null +// ? revision.getStringProperty(pre[1]) +// : ""; + temp[i] = MyUtil.getTCProperty(revision.getTCProperty(pre[1])); + } else if (pre[0].equals("RM")) { +// temp[i] = form.getStringProperty(pre[1]) != null +// ? form.getStringProperty(pre[1]) +// : ""; + temp[i] = MyUtil.getTCProperty(form.getTCProperty(pre[1])); + }else if(pre[0].equals("I")) { + TCComponentItem item2 = revision.getItem(); +// temp[i] = item2.getProperty(pre[1])!=null?item2.getProperty(pre[1]):""; + temp[i] = MyUtil.getTCProperty(item2.getTCProperty(pre[1])); + } + }else { + temp[i] = ""; + } + String[] post = split[1].split("[.]"); + if (post[1].charAt(post[1].length() - 1) == '!') { + rule[i] = "!"; + int t = i + 1; + System.out.println("ͼ" + t + "пɱ༭"); + String nameString = post[1].substring(0, post[1].length() - 1); + post[1] = post[1].substring(0, post[1].length() - 1); + String displayName = null; + if (post[0].equals("R")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "Revision"); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + }else if(post[0].equals("I")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + } else if(post[0].equals("RM")){ + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "RevisionMaster"); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + } + if (!gzpropeprtynameList.contains(displayName)) { + gzpropeprtynameList.add(displayName); + gzpropeprtynameList2.add(post[0]); + gzpropeprtynameList3.add(nameString); + } + } else if (post[1].charAt(post[1].length() - 1) == '*') { + rule[i] = "*"; + int t = i + 1; + System.out.println("ͼ" + t + "б"); + String nameString = post[1].substring(0, post[1].length() - 1); + post[1] = post[1].substring(0, post[1].length() - 1); + String displayName = null; + if (post[0].equals("R")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "Revision"); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + }else if(post[0].equals("I")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + } else if(post[0].equals("RM")){ + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "RevisionMaster"); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + } + if (!gzpropeprtynameList.contains(displayName)) { + gzpropeprtynameList.add(displayName); + gzpropeprtynameList2.add(post[0]); + gzpropeprtynameList3.add(nameString); + } + } else { + rule[i] = "0"; + String displayName = null; + if (post[0].equals("R")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "Revision"); + signProperty(post[1], typeComponent); + displayName = typeComponent.getPropertyDescriptor(post[1]) + .getDisplayName(); + }else if(post[0].equals("I")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem); + signProperty(post[1], typeComponent); + displayName = typeComponent.getPropertyDescriptor(post[1]) + .getDisplayName(); + } else if(post[0].equals("RM")){ + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "RevisionMaster"); + signProperty(post[1], typeComponent); + displayName = typeComponent.getPropertyDescriptor(post[1]) + .getDisplayName(); + } + if (!gzpropeprtynameList.contains(displayName)) { + gzpropeprtynameList.add(displayName); + gzpropeprtynameList2.add(post[0]); + gzpropeprtynameList3.add(post[1]); + } + } + + //2022/11/18⴦Ͳ + if(post.length ==3) { + gzpropeprtynameMap.put(post[1], post[2]); + } + } + } + gzList.add(temp); + gzListRule.add(rule); + break; + } + } + } + } else { + MessageBox.post("ϵԱconnor_design_to_partѡ", "", MessageBox.INFORMATION); + } +// if (gzDesc == null) { +// gzDesc = session.getPreferenceService().getStringValues("connor_design_to_part_option"); +// if(gzDesc==null||gzDesc.length==0) { +// MessageBox.post("δѡconnor_design_to_part_option","",MessageBox.INFORMATION); +// return; +// } +// } + } else if (type.equals("ZF6_CJGTRevision")) { + bzjRevs.add(revision); + if (stringValues != null && stringValues.length > 0) { + for (String s : stringValues) { + String s0 = s.substring(0, s.indexOf("|")); + String s1 = s.substring(s.indexOf("|") + 1); + if (s0.split("=").length == 2) { + if (s0.split("=")[0].equals("ZF6_CJGTRevision")) { + String wuliaoItem = s0.split("=")[1]; + property = s1.split(";"); + temp = new String[property.length]; + rule = new String[property.length]; + for (int i = 0; i < temp.length; i++) { + if (i == -1) { + temp[i] = itemName; + } else { + String[] split = property[i].split("=",-1); + String[] pre = split[0].split("[.]"); + if(split[0]!=null&&split[0].length()>0) { + + if (pre[0].equals("R")) { +// temp[i] = revision.getStringProperty(pre[1]) != null +// ? revision.getStringProperty(pre[1]) +// : ""; + temp[i] = MyUtil.getTCProperty(revision.getTCProperty(pre[1])); + } else if (pre[0].equals("RM")) { +// temp[i] = form.getStringProperty(pre[1]) != null +// ? form.getStringProperty(pre[1]) +// : ""; + temp[i] = MyUtil.getTCProperty(form.getTCProperty(pre[1])); + }else if(pre[0].equals("I")) { + TCComponentItem item2 = revision.getItem(); +// temp[i] = item2.getProperty(pre[1])!=null?item2.getProperty(pre[1]):""; + temp[i] = MyUtil.getTCProperty(item2.getTCProperty(pre[1])); + } + }else { + temp[i] = ""; + } + String[] post = split[1].split("[.]"); + if (post[1].charAt(post[1].length() - 1) == '!') { + rule[i] = "!"; + System.out.println("ȡһɱ༭"); + String nameString = post[1].substring(0, post[1].length() - 1); + post[1] = post[1].substring(0, post[1].length() - 1); + String displayName = null; + if (post[0].equals("R")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "Revision"); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + }else if(post[0].equals("I")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + } else if(post[0].equals("RM")){ + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "RevisionMaster"); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + } + if (!bzjpropeprtynameList.contains(displayName)) { + bzjpropeprtynameList.add(displayName); + bzjpropeprtynameList2.add(post[0]); + bzjpropeprtynameList3.add(nameString); + } + } else if (post[1].charAt(post[1].length() - 1) == '*') { + rule[i] = "*"; + System.out.println("ȡһ"); + String nameString = post[1].substring(0, post[1].length() - 1); + post[1] = post[1].substring(0, post[1].length() - 1); + String displayName = null; + if (post[0].equals("R")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "Revision"); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + }else if(post[0].equals("I")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + } else if(post[0].equals("RM")){ + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "RevisionMaster"); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + } + if (!bzjpropeprtynameList.contains(displayName)) { + bzjpropeprtynameList.add(displayName); + bzjpropeprtynameList2.add(post[0]); + bzjpropeprtynameList3.add(nameString); + } + } else { + rule[i] = "0"; + String displayName = null; + if (post[0].equals("R")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "Revision"); + signProperty(post[1], typeComponent); + displayName = typeComponent.getPropertyDescriptor(post[1]) + .getDisplayName(); + }else if(post[0].equals("I")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem); + signProperty(post[1], typeComponent); + displayName = typeComponent.getPropertyDescriptor(post[1]) + .getDisplayName(); + } else if(post[0].equals("RM")){ + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "RevisionMaster"); + signProperty(post[1], typeComponent); + displayName = typeComponent.getPropertyDescriptor(post[1]) + .getDisplayName(); + } + if (!bzjpropeprtynameList.contains(displayName)) { + bzjpropeprtynameList.add(displayName); + bzjpropeprtynameList2.add(post[0]); + bzjpropeprtynameList3.add(post[1]); + } + } + //2022/11/18⴦Ͳ + if(post.length ==3) { + bzjpropeprtynameMap.put(post[1], post[2]); + } + } + } + bzjList.add(temp); + bzjListRule.add(rule); + break; + } + } + } + } else { + MessageBox.post("ϵԱconnor_design_to_partѡ", "", MessageBox.INFORMATION); + } +// if (bzjDesc == null) { +// bzjDesc = session.getPreferenceService().getStringValues("connor_design_to_part_option"); +// if(bzjDesc==null||bzjDesc.length==0) { +// MessageBox.post("δѡconnor_design_to_part_option","",MessageBox.INFORMATION); +// return; +// } +// } + }else if (type.equals("ZF6_DJGTRevision")) { + yqjRevs.add(revision); + if (stringValues != null && stringValues.length > 0) { + for (String s : stringValues) { + String s0 = s.substring(0, s.indexOf("|")); + String s1 = s.substring(s.indexOf("|") + 1); + if (s0.split("=").length == 2) { + if(s0.split("=")[0].equals("ZF6_DJGTRevision")) { + String wuliaoItem = s0.split("=")[1]; + property = s1.split(";"); + temp = new String[property.length]; + rule = new String[property.length]; + for (int i = 0; i < temp.length; i++) { + if (i == -1) { + temp[i] = itemName; + } else { + String[] split = property[i].split("=",-1); + String[] pre = split[0].split("[.]"); + if(split[0]!=null&&split[0].length()>0) { + + if (pre[0].equals("R")) { +// temp[i] = revision.getStringProperty(pre[1]) != null +// ? revision.getStringProperty(pre[1]) +// : ""; + temp[i] = MyUtil.getTCProperty(revision.getTCProperty(pre[1])); + } else if (pre[0].equals("RM")) { +// temp[i] = form.getStringProperty(pre[1]) != null +// ? form.getStringProperty(pre[1]) +// : ""; + temp[i] = MyUtil.getTCProperty(form.getTCProperty(pre[1])); + }else if(pre[0].equals("I")) { + TCComponentItem item2 = revision.getItem(); +// temp[i] = item2.getProperty(pre[1])!=null?item2.getProperty(pre[1]):""; + temp[i] = MyUtil.getTCProperty(item2.getTCProperty(pre[1])); + } + }else { + temp[i] = ""; + } + String[] post = split[1].split("[.]"); + if (post[1].charAt(post[1].length() - 1) == '!') { + rule[i] = "!"; + System.out.println("ȡһɱ༭"); + String nameString = post[1].substring(0, post[1].length() - 1); + post[1] = post[1].substring(0, post[1].length() - 1); + String displayName = null; + if (post[0].equals("R")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "Revision"); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + }else if(post[0].equals("I")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + } else if(post[0].equals("RM")){ + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "RevisionMaster"); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + } + if (!bzjpropeprtyname2List.contains(displayName)) { + bzjpropeprtyname2List.add(displayName); + bzjpropeprtyname2List2.add(post[0]); + bzjpropeprtyname2List3.add(nameString); + } + } else if (post[1].charAt(post[1].length() - 1) == '*') { + rule[i] = "*"; + System.out.println("ȡһ"); + String nameString = post[1].substring(0, post[1].length() - 1); + post[1] = post[1].substring(0, post[1].length() - 1); + String displayName = null; + if (post[0].equals("R")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "Revision"); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + }else if(post[0].equals("I")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + } else if(post[0].equals("RM")){ + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "RevisionMaster"); + signProperty(nameString, typeComponent); + displayName = typeComponent.getPropertyDescriptor(nameString) + .getDisplayName(); + } + if (!bzjpropeprtyname2List.contains(displayName)) { + bzjpropeprtyname2List.add(displayName); + bzjpropeprtyname2List2.add(post[0]); + bzjpropeprtyname2List3.add(nameString); + } + } else { + rule[i] = "0"; + String displayName = null; + if (post[0].equals("R")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "Revision"); + signProperty(post[1], typeComponent); + displayName = typeComponent.getPropertyDescriptor(post[1]) + .getDisplayName(); + }else if(post[0].equals("I")) { + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem); + signProperty(post[1], typeComponent); + displayName = typeComponent.getPropertyDescriptor(post[1]) + .getDisplayName(); + } else if(post[0].equals("RM")){ + TCComponentType typeComponent = session + .getTypeComponent(wuliaoItem + "RevisionMaster"); + signProperty(post[1], typeComponent); + displayName = typeComponent.getPropertyDescriptor(post[1]) + .getDisplayName(); + } + if (!bzjpropeprtyname2List.contains(displayName)) { + bzjpropeprtyname2List.add(displayName); + bzjpropeprtyname2List2.add(post[0]); + bzjpropeprtyname2List3.add(post[1]); + } + } + + //2022/11/18⴦Ͳ + if(post.length ==3) { + bzjpropeprtyname2Map.put(post[1], post[2]); + } + } + } + bzjList2.add(temp); + bzjListRule2.add(rule); + break; + } + } + } + }else { + MessageBox.post("ϵԱconnor_design_to_partѡ", "", MessageBox.INFORMATION); + } +// if (bzjDesc2 == null) { +// bzjDesc2 = session.getPreferenceService().getStringValues("connor_design_to_part_option"); +// if(bzjDesc2==null||bzjDesc2.length==0) { +// MessageBox.post("δѡconnor_design_to_part_option","",MessageBox.INFORMATION); +// return; +// } +// } + } + + } + + panel = new JPanel(new PropertyLayout()); + tzBox = new JComboBox(); + gzBox = new JComboBox(); + bzjBox = new JComboBox(); + bzjBox2 = new JComboBox(); + okButton = new JButton("ȷ"); + saveButton = new JButton(""); + okButton.setEnabled(false); + JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.LEADING)); + buttonPanel.add(okButton); + buttonPanel.add(saveButton); + //λ + TCComponentType typeComponent = session.getTypeComponent("UnitOfMeasure"); + TCComponent[] extent = typeComponent.extent(); +// JComboBox gzUnitBox = new JComboBox(); +// JComboBox bzjUnitBox = new JComboBox(); +// JComboBox bzjUnitBox2 = new JComboBox(); +// gzUnitBox.addItem(null); +// bzjUnitBox.addItem(null); +// bzjUnitBox2.addItem(null); +// JComboBox unitBox = new JComboBox(); +// unitBox.addItem(null); +// for(int i = 0;i 0) { + if (tzDesc != null) { + for (String s : tzDesc) { + tzBox.addItem(s.split("[|]")[0]); + } + tzBox.setSelectedIndex(0); + } + String[] tzHeader = new String[tzpropeprtynameList.size() + 1]; + tzHeader[0] = "Ʒ"; + for (int i = 1; i < tzpropeprtynameList.size() + 1; i++) { + tzHeader[i] = tzpropeprtynameList.get(i - 1); + } + tzModel = new DefaultTableModel(null, tzHeader); + //ò޸ + tzTable = new MyTable() { + @Override + public boolean isCellEditable(int row, int column) { + if (column == 0) { + return true; + } + if (tzListRule.size() > 0) { + for (int i = 0; i < tzListRule.get(0).length; i++) { + if (tzListRule.get(0)[i].equals("!")) { + int temp = i + 1; + if (column == temp) + return false; + } + } + } + return true; + } + + }; + tzTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + tzTable.setModel(tzModel); + int[] columnwidth = new int[tzHeader.length]; +// columnwidth[0] = 300; +// columnwidth[1] = 300; +// columnwidth[2] = 200; + for (int i = 0; i < tzHeader.length; i++) { + columnwidth[i] = 150; + } + tzTable.setColumnModel(getColumn(tzTable, columnwidth)); + tzTable.setRowHeight(35); + for (int i = 0; i < tzList.size(); i++) { + tzModel.addRow(new String[] {}); + int temp = 0; + for (int j = 0; j < tzList.get(i).length + 1; j++) { + if (j == 0) { + tzTable.setComboCell(i, j, new DefaultCellEditor(daihaoBox)); + tzTable.setValueAt(daihaoBox.getItemAt(0).toString(), i, j); + }else if(tzpropeprtynameList3.get(j-1).equals("uom_tag")) { + JComboBox unitBox = new JAutoCompleteComboBox(); + unitBox.addItem(null); + for(int ii = 0;ii list = new ArrayList(); + list.add(new String[] {""}); + for (String s : propertyLovs.get(temp)) { + String[] temp2 = {s}; + list.add(temp2); + } + String[][] str = list.toArray(new String[list.size()][1]); + RwJComboBox jComboBox = new RwJComboBox(str); + jComboBox.setEditable(true); + jComboBox.setSelectedIndex(0); + tzcomboboxMap.put(jComboBox, new int[] {i,j}); + jComboBox.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + System.out.println("λ1"+tzcomboboxMap.get(jComboBox)[0] + +""+tzcomboboxMap.get(jComboBox)[1]+"еֵΪ" + +jComboBox.getSelectedItem().toString()); + tzTable.setValueAt(jComboBox.getSelectedItem().toString(), + tzcomboboxMap.get(jComboBox)[0], tzcomboboxMap.get(jComboBox)[1]); + } + }); + tzTable.setComboCell(i, j, new DefaultCellEditor(jComboBox)); + if(jComboBox.getSelectedItem()!=null) { + tzTable.setValueAt(jComboBox.getSelectedItem().toString(), i, j); + } + temp++; + break; + case "bool": + JComboBox unitBox = new JAutoCompleteComboBox(); + unitBox.addItem(""); + unitBox.addItem(""); + unitBox.setSelectedIndex(0); + tzTable.setComboCell(i, j, new DefaultCellEditor(unitBox)); + tzTable.setValueAt(unitBox.getSelectedItem().toString(), i, j); + break; + + default: + break; + } + }else{ + if (propertyNameMap.containsKey(tzpropeprtynameList3.get(j-1))) { + JComboBox box = new JAutoCompleteComboBox(); + box.addItem(""); + for (String s : propertyLovs.get(temp)) { + box.addItem(s); + } + tzTable.setComboCell(i, j, new DefaultCellEditor(box)); + if (tzList.get(i)[j - 1] != null && !"".equals(tzList.get(i)[j - 1])) { + for (Map.Entry entry : propertyLovMap.entrySet()) { + if (entry.getValue().equals(tzList.get(i)[j - 1])) { + box.setSelectedItem(entry.getKey()); + break; + } + } + } + temp++; + } else { + tzTable.setValueAt(tzList.get(i)[j - 1], i, j); + } + } + + } + } + } + + if (gzList != null && gzList.size() > 0) { + if (gzDesc != null) { + for (String s : gzDesc) { + gzBox.addItem(s.split("[|]")[0]); + } + gzBox.setSelectedIndex(0); + } + String[] gzHeader = new String[gzpropeprtynameList.size() + 1]; + gzHeader[0] = "Ʒ"; + for (int i = 1; i < gzpropeprtynameList.size() + 1; i++) { + gzHeader[i] = gzpropeprtynameList.get(i - 1); + } + gzModel = new DefaultTableModel(null, gzHeader); + gzTable = new MyTable() { + @Override + public boolean isCellEditable(int row, int column) { + if (column == 0) { + return true; + } + if (gzListRule.size() > 0) { + for (int i = 0; i < gzListRule.get(0).length; i++) { + if (gzListRule.get(0)[i].equals("!")) { + int temp = i + 1; + if (column == temp) + return false; + } + } + } + return true; + } + + }; + gzTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + gzTable.setModel(gzModel); + int[] columnwidth = new int[gzHeader.length]; +// columnwidth[0] = 300; +// columnwidth[1] = 300; +// columnwidth[2] = 200; + for (int i = 0; i < gzHeader.length; i++) { + columnwidth[i] = 150; + } + gzTable.setColumnModel(getColumn(gzTable, columnwidth)); + gzTable.setRowHeight(35); + for (int i = 0; i < gzList.size(); i++) { + gzModel.addRow(new String[] {}); + int temp = 0; + for (int j = 0; j < gzList.get(i).length + 1; j++) { + if (j == 0) { + gzTable.setComboCell(i, j, new DefaultCellEditor(daihaoBox)); + gzTable.setValueAt(daihaoBox.getItemAt(0).toString(), i, j); + }else if(gzpropeprtynameList3.get(j-1).equals("uom_tag")) { + JComboBox unitBox = new JAutoCompleteComboBox(); + unitBox.addItem(null); + for(int ii = 0;ii list = new ArrayList(); + list.add(new String[] {""}); + for (String s : propertyLovs.get(temp)) { + String[] temp2 = {s}; + list.add(temp2); + } + String[][] str = list.toArray(new String[list.size()][1]); + RwJComboBox jComboBox = new RwJComboBox(str); + jComboBox.setEditable(true); + jComboBox.setSelectedIndex(0); + gzcomboboxMap.put(jComboBox, new int[] {i,j}); + jComboBox.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + System.out.println("λ2"+gzcomboboxMap.get(jComboBox)[0] + +""+gzcomboboxMap.get(jComboBox)[1]+"еֵΪ" + +jComboBox.getSelectedItem().toString()); + gzTable.setValueAt(jComboBox.getSelectedItem().toString(), + gzcomboboxMap.get(jComboBox)[0], gzcomboboxMap.get(jComboBox)[1]); + } + }); + gzTable.setComboCell(i, j, new DefaultCellEditor(jComboBox)); + if(jComboBox.getSelectedItem()!=null) { + + gzTable.setValueAt(jComboBox.getSelectedItem().toString(), i, j); + } + temp++; + break; + case "bool": + JComboBox unitBox = new JAutoCompleteComboBox(); + unitBox.addItem(""); + unitBox.addItem(""); + unitBox.setSelectedIndex(0); + gzTable.setComboCell(i, j, new DefaultCellEditor(unitBox)); + gzTable.setValueAt(unitBox.getSelectedItem().toString(), i, j); + break; + + default: + break; + } + } else{ + if (propertyNameMap.containsKey(gzpropeprtynameList3.get(j-1))) { + JComboBox box = new JAutoCompleteComboBox(); + box.addItem(""); + for (String s : propertyLovs.get(temp)) { + box.addItem(s); + } + gzTable.setComboCell(i, j, new DefaultCellEditor(box)); + if (gzList.get(i)[j - 1] != null && !"".equals(gzList.get(i)[j - 1])) { + for (Map.Entry entry : propertyLovMap.entrySet()) { + if (entry.getValue().equals(gzList.get(i)[j - 1])) { + box.setSelectedItem(entry.getKey()); + break; + } + } + } + temp++; + } else { + gzTable.setValueAt(gzList.get(i)[j - 1], i, j); + } + } + + } + } + } + + if (bzjList != null && bzjList.size() > 0) { + if (bzjDesc != null) { + for (String s : bzjDesc) { + bzjBox.addItem(s.split("[|]")[0]); + } + bzjBox.setSelectedIndex(0); + } + String[] bzjHeader = new String[bzjpropeprtynameList.size() + 1]; + bzjHeader[0] = "Ʒ"; + + for (int i = 1; i < bzjpropeprtynameList.size() + 1; i++) { + bzjHeader[i] = bzjpropeprtynameList.get(i - 1); + } + bzjModel = new DefaultTableModel(null, bzjHeader); + bzjTable = new MyTable() { + @Override + public boolean isCellEditable(int row, int column) { + if (column == 0) { + return true; + } + if (bzjListRule.size() > 0) { + for (int i = 0; i < bzjListRule.get(0).length; i++) { + if (bzjListRule.get(0)[i].equals("!")) { + int temp = i + 1; + if (column == temp) + return false; + } + } + } + return true; + } + + }; + bzjTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + bzjTable.setModel(bzjModel); + int[] columnwidth = new int[bzjHeader.length]; +// columnwidth[0] = 300; +// columnwidth[1] = 300; +// columnwidth[2] = 200; + for (int i = 0; i < bzjHeader.length; i++) { + columnwidth[i] = 150; + } + bzjTable.setColumnModel(getColumn(bzjTable, columnwidth)); + bzjTable.setRowHeight(35); + for (int i = 0; i < bzjList.size(); i++) { + bzjModel.addRow(new String[] {}); + int temp = 0; + for (int j = 0; j < bzjList.get(i).length + 1; j++) { + if (j == 0) { + bzjTable.setComboCell(i, j, new DefaultCellEditor(daihaoBox)); + bzjTable.setValueAt(daihaoBox.getItemAt(0).toString(), i, j); + }else if(bzjpropeprtynameList3.get(j-1).equals("uom_tag")) { + JComboBox unitBox = new JAutoCompleteComboBox(); + unitBox.addItem(null); + for(int ii = 0;ii list = new ArrayList(); + list.add(new String[] {""}); + for (String s : propertyLovs.get(temp)) { + String[] temp2 = {s}; + list.add(temp2); + } + String[][] str = list.toArray(new String[list.size()][1]); + RwJComboBox jComboBox = new RwJComboBox(str); + jComboBox.setEditable(true); + jComboBox.setSelectedIndex(0); + bzjcomboboxMap.put(jComboBox, new int[] {i,j}); + jComboBox.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + System.out.println("λ3"+bzjcomboboxMap.get(jComboBox)[0] + +""+bzjcomboboxMap.get(jComboBox)[1]+"еֵΪ" + +jComboBox.getSelectedItem().toString()); + bzjTable.setValueAt(jComboBox.getSelectedItem().toString(), + bzjcomboboxMap.get(jComboBox)[0], bzjcomboboxMap.get(jComboBox)[1]); + } + }); + bzjTable.setComboCell(i, j, new DefaultCellEditor(jComboBox)); + if(jComboBox.getSelectedItem()!=null) { + + bzjTable.setValueAt(jComboBox.getSelectedItem().toString(), i, j); + } + temp++; + break; + case "bool": + JComboBox unitBox = new JAutoCompleteComboBox(); + unitBox.addItem(""); + unitBox.addItem(""); + unitBox.setSelectedIndex(0); + bzjTable.setComboCell(i, j, new DefaultCellEditor(unitBox)); + bzjTable.setValueAt(unitBox.getSelectedItem().toString(), i, j); + break; + + default: + break; + } + } else{ + if (propertyNameMap.containsKey(bzjpropeprtynameList3.get(j-1))) { + JComboBox box = new JAutoCompleteComboBox(); + box.addItem(""); + for (String s : propertyLovs.get(temp)) { + box.addItem(s); + } + bzjTable.setComboCell(i, j, new DefaultCellEditor(box)); + if (bzjList.get(i)[j - 1] != null && !"".equals(bzjList.get(i)[j - 1])) { + for (Map.Entry entry : propertyLovMap.entrySet()) { + if (entry.getValue().equals(bzjList.get(i)[j - 1])) { + box.setSelectedItem(entry.getKey()); + break; + } + } + } + temp++; + } else { + bzjTable.setValueAt(bzjList.get(i)[j - 1], i, j); + } + } + + } + } + } + + if (bzjList2 != null && bzjList2.size() > 0) { + if (bzjDesc2 != null) { + for (String s : bzjDesc2) { + bzjBox2.addItem(s.split("[|]")[0]); + } + bzjBox2.setSelectedIndex(0); + } + String[] bzjHeader = new String[bzjpropeprtyname2List.size() + 1]; + bzjHeader[0] = "Ʒ"; + + for (int i = 1; i < bzjpropeprtyname2List.size() + 1; i++) { + bzjHeader[i] = bzjpropeprtyname2List.get(i - 1); + } + bzjModel2 = new DefaultTableModel(null, bzjHeader); + bzjTable2 = new MyTable() { + @Override + public boolean isCellEditable(int row, int column) { + if (column == 0) { + return true; + } + if (bzjListRule2.size() > 0) { + for (int i = 0; i < bzjListRule2.get(0).length; i++) { + if (bzjListRule2.get(0)[i].equals("!")) { + int temp = i + 1; + if (column == temp) + return false; + } + } + } + return true; + } + + }; + bzjTable2.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + bzjTable2.setModel(bzjModel2); + int[] columnwidth2 = new int[bzjHeader.length]; +// columnwidth[0] = 300; +// columnwidth[1] = 300; +// columnwidth[2] = 200; + for (int i = 0; i < bzjHeader.length; i++) { + columnwidth2[i] = 150; + } + bzjTable2.setColumnModel(getColumn(bzjTable2, columnwidth2)); + bzjTable2.setRowHeight(35); + for (int i = 0; i < bzjList2.size(); i++) { + bzjModel2.addRow(new String[] {}); + int temp = 0; + for (int j = 0; j < bzjList2.get(i).length + 1; j++) { + if (j == 0) { + bzjTable2.setComboCell(i, j, new DefaultCellEditor(daihaoBox)); + bzjTable2.setValueAt(daihaoBox.getItemAt(0).toString(), i, j); + }else if(bzjpropeprtyname2List3.get(j-1).equals("uom_tag")) { + JComboBox unitBox = new JAutoCompleteComboBox(); + unitBox.addItem(null); + for(int ii = 0;ii list = new ArrayList(); + list.add(new String[] {""}); + for (String s : propertyLovs.get(temp)) { + String[] temp2 = {s}; + list.add(temp2); + } + String[][] str = list.toArray(new String[list.size()][1]); + RwJComboBox jComboBox = new RwJComboBox(str); + jComboBox.setEditable(true); + jComboBox.setSelectedIndex(0); + bzjcomboboxMap2.put(jComboBox, new int[] {i,j}); + jComboBox.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + System.out.println("λ4"+bzjcomboboxMap2.get(jComboBox)[0] + +""+bzjcomboboxMap2.get(jComboBox)[1]+"еֵΪ" + +jComboBox.getSelectedItem().toString()); + bzjTable2.setValueAt(jComboBox.getSelectedItem().toString(), + bzjcomboboxMap2.get(jComboBox)[0], bzjcomboboxMap2.get(jComboBox)[1]); + } + }); + bzjTable2.setComboCell(i, j, new DefaultCellEditor(jComboBox)); + if(jComboBox.getSelectedItem()!=null) { + + bzjTable2.setValueAt(jComboBox.getSelectedItem().toString(), i, j); + } + temp++; + break; + case "bool": + JComboBox unitBox = new JAutoCompleteComboBox(); + unitBox.addItem(""); + unitBox.addItem(""); + unitBox.setSelectedIndex(0); + bzjTable2.setComboCell(i, j, new DefaultCellEditor(unitBox)); + bzjTable2.setValueAt(unitBox.getSelectedItem().toString(), i, j); + break; + + default: + break; + } + } else{ + if (propertyNameMap.containsKey(bzjpropeprtyname2List3.get(j-1))) { + JComboBox box = new JAutoCompleteComboBox(); + box.addItem(""); + for (String s : propertyLovs.get(temp)) { + box.addItem(s); + } + bzjTable2.setComboCell(i, j, new DefaultCellEditor(box)); + if (bzjList2.get(i)[j - 1] != null && !"".equals(bzjList2.get(i)[j - 1])) { + for (Map.Entry entry : propertyLovMap.entrySet()) { + if (entry.getValue().equals(bzjList2.get(i)[j - 1])) { + box.setSelectedItem(entry.getKey()); + break; + } + } + } + temp++; + } else { + bzjTable2.setValueAt(bzjList2.get(i)[j - 1], i, j); + } + } + + } + } + } + + if (tzTable != null) { + JLabel label1 = new JLabel("ܳͼ"); +// FitTableColumns(tzTable); + tzTablePanel = new JScrollPane(tzTable); + tzTablePanel.setPreferredSize(new Dimension(WIDTH,HEIGHT)); + tzTablePanel.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + panel.add("1.1.left.top", label1); + panel.add("2.1.left.top", tzTablePanel); + if (gzTable != null) { + JLabel label2 = new JLabel("ͼ"); +// FitTableColumns(gzTable); + gzTablePanel = new JScrollPane(gzTable); + gzTablePanel.setPreferredSize(new Dimension(WIDTH,HEIGHT)); + gzTablePanel.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + panel.add("3.1.left.top", label2); + panel.add("4.1.left.top", gzTablePanel); + if (bzjTable != null) { + JLabel label3 = new JLabel("ӹͼ"); +// FitTableColumns(bzjTable); + bzjTablePanel = new JScrollPane(bzjTable); + bzjTablePanel.setPreferredSize(new Dimension(WIDTH,HEIGHT)); + bzjTablePanel.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + panel.add("5.1.left.top", label3); + panel.add("6.1.left.top", bzjTablePanel); + if (bzjTable2 != null) { + JLabel label4 = new JLabel("ͼӹͼ"); +// FitTableColumns(bzjTable2); + bzjTablePanel2 = new JScrollPane(bzjTable2); + bzjTablePanel2.setPreferredSize(new Dimension(WIDTH,HEIGHT)); + bzjTablePanel2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + panel.add("7.1.left.top",label4); + panel.add("8.1.left.top",bzjTablePanel2); + + panel.add("9.1.left.top", buttonPanel); + + }else { + panel.add("7.1.left.top", buttonPanel); + + } + } else if (bzjTable2 != null) { + JLabel label4 = new JLabel("ͼӹͼ"); +// FitTableColumns(bzjTable2); + bzjTablePanel2 = new JScrollPane(bzjTable2); + bzjTablePanel2.setPreferredSize(new Dimension(WIDTH,HEIGHT)); + bzjTablePanel2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + panel.add("5.1.left.top",label4); + panel.add("6.1.left.top",bzjTablePanel2); + + panel.add("7.1.left.top", buttonPanel); + + }else { + panel.add("5.1.left.top", buttonPanel); + } + } else { + if (bzjTable != null) { + JLabel label3 = new JLabel("ӹͼ"); +// FitTableColumns(bzjTable); + bzjTablePanel = new JScrollPane(bzjTable); + bzjTablePanel.setPreferredSize(new Dimension(WIDTH,HEIGHT)); + bzjTablePanel.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + panel.add("3.1.left.top", label3); + panel.add("4.1.left.top", bzjTablePanel); + if (bzjTable2 != null) { + JLabel label4 = new JLabel("ͼӹͼ"); +// FitTableColumns(bzjTable2); + bzjTablePanel2 = new JScrollPane(bzjTable2); + bzjTablePanel2.setPreferredSize(new Dimension(WIDTH,HEIGHT)); + bzjTablePanel2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + panel.add("5.1.left.top",label4); + panel.add("6.1.left.top",bzjTablePanel2); + + panel.add("7.1.left.top", buttonPanel); + + }else { + panel.add("5.1.left.top", buttonPanel); + + } + } else if (bzjTable2 != null) { + JLabel label4 = new JLabel("ͼӹͼ"); +// FitTableColumns(bzjTable2); + bzjTablePanel2 = new JScrollPane(bzjTable2); + bzjTablePanel2.setPreferredSize(new Dimension(WIDTH,HEIGHT)); + bzjTablePanel2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + panel.add("3.1.left.top",label4); + panel.add("4.1.left.top",bzjTablePanel2); + + panel.add("5.1.left.top", buttonPanel); + + }else{ + panel.add("3.1.left.top", buttonPanel); + } + } + } else { + if (gzTable != null) { + JLabel label2 = new JLabel("ͼ"); +// FitTableColumns(gzTable); + gzTablePanel = new JScrollPane(gzTable); + gzTablePanel.setPreferredSize(new Dimension(WIDTH,HEIGHT)); + gzTablePanel.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + panel.add("1.1.left.top", label2); + panel.add("2.1.left.top", gzTablePanel); + if (bzjTable != null) { + JLabel label3 = new JLabel("ӹͼ"); +// FitTableColumns(bzjTable); + bzjTablePanel = new JScrollPane(bzjTable); + bzjTablePanel.setPreferredSize(new Dimension(WIDTH,HEIGHT)); + bzjTablePanel.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + panel.add("3.1.left.top", label3); + panel.add("4.1.left.top", bzjTablePanel); + if (bzjTable2 != null) { + JLabel label4 = new JLabel("ͼӹͼ"); +// FitTableColumns(bzjTable2); + bzjTablePanel2 = new JScrollPane(bzjTable2); + bzjTablePanel2.setPreferredSize(new Dimension(WIDTH,HEIGHT)); + bzjTablePanel2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + panel.add("5.1.left.top",label4); + panel.add("6.1.left.top",bzjTablePanel2); + + panel.add("7.1.left.top", buttonPanel); + + }else { + panel.add("5.1.left.top", buttonPanel); + + } + } else if (bzjTable2 != null) { + JLabel label4 = new JLabel("ͼӹͼ"); +// FitTableColumns(bzjTable2); + bzjTablePanel2 = new JScrollPane(bzjTable2); + bzjTablePanel2.setPreferredSize(new Dimension(WIDTH,HEIGHT)); + bzjTablePanel2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + panel.add("3.1.left.top",label4); + panel.add("4.1.left.top",bzjTablePanel2); + + panel.add("5.1.left.top", buttonPanel); + + }else { + panel.add("3.1.left.top", buttonPanel); + } + } else { + if (bzjTable != null) { + JLabel label3 = new JLabel("ӹͼ"); +// FitTableColumns(bzjTable); + bzjTablePanel = new JScrollPane(bzjTable); + bzjTablePanel.setPreferredSize(new Dimension(WIDTH,HEIGHT)); + bzjTablePanel.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + panel.add("1.1.left.top", label3); + panel.add("2.1.left.top", bzjTablePanel); + if(bzjTable2 != null) { + JLabel label4 = new JLabel("ͼӹͼ"); + FitTableColumns(bzjTable2); + bzjTablePanel2 = new JScrollPane(bzjTable2); + bzjTablePanel2.setPreferredSize(new Dimension(WIDTH,HEIGHT)); + bzjTablePanel2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + panel.add("3.1.left.top",label4); + panel.add("4.1.left.top",bzjTablePanel2); + + panel.add("5.1.left.top", buttonPanel); + }else { + panel.add("3.1.left.top",buttonPanel); + } + }else if(bzjTable2 != null) { + JLabel label4 = new JLabel("ͼӹͼ"); +// FitTableColumns(bzjTable2); + bzjTablePanel2 = new JScrollPane(bzjTable2); + bzjTablePanel2.setPreferredSize(new Dimension(WIDTH,HEIGHT)); + bzjTablePanel2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + panel.add("1.1.left.top",label4); + panel.add("2.1.left.top",bzjTablePanel2); + panel.add("3.1.left.top", buttonPanel); + } + } + } + if (tzTablePanel != null) { +// if (tzTable.getRowCount() > 1) { +// int count = tzTable.getRowCount() - 1; +// count = 80 + count * 50; +// tzTablePanel.setPreferredSize(new Dimension((int) tzTable.getWidth(), count)); +// tzTablePanel.revalidate(); +// tzTablePanel.repaint(); +// panel.revalidate(); +// panel.repaint(); +// } else { + tzTablePanel.setPreferredSize(new Dimension((int) tzTable.getWidth(), HEIGHT)); + tzTablePanel.revalidate(); + tzTablePanel.repaint(); + panel.revalidate(); + panel.repaint(); +// } + Enumeration columns = tzTable.getColumnModel().getColumns(); + int tempWidth = 0; + while (columns.hasMoreElements()) { + TableColumn column = (TableColumn) columns.nextElement(); + tempWidth += column.getWidth(); + } + if(tempWidth>maxWidth) { + maxWidth = tempWidth; + } + } + if (gzTablePanel != null) { +// if (gzTable.getRowCount() > 1) { +// int count = gzTable.getRowCount() - 1; +// count = 80 + count * 50; +// gzTablePanel.setPreferredSize(new Dimension((int) gzTable.getWidth(), count)); +// gzTablePanel.revalidate(); +// gzTablePanel.repaint(); +// panel.revalidate(); +// panel.repaint(); +// } else { + gzTablePanel.setPreferredSize(new Dimension((int) gzTable.getWidth(), HEIGHT)); + gzTablePanel.revalidate(); + gzTablePanel.repaint(); + panel.revalidate(); + panel.repaint(); +// } + Enumeration columns = gzTable.getColumnModel().getColumns(); + int tempWidth = 0; + while (columns.hasMoreElements()) { + TableColumn column = (TableColumn) columns.nextElement(); + tempWidth += column.getWidth(); + } + if(tempWidth>maxWidth) { + maxWidth = tempWidth; + } + } + if (bzjTablePanel != null) { +// if (bzjTable.getRowCount() > 1) { +// int count = bzjTable.getRowCount() - 1; +// count = 80 + count * 50; +// bzjTablePanel.setPreferredSize(new Dimension((int) bzjTable.getWidth(), count)); +// bzjTablePanel.revalidate(); +// bzjTablePanel.repaint(); +// panel.revalidate(); +// panel.repaint(); +// } else { + bzjTablePanel.setPreferredSize(new Dimension((int) bzjTable.getWidth(), HEIGHT)); + bzjTablePanel.revalidate(); + bzjTablePanel.repaint(); + panel.revalidate(); + panel.repaint(); +// } + Enumeration columns = bzjTable.getColumnModel().getColumns(); + int tempWidth = 0; + while (columns.hasMoreElements()) { + TableColumn column = (TableColumn) columns.nextElement(); + tempWidth += column.getWidth(); + } + if(tempWidth>maxWidth) { + maxWidth = tempWidth; + } + } + if (bzjTablePanel2 != null) { +// if (bzjTable2.getRowCount() > 1) { +// int count = bzjTable2.getRowCount() - 1; +// count = 80 + count * 50; +// bzjTablePanel2.setPreferredSize(new Dimension((int) bzjTable2.getWidth(), count)); +// bzjTablePanel2.revalidate(); +// bzjTablePanel2.repaint(); +// panel.revalidate(); +// panel.repaint(); +// } else { + bzjTablePanel2.setPreferredSize(new Dimension((int) bzjTable2.getWidth(), HEIGHT)); + bzjTablePanel2.revalidate(); + bzjTablePanel2.repaint(); + panel.revalidate(); + panel.repaint(); +// } + Enumeration columns = bzjTable2.getColumnModel().getColumns(); + int tempWidth = 0; + while (columns.hasMoreElements()) { + TableColumn column = (TableColumn) columns.nextElement(); + tempWidth += column.getWidth(); + } + if(tempWidth>maxWidth) { + maxWidth = tempWidth; + } + } + this.addWindowStateListener(new WindowStateListener() { + + @Override + public void windowStateChanged(WindowEvent state) { + // TODO Auto-generated method stub + if(state.getNewState() == 1 || state.getNewState() == 7) { + System.out.println("С"); + }else if(state.getNewState() == 0) { + System.out.println("ڻָʼ״̬"); + if(tzTable!=null) { + tzTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + FitTableColumns(tzTable); + tzTablePanel.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + } + if(gzTable!=null) { + gzTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + FitTableColumns(gzTable); + gzTablePanel.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + } + if(bzjTable!=null) { + bzjTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + FitTableColumns(bzjTable); + bzjTablePanel.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + } + if(bzjTable2!=null) { + bzjTable2.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + FitTableColumns(bzjTable2); + bzjTablePanel.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + } + }else if(state.getNewState() == 6) { + System.out.println(""); + if(tzTable!=null) { + tzTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); + } + if(gzTable!=null) { + gzTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); + } + if(bzjTable!=null) { + bzjTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); + } + if(bzjTable2!=null) { + bzjTable2.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); + } + } + } + }); + this.addComponentListener(new ComponentListener() { + + @Override + public void componentShown(ComponentEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void componentResized(ComponentEvent e) { + // TODO Auto-generated method stub + Component component2 = e.getComponent(); + int width3 = component2.getWidth(); + if (tzTablePanel != null) { + tzTablePanel + .setPreferredSize(new Dimension(width3, (int) tzTablePanel.getPreferredSize().getHeight())); + tzTablePanel.revalidate(); + tzTablePanel.repaint(); + } + if (gzTablePanel != null) { + gzTablePanel + .setPreferredSize(new Dimension(width3, (int) gzTablePanel.getPreferredSize().getHeight())); + gzTablePanel.revalidate(); + gzTablePanel.repaint(); + } + if (bzjTablePanel != null) { + bzjTablePanel.setPreferredSize( + new Dimension(width3, (int) bzjTablePanel.getPreferredSize().getHeight())); + bzjTablePanel.revalidate(); + bzjTablePanel.repaint(); + } + if (bzjTablePanel2 != null) { + bzjTablePanel2.setPreferredSize( + new Dimension(width3, (int) bzjTablePanel2.getPreferredSize().getHeight())); + bzjTablePanel2.revalidate(); + bzjTablePanel2.repaint(); + } + panel.revalidate(); + panel.repaint(); + + } + + @Override + public void componentMoved(ComponentEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void componentHidden(ComponentEvent e) { + // TODO Auto-generated method stub + + } + }); + okButton.addActionListener(this); + saveButton.addActionListener(this); + setTitle("ͼֽת"); + maxWidth += 10; + System.out.println("Ϊ"+maxWidth); + panel.setPreferredSize(new Dimension(maxWidth, (int)panel.getPreferredSize().getHeight())); + JScrollPane jScrollPane = new JScrollPane(panel); + add(jScrollPane); + pack(); + setLocationRelativeTo(null); + // ʾǰҲɲ +// setModal(true); +// setModalityType(Dialog.ModalityType.APPLICATION_MODAL); + setAlwaysOnTop(true); + setVisible(true); + } + + private void signProperty(String nameString, TCComponentType typeComponent) throws TCException { + if (propertyNameMap.containsKey(nameString)) { + System.out.println("nameString="+nameString); + TCComponentListOfValuesType lovType = (TCComponentListOfValuesType)session.getTypeComponent("ListOfValues"); + TCComponentListOfValues[] lov = lovType.find(propertyNameMap.get(nameString)); + ListOfValuesInfo listOfValues = lov[0].getListOfValues(); + String[] descriptions = listOfValues.getDispDescription();//lov + String[] stringListOfValues = listOfValues.getStringListOfValues(); + String[] arr = new String[stringListOfValues.length]; + for (int j = 0; j < stringListOfValues.length; j++) { + String displayLOV = listOfValues + .getDisplayableValue(stringListOfValues[j]); + if("zf6_cplb".equals(nameString)) { + arr[j] = displayLOV+" "+descriptions[j]; + if(propertyLovMap.containsKey(displayLOV+" "+descriptions[j])) { + return; + } + propertyLovMap.put(displayLOV+" "+descriptions[j], stringListOfValues[j]); + }else { + arr[j] = displayLOV; + if(propertyLovMap.containsKey(displayLOV))return; + propertyLovMap.put(displayLOV, stringListOfValues[j]); + } + } + System.out.println("propertyLovs"); + propertyLovs.add(arr); + } + } + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + Object obj = e.getSource(); + if (obj.equals(okButton)) { +// String typeString = (String) typeBox.getSelectedItem(); + try { + DeriveMaterialsOperation operation = new DeriveMaterialsOperation(app, session, DeriveMaterialsDialog.this, ""); + session.queueOperation(operation); +// DeriveMaterialsDialog.this.dispose(); +// MessageBox.post("", "ʾ", MessageBox.INFORMATION); + } catch (Exception e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + }else if (obj == saveButton) { + if(tzTable!=null&&tzTable.getSelectedRow()!=-1) { + tzTable.getCellEditor(tzTable.getSelectedRow(), tzTable.getSelectedColumn()).stopCellEditing(); + tzTable.invalidate(); + } + if(gzTable!=null&&gzTable.getSelectedRow()!=-1) { + gzTable.getCellEditor(gzTable.getSelectedRow(), gzTable.getSelectedColumn()).stopCellEditing(); + gzTable.invalidate(); + } + if(bzjTable!=null&&bzjTable.getSelectedRow()!=-1) { + bzjTable.getCellEditor(bzjTable.getSelectedRow(), bzjTable.getSelectedColumn()).stopCellEditing(); + bzjTable.invalidate(); + } + if(bzjTable2!=null&&bzjTable2.getSelectedRow()!=-1) { + bzjTable2.getCellEditor(bzjTable2.getSelectedRow(), bzjTable2.getSelectedColumn()).stopCellEditing(); + bzjTable2.invalidate(); + } + okButton.setEnabled(true); + } + } + + public void create() throws Exception { + dbStrings = session.getPreferenceService().getStringValues("connor_zf_db"); + String strDriver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; + String strUrl = "jdbc:sqlserver://" + dbStrings[0]; + String strUserName = dbStrings[1]; + String strPassword = dbStrings[2]; + System.out.println("ʼݿ"); + System.out.println("url="+strUrl); +// System.out.println("username="+strUserName); +// System.out.println("password="+strPassword); + dataBaseControl = new DataBaseControl(strDriver, strUrl, strUserName, strPassword); + System.out.println("ӳɹ"); + String[] stringValues = session.getPreferenceService().getStringValues("connor_design_to_part"); +// String[] type = new String[3]; +// for (String s : stringValues) { +// String[] split = s.split("[|]"); +// String[] split2 = split[0].split("="); +// if (split2[0].equals("H8_drawingRevision")) { +// type[0] = split2[1]; +// } else if (split2[0].equals("H8_frockItemRevision")) { +// type[1] = split2[1]; +// } else if (split2[0].equals("H8_standardPartsRevision")) { +// type[2] = split2[1]; +// } +// } + TCComponentItemType itemType = (TCComponentItemType) session.getTypeComponent("Item"); + if (tzRevs.size() > 0) { + for (int i = 0; i < tzList.size(); i++) { + for (int j = 0; j < tzpropeprtynameList.size(); j++) { + int t = j + 1; +// System.out.println("ܳͼ" + t + "й" + tzListRule.get(0)[j]); +// System.out.println("ܳͼ" + i + "е" + t + "ֵΪ" + tzModel.getValueAt(i, t).toString().trim()); +// System.out.println("ܳͼ" + i + "е" + t + "ǷΪnull" + tzModel.getValueAt(i, t) == null); +// System.out.println( +// "ܳͼ" + i + "е" + t + "ǷΪ''" + tzModel.getValueAt(i, t).toString().trim().equals("")); + if (tzListRule.get(0)[j].equals("*")) { + if (tzModel.getValueAt(i, t) == null || tzModel.getValueAt(i, t).toString().trim().equals("")) { +// MessageBox.post("ܳͼ" + tzpropeprtynameList.get(j) + "Ϊ", "", MessageBox.INFORMATION); + throw new Exception("ܳͼ" + tzpropeprtynameList.get(j) + "Ϊ"); + } + } + } + } + for (int i = 0; i < tzRevs.size(); i++) { + TCComponentItemRevision currentRev = tzRevs.get(i); + TCComponent[] representation_for = currentRev.getReferenceListProperty("representation_for"); + if(representation_for != null && representation_for.length > 0){ + System.out.println("ʾϡ"); + Object[] options = {"Ҫ","Ҫ"}; + DeriveMaterialsDialog.this.setAlwaysOnTop(true); + int response = JOptionPane.showOptionDialog(DeriveMaterialsDialog.this, currentRev+"ͼֽѹ"+representation_for[0]+"ϣǷҪתϣ", "ѡ",JOptionPane.YES_OPTION, + JOptionPane.QUESTION_MESSAGE, null, options, options[0]); + if(response == -1) + { + continue; + } + DeriveMaterialsDialog.this.setAlwaysOnTop(false); + + if(response==0) { + System.out.println("Ҫ"); + + }else if (response==1) { + System.out.println("ѡ˲Ҫ"); + continue; + } + } + +// if(!isContinue) { +// System.out.println(""+currentRev); +// continue; +// } + String itemId = tzRevs.get(i).getStringProperty("item_id"); + String[] split = itemId.split("[.]"); + String newID = ""; +// for (String s : tzDesc) { +// if (s.split("[|]")[0].equals(tzModel.getValueAt(i, 2) != null ? tzModel.getValueAt(i, 2).toString() : "")) { +// +// newID = newID + s.split("[|]")[1]; +// } +// } +// if (split.length == 3) { +// if (split[2].length() < 4) { +// newID = newID + split[0].charAt(3) + split[1] + "0" + split[2]; +// } else { +// newID = newID + split[0].charAt(3) + split[1] + split[2]; +// } +// } else { +// MessageBox.post("ܳͼ" + i + "жidϹ淶", "", MessageBox.INFORMATION); +// continue; +//// throw new Exception("ܳͼ" + i + "жidϹ淶"); +// } +// TCComponent[] referenceListProperty = tzRevs.get(i).getReferenceListProperty("IMAN_master_form_rev"); +// if (referenceListProperty != null) { +// String nbbb = referenceListProperty[0].getStringProperty("h8_nbbb"); +// if(nbbb==null||"".equals(nbbb.trim())) { +// nbbb = "0.0"; +// } +// +// newID = newID + nbbb.split("[.]")[0] + nbbb.split("[.]")[1] + "0"; +// +// } else { +// System.out.println(itemId + "δȡh8_nbbb"); +// } + String daihao = daihaoMap.get(tzModel.getValueAt(i, 0).toString()); + String lshMin = "0000000000001"; + String lshMax = "9999999999999"; + String newCode = dataBaseControl.getNewCode(daihao, lshMin, lshMax); + newID = daihao + newCode; + String revision = itemType.getNewRev(null); + TCComponentItem item = null; + try { + System.out.println("id:" + newID); + System.out.println("name:" + tzRevs.get(i).getStringProperty("object_name")); + System.out.println("type:" + type[0]); + item = itemType.create(newID, revision, type[0], tzRevs.get(i).getStringProperty("object_name"), "", + (TCComponent)tzUnitBoxList.get(i).getSelectedItem()); + } catch (TCException e) { + e.printStackTrace(); + MessageBox.post(newID + "-" + tzRevs.get(i).getStringProperty("object_name") + "Ѵ", "", + MessageBox.INFORMATION); + continue; +// throw new Exception(newID + "-" + tzRevs.get(i).getStringProperty("object_name") + "Ѵ"); +// item = itemType.find(newID); + + } +// session.getUser().getNewStuffFolder().add("contents", item); + TCComponentItemRevision rev = item.getLatestItemRevision(); + TCComponent[] forms = rev.getReferenceListProperty("IMAN_master_form_rev"); + TCComponent form = forms[0]; +// String desc = tzModel.getValueAt(i, 2) != null ? tzModel.getValueAt(i, 2).toString() : ""; +// for (String str : tzDesc) { +// if (str.contains(desc)) { +// form.setStringProperty("h8_material_class", str.split("[|]")[1]); +// break; +// } +// } +// form.setStringProperty("h8_material_class", tzModel.getValueAt(i, 1) != null ? tzModel.getValueAt(i, 1).toString() : ""); + try { + rev.add("TC_Is_Represented_By", tzRevs.get(i)); + }catch (Exception e) { + e.printStackTrace(); + System.out.println(""+rev); + continue; + } + + System.out.println(""+tzpropeprtynameList2.size()+""); + for (int j = 0; j < tzpropeprtynameList2.size(); j++) { + System.out.println("ǰõ"+j+":"+tzpropeprtynameList3.get(j)); + if(tzpropeprtynameList3.get(j).equals("uom_tag")) { + System.out.println("λ"); + continue; + } +// System.out.println("ȡܳͼԹ" + tzpropeprtynameList2.get(j)); +// System.out.println("ȡܳͼ" + tzpropeprtynameList3.get(j)); +// System.out.println( +// "ȡܳͼֵ" + tzModel.getValueAt(i, j + 2) != null ? tzModel.getValueAt(i, j + 2).toString() +// : ""); + JComboBox box = null; + if(propertyNameMap.containsKey(tzpropeprtynameList3.get(j))) { + TableCellEditor cellEditor = tzTable.getCellEditor(i, j + 1); + if (cellEditor instanceof DefaultCellEditor) { + DefaultCellEditor ce = (DefaultCellEditor) cellEditor; + box = (JComboBox) ce.getComponent(); + if(box instanceof RwJComboBox)box = null; + } + } + if (tzpropeprtynameList2.get(j).equals("R")) { + if (box != null) { +// rev.setStringProperty(tzpropeprtynameList3.get(j), +// propertyLovMap.get(box.getSelectedItem().toString())); + MyUtil.setTCProperty(rev.getTCProperty(tzpropeprtynameList3.get(j)) + , propertyLovMap.get(box.getSelectedItem().toString())); + } else { + if(tzpropeprtynameMap.containsKey(tzpropeprtynameList3.get(j)) + &&tzpropeprtynameMap.get(tzpropeprtynameList3.get(j)).equals("array")) { + String value = tzModel.getValueAt(i, j + 1) != null ? tzModel.getValueAt(i, j + 1).toString() + : ""; + if(value!=null) { + if(value.contains(",")) { + String[] split2 = value.split(","); + StringBuilder sb = new StringBuilder(); + for(String str2:split2) { + sb.append(propertyLovMap.get(str2)).append(","); + } + MyUtil.setTCProperty(rev.getTCProperty(tzpropeprtynameList3.get(j)) + ,sb.substring(0,sb.length()-1) ); + }else { + MyUtil.setTCProperty(rev.getTCProperty(tzpropeprtynameList3.get(j)) + ,propertyLovMap.get(value) ); + + } + } + }else { + + MyUtil.setTCProperty(rev.getTCProperty(tzpropeprtynameList3.get(j)) + , tzModel.getValueAt(i, j + 1) != null ? tzModel.getValueAt(i, j + 1).toString() + : ""); + } + } + } else if (tzpropeprtynameList2.get(j).equals("RM")) { + if (box != null) { +// form.setStringProperty(tzpropeprtynameList3.get(j), +// propertyLovMap.get(box.getSelectedItem().toString())); + MyUtil.setTCProperty(form.getTCProperty(tzpropeprtynameList3.get(j)) + , propertyLovMap.get(box.getSelectedItem().toString())); + + } else { +// form.setStringProperty(tzpropeprtynameList3.get(j), +// tzModel.getValueAt(i, j + 1) != null ? tzModel.getValueAt(i, j + 1).toString() +// : ""); + MyUtil.setTCProperty(form.getTCProperty(tzpropeprtynameList3.get(j)) + , tzModel.getValueAt(i, j + 1) != null ? tzModel.getValueAt(i, j + 1).toString() + : ""); + } + }else if(tzpropeprtynameList2.get(j).equals("I")) { + TCComponentItem item2 = rev.getItem(); + if (box != null) { +// rev.getItem().setStringProperty(tzpropeprtynameList3.get(j), +// propertyLovMap.get(box.getSelectedItem().toString())); + MyUtil.setTCProperty(item2.getTCProperty(tzpropeprtynameList3.get(j)) + , propertyLovMap.get(box.getSelectedItem().toString())); + } else { +// rev.getItem().setStringProperty(tzpropeprtynameList3.get(j), +// tzModel.getValueAt(i, j + 1) != null ? tzModel.getValueAt(i, j + 1).toString() +// : ""); + MyUtil.setTCProperty(item2.getTCProperty(tzpropeprtynameList3.get(j)) + , tzModel.getValueAt(i, j + 1) != null ? tzModel.getValueAt(i, j + 1).toString() + : ""); + } + if(tzpropeprtynameList3.get(j).equals("object_name")) { + if (box != null) { +// rev.setStringProperty(tzpropeprtynameList3.get(j), +// propertyLovMap.get(box.getSelectedItem().toString())); + MyUtil.setTCProperty(rev.getTCProperty(tzpropeprtynameList3.get(j)) + , propertyLovMap.get(box.getSelectedItem().toString())); + } else { +// rev.setStringProperty(tzpropeprtynameList3.get(j), +// tzModel.getValueAt(i, j + 1) != null ? tzModel.getValueAt(i, j + 1).toString() +// : ""); + rev.setStringProperty(tzpropeprtynameList3.get(j), + tzModel.getValueAt(i, j + 1) != null ? tzModel.getValueAt(i, j + 1).toString() + : ""); + MyUtil.setTCProperty(rev.getTCProperty(tzpropeprtynameList3.get(j)) + , tzModel.getValueAt(i, j + 1) != null ? tzModel.getValueAt(i, j + 1).toString() + : ""); + } + } + } + } + tzRevs.get(i).refresh(); + } + } + if (gzRevs.size() > 0) { + for (int i = 0; i < gzList.size(); i++) { + for (int j = 0; j < gzpropeprtynameList.size(); j++) { + int t = j + 1; +// System.out.println("ͼ" + t + "й" + gzListRule.get(0)[j]); +// System.out.println("ͼ" + i + "е" + t + "ֵΪ" + gzModel.getValueAt(i, t).toString().trim()); +// System.out.println("ͼ" + i + "е" + t + "ǷΪnull" + gzModel.getValueAt(i, t) == null); +// System.out.println( +// "ͼ" + i + "е" + t + "ǷΪ''" + gzModel.getValueAt(i, t).toString().trim().equals("")); + if (gzListRule.get(0)[j].equals("*")) { + if (gzModel.getValueAt(i, j + 1) == null + || gzModel.getValueAt(i, j + 1).toString().trim().equals("")) { + MessageBox.post("ͼ" + gzpropeprtynameList.get(j) + "Ϊ", "", MessageBox.INFORMATION); + throw new Exception("ͼ" + gzpropeprtynameList.get(j) + "Ϊ"); + } + } + } + } + for (int i = 0; i < gzRevs.size(); i++) { + TCComponentItemRevision currentRev = gzRevs.get(i); + TCComponent[] representation_for = currentRev.getReferenceListProperty("representation_for"); + if(representation_for != null && representation_for.length > 0){ + System.out.println("ʾϡ"); + Object[] options = {"Ҫ","Ҫ"}; + DeriveMaterialsDialog.this.setAlwaysOnTop(true); + int response = JOptionPane.showOptionDialog(DeriveMaterialsDialog.this, currentRev+"ͼֽѹ"+representation_for[0]+"ϣǷҪתϣ", "ѡ",JOptionPane.YES_OPTION, + JOptionPane.QUESTION_MESSAGE, null, options, options[0]); + if(response == -1) + { + continue; + } + DeriveMaterialsDialog.this.setAlwaysOnTop(false); + + if(response==0) { + System.out.println("Ҫ"); + + }else if (response==1) { + System.out.println("ѡ˲Ҫ"); + continue; + } + } + String itemId = gzRevs.get(i).getStringProperty("item_id"); + String[] split = itemId.split("[.]"); + String newID = ""; +// for (String s : gzDesc) { +// if (s.split("[|]")[0].equals(gzModel.getValueAt(i, 2) != null ? gzModel.getValueAt(i, 2).toString() : "")) { +// newID = newID + s.split("[|]")[1]; +// } +// } +// if (split.length == 3) { +// newID = newID + split[0].substring(6) + split[1]; +// int len = split[2].length(); +// if (len < 5) { +// for (int l = 0; l < 5 - len; l++) { +// newID = newID + "0"; +// } +// newID = newID + split[2]; +// } +// } else { +// MessageBox.post("ͼ" + i + "жidϹ淶", "", MessageBox.INFORMATION); +//// throw new Exception("ͼ" + i + "жidϹ淶"); +// continue; +// } + String daihao = daihaoMap.get(gzModel.getValueAt(i, 0).toString()); + String lshMin = "0000000000001"; + String lshMax = "9999999999999"; + String newCode = dataBaseControl.getNewCode(daihao, lshMin, lshMax); + newID = daihao + newCode; + String revision = itemType.getNewRev(null); + TCComponentItem item = null; + try { + System.out.println("id:" + newID); + System.out.println("name:" + gzRevs.get(i).getStringProperty("object_name")); + System.out.println("type:" + type[1]); + item = itemType.create(newID, revision, type[1], gzRevs.get(i).getStringProperty("object_name"), "", + (TCComponent)gzUnitBoxList.get(i).getSelectedItem()); + } catch (TCException e) { + e.printStackTrace(); + MessageBox.post(newID + "-" + gzRevs.get(i).getStringProperty("object_name") + "Ѵ", "", + MessageBox.INFORMATION); + continue; +// throw new Exception(newID + "-" + gzRevs.get(i).getStringProperty("object_name") + "Ѵ"); +// item = itemType.find(newID); + } +// session.getUser().getNewStuffFolder().add("contents", item); + TCComponentItemRevision rev = item.getLatestItemRevision(); + TCComponent[] forms = rev.getReferenceListProperty("IMAN_master_form_rev"); + TCComponent form = forms[0]; +// String desc = gzModel.getValueAt(i, 2) != null ? gzModel.getValueAt(i, 2).toString() : ""; +// for (String str : gzDesc) { +// if (str.contains(desc)) { +// form.setStringProperty("h8_material_class", str.split("[|]")[1]); +// break; +// } +// } +// form.setStringProperty("h8_material_class", gzModel.getValueAt(i, 1) != null ? gzModel.getValueAt(i, 1).toString() : ""); + try { + rev.add("TC_Is_Represented_By", gzRevs.get(i)); + }catch (Exception e) { + e.printStackTrace(); + System.out.println(""+rev); + continue; + } + System.out.println(""+gzpropeprtynameList2.size()+""); + for (int j = 0; j < gzpropeprtynameList2.size(); j++) { + System.out.println("ǰõ"+j+":"+gzpropeprtynameList3.get(j)); + if(gzpropeprtynameList3.get(j).equals("uom_tag")) { + System.out.println("λ"); + continue; + } +// System.out.println("ȡͼԹ" + gzpropeprtynameList2.get(j)); +// System.out.println("ȡͼ" + gzpropeprtynameList3.get(j)); +// System.out.println( +// "ȡͼֵ" + gzModel.getValueAt(i, j + 2) != null ? gzModel.getValueAt(i, j + 2).toString() +// : ""); + JComboBox box = null; + if(propertyNameMap.containsKey(gzpropeprtynameList3.get(j))) { + TableCellEditor cellEditor = gzTable.getCellEditor(i, j + 1); + if (cellEditor instanceof DefaultCellEditor) { + DefaultCellEditor ce = (DefaultCellEditor) cellEditor; + box = (JComboBox) ce.getComponent(); + if(box instanceof RwJComboBox)box = null; + } + } + if (gzpropeprtynameList2.get(j).equals("R")) { + if (box != null) { +// rev.setStringProperty(gzpropeprtynameList3.get(j), +// propertyLovMap.get(box.getSelectedItem().toString())); + MyUtil.setTCProperty(rev.getTCProperty(gzpropeprtynameList3.get(j)) + , propertyLovMap.get(box.getSelectedItem().toString())); + } else { +// rev.setStringProperty(gzpropeprtynameList3.get(j), +// gzModel.getValueAt(i, j + 1) != null ? gzModel.getValueAt(i, j + 1).toString() +// : ""); + if(gzpropeprtynameMap.containsKey(gzpropeprtynameList3.get(j)) + &&gzpropeprtynameMap.get(gzpropeprtynameList3.get(j)).equals("array")) { + String value = gzModel.getValueAt(i, j + 1) != null ? gzModel.getValueAt(i, j + 1).toString() + : ""; + if(value!=null) { + if(value.contains(",")) { + String[] split2 = value.split(","); + StringBuilder sb = new StringBuilder(); + for(String str2:split2) { + sb.append(propertyLovMap.get(str2)).append(","); + } + MyUtil.setTCProperty(rev.getTCProperty(gzpropeprtynameList3.get(j)) + ,sb.substring(0,sb.length()-1) ); + }else { + MyUtil.setTCProperty(rev.getTCProperty(gzpropeprtynameList3.get(j)) + ,propertyLovMap.get(value) ); + + } + } + }else { + + MyUtil.setTCProperty(rev.getTCProperty(gzpropeprtynameList3.get(j)) + , gzModel.getValueAt(i, j + 1) != null ? gzModel.getValueAt(i, j + 1).toString() + : ""); + } +// MyUtil.setTCProperty(rev.getTCProperty(gzpropeprtynameList3.get(j)) +// , gzModel.getValueAt(i, j + 1) != null ? gzModel.getValueAt(i, j + 1).toString() +// : ""); + } + } else if (gzpropeprtynameList2.get(j).equals("RM")) { + if (box != null) { +// form.setStringProperty(gzpropeprtynameList3.get(j), +// propertyLovMap.get(box.getSelectedItem().toString())); + MyUtil.setTCProperty(form.getTCProperty(gzpropeprtynameList3.get(j)) + , propertyLovMap.get(box.getSelectedItem().toString())); + + } else { +// form.setStringProperty(gzpropeprtynameList3.get(j), +// gzModel.getValueAt(i, j + 1) != null ? gzModel.getValueAt(i, j + 1).toString() +// : ""); + MyUtil.setTCProperty(form.getTCProperty(gzpropeprtynameList3.get(j)) + , gzModel.getValueAt(i, j + 1) != null ? gzModel.getValueAt(i, j + 1).toString() + : ""); + + } + }else if(gzpropeprtynameList2.get(j).equals("I")) { + TCComponentItem item2 = rev.getItem(); + if (box != null) { +// rev.getItem().setStringProperty(gzpropeprtynameList3.get(j), +// propertyLovMap.get(box.getSelectedItem().toString())); + MyUtil.setTCProperty(item2.getTCProperty(gzpropeprtynameList3.get(j)) + , propertyLovMap.get(box.getSelectedItem().toString())); + } else { +// rev.getItem().setStringProperty(gzpropeprtynameList3.get(j), +// gzModel.getValueAt(i, j + 1) != null ? gzModel.getValueAt(i, j + 1).toString() +// : ""); + MyUtil.setTCProperty(item2.getTCProperty(gzpropeprtynameList3.get(j)) + , gzModel.getValueAt(i, j + 1) != null ? gzModel.getValueAt(i, j + 1).toString() + : ""); + } + if(gzpropeprtynameList3.get(j).equals("object_name")) { + if (box != null) { +// rev.setStringProperty(gzpropeprtynameList3.get(j), +// propertyLovMap.get(box.getSelectedItem().toString())); + MyUtil.setTCProperty(rev.getTCProperty(gzpropeprtynameList3.get(j)) + , propertyLovMap.get(box.getSelectedItem().toString())); + } else { +// rev.setStringProperty(gzpropeprtynameList3.get(j), +// gzModel.getValueAt(i, j + 1) != null ? gzModel.getValueAt(i, j + 1).toString() +// : ""); + MyUtil.setTCProperty(rev.getTCProperty(gzpropeprtynameList3.get(j)) + , gzModel.getValueAt(i, j + 1) != null ? gzModel.getValueAt(i, j + 1).toString() + : ""); + } + } + } +// if (gzpropeprtynameList2.get(j).equals("R")) { +// rev.setStringProperty(gzpropeprtynameList3.get(j), +// gzModel.getValueAt(i, j + 2) != null ? gzModel.getValueAt(i, j + 2).toString() : ""); +// } else if (gzpropeprtynameList2.get(j).equals("RM")) { +// form.setStringProperty(gzpropeprtynameList3.get(j), +// gzModel.getValueAt(i, j + 2) != null ? gzModel.getValueAt(i, j + 2).toString() : ""); +// } + } + gzRevs.get(i).refresh(); + } + } + if (bzjRevs.size() > 0) { + for (int i = 0; i < bzjList.size(); i++) { + for (int j = 0; j < bzjpropeprtynameList.size(); j++) { + int t = j + 1; +// System.out.println("ӹͼ" + t + "й" + bzjListRule.get(0)[j]); +// System.out.println("ӹͼ" + i + "е" + t + "ֵΪ" + bzjModel.getValueAt(i, t).toString().trim()); +// System.out.println("ӹͼ" + i + "е" + t + "ǷΪnull" + bzjModel.getValueAt(i, t) == null); +// System.out.println( +// "ӹͼ" + i + "е" + t + "ǷΪ''" + bzjModel.getValueAt(i, t).toString().trim().equals("")); + if (bzjListRule.get(0)[j].equals("*")) { + if (bzjModel.getValueAt(i, j + 1) == null + || bzjModel.getValueAt(i, j + 1).toString().trim().equals("")) { +// MessageBox.post("ӹͼ" + bzjpropeprtynameList.get(j) + "Ϊ", "", MessageBox.INFORMATION); + throw new Exception("ӹͼ" + bzjpropeprtynameList.get(j) + "Ϊ"); + } + } + } + } + for (int i = 0; i < bzjRevs.size(); i++) { + TCComponentItemRevision currentRev = bzjRevs.get(i); + TCComponent[] representation_for = currentRev.getReferenceListProperty("representation_for"); + if(representation_for != null && representation_for.length > 0){ + System.out.println("ʾϡ"); + Object[] options = {"Ҫ","Ҫ"}; + DeriveMaterialsDialog.this.setAlwaysOnTop(true); + int response = JOptionPane.showOptionDialog(DeriveMaterialsDialog.this, currentRev+"ͼֽѹ"+representation_for[0]+"ϣǷҪתϣ", "ѡ",JOptionPane.YES_OPTION, + JOptionPane.QUESTION_MESSAGE, null, options, options[0]); + if(response == -1) + { + continue; + } + DeriveMaterialsDialog.this.setAlwaysOnTop(false); + + if(response==0) { + System.out.println("Ҫ"); + + }else if (response==1) { + System.out.println("ѡ˲Ҫ"); + continue; + } + } + String itemId = bzjRevs.get(i).getStringProperty("item_id"); +// int temp = 0; +// for (int l = 0; l < itemId.length(); l++) { +// if (itemId.charAt(l) < 'A') { +// temp = l; +// break; +// } +// } + String newID = ""; + String daihao = daihaoMap.get(bzjModel.getValueAt(i, 0).toString()); + String lshMin = "0000000000001"; + String lshMax = "9999999999999"; + String newCode = dataBaseControl.getNewCode(daihao, lshMin, lshMax); + newID = daihao + newCode; +// String newID = itemId.substring(temp); + String revision = itemType.getNewRev(null); + TCComponentItem item = null; + try { + System.out.println("id:" + newID); + System.out.println("name:" + bzjRevs.get(i).getStringProperty("object_name")); + System.out.println("type:" + type[2]); + item = itemType.create(newID, revision, type[2], bzjRevs.get(i).getStringProperty("object_name"), + "", (TCComponent)bzjUnitBoxList.get(i).getSelectedItem()); + } catch (TCException e) { + e.printStackTrace(); + MessageBox.post(newID + "-" + bzjRevs.get(i).getStringProperty("object_name") + "Ѵ", "", + MessageBox.INFORMATION); + continue; +// throw new Exception(newID + "-" + bzjRevs.get(i).getStringProperty("object_name") + "Ѵ"); +// item = itemType.find(newID); + } +// session.getUser().getNewStuffFolder().add("contents", item); + TCComponentItemRevision rev = item.getLatestItemRevision(); + TCComponent[] forms = rev.getReferenceListProperty("IMAN_master_form_rev"); + TCComponent form = forms[0]; +// String desc = bzjModel.getValueAt(i, 2) != null ? bzjModel.getValueAt(i, 2).toString() : ""; +// for (String str : bzjDesc) { +// if (str.contains(desc)) { +// form.setStringProperty("h8_material_class", str.split("[|]")[1]); +// break; +// } +// } + try { + rev.add("TC_Is_Represented_By", bzjRevs.get(i)); + }catch (Exception e) { + e.printStackTrace(); + System.out.println(""+rev); + continue; + } + System.out.println(""+bzjpropeprtynameList2.size()+""); + for (int j = 0; j < bzjpropeprtynameList2.size(); j++) { + System.out.println("ǰõ"+j+":"+bzjpropeprtynameList3.get(j)); + if(bzjpropeprtynameList3.get(j).equals("uom_tag")) { + System.out.println("λ"); + continue; + } +// System.out.println("ȡӹͼԹ" + bzjpropeprtynameList2.get(j)); +// System.out.println("ȡӹͼ" + bzjpropeprtynameList3.get(j)); +// System.out.println("ȡӹͼֵ" + bzjModel.getValueAt(i, j + 2) != null +// ? bzjModel.getValueAt(i, j + 2).toString() +// : ""); + JComboBox box = null; + if(propertyNameMap.containsKey(bzjpropeprtynameList3.get(j))) { + TableCellEditor cellEditor = bzjTable.getCellEditor(i, j + 1); + if (cellEditor instanceof DefaultCellEditor) { + DefaultCellEditor ce = (DefaultCellEditor) cellEditor; + box = (JComboBox) ce.getComponent(); + if(box instanceof RwJComboBox)box = null; + } + } + if (bzjpropeprtynameList2.get(j).equals("R")) { + if (box != null) { +// rev.setStringProperty(bzjpropeprtynameList3.get(j), +// propertyLovMap.get(box.getSelectedItem().toString())); + MyUtil.setTCProperty(rev.getTCProperty(bzjpropeprtynameList3.get(j)) + , propertyLovMap.get(box.getSelectedItem().toString())); + } else { +// rev.setStringProperty(bzjpropeprtynameList3.get(j), +// bzjModel.getValueAt(i, j + 1) != null ? bzjModel.getValueAt(i, j + 1).toString() +// : ""); + + if(bzjpropeprtynameMap.containsKey(bzjpropeprtynameList3.get(j)) + &&bzjpropeprtynameMap.get(bzjpropeprtynameList3.get(j)).equals("array")) { + String value = bzjModel.getValueAt(i, j + 1) != null ? bzjModel.getValueAt(i, j + 1).toString() + : ""; + if(value!=null) { + if(value.contains(",")) { + String[] split2 = value.split(","); + StringBuilder sb = new StringBuilder(); + for(String str2:split2) { + sb.append(propertyLovMap.get(str2)).append(","); + } + MyUtil.setTCProperty(rev.getTCProperty(bzjpropeprtynameList3.get(j)) + ,sb.substring(0,sb.length()-1) ); + }else { + MyUtil.setTCProperty(rev.getTCProperty(bzjpropeprtynameList3.get(j)) + ,propertyLovMap.get(value) ); + + } + } + }else { + + MyUtil.setTCProperty(rev.getTCProperty(bzjpropeprtynameList3.get(j)) + , bzjModel.getValueAt(i, j + 1) != null ? bzjModel.getValueAt(i, j + 1).toString() + : ""); + } +// MyUtil.setTCProperty(rev.getTCProperty(bzjpropeprtynameList3.get(j)) +// , bzjModel.getValueAt(i, j + 1) != null ? bzjModel.getValueAt(i, j + 1).toString() +// : ""); + } + } else if (bzjpropeprtynameList2.get(j).equals("RM")) { + if (box != null) { +// form.setStringProperty(bzjpropeprtynameList3.get(j), +// propertyLovMap.get(box.getSelectedItem().toString())); + MyUtil.setTCProperty(form.getTCProperty(bzjpropeprtynameList3.get(j)) + , propertyLovMap.get(box.getSelectedItem().toString())); + } else { +// form.setStringProperty(bzjpropeprtynameList3.get(j), +// bzjModel.getValueAt(i, j + 1) != null ? bzjModel.getValueAt(i, j + 1).toString() +// : ""); + MyUtil.setTCProperty(form.getTCProperty(bzjpropeprtynameList3.get(j)) + , bzjModel.getValueAt(i, j + 1) != null ? bzjModel.getValueAt(i, j + 1).toString() + : ""); + } + }else if(bzjpropeprtynameList2.get(j).equals("I")) { + TCComponentItem item2 = rev.getItem(); + if (box != null) { +// rev.getItem().setStringProperty(bzjpropeprtynameList3.get(j), +// propertyLovMap.get(box.getSelectedItem().toString())); + MyUtil.setTCProperty(item2.getTCProperty(bzjpropeprtynameList3.get(j)) + , propertyLovMap.get(box.getSelectedItem().toString())); + } else { +// rev.getItem().setStringProperty(bzjpropeprtynameList3.get(j), +// bzjModel.getValueAt(i, j + 1) != null ? bzjModel.getValueAt(i, j + 1).toString() +// : ""); + MyUtil.setTCProperty(item2.getTCProperty(bzjpropeprtynameList3.get(j)) + , bzjModel.getValueAt(i, j + 1) != null ? bzjModel.getValueAt(i, j + 1).toString() + : ""); + } + if(bzjpropeprtynameList3.get(j).equals("object_name")) { + if (box != null) { + rev.setStringProperty(bzjpropeprtynameList3.get(j), + propertyLovMap.get(box.getSelectedItem().toString())); +// MyUtil.setTCProperty(rev.getTCProperty(bzjpropeprtynameList3.get(j)) +// , propertyLovMap.get(box.getSelectedItem().toString())); + } else { + rev.setStringProperty(bzjpropeprtynameList3.get(j), + bzjModel.getValueAt(i, j + 1) != null ? bzjModel.getValueAt(i, j + 1).toString() + : ""); +// MyUtil.setTCProperty(rev.getTCProperty(bzjpropeprtynameList3.get(j)) +// , bzjModel.getValueAt(i, j + 1) != null ? bzjModel.getValueAt(i, j + 1).toString() +// : ""); + } + } + } + } + bzjRevs.get(i).refresh(); + } + } + + if (yqjRevs.size() > 0) { + for (int i = 0; i < bzjList2.size(); i++) { + for (int j = 0; j < bzjpropeprtyname2List.size(); j++) { + int t = j + 1; + if (bzjListRule2.get(0)[j].equals("*")) { + if (bzjModel2.getValueAt(i, j + 1) == null + || bzjModel2.getValueAt(i, j + 1).toString().trim().equals("")) { +// MessageBox.post("ͼӹͼ" + bzjpropeprtyname2List.get(j) + "Ϊ", "", MessageBox.INFORMATION); + throw new Exception("ͼӹͼ" + bzjpropeprtyname2List.get(j) + "Ϊ"); + } + } + } + } + for (int i = 0; i < yqjRevs.size(); i++) { + TCComponentItemRevision currentRev = yqjRevs.get(i); + TCComponent[] representation_for = currentRev.getReferenceListProperty("representation_for"); + if(representation_for != null && representation_for.length > 0){ + System.out.println("ʾϡ"); + Object[] options = {"Ҫ","Ҫ"}; + DeriveMaterialsDialog.this.setAlwaysOnTop(true); + int response = JOptionPane.showOptionDialog(DeriveMaterialsDialog.this, currentRev+"ͼֽѹ"+representation_for[0]+"ϣǷҪתϣ", "ѡ",JOptionPane.YES_OPTION, + JOptionPane.QUESTION_MESSAGE, null, options, options[0]); + if(response == -1) + { + continue; + } + DeriveMaterialsDialog.this.setAlwaysOnTop(false); + + if(response==0) { + System.out.println("Ҫ"); + + }else if (response==1) { + System.out.println("ѡ˲Ҫ"); + continue; + } + } + String itemId = yqjRevs.get(i).getStringProperty("item_id"); +// int temp = 0; +// for (int l = 0; l < itemId.length(); l++) { +// if (itemId.charAt(l) < 'A') { +// temp = l; +// break; +// } +// } + String newID = ""; + String daihao = daihaoMap.get(bzjModel2.getValueAt(i, 0).toString()); + String lshMin = "0000000000001"; + String lshMax = "9999999999999"; + String newCode = dataBaseControl.getNewCode(daihao, lshMin, lshMax); + newID = daihao + newCode; + String revision = itemType.getNewRev(null); + TCComponentItem item = null; + try { + System.out.println("id:" + newID); + System.out.println("name:" + yqjRevs.get(i).getStringProperty("object_name")); + System.out.println("type:" + type[3]); + item = itemType.create(newID, revision, type[3], yqjRevs.get(i).getStringProperty("object_name"), + "", (TCComponent)bzjUnitBox2List.get(i).getSelectedItem()); + } catch (TCException e) { + e.printStackTrace(); + MessageBox.post(newID + "-" + yqjRevs.get(i).getStringProperty("object_name") + "Ѵ", "", + MessageBox.INFORMATION); + continue; +// throw new Exception(newID + "-" + yqjRevs.get(i).getStringProperty("object_name") + "Ѵ"); +// item = itemType.find(newID); + } +// session.getUser().getNewStuffFolder().add("contents", item); + TCComponentItemRevision rev = item.getLatestItemRevision(); + TCComponent[] forms = rev.getReferenceListProperty("IMAN_master_form_rev"); + TCComponent form = forms[0]; +// String desc = bzjModel2.getValueAt(i, 2) != null ? bzjModel2.getValueAt(i, 2).toString() : ""; +// for (String str : bzjDesc2) { +// if (str.contains(desc)) { +// form.setStringProperty("h8_material_class", str.split("[|]")[1]); +// break; +// } +// } + try { + rev.add("TC_Is_Represented_By", yqjRevs.get(i)); + }catch (Exception e) { + e.printStackTrace(); + System.out.println(""+rev); + continue; + } + System.out.println(""+bzjpropeprtyname2List2.size()+""); + for (int j = 0; j < bzjpropeprtyname2List2.size(); j++) { + System.out.println("ǰõ"+j+":"+bzjpropeprtyname2List3.get(j)); + if(bzjpropeprtyname2List3.get(j).equals("uom_tag")) { + System.out.println("λ"); + continue; + } + JComboBox box = null; + if(propertyNameMap.containsKey(bzjpropeprtyname2List3.get(j))) { + TableCellEditor cellEditor = bzjTable2.getCellEditor(i, j + 1); + if (cellEditor instanceof DefaultCellEditor) { + DefaultCellEditor ce = (DefaultCellEditor) cellEditor; + box = (JComboBox) ce.getComponent(); + if(box instanceof RwJComboBox)box = null; + } + } + if (bzjpropeprtyname2List2.get(j).equals("R")) { + if (box != null) { + rev.setStringProperty(bzjpropeprtyname2List3.get(j), + propertyLovMap.get(box.getSelectedItem().toString())); +// MyUtil.setTCProperty(rev.getTCProperty(bzjpropeprtyname2List3.get(j)) +// , propertyLovMap.get(box.getSelectedItem().toString())); + } else { + + if(bzjpropeprtyname2Map.containsKey(bzjpropeprtyname2List3.get(j)) + &&bzjpropeprtyname2Map.get(bzjpropeprtyname2List3.get(j)).equals("array")) { + String value = bzjModel2.getValueAt(i, j + 1) != null ? bzjModel2.getValueAt(i, j + 1).toString() + : ""; + if(value!=null) { + if(value.contains(",")) { + String[] split2 = value.split(","); + StringBuilder sb = new StringBuilder(); + for(String str2:split2) { + sb.append(propertyLovMap.get(str2)).append(","); + } + MyUtil.setTCProperty(rev.getTCProperty(bzjpropeprtyname2List3.get(j)) + ,sb.substring(0,sb.length()-1) ); + }else { + MyUtil.setTCProperty(rev.getTCProperty(bzjpropeprtyname2List3.get(j)) + ,propertyLovMap.get(value) ); + + } + } + }else { +// rev.setStringProperty(bzjpropeprtyname2List3.get(j), +// bzjModel2.getValueAt(i, j + 1) != null ? bzjModel2.getValueAt(i, j + 1).toString() +// : ""); + + MyUtil.setTCProperty(rev.getTCProperty(bzjpropeprtyname2List3.get(j)) + , bzjModel2.getValueAt(i, j + 1) != null ? bzjModel2.getValueAt(i, j + 1).toString() + : ""); + } + +// MyUtil.setTCProperty(rev.getTCProperty(bzjpropeprtyname2List3.get(j)) +// , bzjModel2.getValueAt(i, j + 1) != null ? bzjModel2.getValueAt(i, j + 1).toString() +// : ""); + } + } else if (bzjpropeprtyname2List2.get(j).equals("RM")) { + if (box != null) { +// form.setStringProperty(bzjpropeprtyname2List3.get(j), +// propertyLovMap.get(box.getSelectedItem().toString())); + System.out.println("box=nullʱñ"+bzjpropeprtyname2List3.get(j)+"ֵΪ"+propertyLovMap.get(box.getSelectedItem().toString())); + MyUtil.setTCProperty(form.getTCProperty(bzjpropeprtyname2List3.get(j)) + , propertyLovMap.get(box.getSelectedItem().toString())); + } else { +// form.setStringProperty(bzjpropeprtyname2List3.get(j), +// bzjModel2.getValueAt(i, j + 1) != null ? bzjModel2.getValueAt(i, j + 1).toString() +// : ""); + System.out.print("box==nullʱñ"+bzjpropeprtyname2List3.get(j)+"ֵΪ"); + System.out.println(bzjModel2.getValueAt(i, j + 1) != null ? bzjModel2.getValueAt(i, j + 1).toString() + : ""); + MyUtil.setTCProperty(form.getTCProperty(bzjpropeprtyname2List3.get(j)) + , bzjModel2.getValueAt(i, j + 1) != null ? bzjModel2.getValueAt(i, j + 1).toString() + : ""); + } + }else if(bzjpropeprtyname2List2.get(j).equals("I")) { + TCComponentItem item2 = rev.getItem(); + if (box != null) { +// rev.getItem().setStringProperty(bzjpropeprtyname2List3.get(j), +// propertyLovMap.get(box.getSelectedItem().toString())); + MyUtil.setTCProperty(item2.getTCProperty(bzjpropeprtyname2List3.get(j)) + , propertyLovMap.get(box.getSelectedItem().toString())); + } else { +// rev.getItem().setStringProperty(bzjpropeprtyname2List3.get(j), +// bzjModel2.getValueAt(i, j + 1) != null ? bzjModel2.getValueAt(i, j + 1).toString() +// : ""); + MyUtil.setTCProperty(item2.getTCProperty(bzjpropeprtyname2List3.get(j)) + , bzjModel2.getValueAt(i, j + 1) != null ? bzjModel2.getValueAt(i, j + 1).toString() + : ""); + } + if(bzjpropeprtyname2List3.get(j).equals("object_name")) { + if (box != null) { +// rev.setStringProperty(bzjpropeprtyname2List3.get(j), +// propertyLovMap.get(box.getSelectedItem().toString())); + MyUtil.setTCProperty(rev.getTCProperty(bzjpropeprtyname2List3.get(j)) + , propertyLovMap.get(box.getSelectedItem().toString())); + } else { +// rev.setStringProperty(bzjpropeprtyname2List3.get(j), +// bzjModel2.getValueAt(i, j + 1) != null ? bzjModel2.getValueAt(i, j + 1).toString() +// : ""); + MyUtil.setTCProperty(rev.getTCProperty(bzjpropeprtyname2List3.get(j)) + , bzjModel2.getValueAt(i, j + 1) != null ? bzjModel2.getValueAt(i, j + 1).toString() + : ""); + } + } + } + } + yqjRevs.get(i).refresh(); + } + } + + } + + + /** + * JTableп + */ + public static TableColumnModel getColumn(JTable table, int[] width) { + TableColumnModel columns = table.getColumnModel(); + for (int i = 0; i < width.length; i++) { + TableColumn column = columns.getColumn(i); + column.setPreferredWidth(width[i]); + } + return columns; + } + + class MyTable extends JTable { + int myRow = -1, myCol = -1; + TableCellEditor myEditor; + Map map = new HashMap(); + + public void setComboCell(int r, int c, TableCellEditor ce) { + this.myRow = r; + this.myCol = c; + this.myEditor = ce; + map.put(new Point(r, c), ce); + } + + @Override + public TableCellEditor getCellEditor(int row, int column) { + System.out.println(row + "," + column + ";" + myRow + "," + myCol + "," + myEditor); + + Point point = new Point(row, column); + if (map.containsKey(point)) { + return map.get(point); + } else { + return super.getCellEditor(row, column); + } + } + } + + + public void FitTableColumns(JTable myTable) { //OtableЌS{ + + JTableHeader header = myTable.getTableHeader(); + + int rowCount = myTable.getRowCount(); + + Enumeration columns = myTable.getColumnModel().getColumns(); + + while (columns.hasMoreElements()) { + + TableColumn column = (TableColumn) columns.nextElement(); + + int col = header.getColumnModel().getColumnIndex( + + column.getIdentifier()); + + int width = (int) myTable.getTableHeader().getDefaultRenderer() + + .getTableCellRendererComponent(myTable, + + column.getIdentifier(), false, false, -1, col) + + .getPreferredSize().getWidth(); + + for (int row = 0; row < rowCount; row++){ + + int preferedWidth = (int) myTable.getCellRenderer(row, col) + + .getTableCellRendererComponent(myTable, + + myTable.getValueAt(row, col), false, false, + + row, col).getPreferredSize().getWidth(); + + width = Math.max(width, preferedWidth); + + } + + header.setResizingColumn(column); + + column.setWidth(width + myTable.getIntercellSpacing().width); + + } + + } + +} diff --git a/src/com/connor/zf/desingtopart/DeriveMaterialsHandler.java b/src/com/connor/zf/desingtopart/DeriveMaterialsHandler.java new file mode 100644 index 0000000..685d2c7 --- /dev/null +++ b/src/com/connor/zf/desingtopart/DeriveMaterialsHandler.java @@ -0,0 +1,52 @@ +package com.connor.zf.desingtopart; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.teamcenter.rac.aif.AbstractAIFUIApplication; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class DeriveMaterialsHandler extends AbstractHandler{ + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFUIApplication app = AIFUtility.getCurrentApplication(); + TCSession session = (TCSession) app.getSession(); + InterfaceAIFComponent[] targets =app.getTargetComponents(); + List list = new ArrayList(); + if (targets != null && targets.length > 0) { + for(InterfaceAIFComponent target:targets) { + if (target instanceof TCComponentItemRevision) { + TCComponent t = (TCComponent) target; + String type = target.getType(); + System.out.println(type); + if(type.equals("ZF6_ZCTRevision")||type.equals("ZF6_LJTRevision")||type.equals("ZF6_CJGTRevision")||type.equals("ZF6_DJGTRevision")) { + list.add(t); + }else { + MessageBox.post("ѡȷ汾", "", MessageBox.INFORMATION); + return null; + } + } else { + MessageBox.post("ѡͼֽ汾", "", MessageBox.INFORMATION); + return null; + } + } + DeriveMaterialsDialog dialog = new DeriveMaterialsDialog(app, session, list.toArray(new TCComponent[list.size()])); + new Thread(dialog).start(); + } else { + MessageBox.post("ѡͼֽ汾", "", MessageBox.INFORMATION); + } + return null; + } + +} diff --git a/src/com/connor/zf/desingtopart/DeriveMaterialsOperation.java b/src/com/connor/zf/desingtopart/DeriveMaterialsOperation.java new file mode 100644 index 0000000..fbd08d9 --- /dev/null +++ b/src/com/connor/zf/desingtopart/DeriveMaterialsOperation.java @@ -0,0 +1,108 @@ +package com.connor.zf.desingtopart; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Label; + +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.SwingConstants; + +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.AbstractAIFUIApplication; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class DeriveMaterialsOperation extends AbstractAIFOperation{ + private AbstractAIFUIApplication app; + private TCSession session; + private DeriveMaterialsDialog dialog; + private String exeType; + private String path; + private String errInfo = ""; + + public DeriveMaterialsOperation(AbstractAIFUIApplication app, TCSession session, DeriveMaterialsDialog dialog, String exeType) { + this.app = app; + this.session = session; + this.dialog = dialog; + this.exeType = exeType; + } + @Override + public void executeOperation() throws Exception { + // TODO Auto-generated method stub + new Thread() { + public void run() { + WaitingDialog dia = new WaitingDialog(app.getDesktop(), "INFOMATION", ""+exeType+"......"); + dia.setVisible(true); + try { + + boolean flag = false; + switch (exeType) { + case "": + flag = create(); + if (flag) { + dia.setVisible(false); + dialog.dispose(); + MessageBox.post(exeType+"ɹ", "", MessageBox.INFORMATION); + } else { + dia.setVisible(false); + MessageBox.post(dialog,errInfo, "", MessageBox.INFORMATION); + } + break; + + default: + break; + } + }finally { + dia.setVisible(false); + dia.dispose(); + } + }; + }.start(); + } + public boolean create() { + try { + dialog.create(); + return true; + }catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + errInfo = errInfo+e.getMessage(); + return false; + } + } + class WaitingDialog extends com.teamcenter.rac.aif.AbstractAIFDialog { + private static final long serialVersionUID = 1L; + public JPanel panel; + JProgressBar progressBar = null; + + public WaitingDialog(Frame arg0, String title, String message) { + super(arg0, title); + this.setModal(false); + + panel = new JPanel(new BorderLayout()); + + /* + * JLabel label = new JLabel(message); System.out.println("message:"+message); + * System.out.println("label:"+label); panel.add(label); + */ + + progressBar = new JProgressBar(SwingConstants.HORIZONTAL); + progressBar.setVisible(true); + progressBar.setIndeterminate(true); + + panel.add(BorderLayout.CENTER, new Label(message)); + panel.add(BorderLayout.SOUTH, progressBar); + + panel.setPreferredSize(new Dimension(350, 60)); + + this.getContentPane().add(panel); + + centerToScreen(); + setAlwaysOnTop(true); + pack(); + + } + } +} diff --git a/src/com/connor/zf/editClassAttr/EditClassificationDialog.java b/src/com/connor/zf/editClassAttr/EditClassificationDialog.java new file mode 100644 index 0000000..b41e906 --- /dev/null +++ b/src/com/connor/zf/editClassAttr/EditClassificationDialog.java @@ -0,0 +1,473 @@ +package com.connor.zf.editClassAttr; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMNamespace; +import org.apache.axis2.AxisFault; +import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.client.Options; +import org.apache.axis2.client.ServiceClient; + +import com.connor.zf.util.ClassPropBean; +import com.connor.zf.util.ClassProperty; +import com.connor.zf.util.JDMethodUtil; +import com.connor.zf.util.SoaServerUtil; +import com.connor.zf.util.StringCreateUtil; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCClassService; +import com.teamcenter.rac.kernel.TCClassificationService; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentICO; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.ics.ICSAdminClass; +import com.teamcenter.rac.kernel.ics.ICSKeyLov; +import com.teamcenter.rac.kernel.ics.ICSProperty; +import com.teamcenter.rac.kernel.ics.ICSPropertyDescription; +import com.teamcenter.rac.kernel.ics.ICSKeyLov.KeyLov; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +import net.sf.json.JSONArray; + +/** + * ޸ķ + */ +public class EditClassificationDialog extends AbstractAIFDialog { + + private static final long serialVersionUID = 1L; + private AbstractAIFApplication app; + private TCSession session; + private TCComponent target; + private Map propMap; + private TCClassificationService myService; + final EditClassificationDialog DIALOG = this; + private TCComponentItemRevision rev; + private int[] ids; + private String[] values; + private String[] names; + private boolean finished; + private ICSPropertyDescription[] desc; + private String url = ""; + public EditClassificationDialog(AbstractAIFApplication app) throws TCException { + this.app = app; + this.session = (TCSession) app.getSession(); + this.myService = session.getClassificationService(); + this.target = (TCComponent) AIFUtility.getCurrentApplication().getTargetComponent(); + this.url = JDMethodUtil.getPrefStr("Autocode_SendClassServer_URL", session); + System.out.println(target.getType()); + System.out.println(target instanceof TCComponentItemRevision ? "" : ""); + + if (target instanceof TCComponentItemRevision) { + try { + rev = (TCComponentItemRevision) target; + boolean isAccess = session.getTCAccessControlService().checkPrivilege(rev, "WRITE"); + if (!isAccess) { + //JOptionPane.showMessageDialog(this, "ûа汾޸ȨޣϵϵͳԱ", "ʾ", JOptionPane.WARNING_MESSAGE); + MessageBox.post("ûа汾޸ȨޣϵϵͳԱ", "ʾ", MessageBox.INFORMATION); + return; + } + initUI(); + } catch (Exception e) { + e.printStackTrace(); + } + } else { + MessageBox.post("ѡ汾", "", MessageBox.ERROR); + } + } + + /** + * ȡLOVʾֵ + * @param icsD + * @return + */ + public static String getClassDisplayableValue(ICSPropertyDescription icsD) { + String result = ""; + ICSKeyLov lov = icsD.getFormat().getKeyLov(); + if (lov != null) { + String[] keys = lov.getKeys(); + for (String key : keys) { + result = lov.getValueOfKey(key); + return result; + } + } + return result; + } + + private void initUI() { + this.setTitle("޸ķ"); + + JPanel rootPanel = new JPanel(); + rootPanel.setLayout(new BorderLayout()); + rootPanel.setPreferredSize(new Dimension(600, 350)); + + Map displayMap = new LinkedHashMap(); + propMap = new HashMap(); + + try { + if (rev.getClassificationClass() != null && !"".equals(rev.getClassificationClass())) { + try { + rev.refresh(); + System.out.println("rev.getClassificationClass()=" + rev.getClassificationClass()); + TCComponentICO ico = rev.getClassificationObjects()[0]; + ICSProperty[] props = ico.getICSProperties(true); + desc = ico.getICSPropertyDescriptors(); + for (int i = 0; i < props.length; i++) { +// System.out.println(props[i].getId() + "===>" + props[i].getValue());// 30101===> + // desc.getName=Type and size series ǷԵ||| desc.getId=30101ǷID +// System.out.println("desc.getName=" + desc[i].getName() + " desc.getId=" + desc[i].getId()); + displayMap.put(props[i], desc[i]); + } + } catch (TCException e1) { + e1.printStackTrace(); + } + } else { + this.disposeDialog(); + MessageBox.post("ǰ汾δ", "", MessageBox.ERROR); + return; + } + } catch (TCException e) { + e.printStackTrace(); + } + + if (displayMap.size() == 0) { + return; + } + + JPanel content = new JPanel(); + content.setLayout(null); + content.setPreferredSize(new Dimension(600, displayMap.size() * (25 + 10))); + + int num = 0; + // ͨȡеķԣȻ + for (Entry entry : displayMap.entrySet()) { + //+++ + if(entry.getValue().isHidden()) { + continue; + } + //+++ + JLabel label = new JLabel(entry.getValue().getName() + ""); + label.setBounds(10, num * 35 + 10, 100, 25); + + ICSKeyLov lov = entry.getValue().getFormat().getKeyLov(); +// ArrayList list = new ArrayList<>(); + if (lov != null) { + String[] keys = lov.getKeys(); + JAutoCompleteComboBox combo = new JAutoCompleteComboBox(); +// JComboBox combo = new JComboBox(); + combo.addItem(new ClassPropBean("", "", "")); + for (String key : keys) { + //+++ + KeyLov lov_key = lov.getKeyLovOfKey(key); + boolean deprecated = lov_key.isDeprecated(); + if(deprecated) { + continue; + } + //+++ + combo.addItem(new ClassPropBean(key, lov.getValueOfKey(key), "")); + } + + String v = entry.getKey().getValue(); + for (int i = 0; i < combo.getItemCount(); i++) { + if (v.equals(((ClassPropBean) combo.getItemAt(i)).getId())) { + combo.setSelectedIndex(i); + break; + } + } +// combo.setSelectedItem(v); +// if (!Arrays.asList(lov.getDisplayValues()).contains(v)) { +// combo.addItem(v); +// combo.setSelectedItem(v); +// } + + combo.setBounds(130, num * 35 + 10, 350, 25); + + propMap.put(entry.getValue().getName(), combo); + content.add(combo); + } else { + JTextField text = new JTextField(entry.getKey().getValue()); + text.setBounds(130, num * 35 + 10, 350, 25); + propMap.put(entry.getValue().getName(), text); + content.add(text); + } + + content.add(label); + + num++; + } + + JButton okBtn = new JButton("ȷ"); +// okBtn.setBounds(40, 310, 100, 25); + okBtn.setSelected(true); + okBtn.addActionListener(ok()); + JButton cancelBtn = new JButton("ȡ"); +// cancelBtn.setBounds(160, 310, 100, 25); + cancelBtn.addActionListener(cancel()); + + JScrollPane jsp = new JScrollPane(content); + jsp.getVerticalScrollBar().setUnitIncrement(16); +// jsp.setBounds(0, 0, 600, 300); + jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + rootPanel.add(jsp,BorderLayout.CENTER); + JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + buttonPanel.add(okBtn); + buttonPanel.add(cancelBtn); +// rootPanel.add(okBtn); +// rootPanel.add(cancelBtn); + rootPanel.add(buttonPanel,BorderLayout.SOUTH); + this.setLayout(new BorderLayout()); + this.add(rootPanel,BorderLayout.CENTER); + this.pack(); + this.centerToScreen(); + this.setAutoRequestFocus(true); +// this.setResizable(false); + this.setAlwaysOnTop(true); + this.showDialog(); + } + + private ActionListener ok() { + return new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + ((JButton) e.getSource()).setEnabled(false); + rev = (TCComponentItemRevision) target; + + new Thread(new Runnable() { + + @Override + public void run() { + int i = 1; + while (!DIALOG.finished) { + try { + DIALOG.setTitle("޸ķ " + StringCreateUtil.createPoint(i++ % 3)); + Thread.sleep(200); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + }).start(); + + EditClassificationDialog.this.setAlwaysOnTop(false); + if (saveClassification(rev)) { + MessageBox.post("޸ķԳɹ", "", MessageBox.ERROR); + EditClassificationDialog.this.disposeDialog(); + } else { + MessageBox.post("޸ķʧܣ", "", MessageBox.ERROR); + } + + } + }; + } + + private ActionListener cancel() { + return new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + DIALOG.disposeDialog(); + } + }; + } + + @SuppressWarnings("unchecked") + private boolean saveClassification(TCComponentItemRevision rev) { + + try { + TCComponentForm form = (TCComponentForm) rev.getRelatedComponents("IMAN_master_form_rev")[0]; + TCComponent[] status = form.getRelatedComponents("release_status_list"); + for (TCComponent comp : status) { + if (comp.getProperty("object_name").contains("ʽ")) { + JOptionPane.showMessageDialog(this, "汾ʽ޸ķ", "ʾ", JOptionPane.WARNING_MESSAGE); + return false; + } + } + TCComponentICO[] icoS = rev.getClassificationObjects(); + System.out.println("======>ȡķ:" + icoS.length); + String classID = rev.getClassificationClass(); + if (icoS == null || icoS.length == 0) { + return false; + } + for (int i = 0; i < icoS.length; i++) { + List propList = new ArrayList<>(); + TCComponentICO ico = icoS[i]; + ICSPropertyDescription[] desc = ico.getICSPropertyDescriptors(); + ICSProperty[] oldICSProps = ico.getICSProperties(true); + ids = new int[oldICSProps.length]; + values = new String[oldICSProps.length]; + names = new String[oldICSProps.length]; + for (int j = 0; j < oldICSProps.length; j++) { + ids[j] = oldICSProps[j].getId(); + if (propMap.get(desc[j].getName()) instanceof JComboBox) { + ClassPropBean bean = (ClassPropBean) ((JComboBox) propMap.get(desc[j].getName())).getSelectedItem(); + String str = bean.getId(); + values[j] = " ".equals(str) ? "" : str; + } else { + values[j] = ((JTextField) propMap.get(desc[j].getName())).getText(); + } + names[j] = desc[j].getName(); + ClassProperty prop = new ClassProperty(ids[j], values[j]); + propList.add(prop); + } + String json = objectToJson(propList); + System.out.println("classID=" + classID); + System.out.println("json=" + json); + String str = sendObjToClassficationByWebService(ico.getUid(),classID, rev, json); + if(str.contains("ʧ") || str.contains("")) { + return false; + } + } + } catch (TCException e1) { + e1.printStackTrace(); + JOptionPane.showMessageDialog(null, e1, "", JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + } + + private TCComponentICO getICO(TCComponentItemRevision rev, String classId) throws Exception { + if (rev == null || classId.equals("")) { + return null; + } + TCComponentICO[] icos = rev.getClassificationObjects(); + System.out.println(rev + " -> Ѵڷࣺ" + Arrays.toString(icos)); + int len = icos.length; + if (len == 0) { + return null; + } + TCClassificationService classService = session.getClassificationService(); + for (int i = 0; i < len; i++) { + TCComponentICO ico = icos[i]; + classService.loadICOs(new String[] { ico.getUid() }, ""); + if (ico.getClassId() == null || ico.getClassId().equals("")) { + throw new Exception("쳣ϵԱ"); + } + if (classId.equals(ico.getClassId())) { + return ico; + } + } + return null; + } + + public void deleteClass(String icoPuid) { + try { + ServiceClient sc = new ServiceClient(); + Options opts = new Options(); + String url = JDMethodUtil.getPrefStr("Autocode_SendClassServer_URL", session);// "http://10.201.5.203:19090/ErpWebService.asmx?WSDL"; + EndpointReference end = new EndpointReference(url); + opts.setTo(end); + opts.setAction("DeleteClass"); + sc.setOptions(opts); + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMNamespace omNs = fac.createOMNamespace("http://tempuri.org/", ""); + OMElement method = fac.createOMElement("DeleteClass", omNs); + OMElement value = fac.createOMElement("icoPuid", omNs); + value.setText(icoPuid); + + method.addChild(value); + + OMElement res = sc.sendReceive(method); + res.getFirstElement().getText(); + System.out.println(res.getFirstElement().getText()); + } catch (AxisFault e) { + e.printStackTrace(); + } + + } + + public boolean sendToClass(String wsoPUID, String classID, String json) { + try { + ServiceClient sc = new ServiceClient(); + Options opts = new Options(); + String url = JDMethodUtil.getPrefStr("Autocode_SendClassServer_URL", session); + // "http://10.201.5.203:19090/ErpWebService.asmx?WSDL"; + EndpointReference end = new EndpointReference(url); + opts.setTo(end); + opts.setAction("SendToClass"); + sc.setOptions(opts); + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMNamespace omNs = fac.createOMNamespace("http://tempuri.org/", ""); + OMElement method = fac.createOMElement("SendToClass", omNs); + OMElement value = fac.createOMElement("wsoPuiid", omNs); + value.setText(wsoPUID); + OMElement value1 = fac.createOMElement("classID", omNs); + value1.setText(classID); + OMElement value2 = fac.createOMElement("JsonContainer", omNs); + // "[{\"value\":\"1\",\"propertyID\":-500003},{\"value\":\"1\",\"propertyID\":-500011}]" + value2.setText(json); + + method.addChild(value); + method.addChild(value1); + method.addChild(value2); + + OMElement res = sc.sendReceive(method); + res.getFirstElement().getText(); + System.out.println(res.getFirstElement().getText()); + } catch (AxisFault e) { +// MessageBox.post("ͷʧܣ", "", MessageBox.ERROR); + e.printStackTrace(); + return false; + } + return true; + + } + + public String sendObjToClassficationByWebService(String icoPUID,String class_id, TCComponentItemRevision rev, String json) { + String updateToClass=""; + try { + System.out.println("class_id-----dddddd----->" + class_id); + System.out.println("icoPUID-----dddddd----->" + icoPUID); + if (!class_id.replace(" ", "").equals("")) { + SoaServerUtil.grantWritePrivilege(session, rev);// дȨ + updateToClass = SoaServerUtil.updateToClass(rev.getUid(), class_id, json, url,icoPUID);// ͵ +// SoaServerUtil.deleteAndSendToClass(icoPUID,rev.getUid(), class_id, json, url);// ͵ + + SoaServerUtil.grantReadPrivilege(session, rev);// Ȩ + } + + } catch (Exception e) { + e.printStackTrace(); + } + return updateToClass; + } + + public static String objectToJson(List props) { + String str = null; + try { + JSONArray json = JSONArray.fromObject(props);// javaתΪjson + str = json.toString();// jsonתΪַ + } catch (Exception e) { + e.printStackTrace(); + } + System.out.println("JSON =>" + str); + return str; + } +} diff --git a/src/com/connor/zf/editClassAttr/JAutoCompleteComboBox.java b/src/com/connor/zf/editClassAttr/JAutoCompleteComboBox.java new file mode 100644 index 0000000..be3562f --- /dev/null +++ b/src/com/connor/zf/editClassAttr/JAutoCompleteComboBox.java @@ -0,0 +1,160 @@ +package com.connor.zf.editClassAttr; + +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.util.List; +import java.util.Vector; + +import javax.swing.ComboBoxModel; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JComboBox; +import javax.swing.JTextField; + +@SuppressWarnings({ "serial", "rawtypes", "unchecked" }) +public class JAutoCompleteComboBox extends JComboBox { + private AutoCompleter completer; + + public JAutoCompleteComboBox() { + super(); + addCompleter(); + } + + public JAutoCompleteComboBox(ComboBoxModel cm) { + super(cm); + addCompleter(); + } + + public JAutoCompleteComboBox(Object[] items) { + super(items); + addCompleter(); + } + + public JAutoCompleteComboBox(List v) { + super((Vector) v); + addCompleter(); + } + + private void addCompleter() { + setEditable(true); + completer = new AutoCompleter(this); + } + + public void autoComplete(String str) { + this.completer.autoComplete(str, str.length()); + } + + public String getText() { + return ((JTextField) getEditor().getEditorComponent()).getText(); + } + + public void setText(String text) { + ((JTextField) getEditor().getEditorComponent()).setText(text); + } + + public boolean containsItem(String itemString) { + for (int i = 0; i < this.getModel().getSize(); i++) { + String _item = " " + this.getModel().getElementAt(i); + if (_item.equals(itemString)) + return true; + } + return false; + } + +} + +@SuppressWarnings({"rawtypes"}) +class AutoCompleter implements KeyListener, ItemListener { + + private JComboBox owner = null; + private JTextField editor = null; + + private ComboBoxModel model = null; + + public AutoCompleter(JComboBox comboBox) { + owner = comboBox; + editor = (JTextField) comboBox.getEditor().getEditorComponent(); + editor.addKeyListener(this); + model = comboBox.getModel(); + owner.addItemListener(this); + } + + public void keyTyped(KeyEvent e) { + } + + public void keyPressed(KeyEvent e) { + } + + @SuppressWarnings("unused") + public void keyReleased(KeyEvent e) { + char ch = e.getKeyChar(); + // if (ch == KeyEvent.CHAR_UNDEFINED || Character.isISOControl(ch) + // || ch == KeyEvent.VK_DELETE) + // return; + if (e.getKeyCode() == KeyEvent.VK_ENTER) { + int caretPosition = editor.getCaretPosition(); + String str = editor.getText(); + if (str.length() == 0) + return; + autoComplete(str, caretPosition); + } + } + + @SuppressWarnings({ "unchecked", "unused" }) + protected void autoComplete(String strf, int caretPosition) { + Object[] opts; + opts = getMatchingOptions(strf.substring(0, caretPosition)); + if (owner != null) { + model = new DefaultComboBoxModel(opts); + owner.setModel(model); + } + if (opts.length > 0) { + String str = opts[0].toString(); + editor.setCaretPosition(caretPosition); + if (owner != null) { + try { + owner.showPopup(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + } + } + + @SuppressWarnings("unchecked") + protected Object[] getMatchingOptions(String str) { + List v = new Vector(); + List v1 = new Vector(); + // v.add(str); + for (int k = 0; k < model.getSize(); k++) { + Object itemObj = model.getElementAt(k); + if (itemObj != null) { + String item = itemObj.toString().toLowerCase(); + if (item.indexOf((str.toLowerCase())) > -1) + v.add(model.getElementAt(k)); + else + v1.add(model.getElementAt(k)); + } else + v1.add(model.getElementAt(k)); + } + for (int i = 0; i < v1.size(); i++) { + v.add(v1.get(i)); + } + // if (v.isEmpty()) + return v.toArray(); + } + + public void itemStateChanged(ItemEvent event) { + if (event.getStateChange() == ItemEvent.SELECTED) { + int caretPosition = editor.getCaretPosition(); + if (caretPosition != -1) { + try { + editor.moveCaretPosition(caretPosition); + } catch (IllegalArgumentException ex) { + ex.printStackTrace(); + } + } + } + } +} \ No newline at end of file diff --git a/src/com/connor/zf/editClassAttr/editClassAttrHandler.java b/src/com/connor/zf/editClassAttr/editClassAttrHandler.java new file mode 100644 index 0000000..2666c24 --- /dev/null +++ b/src/com/connor/zf/editClassAttr/editClassAttrHandler.java @@ -0,0 +1,24 @@ +package com.connor.zf.editClassAttr; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCException; + +public class editClassAttrHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app = AIFUtility.getCurrentApplication(); + try { + new Thread(new EditClassificationDialog(app)).start(); + } catch (TCException e) { + e.printStackTrace(); + } + return null; + } + +} diff --git a/src/com/connor/zf/util/CNClassPropBean.java b/src/com/connor/zf/util/CNClassPropBean.java new file mode 100644 index 0000000..1151413 --- /dev/null +++ b/src/com/connor/zf/util/CNClassPropBean.java @@ -0,0 +1,66 @@ +package com.connor.zf.util; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import com.teamcenter.rac.kernel.ics.ICSAdminClassAttribute; +import com.teamcenter.rac.kernel.ics.ICSKeyLov; + +public class CNClassPropBean { + // ICSFormate + public int propID; + public String propDisName; + public String relValue; + public String displayValue; + + public int attrType; + public boolean isLov; + public HashMap lovMapping; + public List keyList; + public ICSAdminClassAttribute icsAttr; + public int intsize = 0; + public int floatsize = 0; + public String formate; + + public CNClassPropBean(ICSAdminClassAttribute icsAttr) { + // System.out.println("attr id :"+icsAttr.getAttributeId()+" attr naem :"+icsAttr.getName()); + this.icsAttr = icsAttr; + this.propID = icsAttr.getAttributeId(); + this.propDisName = icsAttr.getName(); + this.formate = icsAttr.getFormat2().getDisplayString(); + if (icsAttr.getFormat1().isReal()) { + floatsize = icsAttr.getFormat2().getFlagB(); + intsize = icsAttr.getFormat2().getFlagC(); + } + + this.attrType = icsAttr.getFormat1().getType(); + ICSKeyLov lov1 = icsAttr.getFormat1().getKeyLov(); + + lov1 = (lov1 == null ? icsAttr.getFormat2().getKeyLov() : lov1); + lovMapping = new HashMap<>(); + keyList = new ArrayList<>(); + if (lov1 != null) { + this.isLov = true; + String[] keys = lov1.getKeys(); + for (String key : keys) { + String value = lov1.getValueOfKey(key); + System.out.println("lovkey=================="+key); + System.out.println("lovValue=================="+value); + if(!("".equals(value)) && !(" ".equals(value)) + && !(" ".equals(key)) && !(" ".equals(key))){ + lovMapping.put(value, key); + keyList.add(value); + } + } + } else { + this.isLov = false; + } + } + + @Override + public String toString() { + return propDisName + ":"; + } + +} diff --git a/src/com/connor/zf/util/ClassPropBean.java b/src/com/connor/zf/util/ClassPropBean.java new file mode 100644 index 0000000..96df882 --- /dev/null +++ b/src/com/connor/zf/util/ClassPropBean.java @@ -0,0 +1,44 @@ +package com.connor.zf.util; + +public class ClassPropBean { + private String id; + private String name; + private String value; + + public ClassPropBean(String id, String name, String value) { + super(); + this.id = id; + this.name = name; + this.value = value; + } + + public String getId() { + return id; + } + + @Override + public String toString() { + return name; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + +} diff --git a/src/com/connor/zf/util/ClassProperty.java b/src/com/connor/zf/util/ClassProperty.java new file mode 100644 index 0000000..bb5d908 --- /dev/null +++ b/src/com/connor/zf/util/ClassProperty.java @@ -0,0 +1,42 @@ +package com.connor.zf.util; + +/** + * @copyRight 㽭տƼ޹˾ + * @author E-mail:hub@connor.net.cn + * @date ʱ䣺2017-7-3 11:47:03 + * @version v1.0 + * @parameter + * @since + * @return + */ + +public class ClassProperty { + private int propertyID; + private String value; + + public ClassProperty() { + + } + + public ClassProperty(int propertyID, String value) { + this.propertyID = propertyID; + this.value = value; + } + + public int getPropertyID() { + return propertyID; + } + + public void setPropertyID(int propertyID) { + this.propertyID = propertyID; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + +} diff --git a/src/com/connor/zf/util/JAutoCompleteComboBox.java b/src/com/connor/zf/util/JAutoCompleteComboBox.java new file mode 100644 index 0000000..5f855d1 --- /dev/null +++ b/src/com/connor/zf/util/JAutoCompleteComboBox.java @@ -0,0 +1,288 @@ +package com.connor.zf.util; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.util.ArrayList; +import java.util.List; +import java.util.Vector; +import javax.swing.ComboBoxModel; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JTextField; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; + +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Combo; + +public class JAutoCompleteComboBox extends JComboBox { + + private AutoCompleter completer; + + public JAutoCompleteComboBox() { + super(); + addCompleter(); + } + + public JAutoCompleteComboBox(ComboBoxModel cm) { + super(cm); + addCompleter(); + } + + public JAutoCompleteComboBox(Object[] items) { + super(items); + addCompleter(); + } + + public JAutoCompleteComboBox(List v) { + super((Vector) v); + addCompleter(); + } + + private void addCompleter() { + setEditable(true); + completer = new AutoCompleter(this); + } + + public void autoComplete(String str) { + this.completer.autoComplete(str, str.length()); + } + + public String getText() { + return ((JTextField) getEditor().getEditorComponent()).getText(); + } + + public void setText(String text) { + ((JTextField) getEditor().getEditorComponent()).setText(text); + } + + public boolean containsItem(String itemString) { + for (int i = 0; i < this.getModel().getSize(); i++) { + String _item = " " + this.getModel().getElementAt(i); + if (_item.equals(itemString)) + return true; + } + return false; + } + + + public static void main(String[] args) { + JFrame frame = new JFrame(); + Object[] items = new Object[] { "", "abc ", "aab ", "aba ", "hpp ", + "pp ", "hlp " }; + DefaultComboBoxModel model = new DefaultComboBoxModel(); + JAutoCompleteComboBox cmb = new JAutoCompleteComboBox(); + cmb.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + String actionCommand2 = e.getActionCommand(); + System.out.println(""+actionCommand2); + System.out.println("ǰѡֵ1"+cmb.getText()); + System.out.println("ǰѡֵ2"+cmb.getSelectedItem().toString()); + } + }); + cmb.addItem(""); + cmb.addItem("Ʒ"); + cmb.addItem("Ʒ"); + cmb.addItem(""); + cmb.addItem(""); + cmb.addItem(""); + model.addElement(""); + model.addElement("abc "); + model.addElement("aab "); + model.addElement("aba "); + model.addElement("hpp "); + model.addElement("pp "); + model.addElement("hlp "); + frame.getContentPane().add(cmb); + frame.setSize(400, 80); + frame.setVisible(true); +// try { +// Thread.sleep(1*1000); +// System.out.println(cmb.getText()); +// } catch (InterruptedException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } + } + class AutoCompleter implements KeyListener, ItemListener { + + private JComboBox owner = null; + private JTextField editor = null; + private ComboBoxModel model = null; + + public AutoCompleter(JComboBox comboBox) { + owner = comboBox; + editor = (JTextField) comboBox.getEditor().getEditorComponent(); + editor.addKeyListener(this); +// editor.getDocument().addDocumentListener(new DocumentListener() { +// +// @Override +// public void removeUpdate(DocumentEvent e) { +// System.out.println("ɾ"); +// int caretPosition = editor.getCaretPosition(); +// String str = editor.getText(); +// autoComplete(str, caretPosition); +// } +// +// @Override +// public void insertUpdate(DocumentEvent e) { +// System.out.println(""); +// } +// +// @Override +// public void changedUpdate(DocumentEvent e) { +// System.out.println("޸"); +// } +// }); + model = comboBox.getModel(); + + owner.addItemListener(this); + } + + public void keyTyped(KeyEvent e) { + } + + public void keyPressed(KeyEvent e) { + } + + public void keyReleased(KeyEvent e) { + char ch = e.getKeyChar(); +// if (ch == KeyEvent.CHAR_UNDEFINED || Character.isISOControl(ch) +// || ch == KeyEvent.VK_DELETE) +// return; +// System.out.println("str="+str); +// System.out.println("caretPosition="+caretPosition); +// if (str.length() == 0) +// return; + +// if(ch == KeyEvent.VK_ENTER) { +// System.out.println("ִм"); +// int caretPosition = editor.getCaretPosition(); +// String str = editor.getText(); +// autoComplete(str, caretPosition); +// } + + new Thread(new Runnable() { + + @Override + public void run() { + // TODO Auto-generated method stub + try { + Thread.sleep(500); + int caretPosition = editor.getCaretPosition(); + String str = editor.getText(); + autoComplete(str, caretPosition); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + }).start(); + } + + /** + * ԶɡݣбҵƵĿ. + */ + protected void autoComplete(String strf, int caretPosition) { + System.out.println("ǰ±꣺"+caretPosition); + Object[] opts; + opts = getMatchingOptions(strf.substring(0, caretPosition)); + if (owner != null) { + model = new DefaultComboBoxModel(opts); + owner.setModel(model); + } + if (opts.length > 0) { + String str = opts[0].toString(); + try { + + editor.setCaretPosition(caretPosition); + }catch (Exception e) { + } + if (owner != null) { + try { + owner.showPopup(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + } + } + + /** + * + * ҵƵĿ, ҽ֮еǰ档 + * + * @param str + * @return Ŀб + */ + protected Object[] getMatchingOptions(String str) { +// System.out.println("str2="+str); + List v = new Vector(); + List v1 = new Vector(); + if("".equals(str)) { + boolean hasempty = false; + for (int k = 0; k < model.getSize(); k++) { + Object itemObj = model.getElementAt(k); + if (itemObj != null) { + String item = itemObj.toString(); + if(!"".equals(item)) + item = item.toLowerCase(); + if (item.equals(str)) { + hasempty = true; + v.add(model.getElementAt(k)); + }else { + v1.add(model.getElementAt(k)); + } + } else { + hasempty = true; + v1.add(model.getElementAt(k)); + } + } + if(!hasempty) { + v.add(""); + } + }else { + + for (int k = 0; k < model.getSize(); k++) { + Object itemObj = model.getElementAt(k); + if (itemObj != null) { + String item = itemObj.toString().toLowerCase(); + if (item.startsWith(str.toLowerCase())) + v.add(model.getElementAt(k)); + else + v1.add(model.getElementAt(k)); + } else + v1.add(model.getElementAt(k)); + } + } + for (int i = 0; i < v1.size(); i++) { + v.add(v1.get(i)); + } + if (v.isEmpty()) + v.add(str); + return v.toArray(); + } + + public void itemStateChanged(ItemEvent event) { + if (event.getStateChange() == ItemEvent.SELECTED) { + int caretPosition = editor.getCaretPosition(); + if (caretPosition != -1) { + try { + editor.moveCaretPosition(caretPosition); + } catch (IllegalArgumentException ex) { + ex.printStackTrace(); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/com/connor/zf/util/JDMethodUtil.java b/src/com/connor/zf/util/JDMethodUtil.java new file mode 100644 index 0000000..8d5eef4 --- /dev/null +++ b/src/com/connor/zf/util/JDMethodUtil.java @@ -0,0 +1,47 @@ +package com.connor.zf.util; + +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCUserService; + +public class JDMethodUtil { + + public static TCPreferenceService service; + public static TCUserService userservice; + + /** + * + * + * @param prefName + * @return + */ + public static String getPrefStr(String prefName, TCSession session) { + if (service == null) { + service = session.getPreferenceService(); + } + String str = service.getString(TCPreferenceService.TC_preference_site, prefName); + if (str == null) { + str = new String(""); + } + return str; + } + + /** + * + * + * @param prefName + * @return + */ + public static String[] getPrefStrArray(String prefName, TCSession session) { + if (service == null) { + service = session.getPreferenceService(); + } + String[] strs = service.getStringArray(TCPreferenceService.TC_preference_site, prefName); + service.getStringValues(prefName); + service.getStringValue(prefName); + if (strs == null) { + strs = new String[] { "" }; + } + return strs; + } +} diff --git a/src/com/connor/zf/util/MyUtil.java b/src/com/connor/zf/util/MyUtil.java new file mode 100644 index 0000000..9671b46 --- /dev/null +++ b/src/com/connor/zf/util/MyUtil.java @@ -0,0 +1,196 @@ +package com.connor.zf.util; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCPropertyDescriptor; + +public class MyUtil { + /** + * + * @param property + * @param value + * @throws TCException + */ + public static void setTCProperty(TCProperty property, String value) throws TCException { + System.out.println("setTCProperty(TCProperty property =" + property.getPropertyName() + ", String value=" + + value + ") - start"); + + TCPropertyDescriptor descriptor = property.getPropertyDescriptor(); + boolean isArray = descriptor.isArray(); + if (!isArray) { + switch (descriptor.getType()) { + + case TCProperty.PROP_string: + case TCProperty.PROP_long_string: + property.setStringValueData(value); + property.setStringValue(value); + break; + case TCProperty.PROP_char: + if (value.length() > 0) { + property.setCharValueData(value.charAt(0)); + } + break; + case TCProperty.PROP_double: + property.setDoubleValueData(Double.parseDouble(value)); + property.setDoubleValue(Double.parseDouble(value)); + break; + case TCProperty.PROP_float: + property.setFloatValueData(Float.parseFloat(value)); + property.setFloatValue(Float.parseFloat(value)); + break; + case TCProperty.PROP_int: + case TCProperty.PROP_short: + property.setIntValueData(Integer.parseInt(value)); + property.setIntValue(Integer.parseInt(value)); + break; + case TCProperty.PROP_logical: + boolean flag = false; + if(value!=null&&("".equals(value)||"true".equals(value)||"TRUE".equals(value)))flag = true; + property.setLogicalValueData(flag); + property.setLogicalValue(flag); + break; + case TCProperty.PROP_date: + try { + if (!value.isEmpty()) { + property.setDateValueData(new SimpleDateFormat("yyyy-M-d HH:mm").parse(value)); + property.setDateValue(new SimpleDateFormat("yyyy-M-d HH:mm").parse(value)); + } + } catch (ParseException e) { + e.printStackTrace(); + } + break; + } + } else { + if(value == null)value = ""; + if (value.indexOf(",") > 0) { + property.setStringValueArray(value.split(",")); + } else { + property.setStringValueArray(new String[] { value }); + } + // System.out.println("ӦΪͣԴ"); + } + + System.out.println("setTCProperty(TCProperty property, String value) - end"); + } + /** + * + * @param property + * @param value + * @throws TCException + */ + public static String getTCProperty(TCProperty property) throws TCException { + System.out.println("getTCProperty(TCProperty property ȡ=" + property.getPropertyName() + ") - start"); + String result = null; + TCPropertyDescriptor descriptor = property.getPropertyDescriptor(); + boolean isArray = descriptor.isArray(); + if (!isArray) { + switch (descriptor.getType()) { + + case TCProperty.PROP_string: + case TCProperty.PROP_long_string: + result = property.getStringValue(); + break; + case TCProperty.PROP_char: + result = property.getCharValue()+""; + break; + case TCProperty.PROP_double: + result = property.getDoubleValue()+""; + break; + case TCProperty.PROP_float: + result = property.getFloatValue()+""; + break; + case TCProperty.PROP_int: + case TCProperty.PROP_short: + result = property.getIntValue()+""; + break; + case TCProperty.PROP_logical: + result = property.getLogicalValue()?"":""; + break; + case TCProperty.PROP_date: + if(property.getDateValue()!=null) + result = new SimpleDateFormat("yyyy-M-d HH:mm").format(property.getDateValue()); + else + result = ""; + break; + } + } else { + switch (descriptor.getType()) { + + case TCProperty.PROP_string: + case TCProperty.PROP_long_string: + String[] stringValueArray = property.getStringValueArray(); + StringBuilder sb = new StringBuilder(); + for(String s :stringValueArray) { + sb.append(s).append(","); + } + result = sb.substring(0,sb.length()-1); + break; + case TCProperty.PROP_char: + char[] stringValueArray2 = property.getCharValueArray(); + StringBuilder sb2 = new StringBuilder(); + for(char s :stringValueArray2) { + sb2.append(s).append(","); + } + result = sb2.substring(0,sb2.length()-1); + break; + case TCProperty.PROP_double: + double[] doubleValueArray = property.getDoubleValueArray(); + StringBuilder sb3 = new StringBuilder(); + for(double s :doubleValueArray) { + sb3.append(s).append(","); + } + result = sb3.substring(0,sb3.length()-1); + break; + case TCProperty.PROP_float: + float[] floatValueArray = property.getFloatValueArray(); + StringBuilder sb4 = new StringBuilder(); + for(float s :floatValueArray) { + sb4.append(s).append(","); + } + result = sb4.substring(0,sb4.length()-1); + break; + case TCProperty.PROP_int: + case TCProperty.PROP_short: + int[] intValueArray = property.getIntValueArray(); + StringBuilder sb5 = new StringBuilder(); + for(int s :intValueArray) { + sb5.append(s).append(","); + } + result = sb5.substring(0,sb5.length()-1); + break; + case TCProperty.PROP_logical: + boolean[] boolValueArray = property.getLogicalValueArray(); + StringBuilder sb6 = new StringBuilder(); + for(boolean s :boolValueArray) { + sb6.append(s?"":"").append(","); + } + result = sb6.substring(0,sb6.length()-1); + break; + case TCProperty.PROP_date: + Date[] dateValueArray = property.getDateValueArray(); + StringBuilder sb7 = new StringBuilder(); + for(Date s :dateValueArray) { + if(s!=null) { + sb7.append(new SimpleDateFormat("yyyy-M-d HH:mm").format(s)).append(","); + } + } + result = sb7.substring(0,sb7.length()-1); + break; + } +// if (value.indexOf(",") > 0) { +// property.setStringValueArray(value.split(",")); +// } else { +// property.setStringValueArray(new String[] { value }); +// } +// System.out.println("ӦΪͣԴ"); + } + + System.out.println("getTCProperty(TCProperty property) - end value="+result); + return result; + } + +} diff --git a/src/com/connor/zf/util/RwJComboBox.java b/src/com/connor/zf/util/RwJComboBox.java new file mode 100644 index 0000000..8f28244 --- /dev/null +++ b/src/com/connor/zf/util/RwJComboBox.java @@ -0,0 +1,266 @@ +package com.connor.zf.util; + +import java.awt.Point; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.DefaultCellEditor; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableCellEditor; + + + +public class RwJComboBox extends javax.swing.JComboBox implements java.awt.event.FocusListener { +// public static void main(String[] args) { +//// String str[][] = new String[10][3]; +//// for (int i = 0; i < str.length; i++) { +//// str[i][0] = i + 6 + ""; +//// } +// String str1[] = {"1","2"}; +//// String str[][] = {{"1"},{"2"}}; +// List list = new ArrayList(); +// for(String s:str1) { +// String[] temp = {s}; +// list.add(temp); +// } +// String[][] str = list.toArray(new String[list.size()][1]); +// RwJComboBox jComboBox = new RwJComboBox(str); +// jComboBox.setEditable(true); +// jComboBox.setSelectedIndex(0); +// System.out.println(jComboBox.getSelectedItem().toString()); +//// jComboBox.setPreferredSize(new java.awt.Dimension(400, 60)); +// javax.swing.JTextField jTextField = new javax.swing.JTextField(40); +// // Խ¼ +// MyTable table = new MyTable(); +// jComboBox.addActionListener(new ActionListener() { +// +// @Override +// public void actionPerformed(ActionEvent e) { +// // TODO Auto-generated method stub +// System.out.println("========"); +// System.out.println(jComboBox.getSelectedItem().toString()); +// System.out.println(table.getValueAt(0, 0)); +// System.out.println("========="); +// } +// }); +// String [] tzHeader = {"1","2"}; +// DefaultTableModel tzModel = new DefaultTableModel(null, tzHeader); +// table.setModel(tzModel); +// tzModel.addRow(new String[] {}); +// table.setComboCell(0, 0, new DefaultCellEditor(jComboBox)); +// JScrollPane jScrollPane = new JScrollPane(table); +// javax.swing.JFrame frame = new javax.swing.JFrame(); +// frame.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 20, 20)); +// frame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE); +// frame.setSize(500, 500); +// frame.setLocationRelativeTo(null); +//// frame.add(jComboBox); +// frame.add(jTextField); +// frame.add(jScrollPane); +// frame.setVisible(true); +// } + protected java.util.Set set = new java.util.HashSet(); + + public RwJComboBox(String str[][]) { + setModel(new RwDefaultComboBoxModel(str)); + setUI(new RwMetalComboBoxUI(this)); + setRenderer(new RwJCheckBox()); + setSelectedIndex(-1); + ((javax.swing.JTextField)getEditor().getEditorComponent()).setEditable(false); +// ֹ༭Ĵ + } + + public void focusGained(java.awt.event.FocusEvent e) { + } + + public void focusLost(java.awt.event.FocusEvent e) { +// һµʹ÷ +// java.awt.Container container=(java.awt.Container)getEditor().getEditorComponent(); +// while(container!=null&&!(container instanceof javax.swing.JLabel)) +// { +// container=container.getParent(); +// } +// ((cLabel)container).setValue(((javax.swing.JTextField)getEditor().getEditorComponent()).getText()); + } + + public static class RwMetalComboBoxUI extends javax.swing.plaf.metal.MetalComboBoxUI { + private RwMetalComboBoxUI(RwJComboBox rwJComboBox) { + this.comboBox = rwJComboBox; + } + + protected javax.swing.plaf.basic.ComboPopup createPopup() { + return new RwBasicComboPopup(comboBox); + } + } + + public static class RwBasicComboPopup extends javax.swing.plaf.basic.BasicComboPopup { + public RwBasicComboPopup(javax.swing.JComboBox combo) { + super(combo); + } + + protected void configureList() { + super.configureList(); + list.setSelectionModel(new RwDefaultListSelectionModel(comboBox)); + } + + protected java.awt.event.MouseListener createListMouseListener() { + return new RwMouseAdapter(list, comboBox); + } + } + + private static class RwDefaultListSelectionModel extends javax.swing.DefaultListSelectionModel { + protected RwJComboBox rwJComboBox; + + public RwDefaultListSelectionModel(javax.swing.JComboBox comboBox) { + this.rwJComboBox = (RwJComboBox) comboBox; + } + + public boolean isSelectedIndex(int index) { + return rwJComboBox.set.contains(index); + } + } + + private static class RwMouseAdapter extends java.awt.event.MouseAdapter { + protected javax.swing.JList list; + protected RwJComboBox rwJComboBox; + + private RwMouseAdapter(javax.swing.JList list, javax.swing.JComboBox comboBox) { + this.list = list; + this.rwJComboBox = (RwJComboBox) comboBox; + } + + public void mousePressed(java.awt.event.MouseEvent anEvent) { + StringBuilder sb, sb1, sb2, sb3; + int k, index; + index = list.getSelectedIndex(); + javax.swing.JTextField jTextField = (javax.swing.JTextField) rwJComboBox.getEditor().getEditorComponent(); + sb = new StringBuilder(jTextField.getText()); + + if (sb.length() > 0 && ',' != sb.charAt(0)) + sb.insert(0, ","); + if (sb.length() > 0 && ',' != sb.charAt(sb.length() - 1)) + sb.append(","); + if (sb.length() > 0 && ",".equals(sb.toString())) + sb = new StringBuilder(); + if (list.getSelectionMode() == javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION) { + if (rwJComboBox.set.contains(index)) { + rwJComboBox.set.remove(index); + sb1 = new StringBuilder(); + sb1.append(",").append(rwJComboBox.getModel().getElementAt(index)).append(","); + k = sb.indexOf(sb1.toString()); + while (k != -1) { + sb.replace(k, k + sb1.length(), ","); + k = sb.indexOf(sb1.toString()); + } + } else { + rwJComboBox.set.add(index); + if (sb.length() == 0) + sb.append(",").append(rwJComboBox.getModel().getElementAt(index)).append(","); + else + sb.append(rwJComboBox.getModel().getElementAt(index)).append(","); + } + } else { + if (!rwJComboBox.set.contains(index)) { + rwJComboBox.set.clear(); + rwJComboBox.set.add(index); + } + } + Object obj; + sb2 = new StringBuilder(sb); + // 滻Ŀѡֵ + for (int i = 0; i < list.getModel().getSize(); i++) { + obj = list.getModel().getElementAt(i); + sb1 = new StringBuilder(); + sb1.append(",").append(obj).append(","); + k = sb2.indexOf(sb1.toString()); + while (k != -1) { + sb2.replace(k, k + sb1.length(), ","); + k = sb2.indexOf(sb1.toString()); + } + } + java.util.List list1 = new java.util.ArrayList(rwJComboBox.set); + java.util.Collections.sort(list1); + for (int i = 0; i < list1.size(); i++) { + obj = rwJComboBox.getModel().getElementAt(Integer.parseInt(list1.get(i).toString())); + sb1 = new StringBuilder(); + sb1.append(",").append(obj).append(","); + k = sb.indexOf(sb1.toString()); + if (k != -1 && sb2.indexOf(sb1.toString()) == -1) { + sb2.append(obj).append(","); + } + } + sb = new StringBuilder(sb2); + if (sb.length() > 0 && ',' == sb.charAt(0)) + sb.deleteCharAt(0); + if (sb.length() > 0 && ',' == sb.charAt(sb.length() - 1)) + sb.deleteCharAt(sb.length() - 1); + if (sb.length() > 0 && ",".equals(sb.toString())) + sb = new StringBuilder(); + jTextField.setText(sb.toString()); + // java.awt.Container container =jTextField; + // while(container!=null&&!(container instanceof javax.swing.JLabel)) + // { + // container=container.getParent(); + // } + // ((cLabel)container).setValue(sb.toString()); + rwJComboBox.repaint(); + list.repaint(); + } + } + + public static class RwDefaultComboBoxModel extends javax.swing.DefaultComboBoxModel { + private RwDefaultComboBoxModel(String[][] str) { + for (int i = 0; i < str.length; i++) + addElement(str[i][0]); + } + } + + public static class RwJCheckBox extends javax.swing.JCheckBox implements javax.swing.ListCellRenderer { + public java.awt.Component getListCellRendererComponent(javax.swing.JList list, Object value, int index, + boolean isSelected, boolean cellHasFocus) { + setComponentOrientation(list.getComponentOrientation()); + if (isSelected) { + setBackground(list.getSelectionBackground()); + setForeground(list.getSelectionForeground()); + } else { + setBackground(list.getBackground()); + setForeground(list.getForeground()); + } + setEnabled(list.isEnabled()); + setSelected(isSelected); + setText(value == null ? "" : value.toString()); + setFont(list.getFont()); + return this; + } + } +// static class MyTable extends JTable { +// int myRow = -1, myCol = -1; +// TableCellEditor myEditor; +// Map map = new HashMap(); +// +// public void setComboCell(int r, int c, TableCellEditor ce) { +// this.myRow = r; +// this.myCol = c; +// this.myEditor = ce; +// map.put(new Point(r, c), ce); +// } +// +// @Override +// public TableCellEditor getCellEditor(int row, int column) { +// System.out.println(row + "," + column + ";" + myRow + "," + myCol + "," + myEditor); +// +// Point point = new Point(row, column); +// if (map.containsKey(point)) { +// return map.get(point); +// } else { +// return super.getCellEditor(row, column); +// } +// } +// } +} diff --git a/src/com/connor/zf/util/SoaServerUtil.java b/src/com/connor/zf/util/SoaServerUtil.java new file mode 100644 index 0000000..4d7ce95 --- /dev/null +++ b/src/com/connor/zf/util/SoaServerUtil.java @@ -0,0 +1,343 @@ +package com.connor.zf.util; + +import java.util.List; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMNamespace; +import org.apache.axis2.AxisFault; +import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.client.Options; +import org.apache.axis2.client.ServiceClient; +import org.apache.axis2.transport.http.HTTPConstants; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCAccessControlService; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCComponentUserType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCUserService; + +import net.sf.json.JSONArray; + +/** + * ͷUtil + * @author 61666 + * + */ +public class SoaServerUtil { + + public static void sendToClass(String wsoPUID, String classID, String json, String url) { + // AbstractAIFApplication app; + // app=AIFUtility.getCurrentApplication(); + // TCSession session; + // session=(TCSession) app.getSession(); + // TCPreferenceService preferenceService; + // preferenceService=session.getPreferenceService(); + // String account=preferenceService.getStringValue("Autocode_PriverUser_ID"); + // String url; + // url = preferenceService.getStringValue("Autocode_SendClassServer_URL"); + try { + ServiceClient sc = new ServiceClient(); + Options opts = new Options(); + // url = "http://10.201.5.203:19090/ErpWebService.asmx?WSDL"; + EndpointReference end = new EndpointReference(url); + opts.setTo(end); + opts.setAction("SendToClass"); + sc.setOptions(opts); + + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMNamespace omNs = fac.createOMNamespace("http://tempuri.org/", ""); + OMElement method = fac.createOMElement("SendToClass", omNs); + OMElement value = fac.createOMElement("wsoPuiid", omNs); + value.setText(wsoPUID); + OMElement value1 = fac.createOMElement("classID", omNs); + value1.setText(classID); + OMElement value2 = fac.createOMElement("JsonContainer", omNs); + // "[{\"value\":\"1\",\"propertyID\":-500003},{\"value\":\"1\",\"propertyID\":-500011}]" + value2.setText(json); + + method.addChild(value); + method.addChild(value1); + method.addChild(value2); + + OMElement res = sc.sendReceive(method); + res.getFirstElement().getText(); + System.out.println(res.getFirstElement().getText()); + } catch (AxisFault e) { + e.printStackTrace(); + } + + } + + public static String updateToClass(String wsoPUID, String classID, String json, String url, String icoUid) { + // AbstractAIFApplication app; + // app=AIFUtility.getCurrentApplication(); + // TCSession session; + // session=(TCSession) app.getSession(); + // TCPreferenceService preferenceService; + // preferenceService=session.getPreferenceService(); + // String account=preferenceService.getStringValue("Autocode_PriverUser_ID"); + // String url; + // url = preferenceService.getStringValue("Autocode_SendClassServer_URL"); + String reMsgString=""; + try { + ServiceClient sc = new ServiceClient(); + Options opts = new Options(); + // url = "http://10.201.5.203:19090/ErpWebService.asmx?WSDL"; + EndpointReference end = new EndpointReference(url); + opts.setTo(end); + opts.setAction("UpdateToClass"); + sc.setOptions(opts); + + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMNamespace omNs = fac.createOMNamespace("http://tempuri.org/", ""); + OMElement method = fac.createOMElement("UpdateToClass", omNs); + OMElement value = fac.createOMElement("wsoPuiid", omNs); + value.setText(wsoPUID); + OMElement value1 = fac.createOMElement("classID", omNs); + value1.setText(classID); + OMElement value2 = fac.createOMElement("JsonContainer", omNs); + + OMElement value3 = fac.createOMElement("icoPUID", omNs); + // "[{\"value\":\"1\",\"propertyID\":-500003},{\"value\":\"1\",\"propertyID\":-500011}]" + value2.setText(json); + value3.setText(icoUid); + + method.addChild(value); + method.addChild(value1); + method.addChild(value2); + method.addChild(value3); + OMElement res = sc.sendReceive(method); + reMsgString=res.getFirstElement().getText(); + System.out.println(res.getFirstElement().getText()); + + } catch (AxisFault e) { + e.printStackTrace(); + } + + return reMsgString; + + } + public static void deleteAndSendToClass(String icoPUID,String wsoPUID, String classID, String json, String url) { + // AbstractAIFApplication app; + // app=AIFUtility.getCurrentApplication(); + // TCSession session; + // session=(TCSession) app.getSession(); + // TCPreferenceService preferenceService; + // preferenceService=session.getPreferenceService(); + // String account=preferenceService.getStringValue("Autocode_PriverUser_ID"); + // String url; + // url = preferenceService.getStringValue("Autocode_SendClassServer_URL"); + try { + ServiceClient sc = new ServiceClient(); + Options opts = new Options(); + // url = "http://10.201.5.203:19090/ErpWebService.asmx?WSDL"; + EndpointReference end = new EndpointReference(url); + opts.setTo(end); + opts.setAction("SendToClass"); + sc.setOptions(opts); + + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMNamespace omNs = fac.createOMNamespace("http://tempuri.org/", ""); + OMElement method = fac.createOMElement("editToClass", omNs); + OMElement icovalue = fac.createOMElement("icoPUID", omNs); + icovalue.setText(icoPUID); + OMElement value = fac.createOMElement("wsoPuiid", omNs); + value.setText(wsoPUID); + OMElement value1 = fac.createOMElement("classID", omNs); + value1.setText(classID); + OMElement value2 = fac.createOMElement("JsonContainer", omNs); + // "[{\"value\":\"1\",\"propertyID\":-500003},{\"value\":\"1\",\"propertyID\":-500011}]" + value2.setText(json); + method.addChild(icovalue); + method.addChild(value); + method.addChild(value1); + method.addChild(value2); + + OMElement res = sc.sendReceive(method); + res.getFirstElement().getText(); + System.out.println(res.getFirstElement().getText()); + } catch (AxisFault e) { + e.printStackTrace(); + } + + } + // public static void main(String[] args) { + // deleteClass("1111", ""); + // } + // ɾʱ + public static void deleteClass(String icoPUID, String url) { + try { + ServiceClient sc = new ServiceClient(); + Options opts = new Options(); + // url = "http://10.201.5.203:19090/ErpWebService.asmx?WSDL";//TODO + // ѡAutocode_SendClassServer_URL + // url = preferenceService.getStringValue("Autocode_SendClassServer_URL");//TODO + // ѡAutocode_SendClassServer_URL + EndpointReference end = new EndpointReference(url); + opts.setTo(end); + opts.setAction("DeleteClass"); + opts.setProperty(HTTPConstants.CHUNKED, "false"); + sc.setOptions(opts); + + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMNamespace omNs = fac.createOMNamespace("http://tempuri.org/", ""); + OMElement method = fac.createOMElement("DeleteClass", omNs); + OMElement value = fac.createOMElement("icoPuid", omNs); + value.setText(icoPUID); + // OMElement value1 = fac.createOMElement("classID", omNs); + //// value1.setText(classID); + // OMElement value2 = fac.createOMElement("JsonContainer", omNs); + // "[{\"value\":\"1\",\"propertyID\":-500003},{\"value\":\"1\",\"propertyID\":-500011}]" + // value2.setText(json); + + method.addChild(value); + // method.addChild(value1); + // method.addChild(value2); + + OMElement res = sc.sendReceive(method); + res.getFirstElement().getText(); + System.out.println(res.getFirstElement().getText()); + } catch (AxisFault e) { + e.printStackTrace(); + } + + } + + public static String objectToJson(List props) { + String str = null; + try { + JSONArray json = JSONArray.fromObject(props);// javaתΪjson + str = json.toString();// jsonתΪַ + } catch (Exception e) { + e.printStackTrace(); + } + System.out.println("JSON =>" + str); + return str; + } + + public static void grantReadPrivilege(TCSession tcSession, TCComponent tccomponent) { + AbstractAIFApplication app; + app = AIFUtility.getCurrentApplication(); + TCSession session; + session = (TCSession) app.getSession(); + TCPreferenceService preferenceService; + preferenceService = session.getPreferenceService(); + String account = preferenceService.getStringValue("Autocode_PriverUser_ID"); + try { + TCAccessControlService accessControlService = tcSession.getTCAccessControlService(); + TCComponentUserType type = (TCComponentUserType) tcSession.getTypeComponent("User"); + TCComponentUser user = type.find(account); + + if (user == null) { + return; + } + if (tcSession.getUser().equals(user)) { + return; + } + + String[] as2 = new String[] { "READ" }; + + if (tccomponent instanceof TCComponentItemRevision) { + TCComponentItem tempItem = ((TCComponentItemRevision) tccomponent).getItem(); + openByPass(tcSession); + accessControlService.grantPrivilege(tempItem, user, as2); + closeByPass(tcSession); + + openByPass(tcSession); + accessControlService.grantPrivilege(tccomponent, user, as2); + closeByPass(tcSession); + } else { + openByPass(tcSession); + accessControlService.grantPrivilege(tccomponent, user, as2); + closeByPass(tcSession); + } + } catch (TCException e) { + e.printStackTrace(); + } + } + + public static void grantWritePrivilege(TCSession tcSession, TCComponent tccomponent) { + AbstractAIFApplication app; + app = AIFUtility.getCurrentApplication(); + TCSession session; + session = (TCSession) app.getSession(); + TCPreferenceService preferenceService; + preferenceService = session.getPreferenceService(); + String account = preferenceService.getStringValue("Autocode_PriverUser_ID"); + try { + TCAccessControlService accessControlService = tcSession.getTCAccessControlService(); + TCComponentUserType type = (TCComponentUserType) tcSession.getTypeComponent("User"); + + TCComponentUser user = type.find(account); + if (user == null) { + return; + } + if (tcSession.getUser().equals(user)) { + return; + } + + String[] as2 = new String[] { "READ", "WRITE", "DELETE" }; + + if (tccomponent instanceof TCComponentItemRevision) { + TCComponentItem tempItem = ((TCComponentItemRevision) tccomponent).getItem(); + setByPass(true,tcSession); + accessControlService.grantPrivilege(tempItem, user, as2); + setByPass(false,tcSession); + + setByPass(true,tcSession); + accessControlService.grantPrivilege(tccomponent, user, as2); + setByPass(false,tcSession); + } else { + setByPass(true,tcSession); + accessControlService.grantPrivilege(tccomponent, user, as2); + setByPass(false,tcSession); + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public static void openByPass(TCSession session) throws TCException { + TCUserService userservice = session.getUserService(); + Object[] obj = new Object[1]; + obj[0] = ""; + userservice.call("Connor_set_bypass", obj); + } + + public static void closeByPass(TCSession session) throws TCException { + TCUserService userservice = session.getUserService(); + Object[] obj = new Object[1]; + obj[0] = ""; + userservice.call("Connor_close_bypass", obj); + +// session.getUserService().call("Connor_set_bypass", new Object[]{});//bypass +// session.getUserService().call("Connor_close_bypass", new Object[]{});//bypass + } + public static void setByPass(boolean val,TCSession session) throws TCException { + TCUserService userservice = session.getUserService(); + if (userservice == null) { + userservice = session.getUserService(); + } + Object[] obj = new Object[1]; + obj[0] = "origin"; + if (val) { +// userservice.call("ORIGIN_set_bypass", obj); + userservice.call("Connor_set_bypass", obj); + } else { +// userservice.call("ORIGIN_close_bypass", obj); + userservice.call("Connor_close_bypass", obj); + } + } + +} + diff --git a/src/com/connor/zf/util/StringCreateUtil.java b/src/com/connor/zf/util/StringCreateUtil.java new file mode 100644 index 0000000..0d31ff0 --- /dev/null +++ b/src/com/connor/zf/util/StringCreateUtil.java @@ -0,0 +1,21 @@ +package com.connor.zf.util; + +public class StringCreateUtil { + public static String createBlank(int num) { + StringBuilder sb = new StringBuilder(); + while (num > 0) { + sb.append(" "); + num--; + } + return sb.toString(); + } + + public static String createPoint(int num) { + StringBuilder sb = new StringBuilder(); + while (num > 0) { + sb.append("."); + num--; + } + return sb.toString(); + } +}