Search in sources :

Example 76 with Component

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

the class TabSheetLoader method createComponent.

@Override
public void createComponent() {
    resultComponent = (TabSheet) factory.createComponent(TabSheet.NAME);
    loadId(resultComponent, element);
    // noinspection unchecked
    List<Element> tabElements = element.elements("tab");
    for (Element tabElement : tabElements) {
        final String name = tabElement.attributeValue("id");
        boolean lazy = Boolean.parseBoolean(tabElement.attributeValue("lazy"));
        ComponentLoader tabComponentLoader = getLoader(tabElement, TabComponentLoader.class);
        TabSheet.Tab tab;
        if (lazy) {
            tab = resultComponent.addLazyTab(name, tabElement, tabComponentLoader);
        } else {
            tabComponentLoader.createComponent();
            Component tabComponent = tabComponentLoader.getResultComponent();
            tab = resultComponent.addTab(name, tabComponent);
            pendingLoadComponents.add(tabComponentLoader);
        }
        pendingLoadTabs.put(tabElement, tab);
    }
}
Also used : TabSheet(com.haulmont.cuba.gui.components.TabSheet) Element(org.dom4j.Element) Component(com.haulmont.cuba.gui.components.Component) ComponentLoader(com.haulmont.cuba.gui.xml.layout.ComponentLoader)

Example 77 with Component

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

the class WebWindow method removeAll.

@Override
public void removeAll() {
    getContainer().removeAllComponents();
    for (Component childComponent : ownComponents) {
        if (childComponent.getId() != null) {
            allComponents.remove(childComponent.getId());
        }
    }
    Component[] childComponents = ownComponents.toArray(new Component[ownComponents.size()]);
    ownComponents.clear();
    for (Component ownComponent : childComponents) {
        ownComponent.setParent(null);
    }
}
Also used : WebAbstractComponent(com.haulmont.cuba.web.gui.components.WebAbstractComponent) Component(com.haulmont.cuba.gui.components.Component)

Example 78 with Component

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

the class ProductEdit method postInit.

@Override
protected void postInit() {
    super.postInit();
    Component box = componentsFactory.createComponent(VBoxLayout.class);
    Layout vBox = (Layout) WebComponentsHelper.unwrap(box);
    SliderServerComponent slider = new SliderServerComponent();
    slider.setValue(new double[] { getItem().getMinDiscount(), getItem().getMaxDiscount() });
    slider.setMinValue(0);
    slider.setMaxValue(100);
    slider.setWidth("240px");
    slider.setListener(newValue -> {
        getItem().setMinDiscount(newValue[0]);
        getItem().setMaxDiscount(newValue[1]);
    });
    vBox.addComponent(slider);
    fieldGroup.getFieldNN("slider").setComponent(box);
}
Also used : Layout(com.vaadin.ui.Layout) VBoxLayout(com.haulmont.cuba.gui.components.VBoxLayout) SliderServerComponent(com.company.jscomponent.web.toolkit.ui.slider.SliderServerComponent) Component(com.haulmont.cuba.gui.components.Component) SliderServerComponent(com.company.jscomponent.web.toolkit.ui.slider.SliderServerComponent)

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