@Override
public void failed(Throwable reason) {
- VConsole.error(reason);
+ getLogger().log(Level.SEVERE,
+ "Error loading deferred bundle", reason);
}
});
}
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.logging.Level;
import java.util.logging.Logger;
import com.google.gwt.aria.client.LiveValue;
int currentTime = elapsedMillis();
int stepDuration = currentTime - previousStep;
if (stepDuration >= minDuration) {
- VConsole.log(message + ": " + stepDuration + " ms");
+ getLogger().info(message + ": " + stepDuration + " ms");
}
previousStep = currentTime;
}
}
public void init(WidgetSet widgetSet, ApplicationConfiguration cnf) {
- VConsole.log("Starting application " + cnf.getRootPanelId());
- VConsole.log("Using theme: " + cnf.getThemeName());
+ getLogger().info("Starting application " + cnf.getRootPanelId());
+ getLogger().info("Using theme: " + cnf.getThemeName());
- VConsole.log("Vaadin application servlet version: "
- + cnf.getServletVersion());
+ getLogger().info(
+ "Vaadin application servlet version: "
+ + cnf.getServletVersion());
if (!cnf.getServletVersion().equals(Version.getFullVersion())) {
- VConsole.error("Warning: your widget set seems to be built with a different "
- + "version than the one used on server. Unexpected "
- + "behavior may occur.");
+ getLogger()
+ .severe("Warning: your widget set seems to be built with a different "
+ + "version than the one used on server. Unexpected "
+ + "behavior may occur.");
}
this.widgetSet = widgetSet;
payload.put(ApplicationConstants.RPC_INVOCATIONS, reqInvocations);
payload.put(ApplicationConstants.SERVER_SYNC_ID, lastSeenServerSyncId);
- VConsole.log("Making UIDL Request with params: " + payload.toJson());
+ getLogger()
+ .info("Making UIDL Request with params: " + payload.toJson());
String uri = translateVaadinUri(ApplicationConstants.APP_PROTOCOL_PREFIX
+ ApplicationConstants.UIDL_PATH + '/');
@Override
public void onResponseReceived(Request request, Response response) {
- VConsole.log("Server visit took "
- + String.valueOf((new Date()).getTime()
- - requestStartTime.getTime()) + "ms");
+ getLogger().info(
+ "Server visit took "
+ + String.valueOf((new Date()).getTime()
+ - requestStartTime.getTime()) + "ms");
int statusCode = response.getStatusCode();
// Notify network observers about response status
* Status code 0 does indicate that there was no server
* side processing, so we can retry the request.
*/
- VConsole.log("Status code 0, retrying");
+ getLogger().warning("Status code 0, retrying");
(new Timer() {
@Override
public void run() {
*/
String delay = response.getHeader("Retry-After");
if (delay != null) {
- VConsole.log("503, retrying in " + delay + "msec");
+ getLogger().warning(
+ "503, retrying in " + delay + "msec");
(new Timer() {
@Override
public void run() {
try {
doAjaxRequest(uri, payload, requestCallback);
} catch (RequestException e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE, "Error in server request", e);
endRequest();
fireEvent(new ConnectionStatusEvent(0));
}
return;
}
- VConsole.log("JSON parsing took "
- + (new Date().getTime() - start.getTime()) + "ms");
+ getLogger().info(
+ "JSON parsing took " + (new Date().getTime() - start.getTime())
+ + "ms");
if (isApplicationRunning()) {
handleReceivedJSONMessage(start, jsonText, json);
} else {
// Show this message just once
if (cssWaits++ == 0) {
- VConsole.log("Assuming CSS loading is not complete, "
- + "postponing render phase. "
- + "(.v-loading-indicator height == 0)");
+ getLogger().warning(
+ "Assuming CSS loading is not complete, "
+ + "postponing render phase. "
+ + "(.v-loading-indicator height == 0)");
}
} else {
cssLoaded = true;
*
*/
protected void showCommunicationError(String details, int statusCode) {
- VConsole.error("Communication error: " + details);
+ getLogger().severe("Communication error: " + details);
showError(details, configuration.getCommunicationError());
}
* Optional details for debugging.
*/
protected void showAuthenticationError(String details) {
- VConsole.error("Authentication error: " + details);
+ getLogger().severe("Authentication error: " + details);
showError(details, configuration.getAuthorizationError());
}
* Optional details for debugging.
*/
public void showSessionExpiredError(String details) {
- VConsole.error("Session expired: " + details);
+ getLogger().severe("Session expired: " + details);
showError(details, configuration.getSessionExpiredError());
}
protected void startRequest() {
if (hasActiveRequest) {
- VConsole.error("Trying to start a new request while another is active");
+ getLogger().severe(
+ "Trying to start a new request while another is active");
}
hasActiveRequest = true;
requestStartTime = new Date();
protected void endRequest() {
if (!hasActiveRequest) {
- VConsole.error("No active request");
+ getLogger().severe("No active request");
}
// After checkForPendingVariableBursts() there may be a new active
// request, so we must set hasActiveRequest to false before, not after,
&& !getConnectorMap().isDragAndDropPaintable(id)) {
// variable owner does not exist anymore
iterator.remove();
- VConsole.log("Removed variable from removed component: " + id);
+ getLogger().info(
+ "Removed variable from removed component: " + id);
}
}
}
// Some component is doing something that can't be interrupted
// (e.g. animation that should be smooth). Enqueue the UIDL
// message for later processing.
- VConsole.log("Postponing UIDL handling due to lock...");
+ getLogger().info("Postponing UIDL handling due to lock...");
pendingUIDLMessages.add(new PendingUIDLMessage(start, jsonText,
json));
if (!forceHandleMessage.isRunning()) {
final Object lock = new Object();
suspendReponseHandling(lock);
- VConsole.log("Handling message from server");
+ getLogger().info("Handling message from server");
eventBus.fireEvent(new ResponseHandlingStartedEvent(this));
final int syncId;
}
} else {
syncId = -1;
- VConsole.error("Server response didn't contain a sync id. "
- + "Please verify that the server is up-to-date and that the response data has not been modified in transmission.");
+ getLogger()
+ .severe("Server response didn't contain a sync id. "
+ + "Please verify that the server is up-to-date and that the response data has not been modified in transmission.");
}
// Handle redirect
if (json.containsKey("redirect")) {
String url = json.getValueMap("redirect").getString("url");
- VConsole.log("redirecting to " + url);
+ getLogger().info("redirecting to " + url);
redirect(url);
return;
}
csrfToken = json
.getString(ApplicationConstants.UIDL_SECURITY_TOKEN_ID);
}
- VConsole.log(" * Handling resources from server");
+ getLogger().info(" * Handling resources from server");
if (json.containsKey("resources")) {
ValueMap resources = json.getValueMap("resources");
handleUIDLDuration.logDuration(
" * Handling resources from server completed", 10);
- VConsole.log(" * Handling type inheritance map from server");
+ getLogger().info(" * Handling type inheritance map from server");
if (json.containsKey("typeInheritanceMap")) {
configuration.addComponentInheritanceInfo(json
handleUIDLDuration.logDuration(
" * Handling type inheritance map from server completed", 10);
- VConsole.log("Handling type mappings from server");
+ getLogger().info("Handling type mappings from server");
if (json.containsKey("typeMappings")) {
configuration.addComponentMappings(
}
- VConsole.log("Handling resource dependencies");
+ getLogger().info("Handling resource dependencies");
if (json.containsKey("scriptDependencies")) {
loadScriptDependencies(json.getJSStringArray("scriptDependencies"));
}
Profiler.enter("Handling meta information");
ValueMap meta = null;
if (json.containsKey("meta")) {
- VConsole.log(" * Handling meta information");
+ getLogger().info(" * Handling meta information");
meta = json.getValueMap("meta");
if (meta.containsKey("repaintAll")) {
prepareRepaintAll();
* connectors which get a state change event before the UI.
*/
Profiler.enter("Handling locales");
- VConsole.log(" * Handling locales");
+ getLogger().info(" * Handling locales");
// Store locale data
LocaleService
.addLocales(getUIConnector().getState().localeServiceState.localeData);
unregisterRemovedConnectors(connectorHierarchyUpdateResult.detachedConnectorIds);
- VConsole.log("handleUIDLMessage: "
- + (Duration.currentTimeMillis() - processUidlStart)
- + " ms");
+ getLogger()
+ .info("handleUIDLMessage: "
+ + (Duration.currentTimeMillis() - processUidlStart)
+ + " ms");
updatingState = false;
layoutManager.setEverythingNeedsMeasure();
layoutManager.layoutNow();
} catch (final Throwable e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE,
+ "Error processing layouts", e);
}
Profiler.leave("Layout processing");
}
if (ApplicationConfiguration.isDebugMode()) {
Profiler.enter("Dumping state changes to the console");
- VConsole.log(" * Dumping state changes to the console");
+ getLogger().info(" * Dumping state changes to the console");
VConsole.dirUIDL(json, ApplicationConnection.this);
Profiler.leave("Dumping state changes to the console");
}
}
}
- VConsole.log(" Processing time was "
- + String.valueOf(lastProcessingTime) + "ms for "
- + jsonText.length() + " characters of JSON");
- VConsole.log("Referenced paintables: " + connectorMap.size());
+ getLogger().info(
+ " Processing time was "
+ + String.valueOf(lastProcessingTime)
+ + "ms for " + jsonText.length()
+ + " characters of JSON");
+ getLogger().info(
+ "Referenced paintables: " + connectorMap.size());
if (meta == null || !meta.containsKey("async")) {
// End the request if the received message was a response,
JsArrayObject<StateChangeEvent> pendingStateChangeEvents) {
Profiler.enter("@DelegateToWidget");
- VConsole.log(" * Running @DelegateToWidget");
+ getLogger().info(" * Running @DelegateToWidget");
// Keep track of types that have no @DelegateToWidget in their
// state to optimize performance
private void sendStateChangeEvents(
JsArrayObject<StateChangeEvent> pendingStateChangeEvents) {
Profiler.enter("sendStateChangeEvents");
- VConsole.log(" * Sending state change events");
+ getLogger().info(" * Sending state change events");
int size = pendingStateChangeEvents.size();
for (int i = 0; i < size; i++) {
try {
sce.getConnector().fireEvent(sce);
} catch (final Throwable e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE,
+ "Error sending state change events", e);
}
}
ServerConnector c = currentConnectors.get(i);
if (c.getParent() != null) {
if (!c.getParent().getChildren().contains(c)) {
- VConsole.error("ERROR: Connector "
- + c.getConnectorId()
- + " is connected to a parent but the parent ("
- + c.getParent().getConnectorId()
- + ") does not contain the connector");
+ getLogger()
+ .severe("ERROR: Connector "
+ + c.getConnectorId()
+ + " is connected to a parent but the parent ("
+ + c.getParent().getConnectorId()
+ + ") does not contain the connector");
}
} else if (c == getUIConnector()) {
// UIConnector for this connection, ignore
} else {
// The connector has been detached from the
// hierarchy but was not unregistered.
- VConsole.error("ERROR: Connector "
- + c.getConnectorId()
- + " is not attached to a parent but has not been unregistered");
+ getLogger()
+ .severe("ERROR: Connector "
+ + c.getConnectorId()
+ + " is not attached to a parent but has not been unregistered");
}
}
verifyConnectorHierarchy();
}
- VConsole.log("* Unregistered " + detachedArray.length()
- + " connectors");
+ getLogger().info(
+ "* Unregistered " + detachedArray.length()
+ + " connectors");
Profiler.leave("unregisterRemovedConnectors");
}
private JsArrayString createConnectorsIfNeeded(ValueMap json) {
- VConsole.log(" * Creating connectors (if needed)");
+ getLogger().info(" * Creating connectors (if needed)");
JsArrayString createdConnectors = JavaScriptObject
.createArray().cast();
createdConnectors.push(connectorId);
}
} catch (final Throwable e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE,
+ "Error handling type data", e);
}
}
onlyNoLayoutUpdates = false;
}
- VConsole.log(" * Passing UIDL to Vaadin 6 style connectors");
+ getLogger()
+ .info(" * Passing UIDL to Vaadin 6 style connectors");
// update paintables
for (int i = 0; i < length; i++) {
try {
Profiler.leave(key);
}
} else if (legacyConnector == null) {
- VConsole.error("Received update for "
- + uidl.getTag()
- + ", but there is no such paintable ("
- + connectorId + ") rendered.");
+ getLogger()
+ .severe("Received update for "
+ + uidl.getTag()
+ + ", but there is no such paintable ("
+ + connectorId + ") rendered.");
} else {
- VConsole.error("Server sent Vaadin 6 style updates for "
- + Util.getConnectorString(legacyConnector)
- + " but this is not a Vaadin 6 Paintable");
+ getLogger()
+ .severe("Server sent Vaadin 6 style updates for "
+ + Util.getConnectorString(legacyConnector)
+ + " but this is not a Vaadin 6 Paintable");
}
} catch (final Throwable e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE, "Error handling UIDL", e);
}
}
}
Profiler.enter("sendHierarchyChangeEvents");
- VConsole.log(" * Sending hierarchy change events");
+ getLogger().info(" * Sending hierarchy change events");
for (int i = 0; i < eventCount; i++) {
ConnectorHierarchyChangeEvent event = events.get(i);
try {
logHierarchyChange(event);
event.getConnector().fireEvent(event);
} catch (final Throwable e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE,
+ "Error sending hierarchy change events", e);
}
}
return;
}
- VConsole.log("Hierarchy changed for "
- + Util.getConnectorString(event.getConnector()));
+ getLogger()
+ .info("Hierarchy changed for "
+ + Util.getConnectorString(event.getConnector()));
String oldChildren = "* Old children: ";
for (ComponentConnector child : event.getOldChildren()) {
oldChildren += Util.getConnectorString(child) + " ";
}
- VConsole.log(oldChildren);
+ getLogger().info(oldChildren);
String newChildren = "* New children: ";
HasComponentsConnector parent = (HasComponentsConnector) event
for (ComponentConnector child : parent.getChildComponents()) {
newChildren += Util.getConnectorString(child) + " ";
}
- VConsole.log(newChildren);
+ getLogger().info(newChildren);
}
private JsArrayObject<StateChangeEvent> updateConnectorState(
ValueMap json, JsArrayString createdConnectorIds) {
JsArrayObject<StateChangeEvent> events = JavaScriptObject
.createArray().cast();
- VConsole.log(" * Updating connector states");
+ getLogger().info(" * Updating connector states");
if (!json.containsKey("state")) {
return events;
}
Profiler.leave("updateConnectorState inner loop");
}
} catch (final Throwable e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE,
+ "Error updating connector states", e);
}
}
ValueMap json) {
ConnectorHierarchyUpdateResult result = new ConnectorHierarchyUpdateResult();
- VConsole.log(" * Updating connector hierarchy");
+ getLogger().info(" * Updating connector hierarchy");
if (!json.containsKey("hierarchy")) {
return result;
}
ServerConnector childConnector = connectorMap
.getConnector(childConnectorId);
if (childConnector == null) {
- VConsole.error("Hierarchy claims that "
- + childConnectorId
- + " is a child for "
- + connectorId
- + " ("
- + parentConnector.getClass().getName()
- + ") but no connector with id "
- + childConnectorId
- + " has been registered. "
- + "More information might be available in the server-side log if assertions are enabled");
+ getLogger()
+ .severe("Hierarchy claims that "
+ + childConnectorId
+ + " is a child for "
+ + connectorId
+ + " ("
+ + parentConnector.getClass()
+ .getName()
+ + ") but no connector with id "
+ + childConnectorId
+ + " has been registered. "
+ + "More information might be available in the server-side log if assertions are enabled");
continue;
}
newChildren.add(childConnector);
result.events.add(event);
}
} else if (!newComponents.isEmpty()) {
- VConsole.error("Hierachy claims "
- + Util.getConnectorString(parentConnector)
- + " has component children even though it isn't a HasComponentsConnector");
+ getLogger()
+ .severe("Hierachy claims "
+ + Util.getConnectorString(parentConnector)
+ + " has component children even though it isn't a HasComponentsConnector");
}
Profiler.leave("updateConnectorHierarchy handle HasComponentsConnector");
Profiler.leave("updateConnectorHierarchy find removed children");
} catch (final Throwable e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE,
+ "Error updating connector hierarchy", e);
} finally {
Profiler.leave("updateConnectorHierarchy hierarchy entry");
}
if (json.containsKey("rpc")) {
Profiler.enter("handleRpcInvocations");
- VConsole.log(" * Performing server to client RPC calls");
+ getLogger()
+ .info(" * Performing server to client RPC calls");
JsonArray rpcCalls = Util.jso2json(json
.getJavaScriptObject("rpc"));
}
} catch (final Throwable e) {
- VConsole.error(e);
+ getLogger()
+ .log(Level.SEVERE,
+ "Error performing server to client RPC calls",
+ e);
}
}
@Override
public void onError(ResourceLoadEvent event) {
- VConsole.error(event.getResourceUrl()
- + " could not be loaded, or the load detection failed because the stylesheet is empty.");
+ getLogger()
+ .severe(event.getResourceUrl()
+ + " could not be loaded, or the load detection failed because the stylesheet is empty.");
// The show must go on
onLoad(event);
}
@Override
public void onError(ResourceLoadEvent event) {
- VConsole.error(event.getResourceUrl() + " could not be loaded.");
+ getLogger().severe(
+ event.getResourceUrl() + " could not be loaded.");
// The show must go on
onLoad(event);
}
layoutManager.forceLayout();
- VConsole.log("forceLayout in " + duration.elapsedMillis() + " ms");
+ getLogger().info("forceLayout in " + duration.elapsedMillis() + " ms");
}
/**
*/
@Deprecated
public void unregisterPaintable(ServerConnector p) {
- VConsole.log("unregisterPaintable (unnecessarily) called for "
- + Util.getConnectorString(p));
+ getLogger().info(
+ "unregisterPaintable (unnecessarily) called for "
+ + Util.getConnectorString(p));
}
/**
}
if (!manageCaption) {
- VConsole.error(Util.getConnectorString(connector)
- + " called updateComponent with manageCaption=false. The parameter was ignored - override delegateCaption() to return false instead. It is however not recommended to use caption this way at all.");
+ getLogger()
+ .warning(
+ Util.getConnectorString(connector)
+ + " called updateComponent with manageCaption=false. The parameter was ignored - override delegateCaption() to return false instead. It is however not recommended to use caption this way at all.");
}
return false;
}
Timer forceHandleMessage = new Timer() {
@Override
public void run() {
- VConsole.log("WARNING: reponse handling was never resumed, forcibly removing locks...");
+ getLogger()
+ .warning(
+ "WARNING: reponse handling was never resumed, forcibly removing locks...");
responseHandlingLocks.clear();
handlePendingMessages();
}
forceHandleMessage.cancel();
if (!pendingUIDLMessages.isEmpty()) {
- VConsole.log("No more response handling locks, handling pending requests.");
+ getLogger()
+ .info("No more response handling locks, handling pending requests.");
handlePendingMessages();
}
}
import java.util.ArrayList;
import java.util.Collection;
+import java.util.logging.Logger;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JavaScriptObject;
*/
public void unregisterConnector(ServerConnector connector) {
if (connector == null) {
- VConsole.error("Trying to unregister null connector");
+ getLogger().severe("Trying to unregister null connector");
return;
}
return getConnectorId(w.getElement()) != null;
}
+ private static Logger getLogger() {
+ return Logger.getLogger(ConnectorMap.class.getName());
+ }
}
package com.vaadin.client;
import java.util.Date;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.LocaleInfo;
try {
return LocaleService.getMonthNames(currentLocale)[month];
} catch (final LocaleNotLoadedException e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE, "Error in getMonth", e);
return null;
}
}
try {
return LocaleService.getShortMonthNames(currentLocale)[month];
} catch (final LocaleNotLoadedException e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE, "Error in getShortMonth", e);
return null;
}
}
try {
return LocaleService.getDayNames(currentLocale)[day];
} catch (final LocaleNotLoadedException e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE, "Error in getDay", e);
return null;
}
}
try {
return LocaleService.getShortDayNames(currentLocale)[day];
} catch (final LocaleNotLoadedException e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE, "Error in getShortDay", e);
return null;
}
}
try {
return LocaleService.getFirstDayOfWeek(currentLocale);
} catch (final LocaleNotLoadedException e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE, "Error in getFirstDayOfWeek", e);
return 0;
}
}
try {
return LocaleService.isTwelveHourClock(currentLocale);
} catch (final LocaleNotLoadedException e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE, "Error in isTwelveHourClock", e);
return false;
}
}
try {
return LocaleService.getClockDelimiter(currentLocale);
} catch (final LocaleNotLoadedException e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE, "Error in getClockDelimiter", e);
return ":";
}
}
return LocaleService.getAmPmStrings(currentLocale);
} catch (final LocaleNotLoadedException e) {
// TODO can this practically even happen? Should die instead?
- VConsole.error("Locale not loaded, using fallback : AM/PM");
- VConsole.error(e);
+ getLogger().log(Level.SEVERE,
+ "Locale not loaded, using fallback : AM/PM", e);
return DEFAULT_AMPM_STRINGS;
}
}
try {
firstDay = LocaleService.getFirstDayOfWeek(currentLocale);
} catch (final LocaleNotLoadedException e) {
- VConsole.error("Locale not loaded, using fallback 0");
- VConsole.error(e);
+ getLogger().log(Level.SEVERE,
+ "Locale not loaded, using fallback 0", e);
firstDay = 0;
}
int start = dateForFirstOfThisMonth.getDay() - firstDay;
}
+ public static Logger getLogger() {
+ return Logger.getLogger(DateTimeService.class.getName());
+ }
}
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.logging.Logger;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;
String initFunctionName = serverSideClassName
.replaceAll("\\.", "_");
if (tryInitJs(initFunctionName, getConnectorWrapper())) {
- VConsole.log("JavaScript connector initialized using "
- + initFunctionName);
+ getLogger().info(
+ "JavaScript connector initialized using "
+ + initFunctionName);
this.initFunctionName = initFunctionName;
return true;
} else {
- VConsole.log("No JavaScript function " + initFunctionName
- + " found");
+ getLogger()
+ .warning(
+ "No JavaScript function " + initFunctionName
+ + " found");
attemptedNames.add(initFunctionName);
tag = conf.getParentTag(tag.intValue());
}
}
- VConsole.log("No JavaScript init for connector not found");
+ getLogger().info("No JavaScript init for connector found");
showInitProblem(attemptedNames);
return false;
}
public String getInitFunctionName() {
return initFunctionName;
}
+
+ public static Logger getLogger() {
+ return Logger.getLogger(JavaScriptConnectorHelper.class.getName());
+ }
}
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import java.util.logging.Level;
import java.util.logging.Logger;
import com.google.gwt.core.client.Duration;
}
layoutCounts.put(layout.getConnectorId(), count);
if (count.intValue() > 2) {
- VConsole.error(Util.getConnectorString(layout)
- + " has been layouted " + count.intValue() + " times");
+ getLogger().severe(
+ Util.getConnectorString(layout) + " has been layouted "
+ + count.intValue() + " times");
}
}
}
private void doLayout() {
- VConsole.log("Starting layout phase");
+ getLogger().info("Starting layout phase");
Profiler.enter("LayoutManager phase init");
FastStringMap<Integer> layoutCounts = FastStringMap.create();
everythingNeedsMeasure = false;
if (measuredConnectorCount == 0) {
- VConsole.log("No more changes in pass " + passes);
+ getLogger().info("No more changes in pass " + passes);
Profiler.leave("Layout pass");
break;
}
Profiler.leave(key);
}
} catch (RuntimeException e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE,
+ "Error in resize listener", e);
}
}
Profiler.leave("Layout fire resize events - listeners not null");
Profiler.leave(key);
}
} catch (RuntimeException e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE,
+ "Error in ManagedLayout handling", e);
}
countLayout(layoutCounts, cl);
} else {
Profiler.leave(key);
}
} catch (RuntimeException e) {
- VConsole.error(e);
+ getLogger()
+ .log(Level.SEVERE,
+ "Error in SimpleManagedLayout (horizontal) handling",
+ e);
+
}
countLayout(layoutCounts, rr);
}
Profiler.leave(key);
}
} catch (RuntimeException e) {
- VConsole.error(e);
+ getLogger()
+ .log(Level.SEVERE,
+ "Error in DirectionalManagedLayout handling",
+ e);
}
countLayout(layoutCounts, cl);
} else {
Profiler.leave(key);
}
} catch (RuntimeException e) {
- VConsole.error(e);
+ getLogger()
+ .log(Level.SEVERE,
+ "Error in SimpleManagedLayout (vertical) handling",
+ e);
}
countLayout(layoutCounts, rr);
}
b.append(connectorString);
}
}
- VConsole.log(b.toString());
+ getLogger().info(b.toString());
}
Profiler.leave("Layout pass");
- VConsole.log("Pass " + passes + " measured "
- + measuredConnectorCount + " elements, fired "
- + firedListeners + " listeners and did " + layoutCount
- + " layouts.");
+ getLogger()
+ .info("Pass " + passes + " measured "
+ + measuredConnectorCount + " elements, fired "
+ + firedListeners + " listeners and did "
+ + layoutCount + " layouts.");
if (passes > 100) {
- VConsole.log(LOOP_ABORT_MESSAGE);
+ getLogger().severe(LOOP_ABORT_MESSAGE);
if (ApplicationConfiguration.isDebugMode()) {
VNotification.createNotification(
VNotification.DELAY_FOREVER,
cleanMeasuredSizes();
- VConsole.log("Total layout phase time: "
- + totalDuration.elapsedMillis() + "ms");
+ getLogger().info(
+ "Total layout phase time: " + totalDuration.elapsedMillis()
+ + "ms");
}
private void logConnectorStatus(int connectorId) {
}
if (debugLogging) {
- VConsole.log("Doing overflow fix for "
- + Util.getConnectorString(componentConnector)
- + " in "
- + Util.getConnectorString(componentConnector
- .getParent()));
+ getLogger()
+ .info("Doing overflow fix for "
+ + Util.getConnectorString(componentConnector)
+ + " in "
+ + Util.getConnectorString(componentConnector
+ .getParent()));
}
Profiler.enter("Overflow fix apply");
Profiler.leave("Overflow fix restore");
if (!pendingOverflowFixes.isEmpty()) {
- VConsole.log("Did overflow fix for " + remainingCount
- + " elements");
+ getLogger().info(
+ "Did overflow fix for " + remainingCount + " elements");
}
pendingOverflowFixes = delayedOverflowFixes;
}
measuredAndUpdate(element, getMeasuredSize(element, null));
}
Profiler.leave("LayoutManager.measureNonConenctors");
- VConsole.log("Measured " + measuredNonConnectorElements.size()
- + " non connector elements");
+ getLogger().info(
+ "Measured " + measuredNonConnectorElements.size()
+ + " non connector elements");
}
private MeasureResult measuredAndUpdate(Element element,
*/
package com.vaadin.client;
+import java.util.logging.Logger;
+
import com.google.gwt.core.client.JsArrayString;
import com.google.gwt.dom.client.Element;
private void debugSizeChange(Element element, String sizeChangeType,
String changedFrom, String changedTo) {
if (debugSizeChanges) {
- VConsole.log(sizeChangeType + " has changed from " + changedFrom
- + " to " + changedTo + " for " + element.toString());
+ getLogger()
+ .info(sizeChangeType + " has changed from " + changedFrom
+ + " to " + changedTo + " for " + element.toString());
}
}
return sizes1[0] != sizes2[0] || sizes1[2] != sizes2[2];
}
+ public static Logger getLogger() {
+ return Logger.getLogger(MeasuredSize.class.getName());
+ }
+
}
*/
package com.vaadin.client;
+import java.util.logging.Logger;
+
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.http.client.UrlBuilder;
private static void recompileWidgetsetAndStartInDevMode(
final String serverUrl) {
- VConsole.log("Recompiling widgetset using<br/>" + serverUrl
- + "<br/>and then reloading in super dev mode");
+ getLogger().info(
+ "Recompiling widgetset using<br/>" + serverUrl
+ + "<br/>and then reloading in super dev mode");
VNotification n = new VNotification();
n.show("<b>Recompiling widgetset, please wait</b>",
VNotification.CENTERED, VNotification.STYLE_SYSTEM);
@Override
public void onSuccess(RecompileResult result) {
- VConsole.log("JSONP compile call successful");
+ getLogger().fine("JSONP compile call successful");
if (!result.ok()) {
- VConsole.log("* result: " + result);
+ getLogger().fine("* result: " + result);
failed();
return;
}
serverUrl));
setSession(SKIP_RECOMPILE, "1");
- VConsole.log("* result: OK. Reloading");
+ getLogger().fine("* result: OK. Reloading");
Location.reload();
}
@Override
public void onFailure(Throwable caught) {
- VConsole.error("JSONP compile call failed");
+ getLogger().severe("JSONP compile call failed");
// Don't log exception as they are shown as
// notifications
- VConsole.error(caught.getClass().getSimpleName() + ": "
- + caught.getMessage());
+ getLogger().severe(
+ caught.getClass().getSimpleName() + ": "
+ + caught.getMessage());
failed();
}
}
if (hasSession(SKIP_RECOMPILE)) {
- VConsole.log("Running in SuperDevMode");
+ getLogger().info("Running in SuperDevMode");
// When we get here, we are running in super dev mode
// Remove the flag so next reload will recompile
VNotification n = new VNotification();
n.show(message, VNotification.CENTERED_TOP, VNotification.STYLE_SYSTEM);
}
+
+ public static Logger getLogger() {
+ return Logger.getLogger(SuperDevMode.class.getName());
+ }
}
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JavaScriptObject;
ApplicationConnection c) {
ServerConnector connector = ConnectorMap.get(c).getConnector(id);
if (connector != null) {
- VConsole.log("\t" + id + " (" + connector.getClass() + ") :");
+ getLogger().info("\t" + id + " (" + connector.getClass() + ") :");
} else {
- VConsole.log("\t" + id
- + ": Warning: no corresponding connector for id " + id);
+ getLogger().warning(
+ "\t" + id + ": Warning: no corresponding connector for id "
+ + id);
}
for (MethodInvocation invocation : invocations) {
Object[] parameters = invocation.getParameters();
formattedParams = (null != parameters) ? Arrays
.toString(parameters) : null;
}
- VConsole.log("\t\t" + invocation.getInterfaceName() + "."
- + invocation.getMethodName() + "(" + formattedParams + ")");
+ getLogger().info(
+ "\t\t" + invocation.getInterfaceName() + "."
+ + invocation.getMethodName() + "("
+ + formattedParams + ")");
}
}
static void logVariableBurst(ApplicationConnection c,
Collection<MethodInvocation> loggedBurst) {
try {
- VConsole.log("Variable burst to be sent to server:");
+ getLogger().info("Variable burst to be sent to server:");
String curId = null;
ArrayList<MethodInvocation> invocations = new ArrayList<MethodInvocation>();
for (MethodInvocation methodInvocation : loggedBurst) {
printConnectorInvocations(invocations, curId, c);
}
} catch (Exception e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE, "Error sending variable burst", e);
}
}
return JSON.parse(jsonAsString);
}-*/;
+ public static Logger getLogger() {
+ return Logger.getLogger(Util.class.getName());
+ }
}
package com.vaadin.client;
+import java.util.logging.Logger;
+
import com.google.gwt.aria.client.Roles;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style.Unit;
if (owner != null) {
Util.notifyParentOfSizeChange(owner.getWidget(), true);
} else {
- VConsole.log("Warning: Icon load event was not propagated because VCaption owner is unknown.");
+ getLogger()
+ .warning(
+ "Warning: Icon load event was not propagated because VCaption owner is unknown.");
}
}
}
}
+ public static Logger getLogger() {
+ return Logger.getLogger(VCaption.class.getName());
+ }
}
package com.vaadin.client;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
import com.google.gwt.core.client.GWT;
import com.vaadin.client.communication.HasJavaScriptConnectorHelper;
import com.vaadin.client.metadata.BundleLoadCallback;
@Override
public void failed(Throwable reason) {
- VConsole.error(reason);
+ getLogger().log(Level.SEVERE, "Error loading bundle",
+ reason);
ApplicationConfiguration.endDependencyLoading();
}
});
}
}
+ public static Logger getLogger() {
+ return Logger.getLogger(WidgetSet.class.getName());
+ }
}
package com.vaadin.client.communication;
import java.util.ArrayList;
+import java.util.logging.Logger;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.Scheduler;
import com.vaadin.client.ResourceLoader;
import com.vaadin.client.ResourceLoader.ResourceLoadEvent;
import com.vaadin.client.ResourceLoader.ResourceLoadListener;
-import com.vaadin.client.VConsole;
import com.vaadin.shared.ApplicationConstants;
import com.vaadin.shared.Version;
import com.vaadin.shared.communication.PushConstants;
// uri is needed to identify the right connection when closing
uri = SharedUtil.addGetParameters(baseUrl, extraParams);
- VConsole.log("Establishing push connection");
+ getLogger().info("Establishing push connection");
socket = doConnect(uri, getConfig());
}
switch (state) {
case CONNECT_PENDING:
assert isActive();
- VConsole.log("Queuing push message: " + message.toJson());
+ getLogger().info("Queuing push message: " + message.toJson());
messageQueue.add(message);
break;
case CONNECTED:
assert isActive();
- VConsole.log("Sending push message: " + message.toJson());
+ getLogger().info("Sending push message: " + message.toJson());
if (transport.equals("websocket")) {
FragmentedMessage fragmented = new FragmentedMessage(
}
protected void onReopen(AtmosphereResponse response) {
- VConsole.log("Push connection re-established using "
- + response.getTransport());
+ getLogger().info(
+ "Push connection re-established using "
+ + response.getTransport());
onConnect(response);
}
protected void onOpen(AtmosphereResponse response) {
- VConsole.log("Push connection established using "
- + response.getTransport());
+ getLogger().info(
+ "Push connection established using " + response.getTransport());
onConnect(response);
}
break;
case CONNECTED:
// Normal disconnect
- VConsole.log("Closing push connection");
+ getLogger().info("Closing push connection");
doDisconnect(uri);
state = State.DISCONNECTED;
command.execute();
protected void onMessage(AtmosphereResponse response) {
String message = response.getResponseBody();
if (message.startsWith("for(;;);")) {
- VConsole.log("Received push message: " + message);
+ getLogger().info("Received push message: " + message);
// "for(;;);[{json}]" -> "{json}"
message = message.substring(9, message.length() - 1);
connection.handlePushMessage(message);
* tried
*/
protected void onTransportFailure() {
- VConsole.log("Push connection using primary method ("
- + getConfig().getTransport() + ") failed. Trying with "
- + getConfig().getFallbackTransport());
+ getLogger().warning(
+ "Push connection using primary method ("
+ + getConfig().getTransport() + ") failed. Trying with "
+ + getConfig().getFallbackTransport());
}
/**
}
protected void onClose(AtmosphereResponse response) {
- VConsole.log("Push connection closed");
+ getLogger().info("Push connection closed");
state = State.CONNECT_PENDING;
}
protected void onReconnect(JavaScriptObject request,
final AtmosphereResponse response) {
if (state == State.CONNECTED) {
- VConsole.log("No onClose was received before reconnect. Forcing state to closed.");
+ getLogger()
+ .fine("No onClose was received before reconnect. Forcing state to closed.");
state = State.CONNECT_PENDING;
}
- VConsole.log("Reopening push connection");
+ getLogger().info("Reopening push connection");
}
public static abstract class AbstractJSO extends JavaScriptObject {
} else {
final String pushJs = getVersionedPushJs();
- VConsole.log("Loading " + pushJs);
+ getLogger().info("Loading " + pushJs);
ResourceLoader.get().loadScript(
connection.getConfiguration().getVaadinDirUrl() + pushJs,
new ResourceLoadListener() {
@Override
public void onLoad(ResourceLoadEvent event) {
if (isAtmosphereLoaded()) {
- VConsole.log(pushJs + " loaded");
+ getLogger().info(pushJs + " loaded");
command.execute();
} else {
// If bootstrap tried to load vaadinPush.js,
public String getTransportType() {
return transport;
}
+
+ public static Logger getLogger() {
+ return Logger.getLogger(AtmospherePushConnection.class.getName());
+ }
}
package com.vaadin.client.communication;
import java.util.Collection;
+import java.util.logging.Logger;
import com.vaadin.client.ApplicationConnection;
import com.vaadin.client.ConnectorMap;
import com.vaadin.client.ServerConnector;
-import com.vaadin.client.VConsole;
import com.vaadin.client.metadata.Method;
import com.vaadin.client.metadata.NoDataException;
import com.vaadin.client.metadata.Type;
}
parseMethodParameters(invocation, parametersJson, connection);
- VConsole.log("Server to client RPC call: " + invocation);
+ getLogger().info("Server to client RPC call: " + invocation);
applyInvocation(invocation, connector);
}
methodInvocation.setParameters(parameters);
}
+ public static Logger getLogger() {
+ return Logger.getLogger(RpcManager.class.getName());
+ }
}
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.vaadin.client.ComponentConnector;
import com.vaadin.client.JsArrayObject;
import com.vaadin.client.ServerConnector;
-import com.vaadin.client.VConsole;
import com.vaadin.client.WidgetUtil;
import com.vaadin.client.metadata.NoDataException;
import com.vaadin.client.metadata.Property;
}
} catch (NoDataException e) {
html += "<div>Could not read state, error has been logged to the console</div>";
- VConsole.error(e);
+ getLogger().log(Level.SEVERE, "Could not read state", e);
}
clear();
public void clearContents() {
clear();
}
+
+ public static Logger getLogger() {
+ return Logger.getLogger(ConnectorInfoPanel.class.getName());
+ }
}
import java.util.HashSet;
import java.util.Set;
+import java.util.logging.Logger;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.vaadin.client.ApplicationConnection;
import com.vaadin.client.ServerConnector;
import com.vaadin.client.Util;
-import com.vaadin.client.VConsole;
import com.vaadin.client.ui.UnknownComponentConnector;
/**
tag++;
if (tag > 10000) {
// Sanity check
- VConsole.error("Search for used connector classes was forcefully terminated");
+ getLogger()
+ .severe("Search for used connector classes was forcefully terminated");
break;
}
}
return s;
}
+ public static Logger getLogger() {
+ return Logger.getLogger(OptimizedWidgetsetPanel.class.getName());
+ }
}