|
@@ -1,45 +1,45 @@ |
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.forms.client.components.factories.*; |
6 |
|
- |
import org.litesoft.GWT.forms.client.nonpublic.*; |
7 |
|
- |
import org.litesoft.ui.def.*; |
8 |
|
- |
import org.litesoft.ui.def.nonpublic.*; |
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 class UiImageWidgetFactory implements FormComponentFactory { |
15 |
|
- |
public Widget create( FormInstanceComponentHandler pComponentHandler, UiDef pUiDef, |
16 |
|
- |
FormMetaData pFormMetaData, boolean pHasHorizontalPeer ) { |
17 |
|
- |
UiImageDef zDef = (UiImageDef) pUiDef; |
18 |
|
- |
String imageID = zDef.getImageID(); |
19 |
|
- |
if ( !imageID.startsWith( "http://" ) && !imageID.startsWith( "https://" ) ) { |
20 |
|
- |
imageID = "formImages" + (imageID.startsWith( "/" ) ? imageID : "/" + imageID); |
21 |
|
- |
} |
22 |
|
- |
Widget zRV; |
23 |
|
- |
Integer zWidth = zDef.getWidth(); |
24 |
|
- |
Integer zHeight = zDef.getHeight(); |
25 |
|
- |
if ( (zWidth == null) || (zHeight == null) ) { |
26 |
|
- |
SizeableImage rv = new SizeableImage( imageID ); |
27 |
|
- |
if ( FloodX.YES.equals( zDef.getFloodX() ) ) { |
28 |
|
- |
rv.stretchableHorizontally(); |
29 |
|
- |
} |
30 |
|
- |
if ( FloodY.YES.equals( zDef.getFloodY() ) ) { |
31 |
|
- |
rv.stretchableVertically(); |
32 |
|
- |
} |
33 |
|
- |
zRV = rv; |
34 |
|
- |
} else { |
35 |
|
- |
zRV = new OurImage( imageID ); |
36 |
|
- |
} |
37 |
|
- |
if ( zWidth != null ) { |
38 |
|
- |
zRV.setWidth( zWidth.toString() ); |
39 |
|
- |
} |
40 |
|
- |
if ( zHeight != null ) { |
41 |
|
- |
zRV.setHeight( zHeight.toString() ); |
42 |
|
- |
} |
43 |
|
- |
return zRV; |
44 |
|
- |
} |
45 |
|
- |
} |
|
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.forms.client.components.factories.*; |
|
6 |
+ |
import org.litesoft.GWT.forms.client.nonpublic.*; |
|
7 |
+ |
import org.litesoft.ui.def.*; |
|
8 |
+ |
import org.litesoft.ui.def.nonpublic.*; |
|
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 class UiImageWidgetFactory implements FormComponentFactory { |
|
15 |
+ |
public Widget create( FormInstanceComponentHandler pComponentHandler, UiDef pUiDef, |
|
16 |
+ |
FormMetaData pFormMetaData, boolean pHasHorizontalPeer ) { |
|
17 |
+ |
UiImageDef zDef = (UiImageDef) pUiDef; |
|
18 |
+ |
String imageID = zDef.getImageID(); |
|
19 |
+ |
if ( !imageID.startsWith( "http://" ) && !imageID.startsWith( "https://" ) ) { |
|
20 |
+ |
imageID = "formImages" + (imageID.startsWith( "/" ) ? imageID : "/" + imageID); |
|
21 |
+ |
} |
|
22 |
+ |
Widget zRV; |
|
23 |
+ |
Integer zWidth = zDef.getWidth(); |
|
24 |
+ |
Integer zHeight = zDef.getHeight(); |
|
25 |
+ |
if ( (zWidth == null) || (zHeight == null) ) { |
|
26 |
+ |
SizeableImage rv = new SizeableImage( imageID ); |
|
27 |
+ |
if ( FloodX.YES.equals( zDef.getFloodX() ) ) { |
|
28 |
+ |
rv.stretchableHorizontally(); |
|
29 |
+ |
} |
|
30 |
+ |
if ( FloodY.YES.equals( zDef.getFloodY() ) ) { |
|
31 |
+ |
rv.stretchableVertically(); |
|
32 |
+ |
} |
|
33 |
+ |
zRV = rv; |
|
34 |
+ |
} else { |
|
35 |
+ |
zRV = new OurImage( imageID ); |
|
36 |
+ |
} |
|
37 |
+ |
if ( zWidth != null ) { |
|
38 |
+ |
zRV.setWidth( zWidth.toString() ); |
|
39 |
+ |
} |
|
40 |
+ |
if ( zHeight != null ) { |
|
41 |
+ |
zRV.setHeight( zHeight.toString() ); |
|
42 |
+ |
} |
|
43 |
+ |
return zRV; |
|
44 |
+ |
} |
|
45 |
+ |
} |