List of usage examples for com.google.gwt.view.client CellPreviewEvent getColumn
public int getColumn()
From source file:org.apache.hupa.client.activity.MessageListActivity.java
License:Apache License
private boolean hasClickedButFirstCol(CellPreviewEvent<Message> event) { InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d6107e0db20x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d6107e0db2_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d6107e0db20x1_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d6107e0db20x20x00x1_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d6107e0db20x20x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d6107e0db20x2_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d6107e0db20x3_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d6107e0db20x20x00x0"); InstrumentationLoggerProvider.get().instrument( "org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d6107e0db20x30x00x00x00x00x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d6107e0db20x30x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d6107e0db20x30x00x00x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d6107e0db20x30x00x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d6107e0db20x30x00x00x00x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d6107e0db20x30x00x00x10x0_____org_apache_hupa_client_activity_MessageListActivity_java0x031dd50d6107e0db20x30x00x00x1"); return "click".equals(event.getNativeEvent().getType()) && 0 != event.getColumn(); }
From source file:org.eclipse.che.ide.ext.datasource.client.sqllauncher.ResultCellTable.java
License:Open Source License
@Inject public ResultCellTable(final @Assisted int pageSize, final @NotNull CellTableResourcesQueryResults cellTableResources, final @NotNull SqlRequestLauncherConstants constants) { super(pageSize, cellTableResources); final InlineLabel emptyWidget = new InlineLabel(constants.emptyResult()); setEmptyTableWidget(emptyWidget);// w ww . j ava 2 s . c o m emptyWidget.setStyleName(cellTableResources.cellTableStyle().emptyTableWidget()); addCellPreviewHandler(new CellPreviewEvent.Handler<List<String>>() { @Override public void onCellPreview(CellPreviewEvent<List<String>> event) { if ("click".equals(event.getNativeEvent().getType())) { TableCellElement cellElement = getRowElement(event.getIndex()).getCells() .getItem(event.getColumn()); cellElement.setTitle(cellElement.getInnerText()); } } }); }
From source file:org.jbpm.console.ng.cm.client.casegrid.CasesListGridViewImpl.java
License:Apache License
private void onMouseOverGrid(final CellPreviewEvent<CaseSummary> event) { CaseSummary caseInstance = event.getValue(); if (caseInstance.getDescription() != null) { listGrid.setTooltip(listGrid.getKeyboardSelectedRow(), event.getColumn(), caseInstance.getDescription()); }/*ww w . j av a2 s . c o m*/ }
From source file:org.jbpm.console.ng.ht.client.editors.taskslist.grid.dash.DataSetTasksListGridViewImpl.java
License:Apache License
private void onMouseOverGrid(ExtendedPagedTable extendedPagedTable, final CellPreviewEvent<TaskSummary> event) { TaskSummary task = event.getValue(); if (task.getDescription() != null) { extendedPagedTable.setTooltip(extendedPagedTable.getKeyboardSelectedRow(), event.getColumn(), task.getDescription());// w ww.ja v a 2s . c o m } }
From source file:org.jbpm.workbench.common.client.list.ExtendedPagedTable.java
License:Apache License
protected DefaultSelectionEventManager<T> createNoActionColumnManager() { final ExtendedPagedTable<T> extendedPagedTable = this; return DefaultSelectionEventManager .createCustomManager(new DefaultSelectionEventManager.EventTranslator<T>() { @Override//from w w w .j a va 2s.c o m public boolean clearCurrentSelection(CellPreviewEvent<T> event) { return false; } @Override public DefaultSelectionEventManager.SelectAction translateSelectionEvent( CellPreviewEvent<T> event) { DefaultSelectionEventManager.SelectAction ret = DefaultSelectionEventManager.SelectAction.DEFAULT; NativeEvent nativeEvent = event.getNativeEvent(); if (BrowserEvents.CLICK.equals(nativeEvent.getType())) { // Ignore if the event didn't occur in the correct column. if (extendedPagedTable.isSelectionIgnoreColumn(event.getColumn())) { ret = DefaultSelectionEventManager.SelectAction.IGNORE; } //Extension for checkboxes Element target = nativeEvent.getEventTarget().cast(); if ("input".equals(target.getTagName().toLowerCase())) { final InputElement input = target.cast(); if ("checkbox".equals(input.getType().toLowerCase())) { // Synchronize the checkbox with the current selection state. final T domain = event.getValue(); if (domain.isSelected()) { input.setChecked(false); domain.setSelected(false); } else { input.setChecked(true); domain.setSelected(true); } extendedPagedTable.redraw(); ret = DefaultSelectionEventManager.SelectAction.IGNORE; } } } return ret; } }); }
From source file:org.jbpm.workbench.ht.client.editors.taskslist.AbstractTaskListView.java
License:Apache License
private void onMouseOverGrid(ExtendedPagedTable<TaskSummary> extendedPagedTable, final CellPreviewEvent<TaskSummary> event) { TaskSummary task = event.getValue(); if (task.getDescription() != null) { extendedPagedTable.setTooltip(extendedPagedTable.getKeyboardSelectedRow(), event.getColumn(), task.getDescription());//from w w w.j a va2 s . c om } }
From source file:org.rstudio.core.client.widget.ModifyKeyboardShortcutsWidget.java
License:Open Source License
public ModifyKeyboardShortcutsWidget(String filterText) { RStudioGinjector.INSTANCE.injectMembers(this); initialFilterText_ = filterText;//from w ww . j a va 2 s .c o m shortcuts_ = ShortcutManager.INSTANCE; changes_ = new HashMap<KeyboardShortcutEntry, KeyboardShortcutEntry>(); buffer_ = new KeySequence(); table_ = new DataGrid<KeyboardShortcutEntry>(1000, RES, KEY_PROVIDER); FlowPanel emptyWidget = new FlowPanel(); Label emptyLabel = new Label("No bindings available"); emptyLabel.getElement().getStyle().setMarginTop(20, Unit.PX); emptyLabel.getElement().getStyle().setColor("#888"); emptyWidget.add(emptyLabel); table_.setEmptyTableWidget(emptyWidget); table_.setWidth("700px"); table_.setHeight("400px"); // Add a 'global' click handler that performs a row selection regardless // of the cell clicked (it seems GWT clicks can be 'fussy' about whether // you click on the contents of a cell vs. the '<td>' element itself) table_.addDomHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Element el = event.getNativeEvent().getEventTarget().cast(); Element rowEl = DomUtils.findParentElement(el, new ElementPredicate() { @Override public boolean test(Element el) { return el.getTagName().toLowerCase().equals("tr"); } }); if (rowEl == null) return; if (rowEl.hasAttribute("__gwt_row")) { int row = StringUtil.parseInt(rowEl.getAttribute("__gwt_row"), -1); if (row != -1) { event.stopPropagation(); event.preventDefault(); table_.setKeyboardSelectedRow(row); table_.setKeyboardSelectedColumn(0); } } } }, ClickEvent.getType()); table_.setKeyboardSelectionHandler(new CellPreviewEvent.Handler<KeyboardShortcutEntry>() { private final AbstractCellTable.CellTableKeyboardSelectionHandler<KeyboardShortcutEntry> handler_ = new AbstractCellTable.CellTableKeyboardSelectionHandler<KeyboardShortcutEntry>( table_); @Override public void onCellPreview(CellPreviewEvent<KeyboardShortcutEntry> preview) { NativeEvent event = preview.getNativeEvent(); int code = event.getKeyCode(); // Don't let arrow keys change the selection when a shortcut cell // has been selected. if (preview.getColumn() == 1) { if (code == KeyCodes.KEY_UP || code == KeyCodes.KEY_DOWN || code == KeyCodes.KEY_LEFT || code == KeyCodes.KEY_RIGHT) { return; } } // Also disable 'left', 'right' keys as they can 'navigate' the widget // into an unusable state. if (code == KeyCodes.KEY_LEFT || code == KeyCodes.KEY_RIGHT) { return; } handler_.onCellPreview(preview); } }); dataProvider_ = new ListDataProvider<KeyboardShortcutEntry>(); dataProvider_.addDataDisplay(table_); addColumns(); addHandlers(); setText("Keyboard Shortcuts"); addOkButton(new ThemedButton("Apply", new ClickHandler() { @Override public void onClick(ClickEvent event) { applyChanges(); } })); addCancelButton(); radioAll_ = radioButton("All", new ClickHandler() { @Override public void onClick(ClickEvent event) { filter(); } }); radioCustomized_ = radioButton("Customized", new ClickHandler() { @Override public void onClick(ClickEvent event) { filter(); } }); filterWidget_ = new SearchWidget(new SuggestOracle() { @Override public void requestSuggestions(Request request, Callback callback) { callback.onSuggestionsReady(request, new Response(new ArrayList<Suggestion>())); } }); filterWidget_.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { filter(); } }); filterWidget_.setPlaceholderText("Filter..."); addLeftWidget(new ThemedButton("Reset...", new ClickHandler() { @Override public void onClick(ClickEvent event) { globalDisplay_.showYesNoMessage(GlobalDisplay.MSG_QUESTION, "Reset Keyboard Shortcuts", "Are you sure you want to reset keyboard shortcuts to their default values? " + "This action cannot be undone.", new ProgressOperation() { @Override public void execute(final ProgressIndicator indicator) { indicator.onProgress("Resetting Keyboard Shortcuts..."); appCommands_.resetBindings(new CommandWithArg<EditorKeyBindings>() { @Override public void execute(EditorKeyBindings appBindings) { editorCommands_.resetBindings(new Command() { @Override public void execute() { addins_.resetBindings(new Command() { @Override public void execute() { indicator.onCompleted(); ShortcutManager.INSTANCE.resetAppCommandBindings(); resetState(); } }); } }); } }); } }, false); } })); }
From source file:org.rstudio.core.client.widget.ModifyKeyboardShortcutsWidget.java
License:Open Source License
private void addHandlers() { table_.addCellPreviewHandler(new CellPreviewEvent.Handler<KeyboardShortcutEntry>() { @Override// ww w. j a v a2 s.c o m public void onCellPreview(CellPreviewEvent<KeyboardShortcutEntry> preview) { Handle shortcutsHandler = shortcuts_.disable(); int column = preview.getColumn(); if (column == 0) onNameCellPreview(preview); else if (column == 1) onShortcutCellPreview(preview); else if (column == 2) onNameCellPreview(preview); shortcutsHandler.close(); } }); table_.addColumnSortHandler(new ColumnSortEvent.Handler() { @Override public void onColumnSort(ColumnSortEvent event) { List<KeyboardShortcutEntry> data = dataProvider_.getList(); if (event.getColumn().equals(nameColumn_)) sort(data, 0, event.isSortAscending()); else if (event.getColumn().equals(shortcutColumn_)) sort(data, 1, event.isSortAscending()); else if (event.getColumn().equals(typeColumn_)) sort(data, 2, event.isSortAscending()); updateData(data); } }); // Fix a bug where clicking on a table header would also // select the cell at position [0, 0]. It seems that GWT's // DataGrid over-aggressively selects the first cell on the // _first_ mouse down event seen; after the first click, // cell selection occurs only after full mouse clicks. table_.addDomHandler(new MouseDownHandler() { @Override public void onMouseDown(MouseDownEvent event) { Element target = event.getNativeEvent().getEventTarget().cast(); if (target.hasAttribute("__gwt_header")) { event.stopPropagation(); event.preventDefault(); } } }, MouseDownEvent.getType()); }
From source file:org.rstudio.core.client.widget.ModifyKeyboardShortcutsWidget.java
License:Open Source License
private void onShortcutCellPreview(CellPreviewEvent<KeyboardShortcutEntry> preview) { NativeEvent event = preview.getNativeEvent(); String type = event.getType(); if (type.equals("keydown")) { int keyCode = event.getKeyCode(); int modifiers = KeyboardShortcut.getModifierValue(event); // Don't handle raw 'Enter' keypresses (let underlying input // widget process) if (keyCode == KeyCodes.KEY_ENTER && modifiers == 0) return; // Handle any other key events. if (modifiers != 0) swallowNextKeyUpEvent_ = true; event.stopPropagation();//from w w w. j a v a 2 s .c o m event.preventDefault(); if (KeyboardHelper.isModifierKey(event.getKeyCode())) return; if (keyCode == KeyCodes.KEY_BACKSPACE && modifiers == 0) { buffer_.pop(); } else if (keyCode == KeyCodes.KEY_DELETE && modifiers == 0) { buffer_.clear(); } else if (keyCode == KeyCodes.KEY_ESCAPE && modifiers == 0) { buffer_.set(preview.getValue().getOriginalKeySequence()); } else { buffer_.add(event); } // Sneak into the element and find the active <input>, then update it. Element el = getElement(table_, preview.getIndex(), preview.getColumn()); Element input = el.getFirstChildElement().getFirstChildElement(); if (input == null) return; assert input.getTagName().toLowerCase().equals("input") : "Failed to find <input> element in table"; String bufferString = buffer_.toString(); input.setAttribute("value", bufferString); input.setInnerHTML(bufferString); // Move the cursor to the end of the selection. DomUtils.setSelectionRange(input, bufferString.length(), bufferString.length()); } }
From source file:org.seamless.gwt.component.client.widget.BlacklistEventTranslator.java
License:Open Source License
public DefaultSelectionEventManager.SelectAction translateSelectionEvent(CellPreviewEvent<T> event) { return isColumnBlacklisted(event.getColumn()) ? DefaultSelectionEventManager.SelectAction.IGNORE : DefaultSelectionEventManager.SelectAction.DEFAULT; }