Search in sources :

Example 1 with ViewChangeEvent

use of com.vaadin.navigator.ViewChangeListener.ViewChangeEvent in project opencms-core by alkacon.

the class CmsSitemapEditorConfiguration method openSitemapEditor.

/**
 * Opens the sitemap editor for the current site.<p>
 */
void openSitemapEditor() {
    CmsObject cms = A_CmsUI.getCmsObject();
    String siteRoot = cms.getRequestContext().getSiteRoot();
    if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(siteRoot)) {
        String path = getPath(cms, A_CmsUI.get().getHttpSession());
        if (path != null) {
            try {
                CmsAppWorkplaceUi ui = CmsAppWorkplaceUi.get();
                if (ui.beforeViewChange(new ViewChangeEvent(ui.getNavigator(), ui.getCurrentView(), null, APP_ID, null))) {
                    CmsResource res = cms.readResource(CmsADEManager.PATH_SITEMAP_EDITOR_JSP);
                    String link = OpenCms.getLinkManager().substituteLink(cms, res);
                    A_CmsUI.get().getPage().setLocation(link + "?path=" + path);
                }
                return;
            } catch (CmsException e) {
                LOG.debug("Unable to open sitemap editor.", e);
            }
        }
    }
    Notification.show(CmsVaadinUtils.getMessageText(Messages.GUI_SITEMAP_NOT_AVAILABLE_0), Type.WARNING_MESSAGE);
}
Also used : CmsObject(org.opencms.file.CmsObject) ViewChangeEvent(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent) CmsResource(org.opencms.file.CmsResource) CmsException(org.opencms.main.CmsException)

Example 2 with ViewChangeEvent

use of com.vaadin.navigator.ViewChangeListener.ViewChangeEvent in project unity by unity-idm.

the class CredentialRequirementsView method enter.

@Override
public void enter(ViewChangeEvent event) {
    HorizontalLayout buttonsBar = StandardButtonsHelper.buildTopButtonsBar(StandardButtonsHelper.build4AddAction(msg, e -> NavigationHelper.goToView(NewCredentialRequirementsView.VIEW_NAME)));
    credList = new GridWithActionColumn<>(msg, getActionsHandlers(), false);
    credList.addComponentColumn(c -> {
        if (!c.isReadOnly()) {
            return StandardButtonsHelper.buildLinkButton(c.getName(), e -> gotoEdit(c));
        } else {
            return new Label(c.getName());
        }
    }, msg.getMessage("CredentialReqView.nameCaption"), 5).setSortable(true).setComparator((cr1, cr2) -> {
        return cr1.getName().compareTo(cr2.getName());
    }).setId("name");
    credList.addSortableColumn(c -> String.join(", ", c.getRequiredCredentials()), msg.getMessage("CredentialReqView.credentialsCaption"), 10);
    credList.addSortableColumn(c -> c.getDescription(), msg.getMessage("CredentialReqView.descriptionCaption"), 10);
    credList.setItems(getCredentials());
    credList.sort("name");
    VerticalLayout main = new VerticalLayout();
    main.addComponent(buttonsBar);
    main.addComponent(credList);
    main.setWidth(100, Unit.PERCENTAGE);
    main.setMargin(false);
    setCompositionRoot(main);
}
Also used : Arrays(java.util.Arrays) CustomComponent(com.vaadin.ui.CustomComponent) AuthenticationNavigationInfoProvider(io.imunity.webconsole.authentication.AuthenticationNavigationInfoProvider) PrototypeComponent(pl.edu.icm.unity.engine.api.utils.PrototypeComponent) VerticalLayout(com.vaadin.ui.VerticalLayout) Type(io.imunity.webelements.navigation.NavigationInfo.Type) EventsBus(pl.edu.icm.unity.webui.bus.EventsBus) Autowired(org.springframework.beans.factory.annotation.Autowired) Label(com.vaadin.ui.Label) ViewChangeEvent(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent) WebConsoleNavigationInfoProviderBase(io.imunity.webconsole.WebConsoleNavigationInfoProviderBase) CredentialRequirements(pl.edu.icm.unity.types.authn.CredentialRequirements) GridWithActionColumn(pl.edu.icm.unity.webui.common.GridWithActionColumn) UnityView(io.imunity.webelements.navigation.UnityView) NavigationInfo(io.imunity.webelements.navigation.NavigationInfo) MessageSource(pl.edu.icm.unity.MessageSource) WebSession(pl.edu.icm.unity.webui.WebSession) NotificationPopup(pl.edu.icm.unity.webui.common.NotificationPopup) NavigationHelper(io.imunity.webelements.helpers.NavigationHelper) SingleActionHandler(pl.edu.icm.unity.webui.common.SingleActionHandler) Collection(java.util.Collection) ControllerException(pl.edu.icm.unity.webui.exceptions.ControllerException) StandardButtonsHelper(pl.edu.icm.unity.webui.common.StandardButtonsHelper) Sets(com.google.common.collect.Sets) Images(pl.edu.icm.unity.webui.common.Images) ObjectFactory(org.springframework.beans.factory.ObjectFactory) List(java.util.List) Component(org.springframework.stereotype.Component) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Collections(java.util.Collections) CommonViewParam(io.imunity.webelements.helpers.NavigationHelper.CommonViewParam) Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 3 with ViewChangeEvent

use of com.vaadin.navigator.ViewChangeListener.ViewChangeEvent in project unity by unity-idm.

the class NewAuthenticatorView method enter.

@Override
public void enter(ViewChangeEvent event) {
    editor = controller.getEditor(null, this, e -> {
        displayedName = msg.getMessage("New") + " " + AuthenticatorTypeLabelHelper.getAuthenticatorTypeLabel(msg, e.getValue()).toLowerCase();
        refreshBreadCrumbs();
    });
    mainView = new VerticalLayout();
    mainView.setMargin(false);
    mainView.addComponent(editor);
    mainView.addComponent(StandardButtonsHelper.buildConfirmNewButtonsBar(msg, () -> onConfirm(), () -> onCancel()));
    setMainView(mainView);
    refreshBreadCrumbs();
}
Also used : NavigationHelper(io.imunity.webelements.helpers.NavigationHelper) ViewWithSubViewBase(io.imunity.webelements.navigation.ViewWithSubViewBase) PrototypeComponent(pl.edu.icm.unity.engine.api.utils.PrototypeComponent) VerticalLayout(com.vaadin.ui.VerticalLayout) Type(io.imunity.webelements.navigation.NavigationInfo.Type) ControllerException(pl.edu.icm.unity.webui.exceptions.ControllerException) Autowired(org.springframework.beans.factory.annotation.Autowired) StandardButtonsHelper(pl.edu.icm.unity.webui.common.StandardButtonsHelper) ObjectFactory(org.springframework.beans.factory.ObjectFactory) Component(org.springframework.stereotype.Component) AuthenticatorDefinition(pl.edu.icm.unity.types.authn.AuthenticatorDefinition) ViewChangeEvent(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent) FormValidationException(pl.edu.icm.unity.webui.common.FormValidationException) WebConsoleNavigationInfoProviderBase(io.imunity.webconsole.WebConsoleNavigationInfoProviderBase) AuthenticationFacilitiesView(io.imunity.webconsole.authentication.facilities.AuthenticationFacilitiesView) NavigationInfo(io.imunity.webelements.navigation.NavigationInfo) MessageSource(pl.edu.icm.unity.MessageSource) NotificationPopup(pl.edu.icm.unity.webui.common.NotificationPopup) VerticalLayout(com.vaadin.ui.VerticalLayout)

Example 4 with ViewChangeEvent

use of com.vaadin.navigator.ViewChangeListener.ViewChangeEvent in project unity by unity-idm.

the class AttributeClassesView method enter.

@Override
public void enter(ViewChangeEvent event) {
    HorizontalLayout buttonsBar = StandardButtonsHelper.buildTopButtonsBar(StandardButtonsHelper.build4AddAction(msg, e -> NavigationHelper.goToView(NewAttributeClassView.VIEW_NAME)));
    attributeClassGrid = new GridWithActionColumn<>(msg, getRowActionsHandlers(), false, false);
    attributeClassGrid.addShowDetailsColumn(a -> getDetailsComponent(a));
    attributeClassGrid.addComponentColumn(a -> StandardButtonsHelper.buildLinkButton(a.getName(), e -> gotoEdit(a)), msg.getMessage("AttributeClassesView.nameCaption"), 10).setSortable(true).setComparator((a1, a2) -> {
        return a1.getName().compareTo(a2.getName());
    }).setId("name");
    attributeClassGrid.addSortableColumn(a -> String.join(", ", a.getAllowed()), msg.getMessage("AttributeClassesView.allowedCaption"), 10);
    attributeClassGrid.addSortableColumn(a -> String.join(", ", a.getMandatory()), msg.getMessage("AttributeClassesView.mandatoryCaption"), 10);
    attributeClassGrid.addByClickDetailsComponent(a -> getDetailsComponent(a));
    attributeClassGrid.setSizeFull();
    attributeClassGrid.setItems(getAttributeClasses());
    VerticalLayout main = new VerticalLayout();
    main.addComponent(buttonsBar);
    main.addComponent(attributeClassGrid);
    main.setWidth(100, Unit.PERCENTAGE);
    main.setMargin(false);
    setCompositionRoot(main);
}
Also used : Arrays(java.util.Arrays) CustomComponent(com.vaadin.ui.CustomComponent) PrototypeComponent(pl.edu.icm.unity.engine.api.utils.PrototypeComponent) VerticalLayout(com.vaadin.ui.VerticalLayout) Type(io.imunity.webelements.navigation.NavigationInfo.Type) Autowired(org.springframework.beans.factory.annotation.Autowired) Label(com.vaadin.ui.Label) ViewChangeEvent(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent) WebConsoleNavigationInfoProviderBase(io.imunity.webconsole.WebConsoleNavigationInfoProviderBase) GridWithActionColumn(pl.edu.icm.unity.webui.common.GridWithActionColumn) UnityView(io.imunity.webelements.navigation.UnityView) AttributesClass(pl.edu.icm.unity.types.basic.AttributesClass) NavigationInfo(io.imunity.webelements.navigation.NavigationInfo) MessageSource(pl.edu.icm.unity.MessageSource) NotificationPopup(pl.edu.icm.unity.webui.common.NotificationPopup) NavigationHelper(io.imunity.webelements.helpers.NavigationHelper) SingleActionHandler(pl.edu.icm.unity.webui.common.SingleActionHandler) Collection(java.util.Collection) ControllerException(pl.edu.icm.unity.webui.exceptions.ControllerException) ConfirmDialog(pl.edu.icm.unity.webui.common.ConfirmDialog) StandardButtonsHelper(pl.edu.icm.unity.webui.common.StandardButtonsHelper) Sets(com.google.common.collect.Sets) Images(pl.edu.icm.unity.webui.common.Images) ObjectFactory(org.springframework.beans.factory.ObjectFactory) List(java.util.List) Component(org.springframework.stereotype.Component) HorizontalLayout(com.vaadin.ui.HorizontalLayout) FormLayout(com.vaadin.ui.FormLayout) Styles(pl.edu.icm.unity.webui.common.Styles) MessageUtils(pl.edu.icm.unity.engine.api.utils.MessageUtils) Collections(java.util.Collections) CommonViewParam(io.imunity.webelements.helpers.NavigationHelper.CommonViewParam) DirectorySetupNavigationInfoProvider(io.imunity.webconsole.directorySetup.DirectorySetupNavigationInfoProvider) VerticalLayout(com.vaadin.ui.VerticalLayout) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 5 with ViewChangeEvent

use of com.vaadin.navigator.ViewChangeListener.ViewChangeEvent in project unity by unity-idm.

the class AuthenticationRealmsView method enter.

@Override
public void enter(ViewChangeEvent event) {
    HorizontalLayout buttonsBar = StandardButtonsHelper.buildTopButtonsBar(StandardButtonsHelper.build4AddAction(msg, e -> NavigationHelper.goToView(NewAuthenticationRealmView.VIEW_NAME)));
    realmsGrid = new GridWithActionColumn<>(msg, getActionsHandlers(), false);
    realmsGrid.addShowDetailsColumn(r -> getDetailsComponent(r));
    realmsGrid.addComponentColumn(r -> StandardButtonsHelper.buildLinkButton(r.realm.getName(), e -> gotoEdit(r)), msg.getMessage("AuthenticationRealmsView.nameCaption"), 10).setSortable(true).setComparator((r1, r2) -> {
        return r1.realm.getName().compareTo(r2.realm.getName());
    }).setId("name");
    realmsGrid.setItems(getRealms());
    realmsGrid.sort("name");
    realmsGrid.setHeightByRows(false);
    realmsGrid.setHeight(100, Unit.PERCENTAGE);
    VerticalLayout main = new VerticalLayout();
    main.addComponent(buttonsBar);
    main.addComponent(realmsGrid);
    main.setWidth(100, Unit.PERCENTAGE);
    main.setMargin(false);
    setCompositionRoot(main);
}
Also used : Arrays(java.util.Arrays) CustomComponent(com.vaadin.ui.CustomComponent) AuthenticationNavigationInfoProvider(io.imunity.webconsole.authentication.AuthenticationNavigationInfoProvider) PrototypeComponent(pl.edu.icm.unity.engine.api.utils.PrototypeComponent) VerticalLayout(com.vaadin.ui.VerticalLayout) Type(io.imunity.webelements.navigation.NavigationInfo.Type) Autowired(org.springframework.beans.factory.annotation.Autowired) Label(com.vaadin.ui.Label) ViewChangeEvent(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent) WebConsoleNavigationInfoProviderBase(io.imunity.webconsole.WebConsoleNavigationInfoProviderBase) GridWithActionColumn(pl.edu.icm.unity.webui.common.GridWithActionColumn) UnityView(io.imunity.webelements.navigation.UnityView) NavigationInfo(io.imunity.webelements.navigation.NavigationInfo) MessageSource(pl.edu.icm.unity.MessageSource) NotificationPopup(pl.edu.icm.unity.webui.common.NotificationPopup) NavigationHelper(io.imunity.webelements.helpers.NavigationHelper) SingleActionHandler(pl.edu.icm.unity.webui.common.SingleActionHandler) Collection(java.util.Collection) ControllerException(pl.edu.icm.unity.webui.exceptions.ControllerException) ConfirmDialog(pl.edu.icm.unity.webui.common.ConfirmDialog) StandardButtonsHelper(pl.edu.icm.unity.webui.common.StandardButtonsHelper) Sets(com.google.common.collect.Sets) Images(pl.edu.icm.unity.webui.common.Images) ObjectFactory(org.springframework.beans.factory.ObjectFactory) List(java.util.List) Component(org.springframework.stereotype.Component) HorizontalLayout(com.vaadin.ui.HorizontalLayout) FormLayout(com.vaadin.ui.FormLayout) Styles(pl.edu.icm.unity.webui.common.Styles) MessageUtils(pl.edu.icm.unity.engine.api.utils.MessageUtils) Collections(java.util.Collections) CommonViewParam(io.imunity.webelements.helpers.NavigationHelper.CommonViewParam) VerticalLayout(com.vaadin.ui.VerticalLayout) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Aggregations

ViewChangeEvent (com.vaadin.navigator.ViewChangeListener.ViewChangeEvent)17 VerticalLayout (com.vaadin.ui.VerticalLayout)14 MessageSource (pl.edu.icm.unity.MessageSource)14 NotificationPopup (pl.edu.icm.unity.webui.common.NotificationPopup)14 ControllerException (pl.edu.icm.unity.webui.exceptions.ControllerException)14 CustomComponent (com.vaadin.ui.CustomComponent)13 NavigationHelper (io.imunity.webelements.helpers.NavigationHelper)13 UnityView (io.imunity.webelements.navigation.UnityView)13 Autowired (org.springframework.beans.factory.annotation.Autowired)13 Images (pl.edu.icm.unity.webui.common.Images)13 StandardButtonsHelper (pl.edu.icm.unity.webui.common.StandardButtonsHelper)13 WebConsoleNavigationInfoProviderBase (io.imunity.webconsole.WebConsoleNavigationInfoProviderBase)12 NavigationInfo (io.imunity.webelements.navigation.NavigationInfo)12 Type (io.imunity.webelements.navigation.NavigationInfo.Type)12 Collections (java.util.Collections)12 ObjectFactory (org.springframework.beans.factory.ObjectFactory)12 Component (org.springframework.stereotype.Component)12 PrototypeComponent (pl.edu.icm.unity.engine.api.utils.PrototypeComponent)12 GridWithActionColumn (pl.edu.icm.unity.webui.common.GridWithActionColumn)12 HorizontalLayout (com.vaadin.ui.HorizontalLayout)11