Show ThinkcapAnswer.java syntax highlighted
package org.integratedmodelling.thinkcap;
import java.io.File;
import org.apache.velocity.VelocityContext;
import org.integratedmodelling.thinklab.exception.ThinklabNoKMException;
import org.integratedmodelling.thinklab.interfaces.IConcept;
import org.integratedmodelling.thinklab.value.Value;
/**
* A specialized value that holds an answer to a Thinkcap command, including whether a template should
* be generated or an image fetched from the plugin storage and output.
*
* All ThinkcapCommand actions return a ThinkcapAnswer. This way all Thinkcap operations
* are accomplished by creating ThinkcapCommands, which is all API users need to learn.
*
* @author Ferdinando Villa, Ecoinformatics Collaboratory, UVM
*
*/
public class ThinkcapAnswer extends Value {
public String template = null;
public File image = null;
public String style = null;
private VelocityContext context;
public ThinkcapAnswer() throws ThinklabNoKMException {
super();
// TODO Auto-generated constructor stub
}
public ThinkcapAnswer(IConcept arg0) {
super(arg0);
// TODO Auto-generated constructor stub
}
public ThinkcapAnswer(VelocityContext context) throws ThinklabNoKMException {
super();
this.context = context;
}
/**
* Set a variable into the context for the next template output.
*
* @param varname
* @param object
*/
public void setVariable(String varname, Object object) {
context.put(varname, object);
}
public String getVariableAsString(String varname) {
return null;
}
public void setOutputImage(File imageFile) {
image = imageFile;
}
public Object getVariable(String varname) {
return null;
}
public void setOutputTemplate(String templatename) {
template = templatename;
}
public void setStyle(String s) {
style = s;
}
public void resetPage() {
((PageSpecs)context.get("pageSpecs")).reset();
}
}
See more files for this project here