Subversion Repository Public Repository

litesoft

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

Diff revisions: vs.
  @@ -1,108 +1,108 @@
1 - // This Source Code is in the Public Domain per: http://unlicense.org
2 - package org.litesoft.GWT.client.view;
3 -
4 - import org.litesoft.GWT.client.*;
5 - import org.litesoft.GWT.client.nonpublic.*;
6 - import org.litesoft.GWT.client.widgets.*;
7 - import org.litesoft.GWT.client.widgets.SubmitButton;
8 - import org.litesoft.commonfoundation.html.*;
9 - import org.litesoft.commonfoundation.typeutils.*;
10 -
11 - import com.google.gwt.event.dom.client.*;
12 - import com.google.gwt.user.client.ui.*;
13 -
14 - public abstract class DialogView extends UiView implements DialogCloseCallBack,
15 - Dialog {
16 - private Opaqueness mOpaqueness;
17 - private DialogError mErrorLabel = new DialogError();
18 -
19 - public DialogView( CO pCO, Opaqueness pOpaqueness ) {
20 - super( pCO );
21 - mOpaqueness = pOpaqueness;
22 - }
23 -
24 - public boolean isCancelable() {
25 - return true;
26 - }
27 -
28 - public SizeableLabel getErrorLabel() {
29 - return mErrorLabel;
30 - }
31 -
32 - public void setDialogErrorMessage( String pError ) {
33 - boolean zEmpty = (null == (pError = Strings.noEmpty( pError )));
34 - mErrorLabel.setText( !zEmpty ? pError : HTMLConstants.NBSP, zEmpty );
35 - }
36 -
37 - protected void add( Widget pWidget ) {
38 - mContent.add( pWidget );
39 - }
40 -
41 - @Override
42 - public Widget getContent() {
43 - return mContent;
44 - }
45 -
46 - @Override
47 - public void dialogClosed() {
48 - }
49 -
50 - public void cancel() {
51 - close();
52 - }
53 -
54 - public void close() {
55 - if ( mDialog != null ) {
56 - mDialog.hide();
57 - mDialog = null;
58 - }
59 - }
60 -
61 - private AbstractDialog mDialog = null;
62 -
63 - public void setActualDialog( AbstractDialog pDialog ) {
64 - mDialog = pDialog;
65 - }
66 -
67 - public AbstractDialog getActualDialog() {
68 - return mDialog;
69 - }
70 -
71 - public Opaqueness getOpaqueness() {
72 - return mOpaqueness;
73 - }
74 -
75 - protected void submitRequested() {
76 - }
77 -
78 - protected final ButtonBase createSubmitButton() {
79 - return SubmitButton.factory().add( createSubmitClickHandler() ).create();
80 - }
81 -
82 - protected final ClickHandler createSubmitClickHandler() {
83 - return new ClickHandler() {
84 - @Override
85 - public void onClick( ClickEvent event ) {
86 - submitRequested();
87 - }
88 - };
89 - }
90 -
91 - protected final ButtonBase createCancelButton() {
92 - return CancelButton.factory().add( new ClickHandler() {
93 - @Override
94 - public void onClick( ClickEvent event ) {
95 - cancel();
96 - }
97 - } ).create();
98 - }
99 -
100 - protected final ButtonBase createCloseButton() {
101 - return CloseButton.factory().add( new ClickHandler() {
102 - @Override
103 - public void onClick( ClickEvent event ) {
104 - cancel();
105 - }
106 - } ).create();
107 - }
108 - }
1 + // This Source Code is in the Public Domain per: http://unlicense.org
2 + package org.litesoft.GWT.client.view;
3 +
4 + import org.litesoft.GWT.client.*;
5 + import org.litesoft.GWT.client.nonpublic.*;
6 + import org.litesoft.GWT.client.widgets.*;
7 + import org.litesoft.GWT.client.widgets.SubmitButton;
8 + import org.litesoft.commonfoundation.base.*;
9 + import org.litesoft.commonfoundation.html.*;
10 +
11 + import com.google.gwt.event.dom.client.*;
12 + import com.google.gwt.user.client.ui.*;
13 +
14 + public abstract class DialogView extends UiView implements DialogCloseCallBack,
15 + Dialog {
16 + private Opaqueness mOpaqueness;
17 + private DialogError mErrorLabel = new DialogError();
18 +
19 + public DialogView( CO pCO, Opaqueness pOpaqueness ) {
20 + super( pCO );
21 + mOpaqueness = pOpaqueness;
22 + }
23 +
24 + public boolean isCancelable() {
25 + return true;
26 + }
27 +
28 + public SizeableLabel getErrorLabel() {
29 + return mErrorLabel;
30 + }
31 +
32 + public void setDialogErrorMessage( String pError ) {
33 + boolean zEmpty = (null == (pError = ConstrainTo.significantOrNull( pError )));
34 + mErrorLabel.setText( !zEmpty ? pError : HtmlEntity.NBSP, zEmpty );
35 + }
36 +
37 + protected void add( Widget pWidget ) {
38 + mContent.add( pWidget );
39 + }
40 +
41 + @Override
42 + public Widget getContent() {
43 + return mContent;
44 + }
45 +
46 + @Override
47 + public void dialogClosed() {
48 + }
49 +
50 + public void cancel() {
51 + close();
52 + }
53 +
54 + public void close() {
55 + if ( mDialog != null ) {
56 + mDialog.hide();
57 + mDialog = null;
58 + }
59 + }
60 +
61 + private AbstractDialog mDialog = null;
62 +
63 + public void setActualDialog( AbstractDialog pDialog ) {
64 + mDialog = pDialog;
65 + }
66 +
67 + public AbstractDialog getActualDialog() {
68 + return mDialog;
69 + }
70 +
71 + public Opaqueness getOpaqueness() {
72 + return mOpaqueness;
73 + }
74 +
75 + protected void submitRequested() {
76 + }
77 +
78 + protected final ButtonBase createSubmitButton() {
79 + return SubmitButton.factory().add( createSubmitClickHandler() ).create();
80 + }
81 +
82 + protected final ClickHandler createSubmitClickHandler() {
83 + return new ClickHandler() {
84 + @Override
85 + public void onClick( ClickEvent event ) {
86 + submitRequested();
87 + }
88 + };
89 + }
90 +
91 + protected final ButtonBase createCancelButton() {
92 + return CancelButton.factory().add( new ClickHandler() {
93 + @Override
94 + public void onClick( ClickEvent event ) {
95 + cancel();
96 + }
97 + } ).create();
98 + }
99 +
100 + protected final ButtonBase createCloseButton() {
101 + return CloseButton.factory().add( new ClickHandler() {
102 + @Override
103 + public void onClick( ClickEvent event ) {
104 + cancel();
105 + }
106 + } ).create();
107 + }
108 + }