Subversion Repository Public Repository

litesoft

Diff Revisions 136 vs 137 for /trunk/Java/GWT/Client/src/org/litesoft/GWT/client/widgets/NextButton.java

Diff revisions: vs.
  @@ -1,67 +1,40 @@
1 1 // This Source Code is in the Public Domain per: http://litesoft.org/License.txt
2 2 package org.litesoft.GWT.client.widgets;
3 3
4 - import org.litesoft.GWT.client.command.*;
5 4 import org.litesoft.core.util.*;
6 5 import org.litesoft.uispecification.*;
7 6
8 - import com.google.gwt.event.dom.client.*;
9 -
10 - public class NextButton extends GreenButton implements ButtonFactory
7 + public class NextButton implements ButtonFactory
11 8 {
12 9 public static final String NAME = "Next";
13 10
14 - public static DefButtonNamedTypedFactory factory()
11 + public static DefButtonNamedTypedFactory factory( String pText )
15 12 {
16 - return new DefButtonNamed( NAME ).green().text().postImageWidth( 12 ).customStyle( NAME );
13 + return new DefButtonNamed( NAME ).green().text( pText ).postImageWidth( 12 ).customStyle( NAME );
17 14 }
18 15
19 - private static final String TBODY_CLASS_2 = "Next";
20 -
21 - public NextButton( String pText, String pEnabledToolTip, ClickHandler pHandler )
22 - {
23 - super( 0, TBODY_CLASS_2, pText, 12, pEnabledToolTip, "", pHandler );
24 - }
25 -
26 - public NextButton( ViewDef pViewDef, ClickHandler pHandler )
16 + public static DefButtonNamedTypedFactory factory()
27 17 {
28 - this( "Next", (pViewDef == null) ? "" : "Advance to the " + pViewDef.getUiString() + " step", pHandler );
18 + return factory( (String) null );
29 19 }
30 20
31 - public NextButton( final ViewDef pTarget )
21 + public static DefButtonNamedTypedFactory factory( ViewDef pTarget )
32 22 {
33 - this( pTarget, createClickHandler( pTarget ) );
23 + return justButtonFactory( pTarget ).add( pTarget );
34 24 }
35 25
36 - public NextButton( final ViewDef pTarget, UriFragmentIdParams.ScreenParamsFactory pFactory )
26 + public static DefButtonNamedTypedFactory factory( ViewDef pTarget, UriFragmentIdParams.ScreenParamsFactory pFactory )
37 27 {
38 - this( pTarget, createClickHandler( pTarget, pFactory ) );
28 + return justButtonFactory( pTarget ).add( pTarget, pFactory );
39 29 }
40 30
41 - private static ClickHandler createClickHandler( final ViewDef pTarget )
31 + public static DefButtonNamedTypedFactory justButtonFactory( ViewDef pViewDef )
42 32 {
43 - UtilsCommon.assertNotNull( "Target (ViewDef)", pTarget );
44 - return new ClickHandler()
45 - {
46 - @Override
47 - public void onClick( ClickEvent event )
48 - {
49 - new ShowScreenCommand( pTarget ).execute();
50 - }
51 - };
33 + return factory().enabledToolTip( toolTip( "", pViewDef ) );
52 34 }
53 35
54 - private static ClickHandler createClickHandler( final ViewDef pTarget, final UriFragmentIdParams.ScreenParamsFactory pFactory )
36 + public static String toolTip( String pPrefix, ViewDef pViewDef )
55 37 {
56 - UtilsCommon.assertNotNull( "Target (ViewDef)", pTarget );
57 - UtilsCommon.assertNotNull( "Factory", pFactory );
58 - return new ClickHandler()
59 - {
60 - @Override
61 - public void onClick( ClickEvent event )
62 - {
63 - new ShowScreenCommand( pTarget, pFactory.create( pTarget ) ).execute();
64 - }
65 - };
38 + return (pViewDef == null) ? "" : UtilsCommon.deNull( pPrefix ) + "Advance to the " + pViewDef.getUiString() + " step";
66 39 }
67 40 }