|
@@ -6,70 +6,56 @@ |
6 |
6 |
|
|
7 |
7 |
|
import com.google.gwt.user.client.ui.*; |
8 |
8 |
|
|
9 |
|
- |
public class ContentSizeableSimplePanel extends ClippingSimplePanel |
10 |
|
- |
{ |
11 |
|
- |
public ContentSizeableSimplePanel() |
12 |
|
- |
{ |
|
9 |
+ |
public class ContentSizeableSimplePanel extends ClippingSimplePanel { |
|
10 |
+ |
public ContentSizeableSimplePanel() { |
13 |
11 |
|
this( null, null ); |
14 |
12 |
|
} |
15 |
13 |
|
|
16 |
|
- |
public ContentSizeableSimplePanel( Widget pWidget ) |
17 |
|
- |
{ |
|
14 |
+ |
public ContentSizeableSimplePanel( Widget pWidget ) { |
18 |
15 |
|
this( null, pWidget ); |
19 |
16 |
|
} |
20 |
17 |
|
|
21 |
18 |
|
/** |
22 |
|
- |
* @param pNoSizeAffectingCSS_StyleClassname |
23 |
|
- |
* a style name or null |
24 |
|
- |
* @param pWidget a widget or null. Call {@link #setWidget(Widget)} if this is null. |
|
19 |
+ |
* @param pNoSizeAffectingCSS_StyleClassname a style name or null |
|
20 |
+ |
* @param pWidget a widget or null. Call {@link #setWidget(Widget)} if this is null. |
25 |
21 |
|
*/ |
26 |
|
- |
public ContentSizeableSimplePanel( String pNoSizeAffectingCSS_StyleClassname, Widget pWidget ) |
27 |
|
- |
{ |
|
22 |
+ |
public ContentSizeableSimplePanel( String pNoSizeAffectingCSS_StyleClassname, Widget pWidget ) { |
28 |
23 |
|
super( pNoSizeAffectingCSS_StyleClassname ); |
29 |
|
- |
if ( pWidget != null ) |
30 |
|
- |
{ |
|
24 |
+ |
if ( pWidget != null ) { |
31 |
25 |
|
setWidget( pWidget ); |
32 |
26 |
|
} |
33 |
27 |
|
} |
34 |
28 |
|
|
35 |
29 |
|
@Override |
36 |
|
- |
public void setWidget( Widget pWidget ) |
37 |
|
- |
{ |
|
30 |
+ |
public void setWidget( Widget pWidget ) { |
38 |
31 |
|
super.setWidget( pWidget ); |
39 |
32 |
|
updateChildSize(); |
40 |
33 |
|
} |
41 |
34 |
|
|
42 |
35 |
|
@Override |
43 |
|
- |
protected void onAttach() |
44 |
|
- |
{ |
|
36 |
+ |
protected void onAttach() { |
45 |
37 |
|
super.onAttach(); |
46 |
38 |
|
updateChildSize(); |
47 |
39 |
|
} |
48 |
40 |
|
|
49 |
41 |
|
@Override |
50 |
|
- |
public void setVisible( boolean visible ) |
51 |
|
- |
{ |
|
42 |
+ |
public void setVisible( boolean visible ) { |
52 |
43 |
|
super.setVisible( visible ); |
53 |
44 |
|
updateChildSize(); |
54 |
45 |
|
} |
55 |
46 |
|
|
56 |
|
- |
protected void updateChildSize() |
57 |
|
- |
{ |
58 |
|
- |
if ( !LLupdateChildSize() ) |
59 |
|
- |
{ |
|
47 |
+ |
protected void updateChildSize() { |
|
48 |
+ |
if ( !LLupdateChildSize() ) { |
60 |
49 |
|
LLupdateChildSizeLater(); |
61 |
50 |
|
} |
62 |
51 |
|
} |
63 |
52 |
|
|
64 |
|
- |
private boolean LLupdateChildSize() |
65 |
|
- |
{ |
|
53 |
+ |
private boolean LLupdateChildSize() { |
66 |
54 |
|
Widget zWidget = getWidget(); |
67 |
|
- |
if ( isVisible() && isAttached() && (zWidget != null) ) |
68 |
|
- |
{ |
|
55 |
+ |
if ( isVisible() && isAttached() && (zWidget != null) ) { |
69 |
56 |
|
int zWidth = getOffsetWidth(); |
70 |
57 |
|
int zHeight = getOffsetHeight(); |
71 |
|
- |
if ( (10 > zWidth) || (10 > zHeight) ) |
72 |
|
- |
{ |
|
58 |
+ |
if ( (10 > zWidth) || (10 > zHeight) ) { |
73 |
59 |
|
return false; |
74 |
60 |
|
} |
75 |
61 |
|
LLupdateChildWidth( zWidget, zWidth ); |
|
@@ -78,40 +64,31 @@ |
78 |
64 |
|
return true; |
79 |
65 |
|
} |
80 |
66 |
|
|
81 |
|
- |
protected void LLupdateChildHeight( Widget pWidget, int pHeight ) |
82 |
|
- |
{ |
|
67 |
+ |
protected void LLupdateChildHeight( Widget pWidget, int pHeight ) { |
83 |
68 |
|
pWidget.setHeight( "" + pHeight ); |
84 |
69 |
|
} |
85 |
70 |
|
|
86 |
|
- |
protected void LLupdateChildWidth( Widget pWidget, int pWidth ) |
87 |
|
- |
{ |
|
71 |
+ |
protected void LLupdateChildWidth( Widget pWidget, int pWidth ) { |
88 |
72 |
|
pWidget.setWidth( "" + pWidth ); |
89 |
73 |
|
} |
90 |
74 |
|
|
91 |
|
- |
private void LLupdateChildSizeLater() |
92 |
|
- |
{ |
93 |
|
- |
if ( !mUpdateChildSizeDeffered ) |
94 |
|
- |
{ |
|
75 |
+ |
private void LLupdateChildSizeLater() { |
|
76 |
+ |
if ( !mUpdateChildSizeDeffered ) { |
95 |
77 |
|
mUpdateChildSizeDeffered = true; |
96 |
78 |
|
TimedRunnableManager.INSTANCE.runIn( mLaterUpdateChildSize, 50 ); |
97 |
79 |
|
} |
98 |
80 |
|
} |
99 |
81 |
|
|
100 |
82 |
|
private boolean mUpdateChildSizeDeffered = false; |
101 |
|
- |
private TimedRunnable mLaterUpdateChildSize = new TimedRunnable() |
102 |
|
- |
{ |
|
83 |
+ |
private TimedRunnable mLaterUpdateChildSize = new TimedRunnable() { |
103 |
84 |
|
@Override |
104 |
|
- |
public Again runOnce() |
105 |
|
- |
{ |
106 |
|
- |
try |
107 |
|
- |
{ |
108 |
|
- |
if ( !LLupdateChildSize() ) |
109 |
|
- |
{ |
|
85 |
+ |
public Again runOnce() { |
|
86 |
+ |
try { |
|
87 |
+ |
if ( !LLupdateChildSize() ) { |
110 |
88 |
|
return new RunAgainIn( 100 ); |
111 |
89 |
|
} |
112 |
90 |
|
} |
113 |
|
- |
catch ( RuntimeException e ) |
114 |
|
- |
{ |
|
91 |
+ |
catch ( RuntimeException e ) { |
115 |
92 |
|
e.printStackTrace(); |
116 |
93 |
|
} |
117 |
94 |
|
mUpdateChildSizeDeffered = false; |