|
@@ -1,41 +1,41 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.eventbus.client; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.GWT.client.*; |
5 |
|
- |
|
6 |
|
- |
public class WindowNameClientIdCodec { |
7 |
|
- |
private String mEncodedClientIdSuffix; |
8 |
|
- |
|
9 |
|
- |
public WindowNameClientIdCodec( AppNames pAppNames ) { |
10 |
|
- |
mEncodedClientIdSuffix = "_" + pAppNames.getShortAllLettersClientName() + "_"; |
11 |
|
- |
} |
12 |
|
- |
|
13 |
|
- |
/** |
14 |
|
- |
* Window Name is the name of the new window. |
15 |
|
- |
* <p/> |
16 |
|
- |
* This name cannot contain spaces or special characters, but can be quite long (on the order of 2MB). |
17 |
|
- |
* <p/> |
18 |
|
- |
* Known good characters as US Letters (both upper & lower case), digits, and underscore ('_'). |
19 |
|
- |
* <p/> |
20 |
|
- |
* Special / reserved Names are: |
21 |
|
- |
* _blank Loads the linked document into a new blank window. This window is not named. |
22 |
|
- |
* _parent Loads the linked document into the immediate parent of the document the link is in. |
23 |
|
- |
* _self Loads the linked document into the same window the link was clicked in (the active window). |
24 |
|
- |
* _top Loads the linked document into the topmost window. |
25 |
|
- |
* _search Loads the linked document into the browser's search pane. |
26 |
|
- |
* (Available in Internet Explorer 5 or later) |
27 |
|
- |
*/ |
28 |
|
- |
public String createWindowName( String pEncodedClientId ) { |
29 |
|
- |
return mEncodedClientIdSuffix + pEncodedClientId; |
30 |
|
- |
} |
31 |
|
- |
|
32 |
|
- |
public String extractEncodedClientId( String pWindowName ) { |
33 |
|
- |
if ( pWindowName != null ) { |
34 |
|
- |
int at = pWindowName.indexOf( mEncodedClientIdSuffix ); |
35 |
|
- |
if ( at != -1 ) { |
36 |
|
- |
return pWindowName.substring( at + mEncodedClientIdSuffix.length() ).trim(); |
37 |
|
- |
} |
38 |
|
- |
} |
39 |
|
- |
return ""; |
40 |
|
- |
} |
41 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.eventbus.client; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.GWT.client.*; |
|
5 |
+ |
|
|
6 |
+ |
public class WindowNameClientIdCodec { |
|
7 |
+ |
private String mEncodedClientIdSuffix; |
|
8 |
+ |
|
|
9 |
+ |
public WindowNameClientIdCodec( AppNames pAppNames ) { |
|
10 |
+ |
mEncodedClientIdSuffix = "_" + pAppNames.getShortAllLettersClientName() + "_"; |
|
11 |
+ |
} |
|
12 |
+ |
|
|
13 |
+ |
/** |
|
14 |
+ |
* Window Name is the name of the new window. |
|
15 |
+ |
* <p/> |
|
16 |
+ |
* This name cannot contain spaces or special characters, but can be quite long (on the order of 2MB). |
|
17 |
+ |
* <p/> |
|
18 |
+ |
* Known good characters as US Letters (both upper & lower case), digits, and underscore ('_'). |
|
19 |
+ |
* <p/> |
|
20 |
+ |
* Special / reserved Names are: |
|
21 |
+ |
* _blank Loads the linked document into a new blank window. This window is not named. |
|
22 |
+ |
* _parent Loads the linked document into the immediate parent of the document the link is in. |
|
23 |
+ |
* _self Loads the linked document into the same window the link was clicked in (the active window). |
|
24 |
+ |
* _top Loads the linked document into the topmost window. |
|
25 |
+ |
* _search Loads the linked document into the browser's search pane. |
|
26 |
+ |
* (Available in Internet Explorer 5 or later) |
|
27 |
+ |
*/ |
|
28 |
+ |
public String createWindowName( String pEncodedClientId ) { |
|
29 |
+ |
return mEncodedClientIdSuffix + pEncodedClientId; |
|
30 |
+ |
} |
|
31 |
+ |
|
|
32 |
+ |
public String extractEncodedClientId( String pWindowName ) { |
|
33 |
+ |
if ( pWindowName != null ) { |
|
34 |
+ |
int at = pWindowName.indexOf( mEncodedClientIdSuffix ); |
|
35 |
+ |
if ( at != -1 ) { |
|
36 |
+ |
return pWindowName.substring( at + mEncodedClientIdSuffix.length() ).trim(); |
|
37 |
+ |
} |
|
38 |
+ |
} |
|
39 |
+ |
return ""; |
|
40 |
+ |
} |
|
41 |
+ |
} |