|
|
@ -66,6 +66,7 @@ import com.teamcenter.rac.kernel.TCSession;
|
|
|
|
import com.teamcenter.rac.util.MessageBox;
|
|
|
|
import com.teamcenter.rac.util.MessageBox;
|
|
|
|
import com.teamcenter.rac.util.PropertyLayout;
|
|
|
|
import com.teamcenter.rac.util.PropertyLayout;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.ListUtil;
|
|
|
|
import cn.hutool.core.util.ArrayUtil;
|
|
|
|
import cn.hutool.core.util.ArrayUtil;
|
|
|
|
|
|
|
|
|
|
|
|
public class ProcessAttriChangeDialog extends JDialog {
|
|
|
|
public class ProcessAttriChangeDialog extends JDialog {
|
|
|
@ -81,6 +82,10 @@ public class ProcessAttriChangeDialog extends JDialog {
|
|
|
|
private JButton closeBtn;
|
|
|
|
private JButton closeBtn;
|
|
|
|
private JTable impTable;
|
|
|
|
private JTable impTable;
|
|
|
|
private DefaultTableModel impModel;
|
|
|
|
private DefaultTableModel impModel;
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 属性修改面板
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private JPanel propertyPanel;
|
|
|
|
private ArrayList<TCComponentItemRevision> revlist;
|
|
|
|
private ArrayList<TCComponentItemRevision> revlist;
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 内容:[rev,object_name] 即:对象类型,对象属性
|
|
|
|
* 内容:[rev,object_name] 即:对象类型,对象属性
|
|
|
@ -120,22 +125,35 @@ public class ProcessAttriChangeDialog extends JDialog {
|
|
|
|
* @param task 任务节点
|
|
|
|
* @param task 任务节点
|
|
|
|
* @param ruleOpsMap key为列名(名称);value为一个String[]数组,String["item/rev","object_name"]
|
|
|
|
* @param ruleOpsMap key为列名(名称);value为一个String[]数组,String["item/rev","object_name"]
|
|
|
|
* @param cols
|
|
|
|
* @param cols
|
|
|
|
|
|
|
|
* @param chooseRows2
|
|
|
|
* @throws Exception
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public ProcessAttriChangeDialog(TCSession session, TCComponent[] models, TCComponentTask task, LinkedHashMap<String, String[]> ruleOpsMap, int[] cols)
|
|
|
|
public ProcessAttriChangeDialog(
|
|
|
|
|
|
|
|
TCSession session,
|
|
|
|
|
|
|
|
TCComponent[] models,
|
|
|
|
|
|
|
|
TCComponentTask task,
|
|
|
|
|
|
|
|
LinkedHashMap<String, String[]> ruleOpsMap,
|
|
|
|
|
|
|
|
int[] cols, List<Integer> chooseRowsA,
|
|
|
|
|
|
|
|
List<TCComponentItemRevision> targetRevisionA)
|
|
|
|
throws Exception {
|
|
|
|
throws Exception {
|
|
|
|
super(AIFUtility.getActiveDesktop());
|
|
|
|
super(AIFUtility.getActiveDesktop());
|
|
|
|
this.session = session;
|
|
|
|
this.session = session;
|
|
|
|
this.modelsF = models;
|
|
|
|
this.modelsF = models;
|
|
|
|
this.taskF = task;
|
|
|
|
this.taskF = task;
|
|
|
|
this.ruleOpsMapF = ruleOpsMap;
|
|
|
|
this.ruleOpsMapF = ruleOpsMap;
|
|
|
|
System.out.println("开始遍历存放首选项Jd_Standard_UI_Process_Attribute的信息的构造函数入参ruleOpsMap");
|
|
|
|
this.chooseRows = chooseRowsA;
|
|
|
|
for (String key : ruleOpsMap.keySet()){
|
|
|
|
this.targetRevision = targetRevisionA;
|
|
|
|
System.out.println(key+":"+Arrays.toString(ruleOpsMap.get(key)));
|
|
|
|
if (chooseRowsA != null && chooseRowsA.size()>0) {
|
|
|
|
|
|
|
|
System.out.println("构造函数ProcessAttriChangeDialog的入参chooseRowsA:"+chooseRowsA.toString());
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
if (this.chooseRows != null) {
|
|
|
|
|
|
|
|
System.out.println("this.chooseRows:["+this.chooseRows.size()+"]");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
System.out.println("构造函数ProcessAttriChangeDialog的入参chooseRowsA为空!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.colsF = cols;
|
|
|
|
this.colsF = cols;
|
|
|
|
this.argMap = getHandlerArgs(task);
|
|
|
|
this.argMap = getHandlerArgs(task);
|
|
|
|
initUi( modelsF, taskF, ruleOpsMapF, colsF,null);
|
|
|
|
initUi( modelsF, taskF, ruleOpsMapF, colsF,chooseRowsA);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -148,7 +166,10 @@ public class ProcessAttriChangeDialog extends JDialog {
|
|
|
|
* @param chooseRows 初始化界面时,携带的选中行
|
|
|
|
* @param chooseRows 初始化界面时,携带的选中行
|
|
|
|
* @throws Exception
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private void initUi(TCComponent[] models, TCComponentTask task, LinkedHashMap<String, String[]> ruleOpsMapI, int[] cols, List<Integer> chooseRows2) throws Exception {
|
|
|
|
private void initUi(TCComponent[] models,
|
|
|
|
|
|
|
|
TCComponentTask task,
|
|
|
|
|
|
|
|
LinkedHashMap<String, String[]> ruleOpsMapI,
|
|
|
|
|
|
|
|
int[] cols, List<Integer> chooseRows2) throws Exception {
|
|
|
|
// this.chooseRows.addAll(chooseRows2);
|
|
|
|
// this.chooseRows.addAll(chooseRows2);
|
|
|
|
if (chooseRows2 != null && chooseRows2.size()>0) {
|
|
|
|
if (chooseRows2 != null && chooseRows2.size()>0) {
|
|
|
|
System.out.println("当前选中行="+Arrays.toString(chooseRows2.toArray()));
|
|
|
|
System.out.println("当前选中行="+Arrays.toString(chooseRows2.toArray()));
|
|
|
@ -159,95 +180,7 @@ public class ProcessAttriChangeDialog extends JDialog {
|
|
|
|
System.out.println("开始初始化/刷新面板···");
|
|
|
|
System.out.println("开始初始化/刷新面板···");
|
|
|
|
setTitle("编辑节点属性");
|
|
|
|
setTitle("编辑节点属性");
|
|
|
|
remarkBtn = new JButton("修改属性");
|
|
|
|
remarkBtn = new JButton("修改属性");
|
|
|
|
remarkBtn.addActionListener(new ActionListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void actionPerformed(ActionEvent arg0) {//修改属性按钮
|
|
|
|
|
|
|
|
System.out.println("触发修改属性事件~");
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
// chooseRow = impTable.getSelectedRow();
|
|
|
|
|
|
|
|
System.out.println("当前选中行:" + impTable.getSelectedRow());
|
|
|
|
|
|
|
|
for (int i = 0; i < chooseRows.size(); i++) {
|
|
|
|
|
|
|
|
System.out.println("修改属性-选中行:" + chooseRows.get(i));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(chooseRows.size() <= 0) {
|
|
|
|
|
|
|
|
MessageBox.post(ProcessAttriChangeDialog.this, "请选择要编辑的行!", "ERROR", MessageBox.ERROR);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (String key : textAreaMap.keySet()){
|
|
|
|
|
|
|
|
// String text = textAreaMap.get(key).getText();//获取输入框中的值
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
Object component = textAreaMap.get(key);
|
|
|
|
|
|
|
|
String text = getValueByAreaType(component);
|
|
|
|
|
|
|
|
if (text == null){
|
|
|
|
|
|
|
|
System.out.println("info:获取输入框组件值异常!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String showAttr = argMap.get(key);//获取流程参数的value
|
|
|
|
|
|
|
|
if(text.getBytes().length > 1024) {
|
|
|
|
|
|
|
|
MessageBox.post(ProcessAttriChangeDialog.this, showAttr+"属性填写长度过长,无法修改!", "ERROR", MessageBox.ERROR);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
//获取列数
|
|
|
|
|
|
|
|
for (int t = 0; t < tableHeaderList.size(); t++){
|
|
|
|
|
|
|
|
if (tableHeaderList.get(t).equals(showAttr)){
|
|
|
|
|
|
|
|
for (int i = 0; i < chooseRows.size(); i++) {
|
|
|
|
|
|
|
|
impTable.setValueAt(text, chooseRows.get(i), t);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < chooseRows.size(); i++) {
|
|
|
|
|
|
|
|
TCComponentItemRevision rev = revlist.get(chooseRows.get(i));
|
|
|
|
|
|
|
|
TCComponentItem item = rev.getItem();
|
|
|
|
|
|
|
|
if(mark[0].equals("item") && item.isCheckedOut()) {
|
|
|
|
|
|
|
|
MessageBox.post(ProcessAttriChangeDialog.this, item+" 已签出,无法修改!", "ERROR", MessageBox.ERROR);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}else if(mark[0].equals("rev") && rev.isCheckedOut()) {
|
|
|
|
|
|
|
|
MessageBox.post(ProcessAttriChangeDialog.this, rev+" 已签出,无法修改!", "E RROR", MessageBox.ERROR);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
MethodUtil.openByPass(session);
|
|
|
|
|
|
|
|
if(mark[0].equals("item")) {
|
|
|
|
|
|
|
|
for (String key : textAreaMap.keySet()){
|
|
|
|
|
|
|
|
// String value = textAreaMap.get(key).getText();
|
|
|
|
|
|
|
|
Object component = textAreaMap.get(key);
|
|
|
|
|
|
|
|
String inputValue = getValueByAreaType(component);
|
|
|
|
|
|
|
|
if (inputValue == null){
|
|
|
|
|
|
|
|
System.out.println("info:获取输入框组件值异常!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
item.setProperty(key, inputValue);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}else if(mark[0].equals("rev")) {
|
|
|
|
|
|
|
|
for (String key : textAreaMap.keySet()){
|
|
|
|
|
|
|
|
// String value = textAreaMap.get(key).getText();
|
|
|
|
|
|
|
|
Object component = textAreaMap.get(key);
|
|
|
|
|
|
|
|
String inputValue = getValueByAreaType(component);
|
|
|
|
|
|
|
|
if (inputValue == null){
|
|
|
|
|
|
|
|
System.out.println("info:获取输入框组件值异常!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
rev.setProperty(key, inputValue);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MethodUtil.closeByPass(session);
|
|
|
|
|
|
|
|
}catch(Exception e1) {
|
|
|
|
|
|
|
|
e1.printStackTrace();
|
|
|
|
|
|
|
|
MessageBox.post(ProcessAttriChangeDialog.this, "错误:"+e1.getMessage(), "ERROR", MessageBox.ERROR);
|
|
|
|
|
|
|
|
}finally {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
MethodUtil.closeByPass(session);
|
|
|
|
|
|
|
|
}catch(Exception e1) {
|
|
|
|
|
|
|
|
e1.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
exportBtn = new JButton("导出Excel");
|
|
|
|
exportBtn = new JButton("导出Excel");
|
|
|
|
closeBtn = new JButton("关闭");
|
|
|
|
closeBtn = new JButton("关闭");
|
|
|
|
JPanel btnPanel = new JPanel(new FlowLayout());
|
|
|
|
JPanel btnPanel = new JPanel(new FlowLayout());
|
|
|
@ -255,7 +188,6 @@ public class ProcessAttriChangeDialog extends JDialog {
|
|
|
|
btnPanel.add(exportBtn);
|
|
|
|
btnPanel.add(exportBtn);
|
|
|
|
btnPanel.add(closeBtn);
|
|
|
|
btnPanel.add(closeBtn);
|
|
|
|
|
|
|
|
|
|
|
|
// JPanel topPanel = new JPanel(new BorderLayout());
|
|
|
|
|
|
|
|
if (topPanel == null) {
|
|
|
|
if (topPanel == null) {
|
|
|
|
topPanel = new JPanel(new BorderLayout());
|
|
|
|
topPanel = new JPanel(new BorderLayout());
|
|
|
|
|
|
|
|
|
|
|
@ -269,86 +201,87 @@ public class ProcessAttriChangeDialog extends JDialog {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 创建属性面板
|
|
|
|
// 创建属性面板
|
|
|
|
JPanel propertyPanel = new JPanel(new PropertyLayout());
|
|
|
|
propertyPanel = new JPanel(new PropertyLayout());
|
|
|
|
int k = 0;
|
|
|
|
// int k = 0;
|
|
|
|
for (String key : this.argMap.keySet()) {//将流程配置的属性逐个渲染到看板上
|
|
|
|
// for (String key : this.argMap.keySet()) {//将流程配置的属性逐个渲染到看板上
|
|
|
|
k++;
|
|
|
|
// k++;
|
|
|
|
String value = this.argMap.get(key);//属性显示名称
|
|
|
|
// String value = this.argMap.get(key);//属性显示名称
|
|
|
|
System.out.println("流程配置信息Key: " + key + ", Value: " + value);
|
|
|
|
// System.out.println("流程配置信息Key: " + key + ", Value: " + value);
|
|
|
|
String labLocation = String.valueOf(k)+".1.left.top";
|
|
|
|
// String labLocation = String.valueOf(k)+".1.left.top";
|
|
|
|
String fieldLocation = String.valueOf(k)+".2.left.top";
|
|
|
|
// String fieldLocation = String.valueOf(k)+".2.left.top";
|
|
|
|
propertyPanel.add(labLocation,new JLabel(value));
|
|
|
|
// propertyPanel.add(labLocation,new JLabel(value));
|
|
|
|
|
|
|
|
|
|
|
|
//TODO 逻辑重构:根据不同属性类型,渲染不同的输入框
|
|
|
|
|
|
|
|
String[] attrs = ruleOpsMapI.get(value);
|
|
|
|
|
|
|
|
if (attrs == null || attrs.length == 0){
|
|
|
|
|
|
|
|
System.out.println("info:根据属性显示字段【"+value+"】获取属性信息失败,请检查相关首选项配置!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String currentAttributeValue = null;//当前属性的值,用于渲染到看板输入框中
|
|
|
|
|
|
|
|
System.out.println("====================================================================");
|
|
|
|
|
|
|
|
if (this.targetRevision != null && this.targetRevision.size() > 0){
|
|
|
|
|
|
|
|
System.out.println("info:已选中对象,开始根据选中对象的属性类型渲染组件···");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//当选中多个对象时,默认将当前选中的第一个对象属性作为默认值渲染到属性编辑看板上
|
|
|
|
|
|
|
|
TCComponentItem targetItem = this.targetRevision.get(0).getItem();
|
|
|
|
|
|
|
|
//根据属性名称获取属性所属对象类型:item/rev
|
|
|
|
|
|
|
|
String itemType = attrs[0];//item/rev
|
|
|
|
|
|
|
|
String propertyName = attrs[1];//属性真实名称
|
|
|
|
|
|
|
|
if (itemType.equals("item")){
|
|
|
|
|
|
|
|
currentAttributeValue = targetItem.getProperty(propertyName);//获取当前属性的值
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
currentAttributeValue = targetRevision.get(0).getProperty(propertyName);//获取当前属性的值
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
if (isLovType(propertyName)){
|
|
|
|
// //TODO 逻辑重构:根据不同属性类型,渲染不同的输入框
|
|
|
|
System.out.println("属性【"+propertyName+"】类型为:LOV");
|
|
|
|
// String[] attrs = ruleOpsMapI.get(value);
|
|
|
|
|
|
|
|
// if (attrs == null || attrs.length == 0){
|
|
|
|
Map<String, String> lovList = getUnitValue_display(session,propertyName);
|
|
|
|
// System.out.println("info:根据属性显示字段【"+value+"】获取属性信息失败,请检查相关首选项配置!");
|
|
|
|
// 创建下拉列表组件
|
|
|
|
// }
|
|
|
|
JComboBox<String> comboBox = new JComboBox<>();
|
|
|
|
// String currentAttributeValue = null;//当前属性的值,用于渲染到看板输入框中
|
|
|
|
|
|
|
|
// System.out.println("====================================================================");
|
|
|
|
// 将lovList中的value值添加到下拉列表
|
|
|
|
// if (this.targetRevision != null && this.targetRevision.size() > 0){
|
|
|
|
for (String lovValue : lovList.values()) {
|
|
|
|
// System.out.println("info:已选中对象,开始根据选中对象的属性类型渲染组件···");
|
|
|
|
comboBox.addItem(lovValue);
|
|
|
|
//
|
|
|
|
}
|
|
|
|
// //当选中多个对象时,默认将当前选中的第一个对象属性作为默认值渲染到属性编辑看板上
|
|
|
|
// 设置默认显示值(假设defaultValue是您希望默认显示的选项)
|
|
|
|
// TCComponentItem targetItem = this.targetRevision.get(0).getItem();
|
|
|
|
comboBox.setSelectedItem(currentAttributeValue);
|
|
|
|
// //根据属性名称获取属性所属对象类型:item/rev
|
|
|
|
propertyPanel.add(fieldLocation, comboBox);
|
|
|
|
// String itemType = attrs[0];//item/rev
|
|
|
|
this.textAreaMap.put(propertyName, comboBox); //
|
|
|
|
// String propertyName = attrs[1];//属性真实名称
|
|
|
|
}else {//
|
|
|
|
// if (itemType.equals("item")){
|
|
|
|
System.out.println("属性【"+ propertyName+"】类型非LOV ");
|
|
|
|
// currentAttributeValue = targetItem.getProperty(propertyName);//获取当前属性的值
|
|
|
|
|
|
|
|
//
|
|
|
|
JTextArea textArea = new JTextArea(); // 创建JTextArea
|
|
|
|
// }else {
|
|
|
|
textArea.setColumns(20); // 设置输入框宽度
|
|
|
|
// currentAttributeValue = targetRevision.get(0).getProperty(propertyName);//获取当前属性的值
|
|
|
|
textArea.setLineWrap(true); // 启用自动换行
|
|
|
|
//
|
|
|
|
textArea.setWrapStyleWord(true); // 按单词换行
|
|
|
|
// }
|
|
|
|
JScrollPane scrollPane = new JScrollPane(textArea);
|
|
|
|
// //
|
|
|
|
System.out.println("KUMA属性=" + value);
|
|
|
|
// if (isLovType(propertyName)){
|
|
|
|
if (value != null && (value.trim().contains("备注") || "备注".equals(value.trim()))){//备注特殊处理:加高度
|
|
|
|
// System.out.println("属性【"+propertyName+"】类型为:LOV");
|
|
|
|
System.out.println("KUMA:特殊字段特殊处理!");
|
|
|
|
//
|
|
|
|
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
|
|
|
|
// Map<String, String> lovList = getUnitValue_display(session,propertyName);
|
|
|
|
textArea.setRows(3);
|
|
|
|
// // 创建下拉列表组件
|
|
|
|
scrollPane.setPreferredSize(scrollPane.getPreferredSize()); // 设置 JScrollPane 的首选尺寸
|
|
|
|
// JComboBox<String> comboBox = new JComboBox<>();
|
|
|
|
}
|
|
|
|
//
|
|
|
|
//赋值到textArea输入框中
|
|
|
|
// // 将lovList中的value值添加到下拉列表
|
|
|
|
textArea.setText(currentAttributeValue);
|
|
|
|
// for (String lovValue : lovList.values()) {
|
|
|
|
propertyPanel.add(fieldLocation, scrollPane);
|
|
|
|
// comboBox.addItem(lovValue);
|
|
|
|
this.textAreaMap.put(key, textArea); // 将JTextArea保存到Map中
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// // 设置默认显示值(假设defaultValue是您希望默认显示的选项)
|
|
|
|
|
|
|
|
// comboBox.setSelectedItem(currentAttributeValue);
|
|
|
|
|
|
|
|
// propertyPanel.add(fieldLocation, comboBox);
|
|
|
|
|
|
|
|
// this.textAreaMap.put(propertyName, comboBox); //
|
|
|
|
|
|
|
|
// }else {//
|
|
|
|
|
|
|
|
// System.out.println("属性【"+ propertyName+"】类型非LOV ");
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// JTextArea textArea = new JTextArea(); // 创建JTextArea
|
|
|
|
|
|
|
|
// textArea.setColumns(20); // 设置输入框宽度
|
|
|
|
|
|
|
|
// textArea.setLineWrap(true); // 启用自动换行
|
|
|
|
|
|
|
|
// textArea.setWrapStyleWord(true); // 按单词换行
|
|
|
|
|
|
|
|
// JScrollPane scrollPane = new JScrollPane(textArea);
|
|
|
|
|
|
|
|
// System.out.println("KUMA属性=" + value);
|
|
|
|
|
|
|
|
// if (value != null && (value.trim().contains("备注") || "备注".equals(value.trim()))){//备注特殊处理:加高度
|
|
|
|
|
|
|
|
// System.out.println("KUMA:特殊字段特殊处理!");
|
|
|
|
|
|
|
|
// scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
|
|
|
|
|
|
|
|
// textArea.setRows(3);
|
|
|
|
|
|
|
|
// scrollPane.setPreferredSize(scrollPane.getPreferredSize()); // 设置 JScrollPane 的首选尺寸
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// //赋值到textArea输入框中
|
|
|
|
|
|
|
|
// textArea.setText(currentAttributeValue);
|
|
|
|
|
|
|
|
// propertyPanel.add(fieldLocation, scrollPane);
|
|
|
|
|
|
|
|
// this.textAreaMap.put(key, textArea); // 将JTextArea保存到Map中
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// }else {
|
|
|
|
|
|
|
|
// System.out.println("info:未选中任何行,无法获取选中对象!渲染默认组件···");
|
|
|
|
|
|
|
|
// //渲染默认组件
|
|
|
|
|
|
|
|
// JTextArea textArea = new JTextArea(); // 创建JTextArea
|
|
|
|
|
|
|
|
// textArea.setColumns(20); // 设置输入框宽度
|
|
|
|
|
|
|
|
// textArea.setLineWrap(true); // 启用自动换行
|
|
|
|
|
|
|
|
// textArea.setWrapStyleWord(true); // 按单词换行
|
|
|
|
|
|
|
|
// propertyPanel.add(fieldLocation, new JScrollPane(textArea));
|
|
|
|
|
|
|
|
// this.textAreaMap.put(key, textArea); // 将JTextArea保存到Map中
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
System.out.println("info:未选中任何行,无法获取选中对象!渲染默认组件···");
|
|
|
|
|
|
|
|
//渲染默认组件
|
|
|
|
|
|
|
|
JTextArea textArea = new JTextArea(); // 创建JTextArea
|
|
|
|
|
|
|
|
textArea.setColumns(20); // 设置输入框宽度
|
|
|
|
|
|
|
|
textArea.setLineWrap(true); // 启用自动换行
|
|
|
|
|
|
|
|
textArea.setWrapStyleWord(true); // 按单词换行
|
|
|
|
|
|
|
|
propertyPanel.add(fieldLocation, new JScrollPane(textArea));
|
|
|
|
|
|
|
|
this.textAreaMap.put(key, textArea); // 将JTextArea保存到Map中
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 将属性面板放置在中心位置,btnPanel 放置在南边(底部)
|
|
|
|
// 将属性面板放置在中心位置,btnPanel 放置在南边(底部)
|
|
|
|
topPanel.add(propertyPanel, BorderLayout.CENTER);
|
|
|
|
topPanel.add(propertyPanel, BorderLayout.CENTER);
|
|
|
|
topPanel.add(btnPanel, BorderLayout.SOUTH);
|
|
|
|
topPanel.add(btnPanel, BorderLayout.SOUTH);
|
|
|
@ -356,6 +289,7 @@ public class ProcessAttriChangeDialog extends JDialog {
|
|
|
|
topPanel.revalidate();
|
|
|
|
topPanel.revalidate();
|
|
|
|
topPanel.repaint();
|
|
|
|
topPanel.repaint();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//处理表格表头
|
|
|
|
String[] tableHeader = new String[ruleOpsMapI.size() + 1];
|
|
|
|
String[] tableHeader = new String[ruleOpsMapI.size() + 1];
|
|
|
|
tableHeader[0] = "序号";
|
|
|
|
tableHeader[0] = "序号";
|
|
|
|
int h = 1;
|
|
|
|
int h = 1;
|
|
|
@ -383,55 +317,6 @@ public class ProcessAttriChangeDialog extends JDialog {
|
|
|
|
impTable.setModel(impModel);
|
|
|
|
impTable.setModel(impModel);
|
|
|
|
impTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
|
|
|
|
impTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
|
|
|
|
|
|
|
|
|
|
|
|
impTable.addMouseListener(new MouseAdapter() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void mouseClicked(MouseEvent e) {//单机鼠标
|
|
|
|
|
|
|
|
System.out.println("触发单击选中事件~");
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
// chooseRow= impTable.getSelectedRows();
|
|
|
|
|
|
|
|
int[] selectedRows = impTable.getSelectedRows();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(selectedRows.length <= 0) {
|
|
|
|
|
|
|
|
System.out.println("当前未选中任何对象 !");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//选中行
|
|
|
|
|
|
|
|
// List<Integer> chooseRowTemp = new ArrayList<Integer>();
|
|
|
|
|
|
|
|
chooseRows.clear();//放入新的选中行前,清空选中行集合
|
|
|
|
|
|
|
|
targetRevision.clear();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("当前选中行:");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < selectedRows.length; i++) {
|
|
|
|
|
|
|
|
//选中行序号之一
|
|
|
|
|
|
|
|
int selectPartRowNum = selectedRows[i];
|
|
|
|
|
|
|
|
System.out.println("=>"+selectPartRowNum+" ;");
|
|
|
|
|
|
|
|
if (revlist != null && revlist.size() > 0) {
|
|
|
|
|
|
|
|
TCComponentItemRevision selectRevision = revlist.get(selectPartRowNum);//根据选中行的序号,从revlist中获取该行对应的版本对象
|
|
|
|
|
|
|
|
if (selectRevision != null) {
|
|
|
|
|
|
|
|
targetRevision.add(selectRevision);
|
|
|
|
|
|
|
|
chooseRows.add(selectPartRowNum);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
System.out.println("版本list为空!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (targetRevision != null && targetRevision.size() > 0) {
|
|
|
|
|
|
|
|
System.out.println("二次渲染前的选中行:"+Arrays.toString(chooseRows.toArray()));
|
|
|
|
|
|
|
|
initUi(modelsF, taskF, ruleOpsMapF, colsF, chooseRows);
|
|
|
|
|
|
|
|
System.out.println("二次渲染后的选中行:"+Arrays.toString(chooseRows.toArray()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e1) {
|
|
|
|
|
|
|
|
e1.printStackTrace();
|
|
|
|
|
|
|
|
MessageBox.post(ProcessAttriChangeDialog.this, "错误:" + e1.getMessage(), "ERROR", MessageBox.ERROR);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 1; i < impModel.getColumnCount(); i++) {
|
|
|
|
for (int i = 1; i < impModel.getColumnCount(); i++) {
|
|
|
|
TableColumn col = impTable.getColumnModel().getColumn(i);
|
|
|
|
TableColumn col = impTable.getColumnModel().getColumn(i);
|
|
|
@ -444,7 +329,7 @@ public class ProcessAttriChangeDialog extends JDialog {
|
|
|
|
// for (MouseListener listener : impTable.getMouseListeners()) {
|
|
|
|
// for (MouseListener listener : impTable.getMouseListeners()) {
|
|
|
|
// impTable.removeMouseListener(listener);
|
|
|
|
// impTable.removeMouseListener(listener);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// addActionListener(models, cols);
|
|
|
|
addActionListener(models, cols);
|
|
|
|
|
|
|
|
|
|
|
|
setLayout(new BorderLayout());
|
|
|
|
setLayout(new BorderLayout());
|
|
|
|
topPanel.setPreferredSize(new Dimension(260, getHeight())); // 设置宽度
|
|
|
|
topPanel.setPreferredSize(new Dimension(260, getHeight())); // 设置宽度
|
|
|
@ -461,13 +346,13 @@ public class ProcessAttriChangeDialog extends JDialog {
|
|
|
|
//如果有选中行,设置table的选中对应行状态
|
|
|
|
//如果有选中行,设置table的选中对应行状态
|
|
|
|
if (chooseRows != null && chooseRows.size() > 0) {
|
|
|
|
if (chooseRows != null && chooseRows.size() > 0) {
|
|
|
|
System.out.println("重新加载组件完成!当前已选中行,开始设置table选中状态!");
|
|
|
|
System.out.println("重新加载组件完成!当前已选中行,开始设置table选中状态!");
|
|
|
|
List<Integer> uniqueRows = new ArrayList<>(new HashSet<>(chooseRows2)); // 去重
|
|
|
|
List<Integer> uniqueRows = new ArrayList<>(new HashSet<>(chooseRows)); // 去重
|
|
|
|
Collections.sort(uniqueRows); // 排序
|
|
|
|
Collections.sort(uniqueRows); // 排序
|
|
|
|
for (int row : uniqueRows) {
|
|
|
|
for (int row : uniqueRows) {
|
|
|
|
impTable.addRowSelectionInterval(row, row);
|
|
|
|
impTable.addRowSelectionInterval(row, row);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
System.out.println("当前未选中任何行,重新加载组件后无需设置table选中状态!");
|
|
|
|
System.out.println("重新加载组件完成!当前未选中任何行,重新加载组件后无需设置table选中状态!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -486,6 +371,7 @@ public class ProcessAttriChangeDialog extends JDialog {
|
|
|
|
if (lov.length > 0)
|
|
|
|
if (lov.length > 0)
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
} catch (TCException e) {
|
|
|
|
} catch (TCException e) {
|
|
|
|
|
|
|
|
System.out.println("获取LOV异常!");
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
@ -638,6 +524,106 @@ public class ProcessAttriChangeDialog extends JDialog {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 更新属性编辑Panel
|
|
|
|
|
|
|
|
* @throws TCException
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private void updatePropertyPanel(LinkedHashMap<String, String[]> ruleOpsMapI) throws TCException {
|
|
|
|
|
|
|
|
System.out.println("触发updatePropertyPanel方法~");
|
|
|
|
|
|
|
|
//1.更新前,先清空属性Panel
|
|
|
|
|
|
|
|
propertyPanel.removeAll();
|
|
|
|
|
|
|
|
topPanel.remove(propertyPanel);
|
|
|
|
|
|
|
|
propertyPanel = new JPanel(new PropertyLayout());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int k = 0;
|
|
|
|
|
|
|
|
for (String key : this.argMap.keySet()) {//将流程配置的属性逐个渲染到看板上
|
|
|
|
|
|
|
|
k++;
|
|
|
|
|
|
|
|
String value = this.argMap.get(key);//属性显示名称
|
|
|
|
|
|
|
|
System.out.println("流程配置信息Key: " + key + ", Value: " + value);
|
|
|
|
|
|
|
|
String labLocation = String.valueOf(k)+".1.left.top";
|
|
|
|
|
|
|
|
String fieldLocation = String.valueOf(k)+".2.left.top";
|
|
|
|
|
|
|
|
propertyPanel.add(labLocation,new JLabel(value));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO 逻辑重构:根据不同属性类型,渲染不同的输入框
|
|
|
|
|
|
|
|
String[] attrs = ruleOpsMapI.get(value);
|
|
|
|
|
|
|
|
if (attrs == null || attrs.length == 0){
|
|
|
|
|
|
|
|
System.out.println("info:根据属性显示字段【"+value+"】获取属性信息失败,请检查相关首选项配置!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String currentAttributeValue = null;//当前属性的值,用于渲染到看板输入框中
|
|
|
|
|
|
|
|
System.out.println("====================================================================");
|
|
|
|
|
|
|
|
if (this.targetRevision != null && this.targetRevision.size() > 0){
|
|
|
|
|
|
|
|
System.out.println("info:已选中对象,开始根据选中对象的属性类型渲染组件···");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//当选中多个对象时,默认将当前选中的第一个对象属性作为默认值渲染到属性编辑看板上
|
|
|
|
|
|
|
|
TCComponentItem targetItem = this.targetRevision.get(0).getItem();
|
|
|
|
|
|
|
|
//根据属性名称获取属性所属对象类型:item/rev
|
|
|
|
|
|
|
|
String itemType = attrs[0];//item/rev
|
|
|
|
|
|
|
|
String propertyName = attrs[1];//属性真实名称
|
|
|
|
|
|
|
|
if (itemType.equals("item")){
|
|
|
|
|
|
|
|
currentAttributeValue = targetItem.getProperty(propertyName);//获取当前属性的值
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
currentAttributeValue = targetRevision.get(0).getProperty(propertyName);//获取当前属性的值
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
if (isLovType(propertyName)){
|
|
|
|
|
|
|
|
System.out.println("属性【"+propertyName+"】类型为:LOV");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, String> lovList = getUnitValue_display(session,propertyName);
|
|
|
|
|
|
|
|
// 创建下拉列表组件
|
|
|
|
|
|
|
|
JComboBox<String> comboBox = new JComboBox<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 将lovList中的value值添加到下拉列表
|
|
|
|
|
|
|
|
for (String lovValue : lovList.values()) {
|
|
|
|
|
|
|
|
comboBox.addItem(lovValue);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 设置默认显示值(假设defaultValue是您希望默认显示的选项)
|
|
|
|
|
|
|
|
comboBox.setSelectedItem(currentAttributeValue);
|
|
|
|
|
|
|
|
propertyPanel.add(fieldLocation, comboBox);
|
|
|
|
|
|
|
|
this.textAreaMap.put(propertyName, comboBox); //
|
|
|
|
|
|
|
|
}else {//
|
|
|
|
|
|
|
|
System.out.println("属性【"+ propertyName+"】类型非LOV ");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JTextArea textArea = new JTextArea(); // 创建JTextArea
|
|
|
|
|
|
|
|
textArea.setColumns(20); // 设置输入框宽度
|
|
|
|
|
|
|
|
textArea.setLineWrap(true); // 启用自动换行
|
|
|
|
|
|
|
|
textArea.setWrapStyleWord(true); // 按单词换行
|
|
|
|
|
|
|
|
JScrollPane scrollPane = new JScrollPane(textArea);
|
|
|
|
|
|
|
|
System.out.println("KUMA属性=" + value);
|
|
|
|
|
|
|
|
if (value != null && (value.trim().contains("备注") || "备注".equals(value.trim()))){//备注特殊处理:加高度
|
|
|
|
|
|
|
|
System.out.println("KUMA:特殊字段特殊处理!");
|
|
|
|
|
|
|
|
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
|
|
|
|
|
|
|
|
textArea.setRows(3);
|
|
|
|
|
|
|
|
scrollPane.setPreferredSize(scrollPane.getPreferredSize()); // 设置 JScrollPane 的首选尺寸
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//赋值到textArea输入框中
|
|
|
|
|
|
|
|
textArea.setText(currentAttributeValue);
|
|
|
|
|
|
|
|
propertyPanel.add(fieldLocation, scrollPane);
|
|
|
|
|
|
|
|
this.textAreaMap.put(key, textArea); // 将JTextArea保存到Map中
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
System.out.println("info:未选中任何行,无法获取选中对象!渲染默认组件···");
|
|
|
|
|
|
|
|
//渲染默认组件
|
|
|
|
|
|
|
|
JTextArea textArea = new JTextArea(); // 创建JTextArea
|
|
|
|
|
|
|
|
textArea.setColumns(20); // 设置输入框宽度
|
|
|
|
|
|
|
|
textArea.setLineWrap(true); // 启用自动换行
|
|
|
|
|
|
|
|
textArea.setWrapStyleWord(true); // 按单词换行
|
|
|
|
|
|
|
|
propertyPanel.add(fieldLocation, new JScrollPane(textArea));
|
|
|
|
|
|
|
|
this.textAreaMap.put(key, textArea); // 将JTextArea保存到Map中
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
topPanel.add(propertyPanel, BorderLayout.CENTER);
|
|
|
|
|
|
|
|
topPanel.revalidate();
|
|
|
|
|
|
|
|
topPanel.repaint();//更新属性Panel
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 添加事件监听
|
|
|
|
* 添加事件监听
|
|
|
|
* @param models
|
|
|
|
* @param models
|
|
|
@ -649,18 +635,27 @@ public class ProcessAttriChangeDialog extends JDialog {
|
|
|
|
public void mouseClicked(MouseEvent e) {//单机鼠标
|
|
|
|
public void mouseClicked(MouseEvent e) {//单机鼠标
|
|
|
|
System.out.println("触发单击选中事件~");
|
|
|
|
System.out.println("触发单击选中事件~");
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
// chooseRow= impTable.getSelectedRows();
|
|
|
|
|
|
|
|
int[] selectedRows = impTable.getSelectedRows();
|
|
|
|
int[] selectedRows = impTable.getSelectedRows();
|
|
|
|
|
|
|
|
int length = selectedRows.length;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(length <= 0) {
|
|
|
|
if(selectedRows.length <= 0) {
|
|
|
|
System.out.println("当前选中行的长度为:"+length+",未选中任何对象 !");
|
|
|
|
System.out.println("当前未选中任何对象 !");
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
System.out.println("当前选中行:"+ArrayUtil.toString(selectedRows));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//选中行
|
|
|
|
//选中行
|
|
|
|
// List<Integer> chooseRowTemp = new ArrayList<Integer>();
|
|
|
|
if (chooseRows != null && chooseRows.size() > 0) {
|
|
|
|
chooseRows.clear();//放入新的选中行前,清空选中行集合
|
|
|
|
chooseRows.clear();//放入新的选中行前,清空选中行集合
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
chooseRows = new ArrayList<Integer> ();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (targetRevision != null && targetRevision.size() > 0) {
|
|
|
|
targetRevision.clear();
|
|
|
|
targetRevision.clear();
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
targetRevision = new ArrayList<TCComponentItemRevision>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("当前选中行:");
|
|
|
|
System.out.println("当前选中行:");
|
|
|
|
|
|
|
|
|
|
|
@ -683,7 +678,10 @@ public class ProcessAttriChangeDialog extends JDialog {
|
|
|
|
|
|
|
|
|
|
|
|
if (targetRevision != null && targetRevision.size() > 0) {
|
|
|
|
if (targetRevision != null && targetRevision.size() > 0) {
|
|
|
|
System.out.println("二次渲染前的选中行:"+Arrays.toString(chooseRows.toArray()));
|
|
|
|
System.out.println("二次渲染前的选中行:"+Arrays.toString(chooseRows.toArray()));
|
|
|
|
initUi(modelsF, taskF, ruleOpsMapF, colsF, chooseRows);
|
|
|
|
// initUi(modelsF, taskF, ruleOpsMapF, colsF, chooseRows);
|
|
|
|
|
|
|
|
// ProcessAttriChangeDialog.this.dispose();
|
|
|
|
|
|
|
|
// new ProcessAttriChangeDialog(session, models, taskF, ruleOpsMapF, colsF, chooseRows, targetRevision);
|
|
|
|
|
|
|
|
updatePropertyPanel(ruleOpsMapF);
|
|
|
|
System.out.println("二次渲染后的选中行:"+Arrays.toString(chooseRows.toArray()));
|
|
|
|
System.out.println("二次渲染后的选中行:"+Arrays.toString(chooseRows.toArray()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|