|
@@ -1,61 +1,61 @@ |
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.*; |
5 |
|
- |
import com.google.gwt.user.client.ui.*; |
6 |
|
- |
|
7 |
|
- |
public abstract class FloaterTitleBar extends SizeableVerticalPanel { |
8 |
|
- |
private CustomHorizontal mCustomHorizontal = new CustomHorizontal(); |
9 |
|
- |
|
10 |
|
- |
public FloaterTitleBar() { |
11 |
|
- |
LLstretchableHorizontally(); |
12 |
|
- |
super.add( mCustomHorizontal ); |
13 |
|
- |
super.add( new SizeableSpacer( 3 ).stretchableHorizontally() ); |
14 |
|
- |
} |
15 |
|
- |
|
16 |
|
- |
@Override |
17 |
|
- |
public void add( Widget pWidget ) { |
18 |
|
- |
mCustomHorizontal.add( pWidget ); |
19 |
|
- |
} |
20 |
|
- |
|
21 |
|
- |
abstract public String getTitleBarTitle(); |
22 |
|
- |
|
23 |
|
- |
abstract public void setTitleBarTitle( String pTitle ); |
24 |
|
- |
|
25 |
|
- |
public void hide() { |
26 |
|
- |
mCustomHorizontal.setVisible( false ); |
27 |
|
- |
} |
28 |
|
- |
|
29 |
|
- |
public void unhide() { |
30 |
|
- |
mCustomHorizontal.setVisible( true ); |
31 |
|
- |
} |
32 |
|
- |
|
33 |
|
- |
private static class CustomHorizontal extends SizeableHorizontalPanel { |
34 |
|
- |
private boolean mHidden = false; |
35 |
|
- |
|
36 |
|
- |
public CustomHorizontal() { |
37 |
|
- |
stretchableHorizontally(); |
38 |
|
- |
setVerticalAlignment( ALIGN_MIDDLE ); |
39 |
|
- |
add( new Spacer( 1 ) ); |
40 |
|
- |
} |
41 |
|
- |
|
42 |
|
- |
@Override |
43 |
|
- |
public void setWidth( String pWidth ) { |
44 |
|
- |
if ( !mHidden ) { |
45 |
|
- |
super.setWidth( pWidth ); |
46 |
|
- |
} |
47 |
|
- |
} |
48 |
|
- |
|
49 |
|
- |
@Override |
50 |
|
- |
public void setVisible( boolean pVisible ) { |
51 |
|
- |
if ( !pVisible ) { |
52 |
|
- |
super.setWidth( "1" ); |
53 |
|
- |
mHidden = true; |
54 |
|
- |
} else { |
55 |
|
- |
mHidden = false; |
56 |
|
- |
Element zParent = DOM.getParent( getElement() ); |
57 |
|
- |
super.setWidth( "" + zParent.getOffsetWidth() ); |
58 |
|
- |
} |
59 |
|
- |
} |
60 |
|
- |
} |
61 |
|
- |
} |
|
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.*; |
|
5 |
+ |
import com.google.gwt.user.client.ui.*; |
|
6 |
+ |
|
|
7 |
+ |
public abstract class FloaterTitleBar extends SizeableVerticalPanel { |
|
8 |
+ |
private CustomHorizontal mCustomHorizontal = new CustomHorizontal(); |
|
9 |
+ |
|
|
10 |
+ |
public FloaterTitleBar() { |
|
11 |
+ |
LLstretchableHorizontally(); |
|
12 |
+ |
super.add( mCustomHorizontal ); |
|
13 |
+ |
super.add( new SizeableSpacer( 3 ).stretchableHorizontally() ); |
|
14 |
+ |
} |
|
15 |
+ |
|
|
16 |
+ |
@Override |
|
17 |
+ |
public void add( Widget pWidget ) { |
|
18 |
+ |
mCustomHorizontal.add( pWidget ); |
|
19 |
+ |
} |
|
20 |
+ |
|
|
21 |
+ |
abstract public String getTitleBarTitle(); |
|
22 |
+ |
|
|
23 |
+ |
abstract public void setTitleBarTitle( String pTitle ); |
|
24 |
+ |
|
|
25 |
+ |
public void hide() { |
|
26 |
+ |
mCustomHorizontal.setVisible( false ); |
|
27 |
+ |
} |
|
28 |
+ |
|
|
29 |
+ |
public void unhide() { |
|
30 |
+ |
mCustomHorizontal.setVisible( true ); |
|
31 |
+ |
} |
|
32 |
+ |
|
|
33 |
+ |
private static class CustomHorizontal extends SizeableHorizontalPanel { |
|
34 |
+ |
private boolean mHidden = false; |
|
35 |
+ |
|
|
36 |
+ |
public CustomHorizontal() { |
|
37 |
+ |
stretchableHorizontally(); |
|
38 |
+ |
setVerticalAlignment( ALIGN_MIDDLE ); |
|
39 |
+ |
add( new Spacer( 1 ) ); |
|
40 |
+ |
} |
|
41 |
+ |
|
|
42 |
+ |
@Override |
|
43 |
+ |
public void setWidth( String pWidth ) { |
|
44 |
+ |
if ( !mHidden ) { |
|
45 |
+ |
super.setWidth( pWidth ); |
|
46 |
+ |
} |
|
47 |
+ |
} |
|
48 |
+ |
|
|
49 |
+ |
@Override |
|
50 |
+ |
public void setVisible( boolean pVisible ) { |
|
51 |
+ |
if ( !pVisible ) { |
|
52 |
+ |
super.setWidth( "1" ); |
|
53 |
+ |
mHidden = true; |
|
54 |
+ |
} else { |
|
55 |
+ |
mHidden = false; |
|
56 |
+ |
Element zParent = DOM.getParent( getElement() ); |
|
57 |
+ |
super.setWidth( "" + zParent.getOffsetWidth() ); |
|
58 |
+ |
} |
|
59 |
+ |
} |
|
60 |
+ |
} |
|
61 |
+ |
} |