Package org.dmrad.view.context

Examples of org.dmrad.view.context.ModelContext


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

      ModelContext entryModelContext = new ModelContext(modelContext);
      entryModelContext.setEntities(entry);

      ViewContext entryViewContext = new ViewContext(viewContext);
      WebPage entryConceptPage = null;
      String displayType = entry.getConceptConfig().getDisplayType();
      if (displayType == null) {
        displayType = "table";
      }
      if (displayType.equals("table")) {
        entryConceptPage = app.getViewMeta().getPage(
            "EntityDisplayTablePage", entryModelContext,
            entryViewContext);
      } else if (displayType.equals("list")) {
        entryConceptPage = app.getViewMeta().getPage(
            "EntityDisplayListPage", entryModelContext,
            entryViewContext);
      } else if (displayType.equals("slide")) {
        entryConceptPage = app.getViewMeta().getPage(
            "EntityDisplaySlidePage", entryModelContext,
            entryViewContext);
      }
      Link entryConceptLink = new PageLink("entry", entryConceptPage);
      item.add(entryConceptLink);

      ModelContext keywordSelectionModelContext = new ModelContext(
          modelContext);
      keywordSelectionModelContext.setEntities(entry);
      PropertyConfig propertyConfig = entryConceptConfig
          .getPropertiesConfig().getFirstMaxTextSizePropertyConfig();
      keywordSelectionModelContext.setPropertyConfig(propertyConfig);

      ViewContext keywordSelectionViewContext = new ViewContext(
          viewContext);
      keywordSelectionViewContext.getMoreArgs().add("keywords", "");
      keywordSelectionViewContext.getMoreArgs().add("andKeywords",
View Full Code Here


      App app = viewContext.getApp();
     
      ConceptConfig parentConceptConfig = modelContext.getEntities()
          .getConceptConfig();

      ModelContext parentChildModelContext = new ModelContext(
          modelContext, true);
      String sectionTitle = (String) parentChildModelContext
          .getMoreArgs().get("sectionTitle");
      add(new Label("sectionTitle", sectionTitle));

      ViewContext parentChildViewContext = new ViewContext(viewContext,
          true);
View Full Code Here

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

      ModelContext lookupModelContext = new ModelContext(modelContext);

      ViewContext lookupViewContext = new ViewContext(viewContext);
      lookupViewContext.setPage(this);
      lookupViewContext.setWicketId("entityLookupTablePanel");
View Full Code Here

  public HomePageMenuPanel(final String wicketId, final Page page) {
    super(wicketId);
    try {
      App app = (App) getApplication();

      ModelContext commentsModelContext = new ModelContext();
      commentsModelContext.setDomainModel(app.getDomainModel());
      Comments comments = (Comments) app.getEntry("Comments");
      commentsModelContext.setEntities(comments);

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

      EntityDisplayTablePage commentsPage = new EntityDisplayTablePage(
          commentsModelContext, commentsViewContext);
      Link commentsLink = new PageLink("commentsLink", commentsPage);
      add(commentsLink);

      ModelContext questionsModelContext = new ModelContext();
      questionsModelContext.setDomainModel(app.getDomainModel());
      Questions questions = (Questions) app.getEntry("Questions");
      questionsModelContext.setEntities(questions);

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

      EntityDisplayTablePage questionsPage = new EntityDisplayTablePage(
          questionsModelContext, questionsViewContext);
      Link questionsLink = new PageLink("questionsLink", questionsPage);
      add(questionsLink);

      ModelContext presentationsModelContext = new ModelContext();
      presentationsModelContext.setDomainModel(app.getDomainModel());
      Presentations presentations = (Presentations) app
          .getEntry("Presentations");
      Presentations orderedPresentations = presentations
          .getPresentationsOrderedByTitle();
      presentationsModelContext.setEntities(orderedPresentations);

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

      EntityDisplayTablePage orderedPresentationsPage = new EntityDisplayTablePage(
          presentationsModelContext, presentationsViewContext);
      Link orderedPresentationsLink = new PageLink("presentationsLink",
          orderedPresentationsPage);
      add(orderedPresentationsLink);

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

        public void onClick() {
          getAppSession().invalidate();
          setResponsePage(HomePage.class);
        }
      };
      add(logoutLink);
      if (getAppSession().isMemberLoggedIn()) {
        loginLink.setVisible(false);
      } else {
        logoutLink.setVisible(false);
      }
      if (!app.getModelConfig().isLogin()) {
        loginLink.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);

      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(page);
      countryLanguageViewContext
          .setWicketId("countryLanguageChoicePanel");
View Full Code Here

  public QuoteListPanel(final ModelContext modelContext,
      final ViewContext viewContext) {
    super(modelContext, viewContext);
    try {
      ModelContext quotesModelContext = new ModelContext(modelContext);
      ViewContext quotesViewContext = new ViewContext(viewContext);
      quotesViewContext.setWicketId("quoteList");
      QuoteList quoteList = new QuoteList(quotesModelContext,
          quotesViewContext);
      add(quoteList);
View Full Code Here

    try {
      App app = (App) getApplication();

      add(new HomePageMenuPanel("homePageMenuPanel", this));

      ModelContext topicsModelContext = new ModelContext();
      topicsModelContext.setDomainModel(app.getDomainModel());
      Topics topics = (Topics) app.getEntry("Topics");
      Topic modelAndWebTopic = (Topic) topics.getTopic(MODEL_AND_WEB);
      if (modelAndWebTopic != null) {
        Topics modelAndWebTopicSubtopics = (Topics) modelAndWebTopic
            .getSubtopics();
        topicsModelContext.setEntities(modelAndWebTopicSubtopics);
      } else {
        topicsModelContext.setEntities(topics);
      }
      ViewContext topicsViewContext = new ViewContext();
      topicsViewContext.setApp(app);
      topicsViewContext.setContextPage(this);
      topicsViewContext.setPage(this);
      topicsViewContext.setWicketId("topicListPanel");
      TopicListPanel topicListPanel = new TopicListPanel(
          topicsModelContext, topicsViewContext);
      add(topicListPanel);

      ModelContext projectsModelContext = new ModelContext();
      projectsModelContext.setDomainModel(app.getDomainModel());
      Projects projects = (Projects) app.getEntry("Projects");
      Projects approvedOrderedProjects = projects.getApprovedProjects()
          .getProjectsOrderedBySequence();
      projectsModelContext.setEntities(approvedOrderedProjects);
      ViewContext projectsViewContext = new ViewContext();
      projectsViewContext.setApp(app);
      projectsViewContext.setContextPage(this);
      projectsViewContext.setPage(this);
      projectsViewContext.setWicketId("projectListPanel");
      ProjectListPanel projectListPanel = new ProjectListPanel(
          projectsModelContext, projectsViewContext);
      add(projectListPanel);

      ModelContext infoModelContext = new ModelContext();
      infoModelContext.setDomainModel(app.getDomainModel());
      Infos infos = (Infos) app.getEntry("Infos");
      Infos orderedInfos = infos.getInfosOrderedByCreationDate(false);
      Info lastInfo = (Info) orderedInfos.first();
      infoModelContext.setEntity(lastInfo);
      ViewContext infoViewContext = new ViewContext();
      infoViewContext.setApp(app);
      infoViewContext.setContextPage(this);
      infoViewContext.setPage(this);
      infoViewContext.setWicketId("lastInfoPanel");
      Panel lastInfoMinPanel;
      if (lastInfo != null) {
        lastInfoMinPanel = new EntityDisplayMinPanel(infoModelContext,
            infoViewContext);
      } else {
        lastInfoMinPanel = new Panel("lastInfoPanel");
        lastInfoMinPanel.setVisible(false);
      }
      add(lastInfoMinPanel);

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

      Users users = (Users) app.getEntry("Users");
      Blogs allApprovedBlogs = users.getAllApprovedBlogs();
      Entries allApprovedEntries = allApprovedBlogs
          .getAllApprovedEntries();
      if (allApprovedEntries != null) {
        Entries selectedEntries = allApprovedEntries.getLastEntries(3);
        blogEntriesModelContext.setEntities(selectedEntries);
      } else {
        blogEntriesModelContext.setEntities(allApprovedEntries);
      }
      ViewContext blogEntriesViewContext = new ViewContext();
      blogEntriesViewContext.setApp(app);
      blogEntriesViewContext.setContextPage(this);
      blogEntriesViewContext.setPage(this);
      blogEntriesViewContext.setWicketId("entryListPanel");
      EntryListPanel blogEntryListPanel = new EntryListPanel(
          blogEntriesModelContext, blogEntriesViewContext);
      add(blogEntryListPanel);
      if (allApprovedEntries == null) {
        blogEntryListPanel.setVisible(false);
      }

      ModelContext quotesModelContext = new ModelContext();
      quotesModelContext.setDomainModel(app.getDomainModel());
      Quotes quotes = (Quotes) app.getEntry("Quotes");
      quotesModelContext.setEntities(quotes);
      ViewContext quotesViewContext = new ViewContext();
      quotesViewContext.setApp(app);
      quotesViewContext.setContextPage(this);
      quotesViewContext.setPage(this);
      quotesViewContext.setWicketId("quoteListPanel");
      QuoteListPanel quoteListPanel = new QuoteListPanel(
          quotesModelContext, quotesViewContext);
      add(quoteListPanel);

      ModelContext conceptsModelContext = new ModelContext();
      conceptsModelContext.setDomainModel(app.getDomainModel());
      Models models = (Models) app.getEntry("Models");
      Model model = (Model) models.last();
      Concepts concepts = null;
      if (model != null) {
        concepts = model.getConcepts();
      }
      conceptsModelContext.setEntities(concepts);
      ViewContext conceptsViewContext = new ViewContext();
      conceptsViewContext.setApp(app);
      conceptsViewContext.setContextPage(this);
      conceptsViewContext.setPage(this);
      conceptsViewContext.setWicketId("conceptListPanel");
      ConceptListPanel conceptListPanel = new ConceptListPanel(
          conceptsModelContext, conceptsViewContext);
      if (model == null) {
        conceptListPanel.setVisible(false);
      }
      add(conceptListPanel);

      ModelContext presentationSlideListModelContext = new ModelContext();
      presentationSlideListModelContext.setDomainModel(app
          .getDomainModel());
      Presentations presentations = (Presentations) app
          .getEntry("Presentations");
      Presentations orderedPresentations = presentations
          .getPresentationsOrderedByTitle();
      presentationSlideListModelContext.setEntities(orderedPresentations);
      presentationSlideListModelContext.setPropertyCode("title");
      String sectionTitle = getLocalizer()
          .getString("sectionTitle", this);
      presentationSlideListModelContext.getMoreArgs().add("sectionTitle",
          sectionTitle);
      presentationSlideListModelContext.getMoreArgs().add(
          "childNeighbor", "slides");
      presentationSlideListModelContext.getMoreArgs().add(
          "childProperty", "title");

      ViewContext presentationSlideListViewContext = new ViewContext();
      presentationSlideListViewContext.setApp(app);
      presentationSlideListViewContext
View Full Code Here

  public LinkListPanel(final ModelContext modelContext,
      final ViewContext viewContext) {
    super(modelContext, viewContext);
    try {
      ModelContext linksModelContext = new ModelContext(modelContext);
      ViewContext linksViewContext = new ViewContext(viewContext);
      linksViewContext.setWicketId("linkList");
      LinkList linkList = new LinkList(linksModelContext,
          linksViewContext);
      add(linkList);
View Full Code Here

      final App app = viewContext.getApp();

      ConceptConfig conceptConfig = entity.getConceptConfig();

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

      ModelContext parentModelContext = new ModelContext(modelContext);
      ViewContext parentViewContext = new ViewContext(viewContext);

      List<Panel> propertyValuePanels = new ArrayList<Panel>();

      // 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());
                Panel parentPropertyPanel;
                if (parentEntity != null) {
                  parentModelContext.setEntity(parentEntity);
                  parentModelContext
                      .setPropertyConfig(parentConceptPropertyConfig);
                  parentViewContext.setWicketId("valuePanel");
                  parentViewContext.getMoreArgs().add(
                      "shortText", Boolean.TRUE);
                  if (parentConceptPropertyConfig
View Full Code Here

      if (projectTopic == null) {
        projectTopicLinks = new Links(project.getDomainModel());
      } else {
        projectTopicLinks = (Links) projectTopic.getLinks();
      }
      ModelContext linkModelContext = new ModelContext(modelContext);
      Links approvedOrderedLinks = (Links) projectTopicLinks
          .getApprovedLinks().getLinksOrderedByName();
      linkModelContext.setEntities(approvedOrderedLinks);
      ViewContext linkViewContext = new ViewContext(viewContext);
      linkViewContext.setWicketId("linkListPanel");
      LinkListPanel linkListPanel = new LinkListPanel(linkModelContext,
          linkViewContext);
      item.add(linkListPanel);

      ModelContext projectModelContext = new ModelContext(modelContext);
      projectModelContext.setEntity(project);
      PropertyConfig applicationPropertyConfig = project
          .getConceptConfig().getPropertyConfig("application");
      projectModelContext.setPropertyConfig(applicationPropertyConfig);
      ViewContext projectViewContext = new ViewContext(viewContext);
      projectViewContext.setWicketId("appLinkPanel");
      String webApplication = getLocalizer().getString("webApplication", this);
      if (webApplication.startsWith("[")) {
        webApplication = "Web Application";
      }
      projectViewContext.getMoreArgs().add("displayText", webApplication);
      ExternalLinkPanel appLinkPanel = new ExternalLinkPanel(
          projectModelContext, projectViewContext);
      item.add(appLinkPanel);

      ModelContext spiralsModelContext = new ModelContext(modelContext);
      Spirals spirals = project.getSpirals().getSpiralsOrderedByCode();
      spiralsModelContext.setEntities(spirals);
      ViewContext spiralsViewContext = new ViewContext(viewContext);
      spiralsViewContext.setWicketId("spiralTablePanel");
      spiralsViewContext.getMoreArgs().add("displayText", webApplication);
      EntityDisplayTablePanel spiralTablePanel = new EntityDisplayTablePanel(
          spiralsModelContext, spiralsViewContext);
View Full Code Here

      ConceptConfig conceptConfig = entity.getConceptConfig();

      List<PropertyNameLabelValuePanelPair> propertyNameLabelValuePanelPairs = new ArrayList<PropertyNameLabelValuePanelPair>();

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

      PropertiesConfig propertiesConfig = conceptConfig
          .getPropertiesConfig();
      for (IEntity propertyConfigEntity : propertiesConfig) {
        PropertyConfig propertyConfig = (PropertyConfig) propertyConfigEntity;
        if (propertyConfig.isEssential()) {
          String propertyKey = conceptConfig.getCode() + "."
              + propertyConfig.getCode();
          String propertyName = getLocalizer().getString(propertyKey,
              this);
          PropertyNameLabelValuePanelPair propertyNameLabelValuePanelPair = new PropertyNameLabelValuePanelPair();
          Label propertyNameLabel = new Label("propertyName",
              propertyName);
          propertyNameLabelValuePanelPair
              .setPropertyNameLabel(propertyNameLabel);

          entityContext.setPropertyConfig(propertyConfig);
          ViewContext propertiesViewContext = new ViewContext(
              viewContext);
          propertiesViewContext.setWicketId("valuePanel");
          Panel essentialPropertyPanel;
          if (propertyConfig.getPropertyClass()
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.