feat(CreateTempDrawingDialog): 优化临时图纸创建界面并添加滚动条

- 为 CreateTempDrawingDialog 类添加垂直滚动条,确保在内容较多时可以滚动查看
- 优化表单属性设置逻辑,增加空值判断避免潜在错误- 添加创建成功或失败的提示消息
- 移除 plugin.xml 中的冗余注释代码
mian
熊朝柱 2 weeks ago
parent 9444e41148
commit 2765245a0e

@ -11,11 +11,5 @@
<menuContribution locationURI="menu:custWJ?after=projectCust">
<command commandId="CreateTempDrawing" id="cn.net.connor.createTempDrawing.menu.createTempDrawing" mnemonic="S"/>
</menuContribution>
<!--<menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=additions">
<menu label="测试" mnemonic="M" id="DesignToPartCommand">
<command commandId="cn.net.connor.designtopart.commands.DesignToPartCommand" id="cn.net.connor.designtopart.menu.designtopart"/>
</menu>
</menuContribution>-->
</extension>
</plugin>

@ -457,6 +457,9 @@ public class CreateTempDrawingDialog extends JFrame implements ActionListener{
}
}
MessageBox.post("对象【"+item_id+"】创建完成!" , "提示", MessageBox.INFORMATION);
}else {
MessageBox.post("对象【"+item_id+"】创建失败!" , "提示", MessageBox.ERROR);
}
}
@ -538,9 +541,11 @@ public class CreateTempDrawingDialog extends JFrame implements ActionListener{
finalPropValue = tValueString;
}
if (finalPropValue != null) {
System.out.println("设置表单属性["+tNameString+"]="+finalPropValue);
setTCPropertyValue(form,tNameString,finalPropValue);
}
System.out.println("设置表单属性["+tNameString+"]="+finalPropValue);
setTCPropertyValue(form,tNameString,finalPropValue);
}
}
System.out.println("表单属性赋值完成!");
@ -577,6 +582,9 @@ public class CreateTempDrawingDialog extends JFrame implements ActionListener{
* @throws
*/
public static void setTCPropertyValue(TCComponent item, String propertyName, Object value) {
if (item == null || propertyName == null || value == null) {
return;
}
try {
String type2 = item.getType();
TCProperty tcProperty = item.getTCProperty(propertyName);
@ -828,7 +836,18 @@ public class CreateTempDrawingDialog extends JFrame implements ActionListener{
this.setSize(400, 500);
this.setLayout(new BorderLayout());
// 创建滚动面板
JScrollPane scrollPane = new JScrollPane();
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); // 垂直滚动条始终显示
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); // 禁用水平滚动条
JPanel centerPanel1 = new JPanel(new GridBagLayout());
// 设置内容面板的最小高度(确保滚动条生效)
centerPanel1.setMinimumSize(new Dimension(380, 800)); // 根据实际内容调整高度
scrollPane.setViewportView(centerPanel1); // 将内容面板放入滚动面板
JPanel buttomPanel1 = new JPanel(new FlowLayout());
//1.属性条目区域
@ -1071,7 +1090,8 @@ public class CreateTempDrawingDialog extends JFrame implements ActionListener{
this.closeButton.addActionListener(this);
this.buildButton.addActionListener(this);
frame.add(centerPanel1, BorderLayout.CENTER);
// 将滚动面板添加到框架中央
frame.add(scrollPane, BorderLayout.CENTER);
frame.add(buttomPanel1, BorderLayout.SOUTH);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

Loading…
Cancel
Save