Package org.domain.view

Examples of org.domain.view.App


   *            Home page
   */
  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");
      CountryLanguageChoicePanel countryLanguageChoicePanel = new CountryLanguageChoicePanel(
          countryLanguageModelContext, countryLanguageViewContext);
      add(countryLanguageChoicePanel);
      if (!app.getModelConfig().isI18n()) {
        countryLanguageChoicePanel.setVisible(false);
      }
    } catch (Exception e) {
      log.error("Error in HomePageMenuPanel: " + e.getMessage());
    }
View Full Code Here


  /**
   * Constructs the application home page.
   */
  public HomePage() {
    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");
View Full Code Here

TOP

Related Classes of org.domain.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.