Skip to content

Commit

Permalink
0004943: Continued Vaadin 14 upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-miller-jumpmind committed May 3, 2021
1 parent 7a52331 commit 2a1c907
Show file tree
Hide file tree
Showing 26 changed files with 136 additions and 134 deletions.
Expand Up @@ -52,9 +52,9 @@
import com.vaadin.server.VaadinServlet;
import com.vaadin.shared.Position;
import com.vaadin.flow.component.button.Button;
import com.vaadin.ui.Grid;
import com.vaadin.ui.Grid.Column;
import com.vaadin.ui.Grid.SelectionMode;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.grid.Grid.Column;
import com.vaadin.flow.component.grid.Grid.SelectionMode;
import com.vaadin.flow.component.html.Span;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Notification.Type;
Expand All @@ -76,9 +76,9 @@ private CommonUiUtils() {

public static void styleTabSheet(TabSheet tabSheet) {
tabSheet.setSizeFull();
tabSheet.addStyleName(ValoTheme.TABSHEET_FRAMED);
tabSheet.addStyleName(ValoTheme.TABSHEET_COMPACT_TABBAR);
tabSheet.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR);
tabSheet.addClassName(ValoTheme.TABSHEET_FRAMED);
tabSheet.addClassName(ValoTheme.TABSHEET_COMPACT_TABBAR);
tabSheet.addClassName(ValoTheme.TABSHEET_PADDED_TABBAR);
}

public static TabSheet createTabSheet() {
Expand All @@ -96,7 +96,7 @@ public static Button createPrimaryButton(String name, Button.ClickListener liste
if (listener != null) {
button.addClickListener(listener);
}
button.addStyleName(ValoTheme.BUTTON_PRIMARY);
button.addClassName(ValoTheme.BUTTON_PRIMARY);
return button;
}

Expand Down Expand Up @@ -135,7 +135,7 @@ public static void notify(String caption, String message, Type type) {
}

public static void notify(String caption, String message, Throwable ex, Type type) {
Page page = Page.getCurrent();
Page page = UI.getCurrent().getPage();
if (page != null) {
Notification notification = new Notification(caption, contactWithLineFeed(FormatUtils.wordWrap(message, 150)),
Type.HUMANIZED_MESSAGE);
Expand All @@ -149,7 +149,7 @@ public static void notify(String caption, String message, Throwable ex, Type typ
style = ValoTheme.NOTIFICATION_WARNING;
}
notification.setStyleName(notification.getStyleName() + " " + ValoTheme.NOTIFICATION_CLOSABLE + " " + style);
notification.show(Page.getCurrent());
notification.show(UI.getCurrent().getPage());
}
}

Expand Down Expand Up @@ -205,7 +205,7 @@ public static Grid<List<Object>> putResultsInGrid(final ResultSet rs, int maxRes
if (rs != null) {
grid.addColumn(row -> {
return outerList.indexOf(row) + 1;
}).setCaption("#").setId("#").setHidden(!showRowNumbers).setStyleGenerator(row -> {
}).setCaption("#").setId("#").setHidden(!showRowNumbers).setClassNameGenerator(row -> {
if (!grid.getSelectedItems().contains(row)) {
return "rowheader";
}
Expand All @@ -230,7 +230,7 @@ public static Grid<List<Object>> putResultsInGrid(final ResultSet rs, int maxRes

Integer colNum = new Integer(columnCounter[0] - 1 - skipColumnIndexes.size());
grid.addColumn(row -> row.get(colNum)).setId(columnName).setCaption(columnName).setHidable(true)
.setStyleGenerator(row -> {
.setClassNameGenerator(row -> {
if (row.get(colNum) == null) {
return "italics";
}
Expand Down Expand Up @@ -280,11 +280,11 @@ public static Grid<List<Object>> putResultsInGrid(final ResultSet rs, int maxRes
outerList.add(innerList);

if (rowNumber < 100) {
grid.getColumn("#").setWidth(75);
grid.getColumnByKey("#").setWidth(75);
} else if (rowNumber < 1000) {
grid.getColumn("#").setWidth(95);
grid.getColumnByKey("#").setWidth(95);
} else {
grid.getColumn("#").setWidth(115);
grid.getColumnByKey("#").setWidth(115);
}

if (showRowNumbers) {
Expand Down Expand Up @@ -406,8 +406,8 @@ public static String getJdbcTypeValue(String type) {
public static Label createSeparator() {
Label separator = new Label(" ");
separator.setStyleName("vrule");
separator.setHeight(100, Unit.PERCENTAGE);
separator.setWidthUndefined();
separator.setHeightFull();
separator.setWidth(null);
return separator;
}
}
Expand Up @@ -24,14 +24,14 @@

import java.io.Serializable;

import com.vaadin.event.ShortcutAction.KeyCode;
import com.vaadin.flow.component.Key;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.button.Button.ClickEvent;
import com.vaadin.flow.component.button.Button.ClickListener;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.html.Span;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.UI;
import com.vaadin.flow.component.textfield.TextArea;
import com.vaadin.flow.component.UI;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.ui.Window;
import com.vaadin.ui.themes.ValoTheme;
Expand Down Expand Up @@ -67,7 +67,7 @@ public ConfirmDialog(String caption, String text, final IConfirmListener confirm
HorizontalLayout buttonLayout = new HorizontalLayout();
buttonLayout.setStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
buttonLayout.setSpacing(true);
buttonLayout.setWidth(100, Unit.PERCENTAGE);
buttonLayout.setWidthFull();

Label spacer = new Label(" ");
buttonLayout.add(spacer);
Expand Down
Expand Up @@ -8,7 +8,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.vaadin.ui.UI;
import com.vaadin.flow.component.UI;

public class CsvExport {

Expand Down
Expand Up @@ -4,9 +4,9 @@
import java.util.List;
import java.util.stream.Collectors;

import com.vaadin.data.provider.Query;
import com.vaadin.ui.Grid;
import com.vaadin.ui.Grid.Column;
import com.vaadin.flow.data.provider.Query;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.grid.Grid.Column;

public class GridDataProvider implements IDataProvider{

Expand Down
Expand Up @@ -33,7 +33,7 @@
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.html.Span;
import com.vaadin.ui.Notification.Type;
import com.vaadin.ui.UI;
import com.vaadin.flow.component.UI;

public class NotifyDialog extends ResizableWindow {

Expand All @@ -51,7 +51,7 @@ public NotifyDialog(String caption, String text, final Throwable ex, Type type)
setHeight(300, Unit.PIXELS);

final HorizontalLayout messageArea = new HorizontalLayout();
messageArea.addStyleName("v-scrollable");
messageArea.addClassName("v-scrollable");
messageArea.setMargin(true);
messageArea.setSpacing(true);
messageArea.setSizeFull();
Expand Down
Expand Up @@ -24,14 +24,14 @@

import java.io.Serializable;

import com.vaadin.event.ShortcutAction.KeyCode;
import com.vaadin.flow.component.Key;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.button.Button.ClickEvent;
import com.vaadin.flow.component.button.Button.ClickListener;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.ui.UI;
import com.vaadin.flow.component.UI;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.ui.Window;
import com.vaadin.ui.themes.ValoTheme;
Expand Down Expand Up @@ -62,17 +62,17 @@ public PromptDialog(String caption, String text, String defaultValue,
}

final TextField field = new TextField();
field.setWidth(100, Unit.PERCENTAGE);
field.setWidthFull();
field.setValue(defaultValue);
if (defaultValue != null) {
field.setSelection(0, defaultValue.length());
}
layout.add(field);

HorizontalLayout buttonLayout = new HorizontalLayout();
buttonLayout.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
buttonLayout.addClassName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
buttonLayout.setSpacing(true);
buttonLayout.setWidth(100, Unit.PERCENTAGE);
buttonLayout.setWidthFull();

Label spacer = new Label(" ");
buttonLayout.add(spacer);
Expand Down
Expand Up @@ -51,15 +51,15 @@
import com.vaadin.server.Resource;
import com.vaadin.server.StreamResource;
import com.vaadin.server.StreamResource.StreamSource;
import com.vaadin.ui.Alignment;
import com.vaadin.flow.component.orderedlayout.FlexComponent.Alignment;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.button.Button.ClickEvent;
import com.vaadin.flow.component.button.Button.ClickListener;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.component.select.Select;
import com.vaadin.ui.Notification.Type;
import com.vaadin.ui.TextArea;
import com.vaadin.flow.component.textfield.TextArea;
import com.vaadin.ui.Upload;
import com.vaadin.ui.Upload.Receiver;
import com.vaadin.ui.Upload.SucceededEvent;
Expand Down Expand Up @@ -104,9 +104,9 @@ public ReadOnlyTextAreaDialog(final String title, final String value, Table tabl
add(wrapper, 1);

buttonLayout = new HorizontalLayout();
buttonLayout.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
buttonLayout.addClassName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
buttonLayout.setSpacing(true);
buttonLayout.setWidth(100, Unit.PERCENTAGE);
buttonLayout.setWidthFull();
add(buttonLayout);

if (value != null && isEncodedInHex) {
Expand Down
Expand Up @@ -23,7 +23,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.vaadin.event.ShortcutAction.KeyCode;
import com.vaadin.flow.component.Key;
import com.vaadin.event.ShortcutAction.ModifierKey;
import com.vaadin.event.ShortcutListener;
import com.vaadin.server.Page;
Expand All @@ -34,7 +34,7 @@
import com.vaadin.ui.Component;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.html.Span;
import com.vaadin.ui.UI;
import com.vaadin.flow.component.UI;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.ui.Window;
import com.vaadin.ui.themes.ValoTheme;
Expand Down Expand Up @@ -105,7 +105,7 @@ protected void addComponents(Component... components) {

protected Button buildCloseButton() {
Button closeButton = new Button("Close");
closeButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
closeButton.addClassName(ValoTheme.BUTTON_PRIMARY);
closeButton.addClickListener(new CloseButtonListener());
closeButton.focus();
return closeButton;
Expand All @@ -120,7 +120,7 @@ protected HorizontalLayout buildButtonFooter(Button[] toTheLeftButtons, Button..

footer.setWidth("100%");
footer.setSpacing(true);
footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
footer.addClassName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);

if (toTheLeftButtons != null) {
footer.addComponents(toTheLeftButtons);
Expand Down Expand Up @@ -156,7 +156,7 @@ public void show() {
}

public void showAtSize(double percentOfBrowserSize) {
Page page = Page.getCurrent();
Page page = UI.getCurrent().getPage();

setWindowMode(WindowMode.NORMAL);

Expand Down
Expand Up @@ -55,10 +55,10 @@ public void selectedTabChange(SelectedTabChangeEvent event) {
public void onTabClose(TabSheet tabsheet, Component tabContent) {
if (tabContent instanceof IUiPanel) {
if (((IUiPanel)tabContent).closing()) {
tabsheet.removeComponent(tabContent);
tabsheet.remove(tabContent);
}
} else {
tabsheet.removeComponent(tabContent);
tabsheet.remove(tabContent);
}
}
});
Expand Down
Expand Up @@ -18,13 +18,13 @@

import com.vaadin.ui.AbstractLayout;
import com.vaadin.ui.Component;
import com.vaadin.ui.Grid;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.TabSheet.SelectedTabChangeEvent;
import com.vaadin.ui.TabSheet.SelectedTabChangeListener;
import com.vaadin.ui.TabSheet.Tab;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.ui.Grid.SelectionMode;
import com.vaadin.flow.component.grid.Grid.SelectionMode;

public class DatabaseInfoPanel extends VerticalLayout implements IInfoPanel {

Expand Down
Expand Up @@ -41,18 +41,18 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.vaadin.event.ShortcutAction.KeyCode;
import com.vaadin.flow.component.Key;
import com.vaadin.server.FileDownloader;
import com.vaadin.server.StreamResource;
import com.vaadin.server.StreamResource.StreamSource;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.button.Button.ClickEvent;
import com.vaadin.flow.component.checkbox.Checkbox;
import com.vaadin.flow.component.combobox.ComboBox;
import com.vaadin.ui.FormLayout;
import com.vaadin.flow.component.formlayout.FormLayout;
import com.vaadin.flow.component.html.Span;
import com.vaadin.ui.RadioButtonGroup;
import com.vaadin.ui.TextArea;
import com.vaadin.flow.component.radiobutton.RadioButtonGroup;
import com.vaadin.flow.component.textfield.TextArea;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.ui.themes.ValoTheme;

Expand Down Expand Up @@ -150,7 +150,7 @@ protected void selectionChanged() {

protected void addButtons() {
selectAllLink = new Button("Select All");
selectAllLink.addStyleName(ValoTheme.BUTTON_LINK);
selectAllLink.addClassName(ValoTheme.BUTTON_LINK);
selectAllLink.addClickListener(new Button.ClickListener() {
private static final long serialVersionUID = 1L;

Expand All @@ -160,7 +160,7 @@ public void buttonClick(ClickEvent event) {
});

selectNoneLink = new Button("Select None");
selectNoneLink.addStyleName(ValoTheme.BUTTON_LINK);
selectNoneLink.addClassName(ValoTheme.BUTTON_LINK);
selectNoneLink.addClickListener(new Button.ClickListener() {
private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -237,7 +237,7 @@ public void buttonClick(ClickEvent event) {

protected void createOptionLayout() {
optionLayout = new VerticalLayout();
optionLayout.addStyleName("v-scrollable");
optionLayout.addClassName("v-scrollable");
optionLayout.setMargin(true);
optionLayout.setSpacing(true);
optionLayout.setSizeFull();
Expand Down Expand Up @@ -312,7 +312,7 @@ protected void createOptionLayout() {
formLayout.add(quotedIdentifiers);

whereClauseField = new TextArea("Where Clause");
whereClauseField.setWidth(100, Unit.PERCENTAGE);
whereClauseField.setWidthFull();
whereClauseField.setRows(2);
formLayout.add(whereClauseField);

Expand Down Expand Up @@ -355,7 +355,7 @@ protected void setExportButtonsEnabled() {
}

protected void previous() {
content.removeComponent(optionLayout);
content.remove(optionLayout);
content.add(tableSelectionLayout, 0);
content.setExpandRatio(tableSelectionLayout, 1);
previousButton.setVisible(false);
Expand All @@ -374,7 +374,7 @@ protected void previous() {
}

protected void next() {
content.removeComponent(tableSelectionLayout);
content.remove(tableSelectionLayout);
content.add(optionLayout, 0);
content.setExpandRatio(optionLayout, 1);
nextButton.setVisible(false);
Expand Down

0 comments on commit 2a1c907

Please sign in to comment.