alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 * 
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 * 
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
 * Microsystems, Inc. All Rights Reserved.
 */

package org.netbeans.api.editor.fold;

/**
 * Event describing the changes done in the hierarchy.
 * 
* The structural changes are described by the lists of added and removed folds. *
* State changes are described by a list of {@link FoldStateChange}s. *
* In addition there is a description of the offset range that was * affected by the change. This is useful for the editor * to recreate the affected views and repaint the affected area. *

* Added folds can have either collapsed or expanded initial state. * * @author Miloslav Metelka * @version 1.00 */ public final class FoldHierarchyEvent extends java.util.EventObject { private Fold[] removedFolds; private Fold[] addedFolds; private FoldStateChange[] foldStateChanges; private int affectedStartOffset; private int affectedEndOffset; /** * Create new FoldHierarchyEvent. *
* It's guaranteed that no passed arrays contents will be modified. * * @param source FoldHierarchy for which this event gets created. * @param removedFolds non-null array of removed folds. * @param addedFolds non-null array of added folds. * @param foldStateChanges changes describing changes in the state * of particular folds. * @param affectedStartOffset first offset in the document affected by this change. * @param affectedEndOffset end of the offset area affected by this change. */ FoldHierarchyEvent(FoldHierarchy source, Fold[] removedFolds, Fold[] addedFolds, FoldStateChange[] foldStateChanges, int affectedStartOffset, int affectedEndOffset) { super(source); this.removedFolds = removedFolds; this.addedFolds = addedFolds; this.foldStateChanges = foldStateChanges; this.affectedStartOffset = affectedStartOffset; this.affectedEndOffset = affectedEndOffset; } /** * Get the number of folds removed from the hierarchy. * * @return >=0 number of removed folds. */ public int getRemovedFoldCount() { return removedFolds.length; } /** * Get the fold with the given index removed * from the fold hierarchy. * * @param removedFoldIndex >=0 and <{@link #getRemovedFoldCount()} * index of the removed fold. */ public Fold getRemovedFold(int removedFoldIndex) { return removedFolds[removedFoldIndex]; } /** * Get the number of folds that were added to the hierarchy. * * @return >=0 number of added folds. */ public int getAddedFoldCount() { return addedFolds.length; } /** * Get the fold with the given index added * to the hierarchy. * * @param addedFoldIndex >=0 and <{@link #getAddedFoldCount()} * index of the added fold. */ public Fold getAddedFold(int addedFoldIndex) { return addedFolds[addedFoldIndex]; } /** * Get the number of the fold state changes contained in this event. * * @return >=0 number of fold state changes. */ public int getFoldStateChangeCount() { return foldStateChanges.length; } /** * Get the fold state change at the given index. * * @param index >=0 and <{@link #getFoldStateChangeCount()} * index of the fold state change. */ public FoldStateChange getFoldStateChange(int index) { return foldStateChanges[index]; } /** * Get the first offset in the underlying document affected * by this change. * * @return >=0 first offset affected by the change. */ public int getAffectedStartOffset() { return affectedStartOffset; } /** * Get the ending offset in the offset area affected * by this change. * * @return >={@link #getAffectedStartOffset()} * end of the offset area affected by the change. */ public int getAffectedEndOffset() { return affectedEndOffset; } public String toString() { return org.netbeans.modules.editor.fold.FoldUtilitiesImpl.foldHierarchyEventToString(this); } }

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.