Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to drag a window outside of the browser bounds.

    I am using Smart GWT Power User 3.0. In my application, I am creating a Window and populating it with various Smart GWT widgets. My end user wishes to be able to drag the window outside of the browser boundary so that it doesn't cover existing widgets in the main browser window. Is this possible with the Window object? If not, is there a different way of accomplishing this?

    #2
    There's no way in a web browser to just drag out a DHTML/JS Window component to create a new OS-level window (this would be a browser sandbox issue). The closest thing is to offer a "pop-out" button that uses window.open() to create a new browser window which includes a subset of the user interface - this is style used in gmail, for instance (although gmail is not GWT).

    The URL of this new browser window can either be a distinct GWT EntryPoint, or just has URL parameters which the Java code in your EntryPoint detect and uses to show just certain UI components.

    Any communication between the two browser windows is usually best accomplished via relaying through the server. Cross-frame communication is full of nasty surprises with just JavaScript, and GWT's JSNI makes it more complex yet.

    Comment


      #3
      Thank you for the quick response. I would like to attempt your second suggestion:

      "...or just has URL parameters which the Java code in your EntryPoint detect and uses to show just certain UI components"

      I am not that familiar with the EntryPoint code. I see my EntryPoint class overwrites onModuleLoad() but that's all it does. I would appreciate it if you could just briefly describe where I would put code to detect the URL parameters and what that codes signature would be.

      Comment


        #4
        EntryPoint.onModuleLoad() is where you would put the code. Core GWT (not SmartGWT) APIs on the GWT Window class give you access to context like the URL of the page (see eg this Q&A).

        Comment


          #5
          Should I expect that my EntryPoint.onModuleLoad() will be called each time I issue the Window.open() with the correct url? I only see it being called the very first time.

          Comment


            #6
            You should, yes. What you may be seeing is that you already have a Window open at that URL with a cacheable .html bootstrap file, so on your second window.open(), the browser is using the cached copy and never contacting the server at all.

            Comment


              #7
              I see. Yes, that is the case. So for my situation, does that argue for creating a new GWT Module with it's own EntryPoint. One that doesn't have a cacheable .html bootstrap file?

              Comment


                #8
                No. Just use HTTP headers to prevent caching, or if unfamiliar with this, add a random value to the URL.

                Comment

                Working...
                X