List of usage examples for com.google.gwt.dom.client BrowserEvents TOUCHEND
String TOUCHEND
To view the source code for com.google.gwt.dom.client BrowserEvents TOUCHEND.
Click Source Link
From source file:com.sencha.gxt.cell.core.client.AbstractEventCell.java
License:sencha.com license
public void addCellGestureAdapter(CellGestureAdapter<? extends GestureRecognizer, C> cellGestureAdapter) { if (cellGestureAdapters == null) { cellGestureAdapters = new ArrayList<CellGestureAdapter<? extends GestureRecognizer, C>>(); Set<String> updated = new HashSet<String>(); Set<String> consumedEvents = super.getConsumedEvents(); if (consumedEvents != null) { updated.addAll(consumedEvents); }//from w ww . java 2s. c o m if (PointerEventsSupport.impl.isSupported()) { updated.add(PointerEvents.POINTERDOWN.getEventName()); updated.add(PointerEvents.POINTERMOVE.getEventName()); updated.add(PointerEvents.POINTERUP.getEventName()); updated.add(PointerEvents.POINTERCANCEL.getEventName()); } updated.add(BrowserEvents.TOUCHSTART); updated.add(BrowserEvents.TOUCHMOVE); updated.add(BrowserEvents.TOUCHCANCEL); updated.add(BrowserEvents.TOUCHEND); setConsumedEventsInternal(Collections.unmodifiableSet(updated)); } cellGestureAdapter.setDelegate(this); cellGestureAdapters.add(cellGestureAdapter); }
From source file:com.sencha.gxt.cell.core.client.AbstractEventCell.java
License:sencha.com license
@Override public void onBrowserEvent(Context context, Element parent, C value, NativeEvent event, ValueUpdater<C> valueUpdater) { super.onBrowserEvent(context, parent, value, event, valueUpdater); String eventType = event.getType(); if (BrowserEvents.TOUCHSTART.equals(eventType) || BrowserEvents.TOUCHMOVE.equals(eventType) || BrowserEvents.TOUCHCANCEL.equals(eventType) || BrowserEvents.TOUCHEND.equals(eventType)) { onTouch(context, parent, value, event, valueUpdater); }//from ww w. j ava2s. co m }
From source file:com.sencha.gxt.cell.core.client.AbstractEventInputCell.java
License:sencha.com license
public void addCellGestureAdapter(CellGestureAdapter<? extends GestureRecognizer, T> cellGestureAdapter) { if (cellGestureAdapters == null) { cellGestureAdapters = new ArrayList<CellGestureAdapter<? extends GestureRecognizer, T>>(); if (PointerEventsSupport.impl.isSupported()) { consumedEvents.add(PointerEvents.POINTERDOWN.getEventName()); consumedEvents.add(PointerEvents.POINTERMOVE.getEventName()); consumedEvents.add(PointerEvents.POINTERUP.getEventName()); consumedEvents.add(PointerEvents.POINTERCANCEL.getEventName()); }/*from w w w . j a v a2s . c o m*/ consumedEvents.add(BrowserEvents.TOUCHSTART); consumedEvents.add(BrowserEvents.TOUCHMOVE); consumedEvents.add(BrowserEvents.TOUCHCANCEL); consumedEvents.add(BrowserEvents.TOUCHEND); } cellGestureAdapter.setDelegate(this); cellGestureAdapters.add(cellGestureAdapter); }
From source file:com.sencha.gxt.cell.core.client.AbstractEventInputCell.java
License:sencha.com license
@Override public void onBrowserEvent(Context context, Element parent, T value, NativeEvent event, ValueUpdater<T> valueUpdater) { super.onBrowserEvent(context, parent, value, event, valueUpdater); String eventType = event.getType(); if (BrowserEvents.TOUCHSTART.equals(eventType) || BrowserEvents.TOUCHMOVE.equals(eventType) || BrowserEvents.TOUCHCANCEL.equals(eventType) || BrowserEvents.TOUCHEND.equals(eventType)) { onTouch(context, parent, value, event, valueUpdater); }/* www.ja v a2s. c om*/ }
From source file:com.sencha.gxt.core.client.gestures.AbstractGestureRecognizer.java
License:sencha.com license
@Override public boolean handle(NativeEvent event) { String eventType = event.getType(); if (eventType.equals(BrowserEvents.TOUCHSTART) || eventType.equals(PointerEvents.POINTERDOWN.getEventName())) { return handleStart(event); } else if (eventType.equals(BrowserEvents.TOUCHMOVE) || eventType.equals(PointerEvents.POINTERMOVE.getEventName())) { return handleMove(event); } else if (eventType.equals(BrowserEvents.TOUCHEND) || eventType.equals(PointerEvents.POINTERUP.getEventName())) { return handleEnd(event); } else if (eventType.equals(BrowserEvents.TOUCHCANCEL) || eventType.equals(PointerEvents.POINTERCANCEL.getEventName())) { return handleCancel(event); } else if (eventType.equals(PointerEvents.POINTERENTER.getEventName()) || eventType.equals(PointerEvents.POINTERLEAVE.getEventName()) || eventType.equals(PointerEvents.POINTEROVER.getEventName())) { event.preventDefault();/*from ww w .j av a 2s. co m*/ event.stopPropagation(); } //else, skip, we aren't interested return true; }
From source file:com.sencha.gxt.widget.core.client.grid.CheckBoxSelectionModel.java
License:sencha.com license
/** * Creates a CheckBoxSelectionModel with a custom ValueProvider and appearance. * /*from www.j av a 2s . c o m*/ * @param valueProvider the ValueProvider to use when constructing a ColumnConfig * @param appearance the appearance that should be used to render and update the checkbox */ public CheckBoxSelectionModel(ValueProvider<M, M> valueProvider, final CheckBoxColumnAppearance appearance) { this.appearance = appearance; config = newColumnConfig(valueProvider); config.setCellPadding(false); config.setWidth(20); config.setSortable(false); config.setHideable(false); config.setResizable(false); config.setFixed(true); config.setMenuDisabled(true); config.setCellClassName(appearance.getCellClassName()); config.setColumnHeaderClassName(appearance.getCellInnerClassName()); config.setHeader(appearance.renderHeadCheckBox()); // allow touch events in Set<String> consumedEvents = new HashSet<String>(Arrays.asList(BrowserEvents.TOUCHSTART, BrowserEvents.TOUCHMOVE, BrowserEvents.TOUCHCANCEL, BrowserEvents.TOUCHEND)); if (PointerEventsSupport.impl.isSupported()) { consumedEvents.add(PointerEvents.POINTERDOWN.getEventName()); } config.setCell(new AbstractCell<M>(consumedEvents) { @Override public void onBrowserEvent(Context context, Element parent, M value, NativeEvent event, ValueUpdater<M> valueUpdater) { super.onBrowserEvent(context, parent, value, event, valueUpdater); // If the incoming event is touch, then selection is already taken care of // Don't let mouse events to pass through String eventType = event.getType(); if (BrowserEvents.TOUCHSTART.equals(eventType) || BrowserEvents.TOUCHMOVE.equals(eventType) || BrowserEvents.TOUCHCANCEL.equals(eventType) || BrowserEvents.TOUCHEND.equals(eventType) || PointerEventsSupport.impl.isPointerEvent(event)) { event.preventDefault(); } } @Override public void render(Context context, M value, SafeHtmlBuilder sb) { CheckBoxSelectionModel.this.render(context, value, sb); } }); deselectOnSimpleClick = false; }
From source file:com.vaadin.client.widgets.Grid.java
License:Apache License
private boolean handleHeaderDefaultRowEvent(Event event, RowContainer container) { if (container != escalator.getHeader()) { return false; }/*w ww . ja v a2 s.co m*/ if (!getHeader().getRow(eventCell.getRowIndex()).isDefault()) { return false; } if (!eventCell.getColumn().isSortable()) { // Only handle sorting events if the column is sortable return false; } if (BrowserEvents.MOUSEDOWN.equals(event.getType()) && event.getShiftKey()) { // Don't select text when shift clicking on a header. event.preventDefault(); } if (BrowserEvents.TOUCHSTART.equals(event.getType())) { if (event.getTouches().length() > 1) { return false; } event.preventDefault(); Touch touch = event.getChangedTouches().get(0); rowEventTouchStartingPoint = new Point(touch.getClientX(), touch.getClientY()); sorter.sortAfterDelay(GridConstants.LONG_TAP_DELAY, true); return true; } else if (BrowserEvents.TOUCHMOVE.equals(event.getType())) { if (event.getTouches().length() > 1) { return false; } event.preventDefault(); Touch touch = event.getChangedTouches().get(0); double diffX = Math.abs(touch.getClientX() - rowEventTouchStartingPoint.getX()); double diffY = Math.abs(touch.getClientY() - rowEventTouchStartingPoint.getY()); // Cancel long tap if finger strays too far from // starting point if (diffX > GridConstants.LONG_TAP_THRESHOLD || diffY > GridConstants.LONG_TAP_THRESHOLD) { sorter.cancelDelayedSort(); } return true; } else if (BrowserEvents.TOUCHEND.equals(event.getType())) { if (event.getTouches().length() > 1) { return false; } if (sorter.isDelayedSortScheduled()) { // Not a long tap yet, perform single sort sorter.cancelDelayedSort(); sorter.sort(eventCell.getColumn(), false); } return true; } else if (BrowserEvents.TOUCHCANCEL.equals(event.getType())) { if (event.getTouches().length() > 1) { return false; } sorter.cancelDelayedSort(); return true; } else if (BrowserEvents.CLICK.equals(event.getType())) { sorter.sort(eventCell.getColumn(), event.getShiftKey()); // Click events should go onward to cell focus logic return false; } else { return false; } }
From source file:gwt.material.design.client.MaterialWidgetTestCase.java
License:Apache License
public void fireTouchEndEvent(HasHandlers widget) { DomEvent.fireNativeEvent(Document.get().createHtmlEvent(BrowserEvents.TOUCHEND, false, false), widget); }