|
|
|
@ -95,10 +95,9 @@ public class CreateTempDrawingDialog extends JFrame implements ActionListener{
|
|
|
|
|
*/
|
|
|
|
|
public List<String> getPreferenceInfos(String preferenceName) {
|
|
|
|
|
List<String> drawingObjPropInfosList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
TCPreferenceService preferenceService = tcSession.getPreferenceService();
|
|
|
|
|
String[] values = preferenceService.getStringValues(preferenceName);
|
|
|
|
|
if (values.length > 0) {
|
|
|
|
|
if (values != null && values.length > 0) {
|
|
|
|
|
for (int i = 0; i < values.length; i++) {
|
|
|
|
|
drawingObjPropInfosList.add(values[i]);
|
|
|
|
|
}
|
|
|
|
@ -245,6 +244,8 @@ public class CreateTempDrawingDialog extends JFrame implements ActionListener{
|
|
|
|
|
if(!checkRequiredProp()){
|
|
|
|
|
System.out.println("校验未通过!");
|
|
|
|
|
return ;
|
|
|
|
|
}else {
|
|
|
|
|
System.out.println("校验已通过!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -268,7 +269,9 @@ public class CreateTempDrawingDialog extends JFrame implements ActionListener{
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean checkRequiredProp() {
|
|
|
|
|
System.out.println("propComponentMap.size="+propComponentMap.size());
|
|
|
|
|
if (propComponentMap.size()>0) {
|
|
|
|
|
System.out.println("1");
|
|
|
|
|
for (Map.Entry<String, JComponent> entry : propComponentMap.entrySet()) {
|
|
|
|
|
String key = entry.getKey();
|
|
|
|
|
Object value = getComponentValue(entry.getValue());
|
|
|
|
@ -289,21 +292,31 @@ public class CreateTempDrawingDialog extends JFrame implements ActionListener{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取组件的值
|
|
|
|
|
* @根据不同类型的组件获取组件的值
|
|
|
|
|
* @param component
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public String getComponentValue(JComponent component) {
|
|
|
|
|
System.out.println("开始根据不同类型的组件取值");
|
|
|
|
|
if (component instanceof JTextField) {
|
|
|
|
|
System.out.println("JTextField");
|
|
|
|
|
return ((JTextField) component).getText();
|
|
|
|
|
} else if (component instanceof JComboBox) {
|
|
|
|
|
System.out.println("JComboBox");
|
|
|
|
|
JComboBox<String> comboBox = (JComboBox<String>) component;
|
|
|
|
|
return (String)comboBox.getSelectedItem();
|
|
|
|
|
} else if (component instanceof DateButton) {
|
|
|
|
|
System.out.println("DateButton");
|
|
|
|
|
DateButton dateButton = (DateButton) component;
|
|
|
|
|
Date date = dateButton.getDate();
|
|
|
|
|
if (date == null){
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
String dateInput = dateFormat.format(date).replaceAll("(\\d{4})-0(\\d)-", "$1-$2-") + " 00:00";
|
|
|
|
|
System.out.println("dateInput="+dateInput);
|
|
|
|
|
return dateInput;
|
|
|
|
|
}else {
|
|
|
|
|
System.out.println("意料之外的组件!");
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
@ -339,7 +352,6 @@ public class CreateTempDrawingDialog extends JFrame implements ActionListener{
|
|
|
|
|
this.revComboBox = new JComboBox<String>(revs);
|
|
|
|
|
// this.revComboBox.setEditable(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//布局
|
|
|
|
|
// ID Label
|
|
|
|
|
GridBagConstraints gbcIdLabel = new GridBagConstraints();
|
|
|
|
@ -385,11 +397,12 @@ public class CreateTempDrawingDialog extends JFrame implements ActionListener{
|
|
|
|
|
propComponentMap.put("版本", revComboBox);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String preferenceName = getSelectTypePreferenceName();
|
|
|
|
|
System.out.println("preferenceName = " + preferenceName);
|
|
|
|
|
int propIndex = 2;
|
|
|
|
|
if (preferenceName != null){
|
|
|
|
|
List<String> propList = getPreferenceInfos(preferenceName);
|
|
|
|
|
System.out.println("propList.size = "+propList.size());
|
|
|
|
|
for(String propInfo : propList){//propInfo格式为:*有效期=Form.sb6_validuntil=date=Form.sb6_validuntil
|
|
|
|
|
String[] propConfigInfoArray= propInfo.split("=");
|
|
|
|
|
String validPropName = null;
|
|
|
|
|