Search in sources :

Example 1 with ComponentContainer

use of com.vaadin.ui.ComponentContainer in project cuba by cuba-platform.

the class WebRelatedEntities method refreshNavigationActions.

protected void refreshNavigationActions() {
    ComponentContainer actionContainer = (ComponentContainer) vPopupComponent;
    actionContainer.removeAllComponents();
    actionOrder.clear();
    if (listComponent != null) {
        MetaClass metaClass = listComponent.getDatasource().getMetaClass();
        Pattern excludePattern = null;
        if (excludeRegex != null) {
            excludePattern = Pattern.compile(excludeRegex);
        }
        for (MetaProperty metaProperty : metaClass.getProperties()) {
            if (RelatedEntitiesSecurity.isSuitableProperty(metaProperty, metaClass) && (excludePattern == null || !excludePattern.matcher(metaProperty.getName()).matches())) {
                addNavigationAction(metaClass, metaProperty);
            }
        }
        if (actionContainer.getComponentCount() == 0) {
            Messages messages = AppBeans.get(Messages.NAME);
            actionContainer.addComponent(new Label(messages.getMainMessage("actions.Related.Empty")));
        }
    }
}
Also used : Pattern(java.util.regex.Pattern) Messages(com.haulmont.cuba.core.global.Messages) MetaClass(com.haulmont.chile.core.model.MetaClass) ComponentContainer(com.vaadin.ui.ComponentContainer) Label(com.vaadin.ui.Label) MetaProperty(com.haulmont.chile.core.model.MetaProperty)

Example 2 with ComponentContainer

use of com.vaadin.ui.ComponentContainer in project linkki by linkki-framework.

the class BindingContext method removeBindingsForComponent.

/**
 * Removes all bindings in this context that refer to the given component. If the component is a
 * container component, all bindings for the components children and their children are removed,
 * too.
 */
public void removeBindingsForComponent(Component c) {
    elementBindings.remove(c);
    tableBindings.remove(c);
    if (c instanceof ComponentContainer) {
        ComponentContainer container = (ComponentContainer) c;
        container.iterator().forEachRemaining(this::removeBindingsForComponent);
    }
}
Also used : ComponentContainer(com.vaadin.ui.ComponentContainer)

Aggregations

ComponentContainer (com.vaadin.ui.ComponentContainer)2 MetaClass (com.haulmont.chile.core.model.MetaClass)1 MetaProperty (com.haulmont.chile.core.model.MetaProperty)1 Messages (com.haulmont.cuba.core.global.Messages)1 Label (com.vaadin.ui.Label)1 Pattern (java.util.regex.Pattern)1