Package org.dmrad.view.context

Examples of org.dmrad.view.context.ViewContext


                      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")) {
View Full Code Here


  public NeighborListPanel(final ModelContext modelContext,
      final ViewContext viewContext) {
    super(modelContext, viewContext);
    try {
      ModelContext neighborsModelContext = new ModelContext(modelContext);
      ViewContext neighborsViewContext = new ViewContext(viewContext);
      neighborsViewContext.setWicketId("neighborList");
      NeighborList neighborList = new NeighborList(neighborsModelContext,
          neighborsViewContext);
      add(neighborList);
    } catch (Exception e) {
      log.error("Error in NeighborListPanel: " + e.getMessage());
View Full Code Here

      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

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

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

      String childProperty = (String) modelContext.getMoreArgs().get(
          "childProperty");
      PropertyConfig childPropertyConfig = childEntity.getConceptConfig()
          .getPropertyConfig(childProperty);
View Full Code Here

      App app = (App) getApplication();

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

      ViewContext menuViewContext = new ViewContext();
      menuViewContext.setApp(app);
      menuViewContext.setWicketId("dmRadMenuPanel");
     
      add(app.getViewMeta().getDmRadMenuPanel(menuModelContext,
          menuViewContext));

      add(new EmailMessagePanel("emailMessagePanel", title, emailConfig,
View Full Code Here

      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() {
            static final long serialVersionUID = 200744L;

            public Page getPage() {
View Full Code Here

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

      ViewContext entityDisplayMinPanelViewContext = new ViewContext(
          viewContext);
      entityDisplayMinPanelViewContext
          .setWicketId("entityDisplayMinPanel");
      entityDisplayMinPanelViewContext.setPage(this);
      entityDisplayMinPanelViewContext.setUpdate(false);

      add(app.getViewMeta().getPanel("entityDisplayMinPanel",
          modelContext, entityDisplayMinPanelViewContext));
    } catch (Exception e) {
      log.error("Error in EntityDisplayMinPage: "
View Full Code Here

      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
          .setWicketId("entityDisplayTablePanel");

      add(app.getViewMeta().getPanel("EntityDisplayTablePanel",
          entityDisplayTablePanelModelContext,
          entityDisplayTablePanelViewContext));
View Full Code Here

          "add")) {
        entities.getErrors().empty();
        if (entities.add(entity)) {
          ModelContext entityUpdateTablePageModelContext = new ModelContext(
              modelContext);
          ViewContext entityUpdateTablePageViewContext = new ViewContext(
              viewContext);
          setResponsePage(app.getViewMeta().getPage(
              "EntityUpdateTablePage",
              entityUpdateTablePageModelContext,
              entityUpdateTablePageViewContext));
View Full Code Here

      add(new Label("conceptsName", conceptsName));

      ModelContext entityDisplayListListModelContext = new ModelContext(
          modelContext);

      ViewContext entityDisplayListListViewContext = new ViewContext(
          viewContext);
      entityDisplayListListViewContext
          .setWicketId("entityDisplayListListView");

      ListView entityDisplayListListView = app.getViewMeta().getListView(
          "EntityDisplayListListView",
          entityDisplayListListModelContext,
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.