sort base and component ui classes

This commit is contained in:
f43nd1r 2019-12-07 02:54:46 +01:00
parent 2fc60efbca
commit 30ada91aa3
22 changed files with 54 additions and 131 deletions

View file

@ -16,6 +16,7 @@
package com.faendir.acra.ui.base;
import com.faendir.acra.ui.component.Path;
import com.vaadin.flow.component.UI;
import com.vaadin.flow.router.AfterNavigationEvent;
import com.vaadin.flow.router.BeforeEvent;

View file

@ -19,6 +19,7 @@ package com.faendir.acra.ui.base;
import com.faendir.acra.i18n.Messages;
import com.faendir.acra.service.DataService;
import com.faendir.acra.ui.component.FlexLayout;
import com.faendir.acra.ui.component.Path;
import com.vaadin.flow.component.AttachEvent;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.Composite;

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.faendir.acra.ui.base;
package com.faendir.acra.ui.component;
import com.faendir.acra.i18n.Messages;
import com.faendir.acra.model.User;

View file

@ -1,75 +0,0 @@
/*
* (C) Copyright 2018 Lukas Morawietz (https://github.com/F43nd1r)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.faendir.acra.ui.component;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.HasComponents;
import com.vaadin.flow.component.PropertyDescriptor;
import com.vaadin.flow.component.PropertyDescriptors;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.dependency.HtmlImport;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author lukas
* @since 15.11.18
*/
@Tag("simple-dropdown")
@HtmlImport("bower_components/simple-dropdown/simple-dropdown.html")
public class DropdownMenu extends Component implements HasComponents, HasSize, HasStyle {
private static final String ORIGIN = "origin";
private static PropertyDescriptor<Boolean, Boolean> ACTIVE_DESCRIPTOR = PropertyDescriptors.propertyWithDefault("active", false);
private static PropertyDescriptor<String, String> LABEL_DESCRIPTOR = PropertyDescriptors.propertyWithDefault("label", "");
public DropdownMenu() {
}
public DropdownMenu(Component... components) {
this();
add(components);
}
public enum Origin {
LEFT, TOP, RIGHT, BOTTOM, CENTER;
}
public void setOpen(boolean open) {
set(ACTIVE_DESCRIPTOR, open);
}
public boolean isOpen() {
return get(ACTIVE_DESCRIPTOR);
}
public void setOrigin(Origin... origin) {
getElement().setProperty(ORIGIN, Stream.of(origin).map(Origin::name).map(String::toLowerCase).collect(Collectors.joining(" ")));
}
public Origin[] getOrigin() {
return Stream.of(getElement().getProperty(ORIGIN).split(" ")).map(String::toUpperCase).map(Origin::valueOf).toArray(Origin[]::new);
}
public void setLabel(String label) {
set(LABEL_DESCRIPTOR, label);
}
public String getLabel() {
return get(LABEL_DESCRIPTOR);
}
}

View file

@ -14,16 +14,14 @@
* limitations under the License.
*/
package com.faendir.acra.ui.base;
package com.faendir.acra.ui.component;
import com.faendir.acra.dataprovider.QueryDslDataProvider;
import com.faendir.acra.ui.component.HasSize;
import com.querydsl.core.types.Expression;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.ComponentEventListener;
import com.vaadin.flow.component.Composite;
import com.vaadin.flow.component.grid.FooterRow;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.grid.GridSortOrder;
import com.vaadin.flow.component.grid.ItemClickEvent;
import com.vaadin.flow.data.renderer.Renderer;
@ -48,11 +46,11 @@ import java.util.stream.Stream;
* @author lukas
* @since 13.07.18
*/
public class MyGrid<T> extends Composite<Grid<T>> implements LocaleChangeObserver, HasSize {
public class Grid<T> extends Composite<com.vaadin.flow.component.grid.Grid<T>> implements LocaleChangeObserver, HasSize {
private final QueryDslDataProvider<T> dataProvider;
private final Map<Grid.Column<T>, Pair<String, Object[]>> columnCaptions;
private final Map<com.vaadin.flow.component.grid.Grid.Column<T>, Pair<String, Object[]>> columnCaptions;
public MyGrid(QueryDslDataProvider<T> dataProvider) {
public Grid(QueryDslDataProvider<T> dataProvider) {
this.dataProvider = dataProvider;
getContent().setDataProvider(dataProvider);
getContent().setSizeFull();
@ -62,38 +60,38 @@ public class MyGrid<T> extends Composite<Grid<T>> implements LocaleChangeObserve
}
@NonNull
public Grid.Column<T> addColumn(@NonNull ValueProvider<T, ?> valueProvider, @NonNull String captionId, Object... params) {
public com.vaadin.flow.component.grid.Grid.Column<T> addColumn(@NonNull ValueProvider<T, ?> valueProvider, @NonNull String captionId, Object... params) {
return setupColumn(getContent().addColumn(valueProvider), captionId, params);
}
@NonNull
public Grid.Column<T> addColumn(@NonNull ValueProvider<T, ?> valueProvider, @NonNull Expression<? extends Comparable> sort, @NonNull String captionId, Object... params) {
public com.vaadin.flow.component.grid.Grid.Column<T> addColumn(@NonNull ValueProvider<T, ?> valueProvider, @NonNull Expression<? extends Comparable> sort, @NonNull String captionId, Object... params) {
return setupSortableColumn(addColumn(valueProvider, captionId, params), sort);
}
@NonNull
public Grid.Column<T> addColumn(@NonNull Renderer<T> renderer) {
public com.vaadin.flow.component.grid.Grid.Column<T> addColumn(@NonNull Renderer<T> renderer) {
return getContent().addColumn(renderer).setResizable(true).setAutoWidth(true).setFlexGrow(0);
}
@NonNull
public Grid.Column<T> addColumn(@NonNull Renderer<T> renderer, @NonNull String captionId, Object... params) {
public com.vaadin.flow.component.grid.Grid.Column<T> addColumn(@NonNull Renderer<T> renderer, @NonNull String captionId, Object... params) {
return setupColumn(getContent().addColumn(renderer), captionId, params);
}
@NonNull
public Grid.Column<T> addColumn(@NonNull Renderer<T> renderer, @NonNull Expression<? extends Comparable> sort, @NonNull String captionId, Object... params) {
public com.vaadin.flow.component.grid.Grid.Column<T> addColumn(@NonNull Renderer<T> renderer, @NonNull Expression<? extends Comparable> sort, @NonNull String captionId, Object... params) {
return setupSortableColumn(addColumn(renderer, captionId, params), sort);
}
private Grid.Column<T> setupColumn(@NonNull Grid.Column<T> column, @NonNull String captionId, Object... params) {
private com.vaadin.flow.component.grid.Grid.Column<T> setupColumn(@NonNull com.vaadin.flow.component.grid.Grid.Column<T> column, @NonNull String captionId, Object... params) {
String caption = getTranslation(captionId, params);
column = column.setHeader(caption).setResizable(true).setAutoWidth(true).setFlexGrow(0);
columnCaptions.put(column, Pair.of(captionId, params));
return column;
}
private Grid.Column<T> setupSortableColumn(@NonNull Grid.Column<T> column, @NonNull Expression<? extends Comparable> sort) {
private com.vaadin.flow.component.grid.Grid.Column<T> setupSortableColumn(@NonNull com.vaadin.flow.component.grid.Grid.Column<T> column, @NonNull Expression<? extends Comparable> sort) {
column.setSortOrderProvider(direction -> Stream.of(new QueryDslDataProvider.QueryDslSortOrder(sort, direction)));
column.setSortable(true);
return column;
@ -107,11 +105,11 @@ public class MyGrid<T> extends Composite<Grid<T>> implements LocaleChangeObserve
getContent().addItemClickListener(e -> getUI().ifPresent(e.getButton() == 1 ? (ui -> ui.getPage().executeJavaScript("window.open(\"" + RouteConfiguration.forSessionScope().getUrl(target, parameterTransformer.apply(e.getItem())) + "\", \"blank\", \"\");")) : (ui -> ui.navigate(target, parameterTransformer.apply(e.getItem())))));
}
public Registration addSelectionListener(SelectionListener<Grid<T>, T> listener) {
public Registration addSelectionListener(SelectionListener<com.vaadin.flow.component.grid.Grid<T>, T> listener) {
return getContent().addSelectionListener(listener);
}
public void setSelectionMode(Grid.SelectionMode selectionMode) {
public void setSelectionMode(com.vaadin.flow.component.grid.Grid.SelectionMode selectionMode) {
getContent().setSelectionMode(selectionMode);
}
@ -135,7 +133,7 @@ public class MyGrid<T> extends Composite<Grid<T>> implements LocaleChangeObserve
return getContent().appendFooterRow();
}
public List<Grid.Column<T>> getColumns() {
public List<com.vaadin.flow.component.grid.Grid.Column<T>> getColumns() {
return getContent().getColumns();
}

View file

@ -14,8 +14,10 @@
* limitations under the License.
*/
package com.faendir.acra.ui.base;
package com.faendir.acra.ui.component;
import com.faendir.acra.ui.base.HasRoute;
import com.faendir.acra.ui.base.TranslatableText;
import com.faendir.acra.ui.component.HasSize;
import com.faendir.acra.ui.component.HasStyle;
import com.faendir.acra.ui.component.SubTabs;
@ -85,7 +87,7 @@ public class Path extends SubTabs implements AfterNavigationListener, HasStyle,
super.onDetach(detachEvent);
}
public static class Element<T extends Component> extends TranslatableText{
public static class Element<T extends Component> extends TranslatableText {
final Class<T> target;
public Element(Class<T> target, String titleId, Object... params) {

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.faendir.acra.ui.base;
package com.faendir.acra.ui.component;
import com.faendir.acra.dataprovider.QueryDslDataProvider;
import com.faendir.acra.i18n.Messages;
@ -24,11 +24,11 @@ import com.faendir.acra.model.QReport;
import com.faendir.acra.model.Report;
import com.faendir.acra.security.SecurityUtils;
import com.faendir.acra.service.AvatarService;
import com.faendir.acra.ui.component.Grid;
import com.faendir.acra.ui.component.dialog.FluentDialog;
import com.faendir.acra.ui.view.report.ReportView;
import com.faendir.acra.util.TimeSpanRenderer;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.grid.GridSortOrder;
import com.vaadin.flow.component.icon.Icon;
import com.vaadin.flow.component.icon.VaadinIcon;
@ -41,12 +41,12 @@ import java.util.function.Consumer;
* @author lukas
* @since 17.09.18
*/
public class ReportList extends MyGrid<Report>{
public class ReportList extends Grid<Report> {
public ReportList(@NonNull App app, @NonNull QueryDslDataProvider<Report> dataProvider, @NonNull AvatarService avatarService, @NonNull Consumer<Report> reportDeleter) {
super(dataProvider);
setSelectionMode(Grid.SelectionMode.NONE);
setSelectionMode(com.vaadin.flow.component.grid.Grid.SelectionMode.NONE);
addColumn(new ComponentRenderer<>(avatarService::getAvatar) , QReport.report.installationId, Messages.USER);
Grid.Column<Report> dateColumn = addColumn(new TimeSpanRenderer<>(Report::getDate), QReport.report.date, Messages.DATE);
com.vaadin.flow.component.grid.Grid.Column<Report> dateColumn = addColumn(new TimeSpanRenderer<>(Report::getDate), QReport.report.date, Messages.DATE);
sort(GridSortOrder.desc(dateColumn).build());
addColumn(report -> report.getStacktrace().getVersion().getCode(), QReport.report.stacktrace.version.code, Messages.APP_VERSION);
addColumn(Report::getAndroidVersion, QReport.report.androidVersion, Messages.ANDROID_VERSION);

View file

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.faendir.acra.ui.base.statistics;
package com.faendir.acra.ui.component.statistics;
import com.faendir.acra.ui.component.Card;
import com.faendir.acra.ui.component.HasSize;

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.faendir.acra.ui.base.statistics;
package com.faendir.acra.ui.component.statistics;
import com.faendir.acra.i18n.Messages;
import com.faendir.acra.util.LocalSettings;

View file

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.faendir.acra.ui.base.statistics;
package com.faendir.acra.ui.component.statistics;
import com.faendir.acra.model.App;
import com.faendir.acra.service.DataService;

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.faendir.acra.ui.base.statistics;
package com.faendir.acra.ui.component.statistics;
import com.faendir.acra.i18n.Messages;
import com.faendir.acra.model.App;

View file

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.faendir.acra.ui.base.statistics;
package com.faendir.acra.ui.component.statistics;
import com.faendir.acra.i18n.Messages;
import com.faendir.acra.util.LocalSettings;

View file

@ -21,7 +21,7 @@ import com.faendir.acra.model.User;
import com.faendir.acra.security.SecurityUtils;
import com.faendir.acra.service.UserService;
import com.faendir.acra.ui.base.ParentLayout;
import com.faendir.acra.ui.base.Path;
import com.faendir.acra.ui.component.Path;
import com.faendir.acra.ui.component.FlexLayout;
import com.faendir.acra.ui.component.Label;
import com.faendir.acra.ui.component.Tab;
@ -37,7 +37,6 @@ import com.vaadin.flow.component.applayout.AppLayout;
import com.vaadin.flow.component.applayout.DrawerToggle;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.button.ButtonVariant;
import com.vaadin.flow.component.dependency.CssImport;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.Image;

View file

@ -24,9 +24,9 @@ import com.faendir.acra.model.User;
import com.faendir.acra.model.view.VApp;
import com.faendir.acra.security.SecurityUtils;
import com.faendir.acra.service.DataService;
import com.faendir.acra.ui.base.ConfigurationLabel;
import com.faendir.acra.ui.component.ConfigurationLabel;
import com.faendir.acra.ui.base.HasAcrariumTitle;
import com.faendir.acra.ui.base.MyGrid;
import com.faendir.acra.ui.component.Grid;
import com.faendir.acra.ui.base.TranslatableText;
import com.faendir.acra.ui.component.dialog.FluentDialog;
import com.faendir.acra.ui.component.dialog.ValidatedField;
@ -36,7 +36,6 @@ import com.faendir.acra.util.ImportResult;
import com.vaadin.flow.component.AttachEvent;
import com.vaadin.flow.component.ComponentEventListener;
import com.vaadin.flow.component.checkbox.Checkbox;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.component.textfield.NumberField;
@ -65,9 +64,9 @@ public class Overview extends VerticalLayout implements ComponentEventListener<A
@Override
public void onComponentEvent(AttachEvent event) {
removeAll();
MyGrid<VApp> grid = new MyGrid<>(dataService.getAppProvider());
grid.setSelectionMode(Grid.SelectionMode.NONE);
Grid.Column<VApp> appColumn = grid.addColumn(VApp::getName, QApp.app.name, Messages.NAME).setFlexGrow(1);
Grid<VApp> grid = new Grid<>(dataService.getAppProvider());
grid.setSelectionMode(com.vaadin.flow.component.grid.Grid.SelectionMode.NONE);
com.vaadin.flow.component.grid.Grid.Column<VApp> appColumn = grid.addColumn(VApp::getName, QApp.app.name, Messages.NAME).setFlexGrow(1);
grid.addColumn(VApp::getBugCount, QBug.bug.countDistinct(), Messages.BUGS);
grid.addColumn(VApp::getReportCount, QReport.report.count(), Messages.REPORTS);
grid.addOnClickNavigation(BugTab.class, VApp::getId);

View file

@ -27,8 +27,8 @@ import com.faendir.acra.model.Version;
import com.faendir.acra.security.SecurityUtils;
import com.faendir.acra.service.DataService;
import com.faendir.acra.service.UserService;
import com.faendir.acra.ui.base.ConfigurationLabel;
import com.faendir.acra.ui.base.MyGrid;
import com.faendir.acra.ui.component.ConfigurationLabel;
import com.faendir.acra.ui.component.Grid;
import com.faendir.acra.ui.component.dialog.FluentDialog;
import com.faendir.acra.ui.component.Box;
import com.faendir.acra.ui.component.Card;
@ -95,7 +95,7 @@ public class AdminTab extends AppTab<Div> {
@Override
protected void init(App app) {
layout.removeAll();
MyGrid<Version> versionGrid = new MyGrid<>(getDataService().getVersionProvider(app));
Grid<Version> versionGrid = new Grid<>(getDataService().getVersionProvider(app));
versionGrid.setMinHeight(280, HasSize.Unit.PIXEL);
versionGrid.setHeight(100, HasSize.Unit.PERCENTAGE);
versionGrid.addColumn(Version::getCode, QVersion.version.code, Messages.VERSION_CODE).setFlexGrow(1);

View file

@ -26,7 +26,7 @@ import com.faendir.acra.model.view.VBug;
import com.faendir.acra.security.SecurityUtils;
import com.faendir.acra.service.BugMerger;
import com.faendir.acra.service.DataService;
import com.faendir.acra.ui.base.MyGrid;
import com.faendir.acra.ui.component.Grid;
import com.faendir.acra.ui.component.dialog.FluentDialog;
import com.faendir.acra.ui.component.Translatable;
import com.faendir.acra.ui.view.app.AppView;
@ -35,7 +35,6 @@ import com.faendir.acra.util.TimeSpanRenderer;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.checkbox.Checkbox;
import com.vaadin.flow.component.grid.FooterRow;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.grid.GridSortOrder;
import com.vaadin.flow.component.notification.Notification;
import com.vaadin.flow.component.orderedlayout.FlexComponent;
@ -72,8 +71,8 @@ public class BugTab extends AppTab<VerticalLayout> {
protected void init(App app) {
getContent().setAlignItems(FlexComponent.Alignment.START);
Translatable<Checkbox> hideSolved = Translatable.createCheckbox(true, Messages.HIDE_SOLVED);
MyGrid<VBug> bugs = new MyGrid<>(getDataService().getBugProvider(app, () -> hideSolved.getContent().getValue()));
bugs.setSelectionMode(Grid.SelectionMode.MULTI);
Grid<VBug> bugs = new Grid<>(getDataService().getBugProvider(app, () -> hideSolved.getContent().getValue()));
bugs.setSelectionMode(com.vaadin.flow.component.grid.Grid.SelectionMode.MULTI);
hideSolved.getContent().addValueChangeListener(e -> getUI().ifPresent(ui -> ui.access(() -> {
bugs.deselectAll();
bugs.getDataProvider().refreshAll();
@ -93,14 +92,14 @@ public class BugTab extends AppTab<VerticalLayout> {
Notification.show(Messages.ONLY_ONE_BUG_SELECTED);
}
}, Messages.MERGE_BUGS);
Grid.Column<VBug> countColumn = bugs.addColumn(VBug::getReportCount, QReport.report.count(), Messages.REPORTS);
Grid.Column<VBug> dateColumn = bugs.addColumn(new TimeSpanRenderer<>(VBug::getLastReport), QReport.report.date.max(), Messages.LATEST_REPORT);
com.vaadin.flow.component.grid.Grid.Column<VBug> countColumn = bugs.addColumn(VBug::getReportCount, QReport.report.count(), Messages.REPORTS);
com.vaadin.flow.component.grid.Grid.Column<VBug> dateColumn = bugs.addColumn(new TimeSpanRenderer<>(VBug::getLastReport), QReport.report.date.max(), Messages.LATEST_REPORT);
bugs.sort(GridSortOrder.desc(dateColumn).build());
bugs.addColumn(VBug::getHighestVersionCode, QReport.report.stacktrace.version.code.max(), Messages.LATEST_VERSION);
bugs.addColumn(VBug::getUserCount, QReport.report.installationId.countDistinct(), Messages.AFFECTED_USERS);
bugs.addColumn(bug -> bug.getBug().getTitle(), QBug.bug.title, Messages.TITLE).setAutoWidth(false).setFlexGrow(1);
List<Version> versions = getDataService().findAllVersions(app);
Grid.Column<VBug> solvedColumn = bugs.addColumn(new ComponentRenderer<>((VBug bug) -> {
com.vaadin.flow.component.grid.Grid.Column<VBug> solvedColumn = bugs.addColumn(new ComponentRenderer<>((VBug bug) -> {
Select<Version> versionSelect = new Select<>(versions.toArray(new Version[0]));
versionSelect.setTextRenderer(Version::getName);
versionSelect.setEmptySelectionAllowed(true);

View file

@ -19,7 +19,7 @@ package com.faendir.acra.ui.view.app.tabs;
import com.faendir.acra.model.App;
import com.faendir.acra.service.AvatarService;
import com.faendir.acra.service.DataService;
import com.faendir.acra.ui.base.ReportList;
import com.faendir.acra.ui.component.ReportList;
import com.faendir.acra.ui.view.app.AppView;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.router.Route;

View file

@ -18,7 +18,7 @@ package com.faendir.acra.ui.view.app.tabs;
import com.faendir.acra.model.App;
import com.faendir.acra.service.DataService;
import com.faendir.acra.ui.base.statistics.Statistics;
import com.faendir.acra.ui.component.statistics.Statistics;
import com.faendir.acra.ui.view.app.AppView;
import com.faendir.acra.util.LocalSettings;
import com.vaadin.flow.component.html.Div;

View file

@ -19,7 +19,7 @@ package com.faendir.acra.ui.view.bug.tabs;
import com.faendir.acra.model.Bug;
import com.faendir.acra.service.AvatarService;
import com.faendir.acra.service.DataService;
import com.faendir.acra.ui.base.ReportList;
import com.faendir.acra.ui.component.ReportList;
import com.faendir.acra.ui.view.bug.BugView;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.router.Route;

View file

@ -19,7 +19,7 @@ package com.faendir.acra.ui.view.bug.tabs;
import com.faendir.acra.model.Bug;
import com.faendir.acra.model.QReport;
import com.faendir.acra.service.DataService;
import com.faendir.acra.ui.base.statistics.Statistics;
import com.faendir.acra.ui.component.statistics.Statistics;
import com.faendir.acra.ui.view.bug.BugView;
import com.faendir.acra.util.LocalSettings;
import com.vaadin.flow.component.html.Div;

View file

@ -22,7 +22,7 @@ import com.faendir.acra.service.AvatarService;
import com.faendir.acra.service.DataService;
import com.faendir.acra.ui.base.HasRoute;
import com.faendir.acra.ui.base.HasSecureParameter;
import com.faendir.acra.ui.base.Path;
import com.faendir.acra.ui.component.Path;
import com.faendir.acra.ui.component.Card;
import com.faendir.acra.ui.component.CssGrid;
import com.faendir.acra.ui.component.HasSize;

View file

@ -25,7 +25,7 @@ import com.faendir.acra.security.SecurityUtils;
import com.faendir.acra.service.DataService;
import com.faendir.acra.service.UserService;
import com.faendir.acra.ui.base.HasAcrariumTitle;
import com.faendir.acra.ui.base.MyGrid;
import com.faendir.acra.ui.component.Grid;
import com.faendir.acra.ui.base.TranslatableText;
import com.faendir.acra.ui.component.dialog.FluentDialog;
import com.faendir.acra.ui.component.dialog.ValidatedField;
@ -37,7 +37,6 @@ import com.vaadin.flow.component.Composite;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.checkbox.Checkbox;
import com.vaadin.flow.component.combobox.ComboBox;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.textfield.PasswordField;
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.data.renderer.ComponentRenderer;
@ -70,9 +69,9 @@ public class UserManager extends Composite<FlexLayout> implements HasAcrariumTit
protected void onAttach(AttachEvent attachEvent) {
super.onAttach(attachEvent);
getContent().removeAll();
MyGrid<User> userGrid = new MyGrid<>(userService.getUserProvider());
Grid<User> userGrid = new Grid<>(userService.getUserProvider());
userGrid.setWidthFull();
userGrid.setSelectionMode(Grid.SelectionMode.NONE);
userGrid.setSelectionMode(com.vaadin.flow.component.grid.Grid.SelectionMode.NONE);
userGrid.addColumn(User::getUsername, QUser.user.username, Messages.USERNAME).setFlexGrow(1);
userGrid.addColumn(new ComponentRenderer<>(user -> {
Checkbox checkbox = new Checkbox(user.getRoles().contains(User.Role.ADMIN));