Panel refreshing

GWT Designer allows you to quickly create the modules, composites, panels, remote services and other elements that comprise Google Web Tookit applications.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Panel refreshing

Postby seth_king » Mon Nov 06, 2006 8:47 am

I am trying to place a Login panel in the upper right corner. I have an absolute panel set to 100% then I am placing the flow panel based on the width. I can get the panel is move based on the browser's size but I have to refresh to get the panel to update. How can I get the panels to update as the browser is resizing, in realtime.

thanks
seth_king
 
Posts: 3
Joined: Thu Nov 02, 2006 5:32 am

Postby Konstantin.Scheglov » Wed Nov 08, 2006 1:13 am

There are many ways to do this. See below example with two ways - using HorizontalPanel and manually. Variant with Panel's is more simple, but manual gives you most flexibility, for example you can also resize your Login panel, or something like this.

Code: Select all
public class ImageViewer implements EntryPoint {
   final RootPanel rootPanel = RootPanel.get();
   public void onModuleLoad() {
      // first variant - using panels
      {
         final HorizontalPanel horizontalPanel = new HorizontalPanel();
         rootPanel.add(horizontalPanel);
         horizontalPanel.setWidth("100%");
         {
            final Button button = new Button();
            horizontalPanel.add(button);
            horizontalPanel.setCellHorizontalAlignment(button, HasHorizontalAlignment.ALIGN_RIGHT);
            button.setText("New Button");
         }
      }
      // second variant - manual, most flexible
      {
         final Button button = new Button();
         rootPanel.add(button);
         button.setText("New Button");
         WindowResizeListener resizeListener = new WindowResizeListener() {
            public void onWindowResized(int width, int height) {
               int x = width - button.getOffsetWidth();
               int y = height - button.getOffsetHeight();
               rootPanel.setWidgetPosition(button, x, y);
            }
         };
         resizeListener.onWindowResized(Window.getClientWidth(), Window.getClientHeight());
         Window.addWindowResizeListener(resizeListener);
      }
   }
}
Konstantin.Scheglov
Moderator
 
Posts: 186
Joined: Tue Oct 18, 2005 8:11 pm
Location: Russian Federation, Lipetsk


Return to GWT Designer

Who is online

Users browsing this forum: No registered users and 3 guests