Package javax.swing.event

Examples of javax.swing.event.UndoableEditEvent


   * Runs the specified command by this editor's CommandProcessor, which makes
   * the operation reversible.
   * @param command the command to run
   */
  public void execute(Command command) {
    UndoableEditEvent event = new UndoableEditEvent(this, command);
    for (UndoableEditListener l : editListeners) {
      l.undoableEditHappened(event);
    }
    // We need to run() after notifying the UndoManager in order to ensure
    // correct menu behaviour
View Full Code Here


            return null;
        }
    };

    public void testFireUndoableEditUpdate() {
        UndoableEditEvent undoEvent = new UndoableEditEvent(doc, new AbstractUndoableEdit());
        doc.addUndoableEditListener(this);
        doc.fireUndoableEditUpdate(undoEvent);
        checkCalledEvents(false, false, false, true);
        assertSame(undoEvent, undo);
    }
View Full Code Here

        UEListener listener3 = new UEListener("3");
        ues1.addUndoableEditListener(listener1);
        ues1.addUndoableEditListener(listener2);
        ues1.addUndoableEditListener(listener3);
        UndoableEdit ue = new CompoundEdit();
        UndoableEditEvent uee = new UndoableEditEvent(ues1.realSource, ue);
        ues1._postEdit(ue);
        assertEquals("123", fireOrder);
        checkEvent(uee, listener1.event);
        checkEvent(uee, listener2.event);
        checkEvent(uee, listener3.event);
View Full Code Here

            assertEquals(0, ues1.compoundEdit.edits.size());
        }
        ues1.compoundEdit = ce;
        for (int i = 0; i < 10; i++) {
            CompoundEdit ce1 = ues1.compoundEdit;
            UndoableEditEvent uee = new UndoableEditEvent(ues1.realSource, ce1);
            resetDbgInfo(ce, ues1);
            ues1.endUpdate();
            assertEquals(4 - i, ues1.updateLevel);
            if (ues1.updateLevel == 0) {
                assertTrue(ues1.wasCallPostEdit);
View Full Code Here

        assertEquals(edit3.getUndoPresentationName(), um.getUndoPresentationName());
    }

    public void testUndoableEditHappened() {
        UndoableEdit edit = new TestUndoableEdit();
        UndoableEditEvent event = new UndoableEditEvent(this, edit);
        um.undoableEditHappened(event);
        assertEquals(1, um.edits.size());
        assertEquals(edit, um.edits.get(0));
    }
View Full Code Here

   * Runs the specified command by this editor's CommandProcessor, which makes
   * the operation reversible.
   * @param command the command to run
   */
  public void execute(Command command) {
    UndoableEditEvent event = new UndoableEditEvent(this, command);
    undoManager.undoableEditHappened(event);
    // We need to run() after notifying the UndoManager in order to ensure
    // correct menu behaviour
    command.run();
  }
View Full Code Here

   * Runs the specified command by this editor's CommandProcessor, which makes
   * the operation reversible.
   * @param command the command to run
   */
  public void execute(Command command) {
    UndoableEditEvent event = new UndoableEditEvent(this, command);
    for (UndoableEditListener l : editListeners) {
      l.undoableEditHappened(event);
    }
    // We need to run() after notifying the UndoManager in order to ensure
    // correct menu behaviour
View Full Code Here

          ((Circle)obj1).addPropertyChangeListener(Circle.PROP_RADIUS, newCircle);
          newCircle.addPropertyChangeListener(Circle.PROP_RADIUS, (Circle)obj1);
        }
      clearAndHide();
      step.setOutputs(new Object[]{newCircle});
      fireUndoableEditUpdate(new UndoableEditEvent(this, step));
    }
    else if (step.getConstructionType() == THREE_POINTS) {
      Point point1 = (Point)step.getInputs()[0];
      Point point2 = (Point)step.getInputs()[1];
      Point point3 = (Point)step.getInputs()[2];
      Line line12 = new Line(point1, point2);
      Line line23 = new Line(point2, point3);
      if (!((line12.isParallel(line23))||(point1.equalTo(point2))
          || (point2.equalTo(point3)) || (point3.equalTo(point1))))  {
        Circle newCircle = new Circle(point1, point2, point3);
        newCircle.addToObjects(objects);
        clearAndHide();
        step.setOutputs(new Object[]{newCircle.getCentre(), newCircle});
        fireUndoableEditUpdate(new UndoableEditEvent(this, step));
      }
      else {
        JOptionPane.showMessageDialog(this, "Select three distinct"
             + " non-collinear points", "Try Again", JOptionPane.ERROR_MESSAGE);
        initDialog();
View Full Code Here

        if (o.getType() == Line.TYPE)
          ((Line)o).setLengthAndSlope();
      }
      clearAndHide();
      step.setOutputs(new Object[]{tempPoint});
      fireUndoableEditUpdate(new UndoableEditEvent(this, step));
    }
    else {
      System.err.println("Bad construction type");
    }
  }
View Full Code Here

      for (int i = 0; i<objects.size(); i++)
        if (visibilityToggled[i].booleanValue())
          objects.elementAt(i).toggleVisible();
      clearAndHide();
      step.setOutputs(visibilityToggled);
      fireUndoableEditUpdate(new UndoableEditEvent(this, step));
    }
    else if (step.getConstructionType() == REMOVE_OBJECT) {
      GeometricalObject ob = (GeometricalObject)step.getInputs()[0];
      ob.removeFromObjects(objects);
      for (int i = 0; i<objects.size(); i++)
View Full Code Here

TOP

Related Classes of javax.swing.event.UndoableEditEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.