001: /*
002: * uDig - User Friendly Desktop Internet GIS client http://udig.refractions.net (C) 2004,
003: * Refractions Research Inc. This library is free software; you can redistribute it and/or modify it
004: * under the terms of the GNU Lesser General Public License as published by the Free Software
005: * Foundation; version 2.1 of the License. This library is distributed in the hope that it will be
006: * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
007: * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
008: */
009: package net.refractions.udig.project.internal;
010:
011: import java.io.IOException;
012: import java.net.URL;
013: import java.util.List;
014:
015: import net.refractions.udig.catalog.IGeoResource;
016: import net.refractions.udig.project.IStyleBlackboard;
017:
018: import org.eclipse.core.runtime.IProgressMonitor;
019: import org.eclipse.emf.ecore.EObject;
020:
021: /**
022: * Provides persistence, storage for Style information and shared collaboration between renderers
023: * and the user.
024: *
025: * @author Richard Gould
026: * @since 0.6.0
027: * @model
028: */
029: public interface StyleBlackboard extends EObject, IStyleBlackboard,
030: Cloneable {
031:
032: /**
033: * <!-- begin-user-doc --> <!-- end-user-doc -->
034: * @generated
035: */
036: String copyright = "uDig - User Friendly Desktop Internet GIS client http://udig.refractions.net (C) 2004, Refractions Research Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; version 2.1 of the License. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details."; //$NON-NLS-1$
037:
038: /**
039: * List of Style information.
040: * <p>
041: * Note: This list should not be accessed by client code - it is for use by the EMF model.
042: * Please use the lookup methods provided.
043: * </p>
044: *
045: * @model containment="true" type="StyleEntry"
046: */
047: List<StyleEntry> getContent();
048:
049: /**
050: * Retreives the style value by the styleId.
051: *
052: * @param styleId A well known String constant identifying the style agreed upon by the Renderer
053: * and the StyleConfigurator.
054: * @return The requested style object or null if it does not exist
055: * @model
056: */
057: Object get(String styleId);
058:
059: /**
060: * Retreives the style value by the class of the style object. Returns the first object that
061: * meets the criteria.
062: *
063: * @param theClass A superclass of the class of the style object.
064: * @return The requested style object or null if it does not exist
065: * @model
066: */
067: Object lookup(Class<?> theClass);
068:
069: /**
070: * Convenience method for testing for the existance of a style.
071: *
072: * @param styleId A well known String constant identifying the style agreed upon by the Renderer
073: * and the StyleConfigurator.
074: * @return true if the style extists, otherwise false.
075: * @model
076: */
077: boolean contains(String styleId);
078:
079: /**
080: * Places a style onto the blackboard.
081: *
082: * @param styleId A well known String constant identifying the style agreed upon by the Renderer
083: * and the StyleConfigurator. Since the id is assumed to be unique, if a style entry
084: * already exists with the specified id, it should be overwritten.
085: * @param style An object containing all the styling information.
086: * @model
087: */
088: void put(String styleId, Object style);
089:
090: /**
091: * Loads a style from a URL pointing to a resource. This method blocks.
092: *
093: * @param url the URL pointing to the style.
094: * @param monitor A progress monitor. Allowed to be null.
095: * @throws IOException if there is an error getting the style.
096: * @model
097: */
098: void put(URL url, IProgressMonitor monitor) throws IOException;
099:
100: /**
101: * Sets the styles indicated by the ids to be <em>selected</em>.
102: * <p>Selected styles are those that were selected/created by the user rather than the framework</p>
103: * <p>Example:
104: * <p>A layer has WMS and WFS {@link IGeoResource}s so either a FeatureRenderer or a WMSRenderer could render the layer.</p>
105: * <p>In the case where the wms allows the SLD to be retrieved the WMS StyleConfigurator could add both the named style to the blackboard
106: * as well as the SLD style to the blackboard. It could set both as selected because both the WMSRenderer and the FeatureRenderer
107: * would render the same image.</p>
108: * <p>However if the user enters a SLD style (assuming the WMS does not accept SLD POST) only the SLD style would be set to selected</p>
109: * <p>By using selection the choice of renderer used is affected towards the selected style</p>
110: * </p>
111: *
112: * @param ids
113: */
114: void setSelected(String[] ids);
115:
116: /**
117: * Removes the style value identified by styleId from the blackboard. FIXME: Can we reduce this
118: * to put( styleId, null ) ?
119: *
120: * @param styleId A well known String constant identifying the style agreed upon by the Renderer
121: * and the StyleConfigurator.
122: * @return The style object removed from the blackboard, or null if no such entry exists.
123: * @model
124: */
125: Object remove(String styleId);
126:
127: /**
128: * Creates a clone of the blackboard.
129: *
130: * @return A clone of the blackboard.
131: * @model
132: */
133: Object clone();
134:
135: }
|