|
|
|
@ -43,10 +43,15 @@ import com.teamcenter.rac.util.PropertyLayout;
|
|
|
|
|
import com.teamcenter.rac.util.UIUtilities;
|
|
|
|
|
import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException;
|
|
|
|
|
import com.teamcenter.services.rac.core.DataManagementService;
|
|
|
|
|
import com.teamcenter.services.rac.core.LOVService;
|
|
|
|
|
import com.teamcenter.services.rac.core._2008_06.DataManagement.CreateIn;
|
|
|
|
|
import com.teamcenter.services.rac.core._2008_06.DataManagement.CreateInput;
|
|
|
|
|
import com.teamcenter.services.rac.core._2008_06.DataManagement.CreateOut;
|
|
|
|
|
import com.teamcenter.services.rac.core._2008_06.DataManagement.CreateResponse;
|
|
|
|
|
import com.teamcenter.services.rac.core._2013_05.LOV.InitialLovData;
|
|
|
|
|
import com.teamcenter.services.rac.core._2013_05.LOV.LOVSearchResults;
|
|
|
|
|
import com.teamcenter.services.rac.core._2013_05.LOV.LOVValueRow;
|
|
|
|
|
import com.teamcenter.services.rac.core._2013_05.LOV.LovFilterData;
|
|
|
|
|
import com.teamcenter.soaictstubs.BooleanHolder;
|
|
|
|
|
import com.teamcenter.soaictstubs.ICCTItem;
|
|
|
|
|
import com.teamcenter.soaictstubs.StringHolder;
|
|
|
|
@ -361,6 +366,7 @@ public class CreateTempDrawingDialog extends JFrame implements ActionListener{
|
|
|
|
|
itemDef.data.dateProps.put(trueName, calendar);
|
|
|
|
|
}else if (typeString.split(":")[0].equals("lov")) {
|
|
|
|
|
String trueValue = getLovTrueValue(trueName,value,this.lovPropertyList);
|
|
|
|
|
System.out.println("属性:"+propName+",最终赋值:"+trueValue);
|
|
|
|
|
itemDef.data.stringProps.put(trueName, trueValue);
|
|
|
|
|
}
|
|
|
|
|
}else if (location.equals("Rev")) {
|
|
|
|
@ -374,6 +380,7 @@ public class CreateTempDrawingDialog extends JFrame implements ActionListener{
|
|
|
|
|
itemRevisionDef.dateProps.put(trueName, calendar);
|
|
|
|
|
}else if (typeString.split(":")[0].equals("lov")) {
|
|
|
|
|
String trueValue = getLovTrueValue(trueName,value,this.lovPropertyList);
|
|
|
|
|
System.out.println("属性:"+propName+",最终赋值:"+trueValue);
|
|
|
|
|
itemRevisionDef.stringProps.put(trueName, trueValue);
|
|
|
|
|
}
|
|
|
|
|
}else if (location.equals("Form")) {
|
|
|
|
@ -747,23 +754,25 @@ public class CreateTempDrawingDialog extends JFrame implements ActionListener{
|
|
|
|
|
System.out.println("JTextField");
|
|
|
|
|
return ((JTextField) component).getText();
|
|
|
|
|
} else if (component instanceof JComboBox) {
|
|
|
|
|
String returnValue = null;
|
|
|
|
|
// String returnValue = null;
|
|
|
|
|
String chooseDisplay= null;
|
|
|
|
|
if (component instanceof JTreeComboBox){
|
|
|
|
|
System.out.println("JTreeComboBox");
|
|
|
|
|
JTreeComboBox treeComboBox = (JTreeComboBox) component;
|
|
|
|
|
DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) treeComboBox.getSelectedItem();
|
|
|
|
|
|
|
|
|
|
if (selectedNode != null) {
|
|
|
|
|
Object userObject = selectedNode.getUserObject();
|
|
|
|
|
returnValue = userObject.toString();
|
|
|
|
|
chooseDisplay = userObject.toString();
|
|
|
|
|
}else {
|
|
|
|
|
System.out.println("选中节点selectedNode = null");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
System.out.println("JComboBox");
|
|
|
|
|
JComboBox<String> comboBox = (JComboBox<String>) component;
|
|
|
|
|
returnValue = (String)comboBox.getSelectedItem();
|
|
|
|
|
chooseDisplay = (String)comboBox.getSelectedItem();
|
|
|
|
|
}
|
|
|
|
|
return returnValue;
|
|
|
|
|
return chooseDisplay;
|
|
|
|
|
}else if (component instanceof DateButton) {
|
|
|
|
|
System.out.println("DateButton");
|
|
|
|
|
DateButton dateButton = (DateButton) component;
|
|
|
|
@ -784,9 +793,9 @@ public class CreateTempDrawingDialog extends JFrame implements ActionListener{
|
|
|
|
|
/**
|
|
|
|
|
* 绘制对象类型的创建对话框
|
|
|
|
|
* @return
|
|
|
|
|
* @throws TCException
|
|
|
|
|
* @throws Exception
|
|
|
|
|
*/
|
|
|
|
|
public JFrame buildDrawingObjTypeFrame() throws TCException{
|
|
|
|
|
public JFrame buildDrawingObjTypeFrame() throws Exception{
|
|
|
|
|
System.out.println("创建新图纸界面!");
|
|
|
|
|
this.propComponentMap.clear();
|
|
|
|
|
this.lovPropertyList.clear();
|
|
|
|
@ -943,46 +952,72 @@ public class CreateTempDrawingDialog extends JFrame implements ActionListener{
|
|
|
|
|
System.out.println("未获取到属性["+name+"]配置的lov名称,请检查配置!");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
LovProperty lovProperty = new LovProperty();//自定义的lov类型的属性类:存放lov类型的属性信息
|
|
|
|
|
TCComponentListOfValues unitLov = TCLOVUtil.findLOVByName(tcSession, lovName);
|
|
|
|
|
String lovType = null;
|
|
|
|
|
if(unitLov != null){
|
|
|
|
|
lovType = unitLov.getType();
|
|
|
|
|
if (lovType != null && lovType.equals("ListOfValuesString")) {//传统lov:key-value
|
|
|
|
|
rMap.clear();
|
|
|
|
|
Map<String, String> lovMap = getLOVDisplay_value(tcSession, lovName);
|
|
|
|
|
lovProperty.setLovMap(lovMap);
|
|
|
|
|
lovProperty.setLovType("LOV");
|
|
|
|
|
} else if (lovType != null && lovType.equals("Fnd0ListOfValuesDynamic")) {//动态lov:数组
|
|
|
|
|
String[] dynamicLOV = getDynamicLOV(unitLov);
|
|
|
|
|
lovProperty.setLovType("DLOV");
|
|
|
|
|
List<String> dlovList = new ArrayList<>();
|
|
|
|
|
for (int i = 0; i < dynamicLOV.length; i++) {
|
|
|
|
|
dlovList.add(dynamicLOV[i]);
|
|
|
|
|
}
|
|
|
|
|
lovProperty.setDlovList(dlovList);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rMap.clear();
|
|
|
|
|
Map<String, String> lovMap = getLOVDisplay_value(tcSession, lovName);
|
|
|
|
|
// System.out.println("开始打印第一层lov:");
|
|
|
|
|
// for (String displayValue : lovMap.keySet()){
|
|
|
|
|
// System.out.println(" lovMap:"+displayValue+"--"+lovMap.get(displayValue));
|
|
|
|
|
// }
|
|
|
|
|
// printRMap();
|
|
|
|
|
|
|
|
|
|
// String[] displayLovName = lovMap.keySet().toArray(new String[0]);//lov显示值
|
|
|
|
|
LovProperty lovProperty = new LovProperty();//自定义的lov类型的属性类
|
|
|
|
|
lovProperty.setPropName(name);
|
|
|
|
|
lovProperty.setPropTrueName(trueName);
|
|
|
|
|
lovProperty.setLov(true);
|
|
|
|
|
lovProperty.setLovMap(lovMap);
|
|
|
|
|
|
|
|
|
|
this.lovPropertyList.add(lovProperty);
|
|
|
|
|
|
|
|
|
|
// JComboBox<String> propComboBox = new JComboBox<String>(displayLovName);
|
|
|
|
|
DefaultMutableTreeNode root = generateLovTreeNode(lovMap,rMap);
|
|
|
|
|
JTreeComboBox propComboBox = null;
|
|
|
|
|
if(root != null) {
|
|
|
|
|
propComboBox = new JTreeComboBox(root);
|
|
|
|
|
//根据lov的类型,渲染不同的lov组件
|
|
|
|
|
if (lovType.equals("ListOfValuesString")) {
|
|
|
|
|
DefaultMutableTreeNode root = generateLovTreeNode(lovProperty.getLovMap(),rMap);
|
|
|
|
|
JTreeComboBox propComboBox = null;
|
|
|
|
|
if(root != null) {
|
|
|
|
|
propComboBox = new JTreeComboBox(root);
|
|
|
|
|
GridBagConstraints gbcPropCombo = new GridBagConstraints();
|
|
|
|
|
gbcPropCombo.gridx = 1;
|
|
|
|
|
gbcPropCombo.gridy = propIndex;
|
|
|
|
|
gbcPropCombo.anchor = GridBagConstraints.WEST;
|
|
|
|
|
|
|
|
|
|
// 设置自定义宽度
|
|
|
|
|
Dimension propValueSize = new Dimension(200, propComboBox.getPreferredSize().height); // 将200设为所需的宽度
|
|
|
|
|
propComboBox.setPreferredSize(propValueSize);
|
|
|
|
|
|
|
|
|
|
centerPanel1.add(propComboBox, gbcPropCombo);
|
|
|
|
|
propComponentMap.put(validPropName, propComboBox);
|
|
|
|
|
}else {
|
|
|
|
|
System.out.println("绘制多层lov失败!");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
System.out.println("绘制多层lov失败!");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
String[] dlov = (String[]) lovProperty.getDlovList().toArray();
|
|
|
|
|
JComboBox<String> jComboBox = new JComboBox<String>(dlov);
|
|
|
|
|
|
|
|
|
|
GridBagConstraints gbcPropCombo = new GridBagConstraints();
|
|
|
|
|
gbcPropCombo.gridx = 1;
|
|
|
|
|
gbcPropCombo.gridy = propIndex;
|
|
|
|
|
gbcPropCombo.anchor = GridBagConstraints.WEST;
|
|
|
|
|
|
|
|
|
|
// 设置自定义宽度
|
|
|
|
|
Dimension propValueSize = new Dimension(200, jComboBox.getPreferredSize().height); // 将200设为所需的宽度
|
|
|
|
|
jComboBox.setPreferredSize(propValueSize);
|
|
|
|
|
|
|
|
|
|
GridBagConstraints gbcPropCombo = new GridBagConstraints();
|
|
|
|
|
gbcPropCombo.gridx = 1;
|
|
|
|
|
gbcPropCombo.gridy = propIndex;
|
|
|
|
|
gbcPropCombo.anchor = GridBagConstraints.WEST;
|
|
|
|
|
|
|
|
|
|
// 设置自定义宽度
|
|
|
|
|
Dimension propValueSize = new Dimension(200, propComboBox.getPreferredSize().height); // 将200设为所需的宽度
|
|
|
|
|
propComboBox.setPreferredSize(propValueSize);
|
|
|
|
|
|
|
|
|
|
centerPanel1.add(propComboBox, gbcPropCombo);
|
|
|
|
|
propComponentMap.put(validPropName, propComboBox);
|
|
|
|
|
centerPanel1.add(jComboBox, gbcPropCombo);
|
|
|
|
|
propComponentMap.put(validPropName, jComboBox);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
@ -1069,6 +1104,39 @@ public class CreateTempDrawingDialog extends JFrame implements ActionListener{
|
|
|
|
|
return node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取动态LOV值
|
|
|
|
|
* @param lov LOV对象
|
|
|
|
|
* @return LOV选项数组
|
|
|
|
|
*/
|
|
|
|
|
public String[] getDynamicLOV(TCComponentListOfValues lov) throws Exception {
|
|
|
|
|
Vector<String> lovDisplayValueList = new Vector<>();
|
|
|
|
|
// lovDisplayValueList.add("");
|
|
|
|
|
// Vector<String> lovValueList = new Vector<>();
|
|
|
|
|
com.teamcenter.services.rac.core.LOVService lovService = LOVService.getService(tcSession);
|
|
|
|
|
InitialLovData input = new InitialLovData();
|
|
|
|
|
LovFilterData filter = new LovFilterData();
|
|
|
|
|
filter.sortPropertyName = "object_name";
|
|
|
|
|
filter.order = 1;
|
|
|
|
|
filter.numberToReturn = 100;
|
|
|
|
|
filter.maxResults = 100;
|
|
|
|
|
|
|
|
|
|
input.lov = lov;
|
|
|
|
|
input.filterData = filter;
|
|
|
|
|
LOVSearchResults result = lovService.getInitialLOVValues(input);
|
|
|
|
|
for (LOVValueRow row : result.lovValues) {
|
|
|
|
|
Map<String, String[]> map = row.propDisplayValues;
|
|
|
|
|
// Map<String, String[]> realmap = row.propInternalValues;
|
|
|
|
|
for (String key : map.keySet()) {
|
|
|
|
|
lovDisplayValueList.add(map.get(key)[0]);
|
|
|
|
|
// lovValueList.add(realmap.get(key)[0]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return lovDisplayValueList.toArray(new String[lovDisplayValueList.size()]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据选中对象(业务逻辑)获取ID输入框中的默认值
|
|
|
|
|
* @param selectComponent2 选中对象
|
|
|
|
@ -1117,7 +1185,6 @@ public class CreateTempDrawingDialog extends JFrame implements ActionListener{
|
|
|
|
|
*/
|
|
|
|
|
public static Map<String, String> getLOVDisplay_value(TCSession seesion,String lovProp) throws TCException
|
|
|
|
|
{
|
|
|
|
|
// System.out.println("getLOVDisplay_value方法入参:lov名称="+lovProp);
|
|
|
|
|
Map<String, String> Display_values = new HashMap<String, String>();
|
|
|
|
|
|
|
|
|
|
TCComponentListOfValues unitLov = TCLOVUtil.findLOVByName(seesion, lovProp);
|
|
|
|
|