Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting new size #1

Open
darkman97i opened this issue Jul 24, 2014 · 0 comments
Open

Setting new size #1

darkman97i opened this issue Jul 24, 2014 · 0 comments

Comments

@darkman97i
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant