/**************************************************************************************************
**
** $Id: AggregateGraphic.java 831 2006-05-01 00:27:23Z Desruisseaux $
**
** $URL: http://svn.code.sf.net/p/geoapi/code/branches/2.0.x/geoapi/src/main/java/org/opengis/go/display/primitive/AggregateGraphic.java $
**
** Copyright (C) 2003-2005 Open GIS Consortium, Inc.
** All Rights Reserved. http://www.opengis.org/legal/
**
*************************************************************************************************/
package org.opengis.go.display.primitive;
// OpenGIS direct dependencies
import org.opengis.go.display.event.AggregationChangeEvent;
import org.opengis.go.display.event.AggregationListener;
/**
* A common abstraction for implementations of aggregated {@link Graphic}s.
* The abstraction makes no assumptions as to how the Graphics are
* stored within the aggregate. For example, the Graphics may be
* stored in an array such that the Graphic in the zeroeth element
* of the array is considered the front-most object and the Graphic
* in the largest element of the array is considered the bottom-most object. Or, the
* Graphics may be stored in a Skiplist sorted by a unique
* Graphic identifier to make adding and removing
* Graphics very efficient.
*
* Additionally, the abstraction makes no
* assumptions as to thread safety. If the implementations of
* Graphic are to be used in a multi-threaded environment,
* the implementation will have to address thread safety by synchronizing
* methods or by invoking all methods from a single thread.
*
* @author OpenGIS® consortium
* @version $Revision: 658 $, $Date: 2006-02-23 12:09:34 +1100 (jeu., 23 févr. 2006) $
*/
public interface AggregateGraphic extends Graphic {
/**
* Sets the children of this AggregateGraphic to the given
* set of Graphics. If there are already children assigned,
* then those children will be removed and their parent will be set to
* {@code null}.
*
* @param children the new children of the AggregateGraphic.
*/
public void setChildren(Graphic[] children);
/**
* Returns the children of this AggregateGraphic. If no
* children are assigned, the method returns an empty array.
*
* @return the child Graphics of the AggregateGraphic.
*/
public Graphic[] getChildren();
/**
* Adds the given child to this AggregateGraphic.
*
* @param child Graphic child to add to the aggregate.
* @return the added Graphic.
*/
public Graphic addChild(Graphic child);
/**
* Adds the given children to this AggregateGraphic.
*
* @param children Graphic children to add to the aggregate.
* @return the added Graphics.
*/
public Graphic[] addChildren(Graphic[] children);
/**
* Removes the given child from this AggregateGraphic.
*
* @param child the Graphic child to remove from the aggregate.
* @return the removed Graphic, or {@code null} if it is not found.
*/
public Graphic removeChild(Graphic child);
/**
* Removes the given children from this AggregateGraphic.
*
* @param children the Graphic children to remove from the aggregate.
* @return the removed Graphics, or {@code null} if none are found.
*/
public Graphic[] removeChildren(Graphic[] children);
/**
* Removes all of the children from this AggregateGraphic.
*/
public void removeChildren();
/**
* Replaces the oldChild with the newChild.
*
* @param oldChild the child to be replaced.
* @param newChild the child to be added in its place.
* @return the newChild that replaced the oldChild.
*/
public Graphic replaceChild(Graphic oldChild, Graphic newChild);
/**
* Returns the number of children currently assigned to this
* AggregateGraphic.
*
* @return the number of children currently assigned.
*/
public int getChildCount();
/**
* Adds the given AggregationListener to this
* AggregateGraphic's list of listeners. The listeners will
* be notified if this AggregateGraphic adds or removes any elements.
*
* @param listener the AggregationListener to be added.
*/
public void addAggregationListener(AggregationListener listener);
/**
* Removes the given AggregationListener from this
* AggregateGraphic's list of listeners.
*
* @param listener the AggregationListener to be removed.
*/
public void removeAggregationListener(AggregationListener listener);
/**
* Calls the aggregationChanged() method of all AggregationListeners
* in this AggregateGraphic's list of listeners. This method is called when any
* elements are added, removed, or reorderd in this AggregateGraphic.
*
* @param event the AggregationChangedEvent to give to the listeners.
*
* @todo Usually, this kind of method is a protected one in the implementation class,
* not a public method in the interface...
*/
public void aggregationChanged(AggregationChangeEvent event);
}
Ads help maintain this website.