// activity.getDMO().addUsesRunContextItem("eventBus");
activities.put(def.getCamelCaseName(), activity);
components.put(def.getCamelCaseName(), activity);
}
else if (def instanceof View){
View view = (View) def;
views.put(def.getCamelCaseName(), view);
if (view.requiresEventBus()){
view.getDMO().addUsesRunContextItem("eventBus");
}
// All Views 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(view.getViewName().getNameString() + "RCI");
rci.setDescription("The auto generated run context item for the " + view.getViewName());
if (view.getSubpackage() == null)
rci.setUseClass(currentModule.getGenPackage() + ".extended." + view.getViewName());
else
rci.setUseClass(currentModule.getGenPackage() + ".extended." + view.getSubpackage() + "." + view.getViewName());
if (view.getUsesRunContextItemHasValue()){
if (view.isCodeSplit())
rci.setConstruction("new " + view.getViewName() + "(presenter, thisContext)");
else
rci.setConstruction("new " + view.getViewName() + "(presenter, this)");
}
else
rci.setConstruction("new " + view.getViewName() + "(presenter)");
// // BIG NOTE: we don't specify the arguments to the constructor, this will depend on figuring
// // out if the component needs run context items. We determine this in the RunContextItem.
// rci.setConstruction("new " + view.getViewName());
// NOTE: in addition to setting the construction mechanism, we also set the view
// on the context item so that it knows how to create the on demand method that takes
// the View's presenter.
rci.setView(view);
rci.setDefinedInModule(view.getDefinedInModule());
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 view instance is created as required
rci.setCreateOnDemand(true);
// rci.setTheOne(view.isTheOne());
// Tell the view its item
view.setRunContextItem(rci);
}
else if (def instanceof Event){
events.put(def.getCamelCaseName(), (Event) def);
}