// rci.setItemOrder(order);
}
}
else if (def instanceof Presenter){
Presenter presenter = (Presenter) def;
// presenter.getDMO().addUsesRunContextItem("eventBus");
presenters.put(def.getCamelCaseName(), presenter);
components.put(def.getCamelCaseName(), presenter);
// All Presenters are available for access from the run context. They are created on demand.
RunContextItem rci = new RunContextItem();
rci.setAutoCreated(true);
RunContextItemCollection rcic = contexts.get(rci.getContextImpl());
rci.setItemName(presenter.getPresenterName().getNameString() + "RCI");
rci.setDescription("The auto generated run context item for the " + presenter.getPresenterName());
if (presenter.getSubpackage() == null)
rci.setUseClass(currentModule.getGenPackage() + ".extended." + presenter.getPresenterName());
else
rci.setUseClass(currentModule.getGenPackage() + ".extended." + presenter.getSubpackage() + "." + presenter.getPresenterName());
if (presenter.usesRunContext()){
if (presenter.isCodeSplit())
rci.setConstruction("new " + presenter.getPresenterName() + "(thisContext)");
else
rci.setConstruction("new " + presenter.getPresenterName() + "(this)");
}
else
rci.setConstruction("new " + presenter.getPresenterName() + "()");
rci.setDefinedInModule(presenter.getDefinedInModule());
rci.setPresenter(presenter);
if (rcic == null){
rcic = new RunContextItemCollection(rci.getContextImpl());
contexts.put(rci.getContextImpl(), rcic);
}
rcic.addItem(rci);
// Add the item to its module
rci.getDefinedInModule().addRunContextItem(rci);
// We make it so that the presenter instance is created as required
rci.setCreateOnDemand(true);
rci.setSingleton(presenter.isSingleton());
// Tell the presenter its item
presenter.setRunContextItem(rci);
// Also add to our full set of definitions
allDefs.put(rci.getItemName(), rci);
}