Java Code Examples for com.google.gwt.core.shared.GWT#log()

The following examples show how to use com.google.gwt.core.shared.GWT#log() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NodeShape.java    From EasyML with Apache License 2.0 6 votes vote down vote up
protected int getContainerOffsetTop() {
	if (containerOffsetTop < 0 || !sync) {
		int scrollTop = 0;
		Element parent = DOM.getParent(getWidget().getElement());
		while (parent != null) {
			if (getScrollTop(parent) > 0) {
				scrollTop += getScrollTop(parent);
				GWT.log("Scroll Top detected : " + scrollTop);
			}
			if (containerFinder.isContainer(parent)) {
				containerOffsetTop = DOM.getAbsoluteTop(parent) - scrollTop;
			}
			parent = DOM.getParent(parent);
		}
	}
	return containerOffsetTop;
}
 
Example 2
Source File: NodeShape.java    From EasyML with Apache License 2.0 6 votes vote down vote up
protected int getContainerOffsetLeft() {
	if (containerOffsetLeft < 0 || !sync) {
		int scrollLeft = 0;
		Element parent = DOM.getParent(getWidget().getElement());
		while (parent != null) {
			if (getScrollLeft(parent) > 0) {
				scrollLeft += getScrollLeft(parent);
				GWT.log("Scroll left detected : " + scrollLeft);
			}
			if (containerFinder.isContainer(parent)) {
				containerOffsetLeft = DOM.getAbsoluteLeft(parent) - scrollLeft;
			}
			parent = DOM.getParent(parent);
		}
	}
	return containerOffsetLeft;
}
 
Example 3
Source File: HistoryViewer.java    From swellrt with Apache License 2.0 6 votes vote down vote up
private ContentDocument createContentDocument(boolean validateSchema) {

    DocInitialization op;
    try {
      op = DocProviders.POJO.parse("").asOperation();
    } catch (IllegalArgumentException e) {
      GWT.log("Exception processing content", e);
      return null;
    }



    if (validateSchema) {
      ViolationCollector vc = new ViolationCollector();
      if (!DocOpValidator.validate(vc, getSchema(), op).isValid()) {
        GWT.log("Error validating content " + vc.firstDescription());
      }
    }
    return new ContentDocument(getRegistries(), op, DOC_SCHEMA);

  }
 
Example 4
Source File: GanttWidget.java    From gantt with Apache License 2.0 6 votes vote down vote up
@Override
public void onPointerDown(PointerDownEvent event) {
    GWT.log("onPointerDown(PointerDownEvent)");

    if (currentPointerEventId == -1) {
        currentPointerEventId = event.getPointerId();
    } else {
        event.preventDefault();
        return; // multi-touch not supported
    }
    pendingPointerDownEvent = event.getNativeEvent();
    capturePoint = new Point(getTouchOrMouseClientX(event.getNativeEvent()),
            getTouchOrMouseClientY(event.getNativeEvent()));
    pointerTouchStartedTimer.schedule(POINTER_TOUCH_DETECTION_INTERVAL);
    event.preventDefault();
}
 
Example 5
Source File: GanttWidget.java    From gantt with Apache License 2.0 6 votes vote down vote up
@Override
public void onMouseUp(MouseUpEvent event) {
    GWT.log("onMouseUp(MouseUpEvent)");
    if (event.getNativeButton() == NativeEvent.BUTTON_LEFT) {
        GanttWidget.this.onTouchOrMouseUp(event.getNativeEvent());

    } else {
        if (secondaryClickOnNextMouseUp) {
            Element bar = getBar(event.getNativeEvent());
            if (bar != null && isEnabled()) {
                getRpc().stepClicked(getStepUid(bar), event.getNativeEvent(), bar);
            }
        }
        secondaryClickOnNextMouseUp = true;
    }
}
 
Example 6
Source File: SvgArrowWidget.java    From gantt with Apache License 2.0 5 votes vote down vote up
@Override
public void onTouchMove(TouchMoveEvent event) {
    GWT.log("SvgArrowWidget.onTouchMove(TouchMoveEvent)");
    if (event.getChangedTouches().length() == 1) {
        handleMove(event.getNativeEvent());
        event.preventDefault();
    }
}
 
Example 7
Source File: SvgArrowWidget.java    From gantt with Apache License 2.0 5 votes vote down vote up
protected void startMoving(NativeEvent event, Element element) {
    if (element.equals(startingPoint)) {
        selectPredecessorMode = true;
        startingPoint.getStyle().setVisibility(Visibility.HIDDEN);
    } else if (element.equals(endingPoint)) {
        selectFollowerMode = true;
        endingPoint.getStyle().setVisibility(Visibility.HIDDEN);
    }
    capturePointScrollTop = getElement().getParentElement()
            .getParentElement().getScrollTop();
    capturePointScrollLeft = getElement().getParentElement()
            .getParentElement().getScrollLeft();
    getParent().getElement().appendChild(movePointElement);
    getElement().getParentElement().addClassName(SELECTION_STYLE_NAME);
    GWT.log("Capturing clicked point.");
    captureElement = getElement();
    Event.setCapture(getElement());
    event.stopPropagation();

    // enable MODE for new predecessor/following step
    // selection.
    addMoveHandler();

    capturePoint = new Point(getTouchOrMouseClientX(event),
            getTouchOrMouseClientY(event));
    originalWidth = width;
    originalHeight = height;
}
 
Example 8
Source File: GanttWidget.java    From gantt with Apache License 2.0 5 votes vote down vote up
/**
 * This is called when target bar element is moved successfully. Element's
 * CSS attributes 'left' and 'width' are updated (unit in pixels).
 *
 * @param bar
 *            Moved Bar element
 * @param y
 */
protected void moveCompleted(Element bar, int y, NativeEvent event) {
    double deltay = y - capturePoint.getY();
    GWT.log("Position delta y: " + deltay + "px" + " capture point y is " + capturePoint.getY());

    Element newPosition = findStepElement(bar, (int) capturePointAbsTopPx,
            (int) (capturePointAbsTopPx + getElementHeightWithMargin(bar)), y, deltay);
    internalMoveOrResizeCompleted(bar, newPosition, true, event);
}
 
Example 9
Source File: GanttWidget.java    From gantt with Apache License 2.0 5 votes vote down vote up
/**
 * @param child
 *            Child widget.
 * @param container
 *            Parent element.
 * @param beforeIndex
 *            Target index of element in DOM.
 * @param domInsert
 *            true: Insert at specific position. false: append at the end.
 */
@Override
protected void insert(Widget child, Element container, int beforeIndex, boolean domInsert) {
    GWT.log("Count content elements: " + content.getChildCount() + " ("
            + getAdditionalNonWidgetContentElementCount() + " non-widget non-step elements, "
            + (getAdditonalContentElementCount() - getAdditionalNonWidgetContentElementCount())
            + " non-step widgets.)");

    // Validate index; adjust if the widget is already a child of this
    // panel.
    int adjustedBeforeStepIndex = adjustIndex(child, beforeIndex - getAdditionalNonWidgetContentElementCount())
            - getAdditionalWidgetContentElementCount();

    // Detach new child. Might also remove additional widgets like
    // predecessor arrows. May affect contentHeight.
    child.removeFromParent();

    // Logical attach.
    getChildren().insert(child, adjustedBeforeStepIndex + getAdditionalWidgetContentElementCount());

    // Physical attach.
    if (domInsert) {
        DOM.insertChild(container, child.getElement(), adjustedBeforeStepIndex + getAdditonalContentElementCount());
    } else {
        DOM.appendChild(container, child.getElement());
    }

    // Adopt.
    adopt(child);
}
 
Example 10
Source File: GanttWidget.java    From gantt with Apache License 2.0 5 votes vote down vote up
/**
 * Update Gantt chart's timeline and content for the given steps. This won't
 * add any steps, but will update the content widths and heights.
 *
 * @param steps
 */
public void update(List<StepWidget> steps) {
    if (startDate < 0 || endDate < 0 || startDate >= endDate) {
        GWT.log("Invalid start and end dates. Gantt chart can't be rendered. Start: " + startDate + ", End: "
                + endDate);
        return;
    }

    content.getStyle().setHeight(contentHeight, Unit.PX);

    GWT.log("GanttWidget's active TimeZone: " + getLocaleDataProvider().getTimeZone().getID() + " (raw offset: "
            + getLocaleDataProvider().getTimeZone().getStandardOffset() + ")");

    timeline.setCurrentDateAndTime(isShowCurrentTime(), getCurrentDate(), getCurrentHour(), getTimestamp());
    // tell timeline to notice vertical scrollbar before updating it
    timeline.setNoticeVerticalScrollbarWidth(isContentOverflowingVertically());
    timeline.update(resolution, startDate, endDate, firstDayOfRange, firstHourOfRange, localeDataProvider);
    setContentMinWidth(timeline.getMinWidth());
    updateContainerStyle();
    updateContentWidth();

    updateStepWidths(steps);

    wasTimelineOverflowingHorizontally = timeline.isTimelineOverflowingHorizontally();

    updateCurrentTime();
}
 
Example 11
Source File: SvgArrowWidget.java    From gantt with Apache License 2.0 5 votes vote down vote up
@Override
public void onPointerDown(PointerDownEvent event) {
    GWT.log("Starting point touched (pointerDown)!");
    if (currentPointerEventId == -1) {
        currentPointerEventId = event.getPointerId();
    } else {
        event.preventDefault();
        return; // multi-touch not supported
    }
    pointerDownPoint = new Point(
            getTouchOrMouseClientX(event.getNativeEvent()),
            getTouchOrMouseClientY(event.getNativeEvent()));
    pendingPointerDownEvent = event.getNativeEvent();
    pointerTouchStartedTimer.schedule(POINTER_TOUCH_DETECTION_INTERVAL);
}
 
Example 12
Source File: SvgArrowWidget.java    From gantt with Apache License 2.0 5 votes vote down vote up
@Override
public void onPointerMove(PointerMoveEvent event) {
    GWT.log("SvgArrowWidget.onPointerMove(PointerMoveEvent)");
    if (pointerDownPoint == null) {
        return;
    }
    // do nothing, if touch position has not changed
    if (!(pointerDownPoint.getX() == getTouchOrMouseClientX(event
            .getNativeEvent()) && pointerDownPoint.getY() == getTouchOrMouseClientY(event
            .getNativeEvent()))) {
        pointerTouchStartedTimer.cancel();
        handleMove(event.getNativeEvent());
    }
}
 
Example 13
Source File: SvgArrowWidget.java    From gantt with Apache License 2.0 4 votes vote down vote up
@Override
public void onPointerCancel(PointerCancelEvent event) {
    GWT.log("SvgArrowWidget.onPointerCancel(PointerCancelEvent)");
    pointerTouchStartedTimer.cancel();
    cancelMove(true, null);
}
 
Example 14
Source File: AppAsyncCallback.java    From bitcoin-transaction-explorer with MIT License 4 votes vote down vote up
@Override
public void onFailure(final Throwable caught) {
  GWT.log(caught.getMessage());
  throw new RuntimeException(caught);
}
 
Example 15
Source File: RPCResponseActivity.java    From bitcoin-transaction-explorer with MIT License 4 votes vote down vote up
@Override
protected void doDeferredError(final AcceptsOneWidget panel, final Throwable caught) {
  GWT.log("Crapped out.");
}
 
Example 16
Source File: SvgArrowWidget.java    From gantt with Apache License 2.0 4 votes vote down vote up
@Override
public void onMouseMove(MouseMoveEvent event) {
    GWT.log("SvgArrowWidget.onMouseMove(MouseMoveEvent)");

    handleMove(event.getNativeEvent());
}
 
Example 17
Source File: AddressActivity.java    From bitcoin-transaction-explorer with MIT License 4 votes vote down vote up
@Override
protected void doDeferredError(final AcceptsOneWidget panel, final Throwable caught) {
  // Not supported
  GWT.log("boohoo " + caught.getMessage());
}
 
Example 18
Source File: GanttWidget.java    From gantt with Apache License 2.0 4 votes vote down vote up
/**
 * Handle step's move event.
 *
 * @param event
 *            NativeEvent
 * @return True, if this event was handled and had effect on step.
 */
protected boolean onTouchOrMouseMove(NativeEvent event) {
    Element bar = getBar(event);
    if (bar != null) {
        movePoint = new Point(getTouchOrMouseClientX(event), getTouchOrMouseClientY(event));
        showResizingPointer(bar, detectResizing(bar));
    }

    if (targetBarElement == null) {
        return false;
    }
    bar = targetBarElement;

    doubleClickDetectionMaxTimer.cancel();
    disallowClickTimer.cancel();
    clickOnNextMouseUp = false;
    cancelDoubleClickDetection();

    // calculate delta x and y by original position and the current one.
    double deltax = getTouchOrMouseClientX(event) - capturePoint.getX();
    double deltay = getTouchOrMouseClientY(event) - capturePoint.getY();

    GWT.log("Position delta x: " + deltax + "px");

    if (resizing) {
        resizingInProgress = deltax != 0.0;
        if (resizingFromLeft) {
            updateBarResizingLeft(bar, deltax);
        } else {
            updateBarResizingRight(bar, deltax);
        }
        addResizingStyles(bar);
        bar.getStyle().clearBackgroundColor();
    } else if (isMovableStep(bar)) {
        updateMoveInProgressFlag(bar, deltax, deltay);
        updateBarMovingPosition(bar, deltax);
        addMovingStyles(bar);
        bar.getStyle().clearBackgroundColor();
        if (isMovableStepsBetweenRows(bar)) {
            updateBarYPosition(bar, deltay);
        }
    }

    // event.stopPropagation();
    return true;
}
 
Example 19
Source File: Console.java    From openchemlib-js with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public static void println(String s) {
    System.out.println(s);
    GWT.log(s);
    log(s);
}
 
Example 20
Source File: HistoryViewer.java    From swellrt with Apache License 2.0 3 votes vote down vote up
public void init() {

    try {

      // EditorWebDriverUtil.setDocumentSchema(ConversationSchemas.BLIP_SCHEMA_CONSTRAINTS);
      registerDoodads(getRegistries());

      //
      // Document viewer (using editor)
      //

      docViewer = createEditor("docViewer");
      docViewer.init(getRegistries(), new KeyBindingRegistry(), getSettings());

      docHistory = SampleDocHistories.getHistoryOne();
      playbackDoc = new PlaybackDocument(getRegistries(), getSchema(), docHistory);
      docViewer.setContent(playbackDoc.getDocument());
      docViewer.setEditing(false);

      // Render a content document in a panel
      /*
       * editorPanel.add(displayDoc2); doc2 =
       * createContentDocument("This is doc two", false); doc2.setRendering();
       * displayDoc2.getElement()
       * .appendChild(doc2.getFullContentView().getDocumentElement().
       * getImplNodelet());
       */




      buildUI();



    } catch (RuntimeException ex) {
      GWT.log("Fatal Exception", ex);
    }
  }