Package com.gitblit.models

Examples of com.gitblit.models.GitClientApplication


    DataView<GitClientApplication> appMenus = new DataView<GitClientApplication>("appMenus", displayedAppsDp) {
      private static final long serialVersionUID = 1L;

      @Override
      public void populateItem(final Item<GitClientApplication> item) {
        final GitClientApplication clientApp = item.getModelObject();

        // filter the urls for the client app
        List<RepositoryUrl> urls = new ArrayList<RepositoryUrl>();
        for (RepositoryUrl repoUrl : repositoryUrls) {
          if (clientApp.minimumPermission == null || repoUrl.permission == null) {
            // no minimum permission or external permissions, assume it is satisfactory
            if (clientApp.supportsTransport(repoUrl.url)) {
              urls.add(repoUrl);
            }
          } else if (repoUrl.permission.atLeast(clientApp.minimumPermission)) {
            // repo url meets minimum permission requirement
            if (clientApp.supportsTransport(repoUrl.url)) {
              urls.add(repoUrl);
            }
          }
        }

        if (urls.size() == 0) {
          // do not show this app menu because there are no urls
          item.add(new Label("appMenu").setVisible(false));
          return;
        }

        Fragment appMenu = new Fragment("appMenu", "appMenuFragment", this);
        appMenu.setRenderBodyOnly(true);
        item.add(appMenu);

        // menu button
        appMenu.add(new Label("applicationName", clientApp.name));

        // application icon
        Component img;
        if (StringUtils.isEmpty(clientApp.icon)) {
          img = WicketUtils.newClearPixel("applicationIcon").setVisible(false);
        } else {
          if (clientApp.icon.contains("://")) {
            // external image
            img = new ExternalImage("applicationIcon", clientApp.icon);
          } else {
            // context image
            img = WicketUtils.newImage("applicationIcon", clientApp.icon);
          }
        }
        appMenu.add(img);

        // application menu title, may be a link
        if (StringUtils.isEmpty(clientApp.productUrl)) {
          appMenu.add(new Label("applicationTitle", clientApp.toString()));
        } else {
          appMenu.add(new LinkPanel("applicationTitle", null, clientApp.toString(), clientApp.productUrl, true));
        }

        // brief application description
        if (StringUtils.isEmpty(clientApp.description)) {
          appMenu.add(new Label("applicationDescription").setVisible(false));
View Full Code Here

TOP

Related Classes of com.gitblit.models.GitClientApplication

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.