|
@@ -1,46 +1,46 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.forms.client.components.factories.others; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.GWT.client.widgets.*; |
5 |
|
- |
import org.litesoft.GWT.client.widgets.nonpublic.*; |
6 |
|
- |
import org.litesoft.GWT.forms.client.components.nonpublic.*; |
7 |
|
- |
import org.litesoft.GWT.forms.client.nonpublic.*; |
8 |
|
- |
import org.litesoft.ui.def.*; |
9 |
|
- |
import org.litesoft.ui.def.nonpublic.support.*; |
10 |
|
- |
import org.litesoft.uispecification.*; |
11 |
|
- |
|
12 |
|
- |
import com.google.gwt.user.client.ui.*; |
13 |
|
- |
|
14 |
|
- |
public abstract class AbstractSingleLayoutWidgetFactory extends AbstractLayoutWidgetFactory { |
15 |
|
- |
public Widget createContainerWidget( FormInstanceComponentHandler pComponentHandler, UiDef pUiDef, |
16 |
|
- |
FormMetaData pFormMetaData, DefWidgetStruct[] pChildDefWidgets ) { |
17 |
|
- |
UiSingleCellLayoutDef zLayoutDef = (UiSingleCellLayoutDef) pUiDef; |
18 |
|
- |
AbstractSizeableSimplePanel panel = createPanel( pFormMetaData, zLayoutDef ); |
19 |
|
- |
boolean anyStretchableHorizontally = false; |
20 |
|
- |
boolean anyStretchableVertically = false; |
21 |
|
- |
for ( int i = 0; i < pChildDefWidgets.length; i++ ) { |
22 |
|
- |
DefWidgetStruct zDefWidget = pChildDefWidgets[i]; |
23 |
|
- |
anyStretchableHorizontally |= zDefWidget.isStretchableHorizontally(); |
24 |
|
- |
anyStretchableVertically |= zDefWidget.isStretchableVertically(); |
25 |
|
- |
panel.add( zDefWidget.getWidget() ); |
26 |
|
- |
} |
27 |
|
- |
return addStretchabilityAndStyle( panel, zLayoutDef, anyStretchableHorizontally, |
28 |
|
- |
anyStretchableVertically ); |
29 |
|
- |
} |
30 |
|
- |
|
31 |
|
- |
private AbstractSizeableSimplePanel createPanel( FormMetaData pFormMetaData, |
32 |
|
- |
UiSingleCellLayoutDef pUiDef ) { |
33 |
|
- |
Overflow zOverflowPolicy = pUiDef.getOverflowPolicy(); |
34 |
|
- |
boolean zOverflow = !Overflow.Scrolled.equals( zOverflowPolicy ); // todo: replace with 3 options |
35 |
|
- |
String zExtTitle = pUiDef.getExtTitle(); |
36 |
|
- |
if ( zExtTitle != null ) { |
37 |
|
- |
LabelMetaData md = pFormMetaData.getLabel( pUiDef ); |
38 |
|
- |
String zTitle = md.getExternalText(); |
39 |
|
- |
return new SizeableTitledBorderedSimplePanel( zOverflow, zTitle ); |
40 |
|
- |
} |
41 |
|
- |
if ( pUiDef.isBordered() ) { |
42 |
|
- |
return new SizeableBorderedSimplePanel( zOverflow ); |
43 |
|
- |
} |
44 |
|
- |
return new SizeableSimplePanel( zOverflow ); |
45 |
|
- |
} |
46 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.forms.client.components.factories.others; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.GWT.client.widgets.*; |
|
5 |
+ |
import org.litesoft.GWT.client.widgets.nonpublic.*; |
|
6 |
+ |
import org.litesoft.GWT.forms.client.components.nonpublic.*; |
|
7 |
+ |
import org.litesoft.GWT.forms.client.nonpublic.*; |
|
8 |
+ |
import org.litesoft.ui.def.*; |
|
9 |
+ |
import org.litesoft.ui.def.nonpublic.support.*; |
|
10 |
+ |
import org.litesoft.uispecification.*; |
|
11 |
+ |
|
|
12 |
+ |
import com.google.gwt.user.client.ui.*; |
|
13 |
+ |
|
|
14 |
+ |
public abstract class AbstractSingleLayoutWidgetFactory extends AbstractLayoutWidgetFactory { |
|
15 |
+ |
public Widget createContainerWidget( FormInstanceComponentHandler pComponentHandler, UiDef pUiDef, |
|
16 |
+ |
FormMetaData pFormMetaData, DefWidgetStruct[] pChildDefWidgets ) { |
|
17 |
+ |
UiSingleCellLayoutDef zLayoutDef = (UiSingleCellLayoutDef) pUiDef; |
|
18 |
+ |
AbstractSizeableSimplePanel panel = createPanel( pFormMetaData, zLayoutDef ); |
|
19 |
+ |
boolean anyStretchableHorizontally = false; |
|
20 |
+ |
boolean anyStretchableVertically = false; |
|
21 |
+ |
for ( int i = 0; i < pChildDefWidgets.length; i++ ) { |
|
22 |
+ |
DefWidgetStruct zDefWidget = pChildDefWidgets[i]; |
|
23 |
+ |
anyStretchableHorizontally |= zDefWidget.isStretchableHorizontally(); |
|
24 |
+ |
anyStretchableVertically |= zDefWidget.isStretchableVertically(); |
|
25 |
+ |
panel.add( zDefWidget.getWidget() ); |
|
26 |
+ |
} |
|
27 |
+ |
return addStretchabilityAndStyle( panel, zLayoutDef, anyStretchableHorizontally, |
|
28 |
+ |
anyStretchableVertically ); |
|
29 |
+ |
} |
|
30 |
+ |
|
|
31 |
+ |
private AbstractSizeableSimplePanel createPanel( FormMetaData pFormMetaData, |
|
32 |
+ |
UiSingleCellLayoutDef pUiDef ) { |
|
33 |
+ |
Overflow zOverflowPolicy = pUiDef.getOverflowPolicy(); |
|
34 |
+ |
boolean zOverflow = !Overflow.Scrolled.equals( zOverflowPolicy ); // todo: replace with 3 options |
|
35 |
+ |
String zExtTitle = pUiDef.getExtTitle(); |
|
36 |
+ |
if ( zExtTitle != null ) { |
|
37 |
+ |
LabelMetaData md = pFormMetaData.getLabel( pUiDef ); |
|
38 |
+ |
String zTitle = md.getExternalText(); |
|
39 |
+ |
return new SizeableTitledBorderedSimplePanel( zOverflow, zTitle ); |
|
40 |
+ |
} |
|
41 |
+ |
if ( pUiDef.isBordered() ) { |
|
42 |
+ |
return new SizeableBorderedSimplePanel( zOverflow ); |
|
43 |
+ |
} |
|
44 |
+ |
return new SizeableSimplePanel( zOverflow ); |
|
45 |
+ |
} |
|
46 |
+ |
} |