Example usage for com.google.gwt.graphics.client Color BLACK

List of usage examples for com.google.gwt.graphics.client Color BLACK

Introduction

In this page you can find the example usage for com.google.gwt.graphics.client Color BLACK.

Prototype

Color BLACK

To view the source code for com.google.gwt.graphics.client Color BLACK.

Click Source Link

Usage

From source file:com.google.speedtracer.client.view.GraphCallout.java

License:Apache License

private void paint(int xPosition, int durationPixels) {
    canvas.setStrokeStyle(Color.BLACK);
    canvas.setLineWidth(2.0);/* w ww.j  a v  a  2s . co m*/
    canvas.beginPath();

    // Determine which horizontal direction the leader should be drawn.
    int distanceFromRight = Window.getInnerWidth() - (parentElement.getAbsoluteLeft() + xPosition);
    boolean reverseLeader = distanceFromRight < reverseTippingPoint;
    Style canvasStyle = canvas.getElement().getStyle();
    Style labelStyle = label.getStyle();
    Style durationStyle = element.getStyle();

    // If the duration div runs off of the left, it overwrites the
    // title, so fix that up.
    if (xPosition <= 0) {
        durationPixels += xPosition;
        xPosition = 0;
        durationStyle.setProperty("borderLeft", "none");
    } else {
        durationStyle.setProperty("borderLeft", "1px solid #000");
    }

    // Set the width of the duration div
    if (reverseLeader) {
        durationPixels = Math.min(distanceFromRight, durationPixels);
    }

    durationStyle.setProperty("display", "block");
    durationStyle.setPropertyPx("width", Math.max(durationPixels, MINIMUM_DURATION_DISPLAY_WIDTH));

    durationStyle.setPropertyPx("left", xPosition);

    if (reverseLeader) {
        // Close to the right margin, so flip the direction of the leader
        // draw the vertical part on the right side of the canvas.
        labelStyle.setPropertyPx("left", -(css.leadWidth() + label.getOffsetWidth()));
        canvasStyle.setPropertyPx("left", -css.leadWidth());
        // Draw the leader
        canvas.moveTo(css.leadWidth(), css.leadHeight());
        canvas.setLineWidth(1.0);
        canvas.lineTo(0, 0);
    } else {
        // Draw the vertical part of the leader on the left side of the canvas.
        // If the xPosition would run into the scale label, move it over a little.
        int labelOffset = css.leadWidth() + ((xPosition <= 20) ? 20 : 0);
        labelStyle.setPropertyPx("left", labelOffset);
        canvasStyle.setPropertyPx("left", 0);
        // Draw the leader
        canvas.moveTo(0, css.leadHeight());
        canvas.setLineWidth(0.5);
        canvas.lineTo(css.leadWidth(), 0);
    }
    canvas.stroke();
}

From source file:com.google.speedtracer.client.visualizations.view.HintletIndicator.java

License:Apache License

public static String getSeverityColor(int severity) {
    Css css = MonitorResources.getResources().hintletIndicatorCss();
    switch (severity) {
    case HintRecord.SEVERITY_VALIDATION:
        return css.hintletSeverityColorValidation();
    case HintRecord.SEVERITY_CRITICAL:
        return css.hintletSeverityColorCritical();
    case HintRecord.SEVERITY_WARNING:
        return css.hintletSeverityColorWarning();
    case HintRecord.SEVERITY_INFO:
        return css.hintletSeverityColorInfo();
    }/*from  w ww .j  a  v a 2  s .c o  m*/
    return Color.BLACK.toString();
}

From source file:org.gwt.speedchart.client.graph.AbstractGraph.java

License:Open Source License

protected void beginDrawing() {
    canvas.clear();//www .ja  v  a  2  s  .  c  om

    if (chartUiProps.isDrawBorders()) {
        canvas.setFillStyle(Color.BLACK);
        canvas.fillRect(0, COORD_Y_HEIGHT - 1, COORD_X_WIDTH - 1, 1);
        canvas.fillRect(0, 0, 1, COORD_Y_HEIGHT - 1);
    }
}

From source file:org.gwt.speedchart.client.graph.axis.DomainAxis.java

License:Open Source License

private void drawTick(double ux, int tickLength) {
    canvas.setFillStyle(Color.BLACK);
    canvas.fillRect(ux, 0, 2, tickLength);
}