|
|
|
@ -6,13 +6,13 @@ import java.awt.Color;
|
|
|
|
|
import java.awt.Component;
|
|
|
|
|
import java.awt.Dimension;
|
|
|
|
|
import java.awt.FlowLayout;
|
|
|
|
|
import java.awt.Image;
|
|
|
|
|
import java.awt.ScrollPane;
|
|
|
|
|
import java.awt.event.ActionEvent;
|
|
|
|
|
import java.awt.event.ActionListener;
|
|
|
|
|
import java.awt.event.MouseAdapter;
|
|
|
|
|
import java.awt.event.MouseEvent;
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
@ -21,7 +21,6 @@ import java.util.Map;
|
|
|
|
|
import java.util.Map.Entry;
|
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory;
|
|
|
|
|
import javax.swing.ImageIcon;
|
|
|
|
|
import javax.swing.JButton;
|
|
|
|
|
import javax.swing.JComboBox;
|
|
|
|
|
import javax.swing.JFileChooser;
|
|
|
|
@ -43,6 +42,7 @@ import com.connor.jd.plm.table.JRadioPanel;
|
|
|
|
|
import com.connor.jd.plm.table.MyCellEditor;
|
|
|
|
|
import com.connor.jd.plm.table.MyCellEditor1;
|
|
|
|
|
import com.connor.jd.plm.table.MyCellEditor2;
|
|
|
|
|
import com.connor.jd.plm.table.MyComboBoxRenderer;
|
|
|
|
|
import com.connor.jd.plm.table.TCTableUtil;
|
|
|
|
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
|
|
|
|
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
|
|
|
@ -51,9 +51,11 @@ import com.teamcenter.rac.kernel.TCComponent;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentDataset;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentDatasetType;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentForm;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentICO;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCException;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCSession;
|
|
|
|
|
import com.teamcenter.rac.kernel.ics.ICSProperty;
|
|
|
|
|
import com.teamcenter.rac.stylesheet.AbstractRendering;
|
|
|
|
|
|
|
|
|
|
public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
@ -109,7 +111,10 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
private JMenuItem addR2;
|
|
|
|
|
private JMenuItem insertR2;
|
|
|
|
|
private JMenuItem delR2;
|
|
|
|
|
private JMenuItem addF;
|
|
|
|
|
private JMenuItem delF;
|
|
|
|
|
private TCComponentItemRevision rev;
|
|
|
|
|
private String[][] dataStore = new String[8][13];
|
|
|
|
|
|
|
|
|
|
public SampleConfirmationForm(TCComponent arg0) throws Exception {
|
|
|
|
|
super(arg0);
|
|
|
|
@ -290,6 +295,59 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
}
|
|
|
|
|
table3.addMouseListener(rightClick3());
|
|
|
|
|
|
|
|
|
|
// 属性映射
|
|
|
|
|
prop = form.getProperties();
|
|
|
|
|
AIFComponentContext[] parents = rev.whereReferenced();
|
|
|
|
|
TCComponentItemRevision parentRev = null;
|
|
|
|
|
for (AIFComponentContext aif : parents) {
|
|
|
|
|
try {
|
|
|
|
|
System.out.println(aif.getComponent().getProperty("object_string"));
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
if (aif.getComponent() instanceof TCComponentItemRevision) {
|
|
|
|
|
parentRev = (TCComponentItemRevision) aif.getComponent();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (parentRev != null) {
|
|
|
|
|
String partName = parentRev.getProperty("object_name");
|
|
|
|
|
System.out.println(partName);
|
|
|
|
|
if (prop.containsKey("jd2_ljm")) {
|
|
|
|
|
form.setProperty("jd2_ljm", partName);
|
|
|
|
|
}
|
|
|
|
|
String materialCode = parentRev.getProperty("item_id");
|
|
|
|
|
System.out.println(materialCode);
|
|
|
|
|
if (prop.containsKey("jd2_wlbm")) {
|
|
|
|
|
form.setProperty("jd2_wlbm", materialCode);
|
|
|
|
|
}
|
|
|
|
|
TCComponent[] drawings = parentRev.getReferenceListProperty("TC_Is_Represented_By");
|
|
|
|
|
if (drawings != null && drawings.length > 0) {
|
|
|
|
|
TCComponentItemRevision drawingRev = (TCComponentItemRevision) drawings[0];
|
|
|
|
|
String drawingId = drawingRev.getProperty("item_id");
|
|
|
|
|
System.out.println(drawingId);
|
|
|
|
|
if (prop.containsKey("jd2_th")) {
|
|
|
|
|
form.setProperty("jd2_th", drawingId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (parentRev.getClassificationObjects() != null && parentRev.getClassificationObjects().length > 0) {
|
|
|
|
|
TCComponentICO ico = parentRev.getClassificationObjects()[0];
|
|
|
|
|
ICSProperty[] parentICSProps = ico.getICSProperties(true);
|
|
|
|
|
for (int i = 0; i < parentICSProps.length; i++) {
|
|
|
|
|
if (parentICSProps[i].getId() == 1050) {
|
|
|
|
|
if (prop.containsKey("jd2_ljywm")) {
|
|
|
|
|
form.setProperty("jd2_ljywm", parentICSProps[i].getValue());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (parentICSProps[i].getId() == 1058) {
|
|
|
|
|
if (prop.containsKey("jd2_gg")) {
|
|
|
|
|
form.setProperty("jd2_gg", parentICSProps[i].getValue());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 填写数据
|
|
|
|
|
prop = form.getProperties();
|
|
|
|
|
for (Entry<String, int[]> entry : general.entrySet()) {
|
|
|
|
@ -300,6 +358,7 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
System.out.println("属性‘" + entry.getKey() + "’未找到");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (Entry<String, int[]> entry : general3.entrySet()) {
|
|
|
|
|
if (prop.containsKey(entry.getKey())) {
|
|
|
|
|
model3.setValueAt(prop.get(entry.getKey()), entry.getValue()[0], entry.getValue()[1]);
|
|
|
|
@ -325,8 +384,8 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
if (prop.containsKey(entry.getKey())) {
|
|
|
|
|
TCComponent comp = null;
|
|
|
|
|
try {
|
|
|
|
|
if (!"".equals(prop.get(entry.getKey()))) {
|
|
|
|
|
comp = session.stringToComponent(prop.get(entry.getKey()));
|
|
|
|
|
if (comp != null) {
|
|
|
|
|
TCComponentDataset dataset = (TCComponentDataset) comp;
|
|
|
|
|
String temp = System.getenv("temp");
|
|
|
|
|
System.out.println(temp);
|
|
|
|
@ -336,21 +395,27 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
File img = dataset.getFiles(types[0], temp)[0];
|
|
|
|
|
System.out.println(img.getPath());
|
|
|
|
|
|
|
|
|
|
ImageIcon icon = new ImageIcon(img.getPath());
|
|
|
|
|
// ImageIcon icon = new ImageIcon(img.getPath());
|
|
|
|
|
|
|
|
|
|
int[] arr = model3.getSpan(row, col);
|
|
|
|
|
int width = 0;
|
|
|
|
|
for (int i = 0; i < arr[1]; i++) {
|
|
|
|
|
// int width = 0;
|
|
|
|
|
// for (int i = 0; i < arr[1]; i++) {
|
|
|
|
|
// width+=table3.getColumnModel().getColumn()
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
System.out.println("row:" + arr[0] + ",col:" + arr[1]);
|
|
|
|
|
icon.setImage(icon.getImage().getScaledInstance(
|
|
|
|
|
table3.getColumnModel().getColumn(col).getPreferredWidth() * arr[1],
|
|
|
|
|
table3.getRowHeight() * arr[0], Image.SCALE_SMOOTH));
|
|
|
|
|
// icon.setImage(icon.getImage().getScaledInstance(
|
|
|
|
|
// table3.getColumnModel().getColumn(col).getPreferredWidth() * arr[1],
|
|
|
|
|
// table3.getRowHeight() * arr[0], Image.SCALE_SMOOTH));
|
|
|
|
|
JLabel label = new JLabel();
|
|
|
|
|
label.setLayout(new FlowLayout(FlowLayout.CENTER));
|
|
|
|
|
label.setIcon(icon);
|
|
|
|
|
// label.setIcon(icon);
|
|
|
|
|
label.setForeground(new Color(0xff0078D7));
|
|
|
|
|
label.setText(img.getName());
|
|
|
|
|
if ("jd2_icqjyzds".equals(entry.getKey())) {
|
|
|
|
|
label.addMouseListener(showFile(dataset));
|
|
|
|
|
} else {
|
|
|
|
|
label.addMouseListener(showImg(img.getPath()));
|
|
|
|
|
}
|
|
|
|
|
label.setToolTipText(dataset.getUid());
|
|
|
|
|
model3.setValueAt(label, row, col);
|
|
|
|
|
} else {
|
|
|
|
@ -382,6 +447,7 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
}
|
|
|
|
|
if (ii == tableRows[0].length - 1) {
|
|
|
|
|
JComboBox<String> jgComBox = new JComboBox<String>();
|
|
|
|
|
jgComBox.setRenderer(new MyComboBoxRenderer());
|
|
|
|
|
for (Entry<String, String> entry : jgItems.entrySet()) {
|
|
|
|
|
jgComBox.addItem(entry.getKey());
|
|
|
|
|
}
|
|
|
|
@ -578,6 +644,14 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
delP.setEnabled(false);
|
|
|
|
|
menu3.add(delP);
|
|
|
|
|
delP.addActionListener(delPic());
|
|
|
|
|
addF = new JMenuItem("上传文件");
|
|
|
|
|
addF.setEnabled(false);
|
|
|
|
|
menu3.add(addF);
|
|
|
|
|
addF.addActionListener(addFile());
|
|
|
|
|
delF = new JMenuItem("删除文件");
|
|
|
|
|
delF.setEnabled(false);
|
|
|
|
|
menu3.add(delF);
|
|
|
|
|
delF.addActionListener(delFile());
|
|
|
|
|
|
|
|
|
|
// 检验单右键菜单
|
|
|
|
|
menu2.setVisible(false);
|
|
|
|
@ -651,13 +725,17 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
model.setValueAt("分类", 6, 14);
|
|
|
|
|
disableEdit.add("6,14");
|
|
|
|
|
fl = new JComboBox<String>();
|
|
|
|
|
fl.setRenderer(new MyComboBoxRenderer());
|
|
|
|
|
try {
|
|
|
|
|
if (form.getTCProperty("jd2_fl") != null) {
|
|
|
|
|
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();
|
|
|
|
@ -672,13 +750,17 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
model.setValueAt("状态", 7, 14);
|
|
|
|
|
disableEdit.add("7,14");
|
|
|
|
|
zt = new JComboBox<String>();
|
|
|
|
|
zt.setRenderer(new MyComboBoxRenderer());
|
|
|
|
|
try {
|
|
|
|
|
if (form.getTCProperty("jd2_zt") != null) {
|
|
|
|
|
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();
|
|
|
|
@ -686,13 +768,17 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
model.setValueAt("部品等级", 8, 0);
|
|
|
|
|
disableEdit.add("8,0");
|
|
|
|
|
bpdj = new JComboBox<String>();
|
|
|
|
|
bpdj.setRenderer(new MyComboBoxRenderer());
|
|
|
|
|
try {
|
|
|
|
|
if (form.getTCProperty("jd2_bpdj") != null) {
|
|
|
|
|
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();
|
|
|
|
@ -728,7 +814,8 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
disableEdit.add(top + ",19");
|
|
|
|
|
model.setValueAt("规格", top + 1, 1);
|
|
|
|
|
disableEdit.add(top + 1 + ",1");
|
|
|
|
|
model.setValueAt("¹«²î", top + 1, 5);
|
|
|
|
|
model.setValueAt("上公差", top + 1, 5);
|
|
|
|
|
model.setValueAt("下公差", top + 1, 6);
|
|
|
|
|
disableEdit.add(top + 1 + ",5");
|
|
|
|
|
for (int i = 1; i < 11; i++) {
|
|
|
|
|
model.setValueAt("#" + i, top + 1, i + 6);
|
|
|
|
@ -744,6 +831,7 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
disableEdit.add(i + ",0");
|
|
|
|
|
model.combine(new int[] { i }, new int[] { 2, 3, 4 });
|
|
|
|
|
JComboBox<String> jgComBox = new JComboBox<String>();
|
|
|
|
|
jgComBox.setRenderer(new MyComboBoxRenderer());
|
|
|
|
|
for (Entry<String, String> entry : jgItems.entrySet()) {
|
|
|
|
|
jgComBox.addItem(entry.getKey());
|
|
|
|
|
}
|
|
|
|
@ -798,8 +886,6 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
model.combine(new int[] { top }, new int[] { 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 });
|
|
|
|
|
model.combine(new int[] { top, top + 1 }, new int[] { 19 });
|
|
|
|
|
model.combine(new int[] { top + 1 }, new int[] { 1, 2, 3, 4 });
|
|
|
|
|
model.combine(new int[] { top + 1 }, new int[] { 5, 6 });
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void initModel3() {
|
|
|
|
@ -834,6 +920,7 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
general3.put("jd2_lq", new int[] { 2, 7 });
|
|
|
|
|
general3.put("jd2_baoz", new int[] { 2, 8 });
|
|
|
|
|
pic.put("jd2_gfzjbg", new int[] { 2, 9 });
|
|
|
|
|
// pic.put("user_data_2", new int[] { 2, 9 });
|
|
|
|
|
pic.put("jd2_gfzyzds", new int[] { 2, 12 });
|
|
|
|
|
pic.put("jd2_gfqcgct", new int[] { 2, 15 });
|
|
|
|
|
pic.put("jd2_wlbzjbq", new int[] { 2, 18 });
|
|
|
|
@ -868,16 +955,21 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
model3.setValueAt("IQC作业指导书", 9, 4);
|
|
|
|
|
disableEdit3.add(9 + ",4");
|
|
|
|
|
pic.put("jd2_icqjyzds", new int[] { 10, 4 });
|
|
|
|
|
// pic.put("user_data_1", new int[] { 10, 4 });
|
|
|
|
|
model3.setValueAt("决定", 11, 12);
|
|
|
|
|
disableEdit3.add(11 + ",12");
|
|
|
|
|
jued = new JComboBox<String>();
|
|
|
|
|
jued.setRenderer(new MyComboBoxRenderer());
|
|
|
|
|
try {
|
|
|
|
|
if (form.getTCProperty("jd2_jued") != null) {
|
|
|
|
|
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();
|
|
|
|
@ -1120,6 +1212,19 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
@Override
|
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
System.out.println("confirm");
|
|
|
|
|
for (int i = 2; i < 10; i++) {
|
|
|
|
|
for (int ii = 1; ii < 14; ii++) {
|
|
|
|
|
String temp = table2.getValueAt(ii, i) == null ? "" : table2.getValueAt(ii, i).toString();
|
|
|
|
|
table.setValueAt(temp, top + i, ii + 1 > 2 ? ii + 3 : ii + 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (int i = 2; i < 10; i++) {
|
|
|
|
|
table.getColumnModel().getColumn(10).getCellEditor().getTableCellEditorComponent(table,
|
|
|
|
|
table.getValueAt(top + i, 10), true, top + i, 10);
|
|
|
|
|
table.getColumnModel().getColumn(10).getCellEditor().stopCellEditing();
|
|
|
|
|
}
|
|
|
|
|
table.revalidate();
|
|
|
|
|
table.repaint();
|
|
|
|
|
cl.show(center, "confirm");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -1133,6 +1238,26 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
System.out.println("examine");
|
|
|
|
|
for (int i = 1; i < 9; i++) {
|
|
|
|
|
for (int ii = 2; ii < 15; ii++) {
|
|
|
|
|
String temp = table.getValueAt(top + 1 + i, ii > 2 ? ii + 2 : ii) == null ? ""
|
|
|
|
|
: table.getValueAt(top + 1 + i, ii > 2 ? ii + 2 : ii).toString();
|
|
|
|
|
table2.setValueAt(temp, ii - 1, i + 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (int i = 2; i < 10; i++) {
|
|
|
|
|
table2.getColumnModel().getColumn(i).getCellEditor().getTableCellEditorComponent(table2,
|
|
|
|
|
table2.getValueAt(2, i), true, 2, i);
|
|
|
|
|
table2.getColumnModel().getColumn(i).getCellEditor().stopCellEditing();
|
|
|
|
|
table2.getColumnModel().getColumn(i).getCellEditor().getTableCellEditorComponent(table2,
|
|
|
|
|
table2.getValueAt(3, i), true, 3, i);
|
|
|
|
|
table2.getColumnModel().getColumn(i).getCellEditor().stopCellEditing();
|
|
|
|
|
table2.getColumnModel().getColumn(i).getCellEditor().getTableCellEditorComponent(table2,
|
|
|
|
|
table2.getValueAt(4, i), true, 4, i);
|
|
|
|
|
table2.getColumnModel().getColumn(i).getCellEditor().stopCellEditing();
|
|
|
|
|
}
|
|
|
|
|
table2.revalidate();
|
|
|
|
|
table2.repaint();
|
|
|
|
|
cl.show(center, "examine");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -1189,6 +1314,14 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
}
|
|
|
|
|
addP.setEnabled(flag);
|
|
|
|
|
delP.setEnabled(flag);
|
|
|
|
|
addF.setEnabled(false);
|
|
|
|
|
delF.setEnabled(false);
|
|
|
|
|
if (pic.get("jd2_icqjyzds")[0] == row && pic.get("jd2_icqjyzds")[1] == col) {
|
|
|
|
|
addF.setEnabled(true);
|
|
|
|
|
delF.setEnabled(true);
|
|
|
|
|
addP.setEnabled(false);
|
|
|
|
|
delP.setEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
menu3.show(e.getComponent(), e.getX(), e.getY());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -1236,7 +1369,7 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
rev.add("IMAN_specification", dataset);
|
|
|
|
|
String uid = dataset.getUid();
|
|
|
|
|
System.out.println("uid:" + uid);
|
|
|
|
|
ImageIcon icon = new ImageIcon(file.getPath());
|
|
|
|
|
// ImageIcon icon = new ImageIcon(file.getPath());
|
|
|
|
|
int row = table3.getSelectedRow();
|
|
|
|
|
int col = table3.getSelectedColumn();
|
|
|
|
|
String str = ((JLabel) model3.getValueAt(row, col)).getToolTipText();
|
|
|
|
@ -1252,12 +1385,14 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
}
|
|
|
|
|
int[] arr = model3.getSpan(row, col);
|
|
|
|
|
System.out.println("row:" + arr[0] + ",col:" + arr[1]);
|
|
|
|
|
icon.setImage(icon.getImage().getScaledInstance(
|
|
|
|
|
table3.getColumnModel().getColumn(col).getPreferredWidth() * arr[1],
|
|
|
|
|
table3.getRowHeight() * arr[0], Image.SCALE_SMOOTH));
|
|
|
|
|
// icon.setImage(icon.getImage().getScaledInstance(
|
|
|
|
|
// table3.getColumnModel().getColumn(col).getPreferredWidth() * arr[1],
|
|
|
|
|
// table3.getRowHeight() * arr[0], Image.SCALE_SMOOTH));
|
|
|
|
|
JLabel label = new JLabel();
|
|
|
|
|
label.setLayout(new FlowLayout(FlowLayout.CENTER));
|
|
|
|
|
label.setIcon(icon);
|
|
|
|
|
// label.setIcon(icon);
|
|
|
|
|
label.setText(file.getName());
|
|
|
|
|
label.setForeground(new Color(0xff0078D7));
|
|
|
|
|
label.addMouseListener(showImg(file.getPath()));
|
|
|
|
|
label.setToolTipText(uid);
|
|
|
|
|
model3.setValueAt(label, table3.getSelectedRow(), table3.getSelectedColumn());
|
|
|
|
@ -1293,7 +1428,7 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
e1.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
model3.setValueAt(new JLabel(""), row, col);
|
|
|
|
|
((JLabel) model3.getValueAt(row, col)).setText("");
|
|
|
|
|
table3.revalidate();
|
|
|
|
|
table3.repaint();
|
|
|
|
|
}
|
|
|
|
@ -1447,4 +1582,119 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
};
|
|
|
|
|
return adapter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private MouseAdapter showFile(TCComponentDataset dataset) {
|
|
|
|
|
MouseAdapter adapter = new MouseAdapter() {
|
|
|
|
|
@Override
|
|
|
|
|
public void mouseClicked(MouseEvent e) {
|
|
|
|
|
if (e.getClickCount() == 2) {
|
|
|
|
|
try {
|
|
|
|
|
dataset.open();
|
|
|
|
|
} catch (TCException e1) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
e1.printStackTrace();
|
|
|
|
|
} catch (IOException e1) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
e1.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
return adapter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ActionListener addFile() {
|
|
|
|
|
return new ActionListener() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
JFileChooser fileChooser = new JFileChooser();
|
|
|
|
|
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
|
|
|
|
fileChooser.setMultiSelectionEnabled(false);
|
|
|
|
|
fileChooser.setFileFilter(new FileFilter() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String getDescription() {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
return "(文档,表格)*.doc;*.docx;*.xls;*.xlsx;";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean accept(File var1) {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
return var1.getName().endsWith(".doc") || var1.getName().endsWith(".docx")
|
|
|
|
|
|| var1.getName().endsWith(".xls") || var1.getName().endsWith(".xlsx");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
fileChooser.showOpenDialog(menu3);// 参数表示定位
|
|
|
|
|
File file = fileChooser.getSelectedFile();
|
|
|
|
|
if (file != null) {
|
|
|
|
|
System.out.println("fileName:" + file.getName());
|
|
|
|
|
String as1[] = { file.getPath() };// 文件的物理路径
|
|
|
|
|
String as2[] = new String[1];
|
|
|
|
|
String type = "";
|
|
|
|
|
if (file.getName().endsWith(".doc")) {
|
|
|
|
|
as2[0] = "word";
|
|
|
|
|
type = "MSWord";
|
|
|
|
|
} else if (file.getName().endsWith(".docx")) {
|
|
|
|
|
as2[0] = "word";
|
|
|
|
|
type = "MSWordX";
|
|
|
|
|
} else if (file.getName().endsWith(".xls")) {
|
|
|
|
|
as2[0] = "excel";
|
|
|
|
|
type = "MSExcel";
|
|
|
|
|
} else if (file.getName().endsWith(".xlsx")) {
|
|
|
|
|
as2[0] = "excel";
|
|
|
|
|
type = "MSExcelX";
|
|
|
|
|
}
|
|
|
|
|
TCComponentDatasetType datasetType;
|
|
|
|
|
try {
|
|
|
|
|
datasetType = (TCComponentDatasetType) session.getTypeComponent("Dataset");
|
|
|
|
|
TCComponentDataset dataset = datasetType.create(file.getName(), "", type);
|
|
|
|
|
dataset.setFiles(as1, as2);
|
|
|
|
|
TCComponent[] comps = form.getRelatedComponents();
|
|
|
|
|
rev.add("IMAN_specification", dataset);
|
|
|
|
|
String uid = dataset.getUid();
|
|
|
|
|
System.out.println("uid:" + uid);
|
|
|
|
|
// ImageIcon icon = new ImageIcon(file.getPath());
|
|
|
|
|
int row = table3.getSelectedRow();
|
|
|
|
|
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);
|
|
|
|
|
System.out.println("row:" + arr[0] + ",col:" + arr[1]);
|
|
|
|
|
// icon.setImage(icon.getImage().getScaledInstance(
|
|
|
|
|
// table3.getColumnModel().getColumn(col).getPreferredWidth() * arr[1],
|
|
|
|
|
// table3.getRowHeight() * arr[0], Image.SCALE_SMOOTH));
|
|
|
|
|
JLabel label = new JLabel();
|
|
|
|
|
label.setLayout(new FlowLayout(FlowLayout.CENTER));
|
|
|
|
|
// label.setIcon(icon);
|
|
|
|
|
label.setText(file.getName());
|
|
|
|
|
label.setForeground(new Color(0xff0078D7));
|
|
|
|
|
label.addMouseListener(showFile(dataset));
|
|
|
|
|
label.setToolTipText(uid);
|
|
|
|
|
model3.setValueAt(label, table3.getSelectedRow(), table3.getSelectedColumn());
|
|
|
|
|
table3.revalidate();
|
|
|
|
|
table3.repaint();
|
|
|
|
|
} catch (TCException e1) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
e1.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ActionListener delFile() {
|
|
|
|
|
return delPic();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|