litesoft
Diff Revisions
631
vs
632
for /trunk/GWT_Sandbox/FormEngine/src/com/temp/client/foundation/widget/NamedTextButton.java
|
@@ -1,10 +1,14 @@ |
1 |
1 |
|
package com.temp.client.foundation.widget; |
2 |
2 |
|
|
3 |
3 |
|
import com.google.gwt.event.dom.client.ClickHandler; |
|
4 |
+ |
import com.temp.shared.externalization.*; |
4 |
5 |
|
|
5 |
|
- |
public class NamedTextButton extends CompositeButton { |
6 |
|
- |
private NamedTextButton() { |
7 |
|
- |
throw new UnsupportedOperationException("Need Externalization Support"); |
|
6 |
+ |
public class NamedTextButton extends CompositeButton<NamedTextButton> { |
|
7 |
+ |
private E13nResolver resolver = null; |
|
8 |
+ |
private boolean textSet = false; |
|
9 |
+ |
|
|
10 |
+ |
public NamedTextButton() { |
|
11 |
+ |
super( "[No-E13nResolver]" ); |
8 |
12 |
|
} |
9 |
13 |
|
|
10 |
14 |
|
public NamedTextButton(String name) { |
|
@@ -17,15 +21,17 @@ |
17 |
21 |
|
add(handler); |
18 |
22 |
|
} |
19 |
23 |
|
|
20 |
|
- |
@Override |
21 |
|
- |
public void setName(String name) { |
22 |
|
- |
super.setName(name); |
|
24 |
+ |
public final void init(E13nResolver resolver) { |
|
25 |
+ |
this.resolver = resolver; |
23 |
26 |
|
} |
24 |
27 |
|
|
25 |
|
- |
public NamedTextButton add(ClickHandler handler) { |
26 |
|
- |
if (handler != null) { |
27 |
|
- |
proxyTo.addClickHandler(handler); |
|
28 |
+ |
@Override |
|
29 |
+ |
protected void onAttach() |
|
30 |
+ |
{ |
|
31 |
+ |
if (!textSet && (resolver != null)) { |
|
32 |
+ |
setText( resolver.resolve( getName() ) ); |
|
33 |
+ |
textSet = true; |
28 |
34 |
|
} |
29 |
|
- |
return this; |
|
35 |
+ |
super.onAttach(); |
30 |
36 |
|
} |
31 |
37 |
|
} |