@ -6,6 +6,9 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext ;
import com.fr.design.mainframe.DesignerContext ;
import com.fr.stable.Constants ;
import com.fr.stable.Constants ;
import java.awt.Dialog ;
import java.awt.Frame ;
import java.awt.Window ;
import javax.swing.BorderFactory ;
import javax.swing.BorderFactory ;
import javax.swing.Icon ;
import javax.swing.Icon ;
import javax.swing.JEditorPane ;
import javax.swing.JEditorPane ;
@ -30,12 +33,15 @@ public class DesignerToastMsgUtil {
public static void toastPrompt ( JPanel contendPane ) {
public static void toastPrompt ( JPanel contendPane ) {
toastPane ( PROMPT_ICON , contendPane ) ;
toastPane ( PROMPT_ICON , contendPane , DesignerContext . getDesignerFrame ( ) ) ;
}
}
public static void toastWarning ( JPanel contendPane ) {
public static void toastWarning ( JPanel contendPane ) {
toastPane ( WARNING_ICON , contendPane ) ;
toastPane ( WARNING_ICON , contendPane , DesignerContext . getDesignerFrame ( ) ) ;
}
public static void toastWarning ( JPanel contendPane , Window parent ) {
toastPane ( WARNING_ICON , contendPane , parent ) ;
}
}
public static void toastPrompt ( String promptInfo ) {
public static void toastPrompt ( String promptInfo ) {
@ -46,6 +52,10 @@ public class DesignerToastMsgUtil {
toastWarning ( toastPane ( warningInfo ) ) ;
toastWarning ( toastPane ( warningInfo ) ) ;
}
}
public static void toastWarning ( String warningInfo , Window parent ) {
toastWarning ( toastPane ( warningInfo ) , parent ) ;
}
private static JPanel toastPane ( String text ) {
private static JPanel toastPane ( String text ) {
UILabel promptLabel = new UILabel ( "<html>" + text + "</html>" ) ;
UILabel promptLabel = new UILabel ( "<html>" + text + "</html>" ) ;
JPanel jPanel = FRGUIPaneFactory . createBorderLayout_S_Pane ( ) ;
JPanel jPanel = FRGUIPaneFactory . createBorderLayout_S_Pane ( ) ;
@ -58,7 +68,7 @@ public class DesignerToastMsgUtil {
return jPanel ;
return jPanel ;
}
}
private static void toastPane ( Icon icon , JPanel contendPane ) {
private static void toastPane ( Icon icon , JPanel contendPane , Window parent ) {
JPanel pane = FRGUIPaneFactory . createBorderLayout_S_Pane ( ) ;
JPanel pane = FRGUIPaneFactory . createBorderLayout_S_Pane ( ) ;
UILabel uiLabel = new UILabel ( icon ) ;
UILabel uiLabel = new UILabel ( icon ) ;
uiLabel . setVerticalAlignment ( SwingConstants . TOP ) ;
uiLabel . setVerticalAlignment ( SwingConstants . TOP ) ;
@ -67,7 +77,12 @@ public class DesignerToastMsgUtil {
pane . add ( contendPane , BorderLayout . CENTER ) ;
pane . add ( contendPane , BorderLayout . CENTER ) ;
pane . setBorder ( BorderFactory . createEmptyBorder ( 8 , 15 , 8 , 15 ) ) ;
pane . setBorder ( BorderFactory . createEmptyBorder ( 8 , 15 , 8 , 15 ) ) ;
contendPane . setBorder ( BorderFactory . createEmptyBorder ( 0 , 10 , 0 , 0 ) ) ;
contendPane . setBorder ( BorderFactory . createEmptyBorder ( 0 , 10 , 0 , 0 ) ) ;
ToastMsgDialog dialog = new ToastMsgDialog ( DesignerContext . getDesignerFrame ( ) , pane ) ;
ToastMsgDialog dialog ;
if ( parent instanceof Dialog ) {
dialog = new ToastMsgDialog ( ( Dialog ) parent , pane ) ;
} else {
dialog = new ToastMsgDialog ( ( Frame ) parent , pane ) ;
}
dialog . setVisible ( true ) ;
dialog . setVisible ( true ) ;
}
}