Package org.dmrad.view.context

Examples of org.dmrad.view.context.ViewContext


  public ProjectListPanel(final ModelContext modelContext,
      final ViewContext viewContext) {
    super(modelContext, viewContext);
    try {
      ModelContext projectsModelContext = new ModelContext(modelContext);
      ViewContext projectsViewContext = new ViewContext(viewContext);
      projectsViewContext.setWicketId("projectList");
      ProjectList projectList = new ProjectList(projectsModelContext,
          projectsViewContext);
      add(projectList);
    } catch (Exception e) {
      log.error("Error in ProjectListPanel: " + e.getMessage());
View Full Code Here


                      modelContext);
                  parentModelContext.setEntity(parentEntity);
                  parentModelContext
                      .setPropertyConfig(parentConceptPropertyConfig);

                  ViewContext parentViewContext = new ViewContext(
                      viewContext);
                  parentViewContext.setWicketId("valuePanel");

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

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

      PropertiesConfig propertiesConfig = conceptConfig
          .getPropertiesConfig();
      for (IEntity config : propertiesConfig) {
        PropertyConfig propertyConfig = (PropertyConfig) config;
        String propertyCode = propertyConfig.getCode();
        String propertyKey = conceptConfig.getCode() + "."
            + propertyCode;
        String propertyName = getLocalizer().getString(propertyKey,
            this);
        PropertyNameLabelValuePanelPair propertyNameLabelValuePanelPair = new PropertyNameLabelValuePanelPair();
        Label propertyNameLabel = new Label("propertyName",
            propertyName);
        propertyNameLabelValuePanelPair
            .setPropertyNameLabel(propertyNameLabel);
        ModelContext entityModelContext = new ModelContext(modelContext);
        entityModelContext.setPropertyConfig(propertyConfig);
        Panel propertyValuePanel;
        if (propertyConfig.getPropertyClass().equals(
            "java.lang.Boolean")) {
          ViewContext checkBoxPanelContext = new ViewContext(
              viewContext);
          checkBoxPanelContext.setWicketId("valuePanel");
          propertyValuePanel = new CheckBoxPanel(entityModelContext,
              checkBoxPanelContext);
        } else if (propertyConfig.getPropertyClass().equals(
            "java.lang.String")
            && propertyConfig.getDisplayLengthInt() > App.MIN_LONG_TEXT_LENGTH) {
          ViewContext textAreaPanelContext = new ViewContext(
              viewContext);
          textAreaPanelContext.setWicketId("valuePanel");
          propertyValuePanel = new TextAreaPanel(entityModelContext,
              textAreaPanelContext);
        } else if (propertyConfig.isReference()) {
          String neighborCode = propertyConfig.getReferenceNeighbor();
          NeighborConfig neighborConfig = conceptConfig
              .getNeighborsConfig().getNeighborConfig(
                  neighborCode);
          String neighborConceptCode = neighborConfig
              .getDestination();
          IPersistentEntities persistentEntities = app.getDbContext()
              .getPersistentModel().getPersistentEntry(
                  neighborConceptCode);
          IOrderedEntities lookupEntities = null;
          if (persistentEntities != null) {
            lookupEntities = (IOrderedEntities) persistentEntities
                .getEntities();
          }
          if (lookupEntities != null) {
            ModelContext neighborModelContext = new ModelContext(
                modelContext);
            neighborModelContext.setPropertyConfig(propertyConfig);
            neighborModelContext.setLookupEntities(lookupEntities);
            ViewContext lookupViewContext = new ViewContext(
                viewContext);
            lookupViewContext.setWicketId("valuePanel");
            if (neighborConfig.getMinInt() == 0) {
              propertyValuePanel = new LookupEmptyPanel(
                  neighborModelContext, lookupViewContext);

            } else {
              propertyValuePanel = new LookupPanel(
                  neighborModelContext, lookupViewContext);
            }
          } else {
            ViewContext textFieldPanelContext = new ViewContext(
                viewContext);
            textFieldPanelContext.setWicketId("valuePanel");
            propertyValuePanel = new TextFieldPanel(entityModelContext,
                textFieldPanelContext);
          }
        } else if (propertyConfig.isValidateType()
            && propertyConfig
                .isValidatationTypeEntities(domainModel)) {
          ViewContext dropDownChoicePanelContext = new ViewContext(
              viewContext);
          dropDownChoicePanelContext.setWicketId("valuePanel");
          propertyValuePanel = new TypeValueDropDownChoicePanel(
              entityModelContext, dropDownChoicePanelContext);
        } else {
          ViewContext textFieldPanelContext = new ViewContext(
              viewContext);
          textFieldPanelContext.setWicketId("valuePanel");
          propertyValuePanel = new TextFieldPanel(entityModelContext,
              textFieldPanelContext);
        } // end if
        if (!app.isPropertyDisplayAllowed(getAppSession(),
            propertyConfig)) {
          propertyNameLabel.setVisible(false);
          propertyValuePanel.setVisible(false);
        } else if (!app.isPropertyUpdateAllowed(getAppSession(),
            propertyConfig)) {
          ViewContext labelPanelContext = new ViewContext(viewContext);
          labelPanelContext.setWicketId("valuePanel");
          propertyValuePanel = new LabelPanel(entityModelContext,
              labelPanelContext);
        }

        propertyNameLabelValuePanelPair
            .setPropertyValuePanel(propertyValuePanel);
        propertyNameLabelValuePanelPairs
            .add(propertyNameLabelValuePanelPair);
      } // end for

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

      add(new Button("cancel") {
        static final long serialVersionUID = 200721L;

        protected void onSubmit() {
          App app = viewContext.getApp();
          ModelContext entityUpdateTablePageModelContext = new ModelContext(
              modelContext);
          entityUpdateTablePageModelContext.setUpdateEntity(null);
          ViewContext entityUpdateTablePageViewContext = new ViewContext(
              viewContext);
          setResponsePage(app.getViewMeta().getPage(
              "EntityUpdateTablePage",
              entityUpdateTablePageModelContext,
              entityUpdateTablePageViewContext));
View Full Code Here

      App app = viewContext.getApp();

      ModelContext entityDisplayPanelModelContext = new ModelContext(
          modelContext);

      ViewContext entityDisplayPanelViewContext = new ViewContext(
          viewContext);
      entityDisplayPanelViewContext.setWicketId("entityDisplayPanel");
      entityDisplayPanelViewContext.setPage(this);
      entityDisplayPanelViewContext.setUpdate(false);

      add(app.getViewMeta().getPanel("EntityDisplayPanel",
          entityDisplayPanelModelContext,
          entityDisplayPanelViewContext));
    } catch (Exception e) {
View Full Code Here

      IEntity lookupEntity = (IEntity) item.getModelObject();
     
      ModelContext lookupModelContext = new ModelContext(baseModelContext);
      lookupModelContext.setEntity(lookupEntity);

      ViewContext lookupViewContext = new ViewContext(baseViewContext);
      lookupViewContext.setWicketId("entityLookup");
      item.add(new LookupCheckBox(lookupModelContext, lookupViewContext));

    } catch (Exception e) {
      log.error("Error in EntityLookupTableListView.populateItem: "
          + baseModelContext.getEntitiesCode() + e.getMessage());
View Full Code Here

                baseModelContext);
            entityAddFormPageModelContext
                .setEntities(baseModelContext
                    .getContextEntities());
            entityAddFormPageModelContext.setLookupEntities(null);
            ViewContext entityAddFormPageViewContext = new ViewContext(
                baseViewContext);
            entityAddFormPageViewContext.setUpdate(true);
            setResponsePage(app.getViewMeta().getPage(
                "EntityAddFormPage",
                entityAddFormPageModelContext,
                entityAddFormPageViewContext));
          } else {
            IEntity entity = baseModelContext.getUpdateEntity();
            entity.setNeighborEntity(neighborCode, lookupEntity);
            ModelContext entityEditFormPageModelContext = new ModelContext(
                baseModelContext);
            entityEditFormPageModelContext
                .setEntities(baseModelContext
                    .getContextEntities());
            entityEditFormPageModelContext.setLookupEntities(null);
            ViewContext entityEditFormPageViewContext = new ViewContext(
                baseViewContext);
            entityEditFormPageViewContext.setUpdate(true);
            setResponsePage(app.getViewMeta().getPage(
                "EntityEditFormPage",
                entityEditFormPageModelContext,
                entityEditFormPageViewContext));
          }
View Full Code Here

      if (newEntity == null) {
        newEntity = app.getModelMeta().createEntity(entities);
        entityAddFormModelContext.setEntity(newEntity);
      }

      ViewContext entityAddFormViewContext = new ViewContext(viewContext);
      entityAddFormViewContext.setWicketId("entityUpdateForm");

      add(app.getViewMeta().getForm("EntityAddForm",
          entityAddFormModelContext, entityAddFormViewContext));
    } catch (Exception e) {
      log.error("Error in EntityAddFormPanel: "
View Full Code Here

      add(new FeedbackPanel("feedbackPanel"));

      ModelContext entityDisplayPanelModelContext = new ModelContext(
          modelContext);

      ViewContext entityDisplayPanelViewContext = new ViewContext(
          viewContext);
      entityDisplayPanelViewContext.setPage(this);
      entityDisplayPanelViewContext.setWicketId("entityDisplayPanel");
      entityDisplayPanelViewContext.setUpdate(false);

      add(app.getViewMeta().getPanel("EntityDisplayPanel",
          entityDisplayPanelModelContext,
          entityDisplayPanelViewContext));

      ViewContext entityConfirmRemovePanelContext = new ViewContext(
          viewContext);
      entityConfirmRemovePanelContext.setPage(this);
      entityConfirmRemovePanelContext
          .setWicketId("entityConfirmRemovePanel");
      add(app.getViewMeta().getPanel("EntityConfirmRemovePanel",
          entityDisplayPanelModelContext,
          entityConfirmRemovePanelContext));
    } catch (Exception e) {
View Full Code Here

    try {
      ModelContext confirmRemoveFormModelContext = new ModelContext(
          modelContext);
      confirmRemoveFormModelContext.setAction("remove");

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

      add(new ConfirmRemoveForm(confirmRemoveFormModelContext,
          confirmRemoveFormViewContext));
    } catch (Exception e) {
      log.error("Error in EntityConfirmRemovePanel: "
View Full Code Here

                      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(
              "EntityDisplayListPanel", childEntitiesContext,
              entityDisplayListPanelContext);
          childList.add(entityDisplayListPanel);
View Full Code Here

        add(new Button("no") {
          static final long serialVersionUID = 200682L;

          protected void onSubmit() {
            App app = viewContext.getApp();
            ViewContext entityUpdateTablePageContext = new ViewContext(
                viewContext);
            setResponsePage(app.getViewMeta().getPage(
                "EntityUpdateTablePage", modelContext,
                entityUpdateTablePageContext));
          }
View Full Code Here

TOP

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

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.