Example #1
0
  public VariationViewController getVariationViewController() {
    DataModel variationModel = new DataModel();
    //        variationModel.setDefinition(programModel.getDefinition());
    DataModelDefinition definition = new DataModelDefinition();
    definition.setMetadata(programModel.getDefinition().getMetadata("variations/*"));
    variationModel.setDefinition(definition);
    variationModel.setRoot(ProgramRegistry.getData());

    // Determine if we are coming from a link to a proposal
    // If so, we need to instantiate the variation controller using an
    // instance of the proposal controller, otherwise we should just
    // use the major discipline controller
    MajorController theController = null;

    // Look in model to see if we have passed a flag to say we are working with
    // a proposal (passed from VariationsBinding.java, search for isProposal)
    boolean comingFromProposal =
        variationModel != null
            && variationModel.get("isProposal") != null
            && majorProposalController != null;

    if (comingFromProposal) {
      // We are coming from a link to a proposal, so use the proposal controller
      theController = majorProposalController;
    } else {
      // This is not a link to a proposal, so use the normal major discipline controller
      theController = (MajorController) majorViewController;
    }

    // Fix for 2417
    // A case exists where we are coming from majorEditController
    // TODO: we really need to think about how this works rather than
    // add these if/then cases, but we are out of time
    if (theController == null && majorEditController != null) {
      theController = majorEditController;
    }

    // Instantiate a controller used to work with the specialization, passing it
    // either the proposal controller or the major discipline controller
    variationViewController =
        new VariationViewController(variationModel, viewContext, eventBus, theController);

    return variationViewController;
  }
Example #2
0
 public MajorViewController getProgramViewController() {
   programModel.resetRoot();
   getMajorViewController();
   eventBus.fireEvent(new ProgramViewEvent());
   return majorViewController;
 }
Example #3
0
 public MajorEditController getProgramEditController() {
   programModel.resetRoot();
   return getMajorEditController();
 }