Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| org.openide.src 1.8.22
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.openide.src
Class MultiPropertyChangeEvent

    java.lang.Object
      java.util.EventObject
          java.beans.PropertyChangeEvent
              org.openide.src.MultiPropertyChangeEvent

All Implemented Interfaces:
  Serializable

    public class MultiPropertyChangeEvent

extends PropertyChangeEvent

This class is much like the ordinary PropertyChange event, but refines the message so it carry diff between the old and the new contents. There are several operations that can be made on a multivalued property:

- add - new items were introduced into the property.
- remove - items were removed from the property.
- change - some items were atomically replaced by new ones.
- reorder - no items were removed or added, but only reordered within the multivalued property.

ADD operation only introduces new items. For ordered multivalued properties, there's a index array with positions for each newly inserted element.
REMOVE only mentiones elements that are being removed.
CHANGE event specifies what items are being removed and what are replacing them.
REORDER can specify:

- a permutation describing the reorder operation
- old and new state of the whole property
- old state and the permutation
- new state and the permutation

Note: this event is not particularly useful for indexed properties with primitive values since the values does not have an identity and would need to be converted to wrapper Objects which is not cheap anyway.

Since:
  24/11/2000
See Also:
  Serialized Form

Field Summary
`static int` | `TYPE_ADD` Items are being added to the container.
`static int` | `TYPE_COMPOUND` Compound event, resulting from a generic change and comparisons
`static int` | `TYPE_MODIFY` Items are being replaced.
`static int` | `TYPE_REMOVE` Items are being removed from the container.
`static int` | `TYPE_REORDER` Items are being reordered.

Fields inherited from class java.util.EventObject
`source`

Constructor Summary
`MultiPropertyChangeEvent(Object source, String propName, Object oldVal, Object newVal)`

Method Summary
`protected void` | `checkUninitialized()`
`Collection` | `getAffectedItems()` Returns items affected by the operation.
`Collection` | `getComponents()`
`int` | `getEventType()`
`int[]` | `getIndices()` Returns array of relevant indices.
`Iterator` | `getIterator()` Returns iterator over partial operations collection in a compound change event.
`int[]` | `getPermutation()` Returns the permutation that describes the REORDER operation.
`Collection` | `getReplacement()` Returns items that will replace `getAffectedItems()` in the container.
`void` | `makeCompound(Collection partialChanges, int[] offsets)`
`void` | `makeInsertion(Collection items, int[] indices)`
`void` | `makeRemoval(Collection items)`
`void` | `makeRemoval(Collection items, int[] indices)`
`void` | `makeReorder(int[] permutation)`
`void` | `makeReplacement(Collection old, Collection n, int[] indices)`

Methods inherited from class java.beans.PropertyChangeEvent
`getNewValue, getOldValue, getPropagationId, getPropertyName, setPropagationId`

Methods inherited from class java.util.EventObject
`getSource, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### TYPE_ADD

    public static final int TYPE_ADD

  Items are being added to the container.

  See Also:
    Constant Field Values

### TYPE_REMOVE

    public static final int TYPE_REMOVE

  Items are being removed from the container.

  See Also:
    Constant Field Values

### TYPE_MODIFY

    public static final int TYPE_MODIFY

  Items are being replaced.

  See Also:
    Constant Field Values

### TYPE_REORDER

    public static final int TYPE_REORDER

  Items are being reordered.

  See Also:
    Constant Field Values

### TYPE_COMPOUND

    public static final int TYPE_COMPOUND

  Compound event, resulting from a generic change and comparisons

  See Also:
    Constant Field Values

Constructor Detail

### MultiPropertyChangeEvent

    public MultiPropertyChangeEvent(Object source,
                                    String propName,
                                    Object oldVal,
                                    Object newVal)

Method Detail

### makeInsertion

    public void makeInsertion(Collection items,
                              int[] indices)

### makeRemoval

    public void makeRemoval(Collection items,
                            int[] indices)

### makeRemoval

    public void makeRemoval(Collection items)

### makeReorder

    public void makeReorder(int[] permutation)

### makeReplacement

    public void makeReplacement(Collection old,
                                Collection n,
                                int[] indices)

### makeCompound

    public void makeCompound(Collection partialChanges,
                             int[] offsets)

### checkUninitialized

    protected void checkUninitialized()

### getAffectedItems

    public Collection getAffectedItems()

  Returns items affected by the operation. For add and remove operations, these are items added to or removed from the container, respectively. For change operation, the collection contains items that are being replaced in the container.

  Returns:
    collection of affected items. The collection is read-only.

### getComponents

    public Collection getComponents()

### getReplacement

    public Collection getReplacement()
                              throws IllegalStateException

  Returns items that will replace `getAffectedItems()` in the container.

  Returns:
    r/o collection of new items that are being inserted in the container.
  Throws:
    `IllegalStateException`

### getPermutation

    public int[] getPermutation()
                         throws IllegalStateException

  Returns the permutation that describes the REORDER operation.

  Returns:
    array of item's indexes in the new property's state. The array is indexed by positions in the old state.
  Throws:
    `IllegalStateException` - if the event is not REORDER type.

### getIndices

    public int[] getIndices()

  Returns array of relevant indices. For ADD operation, these are indexes which the elements are inserted at (0-based, one position beyond item count permitted). for REMOVE operation, indices are indexes to elements which are to be removed (indexes are computed prior to the removing any of the affected items). For MODIFY operation, this represents positions of elements which were replaced by another ones. Last, REORDER operation uses indices as a permutation that describes the reorder operation.

  Returns:
    array of (integer) indices

### getEventType

    public final int getEventType()

### getIterator

    public Iterator getIterator()

  Returns iterator over partial operations collection in a compound change event. If the event is simple, the returned iterator will return the event itself.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| org.openide.src 1.8.22
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Built on December 7 2006. | Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.