diff --git a/com.connor.jd.plm/META-INF/MANIFEST.MF b/com.connor.jd.plm/META-INF/MANIFEST.MF index 6ab32fe..c3b4388 100644 --- a/com.connor.jd.plm/META-INF/MANIFEST.MF +++ b/com.connor.jd.plm/META-INF/MANIFEST.MF @@ -17,6 +17,7 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.108.0", Automatic-Module-Name: JDProject Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Export-Package: com.connor.jd.plm.action, + com.connor.jd.plm.db, com.connor.jd.plm.dialog, com.connor.jd.plm.form, com.connor.jd.plm.handlers, @@ -49,4 +50,5 @@ Bundle-ClassPath: ., lib/poi-ooxml-4.1.1.jar, lib/poi-ooxml-schemas-4.1.1.jar, lib/poi-scratchpad-4.1.1.jar, - lib/xmlbeans-3.1.0.jar + lib/xmlbeans-3.1.0.jar, + src/com/connor/jd/plm/db/ diff --git a/com.connor.jd.plm/build.properties b/com.connor.jd.plm/build.properties index 3aea07f..6847fdf 100644 --- a/com.connor.jd.plm/build.properties +++ b/com.connor.jd.plm/build.properties @@ -21,4 +21,5 @@ bin.includes = plugin.xml,\ lib/poi-ooxml-4.1.1.jar,\ lib/poi-ooxml-schemas-4.1.1.jar,\ lib/poi-scratchpad-4.1.1.jar,\ - lib/xmlbeans-3.1.0.jar + lib/xmlbeans-3.1.0.jar,\ + src/com/connor/jd/plm/db/ diff --git a/com.connor.jd.plm/src/com/connor/jd/plm/db/db.setting b/com.connor.jd.plm/src/com/connor/jd/plm/db/db.setting new file mode 100644 index 0000000..e682982 --- /dev/null +++ b/com.connor.jd.plm/src/com/connor/jd/plm/db/db.setting @@ -0,0 +1,15 @@ +## db.setting文件 + +url = jdbc:oracle:thin:@localhost:1521:TC +user = root +pass = 123456 + +## 可选配置 +# 是否在日志中显示执行的SQL +showSql = true +# 是否格式化显示的SQL +formatSql = false +# 是否显示SQL参数 +showParams = true +# 打印SQL的日志等级,默认debug,可以是info、warn、error +sqlLevel = debug \ No newline at end of file diff --git a/com.connor.jd.plm/src/com/connor/jd/plm/dialog/EditClassificationDialog.java b/com.connor.jd.plm/src/com/connor/jd/plm/dialog/EditClassificationDialog.java index aa85294..895b62e 100644 --- a/com.connor.jd.plm/src/com/connor/jd/plm/dialog/EditClassificationDialog.java +++ b/com.connor.jd.plm/src/com/connor/jd/plm/dialog/EditClassificationDialog.java @@ -68,6 +68,7 @@ public class EditClassificationDialog extends AbstractAIFDialog { this.setTitle("修改分类属性"); this.setAutoRequestFocus(true); this.setResizable(true); + this.setAlwaysOnTop(true); JPanel rootPanel = new JPanel(new BorderLayout()); rootPanel.setBorder(BorderFactory.createLineBorder(Color.black, 1)); diff --git a/com.connor.jd.plm/src/com/connor/jd/plm/form/ComponentTestFrame.java b/com.connor.jd.plm/src/com/connor/jd/plm/form/ComponentTestFrame.java new file mode 100644 index 0000000..49887e6 --- /dev/null +++ b/com.connor.jd.plm/src/com/connor/jd/plm/form/ComponentTestFrame.java @@ -0,0 +1,116 @@ +package com.connor.jd.plm.form; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; + +import javax.swing.BorderFactory; +import javax.swing.DefaultCellEditor; +import javax.swing.JCheckBox; +import javax.swing.JFrame; +import javax.swing.JTable; +import javax.swing.SwingConstants; +import javax.swing.table.DefaultTableCellRenderer; + +import com.connor.jd.plm.table.CTMap; +import com.connor.jd.plm.table.CTable; + +public class ComponentTestFrame extends JFrame { + private String[] arr; + private CTMap model; + private CTable table; + + private static ComponentTestFrame instance; + + public static ComponentTestFrame getInstance(String[] row) { + if (instance == null) { + instance = new ComponentTestFrame(row); + } else { + instance.arr = row; + instance.init(); + } + return instance; + } + + private ComponentTestFrame(String[] row) { + this.arr = row; + this.init(); + } + + private void init() { + this.setTitle("部件测试项目"); + this.setPreferredSize(new Dimension(700, 500)); + this.setResizable(true); + this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + + Container container = this.getContentPane(); + container.setLayout(new BorderLayout()); + + model = new CTMap(10, 7); + model.setValueAt("序号", 0, 0); + model.setValueAt("部品类型", 0, 1); + model.setValueAt("试验项目", 0, 2); + model.setValueAt("试验时间", 0, 3); + model.setValueAt("样品数量", 0, 4); + model.setValueAt("试验费用", 0, 5); + model.setValueAt("是否选择", 0, 6); + + table = new CTable(model) { + @Override + public boolean isCellEditable(int row, int col) { + if (row == 0 || col == 0) { + return false; + } + return true; + } + }; + table.setRowHeight(25); + table.setBorder(BorderFactory.createLineBorder(Color.black)); + for (int i = 0; i < model.getColumnCount(); i++) { + table.getColumnModel().getColumn(i).setPreferredWidth(100); + } + DefaultTableCellRenderer tcr1 = new DefaultTableCellRenderer() { + // 重写方法 + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, + boolean hasFocus, int row, int column) { + // TODO Auto-generated method stub + + if (value instanceof JCheckBox) { + return (JCheckBox) value; + } + + int maxPreferredHeight = 0; + for (int i = 0; i < table.getColumnCount(); i++) { + setText("" + table.getValueAt(row, i)); + setSize(table.getColumnModel().getColumn(column).getWidth(), 0); + maxPreferredHeight = Math.max(maxPreferredHeight, getPreferredSize().height); + } + setBackground(Color.white); +// if(points1.contains(new Point(row,column))) +// setForeground(new Color(0,0,255)); +// else + setForeground(Color.black); + if (isSelected) { + setBackground(new Color(0, 120, 215)); + setForeground(Color.white); + } + if (table.getRowHeight(row) != maxPreferredHeight) // 少了这行则处理器瞎忙 + table.setRowHeight(row, maxPreferredHeight); + + setText(value == null ? "" : value.toString()); + return this; + } + }; + tcr1.setHorizontalAlignment(SwingConstants.CENTER); + table.setDefaultRenderer(Object.class, tcr1); + table.getColumnModel().getColumn(6).setCellEditor(new DefaultCellEditor(new JCheckBox())); + + // 填写数据 + + this.setVisible(true); + } + +} diff --git a/com.connor.jd.plm/src/com/connor/jd/plm/form/ExperimentalPowerOfAttorneyForm.java b/com.connor.jd.plm/src/com/connor/jd/plm/form/ExperimentalPowerOfAttorneyForm.java new file mode 100644 index 0000000..3ad8321 --- /dev/null +++ b/com.connor.jd.plm/src/com/connor/jd/plm/form/ExperimentalPowerOfAttorneyForm.java @@ -0,0 +1,411 @@ +package com.connor.jd.plm.form; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.swing.BorderFactory; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.SwingConstants; +import javax.swing.table.DefaultTableCellRenderer; + +import com.connor.jd.plm.table.CTMap; +import com.connor.jd.plm.table.CTable; +import com.connor.jd.plm.table.JCheckPanel; +import com.connor.jd.plm.table.MyCellEditor3; +import com.connor.jd.plm.table.TCTableUtil; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.stylesheet.AbstractRendering; + +public class ExperimentalPowerOfAttorneyForm extends AbstractRendering { + private TCComponentForm form; + private CTMap model; + private CTable table; + private int top = 10; + private int end = 4; + private int bottom; + private Map prop; + private List disableEdit; + private Map general; + private JCheckPanel bgqf; + private JPopupMenu menu = new JPopupMenu(); + private JMenuItem addR; + private JMenuItem delR; + private JMenuItem test; + private String[] colNames = new String[] { "jd2_no", "jd2_name", "jd2_bgq", "jd2_bgh", "jd2_risk", "jd2_csjh", + "jd2_bz" }; + private String[][] rows; + + public ExperimentalPowerOfAttorneyForm(TCComponent arg0) throws Exception { + super(arg0); + if (arg0 instanceof TCComponentForm) { + this.form = (TCComponentForm) arg0; + loadRendering(); + } + } + + @Override + public void loadRendering() throws TCException { + this.setLayout(new BorderLayout()); + JPanel root = new JPanel(new BorderLayout()); + root.setPreferredSize(new Dimension(800, 600)); + + // 内容 + prop = form.getProperties(); + model = new CTMap(20, 11); + bottom = model.getRowCount() - end; + disableEdit = new ArrayList<>();// 不允许编辑 + general = new HashMap();// 要填写的一般属性 + model.setValueAt("吉德", 0, 0); + disableEdit.add("0,0"); + model.setValueAt("试验委托书", 0, 3); + disableEdit.add("0,3"); + model.setValueAt("表号", 0, 8); + disableEdit.add("0,8"); + model.setValueAt("生效期", 1, 8); + disableEdit.add("1,8"); + general.put("jd2_bh", new int[] { 0, 9 }); + general.put("jd2_sxq", new int[] { 1, 9 }); + model.setValueAt("委托项目:", 3, 0); + disableEdit.add("3,0"); + model.setValueAt("委托部门:", 4, 0); + disableEdit.add("4,0"); + general.put("jd2_wtxm", new int[] { 3, 3 }); + general.put("jd2_wtbm", new int[] { 4, 3 }); + model.setValueAt("供货厂家:", 3, 6); + disableEdit.add("3,6"); + model.setValueAt("接受部门:", 4, 6); + disableEdit.add("4,6"); + general.put("jd2_ghcj", new int[] { 3, 8 }); + general.put("jd2_jsbm", new int[] { 4, 8 }); + model.setValueAt("变更区分:", 5, 0); + bgqf = new JCheckPanel(new String[] { "复制模", "降本", "二元化", "改善优化", "新规部品" }); + model.setValueAt(bgqf, 5, 2); + model.setValueAt("部品型号:", 7, 0); + disableEdit.add("7,0"); + general.put("jd2_bpxh", new int[] { 7, 2 }); + model.setValueAt("适用型号:", 7, 6); + disableEdit.add("7,6"); + general.put("jd2_syxh", new int[] { 7, 7 }); + model.setValueAt("变更内容", 8, 0); + disableEdit.add("8,0"); + + model.setValueAt("NO", top, 0); + disableEdit.add(top + ",0"); + model.setValueAt("名称", top, 1); + disableEdit.add(top + ",1"); + model.setValueAt("变更前", top, 2); + disableEdit.add(top + ",2"); + model.setValueAt("变更后", top, 5); + disableEdit.add(top + ",5"); + model.setValueAt("Risk", top, 8); + disableEdit.add(top + ",8"); + model.setValueAt("测试计划", top, 9); + disableEdit.add(top + ",9"); + model.setValueAt("备注", top, 10); + disableEdit.add(top + ",10"); + + model.setValueAt("预计完成日期:", bottom, 0); + disableEdit.add(bottom + ",0"); + general.put("jd2_yjwcrq", new int[] { bottom, 2 }); + model.setValueAt("编制签名:", bottom + 1, 0); + disableEdit.add(bottom + 1 + ",0"); + model.setValueAt("批准签名:", bottom + 2, 0); + disableEdit.add(bottom + 3 + ",0"); + general.put("jd2_bz", new int[] { bottom + 2, 2 }); + general.put("jd2_pz", new int[] { bottom + 3, 2 }); + model.setValueAt("编制时间:", bottom + 2, 5); + disableEdit.add(bottom + 2 + ",5"); + model.setValueAt("批准时间:", bottom + 3, 5); + disableEdit.add(bottom + 3 + ",5"); + general.put("jd2_bzrq", new int[] { bottom + 2, 8 }); + general.put("jd2_pzrq", new int[] { bottom + 3, 8 }); + + model.combine(new int[] { 0, 1, 2 }, new int[] { 0, 1, 2 }); + model.combine(new int[] { 0, 1, 2 }, new int[] { 3, 4, 5, 6, 7 }); + model.combine(new int[] { 0 }, new int[] { 9, 10 }); + model.combine(new int[] { 1 }, new int[] { 9, 10 }); + model.combine(new int[] { 2 }, new int[] { 8, 9, 10 }); + model.combine(new int[] { 3 }, new int[] { 0, 1, 2 }); + model.combine(new int[] { 3 }, new int[] { 3, 4, 5 }); + model.combine(new int[] { 3 }, new int[] { 6, 7 }); + model.combine(new int[] { 3 }, new int[] { 8, 9, 10 }); + model.combine(new int[] { 4 }, new int[] { 0, 1, 2 }); + model.combine(new int[] { 4 }, new int[] { 3, 4, 5 }); + model.combine(new int[] { 4 }, new int[] { 6, 7 }); + model.combine(new int[] { 4 }, new int[] { 8, 9, 10 }); + model.combine(new int[] { 5 }, new int[] { 0, 1 }); + model.combine(new int[] { 5 }, new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 }); + model.combine(new int[] { 6 }, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); + model.combine(new int[] { 7 }, new int[] { 0, 1 }); + model.combine(new int[] { 7 }, new int[] { 2, 3, 4, 5 }); + model.combine(new int[] { 7 }, new int[] { 7, 8, 9, 10 }); + model.combine(new int[] { 8, 9 }, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); + model.combine(new int[] { top }, new int[] { 2, 3, 4 }); + model.combine(new int[] { top }, new int[] { 5, 6, 7 }); + for (int i = top + 1; i <= bottom; i++) { + model.combine(new int[] { i }, new int[] { 2, 3, 4 }); + model.combine(new int[] { i }, new int[] { 5, 6, 7 }); + model.setValueAt(i - top, i, 0); + disableEdit.add(i + ",0"); + } + model.combine(new int[] { bottom + 1 }, new int[] { 0, 1 }); + model.combine(new int[] { bottom + 1 }, new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 }); + model.combine(new int[] { bottom + 2 }, new int[] { 0, 1 }); + model.combine(new int[] { bottom + 2 }, new int[] { 2, 3, 4 }); + model.combine(new int[] { bottom + 2 }, new int[] { 5, 6, 7 }); + model.combine(new int[] { bottom + 2 }, new int[] { 8, 9, 10 }); + model.combine(new int[] { bottom + 3 }, new int[] { 0, 1 }); + model.combine(new int[] { bottom + 3 }, new int[] { 2, 3, 4 }); + model.combine(new int[] { bottom + 3 }, new int[] { 5, 6, 7 }); + model.combine(new int[] { bottom + 3 }, new int[] { 8, 9, 10 }); + + table = new CTable(model) { + @Override + public boolean isCellEditable(int row, int col) { + if (isEditorDisable(disableEdit, row, col)) { + return false; + } + return true; + } + }; + + table.setRowHeight(25); + table.setBorder(BorderFactory.createLineBorder(Color.black)); + table.getColumnModel().getColumn(0).setPreferredWidth(40); + table.getColumnModel().getColumn(1).setPreferredWidth(100); + table.getColumnModel().getColumn(2).setPreferredWidth(80); + table.getColumnModel().getColumn(3).setPreferredWidth(80); + table.getColumnModel().getColumn(4).setPreferredWidth(80); + table.getColumnModel().getColumn(5).setPreferredWidth(80); + table.getColumnModel().getColumn(6).setPreferredWidth(80); + table.getColumnModel().getColumn(7).setPreferredWidth(80); + table.getColumnModel().getColumn(8).setPreferredWidth(80); + table.getColumnModel().getColumn(9).setPreferredWidth(150); + table.getColumnModel().getColumn(10).setPreferredWidth(60); + + DefaultTableCellRenderer tcr1 = new DefaultTableCellRenderer() { + // 重写方法 + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, + boolean hasFocus, int row, int column) { + // TODO Auto-generated method stub + + if (value instanceof JPanel) { + return (JPanel) value; + } + + int maxPreferredHeight = 0; + for (int i = 0; i < table.getColumnCount(); i++) { + setText("" + table.getValueAt(row, i)); + setSize(table.getColumnModel().getColumn(column).getWidth(), 0); + maxPreferredHeight = Math.max(maxPreferredHeight, getPreferredSize().height); + } + setBackground(Color.white); +// if(points1.contains(new Point(row,column))) +// setForeground(new Color(0,0,255)); +// else + setForeground(Color.black); + if (isSelected) { + setBackground(new Color(0, 120, 215)); + setForeground(Color.white); + } + if (table.getRowHeight(row) != maxPreferredHeight) // 少了这行则处理器瞎忙 + table.setRowHeight(row, maxPreferredHeight); + + setText(value == null ? "" : value.toString()); + return this; + } + }; + tcr1.setHorizontalAlignment(SwingConstants.CENTER); + table.setDefaultRenderer(Object.class, tcr1); + table.getColumnModel().getColumn(2).setCellEditor(new MyCellEditor3(new JTextField())); + table.addMouseListener(rightClick()); + + // 右键菜单 + menu.setVisible(false); + addR = new JMenuItem("新增行"); + addR.setEnabled(false); + menu.add(addR); + addR.addActionListener(addRow()); + delR = new JMenuItem("删除行"); + delR.setEnabled(false); + menu.add(delR); + delR.addActionListener(delRow()); + test = new JMenuItem("测试项"); + test.setEnabled(false); + menu.add(test); + test.addActionListener(test()); + + // 填写数据 + for (Entry entry : general.entrySet()) { + if (prop.containsKey(entry.getKey())) { + model.setValueAt(prop.get(entry.getKey()), entry.getValue()[0], entry.getValue()[1]); + } else { + System.out.println("未找到属性 " + entry.getKey()); + } + } + if (prop.containsKey("jd2_bgqf")) { + bgqf.setSelected(prop.get("jd2_bgqf")); + } else { + System.out.println("未找到属性 jd2_bgqf"); + } + rows = TCTableUtil.getTableRows(form, "jd2_sywts", colNames); + for (int i = 0; i < rows.length; i++) { + if (top + i + 1 > bottom) { + this.addRow(); + } + model.setValueAt(rows[i], top + i + 1, i > 2 ? i > 3 ? i + 4 : i + 2 : i); + } + + root.add(table, BorderLayout.CENTER); + this.add(menu); + this.add(root); + } + + @Override + public void saveRendering() { + // TODO Auto-generated method stub + for (Entry entry : general.entrySet()) { + if (prop.containsKey(entry.getKey())) { + String value = model.getValueAt(entry.getValue()[0], entry.getValue()[1]).toString(); + try { + if (form.getTCProperty(entry.getKey()).getLOV() != null && !"".equals(value)) { + value = (String) form.getTCProperty(entry.getKey()).getLOV().getListOfValues() + .getRealValue(value); + } + System.out.println(entry.getKey() + ":" + value); + form.setProperty(entry.getKey(), value); + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } + if (prop.containsKey("jd2_bgqf")) { + String value = bgqf.getSelectedText() == null ? "" : bgqf.getSelectedText(); + try { + if (form.getTCProperty("jd2_bgqf").getLOV() != null && !"".equals(value)) { + value = (String) form.getTCProperty("jd2_bgqf").getLOV().getListOfValues().getRealValue(value); + } + System.out.println("jd2_bgqf:" + value); + form.setProperty("jd2_bgqf", value); + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + if (prop.containsKey("jd2_sywts")) { + List data = new ArrayList(); + int num = 0; + while (model.getValueAt(top + 2 + num, 1) != null && !"".equals(model.getValueAt(top + 2 + num, 1))) { + String[] row = new String[7]; + for (int ii = 0; ii < row.length; ii++) { + Object object = model.getValueAt(top + 1 + num, ii > 2 ? ii > 3 ? ii + 4 : ii + 2 : ii); + if (object == null) { + row[ii] = ""; + } else { + row[ii] = object.toString(); + } + } + data.add(row); + num++; + if (top + 1 + num > bottom) { + break; + } + } + String[][] dataArr = data.toArray(new String[data.size()][]); + System.out.println(Arrays.deepToString(dataArr)); + TCTableUtil.setTableRows(form, "jd2_sywts", "JD2_SYWTS", colNames, dataArr); + } + } + + private boolean isEditorDisable(List list, int row, int col) { + return list.contains(row + "," + col); + } + + private MouseAdapter rightClick() { + return new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + if (e.getButton() == MouseEvent.BUTTON3 && form.isCheckedOut() && table.getSelectedRow() != -1) { + int row = table.getSelectedRow(); + boolean flag = (row >= top && row <= bottom); + addR.setEnabled(flag); + delR.setEnabled(flag); + test.setEnabled(flag); + menu.show(e.getComponent(), e.getX(), e.getY()); + } + } + }; + } + + private ActionListener addRow() { + return new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + int num = Integer.parseInt(model.getValueAt(bottom, 0).toString()); + model.insertRow(++bottom); + model.setValueAt(num + 1, bottom, 0); + model.combine(new int[] { bottom }, new int[] { 2, 3, 4 }); + model.combine(new int[] { bottom }, new int[] { 5, 6, 7 }); + } + }; + } + + private ActionListener delRow() { + return new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + int row = table.getSelectedRow(); + int num = Integer.parseInt(model.getValueAt(bottom, 0).toString()); + model.removeRow(row); + bottom--; + if (row <= bottom) { + for (int i = row; i <= bottom; i++) { + model.setValueAt(num + i - row, i, 0); + } + } + } + }; + + } + + private ActionListener test() { + return new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + int row = table.getSelectedRow(); + ComponentTestFrame.getInstance(rows[row - top - 1]); + } + }; + + } + +} diff --git a/com.connor.jd.plm/src/com/connor/jd/plm/form/SampleConfirmationForm.java b/com.connor.jd.plm/src/com/connor/jd/plm/form/SampleConfirmationForm.java index bbe15bc..5edb55b 100644 --- a/com.connor.jd.plm/src/com/connor/jd/plm/form/SampleConfirmationForm.java +++ b/com.connor.jd.plm/src/com/connor/jd/plm/form/SampleConfirmationForm.java @@ -77,7 +77,6 @@ public class SampleConfirmationForm extends AbstractRendering { private Map general; private List disableEdit; private Map pic; - private Map general2; private List disableEdit2; private JRadioPanel yssl; private JCheckPanel mqjd; @@ -482,6 +481,8 @@ public class SampleConfirmationForm extends AbstractRendering { } for (Entry entry : pic.entrySet()) { + int row = entry.getValue()[0]; + int col = entry.getValue()[1]; if (prop.containsKey(entry.getKey())) { TCComponent comp = null; try { @@ -497,8 +498,7 @@ public class SampleConfirmationForm extends AbstractRendering { System.out.println(img.getPath()); ImageIcon icon = new ImageIcon(img.getPath()); - int row = entry.getValue()[0]; - int col = entry.getValue()[1]; + int[] arr = model.getSpan(row, col); int width = 0; for (int i = 0; i < arr[1]; i++) { @@ -515,16 +515,16 @@ public class SampleConfirmationForm extends AbstractRendering { label.setToolTipText(dataset.getUid()); model.setValueAt(label, row, col); } else { - model.setValueAt(new JLabel(""), entry.getValue()[0], entry.getValue()[1]); + model.setValueAt(new JLabel(""), row, col); System.out.println("未找到uid为\"" + prop.get(entry.getKey()) + "\"的数据集"); } } catch (Exception e) { - model.setValueAt(new JLabel(""), entry.getValue()[0], entry.getValue()[1]); + model.setValueAt(new JLabel(""), row, col); e.printStackTrace(System.out); } } else { - model.setValueAt(new JLabel(""), entry.getValue()[0], entry.getValue()[1]); + model.setValueAt(new JLabel(""), row, col); System.out.println("属性‘" + entry.getKey() + "’未找到"); } } @@ -740,13 +740,7 @@ public class SampleConfirmationForm extends AbstractRendering { root.add(buttons, BorderLayout.NORTH); root.add(center, BorderLayout.CENTER); this.add(menu); - this.add(root, BorderLayout.CENTER); - - center.add("confirm", confirmScrollPanel); - center.add("examine", examineScrollPanel); - root.add(buttons, BorderLayout.NORTH); - root.add(center, BorderLayout.CENTER); - this.add(menu); + this.add(menu2); this.add(root, BorderLayout.CENTER); cl.show(center, "confirm"); @@ -758,6 +752,7 @@ public class SampleConfirmationForm extends AbstractRendering { JLabel label = null; for (Entry entry : pic.entrySet()) { if (prop.containsKey(entry.getKey())) { + System.out.println(entry.getKey()); label = (JLabel) model.getValueAt(entry.getValue()[0], entry.getValue()[1]); try { form.setProperty(entry.getKey(), label.getToolTipText()); @@ -798,6 +793,7 @@ public class SampleConfirmationForm extends AbstractRendering { value = (String) form.getTCProperty(entry.getKey()).getLOV().getListOfValues() .getRealValue(value); } + System.out.println(entry.getKey() + ":" + value); form.setProperty(entry.getKey(), value); } } catch (TCException e) { diff --git a/com.connor.jd.plm/src/com/connor/jd/plm/table/MyCellEditor.java b/com.connor.jd.plm/src/com/connor/jd/plm/table/MyCellEditor.java index 562f68d..32d4037 100644 --- a/com.connor.jd.plm/src/com/connor/jd/plm/table/MyCellEditor.java +++ b/com.connor.jd.plm/src/com/connor/jd/plm/table/MyCellEditor.java @@ -87,7 +87,19 @@ public class MyCellEditor extends DefaultCellEditor { double min = Double.MAX_VALUE; double max = Double.MIN_VALUE; Object obj; - for (int i = 7; i < table.getColumnCount() - 3; i++) { + for (int i = 7; i < col; i++) { + obj = table.getValueAt(row, i); + if (obj != null && !"".equals(obj.toString().trim())) { + min = Math.min(min, Double.parseDouble(obj.toString().trim())); + max = Math.max(max, Double.parseDouble(obj.toString().trim())); + } + } + obj = getCellEditorValue(); + if (obj != null && !"".equals(obj.toString().trim())) { + min = Math.min(min, Double.parseDouble(obj.toString().trim())); + max = Math.max(max, Double.parseDouble(obj.toString().trim())); + } + for (int i = col + 1; i < table.getColumnCount() - 3; i++) { obj = table.getValueAt(row, i); if (obj != null && !"".equals(obj.toString().trim())) { min = Math.min(min, Double.parseDouble(obj.toString().trim())); diff --git a/com.connor.jd.plm/src/com/connor/jd/plm/table/MyCellEditor3.java b/com.connor.jd.plm/src/com/connor/jd/plm/table/MyCellEditor3.java new file mode 100644 index 0000000..f5b2295 --- /dev/null +++ b/com.connor.jd.plm/src/com/connor/jd/plm/table/MyCellEditor3.java @@ -0,0 +1,39 @@ +package com.connor.jd.plm.table; + +import java.awt.Component; + +import javax.swing.DefaultCellEditor; +import javax.swing.JTable; +import javax.swing.JTextField; + +public class MyCellEditor3 extends DefaultCellEditor { + private JCheckPanel check = null; + private int type = -1; + + public MyCellEditor3(JTextField arg0) { + super(arg0); + // TODO Auto-generated constructor stub + } + + @Override + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + // TODO Auto-generated method stub + if (value instanceof JCheckPanel) { + check = (JCheckPanel) value; + type = 1; + return check; + } + type = 0; + return super.getTableCellEditorComponent(table, value, isSelected, row, column); + } + + @Override + public Object getCellEditorValue() { + // TODO Auto-generated method stub + if (type == 1) { + return check; + } + return super.getCellEditorValue(); + } + +} diff --git a/com.connor.jd.plm/src/com/connor/jd/plm/table/MyCellEditor4.java b/com.connor.jd.plm/src/com/connor/jd/plm/table/MyCellEditor4.java new file mode 100644 index 0000000..26ddcd7 --- /dev/null +++ b/com.connor.jd.plm/src/com/connor/jd/plm/table/MyCellEditor4.java @@ -0,0 +1,5 @@ +package com.connor.jd.plm.table; + +public class MyCellEditor4 { + +} diff --git a/com.connor.jd.plm/src/com/teamcenter/rac/stylesheet/stylesheet_user.properties b/com.connor.jd.plm/src/com/teamcenter/rac/stylesheet/stylesheet_user.properties index 6fb45b8..a159986 100644 --- a/com.connor.jd.plm/src/com/teamcenter/rac/stylesheet/stylesheet_user.properties +++ b/com.connor.jd.plm/src/com/teamcenter/rac/stylesheet/stylesheet_user.properties @@ -1 +1,2 @@ -JD2_GTYPQRDRevisionMaster.FORMJAVARENDERING=com.connor.jd.plm.form.SampleConfirmationForm \ No newline at end of file +JD2_GTYPQRDRevisionMaster.FORMJAVARENDERING=com.connor.jd.plm.form.SampleConfirmationForm +JD2_GTSYWTSRevisionMaster.FORMJAVARENDERING=com.connor.jd.plm.form.ExperimentalPowerOfAttorneyForm \ No newline at end of file