Package javax.swing.undo

Examples of javax.swing.undo.UndoableEdit


   
    /**
     * @return the translation edit
     */
  public UndoableEdit translateShapeEnd(){
      UndoableEdit res = null;
      res =  new TranslateEdit(currentPoint.x - initPoint.x, currentPoint.y - initPoint.y, element);
     
      initPoint = new Point(currentPoint)
      referencePoint = new Point(initPoint);
      return res;
View Full Code Here


            ((TranslatableShapePointsSelection) _selectedElements.get(0)).translatePoint(dx, dy);
        }
    }

    public void translatePointEnd(){
        UndoableEdit ue = null;

        if ( getShapeCount() == 1 && getSelection(0) instanceof TranslatableShapePointsSelection){
            ue = ((TranslatableShapePointsSelection) _selectedElements.get(0)).translatePointEnd();
        }
View Full Code Here

        CompoundEdit ce = new CompoundEdit();

        for (int i=0;i<_selectedElements.size();i++) {
            ElementSelection ss = (ElementSelection)_selectedElements.get(i);

            UndoableEdit ue = ss.translateShapeEnd();
            if (ue != null && ue.isSignificant()){
                ce.addEdit(ue);
            }
        }

        ce.end();
View Full Code Here

        CompoundEdit ce = new CompoundEdit();
       
        for (int i=0;i<_selectedElements.size();i++) {
            ElementSelection ss = (ElementSelection)_selectedElements.get(i);
           
            UndoableEdit ue = ss.translateShapeEnd();
            if (ue != null && ue.isSignificant()){
                ce.addEdit(ue);
            }
        }

        ce.end();
View Full Code Here

   * The same as super.editToBeUndone() just that we treat DocumentEvent.EventType.CHANGE
   * the same way as true == edit.isSignificant().
   */
  protected UndoableEdit editToBeUndone()
  {
    UndoableEdit ue = super.editToBeUndone();

    if (ue == null)
    {
      return null;
    }

    int i = edits.indexOf(ue);
    while (i >= 0)
    {
      UndoableEdit edit = edits.elementAt(i--);
      if (edit.isSignificant())
      {
        if (edit instanceof AbstractDocument.DefaultDocumentEvent)
        {
          if (DocumentEvent.EventType.CHANGE != ((AbstractDocument.DefaultDocumentEvent)edit).getType())
          {
View Full Code Here

   * The DocumentEvent.EventType.CHANGE fix doesn't remove the bugs but makes it behave
   */
  protected UndoableEdit editToBeRedone()
  {
    int count = edits.size();
    UndoableEdit ue = super.editToBeRedone();

    if (null == ue)
    {
      return null;
    }

    int i = edits.indexOf(ue);

    while (i < count)
    {
      UndoableEdit edit = edits.elementAt(i++);
      if (edit.isSignificant())
      {
        if (edit instanceof AbstractDocument.DefaultDocumentEvent)
        {
          if (DocumentEvent.EventType.CHANGE != ((AbstractDocument.DefaultDocumentEvent)edit).getType())
          {
View Full Code Here

      final Selectable [] newSelectedItems =
        newSelection.toArray(new Selectable [newSelection.size()]);
     
      this.home.setBasePlanLocked(true);
      selectItems(newSelection);
      UndoableEdit undoableEdit = new AbstractUndoableEdit() {     
        @Override
        public void undo() throws CannotUndoException {
          super.undo();
          home.setBasePlanLocked(false);
          selectAndShowItems(Arrays.asList(oldSelectedItems));
View Full Code Here

      List<Selectable> selection = this.home.getSelectedItems();
      final Selectable [] selectedItems =
          selection.toArray(new Selectable [selection.size()]);
     
      this.home.setBasePlanLocked(false);
      UndoableEdit undoableEdit = new AbstractUndoableEdit() {     
        @Override
        public void undo() throws CannotUndoException {
          super.undo();
          home.setBasePlanLocked(true);
          selectAndShowItems(Arrays.asList(selectedItems));
View Full Code Here

   */
  private void postReverseSelectedWallsDirection(final Wall [] walls,
                                                 List<Selectable> oldSelection) {
    final Selectable [] oldSelectedItems =
        oldSelection.toArray(new Selectable [oldSelection.size()]);
    UndoableEdit undoableEdit = new AbstractUndoableEdit() {     
      @Override
      public void undo() throws CannotUndoException {
        super.undo();
        doReverseWallsDirection(walls);
        selectAndShowItems(Arrays.asList(oldSelectedItems));
View Full Code Here

                                     List<Selectable> oldSelection,
                                     final boolean oldBasePlanLocked) {
    final Selectable [] oldSelectedItems =
        oldSelection.toArray(new Selectable [oldSelection.size()]);
    final boolean newBasePlanLocked = this.home.isBasePlanLocked();
    UndoableEdit undoableEdit = new AbstractUndoableEdit() {     
      @Override
      public void undo() throws CannotUndoException {
        super.undo();
        doDeleteWalls(new JoinedWall [] {firstJoinedWall, secondJoinedWall}, oldBasePlanLocked);
        doAddWalls(new JoinedWall [] {splitJoinedWall}, oldBasePlanLocked);
View Full Code Here

TOP

Related Classes of javax.swing.undo.UndoableEdit

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.