|
@@ -1,106 +1,106 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.forms.client.components.nonpublic; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.GWT.client.widgets.*; |
5 |
|
- |
import org.litesoft.GWT.client.widgets.nonpublic.*; |
6 |
|
- |
import org.litesoft.ui.*; |
7 |
|
- |
|
8 |
|
- |
import com.google.gwt.user.client.ui.*; |
9 |
|
- |
|
10 |
|
- |
public class AbstractFormContainer extends Composite implements ISizeableWidget { |
11 |
|
- |
protected final FormContainerErrorPanel mErrorPanel = new FormContainerErrorPanel(); |
12 |
|
- |
private final ResizeHelper mResizeHelper = new MyResizeHelper(); |
13 |
|
- |
private AbstractSizeableVerticalRegularPanel mOuterPanel; |
14 |
|
- |
private String mPendingWidth = null; |
15 |
|
- |
private String mPendingHeight = null; |
16 |
|
- |
private static final String STYLE = "litesoft-OuterBox"; |
17 |
|
- |
|
18 |
|
- |
public AbstractFormContainer( AbstractSizeableVerticalRegularPanel pOuterPanel, ISizeableWidget pWidget ) { |
19 |
|
- |
(mOuterPanel = pOuterPanel).addStyleName( STYLE ); |
20 |
|
- |
initWidget( mOuterPanel ); |
21 |
|
- |
|
22 |
|
- |
mOuterPanel.add( (Widget) pWidget ); |
23 |
|
- |
mOuterPanel.add( mErrorPanel ); |
24 |
|
- |
|
25 |
|
- |
if ( pWidget.getWidthHelper().isStretchable() ) { |
26 |
|
- |
mOuterPanel.LLstretchableHorizontally(); |
27 |
|
- |
} |
28 |
|
- |
if ( pWidget.getHeightHelper().isStretchable() ) { |
29 |
|
- |
mOuterPanel.LLstretchableVertically(); |
30 |
|
- |
} |
31 |
|
- |
} |
32 |
|
- |
|
33 |
|
- |
@Override |
34 |
|
- |
public ISizeableDimensionHelper getWidthHelper() { |
35 |
|
- |
return mOuterPanel.getWidthHelper(); |
36 |
|
- |
} |
37 |
|
- |
|
38 |
|
- |
@Override |
39 |
|
- |
public ISizeableDimensionHelper getHeightHelper() { |
40 |
|
- |
return mOuterPanel.getHeightHelper(); |
41 |
|
- |
} |
42 |
|
- |
|
43 |
|
- |
@Override |
44 |
|
- |
public void relayout() { |
45 |
|
- |
Widget parent = getParent(); |
46 |
|
- |
if ( parent instanceof SizeManaged ) { |
47 |
|
- |
((SizeManaged) parent).relayout(); |
48 |
|
- |
} else { |
49 |
|
- |
setWidth( "" + getOffsetWidth() ); |
50 |
|
- |
setHeight( "" + getOffsetHeight() ); |
51 |
|
- |
} |
52 |
|
- |
} |
53 |
|
- |
|
54 |
|
- |
@Override |
55 |
|
- |
public void setWidth( String width ) { |
56 |
|
- |
mPendingWidth = width; |
57 |
|
- |
mResizeHelper.onResized(); |
58 |
|
- |
} |
59 |
|
- |
|
60 |
|
- |
@Override |
61 |
|
- |
public void setHeight( String height ) { |
62 |
|
- |
mPendingHeight = height; |
63 |
|
- |
mResizeHelper.onResized(); |
64 |
|
- |
} |
65 |
|
- |
|
66 |
|
- |
/** |
67 |
|
- |
* Not supported |
68 |
|
- |
* |
69 |
|
- |
* @throws UnsupportedOperationException |
70 |
|
- |
*/ |
71 |
|
- |
@Override |
72 |
|
- |
public void setTitle( String title ) |
73 |
|
- |
throws UnsupportedOperationException { |
74 |
|
- |
throw new UnsupportedOperationException(); |
75 |
|
- |
} |
76 |
|
- |
|
77 |
|
- |
public void setError( String pError ) { |
78 |
|
- |
mErrorPanel.setError( pError ); |
79 |
|
- |
} |
80 |
|
- |
|
81 |
|
- |
public void setWarning( String pWarning ) { |
82 |
|
- |
mErrorPanel.setWarning( pWarning ); |
83 |
|
- |
} |
84 |
|
- |
|
85 |
|
- |
public void clearErrorOrWarning() { |
86 |
|
- |
mErrorPanel.clearErrorOrWarning(); |
87 |
|
- |
} |
88 |
|
- |
|
89 |
|
- |
private class MyResizeHelper extends ResizeHelper { |
90 |
|
- |
public MyResizeHelper() { |
91 |
|
- |
super( 666 ); |
92 |
|
- |
} |
93 |
|
- |
|
94 |
|
- |
@Override |
95 |
|
- |
protected void doResize() { |
96 |
|
- |
if ( mPendingWidth != null ) { |
97 |
|
- |
mOuterPanel.setWidth( mPendingWidth ); |
98 |
|
- |
mPendingWidth = null; |
99 |
|
- |
} |
100 |
|
- |
if ( mPendingHeight != null ) { |
101 |
|
- |
mOuterPanel.setHeight( mPendingHeight ); |
102 |
|
- |
mPendingHeight = null; |
103 |
|
- |
} |
104 |
|
- |
} |
105 |
|
- |
} |
106 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.forms.client.components.nonpublic; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.GWT.client.widgets.*; |
|
5 |
+ |
import org.litesoft.GWT.client.widgets.nonpublic.*; |
|
6 |
+ |
import org.litesoft.ui.*; |
|
7 |
+ |
|
|
8 |
+ |
import com.google.gwt.user.client.ui.*; |
|
9 |
+ |
|
|
10 |
+ |
public class AbstractFormContainer extends Composite implements ISizeableWidget { |
|
11 |
+ |
protected final FormContainerErrorPanel mErrorPanel = new FormContainerErrorPanel(); |
|
12 |
+ |
private final ResizeHelper mResizeHelper = new MyResizeHelper(); |
|
13 |
+ |
private AbstractSizeableVerticalRegularPanel mOuterPanel; |
|
14 |
+ |
private String mPendingWidth = null; |
|
15 |
+ |
private String mPendingHeight = null; |
|
16 |
+ |
private static final String STYLE = "litesoft-OuterBox"; |
|
17 |
+ |
|
|
18 |
+ |
public AbstractFormContainer( AbstractSizeableVerticalRegularPanel pOuterPanel, ISizeableWidget pWidget ) { |
|
19 |
+ |
(mOuterPanel = pOuterPanel).addStyleName( STYLE ); |
|
20 |
+ |
initWidget( mOuterPanel ); |
|
21 |
+ |
|
|
22 |
+ |
mOuterPanel.add( (Widget) pWidget ); |
|
23 |
+ |
mOuterPanel.add( mErrorPanel ); |
|
24 |
+ |
|
|
25 |
+ |
if ( pWidget.getWidthHelper().isStretchable() ) { |
|
26 |
+ |
mOuterPanel.LLstretchableHorizontally(); |
|
27 |
+ |
} |
|
28 |
+ |
if ( pWidget.getHeightHelper().isStretchable() ) { |
|
29 |
+ |
mOuterPanel.LLstretchableVertically(); |
|
30 |
+ |
} |
|
31 |
+ |
} |
|
32 |
+ |
|
|
33 |
+ |
@Override |
|
34 |
+ |
public ISizeableDimensionHelper getWidthHelper() { |
|
35 |
+ |
return mOuterPanel.getWidthHelper(); |
|
36 |
+ |
} |
|
37 |
+ |
|
|
38 |
+ |
@Override |
|
39 |
+ |
public ISizeableDimensionHelper getHeightHelper() { |
|
40 |
+ |
return mOuterPanel.getHeightHelper(); |
|
41 |
+ |
} |
|
42 |
+ |
|
|
43 |
+ |
@Override |
|
44 |
+ |
public void relayout() { |
|
45 |
+ |
Widget parent = getParent(); |
|
46 |
+ |
if ( parent instanceof SizeManaged ) { |
|
47 |
+ |
((SizeManaged) parent).relayout(); |
|
48 |
+ |
} else { |
|
49 |
+ |
setWidth( "" + getOffsetWidth() ); |
|
50 |
+ |
setHeight( "" + getOffsetHeight() ); |
|
51 |
+ |
} |
|
52 |
+ |
} |
|
53 |
+ |
|
|
54 |
+ |
@Override |
|
55 |
+ |
public void setWidth( String width ) { |
|
56 |
+ |
mPendingWidth = width; |
|
57 |
+ |
mResizeHelper.onResized(); |
|
58 |
+ |
} |
|
59 |
+ |
|
|
60 |
+ |
@Override |
|
61 |
+ |
public void setHeight( String height ) { |
|
62 |
+ |
mPendingHeight = height; |
|
63 |
+ |
mResizeHelper.onResized(); |
|
64 |
+ |
} |
|
65 |
+ |
|
|
66 |
+ |
/** |
|
67 |
+ |
* Not supported |
|
68 |
+ |
* |
|
69 |
+ |
* @throws UnsupportedOperationException |
|
70 |
+ |
*/ |
|
71 |
+ |
@Override |
|
72 |
+ |
public void setTitle( String title ) |
|
73 |
+ |
throws UnsupportedOperationException { |
|
74 |
+ |
throw new UnsupportedOperationException(); |
|
75 |
+ |
} |
|
76 |
+ |
|
|
77 |
+ |
public void setError( String pError ) { |
|
78 |
+ |
mErrorPanel.setError( pError ); |
|
79 |
+ |
} |
|
80 |
+ |
|
|
81 |
+ |
public void setWarning( String pWarning ) { |
|
82 |
+ |
mErrorPanel.setWarning( pWarning ); |
|
83 |
+ |
} |
|
84 |
+ |
|
|
85 |
+ |
public void clearErrorOrWarning() { |
|
86 |
+ |
mErrorPanel.clearErrorOrWarning(); |
|
87 |
+ |
} |
|
88 |
+ |
|
|
89 |
+ |
private class MyResizeHelper extends ResizeHelper { |
|
90 |
+ |
public MyResizeHelper() { |
|
91 |
+ |
super( 666 ); |
|
92 |
+ |
} |
|
93 |
+ |
|
|
94 |
+ |
@Override |
|
95 |
+ |
protected void doResize() { |
|
96 |
+ |
if ( mPendingWidth != null ) { |
|
97 |
+ |
mOuterPanel.setWidth( mPendingWidth ); |
|
98 |
+ |
mPendingWidth = null; |
|
99 |
+ |
} |
|
100 |
+ |
if ( mPendingHeight != null ) { |
|
101 |
+ |
mOuterPanel.setHeight( mPendingHeight ); |
|
102 |
+ |
mPendingHeight = null; |
|
103 |
+ |
} |
|
104 |
+ |
} |
|
105 |
+ |
} |
|
106 |
+ |
} |