Search in sources :

Example 1 with GridWithActionColumn

use of pl.edu.icm.unity.webui.common.GridWithActionColumn 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 2 with GridWithActionColumn

use of pl.edu.icm.unity.webui.common.GridWithActionColumn in project unity by unity-idm.

the class AuthenticationFlowsComponent method initUI.

private void initUI() {
    HorizontalLayout buttonsBar = StandardButtonsHelper.buildTopButtonsBar(StandardButtonsHelper.build4AddAction(msg, e -> NavigationHelper.goToView(NewAuthenticationFlowView.VIEW_NAME)));
    flowsGrid = new GridWithActionColumn<>(msg, getActionsHandlers(), false);
    flowsGrid.addShowDetailsColumn(f -> getDetailsComponent(f));
    flowsGrid.addComponentColumn(f -> StandardButtonsHelper.buildLinkButton(f.flow.getName(), e -> gotoEdit(f)), msg.getMessage("AuthenticationFlowsComponent.nameCaption"), 10).setSortable(true).setComparator((f1, f2) -> {
        return f1.flow.getName().compareTo(f2.flow.getName());
    }).setId("name");
    flowsGrid.setItems(getFlows());
    flowsGrid.sort("name");
    flowsGrid.setHeightByRows(false);
    flowsGrid.setHeight(100, Unit.PERCENTAGE);
    VerticalLayout main = new VerticalLayout();
    Label flowCaption = new Label(msg.getMessage("AuthenticationFlowsComponent.caption"));
    flowCaption.setStyleName(Styles.sectionTitle.toString());
    main.addComponent(flowCaption);
    main.addComponent(buttonsBar);
    main.addComponent(flowsGrid);
    main.setWidth(100, Unit.PERCENTAGE);
    main.setMargin(false);
    setCompositionRoot(main);
}
Also used : Arrays(java.util.Arrays) CustomComponent(com.vaadin.ui.CustomComponent) NavigationHelper(io.imunity.webelements.helpers.NavigationHelper) SingleActionHandler(pl.edu.icm.unity.webui.common.SingleActionHandler) Collection(java.util.Collection) VerticalLayout(com.vaadin.ui.VerticalLayout) 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) List(java.util.List) HorizontalLayout(com.vaadin.ui.HorizontalLayout) FormLayout(com.vaadin.ui.FormLayout) Styles(pl.edu.icm.unity.webui.common.Styles) Label(com.vaadin.ui.Label) MessageUtils(pl.edu.icm.unity.engine.api.utils.MessageUtils) GridWithActionColumn(pl.edu.icm.unity.webui.common.GridWithActionColumn) Collections(java.util.Collections) CommonViewParam(io.imunity.webelements.helpers.NavigationHelper.CommonViewParam) MessageSource(pl.edu.icm.unity.MessageSource) NotificationPopup(pl.edu.icm.unity.webui.common.NotificationPopup) Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 3 with GridWithActionColumn

use of pl.edu.icm.unity.webui.common.GridWithActionColumn 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 4 with GridWithActionColumn

use of pl.edu.icm.unity.webui.common.GridWithActionColumn 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)

Example 5 with GridWithActionColumn

use of pl.edu.icm.unity.webui.common.GridWithActionColumn in project unity by unity-idm.

the class EditTrustedFederationSubView method buildFederationFetchSection.

private CollapsibleLayout buildFederationFetchSection() {
    VerticalLayout federationListLayout = new VerticalLayout();
    federationListLayout.setMargin(false);
    ProgressBar spinner = new ProgressBar();
    spinner.setIndeterminate(true);
    spinner.setVisible(false);
    federationListLayout.addComponent(spinner);
    GridWithActionColumn<SAMLEntityWithLogo> samlEntities = new GridWithActionColumn<>(msg, Collections.emptyList());
    samlEntities.setActionColumnHidden(true);
    samlEntities.setHeightByRows(false);
    samlEntities.setHeightByRows(14);
    samlEntities.addComponentColumn(v -> getLogo(v), msg.getMessage("EditTrustedFederationSubView.logo"), 3);
    samlEntities.addColumn(v -> v.name, msg.getMessage("EditTrustedFederationSubView.name"), 40);
    samlEntities.addColumn(v -> v.id, msg.getMessage("EditTrustedFederationSubView.entityIdentifier"), 40);
    SearchField search = FilterableGridHelper.generateSearchField(samlEntities, msg);
    Toolbar<SAMLEntityWithLogo> toolbar = new Toolbar<>(Orientation.HORIZONTAL);
    toolbar.setWidth(100, Unit.PERCENTAGE);
    toolbar.addSearch(search, Alignment.MIDDLE_RIGHT);
    ComponentWithToolbar samlEntitiesListWithToolbar = new ComponentWithToolbar(samlEntities, toolbar, Alignment.BOTTOM_LEFT);
    samlEntitiesListWithToolbar.setSpacing(false);
    samlEntitiesListWithToolbar.setSizeFull();
    samlEntitiesListWithToolbar.setVisible(false);
    Button fetch = new Button(msg.getMessage("EditTrustedFederationSubView.fetch"));
    UI ui = UI.getCurrent();
    fetch.addClickListener(e -> {
        ui.setPollInterval(500);
        spinner.setVisible(true);
        CompletableFuture.runAsync(() -> {
            try {
                MetadataDownloader metaDownloader = new MetadataDownloader(uriAccessService, fileStorageService);
                EntitiesDescriptorDocument entDoc = metaDownloader.getCached(url.getValue()).orElse(null);
                if (entDoc == null) {
                    entDoc = metaDownloader.getFresh(url.getValue(), httpsTruststore.getValue());
                }
                SimpleIDPMetaConverter convert = new SimpleIDPMetaConverter(msg);
                List<SAMLEntityWithLogo> entries = convert.getEntries(entDoc.getEntitiesDescriptor());
                samlEntities.setItems(entries);
                samlEntitiesListWithToolbar.setVisible(true);
            } catch (Exception e1) {
                ui.access(() -> NotificationPopup.showError(msg, "", e1));
                samlEntities.setItems(Collections.emptyList());
                samlEntitiesListWithToolbar.setVisible(false);
            }
            ui.access(() -> {
                ui.setPollInterval(-1);
                spinner.setVisible(false);
            });
        });
    });
    url.addValueChangeListener(e -> {
        if (e.getValue() == null || e.getValue().isEmpty()) {
            fetch.setEnabled(false);
        } else {
            fetch.setEnabled(true);
        }
    });
    HorizontalLayout wrapper = new HorizontalLayout();
    wrapper.setMargin(false);
    wrapper.addComponents(fetch, spinner);
    federationListLayout.addComponent(wrapper);
    federationListLayout.addComponent(samlEntitiesListWithToolbar);
    return new CollapsibleLayout(msg.getMessage("EditTrustedFederationSubView.serviceProviders"), federationListLayout);
}
Also used : CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) MetadataDownloader(pl.edu.icm.unity.saml.metadata.srv.MetadataDownloader) EntitiesDescriptorDocument(xmlbeans.org.oasis.saml2.metadata.EntitiesDescriptorDocument) ComponentWithToolbar(pl.edu.icm.unity.webui.common.ComponentWithToolbar) GridWithActionColumn(pl.edu.icm.unity.webui.common.GridWithActionColumn) FormValidationException(pl.edu.icm.unity.webui.common.FormValidationException) HorizontalLayout(com.vaadin.ui.HorizontalLayout) SearchField(pl.edu.icm.unity.webui.common.SearchField) SAMLEntityWithLogo(pl.edu.icm.unity.saml.idp.console.SimpleIDPMetaConverter.SAMLEntityWithLogo) UI(com.vaadin.ui.UI) Button(com.vaadin.ui.Button) VerticalLayout(com.vaadin.ui.VerticalLayout) ProgressBar(com.vaadin.ui.ProgressBar) ComponentWithToolbar(pl.edu.icm.unity.webui.common.ComponentWithToolbar) Toolbar(pl.edu.icm.unity.webui.common.Toolbar)

Aggregations

VerticalLayout (com.vaadin.ui.VerticalLayout)19 GridWithActionColumn (pl.edu.icm.unity.webui.common.GridWithActionColumn)19 CustomComponent (com.vaadin.ui.CustomComponent)17 Collections (java.util.Collections)17 MessageSource (pl.edu.icm.unity.MessageSource)17 NotificationPopup (pl.edu.icm.unity.webui.common.NotificationPopup)17 ControllerException (pl.edu.icm.unity.webui.exceptions.ControllerException)17 NavigationHelper (io.imunity.webelements.helpers.NavigationHelper)16 CommonViewParam (io.imunity.webelements.helpers.NavigationHelper.CommonViewParam)16 Arrays (java.util.Arrays)16 Collection (java.util.Collection)16 List (java.util.List)16 SingleActionHandler (pl.edu.icm.unity.webui.common.SingleActionHandler)16 StandardButtonsHelper (pl.edu.icm.unity.webui.common.StandardButtonsHelper)16 HorizontalLayout (com.vaadin.ui.HorizontalLayout)15 Images (pl.edu.icm.unity.webui.common.Images)15 MessageUtils (pl.edu.icm.unity.engine.api.utils.MessageUtils)13 ViewChangeEvent (com.vaadin.navigator.ViewChangeListener.ViewChangeEvent)12 Label (com.vaadin.ui.Label)12 UnityView (io.imunity.webelements.navigation.UnityView)12