List of usage examples for com.google.gwt.user.client.ui Label addDoubleClickHandler
public HandlerRegistration addDoubleClickHandler(DoubleClickHandler handler)
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.//w ww .j a v a 2s .co m * * @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"); } }