From a9c83ba07e4dec90eb7d6e332b91adde9613ebb4 Mon Sep 17 00:00:00 2001 From: Ahmed Ashour Date: Fri, 20 Oct 2017 10:10:02 +0200 Subject: Use .toLowerCase and .toUpperCase(Locale.ROOT) (#10182) * Use .toLowerCase and .toUpperCase(Locale.ROOT) * Spaces * add spaces after if( --- .../src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java | 12 +++++++----- .../src/main/java/com/vaadin/v7/client/ui/VScrollTable.java | 11 ++++++----- .../com/vaadin/v7/client/ui/combobox/ComboBoxConnector.java | 6 ++++-- 3 files changed, 17 insertions(+), 12 deletions(-) (limited to 'compatibility-client/src/main/java/com') diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java index bbbf33f5a4..0d1830e829 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java @@ -21,6 +21,7 @@ import java.util.Collection; import java.util.Date; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Set; import com.google.gwt.aria.client.Roles; @@ -934,7 +935,7 @@ public class VFilterSelect extends Composite private void setTdWidth(Node parent, int width) { for (int i = 0; i < parent.getChildCount(); i++) { Node child = parent.getChild(i); - if ("td".equals(child.getNodeName().toLowerCase())) { + if ("td".equals(child.getNodeName().toLowerCase(Locale.ROOT))) { ((Element) child).getStyle().setWidth(width, Unit.PX); } else { setTdWidth(child, width); @@ -1204,10 +1205,11 @@ public class VFilterSelect extends Composite } } else if (item != null && !"".equals(lastFilter) && (filteringmode == FilteringMode.CONTAINS - ? item.getText().toLowerCase() - .contains(lastFilter.toLowerCase()) - : item.getText().toLowerCase() - .startsWith(lastFilter.toLowerCase()))) { + ? item.getText().toLowerCase(Locale.ROOT).contains( + lastFilter.toLowerCase(Locale.ROOT)) + : item.getText().toLowerCase(Locale.ROOT) + .startsWith(lastFilter + .toLowerCase(Locale.ROOT)))) { doItemAction(item, true); } else { // currentSuggestion has key="" for nullselection diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java index af255c4e5b..16817fd82d 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java @@ -23,6 +23,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.logging.Level; @@ -5904,8 +5905,8 @@ public class VScrollTable extends FlowPanel TooltipInfo info = null; final Element targetTdOrTr = getTdOrTr(target); - if (targetTdOrTr != null && "td" - .equals(targetTdOrTr.getTagName().toLowerCase())) { + if (targetTdOrTr != null && "td".equals( + targetTdOrTr.getTagName().toLowerCase(Locale.ROOT))) { TableCellElement td = (TableCellElement) targetTdOrTr .cast(); info = cellToolTips.get(td); @@ -7593,7 +7594,7 @@ public class VScrollTable extends FlowPanel && row.rowKey == lastEmphasized.overkey) { String stylename = ROWSTYLEBASE + lastEmphasized.dropLocation.toString() - .toLowerCase(); + .toLowerCase(Locale.ROOT); VScrollTableRow.setStyleName(row.getElement(), stylename, false); lastEmphasized = null; @@ -7614,8 +7615,8 @@ public class VScrollTable extends FlowPanel for (Widget w : scrollBody.renderedRows) { VScrollTableRow row = (VScrollTableRow) w; if (details != null && details.overkey == row.rowKey) { - String stylename = ROWSTYLEBASE - + details.dropLocation.toString().toLowerCase(); + String stylename = ROWSTYLEBASE + details.dropLocation + .toString().toLowerCase(Locale.ROOT); VScrollTableRow.setStyleName(row.getElement(), stylename, true); lastEmphasized = details; diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/combobox/ComboBoxConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/combobox/ComboBoxConnector.java index b3b4405a1b..e064eb9dad 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/combobox/ComboBoxConnector.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/combobox/ComboBoxConnector.java @@ -17,6 +17,7 @@ package com.vaadin.v7.client.ui.combobox; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler.ScheduledCommand; @@ -202,8 +203,9 @@ public class ComboBoxConnector extends AbstractFieldConnector } } - if ((getWidget().waitingForFilteringResponse && getWidget().lastFilter - .toLowerCase().equals(uidl.getStringVariable("filter"))) + if ((getWidget().waitingForFilteringResponse + && getWidget().lastFilter.toLowerCase(Locale.ROOT) + .equals(uidl.getStringVariable("filter"))) || popupOpenAndCleared) { getWidget().suggestionPopup.showSuggestions( -- cgit v1.2.3