Search in sources :

Example 56 with Component

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

the class DesktopWindow method removeAll.

@Override
public void removeAll() {
    wrappers.clear();
    getContainer().removeAll();
    componentByIds.clear();
    captions.clear();
    List<Component> components = new ArrayList<>(ownComponents);
    ownComponents.clear();
    for (Component component : components) {
        if (component instanceof DesktopAbstractComponent && !isEnabled()) {
            ((DesktopAbstractComponent) component).setParentEnabled(true);
        }
        if (expandedComponent == component) {
            expandedComponent = null;
        }
        component.setParent(null);
        DesktopContainerHelper.assignContainer(component, null);
    }
    requestRepaint();
}
Also used : Component(com.haulmont.cuba.gui.components.Component) JTextComponent(javax.swing.text.JTextComponent)

Example 57 with Component

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

the class DesktopAbstractBox 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 58 with Component

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

the class DesktopAbstractBox method removeAll.

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

Example 59 with Component

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

the class UserSwitchLinkHandlerProcessor method substituteUserAndOpenWindow.

protected void substituteUserAndOpenWindow(ExternalLinkContext linkContext, UUID userId) {
    App app = linkContext.getApp();
    UserSession userSession = app.getConnection().getSession();
    assert userSession != null;
    final User substitutedUser = loadUser(userId, userSession.getUser());
    if (substitutedUser != null) {
        app.getWindowManager().showOptionDialog(messages.getMainMessage("toSubstitutedUser.title"), getDialogMessage(substitutedUser), Frame.MessageType.CONFIRMATION_HTML, new Action[] { new ChangeSubstUserAction(substitutedUser) {

            @Override
            public void doAfterChangeUser() {
                super.doAfterChangeUser();
                screenHandler.handle(linkContext);
            }

            @Override
            public void doRevert() {
                super.doRevert();
                JavaScript js = Page.getCurrent().getJavaScript();
                js.execute("window.close();");
            }

            @Override
            public String getCaption() {
                return messages.getMainMessage("action.switch");
            }
        }, new DoNotChangeSubstUserAction() {

            @Override
            public void actionPerform(Component component) {
                super.actionPerform(component);
                JavaScript js = Page.getCurrent().getJavaScript();
                js.execute("window.close();");
            }

            @Override
            public String getCaption() {
                return messages.getMainMessage("action.cancel");
            }
        } });
    } else {
        User user = loadUser(userId);
        app.getWindowManager().showOptionDialog(messages.getMainMessage("warning.title"), getWarningMessage(user), Frame.MessageType.WARNING_HTML, new Action[] { new DialogAction(DialogAction.Type.OK).withHandler(event -> {
            JavaScript js = Page.getCurrent().getJavaScript();
            js.execute("window.close();");
        }) });
    }
}
Also used : App(com.haulmont.cuba.web.App) LoadContext(com.haulmont.cuba.core.global.LoadContext) Frame(com.haulmont.cuba.gui.components.Frame) JavaScript(com.vaadin.ui.JavaScript) Ordered(org.springframework.core.Ordered) StringUtils(org.apache.commons.lang.StringUtils) Logger(org.slf4j.Logger) Resource(javax.annotation.Resource) DoNotChangeSubstUserAction(com.haulmont.cuba.web.actions.DoNotChangeSubstUserAction) App(com.haulmont.cuba.web.App) Messages(com.haulmont.cuba.core.global.Messages) UUID(java.util.UUID) User(com.haulmont.cuba.security.entity.User) UserSession(com.haulmont.cuba.security.global.UserSession) Inject(javax.inject.Inject) List(java.util.List) Page(com.vaadin.server.Page) TimeSource(com.haulmont.cuba.core.global.TimeSource) DialogAction(com.haulmont.cuba.gui.components.DialogAction) UserSubstitution(com.haulmont.cuba.security.entity.UserSubstitution) ChangeSubstUserAction(com.haulmont.cuba.web.actions.ChangeSubstUserAction) Component(com.haulmont.cuba.gui.components.Component) DataService(com.haulmont.cuba.core.app.DataService) Action(com.haulmont.cuba.gui.components.Action) DoNotChangeSubstUserAction(com.haulmont.cuba.web.actions.DoNotChangeSubstUserAction) ChangeSubstUserAction(com.haulmont.cuba.web.actions.ChangeSubstUserAction) User(com.haulmont.cuba.security.entity.User) DialogAction(com.haulmont.cuba.gui.components.DialogAction) UserSession(com.haulmont.cuba.security.global.UserSession) JavaScript(com.vaadin.ui.JavaScript) DoNotChangeSubstUserAction(com.haulmont.cuba.web.actions.DoNotChangeSubstUserAction) Component(com.haulmont.cuba.gui.components.Component)

Example 60 with Component

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

the class WebScrollBoxLayout method removeAll.

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

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