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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations