List of usage examples for com.google.gwt.user.client.ui Label setText
public void setText(String text)
From source file:edu.caltech.ipac.firefly.core.HtmlRegionLoader.java
private void updateFooter(String htmlStr, String regionName) { FlowPanel view = new FlowPanel(); GwtUtil.setStyle(view, "align", "center"); final Label versionLabel = new Label(); versionLabel.setHorizontalAlignment(Label.ALIGN_RIGHT); GwtUtil.setStyle(versionLabel, "fontSize", "6pt"); HTML html = new HTML(htmlStr); // html.setSize("100%", "100%"); view.add(html);// w ww . j a v a 2s.com view.add(versionLabel); view.setSize("100%", "100%"); Region region = Application.getInstance().getLayoutManager().getRegion(regionName); if (region != null) region.setDisplay(view); Application.getInstance().findVersion(new AsyncCallback<Version>() { public void onFailure(Throwable caught) { } public void onSuccess(Version v) { versionLabel.setText(v.toString()); } }); }
From source file:edu.caltech.ipac.firefly.ui.catalog.SearchMethods.java
protected static void computeRangesLabel(InputField field, Label rangesLabel) { DegreeFieldDef df = (DegreeFieldDef) field.getFieldDef(); DegreeFieldDef.Units currentUnits = df.getUnits(); String unitDesc = DegreeFieldDef.getUnitDesc(currentUnits); double min = df.getMinValue().doubleValue(); double max = df.getMaxValue().doubleValue(); // WebAssert.tst(minDeg!=maxDeg, "problem in computing ranges: minDeg="+ // minDeg+" maxDeg= " + maxDeg); if (max > min) { // double min= DegreeFieldDef.convert(DegreeFieldDef.Units.DEGREE, // currentUnits, minDeg); // double max= DegreeFieldDef.convert(DegreeFieldDef.Units.DEGREE, // currentUnits, maxDeg); rangesLabel.setText(RANGES_STR + " " + df.format(min) + unitDesc + " and " + df.format(max) + unitDesc); }// w w w. j ava2 s . c om }
From source file:edu.caltech.ipac.firefly.ui.searchui.SpacialBehaviorPanel.java
protected static void computeRangesLabel(InputField field, Label rangesLabel) { DegreeFieldDef df = (DegreeFieldDef) field.getFieldDef(); DegreeFieldDef.Units currentUnits = df.getUnits(); String unitDesc = DegreeFieldDef.getUnitDesc(currentUnits); double min = df.getMinValue().doubleValue(); double max = df.getMaxValue().doubleValue(); if (max > min) { rangesLabel.setText(RANGES_STR + " " + df.format(min) + unitDesc + " and " + df.format(max) + unitDesc); }/*w w w . j a v a 2 s . c o m*/ }
From source file:edu.caltech.ipac.firefly.visualize.ui.MaskAddDialog.java
private Widget colorLabel(int idx, int bitNumber) { Label colorFeedback = new Label(); ClickHandler colorChange = new ColorChange(colorFeedback, bitNumber + "", bitColorArray, idx); colorFeedback.setText(" "); colorFeedback.addClickHandler(colorChange); Widget link = GwtUtil.makeLinkButton(_prop.makeBase("color"), colorChange); colorFeedback.setSize("10px", "10px"); return colorFeedback; }
From source file:edu.caltech.ipac.firefly.visualize.ui.WebLayerControlPopup.java
private Widget makeChangeColorLink(Label colorFeedback, WebLayerItem item) { ClickHandler colorChange = new ColorChange(colorFeedback, item); colorFeedback.setText(" "); colorFeedback.addClickHandler(colorChange); Widget link = GwtUtil.makeLinkButton(_prop.makeBase("color"), colorChange); colorFeedback.setSize("10px", "10px"); return link;/*from w w w.j a v a2s.co m*/ }
From source file:edu.caltech.ipac.firefly.visualize.WebMouseReadout.java
public void setValue(int row, String labelText, String valueText, String valueStyle, boolean valueIsHtml, boolean setOnlyIfActive) { int rowMin = 1; final int rowFinal = row; if (wide) {//w w w . j av a 2s. c o m row--; rowMin = 0; } int labelIdx = 0; int valueIdx = labelIdx + 1; int gridRowCount = _grid.getRowCount() + (wide ? gridWide.getRowCount() : 0); if (gridRowCount > row) { Grid workingGrid = _grid; int workingRow = row; if (wide && row >= WIDE_MAX_ROWS) { workingGrid = gridWide; workingRow = row - WIDE_MAX_ROWS; if ((gridRowCount - WIDE_MAX_ROWS) < (WIDE_MAX_ROWS)) workingRow++; } Label label = (Label) workingGrid.getWidget(workingRow, labelIdx); Label value = (Label) workingGrid.getWidget(workingRow, valueIdx); if (workingRow >= rowMin && label == null) { label = new Label(labelText); label.addStyleName("readout-label"); workingGrid.setWidget(workingRow, labelIdx, label); List<Integer> rowWithOps = incrementAll(_currentHandler.getRowsWithOptions()); if (rowWithOps != null && rowWithOps.contains(row)) { GwtUtil.makeIntoLinkButton(label); label.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { showRowOps(rowFinal); } }); } } if (value == null) { value = new Label(valueText); value.addStyleName("readout-value"); workingGrid.setWidget(workingRow, valueIdx, value); } label.setText(labelText); if (valueIsHtml) { DOM.setInnerHTML(value.getElement(), valueText); } else { value.setText(valueText); } String oldStyle = _styleMap.get(value); if (oldStyle != null) value.removeStyleName(oldStyle); if (valueStyle != null) { value.addStyleName(valueStyle); _styleMap.put(value, valueStyle); } } }
From source file:edu.caltech.ipac.firefly.visualize.WebMouseReadoutPerm.java
public void setValue(int row, String labelText, String valueText, String valueStyle, boolean valueIsHtml, boolean setOnlyIfActive) { if (_currentPlot == null) return;// w w w.j ava2s .c o m if (!active && setOnlyIfActive) return; final int rowFinal = row; row--; if (row > -1 && row < totalRows) { LineRef line = getLine(row); Label label = (Label) line.grid.getWidget(line.row, LABEL_IDX); if (label == null) { label = new Label(labelText); label.addStyleName("perm-readout-label"); line.grid.setWidget(line.row, LABEL_IDX, label); List rowWithOps = getRowsWithOptions(); if (rowWithOps != null && rowWithOps.contains(row)) { GwtUtil.makeIntoLinkButton(label); label.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { showRowOps(rowFinal); } }); } } label.setText(labelText); if (StringUtils.isEmpty(valueText)) valueText = " "; String style = line.leftMostGrid ? "perm-readout-value-first" : "perm-readout-value"; String sV = "<div class=\"" + style + "\">" + valueText + "</div>"; line.grid.setHTML(line.row, VALUE_IDX, sV); if (!_lockMouCheckBox.isVisible()) _lockMouCheckBox.setVisible(true); } }
From source file:edu.iastate.airl.semtus.client.SEMTUSWEBAPP.java
License:Open Source License
/** * This is the entry point method.//from w w w .j a v a 2 s . co m */ public void onModuleLoad() { MenuBar menu = (MenuBar) createMenu(); sendButton = new Button("Send"); inputField = new TextArea(); inputField.setText( "Input some text based on the uploaded ontology for analysis.\n\n [PS: Remember to upload an ontology model for your domain to get relevant results."); final Label errorLabel = new Label(); // We can add style names to widgets sendButton.addStyleName("sendButton"); inputField.setSize("590px", "200px"); // Create a table to layout the form options FlexTable layout = new FlexTable(); layout.setCellSpacing(6); FlexCellFormatter cellFormatter = layout.getFlexCellFormatter(); // Add a title to the form cellFormatter.setColSpan(0, 0, 3); cellFormatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); // Add some standard form options layout.setWidget(1, 1, inputField); layout.setWidget(2, 1, sendButton); DecoratorPanel panel = new DecoratorPanel(); // Add the nameField and sendButton to the RootPanel panel.add(layout); // Focus the cursor on the name field when the app loads inputField.setFocus(true); inputField.selectAll(); // Create the popup dialog box dialogBox = new DialogBox(); dialogBox.setText( "<p align=\"center\"><font color=\"#000000\" face=\"verdana\" size=\"2\">Visualize Complete RDF Graph</font></p>"); dialogBox.setAnimationEnabled(true); closeButton = new Button("Close"); // We can set the id of a widget by accessing its Element closeButton.getElement().setId("closeButton"); final Label textToServerLabel = new Label(); serverResponseLabel = new HTML(); dialogBoxLoadingBar = new DialogBox(); dialogBoxLoadingBar.setAnimationEnabled(true); final VerticalPanel dialogVPanelLoadingBar = new VerticalPanel(); dialogVPanelLoadingBar.setWidth("200"); dialogVPanelLoadingBar .add(new Label("---------------------------------- Processing --------------------------------")); dialogVPanelLoadingBar.add(new Image("http://sushain.com/profile/images/con-bar3.gif")); dialogBoxLoadingBar.setWidget(dialogVPanelLoadingBar); dialogVPanel = new VerticalPanel(); dialogVPanel.addStyleName("dialogVPanel"); // dialogVPanel.add(textToServerLabel); // dialogVPanel.add(new HTML("<br><b>Server replies:</b>")); dialogVPanel.add(serverResponseLabel); dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); dialogVPanel.add(closeButton); dialogBox.setWidget(dialogVPanel); announcementBox = new DialogBox(); announcementBox.setHTML( "<p align=\"center\"><font color=\"#000000\" face=\"verdana\" size=\"2\">SEMANTIXS Analysis Complexity Level Setting</font></p>"); announcementCloseButton = new Button("Close"); announcementDialogVPanel = new VerticalPanel(); announcementLabel = new HTML(); announcementDialogVPanel.addStyleName("announcementDialogVPanel"); announcementDialogVPanel.add(announcementLabel); announcementDialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); announcementDialogVPanel.add(announcementCloseButton); announcementBox.setWidget(announcementDialogVPanel); // Create a tab panel tabPanel = new DecoratedTabPanel(); tabPanel.setWidth("645px"); tabPanel.setHeight("100px"); tabPanel.setAnimationEnabled(true); // Add a home tab String[] tabTitles = new String[] { "Workspace View", "Input Ontology-based Text Here", "View Extracted Semantic Data" }; HTML homeText = new HTML("<p align=\"center\"><font color=\"#e0c190\" face=\"Times\" size=\"6\">" + "<b>SEMANTIXS</b></font>" + "<br/><font color=\"#e0c190\" face=\"Times\" size=\"3\">version 1.0.1</font><br/>" + "</p>"); tabPanel.add(homeText, tabTitles[0]); // Add a tab VerticalPanel vPanel = new VerticalPanel(); vPanel.add(panel); tabPanel.add(vPanel, tabTitles[1]); // Create a table to layout the form options FlexTable layout1 = new FlexTable(); layout1.setCellSpacing(6); FlexCellFormatter cellFormatter1 = layout1.getFlexCellFormatter(); // Add a title to the form cellFormatter1.setColSpan(0, 0, 3); cellFormatter1.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); resultField = new TextArea(); resultField.setText("Send some text for processing before trying to view the results in this tab."); resultField.setSize("590px", "225px"); // Add some standard form options layout1.setWidget(1, 1, resultField); DecoratorPanel panel1 = new DecoratorPanel(); // Add the nameField and sendButton to the RootPanel panel1.add(layout1); VerticalPanel vPanel1 = new VerticalPanel(); vPanel1.add(panel1); tabPanel.add(vPanel1, tabTitles[2]); tabPanel.selectTab(0); tabPanel.ensureDebugId("cwTabPanel"); panelHoldingTabPanel = new DecoratorPanel(); panelHoldingTabPanel.setHeight("450px"); panelHoldingTabPanel.setWidth("650px"); panelHoldingTabPanel.setWidget(tabPanel); panelHoldingTabPanel.setVisible(false); panelHoldingTabPanel.setStyleName("panelHoldingTabPanel"); RootPanel.get("nameFieldContainer").add(menu); RootPanel.get("sendButtonContainer").add(panelHoldingTabPanel); // RootPanel.get("errorLabelContainer").add(errorLabel); RootPanel.getBodyElement().setId("main"); FormPanel uploadForm = upload(); uploadBox = new DialogBox(); uploadBox.setText("Ontology Upload"); uploadBox.setAnimationEnabled(true); uploadBox.setWidget(uploadForm); uploadBox.hide(); // Set default analysis level for SEMANTIXS as 1 level = LEVEL_ONE; // Add a handler to close the DialogBox closeButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { dialogBox.hide(); tabPanel.selectTab(2); sendButton.setEnabled(true); sendButton.setFocus(false); } }); // Add a handler to close the AnnouncementBox announcementCloseButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { announcementBox.hide(); } }); // Create a handler for the sendButton and nameField class MyHandler implements ClickHandler, KeyUpHandler { /** * Fired when the user clicks on the sendButton. */ public void onClick(ClickEvent event) { sendTextToServer(); } /** * Fired when the user types in the nameField. */ public void onKeyUp(KeyUpEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { sendTextToServer(); } } /** * Send the name from the nameField to the server and wait for a * response. */ private void sendTextToServer() { // First, we validate the input. errorLabel.setText(""); String textToServer = inputField.getText(); if (!FieldVerifier.isValidName(textToServer)) { errorLabel.setText( "Please enter a long enough sentence for SEMANTIXS to be able to map it to the ontology definitions"); return; } dialogBoxLoadingBar.center(); // Then, we send the input to the server. sendButton.setEnabled(false); textToServerLabel.setText(textToServer); serverResponseLabel.setText(""); greetingService.handleInput(textToServer, level, new AsyncCallback<String>() { public void onFailure(Throwable caught) { // Show the RPC error message to the user dialogBoxLoadingBar.hide(); sendButton.setEnabled(false); dialogBox.setText("Remote Procedure Call - Failure"); serverResponseLabel.addStyleName("serverResponseLabelError"); serverResponseLabel.setHTML(SERVER_ERROR); dialogBox.center(); closeButton.setFocus(true); } public void onSuccess(String result) { dialogBoxLoadingBar.hide(); sendButton.setEnabled(false); dialogBox.setText("SEMANTIXS response:"); serverResponseLabel.removeStyleName("serverResponseLabelError"); serverResponseLabel.setHTML( "<b>SEMANTIXS has finished processing the text. Please view the extracted results under - \"View Extracted Semantic Data\" tab.</b>"); resultField.setText(result); dialogBox.center(); closeButton.setFocus(true); } }); } } // Add a handler to send the name to the server MyHandler handler = new MyHandler(); sendButton.addClickHandler(handler); inputField.addKeyUpHandler(handler); }
From source file:edu.nrao.dss.client.util.dssgwtcal.DayViewHeader.java
License:Open Source License
public void setDays(Date date, int days) { dayPanel.clear();//from ww w . j av a2 s . c o m float dayWidth = 100f / days; float dayLeft = 0f; for (int i = 0; i < days; i++) { // increment the date by 1 if (i > 0) date.setDate(date.getDate() + 1); // set the left position of the day splitter to // the width * incremented value dayLeft = dayWidth * i; String headerTitle = DAY_LIST[date.getDay()] + ", " + MONTH_LIST[date.getMonth()] + " " + date.getDate(); if (tu.isDSTBoundary(date)) { // warn users that this Daylight Savings Time starts or ends on this day. headerTitle += " (DST)"; } Label dayLabel = new Label(); //dayLabel.setStylePrimaryName("day-cell"); dayLabel.setWidth(dayWidth + "%"); dayLabel.setText(headerTitle); // Question: why are we using the DOM here? DOM.setStyleAttribute(dayLabel.getElement(), "left", dayLeft + "%"); // how should this day be displayed? String styleName = "day-cell"; //default value if (tu.isToday(date)) { styleName = "day-cell-today"; } if (tu.isDSTBoundary(date)) { // notice how displaying the fact that the day is DST takes // precedence over the fact that it is today. styleName = "day-cell-dst"; } dayLabel.setStyleName(styleName); dayPanel.add(dayLabel); } }
From source file:edu.ucsb.eucalyptus.admin.client.DownloadsTable.java
License:Open Source License
private void addDownloadsEntry(int row, DownloadsWeb Downloads) { if ((row % 2) == 1) { this.grid.getRowFormatter().setStyleName(row, "euca-table-odd-row"); } else {//w w w . j av a 2 s. co m this.grid.getRowFormatter().setStyleName(row, "euca-table-even-row"); } final HTML name_b = new HTML("<a href=\"" + Downloads.getUrl() + "\">" + Downloads.getName() + "</a>"); this.grid.setWidget(row, 0, name_b); final Label description_b = new Label(); description_b.setText(Downloads.getDescription()); this.grid.setWidget(row, 1, description_b); }