List of usage examples for com.google.gwt.user.client.ui HTML getHTML
public String getHTML()
From source file:cz.filmtit.client.pages.TranslationWorkspace.java
License:Open Source License
/** * Display the whole row for the given (source-language) chunk in the table, * i.e. the timing, the chunk text and an empty (fakeSubgetsBox)subgestbox. * We have to suppose these are coming in the same order as they appear in * the source./*from w ww. j av a 2 s. com*/ * * @param chunk - source-language chunk to show */ public void showSource(final TranslationResult result) { final TimedChunk chunk = result.getSourceChunk(); final ChunkIndex chunkIndex = chunk.getChunkIndex(); int order = chunk.getOrder(); // create label Label timeslabel = new Label(chunk.getDisplayTimeInterval()); timeslabel.setStyleName("chunk_timing"); timeslabel.setTitle("double-click to change the timing"); // add label to map timeLabels.put(chunkIndex, timeslabel); //int index = lastIndex; //lastIndex++; synchronizer.putSourceChunk(chunk, order, true); //+1 because of the header table.setWidget(order + 1, TIMES_COLNUMBER, timeslabel); //html because of <br /> Label sourcelabel = new HTML(chunk.getSurfaceForm()); sourcelabel.setStyleName("chunk_l1"); sourcelabel.setTitle("double-click to change this text"); table.setWidget(order + 1, SOURCETEXT_COLNUMBER, sourcelabel); // initializing targetbox - fakeSubgetsBox SubgestBox targetbox = new SubgestBox(chunk, this, order + 1); SubgestBox.FakeSubgestBox fakeSubgetsBox = targetbox.new FakeSubgestBox(order + 1); targetBoxes.add(fakeSubgetsBox); table.setWidget(order + 1, TARGETBOX_COLNUMBER, fakeSubgetsBox); sourcelabel.addDoubleClickHandler(new SourceChangeHandler(chunk, sourcelabel, targetbox)); timeslabel.addDoubleClickHandler(new TimeChangeHandler(chunk, targetbox)); // initializing posteditbox - fakeSubgetsBox if (isPosteditOn()) { PosteditBox posteditBox = new PosteditBox(chunk, this, order + 1); PosteditBox.FakePosteditBox fakePosteditBox = posteditBox.new FakePosteditBox(order + 1); posteditBoxes.add(fakePosteditBox); table.setWidget(order + 1, POSTEDIT_COLNUMBER, fakePosteditBox); targetbox.setPosteditBox(posteditBox); posteditBox.setSubgestBox(targetbox); } // chunk-marking (dialogs): // setting sourcemarks: HTML sourcemarks = new HTML(); sourcemarks.setStyleName("chunkmark"); sourcemarks.setTitle("This line is part of the one-screen dialog."); if (chunk.isDialogue()) { sourcemarks.setHTML(sourcemarks.getHTML() + " – "); } if (!sourcemarks.getHTML().isEmpty()) { table.setWidget(order + 1, SOURCE_DIALOGMARK_COLNUMBER, sourcemarks); // and copying the same to the targets (GWT does not have .clone()): HTML targetmarks = new HTML(sourcemarks.getHTML()); targetmarks.setStyleName(sourcemarks.getStyleName()); targetmarks.setTitle(sourcemarks.getTitle()); table.setWidget(order + 1, TARGET_DIALOGMARK_COLNUMBER, targetmarks); } com.github.gwtbootstrap.client.ui.Button undoButton = new com.github.gwtbootstrap.client.ui.Button("", IconType.UNDO, new ClickHandler() { @Override public void onClick(ClickEvent event) { Number revisionNumber = getLoadedRevision(result.getSourceChunk().getChunkIndex()); new LoadOldSubtitleItem(result, currentWorkspace, revisionNumber); } }); table.setWidget(order + 1, UNDO_BUTTON_COLNUMBER, undoButton); // grouping: // alignment because of the grouping: //table.getRowFormatter().setVerticalAlign(index + 1, HasVerticalAlignment.ALIGN_BOTTOM); if (chunk.getPartNumber() > 1) { table.getRowFormatter().addStyleName(order + 1, "row_group_continue"); } else { table.getRowFormatter().addStyleName(order + 1, "row_group_begin"); } }
From source file:cz.filmtit.client.widgets.VLCWidget.java
License:Open Source License
/** * Replaces the contents of HTML element, if it is actually different from what we want to replace it with. * @param elem Element where we want to put text. * @param what Text that we want to put there. newlines are converted to <br>. No check for HTML * is done, so beware XSS issues. (I am not sure if we actually do check for XSS anywhere.) */// w ww . j a v a 2 s . c o m public static void maybeSetHTML(HTML elem, String what) { String withBr = what.replaceAll("\n", "<br/>"); if (!elem.getHTML().equals(withBr)) { elem.setHTML(withBr); } }
From source file:de.swm.commons.mobile.client.widgets.experimental.FastHeaderPanel.java
License:Apache License
/** * {@inheritDoc}// w w w . ja v a 2 s.c om */ public String getCaption() { FlowPanel contents = ((FlowPanel) ((FlowPanel) getWidget()).getWidget(1)); if (contents.getWidgetCount() > 0) { HTML w = (HTML) contents.getWidget(0); return w.getHTML(); } return ""; }
From source file:de.swm.commons.mobile.client.widgets.HeaderPanel.java
License:Apache License
/** * {@inheritDoc}/*from ww w . jav a 2s. com*/ */ @Override public String getCaption() { FlowPanel contents = ((FlowPanel) ((FlowPanel) getWidget()).getWidget(1)); if (contents.getWidgetCount() > 0) { HTML w = (HTML) contents.getWidget(0); return w.getHTML(); } return ""; }
From source file:edu.caltech.ipac.firefly.commands.DynSearchCmd.java
private void doHtmlLoad(Request inputReq, HtmlLoaderTag htmlLoader, final HTML html) { String queryId = htmlLoader.getQueryId(); QueryTag queryTag = getQueryTagIfValid(queryId, inputReq); if (queryTag != null) { String searchProcessorId = queryTag.getSearchProcessorId(); if (searchProcessorId != null) { TableServerRequest tsReq = new TableServerRequest(searchProcessorId, inputReq); tsReq.setParam(DynUtils.QUERY_ID, htmlLoader.getQueryId()); // get query params List<ParamTag> paramTagList = queryTag.getParams(); for (ParamTag p : paramTagList) { tsReq.setParam(p.getKey(), p.getValue()); }/* w ww . j av a2 s .c o m*/ SearchServices.App.getInstance().getRawDataSet(tsReq, new BaseCallback<RawDataSet>() { public void onFailure(Throwable caught) { Application.getInstance().getToolBar().getDropdown().open(); PopupUtil.showSevereError(caught); unmask(); } public void doSuccess(RawDataSet result) { if (result != null) { DataSet data = DataSetParser.parse(result); String msg = data.getMeta().getAttribute("Message"); if (msg != null) { html.setHTML(html.getHTML() + msg); } } } }); } } }
From source file:edu.caltech.ipac.firefly.ui.table.BasicPagingTable.java
protected void updateHeaderTable(List<ColumnDefinition<TableData.Row, ?>> colDefs, boolean force) { if (!colDefs.equals(lastColDefs) || force) { lastColDefs = colDefs;/*from w w w . j a va2s .c o m*/ int numColumns = colDefs.size(); // clear the headers clearTable(headers, numColumns); // Add the column and group headers for (int i = 0; i < numColumns; i++) { // Add the name ColDef colDef = (ColDef) colDefs.get(i); if (colDef == null) continue; // skip if colDef is null String title = colDef.isImmutable() ? "" : "<b>" + colDef.getTitle() + "</b>"; HTML label = new HTML(title, false); label.setTitle(colDef.getShortDesc()); label.setWidth("10px"); DOM.setStyleAttribute(label.getElement(), "display", "inline"); headers.setWidget(LABEL_IDX, i, label); setColumnWidth(i, colDef.getPreferredColumnWidth()); headers.getFlexCellFormatter().setHorizontalAlignment(LABEL_IDX, i, HorizontalPanel.ALIGN_CENTER); if (isShowUnits()) { String u = colDef.getColumn() == null || StringUtils.isEmpty(colDef.getColumn().getUnits()) ? " " : "(" + colDef.getColumn().getUnits() + ")"; label.setHTML(label.getHTML() + "<br>" + u); } GwtUtil.setStyle(label, "display", "inline-table"); } filterSupport.onUpdateHeaders(colDefs); } filterSupport.ensureFilterShow(); }
From source file:es.deusto.weblab.client.ui.widgets.WlWebcamSafariBased.java
License:Open Source License
private void reloadMJpeg() { if (this.lastWebcam != WebcamFormat.mjpeg) { this.imagePanel.clear(); final HTML html = new HTML(); html.setHTML("<div/>"); this.imagePanel.add(html); createJavaScriptCode(html.getElement(), this.streamingWidth, this.streamingHeight, this.streamingUrl); System.out.println(html.getHTML()); }//from w ww. j a va 2 s .c o m }
From source file:gov.nih.nci.ncicb.tcgaportal.level4.gwt.anomalysearch.client.filter.AnomalyDisplay.java
public void setTooltipText(String tooltipText, String widgetTooltipText) { HTML tooltipHTML = new HTML(tooltipText); HTML widgetTooltipHTML = new HTML(widgetTooltipText); if (tooltipListener != null) { headingHtml.removeMouseListener(tooltipListener); }/*from w w w . jav a 2 s . c o m*/ if (filterPanel.areTooltipsEnabled() && tooltipHTML.getHTML() != null) { tooltipListener = new TooltipListener(tooltipHTML); headingHtml.addMouseListener(tooltipListener); headingHtml.addStyleName("action"); } else { headingHtml.removeStyleName("action"); } //set tooltips on all the sub-widgets this.widgetTooltipHTML = widgetTooltipHTML; for (AnomalyWidget widget : this.getSelectedWidgets()) { widget.setTooltipText(widgetTooltipHTML); } }
From source file:gov.nih.nci.ncicb.tcgaportal.level4.gwt.anomalysearch.client.filter.AnomalyWidget.java
public void setTooltipText(HTML tooltipText) { if (tooltipListener != null) { mainPanel.getHeaderLabel().removeMouseListener(tooltipListener); }//from w ww .ja v a2 s . c om if (tooltipText != null && tooltipText.getHTML() != null && tooltipText.getHTML().length() > 0) { tooltipListener = new TooltipListener(tooltipText); mainPanel.getHeaderLabel().addMouseListener(tooltipListener); mainPanel.getHeaderLabel().addStyleName("action"); } }
From source file:nl.mpi.tg.eg.experiment.client.presenter.LocalStoragePresenter.java
License:Open Source License
protected void stimuliValidation() { for (final GeneratedStimulus.Tag tag : GeneratedStimulus.Tag.values()) { ((ComplexView) simpleView).addOptionButton(new PresenterEventListner() { @Override/*from w w w.j a va2 s .c o m*/ public String getLabel() { return "Stimuli Check: " + tag.name(); } @Override public String getStyleName() { return null; } @Override public void eventFired(ButtonBase button, SingleShotEventListner shotEventListner) { final HTML simuliValidationHtmlText = ((ComplexView) simpleView) .addHtmlText("simuliValidation: " + tag.name(), null); final HTML sampleCount = ((ComplexView) simpleView).addHtmlText("sampleCount", null); final HTML uniqueCount = ((ComplexView) simpleView).addHtmlText("uniqueCount", null); final FlexTable outputTable = new FlexTable(); ((ComplexView) simpleView).addWidget(outputTable); final FlexTable transitionTable = new FlexTable(); ((ComplexView) simpleView).addWidget(transitionTable); new SimuliValidationRunner() { @Override public void appendOutput(String outputString) { simuliValidationHtmlText .setHTML(simuliValidationHtmlText.getHTML() + "<br/>" + outputString); } @Override public void sampleCount(int outputString) { sampleCount.setHTML("sampleCount: " + outputString); } @Override public void uniqueCount(int outputString) { uniqueCount.setHTML("uniqueCount: " + outputString); } @Override public void transitionTableValue(int column, int row, String value) { transitionTable.setText(row, column, value); } @Override public void appendUniqueStimuliList(String outputString) { ((ComplexView) simpleView).addText(outputString); } @Override public void outputTableValue(int column, int row, String value) { outputTable.setText(row, column, value); } }.calculate(tag); } @Override public int getHotKey() { return -1; } }); } }