Example #1
0
    public void onKeyDown(KeyDownEvent e) {

      // stopping propagation is needed to prevent duplicate events
      e.stopPropagation();

      checkCursorKeys(e);
      int keyCode = e.getNativeKeyCode();

      switch (keyCode) {
        case KeyCodes.KEY_ESCAPE:
          e.preventDefault();
          GeoElement oldGeo = kernel.getGeoAt(column, row);
          cancelCellEditing();

          // restore old text in spreadsheet
          table.getModel().setValueAt(oldGeo, row, column);

          // stopCellEditing(0,0);
          // force nice redraw
          table.setSelection(column, row);

          // update the formula bar after escape
          // ?//table.getView().updateFormulaBar();

          break;
      }
    }
Example #2
0
    public void onKeyDown(KeyDownEvent event) {
      if (event.getSource() == input_) return;

      // Filter out some keystrokes you might reasonably expect to keep
      // focus inside the output pane
      switch (event.getNativeKeyCode()) {
        case KeyCodes.KEY_PAGEDOWN:
        case KeyCodes.KEY_PAGEUP:
        case KeyCodes.KEY_HOME:
        case KeyCodes.KEY_END:
        case KeyCodes.KEY_CTRL:
        case KeyCodes.KEY_ALT:
        case KeyCodes.KEY_SHIFT:
        case 224: // META (Command) on Firefox/Mac
          return;
        case 91:
        case 93: // Left/Right META (Command), but also [ and ], on Safari
          if (event.isMetaKeyDown()) return;
          break;
        case 'C':
          if (event.isControlKeyDown() || event.isMetaKeyDown()) return;
          break;
      }
      input_.setFocus(true);
      delegateEvent(input_.asWidget(), event);
    }
Example #3
0
 @Override
 public void onKeyDown(KeyDownEvent event) {
   if (event.isLeftArrow()) {
     navigateLeft();
   } else if (event.isRightArrow()) {
     navigateRight();
   }
 }
Example #4
0
  private void handleKeyDown(KeyDownEvent event) {
    int modifiers = KeyboardShortcut.getModifierValue(event.getNativeEvent());
    switch (event.getNativeKeyCode()) {
      case KeyCodes.KEY_UP:
      case KeyCodes.KEY_DOWN:
        break;
      default:
        return;
    }

    if (!allowMultiSelect_) modifiers = KeyboardShortcut.NONE;

    event.preventDefault();
    event.stopPropagation();

    switch (modifiers) {
      case 0:
      case KeyboardShortcut.SHIFT:
        break;
      default:
        return;
    }

    sortSelectedRows();
    int min = table_.getRows().getLength();
    int max = -1;
    if (selectedRows_.size() > 0) {
      min = selectedRows_.get(0).getRowIndex();
      max = selectedRows_.get(selectedRows_.size() - 1).getRowIndex();
    }

    switch (event.getNativeKeyCode()) {
      case KeyCodes.KEY_UP:
        {
          Integer row = findNextValueRow(min, true);
          if (row != null) {
            if (modifiers != KeyboardShortcut.SHIFT) clearSelection();
            setSelectedPhysical(row, 1, true);
            ensureRowVisible(row);
          }
          break;
        }
      case KeyCodes.KEY_DOWN:
        {
          Integer row = findNextValueRow(max, false);
          if (row != null) {
            if (modifiers != KeyboardShortcut.SHIFT) clearSelection();
            setSelectedPhysical(row, 1, true);
            ensureRowVisible(row);
          }
          break;
        }
    }
  }
Example #5
0
 @Override
 public void onKeyDown(KeyDownEvent event) {
   if (shortcutHandler != null) {
     shortcutHandler.handleKeyboardEvent(Event.as(event.getNativeEvent()));
     return;
   }
 }
  @Override
  public void onKeyDown(KeyDownEvent event) {
    switch (event.getNativeEvent().getKeyCode()) {
      case 38: /*up*/
      case 87: /*W*/
        this.moveForward = true;
        break;

      case 37: /*left*/
      case 65: /*A*/
        this.moveLeft = true;
        break;

      case 40: /*down*/
      case 83: /*S*/
        this.moveBackward = true;
        break;

      case 39: /*right*/
      case 68: /*D*/
        this.moveRight = true;
        break;

      case 82: /*R*/
        this.moveUp = true;
        break;
      case 70: /*F*/
        this.moveDown = true;
        break;

      case 81: /*Q*/
        this.freeze = !this.freeze;
        break;
    }
  }
Example #7
0
 public void onModuleLoad() {
   RootPanel root = RootPanel.get();
   root.add(view);
   root.addDomHandler(view, KeyDownEvent.getType());
   controller.initAndStartWith(clock);
   view.initAndRender();
 }
 @Override
 public void onKeyDown(KeyDownEvent event) {
   ignoreNextKeyPress = true;
   Event nativeEvent = (Event) event.getNativeEvent();
   if (!nativeEvent.isCancelled()) {
     handleRepeatableKey(nativeEvent);
   }
   cancelNextKeyPress = nativeEvent.isCancelled();
 }
 @Override
 public void onKeyDown(KeyDownEvent event) {
   int key = event.getNativeKeyCode();
   if (event.isControlKeyDown()) {
     if (key == KEY_PLUS || key == KEY_MINUS) {
       app.getToolbar().zoomChangeClicked(key == KEY_PLUS ? 1 : -1);
       event.preventDefault();
     }
   } else if (!event.isShiftKeyDown()) {
     boolean handled = true;
     switch (key) {
       case KeyCodes.KEY_UP:
         if (!tryPan(0, -PAN_STEP)) changePage(page - 1, 0, 1);
         break;
       case KeyCodes.KEY_DOWN:
         if (!tryPan(0, PAN_STEP)) changePage(page + 1, 0, -1);
         break;
       case KeyCodes.KEY_LEFT:
         if (!tryPan(-PAN_STEP, 0)) changePage(page - 1, 1, 0);
         break;
       case KeyCodes.KEY_RIGHT:
         if (!tryPan(PAN_STEP, 0)) changePage(page + 1, -1, 0);
         break;
       case KeyCodes.KEY_PAGEUP:
         if (!tryPan(0, -canvas.getCoordinateSpaceHeight() + PAN_STEP))
           changePage(page - 1, 0, 1);
         break;
       case KeyCodes.KEY_PAGEDOWN:
       case KeyCodes.KEY_SPACE:
         if (!tryPan(0, canvas.getCoordinateSpaceHeight() - PAN_STEP))
           changePage(page + 1, 0, -1);
         break;
       case KeyCodes.KEY_HOME:
         changePage(0, -1, -1);
         break;
       case KeyCodes.KEY_END:
         changePage(app.getPageCache().getPageCount() - 1, 1, 1);
         break;
       default:
         handled = false;
     }
     if (handled) event.preventDefault();
   }
 }
Example #10
0
 /**
  * The onKeyDown method handles all keys that are held down, before KeyUp and KeyPress events are
  * triggered.
  */
 @Override
 public void onKeyDown(KeyDownEvent event) {
   code = new Code(event);
   if (!code.isControlKey()) {
     if (code.isFunctionKey() || code.isCtrlDown() || code.isAltDown()) {
       processCode(code);
       event.getNativeEvent().stopPropagation();
       event.getNativeEvent().preventDefault();
     }
   }
 }
    public PanController() {
      super(canvas);
      canvas.addMouseWheelHandler(this);
      canvas.addKeyDownHandler(this);
      canvas.setFocus(true);

      TextLayer textLayer = app.getTextLayer();
      if (textLayer != null) {
        textLayer.addDomHandler(this, MouseWheelEvent.getType());
        textLayer.addDomHandler(this, KeyDownEvent.getType());
      }

      app.getHorizontalScrollbar().addScrollPanListener(this);
      app.getVerticalScrollbar().addScrollPanListener(this);
    }
Example #12
0
  /** Displays a {@link RunInfoDialogBox}. */
  public RunInfoDialogBox(DataManager data) {

    super(true); // autohide
    this.setModal(true);
    this.setStyleName("wmt-DialogBox");
    this.setText("Model Run Information");
    this.data = data;

    VerticalPanel contents = new VerticalPanel();
    contents.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    contents.setWidth("30em");
    contents.getElement().getStyle().setMargin(1.0, Unit.EM);

    String msg = "<h2>Congratulations!</h2><p>You have submitted your model run.</p>";
    HTML msgHtml = new HTML(msg);
    contents.add(msgHtml);

    choicePanel = new ChoicePanel();
    choicePanel.getOkButton().setHTML(Constants.FA_STATUS + "View run status...");
    choicePanel.getCancelButton().setHTML(Constants.FA_BEER + "Close");
    contents.add(choicePanel);

    this.setWidget(contents);

    /*
     * Hides the dialog box.
     */
    DialogCancelHandler cancelHandler = new DialogCancelHandler(this);
    choicePanel.getCancelButton().addClickHandler(cancelHandler);

    /*
     * Opens run status page in a new tab.
     */
    ClickHandler okHandler =
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            RunInfoDialogBox.this.hide();
            Window.open(
                DataURL.showCurrentModelRun(RunInfoDialogBox.this.data), "WMT_currentRun", null);
          }
        };
    choicePanel.getOkButton().addClickHandler(okHandler);

    // Apply standard handlers to "Enter" and "Esc" keys.
    choicePanel.addDomHandler(
        new ModalKeyHandler(okHandler, cancelHandler), KeyDownEvent.getType());
  }
Example #13
0
 public void onKeyDown(KeyDownEvent event) {
   if (enabled) {
     switch (event.getNativeKeyCode()) {
       case KeyCodes.KEY_ENTER:
       case KeyCodes.KEY_TAB:
         updateDateFromTextBox();
         // Deliberate fall through
       case KeyCodes.KEY_ESCAPE:
       case KeyCodes.KEY_UP:
         hideDatePicker();
         break;
       case KeyCodes.KEY_DOWN:
         showDatePicker();
         break;
     }
   }
 }
Example #14
0
 public CustomPopup() {
   super(true, false); // autoHide, not modal
   setOwner(VPopupView.this);
   // Delegate popup keyboard events to the relevant handler. The
   // events do not propagate automatically because the popup is
   // directly attached to the RootPanel.
   addDomHandler(
       new KeyDownHandler() {
         @Override
         public void onKeyDown(KeyDownEvent event) {
           if (shortcutActionHandler != null) {
             shortcutActionHandler.handleKeyboardEvent(Event.as(event.getNativeEvent()));
           }
         }
       },
       KeyDownEvent.getType());
 }
  public FirstPersonControls(Object3D object, Widget widget) {
    super(object, widget);

    this.viewHalfX = widget.getOffsetWidth() / 2;
    this.viewHalfY = widget.getOffsetHeight() / 2;

    if (getWidget().getClass() != RootPanel.class)
      getWidget().getElement().setAttribute("tabindex", "-1");

    this.target = new Vector3();

    getWidget().addDomHandler(this, ContextMenuEvent.getType());

    getWidget().addDomHandler(this, MouseMoveEvent.getType());
    getWidget().addDomHandler(this, MouseDownEvent.getType());
    getWidget().addDomHandler(this, MouseUpEvent.getType());
    RootPanel.get().addDomHandler(this, KeyDownEvent.getType());
    RootPanel.get().addDomHandler(this, KeyUpEvent.getType());
  }
Example #16
0
  @UiHandler("threePrimeField")
  public void threePrimeTextEntry(KeyDownEvent k) {
    if (k.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
      try {
        fivePrimeValue = Integer.parseInt(fivePrimeField.getText());
        threePrimeValue = Integer.parseInt(threePrimeField.getText());
      } catch (Exception error) {
        coordinatesToPrime(
            this.internalAnnotationInfo.getMin(), this.internalAnnotationInfo.getMax());
        return;
      }

      if (verifyOperation()) {
        triggerUpdate(fivePrimeValue, threePrimeValue);
      } else {
        coordinatesToPrime(
            this.internalAnnotationInfo.getMin(), this.internalAnnotationInfo.getMax());
      }
    }
  }
Example #17
0
  protected ModalDialogBase(SimplePanel containerPanel) {
    // core initialization. passing false for modal works around
    // modal PopupPanel supressing global keyboard accelerators (like
    // Ctrl-N or Ctrl-T). modality is achieved via setGlassEnabled(true)
    super(false, false);
    setGlassEnabled(true);
    addStyleDependentName("ModalDialog");

    // main panel used to host UI
    mainPanel_ = new VerticalPanel();
    bottomPanel_ = new HorizontalPanel();
    bottomPanel_.setStyleName(ThemeStyles.INSTANCE.dialogBottomPanel());
    bottomPanel_.setWidth("100%");
    buttonPanel_ = new HorizontalPanel();
    leftButtonPanel_ = new HorizontalPanel();
    bottomPanel_.add(leftButtonPanel_);
    bottomPanel_.add(buttonPanel_);
    setButtonAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    mainPanel_.add(bottomPanel_);

    // embed main panel in a custom container if specified
    containerPanel_ = containerPanel;
    if (containerPanel_ != null) {
      containerPanel_.setWidget(mainPanel_);
      setWidget(containerPanel_);
    } else {
      setWidget(mainPanel_);
    }

    addDomHandler(
        new KeyDownHandler() {
          public void onKeyDown(KeyDownEvent event) {
            // Is this too aggressive? Alternatively we could only filter out
            // keycodes that are known to be problematic (pgup/pgdown)
            event.stopPropagation();
          }
        },
        KeyDownEvent.getType());
  }
Example #18
0
    public void checkCursorKeys(KeyDownEvent e) {

      String text = autoCompleteTextField.getText(); // ?// (String)
      // delegate.getCellEditorValue();

      int keyCode = e.getNativeKeyCode();
      // Application.debug(e+"");
      switch (keyCode) {
        case KeyCodes.KEY_UP:
          if (isSuggesting()) {
            return;
          }
          if (isFormulaBarListener) return;

          // Application.debug("UP");
          stopCellEditing(0, -1, false);
          // ?//e.consume();
          tabReturnCol = -1;
          break;

        case KeyCodes.KEY_TAB:
          if (isFormulaBarListener) return;
          App.debug(" tab");
          // Application.debug("RIGHT");
          // shift-tab moves left
          // tab moves right
          if (tabReturnCol == -1) tabReturnCol = column;
          stopCellEditing(e.isShiftKeyDown() ? -1 : 1, 0, false);
          e.preventDefault();
          break;

        case KeyCodes.KEY_ENTER:
          if (isSuggesting()) {
            return;
          }

          // if incomplete command entered, want to move the cursor to
          // between []
          int bracketsIndex = text.indexOf("[]");
          if (bracketsIndex == -1) {

            if (tabReturnCol != -1) {
              int colOffset = tabReturnCol - column;
              stopCellEditing(colOffset, 1, true);
            } else {

              // TODO: in desktop this works with column, row + 1
              String cellBelowStr = GeoElementSpreadsheet.getSpreadsheetCellName(column, row + 1);
              GeoElement cellBelow = kernel.getConstruction().lookupLabel(cellBelowStr);

              boolean moveDown = cellBelow == null || !cellBelow.isFixed();

              // don't move down to cell below after <Enter> if it's
              // fixed
              stopCellEditing(0, moveDown ? 1 : 0, moveDown);
            }
          } else {
            autoCompleteTextField.setCaretPosition(bracketsIndex + 1);
            // ?//e.consume();
          }

          tabReturnCol = -1;
          break;

        case KeyCodes.KEY_DOWN:
          if (isSuggesting()) {
            return;
          }

          if (isFormulaBarListener) {
            // ?//e.consume();
            return;
          }
          // Application.debug("DOWN");
          stopCellEditing(0, 1, false);
          tabReturnCol = -1;
          break;

        case KeyCodes.KEY_LEFT:
          if (isFormulaBarListener) return;
          // Application.debug("LEFT");
          // Allow left/right keys to exit cell for easier data entry
          if (getCaretPosition() == 0) {
            stopCellEditing(-1, 0, false);
          }
          tabReturnCol = -1;
          break;

        case KeyCodes.KEY_RIGHT:
          if (isFormulaBarListener) return;
          // Application.debug("RIGHT");
          // Allow left/right keys to exit cell for easier data entry
          if (getCaretPosition() == text.length()) {
            stopCellEditing(1, 0, false);
          }

          tabReturnCol = -1;
          break;

        case KeyCodes.KEY_PAGEDOWN:
        case KeyCodes.KEY_PAGEUP:
          e.preventDefault();
          // ?//e.consume();
          tabReturnCol = -1;
          break;

          // An F1 keypress causes the focus to be lost, so we
          // need to set 'editing' to false to prevent the focusLost()
          // method from calling stopCellEditing()
          // ?//case KeyEvent.VK_F1:
          // ?// editing = false;
          // ?// break;

      }
    }
Example #19
0
 @Override
 public void onKeyDown(final KeyDownEvent event) {
   currentKeyModifiers.add(event.getNativeKeyCode());
 }
Example #20
0
    public void onKeyDown(KeyDownEvent event) {
      int keyCode = event.getNativeKeyCode();

      for (KeyDownPreviewHandler handler : keyDownPreviewHandlers_) {
        if (handler.previewKeyDown(event.getNativeEvent())) {
          event.preventDefault();
          event.stopPropagation();
          return;
        }
      }

      if (event.getNativeKeyCode() == KeyCodes.KEY_TAB) event.preventDefault();

      int modifiers = KeyboardShortcut.getModifierValue(event.getNativeEvent());

      if (event.isUpArrow() && modifiers == 0) {
        if ((input_.getCurrentLineNum() == 0) || input_.isCursorAtEnd()) {
          event.preventDefault();
          event.stopPropagation();

          navigateHistory(-1);
        }
      } else if (event.isDownArrow() && modifiers == 0) {
        if ((input_.getCurrentLineNum() == input_.getCurrentLineCount() - 1)
            || input_.isCursorAtEnd()) {
          event.preventDefault();
          event.stopPropagation();

          navigateHistory(1);
        }
      } else if (keyCode == KeyCodes.KEY_ENTER && modifiers == 0) {
        event.preventDefault();
        event.stopPropagation();

        restoreFocus_ = true;
        processCommandEntry();
      } else if (keyCode == KeyCodes.KEY_ESCAPE && modifiers == 0) {
        event.preventDefault();

        if (input_.getText().length() == 0) {
          // view_.isPromptEmpty() is to check for cases where the
          // server is prompting but not at the top level. Escape
          // needs to send null in those cases.
          // For example, try "scan()" function
          if (view_.isPromptEmpty()) {
            // interrupt server
            server_.interrupt(
                new VoidServerRequestCallback() {
                  @Override
                  public void onError(ServerError error) {
                    super.onError(error);
                    globalDisplay_.showErrorMessage(
                        "Error Interrupting Server", error.getUserMessage());
                  }
                });
          } else {
            // if the input is already empty then send a console reset
            // which will jump us back to the main prompt
            eventBus_.fireEvent(new ConsoleInputEvent(null));
          }
        }

        input_.clear();
      } else {
        int mod = KeyboardShortcut.getModifierValue(event.getNativeEvent());
        if (mod == KeyboardShortcut.CTRL) {
          switch (keyCode) {
            case 'L':
              Shell.this.onConsoleClear();
              event.preventDefault();
              break;
          }
        } else if (mod == KeyboardShortcut.ALT) {
          switch (keyCode) {
            case 189: // hyphen
              event.preventDefault();
              event.stopPropagation();
              input_.replaceSelection(" <- ", true);
              break;
          }
        } else if ((BrowseCap.hasMetaKey()
                && (mod == (KeyboardShortcut.META + KeyboardShortcut.SHIFT)))
            || (!BrowseCap.hasMetaKey()
                && (mod == (KeyboardShortcut.CTRL + KeyboardShortcut.SHIFT)))) {
          switch (keyCode) {
            case KeyCodes.KEY_M:
              event.preventDefault();
              event.stopPropagation();
              input_.replaceSelection(" %>% ", true);
              break;
          }
        }
      }
    }
  private SuggestCellTable<SearchSuggestion> getSuggestionCellList(
      final Collection<SearchSuggestion> suggestions,
      final SuggestBox suggestBox,
      final PopupPanel suggestionPopup) {

    this.suggestBox = suggestBox;
    this.suggestionPopup = suggestionPopup;

    // Create suggestions table
    final SuggestCellTable<SearchSuggestion> suggestionsTable =
        new SuggestCellTable<>(
            suggestions.size(), (Resources) GWT.create(SuggestionsTableResources.class));

    // Create table's column and add it to the table
    SearchSuggestionColumn<SearchSuggestion> suggestColumn =
        new SearchSuggestionColumn<SearchSuggestion>() {

          @Override
          public SearchSuggestion getValue(SearchSuggestion suggestion) {
            return suggestion;
          }
        };
    suggestionsTable.addColumn(suggestColumn);

    // Create a data provider and bind it to the table
    suggestionDataProvider = new ListDataProvider<>();
    suggestionDataProvider.addDataDisplay(suggestionsTable);

    // Add suggestions to data provider
    List<SearchSuggestion> list = suggestionDataProvider.getList();
    for (SearchSuggestion suggestion : suggestions) {
      list.add(suggestion);
    }

    // Bind a selection model it to the table
    suggestionsTable.setSelectionModel(new SingleSelectionModel<SearchSuggestion>());

    // Set table's properties
    suggestionsTable.setWidth("100%"); // $NON-NLS-1$
    suggestionsTable.setRowCount(suggestions.size());
    suggestionsTable.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.BOUND_TO_SELECTION);

    // Add enter key press event handler
    suggestionsTable.addDomHandler(
        new KeyDownHandler() {
          @Override
          public void onKeyDown(KeyDownEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
              onSelect();
            }

            if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
              hideSuggestions();
            }
          }
        },
        KeyDownEvent.getType());

    // Add click event handler
    suggestionsTable.addDomHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            onSelect();
          }
        },
        ClickEvent.getType());

    return suggestionsTable;
  }
Example #22
0
 @Override
 public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) {
   return peer.addHandler(handler, KeyDownEvent.getType());
 }
Example #23
0
 @Override
 public HandlerRegistration addKeyDownHandler(final KeyDownHandler handler) {
   return handlers.addHandler(KeyDownEvent.getType(), handler);
 }
Example #24
0
 @Override
 public void onKeyDown(KeyDownEvent event) {
   if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
     valueChange(false);
   }
 }
  /* (non-Javadoc)
   * @see com.google.gwt.event.dom.client.KeyDownHandler#onKeyDown(com.google.gwt.event.dom.client.KeyDownEvent)
   */
  @Override
  public void onKeyDown(KeyDownEvent event) {
    //		System.out.println(event.getNativeKeyCode());
    int keyCode = event.getNativeKeyCode();
    if (selectedNode != null) {
      short nodeType = selectedNode.getNodeType();
      if (event.isControlKeyDown()) {
        if (keyCode == ClauseConstants.COPY_C) { // COPY
          if ((nodeType != CellTreeNode.MASTER_ROOT_NODE) && (nodeType != CellTreeNode.ROOT_NODE)) {
            popupPanel.hide();
            copy();
          }

        } else if (keyCode == ClauseConstants.PASTE_V) { // PASTE
          boolean canPaste = false;
          popupPanel.hide();
          if (copiedNode != null) {
            switch (selectedNode.getNodeType()) {
              case CellTreeNode.ROOT_NODE:
                if (selectedNode.equals(copiedNode.getParent())) {
                  clauseWorkspaceContextMenu.pasteRootNodeTypeItem();
                  isDirty = true;
                }
                break;
              case CellTreeNode.LOGICAL_OP_NODE:
              case CellTreeNode.FUNCTIONS_NODE:
                if (copiedNode.getNodeType() != CellTreeNode.CLAUSE_NODE) {
                  canPaste = true;
                }
                break;
              case CellTreeNode.TIMING_NODE:
                if ((copiedNode.getNodeType() != CellTreeNode.CLAUSE_NODE)
                    && ((selectedNode.getChilds() == null)
                        || (selectedNode.getChilds().size() < 2))) {
                  canPaste = true;
                }
                break;
              default:
                break;
            }
            if (canPaste) {
              paste();
              isDirty = true;
            }
          }

        } else if (keyCode == ClauseConstants.CUT_X) { // CUT
          popupPanel.hide();
          if ((selectedNode.getNodeType() != CellTreeNode.MASTER_ROOT_NODE)
              && (selectedNode.getNodeType() != CellTreeNode.CLAUSE_NODE)
              && (selectedNode.getNodeType() != CellTreeNode.ROOT_NODE)
              && (selectedNode.getParent().getNodeType() != CellTreeNode.CLAUSE_NODE)) {
            copy();
            removeNode();
            isDirty = true;
          }
        }
      } else if (keyCode == ClauseConstants.DELETE_DELETE) { // DELETE
        popupPanel.hide();
        if (((selectedNode.getNodeType() != CellTreeNode.MASTER_ROOT_NODE)
                && (selectedNode.getNodeType() != CellTreeNode.ROOT_NODE)
                && (selectedNode.getParent().getNodeType() != CellTreeNode.CLAUSE_NODE)
                && (selectedNode.getNodeType() != CellTreeNode.CLAUSE_NODE))
            || ((selectedNode.getNodeType() == CellTreeNode.CLAUSE_NODE)
                && (selectedNode.getParent().getChilds().size() > 1))) {
          removeNode();
          isDirty = true;
        }
      }
    }
    if ((event.isShiftKeyDown()
        && ((keyCode == ClauseConstants.PLUS_FF) || (keyCode == ClauseConstants.PLUS_IE)))) {
      // EXPAND/COLLAPSE (+(Shift +) Expand| - Collapse)
      popupPanel.hide();
      openAllNodes(cellTree.getRootTreeNode());
    } else if ((event.isShiftKeyDown()
        && ((keyCode == ClauseConstants.MINUS_FF) || (keyCode == ClauseConstants.MINUS_IE)))) {
      popupPanel.hide();
      closeNodes(cellTree.getRootTreeNode());
    }
    /*if(event.isControlKeyDown() && event.isAltKeyDown() && keyCode == 83){
    	saveBtn.getElement().focus();
    	saveBtn.click();
    }*/
  }
 public void onKeyDown(KeyDownEvent event) {
   int keycode = event.getNativeEvent().getKeyCode();
   if (keycode == KeyCodes.KEY_ESCAPE && mouseMoveStarted) {
     cancelMouseMove();
   }
 }
 @UiHandler({"searchTextBox"})
 void onSearchTextBoxKeyDown(KeyDownEvent event) {
   if (event.getNativeKeyCode() == 13) {
     startSearch();
   }
 }
 @Override
 public HandlerRegistration addKeyDownHandler(final KeyDownHandler handler) {
   return gridPanel.addDomHandler(handler, KeyDownEvent.getType());
 }
 private void setKeyPressHandler() {
   this.addDomHandler(getEnterDomHandler(), KeyDownEvent.getType());
 }
Example #30
0
 public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) {
   return addDomHandler(handler, KeyDownEvent.getType());
 }