Search in sources :

Example 1 with ImageContainer

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();
        }
    }
}
Also used : ComponentImage(ca.weblite.shared.components.ComponentImage) Form(com.codename1.ui.Form) ImageContainer(com.codename1.rad.ui.image.ImageContainer)

Example 2 with ImageContainer

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;
}
Also used : PropertySelector(com.codename1.rad.models.PropertySelector)

Example 3 with ImageContainer

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;
}
Also used : PropertySelector(com.codename1.rad.models.PropertySelector)

Aggregations

PropertySelector (com.codename1.rad.models.PropertySelector)2 ComponentImage (ca.weblite.shared.components.ComponentImage)1 ImageContainer (com.codename1.rad.ui.image.ImageContainer)1 Form (com.codename1.ui.Form)1