Example usage for com.google.gwt.widgetideas.graphics.client Color DARK_BLUE

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

Introduction

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

Prototype

Color DARK_BLUE

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

Click Source Link

Usage

From source file:eml.studio.client.ui.widget.program.ProgramWidget.java

License:Open Source License

/**
 * Draw widget at canvas/* w w w  .  j  av  a2 s  . com*/
 */
@Override
protected void custom() {
    canvas.clear();
    //Get the number of input and output NodeShape
    int inCount = inNodeShapes.size();
    int outCount = outNodeShapes.size();

    //Gets the top and bottom positions of the controls
    double top = offsetTop + boder / 2;
    double bottom = offsetTop + offsetHeight - boder / 2;

    //The interval between each top NodeShape
    double span = offsetWidth / (1 + inCount);
    for (int i = 0; i < inCount; ++i) {
        NodeShape nodeShape = this.inNodeShapes.get(i);
        nodeShape.setLeftRelative(offsetLeft + span * (i + 1));
        nodeShape.setTopRelative(top);
        canvas.beginPath();
        canvas.arc(nodeShape.getLeftRelative(), nodeShape.getTopRelative(), 3, 0, Math.PI * 2.0, true);
        canvas.setStrokeStyle(Color.DARK_BLUE);
        canvas.stroke();
        canvas.setFillStyle(Color.DARK_BLUE);
        canvas.fill();
        canvas.closePath();
    }
    //The interval between each bottom NodeShpae
    span = offsetWidth / (1 + outCount);
    for (int i = 0; i < outCount; ++i) {
        NodeShape nodeShape = outNodeShapes.get(i);// new OutNodeShape(this,
        nodeShape.setLeftRelative(offsetLeft + span * (i + 1));
        nodeShape.setTopRelative(bottom);
        canvas.beginPath();
        canvas.arc(nodeShape.getLeftRelative(), nodeShape.getTopRelative(), 3, 0, Math.PI * 2.0, true);
        canvas.setStrokeStyle(Color.GREEN);
        canvas.stroke();
        canvas.setFillStyle(Color.GREEN);
        canvas.fill();
        canvas.closePath();
    }
}