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

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

Introduction

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

Prototype

public static int getClientHeight() 

Source Link

Usage

From source file:com.ikon.frontend.client.widget.searchin.FolderSelectPopup.java

License:Open Source License

/**
 * Shows the popup /*w  w  w  . ja v a2s .c om*/
 */
public void show(boolean categories) {
    this.categories = categories;
    int left = (Window.getClientWidth() - 300) / 2;
    int top = (Window.getClientHeight() - 200) / 2;
    setPopupPosition(left, top);

    if (categories) {
        setText(Main.i18n("search.category.filter"));
    } else {
        setText(Main.i18n("search.folder.filter"));
    }

    // Resets to initial tree value
    folderSelectTree.reset(categories);
    super.show();
}

From source file:com.ikon.frontend.client.widget.searchin.GroupPopup.java

License:Open Source License

/**
 * Show the popup error//from w ww . ja  v  a  2 s .  c  om
 * 
 * @param msg Error message
 */
public void show() {
    int left = (Window.getClientWidth() - 300) / 2;
    int top = (Window.getClientHeight() - 100) / 2;
    setPopupPosition(left, top);
    setText(Main.i18n("group.label"));
    validate = -1;
    groupListBox.clear();
    propertyListBox.clear();
    propertyListBox.setVisible(false);
    propertyLabel.setVisible(false);
    getAllGroups(); // Gets all groups
    addButton.setEnabled(false);
    super.show();
}

From source file:com.ikon.frontend.client.widget.security.SecurityPopup.java

License:Open Source License

/**
 * Show the security popup/*from  w  w w . j  a v a 2  s. com*/
 */
public void show(String path) {
    this.path = path;
    int left = (Window.getClientWidth() - width) / 2;
    int top = (Window.getClientHeight() - 400) / 2;
    setPopupPosition(left, top);
    setText(Main.i18n("security.label"));
    securityPanel.reset(path);
    change.setEnabled(false);
    super.show();

    // TODO:Solves minor bug with IE
    if (Util.getUserAgent().startsWith("ie")) {
        securityPanel.tabPanel.setWidth(String.valueOf(width));
        securityPanel.tabPanel.setWidth(String.valueOf((width + 1)));
    }

    // Fill width must be done on visible widgets
    securityPanel.fillWidth();
}

From source file:com.ikon.frontend.client.widget.startup.StartUpPopup.java

License:Open Source License

public StartUpPopup() {
    // Establishes auto-close when click outside
    super(false, true);

    vPanel = new VerticalPanel();
    status = new VerticalPanel();
    table = new FlexTable();
    button = new Button(Main.i18n("button.close"), this);
    scrollPanel = new ScrollPanel(status);
    scrollPanel.setAlwaysShowScrollBars(false);
    scrollPanel.setSize("490", "160");
    scrollPanel.setStyleName("okm-Input");

    status.setWidth("" + (490 - IE_SIZE_RECTIFICATION));

    vPanel.add(new HTML(" "));
    vPanel.add(scrollPanel);//from   w ww.ja  va  2 s . co m
    vPanel.add(new HTML(" "));
    vPanel.add(table);
    vPanel.add(button);
    vPanel.add(new HTML(" "));

    button.setVisible(false);
    button.setStyleName("okm-YesButton");

    vPanel.setCellHorizontalAlignment(scrollPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(table, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(button, HasAlignment.ALIGN_CENTER);
    vPanel.setCellVerticalAlignment(scrollPanel, HasAlignment.ALIGN_MIDDLE);

    int left = (Window.getClientWidth() - 510) / 2;
    int top = (Window.getClientHeight() - 220) / 2;
    vPanel.setWidth("510px");
    vPanel.setHeight("220px");

    for (int i = 0; i < StartUp.STARTUP_LOADING_HISTORY_SEARCH; i++) {
        table.setWidget(0, i, new Image(OKMBundleResources.INSTANCE.loadedDisabledIcon()));
    }

    setText(Main.i18n("startup.openkm"));
    setPopupPosition(left, top);
    setWidget(vPanel);
}

From source file:com.ikon.frontend.client.widget.thesaurus.ThesaurusSelectPopup.java

License:Open Source License

/**
 * Shows the popup /*from  ww w.j  a v a  2 s.  co m*/
 */
public void show(int selectedFrom) {
    this.selectedFrom = selectedFrom;
    initButtons();
    int left = (Window.getClientWidth() - 400) / 2;
    int top = (Window.getClientHeight() - 325) / 2;
    setPopupPosition(left, top);
    setText(Main.i18n("thesaurus.directory.select.label"));

    // Resets to initial tree value
    thesaurusPanel.reset();

    center();
}

From source file:com.ikon.frontend.client.widget.UserPopup.java

License:Open Source License

/**
 * User popup//from  w w  w  .j a  v a  2  s  .co  m
 */
public UserPopup() {

    // Establishes auto-close when click outside
    super(false, true);
    int left = (Window.getClientWidth() - 400) / 2;
    int top = (Window.getClientHeight() - 220) / 2;

    vPanel = new VerticalPanel();
    userFlexTable = new FlexTable();
    mailFlexTable = new FlexTable();

    userGroupBoxPanel = new GroupBoxPanel();
    userGroupBoxPanel.setCaption(Main.i18n("user.preferences.user.data"));
    userGroupBoxPanel.add(userFlexTable);

    mailGroupBoxPanel = new GroupBoxPanel();
    mailGroupBoxPanel.setCaption(Main.i18n("user.preferences.mail.data"));
    mailGroupBoxPanel.add(mailFlexTable);

    userId = new HTML(Main.i18n("user.preferences.user"));
    userName = new HTML(Main.i18n("user.preferences.name"));
    userPassword = new HTML(Main.i18n("user.preferences.password"));
    userMail = new HTML(Main.i18n("user.preferences.mail"));
    userRoles = new HTML(Main.i18n("user.preferences.roles"));
    mailHost = new HTML(Main.i18n("user.preferences.mail.host"));
    mailUser = new HTML(Main.i18n("user.preferences.mail.user"));
    mailPassword = new HTML(Main.i18n("user.preferences.mail.user.password"));
    mailFolder = new HTML(Main.i18n("user.preferences.mail.folder"));
    mailProtocolLabel = new HTML(Main.i18n("user.preferences.mail.protocol"));
    mailProtocol = new ListBox();
    userPasswordText = new PasswordTextBox();
    userPasswordTextVerify = new PasswordTextBox();
    userNameText = new HTML("");
    userMailText = new TextBox();
    rolesPanel = new VerticalPanel();
    mailUserPasswordText = new PasswordTextBox();
    passwordError = new HTML(Main.i18n("user.preferences.password.error"));
    passwordValidationError = new HTML("");
    mailPassordError = new HTML(Main.i18n("user.preferences.mail.password.error.void"));
    mailError = new HTML(Main.i18n("user.preferences.mail.error"));
    mailTestError = new HTML(Main.i18n("user.preferences.mail.test.error"));
    mailTestOK = new HTML(Main.i18n("user.preferences.mail.test.ok"));

    passwordError.setVisible(false);
    passwordValidationError.setVisible(false);
    mailPassordError.setVisible(false);
    mailError.setVisible(false);
    mailTestError.setVisible(false);
    mailTestOK.setVisible(false);

    hostText = new TextBox();
    mailUserText = new TextBox();
    mailFolderText = new TextBox();

    mailProtocol.addItem(MailAccount.PROTOCOL_IMAP);
    mailProtocol.addItem(MailAccount.PROTOCOL_IMAPS);
    mailProtocol.addItem(MailAccount.PROTOCOL_POP3);
    mailProtocol.addItem(MailAccount.PROTOCOL_POP3S);

    update = new Button(Main.i18n("button.update"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            passwordError.setVisible(false);
            passwordValidationError.setVisible(false);
            mailPassordError.setVisible(false);
            mailError.setVisible(false);
            mailTestError.setVisible(false);
            mailTestOK.setVisible(false);
            // Password always must be equals
            if (!userPasswordText.getText().equals(userPasswordTextVerify.getText())) {
                passwordError.setVisible(true);
                // Case creation
            } else if (Main.get().workspaceUserProperties.getWorkspace().getMailID() < 0
                    && mailUserPasswordText.getText().equals("") && (mailFolderText.getText().length() > 0
                            || mailUserText.getText().length() > 0 || hostText.getText().length() > 0)) {
                mailPassordError.setVisible(true);
                // Case update
            } else if ((mailUserPasswordText.getText().length() > 0 || mailFolderText.getText().length() > 0
                    || mailUserText.getText().length() > 0 || hostText.getText().length() > 0)
                    && !(mailFolderText.getText().length() > 0 && mailUserText.getText().length() > 0
                            && hostText.getText().length() > 0)) {
                mailError.setVisible(true);
            } else {
                final GWTWorkspace workspace = new GWTWorkspace();
                workspace.setUser(Main.get().workspaceUserProperties.getUser());
                workspace.setEmail(userMailText.getText());
                workspace.setMailProtocol(mailProtocol.getItemText(mailProtocol.getSelectedIndex()));
                workspace.setMailFolder(mailFolderText.getText());
                workspace.setMailHost(hostText.getText());
                workspace.setMailUser(mailUserText.getText());
                workspace.setMailPassword(mailUserPasswordText.getText());
                workspace.setPassword(userPasswordText.getText());
                workspace.setMailID(Main.get().workspaceUserProperties.getWorkspace().getMailID());
                // First must validate password
                workspaceService.isValidPassword(userPasswordText.getText(), new AsyncCallback<String>() {
                    @Override
                    public void onSuccess(String result) {
                        if (result.equals("")) {
                            workspaceService.updateUserWorkspace(workspace, callbackUpdateUserWorkspace);
                        } else {
                            passwordValidationError.setHTML(result);
                            passwordValidationError.setVisible(true);
                        }
                    }

                    @Override
                    public void onFailure(Throwable caught) {
                        Main.get().showError("callbackIsValidPassword", caught);
                    }
                });
            }
        }
    });

    cancel = new Button(Main.i18n("button.cancel"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            hide();
        }
    });

    test = new Button(Main.i18n("button.test"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            mailTestError.setVisible(false);
            mailTestOK.setVisible(false);
            test.setEnabled(false);
            generalService.testMailConnection(hostText.getText(), mailUserText.getText(),
                    mailUserPasswordText.getText(), mailFolderText.getText(),
                    mailProtocol.getItemText(mailProtocol.getSelectedIndex()),
                    new AsyncCallback<GWTTestMail>() {
                        @Override
                        public void onSuccess(GWTTestMail result) {
                            if (!result.isError()) {
                                mailTestError.setVisible(false);
                                mailTestOK.setVisible(true);
                            } else {
                                mailTestError.setHTML(Main.i18n("user.preferences.mail.test.error") + "<br>"
                                        + result.getErrorMsg());
                                mailTestError.setVisible(true);
                                mailTestOK.setVisible(false);
                            }
                            test.setEnabled(true);
                        }

                        @Override
                        public void onFailure(Throwable caught) {
                            mailTestError.setVisible(false);
                            mailTestOK.setVisible(false);
                            test.setEnabled(true);
                            Main.get().showError("testmailConnection", caught);
                        }
                    });
        }
    });

    delete = new Button(Main.i18n("button.delete"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            long Id = Main.get().workspaceUserProperties.getWorkspace().getMailID();

            if (Id >= 0) {
                workspaceService.deleteMailAccount(Id, callbackDeleteMailAccount);
            }
        }
    });

    hPanel = new HorizontalPanel();
    hPanel.add(update);
    hPanel.add(new HTML("&nbsp;&nbsp;"));
    hPanel.add(cancel);

    userFlexTable.setCellPadding(0);
    userFlexTable.setCellSpacing(2);
    userFlexTable.setWidth("455");

    userFlexTable.setWidget(0, 0, userId);
    userFlexTable.setWidget(1, 0, userName);
    userFlexTable.setWidget(2, 0, userPassword);
    userFlexTable.setWidget(3, 0, userMail);
    userFlexTable.setWidget(4, 0, userRoles);

    userFlexTable.setWidget(1, 1, userNameText);
    userFlexTable.setWidget(2, 1, userPasswordText);
    userFlexTable.setWidget(2, 2, userPasswordTextVerify);
    userFlexTable.setWidget(3, 1, userMailText);
    userFlexTable.setWidget(4, 1, rolesPanel);

    userFlexTable.getFlexCellFormatter().setVerticalAlignment(4, 0, HasAlignment.ALIGN_TOP);
    userFlexTable.getFlexCellFormatter().setColSpan(3, 1, 2);
    userFlexTable.getFlexCellFormatter().setColSpan(4, 1, 2);

    mailFlexTable.setCellPadding(0);
    mailFlexTable.setCellSpacing(2);
    mailFlexTable.setWidth("455");

    mailFlexTable.setWidget(1, 0, mailProtocolLabel);
    mailFlexTable.setWidget(2, 0, mailHost);
    mailFlexTable.setWidget(3, 0, mailUser);
    mailFlexTable.setWidget(4, 0, mailPassword);
    mailFlexTable.setWidget(5, 0, mailFolder);

    mailFlexTable.setWidget(1, 1, mailProtocol);
    mailFlexTable.setWidget(2, 1, hostText);
    mailFlexTable.setWidget(3, 1, mailUserText);
    mailFlexTable.setWidget(4, 1, mailUserPasswordText);
    mailFlexTable.setWidget(5, 1, mailFolderText);
    mailFlexTable.setWidget(6, 0, new HTML("&nbsp;"));
    mailFlexTable.setWidget(6, 1, delete);
    mailFlexTable.setWidget(6, 2, test);

    mailFlexTable.getFlexCellFormatter().setColSpan(1, 1, 1);

    userMailText.setWidth("275");
    hostText.setWidth("275");
    rolesPanel.setWidth("275");
    userGroupBoxPanel.setWidth("460px");
    mailGroupBoxPanel.setWidth("460px");

    vPanel.setWidth("470px");
    vPanel.setHeight("195px");

    vPanel.add(new HTML("<br>"));
    vPanel.add(userGroupBoxPanel);
    vPanel.add(new HTML("<br>"));
    vPanel.add(mailGroupBoxPanel);
    vPanel.add(passwordError);
    vPanel.add(passwordValidationError);
    vPanel.add(mailPassordError);
    vPanel.add(mailError);
    vPanel.add(mailTestError);
    vPanel.add(mailTestOK);
    vPanel.add(new HTML("<br>"));
    vPanel.add(hPanel);
    vPanel.add(new HTML("<br>"));

    vPanel.setCellHorizontalAlignment(userGroupBoxPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(mailGroupBoxPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(hPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(passwordError, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(passwordValidationError, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(mailPassordError, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(mailError, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(mailTestError, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(mailTestOK, HasAlignment.ALIGN_CENTER);

    userId.addStyleName("okm-NoWrap");
    userName.addStyleName("okm-NoWrap");
    userPassword.addStyleName("okm-NoWrap");
    userMail.addStyleName("okm-NoWrap");
    mailHost.addStyleName("okm-NoWrap");
    mailUser.addStyleName("okm-NoWrap");
    mailPassword.addStyleName("okm-NoWrap");
    mailFolder.addStyleName("okm-NoWrap");
    userPasswordText.setStyleName("okm-Input");
    userPasswordTextVerify.setStyleName("okm-Input");
    userMailText.setStyleName("okm-Input");
    hostText.setStyleName("okm-Input");
    mailUserText.setStyleName("okm-Input");
    mailUserPasswordText.setStyleName("okm-Input");
    mailFolderText.setStyleName("okm-Input");
    mailProtocolLabel.setStyleName("okm-NoWrap");
    passwordError.setStyleName("okm-Input-Error");
    passwordValidationError.setStyleName("okm-Input-Error");
    mailPassordError.setStyleName("okm-Input-Error");
    mailError.setStyleName("okm-Input-Error");
    mailTestError.setStyleName("okm-Input-Error");
    mailTestOK.setStyleName("okm-Input-Ok");
    update.setStyleName("okm-ChangeButton");
    cancel.setStyleName("okm-NoButton");
    delete.setStyleName("okm-DeleteButton");
    test.setStyleName("okm-Button");

    setPopupPosition(left, top);

    super.hide();
    setWidget(vPanel);
}

From source file:com.ikon.frontend.client.widget.WorkflowPopup.java

License:Open Source License

/**
 * Show the popup error//from w w  w.j  a va 2  s .com
 * 
 * @param msg Error message
 */
public void show() {
    setText(Main.i18n("workflow.label"));
    findLatestProcessDefinitions(); // Gets all groups
    listBox.setVisible(true);
    addButton.setEnabled(false);
    workflowWidget = null;
    listBox.setVisible(true);
    sp.setVisible(false);
    sp.clear();
    int left = (Window.getClientWidth() - 300) / 2;
    int top = (Window.getClientHeight() - 100) / 2;
    setPopupPosition(left, top);
    super.show();
}

From source file:com.jitlogic.zico.widgets.client.PopupWindow.java

License:Open Source License

public void resizeAndCenter(int w, int h) {
    setPixelSize(w, h + 20);/*from  w ww  .  j ava  2  s  . com*/
    setPopupPosition((Window.getClientWidth() - w) / 2, (Window.getClientHeight() - h) / 2);
}

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.konakart.client.Konakart.java

License:Open Source License

public void onResize(ResizeEvent event) {
    // when Window is Re-sized...
    onWindowResized(Window.getClientWidth(), Window.getClientHeight());
}