Subversion Repository Public Repository

litesoft

Diff Revisions 947 vs 948 for /trunk/Java/GWT/Client/src/org/litesoft/GWT/client/WindowName.java

Diff revisions: vs.
  @@ -17,10 +17,8 @@
17 17 * . . . _top . . . the topmost window.
18 18 * . . . _search . . the browser's search pane. (Available in IE 5+)
19 19 */
20 - public class WindowName
21 - {
22 - public interface Listener
23 - {
20 + public class WindowName {
21 + public interface Listener {
24 22 public void windowNameChanged();
25 23 }
26 24
  @@ -33,53 +31,40 @@
33 31 "_search", // . browser's search pane. (Available in Internet Explorer 5 or later)
34 32 };
35 33
36 - public static void add( Listener pListener )
37 - {
38 - if ( (pListener != null) && (-1 == indexOf( pListener )) )
39 - {
34 + public static void add( Listener pListener ) {
35 + if ( (pListener != null) && (-1 == indexOf( pListener )) ) {
40 36 sListeners = append( sListeners, pListener );
41 37 }
42 38 }
43 39
44 - public static void remove( Listener pListener )
45 - {
46 - if ( pListener != null )
47 - {
40 + public static void remove( Listener pListener ) {
41 + if ( pListener != null ) {
48 42 int zAt = indexOf( pListener );
49 - if ( zAt != -1 )
50 - {
43 + if ( zAt != -1 ) {
51 44 sListeners = removeAt( sListeners, zAt );
52 45 }
53 46 }
54 47 }
55 48
56 49 public static void set( String pWinName )
57 - throws IllegalArgumentException
58 - {
59 - if ( (pWinName == null) || (pWinName.length() == 0) )
60 - {
50 + throws IllegalArgumentException {
51 + if ( (pWinName == null) || (pWinName.length() == 0) ) {
61 52 throw new IllegalArgumentException( "WinName null or empty" );
62 53 }
63 - if ( -1 != pWinName.indexOf( ' ' ) )
64 - {
54 + if ( -1 != pWinName.indexOf( ' ' ) ) {
65 55 throw new IllegalArgumentException( "WinName '" + pWinName + "' contains a space" );
66 56 }
67 - if ( pWinName.charAt( 0 ) == '_' )
68 - {
69 - for ( String zReservedName : RESERVED_NAMES )
70 - {
71 - if ( zReservedName.equals( pWinName ) )
72 - {
57 + if ( pWinName.charAt( 0 ) == '_' ) {
58 + for ( String zReservedName : RESERVED_NAMES ) {
59 + if ( zReservedName.equals( pWinName ) ) {
73 60 throw new IllegalArgumentException( "WinName '" + pWinName + "' is a reserved name" );
74 61 }
75 62 }
76 63 }
77 - if ( !pWinName.equals( get() ) )
78 - {
64 + if ( !pWinName.equals( get() ) ) {
79 65 LLset( pWinName );
80 66 Listener[] zListeners = sListeners; // Snag the List
81 - for ( Listener zListener : zListeners )
82 - {
67 + for ( Listener zListener : zListeners ) {
83 68 zListener.windowNameChanged();
84 69 }
85 70 }
  @@ -88,8 +73,7 @@
88 73 /**
89 74 * @return null or a non-Empty WindowName
90 75 */
91 - public static String get()
92 - {
76 + public static String get() {
93 77 return Strings.noEmpty( LLget() );
94 78 }
95 79
  @@ -103,10 +87,8 @@
103 87
104 88 private static Listener[] sListeners = new Listener[0];
105 89
106 - private static int indexOf( Listener pListener )
107 - {
108 - for ( int i = 0; i < sListeners.length; i++ )
109 - {
90 + private static int indexOf( Listener pListener ) {
91 + for ( int i = 0; i < sListeners.length; i++ ) {
110 92 Listener zListener = sListeners[i];
111 93 if ( zListener == pListener ) // Identity
112 94 {
  @@ -116,11 +98,9 @@
116 98 return -1;
117 99 }
118 100
119 - private static Listener[] append( Listener[] pArray, Listener pListener )
120 - {
101 + private static Listener[] append( Listener[] pArray, Listener pListener ) {
121 102 int zLength = pArray.length;
122 - if ( zLength == 0 )
123 - {
103 + if ( zLength == 0 ) {
124 104 return new Listener[]{pListener};
125 105 }
126 106 Listener[] zNew = new Listener[zLength + 1];
  @@ -129,16 +109,13 @@
129 109 return zNew;
130 110 }
131 111
132 - private static Listener[] removeAt( Listener[] pArray, int pIndexToRemove )
133 - {
112 + private static Listener[] removeAt( Listener[] pArray, int pIndexToRemove ) {
134 113 int zNewLength = pArray.length - 1;
135 114 Listener[] zNew = new Listener[zNewLength];
136 - if ( pIndexToRemove != 0 )
137 - {
115 + if ( pIndexToRemove != 0 ) {
138 116 System.arraycopy( pArray, 0, zNew, 0, pIndexToRemove );
139 117 }
140 - if ( pIndexToRemove != zNewLength )
141 - {
118 + if ( pIndexToRemove != zNewLength ) {
142 119 System.arraycopy( pArray, pIndexToRemove + 1, zNew, pIndexToRemove, zNewLength - pIndexToRemove );
143 120 }
144 121 return zNew;