List of usage examples for com.google.gwt.cell.client Cell getConsumedEvents
Set<String> getConsumedEvents();
From source file:com.google.gwt.sample.showcase.client.content.cell.CellAdapter.java
/** * Constructor for {@link CellAdapter}./* w w w . j a v a2s. c o m*/ * @param cell the delegate cell * @param transform a function that translates values from this cell's type to the delegate's type */ @SuppressWarnings("unchecked") public CellAdapter(Cell<T> cell, @Nullable Function<? super F, ? extends T> transform, @Nullable Set<String> events) { super(combine(cell.getConsumedEvents(), events)); this.transform = (Function<? super F, ? extends T>) (transform != null ? transform : Functions.<T>identity()); this.cell = cell; }
From source file:com.sencha.gxt.widget.core.client.cell.CellComponent.java
License:sencha.com license
/** * Creates a {@link CellWidget} with the specified cell, initial value, key * provider, using the specified element as the wrapper around the cell. * //from w w w . ja va 2 s . c o m * @param cell the cell to wrap * @param initialValue the initial value of the Cell * @param keyProvider the key provider used to get keys from values * @param elem the browser element to use */ protected CellComponent(Cell<C> cell, C initialValue, ProvidesKey<C> keyProvider, Element elem) { this.cell = cell; this.keyProvider = keyProvider; setElement(elem); CellWidgetImplHelper.sinkEvents(this, cell.getConsumedEvents()); setValue(initialValue); init = true; }
From source file:com.sencha.gxt.widget.core.client.grid.Grid.java
License:sencha.com license
/** * Returns true if the given cell consumes the given event. * //from w w w . java2 s. com * @param cell the cell to inspect * @param eventType the event * @return true if the cell consumes the given event */ protected boolean cellConsumesEventType(Cell<?> cell, String eventType) { Set<String> consumedEvents = cell.getConsumedEvents(); return consumedEvents != null && consumedEvents.contains(eventType); }
From source file:com.sencha.gxt.widget.core.client.grid.Grid.java
License:sencha.com license
/** * Sinks all the events consumed by the cells in the column configs. *//*from w w w . j a v a 2s . c o m*/ protected void sinkCellEvents() { Set<String> consumedEvents = new HashSet<String>(); for (int i = 0, len = cm.getColumnCount(); i < len; i++) { ColumnConfig<M, ?> c = cm.getColumn(i); Cell<?> cell = c.getCell(); if (cell != null) { Set<String> cellEvents = cell.getConsumedEvents(); if (cellEvents != null) { consumedEvents.addAll(cellEvents); } } } CellWidgetImplHelper.sinkEvents(this, consumedEvents); }
From source file:com.sencha.gxt.widget.core.client.ListView.java
License:sencha.com license
/** * Optionally sets the view's cell. If a cell is not provided, toString is * called on the value returned by the view's value provider. * * @param cell the cell//from w w w . ja v a 2 s . c o m */ public void setCell(Cell<N> cell) { this.cell = cell; if (cell != null) { CellWidgetImplHelper.sinkEvents(this, cell.getConsumedEvents()); } }
From source file:com.sencha.gxt.widget.core.client.ListView.java
License:sencha.com license
protected boolean cellConsumesEventType(Cell<N> cell, String eventType) { Set<String> consumedEvents = cell.getConsumedEvents(); return consumedEvents != null && consumedEvents.contains(eventType); }
From source file:com.sencha.gxt.widget.core.client.tree.Tree.java
License:sencha.com license
/** * Sets the tree's cell./*from w ww . ja va 2 s . c o m*/ * * @param cell the cell */ public void setCell(Cell<C> cell) { this.cell = cell; if (cell != null) { CellWidgetImplHelper.sinkEvents(this, cell.getConsumedEvents()); } }
From source file:com.sencha.gxt.widget.core.client.tree.Tree.java
License:sencha.com license
protected boolean cellConsumesEventType(Cell<?> cell, String eventType) { if (cell == null) { return false; }//ww w. j ava 2 s .co m Set<String> consumedEvents = cell.getConsumedEvents(); return consumedEvents != null && consumedEvents.contains(eventType); }
From source file:org.drools.guvnor.client.widgets.decoratedgrid.VerticalMergableGridWidget.java
License:Apache License
@Override public void onBrowserEvent(Event event) { String eventType = event.getType(); // Get the event target EventTarget eventTarget = event.getEventTarget(); if (!Element.is(eventTarget)) { return;/*from w w w . ja v a 2s. com*/ } Element target = event.getEventTarget().cast(); //Check whether "group" widget has been clicked boolean bGroupWidgetClick = isGroupWidgetClicked(event, target); // Find the cell where the event occurred. TableCellElement eventTableCell = findNearestParentCell(target); if (eventTableCell == null) { return; } int htmlCol = eventTableCell.getCellIndex(); Element trElem = eventTableCell.getParentElement(); if (trElem == null) { return; } TableRowElement tr = TableRowElement.as(trElem); int htmlRow = tr.getSectionRowIndex(); // Convert HTML coordinates to physical coordinates CellValue<?> htmlCell = data.get(htmlRow).get(htmlCol); Coordinate eventPhysicalCoordinate = htmlCell.getPhysicalCoordinate(); CellValue<?> eventPhysicalCell = data.get(eventPhysicalCoordinate.getRow()) .get(eventPhysicalCoordinate.getCol()); //Event handlers if (eventType.equals("mousedown")) { handleMousedownEvent(event, eventPhysicalCoordinate, bGroupWidgetClick); return; } else if (eventType.equals("mousemove")) { handleMousemoveEvent(event, eventPhysicalCoordinate); return; } else if (eventType.equals("mouseup")) { handleMouseupEvent(event, eventPhysicalCoordinate); return; } else if (eventType.equals("keydown")) { handleKeyboardNavigationEvent(event); if (event.getKeyCode() == KeyCodes.KEY_ENTER) { // Enter key is a special case; as the selected cell needs to be // sent events and not the cell that GWT deemed the target for // events. switch (rangeDirection) { case UP: eventPhysicalCell = selections.first(); break; case DOWN: eventPhysicalCell = selections.last(); break; } eventPhysicalCoordinate = eventPhysicalCell.getCoordinate(); eventTableCell = tbody.getRows().getItem(eventPhysicalCell.getHtmlCoordinate().getRow()).getCells() .getItem(eventPhysicalCell.getHtmlCoordinate().getCol()); } } // Pass event and physical cell to Cell Widget for handling Cell<CellValue<? extends Comparable<?>>> cellWidget = columns.get(eventPhysicalCoordinate.getCol()) .getCell(); // Implementations of AbstractCell aren't forced to initialise consumed events Set<String> consumedEvents = cellWidget.getConsumedEvents(); if (consumedEvents != null && consumedEvents.contains(eventType)) { Context context = new Context(eventPhysicalCoordinate.getRow(), eventPhysicalCoordinate.getCol(), eventPhysicalCoordinate); //The element containing the cell's HTML is nested inside two DIVs Element parent = eventTableCell.getFirstChildElement().getFirstChildElement(); cellWidget.onBrowserEvent(context, parent, eventPhysicalCell, event, null); } }
From source file:org.wte4j.ui.client.cell.PopupCell.java
License:Apache License
public PopupCell(PopupPanel popupPanel, Cell<T> contentCell) { this.contentCell = contentCell; this.popupPanel = popupPanel; consumedEvents = new HashSet<String>(); if (contentCell.getConsumedEvents() != null) { consumedEvents.addAll(contentCell.getConsumedEvents()); }// w ww .jav a 2 s .co m consumedEvents.add(BrowserEvents.CLICK); }