public class JavascriptLink extends Label{ public JavascriptLink(String id, String label) { super(id, label); add(new AttributeAppender("onclick", "...your javascript here...")); } }
void addFirstOfType() { if (firstOfType == false) { menu.add(new AttributeAppender("class", true, new Model("first-of-type"), " ")); firstOfType = true; } }
/** * Register a component as draggable/moveable item. * (add the css class and markupId to be find on clientside). * * @param v the component to register. * @return this */ protected DnDSortableBehavior registerItem(Component v) { v.add(new AttributeAppender("class", new Model<String>(String.valueOf(options_.get("accept"))), " ")); v.setOutputMarkupId(true); return this; }
/** * Callback method for layout this component and the child components of it. */ protected void onLayout() { getLabel().add(new AttributeAppender("class", "col-lg-5 col-md-5 col-sm-5 ")); getViewableLabel().add(new AttributeAppender("class", "col-lg-5 col-md-5 col-sm-5 ")); } }
/** * Callback method for layout this component and the child components of it. */ protected void onLayout() { getLabel().add(new AttributeAppender("class", "col-lg-5 col-md-5 col-sm-5 ")); getEnumLabel().add(new AttributeAppender("class", "col-lg-5 col-md-5 col-sm-5 ")); } }
@Override protected void onBind() { super.onBind(); Component c = getComponent(); c.setOutputMarkupId(true); c.add(new AttributeAppender("class", new Model<String>("dg_" + id), " ")); }
public TextDialog(IModel<String> title, IModel<String> question, IModel<String> textModel) { super(); this.title = title; add(new Label("question", question)); TextAreaWidget textfield; add(textfield = new TextAreaWidget("value", textModel)); textfield.addBehaviourOnFormComponent( new AttributeAppender("class", true, new Model<String>("text-dialog-textarea"), " ")); setFocus(textfield.getFocusComponent()); }
public PasswordHashLink(final String id, final JcrPropertyModel propertyModel, final IModel<String> valueModel) { super(id, valueModel); this.propertyModel = propertyModel; linkText = "Hash password"; add(new Label("password-hash-link-text", new PropertyModel<String>(this, "linkText"))); add(new AttributeAppender("style", new AbstractReadOnlyModel<Object>() { @Override public Object getObject() { return "color:blue"; } }, " ")); }
public ReferenceLink(final String id, final JcrPropertyModel propertyModel, final IModel<String> valueModel) { super(id, valueModel); this.propertyModel = propertyModel; load(); add(new Label("reference-link-text", new PropertyModel<String>(this, "linkText"))); add(new AttributeAppender("style", new AbstractReadOnlyModel<Object>() { @Override public Object getObject() { return !isValidLink() ? "color:blue" : ""; } }, " ")); }
@Override protected void populateItem(ListItem item) { item.setRenderBodyOnly(true); AbstractYuiMenuItem mi = (AbstractYuiMenuItem) item.getModelObject(); mi.setIndex(item.getIndex()); if (0 == item.getIndex()) { mi.add(new AttributeAppender("class", true, new Model("first-of-type"), " ")); } item.add(mi); }
@Override protected WebMarkupContainer newLink(final String linkId, final int index) { WebMarkupContainer link = super.newLink(linkId, index); if (index == getSelectedTab()) { link.add(new AttributeAppender("class", getSelectedTabCssClass(), " ")); } return link; } }
@Override protected WebMarkupContainer newLink(final String linkId, final int index) { WebMarkupContainer link = super.newLink(linkId, index); if (index == getSelectedTab()) { link.add(new AttributeAppender("class", getSelectedTabCssClass(), " ")); } return link; }
@Override protected void onInitialize() { super.onInitialize(); add(new WebMarkupContainer("pin") .add(new AttributeAppender("style", getBackgroundColorModel()))); }
@Override public AttributeModifier[] getCellAttributeModifiers(IModel model) { Revision revision = (Revision) model.getObject(); StateIconAttributes attrs = new StateIconAttributes((JcrNodeModel) revision.getDocument()); AttributeModifier[] attributes = new AttributeModifier[2]; attributes[0] = new CssClassAppender(new PropertyModel(attrs, "cssClass")); attributes[1] = new AttributeAppender("title", new PropertyModel(attrs, "summary"), " "); return attributes; }
@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); }); } }
public BSModalBorder addButton(ButtonStyle style, IModel<String> label, Button button) { if (label != null) { button.setLabel(label); } buttonsContainer.addOrReplace(button .add(newButtonLabel(BUTTON_LABEL, button)) .add(new AttributeAppender("class", style.cssClassModel(), " "))); return this; }
@Override public void bind(Component component) { super.bind(component); component.setOutputMarkupId(true); component.add(new AttributeAppender("onclick", $(component).chain(button("loading")).get())); this.component = component; }
@Override protected void populateItem(Item<IRenderService> item) { IRenderService renderer = item.getModelObject(); renderer.bind(ListViewService.this, "item"); item.add(renderer.getComponent()); ListViewService.this.onAddRenderService(item, renderer); item.add(new AttributeAppender("class", new EvenOddModel(item.getIndex()), " ")); }
@Override protected void populateItem(Item<IRenderService> item) { IRenderService renderer = item.getModelObject(); renderer.bind(ListViewService.this, "item"); item.add(renderer.getComponent()); ListViewService.this.onAddRenderService(item, renderer); item.add(new AttributeAppender("class", new EvenOddModel(item.getIndex()), " ")); }