@ -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 buttonCance l;
private UIButton buttonCancel = nul l;
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 ) {