Package org.dmrad.view

Examples of org.dmrad.view.App


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

      ModelContext entityDisplayTablePanelModelContext = new ModelContext(
          modelContext);

      ViewContext entityDisplayTablePanelViewContext = new ViewContext(
          viewContext);
      entityDisplayTablePanelViewContext
          .setWicketId("entityDisplayTablePanel");
      entityDisplayTablePanelViewContext.setContextPage(this);
      entityDisplayTablePanelViewContext.setPage(this);
      entityDisplayTablePanelViewContext.setUpdate(false);

      add(app.getViewMeta().getPanel("EntityDisplayTablePanel",
          entityDisplayTablePanelModelContext,
          entityDisplayTablePanelViewContext));
    } catch (Exception e) {
      log.error("Error in EntityDisplayTablePage: "
          + modelContext.getEntitiesCode() + " - " + e.getMessage());
View Full Code Here


   *            Wicket id
   */
  public HomePageMenuPanel(final String wicketId) {
    super(wicketId);
    try {
      final App app = (App) getApplication();

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

      Link loginLink = new PageLink("login", LoginPage.class);
      add(loginLink);
      Link logoutLink = new Link("logout") {
        static final long serialVersionUID = 200971L;

        public void onClick() {
          getAppSession().invalidate();
          setResponsePage(app.getViewMeta().getHomePageClass());
        }
      };
      add(logoutLink);
      if (getAppSession().isMemberLoggedIn()) {
        loginLink.setVisible(false);
      } else {
        logoutLink.setVisible(false);
      }
      if (!app.getModelConfig().isLogin()) {
        loginLink.setVisible(false);
      }

      if (app.getModelConfig().isI18n()) {
        ModelContext countryLanguageModelContext = new ModelContext();
        countryLanguageModelContext
            .setDomainModel(app.getDomainModel());
        CountryLanguages countryLanguages = (CountryLanguages) app
            .getEntry("CountryLanguages");
        countryLanguageModelContext.setEntities(countryLanguages);

        String languageCode = null;
        CountryLanguage defaultCountryLanguage = null;
        languageCode = getSession().getLocale().getLanguage();
        defaultCountryLanguage = (CountryLanguage) countryLanguages
            .retrieveByCode(languageCode);
        countryLanguageModelContext.setEntity(defaultCountryLanguage);
        ViewContext countryLanguageViewContext = new ViewContext();
        countryLanguageViewContext.setApp(app);
        countryLanguageViewContext.setPage(app.getViewMeta()
            .getHomePage());
        countryLanguageViewContext
            .setWicketId("countryLanguageChoicePanel");
        CountryLanguageChoicePanel countryLanguageChoicePanel = new CountryLanguageChoicePanel(
            countryLanguageModelContext, countryLanguageViewContext);
        add(countryLanguageChoicePanel);
      } else {
        Panel panel = new Panel("countryLanguageChoicePanel");
        add(panel);
        panel.setVisible(false);
      }

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

      ViewContext dmLiteEntryPageViewContext = new ViewContext();
      dmLiteEntryPageViewContext.setApp(app);

      WebPage dmLiteEntryPage = new DmLiteEntryPage(
          dmLiteEntryPageModelContext, dmLiteEntryPageViewContext);
      Link dmLiteEntryLink = new PageLink("dmLiteEntry", dmLiteEntryPage);
      add(dmLiteEntryLink);

      ModelConfig modelConfig = app.getDomainModel().getModelConfig();
      String modelKey = modelConfig.getCode();
      String modelName = getLocalizer().getString(modelKey, this);
      add(new Label("modelName", modelName));
    } catch (Exception e) {
      log.error("Error in HomePageMenuPanel: " + e.getMessage());
View Full Code Here

  protected void populateItem(final ListItem item) {
    try {
      IEntity parentEntity = (IEntity) item.getModelObject();
     
      App app = viewContext.getApp();

      ModelContext parentModelContext = new ModelContext(modelContext,
          true);
      parentModelContext.setEntity(parentEntity);

      ViewContext parentViewContext = new ViewContext(viewContext, true);
      parentViewContext.setWicketId("parentProperty");

      PropertyConfig parentPropertyConfig = parentModelContext
          .getPropertyConfig();
      Panel parentPropertyPanel;
      String propertyType = parentPropertyConfig.getPropertyClass();
      if (propertyType.equals("java.net.URL")
          || propertyType.equals("org.dmlite.type.email.Email")) {
        parentPropertyPanel = new ExternalLinkPanel(parentModelContext,
            parentViewContext);
        item.add(parentPropertyPanel);
      } else if (parentPropertyConfig.getPropertyClass().equals(
          "java.lang.String")
          && parentPropertyConfig.isValidateType()) {
        if (parentPropertyConfig.getValidationType().equals(
            "java.net.URL")
            || parentPropertyConfig.getValidationType().equals(
                "org.dmlite.type.email.Email")) {
          parentPropertyPanel = new ExternalLinkPanel(
              parentModelContext, parentViewContext);
          item.add(parentPropertyPanel);
        } else {
          parentPropertyPanel = new LabelPanel(parentModelContext,
              parentViewContext);
          item.add(parentPropertyPanel);
        }
      } else {
        parentPropertyPanel = new LabelPanel(parentModelContext,
            parentViewContext);
        item.add(parentPropertyPanel);
      }
      if (!app.isPropertyDisplayAllowed(getAppSession(),
          parentPropertyConfig)) {
        parentPropertyPanel.setVisible(false);
      }

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

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

      item.add(app.getViewMeta().getPanel(
          "ChildPropertyDisplayListPanel", childModelContext,
          childViewContext));
    } catch (Exception e) {
      log.error("Error in ParentChildPropertyDisplayListListView: "
          + e.getMessage());
View Full Code Here

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

      ViewContext entityDisplayListPanelViewContext = new ViewContext(
          viewContext);
      entityDisplayListPanelViewContext.setContextPage(this);
      entityDisplayListPanelViewContext.setPage(this);
      entityDisplayListPanelViewContext.setUpdate(false);
      entityDisplayListPanelViewContext
          .setWicketId("entityDisplayListPanel");

      add(app.getViewMeta().getPanel("EntityDisplayListPanel",
          entityDisplayTablePanelModelContext,
          entityDisplayListPanelViewContext));
    } catch (Exception e) {
      log.error("Error in  EntityDisplayListPage: "
          + modelContext.getEntitiesCode() + " - " + e.getMessage());
View Full Code Here

   */
  public EntityUpdateTablePanel(final ModelContext modelContext,
      final ViewContext viewContext) {
    super(modelContext, viewContext);
    try {
      final App app = viewContext.getApp();
     
      final IEntities entities = modelContext.getEntities();
      final 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();
      for (String parentPropertyKey : parentEssentialPropertyCodes) {
        String parentPropertyName = getLocalizer().getString(
            parentPropertyKey, this);
        parentEssentialPropertyNames.add(parentPropertyName);
      }

      // Concept essential property names
      List<String> conceptEssentialPropertyNames = new ArrayList<String>();
      List<String> conceptEssentiaPropertyCodes = entities
          .getConceptConfig().getConceptCodeEssentialPropertyCodes();
      for (String conceptPropertyKey : conceptEssentiaPropertyCodes) {
        String 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> childInternalNeighborNames = conceptConfig
          .getInternalChildNeighborNames();
      add(new NeighborEmptyNameLabelListView(
          "neighborEmptyNameLabelListViewHead",
          childInternalNeighborNames));

      ModelContext entityUpdateTableListModelContext = new ModelContext(
          modelContext);

      ViewContext entityUpdateTableListViewContext = new ViewContext(
          viewContext);
      entityUpdateTableListViewContext
          .setWicketId("entityUpdateTableListView");

      PageableListView entityUpdateTableListView = app.getViewMeta()
          .getPageableListView("EntityUpdateTableListView",
              entityUpdateTableListModelContext,
              entityUpdateTableListViewContext);
      add(entityUpdateTableListView);
      if (!app.isConceptDisplayAllowed(getAppSession(), conceptConfig)) {
        entityUpdateTableListView.setVisible(false);
      }

      add(new PropertyEmptyNameLabelListView(
          "propertyEmptyNameLabelListView", essentialPropertyNames));
      add(new PagingNavigator("blockNavigator", entityUpdateTableListView));
      add(new NeighborEmptyNameLabelListView(
          "neighborEmptyNameLabelListViewTail",
          childInternalNeighborNames));

      final Integer currentBlock = new Integer(entityUpdateTableListView
          .getCurrentPage());
      Link addLink = new Link("add") {
        static final long serialVersionUID = 200761L;

        public void onClick() {
          if (app.isConceptUpdateAllowed(getAppSession(),
              conceptConfig, null, "add")) {
            ModelContext entityAddFormPageModelContext = new ModelContext(
                modelContext);
            entityAddFormPageModelContext.setEntity(null);
            ViewContext entityAddPageContext = new ViewContext(
                viewContext);
            entityAddPageContext.setPageBlock(currentBlock);
            setResponsePage(app.getViewMeta().getPage(
                "EntityAddFormPage",
                entityAddFormPageModelContext,
                entityAddPageContext));
          } else {
            String error = getLocalizer().getString(
                "entities.config.add", this);
            error(error);
          }
        }
      };
      add(addLink);

      final IEntity clipboardEntity = getAppSession().getClipboard()
          .getEntity();
      Link pasteLink = new Link("paste") {
        static final long serialVersionUID = 200762L;

        public void onClick() {
          try {
            if (clipboardEntity != null) {
              if (app.isConceptUpdateAllowed(getAppSession(),
                  conceptConfig, clipboardEntity, "add")
                  && clipboardEntity.getConceptConfig() == entities
                      .getConceptConfig()) {
                if (entities.add(clipboardEntity)) {
                  ViewContext entityUpdateTablePageContext = new ViewContext(
                      viewContext);
                  entityUpdateTablePageContext
                      .setPageBlock(currentBlock);
                  setResponsePage(app.getViewMeta().getPage(
                      "EntityUpdateTablePage",
                      modelContext,
                      entityUpdateTablePageContext));
                } else {
                  addDmLiteErrorKeys(entities);
View Full Code Here

  protected void populateItem(final ListItem item) {
    try {
      IEntity entity = (IEntity) item.getModelObject();
     
      App app = viewContext.getApp();

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

      ViewContext entityViewContext = new ViewContext(viewContext);
      entityViewContext.setWicketId("entityProperty");
      entityViewContext.getMoreArgs().add("shortText", Boolean.TRUE);

      PropertyConfig propertyConfig = entityModelContext
          .getPropertyConfig();
      Panel entityPropertyPanel;

      String propertyType = propertyConfig.getPropertyClass();
      if (propertyType.equals("java.net.URL")
          || propertyType.equals("org.dmlite.type.email.Email")) {
        entityPropertyPanel = new ExternalLinkPanel(entityModelContext,
            entityViewContext);
        item.add(entityPropertyPanel);
      } else if (propertyConfig.getPropertyClass().equals(
          "java.lang.String")
          && propertyConfig.isValidateType()) {
        if (propertyConfig.getValidationType().equals("java.net.URL")
            || propertyConfig.getValidationType().equals(
                "org.dmlite.type.email.Email")) {
          entityPropertyPanel = new ExternalLinkPanel(
              entityModelContext, entityViewContext);
          item.add(entityPropertyPanel);
        } else {
          entityPropertyPanel = new LabelPanel(entityModelContext,
              entityViewContext);
          item.add(entityPropertyPanel);
        }
      } else {
        entityPropertyPanel = new LabelPanel(entityModelContext,
            entityViewContext);
        item.add(entityPropertyPanel);
      }
      if (!app.isPropertyDisplayAllowed(getAppSession(), propertyConfig)) {
        entityPropertyPanel.setVisible(false);
      }
    } catch (Exception e) {
      log.error("Error in EntityPropertyDisplayListListView: "
          + e.getMessage());
View Full Code Here

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

      if (baseEntityPropertyConfig.isReference()) {
        lookupLink = new Link("lookupLink") {
          static final long serialVersionUID = 200871L;
          public void onClick() {
            ModelContext lookupModelContext = new ModelContext(
                modelContext);
            ViewContext lookupViewContext = new ViewContext(
                viewContext);
            lookupViewContext.setUpdate(false);
            setResponsePage(app.getViewMeta().getPage(
                "EntityLookupTablePage",
                lookupModelContext, lookupViewContext));
          }
        };
        add(lookupLink);
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.