litesoft
Diff Revisions
949
vs
950
for /trunk/Java/GWT/OldClient/src/org/litesoft/GWT/client/commands/TextCommand.java
|
@@ -1,39 +1,39 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.client.commands; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.GWT.client.*; |
5 |
|
- |
import org.litesoft.commonfoundation.typeutils.*; |
6 |
|
- |
|
7 |
|
- |
public abstract class TextCommand extends DisableableCommand implements IMenuableDef { |
8 |
|
- |
public static final TextCommand[] EMPTY_ARRAY = new TextCommand[0]; |
9 |
|
- |
|
10 |
|
- |
private String mText; |
11 |
|
- |
|
12 |
|
- |
protected TextCommand( String pText ) { |
13 |
|
- |
setText( pText ); |
14 |
|
- |
} |
15 |
|
- |
|
16 |
|
- |
public String getText() { |
17 |
|
- |
return mText; |
18 |
|
- |
} |
19 |
|
- |
|
20 |
|
- |
public void setText( String pText ) { |
21 |
|
- |
mText = Strings.noEmpty( pText ); |
22 |
|
- |
} |
23 |
|
- |
|
24 |
|
- |
public boolean isEnabled() { |
25 |
|
- |
return super.isEnabled() && (mText != null); |
26 |
|
- |
} |
27 |
|
- |
|
28 |
|
- |
public String toString() { |
29 |
|
- |
return (isEnabled() ? "" : "!") + preText() + mText + postText(); |
30 |
|
- |
} |
31 |
|
- |
|
32 |
|
- |
protected String preText() { |
33 |
|
- |
return ""; |
34 |
|
- |
} |
35 |
|
- |
|
36 |
|
- |
protected String postText() { |
37 |
|
- |
return ""; |
38 |
|
- |
} |
39 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.client.commands; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.GWT.client.*; |
|
5 |
+ |
import org.litesoft.commonfoundation.base.*; |
|
6 |
+ |
|
|
7 |
+ |
public abstract class TextCommand extends DisableableCommand implements IMenuableDef { |
|
8 |
+ |
public static final TextCommand[] EMPTY_ARRAY = new TextCommand[0]; |
|
9 |
+ |
|
|
10 |
+ |
private String mText; |
|
11 |
+ |
|
|
12 |
+ |
protected TextCommand( String pText ) { |
|
13 |
+ |
setText( pText ); |
|
14 |
+ |
} |
|
15 |
+ |
|
|
16 |
+ |
public String getText() { |
|
17 |
+ |
return mText; |
|
18 |
+ |
} |
|
19 |
+ |
|
|
20 |
+ |
public void setText( String pText ) { |
|
21 |
+ |
mText = ConstrainTo.significantOrNull( pText ); |
|
22 |
+ |
} |
|
23 |
+ |
|
|
24 |
+ |
public boolean isEnabled() { |
|
25 |
+ |
return super.isEnabled() && (mText != null); |
|
26 |
+ |
} |
|
27 |
+ |
|
|
28 |
+ |
public String toString() { |
|
29 |
+ |
return (isEnabled() ? "" : "!") + preText() + mText + postText(); |
|
30 |
+ |
} |
|
31 |
+ |
|
|
32 |
+ |
protected String preText() { |
|
33 |
+ |
return ""; |
|
34 |
+ |
} |
|
35 |
+ |
|
|
36 |
+ |
protected String postText() { |
|
37 |
+ |
return ""; |
|
38 |
+ |
} |
|
39 |
+ |
} |