修复问题:

1.测试项维护保存后弹窗被覆盖
2.测试项信息修改后当前记录未保存
3.新品测试清单数字无法输入(存疑)
4.新品测试计划创建无提示
5.新品测试清单信息修改未保存
main
zouxk 5 years ago
parent eed466075e
commit 2832140236

File diff suppressed because it is too large Load Diff

@ -55,6 +55,7 @@
<command categoryId="JDProject.commands.category" name="问题点" id="JD2_PROBLEM"></command>
<command categoryId="JDProject.commands.category" name="变更通知单" id="JD2_GTECN"></command>
<command categoryId="JDProject.commands.category" name="齐套性检查" id="JD2_GTQTXJC"></command>
<command categoryId="JDProject.commands.category" name="滚筒新品测试项清单" id="JD2_GTXPCSXQD"></command>
<!--波轮PLM菜单-->
<command categoryId="JDProject.commands.category" name="年度规划大纲" id="JD2_BLNDGHDG"></command>
<command categoryId="JDProject.commands.category" name="产品立项申请表" id="JD2_BLCPLXSQB"></command>
@ -290,6 +291,7 @@
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTSJPSBG"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BXSJJHS"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BXSJRWS"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTXPCSXQD"></handler>
<handler class="com.connor.jd.plm.handlers.CSXWHHandler" commandId="JD2_CSXWH"></handler>
<handler commandId="editClassification" class="com.connor.jd.plm.handlers.EditClassificationHandler"></handler>
@ -323,6 +325,9 @@
<menu id="JDProject.menus.JD2_GTSBYJ" label="手版样机" mnemonic="M">
<command commandId="JD2_GTSBYJPSD" id="JDProject.menus.JD2_GTSBYJPSD" mnemonic="S"></command>
</menu>
<menu id="JDProject.menus.JD2_GTDVSBYJ" label="DV手版样机" mnemonic="M">
<command commandId="JD2_GTXPCSXQD" id="JDProject.menus.JD2_GTXPCSXQD" mnemonic="S"></command>
</menu>
<menu id="JDProject.menus.JD2_GTKFYJ" label="开发样机" mnemonic="M">
<command commandId="JD2_GTTZPSD" id="JDProject.menus.JD2_GTTZPSD" mnemonic="S"></command>
<command commandId="JD2_GTZZJKMQD" id="JDProject.menus.JD2_GTZZJKMQD" mnemonic="S"></command>

@ -0,0 +1,38 @@
package com.connor.jd.plm.beans;
public class JG {
int row;
int times;
String jg;
public JG(int row, int times, String jg) {
super();
this.row = row;
this.times = times;
this.jg = jg;
}
public int getTimes() {
return times;
}
public void setTimes(int times) {
this.times = times;
}
public String getJg() {
return jg;
}
public void setJg(String jg) {
this.jg = jg;
}
public int getRow() {
return row;
}
public void setRow(int row) {
this.row = row;
}
}

@ -0,0 +1,7 @@
package com.connor.jd.plm.dialog;
import javafx.scene.control.Dialog;
public class MsgDialog extends Dialog<String> {
}

@ -19,24 +19,32 @@ import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.kernel.TCException;
import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.Event;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableColumn.CellEditEvent;
import javafx.scene.control.TablePosition;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.control.cell.TextFieldTableCell;
import javafx.scene.input.KeyCode;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.Pane;
import javafx.scene.text.Font;
import javafx.stage.Stage;
public class CSXWHDialog extends Application {
@ -59,15 +67,38 @@ public class CSXWHDialog extends Application {
private int index = 10000;
private int macindex = 10000;
private Stage msgStage;
private Label msgContent;
@Override
public void start(Stage arg0) throws Exception {
msgStage = new Stage();
msgContent = new Label("");
msgContent.setFont(new Font(STYLESHEET_CASPIAN, 16));
Button ok = new Button("确定");
ok.setPrefSize(60, 25);
ok.setOnAction((arg) -> {
msgStage.close();
});
BorderPane msgInner = new BorderPane();
msgInner.setStyle("-fx-padding:10px;");
FlowPane btnFlow = new FlowPane();
btnFlow.setAlignment(Pos.TOP_RIGHT);
btnFlow.getChildren().addAll(ok);
msgInner.setTop(msgContent);
msgInner.setBottom(btnFlow);
Scene msgScene = new Scene(msgInner, 200, 100);
msgStage.setScene(msgScene);
msgStage.setTitle("信息");
msgStage.setAlwaysOnTop(true);
CreateTableOperation.create();
try {
con = DBConnectionUtil.dbConn("infodba", "infodba");
String sqlString = "select * from JD2_Component";
if (con == null) {
Alert alert = new Alert(AlertType.ERROR, "连接失败");
alert.show();
msgContent.setText("连接失败");
msgStage.show();
} else {
ps = con.prepareStatement(sqlString);
rs = ps.executeQuery();
@ -118,7 +149,9 @@ public class CSXWHDialog extends Application {
TableColumn<ComponentBean, String> type0 = new TableColumn<ComponentBean, String>("部品类型");
type0.setPrefWidth(90);
type0.setCellValueFactory(new PropertyValueFactory<>("type"));
type0.setCellFactory(TextFieldTableCell.<ComponentBean>forTableColumn());
type0.setCellFactory((col) -> {
return new EditableStringTableCell<ComponentBean, String>();
});
type0.setOnEditCommit((CellEditEvent<ComponentBean, String> t) -> {
t.getTableView().getItems().get(t.getTablePosition().getRow()).setType(t.getNewValue());
// 如果数据本身是从数据库中取出的那么将数据状态改为2->从数据库取出但被修改了的
@ -129,7 +162,9 @@ public class CSXWHDialog extends Application {
TableColumn<ComponentBean, String> project0 = new TableColumn<ComponentBean, String>("试验项目");
project0.setPrefWidth(89);
project0.setCellValueFactory(new PropertyValueFactory<>("project"));
project0.setCellFactory(TextFieldTableCell.<ComponentBean>forTableColumn());
project0.setCellFactory((col) -> {
return new EditableStringTableCell<ComponentBean, String>();
});
project0.setOnEditCommit((CellEditEvent<ComponentBean, String> t) -> {
t.getTableView().getItems().get(t.getTablePosition().getRow()).setProject(t.getNewValue());
if (t.getTableView().getItems().get(t.getTablePosition().getRow()).getStage() == 0) {
@ -139,7 +174,9 @@ public class CSXWHDialog extends Application {
TableColumn<ComponentBean, String> time = new TableColumn<ComponentBean, String>("试验时间");
time.setPrefWidth(92);
time.setCellValueFactory(new PropertyValueFactory<>("time"));
time.setCellFactory(TextFieldTableCell.<ComponentBean>forTableColumn());
time.setCellFactory((col) -> {
return new EditableStringTableCell<ComponentBean, String>();
});
time.setOnEditCommit((CellEditEvent<ComponentBean, String> t) -> {
t.getTableView().getItems().get(t.getTablePosition().getRow()).setTime(t.getNewValue());
if (t.getTableView().getItems().get(t.getTablePosition().getRow()).getStage() == 0) {
@ -149,7 +186,9 @@ public class CSXWHDialog extends Application {
TableColumn<ComponentBean, String> number = new TableColumn<ComponentBean, String>("样品数量");
number.setPrefWidth(68);
number.setCellValueFactory(new PropertyValueFactory<>("number"));
number.setCellFactory(TextFieldTableCell.<ComponentBean>forTableColumn());
number.setCellFactory((col) -> {
return new EditableStringTableCell<ComponentBean, String>();
});
number.setOnEditCommit((CellEditEvent<ComponentBean, String> t) -> {
if (NumberUtils.isNumber(t.getNewValue())) {
t.getTableView().getItems().get(t.getTablePosition().getRow()).setNumber(t.getNewValue());
@ -159,15 +198,17 @@ public class CSXWHDialog extends Application {
}
} else {
tableView0.refresh();
Alert alert = new Alert(AlertType.ERROR, "请输入数字");
alert.show();
msgContent.setText("请输入数字");
msgStage.show();
}
});
TableColumn<ComponentBean, String> cost = new TableColumn<ComponentBean, String>("试验费用");
cost.setPrefWidth(71);
cost.setCellValueFactory(new PropertyValueFactory<>("cost"));
cost.setCellFactory(TextFieldTableCell.<ComponentBean>forTableColumn());
cost.setCellFactory((col) -> {
return new EditableStringTableCell<ComponentBean, String>();
});
cost.setOnEditCommit((CellEditEvent<ComponentBean, String> t) -> {
t.getNewValue();
if (NumberUtils.isNumber(t.getNewValue())) {
@ -285,6 +326,7 @@ public class CSXWHDialog extends Application {
}
// tableView0.refresh();
});
Button saveBtn0 = new Button("保存");
saveBtn0.setLayoutX(161.0);
saveBtn0.setLayoutY(319.0);
@ -309,13 +351,12 @@ public class CSXWHDialog extends Application {
if (com.getStage() == 2) {
update(com);
com.setStage(0);
}
}
tableView0.refresh();
} else {
Alert alert = new Alert(AlertType.ERROR, "存在某行的内容全为空,请检查");
alert.show();
msgContent.setText("存在某行的内容全为空,请检查");
msgStage.show();
}
});
@ -379,7 +420,9 @@ public class CSXWHDialog extends Application {
TableColumn<MachineBean, String> type1 = new TableColumn<MachineBean, String>("类别");
type1.setPrefWidth(110.0);
type1.setCellValueFactory(new PropertyValueFactory<>("type"));
type1.setCellFactory(TextFieldTableCell.<MachineBean>forTableColumn());
type1.setCellFactory((col) -> {
return new EditableStringTableCell<MachineBean, String>();
});
type1.setOnEditCommit((CellEditEvent<MachineBean, String> t) -> {
t.getTableView().getItems().get(t.getTablePosition().getRow()).setType(t.getNewValue());
if (t.getTableView().getItems().get(t.getTablePosition().getRow()).getStage() == 0) {
@ -389,7 +432,9 @@ public class CSXWHDialog extends Application {
TableColumn<MachineBean, String> project1 = new TableColumn<MachineBean, String>("项目");
project1.setPrefWidth(121.0);
project1.setCellValueFactory(new PropertyValueFactory<>("project"));
project1.setCellFactory(TextFieldTableCell.<MachineBean>forTableColumn());
project1.setCellFactory((col) -> {
return new EditableStringTableCell<MachineBean, String>();
});
project1.setOnEditCommit((CellEditEvent<MachineBean, String> t) -> {
t.getTableView().getItems().get(t.getTablePosition().getRow()).setProject(t.getNewValue());
if (t.getTableView().getItems().get(t.getTablePosition().getRow()).getStage() == 0) {
@ -399,7 +444,9 @@ public class CSXWHDialog extends Application {
TableColumn<MachineBean, String> cost1 = new TableColumn<MachineBean, String>("项目费用");
cost1.setPrefWidth(118.0);
cost1.setCellValueFactory(new PropertyValueFactory<>("cost"));
cost1.setCellFactory(TextFieldTableCell.<MachineBean>forTableColumn());
cost1.setCellFactory((col) -> {
return new EditableStringTableCell<MachineBean, String>();
});
cost1.setOnEditCommit((CellEditEvent<MachineBean, String> t) -> {
if (NumberUtils.isNumber(t.getNewValue())) {
t.getTableView().getItems().get(t.getTablePosition().getRow()).setCost(t.getNewValue());
@ -407,9 +454,9 @@ public class CSXWHDialog extends Application {
t.getTableView().getItems().get(t.getTablePosition().getRow()).setStage(2);
}
} else {
tableView0.refresh();
Alert alert = new Alert(AlertType.ERROR, "请输入数字");
alert.show();
tableView1.refresh();
msgContent.setText("请输入数字");
msgStage.show();
}
});
tableView1.getColumns().addAll(num1, type1, project1, cost1);
@ -530,8 +577,8 @@ public class CSXWHDialog extends Application {
}
tableView1.refresh();
} else {
Alert alert = new Alert(AlertType.ERROR, "存在某行的内容全为空,请检查");
alert.show();
msgContent.setText("存在某行的内容全为空,请检查");
msgStage.show();
}
});
@ -553,7 +600,6 @@ public class CSXWHDialog extends Application {
primaryStage.setTitle("测试项维护");
primaryStage.show();
primaryStage.setAlwaysOnTop(true);
}
public ObservableList search(String name, ObservableList list) {
@ -672,18 +718,18 @@ public class CSXWHDialog extends Application {
int rs = ps.executeUpdate();
if (rs == 1) {
System.out.println("添加成功");
Alert alert = new Alert(AlertType.INFORMATION, "添加成功");
alert.show();
msgContent.setText("添加成功");
msgStage.show();
} else {
System.out.println("添加失败");
Alert alert = new Alert(AlertType.INFORMATION, "添加失败");
alert.show();
msgContent.setText("添加失败");
msgStage.show();
}
} catch (Exception e) {
System.out.println("添加失败");
Alert alert = new Alert(AlertType.INFORMATION, "添加失败");
alert.show();
msgContent.setText("添加失败");
msgStage.show();
} finally {
if (ps != null) {
try {
@ -718,12 +764,12 @@ public class CSXWHDialog extends Application {
System.out.println(rs);
if (rs == 1) {
System.out.println("添加成功");
Alert alert = new Alert(AlertType.INFORMATION, "添加成功");
alert.show();
msgContent.setText("添加成功");
msgStage.show();
} else {
System.out.println("添加失败");
Alert alert = new Alert(AlertType.INFORMATION, "添加失败");
alert.show();
msgContent.setText("添加失败");
msgStage.show();
}
} catch (Exception e) {
@ -767,12 +813,12 @@ public class CSXWHDialog extends Application {
int rs = ps.executeUpdate();
if (rs == 1) {
System.out.println("更新成功");
Alert alert = new Alert(AlertType.INFORMATION, "更新成功");
alert.show();
msgContent.setText("更新成功");
msgStage.show();
} else {
System.out.println("更新失败");
Alert alert = new Alert(AlertType.INFORMATION, "更新失败");
alert.show();
msgContent.setText("更新失败");
msgStage.show();
}
} catch (Exception e) {
@ -801,13 +847,13 @@ public class CSXWHDialog extends Application {
ps.setInt(1, id);
int rs = ps.executeUpdate();
if (rs > 0) {
System.out.println("成功");
Alert alert = new Alert(AlertType.INFORMATION, "成功");
alert.show();
System.out.println("更新成功");
msgContent.setText("更新成功");
msgStage.show();
} else {
System.out.println("失败");
Alert alert = new Alert(AlertType.INFORMATION, "失败");
alert.show();
System.out.println("更新成功");
msgContent.setText("更新失败");
msgStage.show();
}
} catch (Exception e) {
@ -845,12 +891,12 @@ public class CSXWHDialog extends Application {
int rs = ps.executeUpdate();
if (rs == 1) {
System.out.println("更新成功");
Alert alert = new Alert(AlertType.INFORMATION, "更新成功");
alert.show();
msgContent.setText("更新成功");
msgStage.show();
} else {
System.out.println("更新失败");
Alert alert = new Alert(AlertType.ERROR, "更新失败");
alert.show();
msgContent.setText("更新失败");
msgStage.show();
}
} catch (Exception e) {
@ -872,3 +918,101 @@ public class CSXWHDialog extends Application {
}
}
}
class EditableStringTableCell<T, E> extends TableCell<T, String> {
protected TextField textField;
protected ChangeListener<? super Boolean> changeListener = (obs, ov, nv) -> {
if (!nv) {
commitEdit(textField.getText());
}
};
public EditableStringTableCell() {
}
@Override
public void startEdit() {
if (editableProperty().get()) {
if (!isEmpty()) {
super.startEdit();
createTextField();
setText(null);
setGraphic(textField);
textField.requestFocus();
}
}
}
@Override
public void cancelEdit() {
super.cancelEdit();
setText(getItem());
setGraphic(null);
}
@Override
public void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if (empty) {
setText(null);
setGraphic(null);
} else {
if (isEditing()) {
if (textField != null) {
textField.setText(getString());
textField.selectAll();
}
setText(null);
setGraphic(textField);
} else {
setText(getString());
setGraphic(null);
}
}
}
protected void createTextField() {
textField = new TextField(getString());
textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2);
textField.focusedProperty().addListener(changeListener);
textField.setOnAction(evt -> commitEdit(textField.getText()));
textField.setOnKeyPressed((ke) -> {
if (ke.getCode().equals(KeyCode.ESCAPE)) {
textField.focusedProperty().removeListener(changeListener);
cancelEdit();
}
if (ke.getCode().equals(KeyCode.TAB)) {
commitEdit(textField.getText());
}
});
}
protected String getString() {
return getItem() == null ? "" : getItem().toString();
}
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public void commitEdit(String item) {
textField.focusedProperty().removeListener(changeListener);
if (isEditing()) {
super.commitEdit(item);
} else {
final TableView table = getTableView();
if (table != null) {
TablePosition position = new TablePosition(getTableView(), getTableRow().getIndex(), getTableColumn());
CellEditEvent editEvent = new CellEditEvent(table, position, TableColumn.editCommitEvent(), item);
Event.fireEvent(getTableColumn(), editEvent);
}
updateItem(item, false);
if (table != null) {
table.edit(-1, null);
}
}
}
}

@ -32,6 +32,7 @@ import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.table.DefaultTableModel;
import com.connor.jd.plm.beans.ComponentBean;
import com.connor.jd.plm.beans.JG;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponent;
@ -653,42 +654,4 @@ public class CSJHForm extends AbstractRendering {
return form.isCheckedOut();
}
private class JG {
int row;
int times;
String jg;
public JG(int row, int times, String jg) {
super();
this.row = row;
this.times = times;
this.jg = jg;
}
public int getTimes() {
return times;
}
public void setTimes(int times) {
this.times = times;
}
public String getJg() {
return jg;
}
public void setJg(String jg) {
this.jg = jg;
}
public int getRow() {
return row;
}
public void setRow(int row) {
this.row = row;
}
}
}

@ -0,0 +1,611 @@
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.FlowLayout;
import java.awt.Font;
import java.awt.ScrollPane;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
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.DefaultCellEditor;
import javax.swing.JButton;
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.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import com.connor.jd.plm.beans.JG;
import com.connor.jd.plm.table.TCTableUtil;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.aifrcp.AIFUtility;
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.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCComponentItemType;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.stylesheet.AbstractRendering;
public class GTCSJHForm extends AbstractRendering {
private TCComponentForm form;
private Map<String, String> parentProp;
private String[] labelNames = { "项目信息:", "立项时间:", "基本型号:", "测试型号:", "产品型号:", "项目资料:", "产品经理:", "产品变更点:", "品质经理:",
"开发日程:", "开发等级:", "开发阶段:" };
private String[] labellTexts = { "jd2_xmxx", "jd2_lxsj", "jd2_jbxh", "jd2_csxh", "jd2_cpxh", "jd2_xmzl", "jd2_cpjl",
"jd2_cpbgd", "jd2_pzjl", "jd2_kfrc", "jd2_kfdj", "jd2_kfjd" };
private String[] colNames = { "jd2_no", "jd2_syxh", "jd2_symd", "jd2_wtry", "jd2_syxm", "jd2_syts", "jd2_syzq",
"jd2_syfy", "jd2_jhrc", "jd2_sjrc", "jd2_syzt", "jd2_syjg", "jd2_sycs", "jd2_syry", "jd2_csbg", "jd2_bz" };
private String[] colDisplayNames = new String[] { "realNo", "NO", "试验型号", "试验目的", "委托人员", "试验项目", "试验台数", "试验周期",
"试验费用", "计划日程", "实际日程", "试验状态", "实验结果", "第_次试验", "实验人员", "测试报告", "备注" };
private List<Integer> disableRows = new ArrayList<Integer>();
private List<Integer> disableColumns = Arrays.asList(4, 5, 6, 7, 8, 13, 15);
private Map<String, JG> resultMap = new HashMap<String, JG>();
private JTable table;
private DefaultTableModel model;
private TCComponentItemRevision rev;
private TCSession session;
private JLabel cost;
private JLabel jg;
public GTCSJHForm(TCComponent arg0) throws Exception {
super(arg0);
if (arg0 instanceof TCComponentForm) {
this.form = (TCComponentForm) arg0;
this.session = (TCSession) AIFUtility.getCurrentApplication().getSession();
loadRendering();
}
}
@Override
public void loadRendering() throws TCException {
AIFComponentContext[] contexts = form.whereReferenced();
for (int i = 0; i < contexts.length; i++) {
if (contexts[i].getComponent() instanceof TCComponentItemRevision) {
try {
rev = (TCComponentItemRevision) contexts[i].getComponent();
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
// TODO Auto-generated method stub
this.setLayout(new BorderLayout());
JPanel root = new JPanel(new BorderLayout());
JPanel top = new JPanel(new FlowLayout(FlowLayout.CENTER));
JPanel inner = new JPanel();
JPanel innerTop = new JPanel();
JPanel innerCenter = new JPanel(new BorderLayout());
root.setPreferredSize(new Dimension(1000, 500));
inner.setLayout(null);
inner.setPreferredSize(new Dimension(1000, 420));
innerTop.setLayout(null);
innerTop.setPreferredSize(new Dimension(880, 100));
innerTop.setBorder(BorderFactory.createLineBorder(Color.black));
innerTop.setBounds(10, 0, 880, 100);
innerCenter.setPreferredSize(new Dimension(880, 300));
innerCenter.setBorder(BorderFactory.createLineBorder(Color.black));
innerCenter.setBounds(10, 120, 880, 300);
JLabel title = new JLabel();
AIFComponentContext[] aif = form.whereReferenced();
for (AIFComponentContext a : aif) {
if ("JD2_GTXPXMCSJHRevision".equals(a.getComponent().getType())) {
try {
title.setText(a.getComponent().getProperty("object_name"));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
break;
}
}
title.setFont(new Font("宋体", Font.PLAIN, 24));
top.add(title);
JLabel[] infoText = new JLabel[13];
JLabel[] infoValue = new JLabel[12];
infoText[0] = new JLabel("基本信息:");
infoText[0].setBounds(10, 0, 80, 25);
for (int i = 1; i < 13; i++) {
infoText[i] = new JLabel(labelNames[i - 1]);
// infoValue[i - 1] = new JLabel(labellTexts[i - 1]);
infoValue[i - 1] = new JLabel();
}
for (int i = 1; i < 7; i++) {
infoText[i].setBounds(25 * i + 120 * (i - 1), 30, 60, 25);
infoValue[i - 1].setBounds(85 * i + 60 * (i - 1), 30, 60, 25);
infoText[i + 6].setBounds(25 * i + 120 * (i - 1), 60, 60, 25);
infoValue[i + 5].setBounds(85 * i + 60 * (i - 1), 60, 60, 25);
}
innerTop.add(infoText[0]);
for (int i = 0; i < 12; i++) {
innerTop.add(infoText[i + 1]);
innerTop.add(infoValue[i]);
}
model = new DefaultTableModel(colDisplayNames, 0) {
@Override
public boolean isCellEditable(int paramInt1, int paramInt2) {
// TODO Auto-generated method stub
if (disableRows.contains(paramInt1) || disableColumns.contains(paramInt2)) {
return false;
}
return true;
}
};
JComboBox<String> status = new JComboBox<String>();
status.addItem("待测");
status.addItem("进行中");
status.addItem("完成");
DefaultCellEditor dce1 = new DefaultCellEditor(status) {
int row;
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row,
int column) {
this.row = row;
return super.getTableCellEditorComponent(table, value, isSelected, row, column);
}
@Override
public Object getCellEditorValue() {
Object obj = super.getCellEditorValue();
if ("完成".equals(obj == null ? "" : obj.toString())) {
disableRows.add(row);
}
return obj;
}
};
JComboBox<String> result = new JComboBox<String>();
result.addItem("合格");
result.addItem("不合格");
DefaultCellEditor dce2 = new DefaultCellEditor(result) {
JTable table;
int row;
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row,
int column) {
this.table = table;
this.row = row;
return super.getTableCellEditorComponent(table, value, isSelected, row, column);
}
@Override
public Object getCellEditorValue() {
Object obj = super.getCellEditorValue();
String res = (obj == null ? "" : obj.toString());
String no = table.getValueAt(row, 0).toString();
Object temp;
int times = Integer.parseInt((temp = table.getValueAt(row, 13)) == null ? "0" : temp.toString().trim());
addResult(no, row, times, res);
jg.setText(getResult());
return obj;
}
};
table = new JTable(model);
TableColumn tc = table.getColumnModel().getColumn(0);
for (int i = 1; i < table.getColumnCount(); i++) {
table.getColumnModel().getColumn(i).setMinWidth(100);
}
hiddenColumn(table, 0);
table.getColumnModel().getColumn(11).setCellEditor(dce1);
table.getColumnModel().getColumn(12).setCellEditor(dce2);
table.setRowHeight(25);
table.setAutoscrolls(true);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
JScrollPane jsp = new JScrollPane(table);
jsp.setAutoscrolls(true);
innerCenter.add(jsp, BorderLayout.CENTER);
JButton test = new JButton("<html>测试报告<br>上传</html>");
JButton collect = new JButton("<html>汇总结论<br>上传</html>");
JButton again = new JButton("再次试验");
test.setBounds(900, 120, 100, 50);
collect.setBounds(900, 175, 100, 50);
again.setBounds(900, 230, 100, 25);
test.addActionListener(test());
collect.addActionListener(collect());
again.addActionListener(again());
inner.add(test);
inner.add(collect);
inner.add(again);
JLabel label1 = new JLabel("试验费用总计:");
JLabel label2 = new JLabel("结论:");
cost = new JLabel();
jg = new JLabel();
label1.setBounds(300, 470, 120, 25);
cost.setBounds(420, 470, 50, 25);
label2.setBounds(480, 470, 50, 25);
jg.setBounds(530, 470, 60, 25);
root.add(label1);
root.add(label2);
root.add(cost);
root.add(jg);
// 获取信息
AIFComponentContext[] aifs = form.whereReferenced();
String temp;
for (AIFComponentContext a1 : aifs) {
System.out.println("测试计划版本:" + (temp = a1.getComponent().getType()));
if ("JD2_GTXPXMCSJHRevision".equals(temp)) {
TCComponentItemRevision rev = (TCComponentItemRevision) a1.getComponent();
AIFComponentContext[] aifs2 = rev.getItem().whereReferenced();
for (AIFComponentContext a2 : aifs2) {
System.out.println("新品测试项目清单版本:" + (temp = a2.getComponent().getType()));
if ("JD2_GTXPCSXQDRevision".equals(temp)) {
TCComponentItemRevision rev2 = (TCComponentItemRevision) a2.getComponent();
TCComponentForm parent = (TCComponentForm) rev2.getRelatedComponents("IMAN_master_form_rev")[0];
parentProp = parent.getProperties();
}
}
}
}
if (parentProp != null) {
for (int i = 0; i < labellTexts.length; i++) {
if (parentProp.containsKey(labellTexts[i])) {
String str = parentProp.get(labellTexts[i]);
if ("".equals(str)) {
infoValue[i].setText(str);
}
} else {
System.out.println("属性\"" + labellTexts[i] + "\"不存在");
}
}
}
String[][] data = TCTableUtil.getTableRows(form, "jd2_csjhtable", colNames);
// colNames = { "jd2_no", "jd2_syxh", "jd2_symd", "jd2_wtry", "jd2_syxm", "jd2_syts", "jd2_syzq",
// "jd2_syfy", "jd2_jhrc", "jd2_sjrc", "jd2_syzt", "jd2_syjg", "jd2_sycs", "jd2_syry", "jd2_csbg", "jd2_bz" };
// colDisplayNames = new String[] { "realNo", "NO", "试验型号", "试验目的", "委托人员", "试验项目", "试验台数", "试验周期",
// "试验费用", "计划日程", "实际日程", "试验状态", "实验结果", "第_次试验", "实验人员", "测试报告", "备注" };
System.out.println(Arrays.deepToString(data));
System.out.println(data.length);
double sum = 0;
for (int i = 0; i < data.length; i++) {
String[] rowData = new String[17];
rowData[0] = data[i][0];
rowData[1] = i + 1 + "";
for (int ii = 1; ii < colNames.length; ii++) {
rowData[ii + 1] = data[i][ii];
}
Arrays.toString(rowData);
model.addRow(rowData);
if ("完成".equals(data[i][10])) {
disableRows.add(i);
}
sum += Double.parseDouble(data[i][7]);
addResult(data[i][0], i, Integer.parseInt(data[i][12]), data[i][11]);
}
table.revalidate();
table.repaint();
cost.setText(sum + "");
jg.setText(getResult());
inner.add(innerTop);
inner.add(innerCenter);
root.add(top, BorderLayout.NORTH);
root.add(inner, BorderLayout.CENTER);
ScrollPane sc = new ScrollPane();
sc.add(root);
this.add(sc, BorderLayout.CENTER);
}
@Override
public void saveRendering() {
// TODO Auto-generated method stub
String[][] data = new String[0][];
List<String[]> dataList = new ArrayList<String[]>();
Object obj;
for (int i = 0; i < table.getRowCount(); i++) {
String[] rowData = new String[colNames.length];
for (int ii = 0; ii < colNames.length; ii++) {
rowData[ii] = (obj = table.getValueAt(i, ii > 0 ? ii + 1 : ii)) == null ? "" : obj.toString();
}
dataList.add(rowData);
}
data = dataList.toArray(new String[dataList.size()][]);
TCTableUtil.setTableRows(form, "jd2_csjhtable", "JD2_CSJHTABLE", colNames, data);
}
private ActionListener test() {
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle("选择上传的测试报告");
FileFilter filter = new FileNameExtensionFilter("Excel工作簿(.xlsx)", "xlsx");
chooser.setFileFilter(filter);
chooser.showOpenDialog(null);
File file = chooser.getSelectedFile();
if (file != null) {
String filePath = file.getPath();
String fileName = file.getName();
String filename = fileName.substring(0, fileName.lastIndexOf("."));
System.out.println(filePath);
System.out.println(fileName);
int row = table.getSelectedRow();
String value = model.getValueAt(row, 14) == null ? "" : model.getValueAt(row, 14).toString();
if (value.equals("")) {
try {
TCComponentItemType itemtype = (TCComponentItemType) session.getTypeComponent("JD2_GTCSBG");
String itemId = itemtype.getNewID();
String itemRev = itemtype.getNewRev(null);
TCComponentItem item = itemtype.create(itemId, itemRev, "JD2_GTCSBG", fileName, "描述", null);
rev.add("JD2_CSBG", item);
TCComponentDatasetType datasetType = (TCComponentDatasetType) session
.getTypeComponent("Dataset");
String msType = "";
if (filePath.endsWith(".xls")) {
msType = "MSExcel";
} else if (filePath.endsWith(".xlsx") || filePath.endsWith(".xlsm")) {
msType = "MSExcelX";
}
TCComponentDataset datasetMSExcelX = datasetType.create(filename, "", msType);
datasetMSExcelX.setFiles(new String[] { filePath }, new String[] { "excel" });// 两参文件路径命名应用text
item.getLatestItemRevision().add("IMAN_specification", datasetMSExcelX);
model.setValueAt(item.getProperty("current_id"), row, 15);
} catch (TCException e1) {
e1.printStackTrace();
}
} else {
// 添加到数据集
boolean exist = false;
try {
TCComponent[] tcc = rev.getTCProperty("JD2_CSBG").getReferenceValueArray();
for (int i = 0; i < tcc.length; i++) {
if (value.equals(tcc[i].getProperty("current_id"))) {
exist = true;
TCComponentItem item = (TCComponentItem) tcc[i];
TCComponent[] tccitem = item.getLatestItemRevision()
.getTCProperty("IMAN_specification").getReferenceValueArray();
TCComponentDataset dataset = (TCComponentDataset) tccitem[0];
dataset.setFiles(new String[] { file.getPath() }, new String[] { "excel" });
dataset.setProperty("object_name", filename);
item.setProperty("object_name", filename);
item.getLatestItemRevision().setProperty("object_name", filename);
}
}
if (!exist) {
try {
TCComponentItemType itemtype = (TCComponentItemType) session
.getTypeComponent("JD2_GTCSBG");
String itemId = itemtype.getNewID();
String itemRev = itemtype.getNewRev(null);
TCComponentItem item = itemtype.create(itemId, itemRev, "JD2_GTCSBG", fileName,
"描述", null);
rev.add("JD2_CSBG", item);
TCComponentDatasetType datasetType = (TCComponentDatasetType) session
.getTypeComponent("Dataset");
String msType = "";
if (filePath.endsWith(".xls")) {
msType = "MSExcel";
} else if (filePath.endsWith(".xlsx") || filePath.endsWith(".xlsm")) {
msType = "MSExcelX";
}
TCComponentDataset datasetMSExcelX = datasetType.create(filename, "", msType);
datasetMSExcelX.setFiles(new String[] { filePath }, new String[] { "excel" });// 两参文件路径命名应用text
item.getLatestItemRevision().add("IMAN_specification", datasetMSExcelX);
model.setValueAt(item.getProperty("current_id"), row, 15);
} catch (TCException e1) {
e1.printStackTrace();
}
}
} catch (TCException e1) {
e1.printStackTrace();
}
}
}
}
};
}
private ActionListener collect() {
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
int row = table.getSelectedRow();
String value = (String) model.getValueAt(row, 15);
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle("选择上传的汇总结论");
FileFilter filter = new FileNameExtensionFilter("Excel工作簿(.xlsx)", "xlsx");// 设置文件过滤器只列出JPG或GIF格式的图片
chooser.setFileFilter(filter);
chooser.showOpenDialog(null);
File file = chooser.getSelectedFile();
if (file != null) {
String filePath = file.getPath();
String fileName = file.getName();
String filename = fileName.substring(0, fileName.lastIndexOf("."));
System.out.println(filePath);
System.out.println(fileName);
if (value.equals("")) {
try {
TCComponentItemType itemtype = (TCComponentItemType) session.getTypeComponent("JD2_GTCSBG");
String itemId = itemtype.getNewID();
String itemRev = itemtype.getNewRev(null);
TCComponentItem item = itemtype.create(itemId, itemRev, "JD2_GTCSBG", fileName, "描述", null);
rev.add("JD2_CSBGHZ", item);
TCComponentDatasetType datasetType = (TCComponentDatasetType) session
.getTypeComponent("Dataset");
String msType = "";
if (filePath.endsWith(".xls")) {
msType = "MSExcel";
} else if (filePath.endsWith(".xlsx") || filePath.endsWith(".xlsm")) {
msType = "MSExcelX";
}
TCComponentDataset datasetMSExcelX = datasetType.create(filename, "", msType);
datasetMSExcelX.setFiles(new String[] { filePath }, new String[] { "excel" });// 两参文件路径命名应用text
item.getLatestItemRevision().add("IMAN_specification", datasetMSExcelX);
} catch (TCException e1) {
e1.printStackTrace();
}
} else {
// 添加到数据集
boolean exist = false;
try {
TCComponent[] tcc = rev.getTCProperty("JD2_CSBGHZ").getReferenceValueArray();
for (int i = 0; i < tcc.length; i++) {
if (value.equals(tcc[i].getProperty("current_id"))) {
exist = true;
TCComponentItem item = (TCComponentItem) tcc[i];
TCComponent[] tccitem = item.getLatestItemRevision()
.getTCProperty("IMAN_specification").getReferenceValueArray();
TCComponentDataset dataset = (TCComponentDataset) tccitem[0];
dataset.setFiles(new String[] { file.getPath() }, new String[] { "excel" });
dataset.setProperty("object_name", filename);
item.setProperty("object_name", filename);
item.getLatestItemRevision().setProperty("object_name", filename);
}
}
if (!exist) {
try {
TCComponentItemType itemtype = (TCComponentItemType) session
.getTypeComponent("JD2_GTCSBG");
String itemId = itemtype.getNewID();
String itemRev = itemtype.getNewRev(null);
TCComponentItem item = itemtype.create(itemId, itemRev, "JD2_GTCSBG", fileName,
"描述", null);
rev.add("JD2_CSBGHZ", item);
TCComponentDatasetType datasetType = (TCComponentDatasetType) session
.getTypeComponent("Dataset");
String msType = "";
if (filePath.endsWith(".xls")) {
msType = "MSExcel";
} else if (filePath.endsWith(".xlsx") || filePath.endsWith(".xlsm")) {
msType = "MSExcelX";
}
TCComponentDataset datasetMSExcelX = datasetType.create(filename, "", msType);
datasetMSExcelX.setFiles(new String[] { filePath }, new String[] { "excel" });// 两参文件路径命名应用text
item.getLatestItemRevision().add("IMAN_specification", datasetMSExcelX);
} catch (TCException e1) {
e1.printStackTrace();
}
}
} catch (TCException e1) {
e1.printStackTrace();
}
}
}
}
};
}
private ActionListener again() {
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
int row = table.getSelectedRow();
Object obj;
// "realNo", "NO", "试验型号", "试验目的", "委托人员", "试验项目", "试验台数", "试验周期",
// "试验费用", "计划日程", "实际日程", "试验状态", "实验结果", "第_次试验", "实验人员", "测试报告", "备注"
if (row != -1) {
String realNum = (obj = table.getValueAt(row, 0)) == null ? "0" : obj.toString();
int num = Integer.parseInt((obj = table.getValueAt(row, 1)) == null ? "0" : obj.toString());
String[] rowData = new String[table.getColumnCount()];
rowData[0] = realNum;
rowData[1] = num + 1 + "";
for (int i = 2; i < 9; i++) {
rowData[i] = (obj = table.getValueAt(row, i)) == null ? "" : obj.toString();
}
num = Integer.parseInt((obj = table.getValueAt(row, 13)) == null ? "0" : obj.toString());
rowData[13] = num + 1 + "";
rowData[16] = (obj = table.getValueAt(row, 16)) == null ? "" : obj.toString();
disableRows.add(row);
model.insertRow(row + 1, rowData);
table.revalidate();
table.repaint();
cost.setText(getCost() + "");
}
}
};
}
private void hiddenColumn(JTable table, int columnIndex) {
TableColumnModel tcm = table.getColumnModel();
TableColumn tc = tcm.getColumn(columnIndex);
// tc.setResizable(false);
tc.setWidth(0);
tc.setPreferredWidth(0);
tc.setMaxWidth(0);
tc.setMinWidth(0);
table.getTableHeader().getColumnModel().getColumn(columnIndex).setMaxWidth(0);
table.getTableHeader().getColumnModel().getColumn(columnIndex).setMinWidth(0);
}
private double getCost() {
double sum = 0;
Object obj;
for (int i = 0; i < table.getRowCount(); i++) {
double num = Double.parseDouble((obj = table.getValueAt(i, 8)) == null ? "0" : obj.toString());
sum += num;
}
return sum;
}
private void addResult(String realNo, int row, int times, String result) {
if (resultMap.containsKey(realNo)) {
if (times >= resultMap.get(realNo).getTimes()) {
disableRows.add(resultMap.get(realNo).getRow());
resultMap.put(realNo, new JG(row, times, result));
}
} else {
resultMap.put(realNo, new JG(row, times, result));
}
}
private String getResult() {
for (Entry<String, JG> entry : resultMap.entrySet()) {
System.out.println("realNo:" + entry.getKey() + "row:" + entry.getValue().getRow() + "jg:"
+ entry.getValue().getJg() + "times:" + entry.getValue().getTimes());
if ("不合格".equals(entry.getValue().getJg())) {
return "不合格";
}
}
return "合格";
}
@Override
public boolean isRenderingModified() {
// TODO Auto-generated method stub
return form.isCheckedOut();
}
}

@ -4,22 +4,50 @@ import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
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.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import javax.swing.BorderFactory;
import javax.swing.DefaultCellEditor;
import javax.swing.JButton;
import javax.swing.JLabel;
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.ModelList;
import com.connor.jd.plm.table.ModelValue;
import com.connor.jd.plm.table.TCTableUtil;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentForm;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCComponentItemType;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.stylesheet.AbstractRendering;
import com.teamcenter.rac.util.MessageBox;
import cn.hutool.db.Db;
import cn.hutool.db.Entity;
public class NewProductTestForm extends AbstractRendering {
private TCComponentForm form;
@ -28,15 +56,23 @@ public class NewProductTestForm extends AbstractRendering {
private CTable table1;
private CTable table2;
private Map<String, String> prop;
private List<String> disableEdit;
private List<String> disableEdit2;
private Map<String, int[]> general;
private Map<String, int[]> general2;
private ModelList modelList1;
private ModelList modelList2;
private List<Entity> dbData = new ArrayList<Entity>();
private JPopupMenu menu = new JPopupMenu();
private JMenuItem addR;
private String[][] data = new String[0][];
private String[] colNames = { "jd2_no", "jd2_lb", "jd2_xm", "jd2_xmfy", "jd2_DV", "jd2_PV", "jd2_PR", "jd2_SR",
"jd2_bz" };
private String[] colNames2 = { "jd2_no", "jd2_wtry", "jd2_syxm", "jd2_syts", "jd2_syfy", "jd2_sycs" };
private String[] jieduan = { "DV", "PV", "PR", "SR" };
private TCSession session;
public NewProductTestForm(TCComponent arg0) throws Exception {
super(arg0);
if (arg0 instanceof TCComponentForm) {
this.form = (TCComponentForm) arg0;
this.session = (TCSession) AIFUtility.getCurrentApplication().getSession();
loadRendering();
}
}
@ -48,57 +84,38 @@ public class NewProductTestForm extends AbstractRendering {
root.setPreferredSize(new Dimension(800, 500));
JPanel inner = new JPanel(new BorderLayout());
JPanel top = new JPanel(new FlowLayout(FlowLayout.CENTER));
JLabel title = new JLabel("新品项目测试单");
inner.add(title, BorderLayout.NORTH);
title.setFont(new Font("宋体", Font.PLAIN, 24));
top.add(title);
inner.add(top, BorderLayout.NORTH);
prop = form.getProperties();
// 初始化表格
model1 = new CTMap(6, 4);
model1.setValueAt("项目信息:", 0, 0);
disableEdit.add("0,0");
model1.setValueAt("项目信息:", 0, 2);
disableEdit.add("0,2");
model1.setValueAt("项目信息:", 1, 0);
disableEdit.add("1,0");
model1.setValueAt("项目信息:", 1, 2);
disableEdit.add("1,2");
model1.setValueAt("项目信息:", 2, 0);
disableEdit.add("2,0");
model1.setValueAt("项目信息:", 2, 2);
disableEdit.add("2,2");
model1.setValueAt("项目信息:", 3, 0);
disableEdit.add("3,0");
model1.setValueAt("项目信息:", 3, 2);
disableEdit.add("3,2");
model1.setValueAt("项目信息:", 4, 0);
disableEdit.add("4,0");
model1.setValueAt("项目信息:", 4, 2);
disableEdit.add("4,2");
model1.setValueAt("项目信息:", 5, 0);
disableEdit.add("5,0");
model1.setValueAt("项目信息:", 5, 2);
disableEdit.add("5,2");
general.put("jd2_xmxx", new int[] { 0, 1 });
general.put("jd2_lxsj", new int[] { 0, 3 });
general.put("jd2_jbxh", new int[] { 1, 1 });
general.put("jd2_csxh", new int[] { 1, 3 });
general.put("jd2_cpxh", new int[] { 2, 1 });
general.put("jd2_xmzl", new int[] { 2, 3 });
general.put("jd2_cpjl", new int[] { 3, 1 });
general.put("jd2_cpbgd", new int[] { 3, 3 });
general.put("jd2_pzjl", new int[] { 4, 1 });
general.put("jd2_kfrc", new int[] { 4, 3 });
general.put("jd2_kfdj", new int[] { 5, 1 });
general.put("jd2_kfjd", new int[] { 5, 3 });
modelList1 = new ModelList();
String[] textArr1 = { "项目信息:", "立项时间:", "基本型号:", "测试型号:", "产品型号:", "项目资料:", "产品经理:", "产品变更点:", "品质经理:", "开发日程:",
"开发等级:", "开发阶段:" };
int[][] textLocation1 = { { 0, 0 }, { 0, 2 }, { 1, 0 }, { 1, 2 }, { 2, 0 }, { 2, 2 }, { 3, 0 }, { 3, 2 },
{ 4, 0 }, { 4, 2 }, { 5, 0 }, { 5, 2 } };
for (int i = 0; i < textArr1.length; i++) {
modelList1.add(new ModelValue(textArr1[i], false, textLocation1[i][0], textLocation1[i][1], false));
}
String[] propArr = { "jd2_xmxx", "jd2_lxsj", "jd2_jbxh", "jd2_csxh", "jd2_cpxh", "jd2_xmzl", "jd2_cpjl",
"jd2_cpbgd", "jd2_pzjl", "jd2_kfrc", "jd2_kfdj", "jd2_kfjd" };
int[][] propLocation1 = { { 0, 1 }, { 0, 3 }, { 1, 1 }, { 1, 3 }, { 2, 1 }, { 2, 3 }, { 3, 1 }, { 3, 3 },
{ 4, 1 }, { 4, 3 }, { 5, 1 }, { 5, 3 } };
for (int i = 0; i < propArr.length; i++) {
modelList1.add(new ModelValue(propArr[i], true, propLocation1[0][1], propLocation1[0][1], true));
}
initModel(model1, modelList1);
table1 = new CTable(model1) {
@Override
public boolean isCellEditable(int row, int col) {
if (isEditorDisable(disableEdit, row, col)) {
return false;
}
return true;
return !modelList1.isDisableEdit(row, col);
}
};
@ -116,10 +133,6 @@ public class NewProductTestForm extends AbstractRendering {
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));
@ -147,16 +160,470 @@ public class NewProductTestForm extends AbstractRendering {
table1.setDefaultRenderer(Object.class, tcr1);
inner.add(table1, BorderLayout.CENTER);
model2 = new CTMap(131, 9);
modelList2 = new ModelList();
modelList2.add(new ModelValue("NO", false, 0, 0, false, 0, 1, 0, 0));
modelList2.add(new ModelValue("类别", false, 0, 1, false, 0, 1, 1, 1));
modelList2.add(new ModelValue("项目", false, 0, 2, false, 0, 1, 2, 2));
modelList2.add(new ModelValue("项目费用", false, 0, 3, false, 0, 1, 3, 3));
modelList2.add(new ModelValue("项目阶段", false, 0, 4, false, 0, 0, 4, 7));
modelList2.add(new ModelValue("DV", false, 1, 4, false));
modelList2.add(new ModelValue("PV", false, 1, 5, false));
modelList2.add(new ModelValue("PR", false, 1, 6, false));
modelList2.add(new ModelValue("SR", false, 1, 7, false));
modelList2.add(new ModelValue("备注", false, 0, 8, false, 0, 1, 8, 8));
String type = null;
int typeSpan = 0;
data = TCTableUtil.getTableRows(form, "jd2_xpcsxqd", colNames);
if (data.length == 0) {
try {
dbData = Db.use().query("select * from JD2_Machine ORDER BY TEST_TYPE ASC");
model2 = new CTMap(dbData.size() + 3, 9);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
for (int i = 0; i < dbData.size(); i++) {
System.out.println(dbData.get(i).toString());
modelList2.add(new ModelValue(dbData.get(i).getStr("TEST_PROJECT"), false, i + 2, 2, false));
modelList2.add(new ModelValue(dbData.get(i).getInt("TEST_COST") + "", false, i + 2, 3, false));
if (i == 0) {
type = dbData.get(i).getStr("TEST_TYPE");
}
if ((type != null && !type.equals(dbData.get(i).getStr("TEST_TYPE")))) {
System.out.println(type);
modelList2.add(
new ModelValue(type, false, i - typeSpan + 2, 1, false, i - typeSpan + 2, i + 1, 1, 1));
type = dbData.get(i).getStr("TEST_TYPE");
typeSpan = 0;
}
if ((i == dbData.size() - 1)) {
System.out.println(type);
modelList2.add(
new ModelValue(type, false, i - typeSpan + 2, 1, false, i - typeSpan + 2, i + 2, 1, 1));
}
model2.setValueAt(i + 1, i + 2, 0);
for (int ii = 4; ii < 8; ii++) {
model2.setValueAt("/", i + 2, ii);
}
typeSpan++;
}
} else {
model2 = new CTMap(data.length + 3, 9);
for (int i = 0; i < data.length; i++) {
System.out.println(Arrays.toString(data[i]));
modelList2.add(new ModelValue(data[i][2], false, i + 2, 2, false));
modelList2.add(new ModelValue(data[i][3], false, i + 2, 3, false));
if (i == 0) {
type = data[i][1];
}
if ((type != null && !type.equals(data[i][1]))) {
System.out.println(type);
modelList2.add(
new ModelValue(type, false, i - typeSpan + 2, 1, false, i - typeSpan + 2, i + 1, 1, 1));
type = data[i][1];
typeSpan = 0;
}
if ((i == data.length - 1)) {
System.out.println(type);
modelList2.add(
new ModelValue(type, false, i - typeSpan + 2, 1, false, i - typeSpan + 2, i + 2, 1, 1));
}
model2.setValueAt(i + 1, i + 2, 0);
for (int ii = 4; ii < 9; ii++) {
model2.setValueAt(data[i][ii], i + 2, ii);
}
typeSpan++;
}
}
int buttom = data.length == 0 ? dbData.size() + 2 : data.length + 2;
modelList2.add(new ModelValue("项目费用合计", false, buttom, 0, false, buttom, buttom, 0, 2));
modelList2.add(new ModelValue("jd2_zfy", true, buttom, 3, false));
modelList2.add(new ModelValue("jd2_dvfy", true, buttom, 4, false));
modelList2.add(new ModelValue("jd2_pvfy", true, buttom, 5, false));
modelList2.add(new ModelValue("jd2_prfy", true, buttom, 6, false));
modelList2.add(new ModelValue("jd2_srfy", true, buttom, 7, false));
initModel(model2, modelList2);
table2 = new CTable(model2) {
@Override
public boolean isCellEditable(int row, int col) {
if (modelList2.isDisableEdit(row, col) || col == 0 || row == table2.getRowCount() - 1) {
return false;
}
return true;
}
};
table2.setRowHeight(25);
table2.setBorder(BorderFactory.createLineBorder(Color.black));
table2.getColumnModel().getColumn(0).setPreferredWidth(100);
table2.getColumnModel().getColumn(1).setPreferredWidth(60);
table2.getColumnModel().getColumn(2).setPreferredWidth(80);
table2.getColumnModel().getColumn(3).setPreferredWidth(60);
table2.getColumnModel().getColumn(4).setPreferredWidth(50);
table2.getColumnModel().getColumn(5).setPreferredWidth(50);
table2.getColumnModel().getColumn(6).setPreferredWidth(50);
table2.getColumnModel().getColumn(7).setPreferredWidth(50);
table2.getColumnModel().getColumn(8).setPreferredWidth(60);
DefaultTableCellRenderer tcr2 = new DefaultTableCellRenderer() {
// 重写方法
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column) {
// TODO Auto-generated method stub
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;
}
};
DefaultCellEditor dce = new DefaultCellEditor(new JTextField()) {
JTable table;
int row;
int col;
@Override
public Component getTableCellEditorComponent(JTable paramJTable, Object paramObject, boolean paramBoolean,
int paramInt1, int paramInt2) {
this.table = paramJTable;
this.row = paramInt1;
this.col = paramInt2;
return super.getTableCellEditorComponent(paramJTable, paramObject, paramBoolean, paramInt1, paramInt2);
}
@Override
public Object getCellEditorValue() {
Object obj = super.getCellEditorValue();
if (obj != null) {
String objStr = obj.toString().trim();
try {
if ("/".equals(objStr)) {
objStr = "0";
}
int num = Integer.parseInt(objStr);
if (num < 0) {
System.out.println("计算区域只能输入自然数或\"/\"");
MessageBox.post("计算区域只能输入自然数或\"/\"", "错误", MessageBox.ERROR);
return "/";
}
int sum = 0;
Object sumObj;
for (int i = 2; i < row; i++) {
sumObj = table.getValueAt(i, col);
if (sumObj != null && !"/".equals(sumObj.toString().trim())) {
sum += Double.parseDouble(
(sumObj = table.getValueAt(i, 3)) == null ? "0" : sumObj.toString().trim());
}
}
if (!"0".equals(objStr)) {
sum += Double.parseDouble(
(sumObj = table.getValueAt(row, 3)) == null ? "0" : sumObj.toString().trim());
}
for (int i = row + 1; i < table.getRowCount() - 1; i++) {
sumObj = table.getValueAt(i, col);
if (sumObj != null && !"/".equals(sumObj.toString().trim())) {
sum += Double.parseDouble(
(sumObj = table.getValueAt(i, 3)) == null ? "0" : sumObj.toString().trim());
}
}
table.setValueAt(sum, table.getRowCount() - 1, col);
double sum1 = Double
.parseDouble((sumObj = table.getValueAt(table.getRowCount() - 1, 4)) == null ? "0"
: sumObj.toString().trim());
double sum2 = Double
.parseDouble((sumObj = table.getValueAt(table.getRowCount() - 1, 5)) == null ? "0"
: sumObj.toString().trim());
double sum3 = Double
.parseDouble((sumObj = table.getValueAt(table.getRowCount() - 1, 6)) == null ? "0"
: sumObj.toString().trim());
double sum4 = Double
.parseDouble((sumObj = table.getValueAt(table.getRowCount() - 1, 7)) == null ? "0"
: sumObj.toString().trim());
table.setValueAt(sum1 + sum2 + sum3 + sum4, table.getRowCount() - 1, 3);
table2.revalidate();
table2.repaint();
} catch (NumberFormatException e1) {
System.out.println("计算区域只能输入自然数或\"/\"");
MessageBox.post("计算区域只能输入自然数或\"/\"", "错误", MessageBox.ERROR);
obj = "/";
} catch (Exception e2) {
e2.printStackTrace();
obj = "/";
}
}
if ("0".equals(obj.toString().trim())) {
obj = "/";
}
return obj;
}
};
tcr2.setHorizontalAlignment(SwingConstants.CENTER);
table2.getColumnModel().getColumn(4).setCellEditor(dce);
table2.getColumnModel().getColumn(5).setCellEditor(dce);
table2.getColumnModel().getColumn(6).setCellEditor(dce);
table2.getColumnModel().getColumn(7).setCellEditor(dce);
table2.setAutoResizeMode(CTable.AUTO_RESIZE_NEXT_COLUMN);
table2.setDefaultRenderer(Object.class, tcr2);
table2.addMouseListener(rightClick());
inner.add(table2, BorderLayout.SOUTH);
JPanel btns = new JPanel(new FlowLayout(FlowLayout.CENTER));
JButton create = new JButton("创建测试计划");
create.addActionListener(create());
btns.add(create);
menu.setVisible(false);
addR = new JMenuItem("新增测试项");
addR.setEnabled(false);
addR.addActionListener(addRow());
menu.add(addR);
ScrollPane sc = new ScrollPane();
sc.add(inner);
root.add(sc, BorderLayout.CENTER);
root.add(btns, BorderLayout.SOUTH);
this.add(root);
}
@Override
public void saveRendering() {
savePropValue(table1, modelList1);
savePropValue(table2, modelList2);
Object obj;
if (data.length == 0) {
if (dbData.size() == 0) {
try {
dbData = Db.use().query("select * from JD2_Machine ORDER BY TEST_TYPE ASC");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
data = new String[table2.getRowCount() - 3][9];
for (int i = 0; i < dbData.size(); i++) {
data[i][0] = (obj = model2.getValueAt(i + 2, 0)) == null ? "" : obj.toString();
data[i][1] = dbData.get(i).getStr("TEST_TYPE");
data[i][2] = dbData.get(i).getStr("TEST_PROJECT");
data[i][3] = dbData.get(i).getStr("TEST_COST");
for (int ii = 4; ii < 9; ii++) {
data[i][ii] = (obj = model2.getValueAt(i + 2, ii)) == null ? "" : obj.toString();
}
}
System.out.println("dbData.size() " + dbData.size());
System.out.println("table2.getRowCount() " + table2.getRowCount());
for (int i = dbData.size() + 2; i < table2.getRowCount() - 1; i++) {
for (int ii = 0; ii < 9; ii++) {
data[i][ii] = (obj = model2.getValueAt(i + 2, ii)) == null ? "" : obj.toString();
}
}
System.out.println(Arrays.deepToString(data));
TCTableUtil.setTableRows(form, "jd2_xpcsxqd", "JD2_XPCSXQD", colNames, data);
} else {
String[][] newData = new String[table2.getRowCount() - 3][9];
for (int i = 0; i < data.length; i++) {
System.arraycopy(data[i], 0, newData[i], 0, 4);
for (int ii = 4; ii < 9; ii++) {
newData[i][ii] = (obj = model2.getValueAt(i + 2, ii)) == null ? "" : obj.toString();
}
}
for (int i = data.length + 2; i < table2.getRowCount() - 1; i++) {
for (int ii = 0; ii < 9; ii++) {
newData[i][ii] = (obj = model2.getValueAt(i + 2, ii)) == null ? "" : obj.toString();
}
}
System.out.println(Arrays.deepToString(newData));
TCTableUtil.setTableRows(form, "jd2_xpcsxqd", "JD2_XPCSXQD", colNames, newData);
}
}
private void savePropValue(CTable table, ModelList ml) {
for (ModelValue mv : ml) {
if (mv.isProp()) {
Object obj = table.getValueAt(mv.getRow(), mv.getCol());
try {
if (prop.containsKey(mv.getValue())) {
form.setProperty(mv.getValue(), obj == null ? "" : obj.toString());
}
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
private MouseAdapter rightClick() {
return new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON3 && form.isCheckedOut() && table2.getSelectedRow() != -1) {
int row = table2.getSelectedRow();
boolean flag = (row > 1 && row < table2.getRowCount() - 1);
addR.setEnabled(flag);
menu.show(e.getComponent(), e.getX(), e.getY());
}
}
};
}
private ActionListener addRow() {
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent paramActionEvent) {
// TODO Auto-generated method stub
int row = model2.getRowCount() - 2;
int num = Integer.parseInt(model2.getValueAt(row, 0).toString());
model2.insertRow(model2.getRowCount() - 1);
model2.setValueAt(num + 1, row + 1, 0);
table2.revalidate();
table2.repaint();
}
};
}
private ActionListener create() {
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent paramActionEvent) {
// TODO Auto-generated method stub
try {
AIFComponentContext[] comps = form.whereReferenced();
StringBuilder msg = new StringBuilder();
A1: for (AIFComponentContext aif : comps) {
System.out.println("ref type:" + aif.getComponent().getType());
if ("JD2_GTXPCSXQDRevision".equals(aif.getComponent().getType())) {
TCComponentItemRevision rev = (TCComponentItemRevision) aif.getComponent();
TCComponent[] compArr = rev.getTCProperty("JD2_CSJH").getReferenceValueArray();
String exist = "";
for (TCComponent t : compArr) {
exist += t.getProperty("object_name");
}
List<String[]> colData = new ArrayList<String[]>();
String ownner = form.getTCProperty("owning_user").getUIFValue();
for (int i = 0; i < 4; i++) {
if (exist.contains(jieduan[i])) {
System.out.println("已存在阶段\"" + jieduan[i] + "\"测试计划,请检查!");
MessageBox.post("已存在阶段\"" + jieduan[i] + "\"测试计划,请检查!", "错误", MessageBox.ERROR);
break A1;
}
Object obj;
Object temp;
int rowNum = 0;
for (int ii = 2; ii < table2.getRowCount() - 1; ii++) {
obj = table2.getValueAt(ii, i + 4);
if (obj != null && !"/".equals(obj.toString().trim())) {
// colNames2 = { "jd2_no", "jd2_wtry", "jd2_syxm", "jd2_syts", "jd2_syfy",
// "jd2_sycs" };
String[] row = new String[6];
row[0] = rowNum + "";
row[1] = ownner;
row[2] = (temp = table2.getValueAt(ii, 2)) == null ? "" : temp.toString();
row[3] = obj.toString().trim();
row[4] = (temp = table2.getValueAt(ii, 3)) == null ? "0"
: temp.toString().trim();
row[5] = "1";
System.out.println(Arrays.toString(row));
colData.add(row);
rowNum++;
}
}
if (colData.size() != 0) {
TCComponentItemType type = (TCComponentItemType) session
.getTypeComponent("JD2_GTXPXMCSJH");
TCComponentItem item = type.create(null, null, "JD2_GTXPXMCSJH",
jieduan[i] + "阶段测试计划", "", null);
rev.add("JD2_CSJH", item);
TCComponentItemRevision rev1 = item.getLatestItemRevision();
TCComponentForm form1 = (TCComponentForm) rev1
.getRelatedComponents("IMAN_master_form_rev")[0];
String[][] dataArr = colData.toArray(new String[colData.size()][6]);
System.out.println(Arrays.deepToString(dataArr));
TCTableUtil.setTableRows(form1, "jd2_csjhtable", "JD2_CSJHTABLE", colNames2,
dataArr);
msg.append(jieduan[i] + "阶段测试计划创建成功\n");
}
colData.clear();
}
}
}
MessageBox.post(msg.toString(), "提示", MessageBox.WARNING);
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};
}
@Override
public boolean isRenderingModified() {
// TODO Auto-generated method stub
return form.isCheckedOut();
}
private void initModel(CTMap model, ModelList modelList) {
for (ModelValue mv : modelList) {
if (mv.isProp()) {
if (prop.containsKey(mv.getValue())) {
model.setValueAt(prop.get(mv.getValue()), mv.getRow(), mv.getCol());
} else {
System.out.println("属性‘" + mv.getValue() + "’不存在");
}
} else {
model.setValueAt(mv.getValue(), mv.getRow(), mv.getCol());
}
if (mv.isCombine()) {
model.combine(mv.getCombineRows(), mv.getCombineColumns());
}
}
}
private boolean isEditorDisable(List<String> list, int row, int col) {
return list.contains(row + "," + col);
private void saveModel(ModelList modelList) {
Object obj;
for (ModelValue mv : modelList) {
if (mv.isProp()) {
if (prop.containsKey(mv.getValue())) {
obj = table2.getValueAt(mv.getRow(), mv.getCol());
try {
form.setProperty(mv.getValue(), obj == null ? "" : obj.toString());
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
System.out.println("属性\"" + mv.getValue() + "\"不存在");
}
}
}
};
}

@ -24,6 +24,12 @@ public class CSXWHHandler extends AbstractHandler {
TCSession session = (TCSession) app.getSession();
String[] userIdList = JDMethodUtil.getPrefStrArray("JD2_CSXWH", session);
Boolean tag = true;
try {
System.out.println("当前用户id" + session.getUser().getUserId());
} catch (TCException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
for (int i = 0; i < userIdList.length; i++) {
try {
if (session.getUser().getUserId().equals(userIdList[i])) {

@ -0,0 +1,70 @@
package com.connor.jd.plm.table;
import java.util.ArrayList;
import java.util.List;
public class ModelList extends ArrayList<ModelValue> {
private List<String> disableEdit = new ArrayList<String>();
@Override
public boolean add(ModelValue e) {
// TODO Auto-generated method stub
if (!e.isEditable()) {
disableEdit.add(e.getRow() + "," + e.getCol());
}
return super.add(e);
}
public ModelValue getModelValue(int row, int col) {
for (ModelValue mv : this) {
if (mv.getRow() == row && mv.getCol() == col) {
return mv;
}
}
return null;
}
public ModelValue getModelValueInRange(int row, int col) {
int rowStart;
int colStart;
int rowEnd;
int colEnd;
for (ModelValue mv : this) {
if (mv.isCombine()) {
rowStart = mv.getCombineRows()[0];
rowEnd = rowStart + mv.getRowSpan() - 1;
colStart = mv.getCombineColumns()[0];
colEnd = colStart + mv.getColSpan() - 1;
if (row >= rowStart && row <= rowEnd && col >= colStart && col <= colEnd) {
return mv;
}
}
}
return null;
}
public boolean addDisableEdit(int row, int col) {
String str = row + "," + col;
if (disableEdit.contains(str)) {
disableEdit.add(disableEdit.indexOf(str), str);
return true;
}
disableEdit.add(str);
return false;
}
public boolean removeDisableEdit(int row, int col) {
String str = row + "," + col;
if (disableEdit.contains(str)) {
disableEdit.remove(disableEdit.indexOf(str));
return true;
}
return false;
}
public boolean isDisableEdit(int row, int col) {
return disableEdit.contains(row + "," + col);
}
}

@ -0,0 +1,163 @@
package com.connor.jd.plm.table;
import java.util.Objects;
public class ModelValue {
private String value;
private boolean isProp;
private int row;
private int col;
private boolean editable;
private int[] combineRows;
private int rowSpan;
private int[] combineColumns;
private int colSpan;
public ModelValue(String value, boolean isProp, int row, int col, boolean editable, int[] combineRows,
int[] combineColumns, String type) {
super();
this.value = value;
this.isProp = isProp;
this.row = row;
this.col = col;
this.editable = editable;
this.combineRows = combineRows;
this.combineColumns = combineColumns;
}
public ModelValue(boolean editable, int[] combineRows, int[] combineColumns) {
super();
this.editable = editable;
this.combineRows = combineRows;
this.combineColumns = combineColumns;
}
public ModelValue(String value, boolean isProp, int row, int col, boolean editable) {
super();
this.value = value;
this.isProp = isProp;
this.row = row;
this.col = col;
this.editable = editable;
}
public ModelValue(String value, boolean isProp, int row, int col, boolean editable, int[] combineRows,
int[] combineColumns) {
super();
this.value = value;
this.isProp = isProp;
this.row = row;
this.col = col;
this.editable = editable;
this.combineRows = combineRows;
this.combineColumns = combineColumns;
}
public ModelValue(String value, boolean isProp, int row, int col, boolean editable, int rowStart, int rowEnd,
int colStart, int colEnd) {
super();
this.value = value;
this.isProp = isProp;
this.row = row;
this.col = col;
this.editable = editable;
setCombineRows(rowStart, rowEnd);
setCombineColumns(colStart, colEnd);
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public int getRow() {
return row;
}
public void setRow(int row) {
this.row = row;
}
public int getCol() {
return col;
}
public void setCol(int col) {
this.col = col;
}
public boolean isEditable() {
return editable;
}
public void setEditable(boolean editable) {
this.editable = editable;
}
public int[] getCombineRows() {
return combineRows;
}
public void setCombineRows(int[] combineRows) {
this.rowSpan = combineRows.length;
this.combineRows = combineRows;
}
public void setCombineRows(int start, int end) {
if (start <= end) {
this.rowSpan = end - start + 1;
this.combineRows = new int[rowSpan];
for (int i = 0; i < rowSpan; i++) {
combineRows[i] = start + i;
}
}
}
public int[] getCombineColumns() {
return combineColumns;
}
public void setCombineColumns(int[] combineColumns) {
this.colSpan = combineColumns.length;
this.combineColumns = combineColumns;
}
public void setCombineColumns(int start, int end) {
if (start <= end) {
this.colSpan = end - start + 1;
this.combineColumns = new int[colSpan];
for (int i = 0; i < colSpan; i++) {
combineColumns[i] = start + i;
}
}
}
public int getRowSpan() {
return rowSpan;
}
public int getColSpan() {
return colSpan;
}
public boolean isProp() {
return isProp;
}
public void setProp(boolean isProp) {
this.isProp = isProp;
}
public boolean hasValue() {
return Objects.nonNull(value);
}
public boolean isCombine() {
return rowSpan != 0 && colSpan != 0;
}
}

@ -28,8 +28,12 @@ public class TCTableUtil {
}
}
return res;
} catch (NullPointerException e) {
System.out.println("属性\"" + prop + "\"不存在");
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

@ -16,6 +16,7 @@ public class DBConnectionUtil {
}
try {
c = DriverManager.getConnection("jdbc:oracle:thin:@10.20.4.75:1521:TC12", name, pass);
// c = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:TC", name, pass);
// 连接数据的方法有四种, 这个属于最简单的,一般用网页程序 TC是你的数据库实例名称在下载的文件test.sql中可以执行语句查看
// "jdbc:oracle:thin:@计算机名称:监听端口:系统实例名", username, password,
// 计算机名称,要是自己不知道可以在计算机属性查知.

@ -2,3 +2,5 @@ JD2_GTYPQRDRevisionMaster.FORMJAVARENDERING=com.connor.jd.plm.form.SampleConfirm
JD2_GTSYWTSRevisionMaster.FORMJAVARENDERING=com.connor.jd.plm.form.ExperimentalPowerOfAttorneyForm
SF6_ElecElementRevisionMaster.FORMJAVARENDERING=com.connor.jd.plm.form.CSJHForm
JD2_GTCSJHRevisionMaster.FORMJAVARENDERING=com.connor.jd.plm.form.CSJHForm
JD2_GTXPCSXQDRevisionMaster.FORMJAVARENDERING=com.connor.jd.plm.form.NewProductTestForm
JD2_GTXPXMCSJHRevisionMaster.FORMJAVARENDERING=com.connor.jd.plm.form.GTCSJHForm
Loading…
Cancel
Save