|
@@ -1,91 +1,91 @@ |
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 |
|
- |
|
7 |
|
- |
import com.google.gwt.user.client.ui.*; |
8 |
|
- |
|
9 |
|
- |
public class WidgetStruct implements HasAlignment { |
10 |
|
- |
protected Widget mWidget; |
11 |
|
- |
protected boolean mSpacer = false; |
12 |
|
- |
|
13 |
|
- |
protected boolean mStretchableHorizontally = false; |
14 |
|
- |
protected boolean mFloodsX = false; |
15 |
|
- |
protected HorizontalAlignmentConstant mHorizontalAlignment = null; |
16 |
|
- |
|
17 |
|
- |
protected boolean mStretchableVertically = false; |
18 |
|
- |
protected boolean mFloodsY = false; |
19 |
|
- |
protected VerticalAlignmentConstant mVerticalAlignment = null; |
20 |
|
- |
|
21 |
|
- |
public WidgetStruct( Widget pWidget ) { |
22 |
|
- |
mWidget = pWidget; |
23 |
|
- |
if ( pWidget instanceof ISizeableWidget ) { |
24 |
|
- |
ISizeableWidget w = (ISizeableWidget) pWidget; |
25 |
|
- |
mStretchableHorizontally = w.getWidthHelper().isStretchable(); |
26 |
|
- |
mStretchableVertically = w.getHeightHelper().isStretchable(); |
27 |
|
- |
mSpacer = (pWidget instanceof SizeableSpacer); |
28 |
|
- |
} |
29 |
|
- |
} |
30 |
|
- |
|
31 |
|
- |
public Widget getWidget() { |
32 |
|
- |
return mWidget; |
33 |
|
- |
} |
34 |
|
- |
|
35 |
|
- |
public boolean isSpacer() { |
36 |
|
- |
return mSpacer; |
37 |
|
- |
} |
38 |
|
- |
|
39 |
|
- |
public boolean isStretchableHorizontally() { |
40 |
|
- |
return mStretchableHorizontally; |
41 |
|
- |
} |
42 |
|
- |
|
43 |
|
- |
public boolean isFloodsX() { |
44 |
|
- |
return mFloodsX; |
45 |
|
- |
} |
46 |
|
- |
|
47 |
|
- |
public boolean hasHorizontalAlignment() { |
48 |
|
- |
return (mHorizontalAlignment != null); |
49 |
|
- |
} |
50 |
|
- |
|
51 |
|
- |
@Override |
52 |
|
- |
public HorizontalAlignmentConstant getHorizontalAlignment() { |
53 |
|
- |
return mHorizontalAlignment; |
54 |
|
- |
} |
55 |
|
- |
|
56 |
|
- |
@Override |
57 |
|
- |
public void setHorizontalAlignment( HorizontalAlignmentConstant align ) { |
58 |
|
- |
throw new UnsupportedOperationException( "HorizontalAlignment auto determined" ); |
59 |
|
- |
} |
60 |
|
- |
|
61 |
|
- |
public boolean isStretchableVertically() { |
62 |
|
- |
return mStretchableVertically; |
63 |
|
- |
} |
64 |
|
- |
|
65 |
|
- |
public boolean isFloodsY() { |
66 |
|
- |
return mFloodsY; |
67 |
|
- |
} |
68 |
|
- |
|
69 |
|
- |
public boolean hasVerticalAlignment() { |
70 |
|
- |
return (mVerticalAlignment != null); |
71 |
|
- |
} |
72 |
|
- |
|
73 |
|
- |
@Override |
74 |
|
- |
public VerticalAlignmentConstant getVerticalAlignment() { |
75 |
|
- |
return mVerticalAlignment; |
76 |
|
- |
} |
77 |
|
- |
|
78 |
|
- |
@Override |
79 |
|
- |
public void setVerticalAlignment( VerticalAlignmentConstant align ) { |
80 |
|
- |
throw new UnsupportedOperationException( "VerticalAlignment auto determined" ); |
81 |
|
- |
} |
82 |
|
- |
|
83 |
|
- |
public void center() { |
84 |
|
- |
if ( !isStretchableHorizontally() && !isFloodsX() && (mHorizontalAlignment == null) ) { |
85 |
|
- |
mHorizontalAlignment = ALIGN_CENTER; |
86 |
|
- |
} |
87 |
|
- |
if ( !isStretchableVertically() && !isFloodsY() && (mVerticalAlignment == null) ) { |
88 |
|
- |
mVerticalAlignment = ALIGN_MIDDLE; |
89 |
|
- |
} |
90 |
|
- |
} |
91 |
|
- |
} |
|
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 |
+ |
|
|
7 |
+ |
import com.google.gwt.user.client.ui.*; |
|
8 |
+ |
|
|
9 |
+ |
public class WidgetStruct implements HasAlignment { |
|
10 |
+ |
protected Widget mWidget; |
|
11 |
+ |
protected boolean mSpacer = false; |
|
12 |
+ |
|
|
13 |
+ |
protected boolean mStretchableHorizontally = false; |
|
14 |
+ |
protected boolean mFloodsX = false; |
|
15 |
+ |
protected HorizontalAlignmentConstant mHorizontalAlignment = null; |
|
16 |
+ |
|
|
17 |
+ |
protected boolean mStretchableVertically = false; |
|
18 |
+ |
protected boolean mFloodsY = false; |
|
19 |
+ |
protected VerticalAlignmentConstant mVerticalAlignment = null; |
|
20 |
+ |
|
|
21 |
+ |
public WidgetStruct( Widget pWidget ) { |
|
22 |
+ |
mWidget = pWidget; |
|
23 |
+ |
if ( pWidget instanceof ISizeableWidget ) { |
|
24 |
+ |
ISizeableWidget w = (ISizeableWidget) pWidget; |
|
25 |
+ |
mStretchableHorizontally = w.getWidthHelper().isStretchable(); |
|
26 |
+ |
mStretchableVertically = w.getHeightHelper().isStretchable(); |
|
27 |
+ |
mSpacer = (pWidget instanceof SizeableSpacer); |
|
28 |
+ |
} |
|
29 |
+ |
} |
|
30 |
+ |
|
|
31 |
+ |
public Widget getWidget() { |
|
32 |
+ |
return mWidget; |
|
33 |
+ |
} |
|
34 |
+ |
|
|
35 |
+ |
public boolean isSpacer() { |
|
36 |
+ |
return mSpacer; |
|
37 |
+ |
} |
|
38 |
+ |
|
|
39 |
+ |
public boolean isStretchableHorizontally() { |
|
40 |
+ |
return mStretchableHorizontally; |
|
41 |
+ |
} |
|
42 |
+ |
|
|
43 |
+ |
public boolean isFloodsX() { |
|
44 |
+ |
return mFloodsX; |
|
45 |
+ |
} |
|
46 |
+ |
|
|
47 |
+ |
public boolean hasHorizontalAlignment() { |
|
48 |
+ |
return (mHorizontalAlignment != null); |
|
49 |
+ |
} |
|
50 |
+ |
|
|
51 |
+ |
@Override |
|
52 |
+ |
public HorizontalAlignmentConstant getHorizontalAlignment() { |
|
53 |
+ |
return mHorizontalAlignment; |
|
54 |
+ |
} |
|
55 |
+ |
|
|
56 |
+ |
@Override |
|
57 |
+ |
public void setHorizontalAlignment( HorizontalAlignmentConstant align ) { |
|
58 |
+ |
throw new UnsupportedOperationException( "HorizontalAlignment auto determined" ); |
|
59 |
+ |
} |
|
60 |
+ |
|
|
61 |
+ |
public boolean isStretchableVertically() { |
|
62 |
+ |
return mStretchableVertically; |
|
63 |
+ |
} |
|
64 |
+ |
|
|
65 |
+ |
public boolean isFloodsY() { |
|
66 |
+ |
return mFloodsY; |
|
67 |
+ |
} |
|
68 |
+ |
|
|
69 |
+ |
public boolean hasVerticalAlignment() { |
|
70 |
+ |
return (mVerticalAlignment != null); |
|
71 |
+ |
} |
|
72 |
+ |
|
|
73 |
+ |
@Override |
|
74 |
+ |
public VerticalAlignmentConstant getVerticalAlignment() { |
|
75 |
+ |
return mVerticalAlignment; |
|
76 |
+ |
} |
|
77 |
+ |
|
|
78 |
+ |
@Override |
|
79 |
+ |
public void setVerticalAlignment( VerticalAlignmentConstant align ) { |
|
80 |
+ |
throw new UnsupportedOperationException( "VerticalAlignment auto determined" ); |
|
81 |
+ |
} |
|
82 |
+ |
|
|
83 |
+ |
public void center() { |
|
84 |
+ |
if ( !isStretchableHorizontally() && !isFloodsX() && (mHorizontalAlignment == null) ) { |
|
85 |
+ |
mHorizontalAlignment = ALIGN_CENTER; |
|
86 |
+ |
} |
|
87 |
+ |
if ( !isStretchableVertically() && !isFloodsY() && (mVerticalAlignment == null) ) { |
|
88 |
+ |
mVerticalAlignment = ALIGN_MIDDLE; |
|
89 |
+ |
} |
|
90 |
+ |
} |
|
91 |
+ |
} |