Show ShowInstance.java syntax highlighted
package org.integratedmodelling.thinkcap.portal.commands;
import org.integratedmodelling.thinkcap.ThinkcapAction;
import org.integratedmodelling.thinkcap.ThinkcapAnswer;
import org.integratedmodelling.thinkcap.ThinkcapCommand;
import org.integratedmodelling.thinkcap.portal.widgets.OntologyTreeBrowser;
import org.integratedmodelling.thinkcap.ui.widgets.Layout;
import org.integratedmodelling.thinkcap.ui.widgets.TabWidget;
import org.integratedmodelling.thinklab.command.CommandDeclaration;
import org.integratedmodelling.thinklab.command.CommandPattern;
import org.integratedmodelling.thinklab.exception.ThinklabException;
import org.integratedmodelling.thinklab.interfaces.IAction;
public class ShowInstance extends CommandPattern {
class ShowConceptAction extends ThinkcapAction {
@Override
public void execute(ThinkcapCommand command, ThinkcapAnswer value) throws ThinklabException {
OntologyTreeBrowser bw = new OntologyTreeBrowser("obrowser", command.session, null, true);
TabWidget tw = new TabWidget("tabby", command.session);
int cTab = tw.addTab("Concept description",
command.getURLForCommand("ConceptPage", "concept", "observation:Observation"));
int pTab = tw.addTab("Current Portfolio", "<b>Hello Stupid World</b>");
int sTab = tw.addTab("Search for data", "<b>Hello Stupid World</b>");
int dTab = tw.addTab("Specify similar", "<b>Hello Stupid World</b>");
// ConceptExplorer tw = new ConceptExplorer("tabby", command.session,
// command.session.getConcept("observation:Observation"));
Layout widget =
new Layout("widget", command.session, Layout.LayoutType.SMALL_LEFTBAR_NORMAL_CONTENT, "ThinkCap Dictionary");
bw.setAJAXTargetElement(tw.getElementName(cTab));
// bw.setAJAXTargetElement(widget.getPrimaryContentID());
String linkTemplate = "ShowConcept.cmd?concept=@NODE@";
bw.setLinkTemplate(linkTemplate);
widget.setContent(tw);
widget.setSecondaryContent(bw);
// SearchWidget sf = new SearchWidget("searchy", "ConceptSearch.cmd");
/* create widget with chosen concept as parameter; set into "dictionary" variable */
command.getWidgetManager().addWidget(widget);
// command.getWidgetManager().addWidget(sf);
value.setOutputTemplate("ShowWidgetFrame");
}
}
@Override
public CommandDeclaration createCommand() {
CommandDeclaration ret = new CommandDeclaration("ShowIndividual", "");
// try {
// ret.addMandatoryArgument("resource", "",
// KnowledgeManager.KM().getTextType().getSemanticType());
// } catch (ThinklabException e) {
// }
return ret;
}
@Override
public IAction createAction() {
return new ShowConceptAction();
}
}
See more files for this project here