Search in sources :

Example 51 with Component

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

the class DesktopWindowManager method showFrame.

@Override
protected void showFrame(Component parent, Frame frame) {
    // the same as web window manager does
    if (parent instanceof Component.Container) {
        Component.Container container = (Component.Container) parent;
        for (Component c : container.getComponents()) {
            if (c instanceof Component.Disposable) {
                Component.Disposable disposable = (Component.Disposable) c;
                if (!disposable.isDisposed()) {
                    disposable.dispose();
                }
            }
            container.remove(c);
        }
        container.add(frame);
    } else {
        throw new IllegalStateException("Parent component must be com.haulmont.cuba.gui.components.Component.Container");
    }
}
Also used : DesktopAbstractComponent(com.haulmont.cuba.desktop.gui.components.DesktopAbstractComponent) Component(com.haulmont.cuba.gui.components.Component)

Example 52 with Component

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

the class DesktopScrollBoxLayout method removeAll.

@Override
public void removeAll() {
    content.removeAll();
    List<Component> innerComponents = new ArrayList<>(components);
    components.clear();
    for (Component component : innerComponents) {
        if (component instanceof DesktopAbstractComponent && !isEnabledWithParent()) {
            ((DesktopAbstractComponent) component).setParentEnabled(true);
        }
        component.setParent(null);
    }
    adjustViewPreferredSize();
}
Also used : ArrayList(java.util.ArrayList) Component(com.haulmont.cuba.gui.components.Component)

Example 53 with Component

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

the class DesktopSplitPanel method removeAll.

@Override
public void removeAll() {
    impl.removeAll();
    componentByIds.clear();
    List<Component> components = new ArrayList<>(ownComponents);
    ownComponents.clear();
    for (Component component : components) {
        if (component instanceof DesktopAbstractComponent && !isEnabledWithParent()) {
            ((DesktopAbstractComponent) component).setParentEnabled(true);
        }
        component.setParent(null);
    }
}
Also used : Component(com.haulmont.cuba.gui.components.Component)

Example 54 with Component

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

the class DesktopSplitPanel method updateEnabled.

@Override
public void updateEnabled() {
    super.updateEnabled();
    boolean resultEnabled = isEnabledWithParent();
    for (Component component : ownComponents) {
        if (component instanceof DesktopAbstractComponent) {
            ((DesktopAbstractComponent) component).setParentEnabled(resultEnabled);
        }
    }
}
Also used : Component(com.haulmont.cuba.gui.components.Component)

Example 55 with Component

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

the class DesktopWindow method validateAll.

@Override
public boolean validateAll() {
    ValidationErrors errors = new ValidationErrors();
    Collection<Component> components = ComponentsHelper.getComponents(this);
    for (Component component : components) {
        if (component instanceof Validatable) {
            Validatable validatable = (Validatable) component;
            if (validatable.isValidateOnCommit()) {
                try {
                    validatable.validate();
                } catch (ValidationException e) {
                    if (log.isTraceEnabled())
                        log.trace("Validation failed", e);
                    else if (log.isDebugEnabled())
                        log.debug("Validation failed: " + e);
                    ComponentsHelper.fillErrorMessages(validatable, e, errors);
                }
            }
        }
    }
    validateAdditionalRules(errors);
    return handleValidationErrors(errors);
}
Also used : Component(com.haulmont.cuba.gui.components.Component) JTextComponent(javax.swing.text.JTextComponent)

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