From 30ada91aa36509de4049cbb71bba332632fa4250 Mon Sep 17 00:00:00 2001 From: f43nd1r Date: Sat, 7 Dec 2019 02:54:46 +0100 Subject: [PATCH] sort base and component ui classes --- .../com/faendir/acra/ui/base/HasRoute.java | 1 + .../com/faendir/acra/ui/base/TabView.java | 1 + .../ConfigurationLabel.java | 2 +- .../acra/ui/component/DropdownMenu.java | 75 ------------------- .../{base/MyGrid.java => component/Grid.java} | 30 ++++---- .../acra/ui/{base => component}/Path.java | 6 +- .../ui/{base => component}/ReportList.java | 10 +-- .../{base => component}/statistics/Chart.java | 2 +- .../statistics/PieChart.java | 2 +- .../statistics/Property.java | 2 +- .../statistics/Statistics.java | 2 +- .../statistics/TimeChart.java | 2 +- .../com/faendir/acra/ui/view/MainView.java | 3 +- .../com/faendir/acra/ui/view/Overview.java | 11 ++- .../acra/ui/view/app/tabs/AdminTab.java | 6 +- .../faendir/acra/ui/view/app/tabs/BugTab.java | 13 ++-- .../acra/ui/view/app/tabs/ReportTab.java | 2 +- .../acra/ui/view/app/tabs/StatisticsTab.java | 2 +- .../acra/ui/view/bug/tabs/ReportTab.java | 2 +- .../acra/ui/view/bug/tabs/StatisticsTab.java | 2 +- .../acra/ui/view/report/ReportView.java | 2 +- .../acra/ui/view/user/UserManager.java | 7 +- 22 files changed, 54 insertions(+), 131 deletions(-) rename acrarium/src/main/java/com/faendir/acra/ui/{base => component}/ConfigurationLabel.java (97%) delete mode 100644 acrarium/src/main/java/com/faendir/acra/ui/component/DropdownMenu.java rename acrarium/src/main/java/com/faendir/acra/ui/{base/MyGrid.java => component/Grid.java} (71%) rename acrarium/src/main/java/com/faendir/acra/ui/{base => component}/Path.java (96%) rename acrarium/src/main/java/com/faendir/acra/ui/{base => component}/ReportList.java (88%) rename acrarium/src/main/java/com/faendir/acra/ui/{base => component}/statistics/Chart.java (97%) rename acrarium/src/main/java/com/faendir/acra/ui/{base => component}/statistics/PieChart.java (98%) rename acrarium/src/main/java/com/faendir/acra/ui/{base => component}/statistics/Property.java (99%) rename acrarium/src/main/java/com/faendir/acra/ui/{base => component}/statistics/Statistics.java (98%) rename acrarium/src/main/java/com/faendir/acra/ui/{base => component}/statistics/TimeChart.java (98%) diff --git a/acrarium/src/main/java/com/faendir/acra/ui/base/HasRoute.java b/acrarium/src/main/java/com/faendir/acra/ui/base/HasRoute.java index a522f90..ee60ce1 100644 --- a/acrarium/src/main/java/com/faendir/acra/ui/base/HasRoute.java +++ b/acrarium/src/main/java/com/faendir/acra/ui/base/HasRoute.java @@ -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; diff --git a/acrarium/src/main/java/com/faendir/acra/ui/base/TabView.java b/acrarium/src/main/java/com/faendir/acra/ui/base/TabView.java index 0ed766c..a7c20db 100644 --- a/acrarium/src/main/java/com/faendir/acra/ui/base/TabView.java +++ b/acrarium/src/main/java/com/faendir/acra/ui/base/TabView.java @@ -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; diff --git a/acrarium/src/main/java/com/faendir/acra/ui/base/ConfigurationLabel.java b/acrarium/src/main/java/com/faendir/acra/ui/component/ConfigurationLabel.java similarity index 97% rename from acrarium/src/main/java/com/faendir/acra/ui/base/ConfigurationLabel.java rename to acrarium/src/main/java/com/faendir/acra/ui/component/ConfigurationLabel.java index 7a86942..1511841 100644 --- a/acrarium/src/main/java/com/faendir/acra/ui/base/ConfigurationLabel.java +++ b/acrarium/src/main/java/com/faendir/acra/ui/component/ConfigurationLabel.java @@ -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; diff --git a/acrarium/src/main/java/com/faendir/acra/ui/component/DropdownMenu.java b/acrarium/src/main/java/com/faendir/acra/ui/component/DropdownMenu.java deleted file mode 100644 index 96e44bd..0000000 --- a/acrarium/src/main/java/com/faendir/acra/ui/component/DropdownMenu.java +++ /dev/null @@ -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 ACTIVE_DESCRIPTOR = PropertyDescriptors.propertyWithDefault("active", false); - private static PropertyDescriptor 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); - } -} diff --git a/acrarium/src/main/java/com/faendir/acra/ui/base/MyGrid.java b/acrarium/src/main/java/com/faendir/acra/ui/component/Grid.java similarity index 71% rename from acrarium/src/main/java/com/faendir/acra/ui/base/MyGrid.java rename to acrarium/src/main/java/com/faendir/acra/ui/component/Grid.java index 5f42fe2..96f14d4 100644 --- a/acrarium/src/main/java/com/faendir/acra/ui/base/MyGrid.java +++ b/acrarium/src/main/java/com/faendir/acra/ui/component/Grid.java @@ -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 extends Composite> implements LocaleChangeObserver, HasSize { +public class Grid extends Composite> implements LocaleChangeObserver, HasSize { private final QueryDslDataProvider dataProvider; - private final Map, Pair> columnCaptions; + private final Map, Pair> columnCaptions; - public MyGrid(QueryDslDataProvider dataProvider) { + public Grid(QueryDslDataProvider dataProvider) { this.dataProvider = dataProvider; getContent().setDataProvider(dataProvider); getContent().setSizeFull(); @@ -62,38 +60,38 @@ public class MyGrid extends Composite> implements LocaleChangeObserve } @NonNull - public Grid.Column addColumn(@NonNull ValueProvider valueProvider, @NonNull String captionId, Object... params) { + public com.vaadin.flow.component.grid.Grid.Column addColumn(@NonNull ValueProvider valueProvider, @NonNull String captionId, Object... params) { return setupColumn(getContent().addColumn(valueProvider), captionId, params); } @NonNull - public Grid.Column addColumn(@NonNull ValueProvider valueProvider, @NonNull Expression sort, @NonNull String captionId, Object... params) { + public com.vaadin.flow.component.grid.Grid.Column addColumn(@NonNull ValueProvider valueProvider, @NonNull Expression sort, @NonNull String captionId, Object... params) { return setupSortableColumn(addColumn(valueProvider, captionId, params), sort); } @NonNull - public Grid.Column addColumn(@NonNull Renderer renderer) { + public com.vaadin.flow.component.grid.Grid.Column addColumn(@NonNull Renderer renderer) { return getContent().addColumn(renderer).setResizable(true).setAutoWidth(true).setFlexGrow(0); } @NonNull - public Grid.Column addColumn(@NonNull Renderer renderer, @NonNull String captionId, Object... params) { + public com.vaadin.flow.component.grid.Grid.Column addColumn(@NonNull Renderer renderer, @NonNull String captionId, Object... params) { return setupColumn(getContent().addColumn(renderer), captionId, params); } @NonNull - public Grid.Column addColumn(@NonNull Renderer renderer, @NonNull Expression sort, @NonNull String captionId, Object... params) { + public com.vaadin.flow.component.grid.Grid.Column addColumn(@NonNull Renderer renderer, @NonNull Expression sort, @NonNull String captionId, Object... params) { return setupSortableColumn(addColumn(renderer, captionId, params), sort); } - private Grid.Column setupColumn(@NonNull Grid.Column column, @NonNull String captionId, Object... params) { + private com.vaadin.flow.component.grid.Grid.Column setupColumn(@NonNull com.vaadin.flow.component.grid.Grid.Column 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 setupSortableColumn(@NonNull Grid.Column column, @NonNull Expression sort) { + private com.vaadin.flow.component.grid.Grid.Column setupSortableColumn(@NonNull com.vaadin.flow.component.grid.Grid.Column column, @NonNull Expression sort) { column.setSortOrderProvider(direction -> Stream.of(new QueryDslDataProvider.QueryDslSortOrder(sort, direction))); column.setSortable(true); return column; @@ -107,11 +105,11 @@ public class MyGrid extends Composite> 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, T> listener) { + public Registration addSelectionListener(SelectionListener, 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 extends Composite> implements LocaleChangeObserve return getContent().appendFooterRow(); } - public List> getColumns() { + public List> getColumns() { return getContent().getColumns(); } diff --git a/acrarium/src/main/java/com/faendir/acra/ui/base/Path.java b/acrarium/src/main/java/com/faendir/acra/ui/component/Path.java similarity index 96% rename from acrarium/src/main/java/com/faendir/acra/ui/base/Path.java rename to acrarium/src/main/java/com/faendir/acra/ui/component/Path.java index 4f20bb5..ef6cff4 100644 --- a/acrarium/src/main/java/com/faendir/acra/ui/base/Path.java +++ b/acrarium/src/main/java/com/faendir/acra/ui/component/Path.java @@ -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 extends TranslatableText{ + public static class Element extends TranslatableText { final Class target; public Element(Class target, String titleId, Object... params) { diff --git a/acrarium/src/main/java/com/faendir/acra/ui/base/ReportList.java b/acrarium/src/main/java/com/faendir/acra/ui/component/ReportList.java similarity index 88% rename from acrarium/src/main/java/com/faendir/acra/ui/base/ReportList.java rename to acrarium/src/main/java/com/faendir/acra/ui/component/ReportList.java index 9a30dfc..b3f0b22 100644 --- a/acrarium/src/main/java/com/faendir/acra/ui/base/ReportList.java +++ b/acrarium/src/main/java/com/faendir/acra/ui/component/ReportList.java @@ -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{ +public class ReportList extends Grid { public ReportList(@NonNull App app, @NonNull QueryDslDataProvider dataProvider, @NonNull AvatarService avatarService, @NonNull Consumer 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 dateColumn = addColumn(new TimeSpanRenderer<>(Report::getDate), QReport.report.date, Messages.DATE); + com.vaadin.flow.component.grid.Grid.Column 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); diff --git a/acrarium/src/main/java/com/faendir/acra/ui/base/statistics/Chart.java b/acrarium/src/main/java/com/faendir/acra/ui/component/statistics/Chart.java similarity index 97% rename from acrarium/src/main/java/com/faendir/acra/ui/base/statistics/Chart.java rename to acrarium/src/main/java/com/faendir/acra/ui/component/statistics/Chart.java index 1ef4b1e..962456e 100644 --- a/acrarium/src/main/java/com/faendir/acra/ui/base/statistics/Chart.java +++ b/acrarium/src/main/java/com/faendir/acra/ui/component/statistics/Chart.java @@ -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; diff --git a/acrarium/src/main/java/com/faendir/acra/ui/base/statistics/PieChart.java b/acrarium/src/main/java/com/faendir/acra/ui/component/statistics/PieChart.java similarity index 98% rename from acrarium/src/main/java/com/faendir/acra/ui/base/statistics/PieChart.java rename to acrarium/src/main/java/com/faendir/acra/ui/component/statistics/PieChart.java index 9e3a25f..7941e29 100644 --- a/acrarium/src/main/java/com/faendir/acra/ui/base/statistics/PieChart.java +++ b/acrarium/src/main/java/com/faendir/acra/ui/component/statistics/PieChart.java @@ -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; diff --git a/acrarium/src/main/java/com/faendir/acra/ui/base/statistics/Property.java b/acrarium/src/main/java/com/faendir/acra/ui/component/statistics/Property.java similarity index 99% rename from acrarium/src/main/java/com/faendir/acra/ui/base/statistics/Property.java rename to acrarium/src/main/java/com/faendir/acra/ui/component/statistics/Property.java index 872174a..80e19fe 100644 --- a/acrarium/src/main/java/com/faendir/acra/ui/base/statistics/Property.java +++ b/acrarium/src/main/java/com/faendir/acra/ui/component/statistics/Property.java @@ -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; diff --git a/acrarium/src/main/java/com/faendir/acra/ui/base/statistics/Statistics.java b/acrarium/src/main/java/com/faendir/acra/ui/component/statistics/Statistics.java similarity index 98% rename from acrarium/src/main/java/com/faendir/acra/ui/base/statistics/Statistics.java rename to acrarium/src/main/java/com/faendir/acra/ui/component/statistics/Statistics.java index 9be21d4..8894fc4 100644 --- a/acrarium/src/main/java/com/faendir/acra/ui/base/statistics/Statistics.java +++ b/acrarium/src/main/java/com/faendir/acra/ui/component/statistics/Statistics.java @@ -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; diff --git a/acrarium/src/main/java/com/faendir/acra/ui/base/statistics/TimeChart.java b/acrarium/src/main/java/com/faendir/acra/ui/component/statistics/TimeChart.java similarity index 98% rename from acrarium/src/main/java/com/faendir/acra/ui/base/statistics/TimeChart.java rename to acrarium/src/main/java/com/faendir/acra/ui/component/statistics/TimeChart.java index f026053..37d48ff 100644 --- a/acrarium/src/main/java/com/faendir/acra/ui/base/statistics/TimeChart.java +++ b/acrarium/src/main/java/com/faendir/acra/ui/component/statistics/TimeChart.java @@ -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; diff --git a/acrarium/src/main/java/com/faendir/acra/ui/view/MainView.java b/acrarium/src/main/java/com/faendir/acra/ui/view/MainView.java index 3b13520..8903cf5 100644 --- a/acrarium/src/main/java/com/faendir/acra/ui/view/MainView.java +++ b/acrarium/src/main/java/com/faendir/acra/ui/view/MainView.java @@ -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; diff --git a/acrarium/src/main/java/com/faendir/acra/ui/view/Overview.java b/acrarium/src/main/java/com/faendir/acra/ui/view/Overview.java index 29b4fc9..1f6b1a8 100644 --- a/acrarium/src/main/java/com/faendir/acra/ui/view/Overview.java +++ b/acrarium/src/main/java/com/faendir/acra/ui/view/Overview.java @@ -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 grid = new MyGrid<>(dataService.getAppProvider()); - grid.setSelectionMode(Grid.SelectionMode.NONE); - Grid.Column appColumn = grid.addColumn(VApp::getName, QApp.app.name, Messages.NAME).setFlexGrow(1); + Grid grid = new Grid<>(dataService.getAppProvider()); + grid.setSelectionMode(com.vaadin.flow.component.grid.Grid.SelectionMode.NONE); + com.vaadin.flow.component.grid.Grid.Column 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); diff --git a/acrarium/src/main/java/com/faendir/acra/ui/view/app/tabs/AdminTab.java b/acrarium/src/main/java/com/faendir/acra/ui/view/app/tabs/AdminTab.java index d2fe6c1..66a58c6 100644 --- a/acrarium/src/main/java/com/faendir/acra/ui/view/app/tabs/AdminTab.java +++ b/acrarium/src/main/java/com/faendir/acra/ui/view/app/tabs/AdminTab.java @@ -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
{ @Override protected void init(App app) { layout.removeAll(); - MyGrid versionGrid = new MyGrid<>(getDataService().getVersionProvider(app)); + Grid 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); diff --git a/acrarium/src/main/java/com/faendir/acra/ui/view/app/tabs/BugTab.java b/acrarium/src/main/java/com/faendir/acra/ui/view/app/tabs/BugTab.java index 6839274..f911559 100644 --- a/acrarium/src/main/java/com/faendir/acra/ui/view/app/tabs/BugTab.java +++ b/acrarium/src/main/java/com/faendir/acra/ui/view/app/tabs/BugTab.java @@ -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 { protected void init(App app) { getContent().setAlignItems(FlexComponent.Alignment.START); Translatable hideSolved = Translatable.createCheckbox(true, Messages.HIDE_SOLVED); - MyGrid bugs = new MyGrid<>(getDataService().getBugProvider(app, () -> hideSolved.getContent().getValue())); - bugs.setSelectionMode(Grid.SelectionMode.MULTI); + Grid 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 { Notification.show(Messages.ONLY_ONE_BUG_SELECTED); } }, Messages.MERGE_BUGS); - Grid.Column countColumn = bugs.addColumn(VBug::getReportCount, QReport.report.count(), Messages.REPORTS); - Grid.Column dateColumn = bugs.addColumn(new TimeSpanRenderer<>(VBug::getLastReport), QReport.report.date.max(), Messages.LATEST_REPORT); + com.vaadin.flow.component.grid.Grid.Column countColumn = bugs.addColumn(VBug::getReportCount, QReport.report.count(), Messages.REPORTS); + com.vaadin.flow.component.grid.Grid.Column 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 versions = getDataService().findAllVersions(app); - Grid.Column solvedColumn = bugs.addColumn(new ComponentRenderer<>((VBug bug) -> { + com.vaadin.flow.component.grid.Grid.Column solvedColumn = bugs.addColumn(new ComponentRenderer<>((VBug bug) -> { Select versionSelect = new Select<>(versions.toArray(new Version[0])); versionSelect.setTextRenderer(Version::getName); versionSelect.setEmptySelectionAllowed(true); diff --git a/acrarium/src/main/java/com/faendir/acra/ui/view/app/tabs/ReportTab.java b/acrarium/src/main/java/com/faendir/acra/ui/view/app/tabs/ReportTab.java index d6d37db..66e77e2 100644 --- a/acrarium/src/main/java/com/faendir/acra/ui/view/app/tabs/ReportTab.java +++ b/acrarium/src/main/java/com/faendir/acra/ui/view/app/tabs/ReportTab.java @@ -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; diff --git a/acrarium/src/main/java/com/faendir/acra/ui/view/app/tabs/StatisticsTab.java b/acrarium/src/main/java/com/faendir/acra/ui/view/app/tabs/StatisticsTab.java index b0fb0c8..fd952b9 100644 --- a/acrarium/src/main/java/com/faendir/acra/ui/view/app/tabs/StatisticsTab.java +++ b/acrarium/src/main/java/com/faendir/acra/ui/view/app/tabs/StatisticsTab.java @@ -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; diff --git a/acrarium/src/main/java/com/faendir/acra/ui/view/bug/tabs/ReportTab.java b/acrarium/src/main/java/com/faendir/acra/ui/view/bug/tabs/ReportTab.java index f2203b0..8a7edb6 100644 --- a/acrarium/src/main/java/com/faendir/acra/ui/view/bug/tabs/ReportTab.java +++ b/acrarium/src/main/java/com/faendir/acra/ui/view/bug/tabs/ReportTab.java @@ -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; diff --git a/acrarium/src/main/java/com/faendir/acra/ui/view/bug/tabs/StatisticsTab.java b/acrarium/src/main/java/com/faendir/acra/ui/view/bug/tabs/StatisticsTab.java index eed4213..972e297 100644 --- a/acrarium/src/main/java/com/faendir/acra/ui/view/bug/tabs/StatisticsTab.java +++ b/acrarium/src/main/java/com/faendir/acra/ui/view/bug/tabs/StatisticsTab.java @@ -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; diff --git a/acrarium/src/main/java/com/faendir/acra/ui/view/report/ReportView.java b/acrarium/src/main/java/com/faendir/acra/ui/view/report/ReportView.java index df4f264..b9380e0 100644 --- a/acrarium/src/main/java/com/faendir/acra/ui/view/report/ReportView.java +++ b/acrarium/src/main/java/com/faendir/acra/ui/view/report/ReportView.java @@ -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; diff --git a/acrarium/src/main/java/com/faendir/acra/ui/view/user/UserManager.java b/acrarium/src/main/java/com/faendir/acra/ui/view/user/UserManager.java index 5dd662a..3bfd7ec 100644 --- a/acrarium/src/main/java/com/faendir/acra/ui/view/user/UserManager.java +++ b/acrarium/src/main/java/com/faendir/acra/ui/view/user/UserManager.java @@ -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 implements HasAcrariumTit protected void onAttach(AttachEvent attachEvent) { super.onAttach(attachEvent); getContent().removeAll(); - MyGrid userGrid = new MyGrid<>(userService.getUserProvider()); + Grid 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));