Package org.dmrad.view

Examples of org.dmrad.view.App


   */
  public EntityDisplayTablePanel(final ModelContext modelContext,
      final ViewContext viewContext) {
    super(viewContext.getWicketId());
    try {
      App app = viewContext.getApp();
     
      IEntities entities = modelContext.getEntities();
      ConceptConfig conceptConfig = entities.getConceptConfig();

      // Table title
      String conceptsKey = conceptConfig.getEntitiesCode();
      String conceptsName = getLocalizer().getString(conceptsKey, this);
      add(new Label("conceptsName", conceptsName));

      // Absorbed parent essential property names
      List<String> parentEssentialPropertyNames = new ArrayList<String>();
      List<String> parentEssentialPropertyCodes = entities
          .getConceptConfig().getParentCodeEssentialPropertyCodes();

      String parentPropertyName;
      for (String parentPropertyKey : parentEssentialPropertyCodes) {
        parentPropertyName = getLocalizer().getString(
            parentPropertyKey, this);
        parentEssentialPropertyNames.add(parentPropertyName);
      }

      // Concept essential property names
      List<String> conceptEssentialPropertyNames = new ArrayList<String>();
      List<String> conceptEssentiaPropertyCodes = entities
          .getConceptConfig().getConceptCodeEssentialPropertyCodes();
      String conceptPropertyName;
      for (String conceptPropertyKey : conceptEssentiaPropertyCodes) {
        conceptPropertyName = getLocalizer().getString(
            conceptPropertyKey, this);
        conceptEssentialPropertyNames.add(conceptPropertyName);
      }

      List<String> essentialPropertyNames = parentEssentialPropertyNames;
      essentialPropertyNames.addAll(conceptEssentialPropertyNames);
      add(new PropertyNameLabelListView("propertyNameLabelListView",
          essentialPropertyNames));

      // Neighbor empty labels
      List<String> childNeighborNames = conceptConfig
          .getChildNeighborNames();
      add(new NeighborEmptyNameLabelListView(
          "neighborEmptyNameLabelListViewHead", childNeighborNames));

      ModelContext entityDisplayTableListModelContext = new ModelContext(
          modelContext);

      ViewContext entityDisplayTableListViewContext = new ViewContext(
          viewContext);
      entityDisplayTableListViewContext
          .setWicketId("entityDisplayTableListView");

      PageableListView entityDisplayTableListView = app.getViewMeta()
          .getPageableListView("EntityDisplayTableListView",
              entityDisplayTableListModelContext,
              entityDisplayTableListViewContext);
      add(entityDisplayTableListView);
      if (!app.isConceptDisplayAllowed(getAppSession(), conceptConfig)) {
        entityDisplayTableListView.setVisible(false);
      }

      add(new PropertyEmptyNameLabelListView(
          "propertyEmptyNameLabelListView", essentialPropertyNames));
View Full Code Here


   */
  public EntityEditFormPage(final ModelContext modelContext,
      final ViewContext viewContext) {
    super(modelContext, viewContext);
    try {
      App app = viewContext.getApp();

      add(new FeedbackPanel("feedbackPanel"));

      ModelContext entityEditFormPanelModelContext = new ModelContext(
          modelContext);
      entityEditFormPanelModelContext.setAction("update");

      ViewContext entityEditFormPanelViewContext = new ViewContext(
          viewContext);
      entityEditFormPanelViewContext.setPage(this);
      entityEditFormPanelViewContext.setWicketId("entityEditFormPanel");

      add(app.getViewMeta().getPanel("EntityEditFormPanel",
          entityEditFormPanelModelContext,
          entityEditFormPanelViewContext));
    } catch (Exception e) {
      log.error("Error in EntityEditFormPage: "
          + modelContext.getEntitiesCode() + " - " + e.getMessage());
View Full Code Here

   */
  protected void populateItem(ListItem item) {
    IOrderedEntities entry = (IOrderedEntities) item.getModelObject();
    ConceptConfig entryConceptConfig = entry.getConceptConfig();
    try {
      App app = viewContext.getApp();

      String conceptKey = entryConceptConfig.getCode();
      String conceptName = getLocalizer().getString(conceptKey, this);
      Label entryConceptName = new Label("entryName", conceptName);
      item.add(entryConceptName);

      ModelContext entryContext = new ModelContext(modelContext);
      entryContext.setEntities(entry);
      ViewContext entityUpdateTablePageContext = new ViewContext(
          viewContext);
      WebPage entryConceptPage = app.getViewMeta().getPage(
          "EntityUpdateTablePage", entryContext,
          entityUpdateTablePageContext);
      Link entryConceptLink = new PageLink("entryUpdateTable",
          entryConceptPage);
      item.add(entryConceptLink);
      if (!app.isConceptDisplayAllowed(getAppSession(),
          entryConceptConfig)) {
        entryConceptLink.setVisible(false);
      } else if (!app.isConceptUpdateAllowed(getAppSession(),
          entryConceptConfig)) {
        entryConceptLink.setVisible(false);
      }
    } catch (Exception e) {
      log.error("Error in EntryUpdateTableListView: "
View Full Code Here

      final ViewContext viewContext) {
    super(modelContext, viewContext);
    try {
      final PropertyConfig baseEntityPropertyConfig = modelContext
          .getPropertyConfig();
      final App app = viewContext.getApp();

      if (baseEntityPropertyConfig.isReference()
          && !baseEntityPropertyConfig.isRequired()) {
        emptyLink = new Link("emptyLink") {
          static final long serialVersionUID = 200861L;
          public void onClick() {
            ModelContext entityEditFormPageModelContext = new ModelContext(
                modelContext);
            IEntity afterUpdateEntity = entityEditFormPageModelContext
                .getUpdateEntity();
            if (afterUpdateEntity != null) {
              afterUpdateEntity.setProperty(baseEntityPropertyConfig
                  .getCode(), null);
              ViewContext entityEditFormPageViewContext = new ViewContext(
                  viewContext);
              if (modelContext.getAction().equals("update")) {
                setResponsePage(app.getViewMeta().getPage(
                    "EntityEditFormPage",
                    entityEditFormPageModelContext,
                    entityEditFormPageViewContext));
              }
            }
View Full Code Here

  /**
   * Submits a user action.
   */
  protected void onSubmit() {
    try {
      App app = viewContext.getApp();
     
      IEntities<IEntity> entities = modelContext.getEntities();
      IEntity entity = modelContext.getEntity();
      IEntity updateEntity = modelContext.getUpdateEntity();
      ConceptConfig conceptConfig = entities.getConceptConfig();

      if (app.isConceptUpdateAllowed(getAppSession(), conceptConfig,
          entity, "update")) {
        entities.getErrors().empty();
        if (entities.update(entity, updateEntity)) {
          ModelContext entityUpdateTablePageModelContext = new ModelContext(
              modelContext);
          entityUpdateTablePageModelContext.setUpdateEntity(null);
          ViewContext entityUpdateTablePageViewContext = new ViewContext(
              viewContext);
          setResponsePage(app.getViewMeta().getPage(
              "EntityUpdateTablePage",
              entityUpdateTablePageModelContext,
              entityUpdateTablePageViewContext));
        } else {
          addDmLiteErrorKeys(entities);
View Full Code Here

   */
  public EntityDisplaySlidePanel(final ModelContext modelContext,
      final ViewContext viewContext) {
    super(modelContext, viewContext);
    try {
      final App app = viewContext.getApp();
     
      final IOrderedEntities entities = modelContext.getOrderedEntities();
      final IEntity entity = modelContext.getEntity();

      ConceptConfig conceptConfig = entity.getConceptConfig();
      ModelContext slideNavigateModelContext = new ModelContext(
          modelContext);

      ViewContext slideNavigateViewContext = new ViewContext(viewContext);
      slideNavigateViewContext.setWicketId("slideNavigatePanel");
      Panel entitySlideNavigatePanel = new EntitySlideNavigatePanel(
          slideNavigateModelContext, slideNavigateViewContext);
      add(entitySlideNavigatePanel);
      if (!app.isConceptDisplayAllowed(getAppSession(), conceptConfig)) {
        entitySlideNavigatePanel.setVisible(false);
      }

      List<Panel> neighborList = new ArrayList<Panel>();
      NeighborsConfig neighborsConfig = conceptConfig
          .getNeighborsConfig();
      for (IEntity neighborConfigEntity : neighborsConfig) {
        NeighborConfig neighborConfig = (NeighborConfig) neighborConfigEntity;
        if (neighborConfig.getType().equals("child")) {
          String neighborCode = neighborConfig.getCode();
          IDomainModel domainModel = app.getDomainModel();
          IOrderedEntities childEntities = (IOrderedEntities) domainModel
              .getModelMeta().getNeighborEntities(entity,
                  neighborCode);

          ModelContext neighborModelContext = new ModelContext(
              modelContext);
          neighborModelContext.setContextEntities(entities);
          neighborModelContext.setContextEntity(entity);
          neighborModelContext.setEntities(childEntities);

          ViewContext neighborViewContext = new ViewContext(
              viewContext);
          neighborViewContext.setWicketId("entityDisplayListPanel");

          Panel entityDisplayListPanel = app.getViewMeta().getPanel(
              "EntityDisplayListPanel", neighborModelContext,
              neighborViewContext);
          neighborList.add(entityDisplayListPanel);
          if (!app.isNeighborDisplayAllowed(getAppSession(),
              neighborConfig)) {
            entityDisplayListPanel.setVisible(false);
          }
        } // if (neighborConfig.getType().equals("child")) {
      } // for
View Full Code Here

   */
  public EntityUpdateTablePage(final ModelContext modelContext,
      final ViewContext viewContext) {
    super(modelContext, viewContext);
    try {
      App app = viewContext.getApp();

      add(new FeedbackPanel("feedbackPanel"));

      ModelContext entityUpdateTablePanelModelContext = new ModelContext(
          modelContext);
      entityUpdateTablePanelModelContext.setAction(null);

      ViewContext entityUpdateTablePanelViewContext = new ViewContext(
          viewContext);
      entityUpdateTablePanelViewContext.setContextPage(this);
      entityUpdateTablePanelViewContext.setPage(this);
      entityUpdateTablePanelViewContext.setUpdate(true);
      entityUpdateTablePanelViewContext
          .setWicketId("entityUpdateTablePanel");

      add(app.getViewMeta().getPanel("EntityUpdateTablePanel",
          entityUpdateTablePanelModelContext,
          entityUpdateTablePanelViewContext));
    } catch (Exception e) {
      log.error("Error in EntityUpdateTablePage: "
          + modelContext.getEntitiesCode() + " - " + e.getMessage());
View Full Code Here

   */
  public EntityDisplayPanel(final ModelContext modelContext,
      final ViewContext viewContext) {
    super(viewContext.getWicketId());
    try {
      App app = viewContext.getApp();
     
      IEntity entity = modelContext.getEntity();

      ConceptConfig conceptConfig = entity.getConceptConfig();
      String conceptKey = conceptConfig.getCode();
      String conceptName = getLocalizer().getString(conceptKey, this);
      add(new Label("conceptName", conceptName));

      ModelContext entityContext = new ModelContext(modelContext);

      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) {
            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 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 propertyConfigEntity : propertiesConfig) {
        PropertyConfig propertyConfig = (PropertyConfig) propertyConfigEntity;
        if (!propertyConfig.isReference()) {
          String propertyKey = conceptConfig.getCode() + "."
              + propertyConfig.getCode();
          String propertyName = getLocalizer().getString(propertyKey,
              this);
          Label propertyNameLabel = new Label("propertyName",
              propertyName);
          PropertyNameLabelValuePanelPair propertyNameLabelValuePanelPair = new PropertyNameLabelValuePanelPair();
          propertyNameLabelValuePanelPair
              .setPropertyNameLabel(propertyNameLabel);
          entityContext.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(entityContext,
                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(entityContext,
                propertiesViewContext);

          } else if (propertyConfig.getPropertyClass().equals(
              "java.lang.Boolean")) {
            propertyValuePanel = new CheckBoxPanel(entityContext,
                propertiesViewContext);

          } else if (propertyConfig.getPropertyClass().equals(
              "java.lang.String")
              && propertyConfig.getDisplayLengthInt() > App.MIN_LONG_TEXT_LENGTH) {
            propertyValuePanel = new MultiLineLabelPanel(entityContext,
                propertiesViewContext);

          } else {
            propertyValuePanel = new LabelPanel(entityContext,
                propertiesViewContext);
          } // end if
          if (!app.isPropertyDisplayAllowed(getAppSession(),
              propertyConfig)) {
            propertyNameLabel.setVisible(false);
            propertyValuePanel.setVisible(false);
          }

          propertyNameLabelValuePanelPair
              .setPropertyValuePanel(propertyValuePanel);
          propertyNameLabelValuePanelPairs
              .add(propertyNameLabelValuePanelPair);
        } // end if (!propertyConfig.isReference()) {
      } // end for

      ListView propertyNameLabelValuePanelListView = new PropertyNameLabelValuePanelListView(
          "propertyNameLabelValuePanelListView",
          propertyNameLabelValuePanelPairs);
      add(propertyNameLabelValuePanelListView);
      if (!app.isConceptDisplayAllowed(getAppSession(), conceptConfig)) {
        propertyNameLabelValuePanelListView.setVisible(false);
      }
    } catch (Exception e) {
      log.error("Error in EntityDisplayPanel: "
          + modelContext.getEntityCode() + " - " + e.getMessage());
View Full Code Here

   *            view context
   */
  public DmRadDisplayPage(final ModelContext modelContext,
      final ViewContext viewContext) {
    try {
      App app = viewContext.getApp();

      ModelContext menuModelContext = new ModelContext(modelContext);
      ViewContext menuViewContext = new ViewContext(viewContext);
      menuViewContext.setWicketId("dmRadMenuPanel");
      add(app.getViewMeta().getDmRadMenuPanel(menuModelContext,
          menuViewContext));
    } catch (Exception e) {
      log.error("Error in DmLiteDisplayPage: "
          + modelContext.getEntitiesCode() + " - " + e.getMessage());
    }
View Full Code Here

   */
  public DmRadMenuPanel(final ModelContext modelContext,
      final ViewContext viewContext) {
    super(modelContext, viewContext);
    try {
      App app = viewContext.getApp();

      Link homePageLink = new PageLink("home", app.getHomePage());
      homePageLink.setAutoEnable(true);
      add(homePageLink);

      Link contextLink;
      final Page contextPage = viewContext.getContextPage();
      if (contextPage == null) {
        contextLink = new PageLink("context", app.getHomePage());
      } else {
        contextLink = new Link("context") {
          static final long serialVersionUID = 201081L;
          public void onClick() {
            setResponsePage(contextPage);
View Full Code Here

TOP

Related Classes of org.dmrad.view.App

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.