List of usage examples for com.google.gwt.user.client.ui HorizontalPanel HorizontalPanel
public HorizontalPanel()
From source file:com.chinarewards.gwt.license.client.core.ui.impl.SimpleSiteManager.java
public void openEditor(final Editor e) { // store which tab is which instanceId openedEditors.add(e);//from w w w. ja v a 2 s. c o m HorizontalPanel panel = new HorizontalPanel(); Label close = new Label(" "); close.setStyleName("close"); close.addClickHandler(new ClickHandler() { public void onClick(ClickEvent paramClickEvent) { Platform.getInstance().getEditorRegistry().closeEditor(e.getEditorId(), e.getInstanceId()); } }); Label title = new Label(e.getTitle()); title.setStyleName("tabTitle"); Label leftImg = new Label(""); leftImg.setStyleName("leftImg"); Label rightImg = new Label(""); rightImg.setStyleName("rightImg"); panel.add(leftImg); panel.add(title); panel.add(close); panel.add(rightImg); panel.setCellHorizontalAlignment(leftImg, HorizontalPanel.ALIGN_RIGHT); panel.setCellHorizontalAlignment(title, HorizontalPanel.ALIGN_RIGHT); panel.setCellHorizontalAlignment(close, HorizontalPanel.ALIGN_LEFT); panel.setCellHorizontalAlignment(rightImg, HorizontalPanel.ALIGN_RIGHT); ScrollPanel sp = new ScrollPanel(e.asWidget()); editor.add(sp); // editor.add(e.asWidget(), g); // show editor panels only if there is at least one editor opened. if (!openedEditors.isEmpty()) { editor.setVisible(true); } }
From source file:com.chinarewards.gwt.license.client.ui.DialogBox.java
/** * Creates an empty dialog box specifying its "auto-hide" property. It * should not be shown until its child widget has been added using * {@link #add(Widget)}./* ww w .j a v a 2s.c o m*/ * * @param autoHide * <code>true</code> if the dialog should be automatically hidden * when the user clicks outside of it * @param modal * <code>true</code> if keyboard and mouse events for widgets not * contained by the dialog should be ignored */ public DialogBox(boolean autoHide, boolean modal) { super(autoHide, modal); // Add the caption to the top row of the decorator panel. We need to // logically adopt the caption so we can catch mouse events. Element td = getCellElement(0, 1); HorizontalPanel panel = new HorizontalPanel(); /** * About the icon to close the window. */ // <div class="close-wrap"><span class="box-title-sep"></span><span class="box-close" onclick="this.parentNode.parentNode.parentNode.style.display='none'"></span></div> cross = new Span(); cross.setStyleName("box-close"); CrossHandler crossHandler = new CrossHandler(); cross.addClickHandler(crossHandler); cross.addMouseDownHandler(crossHandler); cross.addMouseOverHandler(crossHandler); cross.addMouseOutHandler(crossHandler); // Label left = new Label(""); // left.setStyleName("left"); // Label right = new Label(""); // right.setStyleName("right"); // panel.add(left); panel.add(captionHtml); panel.add(cross); // panel.add(right); // panel.setCellWidth(left, "10px"); // panel.setCellHorizontalAlignment(left, HorizontalPanel.ALIGN_LEFT); panel.setCellHorizontalAlignment(captionHtml, HorizontalPanel.ALIGN_LEFT); panel.setCellHorizontalAlignment(cross, HorizontalPanel.ALIGN_RIGHT); // panel.setCellHorizontalAlignment(right, HorizontalPanel.ALIGN_RIGHT); panel.setWidth("100%"); caption.add(panel); DOM.appendChild(td, caption.getElement()); adopt(caption); caption.setStyleName("Caption"); // Set the style name setStyleName(DEFAULT_STYLENAME); windowWidth = Window.getClientWidth(); clientLeft = Document.get().getBodyOffsetLeft(); clientTop = Document.get().getBodyOffsetTop(); MouseHandler mouseHandler = new MouseHandler(); addDomHandler(mouseHandler, MouseDownEvent.getType()); addDomHandler(mouseHandler, MouseUpEvent.getType()); addDomHandler(mouseHandler, MouseMoveEvent.getType()); addDomHandler(mouseHandler, MouseOverEvent.getType()); addDomHandler(mouseHandler, MouseOutEvent.getType()); }
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();//from w ww. j a va 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 w w w . ja v a 2s. c o 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.codon.dev.client.wigets.SliderWithValBox.java
private void onInit() { HorizontalPanel panel = new HorizontalPanel(); slider = new SliderHorizontal(sliderMaxVal); if (sliderDefaultVal != null) slider.setValue(sliderDefaultVal); panel.add(slider);/*ww w .ja v a 2 s . c o m*/ textBox = new TextBox(); textBox.setStyleName("valueInput"); textBox.setValue(String.valueOf(SliderHorizontal.MINVAL)); panel.add(textBox); initHandlers(); initWidget(panel); }
From source file:com.cognitivemedicine.metricsdashboard.client.adminconsole.AdminConsole.java
License:Apache License
public AdminConsole(DashboardController controller) { this.controller = controller; tabPanel = new TabLayoutPanel(2.5, Unit.EM); tabPanel.setAnimationDuration(200);//from w ww . j a v a 2s. co m // tabPanel.getElement().getStyle().setMarginBottom(10.0, Unit.PX); HTML metricGroupText = new HTML("METRIC GROUPS"); tabPanel.add(new MetricsTab(controller), metricGroupText); HTML rolesText = new HTML("ROLES"); tabPanel.add(new RolesTab(controller), rolesText); // Add a tab HTML moreInfo = new HTML("CHARTS"); tabPanel.add(new ChartsTab(controller), moreInfo); // Return the content tabPanel.selectTab(0); // tabPanel.ensureDebugId("cwTabPanel"); HorizontalPanel buttonPanel = new HorizontalPanel(); // buttonPanel.setWidth("20%"); buttonPanel.setSpacing(4); Image image = new Image(MdConstants.IMG_OK_CHECK); image.setSize("24px", "24px"); PushButton saveButton = new PushButton(image); saveButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { AdminConsole.this.hide(); } }); image = new Image(MdConstants.IMG_CANCEL_X); image.setSize("24px", "24px"); PushButton closeButton = new PushButton(image); closeButton.setTitle("Cancel"); closeButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { AdminConsole.this.hide(); } }); buttonPanel.add(saveButton); buttonPanel.add(closeButton); VerticalPanel mainPanel = new VerticalPanel(); // mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); mainPanel.add(tabPanel); mainPanel.add(buttonPanel); mainPanel.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_CENTER); tabPanel.setHeight("400px"); tabPanel.setWidth("700px"); this.setHeight("400px"); this.setWidth("550px"); this.setText("Admin Console"); this.setWidget(mainPanel); this.setModal(true); this.setGlassEnabled(true); this.center(); }
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 w w .j ava 2s. 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 www . j av a 2 s . c o m*/ 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.ChartEditorPanel.java
License:Apache License
private HorizontalPanel createFormPanel(String fieldName, ListBox list) { HorizontalPanel panel = new HorizontalPanel(); HTML nameLabel = new HTML(fieldName + ": "); nameLabel.setWidth("115px"); list.setWidth("275px"); // panel.setCellHorizontalAlignment(nameLabel, HasHorizontalAlignment.ALIGN_RIGHT); // this.setCellVerticalAlignment(checkBox, HasVerticalAlignment.ALIGN_MIDDLE); panel.add(nameLabel);/*from w ww.j a v a 2 s .c o m*/ panel.add(list); panel.setCellHorizontalAlignment(nameLabel, HasHorizontalAlignment.ALIGN_RIGHT); return panel; }
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 .jav a 2 s.co 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); }