Search in sources :

Example 31 with Component

use of com.haulmont.cuba.gui.components.Component in project cuba by cuba-platform.

the class WebAbstractBox method addLayoutClickListener.

@Override
public void addLayoutClickListener(LayoutClickListener listener) {
    getEventRouter().addListener(LayoutClickListener.class, listener);
    if (layoutClickListener == null) {
        layoutClickListener = event -> {
            Component childComponent = findChildComponent(event.getChildComponent());
            MouseEventDetails mouseEventDetails = WebWrapperUtils.toMouseEventDetails(event);
            LayoutClickEvent layoutClickEvent = new LayoutClickEvent(this, childComponent, mouseEventDetails);
            getEventRouter().fireEvent(LayoutClickListener.class, LayoutClickListener::layoutClick, layoutClickEvent);
        };
        component.addLayoutClickListener(layoutClickListener);
    }
}
Also used : Component(com.haulmont.cuba.gui.components.Component)

Example 32 with Component

use of com.haulmont.cuba.gui.components.Component in project cuba by cuba-platform.

the class WebAbstractOrderedLayout method removeAll.

@Override
public void removeAll() {
    component.removeAllComponents();
    Component[] components = ownComponents.toArray(new Component[ownComponents.size()]);
    ownComponents.clear();
    for (Component childComponent : components) {
        childComponent.setParent(null);
    }
}
Also used : AbstractComponent(com.vaadin.ui.AbstractComponent) Component(com.haulmont.cuba.gui.components.Component)

Example 33 with Component

use of com.haulmont.cuba.gui.components.Component in project cuba by cuba-platform.

the class WebAbstractOrderedLayout method addLayoutClickListener.

@Override
public void addLayoutClickListener(LayoutClickListener listener) {
    getEventRouter().addListener(LayoutClickListener.class, listener);
    if (layoutClickListener == null) {
        layoutClickListener = event -> {
            Component childComponent = findChildComponent(this, event.getChildComponent());
            MouseEventDetails mouseEventDetails = WebWrapperUtils.toMouseEventDetails(event);
            LayoutClickEvent layoutClickEvent = new LayoutClickEvent(this, childComponent, mouseEventDetails);
            getEventRouter().fireEvent(LayoutClickListener.class, LayoutClickListener::layoutClick, layoutClickEvent);
        };
        component.addLayoutClickListener(layoutClickListener);
    }
}
Also used : AbstractComponent(com.vaadin.ui.AbstractComponent) Component(com.haulmont.cuba.gui.components.Component)

Example 34 with Component

use of com.haulmont.cuba.gui.components.Component in project cuba by cuba-platform.

the class WebAccordion method removeTab.

@Override
public void removeTab(String name) {
    final Tab tab = tabs.get(name);
    if (tab == null) {
        throw new IllegalStateException(String.format("Can't find tab '%s'", name));
    }
    tabs.remove(name);
    Component childComponent = tab.getComponent();
    com.vaadin.ui.Component vComponent = WebComponentsHelper.unwrap(childComponent);
    this.component.removeComponent(vComponent);
    tabMapping.remove(vComponent);
    childComponent.setParent(null);
}
Also used : Component(com.haulmont.cuba.gui.components.Component) AbstractComponent(com.vaadin.ui.AbstractComponent)

Example 35 with Component

use of com.haulmont.cuba.gui.components.Component in project cuba by cuba-platform.

the class WebAccordion method removeAllTabs.

@Override
public void removeAllTabs() {
    tabMapping.clear();
    component.removeAllComponents();
    List<Tab> currentTabs = new ArrayList<>(tabs.values());
    tabs.clear();
    for (Tab tab : currentTabs) {
        Component childComponent = tab.getComponent();
        childComponent.setParent(null);
    }
}
Also used : Component(com.haulmont.cuba.gui.components.Component) AbstractComponent(com.vaadin.ui.AbstractComponent)

Aggregations

Component (com.haulmont.cuba.gui.components.Component)78 CollectionDatasource (com.haulmont.cuba.gui.data.CollectionDatasource)10 Datasource (com.haulmont.cuba.gui.data.Datasource)10 User (com.haulmont.cuba.security.entity.User)9 List (java.util.List)9 GuiDevelopmentException (com.haulmont.cuba.gui.GuiDevelopmentException)8 ArrayList (java.util.ArrayList)8 UUID (java.util.UUID)8 LookupPickerField (com.haulmont.cuba.gui.components.LookupPickerField)7 Group (com.haulmont.cuba.security.entity.Group)7 Assert.assertEquals (org.junit.Assert.assertEquals)7 Assert.assertNotNull (org.junit.Assert.assertNotNull)7 Assert.assertTrue (org.junit.Assert.assertTrue)7 Ignore (org.junit.Ignore)7 Test (org.junit.Test)7 Element (org.dom4j.Element)6 ButtonTabComponent (com.haulmont.cuba.desktop.sys.ButtonTabComponent)5 AbstractAction (com.haulmont.cuba.gui.components.AbstractAction)5 Frame (com.haulmont.cuba.gui.components.Frame)4 AbstractComponent (com.vaadin.ui.AbstractComponent)4