Subversion Repository Public Repository

litesoft

Diff Revisions 949 vs 950 for /trunk/Java/GWT/Client/src/org/litesoft/GWT/client/AlertErrorDialog.java

Diff revisions: vs.
  @@ -1,65 +1,65 @@
1 - // This Source Code is in the Public Domain per: http://unlicense.org
2 - package org.litesoft.GWT.client;
3 -
4 - import org.litesoft.GWT.client.nonpublic.*;
5 - import org.litesoft.GWT.client.widgets.Button;
6 - import org.litesoft.GWT.client.widgets.*;
7 - import org.litesoft.commonfoundation.typeutils.*;
8 -
9 - import com.google.gwt.event.dom.client.*;
10 - import com.google.gwt.user.client.ui.*;
11 -
12 - public class AlertErrorDialog extends AbstractMessageDialog {
13 - private static final String VERSION_PANEL_STYLE = "litesoft-AlertErrorDialogVersionPanel";
14 -
15 - protected AlertErrorDialog() {
16 - super( "Error", "litesoft-AlertErrorDialog", //
17 - "litesoft-AlertErrorDialogBodyPanel", "litesoft-AlertErrorDialogHTML", "litesoft-AlertErrorDialogButtonBar", "litesoft-AlertErrorDialogIcon" );
18 - }
19 -
20 - private String mVersion, mDetail;
21 -
22 - public AlertErrorDialog( String pTitle, String pMessage, String pVersion, String pDetail, DialogCloseCallBack pCloseCallBack ) {
23 - this();
24 -
25 - mVersion = Strings.noEmpty( pVersion );
26 - mDetail = Strings.noEmpty( pDetail );
27 -
28 - initialize( pTitle, pMessage, pCloseCallBack );
29 - }
30 -
31 - @Override
32 - protected SizeableHorizontalPanel createMainBodyPanel( final String pMessage ) {
33 - SizeableHorizontalPanel zPanel = super.createMainBodyPanel( pMessage );
34 -
35 - if ( mDetail != null ) {
36 - zPanel.add( Button.named( "Details" ).blue().text().add( new ClickHandler() {
37 - @Override
38 - public void onClick( ClickEvent event ) {
39 - UtilsGwt.windowOpenWithHtml( "", "location=0,menubar=1,status=0,scrollbars=1", //
40 - "<html><body style='font-family:sans-serif; overflow:auto;'>" + //
41 - "<h4>" + pMessage + "</h4>" + //
42 - wrapWithPre( mDetail ) + //
43 - "</body></html>" );
44 - }
45 - } ).create() );
46 - }
47 -
48 - return zPanel;
49 - }
50 -
51 - @Override
52 - protected void augmentMainPanelBeforeButtons( HasWidgets pVerticalPanel ) {
53 - if ( mVersion != null ) {
54 - pVerticalPanel.add( createVersionPanel( mVersion ) );
55 - }
56 - }
57 -
58 - private Widget createVersionPanel( String pMessage ) {
59 - SizeableHorizontalPanel zPanel = new SizeableHorizontalPanel().stretchableHorizontally();
60 - zPanel.add( new SizeableSpacer().stretchableHorizontally() );
61 - zPanel.add( createBodyPanelMessageHTML( pMessage ) );
62 - zPanel.add( new SizeableSpacer().stretchableHorizontally() );
63 - return zPanel.style( VERSION_PANEL_STYLE );
64 - }
65 - }
1 + // This Source Code is in the Public Domain per: http://unlicense.org
2 + package org.litesoft.GWT.client;
3 +
4 + import org.litesoft.GWT.client.nonpublic.*;
5 + import org.litesoft.GWT.client.widgets.Button;
6 + import org.litesoft.GWT.client.widgets.*;
7 + import org.litesoft.commonfoundation.base.*;
8 +
9 + import com.google.gwt.event.dom.client.*;
10 + import com.google.gwt.user.client.ui.*;
11 +
12 + public class AlertErrorDialog extends AbstractMessageDialog {
13 + private static final String VERSION_PANEL_STYLE = "litesoft-AlertErrorDialogVersionPanel";
14 +
15 + protected AlertErrorDialog() {
16 + super( "Error", "litesoft-AlertErrorDialog", //
17 + "litesoft-AlertErrorDialogBodyPanel", "litesoft-AlertErrorDialogHTML", "litesoft-AlertErrorDialogButtonBar", "litesoft-AlertErrorDialogIcon" );
18 + }
19 +
20 + private String mVersion, mDetail;
21 +
22 + public AlertErrorDialog( String pTitle, String pMessage, String pVersion, String pDetail, DialogCloseCallBack pCloseCallBack ) {
23 + this();
24 +
25 + mVersion = ConstrainTo.significantOrNull( pVersion );
26 + mDetail = ConstrainTo.significantOrNull( pDetail );
27 +
28 + initialize( pTitle, pMessage, pCloseCallBack );
29 + }
30 +
31 + @Override
32 + protected SizeableHorizontalPanel createMainBodyPanel( final String pMessage ) {
33 + SizeableHorizontalPanel zPanel = super.createMainBodyPanel( pMessage );
34 +
35 + if ( mDetail != null ) {
36 + zPanel.add( Button.named( "Details" ).blue().text().add( new ClickHandler() {
37 + @Override
38 + public void onClick( ClickEvent event ) {
39 + UtilsGwt.windowOpenWithHtml( "", "location=0,menubar=1,status=0,scrollbars=1", //
40 + "<html><body style='font-family:sans-serif; overflow:auto;'>" + //
41 + "<h4>" + pMessage + "</h4>" + //
42 + wrapWithPre( mDetail ) + //
43 + "</body></html>" );
44 + }
45 + } ).create() );
46 + }
47 +
48 + return zPanel;
49 + }
50 +
51 + @Override
52 + protected void augmentMainPanelBeforeButtons( HasWidgets pVerticalPanel ) {
53 + if ( mVersion != null ) {
54 + pVerticalPanel.add( createVersionPanel( mVersion ) );
55 + }
56 + }
57 +
58 + private Widget createVersionPanel( String pMessage ) {
59 + SizeableHorizontalPanel zPanel = new SizeableHorizontalPanel().stretchableHorizontally();
60 + zPanel.add( new SizeableSpacer().stretchableHorizontally() );
61 + zPanel.add( createBodyPanelMessageHTML( pMessage ) );
62 + zPanel.add( new SizeableSpacer().stretchableHorizontally() );
63 + return zPanel.style( VERSION_PANEL_STYLE );
64 + }
65 + }