first commit

main
李建辉 1 month ago
commit fa18e93166

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="aclib/com.connor.dongmu.plm_1.0.0.jar"/>
<classpathentry kind="lib" path="aclib/cn.com.ebewin.ysr_1.0.0.jar"/>
<classpathentry kind="lib" path="aclib/fastjson-1.2.47.jar"/>
<classpathentry kind="lib" path="aclib/slf4j-api-1.7.25.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.connor.ac</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,2 @@
eclipse.preferences.version=1
encoding//src/com/connor/ac/util/FileUtil.java=UTF-8

@ -0,0 +1,39 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Ac
Bundle-SymbolicName: com.connor.ac; singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: com.connor.ac.Activator
Bundle-Vendor: CONNOR
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
com.teamcenter.rac.aifrcp;bundle-version="11000.2.0",
com.teamcenter.rac.kernel;bundle-version="11000.2.0",
com.teamcenter.rac.common;bundle-version="11000.2.0",
com.teamcenter.rac.tcapps;bundle-version="11000.2.0",
com.teamcenter.rac.ui;bundle-version="11000.2.0",
com.teamcenter.rac.util;bundle-version="11000.2.0",
com.teamcenter.rac.external;bundle-version="11000.2.0",
org.apache.poi.39;bundle-version="3.9.0"
Bundle-ActivationPolicy: lazy
Export-Package: com.alibaba.fastjson,
com.alibaba.fastjson.annotation,
com.alibaba.fastjson.asm,
com.alibaba.fastjson.parser,
com.alibaba.fastjson.parser.deserializer,
com.alibaba.fastjson.serializer,
com.alibaba.fastjson.support.config,
com.alibaba.fastjson.support.hsf,
com.alibaba.fastjson.support.jaxrs,
com.alibaba.fastjson.support.retrofit,
com.alibaba.fastjson.support.spring,
com.alibaba.fastjson.support.spring.annotation,
com.alibaba.fastjson.support.spring.messaging,
com.alibaba.fastjson.support.springfox,
com.alibaba.fastjson.util,
com.connor.AC_01,
com.connor.ac,
com.connor.ac.bean,
com.connor.ac.util
Bundle-ClassPath: aclib/fastjson-1.2.47.jar,
.

Binary file not shown.

Binary file not shown.

Binary file not shown.

1
bin/.gitignore vendored

@ -0,0 +1 @@
/com/

@ -0,0 +1,7 @@
source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
.,\
icons/,\
aclib/fastjson-1.2.47.jar

Binary file not shown.

After

Width:  |  Height:  |  Size: 983 B

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.commands">
<category
name="Sample Category"
id="com.connor.ac.commands.category">
</category>
<command
name="问题报告批量导入"
categoryId="com.connor.ac.commands.category"
id="com.connor.ac.commands.ProblemReportImport">
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
commandId="com.connor.ac.commands.ProblemReportImport"
class="com.connor.AC_05.ProblemReportImportHandler">
</handler>
</extension>
<extension
point="org.eclipse.ui.bindings">
<key
commandId="com.connor.ac.commands.sampleCommand"
contextId="org.eclipse.ui.contexts.window"
sequence="M1+6"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
</key>
</extension>-
<extension
point="org.eclipse.ui.menus">
<!--
<menuContribution
locationURI="menu:cn.com.ebewin.ysr.ui.menus.ProjectManage?after=cn.com.ebewin.ysr.ui.menus.ProblemBoard">
<command
commandId="com.connor.ac.commands.ProblemReportImport"
mnemonic="S"
id="com.connor.ac.menus.ProblemReportImport">
</command>
</menuContribution>
<menuContribution
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
<toolbar
id="com.connor.ac.toolbars.sampleToolbar">
<command
commandId="com.connor.ac.commands.sampleCommand"
icon="icons/sample.gif"
tooltip="Say hello world"
id="com.connor.ac.toolbars.sampleCommand">
</command>
</toolbar>
</menuContribution>-->
</extension>
</plugin>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,678 @@
//package com.connor.AC_01;
//
///*jadclipse*/// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
////Jad home page: http://www.kpdus.com/jad.html
////Decompiler options: packimports(3) radix(10) lradix(10)
////Source File Name: TMomFormStyle.java
//
//
//import com.connor.dongmu.plm.bean.TMomProcessBean;
//import com.connor.dongmu.plm.util.TMomFinalUtil;
//import com.teamcenter.rac.aif.AbstractAIFDialog;
//import com.teamcenter.rac.kernel.TCComponent;
//import com.teamcenter.rac.kernel.TCException;
//import com.teamcenter.rac.kernel.TCProperty;
//import com.teamcenter.rac.stylesheet.AbstractRendering;
//import com.teamcenter.rac.util.MessageBox;
//import com.teamcenter.rac.util.PropertyLayout;
//import java.awt.BorderLayout;
//import java.awt.Color;
//import java.awt.Dimension;
//import java.awt.FlowLayout;
//import java.awt.Toolkit;
//import java.awt.datatransfer.Clipboard;
//import java.awt.datatransfer.StringSelection;
//import java.awt.event.ActionEvent;
//import java.awt.event.ActionListener;
//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.ArrayList;
//import java.util.HashMap;
//import javax.swing.JButton;
//import javax.swing.JLabel;
//import javax.swing.JPanel;
//import javax.swing.JScrollPane;
//import javax.swing.JTabbedPane;
//import javax.swing.JTable;
//import javax.swing.JTextField;
//import javax.swing.JTree;
//import javax.swing.JViewport;
//import javax.swing.table.DefaultTableModel;
//import javax.swing.table.TableColumn;
//import javax.swing.table.TableColumnModel;
//import javax.swing.table.TableModel;
//
////Referenced classes of package com.connor.dongmu.plm.handlers.tmom005:
//// TableCellTextAreaRenderer
//
//public class TMomFormStyle extends AbstractRendering
// implements ActionListener, MouseListener, KeyListener
//{
// private class showERPCountDialog extends AbstractAIFDialog
// {
//
// public void init()
// {
// setTitle("\u7269\u6599\u6D4F\u89C8");
// setPreferredSize(new Dimension(900, 150));
// table = getjTable(table, defaultTM, ckNames, ckCounts);
// panel = new JPanel(new BorderLayout());
// panel2 = new JPanel(new FlowLayout());
// panel3 = new JPanel(new BorderLayout());
// simpleCopyButton = new JButton("\u590D\u5236\u5355\u4E2A\u5E93\u5B58");
// simpleCopyButton.addActionListener(new ActionListener() {
//
// public void actionPerformed(ActionEvent e)
// {
// simpleCopyAction(e);
// }
//
// final showERPCountDialog this$1;
//
//
// {
// this$1 = showERPCountDialog.this;
//
// }
// }
//);
// copyButton = new JButton("\u590D\u5236\u5168\u90E8\u5E93\u5B58");
// copyButton.addActionListener(new ActionListener() {
//
// public void actionPerformed(ActionEvent e)
// {
// totleCopyAction(e);
// }
//
// final showERPCountDialog this$1;
//
//
// {
// this$1 = showERPCountDialog.this;
//
// }
// }
//);
// closeButton = new JButton("\u5173\u95ED");
// closeButton.addActionListener(new ActionListener() {
//
// public void actionPerformed(ActionEvent e)
// {
// closeAction(e);
// }
//
// final showERPCountDialog this$1;
//
//
// {
// this$1 = showERPCountDialog.this;
//
// }
// }
//);
// panel2.add(simpleCopyButton);
// panel2.add(copyButton);
// panel2.add(closeButton);
// panel3.add(new JScrollPane(table), "Center");
// panel.add(panel2, "South");
// panel.add(panel3, "Center");
// add(panel, "Center");
// pack();
// centerToScreen();
// showDialog();
// }
//
// private void simpleCopyAction(ActionEvent e)
// {
// int colIndex = table.getSelectedColumn();
// if(colIndex != -1)
// setClipboard((new StringBuilder()).append(ckCounts[0][colIndex]).toString());
// }
//
// private void totleCopyAction(ActionEvent e)
// {
// StringBuffer sb = new StringBuffer();
// for(int i = 0; i < ckNames.length; i++)
// {
// sb.append(ckNames[i]);
// if(i != ckNames.length - 1)
// sb.append("|");
// }
//
// sb.append("\r\n");
// for(int i = 0; i < ckCounts[0].length; i++)
// {
// sb.append(ckCounts[0][i]);
// if(i != ckCounts[0].length - 1)
// sb.append("|");
// }
//
// setClipboard(sb.toString());
// }
//
// private void closeAction(ActionEvent e)
// {
// dispose();
// }
//
// private Object ckNames[];
// private Object ckCounts[][];
// private String wlCode;
// private JPanel panel;
// private JPanel panel2;
// private JPanel panel3;
// private JButton simpleCopyButton;
// private JButton copyButton;
// private JButton closeButton;
// private JTable table;
// private DefaultTableModel defaultTM;
// final TMomFormStyle this$0;
//
//
//
//
// public showERPCountDialog(String wlCode, Object ckNames[], Object ckCounts[][])
// {
// this$0 = TMomFormStyle.this;
//
// this.wlCode = wlCode;
// this.ckNames = ckNames;
// this.ckCounts = ckCounts;
// init();
// }
// }
//
// private class writeWLCodeDialog extends AbstractAIFDialog
// {
//
// public void init()
// {
// System.out.println("\u521D\u59CB\u5316\u754C\u9762");
// setTitle("\u8BF7\u8F93\u5165\u5DE5\u827A\u4FE1\u606F");
// setPreferredSize(new Dimension(300, 130));
// lable = new JLabel("\u7269\u6599\u7F16\u7801\uFF1A");
// textField = new JTextField(24);
// panel = new JPanel(new BorderLayout());
// panel2 = new JPanel(new FlowLayout());
// panel3 = new JPanel(new FlowLayout());
// okButton = new JButton("\u786E\u5B9A");
// okButton.addActionListener(new ActionListener() {
//
// public void actionPerformed(ActionEvent e)
// {
// okAction(e);
// }
//
// final writeWLCodeDialog this$1;
//
//
// {
// this$1 = writeWLCodeDialog.this;
//
// }
// }
//);
// celButton = new JButton("\u53D6\u6D88");
// celButton.addActionListener(new ActionListener() {
//
// public void actionPerformed(ActionEvent e)
// {
// celAction(e);
// }
//
// final writeWLCodeDialog this$1;
//
//
// {
// this$1 = writeWLCodeDialog.this;
//
// }
// }
//);
// panel2.add(lable);
// panel2.add(textField);
// panel3.add(okButton);
// panel3.add(celButton);
// panel.add(panel3, "South");
// panel.add(panel2, "Center");
// add(panel, "Center");
// pack();
// centerToScreen();
// showDialog();
// }
//
// private void okAction(ActionEvent actionevent)
// {
// }
//
// private void celAction(ActionEvent e)
// {
// dispose();
// }
//
// private JPanel panel;
// private JPanel panel2;
// private JPanel panel3;
// private JLabel lable;
// private JTextField textField;
// private JButton okButton;
// private JButton celButton;
// final TMomFormStyle this$0;
//
//
//
// public writeWLCodeDialog()
// {
// this$0 = TMomFormStyle.this;
//
// init();
// }
// }
//
//
// public TMomFormStyle(TCComponent arg0)
// throws Exception
// {
// super(arg0);
// recordIndex = 0;
// System.out.println("++++++++++++++++++++++++++++++++");
// formComp = arg0;
// loadRendering();
// }
//
// public void getFormVlue()
// {
// valueLists = new ArrayList();
// try
// {
// properties = formComp.getTCProperties(TMomFinalUtil.TM2_PRICE_PROP_NAMES);
// propertiesArray = formComp.getTCProperties(TMomFinalUtil.TM2_PROCESS_PROP_NAMES);
// if(propertiesArray != null)
// {
// String valueStrs0[] = propertiesArray[0] != null ? propertiesArray[0].getStringArrayValue() : new String[0];
// String valueStrs1[] = propertiesArray[1] != null ? propertiesArray[1].getStringArrayValue() : new String[0];
// String valueStrs2[] = propertiesArray[2] != null ? propertiesArray[2].getStringArrayValue() : new String[0];
// String valueStrs3[] = propertiesArray[3] != null ? propertiesArray[3].getStringArrayValue() : new String[0];
// String valueStrs4[] = propertiesArray[4] != null ? propertiesArray[4].getStringArrayValue() : new String[0];
// String valueStrs5[] = propertiesArray[5] != null ? propertiesArray[5].getStringArrayValue() : new String[0];
// String valueStrs6[] = propertiesArray[6] != null ? propertiesArray[6].getStringArrayValue() : new String[0];
// if(valueStrs0.length == valueStrs1.length && valueStrs0.length == valueStrs2.length && valueStrs0.length == valueStrs3.length && valueStrs0.length == valueStrs4.length && valueStrs0.length == valueStrs5.length && valueStrs0.length == valueStrs6.length && valueStrs0.length != 0)
// {
// for(int i = 0; i < valueStrs0.length; i++)
// {
// TMomProcessBean bean = new TMomProcessBean();
// bean.setTm2_DocLineNo(valueStrs0[i]);
// bean.setTm2_ProjectNam(valueStrs1[i]);
// bean.setTm2_ProjectFee(valueStrs2[i]);
// bean.setTm2_ProjectMark(valueStrs3[i]);
// bean.setTm2_ProjectEqui(valueStrs4[i]);
// bean.setTm2_ProjectSuggest(valueStrs5[i]);
// bean.setTm2_ONum(valueStrs6[i]);
// valueLists.add(bean);
// }
//
// }
// }
// if(properties != null)
// {
// propTexts = new JTextField[properties.length];
// priceValues = new String[properties.length];
// for(int i = 0; i < properties.length; i++)
// priceValues[i] = properties[i] != null ? properties[i].getStringValue() : "";
//
// }
// }
// catch(TCException e)
// {
// e.printStackTrace();
// }
// }
//
// public void saveWLProps()
// {
// if(valueLists == null)
// {
// System.out.println("\u5C5E\u6027\u5217\u8868\u4E3A\u7A7A");
// return;
// }
// String valueStrs0[] = new String[valueLists.size()];
// String valueStrs1[] = new String[valueLists.size()];
// String valueStrs2[] = new String[valueLists.size()];
// String valueStrs3[] = new String[valueLists.size()];
// String valueStrs4[] = new String[valueLists.size()];
// String valueStrs5[] = new String[valueLists.size()];
// String valueStrs6[] = new String[valueLists.size()];
// for(int i = 0; i < valueLists.size(); i++)
// {
// TMomProcessBean bean = (TMomProcessBean)valueLists.get(i);
// valueStrs0[i] = bean.getTm2_DocLineNo();
// valueStrs1[i] = bean.getTm2_ProjectNam();
// valueStrs2[i] = bean.getTm2_ProjectFee();
// valueStrs3[i] = bean.getTm2_ProjectMark();
// valueStrs4[i] = bean.getTm2_ProjectEqui();
// valueStrs5[i] = bean.getTm2_ProjectSuggest();
// valueStrs6[i] = bean.getTm2_ONum();
// }
//
// try
// {
// if(propertiesArray[0] != null)
// propertiesArray[0].setStringValueArray(valueStrs0);
// if(propertiesArray[1] != null)
// propertiesArray[1].setStringValueArray(valueStrs1);
// if(propertiesArray[2] != null)
// propertiesArray[2].setStringValueArray(valueStrs2);
// if(propertiesArray[3] != null)
// propertiesArray[3].setStringValueArray(valueStrs3);
// if(propertiesArray[4] != null)
// propertiesArray[4].setStringValueArray(valueStrs4);
// if(propertiesArray[5] != null)
// propertiesArray[5].setStringValueArray(valueStrs5);
// if(propertiesArray[6] != null)
// propertiesArray[6].setStringValueArray(valueStrs6);
// for(int i = 0; i < properties.length; i++)
// properties[i].setStringValue(priceValues[i]);
//
// formComp.setTCProperties(propertiesArray);
// formComp.setTCProperties(properties);
// }
// catch(TCException e)
// {
// e.printStackTrace();
// }
// catch(Exception e1)
// {
// e1.printStackTrace();
// }
// }
//
// public boolean checkForSave(Object obj)
// {
// saveWLProps();
// System.out.println("\u7B7E\u5165\u5E76\u4FDD\u5B58");
// return super.checkForSave(obj);
// }
//
// public void save()
// {
// saveWLProps();
// System.out.println("\u4FDD\u5B58");
// super.save();
// }
//
// public void init()
// {
// System.out.println("====>>>> \u521D\u59CB\u5316\u754C\u9762 <1>");
// clorMap = new HashMap();
// fontMap = new HashMap();
// valueLists = new ArrayList();
// getFormVlue();
// setLayout(new BorderLayout());
// setBackground(Color.WHITE);
// rootPanel = new JPanel(new BorderLayout());
// addButton = new JButton("\u6DFB\u52A0");
// addButton.setEnabled(true);
// delButton = new JButton("\u5220\u9664");
// delButton.setEnabled(true);
// emptyLable = new JLabel(" ");
// addButton.addActionListener(new ActionListener() {
//
// public void actionPerformed(ActionEvent e)
// {
// addRow(e);
// }
//
// final TMomFormStyle this$0;
//
//
// {
// this$0 = TMomFormStyle.this;
//
// }
// }
//);
// delButton.addActionListener(new ActionListener() {
//
// public void actionPerformed(ActionEvent e)
// {
// delRow(e);
// }
//
// final TMomFormStyle this$0;
//
//
// {
// this$0 = TMomFormStyle.this;
//
// }
// }
//);
// partsTable = getjTable(partsTable, dtm, titleNames, getValues(valueLists));
// topPanel = new JPanel(new BorderLayout());
// scrollPanel = new JScrollPane();
// scrollPanel.getViewport().add(partsTable, null);
// scrollPanel.validate();
// topPanel.add("Center", scrollPanel);
// buttomPanel = new JPanel(new FlowLayout());
// buttomPanel.add(addButton);
// buttomPanel.add(emptyLable);
// buttomPanel.add(delButton);
// rootPanel = new JPanel(new BorderLayout());
// rootPanel.add("Center", topPanel);
// rootPanel.add("South", buttomPanel);
// JPanel firstPanel = new JPanel(new PropertyLayout());
// for(int i = 0; i < TMomFinalUtil.TM2_PRICE_PROP_NAMES_ZH_CH.length; i += 3)
// {
// propTexts[i] = new JTextField(24);
// propTexts[i].setText(priceValues[i]);
// firstPanel.add((new StringBuilder(String.valueOf(i / 3 + 1))).append(".1.right.top.preferred.preferred").toString(), new JLabel(TMomFinalUtil.TM2_PRICE_PROP_NAMES_ZH_CH[i]));
// firstPanel.add((new StringBuilder(String.valueOf(i / 3 + 1))).append(".2.left.top.preferred.preferred").toString(), propTexts[i]);
// if(i + 1 == TMomFinalUtil.TM2_PRICE_PROP_NAMES_ZH_CH.length)
// break;
// propTexts[i + 1] = new JTextField(24);
// propTexts[i + 1].setText(priceValues[i + 1]);
// firstPanel.add((new StringBuilder(String.valueOf(i / 3 + 1))).append(".3.right.top.preferred.preferred").toString(), new JLabel(TMomFinalUtil.TM2_PRICE_PROP_NAMES_ZH_CH[i + 1]));
// firstPanel.add((new StringBuilder(String.valueOf(i / 3 + 1))).append(".4.left.top.preferred.preferred").toString(), propTexts[i + 1]);
// if(i + 2 == TMomFinalUtil.TM2_PRICE_PROP_NAMES_ZH_CH.length)
// break;
// propTexts[i + 2] = new JTextField(24);
// propTexts[i + 2].setText(priceValues[i + 2]);
// firstPanel.add((new StringBuilder(String.valueOf(i / 3 + 1))).append(".5.right.top.preferred.preferred").toString(), new JLabel(TMomFinalUtil.TM2_PRICE_PROP_NAMES_ZH_CH[i + 2]));
// firstPanel.add((new StringBuilder(String.valueOf(i / 3 + 1))).append(".6.left.top.preferred.preferred").toString(), propTexts[i + 2]);
// }
//
// JTabbedPane tabPane = new JTabbedPane();
// tabPane.add("\u62A5\u4EF7\u4FE1\u606F", new JScrollPane(firstPanel));
// tabPane.add("\u5DE5\u827A\u4FE1\u606F", new JScrollPane(rootPanel));
// add(tabPane, "Center");
// }
//
// private void addRow(ActionEvent e)
// {
// new writeWLCodeDialog();
// }
//
// private void delRow(ActionEvent e)
// {
// int index = partsTable.getSelectedRow();
// if(index == -1)
// {
// MessageBox.post("\u8BF7\u9009\u62E9\u8868\u683C\u540E\u518D\u6267\u884C\u5220\u9664\u64CD\u4F5C\uFF01", "Warning", 4);
// return;
// } else
// {
// valueLists.remove(index);
// dtm.removeRow(index);
// dtm.fireTableStructureChanged();
// dtm.fireTableDataChanged();
// scrollPanel.validate();
// return;
// }
// }
//
// public JTable getjTable(JTable partsTable, DefaultTableModel dtm, Object titleNames[], Object values[][])
// {
// int simpleLen = 105;
// int totleLen = 900;
// if(partsTable == null)
// {
// partsTable = new JTable(getTableModel(dtm, titleNames, values)) {
//
// public boolean isCellEditable(int row, int column)
// {
// return false;
// }
//
// final TMomFormStyle this$0;
//
//
// {
// this$0 = TMomFormStyle.this;
//
// }
// }
//;
// partsTable.setDefaultRenderer(Object.class, new TableCellTextAreaRenderer());
// if(simpleLen * titleNames.length >= totleLen)
// {
// for(int i = 0; i < titleNames.length; i++)
// partsTable.getColumnModel().getColumn(i).setPreferredWidth(105);
//
// partsTable.setAutoResizeMode(0);
// } else
// {
// partsTable.setAutoResizeMode(1);
// }
// }
// return partsTable;
// }
//
// public DefaultTableModel getTableModel(DefaultTableModel dtm, Object columNameObjects[], Object objects[][])
// {
// if(dtm == null)
// dtm = new DefaultTableModel(objects, columNameObjects);
// return dtm;
// }
//
// public java.util.List getAllChildItemId()
// {
// java.util.List idList = new ArrayList();
// return idList;
// }
//
// public Object[][] getValues(java.util.List beanList)
// {
// Object objects[][] = new Object[beanList.size()][7];
// for(int i = 0; i < beanList.size(); i++)
// {
// objects[i][0] = ((TMomProcessBean)beanList.get(i)).getTm2_DocLineNo();
// objects[i][1] = ((TMomProcessBean)beanList.get(i)).getTm2_ProjectNam();
// objects[i][2] = ((TMomProcessBean)beanList.get(i)).getTm2_ProjectFee();
// objects[i][3] = ((TMomProcessBean)beanList.get(i)).getTm2_ProjectMark();
// objects[i][4] = ((TMomProcessBean)beanList.get(i)).getTm2_ProjectEqui();
// objects[i][5] = ((TMomProcessBean)beanList.get(i)).getTm2_ProjectSuggest();
// objects[i][6] = ((TMomProcessBean)beanList.get(i)).getTm2_ONum();
// }
//
// return objects;
// }
//
// public void setClipboard(String str)
// {
// StringSelection ss = new StringSelection(str);
// Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
// }
//
// public void actionPerformed(ActionEvent actionevent)
// {
// }
//
// public void loadRendering()
// throws TCException
// {
// init();
// }
//
// public void saveRendering()
// {
// }
//
// public static void main(String args1[])
// {
// }
//
// public void keyTyped(KeyEvent keyevent)
// {
// }
//
// public void keyPressed(KeyEvent e)
// {
// int colIndex = partsTable.getSelectedColumn();
// int rowIndex = partsTable.getSelectedRow();
// if(colIndex == 0 && rowIndex == partsTable.getRowCount() - 1)
// e.getKeyCode();
// }
//
// public void keyReleased(KeyEvent keyevent)
// {
// }
//
// public void mouseClicked(MouseEvent mouseevent)
// {
// }
//
// public void mousePressed(MouseEvent mouseevent)
// {
// }
//
// public void mouseReleased(MouseEvent mouseevent)
// {
// }
//
// public void mouseEntered(MouseEvent mouseevent)
// {
// }
//
// public void mouseExited(MouseEvent mouseevent)
// {
// }
//
// private JPanel rootPanel;
// private JPanel topPanel;
// private JPanel buttomPanel;
// private JScrollPane scrollPanel;
// private JLabel emptyLable;
// private JButton addButton;
// private JButton delButton;
// private JTable partsTable;
// private Object titleNames[] = {
// "\u884C\u53F7", "\u5DE5\u5E8F", "\u5DE5\u5E8F\u8D39", "\u5DE5\u5E8F\u5907\u6CE8", "\u5DE5\u5E8F\u8BBE\u5907", "\u9879\u76EE\u5EFA\u8BAE", "\u6392\u5E8F\u53F7"
// };
// private HashMap clorMap;
// private HashMap fontMap;
// private String priceValues[];
// private java.util.List valueLists;
// private DefaultTableModel dtm;
// private int recordIndex;
// private TCComponent formComp;
// private TCProperty properties[];
// private TCProperty propertiesArray[];
// private JTextField propTexts[];
// private JTree tree;
//
//
//}
//
//
///*
// DECOMPILATION REPORT
//
// Decompiled from: Z:\peixun\eclipse\workspace\com.connor.ac\aclib\com.connor.dongmu.plm_1.0.0.jar
// Total time: 103 ms
// Jad reported messages/errors:
// Exit status: 0
// Caught exceptions:
//*/

@ -0,0 +1,78 @@
/*jadclipse*/// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) radix(10) lradix(10)
// Source File Name: TMomFormStyle.java
package com.connor.AC_01;
import java.awt.Color;
import java.awt.Component;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.table.*;
public class TableCellTextAreaRenderer extends JTextArea
implements TableCellRenderer
{
private int rowIndex;
private Color color;
private boolean isSet = false;
public TableCellTextAreaRenderer()
{
setLineWrap(true);
setWrapStyleWord(true);
}
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
{
if(isSet){
if (row == rowIndex) {
setBackground(color);
setForeground(Color.BLACK);
}else if(row > rowIndex){
setBackground(Color.WHITE);
setForeground(Color.BLACK);
}else{
setBackground(Color.WHITE);
setForeground(Color.BLACK);
}
}
int maxPreferredHeight = 0;
for(int i = 0; i < table.getColumnCount(); i++)
{
setText((new StringBuilder()).append(table.getValueAt(row, i)).toString());
setSize(table.getColumnModel().getColumn(column).getWidth(), 0);
maxPreferredHeight = Math.max(maxPreferredHeight, getPreferredSize().height);
}
if(table.getRowHeight(row) != maxPreferredHeight)
table.setRowHeight(row, maxPreferredHeight);
setText(value != null ? value.toString() : "");
return this;
}
public void setOneRowBackgroundColor(JTable partsTable, boolean table, final int rowIndex1,
final Color color1) {
isSet=table;
rowIndex = rowIndex1;
color = color1;
int columnCount = partsTable.getColumnCount();
for (int i = 0; i < columnCount; i++) {
partsTable.getColumn(partsTable.getColumnName(i)).setCellRenderer(this);
}
}
}
/*
DECOMPILATION REPORT
Decompiled from: Z:\peixun\eclipse\workspace\com.connor.ac\aclib\com.connor.dongmu.plm_1.0.0.jar
Total time: 57 ms
Jad reported messages/errors:
Exit status: 0
Caught exceptions:
*/

@ -0,0 +1,28 @@
package com.connor.AC_05;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.common.actions.AbstractAIFAction;
import com.teamcenter.rac.kernel.TCSession;
public class ProblemReportImportAction extends AbstractAIFAction {
private AbstractAIFApplication app;
private String commandName;
public ProblemReportImportAction(AbstractAIFApplication app, String commandName) {
super(app, commandName);
this.app = app;
this.commandName = commandName;
}
@Override
public void run() {
//µ÷ÓÃCommand
ProblemReportImportCommand command = new ProblemReportImportCommand(this.app);
try {
command.executeModal();
} catch (Exception e) {
e.printStackTrace();
}
}
}

@ -0,0 +1,19 @@
package com.connor.AC_05;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.AbstractAIFCommand;
public class ProblemReportImportCommand extends AbstractAIFCommand {
private AbstractAIFApplication app;
public ProblemReportImportCommand(AbstractAIFApplication app) {
this.app = app;
// TODO Auto-generated constructor stub
}
@Override
public void executeModal() throws Exception {
ProblemReportImportDialog dialog = new ProblemReportImportDialog(app);
new Thread(dialog)
.start();
}
}

@ -0,0 +1,234 @@
package com.connor.AC_05;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumnModel;
import com.connor.ac.util.ACFinalUtil;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.AbstractAIFDialog;
import com.teamcenter.rac.kernel.TCComponentFolder;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCPreferenceService;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.stylesheet.PropertyDateComponent;
import com.teamcenter.rac.util.MessageBox;
public class ProblemReportImportDialog extends AbstractAIFDialog {
private AbstractAIFApplication app;
private TCSession session;
private String url;
private String[] modelFiles;
private TCComponentFolder targetFolder;
private JButton b_reload;
private JButton b_imp;
private JButton b_cel;
protected JComboBox<String> b_company;
protected DefaultTableModel tm_pro;
protected JTable t_pro;
public String[] HEADER = new String[] { "序号", "问题ID", "重要度", "用户要求整改期","提交人", "提交次数", "子项目号", "图片说明", "问题说明", "原因分析(提出者必填)","整改责任人","整改计划完成时间","采购责任人","采购计划完成时间","加工责任人","加工计划完成时间","实施负责人","实施计划完成时间","状态"};
public int[] HEADERWIDTH = new int[] { 50, 100, 50, 100,50, 50, 100, 70, 100, 100, 80, 80, 80, 80, 80, 80, 80, 80 };
public ProblemReportImportDialog(AbstractAIFApplication app) {
super(false);
this.app = app;
this.session = (TCSession) this.app.getSession();
}
@Override
public void run() {
try {
System.out.println("开始执行");
targetFolder = (TCComponentFolder)app.getTargetComponent();
String folderName = targetFolder.getStringProperty("object_name");
if(folderName.equals("6、问题反馈")){
System.out.println(targetFolder==null);
System.out.println(folderName);
if(targetFolder!=null){
//-------------------------------------/-------------------------------
chooserLoading();
showDialog();
//-------------------------------------/-------------------------------
}
}else {
MessageBox.post("请选择\"6、问题反馈\"文件夹","提示",MessageBox.INFORMATION);
}
} catch (TCException e) {
e.printStackTrace();
MessageBox.post("请选择\"6、问题反馈\"文件夹","提示",MessageBox.INFORMATION);
}
}
private void chooserLoading(){
JFileChooser chooser = new JFileChooser();
int statu = chooser.showOpenDialog(this);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
if(statu==JFileChooser.APPROVE_OPTION){
File f = chooser.getSelectedFile();
this.url= f.getPath();
initUI();
}
}
private void addListeners() {
this.b_reload.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
});
this.b_cel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
});
this.b_imp.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
});
}
private void initUI() {
this.setTitle("页面");
this.setPreferredSize(new Dimension(1300, 400));
this.setMinimumSize(new Dimension(800, 300));
this.setLayout(new BorderLayout());
JPanel jpa = initQueryPanel();
JPanel jpa1 = initTablePanel();
JPanel jpa2 = initBtnPanel();
if(jpa!=null && jpa1!=null && jpa2!=null){
this.add(BorderLayout.NORTH, jpa);
this.add(BorderLayout.CENTER, jpa1);
this.add(BorderLayout.SOUTH, jpa2);
}
}
private JPanel initBtnPanel() {
JPanel panel = new JPanel();
Box b1=Box.createHorizontalBox(); //创建横向Box容器
panel.add(b1);
// b1.add(Box.createVerticalStrut(100));
b1.add(Box.createHorizontalGlue());
b_imp = new JButton("导入并发起流程");
b1.add(b_imp);
b1.add(Box.createHorizontalStrut(40)); //添加长度为40的水平框架
b_cel = new JButton("取消");
b1.add(b_cel);
b1.add(Box.createHorizontalGlue());
return panel;
}
private JPanel initTablePanel() {
JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
tm_pro = new DefaultTableModel() {
@Override
public boolean isCellEditable(int row, int column) {
return false;
}
@Override
public Class<?> getColumnClass(int columnIndex) {
if(columnIndex==0) {
return Double.class;
}
return super.getColumnClass(columnIndex);
}
};
t_pro = new JTable(tm_pro);
tm_pro.setDataVector(null, HEADER);
t_pro.getTableHeader().setReorderingAllowed(false); // 设置列不可移动,否则会发生类型转换错误(第三列)
this.t_pro.setRowHeight(23);
this.t_pro.setAutoCreateRowSorter(true);
//TableRowSorter<DefaultTableModel> sorter=new TableRowSorter<DefaultTableModel>(tm_workflow);
//this.t_pro.setRowSorter(sorter);
// this.t_part.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
TableColumnModel colModel = this.t_pro.getColumnModel();
int colCnt = HEADERWIDTH.length;
colModel.getColumn(0).setMaxWidth(HEADERWIDTH[0]);
for (int i = 0; i < colCnt; i++) {
colModel.getColumn(i).setPreferredWidth(HEADERWIDTH[i]);
}
JScrollPane scroll = new JScrollPane(t_pro);
panel.add(BorderLayout.CENTER, scroll);
return panel;
}
private JPanel initQueryPanel() {
JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 7, 5));
String folderProId = null;
try {
if(targetFolder!=null){
folderProId = targetFolder.getStringProperty("project_ids");
}else{
MessageBox.post("未指派项目","提示",MessageBox.INFORMATION);
return null;
}
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
JTextField xm_text = new JTextField(folderProId);
Dimension dim1 = new Dimension(150, 25);
xm_text.setPreferredSize(dim1);
xm_text.setEditable(false);
panel.add(new JLabel("项目号 "));
panel.add(xm_text);
panel.add(new JLabel(" 工作流程模板 "));
TCPreferenceService service = session.getPreferenceService();
modelFiles = service.getStringValues(ACFinalUtil.AC_Workflow_Temp_Name);
if(modelFiles==null){
MessageBox.post("未配置AC_Workflow_Temp_Name首选项","提示",MessageBox.INFORMATION);
modelFiles = new String[]{};
}
for (int i = 0; i < modelFiles.length; i++) {
modelFiles[i] = modelFiles[i].split("=")[0];
}
b_company = new JComboBox<String>(modelFiles);
panel.add(b_company);
Dimension dim = new Dimension(80, 25);
b_reload = new JButton("重新加载");
b_reload.setPreferredSize(dim);
panel.add(b_reload);
return panel;
}
}

@ -0,0 +1,28 @@
package com.connor.AC_05;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.common.NotDefinedException;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aifrcp.AIFUtility;
public class ProblemReportImportHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
AbstractAIFApplication app = AIFUtility.getCurrentApplication();
String commandName = null;
try {
commandName = arg0.getCommand().getName();
} catch (NotDefinedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ProblemReportImportAction action = new ProblemReportImportAction(app, commandName);
new Thread(action).start();
return null;
}
}

@ -0,0 +1,61 @@
package com.connor.ac;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "com.connor.ac"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
/**
* The constructor
*/
public Activator() {
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
/**
* Returns an image descriptor for the image file at the given
* plug-in relative path
*
* @param path the path
* @return the image descriptor
*/
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
}

@ -0,0 +1,86 @@
package com.connor.ac.bean;
public class SysCatalogRevisionMasterBean {
private String ysr8_ID;//代号
private String ysr8_object;//名称
private String ysr8_Quantity;//数量
private String ysr8_Category;//子项类别
private String ysr8_Electric;//是否需要电气
private String ysr8_Cost;//计划成本
private String ysr8_Cancel;//子项取消
private String ysr8_Designer;//设计人员
private String ysr8_SubProjectType;//子项类型
private String ysr8_CustomPartCode;//用户图号
private String ysr8_PlanWorkTime;//计划工时
public String getYsr8_Designer() {
return ysr8_Designer;
}
public void setYsr8_Designer(String ysr8_Designer) {
this.ysr8_Designer = ysr8_Designer;
}
public String getYsr8_SubProjectType() {
return ysr8_SubProjectType;
}
public void setYsr8_SubProjectType(String ysr8_SubProjectType) {
this.ysr8_SubProjectType = ysr8_SubProjectType;
}
public String getYsr8_CustomPartCode() {
return ysr8_CustomPartCode;
}
public void setYsr8_CustomPartCode(String ysr8_CustomPartCode) {
this.ysr8_CustomPartCode = ysr8_CustomPartCode;
}
public String getYsr8_PlanWorkTime() {
return ysr8_PlanWorkTime;
}
public void setYsr8_PlanWorkTime(String ysr8_PlanWorkTime) {
this.ysr8_PlanWorkTime = ysr8_PlanWorkTime;
}
public String getYsr8_ID() {
return ysr8_ID;
}
public void setYsr8_ID(String ysr8_ID) {
this.ysr8_ID = ysr8_ID;
}
public String getYsr8_object() {
return ysr8_object;
}
public void setYsr8_object(String ysr8_object) {
this.ysr8_object = ysr8_object;
}
public String getYsr8_Quantity() {
return ysr8_Quantity;
}
public void setYsr8_Quantity(String ysr8_Quantity) {
this.ysr8_Quantity = ysr8_Quantity;
}
public String getYsr8_Category() {
return ysr8_Category;
}
public void setYsr8_Category(String ysr8_Category) {
this.ysr8_Category = ysr8_Category;
}
public String getYsr8_Electric() {
return ysr8_Electric;
}
public void setYsr8_Electric(String ysr8_Electric) {
this.ysr8_Electric = ysr8_Electric;
}
public String getYsr8_Cost() {
return ysr8_Cost;
}
public void setYsr8_Cost(String ysr8_Cost) {
this.ysr8_Cost = ysr8_Cost;
}
public String getYsr8_Cancel() {
return ysr8_Cancel;
}
public void setYsr8_Cancel(String ysr8_Cancel) {
this.ysr8_Cancel = ysr8_Cancel;
}
}

@ -0,0 +1,34 @@
package com.connor.ac.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;
/**
* Our sample handler extends AbstractHandler, an IHandler base class.
* @see org.eclipse.core.commands.IHandler
* @see org.eclipse.core.commands.AbstractHandler
*/
public class SampleHandler extends AbstractHandler {
/**
* The constructor.
*/
public SampleHandler() {
}
/**
* the command has been executed, so extract extract the needed information
* from the application context.
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
MessageDialog.openInformation(
window.getShell(),
"Ac",
"Hello, Eclipse world");
return null;
}
}

@ -0,0 +1,11 @@
package com.connor.ac.util;
public class ACFinalUtil {
public static final String AC_CATALOG_PROP_NAMES[] = { "ysr8_ID", "ysr8_object", "ysr8_Quantity","ysr8_Designer1", "ysr8_Category", "ysr8_SubProjectType1","ysr8_Electric",
"ysr8_CustomPartCode1","ysr8_Cost", "ysr8_Cancel","ysr8_PlanWorkTime" };
public static final String AC_CATALOG_PROP_NAMES_ZH_CH[] = {};
// ---------------ALL----------------------------------------------
public static final String EXCEL_MODEL_FILE = "YSR_SysCatalog_Model";// Excel模板文件
//public static final String AC_Workflow_Temp_Name = "AC_Workflow_Temp_Name";// 工作流程模板名称
public static final String AC_Workflow_Temp_Name = "Connor_Import_Item_Workflow";// 工作流程模板名称
}

@ -0,0 +1,455 @@
package com.connor.ac.util;
import java.awt.Frame;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.filechooser.FileSystemView;
import org.apache.log4j.Logger;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.Name;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.AreaReference;
import org.apache.poi.ss.util.CellReference;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class FileUtil {
private static final Logger log = Logger.getLogger(FileUtil.class);
public static void main(String[] args) {
String path = "E:\\TEMP\\newName.xlsx";
File file = new File(path);
//getCellValueByName(file, "<22><>Ŀ<EFBFBD><C4BF><EFBFBD>");
file = renameFile(file, "2");
System.out.println(file.getName());
}
public static File renameFile(File file, String newName) {
String fileName = file.getName();
String fileSuffix = fileName.substring(fileName.lastIndexOf("."), fileName.length());
File newFile = new File(file.getParent() + "\\" + newName + fileSuffix);
file.renameTo(newFile);
return newFile;
}
public static void writeToExcel(File file, JTable table) {
Integer colCount = table.getColumnCount() - 1;
Integer rowCount = table.getRowCount();
try {
String fileName = file.getName().toLowerCase();
Workbook workBook = fileName.endsWith("xls") ? new HSSFWorkbook() : new XSSFWorkbook();
Sheet sheet = workBook.createSheet("sheet0");
for (int i = 0; i < rowCount; i++) {
Row row = sheet.createRow(i);
for (int j = 0; j < colCount; j++) {
row.createCell(j);
}
}
// <20><>ӱ<EFBFBD><D3B1><EFBFBD>
for (int i = 0; i < colCount; i++) {
sheet.getRow(0).getCell(i).setCellValue(table.getColumnName(i));
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
for (int i = 1; i < rowCount; i++) {
for (int j = 0; j < colCount; j++) {
Object value = table.getValueAt(i, j);
sheet.getRow(i).getCell(j).setCellValue(value != null ? value + "" : "");
}
}
CellStyle style = workBook.createCellStyle();
for (int i = 0; i < sheet.getPhysicalNumberOfRows(); i++) {
Row row = sheet.getRow(i);
row.setHeightInPoints(20f);
for (int k = 0; k < row.getLastCellNum(); k++) {
row.getCell(k).setCellStyle(style);
sheet.setColumnWidth(k, 5000);
}
}
sheet.setColumnWidth(0, 5000);
FileOutputStream fileOut = new FileOutputStream(file);
workBook.write(fileOut);
fileOut.flush();
fileOut.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public static boolean writeToExcel(JDialog dialog, File file, JTable table, int col, Map<String, String> propertiesMap) {
InputStream input = null;
FileOutputStream output = null;
try {
input = new FileInputStream(file);
XSSFWorkbook wb=new XSSFWorkbook(input);
XSSFSheet sheet=wb.getSheetAt(0);
XSSFRow row;
XSSFCell cell;
for (int i = 0; i < table.getRowCount(); i++) {
row=sheet.getRow(2+i);
if(row.getCell(col)==null) {
cell=row.createCell(col);
}else {
cell=row.getCell(col);
}
Object tableObj = table.getValueAt(i, col);
cell.setCellType(XSSFCell.CELL_TYPE_STRING);
cell.setCellValue(tableObj==null?"":tableObj.toString());
}
output=new FileOutputStream(file.getPath());
wb.write(output);
} catch (Exception e1) {
e1.printStackTrace();
return false;
}finally {
if(output!=null) {
try {
output.close();
} catch (Exception e) {
JOptionPane.showMessageDialog(dialog, propertiesMap.get("error")+":"+e.getMessage(),
propertiesMap.get("error"), JOptionPane.WARNING_MESSAGE);
e.printStackTrace();
return false;
}
}
if(input!=null) {
try {
input.close();
} catch (Exception e) {
JOptionPane.showMessageDialog(dialog, propertiesMap.get("error")+":"+e.getMessage(),
propertiesMap.get("error"), JOptionPane.WARNING_MESSAGE);
e.printStackTrace();
return false;
}
}
}
return true;
}
public static String[] getCellValueByName(File file, String cellName) {
String[] cellValue = null;
try {
log.info("file:" + file.getAbsolutePath());
FileInputStream fileIn = new FileInputStream(file);
boolean isExcelX = file.getName().matches("^.+\\.(?i)(xlsx)$");
Workbook workbook = isExcelX ? new XSSFWorkbook(fileIn) : new HSSFWorkbook(fileIn);
int nameIndex = workbook.getNameIndex(cellName);
log.info("nameIndex:" + nameIndex);
if (nameIndex < 0) {
return null;
}
Name name = workbook.getNameAt(nameIndex);
AreaReference aref = new AreaReference(name.getRefersToFormula());
CellReference[] cellRef = aref.getAllReferencedCells();
cellValue = new String[cellRef.length];
for (int i = 0; i < cellRef.length; i++) {
Sheet sheet = workbook.getSheet(cellRef[i].getSheetName());
Row row = sheet.getRow(cellRef[i].getRow());
Cell cell = row.getCell(cellRef[i].getCol());
cellValue[i] = cell.toString();
log.info("cellValue:" + cellValue[i]);
}
} catch (IOException e) {
e.printStackTrace();
}
return cellValue;
}
public static List<ArrayList<String>> readExcel(File file) {
try {
log.info("file:" + file.getAbsolutePath());
FileInputStream fileIn = new FileInputStream(file);
boolean isExcelX = file.getName().matches("^.+\\.(?i)(xlsx)$");
Workbook workbook = isExcelX ? new XSSFWorkbook(fileIn) : new HSSFWorkbook(fileIn);
Sheet sheet = workbook.getSheetAt(0);
log.info("sheet:" + workbook.getSheetName(0));
if (sheet.getRow(1) == null || sheet.getRow(1).getCell(0) == null) {
log.info("sheet.getRow(1).getCell(0) == null");
return null;
}
List<ArrayList<String>> listDatas = new ArrayList<ArrayList<String>>();
Integer totalRows = sheet.getPhysicalNumberOfRows();
Integer totalCells = 0;
if (totalRows >= 1 && sheet.getRow(1) != null) {
totalCells = sheet.getRow(1).getPhysicalNumberOfCells();
}
for (int r = 0; r < totalRows; r++) {
Row row = sheet.getRow(r);
if (row == null) {
continue;
}
ArrayList<String> listRows = new ArrayList<String>();
for (short c = 0; c < totalCells; c++) {
Cell cell = row.getCell(c);
String cellValue = "";
if (cell == null) {
cellValue = "";
} else if (Cell.CELL_TYPE_NUMERIC == cell.getCellType()) {
if (HSSFDateUtil.isCellDateFormatted(cell)) {
cellValue = String.valueOf(DateUtil.getExcelDate(cell.getDateCellValue()));
} else {
cellValue = getRightStr(cell.getNumericCellValue() + "");
}
} else if (Cell.CELL_TYPE_STRING == cell.getCellType()) {
cellValue = cell.getStringCellValue().trim();
} else if (Cell.CELL_TYPE_BOOLEAN == cell.getCellType()) {
cellValue = cell.getBooleanCellValue() + "";
} else {
cellValue = cell.toString().trim();
}
listRows.add(cellValue);
}
listDatas.add(listRows);
}
fileIn.close();
return listDatas;
} catch (IOException e) {
e.printStackTrace();
JOptionPane.showMessageDialog(null, e.getMessage(), null, JOptionPane.ERROR_MESSAGE);
return null;
}
}
private static String getRightStr(String sNum) {
DecimalFormat decimalFormat = new DecimalFormat("#.000000");
String resultStr = decimalFormat.format(new Double(sNum));
if (resultStr.matches("^[-+]?\\d+\\.[0]+$")) {
resultStr = resultStr.substring(0, resultStr.indexOf("."));
}
return resultStr;
}
public static File saveExcelChooser(File file) {
File dir = null;
JFileChooser chooser = new JFileChooser();
chooser.setAcceptAllFileFilterUsed(false);
File currentDir = FileSystemView.getFileSystemView().getDefaultDirectory();
chooser.setCurrentDirectory(currentDir);
String saveType[] = { "xls", "xlsx" };
chooser.setFileFilter(new FileNameExtensionFilter("Microsoft Excel Worksheet(*.xls, *.xlsx)", saveType));
chooser.setSelectedFile(file);
int returnVal = chooser.showSaveDialog(new Frame());
if (returnVal == JFileChooser.APPROVE_OPTION) {
dir = chooser.getSelectedFile();
}
return dir;
}
public static File openFileChooser(String fileType) {
JFileChooser chooser = new JFileChooser();
FileFilter fileFilter = getFilter(fileType);
chooser.setAcceptAllFileFilterUsed(false);
chooser.addChoosableFileFilter(fileFilter);
chooser.setMultiSelectionEnabled(false);
chooser.setFileFilter(fileFilter);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
File desktopDir = FileSystemView.getFileSystemView().getHomeDirectory();
chooser.setSelectedFile(desktopDir);
File file = null;
int returnVal = chooser.showOpenDialog(new Frame());
if (returnVal == JFileChooser.APPROVE_OPTION) {
file = chooser.getSelectedFile();
if (file == null) {
JOptionPane.showMessageDialog(new Frame(), "file not exists");
return null;
}
}
return file;
}
private static FileFilter getFilter(String fileType) {
FileFilter fileFilter = null;
if (fileType.equals("csv")) {
fileFilter = new FileFilter() {
@Override
public boolean accept(File f) {
String fileName = f.getName();
if (f.isDirectory() || fileName.endsWith(".csv"))
return true;
return false;
}
@Override
public String getDescription() {
return "CSV(<28><><EFBFBD>ŷָ<C5B7>)<29><>*.csv<73><76>";
}
};
} else if (fileType.equals("excel")) {
fileFilter = new FileFilter() {
@Override
public boolean accept(File f) {
String fileName = f.getName();
if (f.isDirectory() || fileName.endsWith(".xls") || fileName.endsWith(".xlsx"))
return true;
return false;
}
@Override
public String getDescription() {
return "Microsoft Excel Worksheet(*.xls, *.xlsx)";
}
};
}
return fileFilter;
}
public static void copyRow(XSSFWorkbook wb,XSSFRow fromRow,XSSFRow toRow,boolean copyValueFlag){
for (Iterator<Cell> cellIt = fromRow.cellIterator(); cellIt.hasNext();) {
XSSFCell tmpCell = (XSSFCell) cellIt.next();
XSSFCell newCell = toRow.createCell(tmpCell.getColumnIndex());
copyCell(wb, tmpCell, newCell, copyValueFlag);
}
}
public static void copyCell(XSSFWorkbook wb,XSSFCell srcCell, XSSFCell distCell, boolean copyValueFlag) {
XSSFCellStyle newstyle=wb.createCellStyle();
copyCellStyle(srcCell.getCellStyle(), newstyle);
// distCell.setEncoding(srcCell.getEncoding());
//样式
distCell.setCellStyle(newstyle);
//评论
// if (srcCell.getCellComment() != null) {
// distCell.setCellComment(srcCell.getCellComment());
// }
// 不同数据类型处理
int srcCellType = srcCell.getCellType();
// if(srcCell.getColumnIndex()==8)
// System.out.println(srcCell.getColumnIndex()+"::"+srcCellType);
distCell.setCellType(srcCellType);
if (copyValueFlag) {
if (srcCellType == XSSFCell.CELL_TYPE_NUMERIC) {
if (HSSFDateUtil.isCellDateFormatted(srcCell)) {
distCell.setCellValue(srcCell.getDateCellValue());
} else {
distCell.setCellValue(srcCell.getNumericCellValue());
}
} else if (srcCellType == XSSFCell.CELL_TYPE_STRING) {
distCell.setCellValue(srcCell.getRichStringCellValue());
} else if (srcCellType == XSSFCell.CELL_TYPE_BLANK) {
// nothing21
} else if (srcCellType == XSSFCell.CELL_TYPE_BOOLEAN) {
distCell.setCellValue(srcCell.getBooleanCellValue());
} else if (srcCellType == XSSFCell.CELL_TYPE_ERROR) {
distCell.setCellErrorValue(srcCell.getErrorCellValue());
} else if (srcCellType == XSSFCell.CELL_TYPE_FORMULA) {
distCell.setCellFormula(srcCell.getCellFormula().replaceAll("2", distCell.getRowIndex()+1+""));
System.out.println(distCell.getRowIndex()+","+distCell.getColumnIndex()+":"+distCell.getCellFormula()+"<<"+srcCell.getCellFormula());
} else { // nothing29
}
}
}
public static void copyCellStyle(XSSFCellStyle fromStyle, XSSFCellStyle toStyle) {
toStyle.setAlignment(fromStyle.getAlignment());
//边框和边框颜色
toStyle.setBorderBottom(fromStyle.getBorderBottom());
toStyle.setBorderLeft(fromStyle.getBorderLeft());
toStyle.setBorderRight(fromStyle.getBorderRight());
toStyle.setBorderTop(fromStyle.getBorderTop());
toStyle.setTopBorderColor(fromStyle.getTopBorderColor());
toStyle.setBottomBorderColor(fromStyle.getBottomBorderColor());
toStyle.setRightBorderColor(fromStyle.getRightBorderColor());
toStyle.setLeftBorderColor(fromStyle.getLeftBorderColor());
//背景和前景
toStyle.setFillBackgroundColor(fromStyle.getFillBackgroundColor());
toStyle.setFillForegroundColor(fromStyle.getFillForegroundColor());
toStyle.setDataFormat(fromStyle.getDataFormat());
toStyle.setFillPattern(fromStyle.getFillPattern());
// toStyle.setFont(fromStyle.getFont(null));
toStyle.setHidden(fromStyle.getHidden());
toStyle.setIndention(fromStyle.getIndention());//首行缩进
toStyle.setLocked(fromStyle.getLocked());
toStyle.setRotation(fromStyle.getRotation());//旋转
toStyle.setVerticalAlignment(fromStyle.getVerticalAlignment());
toStyle.setWrapText(fromStyle.getWrapText());
}
public static void insertRow(Workbook wb, Sheet sheet, int starRow, int rows) {
sheet.shiftRows(starRow+1, sheet.getLastRowNum(), rows, true, false);
starRow = starRow - 1;
for (int i = 0; i < rows; i++) {
Row sourceRow = null;
Row targetRow = null;
Cell sourceCell = null;
Cell targetCell = null;
short m;
starRow = starRow + 1;
sourceRow = sheet.getRow(starRow);
targetRow = sheet.createRow(starRow + 1);
targetRow.setHeight(sourceRow.getHeight());
for (m = sourceRow.getFirstCellNum(); m < sourceRow.getLastCellNum(); m++) {
sourceCell = sourceRow.getCell(m);
targetCell = targetRow.createCell(m);
// targetCell.setEncoding(sourceCell.getEncoding());
targetCell.setCellStyle(sourceCell.getCellStyle());
targetCell.setCellType(sourceCell.getCellType());
}
}
}
public static File saveExcelChooser(String defaultFile, String s) {
File dir = null;
JFileChooser chooser = new JFileChooser();
chooser.setAcceptAllFileFilterUsed(false);
// File currentDir = FileSystemView.getFileSystemView().getDefaultDirectory();
File desktopDir = FileSystemView.getFileSystemView().getHomeDirectory();
chooser.setCurrentDirectory(desktopDir);
chooser.setSelectedFile(new File(defaultFile));
String saveType[] = { "xlsx" };
chooser.setFileFilter(new FileNameExtensionFilter(s, saveType));
int returnVal = chooser.showSaveDialog(new Frame());
if (returnVal == JFileChooser.APPROVE_OPTION) {
dir = chooser.getSelectedFile();
String path = dir.getPath();
if(!path.toLowerCase().endsWith(".xlsx")) {
path += ".xlsx";
dir = new File(path);
}
if(dir.exists())
dir.delete();
System.out.println("saveExcelChooser1:" + dir.getPath());
}
return dir;
}
}

@ -0,0 +1,231 @@
package com.connor.ac.util;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.WindowConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableModel;
import com.connor.AC_01.ACSysCatalogStyle;
import com.connor.ac.bean.SysCatalogRevisionMasterBean;
import com.teamcenter.rac.stylesheet.PropertyObjectLink;
import com.teamcenter.rac.util.MessageBox;
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONArray;
//import com.alibaba.fastjson.JSONObject;
//
//
//import java.io.*;
public class test {
static JTable table;
static String editValue = "";
public static void main(String[] args) throws Exception {
JFrame jf = new JFrame("测试窗口");
jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
// 创建内容面板
JPanel panel = new JPanel();
// 表头(列名)
String[] columnNames = {"序号", "姓名", "语文", "数学", "英语", "总分"};
// 表格所有行数据
Object[][] rowData = {
{1, "张三", 80, 80, 80, 240},
{2, "John", 70, 80, 90, 240},
{3, "Sue", 70, 70, 70, 210},
{4, "Jane", 80, 70, 60, 210},
{5, "Joe_05", 80, 70, 60, 210},
{6, "Joe_06", 80, 70, 60, 210},
{7, "Joe_07", 80, 70, 60, 210},
{8, "Joe_08", 80, 70, 60, 210},
{9, "Joe_09", 80, 70, 60, 210},
{10, "Joe_10", 80, 70, 60, 210},
{11, "Joe_11", 80, 70, 60, 210},
{12, "Joe_12", 80, 70, 60, 210},
{13, "Joe_13", 80, 70, 60, 210},
{14, "Joe_14", 80, 70, 60, 210},
{15, "Joe_15", 80, 70, 60, 210},
{16, "Joe_16", 80, 70, 60, 210},
{17, "Joe_17", 80, 70, 60, 210},
{18, "Joe_18", 80, 70, 60, 210},
{19, "Joe_19", 80, 70, 60, 210},
{20, "Joe_20", 80, 70, 60, 210}
};
// 创建一个表格,指定 表头 和 所有行数据
table = new JTable(rowData, columnNames);
// 设置表格内容颜色
table.setForeground(Color.BLACK); // 字体颜色
table.setFont(new Font(null, Font.PLAIN, 14)); // 字体样式
table.setSelectionForeground(Color.DARK_GRAY); // 选中后字体颜色
table.setSelectionBackground(Color.LIGHT_GRAY); // 选中后字体背景
table.setGridColor(Color.GRAY); // 网格颜色
// 设置表头
table.getTableHeader().setFont(new Font(null, Font.BOLD, 14)); // 设置表头名称字体样式
table.getTableHeader().setForeground(Color.RED); // 设置表头名称字体颜色
table.getTableHeader().setResizingAllowed(false); // 设置不允许手动改变列宽
table.getTableHeader().setReorderingAllowed(false); // 设置不允许拖动重新排序各列
// 设置行高
table.setRowHeight(30);
// 第一列列宽设置为40
table.getColumnModel().getColumn(0).setPreferredWidth(40);
// 设置滚动面板视口大小(超过该大小的行数据,需要拖动滚动条才能看到)
table.setPreferredScrollableViewportSize(new Dimension(400, 300));
// table. addFocusListener(new FocusListener() {
// public void focusLost(FocusEvent e) {
// //失去焦点的时候
// System.out.println("输入结束....");
//
// }
// public void focusGained(FocusEvent e) {
// // 获取焦点的时候
// System.out.println("正在输入中.....");
//
// }
// });
table.getModel().addTableModelListener(new TableModelListener(){
@Override
public void tableChanged(TableModelEvent e) {
//int row=e.getFirstRow();//改变的单元格所在的行索引起始值为0
System.out.println("1213");
}
});
// 把 表格 放到 滚动面板 中(表头将自动添加到滚动面板顶部)
JScrollPane scrollPane = new JScrollPane(table);
// 添加 滚动面板 到 内容面板
panel.add(scrollPane);
JButton a = new JButton("同步");
a.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
table.getCellEditor().stopCellEditing();
TableModel model = table.getModel();
// Map<String, String> id_cost = new HashMap<String, String>();
// try {
// for (int i = 0; i < model.getRowCount(); i++) {
// //System.out.println(model.getValueAt(i, 5).toString());
// Double.valueOf(model.getValueAt(i, 5).toString()==""?"0.00":model.getValueAt(i, 5).toString());
// id_cost.put(model.getValueAt(i, 1).toString(), model.getValueAt(i, 5).toString());
// }
//
// } catch (Exception e) {
// System.out.println("成本填写异常");
// }
// System.out.println(id_cost);
Object[] props = {
20, "Joe_20", 80, 70, 60, 210
};
}
});
panel.add(a);
// 设置 内容面板 到 窗口
jf.setContentPane(panel);
jf.pack();
jf.setLocationRelativeTo(null);
jf.setVisible(true);
}
// public static String readJsonFile(String fileName) {
// String jsonStr = "";
// try {
// File jsonFile = new File(fileName);
// FileReader fileReader = new FileReader(jsonFile);
// Reader reader = new InputStreamReader(new FileInputStream(jsonFile),"utf-8");
// int ch = 0;
// StringBuffer sb = new StringBuffer();
// while ((ch = reader.read()) != -1) {
// sb.append((char) ch);
// }
// fileReader.close();
// reader.close();
// jsonStr = sb.toString();
// return jsonStr;
// } catch (IOException e) {
// e.printStackTrace();
// return null;
// }
// }
// public static void readTxtFile(String filePath){
// try {
// String encoding="utf-8";
// File file=new File(filePath);
// if(file.isFile() && file.exists()){ //判断文件是否存在
// InputStreamReader read = new InputStreamReader(
// new FileInputStream(file),encoding);//考虑到编码格式
// BufferedReader bufferedReader = new BufferedReader(read);
// String lineTxt = null;
// String lineTxtRo = "";
// while((lineTxt = bufferedReader.readLine()) != null){
// //System.out.println(lineTxt);
// lineTxtRo+=lineTxt;
// }
// System.out.println(lineTxtRo);
// read.close();
// }else{
// System.out.println("找不到指定的文件");
// }
// } catch (Exception e) {
// System.out.println("读取文件内容出错");
// e.printStackTrace();
// }
//
// }
//
// public static void main(String[] args) {
// String path = "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\bb-2020-7-10-13-19-39.txt";
// readTxtFile(path);
//// String s = readJsonFile(path);
//// JSONObject jobj = JSON.parseObject(s);
//// JSONArray movies = jobj.getJSONArray("robotBodyList");//构建JSONArray数组
//// for (int i = 0 ; i < movies.size();i++){
//// JSONObject key = (JSONObject)movies.get(i);
//// String name = (String)key.get("projCode");
////
//// System.out.println(name);
////
//// }
// }
}

@ -0,0 +1 @@
YSR8_SysCatalogRevisionMaster.FORMJAVARENDERING=com.connor.AC_01.ACSysCatalogStyle
Loading…
Cancel
Save