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);
}
}
}
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;
}
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();
}
}
}
}
Aggregations