Show StreamTemplate.java syntax highlighted
package org.integratedmodelling.thinkcap.basecommands;
import org.integratedmodelling.thinkcap.ThinkcapAction;
import org.integratedmodelling.thinkcap.ThinkcapAnswer;
import org.integratedmodelling.thinkcap.ThinkcapCommand;
import org.integratedmodelling.thinklab.command.CommandDeclaration;
import org.integratedmodelling.thinklab.command.CommandPattern;
import org.integratedmodelling.thinklab.exception.ThinklabException;
import org.integratedmodelling.thinklab.KnowledgeManager;
import org.integratedmodelling.thinklab.interfaces.IAction;
/**
* This command simply outputs the template identified. Only the name of the template is required. Templates are
* usually contained in plugin jars. They're normally output directly from commands; this one just gives
* flexibility and can be used to implement an "include" facility.
*
* Usage in templates is:
*
* <code>
* <a href="StreamTemplate.cmd?ref=tname">....</a>
* </code>
*
* @author Ferdinando Villa
*
*/
public class StreamTemplate extends CommandPattern {
public class StreamTemplateAction extends ThinkcapAction {
@Override
public void execute(ThinkcapCommand command, ThinkcapAnswer value) throws ThinklabException {
String img = command.getArgumentAsString("res");
value.setOutputTemplate(img);
}
}
@Override
public CommandDeclaration createCommand() throws ThinklabException {
CommandDeclaration ret = new CommandDeclaration("StreamTemplate", "");
try {
ret.addMandatoryArgument("ref", "",
KnowledgeManager.KM().getTextType().getSemanticType());
} catch (ThinklabException e) {
}
return ret;
}
@Override
public IAction createAction() {
return new StreamTemplateAction();
}
}
See more files for this project here