Package org.dbwiki.web.ui

Examples of org.dbwiki.web.ui.DatabaseWikiContentGenerator


      }
    } catch (org.dbwiki.exception.WikiException wikiException) {
      wikiException.printStackTrace();
      try {
        exchange.send(HtmlTemplateDecorator.decorate(_template,
            new DatabaseWikiContentGenerator(this.identifier(),
                this.getTitle(), this.cssLinePrinter(),
                wikiException)));
      } catch (org.dbwiki.exception.WikiException exception) {
        exchange.send(new FatalExceptionPage(exception));
      }
View Full Code Here


    // If the request is not redirected (in case of INSERT or DELETE) then
    // assemble appropriate
    // HtmlContentGenerator.
    if (page == null) {
      DatabaseWikiContentGenerator contentGenerator = new DatabaseWikiContentGenerator(
          request, this.getTitle(), this.cssLinePrinter());
      if ((isGetRequest) || (request.type().isCopy())) {// This is the
                                // default case
                                // where no
                                // action has
                                // been
                                // performed and
                                // no special
                                // content is
                                // requested
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentTimemachine,
            new TimemachinePrinter(request));
        contentGenerator.put(DatabaseWikiContentGenerator.ContentMenu,
            new DataMenuPrinter(request, _layouter));
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentObjectLink,
            new NodePathPrinter(request, _layouter));
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentAnnotation,
            new ObjectAnnotationPrinter(request));
        // contentGenerator.put(DatabaseWikiContentGenerator.ContentProvenance,
        // new VersionIndexPrinter(request));
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentProvenance,
            new ObjectProvenancePrinter(request, _layouter));
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentContent,
            new DataNodePrinter(request, _layouter));
      } else if (isIndexRequest) { // The case for the root of the
                      // DatabaseWiki
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentTimemachine,
            new TimemachinePrinter(request));
        contentGenerator.put(DatabaseWikiContentGenerator.ContentMenu,
            new DataMenuPrinter(request, _layouter));
        // TODO: This could be simplified by storing the mapping in a
        // Map<String,IndexContentPrinter>
        if (DatabaseLayouter.IndexAZMultiPage.equals(_layouter
            .indexType())) {
          contentGenerator.put(
              DatabaseWikiContentGenerator.ContentContent,
              new AZMultiPageIndexPrinter(request, database()
                  .content()));
        } else if (DatabaseLayouter.IndexAZSinglePage.equals(_layouter
            .indexType())) {
          contentGenerator.put(
              DatabaseWikiContentGenerator.ContentContent,
              new AZSinglePageIndexPrinter(request, database()
                  .content()));
        } else if (DatabaseLayouter.IndexMultiColumn.equals(_layouter
            .indexType())) {
          contentGenerator.put(
              DatabaseWikiContentGenerator.ContentContent,
              new MultiColumnIndexPrinter(request, database()
                  .content()));
        } else if (DatabaseLayouter.IndexPartialList.equals(_layouter
            .indexType())) {
          contentGenerator.put(
              DatabaseWikiContentGenerator.ContentContent,
              new PartialIndexPrinter(request, database()
                  .content()));
        } else {
          contentGenerator
              .put(DatabaseWikiContentGenerator.ContentContent,
                  new FullIndexPrinter(request, database()
                      .content()));
        }
      } else if (request.type().isSearch()) { // The case for a search
                          // request
        DatabaseContent content = null;
        String query = request.parameters()
            .get(RequestParameter.ParameterSearch).value();
        if (query != null) {
          content = database().search(query);
        } else {
          content = database().content();
        }
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentTimemachine,
            new TimemachinePrinter(request));
        contentGenerator.put(DatabaseWikiContentGenerator.ContentMenu,
            new DataMenuPrinter(request, _layouter));
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentContent,
            new SearchResultPrinter(request, content));
      } else if ((request.type().isCreate()) || (request.type().isEdit())) { // The
                                          // case
                                          // for
                                          // a
                                          // create
                                          // or
                                          // edit
                                          // request
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentObjectLink,
            new NodePathPrinter(request, _layouter));
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentContent,
            new DataUpdateFormPrinter(request, _layouter));
      } else if (request.type().isCreateSchemaNode()) { // Creating a new
                                // schema node.
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentObjectLink,
            new NodePathPrinter(request, _layouter));
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentContent,
            new CreateSchemaNodeFormPrinter(request));
      } else if ((request.type().isTimemachineChanges())
          || ((request.type().isTimemachinePrevious()))) {
        if (request.node() != null) { // Showing version index
          contentGenerator.put(
              DatabaseWikiContentGenerator.ContentObjectLink,
              new NodePathPrinter(request, _layouter));
        }
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentTimemachine,
            new TimemachinePrinter(request));
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentContent,
            new VersionIndexPrinter(request));
      } else if (request.type().isLayout()) { // Editing the layout
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentContent,
            new LayoutEditor(request));
      } else if (request.type().isPasteForm()) { // Pasting XML data from
                            // a URL
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentContent,
            new InputFormPrinter(request, "Copy & Paste",
                "Insert source URL",
                RequestParameter.ParameterPaste,
                RequestParameter.ParameterURL));
      } else if (request.type().isStyleSheet()) { // Editing the
                            // stylesheet
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentContent,
            new FileEditor(request, "Edit style sheet"));
      } else if (request.type().isTemplate()) { // Editing the template
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentContent,
            new FileEditor(request, "Edit template"));
      } else if (request.type().isURLDecoding()) { // Editing the URL
                              // decoding rules
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentContent,
            new FileEditor(request, "Edit URL decoding rules"));
      } else if (request.type().isSettings()) { // The list of prior
                            // combinations of
                            // config files, can be
                            // used to revert.
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentContent,
            new SettingsListingPrinter(request));
      } else {
        throw new WikiRequestException(
            WikiRequestException.InvalidRequest, exchange.getRequestURI().toString());
View Full Code Here

          isIndexRequest = false;
        }
      }
    }

    DatabaseWikiContentGenerator contentGenerator = new DatabaseWikiContentGenerator(
        request, this.getTitle(), this.cssLinePrinter());

    if (isGetRequest) {
      contentGenerator.put(DatabaseWikiContentGenerator.ContentMenu,
          new PageMenuPrinter(request));
      contentGenerator.put(DatabaseWikiContentGenerator.ContentContent,
          new PageContentPrinter(request, _layouter));
    } else if ((isIndexRequest) || (request.type().isDelete())
        || (action.actionInsert())) {
      contentGenerator.put(DatabaseWikiContentGenerator.ContentMenu,
          new PageMenuPrinter(request));
      if (DatabaseLayouter.IndexAZMultiPage.equals(_layouter.indexType())) {
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentContent,
            new AZMultiPageIndexPrinter(request, wiki().content()));
      } else if (DatabaseLayouter.IndexAZSinglePage.equals(_layouter
          .indexType())) {
        contentGenerator
            .put(DatabaseWikiContentGenerator.ContentContent,
                new AZSinglePageIndexPrinter(request, wiki()
                    .content()));
      } else if (DatabaseLayouter.IndexMultiColumn.equals(_layouter
          .indexType())) {
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentContent,
            new MultiColumnIndexPrinter(request, wiki().content()));
      } else if (DatabaseLayouter.IndexPartialList.equals(_layouter
          .indexType())) {
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentContent,
            new PartialIndexPrinter(request, wiki().content()));
      } else {
        contentGenerator.put(
            DatabaseWikiContentGenerator.ContentContent,
            new FullIndexPrinter(request, wiki().content()));
      }
    } else if ((request.type().isCreate()) || (request.type().isEdit())) {
      contentGenerator.put(DatabaseWikiContentGenerator.ContentContent,
          new PageUpdateFormPrinter(request));
    } else if (request.type().isLayout()) {
      contentGenerator.put(DatabaseWikiContentGenerator.ContentContent,
          new LayoutEditor(request));
    } else if (request.type().isStyleSheet()) {
      contentGenerator.put(DatabaseWikiContentGenerator.ContentContent,
          new FileEditor(request, "Edit style sheet"));
    } else if (request.type().isTemplate()) {
      contentGenerator.put(DatabaseWikiContentGenerator.ContentContent,
          new FileEditor(request, "Edit template"));
    } else if (request.type().isURLDecoding()) {
      contentGenerator.put(DatabaseWikiContentGenerator.ContentContent,
          new FileEditor(request, "Edit URL decoding rules"));
    } else if (request.type().isSettings()) {
      contentGenerator.put(DatabaseWikiContentGenerator.ContentContent,
          new SettingsListingPrinter(request));
    } else if (request.type().isPageHistory()) {
      contentGenerator.put(DatabaseWikiContentGenerator.ContentMenu,
          new PageMenuPrinter(request));
      contentGenerator.put(DatabaseWikiContentGenerator.ContentContent,
          new PageHistoryPrinter(request));
    } else {
      throw new WikiRequestException(WikiRequestException.InvalidRequest,
          exchange.getRequestURI().toASCIIString());
    }
View Full Code Here

    // isIndexRequest = false;
    // }
    // }
    // }
    //
    DatabaseWikiContentGenerator contentGenerator = new DatabaseWikiContentGenerator(
        request, this.getTitle(), this.cssLinePrinter());

    if (isGetRequest) {
      contentGenerator.put(
          DatabaseWikiContentGenerator.ContentTimemachine,
          new TimemachinePrinter(request));
      contentGenerator.put(DatabaseWikiContentGenerator.ContentMenu,
          new SchemaMenuPrinter(request));
      contentGenerator.put(
          DatabaseWikiContentGenerator.ContentObjectLink,
          new SchemaPathPrinter(request));
      contentGenerator.put(DatabaseWikiContentGenerator.ContentContent,
          new SchemaNodePrinter(request, _layouter));
    } else if ((isIndexRequest) || (request.type().isDelete())) { // ||
                                    // (action.actionInsert()))
                                    // {
      contentGenerator.put(
          DatabaseWikiContentGenerator.ContentTimemachine,
          new TimemachinePrinter(request));
      contentGenerator.put(DatabaseWikiContentGenerator.ContentMenu,
          new SchemaMenuPrinter(request));
      contentGenerator.put(DatabaseWikiContentGenerator.ContentContent,
          new SchemaNodePrinter(request, _layouter));
    } else if (request.type().isCreateSchemaNode()
        && request.schema().isGroup()) {
      // FIXME #schemaversioning: only display the option to create a new
      // schema node if we're viewing a group?
      contentGenerator.put(DatabaseWikiContentGenerator.ContentContent,
          new CreateSchemaNodeFormPrinter(request));
    }

    // if (IndexAZMultiPage.equals(_layouter.indexType())) {
    // contentGenerator.put(DatabaseWikiContentGenerator.ContentContent, new
View Full Code Here

      }
    } catch (org.dbwiki.exception.WikiException wikiException) {
      wikiException.printStackTrace();
      try {
        exchange.send(HtmlTemplateDecorator.decorate(_template,
            new DatabaseWikiContentGenerator(this.identifier(),
                this.getTitle(), this.cssLinePrinter(),
                wikiException)));
      } catch (org.dbwiki.exception.WikiException exception) {
        exchange.send(new FatalExceptionPage(exception));
      }
View Full Code Here

TOP

Related Classes of org.dbwiki.web.ui.DatabaseWikiContentGenerator

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.