Examples of Canvas


Examples of org.codehaus.enunciate.examples.objc.schema.draw.Canvas

    if (this.skipObjCTests) {
      System.out.println("C tests have been disabled.");
      return;
    }

    Canvas canvas = new Canvas();
    Bus bus = new Bus();
    bus.setId("busId");
    Rectangle busFrame = new Rectangle();
    busFrame.setWidth(100);
    bus.setFrame(busFrame);
    Cat cat = new Cat();
    cat.setId("catId");
    Circle catFace = new Circle();
    catFace.setRadius(30);
    cat.setFace(catFace);
    House house = new House();
    house.setId("houseId");
    Rectangle houseBase = new Rectangle();
    houseBase.setWidth(76);
    house.setBase(houseBase);
    canvas.setFigures(Arrays.asList(bus, cat, house));
    Rectangle rectangle = new Rectangle();
    rectangle.setHeight(50);
    rectangle.setId("rectId");
    Circle circle = new Circle();
    circle.setRadius(10);
    circle.setId("circleId");
    Triangle triangle = new Triangle();
    triangle.setBase(80);
    triangle.setId("triId");
    canvas.setShapes(Arrays.asList(rectangle, circle, triangle));
//    byte[] swaRefBytes = "This is a bunch of random bytes that are to be used as an SWA ref attachment.".getBytes();
//    byte[] explicitBase64Bytes = "This is some more random bytes that are to be used as a base 64 encoded attachment.".getBytes();
//    byte[] attachment1Bytes = "This is some more random bytes that are to be used as the first MTOM attachment.".getBytes();
//    byte[] attachment2Bytes = "This is some more random bytes that are to be used as the second MTOM attachment.".getBytes();
//    byte[] attachment3Bytes = "This is some more random bytes that are to be used as the third MTOM attachment.".getBytes();
//    CanvasAttachment attachment1 = new CanvasAttachment();
//    attachment1.setValue(attachment1Bytes);
//    CanvasAttachment attachment2 = new CanvasAttachment();
//    attachment2.setValue(attachment2Bytes);
//    CanvasAttachment attachment3 = new CanvasAttachment();
//    attachment3.setValue(attachment3Bytes);
//    ByteArrayDataSource dataSource = new ByteArrayDataSource(swaRefBytes, "application/octet-stream");
//    dataSource.setName("somename");
//    canvas.setBackgroundImage(new DataHandler(dataSource));
//    canvas.setExplicitBase64Attachment(explicitBase64Bytes);
//    canvas.setOtherAttachments(Arrays.asList(attachment1, attachment2, attachment3));

    canvas = processThroughXml(canvas);

    Collection shapes = canvas.getShapes();
    assertEquals(3, shapes.size());
    for (Object Shape : shapes) {
      if (Shape instanceof Circle) {
        assertEquals("circleId", ((Circle) Shape).getId());
        assertEquals(10, ((Circle) Shape).getRadius());
      }
      else if (Shape instanceof Rectangle) {
        assertEquals("rectId", ((Rectangle) Shape).getId());
        assertEquals(50, ((Rectangle) Shape).getHeight());
      }
      else if (Shape instanceof Triangle) {
        assertEquals("triId", ((Triangle) Shape).getId());
        assertEquals(80, ((Triangle) Shape).getBase());
      }
      else {
        fail("Unknown shape: " + Shape);
      }
    }

    Collection figures = canvas.getFigures();
    assertEquals(3, figures.size());
    for (Object Figure : figures) {
      if (Figure instanceof Bus) {
        bus = (Bus) Figure;
        assertEquals("busId", bus.getId());
View Full Code Here

Examples of org.codehaus.enunciate.examples.php.schema.draw.Canvas

    if (this.skipPHPTests) {
      System.out.println("PHP tests have been disabled.");
      return;
    }

    Canvas canvas = new Canvas();
    Bus bus = new Bus();
    bus.setId("busId");
    Rectangle busFrame = new Rectangle();
    busFrame.setWidth(100);
    bus.setFrame(busFrame);
    Cat cat = new Cat();
    cat.setId("catId");
    Circle catFace = new Circle();
    catFace.setRadius(30);
    cat.setFace(catFace);
    House house = new House();
    house.setId("houseId");
    Rectangle houseBase = new Rectangle();
    houseBase.setWidth(76);
    house.setBase(houseBase);
    canvas.setFigures(Arrays.asList(bus, cat, house));
    Rectangle rectangle = new Rectangle();
    rectangle.setHeight(50);
    rectangle.setId("rectId");
    Circle circle = new Circle();
    circle.setRadius(10);
    circle.setId("circleId");
    Triangle triangle = new Triangle();
    triangle.setBase(80);
    triangle.setId("triId");
    //canvas.setShapes(Arrays.asList(rectangle, circle, triangle));
//    byte[] swaRefBytes = "This is a bunch of random bytes that are to be used as an SWA ref attachment.".getBytes();
//    byte[] explicitBase64Bytes = "This is some more random bytes that are to be used as a base 64 encoded attachment.".getBytes();
//    byte[] attachment1Bytes = "This is some more random bytes that are to be used as the first MTOM attachment.".getBytes();
//    byte[] attachment2Bytes = "This is some more random bytes that are to be used as the second MTOM attachment.".getBytes();
//    byte[] attachment3Bytes = "This is some more random bytes that are to be used as the third MTOM attachment.".getBytes();
//    CanvasAttachment attachment1 = new CanvasAttachment();
//    attachment1.setValue(attachment1Bytes);
//    CanvasAttachment attachment2 = new CanvasAttachment();
//    attachment2.setValue(attachment2Bytes);
//    CanvasAttachment attachment3 = new CanvasAttachment();
//    attachment3.setValue(attachment3Bytes);
//    ByteArrayDataSource dataSource = new ByteArrayDataSource(swaRefBytes, "application/octet-stream");
//    dataSource.setName("somename");
//    canvas.setBackgroundImage(new DataHandler(dataSource));
//    canvas.setExplicitBase64Attachment(explicitBase64Bytes);
//    canvas.setOtherAttachments(Arrays.asList(attachment1, attachment2, attachment3));

    canvas = processThroughXml(canvas);

    //Collection shapes = canvas.getShapes();
    //assertEquals(3, shapes.size());
    //todo: uncomment with support for @XmlElementRefs.
//    for (Object Shape : shapes) {
//      if (Shape instanceof Circle) {
//        assertEquals("circleId", ((Circle) Shape).getId());
//        assertEquals(10, ((Circle) Shape).getRadius());
//      }
//      else if (Shape instanceof Rectangle) {
//        assertEquals("rectId", ((Rectangle) Shape).getId());
//        assertEquals(50, ((Rectangle) Shape).getHeight());
//      }
//      else if (Shape instanceof Triangle) {
//        assertEquals("triId", ((Triangle) Shape).getId());
//        assertEquals(80, ((Triangle) Shape).getBase());
//      }
//      else {
//        fail("Unknown shape: " + Shape);
//      }
//    }

    Collection figures = canvas.getFigures();
    assertEquals(3, figures.size());
    for (Object Figure : figures) {
      if (Figure instanceof Bus) {
        bus = (Bus) Figure;
        assertEquals("busId", bus.getId());
View Full Code Here

Examples of org.eclipse.swt.widgets.Canvas

    return "PeersGraphicView.title";
  }

  public void initialize(Composite composite) {
    display = composite.getDisplay();
    panel = new Canvas(composite,SWT.NULL);
  }
View Full Code Here

Examples of org.eclipse.swt.widgets.Canvas

    splash = new Shell(display, SWT.NO_TRIM);
    splash.setText(Constants.APP_NAME);
    Utils.setShellIcon(splash);

    splash.setLayout(new FillLayout());
    canvas = new Canvas(splash, SWT.DOUBLE_BUFFERED);

    ImageLoader imageLoader = ImageLoader.getInstance();
    background = imageLoader.getImage(IMG_SPLASH);
    if (ImageLoader.isRealImage(background)) {
      width = background.getBounds().width;
View Full Code Here

Examples of org.eclipse.swt.widgets.Canvas

      new Label( shell, SWT.NULL );
     
    }else{

      final Rectangle spinBounds = spinImages[0].getBounds();
        final Canvas  canvas =
          new Canvas( shell, SWT.NULL )
          {
            public Point computeSize(int wHint, int hHint,boolean changed )
            {
              return( new Point(spinBounds.width, spinBounds.height));
            }
          };
         
          canvas.addPaintListener(new PaintListener() {
            public void paintControl(PaintEvent e) {
              e.gc.drawImage(spinImages[curSpinIndex ], 0, 0);
            }
          });
         
          Utils.execSWTThreadLater(100, new AERunnable() {
            public void runSupport() {
              if (canvas == null || canvas.isDisposed()) {
                return;
              }

              canvas.redraw();
              canvas.update();
              if (curSpinIndex == spinImages.length - 1) {
                curSpinIndex = 0;
              } else {
                curSpinIndex++;
              }
View Full Code Here

Examples of org.eclipse.swt.widgets.Canvas

      Composite colorSet = new Composite(legend, SWT.NONE);

      colorSet.setLayout(new RowLayout(SWT.HORIZONTAL));

      final Canvas cColor = new Canvas(colorSet, SWT.BORDER);
      cColor.setData("Index", new Integer(i));
      // XXX Use paint instead of setBackgrond, because OSX does translucent
      // crap
      cColor.addPaintListener(new PaintListener() {
        public void paintControl(PaintEvent e) {
          int i = ((Integer)cColor.getData("Index")).intValue();
          e.gc.setBackground(blockColors[i]);
          e.gc.fillRectangle(e.x, e.y, e.width, e.height);
        }
      });

      cColor.addMouseListener(new MouseAdapter() {
        public void mouseUp(MouseEvent e) {
          Integer iIndex = (Integer)cColor.getData("Index");
          if (iIndex == null)
            return;
          int index = iIndex.intValue();

          if (e.button == 1) {
            ColorDialog cd = new ColorDialog(panel.getShell());
            cd.setRGB(blockColors[index].getRGB());
           
            RGB rgb = cd.open();
            if (rgb != null)
              config.setRGBParameter(keys[index], rgb.red, rgb.green, rgb.blue);
          } else {
            config.removeRGBParameter(keys[index]);
          }
        }
      });

      Label lblDesc = new Label(colorSet, SWT.NULL);
      Messages.setLanguageText(lblDesc, keys[i]);

      data = new RowData();
      data.width = 20;
      data.height = lblDesc.computeSize(SWT.DEFAULT, SWT.DEFAULT).y - 3;
      cColor.setLayoutData(data);
     
      // If color changes, update our legend
      config.addParameterListener(keys[i],paramListeners[i] = new ParameterListener() {
        public void parameterChanged(String parameterName) {
          for (int j = 0; j < keys.length; j++) {
            if (keys[j].equals(parameterName)) {
              final int index = j;

              final int r = config.getIntParameter(keys[j] + ".red", -1);
              if (r >= 0) {
                final int g = config.getIntParameter(keys[j] + ".green");
                final int b = config.getIntParameter(keys[j] + ".blue");
               
                final RGB rgb = new RGB(r, g, b);
                if (blockColors[j].isDisposed()
                    || !rgb.equals(blockColors[j].getRGB())) {

                  Utils.execSWTThread(new AERunnable() {
                    public void runSupport() {
                      if (panel == null || panel.isDisposed())
                        return;
                      Color color = ColorCache.getColor(panel.getDisplay(), r, g, b);
                      blockColors[index] = color;
                      cColor.redraw();
                    }
                  });
                }
              } else {
                if (blockColors[j].isDisposed()
                    || !blockColors[j].equals(defaultColors[j])) {
                  Utils.execSWTThread(new AERunnable() {
                    public void runSupport() {
                      if (panel == null || panel.isDisposed())
                        return;
                      blockColors[index] = defaultColors[index];
                      cColor.redraw();
                    }
                  });
                }
              }
            }
View Full Code Here

Examples of org.eclipse.swt.widgets.Canvas

    Messages.setLanguageText(lbl,"CacheView.speeds.writes");
   
    lbl = new Label(gCacheSpeeds,SWT.NULL);
    Messages.setLanguageText(lbl,"CacheView.speeds.fromCache");
   
    readsFromCache = new Canvas(gCacheSpeeds,SWT.NO_BACKGROUND);
    gridData = new GridData(GridData.FILL_BOTH);
    readsFromCache.setLayoutData(gridData);
    rfcGraph = SpeedGraphic.getInstance();
    rfcGraph.initialize(readsFromCache);
   
   
    writesToCache = new Canvas(gCacheSpeeds,SWT.NO_BACKGROUND);
    gridData = new GridData(GridData.FILL_BOTH);
    writesToCache.setLayoutData(gridData);
    wtcGraph = SpeedGraphic.getInstance();
    wtcGraph.initialize(writesToCache);
   
    lbl = new Label(gCacheSpeeds,SWT.NULL);
    Messages.setLanguageText(lbl,"CacheView.speeds.fromFile");
   
    readsFromFile = new Canvas(gCacheSpeeds,SWT.NO_BACKGROUND);
    gridData = new GridData(GridData.FILL_BOTH);
    readsFromFile.setLayoutData(gridData);
    rffGraph = SpeedGraphic.getInstance();
    rffGraph.initialize(readsFromFile);
   
    writesToFile = new Canvas(gCacheSpeeds,SWT.NO_BACKGROUND);
    gridData = new GridData(GridData.FILL_BOTH);
    writesToFile.setLayoutData(gridData);
    wtfGraph = SpeedGraphic.getInstance();
    wtfGraph.initialize(writesToFile);
  }
View Full Code Here

Examples of org.eclipse.swt.widgets.Canvas

  }

  public void initialize(Composite composite) {
    GridData gridData;

    upSpeedCanvas = new Canvas(composite, SWT.DOUBLE_BUFFERED);
    gridData = new GridData(GridData.FILL_BOTH);
    upSpeedCanvas.setLayoutData(gridData);
    upSpeedGraphic = SpeedGraphic.getInstance();
    upSpeedGraphic.initialize(upSpeedCanvas);
    //upSpeedGraphic.setAutoAlpha(true);
View Full Code Here

Examples of org.eclipse.swt.widgets.Canvas

  }

  public void initialize(Composite composite) {
    GridData gridData;

    downSpeedCanvas = new Canvas(composite, SWT.DOUBLE_BUFFERED);
    gridData = new GridData(GridData.FILL_BOTH);
    downSpeedCanvas.setLayoutData(gridData);
    downSpeedGraphic = SpeedGraphic.getInstance();
    downSpeedGraphic.initialize(downSpeedCanvas);
    //downSpeedGraphic.setAutoAlpha(true);
View Full Code Here

Examples of org.eclipse.swt.widgets.Canvas

      createOn = skin.getShell();
    } else {
      createOn = (Composite) parent.getControl();
    }

    canvas = new Canvas(createOn, style);
    canvas.setLayoutData(new FormData(maxSize.x == 0 ? SWT.DEFAULT
        : maxSize.x, maxSize.y));
    canvas.setSize(SWT.DEFAULT, maxSize.y);
    setControl(canvas);
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.