List of usage examples for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE
VerticalAlignmentConstant ALIGN_MIDDLE
To view the source code for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE.
Click Source Link
From source file:com.badlogic.gdx.backends.gwt.GwtApplicationCustom.java
License:Apache License
@Override public void onModuleLoad() { this.agentInfo = computeAgentInfo(); this.listener = getApplicationListener(); this.config = getConfig(); if (config.rootPanel != null) { this.root = config.rootPanel; } else {//from ww w.ja v a2 s.co m Element element = Document.get().getElementById("embed-" + GWT.getModuleName()); if (element == null) { VerticalPanel panel = new VerticalPanel(); panel.setWidth("100%"); panel.setHeight("100%"); // panel.setWidth("" + config.width + "px"); // panel.setHeight("" + config.height + "px"); panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); RootPanel.get().add(panel); // RootPanel.get().setWidth("" + config.width + "px"); // RootPanel.get().setHeight("" + config.height + "px"); RootPanel.get().setWidth("100%"); RootPanel.get().setHeight("100%"); this.root = panel; } else { VerticalPanel panel = new VerticalPanel(); panel.setWidth("100%"); panel.setHeight("100%"); panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); element.appendChild(panel.getElement()); root = panel; } } // initialize SoundManager2 SoundManager.init(GWT.getModuleBaseURL(), 9); // wait for soundmanager to load, this is fugly, but for // some reason the ontimeout and onerror callbacks are never // called (function instanceof Function fails, wtf JS?). new Timer() { @Override public void run() { if (SoundManager.swfLoaded()) { final PreloaderCallback callback = getPreloaderCallback(); preloader = new Preloader(); preloader.preload("assets.txt", new PreloaderCallback() { @Override public void loaded(String file, int loaded, int total) { callback.loaded(file, loaded, total); } @Override public void error(String file) { callback.error(file); } @Override public void done() { callback.done(); root.clear(); setupLoop(); } }); cancel(); } } }.scheduleRepeating(100); }
From source file:com.chinarewards.gwt.license.client.widget.EltNewPager.java
public EltNewPager(TextLocation location, Resources resources, boolean showFastForwardButton, final int fastForwardRows, boolean showLastPageButton) { // this.resources = resources; this.fastForwardRows = fastForwardRows; // this.style = resources.simplePagerStyle(); // this.style.ensureInjected(); // Create the buttons. // String disabledStyle = style.disabledButton(); firstPage = new Anchor(""); firstPage.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { firstPage();// w w w.j a v a 2 s. c o m } }); nextPage = new Anchor(""); nextPage.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { nextPage(); } }); prevPage = new Anchor(""); prevPage.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { previousPage(); } }); if (showLastPageButton) { lastPage = new Anchor(""); lastPage.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { lastPage(); } }); } else { lastPage = null; } if (showFastForwardButton) { fastForward = new Anchor("what?"); fastForward.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { setPage(getPage() + getFastForwardPages()); } }); } else { fastForward = null; } onePage = new Anchor("1"); twoPage = new Anchor("2"); threePage = new Anchor("3"); fourPage = new Anchor("4"); fivePage = new Anchor("5"); // 1-5 onePage.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { setPage(0); setButtonStyle(1, getPageCount()); } }); twoPage.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { setPage(1); setButtonStyle(2, getPageCount()); } }); threePage.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { setPage(2); setButtonStyle(3, getPageCount()); } }); fourPage.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { setPage(3); setButtonStyle(4, getPageCount()); } }); fivePage.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { setPage(4); setButtonStyle(5, getPageCount()); } }); // Construct the widget. HorizontalPanel layout = new HorizontalPanel(); layout.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); initWidget(layout); if (location == TextLocation.RIGHT) { layout.add(label); } layout.add(prevPage); layout.add(firstPage); if (location == TextLocation.CENTER) { layout.add(label); } layout.add(onePage); layout.add(twoPage); layout.add(threePage); layout.add(fourPage); layout.add(fivePage); // if (showFastForwardButton) { // layout.add(fastForward); // } if (showLastPageButton) { layout.add(lastPage); } layout.add(nextPage); if (location == TextLocation.LEFT) { layout.add(label); } // // Add style names to the cells. // firstPage.getElement().getParentElement().addClassName(style.button()); // prevPage.getElement().getParentElement().addClassName(style.button()); // label.getElement().getParentElement().addClassName(style.pageDetails()); // nextPage.getElement().getParentElement().addClassName(style.button()); // if (showFastForwardButton) { // fastForward.getElement().getParentElement().addClassName(style.button()); // } // if (showLastPageButton) { // lastPage.getElement().getParentElement().addClassName(style.button()); // } // Disable the buttons by default. setDisplay(null); }
From source file:com.client.celltable.SimplePager.java
License:Apache License
/** * Construct a {@link SimplePager} with the specified resources. * //from ww w . jav a2 s.co m * @param location * the location of the text relative to the buttons * @param resources * the {@link Resources} to use * @param showFastForwardButton * if true, show a fast-forward button that advances by a larger * increment than a single page * @param fastForwardRows * the number of rows to jump when fast forwarding * @param showLastPageButton * if true, show a button to go to the last page * @param showFirstPageButton * if true, show a button to go to the first page * @param imageButtonConstants * Constants that contain the image button names */ public SimplePager(TextLocation location, Resources resources, boolean showFastForwardButton, final int fastForwardRows, boolean showLastPageButton, boolean showFirstPageButton, ImageButtonsConstants imageButtonConstants) { this.resources = resources; this.fastForwardRows = fastForwardRows; this.style = resources.simplePagerStyle(); this.style.ensureInjected(); pageNumber = new TextBox(); pageNumber.setWidth("15px"); pageNumber.setHeight("15px"); pageNumber.setStyleName(style.gotoPageNumber()); pageNumber.addBlurHandler(new BlurHandler() { @Override public void onBlur(BlurEvent event) { Range range = getDisplay().getVisibleRange(); // Window.alert("" + range.getStart()); // Window.alert("" + range.getLength()); // Window.alert("" + Integer.parseInt(pageNumber.getValue())); int page = 0; try { page = Integer.parseInt(pageNumber.getValue()); setPageStart((range.getLength() * (page - 1) + 1)); } catch (NumberFormatException numberFormatException) { } } }); // Create the buttons. String disabledStyle = style.disabledButton(); if (showFirstPageButton) { firstPage = new ImageButton(resources.simplePagerFirstPage(), resources.simplePagerFirstPageDisabled(), disabledStyle, imageButtonConstants.firstPage()); firstPage.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { firstPage(); } }); } else { firstPage = null; } nextPage = new ImageButton(resources.simplePagerNextPage(), resources.simplePagerNextPageDisabled(), disabledStyle, imageButtonConstants.nextPage()); nextPage.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { nextPage(); } }); prevPage = new ImageButton(resources.simplePagerPreviousPage(), resources.simplePagerPreviousPageDisabled(), disabledStyle, imageButtonConstants.prevPage()); prevPage.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { previousPage(); } }); if (showLastPageButton) { lastPage = new ImageButton(resources.simplePagerLastPage(), resources.simplePagerLastPageDisabled(), disabledStyle, imageButtonConstants.lastPage()); lastPage.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { lastPage(); } }); } else { lastPage = null; } if (showFastForwardButton) { fastForward = new ImageButton(resources.simplePagerFastForward(), resources.simplePagerFastForwardDisabled(), disabledStyle, imageButtonConstants.fastForward()); fastForward.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { setPage(getPage() + getFastForwardPages()); } }); } else { fastForward = null; } // Construct the widget. HorizontalPanel layout = new HorizontalPanel(); layout.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); initWidget(layout); if (location == TextLocation.LEFT) { layout.add(pageNumber); layout.add(label); } if (showFirstPageButton) { layout.add(firstPage); } layout.add(prevPage); if (location == TextLocation.CENTER) { layout.add(pageNumber); layout.add(label); } layout.add(nextPage); if (showFastForwardButton) { layout.add(fastForward); } if (showLastPageButton) { layout.add(lastPage); } if (location == TextLocation.RIGHT) { layout.add(pageNumber); layout.add(label); } // Add style names to the cells. if (showFirstPageButton) { firstPage.getElement().getParentElement().addClassName(style.button()); } prevPage.getElement().getParentElement().addClassName(style.button()); label.getElement().getParentElement().addClassName(style.pageDetails()); nextPage.getElement().getParentElement().addClassName(style.button()); pageNumber.getElement().getParentElement().addClassName(style.gotoPageNumber()); if (showFastForwardButton) { fastForward.getElement().getParentElement().addClassName(style.button()); } if (showLastPageButton) { lastPage.getElement().getParentElement().addClassName(style.button()); } // Disable the buttons by default. setDisplay(null); }
From source file:com.cognitivemedicine.metricsdashboard.client.adminconsole.MetricsTab.java
License:Apache License
public MetricsTab(DashboardController dashController) { this.controller = dashController; // METRIC GROUPS allMetricGroupsListBox = new ListBox(); allMetricGroupsListBox.setWidth("200px"); // allMetricGroupsListBox.setWidth("30%"); allMetricGroupsListBox.setVisibleItemCount(15); allMetricGroupsListBox.addChangeHandler(new ChangeHandler() { @Override//from w ww . j a v a 2 s . co m public void onChange(ChangeEvent event) { String id = allMetricGroupsListBox.getValue(allMetricGroupsListBox.getSelectedIndex()); // controller.getMetricsGroups().get(id).getMetricList(); List<Metric> metrics = controller.getMetricsInGroup(id); assignedMetricsListBox.clear(); for (Metric m : metrics) { if (m != null) { System.err.println("Name: " + m.getName() + " ID: " + m.getName()); assignedMetricsListBox.addItem(m.getName(), m.get_id()); } } } }); Collection<MetricGroup> allMetricGroups = controller.getMetricsGroups().values(); for (MetricGroup g : allMetricGroups) { allMetricGroupsListBox.addItem(g.getName(), g.get_id()); } // METRICS allMetricsListBox = new ListBox(true); allMetricsListBox.setWidth("200px"); // allMetricsListBox.setWidth("30%"); allMetricsListBox.setVisibleItemCount(15); Collection<Metric> allMetrics = controller.getAvailableMetrics().values(); for (Metric m : allMetrics) { allMetricsListBox.addItem(m.getName(), m.get_id()); } // ASSIGNED assignedMetricsListBox = new ListBox(true); assignedMetricsListBox.setWidth("200px"); // assignedMetricsListBox.setWidth("30%"); assignedMetricsListBox.setVisibleItemCount(15); VerticalPanel buttonPanel = new VerticalPanel(); buttonPanel.setSpacing(2); Image image = new Image(MdConstants.IMG_LEFT_ARROW); image.setSize("24px", "24px"); PushButton addButton = new PushButton(image); addButton.getElement().setId("addDefinitionButton"); addButton.setSize("24px", "24px"); addButton.setTitle("Add"); // addButton = new Button("<-- Add"); addButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { addButtonClicked(); } }); image = new Image(MdConstants.IMG_RIGHT_ARROW); image.setSize("24px", "24px"); PushButton removeButton = new PushButton(image); removeButton.getElement().setId("removeDefinitionButton"); removeButton.setSize("24px", "24px"); removeButton.setTitle("Add"); // removeButton = new Button("Remove -->"); removeButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { removeButtonClicked(); } }); buttonPanel.add(addButton); buttonPanel.add(removeButton); // buttonPanel.setBorderWidth(2); // this.setBorderWidth(3); // this.setSpacing(2); this.setWidth("100%"); createGroupTextBox = new TextBox(); // createGroupTextBox.setWidth("*"); createGroupButton = new Button("Create Group"); createGroupButton.getElement().setId("createGroupButton"); createGroupButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (!(createGroupTextBox.getValue().equals(""))) { MetricGroup group = new MetricGroup(); group.setName(createGroupTextBox.getValue()); group.setDescription(""); group.setMetricList(new ArrayList<String>()); controller.createMetricGroup(group); } else { Window.alert("You must enter a name to create a group"); } } }); VerticalPanel allMetricsPanel = createLabeledList("Metrics Groups", allMetricGroupsListBox); HorizontalPanel createPanel = new HorizontalPanel(); createPanel.add(createGroupTextBox); createPanel.add(createGroupButton); allMetricsPanel.add(createPanel); this.add(allMetricsPanel); // this.add(createLabeledList("Metrics Groups", allMetricGroupsListBox)); this.add(createLabeledList("Assigned Metrics", assignedMetricsListBox)); this.add(buttonPanel); this.add(createLabeledList("All Metrics", allMetricsListBox)); setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_CENTER); setCellVerticalAlignment(buttonPanel, HasVerticalAlignment.ALIGN_MIDDLE); }
From source file:com.cognitivemedicine.metricsdashboard.client.charts.ChartEditorPanel.java
License:Apache License
public ChartEditorPanel(ChartWidget parent, DashboardController dashboardController, DashboardSettings dashboardSettings, ChartSettings chartSettings) { this.parentWidget = parent; this.controller = dashboardController; String parentId = parent.getElement().getId(); titleBox = new TextBox(); titleBox.getElement().setId(parentId + "chartTitleBox"); periodList = new ListBox(); periodList.setVisibleItemCount(1);//from w w w . j a va 2 s . com periodList.getElement().setId(parentId + "periodList"); for (Period p : Period.values()) { periodList.addItem(p.getDisplayValue(), p.getSymbol()); } datetimePicker = new CalendarPicker(parentId, true); granularityList = new ListBox(); granularityList.setVisibleItemCount(1); granularityList.getElement().setId(parentId + "granularityList"); granularityList.addItem("", ""); for (Granularity g : Granularity.values()) { granularityList.addItem(g.getDisplayValue(), g.getSymbol()); } metricGroupList = new ListBox(); metricGroupList.setVisibleItemCount(1); metricGroupList.getElement().setId(parentId + "groupList"); // for (MetricGroup g : controller.getMetricsGroups().values()) { // metricGroupList.addItem(g.getName(), g.getName()); // } metricGroupList.addItem(ALL_METRICS); for (String g : controller.getMetaGroupMap().keySet()) { metricGroupList.addItem(g, g); } metricGroupList.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { metricGroupListChanged(); } }); availableMetricsList = new MultiSelectListBox(); availableMetricsList.setVisibleItemCount(6); availableMetricsList.getElement().setId(parentId + "availableMetricsList"); // for (Metric m : controller.getAvailableMetrics().values()) { // availableMetricsList.addItem(m.getName(), m.getName()); // } for (MetaDefinition m : controller.getMetaDefinitions()) { availableMetricsList.addItem(m.toString(), m.toString()); } chartTypeList = new ListBox(); chartTypeList.setVisibleItemCount(1); chartTypeList.getElement().setId(parentId + "chartTypeList"); for (ChartType c : ChartType.values()) { chartTypeList.addItem(c.name()); } liveUpdatesCheckBox = new CheckBox("Live Updates"); liveUpdatesCheckBox.getElement().setId(parentId + "liveUpdatesCheckBox"); if (chartSettings != null) { loadChartSettings(chartSettings); } dashboardSettingsUpdated(dashboardSettings); mainPanel = new VerticalPanel(); mainPanel.setSpacing(4); mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); // this.add(createFormPanel("Title", titleBox)); HorizontalPanel titlePanel = new HorizontalPanel(); HTML titleLabel = new HTML("Title" + ": "); titleLabel.setWidth("115px"); titleBox.setWidth("265px"); titlePanel.add(titleLabel); titlePanel.add(titleBox); titlePanel.setCellHorizontalAlignment(titleLabel, HasHorizontalAlignment.ALIGN_RIGHT); mainPanel.add(titlePanel); mainPanel.add(new HTML("<hr>")); mainPanel.add(createFormPanel("Metric", metricGroupList)); mainPanel.add(createFormPanel("Supported Queries", availableMetricsList)); // mainPanel.add(createFormPanel("Chart Type", chartTypeList)); mainPanel.add(new HTML("<hr>")); mainPanel.add(createFormPanel("Period", periodList)); mainPanel.add(datetimePicker); mainPanel.add(new HTML("<hr>")); mainPanel.add(createFormPanel("Granularity", granularityList)); // mainPanel.add(new HTML("<hr>")); HorizontalPanel updatePanel = new HorizontalPanel(); HTML updateLabel = new HTML("Live Updates: "); updateLabel.setWidth("115px"); // titleBox.setWidth("190px"); // updatePanel.add(updateLabel); updatePanel.add(liveUpdatesCheckBox); updatePanel.setCellHorizontalAlignment(updateLabel, HasHorizontalAlignment.ALIGN_RIGHT); // mainPanel.add(updatePanel); this.setHeight("100%"); this.setWidth("100%"); this.add(mainPanel); this.setCellHorizontalAlignment(mainPanel, HasHorizontalAlignment.ALIGN_CENTER); this.setCellVerticalAlignment(mainPanel, HasVerticalAlignment.ALIGN_MIDDLE); // this.add(new HTML(, liveUpdatesCheckBox)); // this.add(buttonPanel); // this.setCellHorizontalAlignment(buttonPanel,HasHorizontalAlignment.ALIGN_CENTER); }
From source file:com.cognitivemedicine.metricsdashboard.client.charts.ChartWidget.java
License:Apache License
public ChartWidget(DashboardController dashboardController, DashboardSettings dashboardSettings, ChartSettings chartSettings) {//from w w w . java 2 s . c o m this.controller = dashboardController; String id = "chartWidget" + widgetId++; this.getElement().setId(id); tabPanel = new TabLayoutPanel(28, Unit.PX); tabPanel.setAnimationDuration(100); // tabPanel.getElement().getStyle().setMarginBottom(10.0, Unit.PX); // tabPanel.ensureDebugId("cwTabPanel"); this.setText("New Chart"); HorizontalPanel buttonPanel = new HorizontalPanel(); buttonPanel.setSpacing(4); Image image = new Image(MdConstants.IMG_OK_CHECK); image.getElement().setId(id + "OkButtonImage"); image.setSize("24px", "24px"); PushButton okButton = new PushButton(image); okButton.getElement().setId(this.getElement().getId() + "OkButton"); okButton.setTitle("Build Chart"); okButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { clickOkButton(); } }); image = new Image(MdConstants.IMG_CANCEL_X); image.setSize("24px", "24px"); image.getElement().setId(id + "CloseButtonImage"); PushButton closeButton = new PushButton(image); closeButton.getElement().setId(this.getElement().getId() + "CloseButton"); closeButton.setTitle("Cancel"); closeButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { controller.getWidgetController().removeWidget(ChartWidget.this); } }); buttonPanel.add(okButton); buttonPanel.add(closeButton); // HTML metricGroupText = new HTML("EDIT"); chartEditorPanel = new ChartEditorPanel(this, controller, dashboardSettings, chartSettings); // When there is a value for chart settings, it means it was loaded form the server. // Click Ok button programatically to load chart if (chartSettings != null) { clickOkButton(); setText(chartSettings.getTitle()); } Image editImage = new Image(MdConstants.IMG_PENCIL); editImage.getElement().setId("editTabImage"); editImage.setSize("16px", "16px"); editImage.getElement().setId("editImage"); tabPanel.add(chartEditorPanel, editImage); // HTML rolesText = new HTML("VIEW"); Image viewImage = new Image(MdConstants.IMG_VIEW_EYE); viewImage.getElement().setId("viewTabImage"); viewImage.setSize("16px", "16px"); // chartViewerPanel = new ChartViewerPanel(id); chartContainer = new VerticalPanel(); // Initialize this to an empty panel chartViewPanel = new EmptyChartPanel(); // chartViewPanel.setBorderWidth(2); chartViewPanel.setSpacing(2); chartViewPanel.setWidth("100%"); // chartContainer.setBorderWidth(2); chartContainer.setSpacing(2); chartContainer.setWidth("100%"); chartContainer.setHeight("100%"); chartContainer.add(chartViewPanel); tabPanel.add(chartContainer, viewImage); // Return the content tabPanel.selectTab(0); tabPanel.getElement().setId(id + "TabPanel"); tabPanel.setHeight("455px"); tabPanel.setWidth("505px"); this.setHeight("530"); this.setWidth("500px"); VerticalPanel mainPanel = new VerticalPanel(); mainPanel.add(tabPanel); mainPanel.add(buttonPanel); mainPanel.setCellVerticalAlignment(buttonPanel, HasVerticalAlignment.ALIGN_MIDDLE); mainPanel.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_CENTER); mainPanel.setWidth("100%"); mainPanel.setHeight("100%"); this.setWidget(mainPanel); this.setModal(false); }
From source file:com.cognitivemedicine.metricsdashboard.client.dashboard.DashboardMainPanel.java
License:Apache License
private void initUi() { mainPanel = new VerticalPanel(); mainPanel.setWidth("300px"); mainPanel.setSpacing(4);/*from ww w . j a v a 2 s . co m*/ VerticalPanel titlePanel = new VerticalPanel(); titlePanel.setWidth("100%"); HorizontalPanel logoutPanel = new HorizontalPanel(); Image logoutImage = new Image(MdConstants.IMG_LOGOUT); logoutImage.getElement().getStyle().setCursor(Cursor.POINTER); logoutImage.setSize("16px", "16px"); logoutImage.setTitle("Log Out"); logoutImage.getElement().getStyle().setProperty("cursor", "hand"); logoutImage.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { controller.logOut(); } }); HTML logOutLabel = new HTML("<u><font size=-2>Log Out </font></u>"); logOutLabel.setHeight("10px"); // logOutLabel.setStyleName("logoutButton"); logOutLabel.setStylePrimaryName("logoutButton"); logOutLabel.getElement().getStyle().setProperty("right", "5px"); // logOutLabel.getElement().getStyle().setProperty("cursor", "hand"); logOutLabel.getElement().getStyle().setCursor(Cursor.POINTER); logOutLabel.setWidth("100%"); logOutLabel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { controller.logOut(); } }); logoutPanel.add(logOutLabel); logoutPanel.add(logoutImage); logoutPanel.setSpacing(2); logoutPanel.setCellHorizontalAlignment(logoutImage, HasHorizontalAlignment.ALIGN_RIGHT); logoutPanel.setCellHorizontalAlignment(logOutLabel, HasHorizontalAlignment.ALIGN_RIGHT); titlePanel.getElement().getStyle().setProperty("marginLeft", "50"); titleLabel = new HTML("<font size=4> </font>"); titleLabel.getElement().setId("dashboardTitleLabel"); titlePanel.add(logoutPanel); titlePanel.add(titleLabel); titlePanel.setCellHorizontalAlignment(logoutPanel, HasHorizontalAlignment.ALIGN_RIGHT); DecoratorPanel titleDecor = new DecoratorPanel(); titleDecor.setWidth("250px"); titleDecor.setHeight("30px"); mainPanel.add(titlePanel); mainPanel.setCellVerticalAlignment(logOutLabel, HasVerticalAlignment.ALIGN_MIDDLE); mainPanel.setCellHorizontalAlignment(logOutLabel, HasHorizontalAlignment.ALIGN_RIGHT); mainPanel.setCellHorizontalAlignment(titleLabel, HasHorizontalAlignment.ALIGN_LEFT); mainPanel.setCellVerticalAlignment(titleLabel, HasVerticalAlignment.ALIGN_MIDDLE); Image image = new Image(MdConstants.IMG_TOOLS); image.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE); adminConsoleButton = new PushButton(image); adminConsoleButton.getElement().setId("adminConsoleButton"); adminConsoleButton.setSize("50px", MdConstants.IMG_SIZE); adminConsoleButton.setTitle("Show Admin Console"); adminConsoleButton.setEnabled(false); adminConsoleButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { AdminConsole console = new AdminConsole(controller); } }); editorDecorator = new DecoratorPanel(); editorDecorator.setTitle("Dashboard Editor"); editorDecorator.setWidth("315px"); toolstripPanel = new DashboardToolStripBar(this); dashboardListBox = new ListBox(false); dashboardListBox.getElement().setId("dashboardListBox"); dashboardListBox.setWidth("295px"); dashboardListBox.setVisibleItemCount(10); dashboardListBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { dashboardListChanged(); } }); notesArea = new TextArea(); notesArea.setVisibleLines(2); notesArea.setWidth("290px"); notesArea.setHeight("50px"); notesArea.getElement().setId("notesTextArea"); VerticalPanel editorVerticalPanel = new VerticalPanel(); editorVerticalPanel.setSpacing(4); editorVerticalPanel.add(toolstripPanel); editorVerticalPanel.add(dashboardListBox); editorVerticalPanel.add(new HTML("<font size=-1><b>Dashboard Notes:</b></font></br>")); editorVerticalPanel.add(notesArea); editorVerticalPanel.setCellVerticalAlignment(toolstripPanel, HasVerticalAlignment.ALIGN_MIDDLE); editorVerticalPanel.setCellHorizontalAlignment(toolstripPanel, HasHorizontalAlignment.ALIGN_CENTER); editorDecorator.setWidget(editorVerticalPanel); settingsPanel = new DashboardSettingsPanel(this); mainPanel.add(editorDecorator); mainPanel.add(settingsPanel); // mainPanel.add(adminConsoleButton); mainPanel.setCellVerticalAlignment(editorDecorator, HasVerticalAlignment.ALIGN_MIDDLE); mainPanel.setCellHorizontalAlignment(editorDecorator, HasHorizontalAlignment.ALIGN_CENTER); mainPanel.setCellVerticalAlignment(settingsPanel, HasVerticalAlignment.ALIGN_TOP); mainPanel.setCellHorizontalAlignment(settingsPanel, HasHorizontalAlignment.ALIGN_CENTER); mainPanel.setCellVerticalAlignment(adminConsoleButton, HasVerticalAlignment.ALIGN_MIDDLE); mainPanel.setCellHorizontalAlignment(adminConsoleButton, HasHorizontalAlignment.ALIGN_CENTER); this.add(mainPanel); }
From source file:com.cognitivemedicine.metricsdashboard.client.dialogs.AuthenticationDialog.java
License:Apache License
public AuthenticationDialog(Md_sandbox application, List<Site> siteList) { this.application = application; mainPanel = new HorizontalPanel(); mainPanel.getElement().getStyle().setProperty("backgroundColor", "#477E7E"); warningPanel = new VerticalPanel(); warningPanel.setWidth("450px"); // warningPanel.setWidth("100%"); warningPanel.setHeight("100%"); warningPanel.setSpacing(20);// w w w. ja va 2 s.c om warningPanel.getElement().getStyle().setProperty("backgroundColor", "#477E7E"); loginPanel = new VerticalPanel(); loginPanel.setWidth("450px"); // loginPanel.setWidth("100%"); loginPanel.setSpacing(4); loginPanel.getElement().getStyle().setProperty("backgroundColor", "#FFFFFF"); warningMessage = new HTML(warningMessageText); warningMessage.getElement().getStyle().setProperty("color", "white"); warningMessage.getElement().getStyle().setProperty("fontSize", "10px"); warningMessage.setWordWrap(true); warningMessage.setHeight("100%"); // warningMessage.setWidth("100%"); titleLabel = new HTML("<h2>CDS METRICS DASHBOARD</h2>"); vaLogo = new Image(MdConstants.IMG_VA_LOGO); vaLogo.setPixelSize(160, 160); vaLogo.getElement().getStyle().setProperty("marginTop", "20px"); facilityListBox = new ListBox(); facilityListBox.setVisibleItemCount(1); facilityListBox.getElement().setId("facilityListBox"); for (Site s : siteList) { facilityListBox.addItem(s.getName(), s.getSiteCode()); } // facilityListBox.setWidth("100%"); accessCode = new PasswordTextBox(); accessCode.getElement().setId("accessCode"); accessCode.setMaxLength(80); // accessCode.setWidth("100%"); verifyCode = new PasswordTextBox(); verifyCode.getElement().setId("verifyCode"); verifyCode.setMaxLength(80); // verifyCode.setWidth("100%"); signInButton = new Button("Sign In"); signInButton.getElement().getStyle().setProperty("background", "#477E7E"); signInButton.getElement().getStyle().setProperty("color", "white"); signInButton.getElement().getStyle().setProperty("fontSize", "10px"); signInButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { signInButtonClicked(); } }); warningPanel.add(warningMessage); warningPanel.setCellVerticalAlignment(warningMessage, HasVerticalAlignment.ALIGN_MIDDLE); loginPanel.add(vaLogo); loginPanel.add(titleLabel); loginPanel.add(createFormPanel("Select a Facility", facilityListBox)); loginPanel.add(createFormPanel("Access Code", accessCode)); loginPanel.add(createFormPanel("Vefify Code", verifyCode)); loginPanel.add(signInButton); loginPanel.setCellHorizontalAlignment(vaLogo, HasHorizontalAlignment.ALIGN_CENTER); loginPanel.setCellHorizontalAlignment(titleLabel, HasHorizontalAlignment.ALIGN_CENTER); loginPanel.setCellHorizontalAlignment(facilityListBox, HasHorizontalAlignment.ALIGN_CENTER); loginPanel.setCellHorizontalAlignment(accessCode, HasHorizontalAlignment.ALIGN_CENTER); loginPanel.setCellHorizontalAlignment(verifyCode, HasHorizontalAlignment.ALIGN_CENTER); loginPanel.setCellHorizontalAlignment(signInButton, HasHorizontalAlignment.ALIGN_RIGHT); mainPanel.add(warningPanel); mainPanel.add(loginPanel); mainPanel.setCellVerticalAlignment(warningPanel, HasVerticalAlignment.ALIGN_MIDDLE); this.setTitle("CDS DASHBOARD LOGIN"); this.setWidget(mainPanel); this.setModal(true); this.setGlassEnabled(true); this.removeStyleName("gwt-DialogBox"); }
From source file:com.cognitivemedicine.metricsdashboard.client.dialogs.CreateDashboardDialog.java
License:Apache License
private void init() { this.setWidth("375px"); this.setText("Create New Dashboard"); VerticalPanel dialogVPanel = new VerticalPanel(); dialogVPanel.add(new HTML("<b>Name:</b>")); nameBox = new TextBox(); nameBox.getElement().setId("createDashboardNameTextBox"); nameBox.setWidth("290px"); nameBox.addKeyUpHandler(new KeyUpHandler() { @Override//from w w w .ja v a 2 s. co m public void onKeyUp(KeyUpEvent event) { createButton.setEnabled(nameBox.getValue().length() > 0); } }); notesArea = new TextArea(); notesArea.setWidth("290px"); notesArea.getElement().setId("createDashboardNotesArea"); dialogVPanel.add(nameBox); dialogVPanel.add(new HTML("<br><b>Dashboard Notes:</b>")); dialogVPanel.add(notesArea); dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT); // // Add a close button at the bottom of the dialog Image image = new Image(MdConstants.IMG_OK_CHECK); image.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE); createButton = new PushButton(image); createButton.setEnabled(false); createButton.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE); createButton.getElement().setId("createDashboardOkButton"); createButton.setTitle("Create new dashboard"); createButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { createButtonClicked(); } }); image = new Image(MdConstants.IMG_CANCEL_X); image.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE); cancelButton = new PushButton(image); cancelButton.getElement().setId("createDashboardCancelButton"); cancelButton.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE); cancelButton.setTitle("Cancel"); cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { CreateDashboardDialog.this.hide(); } }); HorizontalPanel dialogButtonPanel = new HorizontalPanel(); dialogButtonPanel.setSpacing(8); dialogButtonPanel.add(createButton); dialogButtonPanel.add(cancelButton); dialogVPanel.add(dialogButtonPanel); dialogVPanel.setSpacing(4); dialogVPanel.setCellHorizontalAlignment(dialogButtonPanel, HasHorizontalAlignment.ALIGN_CENTER); dialogVPanel.setCellVerticalAlignment(dialogButtonPanel, HasVerticalAlignment.ALIGN_MIDDLE); this.setWidget(dialogVPanel); this.setGlassEnabled(true); this.setModal(true); this.center(); nameBox.setFocus(true); }
From source file:com.dawg6.gwt.client.ApplicationPanel.java
License:Open Source License
public static DialogBox showDialogBox(String title, IsWidget component, int buttons, final DialogBoxResultHandler handler) { // Create the popup dialog box final DialogBox dialogBox = createDialogBox(); dialogBox.setText(title);/*www .ja v a 2 s .co m*/ dialogBox.setAnimationEnabled(true); dialogBox.setModal(false); FlexTable table = new FlexTable(); table.setWidget(0, 0, component); dialogBox.setWidget(table); HorizontalPanel row = new HorizontalPanel(); row.setSpacing(5); row.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); row.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); table.setWidget(1, 0, row); boolean firstButton = true; if (buttons == 0) buttons = OK; for (final ButtonInfo b : allButtons) { if ((buttons > 0) && ((buttons & b.id) != 0)) { final Button button = createDialogBoxButton(b.label); button.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { dialogBox.hide(); if (handler != null) handler.dialogBoxResult(b.id); } }); row.add(button); if (firstButton) { button.setFocus(true); firstButton = false; } } } dialogBox.center(); return dialogBox; }