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 /client/src | |
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 'client/src')
22 files changed, 159 insertions, 80 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/AbstractClickEventHandler.java b/client/src/main/java/com/vaadin/client/ui/AbstractClickEventHandler.java index 0931c3c8f5..f14b2176c1 100644 --- a/client/src/main/java/com/vaadin/client/ui/AbstractClickEventHandler.java +++ b/client/src/main/java/com/vaadin/client/ui/AbstractClickEventHandler.java @@ -15,6 +15,8 @@ */ package com.vaadin.client.ui; +import java.util.logging.Logger; + import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.event.dom.client.ContextMenuEvent; @@ -31,7 +33,6 @@ import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.user.client.Event; import com.google.gwt.user.client.Event.NativePreviewHandler; import com.vaadin.client.ComponentConnector; -import com.vaadin.client.VConsole; import com.vaadin.client.WidgetUtil; public abstract class AbstractClickEventHandler implements MouseDownHandler, @@ -74,7 +75,7 @@ public abstract class AbstractClickEventHandler implements MouseDownHandler, && elementUnderMouse == lastMouseDownTarget) { mouseUpPreviewMatched = true; } else { - VConsole.log("Ignoring mouseup from " + elementUnderMouse + getLogger().info("Ignoring mouseup from " + elementUnderMouse + " when mousedown was on " + lastMouseDownTarget); } } @@ -238,4 +239,8 @@ public abstract class AbstractClickEventHandler implements MouseDownHandler, return connector.getWidget().getElement(); } + private static Logger getLogger() { + return Logger.getLogger(AbstractClickEventHandler.class.getName()); + } + } diff --git a/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java index 655e184f8c..ea73aa1d93 100644 --- a/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java @@ -15,6 +15,8 @@ */ package com.vaadin.client.ui; +import java.util.logging.Logger; + import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.JsArrayString; import com.google.gwt.dom.client.Element; @@ -40,7 +42,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.WidgetUtil; import com.vaadin.client.WidgetUtil.ErrorUtil; import com.vaadin.client.annotations.OnStateChange; @@ -420,7 +421,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector * TODO Enable this error when all widgets have been fixed to * properly support tabIndex, i.e. implement Focusable */ - // VConsole.error("Tab index received for " + // getLogger().severe("Tab index received for " // + Util.getSimpleName(getWidget()) // + " which does not implement Focusable"); } @@ -511,7 +512,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector if (parent instanceof HasComponentsConnector) { ((HasComponentsConnector) parent).updateCaption(this); } else if (parent == null && !(this instanceof UIConnector)) { - VConsole.error("Parent of connector " + getLogger().severe("Parent of connector " + Util.getConnectorString(this) + " is null. This is typically an indication of a broken component hierarchy"); } @@ -760,7 +761,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector // at this point. if (getWidget() != null && getWidget().isAttached()) { getWidget().removeFromParent(); - VConsole.error( + getLogger().severe( "Widget is still attached to the DOM after the connector (" + Util.getConnectorString(this) + ") has been unregistered. Widget was removed."); @@ -879,4 +880,8 @@ public abstract class AbstractComponentConnector extends AbstractConnector public void onDropTargetDetached() { } -}
\ No newline at end of file + + private static Logger getLogger() { + return Logger.getLogger(AbstractComponentConnector.class.getName()); + } +} diff --git a/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java b/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java index 7f58bf35a3..a5b387871b 100644 --- a/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java @@ -21,6 +21,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.logging.Logger; import com.google.gwt.core.client.JsArrayString; import com.google.gwt.dom.client.Element; @@ -35,7 +36,6 @@ import com.vaadin.client.JsArrayObject; import com.vaadin.client.Profiler; import com.vaadin.client.ServerConnector; import com.vaadin.client.Util; -import com.vaadin.client.VConsole; import com.vaadin.client.communication.RpcProxy; import com.vaadin.client.communication.StateChangeEvent; import com.vaadin.client.communication.StateChangeEvent.StateChangeHandler; @@ -310,7 +310,7 @@ public abstract class AbstractConnector public void onStateChanged(StateChangeEvent stateChangeEvent) { Profiler.enter("AbstractConnector.onStateChanged"); if (debugLogging) { - VConsole.log("State change event for " + getLogger().info("State change event for " + Util.getConnectorString(stateChangeEvent.getConnector()) + " received by " + Util.getConnectorString(this)); } @@ -356,7 +356,7 @@ public abstract class AbstractConnector @Override public void onUnregister() { if (debugLogging) { - VConsole.log( + getLogger().info( "Unregistered connector " + Util.getConnectorString(this)); } } @@ -530,4 +530,8 @@ public abstract class AbstractConnector } this.tag = tag; } + + private static Logger getLogger() { + return Logger.getLogger(AbstractConnector.class.getName()); + } } diff --git a/client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java b/client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java index 185b93c8a8..fb52c644a0 100644 --- a/client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java +++ b/client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java @@ -19,6 +19,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; +import java.util.logging.Logger; import com.google.gwt.animation.client.Animation; import com.google.gwt.core.client.Duration; @@ -38,7 +39,6 @@ import com.google.gwt.user.client.Event.NativePreviewEvent; import com.google.gwt.user.client.Event.NativePreviewHandler; import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.BrowserInfo; -import com.vaadin.client.VConsole; /** * Provides one finger touch scrolling for elements with once scrollable @@ -173,7 +173,7 @@ public class TouchScrollDelegate implements NativePreviewHandler { } public void debug(Element e) { - VConsole.log("Classes: " + e.getClassName() + " overflow: " + getLogger().info("Classes: " + e.getClassName() + " overflow: " + e.getStyle().getProperty("overflow") + " w-o-s: " + e.getStyle().getProperty("WebkitOverflowScrolling")); } @@ -311,7 +311,7 @@ public class TouchScrollDelegate implements NativePreviewHandler { } Touch touch = nativeEvent.getTouches().get(0); if (detectScrolledElement(touch)) { - VConsole.log("TouchDelegate takes over"); + getLogger().info("TouchDelegate takes over"); nativeEvent.stopPropagation(); handlerRegistration = Event.addNativePreviewHandler(this); activeScrollDelegate = this; @@ -321,7 +321,7 @@ public class TouchScrollDelegate implements NativePreviewHandler { nextEvent = 1; origScrollTop = getScrollTop(); - VConsole.log("ST" + origScrollTop); + getLogger().info("ST" + origScrollTop); moved = false; // event.preventDefault(); @@ -357,7 +357,7 @@ public class TouchScrollDelegate implements NativePreviewHandler { if (time <= 0) { time = 1; // get animation and transition end event } - VConsole.log("Animate " + time + " " + from + " " + to); + getLogger().info("Animate " + time + " " + from + " " + to); int translateTo = -to + origScrollTop; int fromY = -from + origScrollTop; if (ANDROID_WITH_BROKEN_SCROLL_TOP) { @@ -433,7 +433,7 @@ public class TouchScrollDelegate implements NativePreviewHandler { private void onTouchMove(NativeEvent event) { if (!moved) { double l = (getTimeStamp() - eventTimeStamps[0]); - VConsole.log(l + " ms from start to move"); + getLogger().info(l + " ms from start to move"); } boolean handleMove = readPositionAndSpeed(event); if (handleMove) { @@ -527,22 +527,22 @@ public class TouchScrollDelegate implements NativePreviewHandler { double pixelsPerMs = calculateSpeed(); // we are currently within scrollable area, calculate pixels that // we'll move due to momentum - VConsole.log("pxPerMs" + pixelsPerMs); + getLogger().info("pxPerMs" + pixelsPerMs); pixelsToMove = (int) (0.5 * pixelsPerMs * pixelsPerMs / FRICTION); if (pixelsPerMs < 0) { pixelsToMove = -pixelsToMove; } - // VConsole.log("pixels to move" + pixelsToMove); + // getLogger().info("pixels to move" + pixelsToMove); finalY = currentY + pixelsToMove; if (finalY > maxFinalY + getMaxOverScroll()) { - // VConsole.log("To max overscroll"); + // getLogger().info("To max overscroll"); finalY = getMaxFinalY() + getMaxOverScroll(); int fixedPixelsToMove = finalY - currentY; pixelsToMove = fixedPixelsToMove; } else if (finalY < 0 - getMaxOverScroll()) { - // VConsole.log("to min overscroll"); + // getLogger().info("to min overscroll"); finalY = -getMaxOverScroll(); int fixedPixelsToMove = finalY - currentY; pixelsToMove = fixedPixelsToMove; @@ -556,13 +556,13 @@ public class TouchScrollDelegate implements NativePreviewHandler { duration = getAnimationTimeForDistance(pixelsToMove); } if (duration > MAX_DURATION) { - VConsole.log("Max animation time. " + duration); + getLogger().info("Max animation time. " + duration); duration = MAX_DURATION; } finalScrollTop = finalY; if (Math.abs(pixelsToMove) < 3 || duration < 20) { - VConsole.log("Small 'momentum' " + pixelsToMove + " | " + duration + getLogger().info("Small 'momentum' " + pixelsToMove + " | " + duration + " Skipping animation,"); moveTransformationToScrolloffset(); return; @@ -579,7 +579,7 @@ public class TouchScrollDelegate implements NativePreviewHandler { private double calculateSpeed() { if (nextEvent < EVENTS_FOR_SPEED_CALC) { - VConsole.log("Not enough data for speed calculation"); + getLogger().info("Not enough data for speed calculation"); // not enough data for decent speed calculation, no momentum :-( return 0; } @@ -701,7 +701,7 @@ public class TouchScrollDelegate implements NativePreviewHandler { } break; default: - VConsole.log("Non touch event:" + event.getNativeEvent().getType()); + getLogger().info("Non touch event:" + event.getNativeEvent().getType()); event.cancel(); break; } @@ -721,4 +721,7 @@ public class TouchScrollDelegate implements NativePreviewHandler { return Duration.currentTimeMillis(); } + private static Logger getLogger() { + return Logger.getLogger(TouchScrollDelegate.class.getName()); + } } diff --git a/client/src/main/java/com/vaadin/client/ui/VAbstractCalendarPanel.java b/client/src/main/java/com/vaadin/client/ui/VAbstractCalendarPanel.java index f29e7544a6..70bec08e4f 100644 --- a/client/src/main/java/com/vaadin/client/ui/VAbstractCalendarPanel.java +++ b/client/src/main/java/com/vaadin/client/ui/VAbstractCalendarPanel.java @@ -19,6 +19,7 @@ package com.vaadin.client.ui; import java.util.Date; import java.util.List; import java.util.function.Predicate; +import java.util.logging.Logger; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -51,7 +52,6 @@ import com.google.gwt.user.client.ui.InlineHTML; 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.shared.util.SharedUtil; @@ -392,7 +392,7 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> 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!"); } } @@ -2017,4 +2017,8 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> } } } + + private static Logger getLogger() { + return Logger.getLogger(VAbstractCalendarPanel.class.getName()); + } } diff --git a/client/src/main/java/com/vaadin/client/ui/VAbstractPopupCalendar.java b/client/src/main/java/com/vaadin/client/ui/VAbstractPopupCalendar.java index 76ebe85c28..d894653609 100644 --- a/client/src/main/java/com/vaadin/client/ui/VAbstractPopupCalendar.java +++ b/client/src/main/java/com/vaadin/client/ui/VAbstractPopupCalendar.java @@ -17,6 +17,7 @@ package com.vaadin.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; @@ -43,7 +44,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.VAbstractCalendarPanel.SubmitListener; import com.vaadin.client.ui.aria.AriaHelper; import com.vaadin.shared.ui.datefield.TextualDateFieldState; @@ -394,7 +394,7 @@ public abstract class VAbstractPopupCalendar<PANEL extends VAbstractCalendarPane 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!"); } } @@ -721,4 +721,7 @@ public abstract class VAbstractPopupCalendar<PANEL extends VAbstractCalendarPane } } + private static Logger getLogger() { + return Logger.getLogger(VAbstractPopupCalendar.class.getName()); + } } diff --git a/client/src/main/java/com/vaadin/client/ui/VAbstractSplitPanel.java b/client/src/main/java/com/vaadin/client/ui/VAbstractSplitPanel.java index a883480df2..3a2a46846e 100644 --- a/client/src/main/java/com/vaadin/client/ui/VAbstractSplitPanel.java +++ b/client/src/main/java/com/vaadin/client/ui/VAbstractSplitPanel.java @@ -18,6 +18,7 @@ package com.vaadin.client.ui; import java.util.Collections; import java.util.List; +import java.util.logging.Logger; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Node; @@ -39,7 +40,6 @@ import com.vaadin.client.BrowserInfo; import com.vaadin.client.ComponentConnector; import com.vaadin.client.ConnectorMap; import com.vaadin.client.LayoutManager; -import com.vaadin.client.VConsole; import com.vaadin.client.WidgetUtil; import com.vaadin.client.ui.TouchScrollDelegate.TouchScrollHandler; import com.vaadin.client.ui.VAbstractSplitPanel.SplitterMoveHandler.SplitterMoveEvent; @@ -138,7 +138,7 @@ public abstract class VAbstractSplitPanel extends ComplexPanel { addDomHandler(event -> { // TODO When does this actually happen?? - VConsole.log("TOUCH CANCEL"); + getLogger().info("TOUCH CANCEL"); }, TouchCancelEvent.getType()); addDomHandler(event -> { Node target = event.getTouches().get(0).getTarget().cast(); @@ -847,4 +847,8 @@ public abstract class VAbstractSplitPanel extends ComplexPanel { touchScrollHandler.addElement(firstContainer); touchScrollHandler.addElement(secondContainer); } + + private static Logger getLogger() { + return Logger.getLogger(VAbstractSplitPanel.class.getName()); + } } diff --git a/client/src/main/java/com/vaadin/client/ui/VAbstractTextualDate.java b/client/src/main/java/com/vaadin/client/ui/VAbstractTextualDate.java index 2fd153c458..6525180903 100644 --- a/client/src/main/java/com/vaadin/client/ui/VAbstractTextualDate.java +++ b/client/src/main/java/com/vaadin/client/ui/VAbstractTextualDate.java @@ -17,6 +17,8 @@ package com.vaadin.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.dom.client.Element; @@ -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.aria.AriaHelper; import com.vaadin.client.ui.aria.HandlesAriaCaption; import com.vaadin.client.ui.aria.HandlesAriaInvalid; @@ -129,7 +130,8 @@ public abstract class VAbstractTextualDate<R extends Enum<R>> } 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); return null; } } @@ -240,7 +242,8 @@ public abstract class VAbstractTextualDate<R extends Enum<R>> // 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); setDate(null); @@ -473,4 +476,8 @@ public abstract class VAbstractTextualDate<R extends Enum<R>> } return DateTimeFormat.getFormat(ISO_DATE_PATTERN); } + + private static Logger getLogger() { + return Logger.getLogger(VAbstractTextualDate.class.getName()); + } } diff --git a/client/src/main/java/com/vaadin/client/ui/VComboBox.java b/client/src/main/java/com/vaadin/client/ui/VComboBox.java index c67c276417..94dff03d9e 100644 --- a/client/src/main/java/com/vaadin/client/ui/VComboBox.java +++ b/client/src/main/java/com/vaadin/client/ui/VComboBox.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.animation.client.AnimationScheduler; import com.google.gwt.aria.client.Roles; @@ -71,7 +72,6 @@ import com.vaadin.client.BrowserInfo; import com.vaadin.client.ComputedStyle; import com.vaadin.client.DeferredWorker; import com.vaadin.client.Focusable; -import com.vaadin.client.VConsole; import com.vaadin.client.WidgetUtil; import com.vaadin.client.ui.aria.AriaHelper; import com.vaadin.client.ui.aria.HandlesAriaCaption; @@ -2197,7 +2197,7 @@ public class VComboBox extends Composite implements Field, KeyDownHandler, private void debug(String string) { if (enableDebug) { - VConsole.error(string); + getLogger().severe(string); } } @@ -2917,4 +2917,8 @@ public class VComboBox extends Composite implements Field, KeyDownHandler, setText(emptySelectionCaption); } } + + private static Logger getLogger() { + return Logger.getLogger(VComboBox.class.getName()); + } } diff --git a/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java b/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java index 3c088236c6..6bfef9a309 100644 --- a/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java +++ b/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java @@ -19,6 +19,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.logging.Logger; import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.JsArrayString; @@ -40,7 +41,6 @@ import com.vaadin.client.ConnectorMap; import com.vaadin.client.LayoutManager; import com.vaadin.client.MouseEventDetailsBuilder; import com.vaadin.client.Util; -import com.vaadin.client.VConsole; import com.vaadin.client.ValueMap; import com.vaadin.client.WidgetUtil; import com.vaadin.client.ui.dd.DDUtil; @@ -188,10 +188,10 @@ public class VDragAndDropWrapper extends VCustomComponent if (dragStartElement == null) { dragStartElement = getDragStartElement(); dragStartElement.setPropertyBoolean(DRAGGABLE, true); - VConsole.log("draggable = " + getLogger().info("draggable = " + dragStartElement.getPropertyBoolean(DRAGGABLE)); hookHtml5DragStart(dragStartElement); - VConsole.log("drag start listeners hooked."); + getLogger().info("drag start listeners hooked."); } } else { dragStartElement = null; @@ -281,7 +281,7 @@ public class VDragAndDropWrapper extends VCustomComponent event.preventDefault(); event.stopPropagation(); } catch (Exception e) { - // VConsole.log("IE9 fails"); + // getLogger().info("IE9 fails"); } return false; } catch (Exception e) { @@ -316,7 +316,7 @@ public class VDragAndDropWrapper extends VCustomComponent event.preventDefault(); event.stopPropagation(); } catch (Exception e) { - // VConsole.log("IE9 fails"); + // getLogger().info("IE9 fails"); } return false; } catch (Exception e) { @@ -355,7 +355,7 @@ public class VDragAndDropWrapper extends VCustomComponent event.preventDefault(); event.stopPropagation(); } catch (Exception e) { - // VConsole.log("IE9 fails"); + // getLogger().info("IE9 fails"); } return false; } @@ -387,7 +387,7 @@ public class VDragAndDropWrapper extends VCustomComponent if (event.isFile(i)) { final int fileId = filecounter++; final VHtml5File file = event.getFile(i); - VConsole.log("Preparing to upload file " + file.getName() + getLogger().info("Preparing to upload file " + file.getName() + " with id " + fileId + ", size=" + file.getSize()); transferable.setData("fi" + fileIndex, "" + fileId); @@ -408,7 +408,7 @@ public class VDragAndDropWrapper extends VCustomComponent event.preventDefault(); event.stopPropagation(); } catch (Exception e) { - // VConsole.log("IE9 fails"); + // getLogger().info("IE9 fails"); } return false; } catch (Exception e) { @@ -701,4 +701,7 @@ public class VDragAndDropWrapper extends VCustomComponent } + private static Logger getLogger() { + return Logger.getLogger(VDragAndDropWrapper.class.getName()); + } } diff --git a/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapperIE.java b/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapperIE.java index a992a068cc..f31af47dba 100644 --- a/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapperIE.java +++ b/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapperIE.java @@ -16,18 +16,19 @@ package com.vaadin.client.ui; +import java.util.logging.Logger; + import com.google.gwt.dom.client.AnchorElement; import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Element; import com.google.gwt.user.client.DOM; -import com.vaadin.client.VConsole; public class VDragAndDropWrapperIE extends VDragAndDropWrapper { private AnchorElement anchor = null; @Override protected com.google.gwt.user.client.Element getDragStartElement() { - VConsole.log("IE get drag start element..."); + getLogger().info("IE get drag start element..."); Element div = getElement(); if (dragStartMode == HTML5) { if (anchor == null) { @@ -36,7 +37,7 @@ public class VDragAndDropWrapperIE extends VDragAndDropWrapper { anchor.setClassName("drag-start"); div.appendChild(anchor); } - VConsole.log("IE get drag start element..."); + getLogger().info("IE get drag start element..."); return anchor.cast(); } else { if (anchor != null) { @@ -92,4 +93,7 @@ public class VDragAndDropWrapperIE extends VDragAndDropWrapper { hookHtml5Events(DOM.asOld(el)); } + private static Logger getLogger() { + return Logger.getLogger(VDragAndDropWrapperIE.class.getName()); + } } diff --git a/client/src/main/java/com/vaadin/client/ui/VEmbedded.java b/client/src/main/java/com/vaadin/client/ui/VEmbedded.java index a6045848a7..f573b41e4f 100644 --- a/client/src/main/java/com/vaadin/client/ui/VEmbedded.java +++ b/client/src/main/java/com/vaadin/client/ui/VEmbedded.java @@ -18,6 +18,7 @@ package com.vaadin.client.ui; import java.util.HashMap; import java.util.Map; +import java.util.logging.Logger; import com.google.gwt.dom.client.Element; import com.google.gwt.user.client.DOM; @@ -29,7 +30,6 @@ import com.vaadin.client.ComponentConnector; import com.vaadin.client.ConnectorMap; import com.vaadin.client.UIDL; import com.vaadin.client.Util; -import com.vaadin.client.VConsole; import com.vaadin.client.WidgetUtil; import com.vaadin.shared.ui.embedded.EmbeddedState; @@ -251,9 +251,12 @@ public class VEmbedded extends HTML { public void onBrowserEvent(Event event) { super.onBrowserEvent(event); if (DOM.eventGetType(event) == Event.ONLOAD) { - VConsole.log("Embeddable onload"); + getLogger().info("Embeddable onload"); Util.notifyParentOfSizeChange(this, true); } } + private static Logger getLogger() { + return Logger.getLogger(VEmbedded.class.getName()); + } } diff --git a/client/src/main/java/com/vaadin/client/ui/VPopupTimeCalendar.java b/client/src/main/java/com/vaadin/client/ui/VPopupTimeCalendar.java index 39ae704651..46889da0e2 100644 --- a/client/src/main/java/com/vaadin/client/ui/VPopupTimeCalendar.java +++ b/client/src/main/java/com/vaadin/client/ui/VPopupTimeCalendar.java @@ -24,11 +24,12 @@ import static com.vaadin.shared.ui.datefield.DateTimeResolution.YEAR; import java.util.Date; import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; import com.google.gwt.core.client.GWT; import com.vaadin.client.LocaleNotLoadedException; import com.vaadin.client.LocaleService; -import com.vaadin.client.VConsole; import com.vaadin.shared.ui.datefield.DateTimeResolution; /** @@ -180,7 +181,8 @@ public class VPopupTimeCalendar extends } 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); return null; } } @@ -202,4 +204,7 @@ public class VPopupTimeCalendar extends return true; } + private static Logger getLogger() { + return Logger.getLogger(VPopupTimeCalendar.class.getName()); + } } diff --git a/client/src/main/java/com/vaadin/client/ui/VPopupView.java b/client/src/main/java/com/vaadin/client/ui/VPopupView.java index 959458132e..a066157169 100644 --- a/client/src/main/java/com/vaadin/client/ui/VPopupView.java +++ b/client/src/main/java/com/vaadin/client/ui/VPopupView.java @@ -19,6 +19,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.Set; +import java.util.logging.Logger; import com.google.gwt.core.client.Scheduler; import com.google.gwt.dom.client.Element; @@ -40,7 +41,6 @@ import com.vaadin.client.ApplicationConnection; import com.vaadin.client.ComponentConnector; import com.vaadin.client.DeferredWorker; import com.vaadin.client.VCaptionWrapper; -import com.vaadin.client.VConsole; import com.vaadin.client.communication.StateChangeEvent; import com.vaadin.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner; import com.vaadin.client.ui.popupview.VisibilityChangeEvent; @@ -292,7 +292,7 @@ public class VPopupView extends HTML @Override public void hide(boolean autoClosed) { - VConsole.log("Hiding popupview"); + getLogger().info("Hiding popupview"); syncChildren(); clearPopupComponentConnector(); hasHadMouseOver = false; @@ -430,4 +430,7 @@ public class VPopupView extends HTML return popupShowInProgress; } + private static Logger getLogger() { + return Logger.getLogger(VPopupView.class.getName()); + } } diff --git a/client/src/main/java/com/vaadin/client/ui/VUI.java b/client/src/main/java/com/vaadin/client/ui/VUI.java index 6ee44aa930..bc837e2331 100644 --- a/client/src/main/java/com/vaadin/client/ui/VUI.java +++ b/client/src/main/java/com/vaadin/client/ui/VUI.java @@ -17,6 +17,7 @@ package com.vaadin.client.ui; import java.util.List; +import java.util.logging.Logger; import com.google.gwt.dom.client.Element; import com.google.gwt.event.dom.client.HasScrollHandlers; @@ -35,7 +36,6 @@ import com.vaadin.client.ConnectorMap; import com.vaadin.client.Focusable; import com.vaadin.client.LayoutManager; import com.vaadin.client.Profiler; -import com.vaadin.client.VConsole; import com.vaadin.client.WidgetUtil; import com.vaadin.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner; import com.vaadin.client.ui.TouchScrollDelegate.TouchScrollHandler; @@ -184,14 +184,14 @@ public class VUI extends SimplePanel implements ResizeHandler, changed = true; connector.getLayoutManager().reportOuterWidth(connector, newWindowWidth); - VConsole.log("New window width: " + windowWidth); + getLogger().info("New window width: " + windowWidth); } if (windowHeight != newWindowHeight) { windowHeight = newWindowHeight; changed = true; connector.getLayoutManager().reportOuterHeight(connector, newWindowHeight); - VConsole.log("New window height: " + windowHeight); + getLogger().info("New window height: " + windowHeight); } Element parentElement = getElement().getParentElement(); if (isMonitoringParentSize() && parentElement != null) { @@ -201,12 +201,12 @@ public class VUI extends SimplePanel implements ResizeHandler, if (parentWidth != newParentWidth) { parentWidth = newParentWidth; changed = true; - VConsole.log("New parent width: " + parentWidth); + getLogger().info("New parent width: " + parentWidth); } if (parentHeight != newParentHeight) { parentHeight = newParentHeight; changed = true; - VConsole.log("New parent height: " + parentHeight); + getLogger().info("New parent height: " + parentHeight); } } if (changed) { @@ -217,7 +217,7 @@ public class VUI extends SimplePanel implements ResizeHandler, * should shrink as the content's size is fixed and would thus not * automatically shrink.) */ - VConsole.log( + getLogger().info( "Running layout functions due to window or parent resize"); // update size to avoid (most) redundant re-layout passes @@ -419,4 +419,7 @@ public class VUI extends SimplePanel implements ResizeHandler, } } + private static Logger getLogger() { + return Logger.getLogger(VUI.class.getName()); + } } diff --git a/client/src/main/java/com/vaadin/client/ui/VUpload.java b/client/src/main/java/com/vaadin/client/ui/VUpload.java index a808f76a7e..16d62ccf42 100644 --- a/client/src/main/java/com/vaadin/client/ui/VUpload.java +++ b/client/src/main/java/com/vaadin/client/ui/VUpload.java @@ -16,6 +16,8 @@ package com.vaadin.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; @@ -35,7 +37,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.upload.UploadConnector; import com.vaadin.client.ui.upload.UploadIFrameOnloadStrategy; import com.vaadin.shared.ui.upload.UploadServerRpc; @@ -258,7 +259,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 @@ -303,7 +304,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); @@ -316,11 +317,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 @@ -399,4 +400,7 @@ public class VUpload extends SimplePanel { } } + private static Logger getLogger() { + return Logger.getLogger(VUpload.class.getName()); + } } diff --git a/client/src/main/java/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java b/client/src/main/java/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java index 3ffd4dddf8..fb060ad326 100644 --- a/client/src/main/java/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java @@ -18,11 +18,12 @@ package com.vaadin.client.ui.datefield; import java.util.Map; import java.util.Optional; import java.util.function.Function; +import java.util.logging.Level; +import java.util.logging.Logger; import java.util.stream.Collectors; import java.util.stream.Stream; import com.vaadin.client.LocaleNotLoadedException; -import com.vaadin.client.VConsole; import com.vaadin.client.communication.StateChangeEvent; import com.vaadin.client.ui.AbstractFieldConnector; import com.vaadin.client.ui.VDateField; @@ -106,10 +107,11 @@ public abstract class AbstractDateFieldConnector<R extends Enum<R>> widget.setCurrentLocale(locale); } catch (final LocaleNotLoadedException e) { widget.setCurrentLocale(widget.dts.getLocale()); - VConsole.error("Tried to use an unloaded locale \"" + locale + getLogger().severe("Tried to use an unloaded locale \"" + locale + "\". Using default locale (" + widget.getCurrentLocale() + ")."); - VConsole.error(e); + getLogger().log(Level.SEVERE, + e.getMessage() == null ? "" : e.getMessage(), e); } // We show week numbers only if the week starts with Monday, as ISO 8601 @@ -130,4 +132,8 @@ public abstract class AbstractDateFieldConnector<R extends Enum<R>> widget.setCurrentDate(getTimeValues()); widget.setDefaultDate(getDefaultValues()); } + + private static Logger getLogger() { + return Logger.getLogger(AbstractDateFieldConnector.class.getName()); + } } diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VDragAndDropManager.java b/client/src/main/java/com/vaadin/client/ui/dd/VDragAndDropManager.java index 4030778d34..ae4b8a7e06 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VDragAndDropManager.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VDragAndDropManager.java @@ -16,6 +16,7 @@ package com.vaadin.client.ui.dd; import java.util.Locale; +import java.util.logging.Logger; import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.Scheduler; @@ -37,7 +38,6 @@ import com.vaadin.client.ComponentConnector; import com.vaadin.client.MouseEventDetailsBuilder; import com.vaadin.client.Profiler; import com.vaadin.client.UIDL; -import com.vaadin.client.VConsole; import com.vaadin.client.ValueMap; import com.vaadin.client.WidgetUtil; import com.vaadin.client.extensions.DragSourceExtensionConnector; @@ -704,7 +704,7 @@ public class VDragAndDropManager { ApplicationConnection connection = getCurrentDragApplicationConnection(); Element dragImageParent; if (connection == null) { - VConsole.error( + getLogger().severe( "Could not determine ApplicationConnection for current drag operation. The drag image will likely look broken"); dragImageParent = RootPanel.getBodyElement(); } else { @@ -763,4 +763,7 @@ public class VDragAndDropManager { } } + private static Logger getLogger() { + return Logger.getLogger(VDragAndDropManager.class.getName()); + } } diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VNot.java b/client/src/main/java/com/vaadin/client/ui/dd/VNot.java index d919541b8e..b5ea0fe600 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VNot.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VNot.java @@ -15,8 +15,9 @@ */ package com.vaadin.client.ui.dd; +import java.util.logging.Logger; + import com.vaadin.client.UIDL; -import com.vaadin.client.VConsole; import com.vaadin.event.dd.acceptcriteria.Not; import com.vaadin.shared.ui.dd.AcceptCriterion; import com.vaadin.ui.dnd.DropTargetExtension; @@ -39,7 +40,7 @@ public final class VNot extends VAcceptCriterion { if (crit1 == null) { crit1 = getCriteria(drag, configuration, 0); if (crit1 == null) { - VConsole.log("Not criteria didn't found a child criteria"); + getLogger().info("Not criteria didn't found a child criteria"); return; } } @@ -69,4 +70,8 @@ public final class VNot extends VAcceptCriterion { protected boolean accept(VDragEvent drag, UIDL configuration) { return false; // not used } + + private static Logger getLogger() { + return Logger.getLogger(VNot.class.getName()); + } } diff --git a/client/src/main/java/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java b/client/src/main/java/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java index 04eec16589..2705fae81d 100644 --- a/client/src/main/java/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java @@ -25,7 +25,6 @@ import com.vaadin.client.ComponentConnector; import com.vaadin.client.ConnectorMap; import com.vaadin.client.Paintable; import com.vaadin.client.UIDL; -import com.vaadin.client.VConsole; import com.vaadin.client.extensions.DragSourceExtensionConnector; import com.vaadin.client.extensions.DropTargetExtensionConnector; import com.vaadin.client.ui.VDragAndDropWrapper; @@ -88,7 +87,7 @@ public class DragAndDropWrapperConnector extends CustomComponentConnector && !receiverUrl .equals(widget.fileIdToReceiver .get(fileId))) { - VConsole.error( + getLogger().severe( "Overwriting file receiver mapping for fileId " + fileId + " . Old receiver URL: " + widget.fileIdToReceiver diff --git a/client/src/main/java/com/vaadin/client/ui/embedded/EmbeddedConnector.java b/client/src/main/java/com/vaadin/client/ui/embedded/EmbeddedConnector.java index 010701c210..43bbad59ef 100644 --- a/client/src/main/java/com/vaadin/client/ui/embedded/EmbeddedConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/embedded/EmbeddedConnector.java @@ -17,6 +17,7 @@ package com.vaadin.client.ui.embedded; import java.util.Map; +import java.util.logging.Logger; import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Element; @@ -27,7 +28,6 @@ import com.google.gwt.dom.client.ObjectElement; import com.google.gwt.dom.client.Style; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Event; -import com.vaadin.client.VConsole; import com.vaadin.client.VTooltip; import com.vaadin.client.communication.StateChangeEvent; import com.vaadin.client.ui.AbstractComponentConnector; @@ -134,7 +134,7 @@ public class EmbeddedConnector extends AbstractComponentConnector { setResourceUrl(getResourceUrl("src")); clearBrowserElement = false; } else { - VConsole.error( + getLogger().severe( "Unknown Embedded type '" + widget.type + "'"); } } else if (state.mimeType != null) { @@ -199,10 +199,10 @@ public class EmbeddedConnector extends AbstractComponentConnector { obj.setInnerText(state.altText); } } else { - VConsole.error("Unknown Embedded mimetype '" + mime + "'"); + getLogger().severe("Unknown Embedded mimetype '" + mime + "'"); } } else { - VConsole.error("Unknown Embedded; no type or mimetype attribute"); + getLogger().severe("Unknown Embedded; no type or mimetype attribute"); } if (clearBrowserElement) { @@ -253,4 +253,7 @@ public class EmbeddedConnector extends AbstractComponentConnector { }; + private static Logger getLogger() { + return Logger.getLogger(EmbeddedConnector.class.getName()); + } } diff --git a/client/src/main/java/com/vaadin/client/ui/layout/LayoutDependencyTree.java b/client/src/main/java/com/vaadin/client/ui/layout/LayoutDependencyTree.java index 24e239ca0d..8fef9282e5 100644 --- a/client/src/main/java/com/vaadin/client/ui/layout/LayoutDependencyTree.java +++ b/client/src/main/java/com/vaadin/client/ui/layout/LayoutDependencyTree.java @@ -31,7 +31,6 @@ import com.vaadin.client.JsArrayObject; import com.vaadin.client.Profiler; import com.vaadin.client.ServerConnector; import com.vaadin.client.Util; -import com.vaadin.client.VConsole; import com.vaadin.client.ui.ManagedLayout; import com.vaadin.shared.AbstractComponentState; @@ -722,10 +721,10 @@ public class LayoutDependencyTree { } public void logDependencyStatus(ComponentConnector connector) { - VConsole.log("===="); + getLogger().info("===="); String connectorId = connector.getConnectorId(); - VConsole.log(getDependency(connectorId, HORIZONTAL).toString()); - VConsole.log(getDependency(connectorId, VERTICAL).toString()); + getLogger().info(getDependency(connectorId, HORIZONTAL).toString()); + getLogger().info(getDependency(connectorId, VERTICAL).toString()); } public boolean noMoreChangesExpected(ComponentConnector connector) { |