Search in sources :

Example 1 with HintUIID

use of com.codename1.rad.attributes.HintUIID in project CodeRAD by shannah.

the class TextAreaPropertyView method update.

@Override
public void update() {
    super.update();
    String oldVal = getComponent().getText();
    String newVal = ContentType.convert(getProperty().getContentType(), getProperty().getValue(getEntity().getEntity()), ContentType.Text);
    TextFormatterAttribute formatter = (TextFormatterAttribute) getField().findAttribute(TextFormatterAttribute.class);
    if (formatter != null) {
        newVal = formatter.getValue().format(newVal);
    }
    if (!Objects.equals(oldVal, newVal)) {
        getComponent().setText(newVal);
    }
    HintUIID hintUiid = (HintUIID) getField().findAttribute(HintUIID.class);
    if (hintUiid != null) {
        Label hintLabel = getComponent().getHintLabel();
        if (hintLabel != null) {
            String oldUiid = hintLabel.getUIID();
            String newUiidStr = hintUiid.getValue(getEntity());
            if (newUiidStr != null && !Objects.equals(oldUiid, newUiidStr)) {
                hintLabel.setUIID(newUiidStr);
            }
        }
    }
}
Also used : HintUIID(com.codename1.rad.attributes.HintUIID) Label(com.codename1.ui.Label) TextFormatterAttribute(com.codename1.rad.models.TextFormatterAttribute)

Example 2 with HintUIID

use of com.codename1.rad.attributes.HintUIID in project CodeRAD by shannah.

the class TextFieldPropertyView method update.

@Override
public void update() {
    super.update();
    String oldVal = getComponent().getText();
    String newVal = ContentType.convert(getProperty().getContentType(), getProperty().getValue(getEntity().getEntity()), ContentType.Text);
    TextFormatterAttribute formatter = (TextFormatterAttribute) getField().findAttribute(TextFormatterAttribute.class);
    if (formatter != null) {
        newVal = formatter.getValue().format(newVal);
    }
    if (!Objects.equals(oldVal, newVal)) {
        getComponent().setText(newVal);
    }
    HintUIID hintUiid = (HintUIID) getField().findAttribute(HintUIID.class);
    if (hintUiid != null) {
        Label hintLabel = getComponent().getHintLabel();
        if (hintLabel != null) {
            String oldUiid = hintLabel.getUIID();
            String newUiidStr = hintUiid.getValue(getEntity());
            if (newUiidStr != null && !Objects.equals(oldUiid, newUiidStr)) {
                hintLabel.setUIID(newUiidStr);
            }
        }
    }
}
Also used : HintUIID(com.codename1.rad.attributes.HintUIID) Label(com.codename1.ui.Label) TextFormatterAttribute(com.codename1.rad.models.TextFormatterAttribute)

Aggregations

HintUIID (com.codename1.rad.attributes.HintUIID)2 TextFormatterAttribute (com.codename1.rad.models.TextFormatterAttribute)2 Label (com.codename1.ui.Label)2