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:org.daxplore.presenter.client.ui.StagePanel.java

License:Open Source License

@Inject
protected StagePanel(PerspectivePanel perspectivePanel, QuestionPanel questionPanel,
        ChartPanelPresenter chartPanelPresenter, DaxploreConfig config) {
    this.perspectivePanel = perspectivePanel;
    this.questionPanel = questionPanel;
    this.chartPanel = chartPanelPresenter.getView();

    minWidth = config.stagePanelMinWidth();

    initWidget(uiBinder.createAndBindUi(this));

    setStylePrimaryName("daxplore-StagePanel");

    Window.addResizeHandler(this);

    updateWidth();/*  w ww . j  av a  2  s  .co  m*/
}

From source file:org.eclipse.che.ide.ui.dropdown.DropdownList.java

License:Open Source License

/** Set the dropdown panels's width should be always synchronized with the list header's width. */
public void syncWidths() {
    widthsSynced = true;//from  w  w w  .  j ava  2  s. c  o  m
    Window.addResizeHandler(e -> setDropdownPanelWidth(getElement().getClientWidth() + "px"));
}

From source file:org.eclipse.che.ide.ui.dropdown.DropdownMenu.java

License:Open Source License

/**
 * Creates new dropdown menu.//from  w w  w  . j av  a  2s.  c o m
 *
 * @param dropdownList a dropdown list to which the menu should be bound
 * @param syncWidths specifies whether this dropdown menu's width always should be the same as the
 *     given {@code dropdownList}'s width
 */
DropdownMenu(DropdownList dropdownList, boolean syncWidths) {
    super(true);

    this.dropdownList = dropdownList;
    widthsSynced = syncWidths;
    if (syncWidths) {
        Window.addResizeHandler(e -> setWidth(dropdownList.getElement().getClientWidth() + "px"));
    }

    removeStyleName("gwt-PopupPanel");
    addStyleName(RESOURCES.dropdownListCss().menu());

    addAutoHidePartner(dropdownList.getElement());
    setAnimationEnabled(true);
    setAnimationType(ROLL_DOWN);

    contentPanel = new FlowPanel();
    contentPanel.ensureDebugId("dropdown-list-content-panel");

    add(new ScrollPanel(contentPanel));
}

From source file:org.eclipse.che.ide.ui.dropdown.DropDownWidgetImpl.java

License:Open Source License

@AssistedInject
public DropDownWidgetImpl(Resources resources, ActionManager actionManager, KeyBindingAgent keyBindingAgent,
        Provider<PerspectiveManager> managerProvider, @NotNull @Assisted String actionGroupId) {
    this.resources = resources;
    this.actionGroupId = actionGroupId;

    initWidget(UI_BINDER.createAndBindUi(this));

    resources.dropdownListCss().ensureInjected();

    listHeader.setStyleName(resources.dropdownListCss().menuElement());

    marker.getElement().appendChild(resources.expansionImage().getSvg().getElement());
    marker.addStyleName(resources.dropdownListCss().expandedImage());

    addDomHandler(this, ClickEvent.getType());

    this.actionManager = actionManager;
    this.keyBindingAgent = keyBindingAgent;
    this.managerProvider = managerProvider;

    presentationFactory = new PresentationFactory();
    actions = new DefaultActionGroup(actionManager);

    Window.addResizeHandler(new ResizeHandler() {
        @Override/*  www . j  a va  2s  .  com*/
        public void onResize(ResizeEvent event) {
            updatePopup();
        }
    });
}

From source file:org.eclipse.kapua.app.console.client.KapuaCloudConsole.java

License:Open Source License

private void renderLoginDialog() {
    final Viewport viewport = new Viewport();

    final BorderLayout borderLayout = new BorderLayout();
    viewport.setLayout(borderLayout);/* ww w  . j  a  va 2 s .  c o  m*/
    if (!UserAgentUtils.isIE() || UserAgentUtils.getIEDocumentMode() > 8) {
        viewport.setStyleName("login");
    } else {
        viewport.setStyleName("login-ie8");
    }

    //
    // center
    BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
    centerData.setMargins(new Margins(0));
    centerData.setCollapsible(false);
    centerData.setFloatable(false);
    centerData.setHideCollapseTool(false);
    centerData.setSplit(false);
    LayoutContainer splash = new LayoutContainer(new FillLayout());
    viewport.add(splash, centerData);

    //
    // north
    SimplePanel ethLogo = new SimplePanel();
    if (!UserAgentUtils.isIE() || UserAgentUtils.getIEDocumentMode() > 8) {
        ethLogo.setStyleName("ethLogo");
    } else {
        ethLogo.setStyleName("ethLogo-ie8");
    }

    SimplePanel cloudLogo = new SimplePanel();
    if (!UserAgentUtils.isIE() || UserAgentUtils.getIEDocumentMode() > 8) {
        cloudLogo.setStyleName("cloudLogo");
    } else {
        cloudLogo.setStyleName("cloudLogo-ie8");
    }

    TableLayout layout = new TableLayout(2);
    layout.setWidth("100%");
    LayoutContainer lcFooter = new LayoutContainer(layout);
    if (!UserAgentUtils.isIE() || UserAgentUtils.getIEDocumentMode() > 8) {
        lcFooter.setStyleName("loginBanner");
    } else {
        lcFooter.setStyleName("loginBanner-ie8");
    }

    lcFooter.add(cloudLogo, new TableData(Style.HorizontalAlignment.LEFT, Style.VerticalAlignment.BOTTOM));
    lcFooter.add(ethLogo, new TableData(Style.HorizontalAlignment.RIGHT, Style.VerticalAlignment.BOTTOM));

    BorderLayoutData northData = new BorderLayoutData(LayoutRegion.NORTH, 72);
    northData.setCollapsible(false);
    northData.setFloatable(false);
    northData.setHideCollapseTool(false);
    northData.setSplit(false);
    northData.setMargins(new Margins(0));
    viewport.add(lcFooter, northData);

    RootPanel.get().add(viewport);

    // Dialog window
    final LoginDialog loginDialog = new LoginDialog();
    loginDialog.addListener(Events.Hide, new Listener<ComponentEvent>() {

        public void handleEvent(ComponentEvent be) {
            if (loginDialog.isAllowMainScreen()) {
                currentSession = loginDialog.getCurrentSession();

                if (currentSession != null) {
                    String username = currentSession.getGwtUser().getUsername();
                    if (username != null) {

                        //
                        // Enter into the normal viewport
                        RootPanel.get().remove(viewport);
                        render(currentSession);

                    } else {
                        ConsoleInfo.display(MSGS.error(), MSGS.loginError());
                        loginDialog.show();
                    }
                } else {
                    ConsoleInfo.display(MSGS.error(), MSGS.loginError());
                    loginDialog.show();
                }
            }
        }
    });

    if (!UserAgentUtils.isIE()) {
        Window.addResizeHandler(new ResizeHandler() {

            public void onResize(ResizeEvent arg0) {
                loginDialog.center();
            }
        });
    }

    loginDialog.show();
}

From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.body.AssessmentsPlayerMetadataView.java

License:Open Source License

@Inject
public AssessmentsPlayerMetadataView() {
    setWidget(uiBinder.createAndBindUi(this));
    setLabelAndIds();/*from   w  ww.j a v a2 s.c  o  m*/
    rightPanelMetadata.teacherContainer.setVisible(false);
    PlayerBundle.INSTANCE.getPlayerStyle().ensureInjected();
    SearchResultWrapperCBundle.INSTANCE.css().ensureInjected();
    Boolean isIpad = !!Navigator.getUserAgent().matches("(.*)iPad(.*)");
    Boolean isAndriod = !!Navigator.getUserAgent().matches("(.*)Android(.*)");
    if (isIpad && !StringUtil.IPAD_MESSAGE_Close_Click) {
        studyMainContianer.getElement().setAttribute("style", "margin-top:0px;");
    } else if (isAndriod && !StringUtil.IPAD_MESSAGE_Close_Click) {
        studyMainContianer.getElement().setAttribute("style", "margin-top:0px;");
    }
    Window.addResizeHandler(new ResizeLogicEvent());
}

From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.preview.home.ResourceCurosal.java

License:Open Source License

public ResourceCurosal(Label nextButton, Label previousButton, FlowPanel widgetsPanel, int widgetsCount,
        int widgetWidth, FlowPanel carosualContainer) {
    WIDGET_WIDTH = widgetWidth;/* ww  w.ja  v  a 2  s  .  c om*/
    this.nextButton = nextButton;
    this.previousButton = previousButton;
    this.widgetsPanel = widgetsPanel;
    this.widgetsCount = widgetsCount;
    this.carosualContainer = carosualContainer;
    setTotalWidth();
    nextButton.addClickHandler(new ShowNextWidgetEvent());
    previousButton.addClickHandler(new ShowPreviousWidgetEvent());
    nextButton.addMouseOverHandler(new ButtonMouseOverEvent(true));
    nextButton.addMouseOutHandler(new ButtonMouseOutEvent(true));
    previousButton.addMouseOverHandler(new ButtonMouseOverEvent(false));
    previousButton.addMouseOutHandler(new ButtonMouseOutEvent(false));
    adjustNextbuttonVisibility(currentMarginLeft);
    adjustPreviousButtonVisibility();
    addWidthCarouselContainer();
    Window.addResizeHandler(new ResizeLogicEvent());
}

From source file:org.ednovo.gooru.client.mvp.assessments.play.resource.body.AssessmentsResourcePlayerMetadataView.java

License:Open Source License

@Inject
public AssessmentsResourcePlayerMetadataView() {

    setWidget(uiBinder.createAndBindUi(this));
    singleEmoticsContainer.getElement().getStyle().setDisplay(Display.NONE);
    reactionToolTipOne.setText(i18n.GL0581());
    reactionToolTipOne.getElement().setId("lblReactionToolTipOne");
    reactionToolTipOne.getElement().setAttribute("alt", i18n.GL0581());
    reactionToolTipOne.getElement().setAttribute("title", i18n.GL0581());

    reactionToolTipTwo.setText(i18n.GL0582());
    reactionToolTipTwo.getElement().setId("lblReactionToolTipTwo");
    reactionToolTipTwo.getElement().setAttribute("alt", i18n.GL0582());
    reactionToolTipTwo.getElement().setAttribute("title", i18n.GL0582());

    reactionToolTipThree.setText(i18n.GL0583());
    reactionToolTipThree.getElement().setId("lblReactionToolTipThree");
    reactionToolTipThree.getElement().setAttribute("alt", i18n.GL0583());
    reactionToolTipThree.getElement().setAttribute("title", i18n.GL0583());

    reactionToolTipFour.setText(i18n.GL0584());
    reactionToolTipFour.getElement().setId("lblReactionToolTipFour");
    reactionToolTipFour.getElement().setAttribute("alt", i18n.GL0584());
    reactionToolTipFour.getElement().setAttribute("title", i18n.GL0584());

    reactionToolTipFive.setText(i18n.GL0585());
    reactionToolTipFive.getElement().setId("lblReactionToolTipFive");
    reactionToolTipFive.getElement().setAttribute("alt", i18n.GL0585());
    reactionToolTipFive.getElement().setAttribute("title", i18n.GL0585());

    plusAddTagsButton.setText("+ " + i18n.GL2081());
    plusAddTagsButton.getElement().setId("plusAddTagsButton");
    plusAddTagsButton.getElement().setAttribute("alt", i18n.GL2081());
    plusAddTagsButton.getElement().setAttribute("title", i18n.GL2081());

    starValue.setVisible(true);//from  w w w  .  j  a  v a  2 s  . c o  m
    starValue.setText(i18n.GL1879());
    starValue.getElement().setId("lblStarValue");
    starValue.getElement().setAttribute("alt", i18n.GL1879());
    starValue.getElement().setAttribute("title", i18n.GL1879());

    if (AppClientFactory.getCurrentPlaceToken().equalsIgnoreCase(PlaceTokens.RESOURCE_PLAY)) {
        emoticsContainer.removeFromParent();
        resourceTitleLbl.setVisible(false);

        ratingsContainer.getElement().getStyle().setFloat(Float.RIGHT);
        ratingsContainer.getElement().getStyle().setMarginRight(430, Unit.PX);

        if (isChildAccount()) {
            collectionContainer.getElement().getStyle().setDisplay(Display.NONE);
        } else {
            collectionContainer.getElement().getStyle().setDisplay(Display.BLOCK);
        }
    } else {
        resourceTitleLbl.setVisible(true);
    }
    Boolean isIpad = !!Navigator.getUserAgent().matches("(.*)iPad(.*)");
    Boolean isAndriod = !!Navigator.getUserAgent().matches("(.*)Android(.*)");

    one_star.addMouseOverHandler(new OnStarMouseOver(ONE_STAR));
    two_star.addMouseOverHandler(new OnStarMouseOver(TWO_STAR));
    three_star.addMouseOverHandler(new OnStarMouseOver(THREE_STAR));
    four_star.addMouseOverHandler(new OnStarMouseOver(FOUR_STAR));
    five_star.addMouseOverHandler(new OnStarMouseOver(FIVE_STAR));

    one_star.addMouseOutHandler(new OnStarMouseOut(ONE_STAR));
    two_star.addMouseOutHandler(new OnStarMouseOut(TWO_STAR));
    three_star.addMouseOutHandler(new OnStarMouseOut(THREE_STAR));
    four_star.addMouseOutHandler(new OnStarMouseOut(FOUR_STAR));
    five_star.addMouseOutHandler(new OnStarMouseOut(FIVE_STAR));
    setId();

    doNotUnderstandEmoticButton
            .addMouseOverHandler(new ReactionsMouseOverHandler(doNotUnderstandEmoticButton, i18n.GL0584()));
    needHelpButton.addMouseOverHandler(new ReactionsMouseOverHandler(needHelpButton, i18n.GL0585()));
    mehEmoticButton.addMouseOverHandler(new ReactionsMouseOverHandler(mehEmoticButton, i18n.GL0583()));
    understandEmoticButton
            .addMouseOverHandler(new ReactionsMouseOverHandler(understandEmoticButton, i18n.GL0582()));
    canExplainEmoticButton
            .addMouseOverHandler(new ReactionsMouseOverHandler(canExplainEmoticButton, i18n.GL0581()));

    doNotUnderstandEmoticButton.addMouseOutHandler(new ReactionsMouseOutHandler());
    needHelpButton.addMouseOutHandler(new ReactionsMouseOutHandler());
    mehEmoticButton.addMouseOutHandler(new ReactionsMouseOutHandler());
    understandEmoticButton.addMouseOutHandler(new ReactionsMouseOutHandler());
    canExplainEmoticButton.addMouseOutHandler(new ReactionsMouseOutHandler());

    Window.addResizeHandler(new ResizeHandler() {
        @Override
        public void onResize(ResizeEvent event) {
            String view = AppClientFactory.getPlaceManager().getRequestParameter("view", null);
            if (view != null && view.equals("fullScreen")) {
                setFullScreen(true, pnlNarrationFullScreen);
            }
        }
    });

    AssessmentsNextResourceHandler resourceHandler = new AssessmentsNextResourceHandler() {

        @Override
        public void loadNextResource() {
            navigateToNextResource();
        }
    };

    AppClientFactory.getEventBus().addHandler(AssessmentsNextResourceEvent.TYPE, resourceHandler);
}

From source file:org.ednovo.gooru.client.mvp.folder.toc.FolderTocView.java

License:Open Source License

public FolderTocView() {
    setWidget(uiBinder.createAndBindUi(this));
    folderTocMainPnl.getElement().setId("folderTocMainPnl");
    FolderContainerCBundle.INSTANCE.css().ensureInjected();
    setData();/*from  w ww.j ava  2 s. c  o m*/
    bannerImage.setVisible(false);
    bannerImagePanel.setVisible(false);
    profileBannerPanel.setVisible(false);
    pageNotFoundPanel.setVisible(false);
    //This will handle the window resize
    Window.addResizeHandler(new ResizeLogicEvent());
    setBannerStaticImages();

}

From source file:org.ednovo.gooru.client.mvp.gshelf.courselist.MyCollectionsListView.java

License:Open Source License

/**
 * This method is used to set id's//from  w w  w.  j av  a2 s .  com
 */
public void setIds() {
    courseListContainer.getElement().setId("gShelfCousesList");
    h2Title.getElement().setId("h2Title");
    pnlCourseList.getElement().setId("pnlCourseList");
    pnlH2TitleContainer.getElement().setId("pnlH2TitleContainer");
    StringUtil.setAttributes(btnCreate.getElement(), "btnCreate", "", "");
    StringUtil.setAttributes(btnCreateQuestion.getElement(), "btnCreateQuestion", "", "");
    StringUtil.setAttributes(btnCreateResource.getElement(), "btnCreateResource", "", "");
    createCollectionBtn.setText(i18n.GL_SPL_PLUS() + " " + i18n.GL1451());
    createAssessmentBtn.setText(i18n.GL_SPL_PLUS() + " " + i18n.GL3024());
    courseListContainer.getElement().setAttribute("style", "min-height:" + Window.getClientHeight() + "px");
    Window.addResizeHandler(new ResizeHandler() {
        @Override
        public void onResize(ResizeEvent event) {
            courseListContainer.getElement().setAttribute("style",
                    "min-height:" + Window.getClientHeight() + "px");
        }
    });
}