Package org.dmrad.view.context

Examples of org.dmrad.view.context.ModelContext


    try {
      IEntity childEntity = (IEntity) item.getModelObject();
     
      App app = viewContext.getApp();

      ModelContext childModelContext = new ModelContext(modelContext,
          true);
      childModelContext.setEntity(childEntity);

      ViewContext childViewContext = new ViewContext(viewContext, true);
      childViewContext.setWicketId("childProperty");

      String childProperty = (String) modelContext.getMoreArgs().get(
View Full Code Here


      final IEntities entities = modelContext.getEntities();
      final ConceptConfig conceptConfig = entity.getConceptConfig();

      final Integer currentPageBlock = new Integer(getCurrentPage());

      final ModelContext entityModelContext = new ModelContext(
          modelContext);
      entityModelContext.setEntity(entity);
      Link copyLink = new Link("copy") {
        static final long serialVersionUID = 200741L;

        public void onClick() {
          getAppSession().getClipboard().setEntity(entity);
          ViewContext entityCopyPageContext = new ViewContext(
              viewContext);
          entityCopyPageContext.setPageBlock(currentPageBlock);
          setResponsePage(app.getViewMeta().getPage(
              "EntityUpdateTablePage", entityModelContext,
              entityCopyPageContext));
        }
      };
      item.add(copyLink);

      final ViewContext entityUpdatePageContext = new ViewContext(
          viewContext);
      entityUpdatePageContext.setPageBlock(currentPageBlock);
      Link editLink = new PageLink("edit", new IPageLink() {
        static final long serialVersionUID = 200742L;

        public Page getPage() {
          return app.getViewMeta().getPage("EntityEditFormPage",
              entityModelContext, entityUpdatePageContext);
        }

        public Class getPageIdentity() {
          return app.getViewMeta().getPageClass("EntityEditFormPage",
              entityModelContext, entityUpdatePageContext);
        }
      });
      item.add(editLink);

      final ViewContext entityRemovePageContext = new ViewContext(
          viewContext);
      entityRemovePageContext.setPageBlock(currentPageBlock);
      item.add(new Link("remove") {
        static final long serialVersionUID = 200743L;

        public void onClick() {
          try {
            if (app.isConceptUpdateAllowed(
                getAppSession(), conceptConfig, entity, "remove")) {
              entities.getErrors().empty();
              if (app.getModelConfig().isConfirmRemove()) {
                setResponsePage(app.getViewMeta().getPage(
                    "EntityConfirmRemovePage",
                    entityModelContext,
                    entityRemovePageContext));
              } else if (entities.remove(entity)) {
                setResponsePage(app.getViewMeta().getPage(
                    "EntityUpdateTablePage",
                    entityModelContext,
                    entityRemovePageContext));
              } else {
                addDmLiteErrorKeys(entities);
              }
            } else {
              String error = getLocalizer().getString(
                  "entities.config.remove", this);
              error(error);
            }
          } catch (DmException e) {
            log.error("Error in EntityUpdateTableListView: "
                + modelContext.getEntitiesCode() + " - "
                + e.getMessage());
          }
        }
      });

      // Neighbor update links
      List<NeighborNameLabelLinkPair> neighborNameLabelLinkPairs = new ArrayList<NeighborNameLabelLinkPair>();
      NeighborsConfig neighborsConfig = conceptConfig
          .getNeighborsConfig();
      for (IEntity neighborConfigEntity : neighborsConfig) {
        NeighborConfig neighborConfig = (NeighborConfig) neighborConfigEntity;
        if (neighborConfig.getType().equals("child")
            && neighborConfig.isInternal()) {
          NeighborNameLabelLinkPair neighborNameLabelLinkPair = new NeighborNameLabelLinkPair();
          String conceptCode = conceptConfig.getCode();
          String neighborKey = conceptCode + "."
              + neighborConfig.getCode();
          String neighborName = getLocalizer().getString(neighborKey,
              this);
          Label neighborNameLabel = new Label("neighborName",
              neighborName);
          neighborNameLabelLinkPair
              .setNeighborNameLabel(neighborNameLabel);
          Link neighborLink = null;
          IDomainModel domainModel = app.getDomainModel();
          final IOrderedEntities neighborEntities = (IOrderedEntities) domainModel
              .getModelMeta().getNeighborEntities(entity,
                  neighborConfig.getCode());

          final ModelContext neighborModelContext = new ModelContext(
              modelContext);
          neighborModelContext.setContextEntities(entities);
          neighborModelContext.setContextEntity(entity);
          neighborModelContext.setEntities(neighborEntities);
          final ViewContext neighborViewContext = new ViewContext(
              viewContext);
          neighborViewContext.setPageBlock(new Integer(0));

          neighborLink = new PageLink("neighbor", new IPageLink() {
View Full Code Here

  public EmailMessagePage(final String title, final EmailConfig emailConfig,
      final List emails) {
    try {
      App app = (App) getApplication();

      ModelContext menuModelContext = new ModelContext();
      menuModelContext.setDomainModel(app.getDomainModel());

      ViewContext menuViewContext = new ViewContext();
      menuViewContext.setApp(app);
      menuViewContext.setWicketId("dmRadMenuPanel");
     
View Full Code Here

   *            model context
   * @return model context
   */
  private static ModelContext getNewModelContext(
      final ModelContext modelContext) {
    ModelContext newModelContext = new ModelContext(modelContext);
    Projects projects = (Projects) modelContext.getEntities();
    projects = projects.getProjectsOrderedByName();
    newModelContext.setEntities(projects);
    return newModelContext;
  }
View Full Code Here

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

   *            model context
   * @return model context
   */
  private static ModelContext getNewModelContext(
      final ModelContext modelContext) {
    ModelContext newModelContext = new ModelContext(modelContext);
    Models models = (Models) modelContext.getEntities();
    models = (Models) models.getModelsOrderedByCode();
    newModelContext.setEntities(models);
    return newModelContext;
  }
View Full Code Here

          entitiesThatContainKeywords = (IOrderedEntities) entities
              .getEntities(criteria);
        }
      }

      ModelContext keywordEntitiesModelContext = new ModelContext(
          modelContext);
      keywordEntitiesModelContext
          .setEntities(entitiesThatContainKeywords);

      ViewContext keywordEntitiesViewContext = new ViewContext(
          viewContext);
      keywordEntitiesViewContext.setContextPage(this);
      keywordEntitiesViewContext.setPage(this);
      keywordEntitiesViewContext.setUpdate(false);
      keywordEntitiesViewContext.setMoreArgs(viewContext.getMoreArgs());
      keywordEntitiesViewContext
          .setWicketId("entityPropertyKeywordSelectPanel");

      add(app.getViewMeta().getPanel("EntityPropertyKeywordSelectPanel",
          keywordEntitiesModelContext, keywordEntitiesViewContext));

      ModelContext entityDisplayTablePanelModelContext = new ModelContext(
          modelContext);
      entityDisplayTablePanelModelContext
          .setEntities(entitiesThatContainKeywords);

      ViewContext entityDisplayTablePanelViewContext = new ViewContext(
          viewContext);
      entityDisplayTablePanelViewContext
View Full Code Here

   *            model context
   * @return model context
   */
  private static ModelContext getNewModelContext(
      final ModelContext modelContext) {
    ModelContext newModelContext = new ModelContext(modelContext);
    Models models = (Models) modelContext.getEntities();
    models = (Models) models.getModelsOrderedByCode();
    newModelContext.setEntities(models);
    return newModelContext;
  }
View Full Code Here

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

   *            model context
   * @return model context
   */
  private static ModelContext getNewModelContext(
      final ModelContext modelContext) {
    ModelContext newModelContext = new ModelContext(modelContext);
    Comments comments = (Comments) modelContext.getEntities();
    comments = comments.getCommentsOrderedByCreationDate(false);
    newModelContext.setEntities(comments);
    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.