本文整理汇总了Java中org.apache.wicket.behavior.AttributeAppender类的典型用法代码示例。如果您正苦于以下问题:Java AttributeAppender类的具体用法?Java AttributeAppender怎么用?Java AttributeAppender使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AttributeAppender类属于org.apache.wicket.behavior包,在下文中一共展示了AttributeAppender类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newSuggestionItem
import org.apache.wicket.behavior.AttributeAppender; //导入依赖的package包/类
private Component newSuggestionItem(String itemId, InputCompletion suggestion) {
WebMarkupContainer item = new WebMarkupContainer(itemId);
WebMarkupContainer link = new WebMarkupContainer("link");
Range matchRange = suggestion.getMatchRange();
String label = suggestion.getLabel();
if (matchRange != null) {
String prefix = StringEscapeUtils.escapeHtml4(label.substring(0, matchRange.getFrom()));
String suffix = StringEscapeUtils.escapeHtml4(label.substring(matchRange.getTo()));
String matched = StringEscapeUtils.escapeHtml4(label.substring(matchRange.getFrom(), matchRange.getTo()));
link.add(new Label("label", prefix + "<b>" + matched + "</b>" + suffix).setEscapeModelStrings(false));
} else {
link.add(new Label("label", label));
}
item.add(link);
if (suggestion.getDescription() != null)
item.add(new Label("description", suggestion.getDescription()));
else
item.add(new Label("description").setVisible(false));
item.add(AttributeAppender.append("data-content", suggestion.complete(inputStatus).getContent()));
item.add(AttributeAppender.append("data-caret", suggestion.getCaret()));
item.setOutputMarkupId(true);
return item;
}
示例2: onInitialize
import org.apache.wicket.behavior.AttributeAppender; //导入依赖的package包/类
@Override
protected void onInitialize() {
super.onInitialize();
add(new INullAcceptingValidator<T>() {
@Override
public void validate(IValidatable<T> validatable) {
Validator validator = AppLoader.getInstance(Validator.class);
Set<?> violations = validator.validateValue(
propertyDescriptor.getBeanClass(),
propertyDescriptor.getPropertyName(),
validatable.getValue());
for (Object each: violations) {
ConstraintViolation<?> violation = (ConstraintViolation<?>) each;
addError(violation.getMessage());
}
}
});
add(new AttributeAppender("class", " property editor editable"));
}
示例3: onInitialize
import org.apache.wicket.behavior.AttributeAppender; //导入依赖的package包/类
@Override
protected void onInitialize() {
super.onInitialize();
input = new TextField<Number>("input", Model.of(getModelObject()));
input.setType(getPropertyDescriptor().getPropertyClass());
add(input);
add(new AttributeAppender("class", new LoadableDetachableModel<String>() {
@Override
protected String load() {
if (hasErrors(true))
return " has-error";
else
return "";
}
}));
}
示例4: onInitialize
import org.apache.wicket.behavior.AttributeAppender; //导入依赖的package包/类
@Override
protected void onInitialize() {
super.onInitialize();
add(AttributeAppender.append("class", new LoadableDetachableModel<String>() {
@Override
protected String load() {
BlobIdent blobIdent = (BlobIdent) getDefaultModelObject();
if (blobIdent.isTree())
return " fa fa-folder-o";
else if (blobIdent.isGitLink())
return " fa fa-ext fa-folder-submodule-o";
else if (blobIdent.isSymbolLink())
return " fa fa-ext fa-folder-symbol-link-o";
else
return " fa fa-file-text-o";
}
}));
}
示例5: onInitialize
import org.apache.wicket.behavior.AttributeAppender; //导入依赖的package包/类
@Override
protected void onInitialize() {
super.onInitialize();
add(input = new CheckBox("input", Model.of(getModelObject())));
add(new AttributeAppender("class", new LoadableDetachableModel<String>() {
@Override
protected String load() {
if (hasErrors(true))
return " has-error";
else
return "";
}
}));
}
示例6: onInitialize
import org.apache.wicket.behavior.AttributeAppender; //导入依赖的package包/类
@Override
protected void onInitialize() {
super.onInitialize();
add(new ListView<PropertyContext<Serializable>>("properties", propertyContexts) {
@Override
protected void populateItem(ListItem<PropertyContext<Serializable>> item) {
PropertyContext<Serializable> propertyContext = item.getModelObject();
Method propertyGetter = propertyContext.getPropertyGetter();
Label nameLabel = new Label("name", EditableUtils.getName(propertyGetter));
item.add(nameLabel);
OmitName omitName = propertyGetter.getAnnotation(OmitName.class);
if (omitName != null && omitName.value() != OmitName.Place.EDITOR) {
nameLabel.setVisible(false);
item.add(AttributeAppender.append("class", "name-omitted"));
}
Serializable bean = (Serializable) ReflectionBeanViewer.this.getDefaultModelObject();
Serializable propertyValue = (Serializable) propertyContext.getPropertyValue(bean);
item.add(propertyContext.renderForView("value", Model.of(propertyValue)));
}
});
}
示例7: onInitialize
import org.apache.wicket.behavior.AttributeAppender; //导入依赖的package包/类
@Override
protected void onInitialize() {
super.onInitialize();
add(new IValidator<T>() {
@Override
public void validate(IValidatable<T> validatable) {
Validator validator = AppLoader.getInstance(Validator.class);
for (ConstraintViolation<T> violation: validator.validate(validatable.getValue())) {
ValuePath valuePath = new ValuePath(violation.getPropertyPath());
if (!valuePath.getElements().isEmpty()) {
PathSegment.Property property = (Property) valuePath.getElements().iterator().next();
if (!propertyNames.contains(property.getName()))
continue;
}
ErrorContext errorContext = getErrorContext(valuePath);
errorContext.addError(violation.getMessage());
}
}
});
add(AttributeAppender.append("class", " bean editor editable"));
}
示例8: onInitialize
import org.apache.wicket.behavior.AttributeAppender; //导入依赖的package包/类
@Override
protected void onInitialize() {
super.onInitialize();
input = new PasswordTextField("input", Model.of(getModelObject()));
input.setRequired(false);
input.setResetPassword(false);
add(input);
String autocomplete = EditableUtils.getAutocomplete(getPropertyDescriptor().getPropertyGetter());
if (autocomplete != null)
input.add(AttributeAppender.append("autocomplete", autocomplete));
add(new AttributeAppender("class", new LoadableDetachableModel<String>() {
@Override
protected String load() {
if (hasErrors(true))
return " has-error";
else
return "";
}
}));
}
示例9: newSinceChangesRow
import org.apache.wicket.behavior.AttributeAppender; //导入依赖的package包/类
private Component newSinceChangesRow(String id, Date sinceDate) {
WebMarkupContainer row = new WebMarkupContainer(id);
row.setOutputMarkupId(true);
row.add(AttributeAppender.append("class", " non-discussion"));
WebMarkupContainer avatarColumn = new WebMarkupContainer("avatar");
avatarColumn.add(new WebMarkupContainer("avatar"));
row.add(avatarColumn);
WebMarkupContainer contentColumn = new Fragment("content", "sinceChangesRowContentFrag", this);
contentColumn.add(new SinceChangesLink("sinceChanges", requestModel, sinceDate));
row.add(contentColumn);
row.add(AttributeAppender.append("class", "since-changes"));
return row;
}
示例10: onInitialize
import org.apache.wicket.behavior.AttributeAppender; //导入依赖的package包/类
@Override
protected void onInitialize() {
super.onInitialize();
add(AttributeAppender.append("class", new LoadableDetachableModel<String>() {
@Override
protected String load() {
if (anyMessage(FeedbackMessage.ERROR) || anyMessage(FeedbackMessage.FATAL))
return " error";
else if (anyMessage(FeedbackMessage.WARNING))
return " warning";
else if (anyMessage(FeedbackMessage.SUCCESS))
return " success";
else
return " info";
}
}));
}
示例11: loadNavbar
import org.apache.wicket.behavior.AttributeAppender; //导入依赖的package包/类
/**
* generates the navbar and mark the active page
*
* @param activePage page to be marked active (null for no active page)
*/
private void loadNavbar(final PageType activePage) {
// add an entry for each page type
add(new ListView<PageType>("navbar_left_elements", Arrays.asList(PageType.values())) {
@Override
protected void populateItem(final ListItem<PageType> item) {
final PageType type = item.getModelObject();
// create a link for the page type
BookmarkablePageLink<String> link = new BookmarkablePageLink<>("navbar_left_element_link", type.getPageClass());
link.add(new Label("navbar_left_element_text", type.getLinkText()));
// if the type is same as active page, mark it as active
if (type.equals(activePage)) link.add(new AttributeAppender("class", "active", " "));
item.add(link);
}
});
// create the summoner search region drop down menu
// get all valid entries
List<String> endpoints = Arrays.asList(RiotEndpoint.PLAYABLE_ENDPOINTS)
.stream().map(RiotEndpoint::name).collect(Collectors.toList());
// add the options to the drop down menu
DropDownChoice<String> dropDownChoice = new DropDownChoice<>("navbar_form_regions_select",
new PropertyModel<>(this, "selectedRegion"), endpoints, new StringChoiceRenderer());
dropDownChoice.add(new AttributeModifier("name", "region"));
add(dropDownChoice);
}
示例12: initLayout
import org.apache.wicket.behavior.AttributeAppender; //导入依赖的package包/类
private void initLayout(IModel<String> label, String labelSize, String textSize, boolean required) {
Label l = new Label(ID_LABEL, label);
if (StringUtils.isNotEmpty(labelSize)) {
l.add(AttributeAppender.prepend("class", labelSize));
}
add(l);
WebMarkupContainer dateWrapper = new WebMarkupContainer(ID_DATE_WRAPPER);
if (StringUtils.isNotEmpty(textSize)) {
dateWrapper.add(AttributeAppender.prepend("class", textSize));
}
add(dateWrapper);
DateInput date = new DateInput(ID_DATE, new XmlGregorianCalendarModel(getModel()));
date.setRequired(required);
date.setLabel(label);
dateWrapper.add(date);
FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(date));
dateWrapper.add(feedback);
}
示例13: initLayout
import org.apache.wicket.behavior.AttributeAppender; //导入依赖的package包/类
private void initLayout(){
AjaxButton button = new AjaxButton(ID_BUTTON, createButtonStringResource(getCaption())) {
@Override
public void onClick(AjaxRequestTarget target) {
clickPerformed(target, SingleButtonPanel.this.getModel());
}
@Override
public boolean isEnabled(){
return SingleButtonPanel.this.isEnabled(SingleButtonPanel.this.getModel());
}
@Override
public boolean isVisible() {
return SingleButtonPanel.this.isVisible(SingleButtonPanel.this.getModel());
}
};
button.add(new AttributeAppender("class", getButtonCssClass()));
add(button);
}
示例14: BootstrapLabel
import org.apache.wicket.behavior.AttributeAppender; //导入依赖的package包/类
public BootstrapLabel(String id, IModel<String> model, final IModel<State> state) {
super(id, model);
add(AttributeAppender.append("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
StringBuilder sb = new StringBuilder();
sb.append("label label-");
State s = state.getObject();
if (s == null) {
s = State.DEFAULT;
}
sb.append(s.name().toLowerCase());
return sb.toString();
}
}));
}
示例15: AsyncDashboardPanel
import org.apache.wicket.behavior.AttributeAppender; //导入依赖的package包/类
public AsyncDashboardPanel(String id, IModel<String> title, String icon, IModel<V> callableParameterModel,
Duration durationSecs, String boxCssClasses, boolean noPadding) {
super(id, callableParameterModel, durationSecs);
initLayout(noPadding);
WebMarkupContainer dashboardTitle = (WebMarkupContainer) get(
createComponentPath(ID_DASHBOARD_PARENT, ID_DASHBOARD_TITLE));
Label label = (Label) dashboardTitle.get(ID_TITLE);
label.setDefaultModel(title);
if (boxCssClasses == null) {
boxCssClasses = GuiStyleConstants.CLASS_BOX_DEFAULT;
}
Component dashboardParent = get(ID_DASHBOARD_PARENT);
dashboardParent.add(new AttributeAppender("class", " " + boxCssClasses));
WebMarkupContainer iconI = new WebMarkupContainer(ID_ICON);
iconI.add(AttributeModifier.replace("class", icon));
dashboardTitle.add(iconI);
}