Skip to content

Setting new size #1

@darkman97i

Description

@darkman97i

I do not know if there's something I missing, but I think initial canvas dimensions are hardcode in GraphGWT class line 14, 15 ( int height = 500; ) among other lines.

I've extended the ArborJS to be able to change this default dimensions, I do not know know if there's other way for doing it actually. My suggestion wil be add a new constructor in ArborJS to set widht and height and not needed to extend the class. Also I've included resize method ( this I thing will be good idea, because sometimes panels change size )

import com.google.gwt.canvas.client.Canvas;
import com.google.gwt.user.client.ui.Widget;
import com.temis.client.arborjs.ArborJS;

/**

  • ExtendedArborJS

  • @author jllort
    *
    */
    public class ExtendedArborJS extends ArborJS {
    private Canvas canvas;

    @OverRide
    public Widget getImplementationWidget(int height, int width, String name) {
    Canvas canvas = Canvas.createIfSupported();
    canvas.setWidth(String.valueOf(width) + "px");
    canvas.setHeight(String.valueOf(height) + "px");
    canvas.setCoordinateSpaceWidth(width);
    canvas.setCoordinateSpaceHeight(height);
    canvas.getElement().setId(name);
    this.canvas = canvas;
    return canvas;
    }

    /**

    • resize
      */
      public void resize(int newWidht, int newHeight) {
      canvas.setWidth(String.valueOf(newWidht) + "px");
      canvas.setHeight(String.valueOf(newHeight) + "px");
      canvas.setCoordinateSpaceWidth(newWidht);
      canvas.setCoordinateSpaceHeight(newHeight);
      }
      }

Finally: Really good work, we got about 1-2 weeks using it on experimental environment and for the moment seems all goes fine. I've tryed to send some mail to you directly but I've not been able to found your mail address.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions