Package org.apache.wicket.markup.html.link

Examples of org.apache.wicket.markup.html.link.ExternalLink


      add(new BookmarkablePageLink<Void>("blameLink", BlamePage.class,
          WicketUtils.newPathParameter(repositoryName, objectId, blobPath))
          .setEnabled(false));
      add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class).setEnabled(false));
      String rawUrl = RawServlet.asLink(getContextUrl(), repositoryName, objectId, blobPath);
      add(new ExternalLink("rawLink",  rawUrl));
      add(new CommitHeaderPanel("commitHeader", objectId));
      add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, blobPath, objectId));
      Component c = new Label("blobText", JGitUtils.getStringContent(r, objectId, encodings));
      WicketUtils.setCssClass(c, "plainprint");
      add(c);
    } else {
      // standard blob view
      String extension = null;
      if (blobPath.lastIndexOf('.') > -1) {
        extension = blobPath.substring(blobPath.lastIndexOf('.') + 1).toLowerCase();
      }

      // see if we should redirect to the doc page
      MarkupProcessor processor = new MarkupProcessor(app().settings(), app().xssFilter());
      for (String ext : processor.getMarkupExtensions()) {
        if (ext.equals(extension)) {
          setResponsePage(DocPage.class, params);
          return;
        }
      }

      RevCommit commit = getCommit();

      // blob page links
      add(new BookmarkablePageLink<Void>("blameLink", BlamePage.class,
          WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
      add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class,
          WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
      String rawUrl = RawServlet.asLink(getContextUrl(), repositoryName, objectId, blobPath);
      add(new ExternalLink("rawLink", rawUrl));

      add(new CommitHeaderPanel("commitHeader", repositoryName, commit));

      add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, blobPath, objectId));
View Full Code Here


    fragment.add(new BookmarkablePageLink<Void>("blameLink", BlamePage.class,
        WicketUtils.newPathParameter(repositoryName, objectId, documentPath)));
    fragment.add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class,
        WicketUtils.newPathParameter(repositoryName, objectId, documentPath)));
    String rawUrl = RawServlet.asLink(getContextUrl(), repositoryName, objectId, documentPath);
    fragment.add(new ExternalLink("rawLink", rawUrl));

    fragment.add(new Label("content", markupDoc.html).setEscapeModelStrings(false));
    add(fragment);
  }
View Full Code Here

    // standard navigation links
    NavigationPanel navigationPanel = new NavigationPanel("repositoryNavPanel", getRepoNavPageClass(), navLinks);
    add(navigationPanel);

    add(new ExternalLink("syndication", SyndicationServlet.asLink(getRequest()
        .getRelativePathPrefixToContextRoot(), getRepositoryName(), null, 0)));

    // add floating search form
    SearchForm searchForm = new SearchForm("searchForm", getRepositoryName());
    add(searchForm);
View Full Code Here

    }

    // fork controls
    if (!allowForkControls() || !user.isAuthenticated) {
      // must be logged-in to fork, hide all fork controls
      add(new ExternalLink("forkLink", "").setVisible(false));
      add(new ExternalLink("myForkLink", "").setVisible(false));
    } else {
      String fork = app().repositories().getFork(user.username, model.name);
      boolean hasFork = fork != null;
      boolean canFork = user.canFork(model) && model.hasCommits;

      if (hasFork || !canFork) {
        // user not allowed to fork or fork already exists or repo forbids forking
        add(new ExternalLink("forkLink", "").setVisible(false));

        if (hasFork && !fork.equals(model.name)) {
          // user has fork, view my fork link
          String url = getRequestCycle().urlFor(SummaryPage.class, WicketUtils.newRepositoryParameter(fork)).toString();
          add(new ExternalLink("myForkLink", url));
        } else {
          // no fork, hide view my fork link
          add(new ExternalLink("myForkLink", "").setVisible(false));
        }
      } else if (canFork) {
        // can fork and we do not have one
        add(new ExternalLink("myForkLink", "").setVisible(false));
        String url = getRequestCycle().urlFor(ForkPage.class, WicketUtils.newRepositoryParameter(model.name)).toString();
        add(new ExternalLink("forkLink", url));
      }
    }

    if (showAdmin || isOwner) {
      String url = getRequestCycle().urlFor(EditRepositoryPage.class, WicketUtils.newRepositoryParameter(model.name)).toString();
      add(new ExternalLink("editLink", url));
    } else {
      add(new Label("editLink").setVisible(false));
    }

    super.setupPage(repositoryName, pageName);
View Full Code Here

        }


        // quick links
        if (entry.isSubmodule()) {
          item.add(new ExternalLink("raw", "").setEnabled(false));

          // submodule
          item.add(new BookmarkablePageLink<Void>("diff", BlobDiffPage.class, WicketUtils
              .newPathParameter(repositoryName, entry.commitId, entry.path))
              .setEnabled(!entry.changeType.equals(ChangeType.ADD)));
          item.add(new BookmarkablePageLink<Void>("view", CommitPage.class, WicketUtils
              .newObjectParameter(submodulePath, entry.objectId)).setEnabled(hasSubmodule));
          item.add(new ExternalLink("blame", "").setEnabled(false));
          item.add(new BookmarkablePageLink<Void>("history", HistoryPage.class, WicketUtils
              .newPathParameter(repositoryName, entry.commitId, entry.path))
              .setEnabled(!entry.changeType.equals(ChangeType.ADD)));
        } else {
          // tree or blob
          item.add(new BookmarkablePageLink<Void>("diff", BlobDiffPage.class, WicketUtils
              .newPathParameter(repositoryName, entry.commitId, entry.path))
              .setEnabled(!entry.changeType.equals(ChangeType.ADD)
                  && !entry.changeType.equals(ChangeType.DELETE)));
          item.add(new BookmarkablePageLink<Void>("view", BlobPage.class, WicketUtils
              .newPathParameter(repositoryName, entry.commitId, entry.path))
              .setEnabled(!entry.changeType.equals(ChangeType.DELETE)));
          String rawUrl = RawServlet.asLink(getContextUrl(), repositoryName, entry.commitId, entry.path);
          item.add(new ExternalLink("raw", rawUrl)
              .setEnabled(!entry.changeType.equals(ChangeType.DELETE)));
          item.add(new BookmarkablePageLink<Void>("blame", BlamePage.class, WicketUtils
              .newPathParameter(repositoryName, entry.commitId, entry.path))
              .setEnabled(!entry.changeType.equals(ChangeType.ADD)
                  && !entry.changeType.equals(ChangeType.DELETE)));
View Full Code Here

                  .getName())));

          String contextUrl = RequestCycle.get().getRequest().getRelativePathPrefixToContextRoot();
          String rawUrl = RawServlet.asLink(contextUrl, repositoryName, entry.displayName,
              entry.getReferencedObjectId().getName());
          fragment.add(new ExternalLink("raw", rawUrl));
          item.add(fragment);
        } else {
          // TODO Tree Tag Object
          // Standard Tag Object
          if (entry.isAnnotatedTag()) {
View Full Code Here

          MarkupDocument doc = item.getModelObject();
          String file = StringUtils.getLastPathElement(doc.documentPath);
          file = StringUtils.stripFileExtension(file);
          String name = file.replace('_', ' ').replace('-'' ');

          ExternalLink link = new ExternalLink("link", "#" + file);
          link.add(new Label("label", name.toUpperCase()).setRenderBodyOnly(true));
          item.add(link);
          if (counter == 0) {
            counter++;
            item.add(new SimpleAttributeModifier("class", "active"));
          }
        }
      };
      fragment.add(tabTitles);

      // tab content
      DataView<MarkupDocument> tabsView = new DataView<MarkupDocument>("tabContent", docDp) {
        private static final long serialVersionUID = 1L;
        int counter;

        @Override
        public void populateItem(final Item<MarkupDocument> item) {
          MarkupDocument doc = item.getModelObject();
          // document page links
          item.add(new BookmarkablePageLink<Void>("blameLink", BlamePage.class,
              WicketUtils.newPathParameter(repositoryName, commitId, doc.documentPath)));
          item.add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class,
              WicketUtils.newPathParameter(repositoryName, commitId, doc.documentPath)));
          String rawUrl = RawServlet.asLink(getContextUrl(), repositoryName, commitId, doc.documentPath);
          item.add(new ExternalLink("rawLink", rawUrl));

          // document content
          String file = StringUtils.getLastPathElement(doc.documentPath);
          file = StringUtils.stripFileExtension(file);
          Component content = new Label("content", doc.html)
            .setEscapeModelStrings(false);
          if (!MarkupSyntax.PLAIN.equals(doc.syntax)) {
            content.add(new SimpleAttributeModifier("class", "markdown"));
          }
          item.add(content);
          item.add(new SimpleAttributeModifier("id", file));
          if (counter == 0) {
            counter++;
            item.add(new SimpleAttributeModifier("class", "tab-pane active"));
          }
        }
      };
      fragment.add(tabsView);
    }

    // document list
    final ByteFormat byteFormat = new ByteFormat();
    Fragment docs = new Fragment("documents", "documentsFragment", this);
    ListDataProvider<PathModel> pathsDp = new ListDataProvider<PathModel>(paths);
    DataView<PathModel> pathsView = new DataView<PathModel>("document", pathsDp) {
      private static final long serialVersionUID = 1L;
      int counter;

      @Override
      public void populateItem(final Item<PathModel> item) {
        PathModel entry = item.getModelObject();
        item.add(WicketUtils.newImage("docIcon", "file_world_16x16.png"));
        item.add(new Label("docSize", byteFormat.format(entry.size)));
        item.add(new LinkPanel("docName", "list", StringUtils.stripFileExtension(entry.name),
            DocPage.class, WicketUtils.newPathParameter(repositoryName, commitId, entry.path)));

        // links
        item.add(new BookmarkablePageLink<Void>("view", DocPage.class, WicketUtils
            .newPathParameter(repositoryName, commitId, entry.path)));
        String rawUrl = RawServlet.asLink(getContextUrl(), repositoryName, commitId, entry.path);
        item.add(new ExternalLink("raw", rawUrl));
        item.add(new BookmarkablePageLink<Void>("blame", BlamePage.class, WicketUtils
            .newPathParameter(repositoryName, commitId, entry.path)));
        item.add(new BookmarkablePageLink<Void>("history", HistoryPage.class, WicketUtils
            .newPathParameter(repositoryName, commitId, entry.path)));
        WicketUtils.setAlternatingBackground(item, counter);
View Full Code Here

          item.add(new LinkPanel("pathName", "list", entry.path, "#" + entry.path));
        }

        // quick links
        if (entry.isSubmodule()) {
          item.add(new ExternalLink("raw", "").setEnabled(false));
          // submodule
          item.add(new ExternalLink("patch", "").setEnabled(false));
          item.add(new BookmarkablePageLink<Void>("view", CommitPage.class, WicketUtils
              .newObjectParameter(submodulePath, entry.objectId)).setEnabled(hasSubmodule));
          item.add(new ExternalLink("blame", "").setEnabled(false));
          item.add(new BookmarkablePageLink<Void>("history", HistoryPage.class, WicketUtils
              .newPathParameter(repositoryName, entry.commitId, entry.path))
              .setEnabled(!entry.changeType.equals(ChangeType.ADD)));
        } else {
          // tree or blob
          item.add(new BookmarkablePageLink<Void>("patch", PatchPage.class, WicketUtils
              .newPathParameter(repositoryName, entry.commitId, entry.path))
              .setEnabled(!entry.changeType.equals(ChangeType.ADD)
                  && !entry.changeType.equals(ChangeType.DELETE)));
          item.add(new BookmarkablePageLink<Void>("view", BlobPage.class, WicketUtils
              .newPathParameter(repositoryName, entry.commitId, entry.path))
              .setEnabled(!entry.changeType.equals(ChangeType.DELETE)));
          String rawUrl = RawServlet.asLink(getContextUrl(), repositoryName, entry.commitId, entry.path);
          item.add(new ExternalLink("raw", rawUrl)
              .setEnabled(!entry.changeType.equals(ChangeType.DELETE)));
          item.add(new BookmarkablePageLink<Void>("blame", BlamePage.class, WicketUtils
              .newPathParameter(repositoryName, entry.commitId, entry.path))
              .setEnabled(!entry.changeType.equals(ChangeType.ADD)
                  && !entry.changeType.equals(ChangeType.DELETE)));
View Full Code Here

          fragment.add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils
              .newObjectParameter(model.name, entry.getName())));
          fragment.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils
              .newObjectParameter(model.name, entry.getName())));
          String rawUrl = RawServlet.asLink(getContextUrl(), model.name, Repository.shortenRefName(entry.getName()), null);
          fragment.add(new ExternalLink("raw",  rawUrl));
          fragment.add(new BookmarkablePageLink<Void>("metrics", MetricsPage.class,
              WicketUtils.newObjectParameter(model.name, entry.getName())));
          fragment.add(new ExternalLink("syndication", SyndicationServlet.asLink(
              getRequest().getRelativePathPrefixToContextRoot(), model.name,
              entry.getName(), 0)));
          if (showDelete) {
            fragment.add(createDeleteBranchLink(model, entry));
          }
          item.add(fragment);
        } else {
          Fragment fragment = new Fragment("branchLinks", "branchPanelLinks", this);
          fragment.add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils
              .newObjectParameter(model.name, entry.getName())));
          fragment.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils
              .newObjectParameter(model.name, entry.getName())));
          String rawUrl = RawServlet.asLink(getContextUrl(), model.name, Repository.shortenRefName(entry.getName()), null);
          fragment.add(new ExternalLink("raw",  rawUrl));
          item.add(fragment);
        }
        WicketUtils.setAlternatingBackground(item, counter);
        counter++;
      }
View Full Code Here

            Fragment links = new Fragment("pathLinks", "blobLinks", this);
            links.add(new BookmarkablePageLink<Void>("view", BlobPage.class,
                WicketUtils.newPathParameter(repositoryName, id,
                    path)));
            String rawUrl = RawServlet.asLink(getContextUrl(), repositoryName, id, path);
            links.add(new ExternalLink("raw", rawUrl));
            links.add(new BookmarkablePageLink<Void>("blame", BlamePage.class,
                WicketUtils.newPathParameter(repositoryName, id,
                    path)));
            links.add(new BookmarkablePageLink<Void>("history", HistoryPage.class,
                WicketUtils.newPathParameter(repositoryName, id,
View Full Code Here

TOP

Related Classes of org.apache.wicket.markup.html.link.ExternalLink

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.