Java Code Examples for org.apache.wicket.Component#add()
The following examples show how to use
org.apache.wicket.Component#add() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: onedev File: IssueActivitiesPanel.java License: MIT License | 6 votes |
@Override protected void onBeforeRender() { activitiesView = new RepeatingView("activities"); addOrReplace(activitiesView); Issue issue = getIssue(); for (IssueActivity activity: getActivities()) { if (issue.isVisitedAfter(activity.getDate())) { activitiesView.add(newActivityRow(activitiesView.newChildId(), activity)); } else { Component row = newActivityRow(activitiesView.newChildId(), activity); row.add(AttributeAppender.append("class", "new")); activitiesView.add(row); } } super.onBeforeRender(); }
Example 2
Source Project: projectforge-webapp File: WicketUtils.java License: GNU General Public License v3.0 | 5 votes |
/** * Adds onclick attribute with "javascript:rowClick(this);". * @param row Html tr element. */ public static void addRowClick(final Component row) { row.add(AttributeModifier.replace("onclick", "javascript:rowClick(this);")); // add marker css class for contextMenu javaScript row.add(new AttributeAppender("class", Model.of("withContextMenu"), " ")); }
Example 3
Source Project: inception File: MetricSelectDropDownPanel.java License: Apache License 2.0 | 5 votes |
private static void show(AjaxRequestTarget target, Component component) { component.add(new DisplayNoneBehavior()); String js = "$('#" + component.getMarkupId() + "').animate({'width': '+=100'}, 100); $('#" + ((DropDownChoice) component).getMarkupId() + "').show();"; target.appendJavaScript(js); }
Example 4
Source Project: onedev File: InputAssistBehavior.java License: MIT License | 5 votes |
@Override protected void onBind() { super.onBind(); Component input = getComponent(); input.add(AttributeAppender.append("class", "input-assist")); input.setOutputMarkupId(true); }
Example 5
Source Project: yes-cart File: ImageView.java License: Apache License 2.0 | 5 votes |
private Component createSeoImage(final Component component, final SeoImage seoImage, final String lang) { if (seoImage != null) { final I18NWebSupport i18n = getI18NSupport(); component.add( new AttributeModifier(HTML_ALT, i18n.getFailoverModel(seoImage.getDisplayAlt(), seoImage.getAlt()).getValue(lang)), new AttributeModifier(HTML_TITLE, i18n.getFailoverModel(seoImage.getDisplayTitle(), seoImage.getTitle()).getValue(lang)) ); } return component; }
Example 6
Source Project: projectforge-webapp File: WicketUtils.java License: GNU General Public License v3.0 | 5 votes |
/** * Sets the html attribute placeholder. * @param component * @param value */ public static void setPlaceHolderAttribute(Component component, final String value) { if (component instanceof ComponentWrapperPanel) { component = ((ComponentWrapperPanel) component).getFormComponent(); } component.add(AttributeModifier.replace("placeholder", value)); }
Example 7
Source Project: sakai File: SettingsCategoryPanel.java License: Educational Community License v2.0 | 5 votes |
/** * Helper to handle the value and style updates of the running total label * * @param runningTotal label component to update * @param runningTotalMessage error message component * @return */ private void updateRunningTotal(final Component runningTotal, final Component runningTotalMessage) { final List<CategoryDefinition> categories = this.model.getObject().getGradebookInformation().getCategories(); BigDecimal total = BigDecimal.ZERO; for (final CategoryDefinition categoryDefinition : categories) { Double catWeight = categoryDefinition.getWeight(); if (catWeight == null) { catWeight = 0D; } BigDecimal weight = BigDecimal.valueOf(catWeight); if (weight == null) { weight = BigDecimal.ZERO; } if (!categoryDefinition.getExtraCredit()) { total = total.add(weight); } } // if comparison passes, we have '1' as the value if (total.compareTo(BigDecimal.ONE) == 0) { runningTotal.add(new AttributeModifier("class", "text-success")); runningTotalMessage.setVisible(false); } else { runningTotal.add(new AttributeModifier("class", "text-danger")); runningTotalMessage.setVisible(true); } runningTotal.setDefaultModel(Model.of(FormatHelper.formatDoubleAsPercentage(total.doubleValue() * 100))); }
Example 8
Source Project: ontopia File: DraggableBehavior.java License: Apache License 2.0 | 5 votes |
@Override protected void onBind() { super.onBind(); Component c = getComponent(); c.setOutputMarkupId(true); c.add(new AttributeAppender("class", new Model<String>("dg_" + id), " ")); }
Example 9
Source Project: ontopia File: DroppableBehavior.java License: Apache License 2.0 | 5 votes |
@Override protected void onBind() { super.onBind(); Component c = getComponent(); c.setOutputMarkupId(true); c.add(new AttributeAppender("class", new Model<String>("do_" + id), " ")); }
Example 10
Source Project: Orienteer File: OToursModule.java License: Apache License 2.0 | 5 votes |
@Override public void onInstantiation(Component component) { if(component instanceof Page) { component.add(new CustomizationBehavior()); } }
Example 11
Source Project: projectforge-webapp File: DefaultTreeTablePanel.java License: GNU General Public License v3.0 | 5 votes |
protected void addColumn(final WebMarkupContainer parent, final Component component, final String cssStyle) { if (cssStyle != null) { component.add(AttributeModifier.append("style", new Model<String>(cssStyle))); } parent.add(component); }
Example 12
Source Project: nextreports-server File: SearchEntityPanel.java License: Apache License 2.0 | 5 votes |
private void makeSearchComponentVisible(Component component, boolean isRowLabel) { component.setVisible(true); if (isRowLabel) { component.add(AttributeModifier.replace("class", "row-label row-bottom")); } else { component.add(AttributeModifier.replace("class", "row-bottom")); } }
Example 13
Source Project: projectforge-webapp File: SkillTreeBuilder.java License: GNU General Public License v3.0 | 5 votes |
protected void addColumn(final WebMarkupContainer parent, final Component component, final String cssStyle) { if (cssStyle != null) { component.add(AttributeModifier.append("style", new Model<String>(cssStyle))); } parent.add(component); }
Example 14
Source Project: onedev File: CommitListPanel.java License: MIT License | 4 votes |
private void addCommitClass(Component item, int commitIndex) { item.add(AttributeAppender.append("class", " commit-item-" + commitIndex)); }
Example 15
Source Project: projectforge-webapp File: WicketUtils.java License: GNU General Public License v3.0 | 4 votes |
public static void append(final Component component, final RowCssClass... rowCssClasses) { for (final RowCssClass rowCssClass : rowCssClasses) { component.add(AttributeModifier.append("class", rowCssClass.getCssClass())); } }
Example 16
Source Project: projectforge-webapp File: WicketUtils.java License: GNU General Public License v3.0 | 4 votes |
public static Component setStrong(final Component component) { component.add(AttributeModifier.append("style", "font-weight: bold;")); return component; }
Example 17
Source Project: sakai File: SettingsCategoryPanel.java License: Educational Community License v2.0 | 2 votes |
/** * Helper to add the tooltip when drop/keep settings cause a field to be disabled. * * @param textfield * @param usage determines which message bundle to use for title and aria-label */ private void addDropKeepDisabledToolTip(final Component textfield, final DropKeepUsage usage) { textfield.add(AttributeModifier.replace("title", new ResourceModel(usage.getMessage()))); textfield.add(AttributeModifier.replace("aria-label", new ResourceModel(usage.getMessage()))); }
Example 18
Source Project: projectforge-webapp File: WicketUtils.java License: GNU General Public License v3.0 | 2 votes |
/** * Sets attribute font-size: style="font-size: 1.1em;"; * @param component * @param size * @return This for chaining. */ public static Component setFontSizeLarge(final Component component) { component.add(AttributeModifier.append("style", "font-size: 1.5em;")); return component; }
Example 19
Source Project: sakai File: SettingsCategoryPanel.java License: Educational Community License v2.0 | 2 votes |
/** * Helper to add the tooltip when drop/keep settings cause a field to be disabled. * * @param textfield * @param usage determines which message bundle to use for title and aria-label */ private void addDropKeepDisabledToolTip(final Component textfield, final DropKeepUsage usage) { textfield.add(AttributeModifier.replace("title", new ResourceModel(usage.getMessage()))); textfield.add(AttributeModifier.replace("aria-label", new ResourceModel(usage.getMessage()))); }
Example 20
Source Project: sakai File: SettingsCategoryPanel.java License: Educational Community License v2.0 | 2 votes |
/** * Helper to remove the tooltip from above * * @param textfield */ private void removeDropKeepDisabledToolTip(final Component textfield) { textfield.add(AttributeModifier.remove("title")); textfield.add(AttributeModifier.remove("aria-label")); }