import net.sf.openrocket.aerodynamics.WarningSet;
import net.sf.openrocket.file.simplesax.ElementHandler;
import net.sf.openrocket.file.simplesax.PlainTextHandler;
-import net.sf.openrocket.material.Material;
import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.rocketcomponent.Streamer;
import org.xml.sax.SAXException;
/**
* A SAX handler for Streamer components.
*/
-class StreamerHandler extends PositionDependentHandler<Streamer> {
+class StreamerHandler extends RecoveryDeviceHandler<Streamer> {
/**
* The OpenRocket Streamer.
* Constructor.
*
* @param c the parent component
+ * @param warnings the warning set
+ *
* @throws IllegalArgumentException thrown if <code>c</code> is null
*/
- public StreamerHandler(RocketComponent c) throws IllegalArgumentException {
+ public StreamerHandler(RocketComponent c, WarningSet warnings) throws IllegalArgumentException {
if (c == null) {
throw new IllegalArgumentException("The parent of a streamer may not be null.");
}
streamer = new Streamer();
- c.addChild(streamer);
+ if (isCompatible(c, Streamer.class, warnings)) {
+ c.addChild(streamer);
+ }
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public ElementHandler openElement(String element, HashMap<String, String> attributes, WarningSet warnings) {
return PlainTextHandler.INSTANCE;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void closeElement(String element, HashMap<String, String> attributes, String content, WarningSet warnings)
throws SAXException {
}
}
- @Override
- public Streamer getComponent() {
- return streamer;
- }
-
/**
- * Set the relative position onto the component. This cannot be done directly because setRelativePosition is not
- * public in all components.
- *
- * @param position the OpenRocket position
+ * {@inheritDoc}
*/
@Override
- public void setRelativePosition(RocketComponent.Position position) {
- streamer.setRelativePosition(position);
+ public Streamer getComponent() {
+ return streamer;
}
- /**
- * Get the required type of material for this component.
- *
- * @return BULK
- */
- @Override
- public Material.Type getMaterialType() {
- return Material.Type.SURFACE;
- }
}