Package org.dmrad.view.context

Examples of org.dmrad.view.context.ModelContext


    try {
      App app = viewContext.getApp();

      add(new FeedbackPanel("feedbackPanel"));

      ModelContext entityDisplayPanelModelContext = new ModelContext(
          modelContext);

      ViewContext entityDisplayPanelViewContext = new ViewContext(
          viewContext);
      entityDisplayPanelViewContext.setPage(this);
View Full Code Here


   */
  public EntityConfirmRemovePanel(final ModelContext modelContext,
      final ViewContext viewContext) {
    super(modelContext, viewContext);
    try {
      ModelContext confirmRemoveFormModelContext = new ModelContext(
          modelContext);
      confirmRemoveFormModelContext.setAction("remove");

      ViewContext confirmRemoveFormViewContext = new ViewContext(
          viewContext);
      confirmRemoveFormViewContext.setWicketId("confirmRemoveForm");

View Full Code Here

      App app = viewContext.getApp();

      ConceptConfig conceptConfig = entity.getConceptConfig();
      String conceptCode = conceptConfig.getCode();

      ModelContext entityModelContext = new ModelContext(modelContext);
      entityModelContext.setEntity(entity);

      List<PropertyNameLabelValuePanelPair> propertyNameLabelValuePanelPairs = new ArrayList<PropertyNameLabelValuePanelPair>();

      // Properties absorbed from parents.
      NeighborsConfig neighborsConfig = conceptConfig
          .getNeighborsConfig();
      for (IEntity neighborConfigEntity : neighborsConfig) {
        NeighborConfig neighborConfig = (NeighborConfig) neighborConfigEntity;
        if (neighborConfig.getType().equals("parent")
            && neighborConfig.getMax().equals("1")
            && neighborConfig.isAbsorb()) {
          ConceptConfig parentConceptConfig = neighborConfig
              .getNeighborDestinationConceptConfig();
          if (parentConceptConfig != null) {
            if (conceptCode.equals(neighborConfig
                .getContextConceptConfig().getCode())
                && parentConceptConfig.getDisplayType().equals(
                    "slide")) {
              // Do not absorb the context parent properties when
              // the parent is displayed as a slide.
              continue;
            }
            PropertiesConfig parentConceptPropertiesConfig = parentConceptConfig
                .getPropertiesConfig();
            for (IEntity parentPropertyConfigEntity : parentConceptPropertiesConfig) {
              PropertyConfig parentConceptPropertyConfig = (PropertyConfig) parentPropertyConfigEntity;
              if (parentConceptPropertyConfig.isEssential()) {
                IEntity parentEntity = entity
                    .getNeighborEntity(neighborConfig
                        .getCode());
                if (parentEntity != null) {
                  String parentCode = parentEntity
                      .getConceptConfig().getCode();
                  String parentPropertyKey = parentCode
                      + "."
                      + parentConceptPropertyConfig
                          .getCode();
                  String parentPropertyName = getLocalizer()
                      .getString(parentPropertyKey, this);
                  Label parentPropertyNameLabel = new Label(
                      "propertyName", parentPropertyName);
                  PropertyNameLabelValuePanelPair propertyNameLabelValuePanelPair = new PropertyNameLabelValuePanelPair();
                  propertyNameLabelValuePanelPair
                      .setPropertyNameLabel(parentPropertyNameLabel);

                  ModelContext parentModelContext = new ModelContext(
                      modelContext);
                  parentModelContext.setEntity(parentEntity);
                  parentModelContext
                      .setPropertyConfig(parentConceptPropertyConfig);

                  ViewContext parentViewContext = new ViewContext(
                      viewContext);
                  parentViewContext.setWicketId("valuePanel");
                  Panel parentPropertyPanel;
                  if (parentConceptPropertyConfig
                      .getPropertyClass().equals(
                          "java.net.URL")
                      || parentConceptPropertyConfig
                          .getPropertyClass()
                          .equals(
                              "org.dmlite.type.email.Email")) {
                    parentPropertyPanel = new ExternalLinkPanel(
                        parentModelContext,
                        parentViewContext);
                  } else {
                    parentPropertyPanel = new LabelPanel(
                        parentModelContext,
                        parentViewContext);
                  } // if
                  if (!app.isNeighborDisplayAllowed(
                      getAppSession(), neighborConfig)) {
                    parentPropertyPanel.setVisible(false);
                  } else if (!app.isPropertyDisplayAllowed(
                      getAppSession(),
                      parentConceptPropertyConfig)) {
                    parentPropertyPanel.setVisible(false);
                  }

                  propertyNameLabelValuePanelPair
                      .setPropertyValuePanel(parentPropertyPanel);
                  propertyNameLabelValuePanelPairs
                      .add(propertyNameLabelValuePanelPair);
                } // if
              } // if
            } // for
          } // if
        } // if
      } // for

      PropertiesConfig propertiesConfig = conceptConfig
          .getPropertiesConfig();
      for (IEntity propertyConfigEntity : propertiesConfig) {
        PropertyConfig propertyConfig = (PropertyConfig) propertyConfigEntity;
        if (!propertyConfig.isReference()) {
          String propertyKey = conceptCode + "."
              + propertyConfig.getCode();
          String propertyName = getLocalizer().getString(propertyKey,
              this);
          Label propertyNameLabel = new Label("propertyName",
              propertyName);
          PropertyNameLabelValuePanelPair propertyNameLabelValuePanelPair = new PropertyNameLabelValuePanelPair();
          propertyNameLabelValuePanelPair
              .setPropertyNameLabel(propertyNameLabel);

          entityModelContext.setPropertyConfig(propertyConfig);
          ViewContext propertiesViewContext = new ViewContext(
              viewContext);
          propertiesViewContext.setWicketId("valuePanel");
          Panel propertyValuePanel;
          if (propertyConfig.getPropertyClass()
              .equals("java.net.URL")
              || propertyConfig.getPropertyClass().equals(
                  "org.dmlite.type.email.Email")) {
            propertyValuePanel = new ExternalLinkPanel(
                entityModelContext, propertiesViewContext);
          } else if (propertyConfig.getPropertyClass().equals(
              "java.lang.String")
              && propertyConfig.isValidateType()
              && (propertyConfig.getValidationType().equals(
                  "java.net.URL") || propertyConfig
                  .getValidationType().equals(
                      "org.dmlite.type.email.Email"))) {
            propertyValuePanel = new ExternalLinkPanel(
                entityModelContext, propertiesViewContext);
          } else {
            propertyValuePanel = new LabelPanel(entityModelContext,
                propertiesViewContext);
          }
          if (!app.isPropertyDisplayAllowed(getAppSession(),
              propertyConfig)) {
            propertyNameLabel.setVisible(false);
            propertyValuePanel.setVisible(false);
          }

          propertyNameLabelValuePanelPair
              .setPropertyValuePanel(propertyValuePanel);
          propertyNameLabelValuePanelPairs
              .add(propertyNameLabelValuePanelPair);
        }
      }

      ListView propertyNameLabelValuePanelListView = new PropertyNameLabelValuePanelListView(
          "propertyNameLabelValuePanelListView",
          propertyNameLabelValuePanelPairs);
      item.add(propertyNameLabelValuePanelListView);
      if (!app.isConceptDisplayAllowed(getAppSession(), conceptConfig)) {
        propertyNameLabelValuePanelListView.setVisible(false);
      }

      List<Panel> childList = new ArrayList<Panel>();
      for (IEntity neighborConfigEntity : neighborsConfig) {
        NeighborConfig neighborConfig = (NeighborConfig) neighborConfigEntity;
        if (neighborConfig.getType().equals("child")) {
          String childCode = neighborConfig.getCode();
          IDomainModel domainModel = app.getDomainModel();
          IOrderedEntities childEntities = (IOrderedEntities) domainModel
              .getModelMeta().getNeighborEntities(entity,
                  childCode);
          ModelContext childEntitiesContext = new ModelContext(
              modelContext);
          childEntitiesContext.setEntities(childEntities);
          ViewContext entityDisplayListPanelContext = new ViewContext(
              viewContext);
          entityDisplayListPanelContext
              .setWicketId("entityDisplayListPanel");
          Panel entityDisplayListPanel = app.getViewMeta().getPanel(
View Full Code Here

   */
  public ApplicantAddFormPanel(final ModelContext modelContext,
      final ViewContext viewContext) {
    super(modelContext, viewContext);
    try {
      ModelContext applicantModelContext = new ModelContext(modelContext);
      Applicants applicants = (Applicants) modelContext.getEntities();
      if (applicants != null) {
        applicantModelContext.setEntities(applicants);
        Applicant applicant = new Applicant(applicants.getDomainModel());
        applicantModelContext.setEntity(applicant);

        ViewContext applicantViewContext = new ViewContext(viewContext);
        applicantViewContext.setWicketId("entityUpdateForm");
        add(new ApplicantAddForm(applicantModelContext,
            applicantViewContext));
View Full Code Here

   *            model context
   * @return model context
   */
  private static ModelContext getNewModelContext(
      final ModelContext modelContext) {
    ModelContext newModelContext = new ModelContext(modelContext);
    Infos infos = (Infos) modelContext.getEntities();
    infos = infos.getInfosOrderedByCreationDate(false);
    newModelContext.setEntities(infos);
    return newModelContext;
  }
View Full Code Here

          entityPropertyKey, this);
      Label entityPropertyTitleLabel = new Label("entityPropertyTitle",
          entityPropertyTitle);
      add(entityPropertyTitleLabel);

      ModelContext entityPropertyListModelContext = new ModelContext(
          modelContext);
      ViewContext entityPropertyListViewContext = new ViewContext(
          viewContext);
      entityPropertyListViewContext.setWicketId("entityPropertyList");
View Full Code Here

   */
  public LoginPage() {
    String loginConcept = app.getModelConfig().getLoginConcept();
    Members members = (Members) app.getEntry(loginConcept);
    try {
      ModelContext menuModelContext = new ModelContext();
      menuModelContext.setDomainModel(app.getDomainModel());
      ViewContext menuViewContext = new ViewContext();
      menuViewContext.setApp(app);
      menuViewContext.setContextPage(this);
      menuViewContext.setPage(this);
      menuViewContext.setWicketId("dmRadMenuPanel");
      add(app.getViewMeta().getDmRadMenuPanel(menuModelContext,
          menuViewContext));

      add(new FeedbackPanel("loginFeedback"));

      ModelContext loginModelContext = new ModelContext();
      loginModelContext.setDomainModel(app.getDomainModel());
      loginModelContext.setEntities(members);
      loginModelContext.setEntity(new Member(members.getDomainModel()));
      ViewContext loginViewContext = new ViewContext();
      loginViewContext.setApp(app);
      loginViewContext.setContextPage(this);
      loginViewContext.setPage(this);
      loginViewContext.setWicketId("loginPanel");
      loginViewContext.setUpdate(true);
      add(app.getViewMeta().getLoginPanel(loginModelContext,
          loginViewContext));

      ModelContext confirmationModelContext = new ModelContext();
      confirmationModelContext.setDomainModel(app.getDomainModel());
      confirmationModelContext.setEntities(members);
      ViewContext confirmationViewContext = new ViewContext();
      confirmationViewContext.setApp(app);
      confirmationViewContext.setContextPage(this);
      confirmationViewContext.setPage(this);
      confirmationViewContext.setWicketId("newMemberConfirmPanel");
View Full Code Here

  protected void populateItem(final ListItem item) {
    try {
      Link link = (Link) item.getModelObject();

      ModelContext linkModelContext = new ModelContext(modelContext);
      linkModelContext.setEntity(link);
      PropertyConfig urlPropertyConfig = link.getConceptConfig()
          .getPropertyConfig("url");
      linkModelContext.setPropertyConfig(urlPropertyConfig);
     
      ViewContext linkViewContext = new ViewContext(viewContext);
      linkViewContext.setWicketId("externalLink");
      linkViewContext.getMoreArgs().add("displayText", link.getName());
     
View Full Code Here

   *            model context
   * @return model context
   */
  private static ModelContext getNewModelContext(
      final ModelContext modelContext) {
    ModelContext newModelContext = new ModelContext(modelContext);
    Infos infos = (Infos) modelContext.getEntities();
    infos = infos.getInfosOrderedByCreationDate(false);
    newModelContext.setEntities(infos);
    return newModelContext;
  }
View Full Code Here

   *            model context
   * @return model context
   */
  private static ModelContext getNewModelContext(
      final ModelContext modelContext) {
    ModelContext newModelContext = new ModelContext(modelContext);
    Infos infos = (Infos) modelContext.getEntities();
    infos = infos.getInfosOrderedByCreationDate(false);
    newModelContext.setEntities(infos);
    return newModelContext;
  }
View Full Code Here

TOP

Related Classes of org.dmrad.view.context.ModelContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.