diff options
author | Ahmed Ashour <asashour@yahoo.com> | 2017-11-06 15:17:04 +0100 |
---|---|---|
committer | Pekka Maanpää <pekkamaa@vaadin.com> | 2017-11-06 16:17:04 +0200 |
commit | c58c7e7a2329011e70ad3afeb11b1a667eb6bf37 (patch) | |
tree | e6b15d565dc23c8004cb9de44720e22f35dae837 /compatibility-client/src/main/java | |
parent | cd9b32a99047a28f4999b404bb631a5d723ca0d9 (diff) | |
download | vaadin-framework-c58c7e7a2329011e70ad3afeb11b1a667eb6bf37.tar.gz vaadin-framework-c58c7e7a2329011e70ad3afeb11b1a667eb6bf37.zip |
Use Logger instead of VConsole (#10249)
Because VConsole is deprecated and it recommends using Logger instead
Diffstat (limited to 'compatibility-client/src/main/java')
9 files changed, 66 insertions, 28 deletions
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCalendarPanel.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCalendarPanel.java index f8c5187280..c692087455 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCalendarPanel.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCalendarPanel.java @@ -17,6 +17,7 @@ package com.vaadin.v7.client.ui; import java.util.Date; +import java.util.logging.Logger; import com.google.gwt.aria.client.Roles; import com.google.gwt.aria.client.SelectedValue; @@ -53,7 +54,6 @@ import com.google.gwt.user.client.ui.ListBox; import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.BrowserInfo; import com.vaadin.client.DateTimeService; -import com.vaadin.client.VConsole; import com.vaadin.client.WidgetUtil; import com.vaadin.client.ui.FocusableFlexTable; import com.vaadin.client.ui.SubPartAware; @@ -331,7 +331,7 @@ public class VCalendarPanel extends FocusableFlexTable implements selectDate(focusedDate); } else { - VConsole.log("Trying to select a the focused date which is NULL!"); + getLogger().info("Trying to select a the focused date which is NULL!"); } } @@ -2247,4 +2247,8 @@ public class VCalendarPanel extends FocusableFlexTable implements } } } + + private static Logger getLogger() { + return Logger.getLogger(VCalendarPanel.class.getName()); + } } 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 064bdeb8cb..ccdc5c642b 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 @@ -23,6 +23,7 @@ import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Set; +import java.util.logging.Logger; import com.google.gwt.aria.client.Roles; import com.google.gwt.core.client.JavaScriptObject; @@ -73,7 +74,6 @@ import com.vaadin.client.ConnectorMap; import com.vaadin.client.DeferredWorker; import com.vaadin.client.Focusable; import com.vaadin.client.UIDL; -import com.vaadin.client.VConsole; import com.vaadin.client.WidgetUtil; import com.vaadin.client.ui.Field; import com.vaadin.client.ui.Icon; @@ -2048,7 +2048,7 @@ public class VFilterSelect extends Composite private void debug(String string) { if (enableDebug) { - VConsole.error(string); + getLogger().severe(string); } } @@ -2660,4 +2660,7 @@ public class VFilterSelect extends Composite return explicitSelectedCaption; } + private static Logger getLogger() { + return Logger.getLogger(VFilterSelect.class.getName()); + } } diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VPopupCalendar.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VPopupCalendar.java index 8f6131593b..1f071bc597 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VPopupCalendar.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VPopupCalendar.java @@ -17,6 +17,7 @@ package com.vaadin.v7.client.ui; import java.util.Date; +import java.util.logging.Logger; import com.google.gwt.aria.client.Id; import com.google.gwt.aria.client.LiveValue; @@ -47,7 +48,6 @@ import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.BrowserInfo; import com.vaadin.client.ComputedStyle; -import com.vaadin.client.VConsole; import com.vaadin.client.ui.VOverlay; import com.vaadin.client.ui.aria.AriaHelper; import com.vaadin.v7.client.ui.VCalendarPanel.FocusOutListener; @@ -406,7 +406,7 @@ public class VPopupCalendar extends VTextualDate popup.setHeight(""); popup.setPopupPositionAndShow(new PopupPositionCallback()); } else { - VConsole.error("Cannot reopen popup, it is already open!"); + getLogger().severe("Cannot reopen popup, it is already open!"); } } @@ -715,4 +715,7 @@ public class VPopupCalendar extends VTextualDate } } + private static Logger getLogger() { + return Logger.getLogger(VPopupCalendar.class.getName()); + } } 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 85e80fd928..685c5634f4 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 @@ -90,7 +90,6 @@ import com.vaadin.client.StyleConstants; import com.vaadin.client.TooltipInfo; import com.vaadin.client.UIDL; import com.vaadin.client.Util; -import com.vaadin.client.VConsole; import com.vaadin.client.VTooltip; import com.vaadin.client.WidgetUtil; import com.vaadin.client.ui.Action; @@ -1033,7 +1032,7 @@ public class VScrollTable extends FlowPanel if (prev != null) { return setRowFocus(prev); } else { - VConsole.log("no previous available"); + getLogger().info("no previous available"); } } } @@ -2634,7 +2633,7 @@ public class VScrollTable extends FlowPanel if (client.getMessageSender().hasActiveRequest() || navKeyDown) { // if client connection is busy, don't bother loading it more - VConsole.log("Postponed rowfetch"); + getLogger().info("Postponed rowfetch"); schedule(250); } else if (allRenderedRowsAreNew() && !updatedReqRows) { @@ -4789,7 +4788,7 @@ public class VScrollTable extends FlowPanel public void setLastRendered(int lastRendered) { if (totalRows >= 0 && lastRendered > totalRows) { - VConsole.log("setLastRendered: " + this.lastRendered + " -> " + getLogger().info("setLastRendered: " + this.lastRendered + " -> " + lastRendered); this.lastRendered = totalRows - 1; } else { @@ -8183,7 +8182,7 @@ public class VScrollTable extends FlowPanel if (currentlyFocusedRow != null) { setRowFocus(currentlyFocusedRow); } else { - VConsole.log("no row?"); + getLogger().info("no row?"); focusRowFromBody(); } scrollBody.ensureFocus(); @@ -8258,7 +8257,7 @@ public class VScrollTable extends FlowPanel private void debug(String msg) { if (enableDebug) { - VConsole.error(msg); + getLogger().severe(msg); } } diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTextualDate.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTextualDate.java index f28e62ac55..7959ab0303 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTextualDate.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTextualDate.java @@ -17,6 +17,8 @@ package com.vaadin.v7.client.ui; import java.util.Date; +import java.util.logging.Level; +import java.util.logging.Logger; import com.google.gwt.aria.client.Roles; import com.google.gwt.event.dom.client.BlurEvent; @@ -33,7 +35,6 @@ import com.vaadin.client.BrowserInfo; import com.vaadin.client.Focusable; import com.vaadin.client.LocaleNotLoadedException; import com.vaadin.client.LocaleService; -import com.vaadin.client.VConsole; import com.vaadin.client.ui.SubPartAware; import com.vaadin.client.ui.aria.AriaHelper; import com.vaadin.client.ui.aria.HandlesAriaCaption; @@ -163,7 +164,8 @@ public class VTextualDate extends VDateField } catch (LocaleNotLoadedException e) { // TODO should die instead? Can the component survive // without format string? - VConsole.error(e); + getLogger().log(Level.SEVERE, + e.getMessage() == null ? "" : e.getMessage(), e); } } } @@ -261,7 +263,8 @@ public class VTextualDate extends VDateField // remove possibly added invalid value indication removeStyleName(getStylePrimaryName() + PARSE_ERROR_CLASSNAME); } catch (final Exception e) { - VConsole.log(e); + getLogger().log(Level.INFO, + e.getMessage() == null ? "" : e.getMessage(), e); addStyleName(getStylePrimaryName() + PARSE_ERROR_CLASSNAME); // this is a hack that may eventually be removed @@ -407,4 +410,8 @@ public class VTextualDate extends VDateField onChange(null); } } + + private static Logger getLogger() { + return Logger.getLogger(VTextualDate.class.getName()); + } } diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VUpload.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VUpload.java index 78d4063cfe..16f87db8ca 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VUpload.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VUpload.java @@ -16,6 +16,8 @@ package com.vaadin.v7.client.ui; +import java.util.logging.Logger; + import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler.ScheduledCommand; @@ -38,7 +40,6 @@ import com.vaadin.client.ApplicationConnection; import com.vaadin.client.BrowserInfo; import com.vaadin.client.ConnectorMap; import com.vaadin.client.StyleConstants; -import com.vaadin.client.VConsole; import com.vaadin.client.ui.VButton; import com.vaadin.v7.client.ui.upload.UploadConnector; import com.vaadin.v7.client.ui.upload.UploadIFrameOnloadStrategy; @@ -248,7 +249,7 @@ public class VUpload extends SimplePanel { if (t != null) { t.cancel(); } - VConsole.log("VUpload:Submit complete"); + getLogger().info("VUpload:Submit complete"); if (isAttached()) { // no need to call poll() if component is already // detached #8728 @@ -296,7 +297,7 @@ public class VUpload extends SimplePanel { // Only visit the server if the upload has not already // finished if (thisUploadId == nextUploadId) { - VConsole.log( + getLogger().info( "Visiting server to see if upload started event changed UI."); client.updateVariable(paintableId, "pollForStart", thisUploadId, true); @@ -311,11 +312,11 @@ public class VUpload extends SimplePanel { /** For internal use only. May be removed or replaced in the future. */ public void submit() { if (submitted || !enabled) { - VConsole.log("Submit cancelled (disabled or already submitted)"); + getLogger().info("Submit cancelled (disabled or already submitted)"); return; } if (fu.getFilename().isEmpty()) { - VConsole.log("Submitting empty selection (no file)"); + getLogger().info("Submitting empty selection (no file)"); } // flush possibly pending variable changes, so they will be handled // before upload @@ -394,4 +395,7 @@ public class VUpload extends SimplePanel { } } + private static Logger getLogger() { + return Logger.getLogger(VUpload.class.getName()); + } } diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/CalendarConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/CalendarConnector.java index a9e5341206..40ad42f3ba 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/CalendarConnector.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/CalendarConnector.java @@ -22,6 +22,8 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; import com.google.gwt.core.shared.GWT; import com.google.gwt.dom.client.Element; @@ -35,7 +37,6 @@ import com.vaadin.client.ApplicationConnection; import com.vaadin.client.Paintable; import com.vaadin.client.TooltipInfo; import com.vaadin.client.UIDL; -import com.vaadin.client.VConsole; import com.vaadin.client.WidgetUtil; import com.vaadin.client.communication.RpcProxy; import com.vaadin.client.communication.StateChangeEvent; @@ -514,7 +515,7 @@ public class CalendarConnector extends AbstractLegacyComponentConnector actionStartDate = getActionStartDate(actionKey); actionEndDate = getActionEndDate(actionKey); } catch (ParseException pe) { - VConsole.error("Failed to parse action date"); + getLogger().severe("Failed to parse action date"); continue; } @@ -666,7 +667,8 @@ public class CalendarConnector extends AbstractLegacyComponentConnector a.setActionStartDate(getActionStartDate(actionKey)); a.setActionEndDate(getActionEndDate(actionKey)); } catch (ParseException pe) { - VConsole.error(pe); + getLogger().log(Level.SEVERE, + pe.getMessage() == null ? "" : pe.getMessage(), pe); } actions.add(a); @@ -741,4 +743,8 @@ public class CalendarConnector extends AbstractLegacyComponentConnector getWidget().setSizeForChildren(width, height); } + + private static Logger getLogger() { + return Logger.getLogger(CalendarConnector.class.getName()); + } } diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/datefield/AbstractDateFieldConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/datefield/AbstractDateFieldConnector.java index 8f0f9bf1b7..231c0fcc5e 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/datefield/AbstractDateFieldConnector.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/datefield/AbstractDateFieldConnector.java @@ -16,12 +16,13 @@ package com.vaadin.v7.client.ui.datefield; import java.util.Date; +import java.util.logging.Level; +import java.util.logging.Logger; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.LocaleNotLoadedException; import com.vaadin.client.Paintable; import com.vaadin.client.UIDL; -import com.vaadin.client.VConsole; import com.vaadin.v7.client.ui.AbstractFieldConnector; import com.vaadin.v7.client.ui.VDateField; import com.vaadin.v7.shared.ui.datefield.DateFieldConstants; @@ -51,10 +52,11 @@ public class AbstractDateFieldConnector extends AbstractFieldConnector getWidget().setCurrentLocale(locale); } catch (final LocaleNotLoadedException e) { getWidget().setCurrentLocale(getWidget().dts.getLocale()); - VConsole.error("Tried to use an unloaded locale \"" + locale + getLogger().severe("Tried to use an unloaded locale \"" + locale + "\". Using default locale (" + getWidget().getCurrentLocale() + ")."); - VConsole.error(e); + getLogger().log(Level.SEVERE, + e.getMessage() == null ? "" : e.getMessage(), e); } } @@ -119,4 +121,8 @@ public class AbstractDateFieldConnector extends AbstractFieldConnector public VDateField getWidget() { return (VDateField) super.getWidget(); } + + private static Logger getLogger() { + return Logger.getLogger(AbstractDateFieldConnector.class.getName()); + } } diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/tree/TreeConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/tree/TreeConnector.java index dd8305b90b..12a4873826 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/tree/TreeConnector.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/tree/TreeConnector.java @@ -19,6 +19,8 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; import com.google.gwt.aria.client.Roles; import com.google.gwt.dom.client.Element; @@ -28,7 +30,6 @@ import com.vaadin.client.BrowserInfo; import com.vaadin.client.Paintable; import com.vaadin.client.TooltipInfo; import com.vaadin.client.UIDL; -import com.vaadin.client.VConsole; import com.vaadin.client.WidgetUtil; import com.vaadin.client.communication.StateChangeEvent; import com.vaadin.shared.MouseEventDetails; @@ -211,7 +212,8 @@ public class TreeConnector extends AbstractLegacyComponentConnector levelProperty = Integer.valueOf(levelPropertyString); } catch (NumberFormatException e) { levelProperty = 1; - VConsole.error(e); + getLogger().log(Level.SEVERE, + e.getMessage() == null ? "" : e.getMessage(), e); } renderChildNodes(rootNode, (Iterator) uidl.iterator(), @@ -392,4 +394,8 @@ public class TreeConnector extends AbstractLegacyComponentConnector WidgetUtil.clearTextSelection(); } + + private static Logger getLogger() { + return Logger.getLogger(TreeConnector.class.getName()); + } } |