diff --git a/designer-base/src/main/java/com/fr/design/dialog/UIExpandDialog.java b/designer-base/src/main/java/com/fr/design/dialog/UIExpandDialog.java index 60ee096c3d..328b59f729 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/UIExpandDialog.java +++ b/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) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java index e0dfb3b6cb..b9f84d23a7 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java +++ b/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()