|
@@ -1,162 +1,162 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.client.nonpublic; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.GWT.client.*; |
5 |
|
- |
|
6 |
|
- |
import com.google.gwt.core.client.*; |
7 |
|
- |
import com.google.gwt.event.logical.shared.*; |
8 |
|
- |
import com.google.gwt.user.client.*; |
9 |
|
- |
import com.google.gwt.user.client.ui.*; |
10 |
|
- |
|
11 |
|
- |
import java.util.*; |
12 |
|
- |
|
13 |
|
- |
public class AbstractPopupManager implements CloseHandler<PopupPanel> { |
14 |
|
- |
protected static void show( AbstractEntry pEntry ) { |
15 |
|
- |
INSTANCE.addAndShow( pEntry ); |
16 |
|
- |
} |
17 |
|
- |
|
18 |
|
- |
private static final AbstractPopupManager INSTANCE = new AbstractPopupManager(); |
19 |
|
- |
|
20 |
|
- |
private void addAndShow( AbstractEntry pEntry ) { |
21 |
|
- |
if ( add( pEntry ) && !showing() ) { |
22 |
|
- |
pEntry = getEntry(); |
23 |
|
- |
if ( pEntry != null ) { |
24 |
|
- |
pEntry.show( this ); |
25 |
|
- |
} |
26 |
|
- |
} |
27 |
|
- |
} |
28 |
|
- |
|
29 |
|
- |
@Override |
30 |
|
- |
public void onClose( CloseEvent<PopupPanel> event ) { |
31 |
|
- |
AbstractEntry zEntry = nextEntry(); |
32 |
|
- |
if ( zEntry != null ) { |
33 |
|
- |
zEntry.show( this ); |
34 |
|
- |
} |
35 |
|
- |
} |
36 |
|
- |
|
37 |
|
- |
private synchronized boolean add( AbstractEntry pEntry ) { |
38 |
|
- |
String zFrom = pEntry.getFrom(); |
39 |
|
- |
if ( mFromsInQueue.contains( zFrom ) ) { |
40 |
|
- |
return false; |
41 |
|
- |
} |
42 |
|
- |
mFromsInQueue.add( zFrom ); |
43 |
|
- |
mFromQueue.add( pEntry ); |
44 |
|
- |
return true; |
45 |
|
- |
} |
46 |
|
- |
|
47 |
|
- |
private boolean mShowing = false; |
48 |
|
- |
private List<AbstractEntry> mFromQueue = new ArrayList<AbstractEntry>(); |
49 |
|
- |
private Set<String> mFromsInQueue = new HashSet<String>(); |
50 |
|
- |
|
51 |
|
- |
/** |
52 |
|
- |
* Will "manage" the mShowing flag |
53 |
|
- |
*/ |
54 |
|
- |
private synchronized boolean showing() { |
55 |
|
- |
boolean rv = mShowing; |
56 |
|
- |
mShowing = true; |
57 |
|
- |
return rv; |
58 |
|
- |
} |
59 |
|
- |
|
60 |
|
- |
/** |
61 |
|
- |
* Will "manage" the mShowing flag in conjunction w/ the mFromQueue |
62 |
|
- |
*/ |
63 |
|
- |
private synchronized AbstractEntry getEntry() { |
64 |
|
- |
if ( !mFromQueue.isEmpty() ) { |
65 |
|
- |
return mFromQueue.get( 0 ); |
66 |
|
- |
} |
67 |
|
- |
mShowing = false; |
68 |
|
- |
return null; |
69 |
|
- |
} |
70 |
|
- |
|
71 |
|
- |
private synchronized AbstractEntry nextEntry() { |
72 |
|
- |
if ( !mFromQueue.isEmpty() ) { |
73 |
|
- |
AbstractEntry entry = mFromQueue.remove( 0 ); |
74 |
|
- |
mFromsInQueue.remove( entry.getFrom() ); |
75 |
|
- |
} |
76 |
|
- |
return getEntry(); |
77 |
|
- |
} |
78 |
|
- |
|
79 |
|
- |
protected abstract static class AbstractEntry { |
80 |
|
- |
private String mFrom; |
81 |
|
- |
protected String mTitle, mBody; |
82 |
|
- |
protected DialogCloseCallBack mCloseCallBack; |
83 |
|
- |
|
84 |
|
- |
public AbstractEntry( String pFrom, String pTitle, String pBody, DialogCloseCallBack pCloseCallBack ) { |
85 |
|
- |
mFrom = pFrom; |
86 |
|
- |
mTitle = pTitle; |
87 |
|
- |
mBody = pBody; |
88 |
|
- |
mCloseCallBack = pCloseCallBack; |
89 |
|
- |
} |
90 |
|
- |
|
91 |
|
- |
public String getFrom() { |
92 |
|
- |
return mFrom; |
93 |
|
- |
} |
94 |
|
- |
|
95 |
|
- |
public void show( CloseHandler<PopupPanel> pCloseHandler ) { |
96 |
|
- |
final AbstractMessageDialog zDialog = create(); |
97 |
|
- |
zDialog.addCloseHandler( pCloseHandler ); |
98 |
|
- |
Scheduler.get().scheduleDeferred( new Command() { |
99 |
|
- |
@Override |
100 |
|
- |
public void execute() { |
101 |
|
- |
zDialog.show(); |
102 |
|
- |
} |
103 |
|
- |
} ); |
104 |
|
- |
} |
105 |
|
- |
|
106 |
|
- |
abstract protected AbstractMessageDialog create(); |
107 |
|
- |
} |
108 |
|
- |
|
109 |
|
- |
public static void prefetchImages() { |
110 |
|
- |
Image.prefetch( "common/images/misc/InfoIcon.gif" ); |
111 |
|
- |
Image.prefetch( "common/images/misc/ConfirmIcon.gif" ); |
112 |
|
- |
Image.prefetch( "common/images/misc/AlertError.gif" ); |
113 |
|
- |
|
114 |
|
- |
Image.prefetch( "common/images/misc/dialogShadow/ShadowTopLeft.png" ); |
115 |
|
- |
Image.prefetch( "common/images/misc/dialogShadow/ShadowUpStraight.png" ); |
116 |
|
- |
Image.prefetch( "common/images/misc/dialogShadow/ShadowTopRight.png" ); |
117 |
|
- |
Image.prefetch( "common/images/misc/dialogShadow/ShadowLeftStraight.png" ); |
118 |
|
- |
Image.prefetch( "common/images/misc/dialogShadow/ShadowRightStraight.png" ); |
119 |
|
- |
Image.prefetch( "common/images/misc/dialogShadow/ShadowBottomLeft.png" ); |
120 |
|
- |
Image.prefetch( "common/images/misc/dialogShadow/ShadowDownStraight.png" ); |
121 |
|
- |
Image.prefetch( "common/images/misc/dialogShadow/ShadowBottomRight.png" ); |
122 |
|
- |
|
123 |
|
- |
// Both LnFs are prefetched, need to only load once per theme |
124 |
|
- |
Image.prefetch( "common/lnf/classic/Dialog/CornerBottomLeft.png" ); |
125 |
|
- |
Image.prefetch( "common/lnf/classic/Dialog/CornerBottomLeftDown.png" ); |
126 |
|
- |
Image.prefetch( "common/lnf/classic/Dialog/CornerBottomLeftUp.png" ); |
127 |
|
- |
Image.prefetch( "common/lnf/classic/Dialog/CornerBottomRight.png" ); |
128 |
|
- |
Image.prefetch( "common/lnf/classic/Dialog/CornerBottomRightDown.png" ); |
129 |
|
- |
Image.prefetch( "common/lnf/classic/Dialog/CornerBottomRightUp.png" ); |
130 |
|
- |
Image.prefetch( "common/lnf/classic/Dialog/CornerTopLeft.png" ); |
131 |
|
- |
Image.prefetch( "common/lnf/classic/Dialog/CornerTopLeftDown.png" ); |
132 |
|
- |
Image.prefetch( "common/lnf/classic/Dialog/CornerTopLeftUp.png" ); |
133 |
|
- |
Image.prefetch( "common/lnf/classic/Dialog/CornerTopRight.png" ); |
134 |
|
- |
Image.prefetch( "common/lnf/classic/Dialog/CornerTopRightDown.png" ); |
135 |
|
- |
Image.prefetch( "common/lnf/classic/Dialog/CornerTopRightUp.png" ); |
136 |
|
- |
Image.prefetch( "common/lnf/classic/Dialog/StraightBottom.png" ); |
137 |
|
- |
Image.prefetch( "common/lnf/classic/Dialog/StraightLeftCaption.png" ); |
138 |
|
- |
Image.prefetch( "common/lnf/classic/Dialog/StraightLeftContent.png" ); |
139 |
|
- |
Image.prefetch( "common/lnf/classic/Dialog/StraightRightCaption.png" ); |
140 |
|
- |
Image.prefetch( "common/lnf/classic/Dialog/StraightRightContent.png" ); |
141 |
|
- |
Image.prefetch( "common/lnf/classic/Dialog/StraightTop.png" ); |
142 |
|
- |
|
143 |
|
- |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerBottomLeft.png" ); |
144 |
|
- |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerBottomLeftDown.png" ); |
145 |
|
- |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerBottomLeftUp.png" ); |
146 |
|
- |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerBottomRight.png" ); |
147 |
|
- |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerBottomRightDown.png" ); |
148 |
|
- |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerBottomRightUp.png" ); |
149 |
|
- |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerTopLeft.png" ); |
150 |
|
- |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerTopLeftDown.png" ); |
151 |
|
- |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerTopLeftUp.png" ); |
152 |
|
- |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerTopRight.png" ); |
153 |
|
- |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerTopRightDown.png" ); |
154 |
|
- |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerTopRightUp.png" ); |
155 |
|
- |
Image.prefetch( "common/lnf/classic_rounded/Dialog/StraightBottom.png" ); |
156 |
|
- |
Image.prefetch( "common/lnf/classic_rounded/Dialog/StraightLeftCaption.png" ); |
157 |
|
- |
Image.prefetch( "common/lnf/classic_rounded/Dialog/StraightLeftContent.png" ); |
158 |
|
- |
Image.prefetch( "common/lnf/classic_rounded/Dialog/StraightRightCaption.png" ); |
159 |
|
- |
Image.prefetch( "common/lnf/classic_rounded/Dialog/StraightRightContent.png" ); |
160 |
|
- |
Image.prefetch( "common/lnf/classic_rounded/Dialog/StraightTop.png" ); |
161 |
|
- |
} |
162 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.client.nonpublic; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.GWT.client.*; |
|
5 |
+ |
|
|
6 |
+ |
import com.google.gwt.core.client.*; |
|
7 |
+ |
import com.google.gwt.event.logical.shared.*; |
|
8 |
+ |
import com.google.gwt.user.client.*; |
|
9 |
+ |
import com.google.gwt.user.client.ui.*; |
|
10 |
+ |
|
|
11 |
+ |
import java.util.*; |
|
12 |
+ |
|
|
13 |
+ |
public class AbstractPopupManager implements CloseHandler<PopupPanel> { |
|
14 |
+ |
protected static void show( AbstractEntry pEntry ) { |
|
15 |
+ |
INSTANCE.addAndShow( pEntry ); |
|
16 |
+ |
} |
|
17 |
+ |
|
|
18 |
+ |
private static final AbstractPopupManager INSTANCE = new AbstractPopupManager(); |
|
19 |
+ |
|
|
20 |
+ |
private void addAndShow( AbstractEntry pEntry ) { |
|
21 |
+ |
if ( add( pEntry ) && !showing() ) { |
|
22 |
+ |
pEntry = getEntry(); |
|
23 |
+ |
if ( pEntry != null ) { |
|
24 |
+ |
pEntry.show( this ); |
|
25 |
+ |
} |
|
26 |
+ |
} |
|
27 |
+ |
} |
|
28 |
+ |
|
|
29 |
+ |
@Override |
|
30 |
+ |
public void onClose( CloseEvent<PopupPanel> event ) { |
|
31 |
+ |
AbstractEntry zEntry = nextEntry(); |
|
32 |
+ |
if ( zEntry != null ) { |
|
33 |
+ |
zEntry.show( this ); |
|
34 |
+ |
} |
|
35 |
+ |
} |
|
36 |
+ |
|
|
37 |
+ |
private synchronized boolean add( AbstractEntry pEntry ) { |
|
38 |
+ |
String zFrom = pEntry.getFrom(); |
|
39 |
+ |
if ( mFromsInQueue.contains( zFrom ) ) { |
|
40 |
+ |
return false; |
|
41 |
+ |
} |
|
42 |
+ |
mFromsInQueue.add( zFrom ); |
|
43 |
+ |
mFromQueue.add( pEntry ); |
|
44 |
+ |
return true; |
|
45 |
+ |
} |
|
46 |
+ |
|
|
47 |
+ |
private boolean mShowing = false; |
|
48 |
+ |
private List<AbstractEntry> mFromQueue = new ArrayList<AbstractEntry>(); |
|
49 |
+ |
private Set<String> mFromsInQueue = new HashSet<String>(); |
|
50 |
+ |
|
|
51 |
+ |
/** |
|
52 |
+ |
* Will "manage" the mShowing flag |
|
53 |
+ |
*/ |
|
54 |
+ |
private synchronized boolean showing() { |
|
55 |
+ |
boolean rv = mShowing; |
|
56 |
+ |
mShowing = true; |
|
57 |
+ |
return rv; |
|
58 |
+ |
} |
|
59 |
+ |
|
|
60 |
+ |
/** |
|
61 |
+ |
* Will "manage" the mShowing flag in conjunction w/ the mFromQueue |
|
62 |
+ |
*/ |
|
63 |
+ |
private synchronized AbstractEntry getEntry() { |
|
64 |
+ |
if ( !mFromQueue.isEmpty() ) { |
|
65 |
+ |
return mFromQueue.get( 0 ); |
|
66 |
+ |
} |
|
67 |
+ |
mShowing = false; |
|
68 |
+ |
return null; |
|
69 |
+ |
} |
|
70 |
+ |
|
|
71 |
+ |
private synchronized AbstractEntry nextEntry() { |
|
72 |
+ |
if ( !mFromQueue.isEmpty() ) { |
|
73 |
+ |
AbstractEntry entry = mFromQueue.remove( 0 ); |
|
74 |
+ |
mFromsInQueue.remove( entry.getFrom() ); |
|
75 |
+ |
} |
|
76 |
+ |
return getEntry(); |
|
77 |
+ |
} |
|
78 |
+ |
|
|
79 |
+ |
protected abstract static class AbstractEntry { |
|
80 |
+ |
private String mFrom; |
|
81 |
+ |
protected String mTitle, mBody; |
|
82 |
+ |
protected DialogCloseCallBack mCloseCallBack; |
|
83 |
+ |
|
|
84 |
+ |
public AbstractEntry( String pFrom, String pTitle, String pBody, DialogCloseCallBack pCloseCallBack ) { |
|
85 |
+ |
mFrom = pFrom; |
|
86 |
+ |
mTitle = pTitle; |
|
87 |
+ |
mBody = pBody; |
|
88 |
+ |
mCloseCallBack = pCloseCallBack; |
|
89 |
+ |
} |
|
90 |
+ |
|
|
91 |
+ |
public String getFrom() { |
|
92 |
+ |
return mFrom; |
|
93 |
+ |
} |
|
94 |
+ |
|
|
95 |
+ |
public void show( CloseHandler<PopupPanel> pCloseHandler ) { |
|
96 |
+ |
final AbstractMessageDialog zDialog = create(); |
|
97 |
+ |
zDialog.addCloseHandler( pCloseHandler ); |
|
98 |
+ |
Scheduler.get().scheduleDeferred( new Command() { |
|
99 |
+ |
@Override |
|
100 |
+ |
public void execute() { |
|
101 |
+ |
zDialog.show(); |
|
102 |
+ |
} |
|
103 |
+ |
} ); |
|
104 |
+ |
} |
|
105 |
+ |
|
|
106 |
+ |
abstract protected AbstractMessageDialog create(); |
|
107 |
+ |
} |
|
108 |
+ |
|
|
109 |
+ |
public static void prefetchImages() { |
|
110 |
+ |
Image.prefetch( "common/images/misc/InfoIcon.gif" ); |
|
111 |
+ |
Image.prefetch( "common/images/misc/ConfirmIcon.gif" ); |
|
112 |
+ |
Image.prefetch( "common/images/misc/AlertError.gif" ); |
|
113 |
+ |
|
|
114 |
+ |
Image.prefetch( "common/images/misc/dialogShadow/ShadowTopLeft.png" ); |
|
115 |
+ |
Image.prefetch( "common/images/misc/dialogShadow/ShadowUpStraight.png" ); |
|
116 |
+ |
Image.prefetch( "common/images/misc/dialogShadow/ShadowTopRight.png" ); |
|
117 |
+ |
Image.prefetch( "common/images/misc/dialogShadow/ShadowLeftStraight.png" ); |
|
118 |
+ |
Image.prefetch( "common/images/misc/dialogShadow/ShadowRightStraight.png" ); |
|
119 |
+ |
Image.prefetch( "common/images/misc/dialogShadow/ShadowBottomLeft.png" ); |
|
120 |
+ |
Image.prefetch( "common/images/misc/dialogShadow/ShadowDownStraight.png" ); |
|
121 |
+ |
Image.prefetch( "common/images/misc/dialogShadow/ShadowBottomRight.png" ); |
|
122 |
+ |
|
|
123 |
+ |
// Both LnFs are prefetched, need to only load once per theme |
|
124 |
+ |
Image.prefetch( "common/lnf/classic/Dialog/CornerBottomLeft.png" ); |
|
125 |
+ |
Image.prefetch( "common/lnf/classic/Dialog/CornerBottomLeftDown.png" ); |
|
126 |
+ |
Image.prefetch( "common/lnf/classic/Dialog/CornerBottomLeftUp.png" ); |
|
127 |
+ |
Image.prefetch( "common/lnf/classic/Dialog/CornerBottomRight.png" ); |
|
128 |
+ |
Image.prefetch( "common/lnf/classic/Dialog/CornerBottomRightDown.png" ); |
|
129 |
+ |
Image.prefetch( "common/lnf/classic/Dialog/CornerBottomRightUp.png" ); |
|
130 |
+ |
Image.prefetch( "common/lnf/classic/Dialog/CornerTopLeft.png" ); |
|
131 |
+ |
Image.prefetch( "common/lnf/classic/Dialog/CornerTopLeftDown.png" ); |
|
132 |
+ |
Image.prefetch( "common/lnf/classic/Dialog/CornerTopLeftUp.png" ); |
|
133 |
+ |
Image.prefetch( "common/lnf/classic/Dialog/CornerTopRight.png" ); |
|
134 |
+ |
Image.prefetch( "common/lnf/classic/Dialog/CornerTopRightDown.png" ); |
|
135 |
+ |
Image.prefetch( "common/lnf/classic/Dialog/CornerTopRightUp.png" ); |
|
136 |
+ |
Image.prefetch( "common/lnf/classic/Dialog/StraightBottom.png" ); |
|
137 |
+ |
Image.prefetch( "common/lnf/classic/Dialog/StraightLeftCaption.png" ); |
|
138 |
+ |
Image.prefetch( "common/lnf/classic/Dialog/StraightLeftContent.png" ); |
|
139 |
+ |
Image.prefetch( "common/lnf/classic/Dialog/StraightRightCaption.png" ); |
|
140 |
+ |
Image.prefetch( "common/lnf/classic/Dialog/StraightRightContent.png" ); |
|
141 |
+ |
Image.prefetch( "common/lnf/classic/Dialog/StraightTop.png" ); |
|
142 |
+ |
|
|
143 |
+ |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerBottomLeft.png" ); |
|
144 |
+ |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerBottomLeftDown.png" ); |
|
145 |
+ |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerBottomLeftUp.png" ); |
|
146 |
+ |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerBottomRight.png" ); |
|
147 |
+ |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerBottomRightDown.png" ); |
|
148 |
+ |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerBottomRightUp.png" ); |
|
149 |
+ |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerTopLeft.png" ); |
|
150 |
+ |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerTopLeftDown.png" ); |
|
151 |
+ |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerTopLeftUp.png" ); |
|
152 |
+ |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerTopRight.png" ); |
|
153 |
+ |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerTopRightDown.png" ); |
|
154 |
+ |
Image.prefetch( "common/lnf/classic_rounded/Dialog/CornerTopRightUp.png" ); |
|
155 |
+ |
Image.prefetch( "common/lnf/classic_rounded/Dialog/StraightBottom.png" ); |
|
156 |
+ |
Image.prefetch( "common/lnf/classic_rounded/Dialog/StraightLeftCaption.png" ); |
|
157 |
+ |
Image.prefetch( "common/lnf/classic_rounded/Dialog/StraightLeftContent.png" ); |
|
158 |
+ |
Image.prefetch( "common/lnf/classic_rounded/Dialog/StraightRightCaption.png" ); |
|
159 |
+ |
Image.prefetch( "common/lnf/classic_rounded/Dialog/StraightRightContent.png" ); |
|
160 |
+ |
Image.prefetch( "common/lnf/classic_rounded/Dialog/StraightTop.png" ); |
|
161 |
+ |
} |
|
162 |
+ |
} |