|
@@ -1,77 +1,77 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.forms.client.nonpublic; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.commonfoundation.typeutils.*; |
5 |
|
- |
import org.litesoft.ui.def.nonpublic.support.*; |
6 |
|
- |
|
7 |
|
- |
import com.google.gwt.user.client.ui.*; |
8 |
|
- |
|
9 |
|
- |
public class FormButtonAdapter extends AbstractFormActionAdapter implements ClickListener { |
10 |
|
- |
private ButtonBase mButton; |
11 |
|
- |
|
12 |
|
- |
public FormButtonAdapter( FormInstanceComponentHandler pComponentHandler, // |
13 |
|
- |
String pActionID, AbstractSharedMetaData pMD, // |
14 |
|
- |
UiActionable pDef ) { |
15 |
|
- |
super( pComponentHandler, pActionID, pDef ); |
16 |
|
- |
|
17 |
|
- |
initButton( pMD ); |
18 |
|
- |
} |
19 |
|
- |
|
20 |
|
- |
public FormButtonAdapter( FormInstanceComponentHandler pComponentHandler, // |
21 |
|
- |
String pActionID, AbstractSharedMetaData pMD, // |
22 |
|
- |
Boolean pInputChangeStateEnablement, Boolean pInputErrorStateEnablement ) { |
23 |
|
- |
super( pComponentHandler, pActionID, pInputChangeStateEnablement, pInputErrorStateEnablement ); |
24 |
|
- |
|
25 |
|
- |
initButton( pMD ); |
26 |
|
- |
} |
27 |
|
- |
|
28 |
|
- |
public FormButtonAdapter( FormInstanceComponentHandler pComponentHandler, // |
29 |
|
- |
String pActionID, AbstractSharedMetaData pMD, // |
30 |
|
- |
Boolean pInputChangeStateEnablement, Boolean pInputErrorStateEnablement, |
31 |
|
- |
ButtonBase pButton ) { |
32 |
|
- |
super( pComponentHandler, pActionID, pInputChangeStateEnablement, pInputErrorStateEnablement ); |
33 |
|
- |
|
34 |
|
- |
Objects.assertNotNull( "Button", mButton = pButton ); |
35 |
|
- |
initButtonToolTip( pMD ); |
36 |
|
- |
} |
37 |
|
- |
|
38 |
|
- |
private void initButton( AbstractSharedMetaData pMD ) { |
39 |
|
- |
mButton = new Button(); |
40 |
|
- |
mButton.addStyleName( "litesoft-FormButton" ); |
41 |
|
- |
mButton.setText( pMD.getExternalText() ); |
42 |
|
- |
setDisabled( pMD.isDisabled() ); |
43 |
|
- |
initButtonToolTip( pMD ); |
44 |
|
- |
} |
45 |
|
- |
|
46 |
|
- |
private void initButtonToolTip( AbstractSharedMetaData pMD ) { |
47 |
|
- |
mButton.setTitle( Strings.deNull( pMD.getTooltip() ) ); |
48 |
|
- |
} |
49 |
|
- |
|
50 |
|
- |
protected Widget initWidget() { |
51 |
|
- |
mButton.addClickListener( this ); |
52 |
|
- |
HorizontalPanel zPanel = new HorizontalPanel(); |
53 |
|
- |
zPanel.add( mButton ); |
54 |
|
- |
return zPanel; |
55 |
|
- |
} |
56 |
|
- |
|
57 |
|
- |
public boolean isVisible() { |
58 |
|
- |
return mButton.isVisible(); |
59 |
|
- |
} |
60 |
|
- |
|
61 |
|
- |
public boolean setFocus() { |
62 |
|
- |
mButton.setFocus( true ); |
63 |
|
- |
return true; |
64 |
|
- |
} |
65 |
|
- |
|
66 |
|
- |
public boolean isEnabled() { |
67 |
|
- |
return mButton.isEnabled(); |
68 |
|
- |
} |
69 |
|
- |
|
70 |
|
- |
protected void setWidgetEnabled( boolean pEnabled ) { |
71 |
|
- |
mButton.setEnabled( pEnabled ); |
72 |
|
- |
} |
73 |
|
- |
|
74 |
|
- |
public void onClick( Widget sender ) { |
75 |
|
- |
actionRequested( false ); |
76 |
|
- |
} |
77 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.forms.client.nonpublic; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.commonfoundation.base.*; |
|
5 |
+ |
import org.litesoft.ui.def.nonpublic.support.*; |
|
6 |
+ |
|
|
7 |
+ |
import com.google.gwt.user.client.ui.*; |
|
8 |
+ |
|
|
9 |
+ |
public class FormButtonAdapter extends AbstractFormActionAdapter implements ClickListener { |
|
10 |
+ |
private ButtonBase mButton; |
|
11 |
+ |
|
|
12 |
+ |
public FormButtonAdapter( FormInstanceComponentHandler pComponentHandler, // |
|
13 |
+ |
String pActionID, AbstractSharedMetaData pMD, // |
|
14 |
+ |
UiActionable pDef ) { |
|
15 |
+ |
super( pComponentHandler, pActionID, pDef ); |
|
16 |
+ |
|
|
17 |
+ |
initButton( pMD ); |
|
18 |
+ |
} |
|
19 |
+ |
|
|
20 |
+ |
public FormButtonAdapter( FormInstanceComponentHandler pComponentHandler, // |
|
21 |
+ |
String pActionID, AbstractSharedMetaData pMD, // |
|
22 |
+ |
Boolean pInputChangeStateEnablement, Boolean pInputErrorStateEnablement ) { |
|
23 |
+ |
super( pComponentHandler, pActionID, pInputChangeStateEnablement, pInputErrorStateEnablement ); |
|
24 |
+ |
|
|
25 |
+ |
initButton( pMD ); |
|
26 |
+ |
} |
|
27 |
+ |
|
|
28 |
+ |
public FormButtonAdapter( FormInstanceComponentHandler pComponentHandler, // |
|
29 |
+ |
String pActionID, AbstractSharedMetaData pMD, // |
|
30 |
+ |
Boolean pInputChangeStateEnablement, Boolean pInputErrorStateEnablement, |
|
31 |
+ |
ButtonBase pButton ) { |
|
32 |
+ |
super( pComponentHandler, pActionID, pInputChangeStateEnablement, pInputErrorStateEnablement ); |
|
33 |
+ |
|
|
34 |
+ |
Confirm.isNotNull( "Button", mButton = pButton ); |
|
35 |
+ |
initButtonToolTip( pMD ); |
|
36 |
+ |
} |
|
37 |
+ |
|
|
38 |
+ |
private void initButton( AbstractSharedMetaData pMD ) { |
|
39 |
+ |
mButton = new Button(); |
|
40 |
+ |
mButton.addStyleName( "litesoft-FormButton" ); |
|
41 |
+ |
mButton.setText( pMD.getExternalText() ); |
|
42 |
+ |
setDisabled( pMD.isDisabled() ); |
|
43 |
+ |
initButtonToolTip( pMD ); |
|
44 |
+ |
} |
|
45 |
+ |
|
|
46 |
+ |
private void initButtonToolTip( AbstractSharedMetaData pMD ) { |
|
47 |
+ |
mButton.setTitle( ConstrainTo.notNull( pMD.getTooltip() ) ); |
|
48 |
+ |
} |
|
49 |
+ |
|
|
50 |
+ |
protected Widget initWidget() { |
|
51 |
+ |
mButton.addClickListener( this ); |
|
52 |
+ |
HorizontalPanel zPanel = new HorizontalPanel(); |
|
53 |
+ |
zPanel.add( mButton ); |
|
54 |
+ |
return zPanel; |
|
55 |
+ |
} |
|
56 |
+ |
|
|
57 |
+ |
public boolean isVisible() { |
|
58 |
+ |
return mButton.isVisible(); |
|
59 |
+ |
} |
|
60 |
+ |
|
|
61 |
+ |
public boolean setFocus() { |
|
62 |
+ |
mButton.setFocus( true ); |
|
63 |
+ |
return true; |
|
64 |
+ |
} |
|
65 |
+ |
|
|
66 |
+ |
public boolean isEnabled() { |
|
67 |
+ |
return mButton.isEnabled(); |
|
68 |
+ |
} |
|
69 |
+ |
|
|
70 |
+ |
protected void setWidgetEnabled( boolean pEnabled ) { |
|
71 |
+ |
mButton.setEnabled( pEnabled ); |
|
72 |
+ |
} |
|
73 |
+ |
|
|
74 |
+ |
public void onClick( Widget sender ) { |
|
75 |
+ |
actionRequested( false ); |
|
76 |
+ |
} |
|
77 |
+ |
} |