Example usage for com.google.gwt.user.client.ui DockPanel setCellWidth

List of usage examples for com.google.gwt.user.client.ui DockPanel setCellWidth

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui DockPanel setCellWidth.

Prototype

@Override
    public void setCellWidth(Widget w, String width) 

Source Link

Usage

From source file:edu.caltech.ipac.firefly.core.layout.AbstractLayoutManager.java

protected Widget makeNorth() {

    AbsolutePanel l = new AbsolutePanel();
    DockPanel dlp = new DockPanel();
    //        final Image sep = new Image("images/glow_bottom_center.gif");
    //        dlp.add(sep, DockPanel.SOUTH);
    //        GwtUtil.setStyles(sep, "width", "100%", "height", "5px");
    //        dlp.add(getSmallIcon().getDisplay(), DockPanel.EAST);
    //        dlp.add(getSmallIcon2().getDisplay(), DockPanel.WEST);
    dlp.add(l, DockPanel.CENTER);//from ww w.ja  va 2  s .  c  om
    dlp.setCellWidth(l, "100%");
    dlp.setCellHeight(l, "37px");
    dlp.setWidth("100%");

    //        dlp.setCellWidth(getSmallIcon().getDisplay(), "160px");
    dlp.setStyleName("menu-bar");
    getMenu().getDisplay().addStyleName("menu-bar");

    GwtUtil.setStyles(l, "width", "100%", "height", "5px", "overflow", "visible");

    l.add(getMenu().getDisplay(), 0, 10);
    //        DeferredCommand.addCommand(new Command(){
    //                public void execute() {
    //                    int offset = BrowserUtil.isBrowser(Browser.FIREFOX) ? 8 : 11;
    //                    RootPanel.get().add(getMenu().getDisplay(), l.getAbsoluteLeft(), l.getAbsoluteTop()+offset);
    //                }
    //            });
    return dlp;
}

From source file:edu.caltech.ipac.firefly.ui.panels.SearchPanel.java

private SearchPanel() {

    navPanel = new VerticalPanel();

    formPanel.addStyleName("content-panel");
    setFormAreaMinWidth("500px");

    //li/*w  w  w . j ava 2  s . c  om*/
    DockPanel mainPanel = new DockPanel();
    mainPanel.addStyleName("component-background");
    mainPanel.add(navPanel, DockPanel.WEST);
    mainPanel.add(formPanel, DockPanel.CENTER);

    Element el = (Element) navPanel.getElement().getParentElement();
    if (el != null) {
        DOM.setStyleAttribute(el, "background", "#E5E5E5");
        DOM.setStyleAttribute(el, "padding", "10px 10px 10px 30px");
        DOM.setStyleAttribute(el, "borderRight", "2px outset #e8e8e8");
    } else {
        navPanel.addStyleName("search-panel-list");
    }

    //        mainPanel.setWidth("100%");
    mainPanel.setCellWidth(navPanel, "200px");
    mainPanel.setCellHeight(navPanel, "100%");

    initWidget(mainPanel);
}

From source file:gov.nist.appvet.gwt.client.gui.AppVetPanel.java

License:Open Source License

public AppVetPanel(Unit unit, final ConfigInfoGwt configInfo, List<AppInfoGwt> initialApps) {
    super(Unit.PX);

    Window.addResizeHandler(new ResizeHandler() {
        Timer resizeTimer = new Timer() {

            @Override//ww  w .j  a  va2  s. c o m
            public void run() {
                resizeComponents();
            }

        };

        @Override
        public void onResize(ResizeEvent event) {
            resizeTimer.cancel();
            resizeTimer.schedule(250);
        }

    });

    userInfo = configInfo.getUserInfo();
    userName = userInfo.getUserName();
    allApps = initialApps;

    sinkEvents(Event.ONCLICK);
    sessionId = configInfo.getSessionId();
    sessionExpirationLong = configInfo.getSessionExpirationLong();
    MAX_SESSION_IDLE_DURATION = configInfo.getMaxIdleTime();
    POLLING_INTERVAL = configInfo.getUpdatesDelay();

    setSize("100%", "");
    setStyleName("mainDockPanel");
    SERVLET_URL = configInfo.getAppVetServletUrl();
    HOST_URL = configInfo.getAppVetHostUrl();
    appSelectionModel = new SingleSelectionModel<AppInfoGwt>();
    appSelectionModel.addSelectionChangeHandler(new AppListHandler(this, configInfo));
    if (configInfo.getAvailableToolNames() == null) {
        log.severe("Available tools is null");
    }
    availableToolNames = configInfo.getAvailableToolNames();
    availableToolIDs = configInfo.getAvailableToolIDs();
    availableToolTypes = configInfo.getAvailableToolTypes();

    final VerticalPanel northAppVetPanel = new VerticalPanel();
    northAppVetPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    northAppVetPanel.setStyleName("northAppVetPanel");
    northAppVetPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    addNorth(northAppVetPanel, 125.0);
    northAppVetPanel.setSize("100%", "");

    final HorizontalPanel horizontalPanel_5 = new HorizontalPanel();
    horizontalPanel_5.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_5.setStyleName("appVetHeaderPanel");
    northAppVetPanel.add(horizontalPanel_5);
    northAppVetPanel.setCellVerticalAlignment(horizontalPanel_5, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_5.setWidth("100%");
    northAppVetPanel.setCellWidth(horizontalPanel_5, "100%");

    final InlineHTML nlnhtmlNewInlinehtml_1 = new InlineHTML(
            "<img border=\"0\" width=\"192px\" src=\"images/appvet_logo.png\" alt=\"appvet\" />");
    nlnhtmlNewInlinehtml_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    nlnhtmlNewInlinehtml_1.setStyleName("");
    horizontalPanel_5.add(nlnhtmlNewInlinehtml_1);
    horizontalPanel_5.setCellWidth(nlnhtmlNewInlinehtml_1, "33%");
    horizontalPanel_5.setCellVerticalAlignment(nlnhtmlNewInlinehtml_1, HasVerticalAlignment.ALIGN_MIDDLE);

    final HorizontalPanel horizontalPanel_6 = new HorizontalPanel();
    horizontalPanel_6.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_6.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_5.add(horizontalPanel_6);
    horizontalPanel_6.setWidth("");
    horizontalPanel_5.setCellWidth(horizontalPanel_6, "34%");
    horizontalPanel_5.setCellHorizontalAlignment(horizontalPanel_6, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_5.setCellVerticalAlignment(horizontalPanel_6, HasVerticalAlignment.ALIGN_MIDDLE);

    searchTextBox = new TextBox();
    searchTextBox.setText("Search");
    searchTextBox.setStyleName("searchTextBox");
    searchTextBox.setTitle("Search by app ID, name, release kit, etc.");
    searchTextBox.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            searchTextBox.setText("");
        }

    });

    searchTextBox.addKeyPressHandler(new KeyPressHandler() {

        @Override
        public void onKeyPress(KeyPressEvent event_) {
            final boolean enterPressed = KeyCodes.KEY_ENTER == event_.getNativeEvent().getKeyCode();
            final String searchString = searchTextBox.getText();

            if (enterPressed) {
                final int numFound = search();
                if (numFound > 0) {
                    appsLabel.setText("Search Results for \"" + searchString + "\"");
                }
            }
        }

    });

    searchTextBox.setSize("300px", "22px");

    horizontalPanel_6.add(searchTextBox);
    horizontalPanel_6.setCellVerticalAlignment(searchTextBox, HasVerticalAlignment.ALIGN_MIDDLE);

    final PushButton searchButton = new PushButton("Search");
    searchButton.setTitle("Search by app ID, name, release kit, etc.");
    searchButton.getUpFace().setHTML("");
    searchButton.setSize("18px", "18px");
    searchButton.setHTML("<img width=\"18px\" src=\"images/icon-search.png\" alt=\"search\" />");
    searchButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            final String searchString = searchTextBox.getText();
            final int numFound = search();
            if (numFound > 0) {
                appsLabel.setText("Search Results for \"" + searchString + "\"");
            }
        }

    });

    horizontalPanel_6.add(searchButton);
    horizontalPanel_6.setCellHorizontalAlignment(searchButton, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_6.setCellVerticalAlignment(searchButton, HasVerticalAlignment.ALIGN_MIDDLE);

    Image image = new Image("images/nist-gray.png");
    horizontalPanel_5.add(image);
    horizontalPanel_5.setCellHorizontalAlignment(image, HasHorizontalAlignment.ALIGN_RIGHT);
    horizontalPanel_5.setCellWidth(image, "33%");

    final HorizontalPanel horizontalPanel_3 = new HorizontalPanel();
    northAppVetPanel.add(horizontalPanel_3);
    northAppVetPanel.setCellHorizontalAlignment(horizontalPanel_3, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_3.setWidth("100%");
    northAppVetPanel.setCellWidth(horizontalPanel_3, "100%");
    final MenuBar appVetMenuBar = new MenuBar(false);
    horizontalPanel_3.add(appVetMenuBar);

    appVetMenuBar.setStyleName("appVetMenuBar");
    appVetMenuBar.setAutoOpen(true);
    appVetMenuBar.setWidth("250px");
    appVetMenuBar.setAnimationEnabled(false);
    final MenuBar userMenuBar = new MenuBar(true);
    accountMenuItem = new MenuItem(userInfo.getNameWithLastNameInitial(), true, userMenuBar);
    accountMenuItem.setStyleName("AccountMenuItem");

    final MenuItem accountSettingsMenuItem = new MenuItem("Account Settings", false, new Command() {
        @Override
        public void execute() {
            updateUserInfo();
        }
    });

    userMenuBar.addItem(accountSettingsMenuItem);

    final MenuItem myAppsMenuItem = new MenuItem("My Apps", false, new Command() {

        @Override
        public void execute() {
            searchTextBox.setText(userInfo.getUserName());
            final int numFound = search();
            if (numFound > 0) {
                appsLabel.setText("My Apps");
            }
        }

    });
    userMenuBar.addItem(myAppsMenuItem);

    final MenuItemSeparator separator = new MenuItemSeparator();
    userMenuBar.addSeparator(separator);
    final MenuItem logoutMenuItem = new MenuItem("Logout", false, new Command() {

        @Override
        public void execute() {
            appVetServiceAsync.removeSession(sessionId, new AsyncCallback<Boolean>() {

                @Override
                public void onFailure(Throwable caught) {
                    AppVetPanel.showMessageDialog("AppVet Error", "App list retrieval error", true);
                    errorDialogBox.closeButton.setFocus(true);
                    errorDialogBox.closeButton.addClickHandler(new ClickHandler() {

                        @Override
                        public void onClick(ClickEvent event) {
                            killDialogBox(errorDialogBox);
                        }

                    });
                }

                @Override
                public void onSuccess(Boolean result) {
                    if (result == false) {
                        AppVetPanel.showMessageDialog("AppVet Error", "Could not remove session", true);
                        errorDialogBox.closeButton.setFocus(true);
                        errorDialogBox.closeButton.addClickHandler(new ClickHandler() {

                            @Override
                            public void onClick(ClickEvent event) {
                                killDialogBox(errorDialogBox);
                            }

                        });
                    } else {
                        pollingTimer.cancel();
                        final LoginPanel loginPanel = new LoginPanel(Unit.PX);
                        final RootLayoutPanel rootLayoutPanel = RootLayoutPanel.get();
                        rootLayoutPanel.clear();
                        rootLayoutPanel.add(loginPanel);

                        System.gc();
                    }
                }

            });
        }

    });

    userMenuBar.addItem(logoutMenuItem);
    appVetMenuBar.addItem(accountMenuItem);

    final MenuBar helpMenuBar = new MenuBar(true);
    final MenuItem helpMenuItem = new MenuItem("Help", true, helpMenuBar);
    final MenuItem aboutMenuItem = new MenuItem("About", false, new Command() {

        @Override
        public void execute() {
            aboutDialogBox = new AboutDialogBox(configInfo.getAppVetVersion());
            aboutDialogBox.setText("About");
            aboutDialogBox.center();
            aboutDialogBox.closeButton.setFocus(true);
            aboutDialogBox.closeButton.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    killDialogBox(aboutDialogBox);
                }

            });
        }

    });

    final MenuItem documentationMenuItem = new MenuItem("Documentation", false, new Command() {

        @Override
        public void execute() {
            Window.open("http://csrc.nist.gov/projects/appvet/", "_blank", null);
        }

    });
    helpMenuBar.addItem(documentationMenuItem);

    appVetMenuBar.addItem(helpMenuItem);
    helpMenuBar.addItem(aboutMenuItem);

    horizontalPanel_3.add(statusMessageLabel);
    horizontalPanel_3.setCellVerticalAlignment(statusMessageLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_3.setCellHorizontalAlignment(statusMessageLabel, HasHorizontalAlignment.ALIGN_RIGHT);
    horizontalPanel_3.setCellWidth(statusMessageLabel, "100%");

    statusMessageLabel.setStyleName("devModeIndicator");
    statusMessageLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    statusMessageLabel.setSize("420px", "18");

    final MenuBar adminMenuBar = new MenuBar(true);
    final MenuItem adminMenuItem = new MenuItem("Admin", true, adminMenuBar);

    final MenuItem mntmAppVetLog = new MenuItem("AppVet Log", false, new Command() {

        @Override
        public void execute() {
            final String dateString = "?nocache" + new Date().getTime();
            final String url = SERVLET_URL + dateString + "&command=GET_APPVET_LOG&sessionid=" + sessionId;
            Window.open(url, "_blank", "");
        }

    });

    adminMenuBar.addItem(mntmAppVetLog);

    final MenuItem usersMenuItem = new MenuItem("Users", false, new Command() {

        @Override
        public void execute() {
            usersDialogBox = new UsersDialogBox();
            usersDialogBox.setText("Users");
            usersDialogBox.center();
            usersDialogBox.doneButton.setFocus(true);
            usersDialogBox.doneButton.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    killDialogBox(usersDialogBox);
                }

            });
        }

    });

    adminMenuBar.addItem(usersMenuItem);

    if (userInfo.getRole().equals("ADMIN")) {
        appVetMenuBar.addItem(adminMenuItem);
    }

    // Remove first element containing the lastUpdate timestamp
    AppInfoGwt timeStampObject = null;
    if (initialApps != null && initialApps.size() > 0) {
        timeStampObject = initialApps.remove(0);
        lastAppsListUpdate = timeStampObject.getLastAppUpdate();
    }

    final HorizontalPanel horizontalPanel_2 = new HorizontalPanel();
    horizontalPanel_2.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_2.setStyleName("footerPanel");
    addSouth(horizontalPanel_2, 35.0);
    horizontalPanel_2.setSize("100%", "");

    //      final Label lastUpdatedLabel = new Label("Last updated: "
    //            + configInfo.getLastUpdated());
    //      lastUpdatedLabel
    //      .setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    //      lastUpdatedLabel.setStyleName("lastUpdated");
    //      horizontalPanel_2.add(lastUpdatedLabel);
    //      lastUpdatedLabel.setWidth("200px");
    //      horizontalPanel_2.setCellWidth(lastUpdatedLabel, "100%");
    //      horizontalPanel_2.setCellVerticalAlignment(lastUpdatedLabel,
    //            HasVerticalAlignment.ALIGN_MIDDLE);

    final HorizontalSplitPanel centerAppVetSplitPanel = new HorizontalSplitPanel();
    centerAppVetSplitPanel.setSplitPosition("64%");
    centerAppVetSplitPanel.setSize("", "");

    final SimplePanel leftCenterPanel = new SimplePanel();
    centerAppVetSplitPanel.setLeftWidget(leftCenterPanel);
    leftCenterPanel.setSize("", "95%");

    final DockPanel dockPanel_1 = new DockPanel();
    dockPanel_1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    leftCenterPanel.setWidget(dockPanel_1);
    dockPanel_1.setSize("100%", "");
    rightCenterPanel = new SimplePanel();
    centerAppVetSplitPanel.setRightWidget(rightCenterPanel);
    rightCenterPanel.setSize("", "630px");

    final VerticalPanel appInfoVerticalPanel = new VerticalPanel();
    appInfoVerticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    rightCenterPanel.setWidget(appInfoVerticalPanel);
    appInfoVerticalPanel.setSize("99%", "");

    final HorizontalPanel horizontalPanel_1 = new HorizontalPanel();
    horizontalPanel_1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_1.setStyleName("iconPanel");
    appInfoVerticalPanel.add(horizontalPanel_1);
    appInfoVerticalPanel.setCellWidth(horizontalPanel_1, "100%");
    horizontalPanel_1.setSize("", "");

    appInfoIcon = new Image("");
    appInfoIcon.setVisible(false);
    appInfoIcon.setAltText("");
    horizontalPanel_1.add(appInfoIcon);
    horizontalPanel_1.setCellVerticalAlignment(appInfoIcon, HasVerticalAlignment.ALIGN_MIDDLE);
    appInfoIcon.setSize("70px", "70px");

    final VerticalPanel verticalPanel = new VerticalPanel();
    horizontalPanel_1.add(verticalPanel);
    appInfoName = new HTML("", true);
    appInfoName.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    verticalPanel.add(appInfoName);
    appInfoName.setStyleName("appInfoName");
    appInfoName.setWidth("");
    horizontalPanel_1.setCellVerticalAlignment(appInfoName, HasVerticalAlignment.ALIGN_MIDDLE);
    appInfoVersion = new HTML("", true);
    appInfoVersion.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    appInfoVersion.setStyleName("appInfoVersion");
    verticalPanel.add(appInfoVersion);
    appsListButtonPanel = new HorizontalPanel();
    appsListButtonPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    dockPanel_1.add(appsListButtonPanel, DockPanel.NORTH);
    dockPanel_1.setCellHorizontalAlignment(appsListButtonPanel, HasHorizontalAlignment.ALIGN_CENTER);
    dockPanel_1.setCellWidth(appsListButtonPanel, "100%");
    dockPanel_1.setCellVerticalAlignment(appsListButtonPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    appsListButtonPanel.setStyleName("appListButtonPanel");
    appsListButtonPanel.setSize("100%", "");

    appsLabel = new InlineLabel("Apps");
    appsLabel.setStyleName("AppsLabel");
    appsListButtonPanel.add(appsLabel);
    appsListButtonPanel.setCellWidth(appsLabel, "50%");
    appsListButtonPanel.setCellVerticalAlignment(appsLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    appsLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    appsLabel.setWidth("60px");

    final HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.setStyleName("appFunctionButtonPanel");
    appsListButtonPanel.add(horizontalPanel);
    appsListButtonPanel.setCellWidth(horizontalPanel, "50%");
    appsListButtonPanel.setCellVerticalAlignment(horizontalPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    appsListButtonPanel.setCellHorizontalAlignment(horizontalPanel, HasHorizontalAlignment.ALIGN_RIGHT);
    horizontalPanel.setWidth("");

    final PushButton submitButton = new PushButton("Submit");
    submitButton.setTitle("Submit App");
    submitButton.setHTML("<img width=\"18px\" src=\"images/icon-submit.png\" alt=\"Submit\" />");
    submitButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            appUploadDialogBox = new AppUploadDialogBox(sessionId, SERVLET_URL);
            appUploadDialogBox.setText("Submit App");
            appUploadDialogBox.center();
            appUploadDialogBox.cancelButton.setFocus(true);
            appUploadDialogBox.cancelButton.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    killDialogBox(appUploadDialogBox);
                }

            });

            appUploadDialogBox.uploadAppForm.addFormHandler(new AppUploadFormHandler(appUploadDialogBox));
        }
    });

    final PushButton viewAllButton = new PushButton("View All");
    viewAllButton.setTitle("View All");
    viewAllButton.setHTML("<img width=\"18px\" src=\"images/icon-view-all.png\" alt=\"view-all\" />");
    viewAllButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            searchMode = false;
            setAllApps();
        }

    });

    horizontalPanel.add(viewAllButton);
    horizontalPanel.setCellHorizontalAlignment(viewAllButton, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel.setCellVerticalAlignment(viewAllButton, HasVerticalAlignment.ALIGN_MIDDLE);
    viewAllButton.setSize("18px", "18px");
    horizontalPanel.add(submitButton);
    horizontalPanel.setCellVerticalAlignment(submitButton, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.setCellHorizontalAlignment(submitButton, HasHorizontalAlignment.ALIGN_CENTER);
    submitButton.setSize("18px", "18px");
    downloadButton = new PushButton("Download");
    downloadButton.setTitle("Download Reports");
    downloadButton.setHTML("<img width=\"18px\" src=\"images/icon-download.png\" alt=\"Download\" />");
    horizontalPanel.add(downloadButton);
    downloadButton.setEnabled(true);
    downloadButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            final AppInfoGwt selected = appSelectionModel.getSelectedObject();
            if (selected == null) {
                showMessageDialog("AppVet Error", "No app is selected", true);
            } else {

                final String appId = selected.appId;
                final String dateString = "?nocache" + new Date().getTime();
                final String url = SERVLET_URL + dateString + "&command=DOWNLOAD_REPORTS&appid=" + appId
                        + "&sessionid=" + sessionId;
                Window.open(url, "_self", "");

                //               downloadDialog = new DownloadDialogBox(sessionId, selected);
                //               downloadDialog.setText("Download reports");
                //               downloadDialog.center();
                //               downloadDialog.cancelButton.setFocus(true);
                //               downloadDialog.cancelButton
                //               .addClickHandler(new ClickHandler() {
                //                  @Override
                //                  public void onClick(ClickEvent event) {
                //                     killDialogBox(downloadDialog);
                //                  }
                //               });
                //               downloadDialog.downloadButton
                //               .addClickHandler(new ClickHandler() {
                //                  @Override
                //                  public void onClick(ClickEvent event) {
                //                     if (downloadDialog.selected_apk_radio_button
                //                           .isChecked()) {
                //                        final AppInfoGwt selected = appSelectionModel
                //                              .getSelectedObject();
                //                        final String appId = selected.appId;
                //                        final String apk = selected.appName;
                //                        final String dateString = "?nocache"
                //                              + new Date().getTime();
                //                        final String url = SERVLET_URL
                //                              + dateString
                //                              + "&command=DOWNLOAD_APP&appid="
                //                              + appId + "&sessionid="
                //                              + sessionId + "&appname=" + apk
                //                              + ".apk";
                //                        Window.open(url, "_self", "");
                //                        killDialogBox(downloadDialog);
                //                     } else if (downloadDialog.selected_report_radio_button
                //                           .isChecked()) {
                //                        final AppInfoGwt selected = appSelectionModel
                //                              .getSelectedObject();
                //                        final String appId = selected.appId;
                //                        final String dateString = "?nocache"
                //                              + new Date().getTime();
                //                        final String url = SERVLET_URL
                //                              + dateString
                //                              + "&command=DOWNLOAD_REPORTS&appid="
                //                              + appId + "&sessionid="
                //                              + sessionId;
                //                        Window.open(url, "_self", "");
                //                        killDialogBox(downloadDialog);
                //                     }
                //                  }
                //               });
            }
        }
    });

    horizontalPanel.setCellHorizontalAlignment(downloadButton, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel.setCellVerticalAlignment(downloadButton, HasVerticalAlignment.ALIGN_MIDDLE);
    appsListButtonPanel.setCellHorizontalAlignment(downloadButton, HasHorizontalAlignment.ALIGN_CENTER);
    downloadButton.setSize("18px", "18px");
    addReportButton = new PushButton("Add Report");
    horizontalPanel.add(addReportButton);
    horizontalPanel.setCellVerticalAlignment(addReportButton, HasVerticalAlignment.ALIGN_MIDDLE);
    addReportButton.setTitle("Override Report");
    addReportButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            final AppInfoGwt selected = appSelectionModel.getSelectedObject();
            if (selected == null) {
                showMessageDialog("AppVet Error", "No app is selected", true);
            } else {
                reportUploadDialogBox = new ReportUploadDialogBox(userName, sessionId, selected.appId,
                        SERVLET_URL, availableToolNames, availableToolIDs);
                reportUploadDialogBox.setText("Override Report");
                reportUploadDialogBox.center();
                reportUploadDialogBox.cancelButton.setFocus(true);
                reportUploadDialogBox.cancelButton.addClickHandler(new ClickHandler() {

                    @Override
                    public void onClick(ClickEvent event) {
                        killDialogBox(reportUploadDialogBox);
                    }

                });
                reportUploadDialogBox.uploadReportForm.addFormHandler(
                        new ReportUploadFormHandler(reportUploadDialogBox, userName, selected.appId));
            }
        }
    });

    addReportButton.setSize("18px", "18px");
    addReportButton.setHTML("<img width=\"18px\" src=\"images/icon-submit-report.png\" alt=\"Add Report\" />");
    deleteButton = new PushButton("Delete");
    horizontalPanel.add(deleteButton);
    horizontalPanel.setCellVerticalAlignment(deleteButton, HasVerticalAlignment.ALIGN_MIDDLE);
    deleteButton.setHTML("<img width=\"18px\" src=\"images/icon-delete.png\" alt=\"delete\" />");
    deleteButton.setTitle("Delete App");
    deleteButton.setVisible(true);
    deleteButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            final AppInfoGwt selected = appSelectionModel.getSelectedObject();
            deleteConfirmDialogBox = new DeleteAppConfirmDialogBox(selected.appId, selected.appName);
            deleteConfirmDialogBox.setText("Confirm Delete");
            deleteConfirmDialogBox.center();
            deleteConfirmDialogBox.cancelButton.setFocus(true);
            deleteConfirmDialogBox.cancelButton.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    killDialogBox(deleteConfirmDialogBox);
                    return;
                }

            });
            deleteConfirmDialogBox.okButton.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    killDialogBox(deleteConfirmDialogBox);
                    if (selected != null) {
                        deleteApp(selected.appId, userName);
                    }
                }

            });
        }
    });
    deleteButton.setSize("18px", "18px");
    logButton = new PushButton("Log");
    horizontalPanel.add(logButton);
    horizontalPanel.setCellVerticalAlignment(logButton, HasVerticalAlignment.ALIGN_MIDDLE);
    logButton.setTitle("View Log");
    logButton.setHTML("<img width=\"18px\" src=\"images/icon-log.png\" alt=\"log\" />");
    logButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            final AppInfoGwt selected = appSelectionModel.getSelectedObject();
            if (selected != null) {
                final String appId = selected.appId;
                final String dateString = "?nocache" + new Date().getTime();
                final String url = SERVLET_URL + dateString + "&command=GET_APP_LOG&appid=" + appId
                        + "&sessionid=" + sessionId;
                Window.open(url, "_blank", "");
            }
        }

    });
    logButton.setSize("18px", "18px");

    appsListTable = new AppsListPagingDataGrid<AppInfoGwt>();
    appsListTable.dataGrid.setStyleName("dataGrid");
    dockPanel_1.add(appsListTable, DockPanel.CENTER);
    dockPanel_1.setCellHorizontalAlignment(appsListTable, HasHorizontalAlignment.ALIGN_CENTER);
    dockPanel_1.setCellVerticalAlignment(appsListTable, HasVerticalAlignment.ALIGN_MIDDLE);
    appsListTable.setAppVetHostUrl(HOST_URL);
    appsListTable.dataGrid.setSize("99%", "");
    appsListTable.setDataList(initialApps);
    appsListTable.setSize("", "");
    appsListTable.dataGrid.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
    appsListTable.dataGrid.setSelectionModel(appSelectionModel);
    addReportButton.setVisible(true);
    logButton.setVisible(true);

    //      final Label lblNewLabel_1 = new Label("*See log for system errors");
    //      lblNewLabel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    //      appInfoVerticalPanel.add(lblNewLabel_1);
    //      lblNewLabel_1.setWidth("200px");
    //      appInfoVerticalPanel.setCellWidth(lblNewLabel_1, "100%");
    toolResultsHtml = new HTML("", true);
    appInfoVerticalPanel.add(toolResultsHtml);
    appInfoVerticalPanel.setCellWidth(toolResultsHtml, "100%");
    toolResultsHtml.setWidth("100%");
    toolResultsHtml.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    toolResultsHtml.setStyleName("toolResultsHtml");

    add(centerAppVetSplitPanel);

    /*
    // Add logo in bottom-right corner 
    final InlineHTML nlnhtmlNewInlinehtml = new InlineHTML(
    "<a href=\"http://www.example.com\"><img border=\"0\" width=\"75px\"  src=\"exampleImage.png\" alt=\"example\" /></a>"
    ); nlnhtmlNewInlinehtml
    .setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    nlnhtmlNewInlinehtml.setStyleName("mainTaLogo");
    horizontalPanel_2.add(nlnhtmlNewInlinehtml);
    nlnhtmlNewInlinehtml.setWidth("");
    horizontalPanel_2.setCellHorizontalAlignment(nlnhtmlNewInlinehtml,
    HasHorizontalAlignment.ALIGN_RIGHT);
    horizontalPanel_2.setCellVerticalAlignment(nlnhtmlNewInlinehtml,
    HasVerticalAlignment.ALIGN_MIDDLE);
     */
    if ((initialApps != null) && (initialApps.size() > 0)) {
        appSelectionModel.setSelected(initialApps.get(0), true);
    } else {
        logButton.setEnabled(false);
        addReportButton.setEnabled(false);
        deleteButton.setEnabled(false);
        downloadButton.setEnabled(false);
    }
    pollServer(userName);
    scheduleResize();
}

From source file:gov.nist.appvet.gwt.client.gui.LoginPanel.java

License:Open Source License

public LoginPanel(Unit unit) {
    super(Unit.PX);

    final String version = AppVetProperties.VERSION;
    log.info("Starting AppVet v" + version + "...");

    setSize("100%", "");

    DockPanel dockPanel_1 = new DockPanel();
    dockPanel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    addNorth(dockPanel_1, 32.0);/*from   w ww  .  ja  v  a  2  s .  co m*/
    dockPanel_1.setWidth("100%");

    Image image = new Image("images/nist-gray.png");
    image.setStyleName("nistLoginLogo");
    dockPanel_1.add(image, DockPanel.EAST);
    dockPanel_1.setCellVerticalAlignment(image, HasVerticalAlignment.ALIGN_MIDDLE);
    dockPanel_1.setCellHorizontalAlignment(image, HasHorizontalAlignment.ALIGN_RIGHT);

    final VerticalPanel centerVerticalPanel = new VerticalPanel();
    centerVerticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    centerVerticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    add(centerVerticalPanel);
    centerVerticalPanel.setSize("100%", "90%");

    final DecoratorPanel decoratorPanel = new DecoratorPanel();
    centerVerticalPanel.add(decoratorPanel);
    centerVerticalPanel.setCellWidth(decoratorPanel, "100%");
    decoratorPanel.setSize("", "");
    centerVerticalPanel.setCellHorizontalAlignment(decoratorPanel, HasHorizontalAlignment.ALIGN_CENTER);
    centerVerticalPanel.setCellVerticalAlignment(decoratorPanel, HasVerticalAlignment.ALIGN_MIDDLE);

    final DockPanel dockPanel = new DockPanel();
    dockPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    dockPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    decoratorPanel.setWidget(dockPanel);
    dockPanel.setSize("100%", "200px");

    final VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    dockPanel.add(verticalPanel, DockPanel.NORTH);
    dockPanel.setCellWidth(verticalPanel, "100%");
    dockPanel.setCellVerticalAlignment(verticalPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    dockPanel.setCellHorizontalAlignment(verticalPanel, HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setSize("300px", "90px");

    final Image appVetImage = new Image("images/appvet_logo.png");
    appVetImage.setStyleName("loginPanelLogo");
    verticalPanel.add(appVetImage);
    verticalPanel.setCellHorizontalAlignment(appVetImage, HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setCellVerticalAlignment(appVetImage, HasVerticalAlignment.ALIGN_MIDDLE);
    appVetImage.setSize("192px", "73px");

    loginStatusLabel.setStyleName("submissionRequirementsLabel");
    verticalPanel.add(loginStatusLabel);
    loginStatusLabel.setVisible(true);
    loginStatusLabel.setSize("200px", "20px");
    verticalPanel.setCellHorizontalAlignment(loginStatusLabel, HasHorizontalAlignment.ALIGN_CENTER);

    final Grid grid = new Grid(2, 2);
    grid.setStyleName("loginGrid");
    dockPanel.add(grid, DockPanel.CENTER);
    dockPanel.setCellWidth(grid, "100%");
    grid.setHeight("");
    dockPanel.setCellVerticalAlignment(grid, HasVerticalAlignment.ALIGN_MIDDLE);
    dockPanel.setCellHorizontalAlignment(grid, HasHorizontalAlignment.ALIGN_CENTER);

    final Label usernameLabel = new Label("USERNAME");
    usernameLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    grid.setWidget(0, 0, usernameLabel);
    usernameLabel.setSize("100px", "20px");
    grid.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT);
    grid.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE);

    grid.setWidget(0, 1, userNameTextBox);
    userNameTextBox.setSize("180px", "15px");
    grid.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT);
    grid.getCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE);

    final Label passwordLabel = new Label("PASSWORD");
    passwordLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    grid.setWidget(1, 0, passwordLabel);
    passwordLabel.setSize("100px", "20px");
    grid.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_LEFT);
    grid.getCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_MIDDLE);

    grid.setWidget(1, 1, passwordTextBox);
    passwordTextBox.setSize("180px", "15px");
    grid.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_RIGHT);
    grid.getCellFormatter().setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_MIDDLE);
    passwordTextBox.addKeyPressHandler(new KeyPressHandler() {

        @Override
        public void onKeyPress(KeyPressEvent event_) {
            final boolean enterPressed = KeyCodes.KEY_ENTER == event_.getNativeEvent().getKeyCode();
            if (enterPressed) {
                getUserInput();
            }
        }

    });
    final SimplePanel simplePanel_3 = new SimplePanel();
    simplePanel_3.setStyleName("buttonPanel");
    dockPanel.add(simplePanel_3, DockPanel.SOUTH);
    simplePanel_3.setHeight("28px");
    dockPanel.setCellVerticalAlignment(simplePanel_3, HasVerticalAlignment.ALIGN_MIDDLE);
    dockPanel.setCellHorizontalAlignment(simplePanel_3, HasHorizontalAlignment.ALIGN_CENTER);
    loginButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            getUserInput();
        }

    });
    simplePanel_3.setWidget(loginButton);
    loginButton.setText("LOGIN");
    loginButton.setSize("78px", "26px");
}

From source file:org.freemedsoftware.gwt.client.screen.MainScreen.java

License:Open Source License

public MainScreen() {
    final DockPanel mainPanel = new DockPanel();
    initWidget(mainPanel);/*  w  w w. j  a v a 2 s.c om*/
    mainPanel.setSize("100%", "100%");

    // CurrentState.retrieveUserConfiguration(true);
    CurrentState.retrieveSystemConfiguration(true);

    // populateLeftNavigationPanel();

    JsonUtil.debug("MainScreen: call populateDefaultProvider");
    populateDefaultProvider();

    JsonUtil.debug("MainScreen: call populateDefaultFacility");
    JsonUtil.debug("MainScreen: assign object to CurrentState static object");
    CurrentState.assignMainScreen(this);

    /*
     * Top Header panel to use top header shortcuts e.g logoff,add patient
     * etc
     */

    VerticalPanel topHeaderPanel = new VerticalPanel();
    topHeaderPanel.ensureDebugId("topHeaderPanel");
    topHeaderPanel.setStyleName(AppConstants.STYLE_HEADER_PANEL);
    topHeaderPanel.setWidth("100%");

    Image logoImage = new Image();
    logoImage.setUrl("resources/images/FreemedHeader.jpg");
    logoImage.setSize("100%", "55px");
    topHeaderPanel.add(logoImage);
    topHeaderPanel.setCellHorizontalAlignment(logoImage, HasHorizontalAlignment.ALIGN_CENTER);
    topHeaderPanel.setCellWidth(logoImage, "100%");

    HorizontalPanel topHeaderHorPanel = new HorizontalPanel();
    topHeaderHorPanel.setWidth("100%");

    HorizontalPanel facilityInfoPanel = new HorizontalPanel();
    facilityInfoPanel.setStyleName(AppConstants.STYLE_HEADER_PANEL);

    // adding userInfoPanel at top left
    HorizontalPanel userInfoPanel = new HorizontalPanel();
    userInfoPanel.setStyleName(AppConstants.STYLE_HEADER_PANEL);
    Image userImage = new Image();
    userImage.setUrl("resources/images/user-icon.png");
    userImage.setSize("13px", "100%");
    userInfoPanel.add(userImage);
    userInfoPanel.add(loginUserInfo);// Adding loginuserinfo link
    setLoginUserInfo();
    // Adding UserInfoPanel into top headerhorpanel
    HorizontalPanel hp = new HorizontalPanel();

    Image homeImage = new Image();
    homeImage.setUrl("resources/images/home-icon.png");
    homeImage.setSize("15px", "100%");
    facilityInfoPanel.add(homeImage);
    facilityInfoPanel.add(facilityInfo);

    HTML separator = new HTML("|");
    separator.setWidth("8px");
    separator.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    hp.add(userInfoPanel);
    hp.add(separator);
    hp.add(facilityInfoPanel);
    // Adding UserInfoPanel into top headerhorpanel
    topHeaderHorPanel.add(hp);
    topHeaderHorPanel.setCellHorizontalAlignment(hp, HasHorizontalAlignment.ALIGN_LEFT);
    topHeaderHorPanel.setCellHorizontalAlignment(facilityInfoPanel, HasHorizontalAlignment.ALIGN_LEFT);
    // topHeaderHorPanel.setCellWidth(facilityInfoPanel, "20%");

    // adding shortcuts panel at top right corder

    shortCutsPanel = new HorizontalPanel();

    // Adding shortCutsPanel into top header
    topHeaderHorPanel.add(shortCutsPanel);
    topHeaderHorPanel.setCellHorizontalAlignment(shortCutsPanel, HasHorizontalAlignment.ALIGN_RIGHT);

    // Adding tophorpanel into top topheaderpanel
    topHeaderPanel.add(topHeaderHorPanel);
    topHeaderPanel.setCellWidth(topHeaderHorPanel, "100%");

    // Adding top header to main panel
    mainPanel.add(topHeaderPanel, DockPanel.NORTH);
    mainPanel.setCellWidth(topHeaderPanel, "100%");
    mainPanel.setCellHeight(topHeaderPanel, "3%");

    /*
     * SimplePanel to hold (hopefully) a horizontal sub menu, going to try
     * to use the Menu Bar items to call each sub-menu -JA
     */

    JsonUtil.debug("MainScreen: create accordion panel");

    // Creating Left Navigation area with decorated stack panel
    stackPanel = new AccordionPanel();
    stackPanel.setWidth("100%");
    // stackPanel.setHeight("100%");

    {
        JsonUtil.debug("MainScreen: add main pane");
        mainAccPanel = new VerticalPanel();
        mainAccPanel.setStyleName("accordion-panel");
        mainAccPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        // adding Main Panel(System) into stack panel
        // stackPanel.add(mainAccPanel,
        // getHeaderString(AppConstants.SYSTEM_CATEGORY, null), true);

        JsonUtil.debug("MainScreen: add patient pane");
        patientAccPanel = new VerticalPanel();
        patientAccPanel.setStyleName("accordion-panel");
        patientAccPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        // adding Patient Panel into stack panel
        // stackPanel.add(patientAccPanel,
        // getHeaderString(AppConstants.PATIENT_CATEGORY, null), true);

        JsonUtil.debug("MainScreen: add document pane");
        documentAccPanel = new VerticalPanel();
        documentAccPanel.setStyleName("accordion-panel");
        documentAccPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        // adding Documents Panel into stack panel
        // stackPanel.add(documentAccPanel,
        // getHeaderString(AppConstants.DOCUMENTS_CATEGORY, null), true);
        JsonUtil.debug("MainScreen: add Billing pane");
        billingAccPanel = new VerticalPanel();
        billingAccPanel.setStyleName("accordion-panel");
        billingAccPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        // adding Billing Panel into stack panel
        // stackPanel.add(billingAccPanel,
        // getHeaderString(AppConstants.BILLING_CATEGORY, null), true);

        JsonUtil.debug("MainScreen: add Reporting pane");
        reportingAccPanel = new VerticalPanel();
        reportingAccPanel.setStyleName("accordion-panel");
        reportingAccPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        // adding Reporting Panel into stack panel
        // stackPanel.add(reportingAccPanel,
        // getHeaderString(AppConstants.REPORTING_CATEGORY, null), true);

        JsonUtil.debug("MainScreen: add utilities pane");
        utilitiesAccPanel = new VerticalPanel();
        utilitiesAccPanel.setStyleName("accordion-panel");
        utilitiesAccPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

        // adding Utilities Panel into stack panel
        // stackPanel.add(utilitiesAccPanel,
        // getHeaderString(AppConstants.UTILITIES_CATEGORY, null), true);

        // Disable for now
        // accordionPanel.selectPanel("Main");
    }
    JsonUtil.debug("MainScreen: create container hpanel for accordion and tabs");

    HorizontalPanel menuAndContent = new HorizontalPanel();
    menuAndContent.setSize("100%", "100%");

    // Jam them together, no space.
    menuAndContent.setSpacing(0);
    // menuAndContent.setCellWidth(accordionPanel, "250px");

    JsonUtil.debug("MainScreen: add accordion and tab panel to container");
    menuAndContent.add(stackPanel);
    stackPanel.ensureDebugId("cwStackPanel");

    // defining left navigation area width
    menuAndContent.setCellWidth(stackPanel, "12%");

    JsonUtil.debug("MainScreen: create tabPanel");
    tabPanel = new DecoratedTabPanel();

    tabPanel.setSize("100%", "100%");
    tabPanel.setAnimationEnabled(true);
    menuAndContent.add(tabPanel);
    // defining content area width
    menuAndContent.setCellWidth(tabPanel, "88%");

    menuAndContent.setCellHorizontalAlignment(tabPanel, HasHorizontalAlignment.ALIGN_LEFT);
    JsonUtil.debug("MainScreen: add container to dock panel");
    mainPanel.add(menuAndContent, DockPanel.CENTER);

    JsonUtil.debug("MainScreen: add dashboard panel to tabs and select");
    // tabPanel.add(dashboard, "Dashboard");
    tabPanel.add(dashboardScreenNew, "Dashboard");

    tabPanel.selectTab(0);
    JsonUtil.debug("MainScreen: pass tabPanel to static CurrentState");
    CurrentState.assignTabPanel(tabPanel);

    // Get configuration
    CurrentState.retrieveUserConfiguration(true, new Command() {
        public void execute() {
            JsonUtil.debug("MainScreen: Set State of dashboard");
            dashboardScreenNew.loadWidgets();
            dashboardScreenNew.reloadDashboard();
        }
    });

    // Expand out main tabpanel to take up all extra room
    JsonUtil.debug("MainScreen: expand tabpanel");
    // mainPanel.setCellWidth(tabPanel, "100%");
    // mainPanel.setCellHeight(tabPanel, "100%");

    final HTML poweredByLabel = new HTML(_("Powered By FreeMED&trade;"));
    poweredByLabel.setStyleName(AppConstants.STYLE_LABEL_SMALL);
    mainPanel.add(poweredByLabel, DockPanel.SOUTH);
    mainPanel.setCellHorizontalAlignment(poweredByLabel, HasHorizontalAlignment.ALIGN_CENTER);

    JsonUtil.debug("MainScreen: split panel");
    statusBarContainer = new HorizontalSplitPanel();
    mainPanel.add(statusBarContainer, DockPanel.SOUTH);
    statusBarContainer.setSize("100%", "30px");
    statusBarContainer.setSplitPosition("50%");

    JsonUtil.debug("MainScreen: status bar");
    statusBar1 = new Label(_("Ready"));
    statusBar1.setStyleName("statusBar");
    statusBarContainer.add(statusBar1);
    CurrentState.assignStatusBar(statusBar1);
    statusBar2 = new Label("-");
    statusBar2.setStyleName("statusBar");
    statusBarContainer.add(statusBar2);
    if (Util.isStubbedMode()) {
        statusBar2.setText("STUBBED / TEST MODE");
    }
    populateDefaultFacility();

    // Create notification toaster
    JsonUtil.debug("MainScreen: create toaster");
    if (CurrentState.getToaster() == null) {
        Toaster toaster = new Toaster();
        CurrentState.assignToaster(toaster);
        toaster.setTimeout(7);
    }

    // Handle system notifications
    // notifications.setState(getCurrentState());
    JsonUtil.debug("MainScreen: start notifications");
    notifications.start();

    if (Util.getProgramMode() == ProgramMode.STUBBED)
        initNavigations();

    tabPanel.addSelectionHandler(new SelectionHandler<Integer>() {
        @Override
        public void onSelection(SelectionEvent<Integer> arg0) {
            if (tabPanel.getWidget(arg0.getSelectedItem()) instanceof ScreenInterface) {
                ScreenInterface screenInterface = ((ScreenInterface) tabPanel
                        .getWidget(arg0.getSelectedItem()));
                String className = screenInterface.getClass().getName();
                className = className.substring(className.lastIndexOf('.') + 1);
                CurrentState.assignCurrentPageHelp(className);
            }
        }
    });

    // Force showing the screen
    // show();
}

From source file:org.jboss.errai.widgets.client.layout.WSDropShadowLayout.java

License:Apache License

public WSDropShadowLayout(Widget wrappedWidget) {
    DockPanel dockPanel = new DockPanel();

    /**/*from  www  .jav a2s . c om*/
     * Bad hack to avoid rendering shadow when IE is present.
     */
    if (getUserAgent().indexOf("msie") == -1) {
        HorizontalPanel top = new HorizontalPanel();
        top.setWidth("100%");

        dockPanel.add(top, DockPanel.NORTH);
        dockPanel.setCellWidth(top, "100%");

        SimplePanel topLeftCorner = new SimplePanel();
        topLeftCorner.setStyleName("WSDropShadow-topLeftCorner");
        top.add(topLeftCorner);

        SimplePanel topLeft = new SimplePanel();
        topLeft.setStyleName("WSDropShadow-topLeft");
        top.add(topLeft);

        SimplePanel topMiddle = new SimplePanel();
        topMiddle.setStyleName("WSDropShadow-topMiddle");
        top.add(topMiddle);
        top.setCellWidth(topMiddle, "100%");

        SimplePanel topRight = new SimplePanel();
        topRight.setStyleName("WSDropShadow-topRight");
        top.add(topRight);

        SimplePanel topRightCorner = new SimplePanel();
        topRightCorner.setStyleName("WSDropShadow-topRightCorner");
        top.add(topRightCorner);

        HorizontalPanel bottom = new HorizontalPanel();
        bottom.setWidth("100%");
        dockPanel.add(bottom, DockPanel.SOUTH);
        dockPanel.setCellWidth(bottom, "100%");

        SimplePanel bottomLeftCorner = new SimplePanel();
        bottomLeftCorner.setStyleName("WSDropShadow-bottomLeftCorner");
        bottom.add(bottomLeftCorner);

        SimplePanel bottomLeft = new SimplePanel();
        bottomLeft.setStyleName("WSDropShadow-bottomLeft");
        bottom.add(bottomLeft);

        SimplePanel bottomMiddle = new SimplePanel();
        bottomMiddle.setStyleName("WSDropShadow-bottomMiddle");
        bottom.add(bottomMiddle);
        bottom.setCellWidth(bottomMiddle, "100%");

        SimplePanel bottomRight = new SimplePanel();
        bottomRight.setStyleName("WSDropShadow-bottomRight");
        bottom.add(bottomRight);

        SimplePanel bottomRightCorner = new SimplePanel();
        bottomRightCorner.setStyleName("WSDropShadow-bottomRightCorner");
        bottom.add(bottomRightCorner);

        VerticalPanel left = new VerticalPanel();
        left.setHeight("100%");
        dockPanel.add(left, DockPanel.WEST);
        dockPanel.setCellHeight(left, "100%");

        SimplePanel leftTop = new SimplePanel();
        leftTop.setStyleName("WSDropShadow-leftTop");
        left.add(leftTop);

        SimplePanel leftMiddle = new SimplePanel();
        leftMiddle.setHeight("100%");
        leftMiddle.setStyleName("WSDropShadow-leftMiddle");
        left.add(leftMiddle);
        left.setCellHeight(leftMiddle, "100%");

        SimplePanel leftBottom = new SimplePanel();
        leftBottom.setStyleName("WSDropShadow-leftBottom");
        left.add(leftBottom);

        VerticalPanel right = new VerticalPanel();
        right.setHeight("100%");
        dockPanel.add(right, DockPanel.EAST);
        dockPanel.setCellHeight(right, "100%");

        SimplePanel rightTop = new SimplePanel();
        rightTop.setStyleName("WSDropShadow-rightTop");
        right.add(rightTop);

        SimplePanel rightMiddle = new SimplePanel();
        rightMiddle.setHeight("100%");
        rightMiddle.setStyleName("WSDropShadow-rightMiddle");
        right.add(rightMiddle);
        right.setCellHeight(rightMiddle, "100%");

        SimplePanel rightBottom = new SimplePanel();
        rightBottom.setStyleName("WSDropShadow-rightBottom");
        right.add(rightBottom);

    }
    dockPanel.add(wrappedWidget, DockPanel.CENTER);
    dockPanel.setCellWidth(wrappedWidget, "100%");
    dockPanel.setCellHeight(wrappedWidget, "100%");

    initWidget(dockPanel);
}

From source file:org.otalo.ao.client.Messages.java

License:Apache License

public void loadRest() {

    topPanel = new TopPanel(line, moderator, images);
    topPanel.setWidth("100%");

    fora = new Fora(images);
    messageList = new MessageList(images);
    messageList.setWidth("100%");

    // Create the right panel, containing the email list & details.
    rightPanel.add(messageList);/*from w  ww .j  a  va 2 s.com*/
    if (!canManage()) {
        searchResultMsgList = new SearchResultMsgList();
        searchResultMsgList.setWidth("100%");
        searchResultMsgList.setVisible(false);
        rightPanel.add(searchResultMsgList);
    }

    if (line.bcastingAllowed()) {
        broadcastIface = new BroadcastInterface(images);
        bcasts = new Broadcasts(images);
        rightPanel.add(broadcastIface);
    }
    if (line.hasSMSConfig()) {
        smsList = new SMSList(images);
        smsList.setWidth("100%");
        smsIface = new SMSInterface(images);
        smss = new SMSs(images);
        rightPanel.add(smsIface);
        rightPanel.add(smsList);
    }

    shortcuts = new Shortcuts(images, fora, bcasts, smss, search);
    shortcuts.setWidth("100%");
    rightPanel.setWidth("100%");

    if (canManage()) {
        groupsIface = new ManageGroups(images);
        rightPanel.add(groupsIface);

        //showing help if its stream
        String helpHtmlStr = "<div id='help_tab' class='help-tab-right'>"
                + "<a href='http://awaaz.de/blog/2013/09/awaaz-de-streams-start-up-guide-and-glossary/' target=_blank  id='help-link'>"
                + "<span>H</span>" + "<span>E</span>" + "<span>L</span>" + "<span>P</span></a></div>";
        HTML helpHtml = new HTML(helpHtmlStr);
        RootPanel.get().add(helpHtml);
    } else {
        messageDetail = new MessageDetail();
        messageDetail.setWidth("100%");
        rightPanel.add(messageDetail);

        search = new SearchFilterPanel(searchResultMsgList);
        searchShortCut = new Shortcuts(images, null, null, null, search);
        searchShortCut.setWidth("100%");
        searchShortCut.setVisible(false);
    }

    displayForumPanel();

    // creating a loader
    loaderImage = new HTML(AbstractImagePrototype.create(images.loader()).getHTML());
    loaderImage.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    loaderImage.addStyleName("loader-img");
    showLoader(false);

    rightPanel.add(loaderImage);

    // Create a dock panel that will contain the menu bar at the top,
    // the shortcuts to the left, and the mail list & details taking the rest.
    DockPanel outer = new DockPanel();
    //DockLayoutPanel outer = new DockLayoutPanel(Unit.PCT);

    outer.add(topPanel, DockPanel.NORTH);
    outer.add(shortcuts, DockPanel.WEST);
    if (!canManage()) {
        if (searchShortCut.isVisible())
            searchShortCut.setVisible(false);
        outer.add(searchShortCut, DockPanel.WEST);
    }

    //outer.addWest(shortcuts, 100);
    outer.add(rightPanel, DockPanel.CENTER);
    //outer.add(rightPanel);
    outer.setWidth("100%");

    outer.setSpacing(4);
    outer.setCellWidth(rightPanel, "100%");

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

    // 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");

    // Finally, add the outer panel to the RootPanel, so that it will be
    // displayed.
    RootPanel.get().add(outer);

    // Call the window resized handler to get the initial sizes setup. Doing
    // this in a deferred command causes it to occur after all widgets' sizes
    // have been computed by the browser.
    Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
        public void execute() {
            onWindowResized(Window.getClientWidth(), Window.getClientHeight());

        }
    });

    onWindowResized(Window.getClientWidth(), Window.getClientHeight());
}

From source file:org.pentaho.gwt.widgets.client.controls.TableEditor.java

License:Open Source License

public TableEditor(String labelText) {

    DockPanel buttonPanel = new DockPanel();

    buttonPanel.add(deleteBtn, DockPanel.EAST);
    VerticalPanel spacer = new VerticalPanel();
    spacer.setWidth("2"); //$NON-NLS-1$
    buttonPanel.add(spacer, DockPanel.EAST);
    buttonPanel.add(addBtn, DockPanel.EAST);

    errorLabel = new ErrorLabel(new Label(labelText));
    buttonPanel.add(errorLabel, DockPanel.WEST);
    buttonPanel.setCellWidth(errorLabel, "100%"); //$NON-NLS-1$

    add(buttonPanel);//from  www .ja  v  a  2  s  . c  o m

    actionLb.setWidth("100%"); //$NON-NLS-1$
    actionLb.setHeight("100%"); //$NON-NLS-1$
    actionLb.setVisibleItemCount(DEFAULT_NUM_VISIBLE_ITEMS);
    actionLb.setMultipleSelect(true);
    final TableEditor localThis = this;

    actionLb.addClickListener(new ClickListener() {
        public void onClick(Widget arg0) {
            if (null != onSelectHandler) {
                onSelectHandler.onHandle(localThis);
            }
        }
    });
    add(actionLb);
    setCellHeight(actionLb, "100%"); //$NON-NLS-1$
    addBtn.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            localThis.handleAdd();
        }
    });

    deleteBtn.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            localThis.handleDeleteSelectedItems();
        }
    });
}

From source file:org.pentaho.pac.client.datasources.DataSourcesPanel.java

License:Open Source License

public DockPanel buildDataSourceDetailsDockPanel() {
    DockPanel dockPanel = new DockPanel();

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.add(generalButton);//from   w w w .  j a va2s  . c om
    horizontalPanel.add(advanceButton);
    dockPanel.add(horizontalPanel, DockPanel.NORTH);
    dockPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    dockPanel.setSpacing(10);
    generalButton.setTitle(Messages.getString("clickEditGeneral")); //$NON-NLS-1$
    advanceButton.setTitle(Messages.getString("clickEditAdvance")); //$NON-NLS-1$

    generalButton.setStylePrimaryName("generalToggleBtn"); //$NON-NLS-1$
    advanceButton.setStylePrimaryName("advanceToggleBtn"); //$NON-NLS-1$
    deckPanel.add(dataSourceGeneralPanel);
    deckPanel.add(dataSourceAdvancePanel);

    dataSourceGeneralPanel.setWidth("100%"); //$NON-NLS-1$
    dataSourceGeneralPanel.setHeight("100%"); //$NON-NLS-1$
    dataSourceAdvancePanel.setWidth("100%"); //$NON-NLS-1$
    dataSourceAdvancePanel.setHeight("100%"); //$NON-NLS-1$

    dockPanel.add(deckPanel, DockPanel.CENTER);
    dockPanel.setCellWidth(deckPanel, "100%"); //$NON-NLS-1$
    dockPanel.setCellHeight(deckPanel, "100%"); //$NON-NLS-1$

    deckPanel.setWidth("100%"); //$NON-NLS-1$
    deckPanel.setHeight("100%"); //$NON-NLS-1$
    deckPanel.setStyleName("newDataSourceDialogBox.detailsPanel"); //$NON-NLS-1$
    deckPanel.showWidget(GENERAL_PANEL_ID);
    generalButton.setDown(true);
    advanceButton.setDown(false);
    generalButton.addClickListener(this);
    advanceButton.addClickListener(this);

    dockPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    dataSourceGeneralPanel.getJndiNameTextBox().setReadOnly(true);
    return dockPanel;
}

From source file:org.pentaho.pac.client.datasources.DataSourcesPanel.java

License:Open Source License

public DockPanel buildDataSourcesListPanel() {
    DockPanel headerDockPanel = new DockPanel();
    headerDockPanel.add(deleteDataSourceBtn, DockPanel.EAST);
    VerticalPanel spacer = new VerticalPanel();
    spacer.setWidth("2"); //$NON-NLS-1$
    headerDockPanel.add(spacer, DockPanel.EAST);
    headerDockPanel.add(addDataSourceBtn, DockPanel.EAST);
    Label label = new Label(Messages.getString("dataSources")); //$NON-NLS-1$
    headerDockPanel.add(label, DockPanel.WEST);
    headerDockPanel.setCellWidth(label, "100%"); //$NON-NLS-1$
    DockPanel dataSourceListPanel = new DockPanel();
    dataSourceListPanel.add(headerDockPanel, DockPanel.NORTH);
    dataSourceListPanel.add(dataSourcesList, DockPanel.CENTER);
    dataSourceListPanel.setCellHeight(dataSourcesList, "100%"); //$NON-NLS-1$
    dataSourceListPanel.setCellWidth(dataSourcesList, "100%"); //$NON-NLS-1$
    dataSourceListPanel.setHeight("100%"); //$NON-NLS-1$
    dataSourceListPanel.setWidth("100%"); //$NON-NLS-1$
    dataSourcesList.setHeight("100%"); //$NON-NLS-1$
    dataSourcesList.setWidth("100%"); //$NON-NLS-1$
    deleteDataSourceBtn.setEnabled(false);
    dataSourcesList.addChangeListener(this);
    addDataSourceBtn.addClickListener(this);
    deleteDataSourceBtn.addClickListener(this);
    return dataSourceListPanel;
}