Menu

How to access a DOM object?

al0
2007-03-22
2013-04-24
  • al0

    al0 - 2007-03-22

    Hello,

    as far as I can see there is no way to find ID of a DOM object that backs up specific ThinWire Java object as method getComponentId() of
    WindowRenderer has package scope (and, additionaly, it is not clear how to obtain WindowRenderer object itself).

    In my opinion, this information is desperatly needed if someone tries to integrate ThinWire with external JavaScript libraries that provide features unavailable in the ThinWire at the moment. E.g. hints, "vector" graphic etc.

    Regards,
    Oleksandr

     
    • Joshua Gertzen

      Joshua Gertzen - 2007-04-19

      No longer true in the latest builds:

      WebApplication app = (WebApplication)Application.current()

      Component tf = new TextField().setBounds(100, 25, 5, 5);
      app.getFrame().getChildren().add(tf);

      //Get the component id
      Integer id = app.getComponentId(tf);

      //Get the component from an id
      Component tfFromId = app.getComponentFromId(tfFromId);

      Additionally, it's possible to add a RenderStateListener to WebApplication so that you receive a call back when the component is actually rendered.  This is helpful if you don't know for sure when the rendering will occur.  Keep in mind though, you must remove the RenderStateListener within the callback or at some point in the future, otherwise it will linger.

       
      • al0

        al0 - 2007-04-19

        Thank you for response, I has overlooked that WebApplication had this method as well, sorry :(

        But what to do in the latest (and forthcomig) builds?

        I need this functionality mostly to integrate with external JS libraries. There are a lot of them and some provide functionality that is absent in ThinWire and is not likely to be included soon (if ever).

        Regards,
        Oleksandr

         
    • al0

      al0 - 2007-04-19

      Hello,

      thank you. I would try.

      Regards,
      Oleksandr

       

Log in to post a comment.

MongoDB Logo MongoDB