public class JavascriptLink extends Label{ public JavascriptLink(String id, String label) { super(id, label); add(new AttributeAppender("onclick", "...your javascript here...")); } }
@Override public Component getLoadingComponent(String markupId) { Component component = new Label(markupId, "<img src='/img/ajax-indicator-big.gif'></img> Calculating merge preview..."); component.add(AttributeAppender.append("class", "calculating")); component.setEscapeModelStrings(false); return component; }
/** * Creates a attribute modifier that appends the current value with the given {@code value} * using a default space character (' ') separator. * * @param attributeName * @param value * @return the attribute modifier * @since 1.5 * @see AttributeAppender */ public static AttributeAppender append(String attributeName, IModel<?> value) { Args.notEmpty(attributeName, "attributeName"); return new AttributeAppender(attributeName, value).setSeparator(" "); }
@Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); if (isShowBox()) { SValidationFeedbackHandler.get(getFence().getMainContainer()).findNestedErrorsMaxLevel().ifPresent(level -> { new AttributeAppender("class", level.isWarning() ? "alert alert-warning" : "alert alert-danger").onComponentTag(this, tag); }); } }
@Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); if (isShowBox()) { SValidationFeedbackHandler.get(getFence().getMainContainer()).findNestedErrorsMaxLevel().ifPresent(level -> { new AttributeAppender("class", level.isWarning() ? "alert alert-warning" : "alert alert-danger", " ").onComponentTag(this, tag); }); } }
default AttributeAppender newBSGridColBehavior() { return new AttributeAppender("class", new AbstractReadOnlyModel<CharSequence>() { @Override public CharSequence getObject() { StringBuilder sb = new StringBuilder(); appendColValue(sb); appendColOffset(sb); appendHidden(sb); return sb; } }, " "); }
/** * Creates a attribute modifier that appends the current value with the given {@code value} * using a default space character (' ') separator. * * @param attributeName * @param value * @return the attribute modifier * @since 1.5 * @see AttributeAppender */ public static AttributeAppender append(String attributeName, IModel<?> value) { Args.notEmpty(attributeName, "attributeName"); return new AttributeAppender(attributeName, value).setSeparator(" "); }
@Override protected void onInitialize(FloatingPanel dropdown) { super.onInitialize(dropdown); dropdown.add(AttributeAppender.append("class", "nav-context-dropdown user-nav-context-dropdown")); }
BrickPanel a = new BrickPanel("abrick", ... ); BrickPanel b = new BrickPanel("bbrick", ... ); a.add(new AttributeAppender("class", "good")); b.add(new AttributeAppender("class", "bad")); add(a); add(b);
@Override protected void onInitialize() { super.onInitialize(); if (currentPrivilege == ProjectPrivilege.CODE_READ) add(AttributeAppender.append("class", "active")); }
//override this method of the DataTable class @Override protected Item<T> newRowItem(String id, int index, final IModel<T> model) { Item<T> rowItem = new Item<T>(id, index, model); item.add(new AttributeAppender("onclick", "$(this).addClass('selected').siblings().removeClass('selected')", " ")); return rowItem; }
@Override protected void onInitialize() { super.onInitialize(); if (currentPrivilege == ProjectPrivilege.CODE_WRITE) add(AttributeAppender.append("class", "active")); }
void addFirstOfType() { if (firstOfType == false) { menu.add(new AttributeAppender("class", true, new Model("first-of-type"), " ")); firstOfType = true; } }
@Override protected void onInitialize() { super.onInitialize(); add(AttributeAppender.append("class", new AbstractReadOnlyModel<String>() { @Override public String getObject() { return "label label-" + (milestoneModel.getObject().isClosed()? "success": "warning"); } })); }
public void addLinkAttribute(String attribute, String value) { link.add(new AttributeAppender(attribute, value)); } }
@Override protected void onInitialize() { super.onInitialize(); add(AttributeAppender.append("class", "state-spec def-detail")); }
YuiMenuGroupMenu(IModel label, final boolean firstMenu, boolean addInit) { super(null, false, addInit); Label lbl = new Label(LABEL_ID, label); if (firstMenu) { lbl.add(new AttributeAppender("class", true, new Model( "first-of-type"), " ")); } add(lbl); }
@Override protected void onInitialize(FloatingPanel dropdown) { super.onInitialize(dropdown); dropdown.add(AttributeAppender.append("class", "menu tabs")); }
void addFirstOfType() { if (firstOfType == false) { getItemContainer().add( new AttributeAppender("class", true, new Model("first-of-type"), " ")); firstOfType = true; } }
@Override protected void onInitialize() { super.onInitialize(); add(AttributeAppender.append("class", "board-spec def-detail")); }