first commit

main
李建辉 1 month ago
commit 811245db0c

@ -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>

1
.gitignore vendored

@ -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 = .

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 B

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,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,168 @@
package PropertyToFile.handlers;
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.hwpf.HWPFDocument;
import org.apache.poi.hwpf.usermodel.Bookmark;
import org.apache.poi.hwpf.usermodel.Bookmarks;
import org.apache.poi.hwpf.usermodel.Range;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBookmark;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP;
import org.w3c.dom.Node;
public class WordUtils {
public static final String RUN_NODE_NAME = "w:r";
public static final String TEXT_NODE_NAME = "w:t";
public static final String BOOKMARK_START_TAG = "w:bookmarkStart";
public static final String BOOKMARK_END_TAG = "w:bookmarkEnd";
public static final String BOOKMARK_ID_ATTR_NAME = "w:id";
public static final String STYLE_NODE_NAME = "w:rPr";
public static void main(String[] args) throws IOException {
// 替换文件中的 bookmark 内容
InputStream inputStream3 = Files.newInputStream(Paths.get("C:\\Users\\Administrator\\Desktop\\测试文件夹\\22.doc"));
Map<String, String> dataMap = new HashMap<>();
dataMap.put("one", "oneoneoneoneone");
dataMap.put("two", "twotwotwotwo");
dataMap.put("three", "ceshi");
replaceBookmarksByDoc(inputStream3, Files.newOutputStream(Paths.get("C:\\Users\\Administrator\\Desktop\\测试文件夹\\33.doc")), dataMap);
}
/**
* doc
*
* @param inputStream
* @throws IOException
*/
public static void getBookmarksByDoc(InputStream inputStream) throws IOException {
HWPFDocument wordDoc = new HWPFDocument(inputStream);
Bookmarks bookmarks = wordDoc.getBookmarks();
for (int b = 0; b < bookmarks.getBookmarksCount(); b++) {
Bookmark bookmark = bookmarks.getBookmark(b);
String bookMarkText = new Range(bookmark.getStart(), bookmark.getEnd(), wordDoc).text();
System.out.println("[" + bookmark.getStart() + "; "
+ bookmark.getEnd() + "]: " + bookmark.getName() + " = " + bookMarkText);
}
}
/**
* docx
*
* @param inputStream
* @throws IOException
*/
public static void getBookmarksByDocx(InputStream inputStream) throws IOException {
XWPFDocument docx = new XWPFDocument(inputStream);
List<XWPFParagraph> paragraphList = docx.getParagraphs();
for (XWPFParagraph xwpfParagraph : paragraphList) {
CTP ctp = xwpfParagraph.getCTP();
for (int dwI = 0; dwI < ctp.sizeOfBookmarkStartArray(); dwI++) {
CTBookmark bookmark = ctp.getBookmarkStartArray(dwI);
String bookmarkName = bookmark.getName();
// 因为 docx 的结构是xml格式它不像 doc 文档那样有具体的start和end值来定位一个bookmark的值范围
// 所有如果你想要读取 docx 文档中bookmark的内容你需要从 bookmarkStart 节点开始逐级逐层依次解析xml文
// 件的 nodeValue 值并进行拼接,直至读取到下一个名为 bookmarkEnd 的节点为止。
// 下面这个方法 getBookmarkTextContent() 是一个没有实现的方法,如有需要请自行实现
// String bookmarkTextContent = getBookmarkTextContent(bookmark);
System.out.println(bookmarkName);
}
}
}
/**
* docx
*
* @param inputStream
* @param outputStream
* @param dataMap
* @throws IOException
*/
public static void replaceBookmarksByDocx(InputStream inputStream, OutputStream outputStream, Map<String, String> dataMap) throws IOException {
XWPFDocument document = new XWPFDocument(inputStream).getXWPFDocument();
List<XWPFParagraph> paragraphList = document.getParagraphs();
for (XWPFParagraph xwpfParagraph : paragraphList) {
CTP ctp = xwpfParagraph.getCTP();
for (int dwI = 0; dwI < ctp.sizeOfBookmarkStartArray(); dwI++) {
CTBookmark bookmark = ctp.getBookmarkStartArray(dwI);
if (dataMap.containsKey(bookmark.getName())) {
XWPFRun run = xwpfParagraph.createRun();
run.setText(dataMap.get(bookmark.getName()));
Node firstNode = bookmark.getDomNode();
Node nextNode = firstNode.getNextSibling();
while (nextNode != null) {
// 循环查找结束符
String nodeName = nextNode.getNodeName();
if (nodeName.equals(BOOKMARK_END_TAG)) {
break;
}
// 删除中间的非结束节点,即删除原书签内容
Node delNode = nextNode;
nextNode = nextNode.getNextSibling();
ctp.getDomNode().removeChild(delNode);
}
if (nextNode == null) {
// 始终找不到结束标识的,就在书签前面添加
ctp.getDomNode().insertBefore(run.getCTR().getDomNode(), firstNode);
} else {
// 找到结束符将新内容添加到结束符之前即内容写入bookmark中间
ctp.getDomNode().insertBefore(run.getCTR().getDomNode(), nextNode);
}
}
}
}
document.write(outputStream);
document.close();
}
/**
* doc
*
* @param inputStream
* @param outputStream
* @param dataMap
* @throws IOException
*/
public static void replaceBookmarksByDoc(InputStream inputStream, OutputStream outputStream,
Map<String, String> dataMap) throws IOException {
HWPFDocument document = new HWPFDocument(inputStream);
Bookmarks bookmarks = document.getBookmarks();
for (int dwI = 0; dwI < bookmarks.getBookmarksCount(); dwI++) {
Bookmark bookmark = bookmarks.getBookmark(dwI);
if (dataMap.containsKey(bookmark.getName())) {
Range range = new Range(bookmark.getStart(), bookmark.getEnd(), document);
range.replaceText(dataMap.get(bookmark.getName()), false);
}
}
document.write(outputStream);
}
}

@ -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,693 @@
package com.origin.beans;
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
import com.teamcenter.rac.commands.newitem.IItemTypesLoader;
import com.teamcenter.rac.commands.newitem.NewItemTypesLoader;
import com.teamcenter.rac.kernel.TCComponentType;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCPreferenceService;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.kernel.TCTypeService;
import com.teamcenter.rac.util.Registry;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.Vector;
import javax.swing.JOptionPane;
public class AutoCodeBean
{
AbstractAIFUIApplication app;
TCSession session = null;
String[] starItemTypeNames;
TCComponentType[] tc_component_type_a = null;
String[] stra_Single;
KelsenStartWindow ksw;
String strDisplay = "";
String strDisplayItem = "";
String strDisplayAllType = "";
String strFile_Display1 = "";
String strInnerDisplay = "";
String strDisplay_getProperties = "";
TCPreferenceService preferenceService = null;
public AutoCodeBean(TCSession session)
{
this.session = session;
session.getRegistry();
try
{
this.preferenceService = session.getPreferenceService();
}
catch (Exception e)
{
e.printStackTrace();
}
}
public String[][] getAllItemTypes()
{
String[][] straResult = (String[][])null;
try
{
IItemTypesLoader item = new NewItemTypesLoader();
item
.init(
Registry.getRegistry("com.teamcenter.rac.commands.newitem.newitem"),
false, this.session);
Map map = item.loadTypes();
System.out.println("Map:::::::::" + map);
String mapToString = map.toString();
mapToString = mapToString.replace("{", "");
mapToString = mapToString.replace("}", "");
String[] split = null;
System.out.println("mapToString=="+mapToString);
if(mapToString.contains(",")) {
split = mapToString.split(",");
}else if(mapToString.contains("")) {
split = mapToString.split("");
}
if(split != null) {
straResult = new String[split.length][];
for (int i = 0; i < split.length; i++) {
String[] split2 = split[i].split("=");
this.stra_Single = new String[2];
System.out.println("split2[0]==="+split2[0]);
System.out.println("split2[1]==="+split2[1]);
this.stra_Single[0] = split2[0];
this.stra_Single[1] = split2[1];
straResult[i] = this.stra_Single;
System.out.println("111"+straResult[i].toString());
}
}
// straResult = new String[map.size()][];
// Iterator iterator = map.keySet().iterator();
// String clientStr = "";
// int i = 0;
// while (iterator.hasNext())
// {
// clientStr = iterator.next().toString();
//
// System.out.println(clientStr);
// this.stra_Single = new String[2];
// this.stra_Single[0] = clientStr;
// this.stra_Single[1] = map.get(clientStr).toString();
// straResult[(i++)] = this.stra_Single;
// }
}
catch (Exception e)
{
e.printStackTrace();
}
return straResult;
}
public boolean isRegistRule(String str_ItemType)
{
boolean b_result = false;
HashMap hm_allBeRegistItemType = getAllRegistItemType();
if (hm_allBeRegistItemType != null)
{
if (hm_allBeRegistItemType.get(str_ItemType) == null) {
b_result = false;
} else {
b_result = true;
}
}
else {
b_result = false;
}
return b_result;
}
public HashMap getAllRegistItemType()
{
HashMap hm_result = null;
String[] stra_option_origin_item_names = getOriginOptions(
"origin_item_names", 4);
if ((stra_option_origin_item_names != null) &&
(stra_option_origin_item_names.length > 0))
{
hm_result = new HashMap();
for (int i = 0; i < stra_option_origin_item_names.length; i++) {
hm_result.put(stra_option_origin_item_names[i],
stra_option_origin_item_names[i]);
}
}
return hm_result;
}
public String[] getStraREVMasterPro(String str_FormType)
{
String[] stra_result = (String[])null;
if (this.session == null) {
this.session = ((TCSession)this.app.getSession());
}
try
{
System.out.println("str_FormType------>" + str_FormType);
TCTypeService typeService = this.session.getTypeService();
TCComponentType typeComponent = typeService
.getTypeComponent(str_FormType);
stra_result = typeComponent.getPropertyNames();
}
catch (TCException e)
{
e.printStackTrace();
}
return stra_result;
}
public String[] getOriginOptions(String str_Option_Title, int int_scope)
{
String[] stra_Result = (String[])null;
try
{
stra_Result = this.preferenceService.getStringArray(int_scope,
str_Option_Title);
}
catch (Exception e)
{
e.printStackTrace();
}
return stra_Result;
}
public boolean deleteRule(String str_selete_item_type)
{
boolean b_result = true;
String[] stra_Field = getOriginOptions("origin_" + str_selete_item_type +
"_field", 4);
int int_Field = 0;
if ((stra_Field != null) && (stra_Field.length > 0)) {
try
{
int_Field = Integer.parseInt(stra_Field[0].split("【oj】")[1]);
}
catch (Exception localException)
{
System.out.println("错误!!!!!\n 在读取origin_" +
str_selete_item_type + "_field语法出了问题");
}
} else {
b_result = false;
}
if (int_Field != 0)
{
b_result = deleteOption(
"origin_" + str_selete_item_type + "_field", 4);
b_result = deleteOption("origin_" + str_selete_item_type +
"_other_info", 4);
b_result = deleteOption("origin_" + str_selete_item_type +
"_options", 4);
for (int i = 0; i < int_Field; i++)
{
b_result = deleteOption("origin_" + str_selete_item_type + "_" + (
i + 1) + "_类型", 4);
b_result = deleteOption("origin_" + str_selete_item_type + "_" + (
i + 1) + "_内容", 4);
}
}
if (b_result)
{
String[] stra_all_regist_name = getOriginOptions(
"origin_item_names", 4);
if ((stra_all_regist_name != null) && (stra_all_regist_name.length > 0))
{
Vector v_new_regist_name = new Vector();
for (int i = 0; i < stra_all_regist_name.length; i++) {
if (!str_selete_item_type.equals(stra_all_regist_name[i])) {
v_new_regist_name.add(stra_all_regist_name[i]);
}
}
String[] stra_new_regist_names = new String[v_new_regist_name
.size()];
for (int j = 0; j < stra_new_regist_names.length; j++) {
stra_new_regist_names[j] =
((String)v_new_regist_name.get(j));
}
addOptionsPreference(this.session, 4, "origin_item_names",
stra_new_regist_names);
}
}
return b_result;
}
public boolean deleteOption(String str_Option_Title, int int_scope)
{
boolean b_result = true;
try
{
this.preferenceService.removeEntry(int_scope, str_Option_Title);
}
catch (Exception e)
{
b_result = false;
e.printStackTrace();
}
return b_result;
}
public boolean deleteOptions(String[] stra_Option_Title, int[] inta_scope)
{
boolean b_result = true;
try
{
this.preferenceService.removePreferencesFromCache(inta_scope,
stra_Option_Title);
}
catch (Exception e)
{
b_result = false;
e.printStackTrace();
}
return b_result;
}
public void addOptionsPreference(TCSession session, int int_scope, String str_Option_Title, String[] stra_Option_values)
{
try
{
TCPreferenceService preferenceService = session
.getPreferenceService();
preferenceService.setStringArray(int_scope, str_Option_Title,
stra_Option_values);
System.out.println("Options值添加成功");
}
catch (Exception e)
{
e.printStackTrace();
}
}
public HashMap getCodeRuleMessage(String str_CodeRuleName)
{
HashMap hm_result = null;
String[] stra_filed = getOriginOptions("origin_" + str_CodeRuleName +
"_field", 4);
String[] other_info = getOriginOptions("origin_" + str_CodeRuleName +
"_other_info", 4);
String[] stra_options = getOriginOptions("origin_" + str_CodeRuleName +
"_options", 4);
if ((stra_filed != null) && (stra_filed.length > 0)) {
try
{
int int_filed_count =
Integer.parseInt(stra_filed[0].split("【oj】")[1]);
Vector v_Style_Content = new Vector();
for (int i = 1; i <= int_filed_count; i++)
{
String[] stra_style = getOriginOptions("origin_" +
str_CodeRuleName + "_" + i + "_类型", 4);
String[] stra_content = getOriginOptions("origin_" +
str_CodeRuleName + "_" + i + "_内容", 4);
Vector v_temp = new Vector();
v_temp.add(stra_style);
v_temp.add(stra_content);
v_Style_Content.add(v_temp);
}
hm_result = new HashMap();
hm_result.put("origin_" + str_CodeRuleName + "_field",
stra_filed);
hm_result.put("origin_" + str_CodeRuleName + "_other_info",
other_info);
hm_result.put("origin_" + str_CodeRuleName + "_options",
stra_options);
hm_result.put("origin_" + str_CodeRuleName + "_类型_内容",
v_Style_Content);
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, "规则数据查看处出现问题!", "警告", 2);
e.printStackTrace();
}
}
return hm_result;
}
public HashMap getFinalCodeRuleMessage(String str_CodeRuleName)
{
HashMap hm_result = null;
HashMap hm_first_get = getCodeRuleMessage(str_CodeRuleName);
try
{
hm_result = new HashMap();
String[] stra_temp = (String[])hm_first_get.get("origin_" +
str_CodeRuleName + "_field");
String str_ZCS_MDS = stra_temp[0].split("【oj】")[1];
hm_result.put("主参数_码段数", str_ZCS_MDS);
String[] stra_other_info = (String[])hm_first_get.get("origin_" +
str_CodeRuleName + "_other_info");
String[] stra_ZCS_LSHWZ = stra_other_info[0].split("【oj】")[1]
.split("/");
if ((stra_ZCS_LSHWZ != null) && (stra_ZCS_LSHWZ.length > 0)) {
for (int i = 0; i < stra_ZCS_LSHWZ.length; i++) {
hm_result.put("码段" + (i + 1) + "_标题", stra_ZCS_LSHWZ[i]);
}
}
String[] stra_options = (String[])hm_first_get.get("origin_" +
str_CodeRuleName + "_options");
if ((stra_options != null) && (stra_options.length > 0))
{
String str_ItemIDEdable = stra_options[0].split("【oj】")[1];
hm_result.put("ItemID可编辑", str_ItemIDEdable);
String str_LiuShuiHaoXinXi = stra_options[1].split("【oj】")[1];
String[] stra_LiuShuiHaoXinXi = str_LiuShuiHaoXinXi.split("/");
if ((stra_LiuShuiHaoXinXi != null) &&
(stra_LiuShuiHaoXinXi.length >= 4))
{
String str_WeiShu = stra_LiuShuiHaoXinXi[0];
hm_result.put("流水号_位数", str_WeiShu);
String str_QiShiZhi = stra_LiuShuiHaoXinXi[1];
hm_result.put("流水号_起始值", str_QiShiZhi);
String str_ZhongZhiZhi = stra_LiuShuiHaoXinXi[2];
hm_result.put("流水号_终止值", str_ZhongZhiZhi);
String str_BuChang = stra_LiuShuiHaoXinXi[3];
hm_result.put("流水号_步长", str_BuChang);
}
else
{
System.out.println("注意!!!!!!!!!!!!!!!\n配置文件中流水号信息有问题");
}
String str_ItemNameSetValueTo = stra_options[2].split("【oj】")[1];
String[] stra_ItemNameSetValueTo = str_ItemNameSetValueTo
.split("/");
if ((stra_ItemNameSetValueTo != null) &&
(stra_ItemNameSetValueTo.length >= 2))
{
hm_result.put("Item Name赋值开关", stra_ItemNameSetValueTo[0]);
hm_result.put("Name赋到的具体属性", stra_ItemNameSetValueTo[1]);
}
else
{
System.out.println("注意!!!!!!!!!!!!!!!\n配置文件中ItemName赋值信息有问题");
}
String str_ShouDongBianMa = stra_options[3].split("【oj】")[1];
hm_result.put("手动编码", str_ShouDongBianMa);
String str_LiuShuiHaoWeiZhi = stra_options[4].split("【oj】")[1];
String[] stra_LiuShuiHaoWeiZhi = str_LiuShuiHaoWeiZhi
.split("/");
if ((stra_LiuShuiHaoWeiZhi != null) &&
(stra_LiuShuiHaoWeiZhi.length >= 2))
{
// stra_LiuShuiHaoWeiZhi[0];
// stra_LiuShuiHaoWeiZhi[1];
hm_result.put("流水号位置_开关", stra_LiuShuiHaoWeiZhi[0]);
hm_result.put("流水号位置", stra_LiuShuiHaoWeiZhi[1]);
}
else
{
System.out.println("注意!!!!!!!!!!!!!!!\n配置文件中流水号位置配置信息有问题");
}
try
{
String str_ItemIDSetValueTo = stra_options[5].split("【oj】")[1];
String[] stra_ItemIDSetValueTo = str_ItemIDSetValueTo
.split("/");
if ((stra_ItemIDSetValueTo != null) &&
(stra_ItemIDSetValueTo.length >= 2))
{
hm_result.put("Item ID赋值开关", stra_ItemIDSetValueTo[0]);
hm_result
.put("ItemID赋到的具体属性", stra_ItemIDSetValueTo[1]);
}
else
{
System.out.println("注意!!!!!!!!!!!!!!!\n配置文件中把ItemID赋值到具体表单属性配置有问题【语法】是否把零组ID赋值到具体属性【oj】yes/shPrtEnN");
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
Vector v_Style_Contain = (Vector)hm_first_get.get("origin_" +
str_CodeRuleName + "_类型_内容");
System.out.println("类型和内容标签:\nv_Style_Contain.size()=" +
v_Style_Contain.size());
if ((v_Style_Contain != null) && (v_Style_Contain.size() > 0)) {
for (int i = 0; i < v_Style_Contain.size(); i++)
{
Vector v_temp = (Vector)v_Style_Contain.get(i);
if (v_temp.size() > 0)
{
String[] stra_Style = (String[])v_temp.get(0);
if (stra_Style.length >= 4)
{
String str_LeiXing = stra_Style[0];
str_LeiXing = str_LeiXing.split("【oj】")[1];
hm_result.put("码段" + (i + 1) + "_类型", str_LeiXing);
String str_ShiFouChengWeiGuiZeZiDuan = stra_Style[1];
str_ShiFouChengWeiGuiZeZiDuan = str_ShiFouChengWeiGuiZeZiDuan
.split("【oj】")[1];
hm_result.put("码段" + (i + 1) + "_是否成为规则字段",
str_ShiFouChengWeiGuiZeZiDuan);
String str_ShuXingFuZhiXinXi = stra_Style[2];
str_ShuXingFuZhiXinXi = str_ShuXingFuZhiXinXi
.split("【oj】")[1];
String[] stra_ShuXingFuZhiXinXi = str_ShuXingFuZhiXinXi
.split("/");
if (stra_ShuXingFuZhiXinXi.length >= 4)
{
hm_result.put("码段" + (i + 1) + "_属性赋值开关",
stra_ShuXingFuZhiXinXi[0]);
hm_result.put("码段" + (i + 1) + "_赋值的表单类型",
stra_ShuXingFuZhiXinXi[1]);
hm_result.put("码段" + (i + 1) + "_赋值的表单属性",
stra_ShuXingFuZhiXinXi[2]);
hm_result.put("码段" + (i + 1) + "_显示值或内部值",
stra_ShuXingFuZhiXinXi[3]);
}
else
{
System.out.println("码段" + (i + 1) +
"_属性赋值信息配置有问题!");
hm_result.put("码段" + (i + 1) + "_属性赋值开关", "no");
}
String str_ShiFouCanYuTeZhengMa = stra_Style[3];
str_ShiFouCanYuTeZhengMa = str_ShiFouCanYuTeZhengMa
.split("【oj】")[1];
hm_result.put("码段" + (i + 1) + "_是否参与特征码",
str_ShiFouCanYuTeZhengMa);
}
String[] stra_Content = (String[])v_temp.get(1);
Object[][] obja2 = new Object[stra_Content.length][];
for (int k = 0; k < stra_Content.length; k++)
{
String[] stra = stra_Content[k].split("【oj】");
Object[] obja = new Object[2];
obja[0] = stra[0];
obja[1] = stra[1];
obja2[k] = obja;
}
hm_result.put("码段" + (i + 1) + "_内容二维数组", obja2);
}
else
{
System.out.println("AutoCodeBean.java338获取类型和内容标签是不匹配Vector的长度需为2个字符串数组");
}
}
}
}
catch (Exception e)
{
hm_result = null;
e.printStackTrace();
}
return hm_result;
}
public void StringBufferDemo(String strContext, String strFileName)
throws IOException
{
File file = new File("C:\\" + strFileName);
if (!file.exists()) {
file.createNewFile();
}
FileOutputStream out = new FileOutputStream(file, true);
StringBuffer sb = new StringBuffer(strContext);
out.write(sb.toString().getBytes("gb2312"));
out.close();
}
public void displayInfo()
{
try
{
for (int j = 0; j < this.tc_component_type_a.length; j++)
{
Map<String, String> abac = this.tc_component_type_a[j]
.getProperties();
Set<Map.Entry<String, String>> en = abac.entrySet();
Iterator<Map.Entry<String, String>> eii = en.iterator();
while (eii.hasNext()) {
this.strDisplay_getProperties =
(this.strDisplay_getProperties + eii.next() + "\n");
}
this.strInnerDisplay =
(this.strInnerDisplay + "【" + this.tc_component_type_a[j].getTypeName() + "】\n" + "tc_component_type_a[" + j + "].getTypeName()=" + this.tc_component_type_a[j].getTypeName() + "\n" + "tc_component_type_a[" + j + "].getAuditInfo(true)=" + this.tc_component_type_a[j].getAuditInfo(true) + "\n" + "tc_component_type_a[" + j + "].getAuditInfo(false)=" + this.tc_component_type_a[j].getAuditInfo(false) + "\n" + "tc_component_type_a[" + j + "].getChildrenCount()=" + this.tc_component_type_a[j].getChildrenCount() + "\n" + "tc_component_type_a[" + j + "].getClassificationClass()=" + this.tc_component_type_a[j].getClassificationClass() + "\n" + "tc_component_type_a[" + j + "].getClassificationSubclass()=" + this.tc_component_type_a[j].getClassificationSubclass() + "\n" + "tc_component_type_a[" + j + "].getClassType()=" + this.tc_component_type_a[j].getClassType() + "\n" + "tc_component_type_a[" + j + "].getDefaultPasteRelation()=" + this.tc_component_type_a[j].getDefaultPasteRelation() + "\n" + "tc_component_type_a[" + j + "].getObjectString()=" + this.tc_component_type_a[j].getObjectString() + "\n" + "tc_component_type_a[" + j + "].getServerEncodingName()=" + this.tc_component_type_a[j].getServerEncodingName() + "\n" + "tc_component_type_a[" + j + "].getSubType()=" + this.tc_component_type_a[j].getSubType() + "\n" + "tc_component_type_a[" + j + "].getToStringProperty()=" + this.tc_component_type_a[j].getToStringProperty() + "\n" + "tc_component_type_a[" + j + "].getType()=" + this.tc_component_type_a[j].getType() + "\n" + "tc_component_type_a[" + j + "].getUid()=" + this.tc_component_type_a[j].getUid() + "\n" + "tc_component_type_a[" + j + "].getWebURL()=" + this.tc_component_type_a[j].getWebURL() + "\n" + "tc_component_type_a[" + j + "].getWhereReferencedCount()=" + this.tc_component_type_a[j].getWhereReferencedCount() + "\n" + "tc_component_type_a[" + j + "].getKey()=" + (String)((Map.Entry)this.tc_component_type_a[j]).getKey() + "\n" + "tc_component_type_a[" + j + "].getProperties()=" + this.tc_component_type_a[j].getProperties() + "\n" + "-------------START--------------------TCComponentType对象的getProperties()---------------START----------------" + "\n" + this.strDisplay_getProperties + "--------------END---------------------TCComponentType对象的getProperties()----------------END-----------------" + "\n" + "tc_component_type_a[" + j + "].getPasteRelationNames()=" + this.tc_component_type_a[j].getPasteRelationNames() + "\n" + "tc_component_type_a[" + j + "].getPropertyNames()=" + this.tc_component_type_a[j].getPropertyNames() + "\n");
System.out
.println("=========================ItemType信息=============================\n" +
this.strInnerDisplay);
this.strDisplayItem =
(this.strDisplayItem + this.tc_component_type_a[j].getTypeName() + "\n");
}
this.starItemTypeNames = this.session.getTypeService().getTypeNames();
for (int k = 0; k < this.starItemTypeNames.length; k++) {
this.strDisplayAllType =
(this.strDisplayAllType + this.starItemTypeNames[k] + "\n");
}
System.out.println("=====================所有类型信息session.getTypeService().getTypeNames()====================\n" +
this.strDisplayAllType +
"=====================所有类型信息session.getTypeService().getTypes(\"Item\")====================\n" +
this.strDisplayItem);
Calendar c = Calendar.getInstance();
Date date = c.getTime();
String strDate = new SimpleDateFormat().format(date);
this.strFile_Display1 =
("\n====================================【ItemType信息】==========================================\n" + this.strInnerDisplay + "=====================【所有类型信息session.getTypeService().getTypeNames()】===================\n" + this.strDisplayAllType + "=====================【所有类型信息session.getTypeService().getTypes(\"Item\")】================\n" + this.strDisplayItem + "=====================【日志产生日期】================\n" + strDate + " Kelsen Xu\n\n\n\n");
StringBufferDemo(this.strFile_Display1, "K_Item_Info.log");
}
catch (Exception e)
{
e.printStackTrace();
}
}
}

@ -0,0 +1,555 @@
package com.origin.beans;
import com.teamcenter.rac.util.Registry;
import java.awt.AWTException;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.Point;
import java.awt.Robot;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.PrintStream;
import java.util.Vector;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;
public class KSearchDialog
extends JDialog
implements MouseListener, KeyListener
{
public JScrollPane jsp;
public JList listMy;
JPanel pMain;
Container con;
String[] stra;
Vector vMain;
JTextField txtBeSet;
JPanel pBottom;
JLabel lblClose;
JDialog dialogK;
ImageIcon iiClose_1;
ImageIcon iiClose_2;
public KSearchDialog(JDialog d, JTextField txtK, Vector vMain)
{
super(d);
this.dialogK = d;
this.txtBeSet = txtK;
this.vMain = vMain;
this.stra = new String[vMain.size()];
this.lblClose = new JLabel("关闭");
this.pBottom = new JPanel();
this.pBottom.add(new JLabel(" "));
this.pBottom.add(this.lblClose);
this.lblClose.addMouseListener(this);
this.pBottom.setBackground(Color.LIGHT_GRAY);
for (int i = 0; i < this.stra.length; i++) {
this.stra[i] = ((String)vMain.get(i));
}
this.listMy = new JList(this.stra);
this.jsp = new JScrollPane(this.listMy);
this.con = getContentPane();
this.con.setLayout(new BorderLayout());
this.con.add("Center", this.jsp);
this.con.add("South", this.pBottom);
this.listMy.addMouseListener(this);
this.listMy.addKeyListener(this);
setUndecorated(true);
setSize(150, 150);
}
public KSearchDialog(JDialog d, JTextField txtK, String[] stra_Main)
{
super(d);
this.dialogK = d;
this.txtBeSet = txtK;
this.stra = stra_Main;
this.lblClose = new JLabel("关闭");
this.pBottom = new JPanel();
this.pBottom.add(new JLabel(" "));
this.pBottom.add(this.lblClose);
this.lblClose.addMouseListener(this);
this.pBottom.setBackground(Color.LIGHT_GRAY);
for (int i = 0; i < this.stra.length; i++) {
this.stra[i] = ((String)this.vMain.get(i));
}
this.listMy = new JList(this.stra);
this.jsp = new JScrollPane(this.listMy);
this.con = getContentPane();
this.con.setLayout(new BorderLayout());
this.con.add("Center", this.jsp);
this.con.add("South", this.pBottom);
this.listMy.addMouseListener(this);
this.listMy.addKeyListener(this);
setUndecorated(true);
setSize(150, 150);
}
public KSearchDialog(JDialog d, JTextField txtK, Vector vMain, boolean selfFlag)
{
super(d);
this.dialogK = d;
this.txtBeSet = txtK;
this.vMain = vMain;
this.stra = new String[vMain.size()];
this.lblClose = new JLabel("关闭");
this.pBottom = new JPanel();
this.pBottom.add(new JLabel(" "));
this.pBottom.add(this.lblClose);
this.lblClose.addMouseListener(this);
this.pBottom.setBackground(Color.LIGHT_GRAY);
for (int i = 0; i < this.stra.length; i++) {
this.stra[i] = ((String)vMain.get(i));
}
this.listMy = new JList(this.stra);
this.jsp = new JScrollPane(this.listMy);
this.con = getContentPane();
this.con.setLayout(new BorderLayout());
this.con.add("Center", this.jsp);
this.con.add("South", this.pBottom);
this.listMy.addMouseListener(this);
this.listMy.addKeyListener(this);
setUndecorated(true);
setSize(150, 150);
this.txtBeSet.addKeyListener(new KeyAdapter()
{
int iCount = 0;
int iSelect = 0;
public void keyReleased(KeyEvent ke)
{
if ((this.iCount == 0) && (KSearchDialog.this != null))
{
KSearchDialog.this.setLocation(
KSearchDialog.this.txtBeSet.getLocationOnScreen().x,
KSearchDialog.this.txtBeSet.getLocationOnScreen().y + 25);
KSearchDialog.this.setVisible(true);
this.iCount = 1;
}
if ((KSearchDialog.this != null) && (ke.getKeyCode() != 40) &&
(ke.getKeyCode() != 17) &&
(ke.getKeyCode() != 37) &&
(ke.getKeyCode() != 39))
{
String strContain = KSearchDialog.this.txtBeSet.getText();
Vector vFinal = new Vector();
String strTemp = "";
for (int i = 0; i < KSearchDialog.this.vMain.size(); i++)
{
strTemp = (String)KSearchDialog.this.vMain.get(i);
if (strTemp.contains(strContain)) {
vFinal.add(strTemp);
}
}
String[] straFinal = new String[vFinal
.size()];
for (int i = 0; i < straFinal.length; i++) {
straFinal[i] = ((String)vFinal.get(i));
}
KSearchDialog.this.kUpLoad(straFinal);
this.iSelect = 0;
}
else if ((KSearchDialog.this != null) && (ke.getKeyCode() == 40) &&
(this.iSelect == 0))
{
KSearchDialog.this.dialogK.setEnabled(false);
KSearchDialog.this.setEnabled(true);
KSearchDialog.this.listMy.setSelectedIndex(0);
KSearchDialog.this.listMy.requestFocus();
this.iSelect = 1;
}
}
});
}
public void setKtxtBeSetAndKVector(JTextField txt_k, Vector v_k)
{
this.txtBeSet = txt_k;
this.vMain = v_k;
setVisible(true);
}
public KSearchDialog(JDialog d, JTextField txtK, Vector vMain, Registry fappReg)
{
super(d);
this.iiClose_1 = fappReg.getImageIcon("error.ICON");
this.iiClose_2 = fappReg.getImageIcon("close.ICON");
this.dialogK = d;
this.txtBeSet = txtK;
this.vMain = vMain;
this.stra = new String[vMain.size()];
this.lblClose = new JLabel(this.iiClose_1);
this.pBottom = new JPanel();
this.pBottom.add(new JLabel(" "));
this.pBottom.add(this.lblClose);
this.lblClose.addMouseListener(this);
this.pBottom.setBackground(Color.LIGHT_GRAY);
for (int i = 0; i < this.stra.length; i++) {
this.stra[i] = ((String)vMain.get(i));
}
this.listMy = new JList(this.stra);
this.jsp = new JScrollPane(this.listMy);
this.con = getContentPane();
this.con.setLayout(new BorderLayout());
this.con.add("Center", this.jsp);
this.con.add("South", this.pBottom);
this.listMy.addMouseListener(this);
this.listMy.addKeyListener(this);
setUndecorated(true);
setSize(150, 150);
}
public KSearchDialog(JDialog d, JTextField txtK, Vector vMain, Registry fappReg, boolean bFlag)
{
super(d);
this.iiClose_1 = fappReg.getImageIcon("error.ICON");
this.iiClose_2 = fappReg.getImageIcon("close.ICON");
this.dialogK = d;
this.txtBeSet = txtK;
this.vMain = vMain;
this.stra = new String[vMain.size()];
this.lblClose = new JLabel(this.iiClose_1);
this.pBottom = new JPanel();
this.pBottom.setLayout(new BorderLayout());
this.pBottom.add("East", this.lblClose);
this.lblClose.addMouseListener(this);
this.pBottom.setBackground(Color.LIGHT_GRAY);
for (int i = 0; i < this.stra.length; i++) {
this.stra[i] = ((String)vMain.get(i));
}
this.listMy = new JList(this.stra);
this.jsp = new JScrollPane(this.listMy);
this.con = getContentPane();
this.con.setLayout(new BorderLayout());
this.con.add("Center", this.jsp);
this.con.add("South", this.pBottom);
this.listMy.addMouseListener(this);
this.listMy.addKeyListener(this);
setUndecorated(true);
setSize(this.txtBeSet.getWidth(), 150);
this.txtBeSet.addKeyListener(new KeyAdapter()
{
int iSelect = 0;
public void keyReleased(KeyEvent ke)
{
if (!KSearchDialog.this.isVisible())
{
KSearchDialog.this.setLocation(
KSearchDialog.this.txtBeSet.getLocationOnScreen().x,
KSearchDialog.this.txtBeSet.getLocationOnScreen().y + 25);
KSearchDialog.this.setVisible(true);
KSearchDialog.this.txtBeSet.requestFocus();
try
{
Robot myRobot = new Robot();
myRobot.keyPress(37);
myRobot.keyPress(39);
myRobot = null;
}
catch (AWTException e)
{
e.printStackTrace();
}
}
if ((KSearchDialog.this != null) && (ke.getKeyCode() != 40) &&
(ke.getKeyCode() != 17) &&
(ke.getKeyCode() != 37) &&
(ke.getKeyCode() != 39))
{
String strContain = KSearchDialog.this.txtBeSet.getText();
Vector vFinal = new Vector();
String strTemp = "";
for (int i = 0; i < KSearchDialog.this.vMain.size(); i++)
{
strTemp = (String)KSearchDialog.this.vMain.get(i);
if (strTemp.contains(strContain)) {
vFinal.add(strTemp);
}
}
String[] straFinal = new String[vFinal
.size()];
for (int i = 0; i < straFinal.length; i++) {
straFinal[i] = ((String)vFinal.get(i));
}
KSearchDialog.this.kUpLoad(straFinal);
this.iSelect = 0;
}
else if ((KSearchDialog.this != null) && (ke.getKeyCode() == 40) &&
(this.iSelect == 0))
{
KSearchDialog.this.dialogK.setEnabled(false);
KSearchDialog.this.setEnabled(true);
KSearchDialog.this.listMy.setSelectedIndex(0);
KSearchDialog.this.listMy.requestFocus();
this.iSelect = 1;
}
if ((KSearchDialog.this != null) && (ke.getKeyCode() == 10)) {
KSearchDialog.this.setVisible(false);
}
}
});
this.txtBeSet.addAncestorListener(new AncestorListener()
{
public void ancestorAdded(AncestorEvent event) {}
public void ancestorMoved(AncestorEvent event) {}
public void ancestorRemoved(AncestorEvent event)
{
KSearchDialog.this.setVisible(false);
}
});
this.txtBeSet.requestFocus();
}
public KSearchDialog(JDialog d, JTextField txtK, String[] stra_Main, Registry fappReg, boolean bFlag)
{
super(d);
this.iiClose_1 = fappReg.getImageIcon("error.ICON");
this.iiClose_2 = fappReg.getImageIcon("close.ICON");
this.dialogK = d;
this.txtBeSet = txtK;
this.stra = stra_Main;
this.lblClose = new JLabel(this.iiClose_1);
this.pBottom = new JPanel();
this.pBottom.setLayout(new BorderLayout());
this.pBottom.add("East", this.lblClose);
this.lblClose.addMouseListener(this);
this.pBottom.setBackground(Color.LIGHT_GRAY);
this.listMy = new JList(this.stra);
this.jsp = new JScrollPane(this.listMy);
this.con = getContentPane();
this.con.setLayout(new BorderLayout());
this.con.add("Center", this.jsp);
this.con.add("South", this.pBottom);
this.listMy.addMouseListener(this);
this.listMy.addKeyListener(this);
setUndecorated(true);
setSize(this.txtBeSet.getWidth(), 150);
this.txtBeSet.addKeyListener(new KeyAdapter()
{
int iSelect = 0;
public void keyReleased(KeyEvent ke)
{
if (!KSearchDialog.this.isVisible())
{
KSearchDialog.this.setLocation(
KSearchDialog.this.txtBeSet.getLocationOnScreen().x,
KSearchDialog.this.txtBeSet.getLocationOnScreen().y + 25);
KSearchDialog.this.setVisible(true);
KSearchDialog.this.txtBeSet.requestFocus();
try
{
Robot myRobot = new Robot();
myRobot.keyPress(37);
myRobot.keyPress(39);
myRobot = null;
}
catch (AWTException e)
{
e.printStackTrace();
}
}
if ((KSearchDialog.this != null) && (ke.getKeyCode() != 40) &&
(ke.getKeyCode() != 17) &&
(ke.getKeyCode() != 37) &&
(ke.getKeyCode() != 39))
{
String strContain = KSearchDialog.this.txtBeSet.getText();
Vector vFinal = new Vector();
String strTemp = "";
for (int i = 0; i < KSearchDialog.this.stra.length; i++)
{
strTemp = KSearchDialog.this.stra[i];
if (strTemp.contains(strContain)) {
vFinal.add(strTemp);
}
}
String[] straFinal = new String[vFinal
.size()];
for (int i = 0; i < straFinal.length; i++) {
straFinal[i] = ((String)vFinal.get(i));
}
KSearchDialog.this.kUpLoad(straFinal);
this.iSelect = 0;
}
else if ((KSearchDialog.this != null) && (ke.getKeyCode() == 40) &&
(this.iSelect == 0))
{
KSearchDialog.this.dialogK.setEnabled(false);
KSearchDialog.this.setEnabled(true);
KSearchDialog.this.listMy.setSelectedIndex(0);
KSearchDialog.this.listMy.requestFocus();
this.iSelect = 1;
}
if ((KSearchDialog.this != null) && (ke.getKeyCode() == 10)) {
KSearchDialog.this.setVisible(false);
}
}
});
this.txtBeSet.addAncestorListener(new AncestorListener()
{
public void ancestorAdded(AncestorEvent event) {}
public void ancestorMoved(AncestorEvent event) {}
public void ancestorRemoved(AncestorEvent event)
{
KSearchDialog.this.setVisible(false);
}
});
this.txtBeSet.requestFocus();
}
public void kUpLoad(String[] straK)
{
this.listMy = new JList(straK);
this.listMy.addMouseListener(this);
this.listMy.addKeyListener(this);
this.jsp = new JScrollPane(this.listMy);
this.con.removeAll();
this.con.add("Center", this.jsp);
this.con.add("South", this.pBottom);
this.con.repaint();
this.con.validate();
this.con.setVisible(false);
this.con.setVisible(true);
setLocation(this.txtBeSet.getLocationOnScreen().x,
this.txtBeSet.getLocationOnScreen().y + 25);
}
public void mouseClicked(MouseEvent me)
{
if (me.getComponent() == this.lblClose)
{
this.lblClose.setForeground(Color.black);
setVisible(false);
}
else if ((me.getComponent() == this.listMy) &&
(me.getClickCount() == 2))
{
this.txtBeSet.setText(String.valueOf(this.listMy.getSelectedValue()));
this.dialogK.setEnabled(true);
setVisible(false);
}
}
public void mouseEntered(MouseEvent e)
{
if (e.getComponent() == this.lblClose) {
if (this.iiClose_2 != null) {
this.lblClose.setIcon(this.iiClose_2);
} else {
this.lblClose.setForeground(Color.red);
}
}
}
public void mouseExited(MouseEvent e)
{
if (e.getComponent() == this.lblClose)
{
if (this.iiClose_1 != null) {
this.lblClose.setIcon(this.iiClose_1);
} else {
this.lblClose.setForeground(Color.black);
}
}
else if (e.getComponent() == this.listMy) {
this.dialogK.setEnabled(true);
}
}
public void mousePressed(MouseEvent e) {}
public void mouseReleased(MouseEvent e) {}
public void keyPressed(KeyEvent e) {}
public void keyReleased(KeyEvent ke)
{
if (ke.getComponent() == this.listMy) {
if ((this.txtBeSet != null) && (this.dialogK != null))
{
if (ke.getKeyCode() == 10)
{
this.txtBeSet.setText(String.valueOf(this.listMy.getSelectedValue()));
this.dialogK.setEnabled(true);
this.txtBeSet.requestFocus();
setVisible(false);
}
}
else {
System.out.println("注意txtBeSet等于null");
}
}
}
public void keyTyped(KeyEvent e) {}
public static void main(String[] args)
{
Vector vMain = new Vector();
vMain.add(new String("kelsen"));
vMain.add(new String("ken"));
vMain.add(new String("jerry"));
vMain.add(new String("mandy"));
vMain.add(new String("happy"));
vMain.add(new String("jim"));
vMain.add(new String("kelly"));
vMain.add(new String("shirly"));
vMain.add(new String("welly"));
vMain.add(new String("susan"));
vMain.add(new String("机种"));
vMain.add(new String("曲轴"));
vMain.add(new String("轴承"));
vMain.add(new String("承接"));
vMain.add(new String("接地零组件"));
vMain.add(new String("大盘"));
vMain.add(new String("冷风机"));
vMain.add(new String("部件"));
vMain.add(new String("外发图纸"));
vMain.add(new String("许楷"));
JTextField txtInput = new JTextField(15);
JDialog dialog = new JDialog();
Container con = dialog.getContentPane();
con.setLayout(new FlowLayout());
new KSearchDialog(dialog, txtInput, vMain, true);
con.add(txtInput);
dialog.setSize(300, 300);
dialog.setVisible(true);
}
}

@ -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,102 @@
package com.origin.beans;
import java.awt.Color;
import java.awt.Component;
import java.io.PrintStream;
import javax.swing.Icon;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
class KelsenJListCellRenderer
extends JLabel
implements ListCellRenderer
{
boolean b_back_color = false;
KelsenJListCellRenderer()
{
setOpaque(true);
}
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
{
Object[] obja = (Object[])value;
if (value != null)
{
setText(String.valueOf(obja[1]));
setIcon((Icon)obja[0]);
setToolTipText(String.valueOf(obja[2]));
}
if (isSelected)
{
setBackground(list.getSelectionBackground());
setForeground(list.getSelectionForeground());
}
else
{
String str_BiaoShi = "";
try
{
String[] stra_1 = String.valueOf(obja[2]).split("【");
if (stra_1.length >= 2)
{
String str_1 = stra_1[1];
String[] stra_2 = str_1.split("】");
if (stra_2.length >= 1)
{
String str_2 = stra_2[0];
str_BiaoShi = str_2;
}
else
{
System.out.println("[[[[ 有出入JList里面的描述缺少 \")\" ]]]]");
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
if ((str_BiaoShi.equals("已绑定编码规则")) && (!this.b_back_color))
{
setBackground(Color.decode("#FCFBAB"));
setForeground(list.getForeground());
this.b_back_color = true;
}
else if ((str_BiaoShi.equals("已绑定编码规则")) && (this.b_back_color))
{
setBackground(Color.decode("#C1D0FF"));
setForeground(list.getForeground());
this.b_back_color = false;
}
else
{
setBackground(list.getBackground());
setForeground(list.getForeground());
this.b_back_color = false;
}
}
return this;
}
public static void main(String[] args)
{
String str_temp = "类型为: shecitem【已绑定编码规则】";
String[] stra_1 = str_temp.split("【");
if (stra_1.length >= 2)
{
String str_1 = stra_1[1];
String[] stra_2 = str_1.split("】");
if (stra_2.length >= 1)
{
String str_2 = stra_2[0];
System.out.println(str_2);
}
else
{
System.out.println("[[[[ 有出入JList里面的描述缺少 \")\" ]]]]");
}
}
}
}

@ -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();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 799 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 608 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 567 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 897 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 837 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 728 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 834 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 772 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 743 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 775 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 856 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 775 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 665 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 831 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 838 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

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();
}
}
}

File diff suppressed because it is too large Load Diff

@ -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();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 799 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 608 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 567 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save