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

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

Introduction

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

Prototype

public static int getClientWidth() 

Source Link

Usage

From source file:org.eclipse.che.plugin.languageserver.ide.quickopen.QuickOpenViewImpl.java

License:Open Source License

@Override
public void show(final String value) {
    super.show();

    nameField.setValue(value);/*from   ww  w .ja  va2s  .  co  m*/

    setPopupPositionAndShow(new PositionCallback() {
        @Override
        public void setPosition(int offsetWidth, int offsetHeight) {
            setPopupPosition((Window.getClientWidth() / 2) - (offsetWidth / 2), 60);
        }
    });

    Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
        @Override
        public void execute() {
            delegate.valueChanged(value);
            nameField.setFocus(true);
        }
    });
}

From source file:org.eclipse.che.security.oauth.JsOAuthWindow.java

License:Open Source License

public JsOAuthWindow(String authUrl, String errUrl, int popupHeight, int popupWidth, OAuthCallback callback) {
    this.authUrl = authUrl;
    this.errUrl = errUrl;
    this.popupHeight = popupHeight;
    this.popupWidth = popupWidth;
    this.clientHeight = Window.getClientHeight();
    this.clientWidth = Window.getClientWidth();
    this.callback = callback;
}

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

License:Open Source License

public void placeCollectionMetadataContainer() {
    int clientWidth = Window.getClientWidth();
    if (clientWidth > 991) {
        FlowPanel menuContainer = getUiHandlers().getMenuContainer();
        menuContainer.getParent().setStyleName("player");
    }//from w  w w .j av  a  2 s .com
}

From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.end.study.AssessmentsHomeMetadataView.java

License:Open Source License

/**
 *
 * @function oncustomizeCollectionBtnClicked
 *
 * @created_date : 11-Dec-2013//w  w  w  .j av  a2  s  .  c o  m
 *
 * @description
 *
 *
 * @parm(s) : @param clickEvent
 *
 * @return : void
 *
 * @throws : <Mentioned if any exceptions>
 *
 */
@UiHandler("shareCollectionBtn")
public void onshareCollectionBtnClicked(ClickEvent clickEvent) {
    getUiHandlers().triggerCollectionShareDataEvent(null, PlayerDataLogEvents.COLLECTION, "gooru", false);
    String collectionId = collectionDo.getGooruOid();
    AssignPopupVc successPopupVc = new AssignPopupVc(collectionId, collectionDo.getTitle(),
            collectionDo.getGoals()) {
        @Override
        public void closePoup() {
            Window.enableScrolling(true);
            this.hide();
        }
    };

    Window.scrollTo(0, 0);
    int clientHeight = Window.getClientHeight();
    //successPopupVc.setWidth("500px");
    //successPopupVc.setHeight("658px");
    if (clientHeight > 625) {
        clientHeight = 625;
        //successPopupVc.getAssignContainer().getElement().setAttribute("style", "max-height:"+clientHeight+"px;overflow-x:hidden;overflow-y:scroll");
    } /*else{
        successPopupVc.getAssignContainer().getElement().setAttribute("style", "max-height:"+clientHeight+"px;overflow-x:hidden;overflow-y:scroll");
      }*/
    successPopupVc.show();
    int left = (Window.getClientWidth() - 500) >> 1;
    int top = (Window.getClientHeight() - clientHeight) >> 1;
    //  successPopupVc.setHeight("658px");
    // successPopupVc.setPopupPosition(Math.max(Window.getScrollLeft() + left, 0), Math.max(Window.getScrollTop()+5, 0));

    /*if(AppClientFactory.isAnonymous()){
       successPopupVc.setPopupPosition(successPopupVc.getAbsoluteLeft(), -30);
            
    }*/
    if (!BrowserAgent.isDevice() && AppClientFactory.isAnonymous()) {
        /*successPopupVc.setWidth("550px");
        successPopupVc.setHeight("625px");
        successPopupVc.center();*/
        successPopupVc.setPopupPosition(0, (Window.getClientHeight() - 625) / 2);
    } else if (!BrowserAgent.isDevice() && !AppClientFactory.isAnonymous()) {
        /*successPopupVc.setWidth("550px");
        successPopupVc.setHeight("502px");
        successPopupVc.center();*/
        successPopupVc.setPopupPosition(0, (Window.getClientHeight() - 527) / 2);
    }

}

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

License:Open Source License

public int getTotalViewableWidth() {
    int totalClientWidth = Window.getClientWidth();
    int totalViewableWidth = 0;
    if (totalClientWidth > 1000) {
        totalViewableWidth = 900;/* w  w  w .ja  va 2s.c o m*/
    } else {
        totalViewableWidth = totalClientWidth - 100;
    }
    return totalViewableWidth;
}

From source file:org.ednovo.gooru.client.mvp.classpage.studentclassview.StudentClassView.java

License:Open Source License

@Override
public void initiateJoinClassPopup() {
    if (AppClientFactory.isAnonymous()) {
        LoginPopupUc loginPopupUc = new LoginPopupUc() {
            @Override/*ww w .j  a v a 2s  .  c  om*/
            public void onLoginSuccess() {
                // TODO Auto-generated method stub
            }
        };
    } else {

        joinClassPopup = new StudentJoinClassPopup(classpageDo) {

            @Override
            void joinIntoClass() {
                getUiHandlers().studentJoinClassPoup(classpageDo.getClassUid());
            }

            @Override
            public void closePoup() {
                hide();
                Window.enableScrolling(true);
                if (!classpageDo.isVisibility()) {
                    AppClientFactory.getPlaceManager().revealPlace(PlaceTokens.HOME);
                }
            }
        };
        int windowHeight = Window.getClientHeight() / 2; //I subtract 10 from the client height so the window isn't maximized.
        int windowWidth = Window.getClientWidth() / 2;
        joinClassPopup.setPopupPosition(windowWidth - 253, windowHeight - 70);
        joinClassPopup.setPixelSize(506, 261);
        //joinPopup.center();
        joinClassPopup.show();
    }
}

From source file:org.ednovo.gooru.client.mvp.classpages.studentView.StudentAssignmentView.java

License:Open Source License

@Override
public void setClasspageData(ClasspageDo classpageDo) {
    this.classpageDo = classpageDo;
    mainTitleLbl.setText(classpageDo.getTitle() != null ? classpageDo.getTitle() : "");
    studentViewImage.setAltText(classpageDo.getTitle() != null ? classpageDo.getTitle() : "");
    studentViewImage.setTitle(classpageDo.getTitle() != null ? classpageDo.getTitle() : "");
    studentViewImage.setUrl(classpageDo.getThumbnailUrl());
    AppClientFactory.fireEvent(new SetSelectedClasspageListEvent(classpageDo.getClasspageId()));
    imgProfileImage.setUrl(classpageDo.getCreatorProfileImage());
    lblUserName.setText(classpageDo.getCreatorUsername());

    imgProfileImage.addErrorHandler(new ErrorHandler() {

        @Override//from   ww  w. j  a  v a 2s .  c  o m
        public void onError(ErrorEvent event) {
            imgProfileImage.setUrl(defaultProfileImage);
        }
    });

    if (classpageDo.getSharing().equalsIgnoreCase("public")) {
        if (classpageDo.getCreatorId().equalsIgnoreCase(AppClientFactory.getGooruUid())) {
            btnJoinClass.setVisible(false);
            userImage.setVisible(true);
            lblWebHelp.setVisible(false);
            btnWithDraw.setVisible(false);
            LblMember.setVisible(true);
            userImage.setVisible(true);
            LblMember.setText(GL1551);
            mainContainer.setVisible(true);
        } else if (classpageDo.getStatus().equalsIgnoreCase("active")) {
            btnJoinClass.setVisible(false);
            userImage.setVisible(true);
            lblWebHelp.setVisible(false);
            btnWithDraw.setVisible(true);
            LblMember.setVisible(true);
            userImage.setVisible(true);
            mainContainer.setVisible(true);
        } else {

            btnJoinClass.setVisible(true);
            userImage.setVisible(false);
            lblWebHelp.setVisible(true);
            btnWithDraw.setVisible(false);
            LblMember.setVisible(false);
            userImage.setVisible(false);
            mainContainer.setVisible(true);

        }
    } else {
        if (AppClientFactory.isAnonymous()) {

            mainContainer.setVisible(false);
            LoginPopupUc loginPopupUc = new LoginPopupUc();

        } else {
            if (classpageDo.getCreatorId().equalsIgnoreCase(AppClientFactory.getGooruUid())) {
                btnJoinClass.setVisible(false);
                userImage.setVisible(true);
                lblWebHelp.setVisible(false);
                btnWithDraw.setVisible(false);
                LblMember.setVisible(true);
                LblMember.setText(GL1551);
                userImage.setVisible(true);
                mainContainer.setVisible(true);
            } else if (classpageDo.getStatus().equalsIgnoreCase("active")) {
                btnJoinClass.setVisible(false);
                userImage.setVisible(true);
                lblWebHelp.setVisible(false);
                btnWithDraw.setVisible(false);
                LblMember.setVisible(true);
                userImage.setVisible(true);
                mainContainer.setVisible(true);
            } else if (classpageDo.getStatus().equalsIgnoreCase("pending")) {
                btnJoinClass.setVisible(true);
                userImage.setVisible(false);
                lblWebHelp.setVisible(true);
                btnWithDraw.setVisible(false);
                LblMember.setVisible(false);
                userImage.setVisible(false);
                mainContainer.setVisible(false);

                if (!isJoinPopupPrivateStatic) {
                    isJoinPopupPrivateStatic = true;
                    joinPopupPrivate = new StudentJoinClassPopup(classpageDo) {

                        @Override
                        void joinIntoClass() {
                            String emailId = AppClientFactory.getLoggedInUser().getEmailId();
                            AppClientFactory.getInjector().getClasspageService().studentJoinIntoClass(
                                    classpageDo.getClasspageCode(), emailId,
                                    new SimpleAsyncCallback<ClasspageDo>() {

                                        @Override
                                        public void onSuccess(ClasspageDo result) {
                                            joinPopupPrivate.hide();
                                            mainContainer.setVisible(true);
                                            SuccessPopupViewVc success = new SuccessPopupViewVc() {

                                                @Override
                                                public void onClickPositiveButton(ClickEvent event) {
                                                    Window.enableScrolling(true);
                                                    btnJoinClass.setVisible(false);
                                                    userImage.setVisible(true);
                                                    lblWebHelp.setVisible(false);
                                                    btnWithDraw.setVisible(false);
                                                    LblMember.setVisible(true);
                                                    LblMember.setText(GL1549);
                                                    mainContainer.setVisible(true);
                                                    this.hide();
                                                    isJoinPopupPrivateStatic = false;

                                                }

                                            };
                                            success.setHeight("248px");
                                            success.setWidth("450px");
                                            success.setPopupTitle(GL1553);
                                            success.setDescText(GL1554 + classpageDo.getTitle()
                                                    + GL_SPL_EXCLAMATION + '\n' + GL1552);
                                            success.setPositiveButtonText(GL0190);
                                            success.center();
                                            success.show();

                                        }
                                    });
                        }

                        @Override
                        public void closePoup() {
                            hide();
                            Window.enableScrolling(true);
                            AppClientFactory.getPlaceManager().revealPlace(PlaceTokens.HOME);
                        }
                    };
                }
                int windowHeight = Window.getClientHeight() / 2; //I subtract 10 from the client height so the window isn't maximized.
                int windowWidth = Window.getClientWidth() / 2;
                joinPopupPrivate.setPopupPosition(windowWidth - 253, windowHeight - 70);
                joinPopupPrivate.setPixelSize(506, 261);
                //joinPopup.center();
                joinPopupPrivate.show();

            } else {
                try {
                    mainContainer.setVisible(false);
                } catch (Exception ex) {

                }
                if (AppClientFactory.isAnonymous()) {
                    new SentEmailSuccessVc(GL1177, GL1535);
                } else {
                    new SentEmailSuccessVc(GL1177, GL1535_1);
                }
            }

        }
    }
    /*}
    else
    {
       if(classpageDo.getStatus().equalsIgnoreCase("active")){
    btnJoinClass.setVisible(false);
    lblWebHelp.setVisible(false);
    btnWithDraw.setVisible(true);
    LblMember.setVisible(true);
       }else if(classpageDo.getStatus().equalsIgnoreCase("pending")) {
    btnJoinClass.setVisible(true);
    lblWebHelp.setVisible(true);
    btnWithDraw.setVisible(false);
    LblMember.setVisible(false);
       }else {
    //dont have access popup
       }
    }*/

    //here we need to check for http://collab.ednovo.org/jira/browse/CORE-516 this 
    //api response and display the button text and functionality.
    DataLogEvents.classpageView(GwtUUIDGenerator.uuid(), "classpage-view", classpageDo.getClasspageId(),
            AppClientFactory.getLoggedInUser().getGooruUId(), System.currentTimeMillis(),
            System.currentTimeMillis(), "", 0L, AppClientFactory.getLoggedInUser().getToken(), "start");
}

From source file:org.ednovo.gooru.client.mvp.classpages.studentView.StudentAssignmentView.java

License:Open Source License

public static void setPrivatePagePending() {
    btnJoinClass.setVisible(true);//from   w ww. ja va2 s.c o  m
    userImage.setVisible(false);
    lblWebHelp.setVisible(true);
    btnWithDraw.setVisible(false);
    LblMember.setVisible(false);
    LblMember.setText(GL1549);
    mainContainer.setVisible(false);

    if (AppClientFactory.isAnonymous()) {

        LoginPopupUc loginPopupUc = new LoginPopupUc();

    } else {

        if (!isJoinPopupPrivate) {
            isJoinPopupPrivate = true;
            joinPopupPrivate = new StudentJoinClassPopup(classpageDo) {

                @Override
                void joinIntoClass() {
                    String emailId = AppClientFactory.getLoggedInUser().getEmailId();
                    AppClientFactory.getInjector().getClasspageService().studentJoinIntoClass(
                            classpageDo.getClasspageCode(), emailId, new SimpleAsyncCallback<ClasspageDo>() {

                                @Override
                                public void onSuccess(ClasspageDo result) {
                                    joinPopupPrivate.hide();
                                    mainContainer.setVisible(true);
                                    SuccessPopupViewVc success = new SuccessPopupViewVc() {

                                        @Override
                                        public void onClickPositiveButton(ClickEvent event) {
                                            Window.enableScrolling(true);
                                            btnJoinClass.setVisible(false);
                                            userImage.setVisible(true);
                                            lblWebHelp.setVisible(false);
                                            btnWithDraw.setVisible(false);
                                            LblMember.setVisible(true);
                                            LblMember.setText(GL1549);
                                            mainContainer.setVisible(true);
                                            this.hide();
                                            isJoinPopupPrivate = false;

                                        }

                                    };
                                    success.setHeight("248px");
                                    success.setWidth("450px");
                                    success.setPopupTitle(GL1553);
                                    success.setDescText(GL1554 + classpageDo.getTitle() + GL_SPL_EXCLAMATION
                                            + '\n' + GL1552);
                                    success.setPositiveButtonText(GL0190);
                                    success.center();
                                    success.show();

                                }
                            });
                }

                @Override
                public void closePoup() {
                    hide();
                    Window.enableScrolling(true);
                    AppClientFactory.getPlaceManager().revealPlace(PlaceTokens.HOME);
                }
            };
        }
        int windowHeight = Window.getClientHeight() / 2; //I subtract 10 from the client height so the window isn't maximized.
        int windowWidth = Window.getClientWidth() / 2;
        joinPopupPrivate.setPopupPosition(windowWidth - 253, windowHeight - 70);
        joinPopupPrivate.setPixelSize(506, 261);
        //joinPopup.center();
        joinPopupPrivate.show();
    }

}

From source file:org.ednovo.gooru.client.mvp.dnd.PickupDragController.java

License:Open Source License

@Override
public void dragMove() {
    // may have changed due to scrollIntoView(), developer driven changes
    // or manual user scrolling

    long timeMillis = System.currentTimeMillis();
    if (timeMillis - lastResetCacheTimeMillis >= CACHE_TIME_MILLIS) {
        lastResetCacheTimeMillis = timeMillis;
        resetCache();//from  w w w. j a v  a2s  . com
        calcBoundaryOffset();
    }

    int desiredLeft = context.desiredDraggableX - boundaryOffsetX;
    int desiredTop = context.desiredDraggableY - boundaryOffsetY;

    if (getBehaviorConstrainedToBoundaryPanel()) {
        desiredLeft = Math.max(0,
                Math.min(desiredLeft, dropTargetClientWidth - context.draggable.getOffsetWidth()));
        desiredTop = Math.max(0,
                Math.min(desiredTop, dropTargetClientHeight - context.draggable.getOffsetHeight()));
    }

    if (context.mouseX > (Window.getClientWidth()) && desiredLeft > 400) {
        context.mouseX = Window.getClientWidth();
        desiredLeft = 400;
    }
    draggedElementEndLeft = desiredLeft;
    draggedElementEndTop = desiredTop;
    DOMUtil.fastSetElementPosition(movablePanel.getElement(), desiredLeft, desiredTop);

    DropController newDropController = getIntersectDropController(context.mouseX, context.mouseY);
    if (context.dropController != newDropController) {
        if (context.dropController != null) {
            context.dropController.onLeave(context);
        }
        context.dropController = newDropController;
        if (context.dropController != null) {
            context.dropController.onEnter(context);
        }
    }

    if (context.dropController != null) {
        context.dropController.onMove(context);
    }
}

From source file:org.ednovo.gooru.client.mvp.dnd.PickupDragController.java

License:Open Source License

public int setMovablePanelDesiredLeft(int desiredLeftPosition) {
    if (context.mouseX < (Window.getClientWidth())) {
        desiredLeftPosition = context.mouseX;
    } else {/*from   www  .  j a  v a  2 s  . c om*/
        desiredLeftPosition = Window.getClientWidth();
    }
    return desiredLeftPosition;
}