Search in sources :

Example 61 with CheckBox

use of com.vaadin.v7.ui.CheckBox in project opencms-core by alkacon.

the class CmsCategoryTree method setSelectedCategories.

/**
 * Sets the selected categories.<p>
 *
 * @param categories the categories to select
 */
public void setSelectedCategories(Collection<CmsCategory> categories) {
    for (Entry<CmsCategory, CheckBox> entry : m_checkboxes.entrySet()) {
        entry.getValue().setValue(Boolean.valueOf(categories.contains(entry.getKey())));
        CmsCategory parentCat = (CmsCategory) getParent(entry.getKey());
        if (parentCat != null) {
            setCollapsed(parentCat, false);
        }
    }
}
Also used : CheckBox(com.vaadin.v7.ui.CheckBox) CmsCategory(org.opencms.relations.CmsCategory)

Example 62 with CheckBox

use of com.vaadin.v7.ui.CheckBox in project opencms-core by alkacon.

the class CmsEditSiteForm method createAliasComponent.

/**
 * Creates field for aliases.<p>
 *
 * @param alias url
 * @param red redirect
 * @return component
 */
protected FormLayout createAliasComponent(String alias, boolean red) {
    FormLayout layout = new FormLayout();
    TextField field = new TextField(CmsVaadinUtils.getMessageText(Messages.GUI_SITE_ALIAS_0));
    field.setWidth("100%");
    field.setValue(alias);
    field.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_SITE_ALIAS_HELP_0));
    CheckBox redirect = new CheckBox(CmsVaadinUtils.getMessageText(Messages.GUI_SITE_ALIAS_REDIRECT_0), red);
    redirect.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_SITE_ALIAS_REDIRECT_HELP_0));
    layout.addComponent(field);
    layout.addComponent(redirect);
    return layout;
}
Also used : FormLayout(com.vaadin.ui.FormLayout) CheckBox(com.vaadin.v7.ui.CheckBox) TextField(com.vaadin.v7.ui.TextField)

Example 63 with CheckBox

use of com.vaadin.v7.ui.CheckBox in project CodeRAD by shannah.

the class DefaultActionViewFactory method update.

public static void update(Button btn, Entity entity, ActionNode action) {
    boolean repaint = false;
    boolean revalidate = false;
    Condition cond = action.getCondition();
    if (cond != null) {
        boolean hidden = !cond.getValue().test(entity);
        if (hidden != btn.isHidden()) {
            btn.setHidden(hidden);
            btn.setVisible(!hidden);
            revalidate = true;
        }
    }
    EnabledCondition enabledCond = action.getEnabledCondition();
    if (enabledCond != null) {
        boolean enabled = enabledCond.getValue().test(entity);
        if (enabled != btn.isEnabled()) {
            btn.setEnabled(enabled);
            repaint = true;
        }
    }
    if (action.getLabel() != null) {
        String currTextVal = btn.getText();
        String newTextVal = action.getLabelText(entity);
        if (!Objects.equals(currTextVal, newTextVal)) {
            btn.setText(newTextVal);
            repaint = true;
        }
    }
    if (!action.isTextStyle() && !"".equals(btn.getText().trim())) {
        btn.setText("");
        repaint = true;
    }
    if (action.getUIID() != null) {
        String currUiid = btn.getUIID();
        String newUiid = action.getUIID(entity, "Button");
        if (!Objects.equals(currUiid, newUiid)) {
            btn.setUIID(newUiid);
            repaint = true;
        }
    }
    if (btn instanceof CheckBox) {
        SelectedCondition selectedCond = action.getSelectedCondition();
        if (selectedCond != null) {
            boolean selected = selectedCond.getValue().test(entity);
            if (selected != btn.isSelected()) {
                ((CheckBox) btn).setSelected(selected);
                repaint = true;
                ActionNode newState = selected ? action.getSelected() : action.getUnselected();
                ActionNode oldState = selected ? action.getUnselected() : action.getSelected();
                if (oldState != newState) {
                    String currText = btn.getText();
                    String newText = newState.getLabelText(entity);
                    if (!newState.isTextStyle()) {
                        newText = "";
                    }
                    if (!Objects.equals(newText, currText)) {
                        btn.setText(newText);
                    }
                }
            }
        }
    }
    Badge badge = action.getBadge();
    if (badge != null) {
        btn.setBadgeText(badge.getValue(entity));
        BadgeUIID badgeUiid = action.getBadgeUIID();
        if (badgeUiid != null) {
            btn.setBadgeUIID(badgeUiid.getValue());
        }
    }
    if (revalidate || repaint) {
        Form f = btn.getComponentForm();
        if (f != null) {
            if (revalidate) {
                Component entityView = findEntityViewParent(btn);
                if (entityView instanceof Container) {
                    ((Container) entityView).revalidateLater();
                } else {
                    entityView.repaint();
                }
            } else {
                btn.repaint();
            }
        }
    }
}
Also used : EnabledCondition(com.codename1.rad.nodes.ActionNode.EnabledCondition) Condition(com.codename1.rad.attributes.Condition) SelectedCondition(com.codename1.rad.attributes.SelectedCondition) SelectedCondition(com.codename1.rad.attributes.SelectedCondition) Container(com.codename1.ui.Container) Form(com.codename1.ui.Form) CheckBox(com.codename1.ui.CheckBox) EnabledCondition(com.codename1.rad.nodes.ActionNode.EnabledCondition) ActionNode(com.codename1.rad.nodes.ActionNode) Badge(com.codename1.rad.attributes.Badge) Component(com.codename1.ui.Component) BadgeUIID(com.codename1.rad.attributes.BadgeUIID)

Aggregations

CheckBox (com.vaadin.v7.ui.CheckBox)40 CheckBox (com.codename1.ui.CheckBox)18 Label (com.vaadin.ui.Label)15 ComboBox (com.vaadin.v7.ui.ComboBox)14 Button (com.codename1.ui.Button)12 TextField (com.vaadin.v7.ui.TextField)12 I18nProperties (de.symeda.sormas.api.i18n.I18nProperties)12 Form (com.codename1.ui.Form)11 Disease (de.symeda.sormas.api.Disease)11 Captions (de.symeda.sormas.api.i18n.Captions)11 DistrictReferenceDto (de.symeda.sormas.api.infrastructure.district.DistrictReferenceDto)11 NullableOptionGroup (de.symeda.sormas.ui.utils.NullableOptionGroup)11 List (java.util.List)11 Container (com.codename1.ui.Container)10 FacadeProvider (de.symeda.sormas.api.FacadeProvider)10 Strings (de.symeda.sormas.api.i18n.Strings)10 Label (com.codename1.ui.Label)9 TextField (com.codename1.ui.TextField)9 HorizontalLayout (com.vaadin.ui.HorizontalLayout)9 AbstractEditForm (de.symeda.sormas.ui.utils.AbstractEditForm)9