Subversion Repository Public Repository

litesoft

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// This Source Code is in the Public Domain per: http://unlicense.org
package org.litesoft.GWT.client.testplan;

import org.litesoft.GWT.client.*;
import org.litesoft.GWT.shared.service.*;
import org.litesoft.commonfoundation.base.*;
import org.litesoft.logger.*;
import org.litesoft.testplan.*;

import com.google.gwt.core.client.*;
import com.google.gwt.user.client.rpc.*;

public class TestPlanServiceFacade
{
    public static final Logger LOGGER = LoggerFactory.getLogger( TestPlanServiceFacade.class );

    private static TestPlanServiceAsync sServiceInstance = null;

    private static int sStep = 0;

    private static TestPlanServiceAsync getServiceInstance()
    {
        if ( sServiceInstance == null )
        {
            sServiceInstance = GWT.create( TestPlanService.class );
        }
        return sServiceInstance;
    }

    public static void nextStep( final TestPlanStepCallback pCallback )
    {
        LOGGER.warn.log( "Test Plan Request Step: ", sStep );
        getServiceInstance().get( new TestPlanStepRequest( sStep++ ), new AsyncCallback<TestPlanStepResponse>()
        {
            public void onSuccess( TestPlanStepResponse pResult )
            {
                if ( pResult == null )
                {
                    LOGGER.warn.log( "Test Plan Response - No Result" );
                }
                else
                {
                    UtilsGwt.trywindowOpenWithHtml( "TestPlanMonitor", UtilsGwt.CHROMELESS_SCROLLED, //
                                                    createHTML( pResult.getStep(), pResult.getSection(), pResult.getInstructions(), //
                                                                pResult.getNextStep(), pResult.getNextSection(), pResult.getNextInstructions() ) );
                    TestPlanAction zAction = pResult.getAction();
                    if ( zAction == null )
                    {
                        LOGGER.warn.log( "Test Plan Response - No Action" );
                    }
                    else
                    {
                        LOGGER.warn.log( "Test Plan Response - Action: ", zAction );
                        pCallback.handleAction( zAction );
                    }
                }
            }

            public void onFailure( Throwable pCaught )
            {
                AlertManager.alert( "TestPlanServiceFacade", "Test Plan Service Problem", //
                                    "Unexpected Error from Test Plan Service\n" + //
                                    "of\n" + //
                                    pCaught.getMessage(), pCaught );
            }
        } );
    }

    private static String createHTML( String pCurStep, String pCurSection, String pCurInstructions, //
                                      String pNextStep, String pNextSection, String pNextInstructions )
    {
        String zCurPreText = createInstructionsText( pCurStep, pCurSection, "Post Instructions", pCurInstructions );

        String zNextPreText = createInstructionsText( pNextStep, pNextSection, "Pre Instructions", pNextInstructions );

        return "<html><body><table width='100%' height='100%'>" + //
               "<tr><td align='left' valign='top' height='50%'>" + //
               zCurPreText + "</td></tr>" + //
               "<tr><td align='left' valign='top' height='50%' style='border-top:1px solid #666666;'>" + //
               zNextPreText + "</td></tr>" + //
               "</table></body></html>";
    }

    private static String createInstructionsText( String pStep, String pSection, String pWhat, String pInstructions )
    {
        if ( Currently.isNullOrEmpty( pSection ) )
        {
            return "";
        }
        if ( pInstructions == null )
        {
            pInstructions = "";
        }
        else
        {
            // Process...
        }
        return "<h3>Step " + pStep + " of " + pSection + "</h3>" + //
               "<h5>" + pWhat + "</h5>" + //
               "<pre>" + pInstructions + "</pre>";
    }
}

Commits for litesoft/trunk/Java/GWT/Dev/src/org/litesoft/GWT/client/testplan/TestPlanServiceFacade.java

Diff revisions: vs.
Revision Author Commited Message
950 Diff Diff GeorgeS picture GeorgeS Thu 19 Jun, 2014 17:57:04 +0000

New Lines

947 Diff Diff GeorgeS picture GeorgeS Fri 06 Jun, 2014 23:36:56 +0000

Correct Spelling of package!

939 Diff Diff GeorgeS picture GeorgeS Mon 02 Jun, 2014 21:30:31 +0000

Extracting commonfoundation

802 Diff Diff GeorgeS picture GeorgeS Wed 15 Aug, 2012 04:04:47 +0000
489 Diff Diff GeorgeS picture GeorgeS Fri 09 Sep, 2011 12:03:04 +0000

Prioritizer Dup code minimized

49 Diff Diff GeorgeS picture GeorgeS Mon 12 Apr, 2010 02:59:10 +0000

License Text

2 GeorgeS picture GeorgeS Sun 07 Feb, 2010 12:50:58 +0000