add(new SimpleAttributeModifier("style", "float:right"))
/** * @see org.apache.wicket.behavior.AbstractBehavior#onComponentTag(org.apache.wicket.Component, * org.apache.wicket.markup.ComponentTag) */ public void onComponentTag(final Component component, final ComponentTag tag) { if (isEnabled(component)) { tag.getAttributes().put(attribute, value); } } }
yourLink.add(new SimpleAttributeModifier("onclick","alert('information')"));
/** * @see org.apache.wicket.behavior.AbstractBehavior#onComponentTag(org.apache.wicket.Component, * org.apache.wicket.markup.ComponentTag) */ @Override public void onComponentTag(final Component component, final ComponentTag tag) { if (isEnabled(component)) { tag.getAttributes().put(attribute, value); } } }
new SimpleAttributeModifier("onclick", "concat();")
public IBehavior getDatePickerStyle() { return new CompositeBehavior( new SimpleAttributeAppender("class", "date-pick", " "), new SimpleAttributeModifier("size", String.valueOf(format_.length())), new SimpleAttributeModifier("maxlength", String.valueOf(format_.length())), new SimpleAttributeModifier("title", format_) ); } }
/** * Set the 'class' attribute for the tbody tag. * * @param cssStyle */ public final void setTableBodyCss(final String cssStyle) { body.add(new SimpleAttributeModifier("class", cssStyle)); }
public Component createComponent(String id, DebugBar debugBar) { Label label = new Label(id, new AbstractReadOnlyModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { return Application.get().getFrameworkSettings().getVersion(); } }); label.add(new SimpleAttributeModifier("class", "wicketversioncontrib")); return label; }
Label label = new Label("id", "Some silly text.") add(label); label.add(new SimpleAttributeModifier("class", "my-css-class");
@Override protected Link newPagingNavigationLink(String id, IPageable pageable, int pageNumber) { Link link = super.newPagingNavigationLink(id, pageable, pageNumber); // we turn the id into the css class link.add(new SimpleAttributeModifier("class", id)); return link; }
@Override protected Link newPagingNavigationIncrementLink(String id, IPageable pageable, int increment) { Link link = super.newPagingNavigationIncrementLink(id, pageable, increment); // we turn the id into the css class link.add(new SimpleAttributeModifier("class", id)); return link; }
super(id); add(new Label("value", " " + numberOfConflictingDays +" ").add(new SimpleAttributeModifier("style", "color: red"))); add(new AjaxButton("cancelButton", this) {
item.add(checkBox); String js = "deselectChecks('" + checkboxMarkupId + "');"; checkbox.add(new SimpleAttributeModifier("onchange", js));
@Override protected void populateItem(ListItem item) { String paramName = item.getDefaultModelObjectAsString(); ParamInfo paramMetadata = paramsMetadata.get(paramName); Component inputComponent; inputComponent = getInputComponent("parameterPanel", paramsModel, paramMetadata); String description = paramMetadata.getTitle(); if (description != null) { inputComponent.add(new SimpleAttributeModifier("title", description)); } item.add(inputComponent); } };
protected void addNewFieldValueCssClass(WebMarkupContainer component, FieldValuesModel fieldValuesModel, FieldValueModel fieldValueModel) { // add css class if field is new, there are no other exiting values, and the cardinality requires at least one value // Cardinality cardinality = fieldValuesModel.getFieldInstanceModel().getFieldInstance().getFieldAssignment().getCardinality(); // if (!fieldValueModel.isExistingValue() && !fieldValuesModel.containsExisting() && cardinality.isMinOne()) // component.add(new SimpleAttributeModifier("class", "newFieldValue")); // add css class if field value is new, and the display of it was user triggered. if (!fieldValueModel.isExistingValue() && fieldValuesModel.getShowExtraField() && fieldValuesModel.getShowExtraFieldUserTriggered()) component.add(new SimpleAttributeModifier("class", "newFieldValue")); }
@Override protected void populateItem(ListItem<String> item) { Link<String> wStatusLink = new Link<String>("wstatus_link", new Model( item.getModelObject())) { /* * (non-Javadoc) * * @see org.apache.wicket.markup.html.link.Link#onClick() */ @Override public void onClick() { PageParameters params = new PageParameters(); params.add("status", getModelObject()); setResponsePage(getPage().getClass(), params); } }; Label wStatusLabel = new Label("wstatus", item.getModelObject()); if (item.getModelObject().equals(status)) { wStatusLabel.add(new SimpleAttributeModifier("class", "selected")); } wStatusLink.add(wStatusLabel); item.add(wStatusLink); } });
protected void addNewFieldValueCssClass(WebMarkupContainer component, FieldValuesModel fieldValuesModel, FieldValueModel fieldValueModel) { // add css class if field is new, there are no other exiting values, and the cardinality requires at least one value // Cardinality cardinality = fieldValuesModel.getFieldInstanceModel().getFieldInstance().getFieldAssignment().getCardinality(); // if (!fieldValueModel.isExistingValue() && !fieldValuesModel.containsExisting() && cardinality.isMinOne()) // component.add(new SimpleAttributeModifier("class", "newFieldValue")); // add css class if field value is new, and the display of it was user triggered. if (!fieldValueModel.isExistingValue() && fieldValuesModel.getShowExtraField() && fieldValuesModel.getShowExtraFieldUserTriggered()) component.add(new SimpleAttributeModifier("class", "newFieldValue")); }
protected void populateItem(ListItem<MenuItem> item) { MenuItem menuItem = item.getModelObject(); BookmarkablePageLink<Page> link = new BookmarkablePageLink<Page>("menuItemLink", menuItem.getPageClass(), menuItem.getPageParameters()); link.add(menuItem.getCaption()); item.add(link); if (counter == selectedMenuItemIndex) { if (counter > 0) item.add(new SimpleAttributeModifier("class", "delimiter selected")); else item.add(new SimpleAttributeModifier("class", "selected")); } else { if (counter > 0) item.add(new SimpleAttributeModifier("class", "delimiter")); } counter++; } };
@Override protected void populateItem(ListItem<String> item) { Link<String> wStatusLink = new Link<String>("wstatus_link", new Model( item.getModelObject())) { /* * (non-Javadoc) * * @see org.apache.wicket.markup.html.link.Link#onClick() */ @Override public void onClick() { PageParameters params = new PageParameters(); params.add("status", getModelObject()); setResponsePage(getPage().getClass(), params); } }; Label wStatusLabel = new Label("wstatus", item.getModelObject()); if (item.getModelObject().equals(status)) { wStatusLabel.add(new SimpleAttributeModifier("class", "selected")); } wStatusLink.add(wStatusLabel); item.add(wStatusLink); } });
protected void setFieldParameters(FormComponent field) { Integer maxLength = getMaxLength(); if (maxLength != null) { field.add( new SimpleAttributeModifier("maxlength", maxLength.toString()) ); } String defaultValue = getDefaultValue(); if (defaultValue != null && Strings.isEmpty(getModelObjectAsString())) { field.setModelValue(defaultValue); } }