/** Gets the lines with line number whitin the range inclusive. * @return <code>List</code> of lines from range inclusive */ private List getLinesFromRange(int startLineNumber, int endLineNumber) { List linesInRange = new ArrayList(10); synchronized(findWeakHashMap ()) { for(Iterator it = findWeakHashMap ().keySet().iterator(); it.hasNext(); ) { Line line = (Line)it.next(); int lineNumber = line.getLineNumber(); if(startLineNumber <= lineNumber && lineNumber <= endLineNumber) { linesInRange.add(line); } } } return linesInRange; }
/** Find the line given as parameter in list of all lines attached to this set * and if the line exist in the list, notify it about being edited. */ void linesChanged(int startLineNumber, int endLineNumber, DocumentEvent p0) { List changedLines = getLinesFromRange(startLineNumber, endLineNumber); StyledDocument doc = listener.support.getDocument(); for (Iterator it = changedLines.iterator(); it.hasNext();) { Line line = (Line) it.next(); line.firePropertyChange(Annotatable.PROP_TEXT, null, null); // revalidate all parts attached to this line // that they are still part of the line if (doc != null && line instanceof DocumentLine) { ((DocumentLine) line).notifyChange(p0, this, doc); } } }
/** Override this to create the delegate */ private java.util.List createDelegate () { int cnt = set.listener.getOriginalLineCount (); java.util.List l = new java.util.ArrayList (cnt); for (int i = 0; i < cnt; i++) { l.add (set.getOriginal (i)); } return l; }
DocumentLine line = (DocumentLine)set.getCurrent(NbDocument.findLineNumber(doc, part.getOffset())); moveLinePart(part, line); } else {
DocumentLine line = (DocumentLine)set.getCurrent(NbDocument.findLineNumber(doc, part.getOffset())); moveLinePart(part, line); } else {
DocumentLine line = (DocumentLine) set.getCurrent(NbDocument.findLineNumber(doc, part.getOffset())); moveLinePart(part, line); } else {
public void removeUpdate(javax.swing.event.DocumentEvent p0) { int elem = root.getElementCount (); int delta = lines - elem; lines = elem; int lineNumber = NbDocument.findLineNumber (doc, p0.getOffset ()); if (delta > 0) { struct.deleteLines ( lineNumber, delta ); } if ( support == null) return; Line.Set set = support.getLineSet (); if (!(set instanceof DocumentLine.Set)) return; // Notify lineSet there was changed range of lines. ((DocumentLine.Set)set).linesChanged(lineNumber, lineNumber+delta, p0); if (delta > 0) { // Notify Line.Set there was moved range of lines. ((DocumentLine.Set)set).linesMoved(lineNumber, elem); } }
public void removeUpdate(javax.swing.event.DocumentEvent p0) { int elem = root.getElementCount(); int delta = lines - elem; lines = elem; StyledDocument doc = support.getDocument(); if (doc == null) { return; } int lineNumber = NbDocument.findLineNumber(doc, p0.getOffset()); if (delta > 0) { struct.deleteLines(lineNumber, delta); } if (support == null) { return; } Line.Set set = support.getLineSet(); if (!(set instanceof DocumentLine.Set)) { return; } // Notify lineSet there was changed range of lines. ((DocumentLine.Set) set).linesChanged(lineNumber, lineNumber + delta, p0); if (delta > 0) { // Notify Line.Set there was moved range of lines. ((DocumentLine.Set) set).linesMoved(lineNumber, elem); } }
((DocumentLine.Set) set).linesChanged(lineNumber, lineNumber, p0); ((DocumentLine.Set) set).linesMoved(lineNumber, elem);
public void removeUpdate(javax.swing.event.DocumentEvent p0) { int elem = root.getElementCount (); int delta = lines - elem; lines = elem; int lineNumber = NbDocument.findLineNumber (doc, p0.getOffset ()); if (delta > 0) { struct.deleteLines ( lineNumber, delta ); } if ( support == null) return; Line.Set set = support.getLineSet (); if (!(set instanceof DocumentLine.Set)) return; // Notify lineSet there was changed range of lines. ((DocumentLine.Set)set).linesChanged(lineNumber, lineNumber+delta, p0); if (delta > 0) { // Notify Line.Set there was moved range of lines. ((DocumentLine.Set)set).linesMoved(lineNumber, elem); } }
public void insertUpdate(javax.swing.event.DocumentEvent p0) { int elem = root.getElementCount (); int delta = elem - lines; lines = elem; int lineNumber = NbDocument.findLineNumber (doc, p0.getOffset ()); if (delta > 0) { struct.insertLines ( lineNumber, delta ); } if ( support == null) return; Line.Set set = support.getLineSet (); if (!(set instanceof DocumentLine.Set)) return; // Nptify Line.Set there was changed range of lines. ((DocumentLine.Set)set).linesChanged(lineNumber, lineNumber, p0); if (delta > 0) { // Notify Line.Set there was moved range of lines. ((DocumentLine.Set)set).linesMoved(lineNumber, elem); } }
public void insertUpdate(javax.swing.event.DocumentEvent p0) { int elem = root.getElementCount (); int delta = elem - lines; lines = elem; int lineNumber = NbDocument.findLineNumber (doc, p0.getOffset ()); if (delta > 0) { struct.insertLines ( lineNumber, delta ); } if ( support == null) return; Line.Set set = support.getLineSet (); if (!(set instanceof DocumentLine.Set)) return; // Nptify Line.Set there was changed range of lines. ((DocumentLine.Set)set).linesChanged(lineNumber, lineNumber, p0); if (delta > 0) { // Notify Line.Set there was moved range of lines. ((DocumentLine.Set)set).linesMoved(lineNumber, elem); } }
/** Gets the lines with line number whitin the range inclusive. * @return <code>List</code> of lines from range inclusive */ private List getLinesFromRange(int startLineNumber, int endLineNumber) { List linesInRange = new ArrayList(10); synchronized(findWeakHashMap ()) { for(Iterator it = findWeakHashMap ().keySet().iterator(); it.hasNext(); ) { Line line = (Line)it.next(); int lineNumber = line.getLineNumber(); if(startLineNumber <= lineNumber && lineNumber <= endLineNumber) { linesInRange.add(line); } } } return linesInRange; }
/** Find the line given as parameter in list of all lines attached to this set * and if the line exist in the list, notify it about being moved. */ void linesMoved(int startLineNumber, int endLineNumber) { List movedLines = getLinesFromRange(startLineNumber, endLineNumber); for(Iterator it = movedLines.iterator(); it.hasNext(); ) { Line line = (Line)it.next(); line.firePropertyChange(Line.PROP_LINE_NUMBER, null, null); // notify all parts attached to this line // that they were moved if (line instanceof DocumentLine) { ((DocumentLine)line).notifyMove(); } } }
/** Find the line given as parameter in list of all lines attached to this set * and if the line exist in the list, notify it about being moved. */ void linesMoved(int startLineNumber, int endLineNumber) { List movedLines = getLinesFromRange(startLineNumber, endLineNumber); for(Iterator it = movedLines.iterator(); it.hasNext(); ) { Line line = (Line)it.next(); line.firePropertyChange(Line.PROP_LINE_NUMBER, null, null); // notify all parts attached to this line // that they were moved if (line instanceof DocumentLine) { ((DocumentLine)line).notifyMove(); } } }
/** Find the line given as parameter in list of all lines attached to this set * and if the line exist in the list, notify it about being edited. */ void linesChanged(int startLineNumber, int endLineNumber, DocumentEvent p0) { List changedLines = getLinesFromRange(startLineNumber, endLineNumber); for(Iterator it = changedLines.iterator(); it.hasNext(); ) { Line line = (Line)it.next(); line.firePropertyChange(Annotatable.PROP_TEXT, null, null); // revalidate all parts attached to this line // that they are still part of the line if(line instanceof DocumentLine) { ((DocumentLine)line).notifyChange(p0, this, listener.doc); } } }
/** Gets the lines with line number whitin the range inclusive. * @return <code>List</code> of lines from range inclusive */ private List<Line> getLinesFromRange(int startLineNumber, int endLineNumber) { List<Line> linesInRange = new ArrayList<Line>(10); synchronized (findWeakHashMap()) { for (Line line : findWeakHashMap().keySet()) { int lineNumber = line.getLineNumber(); if ((startLineNumber <= lineNumber) && (lineNumber <= endLineNumber)) { linesInRange.add(line); } } } return linesInRange; }
public Line getCurrent (int line) throws IndexOutOfBoundsException { int offset = NbDocument.findLineOffset (listener.doc, line); return safelyRegisterLine(createLine(offset)); }
public Line getCurrent (int line) throws IndexOutOfBoundsException { int offset = NbDocument.findLineOffset (listener.doc, line); return safelyRegisterLine(createLine(offset)); }
public int indexOf (Object o) { if (o instanceof DocumentLine) { Line find = set.findLine ((DocumentLine)o); if (find != null) { int indx = set.listener.getOld (find.getLineNumber ()); if (set.getOriginal (indx).equals (o)) { // just to verify that the index really exists return indx; } } } return -1; }