Package javax.swing.undo

Examples of javax.swing.undo.UndoableEdit


   */
  public void modifyPageSetup() {
    HomePrint oldHomePrint = this.home.getPrint();
    HomePrint homePrint = getPrint();
    this.home.setPrint(homePrint);
    UndoableEdit undoableEdit = new HomePrintModificationUndoableEdit(
        this.home, this.preferences,oldHomePrint, homePrint);
    this.undoSupport.postEdit(undoableEdit);
  }
View Full Code Here


    private void postEdit( final CropBounds newBounds, final String name,
                           final boolean significant ) {
        final CropBounds oldBounds = bounds;
        bounds = newBounds;
        UndoableEdit edit = new AbstractUndoableEdit() {
            public String getPresentationName() {
                return name;
            }
            public void undo() {
                super.undo();
View Full Code Here

        setSelection(control);

        control.addUndoableEditListener(this);

        if (! undoSupport.isRestoring()) {
            UndoableEdit edit = new AbstractUndoableEdit() {
                public String getPresentationName() {
                    String name = control.getTitleText();
                    return LOCALE.get("AddToolEditName", name);
                }
                public void undo() {
View Full Code Here

        engine.removeOperation(index);

        opControl.removeUndoableEditListener(this);

        if (! undoSupport.isRestoring()) {
            UndoableEdit edit = new AbstractUndoableEdit() {
                public String getPresentationName() {
                    String name = opControl.getTitleText();
                    return LOCALE.get("RemoveToolEditName", name);
                }
                public void undo() {
View Full Code Here

        if (control.isContentShown()) {
            return;
        }
        control.setShowContent(true);
        if (! undoSupport.isRestoring()) {
            UndoableEdit edit = new AbstractUndoableEdit() {
                public String getPresentationName() {
                    return LOCALE.get("ExpandToolEditName");
                }
                public boolean isSignificant() {
                    return false;
View Full Code Here

        if (! control.isContentShown()) {
            return;
        }
        control.setShowContent(false);
        if (! undoSupport.isRestoring()) {
            UndoableEdit edit = new AbstractUndoableEdit() {
                public String getPresentationName() {
                    return LOCALE.get("CollapseToolEditName");
                }
                public boolean isSignificant() {
                    return false;
View Full Code Here

            // gesture, then sync the DraggableStack layout manually:
            JComponent upper = pop(index);
            push(upper, index + 1);
        }
        if (! undoSupport.isRestoring()) {
            UndoableEdit edit = new AbstractUndoableEdit() {
                public String getPresentationName() {
                    return LOCALE.get("SwapToolEditName");
                }
                public void undo() {
                    super.undo();
View Full Code Here

  private void dragTimelinePosition( MouseEvent e )
  {
    int        x   = e.getX();
    Span      span, span2;
    long      position;
    UndoableEdit  edit;

    // translate into a valid time offset
        span        = doc.timeline.getVisibleSpan();
        position    = span.getStart() + (long) ((double) x / (double) getWidth() *
                                                span.getLength());
        position    = Math.max( 0, Math.min( doc.timeline.getLength(), position ));
       
        if( shiftDrag ) {
      span2  = doc.timeline.getSelectionSpan();
      if( altDrag || span2.isEmpty() ) {
        selectionStart = doc.timeline.getPosition();
        altDrag = false;
      } else if( selectionStart == -1 ) {
        selectionStart = Math.abs( span2.getStart() - position ) >
                 Math.abs( span2.getStop() - position ) ?
                 span2.getStart() : span2.getStop();
      }
      span  = new Span( Math.min( position, selectionStart ),
                Math.max( position, selectionStart ));
      edit  = TimelineVisualEdit.select( this, doc, span ).perform();
        } else {
      if( altDrag ) {
        edit  = new CompoundEdit();
        edit.addEdit( TimelineVisualEdit.select( this, doc, new Span() ).perform() );
        edit.addEdit( TimelineVisualEdit.position( this, doc, position ).perform() );
        ((CompoundEdit) edit).end();
        altDrag = false;
      } else {
        edit  = TimelineVisualEdit.position( this, doc, position ).perform();
      }
View Full Code Here

        assertEquals(pos.size(), v.size());
        int[] offsets = new int[v.size()];
        for (int i = 0; i < pos.size(); i++) {
            offsets[i] = pos.get(i).getOffset();
        }
        UndoableEdit ue = content.remove(0, 9);
        ue.undo();
        for (int i = 0; i < pos.size(); i++) {
            assertEquals(offsets[i], pos.get(i).getOffset());
        }
    }
View Full Code Here

        cont1 = new GapContent() {
            private static final long serialVersionUID = 1L;

            @Override
            public UndoableEdit remove(int where, int len) throws BadLocationException {
                UndoableEdit u = super.remove(where, len);
                return u;
            }

            @Override
            public UndoableEdit insertString(int offset, String str)
                    throws BadLocationException {
                UndoableEdit u = super.insertString(offset, str);
                return u;
            }

            @SuppressWarnings("unchecked")
            @Override
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.