Exemplo n.º 1
0
 public void onClick(ClickEvent e) {
   Element target = e.getNativeEvent().getEventTarget().cast();
   boolean isEditing = assignmentsTable.isVisible();
   if (target == btApply.getElement()) {
     if (isEditing) {
       hide();
       app.getActiveEuclidianView().requestFocusInWindow();
       app.storeUndoInfo();
       app.getKernel().notifyRepaint();
     } else {
       assignmentsTable.setVisible(true);
       checkAssignmentsTable.setVisible(false);
       btTest.setText(app.getPlain("Test"));
       btApply.setText(app.getPlain("OK"));
       hide();
       setGlassEnabled(true);
       center();
     }
   } else if (target == btTest.getElement()) {
     if (isEditing) {
       assignmentsTable.setVisible(false);
       checkAssignmentsTable.setVisible(true);
       check();
       btTest.setText(app.getPlain("Check"));
       btApply.setText(app.getPlain("Back"));
       hide();
       setGlassEnabled(false);
       center();
     } else {
       check();
     }
   }
 }
Exemplo n.º 2
0
  /**
   * Attempts to create or redefine the cell geo using the current editing string
   *
   * @return
   */
  private boolean processGeo() {

    try {

      if (allowProcessGeo) {
        String text = autoCompleteTextField.getText(); // ?// (String)
        // delegate.getCellEditorValue();
        // get GeoElement of current cell
        value = kernel.lookupLabel(GeoElementSpreadsheet.getSpreadsheetCellName(column, row));

        if (text.equals("")) {
          if (value != null) {
            value.removeOrSetUndefinedIfHasFixedDescendent();
            value = null;
          }

        } else {
          GeoElement newVal =
              RelativeCopy.prepareAddingValueToTableNoStoringUndoInfo(
                  kernel, app, text, value, column, row, false);
          if (newVal == null) {
            return false;
          }
          value = newVal;
        }

        if (value != null) app.storeUndoInfo();
      }

    } catch (Exception ex) {
      // show GeoGebra error dialog
      // kernel.getApplication().showError(ex.getMessage());
      ex.printStackTrace();
      // TODO super.stopCellEditing();
      editing = false;
      return false;
    }
    return true;
  }