Package org.apache.wicket.behavior

Examples of org.apache.wicket.behavior.SimpleAttributeModifier


          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)));
          item.add(new BookmarkablePageLink<Void>("rawLink", RawPage.class, WicketUtils.newPathParameter(
              repositoryName, commitId, doc.documentPath)));

          // 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);
    }
View Full Code Here


import com.gitblit.utils.TimeUtils;

public class WicketUtils {

  public static void setCssClass(Component container, String value) {
    container.add(new SimpleAttributeModifier("class", value));
  }
View Full Code Here

  public static void setCssClass(Component container, String value) {
    container.add(new SimpleAttributeModifier("class", value));
  }

  public static void setCssStyle(Component container, String value) {
    container.add(new SimpleAttributeModifier("style", value));
  }
View Full Code Here

  }

  public static void setCssBackground(Component container, String value) {
    String background = MessageFormat.format("background-color:{0};",
        StringUtils.getColor(value));
    container.add(new SimpleAttributeModifier("style", background));
  }
View Full Code Here

        StringUtils.getColor(value));
    container.add(new SimpleAttributeModifier("style", background));
  }

  public static void setHtmlTooltip(Component container, String value) {
    container.add(new SimpleAttributeModifier("title", value));
  }
View Full Code Here

  public static void setHtmlTooltip(Component container, String value) {
    container.add(new SimpleAttributeModifier("title", value));
  }

  public static void setInputPlaceholder(Component container, String value) {
    container.add(new SimpleAttributeModifier("placeholder", value));
  }
View Full Code Here

          + "Link";
      BookmarkablePageLink<Void> blameByPageLink =
          new BookmarkablePageLink<Void>(blameByLinkText, BlamePage.class, blameTypePageParam);

      if (activeBlameType == type) {
        blameByPageLink.add(new SimpleAttributeModifier("style", "font-weight:bold;"));
      }

      add(blameByPageLink);
    }

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

    add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, blobPath, objectId));

    String format = app().settings().getString(Keys.web.datetimestampLongFormat,
        "EEEE, MMMM d, yyyy HH:mm Z");
    final DateFormat df = new SimpleDateFormat(format);
    df.setTimeZone(getTimeZone());

    PathModel pathModel = null;
    List<PathModel> paths = JGitUtils.getFilesInPath(getRepository(), StringUtils.getRootPath(blobPath), commit);
    for (PathModel path : paths) {
      if (path.path.equals(blobPath)) {
        pathModel = path;
        break;
      }
    }

    if (pathModel == null) {
      final String notFound = MessageFormat.format("Blame page failed to find {0} in {1} @ {2}",
          blobPath, repositoryName, objectId);
      logger.error(notFound);
      add(new Label("annotation").setVisible(false));
      add(new Label("missingBlob", missingBlob(blobPath, commit)).setEscapeModelStrings(false));
      return;
    }

    add(new Label("missingBlob").setVisible(false));

    List<AnnotatedLine> lines = DiffUtils.blame(getRepository(), blobPath, objectId);
    final Map<?, String> colorMap = initializeColors(activeBlameType, lines);
    ListDataProvider<AnnotatedLine> blameDp = new ListDataProvider<AnnotatedLine>(lines);
    DataView<AnnotatedLine> blameView = new DataView<AnnotatedLine>("annotation", blameDp) {
      private static final long serialVersionUID = 1L;
      private String lastCommitId = "";
      private boolean showInitials = true;
      private String zeroId = ObjectId.zeroId().getName();

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

        // commit id and author
        if (!lastCommitId.equals(entry.commitId)) {
          lastCommitId = entry.commitId;
          if (zeroId.equals(entry.commitId)) {
            // unknown commit
            item.add(new Label("commit", "<?>"));
            showInitials = false;
          } else {
            // show the link for first line
            LinkPanel commitLink = new LinkPanel("commit", null,
                getShortObjectId(entry.commitId), CommitPage.class,
                newCommitParameter(entry.commitId));
            WicketUtils.setHtmlTooltip(commitLink,
                MessageFormat.format("{0}, {1}", entry.author, df.format(entry.when)));
            item.add(commitLink);
            WicketUtils.setCssStyle(item, "border-top: 1px solid #ddd;");
            showInitials = true;
          }
        } else {
          if (showInitials) {
            showInitials = false;
            // show author initials
            item.add(new Label("commit", getInitials(entry.author)));
          } else {
            // hide the commit link until the next block
            item.add(new Label("commit").setVisible(false));
          }
        }

        // line number
        item.add(new Label("line", "" + entry.lineNumber));

        // line content
        String color;
        switch (activeBlameType) {
        case AGE:
          color = colorMap.get(entry.when);
          break;
        case AUTHOR:
          color = colorMap.get(entry.author);
          break;
        default:
          color = colorMap.get(entry.commitId);
          break;
        }
        Component data = new Label("data", StringUtils.escapeForHtml(entry.data, true)).setEscapeModelStrings(false);
        data.add(new SimpleAttributeModifier("style", "background-color: " + color + ";"));
        item.add(data);
      }
    };
    add(blameView);
  }
View Full Code Here

        setResponsePage(UsersPage.class);
      }
    };

    // do not let the browser pre-populate these fields
    form.add(new SimpleAttributeModifier("autocomplete", "off"));

    // not all user services support manipulating team memberships
    boolean editMemberships = app().authentication().supportsTeamMembershipChanges(teamModel);

    // field names reflective match TeamModel fields
View Full Code Here

   *
   * @param cssStyle
   */
  public final void setTableBodyCss(final String cssStyle)
  {
    body.add(new SimpleAttributeModifier("class", cssStyle));
  }
View Full Code Here

        }
      }
    }

    // do not let the browser pre-populate these fields
    form.add(new SimpleAttributeModifier("autocomplete", "off"));


    //
    //
    // GENERAL
View Full Code Here

TOP

Related Classes of org.apache.wicket.behavior.SimpleAttributeModifier

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.