Package javax.swing.undo

Examples of javax.swing.undo.UndoableEditSupport


public class getUpdateLevel
  implements Testlet
{
  public void test(TestHarness harness)
  {
    UndoableEditSupport ues;

    // Check #1.
    ues = new UndoableEditSupport();
    harness.check(ues.getUpdateLevel(), 0);

    // Check #2.
    ues.beginUpdate();
    harness.check(ues.getUpdateLevel(), 1);

    // Check #3.
    ues.beginUpdate();
    harness.check(ues.getUpdateLevel(), 2);

    // Check #4.
    ues.endUpdate();
    harness.check(ues.getUpdateLevel(), 1);

    // Check #5.
    ues.beginUpdate();
    harness.check(ues.getUpdateLevel(), 2);

    // Check #6.
    ues.endUpdate();
    harness.check(ues.getUpdateLevel(), 1);

    // Check #7.
    ues.endUpdate();
    harness.check(ues.getUpdateLevel(), 0);
  }
View Full Code Here


public class getUndoableEditListeners
  implements Testlet
{
  public void test(TestHarness harness)
  {
    UndoableEditSupport ues;
    TestListener t1, t2;
    UndoableEditListener[] l;

    ues = new UndoableEditSupport();
    t1 = new TestListener();
    t2 = new TestListener();

    // Check #1.
    l = ues.getUndoableEditListeners();
    harness.check((l != null) && (l.length == 0));

    // Check #2.
    ues.addUndoableEditListener(t1);
    l = ues.getUndoableEditListeners();
    harness.check((l != null) && (l.length == 1) && (l[0] == t1));

    // Check #3.
    ues.addUndoableEditListener(t2);
    l = ues.getUndoableEditListeners();
    harness.check(l != null && l.length == 2
                  && l[0] == t1 && l[1] == t2);

    // Check #4.
    ues.removeUndoableEditListener(t1);
    l = ues.getUndoableEditListeners();
    harness.check(l != null && l.length == 1
                  && l[0] == t2);
  }
View Full Code Here

    else CollectionUtils.forAllDo(selection, new SnapshottableImpl.SaveCurrentToSnapshotClosure(snapshotId));

    fireBaselineChanged(this, null, (Integer)snapshotId,true);

    if (undo){
      UndoableEditSupport undoableEditSupport=getUndoController().getEditSupport();
      if (undoableEditSupport!=null){
        undoableEditSupport.postEdit(new SaveSnapshotEdit(this,snapshotId,entireProject,selection));
      }
    }

  }
View Full Code Here

    else CollectionUtils.forAllDo(selection, new SnapshottableImpl.ClearSnapshotClosure(snapshotId));
//    FieldEvent.fire(this, Configuration.getFieldFromId("Field.baseline" + snapshotId + "Cost"), null);
    fireBaselineChanged(this, null, (Integer)snapshotId,false);

    if (foundSnapshot[0]){
      UndoableEditSupport undoableEditSupport=getUndoController().getEditSupport();
      if (undoableEditSupport!=null){
        undoableEditSupport.postEdit(new ClearSnapshotEdit(this,snapshotId,entireProject,selection,snapshotDetails));
      }
    }

  }
View Full Code Here

    /** Construct a document that is owned by the given application
     */
    public AbstractDocument(Application a) {
        _application = a;
        _undoManager = new UndoManager();
        _editSupport = new UndoableEditSupport();
    }
View Full Code Here

    curEyed = new Cursor(Cursor.CROSSHAIR_CURSOR);
    curDefault = new Cursor(Cursor.DEFAULT_CURSOR);

    undoHandler = new UndoHandler(this);
    undoSupport = new UndoableEditSupport();
    undoSupport.addUndoableEditListener(undoHandler);

    cursorHighlight = new SelectionLayer(1, 1);
    cursorHighlight.select(0, 0);
    cursorHighlight.setVisible(prefs.getBoolean("cursorhighlight", true));
View Full Code Here

        curEyed = new Cursor(Cursor.CROSSHAIR_CURSOR);
        curDefault = new Cursor(Cursor.DEFAULT_CURSOR);

        undoHandler = new UndoHandler(this);
        undoSupport = new UndoableEditSupport();
        undoSupport.addUndoableEditListener(undoHandler);

        cursorHighlight = new SelectionLayer(1, 1);
        cursorHighlight.select(0, 0);
        cursorHighlight.setVisible(prefs.getBoolean("cursorhighlight", true));
View Full Code Here

    /**
     * Sets the name of the current undoable operation.
     * @param editName String - The name to be used for the command (may be used in UI)
     */
    public void setUndoableName(String editName) {
        UndoableEditSupport undoableEditSupport = getUndoableEditSupport();
        if (undoableEditSupport instanceof ExtendedUndoableEditSupport) {
            ((ExtendedUndoableEditSupport)undoableEditSupport).setEditName(editName);
        }
    }
View Full Code Here

    else CollectionUtils.forAllDo(selection, new SnapshottableImpl.SaveCurrentToSnapshotClosure(snapshotId));

    fireBaselineChanged(this, null, (Integer)snapshotId,true);

    if (undo){
      UndoableEditSupport undoableEditSupport=getUndoController().getEditSupport();
      if (undoableEditSupport!=null){
        undoableEditSupport.postEdit(new SaveSnapshotEdit(this,snapshotId,entireProject,selection));
      }
    }

  }
View Full Code Here

    else CollectionUtils.forAllDo(selection, new SnapshottableImpl.ClearSnapshotClosure(snapshotId));
//    FieldEvent.fire(this, Configuration.getFieldFromId("Field.baseline" + snapshotId + "Cost"), null);
    fireBaselineChanged(this, null, (Integer)snapshotId,false);

    if (foundSnapshot[0]){
      UndoableEditSupport undoableEditSupport=getUndoController().getEditSupport();
      if (undoableEditSupport!=null){
        undoableEditSupport.postEdit(new ClearSnapshotEdit(this,snapshotId,entireProject,selection,snapshotDetails));
      }
    }

  }
View Full Code Here

TOP

Related Classes of javax.swing.undo.UndoableEditSupport

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.