|
@@ -1,53 +1,53 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.client.widgets; |
3 |
|
- |
|
4 |
|
- |
import com.google.gwt.user.client.ui.*; |
5 |
|
- |
|
6 |
|
- |
public interface ISizeableTabPanel { |
7 |
|
- |
public void addStyleName( String pStyle ); |
8 |
|
- |
|
9 |
|
- |
public void insertTab( int pBeforeIndex, String pLabelText, Widget pWidget ); |
10 |
|
- |
|
11 |
|
- |
public void insertTab( int pBeforeIndex, String pLabelText, boolean pAsHTML, Widget pWidget ); |
12 |
|
- |
|
13 |
|
- |
public void removeTab( int pIndex ); |
14 |
|
- |
|
15 |
|
- |
public void addTab( String pLabelText, Widget pWidget ); |
16 |
|
- |
|
17 |
|
- |
public void addTab( String pLabelText, boolean pAsHTML, Widget pWidget ); |
18 |
|
- |
|
19 |
|
- |
public int getTabCount(); |
20 |
|
- |
|
21 |
|
- |
public int getSelectedTab(); |
22 |
|
- |
|
23 |
|
- |
public void selectTab( int pIndex ); |
24 |
|
- |
|
25 |
|
- |
public void setError( int pIndex, boolean pError ); |
26 |
|
- |
|
27 |
|
- |
class Helper { |
28 |
|
- |
public static int normalizeBeforeIndex( int pIndex, ISizeableTabPanel pSource ) { |
29 |
|
- |
if ( pIndex <= 0 ) // == 0 is always safe |
30 |
|
- |
{ |
31 |
|
- |
return 0; |
32 |
|
- |
} |
33 |
|
- |
int zTabCount = pSource.getTabCount(); |
34 |
|
- |
return (pIndex <= zTabCount) ? pIndex : zTabCount; |
35 |
|
- |
} |
36 |
|
- |
|
37 |
|
- |
public static boolean indexOK( int pIndex, ISizeableTabPanel pSource ) { |
38 |
|
- |
return ((0 <= pIndex) && (pIndex < pSource.getTabCount())); |
39 |
|
- |
} |
40 |
|
- |
|
41 |
|
- |
public static String augment( String pLabelText, boolean pErrorable ) { |
42 |
|
- |
return pErrorable ? augmentWithErrorIndicator( pLabelText ) : augmentWithSpacer( pLabelText ); |
43 |
|
- |
} |
44 |
|
- |
|
45 |
|
- |
public static String augmentWithErrorIndicator( String pLabelText ) { |
46 |
|
- |
return "<img src='" + TransparentImage.URL + "' width='13' height='12' class='tabErrorIndicator' border='0'>" + pLabelText; |
47 |
|
- |
} |
48 |
|
- |
|
49 |
|
- |
public static String augmentWithSpacer( String pLabelText ) { |
50 |
|
- |
return "<img src='" + TransparentImage.URL + "' width='13' height='12' border='0'>" + pLabelText; |
51 |
|
- |
} |
52 |
|
- |
} |
53 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.client.widgets; |
|
3 |
+ |
|
|
4 |
+ |
import com.google.gwt.user.client.ui.*; |
|
5 |
+ |
|
|
6 |
+ |
public interface ISizeableTabPanel { |
|
7 |
+ |
public void addStyleName( String pStyle ); |
|
8 |
+ |
|
|
9 |
+ |
public void insertTab( int pBeforeIndex, String pLabelText, Widget pWidget ); |
|
10 |
+ |
|
|
11 |
+ |
public void insertTab( int pBeforeIndex, String pLabelText, boolean pAsHTML, Widget pWidget ); |
|
12 |
+ |
|
|
13 |
+ |
public void removeTab( int pIndex ); |
|
14 |
+ |
|
|
15 |
+ |
public void addTab( String pLabelText, Widget pWidget ); |
|
16 |
+ |
|
|
17 |
+ |
public void addTab( String pLabelText, boolean pAsHTML, Widget pWidget ); |
|
18 |
+ |
|
|
19 |
+ |
public int getTabCount(); |
|
20 |
+ |
|
|
21 |
+ |
public int getSelectedTab(); |
|
22 |
+ |
|
|
23 |
+ |
public void selectTab( int pIndex ); |
|
24 |
+ |
|
|
25 |
+ |
public void setError( int pIndex, boolean pError ); |
|
26 |
+ |
|
|
27 |
+ |
class Helper { |
|
28 |
+ |
public static int normalizeBeforeIndex( int pIndex, ISizeableTabPanel pSource ) { |
|
29 |
+ |
if ( pIndex <= 0 ) // == 0 is always safe |
|
30 |
+ |
{ |
|
31 |
+ |
return 0; |
|
32 |
+ |
} |
|
33 |
+ |
int zTabCount = pSource.getTabCount(); |
|
34 |
+ |
return (pIndex <= zTabCount) ? pIndex : zTabCount; |
|
35 |
+ |
} |
|
36 |
+ |
|
|
37 |
+ |
public static boolean indexOK( int pIndex, ISizeableTabPanel pSource ) { |
|
38 |
+ |
return ((0 <= pIndex) && (pIndex < pSource.getTabCount())); |
|
39 |
+ |
} |
|
40 |
+ |
|
|
41 |
+ |
public static String augment( String pLabelText, boolean pErrorable ) { |
|
42 |
+ |
return pErrorable ? augmentWithErrorIndicator( pLabelText ) : augmentWithSpacer( pLabelText ); |
|
43 |
+ |
} |
|
44 |
+ |
|
|
45 |
+ |
public static String augmentWithErrorIndicator( String pLabelText ) { |
|
46 |
+ |
return "<img src='" + TransparentImage.URL + "' width='13' height='12' class='tabErrorIndicator' border='0'>" + pLabelText; |
|
47 |
+ |
} |
|
48 |
+ |
|
|
49 |
+ |
public static String augmentWithSpacer( String pLabelText ) { |
|
50 |
+ |
return "<img src='" + TransparentImage.URL + "' width='13' height='12' border='0'>" + pLabelText; |
|
51 |
+ |
} |
|
52 |
+ |
} |
|
53 |
+ |
} |