Subversion Repository Public Repository

litesoft

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

Diff revisions: vs.
  @@ -1,37 +1,37 @@
1 - // This Source Code is in the Public Domain per: http://unlicense.org
2 - package org.litesoft.GWT.client.widgets;
3 -
4 - import org.litesoft.GWT.client.widgets.nonpublic.*;
5 - import org.litesoft.commonfoundation.html.*;
6 - import org.litesoft.commonfoundation.typeutils.*;
7 -
8 - import com.google.gwt.user.client.*;
9 -
10 - public class TextCellButton extends AbstractCellButton {
11 - public TextCellButton( DefButtonNamedTypedFactoryText pDefButtonFactory, int pMinimumCellSize ) {
12 - super( pDefButtonFactory.getPreImageWidth(), pDefButtonFactory, pDefButtonFactory.getPostImageWidth(), "Text", //
13 - pMinimumCellSize, createElement( makeHTML( pDefButtonFactory.getText(), pDefButtonFactory.wrapText() ) ) );
14 - }
15 -
16 - private static String makeHTML( String pText, boolean pWrapText ) {
17 - switch ( pText.length() ) {
18 - case 1:
19 - case 2:
20 - pText = HTMLConstants.NBSP + pText + HTMLConstants.NBSP;
21 - // Fall Thru
22 - case 3:
23 - pText = HTMLConstants.NBSP + pText + HTMLConstants.NBSP;
24 - // Fall Thru
25 - default:
26 - break;
27 - }
28 - return Strings.replace( pText, ' ', pWrapText ? "<BR>" : HTMLConstants.NBSP );
29 - }
30 -
31 - private static Element createElement( String pInnerHTML ) {
32 - Element zElement = DOM.createDiv();
33 - zElement.setClassName( "Text" );
34 - zElement.setInnerHTML( pInnerHTML );
35 - return zElement;
36 - }
37 - }
1 + // This Source Code is in the Public Domain per: http://unlicense.org
2 + package org.litesoft.GWT.client.widgets;
3 +
4 + import org.litesoft.GWT.client.widgets.nonpublic.*;
5 + import org.litesoft.commonfoundation.html.*;
6 + import org.litesoft.commonfoundation.typeutils.*;
7 +
8 + import com.google.gwt.user.client.*;
9 +
10 + public class TextCellButton extends AbstractCellButton {
11 + public TextCellButton( DefButtonNamedTypedFactoryText pDefButtonFactory, int pMinimumCellSize ) {
12 + super( pDefButtonFactory.getPreImageWidth(), pDefButtonFactory, pDefButtonFactory.getPostImageWidth(), "Text", //
13 + pMinimumCellSize, createElement( makeHTML( pDefButtonFactory.getText(), pDefButtonFactory.wrapText() ) ) );
14 + }
15 +
16 + private static String makeHTML( String pText, boolean pWrapText ) {
17 + switch ( pText.length() ) {
18 + case 1:
19 + case 2:
20 + pText = HtmlEntity.NBSP + pText + HtmlEntity.NBSP;
21 + // Fall Thru
22 + case 3:
23 + pText = HtmlEntity.NBSP + pText + HtmlEntity.NBSP;
24 + // Fall Thru
25 + default:
26 + break;
27 + }
28 + return Strings.replace( pText, ' ', pWrapText ? "<BR>" : HtmlEntity.NBSP );
29 + }
30 +
31 + private static Element createElement( String pInnerHTML ) {
32 + Element zElement = DOM.createDiv();
33 + zElement.setClassName( "Text" );
34 + zElement.setInnerHTML( pInnerHTML );
35 + return zElement;
36 + }
37 + }