use of com.codename1.rad.ui.image.ImageContainer in project CodeRAD by shannah.
the class LabelEntityView method update.
@Override
public void update() {
boolean changed = false;
String text = "";
if (!getEntity().getEntity().isEmpty(nameProperty)) {
text = getEntity().getEntity().getText(nameProperty);
}
if (!Objects.equals(text, label.getText())) {
label.setText(text);
changed = true;
}
String iconVal = getEntity().getEntity().getText(iconProperty);
if (!Objects.equals(iconVal, lastIconVal)) {
lastIconVal = iconVal;
changed = true;
if (iconVal == null || iconWidth == 0 || iconHeight == 0) {
label.setIcon(null);
} else {
ImageContainer imgCnt = ImageContainer.createToFileSystem(getEntity(), iconProperty);
imgCnt.setUIID(label.getIconUIID());
imgCnt.setWidth(iconWidth);
imgCnt.setHeight(iconHeight);
imgCnt.setAspectRatio(iconWidth / (double) iconHeight);
imgCnt.layoutContainer();
ComponentImage cimg = new ComponentImage(imgCnt, iconWidth, iconHeight);
cimg.setAnimation(true);
label.setIcon(cimg);
}
}
if (changed) {
Form f = getComponentForm();
if (f != null) {
revalidateLater();
}
}
}
use of com.codename1.rad.ui.image.ImageContainer in project CodeRAD by shannah.
the class ImageContainer method createToFileSystem.
public static ImageContainer createToFileSystem(Entity entity, Property property, String filePath) {
ImageContainer out = new ImageContainer();
out.filePath = filePath;
out.useFileSystem = true;
out.property = new PropertySelector(entity, property);
return out;
}
use of com.codename1.rad.ui.image.ImageContainer in project CodeRAD by shannah.
the class ImageContainer method createToStorage.
public static ImageContainer createToStorage(Entity entity, Property property, String storageFile) {
ImageContainer out = new ImageContainer();
out.storageFile = storageFile;
out.useStorage = true;
out.property = new PropertySelector(entity, property);
return out;
}
Aggregations