@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<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="lib" path="lib/commons-collections4-4.1.jar"/>
|
||||
<classpathentry kind="lib" path="lib/poi-3.17.jar"/>
|
||||
<classpathentry kind="lib" path="lib/poi-examples-3.17.jar"/>
|
||||
<classpathentry kind="lib" path="lib/poi-excelant-3.17.jar"/>
|
||||
<classpathentry kind="lib" path="lib/poi-ooxml-3.17.jar"/>
|
||||
<classpathentry kind="lib" path="lib/poi-ooxml-schemas-3.17.jar"/>
|
||||
<classpathentry kind="lib" path="lib/poi-scratchpad-3.17.jar"/>
|
||||
<classpathentry kind="lib" path="lib/xmlbeans-2.6.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/aspose-words-17.4.0-jdk16.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@ -0,0 +1 @@
|
||||
/bin/
|
||||
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>CodeManagement</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,44 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: CodeManagement
|
||||
Bundle-SymbolicName: CodeManagement;singleton:=true
|
||||
Bundle-Version: 1.0.0
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
org.eclipse.ui.forms;bundle-version="3.11.400",
|
||||
org.apache.felix.gogo.runtime;bundle-version="1.1.6",
|
||||
com.teamcenter.rac.ui;bundle-version="14000.3.0",
|
||||
com.teamcenter.rac.aifrcp;bundle-version="14000.3.0",
|
||||
com.teamcenter.rac.viewer;bundle-version="14000.3.0",
|
||||
com.teamcenter.rac.kernel;bundle-version="14000.3.0",
|
||||
com.teamcenter.rac.cme.kernel;bundle-version="14000.3.0",
|
||||
com.teamcenter.rac.cme.framework;bundle-version="14000.3.0",
|
||||
com.teamcenter.rac.ms.util;bundle-version="14000.3.0",
|
||||
com.teamcenter.rac.cme.bvr.connect;bundle-version="14000.3.0",
|
||||
com.teamcenter.rac.ui.commands;bundle-version="14000.3.0",
|
||||
com.teamcenter.rac.cme.license;bundle-version="14000.3.0",
|
||||
com.teamcenter.rac.classification.icm;bundle-version="14000.3.0",
|
||||
com.teamcenter.rac.aif.registryeditor;bundle-version="14000.3.0",
|
||||
com.teamcenter.rac.util;bundle-version="14000.3.0",
|
||||
com.teamcenter.rac.common;bundle-version="14000.3.0",
|
||||
org.eclipse.core.runtime;bundle-version="3.26.0"
|
||||
Automatic-Module-Name: CodeManagement
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Export-Package: PropertyToFile.handlers,
|
||||
codemanagement.handlers,
|
||||
com.origin.beans,
|
||||
com.origin.rac.applications,
|
||||
com.origin.rac.command,
|
||||
com.origin.rac.handler,
|
||||
com.origin.ui,
|
||||
com.teamcenter.rac.common.actions,
|
||||
org.jdesktop.layout
|
||||
Bundle-ClassPath: .,
|
||||
lib/aspose-words-17.4.0-jdk16.jar,
|
||||
lib/commons-collections4-4.1.jar,
|
||||
lib/poi-3.17.jar,
|
||||
lib/poi-examples-3.17.jar,
|
||||
lib/poi-excelant-3.17.jar,
|
||||
lib/poi-ooxml-3.17.jar,
|
||||
lib/poi-ooxml-schemas-3.17.jar,
|
||||
lib/poi-scratchpad-3.17.jar,
|
||||
lib/xmlbeans-2.6.0.jar
|
||||
@ -0,0 +1,18 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = plugin.xml,\
|
||||
META-INF/,\
|
||||
.,\
|
||||
icons/,\
|
||||
src/com/origin/images/,\
|
||||
lib/aspose-words-17.4.0-jdk16.jar,\
|
||||
lib/commons-collections4-4.1.jar,\
|
||||
lib/poi-3.17.jar,\
|
||||
lib/poi-examples-3.17.jar,\
|
||||
lib/poi-excelant-3.17.jar,\
|
||||
lib/poi-ooxml-3.17.jar,\
|
||||
lib/poi-ooxml-schemas-3.17.jar,\
|
||||
lib/poi-scratchpad-3.17.jar,\
|
||||
lib/xmlbeans-2.6.0.jar,\
|
||||
src/com/origin/ui/images/
|
||||
jars.compile.order = .
|
||||
|
After Width: | Height: | Size: 332 B |
|
After Width: | Height: | Size: 526 B |
@ -0,0 +1,151 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
|
||||
<extension
|
||||
point="org.eclipse.ui.commands">
|
||||
|
||||
<command
|
||||
id="com.mycom.my_app.mycommand"
|
||||
name="自动编码后台管理">
|
||||
</command>
|
||||
<command
|
||||
id="PropertyToWordOrExcelCommand"
|
||||
name="提取属性到Word/Excel">
|
||||
</command>
|
||||
|
||||
<command
|
||||
id="com.teamcenter.rac.ui.applicationAutoSortingPSECommand"
|
||||
name="明细序号自动生成">
|
||||
</command>
|
||||
|
||||
<command
|
||||
id="com.teamcenter.rac.ui.WXYSJReportWYCheckCommand"
|
||||
name="检查同层零部件唯一性">
|
||||
</command>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.handlers">
|
||||
<handler
|
||||
class="com.teamcenter.rac.handlers.LegacyHandler:MyAction:com.teamcenter.rac.common.actions.actions"
|
||||
commandId="com.mycom.my_app.mycommand">
|
||||
</handler>
|
||||
<handler commandId="PropertyToWordOrExcelCommand" class="PropertyToFile.handlers.PropertyToHandler"/>
|
||||
|
||||
<handler
|
||||
class="com.origin.rac.handler.WXYSJApplicationAutoSortingPSEHandler"
|
||||
commandId="com.teamcenter.rac.ui.applicationAutoSortingPSECommand">
|
||||
</handler>
|
||||
|
||||
<handler
|
||||
class="com.origin.rac.handler.WXYSJReportWYCheckHandler"
|
||||
commandId="com.teamcenter.rac.ui.WXYSJReportWYCheckCommand">
|
||||
</handler>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.bindings">
|
||||
<key
|
||||
commandId="CodeManagement.commands.sampleCommand"
|
||||
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
|
||||
label="锡压系统管理员菜单"
|
||||
mnemonic="M">
|
||||
<command
|
||||
commandId="com.mycom.my_app.mycommand"
|
||||
mnemonic="S"
|
||||
id="com.mycom.my_app.mycommand">
|
||||
<visibleWhen checkEnabled="true">
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="com.mycom.my_app.mycommand">
|
||||
</equals>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menu>
|
||||
</menuContribution>
|
||||
|
||||
|
||||
<menuContribution
|
||||
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
|
||||
<menu
|
||||
label="客户化菜单"
|
||||
mnemonic="M">
|
||||
<menu
|
||||
label="应用">
|
||||
<command
|
||||
commandId="com.teamcenter.rac.ui.applicationAutoSortingPSECommand"
|
||||
label="明细序号自动生成">
|
||||
</command>
|
||||
<command
|
||||
commandId="com.teamcenter.rac.ui.WXYSJReportWYCheckCommand"
|
||||
label="检查同层零部件唯一性">
|
||||
</command>
|
||||
</menu>
|
||||
</menu>
|
||||
</menuContribution>
|
||||
|
||||
<!--
|
||||
<menuContribution
|
||||
locationURI="menu:customization?after=customizationStart">
|
||||
<menu label="客户化功能">
|
||||
<menu
|
||||
label="应用">
|
||||
<command
|
||||
commandId="com.teamcenter.rac.ui.applicationAutoSortingPSECommand"
|
||||
label="明细序号自动生成">
|
||||
</command>
|
||||
<command
|
||||
commandId="com.teamcenter.rac.ui.WXYSJReportWYCheckCommand"
|
||||
label="检查同层零部件唯一性">
|
||||
<visibleWhen>
|
||||
<reference
|
||||
definitionId="com.teamcenter.rac.pse.inMainView">
|
||||
</reference>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menu>
|
||||
</menu>
|
||||
</menuContribution>
|
||||
-->
|
||||
|
||||
<!-- 右键-->
|
||||
<menuContribution locationURI="popup:org.eclipse.ui.popup.any?after=additions">
|
||||
<command id="PropertyToWordOrExcelCommand" commandId="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="PropertyToWordOrExcelCommand" />
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
@ -0,0 +1,41 @@
|
||||
package PropertyToFile.handlers;
|
||||
|
||||
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.TCSession;
|
||||
|
||||
public class PropertyToHandler extends AbstractHandler{
|
||||
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
AbstractAIFApplication app = AIFUtility.getCurrentApplication();
|
||||
TCSession session = (TCSession) app.getSession();
|
||||
try {
|
||||
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
try {
|
||||
new PropertyToWordOrExcelOperation(app,session);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}.start();
|
||||
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,333 @@
|
||||
package PropertyToFile.handlers;
|
||||
|
||||
import java.awt.Window;
|
||||
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.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.teamcenter.rac.aif.AIFDesktop;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.AbstractAIFOperation;
|
||||
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.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.FileUtility;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class PropertyToWordOrExcelOperation extends AbstractAIFOperation{
|
||||
|
||||
private AbstractAIFApplication app;
|
||||
private TCSession session;
|
||||
|
||||
public PropertyToWordOrExcelOperation(AbstractAIFApplication app,TCSession session) throws Exception {
|
||||
super();
|
||||
this.app = app;
|
||||
this.session = session;
|
||||
executeOperation();
|
||||
}
|
||||
final String preName = "Connor_WordExcel_Report_ItemType";
|
||||
|
||||
|
||||
@Override
|
||||
public void executeOperation() throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
System.out.println("33333333333");
|
||||
new Thread().sleep(1000);
|
||||
InterfaceAIFComponent targetComponent = app.getTargetComponent();
|
||||
TCComponentItemRevision revision = (TCComponentItemRevision) targetComponent;
|
||||
String[] prefVals = getPrefVals(session, preName);
|
||||
if(prefVals == null || prefVals.length == 0) {
|
||||
info(AIFDesktop.getActiveDesktop(), preName + "该首选项未配置,请联系管理员!");
|
||||
return;
|
||||
}
|
||||
String relatioin = prefVals[0];
|
||||
TCComponent[] relatedComponents = revision.getRelatedComponents(relatioin);
|
||||
if(relatedComponents == null || relatedComponents.length == 0) {
|
||||
info(AIFDesktop.getActiveDesktop(), "选中对象的 " + relatioin + " 关系下没有数据集");
|
||||
return;
|
||||
}
|
||||
//处理首选项
|
||||
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("=");
|
||||
nameMap.put(split[1],split[0]);
|
||||
}
|
||||
}
|
||||
for (TCComponent tcComponent : relatedComponents) {
|
||||
if (tcComponent instanceof TCComponentDataset) {
|
||||
TCComponentDataset dataset = (TCComponentDataset) tcComponent;
|
||||
File datasetFile = 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});
|
||||
}
|
||||
}
|
||||
}
|
||||
info(AIFDesktop.getActiveDesktop(), "提取对象版本属性到Word Excel执行完成");
|
||||
|
||||
}
|
||||
|
||||
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
dataMap.put(key, preConfigValue);
|
||||
}
|
||||
//String newPath = "";
|
||||
if(type.equals("doc")) {
|
||||
//newPath = path.replace(".doc", "temp.doc");
|
||||
WordUtils.replaceBookmarksByDoc(inputStream, Files.newOutputStream(Paths.get(path)), dataMap);
|
||||
}
|
||||
else if(type.equals("docx")) {
|
||||
//newPath = path.replace(".docx", "temp.docx");
|
||||
WordUtils.replaceBookmarksByDocx(inputStream, Files.newOutputStream(Paths.get(path)), dataMap);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
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(path);
|
||||
Map<String, String> dataMap = new HashMap<>();
|
||||
for(String key : nameMap.keySet()) {
|
||||
String preConfigValue = getPreConfigValue(revision,nameMap,nameMap.get(key));
|
||||
dataMap.put(key, preConfigValue);
|
||||
}
|
||||
System.out.println(" document2.getRange().getBookmarks()==="+ document2.getRange().getBookmarks().getCount());
|
||||
|
||||
for (Bookmark bookmark : document2.getRange().getBookmarks()) {
|
||||
System.out.println("11111111111");
|
||||
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 path;
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到首选项中“=”左边对应的属性值
|
||||
* @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) {
|
||||
System.out.println("split1========"+split[0]);
|
||||
System.out.println("split1========"+split[1]);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//kUtil
|
||||
|
||||
public static boolean isEmpty(String str) {
|
||||
return str == null || "".equals(str.trim());
|
||||
}
|
||||
|
||||
public static String[] getPrefVals(TCSession session, String prefName) throws Exception {
|
||||
if (isEmpty(prefName)) {
|
||||
return null;
|
||||
}
|
||||
return session.getPreferenceService().getStringValues(prefName);
|
||||
}
|
||||
|
||||
public static void info(Window dialog, String msg) {
|
||||
MessageBox.post(dialog, msg, "", MessageBox.INFORMATION);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static File getDatasetFile(TCComponentDataset dataset) throws Exception {
|
||||
File[] files = dataset.getFiles("", System.getenv("TEMP"));
|
||||
if (files == null || files.length == 0) {
|
||||
throw new Exception(String.format("没有数据集!", dataset.toString()));
|
||||
}
|
||||
System.out.println(">> Download file (" + files.length + "): " + files[0].getAbsolutePath());
|
||||
return files[0];
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package codemanagement.handlers;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
|
||||
public class SampleHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
|
||||
MessageDialog.openInformation(
|
||||
window.getShell(),
|
||||
"CodeManagement",
|
||||
"Hello, Eclipse world");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.origin.beans;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import javax.swing.DefaultListModel;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
public class KelsenJList
|
||||
extends JPanel
|
||||
{
|
||||
JLabel iconLabel = null;
|
||||
JList iconJList = null;
|
||||
DefaultListModel dlm;
|
||||
|
||||
public KelsenJList(Object[][] obj)
|
||||
{
|
||||
this.dlm = new DefaultListModel();
|
||||
for (int i = 0; i < obj.length; i++) {
|
||||
this.dlm.addElement(obj[i]);
|
||||
}
|
||||
this.iconJList = new JList(this.dlm);
|
||||
iconJList.setCellRenderer(new KelsenJListCellRenderer());
|
||||
JScrollPane jsp = new JScrollPane(this.iconJList);
|
||||
setLayout(new BorderLayout());
|
||||
add(jsp);
|
||||
}
|
||||
|
||||
public JList getJList()
|
||||
{
|
||||
return this.iconJList;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,134 @@
|
||||
package com.origin.beans;
|
||||
|
||||
import java.awt.Container;
|
||||
import java.awt.FlowLayout;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
|
||||
public class KelsenMoveThread
|
||||
extends Thread
|
||||
{
|
||||
private String strTitle;
|
||||
private String str1;
|
||||
private String str2;
|
||||
Object component;
|
||||
boolean flag = false;
|
||||
Thread threadOutside = null;
|
||||
String strSpace = " ";
|
||||
|
||||
public KelsenMoveThread(Object objJComponent)
|
||||
{
|
||||
this.str1 = "";
|
||||
this.strSpace = " ";
|
||||
if ((objJComponent instanceof JFrame))
|
||||
{
|
||||
JFrame jframe = (JFrame)objJComponent;
|
||||
this.strTitle = jframe.getTitle();
|
||||
}
|
||||
else if ((objJComponent instanceof JLabel))
|
||||
{
|
||||
JLabel jlabel = (JLabel)objJComponent;
|
||||
this.strTitle = jlabel.getText();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.strTitle = "dddd";
|
||||
}
|
||||
this.component = objJComponent;
|
||||
}
|
||||
|
||||
public KelsenMoveThread(Object objJComponent, Thread kthread)
|
||||
{
|
||||
this.str1 = "";
|
||||
this.strSpace = " ";
|
||||
if ((objJComponent instanceof JFrame))
|
||||
{
|
||||
JFrame jframe = (JFrame)objJComponent;
|
||||
this.strTitle = jframe.getTitle();
|
||||
}
|
||||
else if ((objJComponent instanceof JLabel))
|
||||
{
|
||||
JLabel jlabel = (JLabel)objJComponent;
|
||||
this.strTitle = jlabel.getText();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.strTitle = "dddd";
|
||||
}
|
||||
this.component = objJComponent;
|
||||
this.threadOutside = kthread;
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
if (this.threadOutside != null)
|
||||
{
|
||||
JLabel jlabel = (JLabel)this.component;
|
||||
jlabel.setText("");
|
||||
try
|
||||
{
|
||||
sleep(1000L);
|
||||
}
|
||||
catch (Exception localException1) {}
|
||||
}
|
||||
for (int j = 0; j < this.strTitle.length(); j++)
|
||||
{
|
||||
try
|
||||
{
|
||||
sleep(1L);
|
||||
}
|
||||
catch (Exception localException2) {}
|
||||
this.str2 = new String(this.strSpace + this.strTitle.charAt(j));
|
||||
int i = this.str2.length();
|
||||
for (int k = 0; k < i - 1; k++)
|
||||
{
|
||||
try
|
||||
{
|
||||
sleep(2L);
|
||||
}
|
||||
catch (Exception localException3) {}
|
||||
if ((this.component instanceof JFrame))
|
||||
{
|
||||
JFrame jframe = (JFrame)this.component;
|
||||
jframe.setTitle(this.str1 + this.str2);
|
||||
}
|
||||
if ((this.component instanceof JLabel))
|
||||
{
|
||||
JLabel jlabel = (JLabel)this.component;
|
||||
jlabel.setText(this.str1 + this.str2);
|
||||
}
|
||||
this.str2 = this.str2.substring(1, this.str2.length());
|
||||
}
|
||||
this.str1 += this.str2;
|
||||
if (j == this.strTitle.length() - 1) {
|
||||
try
|
||||
{
|
||||
if (this.threadOutside == null) {
|
||||
break;
|
||||
}
|
||||
this.threadOutside.start();
|
||||
}
|
||||
catch (Exception localException4)
|
||||
{
|
||||
j = -1;
|
||||
this.str1 = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
JFrame frame = new JFrame("这个就使船方将阿空间法阿四地方 ");
|
||||
JLabel lbl = new JLabel("ABCDEFGHIJKLMN ");
|
||||
Container con = frame.getContentPane();
|
||||
con.setLayout(new FlowLayout());
|
||||
con.add(lbl);
|
||||
frame.setSize(500, 500);
|
||||
frame.setVisible(true);
|
||||
KelsenMoveThread kt = new KelsenMoveThread(frame);
|
||||
kt.start();
|
||||
KelsenMoveThread kt2 = new KelsenMoveThread(lbl);
|
||||
kt2.start();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,133 @@
|
||||
package com.origin.beans;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||
import java.awt.Color;
|
||||
import java.awt.Container;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Toolkit;
|
||||
import java.net.URL;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.JWindow;
|
||||
|
||||
public class KelsenStartWindow
|
||||
extends JWindow
|
||||
implements Runnable
|
||||
{
|
||||
Thread splashThread;
|
||||
JProgressBar progress;
|
||||
private boolean B_KStartWindow_Flag = true;
|
||||
public int intTime = 30;
|
||||
AbstractAIFUIApplication app;
|
||||
|
||||
public KelsenStartWindow(AbstractAIFUIApplication app)
|
||||
{
|
||||
this.app = app;
|
||||
Container container = getContentPane();
|
||||
setCursor(Cursor.getPredefinedCursor(3));
|
||||
URL url = getClass().getResource("login.jpg");
|
||||
if (url != null) {
|
||||
container.add(new JLabel(new ImageIcon(url)), "Center");
|
||||
}
|
||||
this.progress = new JProgressBar(1, 100);
|
||||
this.progress.setStringPainted(true);
|
||||
this.progress.setString("数据加载中,请稍候......");
|
||||
this.progress.setBackground(Color.white);
|
||||
container.add(this.progress, "South");
|
||||
|
||||
Dimension screen = getToolkit().getScreenSize();
|
||||
pack();
|
||||
setLocation((screen.width - getSize().width) / 2,
|
||||
(screen.height - getSize().height) / 2);
|
||||
}
|
||||
|
||||
public KelsenStartWindow()
|
||||
{
|
||||
this.app = this.app;
|
||||
Container container = getContentPane();
|
||||
setCursor(Cursor.getPredefinedCursor(3));
|
||||
URL url = getClass().getResource("login.jpg");
|
||||
if (url != null) {
|
||||
container.add(new JLabel(new ImageIcon(url)), "Center");
|
||||
}
|
||||
this.progress = new JProgressBar(1, 100);
|
||||
this.progress.setStringPainted(true);
|
||||
this.progress.setString("编码数据加载中,请稍候......................");
|
||||
this.progress.setBackground(Color.white);
|
||||
container.add(this.progress, "South");
|
||||
|
||||
Dimension screen = getToolkit().getScreenSize();
|
||||
pack();
|
||||
setLocation((screen.width - getSize().width) / 2,
|
||||
(screen.height - getSize().height) / 2);
|
||||
}
|
||||
|
||||
public KelsenStartWindow(int kintTime)
|
||||
{
|
||||
this.app = this.app;
|
||||
this.intTime = kintTime;
|
||||
Container container = getContentPane();
|
||||
setCursor(Cursor.getPredefinedCursor(3));
|
||||
URL url = getClass().getResource("login.jpg");
|
||||
if (url != null) {
|
||||
container.add(new JLabel(new ImageIcon(url)), "Center");
|
||||
}
|
||||
this.progress = new JProgressBar(1, 100);
|
||||
this.progress.setStringPainted(true);
|
||||
|
||||
this.progress.setString("稍候...");
|
||||
this.progress.setBackground(Color.white);
|
||||
container.add(this.progress, "South");
|
||||
|
||||
Dimension screen = getToolkit().getScreenSize();
|
||||
pack();
|
||||
setLocation((screen.width - getSize().width) / 2,
|
||||
(screen.height - getSize().height) / 2);
|
||||
}
|
||||
|
||||
public void start()
|
||||
{
|
||||
toFront();
|
||||
this.splashThread = new Thread(this);
|
||||
this.splashThread.start();
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
setVisible(true);
|
||||
try
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
Thread.sleep(this.intTime);
|
||||
if (!this.B_KStartWindow_Flag) {
|
||||
break;
|
||||
}
|
||||
this.progress.setValue(this.progress.getValue() + 1);
|
||||
if (this.progress.getValue() == 100) {
|
||||
this.progress.setValue(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
|
||||
|
||||
dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public void stop()
|
||||
{
|
||||
this.B_KStartWindow_Flag = false;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
KelsenStartWindow splash = new KelsenStartWindow(160);
|
||||
splash.start();
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 685 B |
|
After Width: | Height: | Size: 383 B |
|
After Width: | Height: | Size: 506 B |
|
After Width: | Height: | Size: 799 B |
|
After Width: | Height: | Size: 649 B |
|
After Width: | Height: | Size: 660 B |
|
After Width: | Height: | Size: 608 B |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 567 B |
|
After Width: | Height: | Size: 617 B |
|
After Width: | Height: | Size: 576 B |
|
After Width: | Height: | Size: 661 B |
|
After Width: | Height: | Size: 685 B |
|
After Width: | Height: | Size: 570 B |
|
After Width: | Height: | Size: 897 B |
|
After Width: | Height: | Size: 798 B |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 8.8 KiB |
|
After Width: | Height: | Size: 328 B |
|
After Width: | Height: | Size: 837 B |
|
After Width: | Height: | Size: 839 B |
|
After Width: | Height: | Size: 728 B |
|
After Width: | Height: | Size: 834 B |
|
After Width: | Height: | Size: 772 B |
|
After Width: | Height: | Size: 820 B |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 743 B |
|
After Width: | Height: | Size: 775 B |
|
After Width: | Height: | Size: 856 B |
|
After Width: | Height: | Size: 671 B |
|
After Width: | Height: | Size: 775 B |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 665 B |
|
After Width: | Height: | Size: 831 B |
|
After Width: | Height: | Size: 526 B |
|
After Width: | Height: | Size: 838 B |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 739 B |
|
After Width: | Height: | Size: 9.4 KiB |
@ -0,0 +1,63 @@
|
||||
package com.origin.rac.applications;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
public class WXYSJApplicationAutoSortingPSE
|
||||
{
|
||||
private AbstractAIFUIApplication abstractaifuiapplication_local;
|
||||
private TCSession tcsession;
|
||||
|
||||
public WXYSJApplicationAutoSortingPSE(AbstractAIFUIApplication abstractaifuiapplication)
|
||||
{
|
||||
this.abstractaifuiapplication_local = abstractaifuiapplication;
|
||||
this.tcsession = ((TCSession)this.abstractaifuiapplication_local.getSession());
|
||||
}
|
||||
|
||||
public void startRunning()
|
||||
{
|
||||
TCComponentBOMLine tcBomLine = (TCComponentBOMLine)this.abstractaifuiapplication_local.getTargetComponent();
|
||||
if (tcBomLine != null)
|
||||
{
|
||||
Object[] options = { "确定", "取消" };
|
||||
int selectIndex = JOptionPane.showOptionDialog(null, "是否进行明细号自动生成", "消息提示",
|
||||
-1, -1,
|
||||
null, options, options[1]);
|
||||
if (selectIndex == 0)
|
||||
{
|
||||
System.out.println("确定");
|
||||
try
|
||||
{
|
||||
AIFComponentContext[] aifcomponentcontext = tcBomLine.getChildren();
|
||||
if (aifcomponentcontext.length <= 0) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < aifcomponentcontext.length; i++)
|
||||
{
|
||||
tcBomLine = (TCComponentBOMLine)aifcomponentcontext[i].getComponent();
|
||||
tcBomLine.setProperty("Detail_ID", Integer.toString(i + 1));
|
||||
}
|
||||
}
|
||||
catch (TCException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
MessageBox.post(e.getError(),"提示",2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("取消");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.post("没有对象被选中", "消息提示", 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
package com.origin.rac.applications;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
import java.util.Vector;
|
||||
|
||||
public class WXYSJReportWYCheck
|
||||
{
|
||||
private AbstractAIFUIApplication abstractaifuiapplication_local;
|
||||
private TCSession tcsession;
|
||||
private Vector<TCComponentBOMLine> vectorAllNodes;
|
||||
|
||||
public WXYSJReportWYCheck(AbstractAIFUIApplication abstractaifuiapplication)
|
||||
{
|
||||
this.abstractaifuiapplication_local = abstractaifuiapplication;
|
||||
this.tcsession = ((TCSession)this.abstractaifuiapplication_local.getSession());
|
||||
}
|
||||
|
||||
public void startRunning()
|
||||
{
|
||||
this.vectorAllNodes = new Vector();
|
||||
TCComponentBOMLine tcBOMLineTop = (TCComponentBOMLine)this.abstractaifuiapplication_local.getTargetComponent();
|
||||
try
|
||||
{
|
||||
if (tcBOMLineTop != null)
|
||||
{
|
||||
int intCount = tcBOMLineTop.getChildrenCount();
|
||||
if (intCount > 0)
|
||||
{
|
||||
StringBuilder strInformation = new StringBuilder();
|
||||
String strIn = "重复的零件ID如下:\n";
|
||||
strInformation.append(strIn);
|
||||
TCComponentBOMLine itemRev01 = null;
|
||||
TCComponentBOMLine itemRev02 = null;
|
||||
AIFComponentContext[] aifcomponentcontext = tcBOMLineTop.getChildren();
|
||||
for (int i = 0; i < aifcomponentcontext.length - 1; i++)
|
||||
{
|
||||
itemRev01 = (TCComponentBOMLine)aifcomponentcontext[i].getComponent();
|
||||
if (intCount >= 2) {
|
||||
for (int j = i + 1; j < aifcomponentcontext.length; j++)
|
||||
{
|
||||
itemRev02 = (TCComponentBOMLine)aifcomponentcontext[j].getComponent();
|
||||
if (itemRev01.getProperty("bl_rev_current_id").equals(itemRev02.getProperty("bl_rev_current_id"))) {
|
||||
strInformation.append(aifcomponentcontext[i] + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (strInformation.toString().length() > strIn.length()) {
|
||||
MessageBox.post(strInformation.toString(), "消息提示", 2);
|
||||
} else {
|
||||
MessageBox.post("检查完毕,未发现相同零部件", "消息提示", 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.post("未正确选择,请选择有结构的对象", "消息提示", 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.post("没有对象被选中", "消息提示", 2);
|
||||
}
|
||||
}
|
||||
catch (TCException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void judgeQT_TZAllNodes(TCComponentBOMLine tccomponentbomline)
|
||||
{
|
||||
TCComponentBOMLine tcBOMLine = null;
|
||||
String releaseState = "";
|
||||
try
|
||||
{
|
||||
if (tccomponentbomline.getChildrenCount() > 0)
|
||||
{
|
||||
AIFComponentContext[] aifcomponentcontext = tccomponentbomline.getChildren();
|
||||
for (int i = 0; i < aifcomponentcontext.length; i++)
|
||||
{
|
||||
tcBOMLine = (TCComponentBOMLine)aifcomponentcontext[i].getComponent();
|
||||
releaseState = tcBOMLine.getProperty("bl_rev_release_statuses");
|
||||
if ((!releaseState.contains("XYDesRelease")) && (!releaseState.contains("XYRelease"))) {
|
||||
this.vectorAllNodes.addElement(tcBOMLine);
|
||||
}
|
||||
judgeQT_TZAllNodes(tcBOMLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (TCException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
MessageBox.post(e.getError(), "消息提示", 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package com.origin.rac.command;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFCommand;
|
||||
import com.teamcenter.rac.aif.AbstractAIFOperation;
|
||||
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.Registry;
|
||||
|
||||
public abstract class AbstractWXYSJReportCommand
|
||||
extends AbstractAIFCommand
|
||||
{
|
||||
private AbstractAIFUIApplication application = null;
|
||||
private TCSession tcsession = null;
|
||||
private Registry reg = null;
|
||||
|
||||
public AbstractWXYSJReportCommand(AbstractAIFUIApplication application)
|
||||
{
|
||||
this.application = application;
|
||||
this.tcsession = ((TCSession)application.getSession());
|
||||
this.reg = Registry.getRegistry(this);
|
||||
startRunning();
|
||||
}
|
||||
|
||||
public void startRunning()
|
||||
{
|
||||
this.tcsession.queueOperation(new AbstractAIFOperation(this.reg.getString("create.MESSAGE", "Êý¾Ý´¦ÀíÖÐ..."))
|
||||
{
|
||||
public void executeOperation()
|
||||
throws Exception
|
||||
{
|
||||
AbstractWXYSJReportCommand.this.reportRunning(AbstractWXYSJReportCommand.this.application);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected abstract void reportRunning(AbstractAIFUIApplication paramAbstractAIFUIApplication);
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.origin.rac.command;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||
import com.origin.rac.applications.WXYSJApplicationAutoSortingPSE;
|
||||
|
||||
public class WXYSJApplicationAutoSortingPSECommand
|
||||
extends AbstractWXYSJReportCommand
|
||||
{
|
||||
public WXYSJApplicationAutoSortingPSECommand(AbstractAIFUIApplication application)
|
||||
{
|
||||
super(application);
|
||||
}
|
||||
|
||||
protected void reportRunning(AbstractAIFUIApplication application)
|
||||
{
|
||||
WXYSJApplicationAutoSortingPSE start = new WXYSJApplicationAutoSortingPSE(application);
|
||||
start.startRunning();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.origin.rac.command;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||
import com.origin.rac.applications.WXYSJReportWYCheck;
|
||||
|
||||
public class WXYSJReportWYCheckCommand
|
||||
extends AbstractWXYSJReportCommand
|
||||
{
|
||||
public WXYSJReportWYCheckCommand(AbstractAIFUIApplication application)
|
||||
{
|
||||
super(application);
|
||||
}
|
||||
|
||||
protected void reportRunning(AbstractAIFUIApplication application)
|
||||
{
|
||||
WXYSJReportWYCheck report = new WXYSJReportWYCheck(application);
|
||||
report.startRunning();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.origin.rac.handler;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
public abstract class AbstractWXYSJHandler
|
||||
extends AbstractHandler
|
||||
{
|
||||
private AbstractAIFUIApplication application;
|
||||
|
||||
public Object execute(ExecutionEvent arg0)
|
||||
throws ExecutionException
|
||||
{
|
||||
this.application = AIFUtility.getCurrentApplication();
|
||||
try
|
||||
{
|
||||
startRunning(this.application);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
MessageBox.post(exception, true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected abstract void startRunning(AbstractAIFUIApplication paramAbstractAIFUIApplication);
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.origin.rac.handler;
|
||||
|
||||
import com.origin.rac.command.WXYSJApplicationAutoSortingPSECommand;
|
||||
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||
|
||||
public class WXYSJApplicationAutoSortingPSEHandler
|
||||
extends AbstractWXYSJHandler
|
||||
{
|
||||
protected void startRunning(AbstractAIFUIApplication application)
|
||||
{
|
||||
try
|
||||
{
|
||||
WXYSJApplicationAutoSortingPSECommand command = new WXYSJApplicationAutoSortingPSECommand(application);
|
||||
command.executeModal();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.origin.rac.handler;
|
||||
|
||||
import com.origin.rac.command.WXYSJReportWYCheckCommand;
|
||||
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||
|
||||
public class WXYSJReportWYCheckHandler
|
||||
extends AbstractWXYSJHandler
|
||||
{
|
||||
protected void startRunning(AbstractAIFUIApplication application)
|
||||
{
|
||||
WXYSJReportWYCheckCommand command = new WXYSJReportWYCheckCommand(application);
|
||||
try
|
||||
{
|
||||
command.executeModal();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,190 @@
|
||||
package com.origin.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import org.jdesktop.layout.GroupLayout;
|
||||
import org.jdesktop.layout.GroupLayout.ParallelGroup;
|
||||
import org.jdesktop.layout.GroupLayout.SequentialGroup;
|
||||
|
||||
public class JPanel_JTabelDataEdit
|
||||
extends JPanel
|
||||
{
|
||||
AutoCodeMainPanel acmp;
|
||||
JTable table;
|
||||
JDialog dialog;
|
||||
private JButton jButton1;
|
||||
private JButton jButton2;
|
||||
private JButton jButton3;
|
||||
private JScrollPane jScrollPane1;
|
||||
private JTable jTableSingle;
|
||||
|
||||
public JPanel_JTabelDataEdit()
|
||||
{
|
||||
initComponents();
|
||||
}
|
||||
|
||||
public JPanel_JTabelDataEdit(JTable table, AutoCodeMainPanel acmp, JDialog dialog)
|
||||
{
|
||||
this.dialog = dialog;
|
||||
this.acmp = acmp;
|
||||
this.table = table;
|
||||
initComponents();
|
||||
this.jTableSingle.setModel(table.getModel());
|
||||
}
|
||||
|
||||
private void initComponents()
|
||||
{
|
||||
this.jScrollPane1 = new JScrollPane();
|
||||
this.jTableSingle = new JTable();
|
||||
this.jButton1 = new JButton();
|
||||
this.jButton2 = new JButton();
|
||||
this.jButton3 = new JButton();
|
||||
|
||||
setBackground(new Color(255, 255, 255));
|
||||
setBorder(BorderFactory.createTitledBorder(null, "内容编辑",
|
||||
0,
|
||||
0,
|
||||
new Font("新宋体", 0, 12)));
|
||||
|
||||
this.jTableSingle.setFont(new Font("新宋体", 0, 12));
|
||||
this.jTableSingle.setModel(new DefaultTableModel(
|
||||
new Object[][] { new Object[2] },
|
||||
new String[] { "内部值", "显示值" }));
|
||||
this.jTableSingle
|
||||
.addPropertyChangeListener(new PropertyChangeListener()
|
||||
{
|
||||
public void propertyChange(PropertyChangeEvent evt)
|
||||
{
|
||||
JPanel_JTabelDataEdit.this.jTableSinglePropertyChange(evt);
|
||||
}
|
||||
});
|
||||
this.jScrollPane1.setViewportView(this.jTableSingle);
|
||||
|
||||
this.jButton1.setBackground(new Color(255, 255, 255));
|
||||
this.jButton1.setFont(new Font("新宋体", 0, 12));
|
||||
this.jButton1.setText("确定");
|
||||
this.jButton1.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent evt)
|
||||
{
|
||||
JPanel_JTabelDataEdit.this.jButton1ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
this.jButton2.setBackground(new Color(255, 255, 255));
|
||||
this.jButton2.setFont(new Font("新宋体", 0, 12));
|
||||
this.jButton2.setText("清除");
|
||||
this.jButton2.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent evt)
|
||||
{
|
||||
JPanel_JTabelDataEdit.this.jButton2ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
this.jButton3.setBackground(new Color(255, 255, 255));
|
||||
this.jButton3.setFont(new Font("新宋体", 0, 12));
|
||||
this.jButton3.setText("关闭");
|
||||
this.jButton3.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent evt)
|
||||
{
|
||||
JPanel_JTabelDataEdit.this.jButton3ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
GroupLayout layout = new GroupLayout(
|
||||
this);
|
||||
setLayout(layout);
|
||||
layout
|
||||
.setHorizontalGroup(layout
|
||||
.createParallelGroup(
|
||||
1)
|
||||
.add(
|
||||
layout
|
||||
.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.add(
|
||||
layout
|
||||
.createParallelGroup(
|
||||
1)
|
||||
.add(
|
||||
this.jScrollPane1,
|
||||
-1,
|
||||
614,
|
||||
32767)
|
||||
.add(
|
||||
2,
|
||||
layout
|
||||
.createSequentialGroup()
|
||||
.add(
|
||||
this.jButton1,
|
||||
-2,
|
||||
116,
|
||||
-2)
|
||||
.addPreferredGap(
|
||||
0,
|
||||
370,
|
||||
32767)
|
||||
.add(
|
||||
this.jButton2)
|
||||
.addPreferredGap(
|
||||
1)
|
||||
.add(
|
||||
this.jButton3)))
|
||||
.addContainerGap()));
|
||||
layout
|
||||
.setVerticalGroup(layout
|
||||
.createParallelGroup(
|
||||
1)
|
||||
.add(
|
||||
layout
|
||||
.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.add(
|
||||
this.jScrollPane1,
|
||||
-2,
|
||||
-1,
|
||||
-2)
|
||||
.addPreferredGap(
|
||||
0,
|
||||
11, 32767)
|
||||
.add(
|
||||
layout
|
||||
.createParallelGroup(
|
||||
3)
|
||||
.add(this.jButton2).add(
|
||||
this.jButton3).add(
|
||||
this.jButton1))
|
||||
.addContainerGap()));
|
||||
}
|
||||
|
||||
private void jTableSinglePropertyChange(PropertyChangeEvent evt)
|
||||
{
|
||||
this.acmp.controlTheTable(this.table);
|
||||
this.acmp.removeNotFinalDatas(this.table);
|
||||
}
|
||||
|
||||
private void jButton3ActionPerformed(ActionEvent evt)
|
||||
{
|
||||
this.dialog.dispose();
|
||||
}
|
||||
|
||||
private void jButton2ActionPerformed(ActionEvent evt)
|
||||
{
|
||||
this.acmp.clearAllData(this.table);
|
||||
}
|
||||
|
||||
private void jButton1ActionPerformed(ActionEvent evt)
|
||||
{
|
||||
this.dialog.dispose();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package com.origin.ui;
|
||||
|
||||
import java.io.PrintStream;
|
||||
|
||||
public class KCharacterStringParser
|
||||
{
|
||||
public String orgContentFromTowMarker(String str_Left, String str_Right, String str_in)
|
||||
{
|
||||
String str_result = null;
|
||||
int i_left = str_in.indexOf(str_Left);
|
||||
int i_right = str_in.indexOf(str_Right);
|
||||
System.out.println("¡¾orgContentFromTowMarker¡¿\n[i_left]" +
|
||||
i_left +
|
||||
"\n[i_right]" + i_right);
|
||||
if ((i_left == -1) || (i_right == -1)) {
|
||||
return "";
|
||||
}
|
||||
str_result = str_in.substring(i_left + 1, i_right);
|
||||
return str_result;
|
||||
}
|
||||
|
||||
public String orgContentFromLeftMarker(String str_Left, String str_in)
|
||||
{
|
||||
String str_result = null;
|
||||
if (str_in.indexOf(str_Left) == -1) {
|
||||
return str_in;
|
||||
}
|
||||
try
|
||||
{
|
||||
str_result = str_in.split(str_Left)[0];
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
str_result = "";
|
||||
}
|
||||
return str_result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,94 @@
|
||||
package com.origin.ui;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dialog;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
public class OrgInputDialog
|
||||
extends AbstractAIFDialog
|
||||
{
|
||||
JPanel p_main;
|
||||
public JTextField txt_main;
|
||||
public JTextField txt_description;
|
||||
public JComboBox comb_code;
|
||||
JButton btn_ok;
|
||||
JButton btn_cancel;
|
||||
GridLayout gridlayout;
|
||||
public boolean b_falg = false;
|
||||
|
||||
public OrgInputDialog(Dialog dialog, boolean arg1, String str_title)
|
||||
{
|
||||
super(dialog, arg1);
|
||||
setTitle(str_title);
|
||||
init();
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
this.gridlayout = new GridLayout(2, 1);
|
||||
this.p_main = new JPanel();
|
||||
this.p_main.setLayout(this.gridlayout);
|
||||
this.txt_main = new JTextField(35);
|
||||
this.txt_description = new JTextField(35);
|
||||
this.comb_code = new JComboBox(new Object[] { "", "虚" });
|
||||
this.comb_code.setEditable(true);
|
||||
JPanel p_temp2 = new JPanel();
|
||||
p_temp2.setLayout(new BorderLayout());
|
||||
JPanel p_main_des = new JPanel();
|
||||
p_main_des.add(this.txt_main);
|
||||
p_main_des.add(this.txt_description);
|
||||
p_temp2.add("Center", p_main_des);
|
||||
JPanel p_code = new JPanel();
|
||||
p_code.add(this.comb_code);
|
||||
p_temp2.add("East", p_code);
|
||||
this.p_main.add(p_temp2);
|
||||
this.btn_ok = new JButton("确定");
|
||||
this.btn_cancel = new JButton("放弃");
|
||||
JPanel p_temp = new JPanel();
|
||||
p_temp.add(this.btn_ok);
|
||||
p_temp.add(this.btn_cancel);
|
||||
this.p_main.add(p_temp);
|
||||
getContentPane().add(this.p_main);
|
||||
pack();
|
||||
actioninit();
|
||||
}
|
||||
|
||||
public void actioninit()
|
||||
{
|
||||
this.btn_ok.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent arg0)
|
||||
{
|
||||
if (OrgInputDialog.this.txt_main.getText().trim().equals(""))
|
||||
{
|
||||
new MessageBox("节点名字不能为空!", "", "警告", 2, true).setVisible(true);
|
||||
}
|
||||
else if (OrgInputDialog.this.comb_code.getSelectedItem().toString().equals(""))
|
||||
{
|
||||
new MessageBox("类别代码不能为空!", "", "警告", 2, true).setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
OrgInputDialog.this.b_falg = true;
|
||||
OrgInputDialog.this.dispose();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.btn_cancel.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
OrgInputDialog.this.dispose();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.origin.ui;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||
import java.awt.Dialog;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTree;
|
||||
|
||||
public class OrgSingleTreeEditDialog
|
||||
extends AbstractAIFDialog
|
||||
{
|
||||
Dialog dialog;
|
||||
boolean flag;
|
||||
JTree t_main;
|
||||
AutoCodeMainPanel acmp;
|
||||
|
||||
public OrgSingleTreeEditDialog(Dialog dialog, boolean flag, JTree t_main, AutoCodeMainPanel acmp, int i_index, JScrollPane jsp_in)
|
||||
{
|
||||
super(dialog, flag);
|
||||
this.t_main = t_main;
|
||||
if (t_main == null) {
|
||||
JOptionPane.showMessageDialog(null, "222222");
|
||||
}
|
||||
add(new SingleTreeEditPanel(t_main, acmp, this, i_index, jsp_in));
|
||||
setLocation(150, 150);
|
||||
pack();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package com.origin.ui;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Toolkit;
|
||||
import java.util.HashMap;
|
||||
import javax.swing.DefaultListModel;
|
||||
import javax.swing.JList;
|
||||
|
||||
public class OriginAutoCodeMainUI
|
||||
extends AbstractAIFDialog
|
||||
{
|
||||
Dimension dimension;
|
||||
public JList typeListBox;
|
||||
TCSession session;
|
||||
protected HashMap typeToIcon;
|
||||
public DefaultListModel typeListModel;
|
||||
|
||||
public OriginAutoCodeMainUI(boolean arg0, TCSession session)
|
||||
{
|
||||
super(arg0);
|
||||
this.session = session;
|
||||
this.dimension = getContentPane().getToolkit().getScreenSize();
|
||||
|
||||
add(new AutoCodeMainPanel(session, this));
|
||||
pack();
|
||||
setLocation(150, 150);
|
||||
setTitle("×Ô¶¯±àÂë¹æÔò´´½¨Ïòµ¼");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.origin.ui;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||
import java.awt.Dialog;
|
||||
import javax.swing.JTable;
|
||||
|
||||
public class OriginSingleTableDialog
|
||||
extends AbstractAIFDialog
|
||||
{
|
||||
Dialog dialog;
|
||||
boolean flag;
|
||||
JTable table;
|
||||
AutoCodeMainPanel acmp;
|
||||
|
||||
public OriginSingleTableDialog(Dialog dialog, boolean flag, JTable table, AutoCodeMainPanel acmp)
|
||||
{
|
||||
super(dialog, flag);
|
||||
add(new JPanel_JTabelDataEdit(table, acmp, this));
|
||||
setLocation(150, 150);
|
||||
pack();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,149 @@
|
||||
package com.origin.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.JViewport;
|
||||
import javax.swing.event.AncestorEvent;
|
||||
import javax.swing.event.AncestorListener;
|
||||
import org.jdesktop.layout.GroupLayout;
|
||||
import org.jdesktop.layout.GroupLayout.ParallelGroup;
|
||||
import org.jdesktop.layout.GroupLayout.SequentialGroup;
|
||||
|
||||
public class SingleTreeEditPanel
|
||||
extends JPanel
|
||||
{
|
||||
AutoCodeMainPanel acmp;
|
||||
JDialog dialog;
|
||||
JTree t_main;
|
||||
int i_index;
|
||||
JScrollPane jsp_in;
|
||||
private JButton jButton1;
|
||||
private JButton jButton2;
|
||||
private JButton jButton3;
|
||||
private JScrollPane jScrollPane1;
|
||||
private JTree t_temp;
|
||||
|
||||
public SingleTreeEditPanel()
|
||||
{
|
||||
initComponents();
|
||||
|
||||
initMyTree();
|
||||
}
|
||||
|
||||
public SingleTreeEditPanel(JTree t_main, AutoCodeMainPanel acmp, JDialog dialog, int i_index, JScrollPane jsp_in)
|
||||
{
|
||||
this.dialog = dialog;
|
||||
this.t_main = t_main;
|
||||
this.acmp = acmp;
|
||||
this.i_index = i_index;
|
||||
this.jsp_in = jsp_in;
|
||||
initComponents();
|
||||
initMyTree();
|
||||
}
|
||||
|
||||
private void initComponents()
|
||||
{
|
||||
this.jButton1 = new JButton();
|
||||
this.jButton2 = new JButton();
|
||||
this.jButton3 = new JButton();
|
||||
this.jScrollPane1 = new JScrollPane();
|
||||
this.t_temp = new JTree();
|
||||
|
||||
setBackground(new Color(255, 255, 255));
|
||||
setBorder(BorderFactory.createTitledBorder(null, "内容编辑", 0, 0, new Font("新宋体", 0, 12)));
|
||||
|
||||
this.jButton1.setBackground(new Color(255, 255, 255));
|
||||
this.jButton1.setFont(new Font("新宋体", 0, 12));
|
||||
this.jButton1.setText("确定");
|
||||
this.jButton1.setVisible(false);
|
||||
this.jButton2.setBackground(new Color(255, 255, 255));
|
||||
this.jButton2.setFont(new Font("新宋体", 0, 12));
|
||||
this.jButton2.setText("清除");
|
||||
this.jButton2.setVisible(false);
|
||||
this.jButton3.setBackground(new Color(255, 255, 255));
|
||||
this.jButton3.setFont(new Font("新宋体", 0, 12));
|
||||
this.jButton3.setText("关闭");
|
||||
this.jButton3.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent evt)
|
||||
{
|
||||
SingleTreeEditPanel.this.jButton3ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
this.jButton3.addAncestorListener(new AncestorListener()
|
||||
{
|
||||
public void ancestorMoved(AncestorEvent evt) {}
|
||||
|
||||
public void ancestorAdded(AncestorEvent evt) {}
|
||||
|
||||
public void ancestorRemoved(AncestorEvent evt)
|
||||
{
|
||||
SingleTreeEditPanel.this.jButton3AncestorRemoved(evt);
|
||||
}
|
||||
});
|
||||
this.jScrollPane1.setViewportView(this.t_temp);
|
||||
|
||||
GroupLayout layout = new GroupLayout(this);
|
||||
setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(1)
|
||||
.add(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.add(layout.createParallelGroup(1)
|
||||
.add(this.jScrollPane1, -1, 614, 32767)
|
||||
.add(layout.createSequentialGroup()
|
||||
.add(this.jButton1, -2, 116, -2)
|
||||
.addPreferredGap(0, 370, 32767)
|
||||
.add(this.jButton2)
|
||||
.addPreferredGap(1)
|
||||
.add(this.jButton3)))
|
||||
.addContainerGap()));
|
||||
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(1)
|
||||
.add(2, layout.createSequentialGroup()
|
||||
.add(this.jScrollPane1, -1, 439, 32767)
|
||||
.addPreferredGap(0)
|
||||
.add(layout.createParallelGroup(3)
|
||||
.add(this.jButton2)
|
||||
.add(this.jButton3)
|
||||
.add(this.jButton1))
|
||||
.addContainerGap()));
|
||||
}
|
||||
|
||||
private void jButton3ActionPerformed(ActionEvent evt)
|
||||
{
|
||||
this.jsp_in.getViewport().removeAll();
|
||||
this.jsp_in.getViewport().add(this.t_main);
|
||||
this.jsp_in.repaint();
|
||||
this.jsp_in.updateUI();
|
||||
this.acmp.mi_big[(this.i_index - 1)].setEnabled(true);
|
||||
this.dialog.dispose();
|
||||
}
|
||||
|
||||
private void jButton3AncestorRemoved(AncestorEvent evt)
|
||||
{
|
||||
this.jsp_in.getViewport().removeAll();
|
||||
this.jsp_in.getViewport().add(this.t_main);
|
||||
this.jsp_in.repaint();
|
||||
this.jsp_in.updateUI();
|
||||
this.acmp.mi_big[(this.i_index - 1)].setEnabled(true);
|
||||
}
|
||||
|
||||
public void initMyTree()
|
||||
{
|
||||
this.jScrollPane1.getViewport().removeAll();
|
||||
this.jScrollPane1.getViewport().add(this.t_main);
|
||||
this.jScrollPane1.repaint();
|
||||
this.jScrollPane1.updateUI();
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 685 B |
|
After Width: | Height: | Size: 383 B |
|
After Width: | Height: | Size: 506 B |
|
After Width: | Height: | Size: 799 B |
|
After Width: | Height: | Size: 649 B |
|
After Width: | Height: | Size: 660 B |
|
After Width: | Height: | Size: 608 B |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 567 B |
|
After Width: | Height: | Size: 617 B |
|
After Width: | Height: | Size: 576 B |