commit
7435655f67
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry exported="true" kind="lib" path="poi_lib/commons-io-1.4.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="poi_lib/antlr-2.7.7.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="poi_lib/axis2-ant-plugin-1.6.2.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="poi_lib/aspose-words-17.4.0-jdk16.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="poi_lib/commons-collections4-4.1.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="poi_lib/poi-3.17.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="poi_lib/poi-examples-3.17.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="poi_lib/poi-excelant-3.17.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="poi_lib/poi-ooxml-3.17.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="poi_lib/poi-ooxml-schemas-3.17.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="poi_lib/poi-scratchpad-3.17.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="poi_lib/xmlbeans-2.6.0.jar"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>com.connor.plm</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.pde.PluginNature</nature>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
@ -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
|
@ -0,0 +1,38 @@
|
|||||||
|
Manifest-Version: 1.0
|
||||||
|
Bundle-ManifestVersion: 2
|
||||||
|
Bundle-Name: Plm
|
||||||
|
Bundle-SymbolicName: com.connor.plm;singleton:=true
|
||||||
|
Bundle-Version: 1.0.0
|
||||||
|
Bundle-Vendor: CONNOR
|
||||||
|
Require-Bundle: org.eclipse.ui,
|
||||||
|
org.eclipse.core.runtime,
|
||||||
|
com.teamcenter.rac.aifrcp,
|
||||||
|
com.teamcenter.rac.kernel,
|
||||||
|
com.teamcenter.rac.util,
|
||||||
|
com.teamcenter.rac.common,
|
||||||
|
com.teamcenter.rac.tcapps,
|
||||||
|
TcSoaCoreRac;bundle-version="12000.3.0",
|
||||||
|
com.teamcenter.rac.ui;bundle-version="12000.3.0",
|
||||||
|
org.eclipse.osgi.services;bundle-version="3.7.100",
|
||||||
|
org.eclipse.osgi.util;bundle-version="3.5.100",
|
||||||
|
com.teamcenter.rac.pca.kernel;bundle-version="12000.3.0",
|
||||||
|
com.teamcenter.rac.workflow.processdesigner;bundle-version="12000.3.0",
|
||||||
|
TcSoaWorkflowRac;bundle-version="12000.3.0",
|
||||||
|
com.teamcenter.rac.workflow;bundle-version="12000.3.0",
|
||||||
|
com.teamcenter.rac.workflow.processviewer;bundle-version="12000.3.0",
|
||||||
|
TcSoaWorkflowLoose;bundle-version="12000.3.0"
|
||||||
|
Automatic-Module-Name: com.connor.plm
|
||||||
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
|
Bundle-ClassPath: poi_lib/aspose-words-17.4.0-jdk16.jar,
|
||||||
|
poi_lib/commons-collections4-4.1.jar,
|
||||||
|
poi_lib/poi-3.17.jar,
|
||||||
|
poi_lib/poi-examples-3.17.jar,
|
||||||
|
poi_lib/poi-excelant-3.17.jar,
|
||||||
|
poi_lib/poi-ooxml-3.17.jar,
|
||||||
|
poi_lib/poi-ooxml-schemas-3.17.jar,
|
||||||
|
poi_lib/poi-scratchpad-3.17.jar,
|
||||||
|
poi_lib/xmlbeans-2.6.0.jar,
|
||||||
|
.,
|
||||||
|
poi_lib/axis2-ant-plugin-1.6.2.jar,
|
||||||
|
poi_lib/antlr-2.7.7.jar,
|
||||||
|
poi_lib/commons-io-1.4.jar
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,58 @@
|
|||||||
|
#
|
||||||
|
#Thu Jan 21 10:28:16 CST 2021
|
||||||
|
createscheduledeliverable.ERROR2=\u4E3A [%s] \u521B\u5EFA\u65F6\u95F4\u8868\u4EA4\u4ED8\u7269 [%s] \u5931\u8D25
|
||||||
|
project=Project
|
||||||
|
dsuidinpref.ERROR1=Error dataset uid set in preference\: %s
|
||||||
|
valuenotinlov.ERROR2=LOV "%s" does not contain value\: %s
|
||||||
|
writedata=Write Data
|
||||||
|
querynotexist.ERROR1=Query not exist\: %s
|
||||||
|
dialoginit.ERROR=Init Error
|
||||||
|
preferror.ERROR1=Preference error\: %s
|
||||||
|
norefindataset.ERROR1=Download file from dataset "%s" failed. No ref file.
|
||||||
|
cancel=Cancel
|
||||||
|
exeop.STATUS=Execute...
|
||||||
|
initop.STATUS=Checking Data...
|
||||||
|
noflowkey.ERROR=Missing key for flow number.
|
||||||
|
wordfield_pagecount.NAME=\u9875\u6570
|
||||||
|
nopropintype.ERROR2=Property is not defined in type "%s"\: %s.
|
||||||
|
getflowno.ERROR1=Error getting new flow number for key\: %s
|
||||||
|
formsave.ERRORTITLE=Error Saving Data
|
||||||
|
wordfield_pageno.NAME=\u9875\u7801
|
||||||
|
wordfield_totalpagenominus1.NAME=\u603B\u9875\u7801\u51CF\u4E00
|
||||||
|
wordfield_totalpagecount.NAME=\u603B\u9875\u6570
|
||||||
|
exceltitlenorelateinfo.ERROR=Title row in sheet does not have any relation info.
|
||||||
|
selectProject=Select Project
|
||||||
|
proplocationnotdefined.ERROR1=\u672A\u77E5\u5C5E\u6027\u4F4D\u7F6E\u201C%s\u201D\uFF0C\u8BF7\u68C0\u67E5\u914D\u7F6E
|
||||||
|
excelnotitle.ERROR=Can't find title row in excel sheet.
|
||||||
|
loadCompFromUid.Error2=Error loading component "%s", UID \= "%s".
|
||||||
|
uploadfilewhencheckout.ERROR1=Dataset "%s" is checked out. Upload file failed.
|
||||||
|
wordfield_totalactualpagecountminus1.NAME=\u603B\u5B9E\u9645\u9875\u6570\u51CF\u4E00
|
||||||
|
nodatainfile.ERROR1=No Data in File\: %s
|
||||||
|
noexportdata.ERROR=\u6CA1\u6709\u6570\u636E\u53EF\u4EE5\u5BFC\u51FA
|
||||||
|
notscheduleadmin.INFO=\u53EA\u6709\u534F\u8C03\u8005\u624D\u80FD\u64CD\u4F5C
|
||||||
|
error=Error
|
||||||
|
mergefile=Merge File...
|
||||||
|
index=Index
|
||||||
|
forminit.ERRORTITLE=Error Loading Rendering
|
||||||
|
ok=OK
|
||||||
|
wordfield_totalactualpagecount.NAME=\u603B\u5B9E\u9645\u9875\u6570
|
||||||
|
requireprop.INFO1=\u8BF7\u586B\u5199\u5C5E\u6027\uFF1A%s
|
||||||
|
functionnotavailable.INFO=\u6B64\u5BF9\u8C61\u4E0D\u53EF\u4F7F\u7528\u6B64\u529F\u80FD
|
||||||
|
multiuserbyid.ERROR1=Find multiple users by id\: %s
|
||||||
|
preparedata=Prepare Data
|
||||||
|
dbconn.ERROR=Connect to database failed.
|
||||||
|
typenotfound.ERROR1=Type not found\: %s
|
||||||
|
filenotexist.ERROR1=File not exist\: %s
|
||||||
|
wordfield_totalpagecountminus1.NAME=\u603B\u9875\u6570\u51CF\u4E00
|
||||||
|
readdata=Read Data
|
||||||
|
clearcache=Clear Cache
|
||||||
|
exportsuccess.INFO=Export Complete.
|
||||||
|
uploadfile=Upload File
|
||||||
|
propnotdefinedintype.ERROR2=\u5BF9\u8C61\u7C7B\u578B\u201C%s\u201D\u672A\u5B9A\u4E49\u5C5E\u6027\uFF1A%s
|
||||||
|
foldernotexist.ERROR1=Folder not exist\: %s
|
||||||
|
info=Info
|
||||||
|
wordfield_totalpageno.NAME=\u603B\u9875\u7801
|
||||||
|
multiuserbyname.ERROR1=Find multiple users by name\: %s
|
||||||
|
exportopenfile.INFO=Export complete. Open file?
|
||||||
|
prefnotconfiged.ERROR1=Prefernce not found\: %s
|
||||||
|
export=Export
|
@ -0,0 +1,58 @@
|
|||||||
|
#
|
||||||
|
#Thu Jan 21 10:28:16 CST 2021
|
||||||
|
createscheduledeliverable.ERROR2=\u4E3A [%s] \u521B\u5EFA\u65F6\u95F4\u8868\u4EA4\u4ED8\u7269 [%s] \u5931\u8D25
|
||||||
|
project=\u9879\u76EE
|
||||||
|
dsuidinpref.ERROR1=\u8BF7\u68C0\u67E5\u9996\u9009\u9879<%s>\uFF0C\u901A\u8FC7\u914D\u7F6EUID\u672A\u627E\u5230\u6570\u636E\u96C6
|
||||||
|
valuenotinlov.ERROR2=LOV "%s" \u4E2D\u672A\u5B9A\u4E49\u6570\u503C\uFF1A%s
|
||||||
|
writedata=\u5199\u5165\u6570\u636E
|
||||||
|
querynotexist.ERROR1=\u67E5\u8BE2\u4E0D\u5B58\u5728\uFF1A%s
|
||||||
|
dialoginit.ERROR=\u521D\u59CB\u5316\u5F02\u5E38
|
||||||
|
preferror.ERROR1=\u9996\u9009\u9879\u914D\u7F6E\u9519\u8BEF\uFF1A%s
|
||||||
|
norefindataset.ERROR1=\u4ECE\u6570\u636E\u96C6\u201C%s\u201D\u4E0B\u8F7D\u6587\u4EF6\u5931\u8D25\uFF0C\u6CA1\u6709\u627E\u5230\u5F15\u7528\u6587\u4EF6\u3002
|
||||||
|
cancel=\u53D6\u6D88
|
||||||
|
exeop.STATUS=\u6B63\u5728\u6267\u884C...
|
||||||
|
initop.STATUS=\u68C0\u67E5\u6570\u636E...
|
||||||
|
noflowkey.ERROR=\u6D41\u6C34\u7801\u952E\u503C\u4E0D\u53EF\u4E3A\u7A7A
|
||||||
|
wordfield_pagecount.NAME=\u9875\u6570
|
||||||
|
nopropintype.ERROR2=\u5BF9\u8C61\u7C7B\u578B\u201C%s\u201D\u4E0D\u5B58\u5728\u5C5E\u6027\uFF1A%s
|
||||||
|
getflowno.ERROR1=\u83B7\u53D6\u6D41\u6C34\u7801\u5931\u8D25\uFF1A%s
|
||||||
|
formsave.ERRORTITLE=\u4FDD\u5B58\u6570\u636E\u51FA\u9519
|
||||||
|
wordfield_pageno.NAME=\u9875\u7801
|
||||||
|
wordfield_totalpagenominus1.NAME=\u603B\u9875\u7801\u51CF\u4E00
|
||||||
|
wordfield_totalpagecount.NAME=\u603B\u9875\u6570
|
||||||
|
exceltitlenorelateinfo.ERROR=\u6807\u9898\u884C\u6CA1\u6709\u89E3\u6790\u5230\u6620\u5C04\u5185\u5BB9
|
||||||
|
selectProject=\u9009\u62E9\u9879\u76EE
|
||||||
|
proplocationnotdefined.ERROR1=\u672A\u77E5\u5C5E\u6027\u4F4D\u7F6E\u201C%s\u201D\uFF0C\u8BF7\u68C0\u67E5\u914D\u7F6E
|
||||||
|
excelnotitle.ERROR=\u672A\u627E\u5230\u5DE5\u4F5C\u8868\u4E2D\u7684\u6807\u9898\u884C
|
||||||
|
loadCompFromUid.Error2=\u52A0\u8F7D\u5BF9\u8C61\u201C%s\u201D\u5931\u8D25\uFF0CUID\=\u201C%s\u201D\u3002
|
||||||
|
uploadfilewhencheckout.ERROR1=\u6570\u636E\u96C6\u201C%s\u201D\u5DF2\u7B7E\u51FA\uFF0C\u4E0A\u4F20\u6587\u4EF6\u5931\u8D25\u3002\u8BF7\u7B7E\u5165\u540E\u518D\u8FDB\u884C\u64CD\u4F5C\u3002
|
||||||
|
wordfield_totalactualpagecountminus1.NAME=\u603B\u5B9E\u9645\u9875\u6570\u51CF\u4E00
|
||||||
|
nodatainfile.ERROR1=\u6587\u4EF6\u4E2D\u6CA1\u6709\u6570\u636E\uFF1A%s
|
||||||
|
noexportdata.ERROR=\u6CA1\u6709\u6570\u636E\u53EF\u4EE5\u5BFC\u51FA
|
||||||
|
notscheduleadmin.INFO=\u53EA\u6709\u534F\u8C03\u8005\u624D\u80FD\u64CD\u4F5C
|
||||||
|
error=\u9519\u8BEF
|
||||||
|
mergefile=\u5408\u5E76\u6587\u4EF6
|
||||||
|
index=\u5E8F\u53F7
|
||||||
|
forminit.ERRORTITLE=\u521D\u59CB\u5316\u754C\u9762\u5F02\u5E38
|
||||||
|
ok=\u786E\u5B9A
|
||||||
|
wordfield_totalactualpagecount.NAME=\u603B\u5B9E\u9645\u9875\u6570
|
||||||
|
requireprop.INFO1=\u8BF7\u586B\u5199\u5C5E\u6027\uFF1A%s
|
||||||
|
functionnotavailable.INFO=\u6B64\u5BF9\u8C61\u4E0D\u53EF\u4F7F\u7528\u6B64\u529F\u80FD
|
||||||
|
multiuserbyid.ERROR1=\u901A\u8FC7id\u67E5\u8BE2\u5230\u591A\u4E2A\u7528\u6237\uFF1A%s
|
||||||
|
preparedata=\u51C6\u5907\u6570\u636E
|
||||||
|
dbconn.ERROR=\u8FDE\u63A5\u6570\u636E\u5E93\u5931\u8D25\u3002
|
||||||
|
typenotfound.ERROR1=\u672A\u627E\u5230\u7C7B\u578B\uFF1A%s
|
||||||
|
filenotexist.ERROR1=\u6587\u4EF6\u4E0D\u5B58\u5728\uFF1A%s
|
||||||
|
wordfield_totalpagecountminus1.NAME=\u603B\u9875\u6570\u51CF\u4E00
|
||||||
|
readdata=\u8BFB\u53D6\u6570\u636E
|
||||||
|
clearcache=\u6E05\u7406\u7F13\u5B58
|
||||||
|
exportsuccess.INFO=\u5BFC\u51FA\u5B8C\u6210
|
||||||
|
uploadfile=\u4E0A\u4F20\u6587\u4EF6
|
||||||
|
propnotdefinedintype.ERROR2=\u5BF9\u8C61\u7C7B\u578B\u201C%s\u201D\u672A\u5B9A\u4E49\u5C5E\u6027\uFF1A%s
|
||||||
|
foldernotexist.ERROR1=\u6587\u4EF6\u5939\u4E0D\u5B58\u5728\uFF1A%s
|
||||||
|
info=\u63D0\u793A
|
||||||
|
wordfield_totalpageno.NAME=\u603B\u9875\u7801
|
||||||
|
multiuserbyname.ERROR1=\u901A\u8FC7\u59D3\u540D\u67E5\u8BE2\u5230\u591A\u4E2A\u7528\u6237\uFF1A%s
|
||||||
|
exportopenfile.INFO=\u5BFC\u51FA\u5B8C\u6210\uFF0C\u6253\u5F00\u6587\u4EF6\uFF1F
|
||||||
|
prefnotconfiged.ERROR1=\u672A\u914D\u7F6E\u9996\u9009\u9879\uFF1A%s
|
||||||
|
export=\u5BFC\u51FA
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,7 @@
|
|||||||
|
selectDataset=Please select a dataset
|
||||||
|
warn=warn
|
||||||
|
ok=ok
|
||||||
|
err=err
|
||||||
|
revisedSuccessful=save successfully
|
||||||
|
revisionFailed=save failed
|
||||||
|
cel=cancel
|
@ -0,0 +1,7 @@
|
|||||||
|
selectDataset=\u8BF7\u9009\u4E2D\u6570\u636E\u96C6
|
||||||
|
warn=\u63D0\u9192
|
||||||
|
ok=\u786E\u8BA4
|
||||||
|
err=\u9519\u8BEF
|
||||||
|
revisedSuccessful=\u5907\u4EFD\u5B8C\u6210
|
||||||
|
revisionFailed=\u5907\u4EFD\u5931\u8D25
|
||||||
|
cel=\u53D6\u6D88
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,86 @@
|
|||||||
|
package com.net.connor.ld.plm.ld06;
|
||||||
|
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Polygon;
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
import javax.swing.Icon;
|
||||||
|
import javax.swing.RowSorter;
|
||||||
|
import javax.swing.RowSorter.SortKey;
|
||||||
|
import javax.swing.SortOrder;
|
||||||
|
import javax.swing.table.TableRowSorter;
|
||||||
|
|
||||||
|
import antlr.collections.List;
|
||||||
|
|
||||||
|
public class ArrowIcon implements Icon {
|
||||||
|
private final SortOrder sortOrder;
|
||||||
|
private final int size;
|
||||||
|
private final boolean ascending;
|
||||||
|
public ArrowIcon(TableRowSorter<?> sorter, int column, boolean ascending) {
|
||||||
|
this.ascending = ascending;
|
||||||
|
this.size = 12;
|
||||||
|
java.util.List<? extends SortKey> sortKeys = sorter.getSortKeys();
|
||||||
|
if (sortKeys.size() > 0 && ((RowSorter.SortKey) sortKeys.get(0)).getColumn() == column) {
|
||||||
|
this.sortOrder = ((RowSorter.SortKey) sortKeys.get(0)).getSortOrder();
|
||||||
|
} else {
|
||||||
|
this.sortOrder = SortOrder.ASCENDING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||||
|
Graphics2D g2 = (Graphics2D) g.create();
|
||||||
|
g2.translate(x, y);
|
||||||
|
if (ascending) {
|
||||||
|
g2.rotate(Math.PI, size / 2.0, size / 2.0);
|
||||||
|
}
|
||||||
|
if (sortOrder == SortOrder.ASCENDING) {
|
||||||
|
g2.draw(createUpTriangle(size));
|
||||||
|
} else {
|
||||||
|
g2.draw(createDownTriangle(size));
|
||||||
|
}
|
||||||
|
g2.dispose();
|
||||||
|
}
|
||||||
|
public int getIconWidth() {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
public int getIconHeight() {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
private Polygon createUpTriangle(int size) {
|
||||||
|
Polygon triangle = new Polygon();
|
||||||
|
triangle.addPoint(0, size);
|
||||||
|
triangle.addPoint(size / 2, 0);
|
||||||
|
triangle.addPoint(size, size);
|
||||||
|
return triangle;
|
||||||
|
}
|
||||||
|
private Polygon createDownTriangle(int size) {
|
||||||
|
Polygon triangle = new Polygon();
|
||||||
|
triangle.addPoint(0, 0);
|
||||||
|
triangle.addPoint(size, 0);
|
||||||
|
triangle.addPoint(size / 2, size);
|
||||||
|
return triangle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//表格列排序类
|
||||||
|
class ColumnSorter implements Comparator<Object> {
|
||||||
|
private final int col;
|
||||||
|
private final boolean ascending;
|
||||||
|
public ColumnSorter(int col, boolean ascending) {
|
||||||
|
this.col = col;
|
||||||
|
this.ascending = ascending;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int compare(Object a, Object b) {
|
||||||
|
if (a instanceof Comparable && b instanceof Comparable) {
|
||||||
|
if (ascending) {
|
||||||
|
return ((Comparable) a).compareTo((Comparable) b);
|
||||||
|
} else {
|
||||||
|
return ((Comparable) b).compareTo((Comparable) a);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Binary file not shown.
@ -0,0 +1,18 @@
|
|||||||
|
source.. = src/
|
||||||
|
output.. = bin/
|
||||||
|
bin.includes = plugin.xml,\
|
||||||
|
META-INF/,\
|
||||||
|
.,\
|
||||||
|
icons/,\
|
||||||
|
poi_lib/aspose-words-17.4.0-jdk16.jar,\
|
||||||
|
poi_lib/commons-collections4-4.1.jar,\
|
||||||
|
poi_lib/poi-3.17.jar,\
|
||||||
|
poi_lib/poi-examples-3.17.jar,\
|
||||||
|
poi_lib/poi-excelant-3.17.jar,\
|
||||||
|
poi_lib/poi-ooxml-3.17.jar,\
|
||||||
|
poi_lib/poi-ooxml-schemas-3.17.jar,\
|
||||||
|
poi_lib/poi-scratchpad-3.17.jar,\
|
||||||
|
poi_lib/xmlbeans-2.6.0.jar,\
|
||||||
|
poi_lib/axis2-ant-plugin-1.6.2.jar,\
|
||||||
|
poi_lib/antlr-2.7.7.jar,\
|
||||||
|
poi_lib/commons-io-1.4.jar
|
After Width: | Height: | Size: 332 B |
After Width: | Height: | Size: 526 B |
@ -0,0 +1,124 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<?eclipse version="3.4"?>
|
||||||
|
<plugin>
|
||||||
|
<!--菜单名称定义-->
|
||||||
|
<extension point="org.eclipse.ui.commands">
|
||||||
|
<command name="备份实施计划" id="com.connor.plm.sample.DatasetSaveAsHandler"> </command>
|
||||||
|
<command name="提取属性到Word/Excel" id="com.connor.plm.sb01.PropertyToWordOrExcelCommand"/>
|
||||||
|
<command name="派生更改请求ECR" id="com.connor.plm.sb02.DerivedChangeRequestCommand"/>
|
||||||
|
<command name="派生更改通知ECN" id="com.connor.plm.sb02.DerivedChangeNoticeCommand"/>
|
||||||
|
</extension>
|
||||||
|
<!--菜单跳转到对应程序-->
|
||||||
|
<extension point="org.eclipse.ui.handlers">
|
||||||
|
<handler
|
||||||
|
class="com.connor.plm.sample.DatasetSaveAsHandler"
|
||||||
|
commandId="com.connor.plm.sample.DatasetSaveAsHandler">
|
||||||
|
</handler>
|
||||||
|
<handler commandId="com.connor.plm.sb01.PropertyToWordOrExcelCommand" class="com.connor.plm.KHandler"/>
|
||||||
|
<handler commandId="com.connor.plm.sb02.DerivedChangeRequestCommand" class="com.connor.plm.KHandler"/>
|
||||||
|
<handler commandId="com.connor.plm.sb02.DerivedChangeNoticeCommand" class="com.connor.plm.KHandler"/>
|
||||||
|
</extension>
|
||||||
|
<!--菜单快捷键设置-->
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.ui.bindings">
|
||||||
|
<key
|
||||||
|
commandId="com.connor.plm.sample.DatasetSaveAsHandler"
|
||||||
|
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
|
||||||
|
contextId="org.eclipse.ui.contexts.window"
|
||||||
|
sequence="M1+6">
|
||||||
|
</key>
|
||||||
|
</extension>
|
||||||
|
<!--菜单显示位置设置-->
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.ui.menus">
|
||||||
|
<menuContribution
|
||||||
|
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
|
||||||
|
<menu
|
||||||
|
id="com.connor.plm.menus.sampleMenu"
|
||||||
|
label="世宝二开"
|
||||||
|
mnemonic="M">
|
||||||
|
<command
|
||||||
|
commandId="com.connor.plm.sample.DatasetSaveAsHandler"
|
||||||
|
id="com.connor.plm.sample.menus.DatasetSaveAsHandler"
|
||||||
|
mnemonic="S">
|
||||||
|
</command>
|
||||||
|
</menu>
|
||||||
|
</menuContribution>
|
||||||
|
<!-- 右键菜单 -->
|
||||||
|
<menuContribution
|
||||||
|
locationURI="popup:org.eclipse.ui.popup.any?after=additions">
|
||||||
|
<command
|
||||||
|
commandId="com.connor.plm.sample.DatasetSaveAsHandler"
|
||||||
|
id="com.connor.plm.sample.menus.DatasetSaveAsHandler"
|
||||||
|
mnemonic="S">
|
||||||
|
</command>
|
||||||
|
<command id="com.connor.plm.sb01.menus.PropertyToWordOrExcelCommand" commandId="com.connor.plm.sb01.PropertyToWordOrExcelCommand">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<and>
|
||||||
|
<iterate ifEmpty="false">
|
||||||
|
<adapt type="com.teamcenter.rac.kernel.TCComponent">
|
||||||
|
<or>
|
||||||
|
<test property="com.teamcenter.rac.kernel.TCComponent.typeClass"
|
||||||
|
value="ItemRevision">
|
||||||
|
</test>
|
||||||
|
</or>
|
||||||
|
</adapt>
|
||||||
|
</iterate>
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="com.connor.plm.sb01.PropertyToWordOrExcelCommand" />
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</and>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command id="com.connor.plm.sb02.menus.DerivedChangeRequestCommand" commandId="com.connor.plm.sb02.DerivedChangeRequestCommand">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<and>
|
||||||
|
<iterate ifEmpty="false">
|
||||||
|
<adapt type="com.teamcenter.rac.kernel.TCComponent">
|
||||||
|
<or>
|
||||||
|
<test property="com.teamcenter.rac.kernel.TCComponent.typeClass"
|
||||||
|
value="ItemRevision">
|
||||||
|
</test>
|
||||||
|
</or>
|
||||||
|
</adapt>
|
||||||
|
</iterate>
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="com.connor.plm.sb02.DerivedChangeRequestCommand" />
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</and>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command id="com.connor.plm.sb02.menus.DerivedChangeNoticeCommand" commandId="com.connor.plm.sb02.DerivedChangeNoticeCommand">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<and>
|
||||||
|
<iterate ifEmpty="false">
|
||||||
|
<adapt type="com.teamcenter.rac.kernel.TCComponent">
|
||||||
|
<or>
|
||||||
|
<test property="com.teamcenter.rac.kernel.TCComponent.typeClass"
|
||||||
|
value="ItemRevision">
|
||||||
|
</test>
|
||||||
|
</or>
|
||||||
|
</adapt>
|
||||||
|
</iterate>
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="com.connor.plm.sb02.DerivedChangeNoticeCommand" />
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</and>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
</menuContribution>
|
||||||
|
</extension>
|
||||||
|
|
||||||
|
</plugin>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,44 @@
|
|||||||
|
package com.connor.plm;
|
||||||
|
|
||||||
|
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||||
|
import org.osgi.framework.BundleContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The activator class controls the plug-in life cycle
|
||||||
|
*/
|
||||||
|
public class Activator extends AbstractUIPlugin {
|
||||||
|
|
||||||
|
// The plug-in ID
|
||||||
|
public static final String PLUGIN_ID = "cn.net.connor.ml.plm"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
// The shared instance
|
||||||
|
private static Activator plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The constructor
|
||||||
|
*/
|
||||||
|
public Activator() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(BundleContext context) throws Exception {
|
||||||
|
super.start(context);
|
||||||
|
plugin = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stop(BundleContext context) throws Exception {
|
||||||
|
plugin = null;
|
||||||
|
super.stop(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the shared instance
|
||||||
|
*
|
||||||
|
* @return the shared instance
|
||||||
|
*/
|
||||||
|
public static Activator getDefault() {
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package com.connor.plm;
|
||||||
|
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aif.common.actions.AbstractAIFAction;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
|
||||||
|
public class KAction extends AbstractAIFAction {
|
||||||
|
|
||||||
|
|
||||||
|
KAction(AbstractAIFUIApplication app, String string) {
|
||||||
|
super(app,string);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
int ind = actionName.indexOf('#');
|
||||||
|
String action=actionName;
|
||||||
|
String actionData="";
|
||||||
|
if(ind>0) {
|
||||||
|
action=actionName.substring(0,ind);
|
||||||
|
actionData=actionName.substring(ind+1);
|
||||||
|
}
|
||||||
|
Class<?> c = Class.forName(action);
|
||||||
|
Constructor<?> constructor = c.getConstructor(AbstractAIFApplication.class, String.class,String.class);
|
||||||
|
KCommand command = (KCommand) constructor.newInstance(this.application, action, actionData);
|
||||||
|
command.executeModal();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
MessageBox.post(e.toString(),KLocale.getString("error"),MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.connor.plm;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFCommand;
|
||||||
|
|
||||||
|
public abstract class KCommand extends AbstractAIFCommand {
|
||||||
|
|
||||||
|
protected AbstractAIFApplication app;
|
||||||
|
protected String actionInfo;
|
||||||
|
|
||||||
|
public KCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||||
|
this.app = app;
|
||||||
|
this.actionInfo = actionInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.connor.plm;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add following config to MANIFEST.MF
|
||||||
|
* Eclipse-RegisterBuddy: k.util
|
||||||
|
* @author Administrator
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class KHandler extends AbstractHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object execute(ExecutionEvent arg0) {
|
||||||
|
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||||
|
new Thread(new KAction(app,arg0.getCommand().getId())).start();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.connor.plm;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.util.Registry;
|
||||||
|
|
||||||
|
|
||||||
|
public class KLocale {
|
||||||
|
|
||||||
|
public static final Registry reg = Registry.getRegistry(KLocale.class);
|
||||||
|
|
||||||
|
public static String getString(String title) {
|
||||||
|
if (isEmpty(title)) {
|
||||||
|
return "";
|
||||||
|
} else {
|
||||||
|
String res = reg.getString(title);
|
||||||
|
return isEmpty(res) ? title : res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isEmpty(String title) {
|
||||||
|
return title == null || "".equals(title.trim());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
package com.connor.plm;
|
||||||
|
|
||||||
|
import java.awt.Dimension;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFOperation;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* do not call executeOperation yourself
|
||||||
|
* use session.performOperation
|
||||||
|
*/
|
||||||
|
public abstract class KOperation extends AbstractAIFOperation {
|
||||||
|
|
||||||
|
protected AbstractAIFApplication app;
|
||||||
|
protected TCSession session;
|
||||||
|
public String messageLabel;
|
||||||
|
|
||||||
|
public KOperation(AbstractAIFApplication app, String opName, String messageLabel) {
|
||||||
|
super(opName, true);
|
||||||
|
this.app = app;
|
||||||
|
this.session = (TCSession) app.getSession();
|
||||||
|
this.messageLabel = messageLabel;// ½ø¶ÈÌõÐÅÏ¢
|
||||||
|
setSession(session);
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract boolean init() throws Exception;
|
||||||
|
|
||||||
|
public abstract void execute() throws Exception;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executeOperation() {
|
||||||
|
ProgressBar pb = new ProgressBar(getCurrentDesktop(), new Dimension(250, 50), true);
|
||||||
|
try {
|
||||||
|
pb.showDialog();
|
||||||
|
pb.setText(messageLabel);
|
||||||
|
setStatus("Checking Data...");
|
||||||
|
if (!init()) {
|
||||||
|
pb.disposeDialog();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setStatus("Execute...");
|
||||||
|
pb.setText(messageLabel);
|
||||||
|
execute();
|
||||||
|
pb.disposeDialog();
|
||||||
|
} catch (Exception e) {
|
||||||
|
pb.disposeDialog();
|
||||||
|
KUtil.error(getCurrentDesktop(), "·¢ÉúÒì³££º\n" + e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
package com.connor.plm;
|
||||||
|
|
||||||
|
import java.awt.Dimension;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFOperation;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* do not call executeOperation yourself
|
||||||
|
* use session.performOperation
|
||||||
|
*/
|
||||||
|
public abstract class KOperation2 extends AbstractAIFOperation {
|
||||||
|
|
||||||
|
protected AbstractAIFApplication app;
|
||||||
|
protected TCSession session;
|
||||||
|
protected ProgressBar pb;
|
||||||
|
|
||||||
|
public KOperation2(AbstractAIFApplication app, String opName) {
|
||||||
|
super(opName, true);
|
||||||
|
this.app = app;
|
||||||
|
this.session = (TCSession) app.getSession();
|
||||||
|
setSession(session);
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract boolean init() throws Exception;
|
||||||
|
|
||||||
|
public abstract void execute() throws Exception;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executeOperation() {
|
||||||
|
pb = new ProgressBar(getCurrentDesktop(), new Dimension(250, 50), true);
|
||||||
|
try {
|
||||||
|
pb.showDialog();
|
||||||
|
setStatus(KLocale.getString("initop.STATUS"));
|
||||||
|
if (!init()) {
|
||||||
|
pb.disposeDialog();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setStatus(KLocale.getString("exeop.STATUS"));
|
||||||
|
execute();
|
||||||
|
KUtil.setByPass(false);
|
||||||
|
pb.disposeDialog();
|
||||||
|
} catch (Exception e) {
|
||||||
|
pb.disposeDialog();
|
||||||
|
KUtil.setByPass(false);
|
||||||
|
KUtil.error(getCurrentDesktop(), "·¢ÉúÒì³££º\n" + e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,130 @@
|
|||||||
|
package com.connor.plm;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.GridBagConstraints;
|
||||||
|
import java.awt.GridBagLayout;
|
||||||
|
import java.awt.Insets;
|
||||||
|
import java.awt.Point;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
|
||||||
|
import javax.swing.JComponent;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JProgressBar;
|
||||||
|
import javax.swing.KeyStroke;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AIFDesktop;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class ProgressBar extends AbstractAIFDialog {
|
||||||
|
|
||||||
|
private JLabel messageLabel;
|
||||||
|
|
||||||
|
private JProgressBar progressBar;
|
||||||
|
|
||||||
|
private boolean showBar = false;
|
||||||
|
|
||||||
|
public ProgressBar(AIFDesktop aifDesktop, Dimension dim, boolean showBar) {
|
||||||
|
super(aifDesktop, false);
|
||||||
|
this.showBar = showBar;
|
||||||
|
initUI(dim);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProgressBar(AbstractAIFDialog pd, Dimension dimension) {
|
||||||
|
super(pd, false);
|
||||||
|
initUI(dimension);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProgressBar(Dimension dim, boolean showBar) {
|
||||||
|
super(false);
|
||||||
|
this.showBar = showBar;
|
||||||
|
initUI(dim);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProgressBar(AbstractAIFDialog pd, Dimension dimension, boolean showBar) {
|
||||||
|
super(pd, false);
|
||||||
|
this.showBar = showBar;
|
||||||
|
initUI(dimension);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initUI(Dimension dim) {
|
||||||
|
this.setLayout(new BorderLayout(0, 0));
|
||||||
|
this.setUndecorated(true);
|
||||||
|
JPanel main = new JPanel(new GridBagLayout());
|
||||||
|
GridBagConstraints s = new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 5, 2, 5), 0, 0);
|
||||||
|
main.setBackground(new Color(53, 53, 53));
|
||||||
|
if (dim != null) {
|
||||||
|
this.setPreferredSize(dim);
|
||||||
|
} else {
|
||||||
|
this.setPreferredSize(new Dimension(200, 40));
|
||||||
|
}
|
||||||
|
messageLabel = new JLabel(" ");
|
||||||
|
messageLabel.setForeground(Color.white);
|
||||||
|
progressBar = new JProgressBar();
|
||||||
|
progressBar.setForeground(Color.black);
|
||||||
|
main.add(messageLabel, s);
|
||||||
|
s.gridy++;
|
||||||
|
s.insets = new Insets(0, 5, 2, 5);
|
||||||
|
if (showBar) {
|
||||||
|
main.add(progressBar, s);
|
||||||
|
}
|
||||||
|
this.add(BorderLayout.CENTER, main);
|
||||||
|
KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
|
||||||
|
this.getRootPane().registerKeyboardAction(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
disposeDialog();
|
||||||
|
}
|
||||||
|
}, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
|
||||||
|
MouseAdapter ma = new MouseAdapter() {
|
||||||
|
private Point pressPoint = new Point();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mousePressed(MouseEvent e) {
|
||||||
|
pressPoint = e.getPoint();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseReleased(MouseEvent e) {
|
||||||
|
pressPoint = new Point();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseDragged(MouseEvent e) {
|
||||||
|
Rectangle r = ProgressBar.this.getBounds();
|
||||||
|
setLocation(r.x + (e.getX() - pressPoint.x), r.y + (e.getY() - pressPoint.y));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.addMouseListener(ma);
|
||||||
|
this.addMouseMotionListener(ma);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setText(String message) {
|
||||||
|
// System.out.println(message);
|
||||||
|
messageLabel.setText(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setText(String txt, int percent) {
|
||||||
|
setText(txt);
|
||||||
|
if (percent > progressBar.getMaximum()) {
|
||||||
|
percent = progressBar.getMaximum();
|
||||||
|
}
|
||||||
|
progressBar.setValue(percent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cancel() {
|
||||||
|
disposeDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startProgress() {
|
||||||
|
showDialog();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
#
|
||||||
|
#Thu Jan 21 10:28:16 CST 2021
|
||||||
|
createscheduledeliverable.ERROR2=\u4E3A [%s] \u521B\u5EFA\u65F6\u95F4\u8868\u4EA4\u4ED8\u7269 [%s] \u5931\u8D25
|
||||||
|
project=Project
|
||||||
|
dsuidinpref.ERROR1=Error dataset uid set in preference\: %s
|
||||||
|
valuenotinlov.ERROR2=LOV "%s" does not contain value\: %s
|
||||||
|
writedata=Write Data
|
||||||
|
querynotexist.ERROR1=Query not exist\: %s
|
||||||
|
dialoginit.ERROR=Init Error
|
||||||
|
preferror.ERROR1=Preference error\: %s
|
||||||
|
norefindataset.ERROR1=Download file from dataset "%s" failed. No ref file.
|
||||||
|
cancel=Cancel
|
||||||
|
exeop.STATUS=Execute...
|
||||||
|
initop.STATUS=Checking Data...
|
||||||
|
noflowkey.ERROR=Missing key for flow number.
|
||||||
|
wordfield_pagecount.NAME=\u9875\u6570
|
||||||
|
nopropintype.ERROR2=Property is not defined in type "%s"\: %s.
|
||||||
|
getflowno.ERROR1=Error getting new flow number for key\: %s
|
||||||
|
formsave.ERRORTITLE=Error Saving Data
|
||||||
|
wordfield_pageno.NAME=\u9875\u7801
|
||||||
|
wordfield_totalpagenominus1.NAME=\u603B\u9875\u7801\u51CF\u4E00
|
||||||
|
wordfield_totalpagecount.NAME=\u603B\u9875\u6570
|
||||||
|
exceltitlenorelateinfo.ERROR=Title row in sheet does not have any relation info.
|
||||||
|
selectProject=Select Project
|
||||||
|
proplocationnotdefined.ERROR1=\u672A\u77E5\u5C5E\u6027\u4F4D\u7F6E\u201C%s\u201D\uFF0C\u8BF7\u68C0\u67E5\u914D\u7F6E
|
||||||
|
excelnotitle.ERROR=Can't find title row in excel sheet.
|
||||||
|
loadCompFromUid.Error2=Error loading component "%s", UID \= "%s".
|
||||||
|
uploadfilewhencheckout.ERROR1=Dataset "%s" is checked out. Upload file failed.
|
||||||
|
wordfield_totalactualpagecountminus1.NAME=\u603B\u5B9E\u9645\u9875\u6570\u51CF\u4E00
|
||||||
|
nodatainfile.ERROR1=No Data in File\: %s
|
||||||
|
noexportdata.ERROR=\u6CA1\u6709\u6570\u636E\u53EF\u4EE5\u5BFC\u51FA
|
||||||
|
notscheduleadmin.INFO=\u53EA\u6709\u534F\u8C03\u8005\u624D\u80FD\u64CD\u4F5C
|
||||||
|
error=Error
|
||||||
|
mergefile=Merge File...
|
||||||
|
index=Index
|
||||||
|
forminit.ERRORTITLE=Error Loading Rendering
|
||||||
|
ok=OK
|
||||||
|
wordfield_totalactualpagecount.NAME=\u603B\u5B9E\u9645\u9875\u6570
|
||||||
|
requireprop.INFO1=\u8BF7\u586B\u5199\u5C5E\u6027\uFF1A%s
|
||||||
|
functionnotavailable.INFO=\u6B64\u5BF9\u8C61\u4E0D\u53EF\u4F7F\u7528\u6B64\u529F\u80FD
|
||||||
|
multiuserbyid.ERROR1=Find multiple users by id\: %s
|
||||||
|
preparedata=Prepare Data
|
||||||
|
dbconn.ERROR=Connect to database failed.
|
||||||
|
typenotfound.ERROR1=Type not found\: %s
|
||||||
|
filenotexist.ERROR1=File not exist\: %s
|
||||||
|
wordfield_totalpagecountminus1.NAME=\u603B\u9875\u6570\u51CF\u4E00
|
||||||
|
readdata=Read Data
|
||||||
|
clearcache=Clear Cache
|
||||||
|
exportsuccess.INFO=Export Complete.
|
||||||
|
uploadfile=Upload File
|
||||||
|
propnotdefinedintype.ERROR2=\u5BF9\u8C61\u7C7B\u578B\u201C%s\u201D\u672A\u5B9A\u4E49\u5C5E\u6027\uFF1A%s
|
||||||
|
foldernotexist.ERROR1=Folder not exist\: %s
|
||||||
|
info=Info
|
||||||
|
wordfield_totalpageno.NAME=\u603B\u9875\u7801
|
||||||
|
multiuserbyname.ERROR1=Find multiple users by name\: %s
|
||||||
|
exportopenfile.INFO=Export complete. Open file?
|
||||||
|
prefnotconfiged.ERROR1=Prefernce not found\: %s
|
||||||
|
export=Export
|
@ -0,0 +1,58 @@
|
|||||||
|
#
|
||||||
|
#Thu Jan 21 10:28:16 CST 2021
|
||||||
|
createscheduledeliverable.ERROR2=\u4E3A [%s] \u521B\u5EFA\u65F6\u95F4\u8868\u4EA4\u4ED8\u7269 [%s] \u5931\u8D25
|
||||||
|
project=\u9879\u76EE
|
||||||
|
dsuidinpref.ERROR1=\u8BF7\u68C0\u67E5\u9996\u9009\u9879<%s>\uFF0C\u901A\u8FC7\u914D\u7F6EUID\u672A\u627E\u5230\u6570\u636E\u96C6
|
||||||
|
valuenotinlov.ERROR2=LOV "%s" \u4E2D\u672A\u5B9A\u4E49\u6570\u503C\uFF1A%s
|
||||||
|
writedata=\u5199\u5165\u6570\u636E
|
||||||
|
querynotexist.ERROR1=\u67E5\u8BE2\u4E0D\u5B58\u5728\uFF1A%s
|
||||||
|
dialoginit.ERROR=\u521D\u59CB\u5316\u5F02\u5E38
|
||||||
|
preferror.ERROR1=\u9996\u9009\u9879\u914D\u7F6E\u9519\u8BEF\uFF1A%s
|
||||||
|
norefindataset.ERROR1=\u4ECE\u6570\u636E\u96C6\u201C%s\u201D\u4E0B\u8F7D\u6587\u4EF6\u5931\u8D25\uFF0C\u6CA1\u6709\u627E\u5230\u5F15\u7528\u6587\u4EF6\u3002
|
||||||
|
cancel=\u53D6\u6D88
|
||||||
|
exeop.STATUS=\u6B63\u5728\u6267\u884C...
|
||||||
|
initop.STATUS=\u68C0\u67E5\u6570\u636E...
|
||||||
|
noflowkey.ERROR=\u6D41\u6C34\u7801\u952E\u503C\u4E0D\u53EF\u4E3A\u7A7A
|
||||||
|
wordfield_pagecount.NAME=\u9875\u6570
|
||||||
|
nopropintype.ERROR2=\u5BF9\u8C61\u7C7B\u578B\u201C%s\u201D\u4E0D\u5B58\u5728\u5C5E\u6027\uFF1A%s
|
||||||
|
getflowno.ERROR1=\u83B7\u53D6\u6D41\u6C34\u7801\u5931\u8D25\uFF1A%s
|
||||||
|
formsave.ERRORTITLE=\u4FDD\u5B58\u6570\u636E\u51FA\u9519
|
||||||
|
wordfield_pageno.NAME=\u9875\u7801
|
||||||
|
wordfield_totalpagenominus1.NAME=\u603B\u9875\u7801\u51CF\u4E00
|
||||||
|
wordfield_totalpagecount.NAME=\u603B\u9875\u6570
|
||||||
|
exceltitlenorelateinfo.ERROR=\u6807\u9898\u884C\u6CA1\u6709\u89E3\u6790\u5230\u6620\u5C04\u5185\u5BB9
|
||||||
|
selectProject=\u9009\u62E9\u9879\u76EE
|
||||||
|
proplocationnotdefined.ERROR1=\u672A\u77E5\u5C5E\u6027\u4F4D\u7F6E\u201C%s\u201D\uFF0C\u8BF7\u68C0\u67E5\u914D\u7F6E
|
||||||
|
excelnotitle.ERROR=\u672A\u627E\u5230\u5DE5\u4F5C\u8868\u4E2D\u7684\u6807\u9898\u884C
|
||||||
|
loadCompFromUid.Error2=\u52A0\u8F7D\u5BF9\u8C61\u201C%s\u201D\u5931\u8D25\uFF0CUID\=\u201C%s\u201D\u3002
|
||||||
|
uploadfilewhencheckout.ERROR1=\u6570\u636E\u96C6\u201C%s\u201D\u5DF2\u7B7E\u51FA\uFF0C\u4E0A\u4F20\u6587\u4EF6\u5931\u8D25\u3002\u8BF7\u7B7E\u5165\u540E\u518D\u8FDB\u884C\u64CD\u4F5C\u3002
|
||||||
|
wordfield_totalactualpagecountminus1.NAME=\u603B\u5B9E\u9645\u9875\u6570\u51CF\u4E00
|
||||||
|
nodatainfile.ERROR1=\u6587\u4EF6\u4E2D\u6CA1\u6709\u6570\u636E\uFF1A%s
|
||||||
|
noexportdata.ERROR=\u6CA1\u6709\u6570\u636E\u53EF\u4EE5\u5BFC\u51FA
|
||||||
|
notscheduleadmin.INFO=\u53EA\u6709\u534F\u8C03\u8005\u624D\u80FD\u64CD\u4F5C
|
||||||
|
error=\u9519\u8BEF
|
||||||
|
mergefile=\u5408\u5E76\u6587\u4EF6
|
||||||
|
index=\u5E8F\u53F7
|
||||||
|
forminit.ERRORTITLE=\u521D\u59CB\u5316\u754C\u9762\u5F02\u5E38
|
||||||
|
ok=\u786E\u5B9A
|
||||||
|
wordfield_totalactualpagecount.NAME=\u603B\u5B9E\u9645\u9875\u6570
|
||||||
|
requireprop.INFO1=\u8BF7\u586B\u5199\u5C5E\u6027\uFF1A%s
|
||||||
|
functionnotavailable.INFO=\u6B64\u5BF9\u8C61\u4E0D\u53EF\u4F7F\u7528\u6B64\u529F\u80FD
|
||||||
|
multiuserbyid.ERROR1=\u901A\u8FC7id\u67E5\u8BE2\u5230\u591A\u4E2A\u7528\u6237\uFF1A%s
|
||||||
|
preparedata=\u51C6\u5907\u6570\u636E
|
||||||
|
dbconn.ERROR=\u8FDE\u63A5\u6570\u636E\u5E93\u5931\u8D25\u3002
|
||||||
|
typenotfound.ERROR1=\u672A\u627E\u5230\u7C7B\u578B\uFF1A%s
|
||||||
|
filenotexist.ERROR1=\u6587\u4EF6\u4E0D\u5B58\u5728\uFF1A%s
|
||||||
|
wordfield_totalpagecountminus1.NAME=\u603B\u9875\u6570\u51CF\u4E00
|
||||||
|
readdata=\u8BFB\u53D6\u6570\u636E
|
||||||
|
clearcache=\u6E05\u7406\u7F13\u5B58
|
||||||
|
exportsuccess.INFO=\u5BFC\u51FA\u5B8C\u6210
|
||||||
|
uploadfile=\u4E0A\u4F20\u6587\u4EF6
|
||||||
|
propnotdefinedintype.ERROR2=\u5BF9\u8C61\u7C7B\u578B\u201C%s\u201D\u672A\u5B9A\u4E49\u5C5E\u6027\uFF1A%s
|
||||||
|
foldernotexist.ERROR1=\u6587\u4EF6\u5939\u4E0D\u5B58\u5728\uFF1A%s
|
||||||
|
info=\u63D0\u793A
|
||||||
|
wordfield_totalpageno.NAME=\u603B\u9875\u7801
|
||||||
|
multiuserbyname.ERROR1=\u901A\u8FC7\u59D3\u540D\u67E5\u8BE2\u5230\u591A\u4E2A\u7528\u6237\uFF1A%s
|
||||||
|
exportopenfile.INFO=\u5BFC\u51FA\u5B8C\u6210\uFF0C\u6253\u5F00\u6587\u4EF6\uFF1F
|
||||||
|
prefnotconfiged.ERROR1=\u672A\u914D\u7F6E\u9996\u9009\u9879\uFF1A%s
|
||||||
|
export=\u5BFC\u51FA
|
@ -0,0 +1,47 @@
|
|||||||
|
package com.connor.plm.sample;
|
||||||
|
|
||||||
|
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.TCComponentDataset;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
/**
|
||||||
|
* 功能描述: 备份实施计划
|
||||||
|
* 创建日期:2024-08-04
|
||||||
|
* @author 王辰
|
||||||
|
*
|
||||||
|
* 修改日期 修改人 修改描述
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DatasetSaveAsHandler extends AbstractHandler{
|
||||||
|
|
||||||
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
|
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||||
|
InterfaceAIFComponent targetComp = app.getTargetComponent();
|
||||||
|
TCSession session = (TCSession) app.getSession();
|
||||||
|
if(targetComp != null){
|
||||||
|
if(targetComp instanceof TCComponentDataset){
|
||||||
|
TCComponentDataset targetDataset = (TCComponentDataset)targetComp;
|
||||||
|
DatasetSaveAsOperation operation = new DatasetSaveAsOperation(app,targetDataset);
|
||||||
|
session.queueOperation(operation);
|
||||||
|
return null;
|
||||||
|
}else{
|
||||||
|
MessageBox.post(PlmLocale.getString("selectDataset"),
|
||||||
|
PlmLocale.getString("warn"),
|
||||||
|
MessageBox.INFORMATION);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
MessageBox.post(PlmLocale.getString("selectDataset"),
|
||||||
|
PlmLocale.getString("warn"),
|
||||||
|
MessageBox.INFORMATION);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,170 @@
|
|||||||
|
package com.connor.plm.sample;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
|
||||||
|
import com.connor.plm.KUtil;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFOperation;
|
||||||
|
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.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentDatasetType;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCException;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
import com.teamcenter.services.rac.workflow.WorkflowService;
|
||||||
|
import com.teamcenter.services.rac.workflow._2008_06.Workflow.ContextData;
|
||||||
|
import com.teamcenter.services.rac.workflow._2008_06.Workflow.InstanceInfo;
|
||||||
|
/**
|
||||||
|
* 功能描述: 产品图修订
|
||||||
|
* 创建日期:2019-02-26
|
||||||
|
* @author 王辰
|
||||||
|
*
|
||||||
|
* 修改日期 修改人 修改描述
|
||||||
|
* 2019-01-24 XXXX 创建程序
|
||||||
|
*/
|
||||||
|
public class DatasetSaveAsOperation extends AbstractAIFOperation{
|
||||||
|
|
||||||
|
private AbstractAIFUIApplication app;
|
||||||
|
private TCComponentDataset targetComp;
|
||||||
|
private static final String SPEC_RELATION_TYPE = "IMAN_specification";
|
||||||
|
private static final String preName = "Connor_dataset_ref";
|
||||||
|
private TCSession session;
|
||||||
|
|
||||||
|
public DatasetSaveAsOperation(AbstractAIFUIApplication app,
|
||||||
|
TCComponentDataset targetComp) {
|
||||||
|
this.app = app;
|
||||||
|
this.targetComp = targetComp;
|
||||||
|
session = (TCSession) app.getSession();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 方法描述
|
||||||
|
* 根据源数据集备份新的数据集。
|
||||||
|
* @return 返回新创建数据集对象
|
||||||
|
*/
|
||||||
|
private TCComponentDataset createDataset() {
|
||||||
|
TCComponentDataset newDataset = null;
|
||||||
|
String[] path = new String[1];
|
||||||
|
String[] refType = new String[1];
|
||||||
|
try {
|
||||||
|
String type = targetComp.getType();
|
||||||
|
Map<String, String> refMap = new HashMap<String, String>();
|
||||||
|
String[] prefVals = KUtil.getPrefVals(session, preName);
|
||||||
|
for (int i = 0; i < prefVals.length; i++) {
|
||||||
|
if(prefVals[i].contains("=")) {
|
||||||
|
String[] split = prefVals[i].split("=");
|
||||||
|
refMap.put(split[0], split[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(refMap.containsKey(type)) {
|
||||||
|
refType[0] = refMap.get(type);
|
||||||
|
}else {
|
||||||
|
MessageBox.post("未找到对应数据集类型"+type+"的引用,请联系管理员检查",
|
||||||
|
PlmLocale.getString("err"),
|
||||||
|
MessageBox.INFORMATION);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String datasetName = targetComp.getStringProperty("object_name");
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||||
|
String timestamp = sdf.format(new Date());
|
||||||
|
String objectName = "";
|
||||||
|
if(datasetName.contains(".")) {
|
||||||
|
String[] split = datasetName.split("\\.");
|
||||||
|
objectName = split[0] + timestamp + "." + split[1];
|
||||||
|
}else {
|
||||||
|
objectName = datasetName + timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
File[] files = targetComp.getFiles("");
|
||||||
|
TCComponentDatasetType datasetType = (TCComponentDatasetType) session.getTypeComponent("Dataset");
|
||||||
|
//创建数据集
|
||||||
|
newDataset = datasetType.create(objectName, "", type);
|
||||||
|
//上传物理文件
|
||||||
|
if(newDataset != null) {
|
||||||
|
String oldPath = files[0].getAbsolutePath();
|
||||||
|
if(oldPath.contains(".")) {
|
||||||
|
String[] split = oldPath.split("\\.");
|
||||||
|
String newPath = split[0] + timestamp + "." + split[1];
|
||||||
|
FileUtils.copyFile(new File(oldPath), new File(newPath));
|
||||||
|
path[0] = newPath;
|
||||||
|
newDataset.setFiles(path, refType);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
return newDataset;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return newDataset;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executeOperation() throws Exception {
|
||||||
|
try {
|
||||||
|
//获取关联目标数据集的版本对象
|
||||||
|
AIFComponentContext[] whereReferenced = targetComp.whereReferenced();
|
||||||
|
InterfaceAIFComponent comp = whereReferenced[0].getComponent();
|
||||||
|
if(comp instanceof TCComponentItemRevision) {
|
||||||
|
TCComponentItemRevision rev = (TCComponentItemRevision) comp;
|
||||||
|
TCComponentDataset tempDataset = createDataset();
|
||||||
|
if(tempDataset != null) {
|
||||||
|
//给新数据集打上发布状态
|
||||||
|
workflow(new String[] {tempDataset.getUid()},"快速发布","TCM Release Process");
|
||||||
|
//添加关系
|
||||||
|
rev.add(SPEC_RELATION_TYPE,tempDataset);
|
||||||
|
MessageBox.post(PlmLocale.getString("revisedSuccessful"),
|
||||||
|
PlmLocale.getString("ok"),
|
||||||
|
MessageBox.INFORMATION);
|
||||||
|
}else {
|
||||||
|
MessageBox.post(PlmLocale.getString("revisionFailed"),
|
||||||
|
PlmLocale.getString("err"),
|
||||||
|
MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (TCException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
MessageBox.post(PlmLocale.getString("revisionFailed"),
|
||||||
|
PlmLocale.getString("err"),
|
||||||
|
MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 方法描述
|
||||||
|
* 给新建的数据集打上发布状态
|
||||||
|
*/
|
||||||
|
public void workflow(String[] uid,String workFlowName,String templateName) {
|
||||||
|
// String uid = rev.getUid();
|
||||||
|
//创建流程
|
||||||
|
WorkflowService wfService = WorkflowService.getService(session);
|
||||||
|
ContextData contextData = new ContextData();
|
||||||
|
String observerKey = "";
|
||||||
|
String name = workFlowName;
|
||||||
|
String subject = "";
|
||||||
|
String description = "";
|
||||||
|
contextData.processTemplate = templateName; // update with your own ProcessTemplate.
|
||||||
|
contextData.subscribeToEvents = false;
|
||||||
|
contextData.subscriptionEventCount = 0;
|
||||||
|
contextData.attachmentCount = uid.length;
|
||||||
|
contextData.attachments = uid ;
|
||||||
|
int [] types = new int[uid.length];
|
||||||
|
for(int i = 0;i <uid.length;i++) {
|
||||||
|
types[i] = 1;
|
||||||
|
}
|
||||||
|
contextData.attachmentTypes = types;
|
||||||
|
//创建流程
|
||||||
|
InstanceInfo instanceInfo = wfService.createInstance(true, observerKey, name, subject, description, contextData);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.connor.plm.sample;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.util.Registry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能描述: 中英文环境切换
|
||||||
|
* 创建日期:2019-02-26
|
||||||
|
* @author 王辰
|
||||||
|
*
|
||||||
|
* 修改日期 修改人 修改描述
|
||||||
|
* 2019-01-24 XXXX 创建程序
|
||||||
|
*/
|
||||||
|
public class PlmLocale {
|
||||||
|
|
||||||
|
public static final Registry reg = Registry.getRegistry(PlmLocale.class);
|
||||||
|
|
||||||
|
public static String getString(String title) {
|
||||||
|
if (isEmpty(title)) {
|
||||||
|
return "";
|
||||||
|
} else {
|
||||||
|
String res = reg.getString(title);
|
||||||
|
return isEmpty(res) ? title : res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isEmpty(String title) {
|
||||||
|
return title == null || "".equals(title.trim());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
selectDataset=Please select a dataset
|
||||||
|
warn=warn
|
||||||
|
ok=ok
|
||||||
|
err=err
|
||||||
|
revisedSuccessful=save successfully
|
||||||
|
revisionFailed=save failed
|
||||||
|
cel=cancel
|
@ -0,0 +1,7 @@
|
|||||||
|
selectDataset=\u8BF7\u9009\u4E2D\u6570\u636E\u96C6
|
||||||
|
warn=\u63D0\u9192
|
||||||
|
ok=\u786E\u8BA4
|
||||||
|
err=\u9519\u8BEF
|
||||||
|
revisedSuccessful=\u5907\u4EFD\u5B8C\u6210
|
||||||
|
revisionFailed=\u5907\u4EFD\u5931\u8D25
|
||||||
|
cel=\u53D6\u6D88
|
@ -0,0 +1,66 @@
|
|||||||
|
package com.connor.plm.sb01;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import com.connor.plm.KCommand;
|
||||||
|
import com.connor.plm.KUtil;
|
||||||
|
import com.teamcenter.rac.aif.AIFDesktop;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||||
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
|
||||||
|
public class PropertyToWordOrExcelCommand extends KCommand{
|
||||||
|
|
||||||
|
final String preName = "Connor_WordExcel_Report_ItemType";
|
||||||
|
|
||||||
|
public PropertyToWordOrExcelCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||||
|
super(app, commandId, actionInfo);
|
||||||
|
TCSession session = (TCSession) app.getSession();
|
||||||
|
this.setRunnable(new PropertyToWordOrExcelOperation(app, "提取对象版本属性到Word Excel"));
|
||||||
|
// InterfaceAIFComponent targetComponent = app.getTargetComponent();
|
||||||
|
// TCComponentItemRevision revision = (TCComponentItemRevision) targetComponent;
|
||||||
|
// try {
|
||||||
|
// String[] prefVals = KUtil.getPrefVals(session, preName);
|
||||||
|
// if(prefVals == null || prefVals.length == 0) {
|
||||||
|
// KUtil.info(AIFDesktop.getActiveDesktop(), preName + "该首选项未配置,请联系管理员!");
|
||||||
|
// return ;
|
||||||
|
// }
|
||||||
|
// String relatioin = prefVals[0];
|
||||||
|
// TCComponent[] relatedComponents = revision.getRelatedComponents(relatioin);
|
||||||
|
// if(relatedComponents == null || relatedComponents.length == 0) {
|
||||||
|
// KUtil.info(AIFDesktop.getActiveDesktop(), "选中对象的 " + relatioin + " 关系下没有数据集");
|
||||||
|
// return ;
|
||||||
|
// }
|
||||||
|
// for (TCComponent tcComponent : relatedComponents) {
|
||||||
|
// if (tcComponent instanceof TCComponentDataset) {
|
||||||
|
// TCComponentDataset dataset = (TCComponentDataset) tcComponent;
|
||||||
|
// File datasetFile = KUtil.getDatasetFile(dataset);
|
||||||
|
// System.out.println();
|
||||||
|
// String type = tcComponent.getType();
|
||||||
|
// switch (type) {
|
||||||
|
// case "MSExcel":
|
||||||
|
//
|
||||||
|
// break;
|
||||||
|
// case "MSExcelX":
|
||||||
|
//
|
||||||
|
// break;
|
||||||
|
// case "MSWord":
|
||||||
|
//
|
||||||
|
// break;
|
||||||
|
// case "MSWordX":
|
||||||
|
//
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// // TODO Auto-generated catch block
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,345 @@
|
|||||||
|
package com.connor.plm.sb01;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFName;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFRow;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||||
|
import org.apache.poi.ss.util.CellReference;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFName;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
|
||||||
|
import com.aspose.words.Bookmark;
|
||||||
|
import com.aspose.words.Document;
|
||||||
|
import com.aspose.words.SaveFormat;
|
||||||
|
import com.connor.plm.KOperation;
|
||||||
|
import com.connor.plm.KUtil;
|
||||||
|
import com.teamcenter.rac.aif.AIFDesktop;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||||
|
import com.teamcenter.rac.aif.kernel.AbstractAIFSession;
|
||||||
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentTcFile;
|
||||||
|
import com.teamcenter.rac.kernel.TCException;
|
||||||
|
import com.teamcenter.rac.kernel.TCProperty;
|
||||||
|
import com.teamcenter.rac.util.FileUtility;
|
||||||
|
|
||||||
|
public class PropertyToWordOrExcelOperation extends KOperation {
|
||||||
|
|
||||||
|
public PropertyToWordOrExcelOperation(AbstractAIFApplication app, String opName) {
|
||||||
|
super(app, opName, "正在执行。。。");
|
||||||
|
}
|
||||||
|
|
||||||
|
final String preName = "Connor_WordExcel_Report_ItemType";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean init() throws Exception {
|
||||||
|
new Thread().sleep(1000);
|
||||||
|
InterfaceAIFComponent targetComponent = app.getTargetComponent();
|
||||||
|
TCComponentItemRevision revision = (TCComponentItemRevision) targetComponent;
|
||||||
|
String[] prefVals = KUtil.getPrefVals(session, preName);
|
||||||
|
if(prefVals == null || prefVals.length == 0) {
|
||||||
|
KUtil.info(AIFDesktop.getActiveDesktop(), preName + "该首选项未配置,请联系管理员!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String relatioin = prefVals[0];
|
||||||
|
TCComponent[] relatedComponents = revision.getRelatedComponents(relatioin);
|
||||||
|
if(relatedComponents == null || relatedComponents.length == 0) {
|
||||||
|
KUtil.info(AIFDesktop.getActiveDesktop(), "选中对象的 " + relatioin + " 关系下没有数据集");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String revType = revision.getType();
|
||||||
|
//处理首选项
|
||||||
|
HashMap<String, String> nameMap = new HashMap<String, String>();//数据集里面的名称和对象(item,rev,revMaster)集合
|
||||||
|
if(prefVals.length >= 2) {
|
||||||
|
for (int i = 1; i < prefVals.length; i++) {
|
||||||
|
//Item.object_name=object_name
|
||||||
|
String[] split = prefVals[i].split("\\|");
|
||||||
|
if(!split[0].equals(revType)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String[] split1 = split[1].split("=");
|
||||||
|
nameMap.put(split1[1],split1[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (TCComponent tcComponent : relatedComponents) {
|
||||||
|
if (tcComponent instanceof TCComponentDataset) {
|
||||||
|
TCComponentDataset dataset = (TCComponentDataset) tcComponent;
|
||||||
|
TCComponent[] comps = dataset.getRelatedComponents("release_status_list");
|
||||||
|
if(comps != null && comps.length > 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
File datasetFile = KUtil.getDatasetFile(dataset);
|
||||||
|
String type = tcComponent.getType();
|
||||||
|
String datasetType = "";
|
||||||
|
String newPath = "";
|
||||||
|
if("MSExcel".equals(type) || "MSExcelX".equals(type) || "MSWord".equals(type) || "MSWordX".equals(type)) {
|
||||||
|
switch (type) {
|
||||||
|
case "MSExcel":
|
||||||
|
datasetType = "excel";
|
||||||
|
newPath = dealExcel(datasetFile,revision,nameMap);
|
||||||
|
break;
|
||||||
|
case "MSExcelX":
|
||||||
|
datasetType = "excel";
|
||||||
|
newPath = dealExcelX(datasetFile,revision,nameMap);
|
||||||
|
break;
|
||||||
|
case "MSWord":
|
||||||
|
datasetType = "word";
|
||||||
|
newPath = dealWord2(datasetFile,revision,nameMap,"doc");
|
||||||
|
break;
|
||||||
|
case "MSWordX":
|
||||||
|
datasetType = "word";
|
||||||
|
newPath = dealWord2(datasetFile,revision,nameMap,"docx");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//给数据集设置新的命名的引用
|
||||||
|
dataset.setFiles(new String[] {newPath}, new String[] {datasetType});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
KUtil.info(AIFDesktop.getActiveDesktop(), "提取对象版本属性到Word Excel执行完成");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private String dealExcel(File datasetFile, TCComponentItemRevision revision, HashMap<String, String> nameMap) throws IOException, TCException {
|
||||||
|
FileInputStream is = new FileInputStream(datasetFile);
|
||||||
|
HSSFWorkbook workbook = new HSSFWorkbook(is);
|
||||||
|
List<HSSFName> allNames = workbook.getAllNames();
|
||||||
|
for (HSSFName hssfName : allNames) {
|
||||||
|
String name = hssfName.getNameName();
|
||||||
|
//名称管理器存在首选项的名称
|
||||||
|
if (nameMap.containsKey(name)) {
|
||||||
|
CellReference cellReference = new CellReference(hssfName.getRefersToFormula());
|
||||||
|
HSSFSheet sheet = workbook.getSheet(cellReference.getSheetName());
|
||||||
|
HSSFRow row = sheet.getRow(cellReference.getRow());
|
||||||
|
HSSFCell cell = row.getCell(cellReference.getCol());
|
||||||
|
String preConfigValue = getPreConfigValue(revision,nameMap,nameMap.get(name));
|
||||||
|
if(preConfigValue.endsWith("00:00")) {
|
||||||
|
System.out.println("时间格式特殊处理");
|
||||||
|
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||||
|
DateFormat dateFormat2 = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
try {
|
||||||
|
Date date = dateFormat.parse(preConfigValue);
|
||||||
|
preConfigValue = dateFormat2.format(date);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("行为:" + cellReference.getRow() + "====" + "列为:" + cellReference.getCol() + "===="
|
||||||
|
+ "值为: " + preConfigValue);
|
||||||
|
if(cell == null) {
|
||||||
|
cell = row.createCell(cellReference.getCol());
|
||||||
|
}
|
||||||
|
cell.setCellValue(preConfigValue);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
is.close();
|
||||||
|
FileOutputStream os = new FileOutputStream(datasetFile);
|
||||||
|
workbook.write(os);
|
||||||
|
workbook.close();
|
||||||
|
return datasetFile.getAbsolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String dealExcelX(File datasetFile, TCComponentItemRevision revision, HashMap<String, String> nameMap) throws IOException, TCException {
|
||||||
|
FileInputStream is = new FileInputStream(datasetFile);
|
||||||
|
XSSFWorkbook workbook = new XSSFWorkbook(is);
|
||||||
|
List<XSSFName> allNames = workbook.getAllNames();
|
||||||
|
for (XSSFName xssfName : allNames) {
|
||||||
|
String name = xssfName.getNameName();
|
||||||
|
//名称管理器存在首选项的名称
|
||||||
|
if (nameMap.containsKey(name)) {
|
||||||
|
CellReference cellReference = new CellReference(xssfName.getRefersToFormula());
|
||||||
|
XSSFSheet sheet = workbook.getSheet(cellReference.getSheetName());
|
||||||
|
XSSFRow row = sheet.getRow(cellReference.getRow());
|
||||||
|
XSSFCell cell = row.getCell(cellReference.getCol());
|
||||||
|
String preConfigValue = getPreConfigValue(revision,nameMap,nameMap.get(name));
|
||||||
|
if(preConfigValue.endsWith("00:00")) {
|
||||||
|
System.out.println("时间格式特殊处理");
|
||||||
|
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||||
|
DateFormat dateFormat2 = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
try {
|
||||||
|
Date date = dateFormat.parse(preConfigValue);
|
||||||
|
preConfigValue = dateFormat2.format(date);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("行为:" + cellReference.getRow() + "====" + "列为:" + cellReference.getCol() + "===="
|
||||||
|
+ "值为: " + preConfigValue);
|
||||||
|
if(cell == null) {
|
||||||
|
cell = row.createCell(cellReference.getCol());
|
||||||
|
cell.setCellValue(preConfigValue);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cell.setCellValue(preConfigValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
is.close();
|
||||||
|
FileOutputStream os = new FileOutputStream(datasetFile);
|
||||||
|
workbook.write(os);
|
||||||
|
workbook.close();
|
||||||
|
return datasetFile.getAbsolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String dealWord(File datasetFile, TCComponentItemRevision revision, HashMap<String, String> nameMap,String type) throws IOException, TCException {
|
||||||
|
String path = datasetFile.getAbsolutePath();
|
||||||
|
InputStream inputStream = Files.newInputStream(Paths.get(path));
|
||||||
|
Map<String, String> dataMap = new HashMap<>();
|
||||||
|
for(String key : nameMap.keySet()) {
|
||||||
|
String preConfigValue = getPreConfigValue(revision,nameMap,nameMap.get(key));
|
||||||
|
if(preConfigValue.endsWith("00:00")) {
|
||||||
|
System.out.println("时间格式特殊处理");
|
||||||
|
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||||
|
DateFormat dateFormat2 = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
try {
|
||||||
|
Date date = dateFormat.parse(preConfigValue);
|
||||||
|
preConfigValue = dateFormat2.format(date);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dataMap.put(key, preConfigValue);
|
||||||
|
}
|
||||||
|
String newPath = "";
|
||||||
|
if(type.equals("doc")) {
|
||||||
|
newPath = path.replace(".doc", "temp.doc");
|
||||||
|
WordUtils.replaceBookmarksByDoc(inputStream, Files.newOutputStream(Paths.get(newPath)), dataMap);
|
||||||
|
}
|
||||||
|
else if(type.equals("docx")) {
|
||||||
|
newPath = path.replace(".docx", "temp.docx");
|
||||||
|
WordUtils.replaceBookmarksByDocx(inputStream, Files.newOutputStream(Paths.get(newPath)), dataMap);
|
||||||
|
}
|
||||||
|
return newPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String dealWord2(File datasetFile, TCComponentItemRevision revision, HashMap<String, String> nameMap,String type) throws FileNotFoundException, Exception {
|
||||||
|
String path = datasetFile.getAbsolutePath();
|
||||||
|
Document document2 = new Document(new FileInputStream(path));
|
||||||
|
OutputStream outputStream = null;
|
||||||
|
String newPath = path.replace(".doc", "temp.doc");
|
||||||
|
outputStream = new FileOutputStream(newPath);
|
||||||
|
Map<String, String> dataMap = new HashMap<>();
|
||||||
|
for(String key : nameMap.keySet()) {
|
||||||
|
String preConfigValue = getPreConfigValue(revision,nameMap,nameMap.get(key));
|
||||||
|
if(preConfigValue.endsWith("00:00")) {
|
||||||
|
System.out.println("时间格式特殊处理");
|
||||||
|
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||||
|
DateFormat dateFormat2 = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
try {
|
||||||
|
Date date = dateFormat.parse(preConfigValue);
|
||||||
|
preConfigValue = dateFormat2.format(date);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dataMap.put(key, preConfigValue);
|
||||||
|
}
|
||||||
|
for (Bookmark bookmark : document2.getRange().getBookmarks()) {
|
||||||
|
String bookmarkName = bookmark.getName();
|
||||||
|
System.out.println("书签名:"+bookmarkName);
|
||||||
|
if(dataMap.containsKey(bookmarkName))
|
||||||
|
{
|
||||||
|
System.out.println("添加内容");
|
||||||
|
bookmark.setText(dataMap.get(bookmarkName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(type.equals("doc")) {
|
||||||
|
document2.save(outputStream, SaveFormat.DOC);
|
||||||
|
}else if(type.equals("docx")) {
|
||||||
|
document2.save(outputStream, SaveFormat.DOCX);
|
||||||
|
}
|
||||||
|
return newPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 得到首选项中“=”左边对应的属性值
|
||||||
|
* @param revision
|
||||||
|
* @param nameMap
|
||||||
|
* @param value
|
||||||
|
* @return
|
||||||
|
* @throws TCException
|
||||||
|
*/
|
||||||
|
private String getPreConfigValue(TCComponentItemRevision revision, HashMap<String, String> nameMap,String value) throws TCException {
|
||||||
|
String[] split = value.split("\\.");
|
||||||
|
String cellValue = "";
|
||||||
|
TCProperty property = null;
|
||||||
|
if(split.length == 2) {
|
||||||
|
switch (split[0]) {
|
||||||
|
case "Item":
|
||||||
|
property = revision.getItem().getTCProperty(split[1]);
|
||||||
|
break;
|
||||||
|
case "Rev":
|
||||||
|
property = revision.getTCProperty(split[1]);
|
||||||
|
break;
|
||||||
|
case "RevMaster":
|
||||||
|
property = revision.getRelatedComponent("IMAN_master_form_rev").getTCProperty(split[1]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//取关系文件夹下的属性
|
||||||
|
else if(split.length == 3) {
|
||||||
|
String relation = split[0];
|
||||||
|
TCComponent relatedComponent = revision.getRelatedComponent(relation);
|
||||||
|
TCComponentItemRevision centerRev = null;
|
||||||
|
if(relatedComponent instanceof TCComponentItemRevision) {
|
||||||
|
centerRev = (TCComponentItemRevision) relatedComponent;
|
||||||
|
}else if(relatedComponent instanceof TCComponentItem) {
|
||||||
|
centerRev = ((TCComponentItem) relatedComponent).getLatestItemRevision();
|
||||||
|
}
|
||||||
|
if(centerRev != null) {
|
||||||
|
switch (split[1]) {
|
||||||
|
case "Item":
|
||||||
|
property = centerRev.getItem().getTCProperty(split[2]);
|
||||||
|
break;
|
||||||
|
case "Rev":
|
||||||
|
property = centerRev.getTCProperty(split[2]);
|
||||||
|
break;
|
||||||
|
case "RevMaster":
|
||||||
|
property = centerRev.getRelatedComponent("IMAN_master_form_rev").getTCProperty(split[2]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(property == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cellValue = property.getDisplayValue();
|
||||||
|
return cellValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,68 @@
|
|||||||
|
package com.connor.plm.sb01;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFName;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||||
|
import org.apache.poi.ss.util.CellReference;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFName;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
|
||||||
|
import com.aspose.words.Bookmark;
|
||||||
|
import com.aspose.words.Document;
|
||||||
|
import com.aspose.words.SaveFormat;
|
||||||
|
|
||||||
|
public class Test {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
try {
|
||||||
|
// FileInputStream is = new FileInputStream("C:\\Users\\Administrator\\Desktop\\测试文件夹\\2.xls");
|
||||||
|
// // 读取文件进来
|
||||||
|
// HSSFWorkbook workbook = new HSSFWorkbook(is);
|
||||||
|
// List<HSSFName> allNames = workbook.getAllNames();
|
||||||
|
// System.out.println("allNames = " + allNames);
|
||||||
|
// String cellReference = allNames.get(0).getRefersToFormula();
|
||||||
|
// workbook.close();
|
||||||
|
// is.close();
|
||||||
|
|
||||||
|
// FileInputStream is2 = new FileInputStream("C:\\Users\\Administrator\\Desktop\\测试文件夹\\1.xlsx");
|
||||||
|
// // 读取文件进来
|
||||||
|
// XSSFWorkbook workbook2 = new XSSFWorkbook(is2);
|
||||||
|
// List<XSSFName> allNames2 = workbook2.getAllNames();
|
||||||
|
//
|
||||||
|
// workbook2.close();
|
||||||
|
// is2.close();
|
||||||
|
|
||||||
|
FileInputStream is = new FileInputStream("C:\\Users\\Administrator\\Desktop\\work。excel\\1.docx");
|
||||||
|
// 读取文件进来
|
||||||
|
XSSFWorkbook workbook = new XSSFWorkbook(is);
|
||||||
|
File datasetFile = new File("C:\\Users\\Administrator\\Desktop\\work。excel\\1.docx");
|
||||||
|
String path = datasetFile.getAbsolutePath();
|
||||||
|
Document document2 = new Document(new FileInputStream(path));
|
||||||
|
OutputStream outputStream = null;
|
||||||
|
String newPath = path.replace(".doc", "temp.doc");
|
||||||
|
outputStream = new FileOutputStream(newPath);
|
||||||
|
Map<String, String> dataMap = new HashMap<>();
|
||||||
|
dataMap.put("one", "one");
|
||||||
|
dataMap.put("two", "two");
|
||||||
|
for (Bookmark bookmark : document2.getRange().getBookmarks()) {
|
||||||
|
String bookmarkName = bookmark.getName();
|
||||||
|
System.out.println("书签名:"+bookmarkName);
|
||||||
|
if(dataMap.containsKey(bookmarkName))
|
||||||
|
{
|
||||||
|
System.out.println("添加内容");
|
||||||
|
bookmark.setText(dataMap.get(bookmarkName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
document2.save(outputStream, SaveFormat.DOC);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
package com.connor.plm.sb02;
|
||||||
|
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Polygon;
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
import javax.swing.Icon;
|
||||||
|
import javax.swing.RowSorter;
|
||||||
|
import javax.swing.RowSorter.SortKey;
|
||||||
|
import javax.swing.SortOrder;
|
||||||
|
import javax.swing.table.TableRowSorter;
|
||||||
|
|
||||||
|
import antlr.collections.List;
|
||||||
|
|
||||||
|
public class ArrowIcon implements Icon {
|
||||||
|
private final SortOrder sortOrder;
|
||||||
|
private final int size;
|
||||||
|
private final boolean ascending;
|
||||||
|
public ArrowIcon(TableRowSorter<?> sorter, int column, boolean ascending) {
|
||||||
|
this.ascending = ascending;
|
||||||
|
this.size = 12;
|
||||||
|
java.util.List<? extends SortKey> sortKeys = sorter.getSortKeys();
|
||||||
|
if (sortKeys.size() > 0 && ((RowSorter.SortKey) sortKeys.get(0)).getColumn() == column) {
|
||||||
|
this.sortOrder = ((RowSorter.SortKey) sortKeys.get(0)).getSortOrder();
|
||||||
|
} else {
|
||||||
|
this.sortOrder = SortOrder.ASCENDING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||||
|
Graphics2D g2 = (Graphics2D) g.create();
|
||||||
|
g2.translate(x, y);
|
||||||
|
if (ascending) {
|
||||||
|
g2.rotate(Math.PI, size / 2.0, size / 2.0);
|
||||||
|
}
|
||||||
|
if (sortOrder == SortOrder.ASCENDING) {
|
||||||
|
g2.draw(createUpTriangle(size));
|
||||||
|
} else {
|
||||||
|
g2.draw(createDownTriangle(size));
|
||||||
|
}
|
||||||
|
g2.dispose();
|
||||||
|
}
|
||||||
|
public int getIconWidth() {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
public int getIconHeight() {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
private Polygon createUpTriangle(int size) {
|
||||||
|
Polygon triangle = new Polygon();
|
||||||
|
triangle.addPoint(0, size);
|
||||||
|
triangle.addPoint(size / 2, 0);
|
||||||
|
triangle.addPoint(size, size);
|
||||||
|
return triangle;
|
||||||
|
}
|
||||||
|
private Polygon createDownTriangle(int size) {
|
||||||
|
Polygon triangle = new Polygon();
|
||||||
|
triangle.addPoint(0, 0);
|
||||||
|
triangle.addPoint(size, 0);
|
||||||
|
triangle.addPoint(size / 2, size);
|
||||||
|
return triangle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//±í¸ñÁÐÅÅÐòÀà
|
||||||
|
class ColumnSorter implements Comparator<Object> {
|
||||||
|
private final int col;
|
||||||
|
private final boolean ascending;
|
||||||
|
public ColumnSorter(int col, boolean ascending) {
|
||||||
|
this.col = col;
|
||||||
|
this.ascending = ascending;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int compare(Object a, Object b) {
|
||||||
|
if (a instanceof Comparable && b instanceof Comparable) {
|
||||||
|
if (ascending) {
|
||||||
|
return ((Comparable) a).compareTo((Comparable) b);
|
||||||
|
} else {
|
||||||
|
return ((Comparable) b).compareTo((Comparable) a);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.connor.plm.sb02;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
public class DateTest {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String ssString = "sss.sss";
|
||||||
|
String[] split = ssString.split("\\.");
|
||||||
|
System.out.println(split.length);
|
||||||
|
String takeeffect = "";
|
||||||
|
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-M-dd HH:mm");
|
||||||
|
//LocalDateTime createDate = LocalDateTime.parse(create, fmt);
|
||||||
|
LocalDateTime takeeffectDate = LocalDateTime.parse(takeeffect, fmt);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package com.connor.plm.sb02;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import com.connor.plm.KCommand;
|
||||||
|
import com.connor.plm.KUtil;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||||
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
|
||||||
|
public class DerivedChangeRequestCommand extends KCommand {
|
||||||
|
|
||||||
|
public DerivedChangeRequestCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||||
|
super(app, commandId, actionInfo);
|
||||||
|
TCSession session = (TCSession) app.getSession();
|
||||||
|
String preName = "Connor_Derive_CR";
|
||||||
|
try {
|
||||||
|
String[] prefVals = KUtil.getPrefVals(session, preName);
|
||||||
|
InterfaceAIFComponent targetComponent = app.getTargetComponent();
|
||||||
|
StringBuffer newType = new StringBuffer();
|
||||||
|
if (prefVals == null) {
|
||||||
|
MessageBox.post(preName + "首选项未配置", "提示", MessageBox.INFORMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ArrayList<ControlBean> beanList = new ArrayList<ControlBean>();
|
||||||
|
KUtil.dealPref(prefVals, targetComponent, beanList, newType);
|
||||||
|
System.out.println("newType:" + newType);
|
||||||
|
if (newType.toString().isEmpty()) {
|
||||||
|
MessageBox.post(preName + "首选项配置有误,不存在新建的对象类型", "提示", MessageBox.INFORMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (beanList.size() == 0) {
|
||||||
|
MessageBox.post(preName + "首选项配置有误,不存在选中对象类型的配置", "提示", MessageBox.INFORMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.setRunnable(
|
||||||
|
new DerivedChangeRequestDialog(app, beanList, newType, (TCComponentItemRevision) targetComponent));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
package com.connor.plm.sb02;
|
||||||
|
|
||||||
|
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Font;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import javax.swing.JCheckBox;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JTable;
|
||||||
|
import javax.swing.table.DefaultTableCellRenderer;
|
||||||
|
import javax.swing.table.DefaultTableModel;
|
||||||
|
import javax.swing.table.JTableHeader;
|
||||||
|
import javax.swing.table.TableCellRenderer;
|
||||||
|
|
||||||
|
import javafx.scene.control.TableColumn;
|
||||||
|
|
||||||
|
public class TableDemo extends JFrame{
|
||||||
|
static JTable table;
|
||||||
|
public TableDemo() {
|
||||||
|
|
||||||
|
setSize(600, 600);
|
||||||
|
setLocationRelativeTo(null);
|
||||||
|
|
||||||
|
/*创建表格*/
|
||||||
|
DefaultTableModel model = new DefaultTableModel();
|
||||||
|
model.addColumn("编号",new Vector<Integer>());
|
||||||
|
model.addColumn("书名", new Vector<String>());
|
||||||
|
model.addColumn("作者", new Vector<String>());
|
||||||
|
model.addColumn("是否选中", new Vector<String>());
|
||||||
|
|
||||||
|
table = new JTable(model);
|
||||||
|
JScrollPane jp = new JScrollPane(table);
|
||||||
|
for(int i = 0;i < 20 ;i ++) {
|
||||||
|
model.addRow(new Vector<String>());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
JTableHeader head = table.getTableHeader();
|
||||||
|
//设置表头的大小
|
||||||
|
head.setPreferredSize(new Dimension(head.getWidth(),30));
|
||||||
|
//设置表头字体大小
|
||||||
|
head.setFont(new Font("宋体",Font.BOLD,16));
|
||||||
|
//设置表格的行宽
|
||||||
|
table.setRowHeight(30);
|
||||||
|
//设置表格行中字体大小
|
||||||
|
table.setFont(new Font("宋体",Font.ROMAN_BASELINE,13));
|
||||||
|
/*设置表格中的内容居中*/
|
||||||
|
DefaultTableCellRenderer renderer=new DefaultTableCellRenderer();
|
||||||
|
renderer.setHorizontalAlignment(DefaultTableCellRenderer.CENTER);
|
||||||
|
table.setDefaultRenderer(Object.class, renderer);
|
||||||
|
|
||||||
|
/*定义复选框*/
|
||||||
|
JCheckBox box = new JCheckBox();
|
||||||
|
|
||||||
|
/*getColumn()中数字填对应的第几行添加复选框*/
|
||||||
|
table.getColumnModel().getColumn(3).setCellRenderer(new TableCellRenderer() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getTableCellRendererComponent(JTable table, Object value,
|
||||||
|
boolean isSelected, boolean hasFocus,int row, int column) {
|
||||||
|
|
||||||
|
|
||||||
|
/*设置当复选框被选中整行被渲染*/
|
||||||
|
box.setSelected(isSelected);
|
||||||
|
|
||||||
|
/*设置复选框在单元格中居中*/
|
||||||
|
box.setHorizontalAlignment((int) 0.5f);
|
||||||
|
|
||||||
|
return box;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add(jp);
|
||||||
|
setVisible(true);
|
||||||
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
|
||||||
|
}
|
||||||
|
public static void main(String[] args) {
|
||||||
|
TableDemo t = new TableDemo();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
package com.net.connor.ld.plm.ld06;
|
||||||
|
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Polygon;
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
import javax.swing.Icon;
|
||||||
|
import javax.swing.RowSorter;
|
||||||
|
import javax.swing.RowSorter.SortKey;
|
||||||
|
import javax.swing.SortOrder;
|
||||||
|
import javax.swing.table.TableRowSorter;
|
||||||
|
|
||||||
|
import antlr.collections.List;
|
||||||
|
|
||||||
|
public class ArrowIcon implements Icon {
|
||||||
|
private final SortOrder sortOrder;
|
||||||
|
private final int size;
|
||||||
|
private final boolean ascending;
|
||||||
|
public ArrowIcon(TableRowSorter<?> sorter, int column, boolean ascending) {
|
||||||
|
this.ascending = ascending;
|
||||||
|
this.size = 12;
|
||||||
|
java.util.List<? extends SortKey> sortKeys = sorter.getSortKeys();
|
||||||
|
if (sortKeys.size() > 0 && ((RowSorter.SortKey) sortKeys.get(0)).getColumn() == column) {
|
||||||
|
this.sortOrder = ((RowSorter.SortKey) sortKeys.get(0)).getSortOrder();
|
||||||
|
} else {
|
||||||
|
this.sortOrder = SortOrder.ASCENDING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||||
|
Graphics2D g2 = (Graphics2D) g.create();
|
||||||
|
g2.translate(x, y);
|
||||||
|
if (ascending) {
|
||||||
|
g2.rotate(Math.PI, size / 2.0, size / 2.0);
|
||||||
|
}
|
||||||
|
if (sortOrder == SortOrder.ASCENDING) {
|
||||||
|
g2.draw(createUpTriangle(size));
|
||||||
|
} else {
|
||||||
|
g2.draw(createDownTriangle(size));
|
||||||
|
}
|
||||||
|
g2.dispose();
|
||||||
|
}
|
||||||
|
public int getIconWidth() {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
public int getIconHeight() {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
private Polygon createUpTriangle(int size) {
|
||||||
|
Polygon triangle = new Polygon();
|
||||||
|
triangle.addPoint(0, size);
|
||||||
|
triangle.addPoint(size / 2, 0);
|
||||||
|
triangle.addPoint(size, size);
|
||||||
|
return triangle;
|
||||||
|
}
|
||||||
|
private Polygon createDownTriangle(int size) {
|
||||||
|
Polygon triangle = new Polygon();
|
||||||
|
triangle.addPoint(0, 0);
|
||||||
|
triangle.addPoint(size, 0);
|
||||||
|
triangle.addPoint(size / 2, size);
|
||||||
|
return triangle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//表格列排序类
|
||||||
|
class ColumnSorter implements Comparator<Object> {
|
||||||
|
private final int col;
|
||||||
|
private final boolean ascending;
|
||||||
|
public ColumnSorter(int col, boolean ascending) {
|
||||||
|
this.col = col;
|
||||||
|
this.ascending = ascending;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int compare(Object a, Object b) {
|
||||||
|
if (a instanceof Comparable && b instanceof Comparable) {
|
||||||
|
if (ascending) {
|
||||||
|
return ((Comparable) a).compareTo((Comparable) b);
|
||||||
|
} else {
|
||||||
|
return ((Comparable) b).compareTo((Comparable) a);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.connor.plm;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
|
public class test {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
String value = null;
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-M-dd HH:mm");
|
||||||
|
value = sdf.format("");
|
||||||
|
System.out.println(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in new issue