< prev index next >

src/java.desktop/share/classes/javax/swing/text/GapContent.java

Print this page




 741         }
 742 
 743         Vector<UndoPosRef> placeIn = (v == null) ?
 744             new Vector<>(Math.max(1, endIndex - startIndex)) :
 745             v;
 746 
 747         for (int counter = startIndex; counter < endIndex; counter++) {
 748             placeIn.addElement(new UndoPosRef(marks.elementAt(counter)));
 749         }
 750         return placeIn;
 751     }
 752 
 753     /**
 754      * Resets the location for all the UndoPosRef instances
 755      * in <code>positions</code>.
 756      * <p>
 757      * This is meant for internal usage, and is generally not of interest
 758      * to subclasses.
 759      *
 760      * @param positions the UndoPosRef instances to reset


 761      */
 762     @SuppressWarnings("rawtypes") // UndoPosRef type cannot be exposed
 763     protected void updateUndoPositions(Vector positions, int offset,
 764                                        int length) {
 765         // Find the indexs of the end points.
 766         int endOffset = offset + length;
 767         int g1 = getGapEnd();
 768         int startIndex;
 769         int endIndex = findMarkAdjustIndex(g1 + 1);
 770 
 771         if (offset != 0) {
 772             startIndex = findMarkAdjustIndex(g1);
 773         }
 774         else {
 775             startIndex = 0;
 776         }
 777 
 778         // Reset the location of the refenences.
 779         for(int counter = positions.size() - 1; counter >= 0; counter--) {
 780             UndoPosRef ref = (UndoPosRef) positions.elementAt(counter);




 741         }
 742 
 743         Vector<UndoPosRef> placeIn = (v == null) ?
 744             new Vector<>(Math.max(1, endIndex - startIndex)) :
 745             v;
 746 
 747         for (int counter = startIndex; counter < endIndex; counter++) {
 748             placeIn.addElement(new UndoPosRef(marks.elementAt(counter)));
 749         }
 750         return placeIn;
 751     }
 752 
 753     /**
 754      * Resets the location for all the UndoPosRef instances
 755      * in <code>positions</code>.
 756      * <p>
 757      * This is meant for internal usage, and is generally not of interest
 758      * to subclasses.
 759      *
 760      * @param positions the UndoPosRef instances to reset
 761      * @param offset where the string was inserted
 762      * @param length length of inserted string
 763      */
 764     @SuppressWarnings("rawtypes") // UndoPosRef type cannot be exposed
 765     protected void updateUndoPositions(Vector positions, int offset,
 766                                        int length) {
 767         // Find the indexs of the end points.
 768         int endOffset = offset + length;
 769         int g1 = getGapEnd();
 770         int startIndex;
 771         int endIndex = findMarkAdjustIndex(g1 + 1);
 772 
 773         if (offset != 0) {
 774             startIndex = findMarkAdjustIndex(g1);
 775         }
 776         else {
 777             startIndex = 0;
 778         }
 779 
 780         // Reset the location of the refenences.
 781         for(int counter = positions.size() - 1; counter >= 0; counter--) {
 782             UndoPosRef ref = (UndoPosRef) positions.elementAt(counter);


< prev index next >