|
|
|
@ -70,8 +70,8 @@ import com.teamcenter.rac.kernel.TCSession;
|
|
|
|
|
import com.teamcenter.rac.util.MessageBox;
|
|
|
|
|
|
|
|
|
|
public class CreateNPIprojectDialog extends JFrame implements Runnable {
|
|
|
|
|
private final String TABLE_TITLE = "Drawing Task Book Table";
|
|
|
|
|
private final String JFRAME_TITLE = "Create NPI Project";
|
|
|
|
|
private final String TABLE_TITLE = "³öͼÈÎÎñÊé±í";
|
|
|
|
|
private final String JFRAME_TITLE = "´´½¨NPI";
|
|
|
|
|
|
|
|
|
|
private final String PREFERENCE_EXCEL_GETUID = "VF5CTRWS";
|
|
|
|
|
private final String TARGET_REV_XJXXD_GX = "VF5xjxxdgx";
|
|
|
|
@ -158,14 +158,14 @@ public class CreateNPIprojectDialog extends JFrame implements Runnable {
|
|
|
|
|
* @throws TCException
|
|
|
|
|
*/
|
|
|
|
|
private void setPanelProperties() throws TCException {
|
|
|
|
|
okButton = new JButton(ConstantPool.EN_BUTTON_CONFIRM);
|
|
|
|
|
celButton = new JButton(ConstantPool.EN_BUTTON_CANCEL);
|
|
|
|
|
importButton = new JButton(ConstantPool.EN_BUTTON_IMPORT);
|
|
|
|
|
exportButton = new JButton(ConstantPool.EN_BUTTON_EXPORT);
|
|
|
|
|
addButton = new JButton(ConstantPool.EN_BUTTON_ADD);
|
|
|
|
|
deleteButton = new JButton(ConstantPool.EN_BUTTON_DELETE);
|
|
|
|
|
moveUpButton = new JButton(ConstantPool.EN_BUTTON_MOVE_UP);
|
|
|
|
|
moveDownButton = new JButton(ConstantPool.EN_BUTTON_MOVE_DOWN);
|
|
|
|
|
okButton = new JButton(ConstantPool.CH_BUTTON_CONFIRM);
|
|
|
|
|
celButton = new JButton(ConstantPool.CH_BUTTON_CANCEL);
|
|
|
|
|
importButton = new JButton(ConstantPool.CH_BUTTON_IMPORT);
|
|
|
|
|
exportButton = new JButton(ConstantPool.CH_BUTTON_EXPORT);
|
|
|
|
|
addButton = new JButton(ConstantPool.CH_BUTTON_ADD);
|
|
|
|
|
deleteButton = new JButton(ConstantPool.CH_BUTTON_DELETE);
|
|
|
|
|
moveUpButton = new JButton(ConstantPool.CH_BUTTON_MOVE_UP);
|
|
|
|
|
moveDownButton = new JButton(ConstantPool.CH_BUTTON_MOVE_DOWN);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private JScrollPane getTopPanel() {
|
|
|
|
@ -308,12 +308,12 @@ public class CreateNPIprojectDialog extends JFrame implements Runnable {
|
|
|
|
|
buttonPanel.add(moveDownButton);
|
|
|
|
|
|
|
|
|
|
importButton.addActionListener(e -> {
|
|
|
|
|
createDialog(ConstantPool.EN_TITLE_IMPORT_PATH, ConstantPool.EN_LABEL_UPLOAD_PATH, "import");
|
|
|
|
|
createDialog(ConstantPool.CH_TITLE_IMPORT_PATH, ConstantPool.CH_LABEL_UPLOAD_PATH, "import");
|
|
|
|
|
System.out.println("本地导入按钮被点击");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
exportButton.addActionListener(e -> {
|
|
|
|
|
createDialog(ConstantPool.EN_TITLE_EXPORT_PATH, ConstantPool.EN_LABEL_UPLOAD_PATH, "export");
|
|
|
|
|
createDialog(ConstantPool.CH_TITLE_EXPORT_PATH, ConstantPool.CH_LABEL_UPLOAD_PATH, "export");
|
|
|
|
|
System.out.println("本地导出按钮被点击");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -354,7 +354,7 @@ public class CreateNPIprojectDialog extends JFrame implements Runnable {
|
|
|
|
|
table.clearSelection();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
JOptionPane.showMessageDialog(table, ConstantPool.EN_MESSAGE_DELETE);
|
|
|
|
|
JOptionPane.showMessageDialog(table, ConstantPool.CH_MESSAGE_DELETE);
|
|
|
|
|
}
|
|
|
|
|
System.out.println("删除行按钮被点击");
|
|
|
|
|
});
|
|
|
|
@ -376,7 +376,7 @@ public class CreateNPIprojectDialog extends JFrame implements Runnable {
|
|
|
|
|
model.insertRow(selectedRow - 1, row);
|
|
|
|
|
table.setRowSelectionInterval(selectedRow - 1, selectedRow - 1);
|
|
|
|
|
} else {
|
|
|
|
|
JOptionPane.showMessageDialog(table, ConstantPool.EN_MESSAGE_MOVE_UP);
|
|
|
|
|
JOptionPane.showMessageDialog(table, ConstantPool.CH_MESSAGE_MOVE_UP);
|
|
|
|
|
}
|
|
|
|
|
System.out.println("上移按钮被点击");
|
|
|
|
|
});
|
|
|
|
@ -397,7 +397,7 @@ public class CreateNPIprojectDialog extends JFrame implements Runnable {
|
|
|
|
|
model.insertRow(selectedRow + 1, row);
|
|
|
|
|
table.setRowSelectionInterval(selectedRow + 1, selectedRow + 1);
|
|
|
|
|
} else {
|
|
|
|
|
JOptionPane.showMessageDialog(table, ConstantPool.EN_MESSAGE_MOVE_DOWN);
|
|
|
|
|
JOptionPane.showMessageDialog(table, ConstantPool.CH_MESSAGE_MOVE_DOWN);
|
|
|
|
|
}
|
|
|
|
|
System.out.println("下移按钮被点击");
|
|
|
|
|
|
|
|
|
@ -417,7 +417,7 @@ public class CreateNPIprojectDialog extends JFrame implements Runnable {
|
|
|
|
|
pathField.setBounds(110, 40, 150, 25);
|
|
|
|
|
dialog.add(pathField);
|
|
|
|
|
|
|
|
|
|
JButton selectButton = new JButton(ConstantPool.EN_BUTTON_CHOOSE);
|
|
|
|
|
JButton selectButton = new JButton(ConstantPool.CH_BUTTON_CHOOSE);
|
|
|
|
|
selectButton.setBounds(280, 40, 90, 25);
|
|
|
|
|
|
|
|
|
|
selectButton.addActionListener(e -> {
|
|
|
|
@ -443,22 +443,22 @@ public class CreateNPIprojectDialog extends JFrame implements Runnable {
|
|
|
|
|
});
|
|
|
|
|
dialog.add(selectButton, BorderLayout.EAST);
|
|
|
|
|
|
|
|
|
|
JButton localOkButton = new JButton(ConstantPool.EN_BUTTON_CONFIRM);
|
|
|
|
|
JButton localOkButton = new JButton(ConstantPool.CH_BUTTON_CONFIRM);
|
|
|
|
|
// localOkButton.setBounds(80, 70, 100, 25);
|
|
|
|
|
localOkButton.setBounds(80, 90, 100, 25);
|
|
|
|
|
JButton localCancelButton = new JButton(ConstantPool.EN_BUTTON_CANCEL);
|
|
|
|
|
JButton localCancelButton = new JButton(ConstantPool.CH_BUTTON_CANCEL);
|
|
|
|
|
// localCancelButton.setBounds(200, 70, 100, 25);
|
|
|
|
|
localCancelButton.setBounds(200, 90, 100, 25);
|
|
|
|
|
|
|
|
|
|
localOkButton.addActionListener(e -> {
|
|
|
|
|
String path = pathField.getText();
|
|
|
|
|
if (path.isEmpty()) {
|
|
|
|
|
JOptionPane.showMessageDialog(dialog, ConstantPool.EN_MESSAGE_IMPORT);
|
|
|
|
|
JOptionPane.showMessageDialog(dialog, ConstantPool.CH_MESSAGE_IMPORT);
|
|
|
|
|
} else if (method.equals("import")) {
|
|
|
|
|
System.out.println(labelName + ":" + path);
|
|
|
|
|
// 检查文件扩展名是否为 .xlsx 或 .xls
|
|
|
|
|
if (!path.toLowerCase().endsWith(".xlsx") && !path.toLowerCase().endsWith(".xls")) {
|
|
|
|
|
JOptionPane.showMessageDialog(dialog, ConstantPool.EN_MESSAGE_EXCEL_ERROR);
|
|
|
|
|
JOptionPane.showMessageDialog(dialog, ConstantPool.CH_MESSAGE_EXCEL_ERROR);
|
|
|
|
|
} else {
|
|
|
|
|
System.out.println(labelName + ":" + path);
|
|
|
|
|
importData(path);
|
|
|
|
@ -468,7 +468,7 @@ public class CreateNPIprojectDialog extends JFrame implements Runnable {
|
|
|
|
|
// 检查文件是否为目录
|
|
|
|
|
File file = new File(path);
|
|
|
|
|
if (!file.isDirectory()) {
|
|
|
|
|
JOptionPane.showMessageDialog(dialog, ConstantPool.EN_MESSAGE_FILE_ERROR);
|
|
|
|
|
JOptionPane.showMessageDialog(dialog, ConstantPool.CH_MESSAGE_FILE_ERROR);
|
|
|
|
|
} else {
|
|
|
|
|
// 处理导出逻辑
|
|
|
|
|
System.out.println(labelName + ":" + path);
|
|
|
|
|