parent
bbcac57a9a
commit
dc52c69198
@ -1,164 +1,495 @@
|
||||
package com.connor.plm.CostListManagement.pojo;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* ===============================================================================
|
||||
* Copyright (c) 2012-2024 CONNOR lijh. Unpublished - All Rights Reserved
|
||||
* ===============================================================================
|
||||
* File description:
|
||||
*
|
||||
* GzxqBean.java 工装需求bean
|
||||
*
|
||||
* ===============================================================================
|
||||
* DATE Name Description of Change
|
||||
*
|
||||
* 2024-06-13 ljh create
|
||||
* ===============================================================================
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
import java.awt.Desktop;
|
||||
import java.net.URI;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
import com.teamcenter.rac.kernel.TCComponentFolder;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemType;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.TextArea;
|
||||
|
||||
public class GzxqBean {
|
||||
private String instanceId;
|
||||
private String factory;
|
||||
private String sfId;
|
||||
private String head;
|
||||
private String scheduledtime;
|
||||
private String model;
|
||||
private String productname;
|
||||
private String toolnumber;
|
||||
private String toolname;
|
||||
private String toolinglevel;
|
||||
private String reason;
|
||||
private String jsgyrequirements;
|
||||
private String link;
|
||||
private String state;
|
||||
|
||||
public GzxqBean() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String getInstanceId() {
|
||||
return instanceId;
|
||||
}
|
||||
|
||||
public void setInstanceId(String instanceId) {
|
||||
this.instanceId = instanceId;
|
||||
}
|
||||
|
||||
public String getFactory() {
|
||||
return factory;
|
||||
}
|
||||
|
||||
public void setFactory(String factory) {
|
||||
this.factory = factory;
|
||||
}
|
||||
|
||||
public String getSfId() {
|
||||
return sfId;
|
||||
}
|
||||
|
||||
public void setSfId(String sfId) {
|
||||
this.sfId = sfId;
|
||||
}
|
||||
|
||||
public String getHead() {
|
||||
return head;
|
||||
}
|
||||
|
||||
public void setHead(String head) {
|
||||
this.head = head;
|
||||
}
|
||||
|
||||
public String getScheduledtime() {
|
||||
return scheduledtime;
|
||||
}
|
||||
|
||||
public void setScheduledtime(String scheduledtime) {
|
||||
this.scheduledtime = scheduledtime;
|
||||
}
|
||||
|
||||
public String getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public void setModel(String model) {
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
public String getProductname() {
|
||||
return productname;
|
||||
}
|
||||
|
||||
public void setProductname(String productname) {
|
||||
this.productname = productname;
|
||||
}
|
||||
|
||||
public String getToolnumber() {
|
||||
return toolnumber;
|
||||
}
|
||||
|
||||
public void setToolnumber(String toolnumber) {
|
||||
this.toolnumber = toolnumber;
|
||||
}
|
||||
|
||||
public String getToolname() {
|
||||
return toolname;
|
||||
}
|
||||
|
||||
public void setToolname(String toolname) {
|
||||
this.toolname = toolname;
|
||||
}
|
||||
|
||||
public String getToolinglevel() {
|
||||
return toolinglevel;
|
||||
}
|
||||
|
||||
public void setToolinglevel(String toolinglevel) {
|
||||
this.toolinglevel = toolinglevel;
|
||||
}
|
||||
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setReason(String reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public String getJsgyrequirements() {
|
||||
return jsgyrequirements;
|
||||
}
|
||||
|
||||
public void setJsgyrequirements(String jsgyrequirements) {
|
||||
this.jsgyrequirements = jsgyrequirements;
|
||||
}
|
||||
|
||||
public String getLink() {
|
||||
return link;
|
||||
}
|
||||
|
||||
public void setLink(String link) {
|
||||
this.link = link;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public GzxqBean(String instanceId, String factory, String sfId, String head, String scheduledtime, String model,
|
||||
String productname, String toolnumber, String toolname, String toolinglevel, String reason,
|
||||
String jsgyrequirements, String link, String state) {
|
||||
super();
|
||||
this.instanceId = instanceId;
|
||||
this.factory = factory;
|
||||
this.sfId = sfId;
|
||||
this.head = head;
|
||||
this.scheduledtime = scheduledtime;
|
||||
this.model = model;
|
||||
this.productname = productname;
|
||||
this.toolnumber = toolnumber;
|
||||
this.toolname = toolname;
|
||||
this.toolinglevel = toolinglevel;
|
||||
this.reason = reason;
|
||||
this.jsgyrequirements = jsgyrequirements;
|
||||
this.link = link;
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GzxqBean [instanceId=" + instanceId + ", factory=" + factory + ", sfId=" + sfId + ", head=" + head
|
||||
+ ", scheduledtime=" + scheduledtime + ", model=" + model + ", productname=" + productname
|
||||
+ ", toolnumber=" + toolnumber + ", toolname=" + toolname + ", toolinglevel=" + toolinglevel
|
||||
+ ", reason=" + reason + ", jsgyrequirements=" + jsgyrequirements + ", link=" + link + ", state="
|
||||
+ state + "]";
|
||||
}
|
||||
private TextArea instanceId = new TextArea();
|
||||
private TextArea factory = new TextArea();
|
||||
private TextArea sfId = new TextArea();
|
||||
private TextArea head = new TextArea();
|
||||
private TextArea scheduledtime = new TextArea();
|
||||
private TextArea model = new TextArea();
|
||||
private TextArea productname = new TextArea();
|
||||
private TextArea toolnumber = new TextArea();
|
||||
private TextArea toolname = new TextArea();
|
||||
private TextArea toolinglevel = new TextArea();
|
||||
|
||||
private TextArea reason = new TextArea();
|
||||
private TextArea jsgyrequirements = new TextArea();
|
||||
private Button link = new Button();
|
||||
private Button cjgzxq = new Button();
|
||||
private String linkStr;
|
||||
private String sfIdStr;
|
||||
private String instanceIdStr;
|
||||
private TCSession session;
|
||||
private TextArea state = new TextArea();
|
||||
private TextArea xh = new TextArea();
|
||||
//设置TextArea的值和Button
|
||||
public GzxqBean(String instanceId, String factory, String sfId, String head, String scheduledtime,
|
||||
String model, String productname, String toolnumber, String toolname, String toolinglevel,
|
||||
String reason, String jsgyrequirements, String link, String state, String xh,TCSession session) {
|
||||
super();
|
||||
this.instanceId.setText(instanceId);
|
||||
this.instanceId.setEditable(false);
|
||||
this.instanceId.setPrefSize(200, 40);
|
||||
|
||||
this.factory.setText(factory);
|
||||
this.factory.setEditable(false);
|
||||
this.factory.setPrefSize(200, 40);
|
||||
|
||||
this.sfId.setText(sfId);
|
||||
this.sfId.setEditable(false);
|
||||
this.sfId.setPrefSize(200, 40);
|
||||
|
||||
this.head.setText(head);
|
||||
this.head.setEditable(false);
|
||||
this.head.setPrefSize(200, 40);
|
||||
|
||||
this.scheduledtime.setText(scheduledtime);
|
||||
this.scheduledtime.setEditable(false);
|
||||
this.scheduledtime.setPrefSize(200, 40);
|
||||
|
||||
|
||||
this.model.setText(model);
|
||||
this.model.setEditable(false);
|
||||
this.model.setPrefSize(200, 40);
|
||||
|
||||
this.productname.setText(productname);
|
||||
this.productname.setEditable(false);
|
||||
this.productname.setPrefSize(200, 40);
|
||||
|
||||
this.toolnumber.setText(toolnumber);
|
||||
this.toolnumber.setEditable(false);
|
||||
this.toolnumber.setPrefSize(200, 40);
|
||||
|
||||
this.toolname.setText(toolname);
|
||||
this.toolname.setEditable(false);
|
||||
this.toolname.setPrefSize(200, 40);
|
||||
|
||||
this.toolinglevel.setText(toolinglevel);
|
||||
this.toolinglevel.setEditable(false);
|
||||
this.toolinglevel.setPrefSize(200, 40);
|
||||
|
||||
|
||||
|
||||
this.reason.setText(reason);
|
||||
this.reason.setEditable(false);
|
||||
this.reason.setPrefSize(200, 40);
|
||||
|
||||
this.jsgyrequirements.setText(jsgyrequirements);
|
||||
this.jsgyrequirements.setEditable(false);
|
||||
this.jsgyrequirements.setPrefSize(200, 40);
|
||||
|
||||
this.cjgzxq.setText("设计");;
|
||||
this.cjgzxq.setPrefSize(200, 40);
|
||||
this.link.setText("打开");
|
||||
this.link.setPrefSize(200, 40);
|
||||
this.linkStr = link;
|
||||
this.sfIdStr = sfId;
|
||||
this.instanceIdStr = instanceId;
|
||||
this.session = session;
|
||||
|
||||
this.state.setText(state);
|
||||
this.state.setEditable(false);
|
||||
this.state.setPrefSize(200, 40);
|
||||
|
||||
this.xh.setText(xh);
|
||||
this.xh.setEditable(false);
|
||||
this.xh.setPrefSize(200, 40);
|
||||
|
||||
//加按钮监听
|
||||
this.link.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
System.out.println("Button was clicked!");
|
||||
// 在这里可以添加更多的逻辑
|
||||
try {
|
||||
browse2(linkStr);
|
||||
} catch (Exception e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//加按钮监听 创建对象
|
||||
this.cjgzxq.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
System.out.println("Button was clicked!");
|
||||
// 在这里可以添加更多的逻辑
|
||||
|
||||
String formnumber = instanceIdStr;
|
||||
String sfid =sfIdStr;
|
||||
AbstractAIFApplication app = AIFUtility.getCurrentApplication();
|
||||
InterfaceAIFComponent target = app.getTargetComponent();
|
||||
if(target instanceof TCComponentFolder) {
|
||||
TCComponentFolder folder = (TCComponentFolder)target;
|
||||
try {
|
||||
TCComponentItemType typeComponent = (TCComponentItemType) session.getTypeComponent("ZT2_Frock");
|
||||
String newID = typeComponent.getNewID();
|
||||
TCComponentItem item = typeComponent.create(newID, "A", "ZT2_Frock", "", "", null);
|
||||
TCComponentItemRevision itemRev = item.getLatestItemRevision();
|
||||
if(itemRev != null && formnumber != null && !formnumber.isEmpty()) {
|
||||
itemRev.setStringProperty("zt2_formnumber", formnumber);
|
||||
}
|
||||
if(itemRev != null && sfid != null && !sfid.isEmpty()) {
|
||||
itemRev.setStringProperty("zt2_sfid", sfid);
|
||||
}
|
||||
folder.add("contents", item);
|
||||
folder.refresh();
|
||||
} catch (Exception e2) {
|
||||
// TODO: handle exception
|
||||
e2.printStackTrace();
|
||||
}
|
||||
|
||||
}else {
|
||||
try {
|
||||
TCComponentItemType typeComponent = (TCComponentItemType) session.getTypeComponent("ZT2_Frock");
|
||||
String newID = typeComponent.getNewID();
|
||||
TCComponentItem item = typeComponent.create(newID, "A", "ZT2_Frock", "", "", null);
|
||||
TCComponentItemRevision itemRev = item.getLatestItemRevision();
|
||||
if(itemRev != null && formnumber != null && !formnumber.isEmpty()) {
|
||||
itemRev.setStringProperty("zt2_formnumber", formnumber);
|
||||
|
||||
}
|
||||
if(itemRev != null && sfid != null && !sfid.isEmpty()) {
|
||||
itemRev.setStringProperty("zt2_sfid", sfid);
|
||||
}
|
||||
session.getUser().getNewStuffFolder().add("contents", item);
|
||||
} catch (Exception e2) {
|
||||
// TODO: handle exception
|
||||
e2.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public TextArea getInstanceId() {
|
||||
return instanceId;
|
||||
}
|
||||
public void setInstanceId(TextArea instanceId) {
|
||||
this.instanceId = instanceId;
|
||||
}
|
||||
public TextArea getFactory() {
|
||||
return factory;
|
||||
}
|
||||
public void setFactory(TextArea factory) {
|
||||
this.factory = factory;
|
||||
}
|
||||
public TextArea getSfId() {
|
||||
return sfId;
|
||||
}
|
||||
public void setSfId(TextArea sfId) {
|
||||
this.sfId = sfId;
|
||||
}
|
||||
public TextArea getHead() {
|
||||
return head;
|
||||
}
|
||||
public void setHead(TextArea head) {
|
||||
this.head = head;
|
||||
}
|
||||
public TextArea getScheduledtime() {
|
||||
return scheduledtime;
|
||||
}
|
||||
public void setScheduledtime(TextArea scheduledtime) {
|
||||
this.scheduledtime = scheduledtime;
|
||||
}
|
||||
public TextArea getModel() {
|
||||
return model;
|
||||
}
|
||||
public void setModel(TextArea model) {
|
||||
this.model = model;
|
||||
}
|
||||
public TextArea getProductname() {
|
||||
return productname;
|
||||
}
|
||||
public void setProductname(TextArea productname) {
|
||||
this.productname = productname;
|
||||
}
|
||||
public TextArea getToolnumber() {
|
||||
return toolnumber;
|
||||
}
|
||||
public void setToolnumber(TextArea toolnumber) {
|
||||
this.toolnumber = toolnumber;
|
||||
}
|
||||
public TextArea getToolname() {
|
||||
return toolname;
|
||||
}
|
||||
public void setToolname(TextArea toolname) {
|
||||
this.toolname = toolname;
|
||||
}
|
||||
public TextArea getToolinglevel() {
|
||||
return toolinglevel;
|
||||
}
|
||||
public void setToolinglevel(TextArea toolinglevel) {
|
||||
this.toolinglevel = toolinglevel;
|
||||
}
|
||||
public TextArea getReason() {
|
||||
return reason;
|
||||
}
|
||||
public void setReason(TextArea reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
public Button getCjgzxq() {
|
||||
return cjgzxq;
|
||||
}
|
||||
public void setCjgzxq(Button cjgzxq) {
|
||||
this.cjgzxq = cjgzxq;
|
||||
}
|
||||
public Button getLink() {
|
||||
return link;
|
||||
}
|
||||
public void setLink(Button link) {
|
||||
this.link = link;
|
||||
}
|
||||
public TextArea getState() {
|
||||
return state;
|
||||
}
|
||||
public void setState(TextArea state) {
|
||||
this.state = state;
|
||||
}
|
||||
public TextArea getXh() {
|
||||
return xh;
|
||||
}
|
||||
public void setXh(TextArea xh) {
|
||||
this.xh = xh;
|
||||
}
|
||||
|
||||
|
||||
public TextArea getJsgyrequirements() {
|
||||
return jsgyrequirements;
|
||||
}
|
||||
|
||||
public void setJsgyrequirements(TextArea jsgyrequirements) {
|
||||
this.jsgyrequirements = jsgyrequirements;
|
||||
}
|
||||
|
||||
public String getLinkStr() {
|
||||
return linkStr;
|
||||
}
|
||||
|
||||
public void setLinkStr(String linkStr) {
|
||||
this.linkStr = linkStr;
|
||||
}
|
||||
|
||||
public String getSfIdStr() {
|
||||
return sfIdStr;
|
||||
}
|
||||
|
||||
public void setSfIdStr(String sfIdStr) {
|
||||
this.sfIdStr = sfIdStr;
|
||||
}
|
||||
|
||||
public String getInstanceIdStr() {
|
||||
return instanceIdStr;
|
||||
}
|
||||
|
||||
public void setInstanceIdStr(String instanceIdStr) {
|
||||
this.instanceIdStr = instanceIdStr;
|
||||
}
|
||||
|
||||
public TCSession getSession() {
|
||||
return session;
|
||||
}
|
||||
|
||||
public void setSession(TCSession session) {
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过浏览器打开连接
|
||||
*/
|
||||
private void browse2(String url) throws Exception {
|
||||
Desktop desktop = Desktop.getDesktop();
|
||||
if (Desktop.isDesktopSupported() && desktop.isSupported(Desktop.Action.BROWSE)) {
|
||||
URI uri = new URI(url);
|
||||
desktop.browse(uri);
|
||||
}
|
||||
}
|
||||
// public GzxqBean() {
|
||||
// super();
|
||||
// }
|
||||
//
|
||||
// public String getInstanceId() {
|
||||
// return instanceId;
|
||||
// }
|
||||
//
|
||||
// public void setInstanceId(String instanceId) {
|
||||
// this.instanceId = instanceId;
|
||||
// }
|
||||
//
|
||||
// public String getFactory() {
|
||||
// return factory;
|
||||
// }
|
||||
//
|
||||
// public void setFactory(String factory) {
|
||||
// this.factory = factory;
|
||||
// }
|
||||
//
|
||||
// public String getSfId() {
|
||||
// return sfId;
|
||||
// }
|
||||
//
|
||||
// public void setSfId(String sfId) {
|
||||
// this.sfId = sfId;
|
||||
// }
|
||||
//
|
||||
// public String getHead() {
|
||||
// return head;
|
||||
// }
|
||||
//
|
||||
// public void setHead(String head) {
|
||||
// this.head = head;
|
||||
// }
|
||||
//
|
||||
// public String getScheduledtime() {
|
||||
// return scheduledtime;
|
||||
// }
|
||||
//
|
||||
// public void setScheduledtime(String scheduledtime) {
|
||||
// this.scheduledtime = scheduledtime;
|
||||
// }
|
||||
//
|
||||
// public String getModel() {
|
||||
// return model;
|
||||
// }
|
||||
//
|
||||
// public void setModel(String model) {
|
||||
// this.model = model;
|
||||
// }
|
||||
//
|
||||
// public String getProductname() {
|
||||
// return productname;
|
||||
// }
|
||||
//
|
||||
// public void setProductname(String productname) {
|
||||
// this.productname = productname;
|
||||
// }
|
||||
//
|
||||
// public String getToolnumber() {
|
||||
// return toolnumber;
|
||||
// }
|
||||
//
|
||||
// public void setToolnumber(String toolnumber) {
|
||||
// this.toolnumber = toolnumber;
|
||||
// }
|
||||
//
|
||||
// public String getToolname() {
|
||||
// return toolname;
|
||||
// }
|
||||
//
|
||||
// public void setToolname(String toolname) {
|
||||
// this.toolname = toolname;
|
||||
// }
|
||||
//
|
||||
// public String getToolinglevel() {
|
||||
// return toolinglevel;
|
||||
// }
|
||||
//
|
||||
// public void setToolinglevel(String toolinglevel) {
|
||||
// this.toolinglevel = toolinglevel;
|
||||
// }
|
||||
//
|
||||
// public String getReason() {
|
||||
// return reason;
|
||||
// }
|
||||
//
|
||||
// public void setReason(String reason) {
|
||||
// this.reason = reason;
|
||||
// }
|
||||
//
|
||||
// public String getJsgyrequirements() {
|
||||
// return jsgyrequirements;
|
||||
// }
|
||||
//
|
||||
// public void setJsgyrequirements(String jsgyrequirements) {
|
||||
// this.jsgyrequirements = jsgyrequirements;
|
||||
// }
|
||||
//
|
||||
// public String getLink() {
|
||||
// return link;
|
||||
// }
|
||||
//
|
||||
// public void setLink(String link) {
|
||||
// this.link = link;
|
||||
// }
|
||||
//
|
||||
// public String getState() {
|
||||
// return state;
|
||||
// }
|
||||
//
|
||||
// public void setState(String state) {
|
||||
// this.state = state;
|
||||
// }
|
||||
//
|
||||
// public GzxqBean(String instanceId, String factory, String sfId, String head, String scheduledtime, String model,
|
||||
// String productname, String toolnumber, String toolname, String toolinglevel, String reason,
|
||||
// String jsgyrequirements, String link, String state) {
|
||||
// super();
|
||||
// this.instanceId = instanceId;
|
||||
// this.factory = factory;
|
||||
// this.sfId = sfId;
|
||||
// this.head = head;
|
||||
// this.scheduledtime = scheduledtime;
|
||||
// this.model = model;
|
||||
// this.productname = productname;
|
||||
// this.toolnumber = toolnumber;
|
||||
// this.toolname = toolname;
|
||||
// this.toolinglevel = toolinglevel;
|
||||
// this.reason = reason;
|
||||
// this.jsgyrequirements = jsgyrequirements;
|
||||
// this.link = link;
|
||||
// this.state = state;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String toString() {
|
||||
// return "GzxqBean [instanceId=" + instanceId + ", factory=" + factory + ", sfId=" + sfId + ", head=" + head
|
||||
// + ", scheduledtime=" + scheduledtime + ", model=" + model + ", productname=" + productname
|
||||
// + ", toolnumber=" + toolnumber + ", toolname=" + toolname + ", toolinglevel=" + toolinglevel
|
||||
// + ", reason=" + reason + ", jsgyrequirements=" + jsgyrequirements + ", link=" + link + ", state="
|
||||
// + state + "]";
|
||||
// }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,124 +1,124 @@
|
||||
package com.connor.plm.GZXQ;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Desktop;
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.AbstractCellEditor;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.TableCellEditor;
|
||||
|
||||
import com.connor.plm.CostListManagement.pojo.Cusquotation;
|
||||
import com.connor.plm.CostListManagement.pojo.GzxqBean;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentFolder;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemType;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
|
||||
public class ButtonCellEditor extends AbstractCellEditor implements TableCellEditor{
|
||||
|
||||
|
||||
private JButton button;
|
||||
private JTable table;
|
||||
private List<GzxqBean> quotations;
|
||||
private Boolean flag = false;
|
||||
public static GzxqBean quotation;
|
||||
public static Cusquotation cusquotation;
|
||||
public static TCSession session;
|
||||
|
||||
public ButtonCellEditor(JTable jTable2,List<GzxqBean> quotations,TCSession session, TCComponent f) {
|
||||
button = new JButton();
|
||||
this.table = jTable2;
|
||||
this.quotations = quotations;
|
||||
this.session = session;
|
||||
button.addActionListener(e -> {
|
||||
// 这里可以添加按钮的点击事件响应逻辑
|
||||
int selectedRow = table.getSelectedRow();
|
||||
System.out.println("点击了第"+selectedRow+"行");
|
||||
String text = button.getText();
|
||||
System.out.println("点击按钮名称:"+text);
|
||||
if("打开".equals(text)) {
|
||||
String url = quotations.get(selectedRow).getLink();
|
||||
try {
|
||||
browse2(url);
|
||||
} catch (Exception e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}else if("设计".equals(text)){
|
||||
String formnumber = quotations.get(selectedRow).getInstanceId();
|
||||
String sfid = quotations.get(selectedRow).getSfId();
|
||||
AbstractAIFApplication app = AIFUtility.getCurrentApplication();
|
||||
InterfaceAIFComponent target = app.getTargetComponent();
|
||||
if(target instanceof TCComponentFolder) {
|
||||
TCComponentFolder folder = (TCComponentFolder)target;
|
||||
try {
|
||||
TCComponentItemType typeComponent = (TCComponentItemType) session.getTypeComponent("ZT2_Frock");
|
||||
String newID = typeComponent.getNewID();
|
||||
TCComponentItem item = typeComponent.create(newID, "A", "ZT2_Frock", "", "", null);
|
||||
TCComponentItemRevision itemRev = item.getLatestItemRevision();
|
||||
if(itemRev != null && formnumber != null && !formnumber.isEmpty()) {
|
||||
itemRev.setStringProperty("zt2_formnumber", formnumber);
|
||||
}
|
||||
if(itemRev != null && sfid != null && !sfid.isEmpty()) {
|
||||
itemRev.setStringProperty("zt2_sfid", sfid);
|
||||
}
|
||||
folder.add("contents", item);
|
||||
folder.refresh();
|
||||
} catch (Exception e2) {
|
||||
// TODO: handle exception
|
||||
e2.printStackTrace();
|
||||
}
|
||||
|
||||
}else {
|
||||
try {
|
||||
TCComponentItemType typeComponent = (TCComponentItemType) session.getTypeComponent("ZT2_Frock");
|
||||
String newID = typeComponent.getNewID();
|
||||
TCComponentItem item = typeComponent.create(newID, "A", "ZT2_Frock", "", "", null);
|
||||
TCComponentItemRevision itemRev = item.getLatestItemRevision();
|
||||
if(itemRev != null && formnumber != null && !formnumber.isEmpty()) {
|
||||
itemRev.setStringProperty("zt2_formnumber", formnumber);
|
||||
|
||||
}
|
||||
if(itemRev != null && sfid != null && !sfid.isEmpty()) {
|
||||
itemRev.setStringProperty("zt2_sfid", sfid);
|
||||
}
|
||||
session.getUser().getNewStuffFolder().add("contents", item);
|
||||
} catch (Exception e2) {
|
||||
// TODO: handle exception
|
||||
e2.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
private void browse2(String url) throws Exception {
|
||||
Desktop desktop = Desktop.getDesktop();
|
||||
if (Desktop.isDesktopSupported() && desktop.isSupported(Desktop.Action.BROWSE)) {
|
||||
URI uri = new URI(url);
|
||||
desktop.browse(uri);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected,
|
||||
int row, int column) {
|
||||
button.setText(value != null ? value.toString() : "");
|
||||
return button;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getCellEditorValue() {
|
||||
return button.getText();
|
||||
}
|
||||
|
||||
}
|
||||
//package com.connor.plm.GZXQ;
|
||||
//
|
||||
//import java.awt.Component;
|
||||
//import java.awt.Desktop;
|
||||
//import java.net.URI;
|
||||
//import java.util.List;
|
||||
//
|
||||
//import javax.swing.AbstractCellEditor;
|
||||
//import javax.swing.JButton;
|
||||
//import javax.swing.JTable;
|
||||
//import javax.swing.table.TableCellEditor;
|
||||
//
|
||||
//import com.connor.plm.CostListManagement.pojo.Cusquotation;
|
||||
//import com.connor.plm.CostListManagement.pojo.GzxqBean;
|
||||
//import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
//import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
//import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
//import com.teamcenter.rac.kernel.TCComponent;
|
||||
//import com.teamcenter.rac.kernel.TCComponentFolder;
|
||||
//import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
//import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
//import com.teamcenter.rac.kernel.TCComponentItemType;
|
||||
//import com.teamcenter.rac.kernel.TCSession;
|
||||
//
|
||||
//public class ButtonCellEditor extends AbstractCellEditor implements TableCellEditor{
|
||||
//
|
||||
//
|
||||
// private JButton button;
|
||||
// private JTable table;
|
||||
// private List<GzxqBean> quotations;
|
||||
// private Boolean flag = false;
|
||||
// public static GzxqBean quotation;
|
||||
// public static Cusquotation cusquotation;
|
||||
// public static TCSession session;
|
||||
//
|
||||
// public ButtonCellEditor(JTable jTable2,List<GzxqBean> quotations,TCSession session, TCComponent f) {
|
||||
// button = new JButton();
|
||||
// this.table = jTable2;
|
||||
// this.quotations = quotations;
|
||||
// this.session = session;
|
||||
// button.addActionListener(e -> {
|
||||
// // 这里可以添加按钮的点击事件响应逻辑
|
||||
// int selectedRow = table.getSelectedRow();
|
||||
// System.out.println("点击了第"+selectedRow+"行");
|
||||
// String text = button.getText();
|
||||
// System.out.println("点击按钮名称:"+text);
|
||||
// if("打开".equals(text)) {
|
||||
// String url = quotations.get(selectedRow).getLink();
|
||||
// try {
|
||||
// browse2(url);
|
||||
// } catch (Exception e1) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e1.printStackTrace();
|
||||
// }
|
||||
// }else if("设计".equals(text)){
|
||||
// String formnumber = quotations.get(selectedRow).getInstanceId();
|
||||
// String sfid = quotations.get(selectedRow).getSfId();
|
||||
// AbstractAIFApplication app = AIFUtility.getCurrentApplication();
|
||||
// InterfaceAIFComponent target = app.getTargetComponent();
|
||||
// if(target instanceof TCComponentFolder) {
|
||||
// TCComponentFolder folder = (TCComponentFolder)target;
|
||||
// try {
|
||||
// TCComponentItemType typeComponent = (TCComponentItemType) session.getTypeComponent("ZT2_Frock");
|
||||
// String newID = typeComponent.getNewID();
|
||||
// TCComponentItem item = typeComponent.create(newID, "A", "ZT2_Frock", "", "", null);
|
||||
// TCComponentItemRevision itemRev = item.getLatestItemRevision();
|
||||
// if(itemRev != null && formnumber != null && !formnumber.isEmpty()) {
|
||||
// itemRev.setStringProperty("zt2_formnumber", formnumber);
|
||||
// }
|
||||
// if(itemRev != null && sfid != null && !sfid.isEmpty()) {
|
||||
// itemRev.setStringProperty("zt2_sfid", sfid);
|
||||
// }
|
||||
// folder.add("contents", item);
|
||||
// folder.refresh();
|
||||
// } catch (Exception e2) {
|
||||
// // TODO: handle exception
|
||||
// e2.printStackTrace();
|
||||
// }
|
||||
//
|
||||
// }else {
|
||||
// try {
|
||||
// TCComponentItemType typeComponent = (TCComponentItemType) session.getTypeComponent("ZT2_Frock");
|
||||
// String newID = typeComponent.getNewID();
|
||||
// TCComponentItem item = typeComponent.create(newID, "A", "ZT2_Frock", "", "", null);
|
||||
// TCComponentItemRevision itemRev = item.getLatestItemRevision();
|
||||
// if(itemRev != null && formnumber != null && !formnumber.isEmpty()) {
|
||||
// itemRev.setStringProperty("zt2_formnumber", formnumber);
|
||||
//
|
||||
// }
|
||||
// if(itemRev != null && sfid != null && !sfid.isEmpty()) {
|
||||
// itemRev.setStringProperty("zt2_sfid", sfid);
|
||||
// }
|
||||
// session.getUser().getNewStuffFolder().add("contents", item);
|
||||
// } catch (Exception e2) {
|
||||
// // TODO: handle exception
|
||||
// e2.printStackTrace();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// }
|
||||
//private void browse2(String url) throws Exception {
|
||||
// Desktop desktop = Desktop.getDesktop();
|
||||
// if (Desktop.isDesktopSupported() && desktop.isSupported(Desktop.Action.BROWSE)) {
|
||||
// URI uri = new URI(url);
|
||||
// desktop.browse(uri);
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//@Override
|
||||
//public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected,
|
||||
// int row, int column) {
|
||||
// button.setText(value != null ? value.toString() : "");
|
||||
// return button;
|
||||
//}
|
||||
//
|
||||
//@Override
|
||||
//public Object getCellEditorValue() {
|
||||
// return button.getText();
|
||||
//}
|
||||
//
|
||||
//}
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue