Example usage for com.google.gwt.user.client Window addResizeHandler

List of usage examples for com.google.gwt.user.client Window addResizeHandler

Introduction

In this page you can find the example usage for com.google.gwt.user.client Window addResizeHandler.

Prototype

public static HandlerRegistration addResizeHandler(ResizeHandler handler) 

Source Link

Usage

From source file:com.gwtplatform.mvp.client.PopupViewImpl.java

License:Apache License

/**
 * @param eventBus The {@link EventBus}.
 * @param positioner The {@link PopupPositioner} used to position the popup onReveal();
 *
 * @see com.gwtplatform.mvp.client.view.CenterPopupPositioner
 * @see com.gwtplatform.mvp.client.view.RelativeToWidgetPopupPositioner
 * @see com.gwtplatform.mvp.client.view.TopLeftPopupPositioner
 *///from w w w  . j  a v a  2s.c o  m
protected PopupViewImpl(EventBus eventBus, PopupPositioner positioner) {
    this.eventBus = eventBus;
    setPopupPositioner(positioner);
    if (repositionOnWindowResize()) {
        Window.addResizeHandler(new ResizeHandler() {
            @Override
            public void onResize(ResizeEvent event) {
                if (asPopupPanel().isShowing()) {
                    showAndReposition();
                }
            }
        });
    }
}

From source file:com.gwttest.client.ui.ResizableWidgetCollection.java

License:Open Source License

/**
 * Set whether or not resize checking is enabled. If disabled, elements will
 * still be resized on window events, but the timer will not check their
 * dimensions periodically.//  ww  w  .  jav  a2s  .  c  o  m
 * 
 * @param enabled
 *            true to enable the resize checking timer
 */
public void setResizeCheckingEnabled(boolean enabled) {
    if (enabled && !resizeCheckingEnabled) {
        resizeCheckingEnabled = true;
        if (windowHandler == null) {
            windowHandler = Window.addResizeHandler(new ResizeHandler() {
                public void onResize(ResizeEvent event) {
                    onWindowResized(event.getWidth(), event.getHeight());
                }
            });
        }
        resizeCheckTimer.schedule(resizeCheckDelay);
    } else if (!enabled && resizeCheckingEnabled) {
        resizeCheckingEnabled = false;
        if (windowHandler != null) {
            windowHandler.removeHandler();
            windowHandler = null;
        }
        resizeCheckTimer.cancel();
    }
}

From source file:com.ikon.frontend.client.panel.ExtendedDockPanel.java

License:Open Source License

/**
 * Extended dock panel//from  w  w w  .j  ava  2s.  c  o m
 */
public ExtendedDockPanel() {
    dockPanel = new DockLayoutPanel(Unit.PX);
    folderSelectPopup = new FolderSelectPopup();
    enableKeyShorcuts();

    // Object initialization
    topPanel = new TopPanel();
    leftBorderPanel = new VerticalBorderPanel();
    rightBorderPanel = new VerticalBorderPanel();
    bottomPanel = new BottomPanel();

    // Desktop panels initialization
    desktop = new Desktop();

    // Search panels initialization
    search = new Search();

    // Dashboard panel initialization
    dashboard = new Dashboard();

    // Administration panel initialization
    administration = new Administration();

    // set inner component's size
    SetWidgetsSize();

    actualView = UIDockPanelConstants.DESKTOP;

    // Creates the dockPanel
    dockPanel.addNorth(topPanel, TopPanel.PANEL_HEIGHT);
    dockPanel.addSouth(bottomPanel, BottomPanel.PANEL_HEIGHT);
    dockPanel.addWest(leftBorderPanel, VERTICAL_BORDER_PANEL_WIDTH);
    dockPanel.addEast(rightBorderPanel, VERTICAL_BORDER_PANEL_WIDTH);
    dockPanel.add(desktop);

    Window.addResizeHandler(new ResizeHandler() {
        @Override
        public void onResize(ResizeEvent event) {
            SetWidgetsSize();
        }
    });

    initWidget(dockPanel);
}

From source file:com.jcommerce.gwt.client.panels.goods.CategoryInfo.java

License:Apache License

protected void onRender(Element parent, int index) {
    super.onRender(parent, index);

    BasePagingLoader loader = new PagingListService().getLoader(ModelNames.CATEGORY);

    loader.load(0, 50);//from w  w  w. ja v a  2s  .c o  m

    final ListStore<BeanObject> store = new ListStore<BeanObject>(loader);

    store.addStoreListener(new StoreListener<BeanObject>() {
        public void storeUpdate(StoreEvent<BeanObject> se) {
            List<Record> changed = store.getModifiedRecords();
        }
    });

    toolBar = new PagingToolBar(50);
    toolBar.bind(loader);

    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
    //CheckBoxSelectionModel<BeanObject> sm = new CheckBoxSelectionModel<BeanObject>();
    //columns.add(sm.getColumn());        
    columns.add(new ColumnConfig(ICategory.NAME, "??", 150));
    columns.add(new ColumnConfig(ICategory.MEASUREUNIT, "???", 80));
    columns.add(new CheckColumnConfig(ICategory.SHOWINNAVIGATOR, "?", 80));
    columns.add(new CheckColumnConfig(ICategory.SHOW, "?", 80));
    columns.add(new ColumnConfig(ICategory.GRADE, "", 60));
    columns.add(new ColumnConfig(ICategory.SORTORDER, "?", 50));
    ColumnConfig actcol = new ColumnConfig("Action", "?", 150);
    columns.add(actcol);

    ColumnModel cm = new ColumnModel(columns);

    Grid<BeanObject> grid = new EditorGrid<BeanObject>(store, cm);
    grid.setLoadMask(true);
    grid.setBorders(true);
    //grid.setSelectionModel(sm);
    //        grid.setAutoExpandColumn("forum");

    ActionCellRenderer render = new ActionCellRenderer(grid);
    ActionCellRenderer.ActionInfo act = new ActionCellRenderer.ActionInfo();
    act.setText(" ");
    act.setAction("changeCategory($id)");
    render.addAction(act);
    act = new ActionCellRenderer.ActionInfo();
    act.setText(" ");
    act.setAction("deleteCategory($id)");
    act.setTooltip(Resources.constants.GoodsList_action_delete());
    render.addAction(act);
    actcol.setRenderer(render);

    final ContentPanel panel = new ContentPanel();
    panel.setFrame(true);
    panel.setCollapsible(true);
    panel.setAnimCollapse(false);
    panel.setButtonAlign(HorizontalAlignment.CENTER);
    panel.setIconStyle("icon-table");
    panel.setHeading("Paging Grid");
    panel.setLayout(new FitLayout());
    panel.add(grid);
    panel.setHeight(500);
    panel.setWidth("100%");
    panel.setBottomComponent(toolBar);

    //        panel.setButtonAlign(HorizontalAlignment.CENTER);
    //        panel.addButton(new com.extjs.gxt.ui.client.widget.button.Button("", new SelectionListener<ButtonEvent>() {
    //          public void componentSelected(ButtonEvent ce) {
    //              NewCategory.State state = new NewCategory.State();
    //              state.execute();
    //          }
    //        }));
    //        
    add(panel);

    Window.addResizeHandler(new ResizeHandler() {
        public void onResize(ResizeEvent event) {
            int w = event.getWidth() - 300;
            panel.setWidth(w + "px");
        }
    });
}

From source file:com.konakart.client.Konakart.java

License:Open Source License

/**
 * This method constructs the application user interface by instantiating controls and hooking
 * up event listeners.//from  w  w w  .  j a  v a 2 s .c o  m
 */
public void onModuleLoad() {
    if (RootPanel.get("nowloading") != null) {
        RootPanel.get("nowloading").setVisible(false);
    }

    setKK(this);

    // Get the parameters from the JSP
    getParameters("kkLabelForm0");

    // Determine whether we are in hosted mode or not
    isHostedMode = hostedMode();

    // Get rid of scrollbars, and clear out the window's built-in margin,
    // because we want to take advantage of the entire client area.
    // Window.enableScrolling(false);
    Window.setMargin("0px");

    // Add the window resize event, so that we can adjust the UI.
    Window.addResizeHandler(this);

    // Call the window resized handler to get the initial sizes setup.
    onWindowResized(Window.getClientWidth(), Window.getClientHeight());

    // Set redirect URL
    setRedirectUrl();

    // Get the ball rolling by figuring out whether the customer is logged in
    getMyKKGWTService().isLoggedIn(isLoggedInCallback);
}

From source file:com.lushprojects.circuitjs1.client.circuitjs1.java

License:Open Source License

public void loadSimulator() {
    mysim = new CirSim();
    mysim.localizationMap = localizationMap;
    mysim.init();/*from   w w w .  j  a  v a 2s  .  c  om*/

    Window.addResizeHandler(new ResizeHandler() {

        public void onResize(ResizeEvent event) {
            mysim.setCanvasSize();
            mysim.setiFrameHeight();

        }
    });

    /*
    Window.addWindowClosingHandler(new Window.ClosingHandler() {
            
        public void onWindowClosing(ClosingEvent event) {
       event.setMessage("Are you sure?");
        }
    });
     */

    mysim.updateCircuit();

}

From source file:com.milmaps.client.MobileEntryPoint.java

License:Open Source License

@Override
public void onModuleLoad() {
    final RootPanel mapPanel = RootPanel.get("mapPanel");
    if (mapPanel != null) {
        doMapPanel(mapPanel);/*from w  ww.  j  a  v  a 2s. c o m*/
        Window.addResizeHandler(new ResizeHandler() {

            @Override
            public void onResize(ResizeEvent event) {
                setView();
            }
        });
    }
}

From source file:com.nanosim.client.Application.java

License:Apache License

/**
 * Constructor.//from  ww  w  .j  a  va  2  s .  c o  m
 */
public Application() {
    // Setup the main layout widget
    FlowPanel layout = new FlowPanel();
    initWidget(layout);

    // Setup the top panel with the title and links
    createTopPanel();
    layout.add(topPanel);

    // Add the main menu
    bottomPanel = new HorizontalPanel();
    bottomPanel.setWidth("100%");
    bottomPanel.setSpacing(0);
    bottomPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    layout.add(bottomPanel);
    createMainMenu();
    bottomPanel.add(mainMenu);

    // Setup the content layout
    contentLayout = new Grid(2, 1);
    contentLayout.setCellPadding(0);
    contentLayout.setCellSpacing(0);
    contentDecorator = new DecoratorPanel();
    contentDecorator.setWidget(contentLayout);
    contentDecorator.addStyleName(DEFAULT_STYLE_NAME + "-content-decorator");
    bottomPanel.add(contentDecorator);
    bottomPanel.setCellHorizontalAlignment(contentDecorator, HasHorizontalAlignment.ALIGN_LEFT);
    contentDecorator.getElement().setAttribute("align", "LEFT");

    CellFormatter formatter = contentLayout.getCellFormatter();

    // Add the content title
    setContentTitle(new HTML("Content"));
    formatter.setStyleName(0, 0, DEFAULT_STYLE_NAME + "-content-title");

    // Add the content wrapper
    contentWrapper = new SimplePanel();
    contentLayout.setWidget(1, 0, contentWrapper);
    formatter.setStyleName(1, 0, DEFAULT_STYLE_NAME + "-content-wrapper");
    setContent(null);

    // Add a window resize handler
    Window.addResizeHandler(this);
}

From source file:com.openkm.frontend.client.panel.ExtendedDockPanel.java

License:Open Source License

/**
 * Extended dock panel//from w  ww  . j  a  v  a  2s .c  o m
 */
public ExtendedDockPanel() {
    dockPanel = new DockLayoutPanel(Unit.PX);
    folderSelectPopup = new FolderSelectPopup();
    enableKeyShorcuts();

    // Object initialization
    topPanel = new TopPanel();
    leftBorderPanel = new VerticalBorderPanel();
    rightBorderPanel = new VerticalBorderPanel();
    bottomPanel = new BottomPanel();

    // Desktop panels initialization
    desktop = new Desktop();

    // Search panels initialization
    search = new Search();

    // Dashboard panel initialization
    dashboard = new Dashboard();

    // Administration panel initialization
    administration = new Administration();

    // set inner component's size
    SetWidgetsSize();

    actualView = UIDockPanelConstants.DESKTOP;

    // Creates the dockPanel
    dockPanel.addNorth(topPanel, TopPanel.PANEL_HEIGHT);
    dockPanel.addSouth(bottomPanel, BottomPanel.PANEL_HEIGHT);
    dockPanel.addWest(leftBorderPanel, VERTICAL_BORDER_PANEL_WIDTH);
    dockPanel.addEast(rightBorderPanel, VERTICAL_BORDER_PANEL_WIDTH);
    dockPanel.add(desktop);

    Window.addResizeHandler(new ResizeHandler() {
        @Override
        public void onResize(ResizeEvent event) {
            SetWidgetsSize();
            Main.get().mainPanel.topPanel.toolBar.windowResized(); // splitter changes
        }
    });

    initWidget(dockPanel);
}

From source file:com.pietschy.gwt.pectin.demo.client.DemoEntryPoint.java

License:Apache License

public void onModuleLoad() {
    rootPanel = RootPanel.get("demo-target");

    //      tabs.add(new BasicDemo(), "Basic", "basic");
    //      tabs.add(new FormattedFieldDemo(), "Formatted Fields", "formattedFields");
    //      tabs.add(new MetadataDemo(), "Metadata Plugin", "metadata");
    //      tabs.add(new ValidationDemo(), "Validation Plugin", "validation");
    //      tabs.add(new StyleDemo(), "Style Bindings", "style");
    //      tabs.initialiseSelectionFromHistory();

    tabs.add(new LazyPanel() {
        @Override// w  w w  .  jav a 2s.  co  m
        protected Widget createWidget() {
            return new BasicDemo();
        }
    }, "Basic Form");

    tabs.add(new LazyPanel() {
        @Override
        protected Widget createWidget() {
            return new MetadataDemo();
        }
    }, "Enabled/Visible/Watermarks");

    tabs.add(new LazyPanel() {
        @Override
        protected Widget createWidget() {
            return new FormattedFieldDemo();
        }
    }, "Formatted fields");

    tabs.add(new LazyPanel() {
        @Override
        protected Widget createWidget() {
            return new ValidationDemo();
        }
    }, "Validation");

    tabs.add(new LazyPanel() {
        @Override
        protected Widget createWidget() {
            return new StyleDemo();
        }
    }, "Style bindings");

    tabs.add(new LazyPanel() {
        @Override
        protected Widget createWidget() {
            return new CommandDemo();
        }
    }, "UiCommands & Buttons");

    tabs.selectTab(0);

    rootPanel.add(tabs);

    Window.enableScrolling(true);

    Window.addResizeHandler(new ResizeHandler() {
        public void onResize(ResizeEvent event) {
            updateSize();
        }
    });

    updateSize();
}