Browse Source

Pull request #4548: REPORT-53731 关闭窗口触发doCancel事件 & REPORT-53739 提供单按钮ui

Merge in DESIGN/design from ~VITO/c-design:feature/10.0 to feature/10.0

* commit 'db5d7270fd7e06b96839171c9b48ff5ab536d055':
  REPORT-53739 提供单按钮ui
  REPORT-53731 关闭窗口触发doCancel事件
feature/10.0
vito 3 years ago
parent
commit
55c8fa0f38
  1. 29
      designer-base/src/main/java/com/fr/design/dialog/UIExpandDialog.java
  2. 1
      designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java

29
designer-base/src/main/java/com/fr/design/dialog/UIExpandDialog.java

@ -6,6 +6,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.Icon;
@ -64,7 +65,7 @@ public class UIExpandDialog extends UIDialog {
private final UILabel narrow = new UILabel();
private final UILabel narrowHit = new UILabel();
private final UIButton buttonOK;
private final UIButton buttonCancel;
private UIButton buttonCancel = null;
private JLabel msg;
private final UITextArea textArea = new UITextArea();
@ -73,7 +74,9 @@ public class UIExpandDialog extends UIDialog {
String okText, String cancelText, boolean isExpand) {
super(owner);
buttonOK = new UIButton(okText);
buttonCancel = new UIButton(cancelText);
if (!StringUtils.isEmpty(cancelText)) {
buttonCancel = new UIButton(cancelText);
}
setTitle(title);
setModal(isModal);
initComponents(messageType, message, detail, isModal, isExpand, null);
@ -82,7 +85,9 @@ public class UIExpandDialog extends UIDialog {
public UIExpandDialog(Builder builder) {
super(builder.owner);
buttonOK = new UIButton(builder.okText);
buttonCancel = new UIButton(builder.cancelText);
if (!StringUtils.isEmpty(builder.cancelText)) {
buttonCancel = new UIButton(builder.cancelText);
}
setTitle(builder.title);
setModal(builder.modal);
initComponents(builder.messageType, builder.message, builder.detail,
@ -91,7 +96,7 @@ public class UIExpandDialog extends UIDialog {
public void initComponents(int messageType, String message, String detail,
boolean isModal, boolean isExpand, DialogActionListener l) {
applyClosingAction();
setLayout(new BorderLayout(GAP, GAP));
setResizable(false);
setModal(isModal);
@ -133,7 +138,9 @@ public class UIExpandDialog extends UIDialog {
// 操作面板
JPanel actionPanel = new JPanel();
actionPanel.setLayout(new FlowLayout(FlowLayout.CENTER, MARGIN, MARGIN));
actionPanel.add(buttonCancel);
if (buttonCancel != null) {
actionPanel.add(buttonCancel);
}
actionPanel.add(buttonOK);
add(actionPanel, BorderLayout.SOUTH);
@ -185,11 +192,13 @@ public class UIExpandDialog extends UIDialog {
}
});
buttonCancel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doCancel();
}
});
if (buttonCancel != null) {
buttonCancel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doCancel();
}
});
}
}
protected Icon getIconForType(int messageType) {

1
designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java

@ -178,6 +178,7 @@ public class DesignerAppUtils {
} else {
UIExpandDialog.Builder().owner(DesignerContext.getDesignerFrame())
.title(Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"))
.cancelText(StringUtils.EMPTY)
.message(Toolkit.i18nText("Fine-Design_Template_Plugin_Error_Message_Remote"))
.detail(detail)
.build()

Loading…
Cancel
Save