zouxk 5 years ago
parent 2156c4f8ff
commit 1260a85868

@ -19,8 +19,6 @@ import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.kernel.ics.ICSProperty; import com.teamcenter.rac.kernel.ics.ICSProperty;
import com.teamcenter.rac.util.MessageBox; import com.teamcenter.rac.util.MessageBox;
import cn.hutool.http.HttpUtil;
public class WLTZReviseAction extends AbstractAIFAction { public class WLTZReviseAction extends AbstractAIFAction {
private AbstractAIFApplication app; private AbstractAIFApplication app;
private TCSession session; private TCSession session;
@ -51,7 +49,9 @@ public class WLTZReviseAction extends AbstractAIFAction {
return; return;
} }
TCComponentItem item = rev.getItem(); TCComponentItem item = rev.getItem();
session.getUserService().call("bs_bypass", new Object[] { true });
TCComponentItemRevision newRev = rev.saveAs(item.getNewRev()); TCComponentItemRevision newRev = rev.saveAs(item.getNewRev());
session.getUserService().call("bs_bypass", new Object[] { false });
TCComponentICO ico = rev.getClassificationObjects()[0]; TCComponentICO ico = rev.getClassificationObjects()[0];
ICSProperty[] oldICSProps = ico.getICSProperties(true); ICSProperty[] oldICSProps = ico.getICSProperties(true);
int[] ids = new int[oldICSProps.length]; int[] ids = new int[oldICSProps.length];
@ -88,7 +88,7 @@ public class WLTZReviseAction extends AbstractAIFAction {
@Override @Override
public void run() { public void run() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
HttpUtil.post(URL, PARAMMAP); cn.hutool.http.HttpUtil.post(URL, PARAMMAP);
System.out.println("success"); System.out.println("success");
} }
}).start(); }).start();

@ -0,0 +1,39 @@
package com.connor.jd.plm.dialog;
public class DocumentTemplate {
private String type;// 模板类型
private String[] relation;// 数据集关系
private String uid;// 模板uid
public DocumentTemplate(String type, String uid, String[] relation) {
super();
this.type = type;
this.relation = relation;
this.uid = uid;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String[] getRelation() {
return relation;
}
public void setRelation(String[] relation) {
this.relation = relation;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
}

@ -52,6 +52,9 @@ public class EditClassificationDialog extends AbstractAIFDialog {
this.session = (TCSession) app.getSession(); this.session = (TCSession) app.getSession();
this.myService = session.getClassificationService(); this.myService = session.getClassificationService();
this.target = (TCComponent) AIFUtility.getCurrentApplication().getTargetComponent(); this.target = (TCComponent) AIFUtility.getCurrentApplication().getTargetComponent();
System.out.println(target.getType());
System.out.println(target instanceof TCComponentItemRevision ? "是" : "否");
if (target instanceof TCComponentItemRevision) { if (target instanceof TCComponentItemRevision) {
try { try {
initUI(); initUI();

@ -23,6 +23,7 @@ import java.util.Map.Entry;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFileChooser; import javax.swing.JFileChooser;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JMenuItem; import javax.swing.JMenuItem;
@ -31,6 +32,7 @@ import javax.swing.JPopupMenu;
import javax.swing.JTable; import javax.swing.JTable;
import javax.swing.JTextField; import javax.swing.JTextField;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;
import javax.swing.filechooser.FileFilter; import javax.swing.filechooser.FileFilter;
import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableCellRenderer;
@ -86,6 +88,10 @@ public class SampleConfirmationForm extends AbstractRendering {
private List<String> disableEdit2; private List<String> disableEdit2;
private JRadioPanel yssl; private JRadioPanel yssl;
private JCheckPanel mqjd; private JCheckPanel mqjd;
private JComboBox<String> bpdj;
private JComboBox<String> fl;
private JComboBox<String> zt;
private JComboBox<String> jued;
private String[] colNames = { "jd2_no", "jd2_gg", "jd2_gg1", "jd2_gc", "jd2_gc1", "jd2_1", "jd2_2", "jd2_3", private String[] colNames = { "jd2_no", "jd2_gg", "jd2_gg1", "jd2_gc", "jd2_gc1", "jd2_1", "jd2_2", "jd2_3",
"jd2_4", "jd2_5", "jd2_6", "jd2_7", "jd2_8", "jd2_9", "jd2_10", "jd2_min", "jd2_max", "jd2_jg" }; "jd2_4", "jd2_5", "jd2_6", "jd2_7", "jd2_8", "jd2_9", "jd2_10", "jd2_min", "jd2_max", "jd2_jg" };
private String[] colNames1 = { "jd2_ctq1", "jd2_ctq2", "jd2_ctq3", "jd2_ctq4", "jd2_ctq5", "jd2_ctq6", "jd2_ctq7", private String[] colNames1 = { "jd2_ctq1", "jd2_ctq2", "jd2_ctq3", "jd2_ctq4", "jd2_ctq5", "jd2_ctq6", "jd2_ctq7",
@ -94,6 +100,7 @@ public class SampleConfirmationForm extends AbstractRendering {
"jd2_ctq7", "jd2_ctq8" }; "jd2_ctq7", "jd2_ctq8" };
private String[] colNames3 = { "jd2_ctq1", "jd2_ctq2", "jd2_ctq3", "jd2_ctq4", "jd2_ctq5", "jd2_ctq6", "jd2_ctq7", private String[] colNames3 = { "jd2_ctq1", "jd2_ctq2", "jd2_ctq3", "jd2_ctq4", "jd2_ctq5", "jd2_ctq6", "jd2_ctq7",
"jd2_ctq8" }; "jd2_ctq8" };
private Map<String, String> jgItems = new HashMap<String, String>();
private JMenuItem addP; private JMenuItem addP;
private JMenuItem delP; private JMenuItem delP;
private JMenuItem addR; private JMenuItem addR;
@ -102,6 +109,7 @@ public class SampleConfirmationForm extends AbstractRendering {
private JMenuItem addR2; private JMenuItem addR2;
private JMenuItem insertR2; private JMenuItem insertR2;
private JMenuItem delR2; private JMenuItem delR2;
private TCComponentItemRevision rev;
public SampleConfirmationForm(TCComponent arg0) throws Exception { public SampleConfirmationForm(TCComponent arg0) throws Exception {
super(arg0); super(arg0);
@ -115,9 +123,17 @@ public class SampleConfirmationForm extends AbstractRendering {
@Override @Override
public void loadRendering() throws TCException { public void loadRendering() throws TCException {
jgItems.put("ºÏ¸ñ", "0");
jgItems.put("¾Ü¾ø", "1");
jgItems.put("±£Áô", "2");
jgItems.put("¸ü¸Äͼֽ", "3");
AIFComponentContext[] ref = form.whereReferenced();
rev = (TCComponentItemRevision) ref[0].getComponent();
setLayout(new BorderLayout()); setLayout(new BorderLayout());
JPanel root = new JPanel(new BorderLayout()); JPanel root = new JPanel(new BorderLayout());
root.setPreferredSize(new Dimension(800, 600)); root.setPreferredSize(new Dimension(800, 600));
root.setBorder(new EmptyBorder(0, 0, 0, 25));
// 头部 // 头部
JPanel buttons = new JPanel(new FlowLayout(FlowLayout.LEFT)); JPanel buttons = new JPanel(new FlowLayout(FlowLayout.LEFT));
JButton confirm = new JButton("样品确认单"); JButton confirm = new JButton("样品确认单");
@ -173,6 +189,9 @@ public class SampleConfirmationForm extends AbstractRendering {
if (value instanceof JPanel) { if (value instanceof JPanel) {
return (JPanel) value; return (JPanel) value;
} }
if (value instanceof JComboBox) {
return (JComboBox<String>) value;
}
int maxPreferredHeight = 0; int maxPreferredHeight = 0;
for (int i = 0; i < table.getColumnCount(); i++) { for (int i = 0; i < table.getColumnCount(); i++) {
@ -237,6 +256,9 @@ public class SampleConfirmationForm extends AbstractRendering {
if (value instanceof JLabel) { if (value instanceof JLabel) {
return (JLabel) value; return (JLabel) value;
} }
if (value instanceof JComboBox) {
return (JComboBox<String>) value;
}
int maxPreferredHeight = 0; int maxPreferredHeight = 0;
for (int i = 0; i < table.getColumnCount(); i++) { for (int i = 0; i < table.getColumnCount(); i++) {
@ -348,6 +370,7 @@ public class SampleConfirmationForm extends AbstractRendering {
if (prop.containsKey("jd2_ypqrdtable")) { if (prop.containsKey("jd2_ypqrdtable")) {
String[][] tableRows = TCTableUtil.getTableRows(form, "jd2_ypqrdtable", colNames); String[][] tableRows = TCTableUtil.getTableRows(form, "jd2_ypqrdtable", colNames);
System.out.println(Arrays.deepToString(tableRows)); System.out.println(Arrays.deepToString(tableRows));
for (int i = 0; i < tableRows.length; i++) { for (int i = 0; i < tableRows.length; i++) {
for (int ii = 0; ii < tableRows[0].length; ii++) { for (int ii = 0; ii < tableRows[0].length; ii++) {
if (i + top + 2 > bottom) { if (i + top + 2 > bottom) {
@ -357,7 +380,16 @@ public class SampleConfirmationForm extends AbstractRendering {
model.combine(new int[] { bottom }, new int[] { 2, 3, 4 }); model.combine(new int[] { bottom }, new int[] { 2, 3, 4 });
bottom = model.getRowCount() - end; bottom = model.getRowCount() - end;
} }
model.setValueAt(tableRows[i][ii], i + top + 2, ii > 2 ? ii + 2 : ii); if (ii == tableRows[0].length - 1) {
JComboBox<String> jgComBox = new JComboBox<String>();
for (Entry<String, String> entry : jgItems.entrySet()) {
jgComBox.addItem(entry.getKey());
}
jgComBox.setSelectedItem(tableRows[i][ii]);
model.setValueAt(jgComBox, i + top + 2, ii + 2);
} else {
model.setValueAt(tableRows[i][ii], i + top + 2, ii > 2 ? ii + 2 : ii);
}
} }
} }
} else { } else {
@ -618,7 +650,18 @@ public class SampleConfirmationForm extends AbstractRendering {
general.put("jd2_xh", new int[] { 6, 10 }); general.put("jd2_xh", new int[] { 6, 10 });
model.setValueAt("分类", 6, 14); model.setValueAt("分类", 6, 14);
disableEdit.add("6,14"); disableEdit.add("6,14");
general.put("jd2_fl", new int[] { 6, 17 }); fl = new JComboBox<String>();
try {
String[] items = form.getTCProperty("jd2_fl").getLOV().getListOfValues().getLOVDisplayValues();
for (String s : items) {
fl.addItem(s);
}
fl.setSelectedItem(form.getProperty("jd2_fl"));
model.setValueAt(fl, 6, 17);
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
model.setValueAt("物料编码", 7, 0); model.setValueAt("物料编码", 7, 0);
disableEdit.add("7,0"); disableEdit.add("7,0");
general.put("jd2_wlbm", new int[] { 7, 2 }); general.put("jd2_wlbm", new int[] { 7, 2 });
@ -628,10 +671,32 @@ public class SampleConfirmationForm extends AbstractRendering {
model.setValueAt(yssl, 7, 10); model.setValueAt(yssl, 7, 10);
model.setValueAt("状态", 7, 14); model.setValueAt("状态", 7, 14);
disableEdit.add("7,14"); disableEdit.add("7,14");
general.put("jd2_zt", new int[] { 7, 17 }); zt = new JComboBox<String>();
try {
String[] items = form.getTCProperty("jd2_zt").getLOV().getListOfValues().getLOVDisplayValues();
for (String s : items) {
zt.addItem(s);
}
zt.setSelectedItem(form.getProperty("jd2_zt"));
model.setValueAt(zt, 7, 17);
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
model.setValueAt("部品等级", 8, 0); model.setValueAt("部品等级", 8, 0);
disableEdit.add("8,0"); disableEdit.add("8,0");
general.put("jd2_bpdj", new int[] { 8, 2 }); bpdj = new JComboBox<String>();
try {
String[] items = form.getTCProperty("jd2_bpdj").getLOV().getListOfValues().getLOVDisplayValues();
for (String s : items) {
bpdj.addItem(s);
}
bpdj.setSelectedItem(form.getProperty("jd2_bpdj"));
model.setValueAt(bpdj, 8, 2);
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
model.setValueAt("参考物料", 8, 8); model.setValueAt("参考物料", 8, 8);
disableEdit.add("8,8"); disableEdit.add("8,8");
model.setValueAt("jd2_ckwl", 8, 10); model.setValueAt("jd2_ckwl", 8, 10);
@ -678,6 +743,11 @@ public class SampleConfirmationForm extends AbstractRendering {
model.setValueAt(i - 1 - top, i, 0); model.setValueAt(i - 1 - top, i, 0);
disableEdit.add(i + ",0"); disableEdit.add(i + ",0");
model.combine(new int[] { i }, new int[] { 2, 3, 4 }); model.combine(new int[] { i }, new int[] { 2, 3, 4 });
JComboBox<String> jgComBox = new JComboBox<String>();
for (Entry<String, String> entry : jgItems.entrySet()) {
jgComBox.addItem(entry.getKey());
}
model.setValueAt(jgComBox, i, model.getColumnCount() - 1);
} }
model.combine(new int[] { 0, 1 }, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }); model.combine(new int[] { 0, 1 }, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 });
@ -800,7 +870,18 @@ public class SampleConfirmationForm extends AbstractRendering {
pic.put("jd2_icqjyzds", new int[] { 10, 4 }); pic.put("jd2_icqjyzds", new int[] { 10, 4 });
model3.setValueAt("决定", 11, 12); model3.setValueAt("决定", 11, 12);
disableEdit3.add(11 + ",12"); disableEdit3.add(11 + ",12");
general3.put("jd2_jued", new int[] { 11, 15 }); jued = new JComboBox<String>();
try {
String[] items = form.getTCProperty("jd2_jued").getLOV().getListOfValues().getLOVDisplayValues();
for (String s : items) {
jued.addItem(s);
}
jued.setSelectedItem(form.getProperty("jd2_jued"));
model3.setValueAt(jued, 11, 15);
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
pic.put("jd2_qtbg", new int[] { 9, 7 }); pic.put("jd2_qtbg", new int[] { 9, 7 });
model3.combine(new int[] { 0 }, new int[] { 0, 1, 2, 3, 4, 5 }); model3.combine(new int[] { 0 }, new int[] { 0, 1, 2, 3, 4, 5 });
@ -873,6 +954,34 @@ public class SampleConfirmationForm extends AbstractRendering {
} }
form.setProperty("jd2_mqjd", value); form.setProperty("jd2_mqjd", value);
} }
if (prop.containsKey("jd2_bpdj")) {
String value = bpdj.getSelectedItem() == null ? "" : bpdj.getSelectedItem().toString();
if (form.getTCProperty("jd2_bpdj").getLOV() != null && !"".equals(value)) {
value = (String) form.getTCProperty("jd2_bpdj").getLOV().getListOfValues().getRealValue(value);
}
form.setProperty("jd2_bpdj", value);
}
if (prop.containsKey("jd2_fl")) {
String value = fl.getSelectedItem() == null ? "" : fl.getSelectedItem().toString();
if (form.getTCProperty("jd2_fl").getLOV() != null && !"".equals(value)) {
value = (String) form.getTCProperty("jd2_fl").getLOV().getListOfValues().getRealValue(value);
}
form.setProperty("jd2_fl", value);
}
if (prop.containsKey("jd2_zt")) {
String value = zt.getSelectedItem() == null ? "" : zt.getSelectedItem().toString();
if (form.getTCProperty("jd2_zt").getLOV() != null && !"".equals(value)) {
value = (String) form.getTCProperty("jd2_zt").getLOV().getListOfValues().getRealValue(value);
}
form.setProperty("jd2_zt", value);
}
if (prop.containsKey("jd2_jued")) {
String value = jued.getSelectedItem() == null ? "" : jued.getSelectedItem().toString();
if (form.getTCProperty("jd2_jued").getLOV() != null && !"".equals(value)) {
value = (String) form.getTCProperty("jd2_jued").getLOV().getListOfValues().getRealValue(value);
}
form.setProperty("jd2_jued", value);
}
} catch (TCException e) { } catch (TCException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
@ -919,10 +1028,11 @@ public class SampleConfirmationForm extends AbstractRendering {
String[] row = new String[18]; String[] row = new String[18];
for (int ii = 0; ii < row.length; ii++) { for (int ii = 0; ii < row.length; ii++) {
Object object = model.getValueAt(top + 2 + num, ii > 2 ? ii + 2 : ii); Object object = model.getValueAt(top + 2 + num, ii > 2 ? ii + 2 : ii);
if (object == null) { if (ii == row.length - 1) {
row[ii] = ""; object = ((JComboBox<String>) object).getSelectedItem();
row[ii] = object == null ? "" : jgItems.get(object.toString());
} else { } else {
row[ii] = object.toString(); row[ii] = object == null ? "" : object.toString();
} }
} }
data.add(row); data.add(row);
@ -1123,14 +1233,23 @@ public class SampleConfirmationForm extends AbstractRendering {
TCComponentDataset dataset = datasetType.create(file.getName(), "", "Image"); TCComponentDataset dataset = datasetType.create(file.getName(), "", "Image");
dataset.setFiles(as1, as2); dataset.setFiles(as1, as2);
TCComponent[] comps = form.getRelatedComponents(); TCComponent[] comps = form.getRelatedComponents();
AIFComponentContext[] ref = form.whereReferenced();
TCComponentItemRevision rev = (TCComponentItemRevision) ref[0].getComponent();
rev.add("IMAN_specification", dataset); rev.add("IMAN_specification", dataset);
String uid = dataset.getUid(); String uid = dataset.getUid();
System.out.println("uid:" + uid); System.out.println("uid:" + uid);
ImageIcon icon = new ImageIcon(file.getPath()); ImageIcon icon = new ImageIcon(file.getPath());
int row = table3.getSelectedRow(); int row = table3.getSelectedRow();
int col = table3.getSelectedColumn(); int col = table3.getSelectedColumn();
String str = ((JLabel) model3.getValueAt(row, col)).getToolTipText();
if (str != null && !"".equals(str)) {
try {
TCComponentDataset oldDataset = (TCComponentDataset) session.stringToComponent(str);
rev.cutOperation("IMAN_specification", new TCComponent[] { oldDataset });
oldDataset.delete();
} catch (TCException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
int[] arr = model3.getSpan(row, col); int[] arr = model3.getSpan(row, col);
System.out.println("row:" + arr[0] + ",col:" + arr[1]); System.out.println("row:" + arr[0] + ",col:" + arr[1]);
icon.setImage(icon.getImage().getScaledInstance( icon.setImage(icon.getImage().getScaledInstance(
@ -1142,6 +1261,8 @@ public class SampleConfirmationForm extends AbstractRendering {
label.addMouseListener(showImg(file.getPath())); label.addMouseListener(showImg(file.getPath()));
label.setToolTipText(uid); label.setToolTipText(uid);
model3.setValueAt(label, table3.getSelectedRow(), table3.getSelectedColumn()); model3.setValueAt(label, table3.getSelectedRow(), table3.getSelectedColumn());
table3.revalidate();
table3.repaint();
} catch (TCException e1) { } catch (TCException e1) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e1.printStackTrace(); e1.printStackTrace();
@ -1161,7 +1282,20 @@ public class SampleConfirmationForm extends AbstractRendering {
// TODO Auto-generated method stub // TODO Auto-generated method stub
int row = table3.getSelectedRow(); int row = table3.getSelectedRow();
int col = table3.getSelectedColumn(); int col = table3.getSelectedColumn();
String uid = ((JLabel) model3.getValueAt(row, col)).getToolTipText();
if (uid != null && !"".equals(uid)) {
try {
TCComponentDataset dataset = (TCComponentDataset) session.stringToComponent(uid);
rev.cutOperation("IMAN_specification", new TCComponent[] { dataset });
dataset.delete();
} catch (TCException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
model3.setValueAt(new JLabel(""), row, col); model3.setValueAt(new JLabel(""), row, col);
table3.revalidate();
table3.repaint();
} }
}; };
@ -1183,7 +1317,6 @@ public class SampleConfirmationForm extends AbstractRendering {
// initModel(); // initModel();
table.revalidate(); table.revalidate();
table.repaint(); table.repaint();
} }
}; };
return actionListener; return actionListener;
@ -1199,6 +1332,8 @@ public class SampleConfirmationForm extends AbstractRendering {
model2.insertRow(++bottom2); model2.insertRow(++bottom2);
model2.setValueAt(num + 1, bottom2, 0); model2.setValueAt(num + 1, bottom2, 0);
model2.combine(new int[] { bottom2 }, new int[] { 0, 1 }); model2.combine(new int[] { bottom2 }, new int[] { 0, 1 });
table2.revalidate();
table2.repaint();
} }
}; };
return actionListener; return actionListener;
@ -1242,6 +1377,8 @@ public class SampleConfirmationForm extends AbstractRendering {
model2.setValueAt(num + i - row, i, 0); model2.setValueAt(num + i - row, i, 0);
} }
model2.combine(new int[] { row }, new int[] { 0, 1 }); model2.combine(new int[] { row }, new int[] { 0, 1 });
table2.revalidate();
table2.repaint();
} }
}; };
return actionListener; return actionListener;
@ -1287,6 +1424,8 @@ public class SampleConfirmationForm extends AbstractRendering {
model2.setValueAt(num + i - row, i, 0); model2.setValueAt(num + i - row, i, 0);
} }
} }
table2.revalidate();
table2.repaint();
} }
}; };
return actionListener; return actionListener;

@ -3,6 +3,7 @@ package com.connor.jd.plm.table;
import java.awt.Component; import java.awt.Component;
import javax.swing.DefaultCellEditor; import javax.swing.DefaultCellEditor;
import javax.swing.JComboBox;
import javax.swing.JTable; import javax.swing.JTable;
import javax.swing.JTextField; import javax.swing.JTextField;
@ -11,6 +12,7 @@ import com.teamcenter.rac.util.MessageBox;
public class MyCellEditor extends DefaultCellEditor { public class MyCellEditor extends DefaultCellEditor {
private JRadioPanel radio = null; private JRadioPanel radio = null;
private JCheckPanel check = null; private JCheckPanel check = null;
private JComboBox<String> comboBox = null;
private int type = -1; private int type = -1;
private int row; private int row;
private int col; private int col;
@ -42,6 +44,10 @@ public class MyCellEditor extends DefaultCellEditor {
check = (JCheckPanel) value; check = (JCheckPanel) value;
type = 2; type = 2;
return check; return check;
} else if (value instanceof JComboBox) {
comboBox = (JComboBox<String>) value;
type = 3;
return comboBox;
} }
this.row = row; this.row = row;
this.col = column; this.col = column;
@ -59,6 +65,9 @@ public class MyCellEditor extends DefaultCellEditor {
if (type == 2) { if (type == 2) {
return check; return check;
} }
if (type == 3) {
return comboBox;
}
Object obj = super.getCellEditorValue(); Object obj = super.getCellEditorValue();
if (obj != null && !"".equals(obj.toString().trim()) && row >= top && row <= bottom && col >= 7 if (obj != null && !"".equals(obj.toString().trim()) && row >= top && row <= bottom && col >= 7

@ -3,12 +3,14 @@ package com.connor.jd.plm.table;
import java.awt.Component; import java.awt.Component;
import javax.swing.DefaultCellEditor; import javax.swing.DefaultCellEditor;
import javax.swing.JComboBox;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JTable; import javax.swing.JTable;
import javax.swing.JTextField; import javax.swing.JTextField;
public class MyCellEditor2 extends DefaultCellEditor { public class MyCellEditor2 extends DefaultCellEditor {
private JLabel img = null; private JLabel img = null;
private JComboBox<String> jued = null;
private int type = -1; private int type = -1;
public MyCellEditor2(JTextField var1) { public MyCellEditor2(JTextField var1) {
@ -23,6 +25,11 @@ public class MyCellEditor2 extends DefaultCellEditor {
type = 1; type = 1;
return img; return img;
} }
if (value instanceof JComboBox) {
jued = (JComboBox<String>) value;
type = 2;
return jued;
}
type = 0; type = 0;
return super.getTableCellEditorComponent(table, value, isSelected, row, column); return super.getTableCellEditorComponent(table, value, isSelected, row, column);
} }
@ -32,6 +39,9 @@ public class MyCellEditor2 extends DefaultCellEditor {
if (type == 1) { if (type == 1) {
return img; return img;
} }
if (type == 2) {
return jued;
}
return super.getCellEditorValue(); return super.getCellEditorValue();
} }

Loading…
Cancel
Save