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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
package org.litesoft.GWT.client;
import org.litesoft.GWT.client.widgets.*;
import org.litesoft.core.simpletypes.temporal.*;
import org.litesoft.core.util.*;
import org.litesoft.logger.*;
import com.google.gwt.core.client.*;
import com.google.gwt.event.logical.shared.*;
import com.google.gwt.user.client.*;
import com.google.gwt.user.client.ui.*;
public abstract class AbstractClientMainAppEntryPoint implements EntryPoint,
AppWindowLifeCycle,
DataTableStyle
{
/**
* @noinspection NonJREEmulationClassesInClientCode
*/
public static Logger CLIENT_LOGGER = LoggerFactory.getLogger( "Client" );
public static boolean sWindowClosing = false;
/**
* @noinspection NonJREEmulationClassesInClientCode
*/
public static final Logger ENTRY_POINT_LOGGER = LoggerFactory.getLogger( EntryPoint.class );
protected final String mAppName;
protected final String mShortAllLettersClientName;
private static final String APP_PANEL = "AppPanel";
protected AbstractClientMainAppEntryPoint( AppNames pAppNames )
{
mAppName = pAppNames.getAppName();
mShortAllLettersClientName = pAppNames.getShortAllLettersClientName();
}
/**
* This is the entry point method.
*/
public final void onModuleLoad()
{
System.err.println( new UtilDateAdaptor() + " | Application Client Start Up" );
Window.addCloseHandler( this );
Window.addWindowClosingHandler( this );
OurUncaughtExceptionHandler handler = new OurUncaughtExceptionHandler( this );
GWT.setUncaughtExceptionHandler( handler );
RootPanel zBodyPanel = RootPanel.get();
zBodyPanel.addStyleName( "litesoft-LayoutOverflowHidden" );
zBodyPanel.addStyleName( GWT.isScript() ? "litesoft-RegularMode" : "litesoft-HostedMode" );
/**
* Add a class to the body element to enable platform-specific CSS rules.
*/
UserAgent zUserAgent = UserAgent.getInstance();
zBodyPanel.addStyleName( "UserAgent-" + zUserAgent.getFamily() );
String zReally = zUserAgent.getReally();
if ( UtilsCommon.isNotNullOrEmpty( zReally ) )
{
zBodyPanel.addStyleName( "Really" + zReally );
}
getAppPanel().addStyleName( "Platform-" + zUserAgent.getPlatform() );
onAppLoad();
}
private RootPanel getAppPanel()
{
return RootPanel.get( APP_PANEL );
}
public void onAppLoad()
{
nativeCodeInjection();
prefetchImages();
}
public void onWindowClosing( Window.ClosingEvent pEvent )
{
}
public void onClose( CloseEvent<Window> pEvent )
{
sWindowClosing = true;
nativeCodeDispose();
CLIENT_LOGGER.trace.log( "WindowClosing..." );
}
public void prefetchImages()
{
AlertManager.prefetchImages();
}
public void nativeCodeInjection()
{
}
public void nativeCodeDispose()
{
}
protected SingleWidgetContainer replaceAppPanel()
{
return replaceAppPanel( new WindowSizingPanel() );
}
protected SingleWidgetContainer replaceAppPanel( SingleWidgetContainer pSWC )
{
Element zElement = RootPanel.get().getElement();
DOM.setStyleAttribute( zElement, "overflow", "hidden" );
DOM.setStyleAttribute( zElement, "margin", "0" );
DOM.setStyleAttribute( zElement, "padding", "0" );
//noinspection GwtToHtmlReferences
RootPanel panel = getAppPanel();
if ( panel == null )
{
UtilsGwt.closeWindowNoConfirm( "HTML Corrupted - Failed to find an element with an id of 'AppPanel' in the HTML host page\nWill attempt to close Window!" );
return null;
}
panel.clear(); // properly remove GWT widgets
zElement = panel.getElement();
DOM.setInnerText( zElement, "" ); // remove static content
DOM.setStyleAttribute( zElement, "height", null );
DOM.setStyleAttribute( zElement, "overflow", "hidden" );
panel.add( (Widget) pSWC );
FontSizer.get( DATA_TABLE_TEXT );
FontSizer.get( HEADER_TABLE_TEXT );
return pSWC;
}
protected void handleUncaughtException( Throwable e )
{
if ( e != null )
{
ENTRY_POINT_LOGGER.error.log( e );
AlertManager.alert( "MainApp", "Unexpected Exception", e.getClass().getName(), e );
}
}
private static class OurUncaughtExceptionHandler implements GWT.UncaughtExceptionHandler
{
private AbstractClientMainAppEntryPoint mEntryPoint;
public OurUncaughtExceptionHandler( AbstractClientMainAppEntryPoint pEntryPoint )
{
mEntryPoint = pEntryPoint;
}
public void onUncaughtException( Throwable e )
{
if ( !sWindowClosing )
{
mEntryPoint.handleUncaughtException( e );
}
}
}
}
|
Revision |
Author |
Commited |
Message |
2
|
GeorgeS
|
Sun 07 Feb, 2010 12:50:58 +0000 |
|