Java 类com.google.gwt.dom.client.BrowserEvents 实例源码

项目:listmaker    文件:NotesTable.java   
public NotesTable() {
        selectionModel = new MultiSelectionModel<Note>();
        table.setSelectionModel(selectionModel, DefaultSelectionEventManager.<Note> createDefaultManager());
        info.setCellStyleNames(AppStyles.NOTE_TEXT);
        list.setCellStyleNames(AppStyles.NOTE_LIST_NAME);
        table.addColumn(info, "Note");
//        table.addColumn(list, "List");
        initWidget(table);
        dataProvider = new ListDataProvider<Note>();
        dataProvider.addDataDisplay(table);

        table.addCellPreviewHandler(new CellPreviewEvent.Handler() {
            @Override
            public void onCellPreview(CellPreviewEvent event) {
                if (BrowserEvents.CLICK.equalsIgnoreCase(event.getNativeEvent().getType())) {
                    selectedColumn = event.getColumn();
                    selectedRow = event.getIndex();
                    //used to prepare double click info
                }
            }
        });
    }
项目:platypus-js    文件:TreeExpandableCell.java   
@Override
protected void onNonCellBrowserEvent(Cell.Context context, Element parent, C value, NativeEvent event, ValueUpdater<C> valueUpdater) {
    if (treeProvider != null) {
        if (BrowserEvents.MOUSEDOWN.equals(event.getType())) {
            T toBeToggled = treeProvider.getList().get(context.getIndex());
            treeProvider.getList().set(context.getIndex(), toBeToggled);
            if (isExpanded(context)) {
                treeProvider.collapse(toBeToggled);
            } else {
                treeProvider.expand(toBeToggled);
            }
        } else if (cell.getConsumedEvents().contains(event.getType())) {
            cell.onBrowserEvent(context, getCellParent(parent), value, event, valueUpdater);
        }
    }
}
项目:platypus-js    文件:DraggableHeader.java   
@Override
public void onBrowserEvent(Context context, Element targetCell, NativeEvent event) {
    if (BrowserEvents.DRAGSTART.equals(event.getType())) {
        event.stopPropagation();
        EventTarget et = event.getEventTarget();
        if (Element.is(et)) {
            DraggedColumn<?> col = new DraggedColumn<>(column, this, table, targetCell, Element.as(et));
            if ((col.isMove() && moveable) || (col.isResize() && resizable)) {
                event.getDataTransfer().<XDataTransfer> cast().setEffectAllowed("move");
                DraggedColumn.instance = col;
                event.getDataTransfer().setData(
                        "Text",
                        (table != null ? "grid-section-" + table.hashCode() : "not leaf") + "; column-" + (DraggedColumn.instance.isMove() ? "moved" : "resized")
                                + (table != null ? ":" + table.getColumnIndex(column) : ""));
            } else {
                event.getDataTransfer().<XDataTransfer> cast().setEffectAllowed("none");
            }
        }
    }
    super.onBrowserEvent(context, targetCell, event);
}
项目:avro-ui    文件:AbstractSelectionCell.java   
@SuppressWarnings("unchecked")
@Override
public void onBrowserEvent(Context context, Element parent, T value,
        NativeEvent event, ValueUpdater<T> valueUpdater) {
    super.onBrowserEvent(context, parent, value, event, valueUpdater);
    String type = event.getType();
    if (BrowserEvents.CHANGE.equals(type)) {
        Object key = context.getKey();
        SelectElement select = parent.getFirstChild().cast();
        T newValue = getValueAtIndex((K) key, select.getSelectedIndex());
        setViewData(key, newValue);
        finishEditing(parent, newValue, key, valueUpdater);
        if (valueUpdater != null) {
            valueUpdater.update(newValue);
        }
    }
}
项目:avro-ui    文件:ValueSelectionCell.java   
@Override
public void onBrowserEvent(Context context, Element parent, T value,
    NativeEvent event, ValueUpdater<T> valueUpdater) {
  super.onBrowserEvent(context, parent, value, event, valueUpdater);
  String type = event.getType();
  if (BrowserEvents.CHANGE.equals(type)) {
    Object key = context.getKey();
    SelectElement select = parent.getFirstChild().cast();
    T newValue = options.get(select.getSelectedIndex());
    //setViewData(key, newValue);
    finishEditing(parent, newValue, key, valueUpdater);
    if (valueUpdater != null) {
      valueUpdater.update(newValue);
    }
  }
}
项目:consulo    文件:CellBrowser.java   
@Override
protected void onBrowserEvent2(Event event) {
  super.onBrowserEvent2(event);

  // Handle keyboard navigation between lists.
  String eventType = event.getType();
  if (BrowserEvents.KEYDOWN.equals(eventType) && !isKeyboardNavigationSuppressed()) {
    int keyCode = event.getKeyCode();
    boolean isRtl = LocaleInfo.getCurrentLocale().isRTL();
    keyCode = KeyCodes.maybeSwapArrowKeysForRtl(keyCode, isRtl);
    switch (keyCode) {
      case KeyCodes.KEY_LEFT:
        keyboardNavigateShallow();
        return;
      case KeyCodes.KEY_RIGHT:
        keyboardNavigateDeep();
        return;
    }
  }
}
项目:jbpm-data-modeler    文件:DynamicSelectionCell.java   
@Override
public void onBrowserEvent(Context context, Element parent, String value,
                           NativeEvent event, ValueUpdater<String> valueUpdater) {
    super.onBrowserEvent(context, parent, value, event, valueUpdater);
    String type = event.getType();
    if (BrowserEvents.CHANGE.equals(type)) {
        Object key = context.getKey();
        SelectElement select = parent.getFirstChild().cast();
        String newValue = options.get(select.getSelectedIndex());
        setViewData(key, newValue);
        finishEditing(parent, newValue, key, valueUpdater);
        if (valueUpdater != null) {
            valueUpdater.update(newValue);
        }
    }
}
项目:gwt-material-table    文件:AbstractDataTable.java   
@Override
public void onBrowserEvent(Event event) {
    CellBasedWidgetImpl.get().onBrowserEvent(this, event);

    // Ignore spurious events (such as onblur) while we refresh the table.
    if (refreshing) {
        return;
    }

    // Verify that the target is still a child of this widget. IE fires focus
    // events even after the element has been removed from the DOM.
    EventTarget eventTarget = event.getEventTarget();
    if (!Element.is(eventTarget)) {
        return;
    }
    Element target = Element.as(eventTarget);
    if (!getElement().isOrHasChild(Element.as(eventTarget))) {
        return;
    }
    super.onBrowserEvent(event);

    String eventType = event.getType();
    if (BrowserEvents.FOCUS.equals(eventType)) {
        // Remember the focus state.
        focused = true;
        onFocus();
    } else if (BrowserEvents.BLUR.equals(eventType)) {
        // Remember the blur state.
        focused = false;
        onBlur();
    } else if (BrowserEvents.KEYDOWN.equals(eventType)) {
        // A key event indicates that we already have focus.
        focused = true;
    } else if (BrowserEvents.MOUSEDOWN.equals(eventType)
            && CellBasedWidgetImpl.get().isFocusable(Element.as(target))) {
        // If a natively focusable element was just clicked, then we must have
        // focus.
        focused = true;
    }
}
项目:wte4j    文件:PopupCell.java   
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());
    }
    consumedEvents.add(BrowserEvents.CLICK);

}
项目:wte4j    文件:PopupCell.java   
@Override
public void onBrowserEvent(Cell.Context context, Element parent, T value,
        NativeEvent event, ValueUpdater<T> valueUpdater) {
    contentCell.onBrowserEvent(context, parent, value, event, valueUpdater);
    EventTarget eventTarget = event.getEventTarget();
    if (!BrowserEvents.CLICK.equals(event.getType())) {
        return;
    }
    final Element domElement = Element.as(eventTarget);
    popupPanel.setPopupPositionAndShow(new PositionCallback() {
        @Override
        public void setPosition(int offsetWidth, int offsetHeight) {

            int positionLeft = domElement.getAbsoluteLeft();
            int outerleft = domElement.getAbsoluteLeft() + popupPanel.getOffsetWidth();
            if (outerleft > Window.getClientWidth()) {
                positionLeft = domElement.getAbsoluteLeft() - popupPanel.getOffsetWidth() + domElement.getOffsetWidth();
            }

            int positionTop = domElement.getAbsoluteTop();
            int outerTop = domElement.getAbsoluteTop() + popupPanel.getOffsetWidth();
            if (outerTop > Window.getClientHeight()) {
                positionTop = domElement.getAbsoluteTop() - popupPanel.getOffsetHeight() + domElement.getOffsetHeight();
            }
            popupPanel.setPopupPosition(positionLeft, positionTop);
        }
    });
}
项目:gwt-material    文件:MaterialWidgetTestCase.java   
public void fireGestureStartEvent(HasHandlers widget) {
    DomEvent.fireNativeEvent(Document.get().createHtmlEvent(BrowserEvents.GESTURESTART, false, false), widget);
}
项目:gwt-material    文件:MaterialWidgetTestCase.java   
public void fireGestureChangeEvent(HasHandlers widget) {
    DomEvent.fireNativeEvent(Document.get().createHtmlEvent(BrowserEvents.GESTURECHANGE, false, false), widget);
}
项目:gwt-material    文件:MaterialWidgetTestCase.java   
public void fireGestureEndEvent(HasHandlers widget) {
    DomEvent.fireNativeEvent(Document.get().createHtmlEvent(BrowserEvents.GESTUREEND, false, false), widget);
}
项目:gwt-material    文件:MaterialWidgetTestCase.java   
public void fireTouchCancelEvent(HasHandlers widget) {
    DomEvent.fireNativeEvent(Document.get().createHtmlEvent(BrowserEvents.TOUCHCANCEL, false, false), widget);
}
项目:platypus-js    文件:RenderedEditorCell.java   
public void onBrowserEvent(Cell.Context context, Element parent, T value, NativeEvent event, ValueUpdater<T> valueUpdater) {
    if (readonly == null || !readonly.isReadonly()) {
        if (!isEditing(context, parent, value)) {
            String type = event.getType();
            int keyCode = event.getKeyCode();
            boolean editToggleKeys = BrowserEvents.KEYDOWN.equals(type) && (keyCode == KeyCodes.KEY_ENTER || keyCode == KeyCodes.KEY_F2);
            if (BrowserEvents.DBLCLICK.equals(type) || editToggleKeys) {
                // Switch to edit mode.
                ViewData<T> viewData = new ViewData<>(Document.get().createUniqueId(), valueUpdater);
                setViewData(context.getKey(), viewData);
                setValue(new RenderedCellContext(context.getIndex(), context.getColumn(), context.getKey()), parent, value);
            }
        }
    }
}
项目:platypus-js    文件:TreeExpandableCell.java   
@Override
public Set<String> getConsumedEvents() {
    if (visible) {
        if (treeProvider != null) {
            Set<String> consumed = new HashSet<>();
            consumed.addAll(cell.getConsumedEvents());
            consumed.add(BrowserEvents.MOUSEDOWN);
            return consumed;
        } else {
            return cell.getConsumedEvents();
        }
    } else {
        return null;
    }
}
项目:platypus-js    文件:CheckBoxesEventTranslator.java   
protected boolean checkBoxClick(CellPreviewEvent<T> event) {
    NativeEvent nativeEvent = event.getNativeEvent();
    if (BrowserEvents.CLICK.equals(nativeEvent.getType())) {
        if(event.getDisplay() instanceof CellTable<?>){
            CellTable<T> table = (CellTable<T>)event.getDisplay();
            if(table.getColumn(event.getColumn()) instanceof CheckServiceColumn){
                return true;
            }
        }
    }
    return false;
}
项目:avro-ui    文件:FilterTextInputCell.java   
public FilterTextInputCell(double width, Unit widthUnit) {
  super(BrowserEvents.BLUR, BrowserEvents.CHANGE, BrowserEvents.KEYUP, PASTE);
  if (template == null) {
    template = GWT.create(Template.class);
  }
  if (width > 0) {
      inputStyle = SafeStylesUtils.forWidth(width, widthUnit);
  }
}
项目:avro-ui    文件:FilterTextInputCell.java   
@Override
public void onBrowserEvent(Context context, Element parent, String value,
    NativeEvent event, ValueUpdater<String> valueUpdater) {

  super.onBrowserEvent(context, parent, value, event, valueUpdater);

  // Ignore events that don't target the input.
  InputElement input = getInputElement(parent);
  Element target = event.getEventTarget().cast();
  if (!input.isOrHasChild(target)) {
    return;
  }

  String eventType = event.getType();
  Object key = context.getKey();
  if (BrowserEvents.BLUR.equals(eventType)) {
    finishEditing(parent, value, key, valueUpdater);
  } else if (BrowserEvents.CHANGE.equals(eventType) || 
          BrowserEvents.KEYUP.equals(eventType) ||
          PASTE.equals(eventType)) {
    ViewData vd = getViewData(key);
    if (vd == null) {
      vd = new ViewData(value);
      setViewData(key, vd);
    }

    String newValue = input.getValue();

    vd.setCurrentValue(input.getValue());

    if (valueUpdater != null && !vd.getCurrentValue().equals(vd.getLastValue())) {
        vd.setLastValue(newValue);
        valueUpdater.update(newValue);
    }
  }
}
项目:avro-ui    文件:AbstractSelectionCell.java   
public AbstractSelectionCell(Renderer<T> renderer) {
    super(BrowserEvents.CHANGE);
    if (template == null) {
        template = GWT.create(Template.class);
    }
    this.renderer = renderer;
}
项目:avro-ui    文件:ValueSelectionCell.java   
/**
 * Construct a new {@link ValueSelectionCell} with the specified options.
 *
 * @param options the options in the cell
 * @param renderer the renderer to render options in the cell
 */
public ValueSelectionCell(List<T> options, Renderer<T> renderer) {
  super(BrowserEvents.CHANGE);
  if (template == null) {
    template = GWT.create(Template.class);
  }
  this.options = new ArrayList<T>(options);
  this.renderer = renderer;
  int index = 0;
  for (T option : options) {
    indexForOption.put(option, index++);
  }
}
项目:gwtutil    文件:ReadonlyCheckboxColumn.java   
@Override
public void onBrowserEvent(Context context, Element elem, T object, NativeEvent event) {
    if (BrowserEvents.CHANGE.equals(event.getType())) {
        InputElement input = elem.getFirstChild().cast();
        input.setChecked(!input.isChecked());
    }
}
项目:vograbulary    文件:StudentChooserPresenter.java   
public StudentChooserPresenter(GwtPreferences preferences) {
    this.preferences = preferences;
    initWidget(uiBinder.createAndBindUi(this));
    TextCell textCell = new TextCell();
    studentList = new CellList<String>(textCell);
    selectionModel = new MultiSelectionModel<>();
    studentList.addCellPreviewHandler(new Handler<String>() {
        @Override
        public void onCellPreview(CellPreviewEvent<String> event) {
            if (BrowserEvents.CLICK.equals(event.getNativeEvent().getType())) {
                boolean isSelected = selectionModel.isSelected(event.getValue());
                selectionModel.setSelected(event.getValue(), ! isSelected);
                event.setCanceled(true);
            }
        }
    });
    DefaultSelectionEventManager<String> selectionManager =
            DefaultSelectionEventManager.createCheckboxManager();
    studentList.setSelectionModel(selectionModel, selectionManager);
    studentPanel.add(studentList);
    studentList.setRowData(preferences.getStudentNames());
    setListBoxValue(
            wordLength,
            preferences.getUltraghostMinimumWordLength());
    setListBoxValue(
            vocabularySize,
            preferences.getComputerStudentVocabularySize());
}
项目:kie-wb-common    文件:CheckboxCell.java   
@Override
public void onBrowserEvent( final Context context,
                            final Element parent,
                            final Boolean value,
                            final NativeEvent event,
                            final ValueUpdater<Boolean> valueUpdater ) {
    String type = event.getType();

    boolean enterPressed = BrowserEvents.KEYDOWN.equals( type )
            && event.getKeyCode() == KeyCodes.KEY_ENTER;
    if ( BrowserEvents.CHANGE.equals( type ) || enterPressed ) {
        InputElement input = parent.getFirstChild().cast();
        Boolean isChecked = input.isChecked();

        // Toggle the value if the enter key was pressed and the cell handles
        // selection or doesn't depend on selection. If the cell depends on
        // selection but doesn't handle selection, then ignore the enter key and
        // let the SelectionEventManager determine which keys will trigger a
        // change.
        if ( enterPressed && ( handlesSelection() || !dependsOnSelection() ) ) {
            isChecked = !isChecked;
            input.setChecked( isChecked );
        }

        // Save the new value. However, if the cell depends on the selection, then
        // do not save the value because we can get into an inconsistent state.
        if ( value != isChecked && !dependsOnSelection() ) {
            setViewData( context.getKey(), isChecked );
        } else {
            clearViewData( context.getKey() );
        }

        if ( valueUpdater != null ) {
            valueUpdater.update( isChecked );
        }
    }
}
项目:consulo    文件:GwtTreeCell.java   
@Override
public void onBrowserEvent(Context context, Element parent, TreeState.TreeNodeState value, NativeEvent event, ValueUpdater<TreeState.TreeNodeState> valueUpdater) {
  String type = event.getType();

  if (type.equals(BrowserEvents.DBLCLICK)) {

    myCellTree.getTreeViewModel().getDoubleClickHandler().accept(value);
  }
  else {
    super.onBrowserEvent(context, parent, value, event, valueUpdater);
  }
}
项目:jbpm-data-modeler    文件:DynamicSelectionCell.java   
/**
 * Construct a new {@link DynamicSelectionCell} with the specified options.
 *
 * @param options the options in the cell
 */
public DynamicSelectionCell(List<String> options) {
    super(BrowserEvents.CHANGE);
    if (template == null) {
        template = GWT.create(Template.class);
    }
    this.options = new ArrayList<String>(options);
    int index = 0;
    for (String option : options) {
        indexForOption.put(option, index++);
    }
}
项目:tree-grid    文件:NavigationExtensionConnector.java   
@Override
protected void extend(ServerConnector target) {
    final TreeGrid grid = getParent().getWidget();

    grid.addBrowserEventHandler(5, new GridEventHandler<JsonObject>() {
        @Override
        public void onEvent(Grid.GridEvent<JsonObject> event) {
            if (event.isHandled()) {
                return;
            }

            Event domEvent = event.getDomEvent();

            if (domEvent.getType().equals(BrowserEvents.KEYDOWN)) {

                // Navigate within hierarchy with ALT/OPTION + ARROW KEY when hierarchy column is selected
                if (isHierarchyColumn(event.getCell()) && domEvent.getAltKey() && (
                        domEvent.getKeyCode() == KeyCodes.KEY_LEFT
                                || domEvent.getKeyCode() == KeyCodes.KEY_RIGHT)) {

                    // Hierarchy metadata
                    boolean collapsed, leaf;
                    int depth, parentIndex;
                    if (event.getCell().getRow().hasKey(GridState.JSONKEY_ROWDESCRIPTION)) {
                        JsonObject rowDescription = event.getCell().getRow()
                                .getObject(GridState.JSONKEY_ROWDESCRIPTION);
                        collapsed = rowDescription.getBoolean("collapsed");
                        leaf = rowDescription.getBoolean("leaf");
                        depth = (int) rowDescription.getNumber("depth");
                        parentIndex = (int) rowDescription.getNumber("parentIndex");

                        switch (domEvent.getKeyCode()) {
                        case KeyCodes.KEY_RIGHT:
                            if (!leaf) {
                                if (collapsed) {
                                    toggleCollapse(getParent().getRowKey(event.getCell().getRow()));
                                } else {
                                    // Focus on next row
                                    grid.focusCell(event.getCell().getRowIndex() + 1,
                                            event.getCell().getColumnIndex());
                                }
                            }
                            break;
                        case KeyCodes.KEY_LEFT:
                            if (!collapsed) {
                                // collapse node
                                toggleCollapse(getParent().getRowKey(event.getCell().getRow()));
                            } else if (depth > 0) {
                                // jump to parent
                                grid.focusCell(parentIndex, event.getCell().getColumnIndex());
                            }
                            break;
                        }
                    }
                    event.setHandled(true);
                    return;
                }
            }
            event.setHandled(false);
        }
    });
}
项目:listmaker    文件:NotesTable.java   
public Set<String> getConsumedEvents() {
    HashSet<String> events = new HashSet<String>();
    events.add(BrowserEvents.CLICK);
    return events;
}
项目:gwt-material    文件:MaterialWidgetTestCase.java   
public void fireTouchStartEvent(HasHandlers widget) {
    DomEvent.fireNativeEvent(Document.get().createHtmlEvent(BrowserEvents.TOUCHSTART, false, false), widget);
}
项目:gwt-material    文件:MaterialWidgetTestCase.java   
public void fireTouchMoveEvent(HasHandlers widget) {
    DomEvent.fireNativeEvent(Document.get().createHtmlEvent(BrowserEvents.TOUCHMOVE, false, false), widget);
}
项目:gwt-material    文件:MaterialWidgetTestCase.java   
public void fireTouchEndEvent(HasHandlers widget) {
    DomEvent.fireNativeEvent(Document.get().createHtmlEvent(BrowserEvents.TOUCHEND, false, false), widget);
}
项目:blogwt    文件:ResourcePreviewCell.java   
public ResourcePreviewCell () {
    super(BrowserEvents.CLICK);
}
项目:platypus-js    文件:CheckBoxCell.java   
public CheckBoxCell(String aGroupName) {
    super(BrowserEvents.CLICK, BrowserEvents.CHANGE, BrowserEvents.KEYDOWN);
    groupName = aGroupName;
}
项目:platypus-js    文件:CheckBoxCell.java   
@Override
public void onBrowserEvent(Context context, Element parent, Object value, NativeEvent event, ValueUpdater<Object> valueUpdater) {
    String type = event.getType();

    boolean enterPressed = (BrowserEvents.KEYDOWN.equals(type) && event.getKeyCode() == KeyCodes.KEY_ENTER);
    /* 
     * Crazy browsers fire click and change events in different order.
     * FireFox issues a click event first and then change event.
     * Than we have an issue with selection re-rendering and 'change' event never fired,
     * because of mark-up replacement while grid rendering.
     */ 
    if (BrowserEvents.CLICK.equals(type) || BrowserEvents.CHANGE.equals(type) || enterPressed) {
        InputElement input = parent.<XElement>cast().firstChildByTagName("input").cast();
        Boolean isChecked = input.isChecked();

        /*
         * Toggle the value if the enter key was pressed and the cell
         * handles selection or doesn't depend on selection. If the cell
         * depends on selection but doesn't handle selection, then ignore
         * the enter key and let the SelectionEventManager determine which
         * keys will trigger a change.
         */
        if (enterPressed && (handlesSelection() || !dependsOnSelection())) {
            isChecked = !isChecked;
            input.setChecked(isChecked);
        }

        /*
         * Save the new value. However, if the cell depends on the
         * selection, then do not save the value because we can get into an
         * inconsistent state.
         */
        if (value != isChecked && !dependsOnSelection()) {
            setViewData(context.getKey(), isChecked);
        } else {
            clearViewData(context.getKey());
        }

        if (valueUpdater != null) {
            valueUpdater.update(isChecked);
        }
    }
}
项目:platypus-js    文件:RenderedEditorCell.java   
public RenderedEditorCell(Widget aEditor) {
    super(aEditor, BrowserEvents.DBLCLICK, BrowserEvents.KEYDOWN, BrowserEvents.FOCUS, BrowserEvents.BLUR);
}
项目:platypus-js    文件:GridSection.java   
public GridSection(ProvidesKey<T> keyProvider) {
    super(15, ThemedGridResources.instance, keyProvider, null, true, false);
    setKeyboardPagingPolicy(HasKeyboardPagingPolicy.KeyboardPagingPolicy.CURRENT_PAGE);
    setLoadingIndicator(null);
    setEmptyTableWidget(null);
    getElement().getStyle().setProperty("borderCollapse", "collapse");
    setKeyboardSelectionHandler(new CellTableKeyboardSelectionHandler<T>(this) {

        @Override
        public void onCellPreview(CellPreviewEvent<T> event) {
            NativeEvent nativeEvent = event.getNativeEvent();
            String eventType = event.getNativeEvent().getType();
            if (BrowserEvents.KEYDOWN.equals(eventType) && !event.isCellEditing()) {
                /*
                 * Handle keyboard navigation, unless the cell is being
                 * edited. If the cell is being edited, we do not want to
                 * change rows.
                 * 
                 * Prevent default on navigation events to prevent default
                 * scrollbar behavior.
                 */
                int oldRow = GridSection.this.getKeyboardSelectedRow();
                int oldColumn = GridSection.this.getKeyboardSelectedColumn();
                boolean isRtl = LocaleInfo.getCurrentLocale().isRTL();
                int keyCodeLineEnd = isRtl ? KeyCodes.KEY_LEFT : KeyCodes.KEY_RIGHT;
                int keyCodeLineStart = isRtl ? KeyCodes.KEY_RIGHT : KeyCodes.KEY_LEFT;
                int keyCode = nativeEvent.getKeyCode();
                super.onCellPreview(event);
                if (keyCode == keyCodeLineEnd) {
                    GridSection.this.setKeyboardSelectedRow(oldRow);
                    if (GridSection.this.getKeyboardSelectedColumn() < oldColumn)
                        GridSection.this.setKeyboardSelectedColumn(oldColumn);
                } else if (keyCode == keyCodeLineStart) {
                    GridSection.this.setKeyboardSelectedRow(oldRow);
                    if (GridSection.this.getKeyboardSelectedColumn() > oldColumn)
                        GridSection.this.setKeyboardSelectedColumn(oldColumn);
                }
            } else
                super.onCellPreview(event);
        }
    });
}
项目:platypus-js    文件:DraggableHeader.java   
public HeaderCell() {
    super(BrowserEvents.DRAGSTART);
}
项目:avro-ui    文件:StringFilterHeader.java   
public static boolean isFilterFocusEvent(String eventType) {
    return BrowserEvents.CHANGE.equals(eventType) || 
            BrowserEvents.KEYUP.equals(eventType) ||
            BrowserEvents.KEYDOWN.equals(eventType) ||
            FilterTextInputCell.PASTE.equals(eventType);
}
项目:ineform    文件:DisableAbleCheckboxCell.java   
@Override
public void onBrowserEvent(
    Context context,
    Element parent,
    CheckedAndDisabled value,
    NativeEvent event,
    ValueUpdater<CheckedAndDisabled> valueUpdater) {
    String type = event.getType();

    boolean enterPressed = BrowserEvents.KEYDOWN.equals(type)
        && event.getKeyCode() == KeyCodes.KEY_ENTER;
    if (BrowserEvents.CHANGE.equals(type) || enterPressed) {
        InputElement input = parent.getFirstChild().cast();
        Boolean isChecked = input.isChecked();

        /*
         * Toggle the value if the enter key was pressed and the cell
         * handles selection or doesn't depend on selection. If the cell
         * depends on selection but doesn't handle selection, then ignore
         * the enter key and let the SelectionEventManager determine which
         * keys will trigger a change.
         */
        if (enterPressed && (handlesSelection() || !dependsOnSelection())) {
            isChecked = !isChecked;
            input.setChecked(isChecked);
        }

        /*
         * Save the new value. However, if the cell depends on the
         * selection, then do not save the value because we can get into an
         * inconsistent state.
         */
        if (value.getChecked() != isChecked && !dependsOnSelection()) {
            value.setChecked(isChecked);
            setViewData(context.getKey(), value);
        } else {
            clearViewData(context.getKey());
        }

        if (valueUpdater != null) {
            valueUpdater.update(value);
        }
    }
}
项目:kie-wb-common    文件:CheckboxCell.java   
/**
 * Construct a new {@link org.guvnor.common.services.project.client.repositories.CheckboxCell}.
 */
public CheckboxCell() {
    super( BrowserEvents.CHANGE,
           BrowserEvents.KEYDOWN );
}