Java Code Examples for org.apache.wicket.Component.add()

The following are Jave code examples for showing how to use add() of the org.apache.wicket.Component class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: gitplex-mit   File: WicketUtils.java   Source Code and License Vote up 5 votes
public static void markLastVisibleChild(WebMarkupContainer container) {
	Component lastVisible = null;
	for (Component child: container) {
		for (Behavior behavior: child.getBehaviors()) {
			if (behavior instanceof LastVisibleAppender) {
				child.remove(behavior);
			}
		}
		child.configure();
		if (child.isVisible())
			lastVisible = child;
	}
	if (lastVisible != null)
		lastVisible.add(new LastVisibleAppender("class", "last-visible").setSeparator(" "));
}
 
Example 2
Project: gitplex-mit   File: CollapseBehavior.java   Source Code and License Vote up 4 votes
public CollapseBehavior(Component target) {
	this.target = target;
	target.add(AttributeAppender.append("class", "collapse"));
	target.setOutputMarkupId(true);
}
 
Example 3
Project: gitplex-mit   File: CodeCommentPanel.java   Source Code and License Vote up 4 votes
@Override
protected void onInitialize() {
	super.onInitialize();

	PageParameters params = RequestChangesPage.paramsOf(getComment());
	add(new BookmarkablePageLink<Void>("outdatedContext", RequestChangesPage.class, params) {

		@Override
		public void onEvent(IEvent<?> event) {
			super.onEvent(event);

			if (event.getPayload() instanceof PageDataChanged) {
				PageDataChanged pageDataChanged = (PageDataChanged) event.getPayload();
				pageDataChanged.getHandler().add(this);
			}
		}
		
		@Override
		protected void onConfigure() {
			super.onConfigure();
			
			CodeComment comment = getComment();
			if (getPage() instanceof ProjectBlobPage) {
				setVisible(comment.isCodeChanged());
			} else if (getPage() instanceof RequestChangesPage) {
				RequestChangesPage page = (RequestChangesPage) getPage();
				if (page.getState().newCommit.equals(comment.getCommentPos().getCommit())) {
					setVisible(comment.isCodeChanged());
				} else {
					setVisible(!comment.getRequest().getHeadCommitHash().equals(page.getState().newCommit));
				}
			}
		}
		
	}.setOutputMarkupPlaceholderTag(true));
	
	add(newCommentContainer());
	
	activitiesView = new RepeatingView("activities");
	
	List<CodeCommentActivity> activities = new ArrayList<>();
	for (CodeCommentReply reply: getComment().getReplies()) {
		activities.add(reply);
	}
	for (CodeCommentStatusChange statusChange: getComment().getStatusChanges()) {
		activities.add(statusChange);
	}

	activities.sort((o1, o2)->o1.getDate().compareTo(o2.getDate()));

	for (CodeCommentActivity activity: activities) {
		Component activityContainer = newActivityContainer(activitiesView.newChildId(), activity);				
		if (!getComment().isVisitedAfter(activity.getDate()))
			activityContainer.add(AttributeAppender.append("class", "new"));
		activitiesView.add(activityContainer);			
	}
	add(activitiesView);
	add(newAddReplyContainer());
	
	setOutputMarkupId(true);
}
 
Example 4
Project: gitplex-mit   File: ProjectCommitsPage.java   Source Code and License Vote up 4 votes
private void addCommitClass(Component item, int commitIndex) {
	item.add(AttributeAppender.append("class", " commit-item-" + commitIndex));
}