fix for images with null pElemRef
MODIFY
builder/src/main/java/builder/controller/CodeGenerator.java
builder/src/main/java/builder/controller/CodeGenerator.java
@@ -1309,22 +1309,52 @@ public class CodeGenerator {
// save page enum for our quick access code generation section
// quick access may be needed for progressbars, sliders, and text that is changed dynamically at runtime.
+ String ref = null;
for (PagePane p : pages) {
for (Widget w : p.getWidgets()) {
if (w.getType().equals(EnumFactory.TEXT)) {
- if (((TextModel)w.getModel()).getTextStorage() > 0) {
+ ref = ((TextModel)w.getModel()).getElementRef();
+ if (ref != null && !ref.isEmpty()) {
refList.add(w.getModel());
w.getModel().setPageEnum(p.getEnum());
}
- } else if (w.getType().equals(EnumFactory.PROGRESSBAR) ||
- w.getType().equals(EnumFactory.TEXTBOX) ||
- w.getType().equals(EnumFactory.GRAPH) ||
- w.getType().equals(EnumFactory.IMAGE) ||
- w.getType().equals(EnumFactory.IMAGEBUTTON) ||
- w.getType().equals(EnumFactory.SLIDER)) {
+ } else if (w.getType().equals(EnumFactory.PROGRESSBAR)) {
+ ref = ((ProgressBarModel)w.getModel()).getElementRef();
+ if (ref != null && !ref.isEmpty()) {
refList.add(w.getModel());
w.getModel().setPageEnum(p.getEnum());
}
+ } else if (w.getType().equals(EnumFactory.TEXTBOX)) {
+ ref = ((GraphModel)w.getModel()).getElementRef();
+ if (ref != null && !ref.isEmpty()) {
+ refList.add(w.getModel());
+ w.getModel().setPageEnum(p.getEnum());
+ }
+ } else if (w.getType().equals(EnumFactory.GRAPH)) {
+ ref = ((TextModel)w.getModel()).getElementRef();
+ if (ref != null && !ref.isEmpty()) {
+ refList.add(w.getModel());
+ w.getModel().setPageEnum(p.getEnum());
+ }
+ } else if (w.getType().equals(EnumFactory.IMAGE)) {
+ ref = ((ImageModel)w.getModel()).getElementRef();
+ if (ref != null && !ref.isEmpty()) {
+ refList.add(w.getModel());
+ w.getModel().setPageEnum(p.getEnum());
+ }
+ } else if (w.getType().equals(EnumFactory.IMAGEBUTTON)) {
+ ref = ((ImgButtonModel)w.getModel()).getElementRef();
+ if (ref != null && !ref.isEmpty()) {
+ refList.add(w.getModel());
+ w.getModel().setPageEnum(p.getEnum());
+ }
+ } else if (w.getType().equals(EnumFactory.SLIDER)) {
+ ref = ((SliderModel)w.getModel()).getElementRef();
+ if (ref != null && !ref.isEmpty()) {
+ refList.add(w.getModel());
+ w.getModel().setPageEnum(p.getEnum());
+ }
+ }
}
}
if (refList.size() > 0) {
@@ -1334,7 +1364,6 @@ public class CodeGenerator {
return one.getKey().compareTo(other.getKey());
}
});
- String ref = "";
for (WidgetModel m : refList) {
if (m.getType().equals(EnumFactory.TEXT)) {
ref = ((TextModel) m).getElementRef();

MODIFY
builder/src/main/java/builder/models/ImageModel.java
builder/src/main/java/builder/models/ImageModel.java
@@ -34,7 +34,6 @@ import java.io.ObjectOutputStream;
import javax.imageio.ImageIO;
-import builder.common.ColorFactory;
import builder.common.CommonUtil;
import builder.common.EnumFactory;
import builder.events.MsgBoard;

MODIFY
builder/src/main/java/builder/models/ImgButtonModel.java
builder/src/main/java/builder/models/ImgButtonModel.java
@@ -34,7 +34,6 @@ import java.io.ObjectOutputStream;
import javax.imageio.ImageIO;
-import builder.common.ColorFactory;
import builder.common.CommonUtil;
import builder.common.EnumFactory;
import builder.events.MsgBoard;

fix for images with null pElemRef