コード例 #1
0
 @Override
 public void onBrowserEvent(Event event) {
   String eventType = event.getType();
   if (BrowserEvents.MOUSEMOVE.equals(eventType)) {
     int currentPosition = positionController.getPosition(event);
     cell.setSize(startSize + currentPosition - startPosition);
   } else if (BrowserEvents.MOUSEUP.equals(eventType)) {
     DOM.releaseCapture(resizer);
     DOM.setEventListener(resizer, null);
   }
 }
コード例 #2
0
 @Override
 public boolean onBrowserEvent(
     Cell.Context context,
     Element parent,
     C value,
     NativeEvent event,
     ValueUpdater<C> cValueUpdater) {
   resizer = cell.getResizeElement().cast();
   if (event.getEventTarget().equals(resizer)) {
     String eventType = event.getType();
     if (BrowserEvents.MOUSEDOWN.equals(eventType)) {
       startPosition = positionController.getPosition(Event.getCurrentEvent());
       int events =
           Event.getTypeInt(BrowserEvents.MOUSEMOVE) | Event.getTypeInt(BrowserEvents.MOUSEUP);
       DOM.setEventListener(resizer, eventListener);
       DOM.sinkEvents(resizer, events);
       DOM.setCapture(resizer);
       startSize = cell.getSize(parent);
       event.preventDefault();
       return true;
     }
   }
   return false;
 }