本文整理匯總了Java中org.apache.wicket.AttributeModifier類的典型用法代碼示例。如果您正苦於以下問題:Java AttributeModifier類的具體用法?Java AttributeModifier怎麽用?Java AttributeModifier使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AttributeModifier類屬於org.apache.wicket包,在下文中一共展示了AttributeModifier類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: CSSFeedbackPanel
import org.apache.wicket.AttributeModifier; //導入依賴的package包/類
public CSSFeedbackPanel(String id) {
super(id);
WebMarkupContainer feedbackul = (WebMarkupContainer) get("feedbackul");
if(feedbackul != null){
feedbackul.add(new AttributeModifier("class", true, new Model() {
private static final long serialVersionUID = 1L;
public Serializable getObject() {
if(anyErrorMessage()){
return "alertMessage";
}else if(anyMessage()){
return "success";
}else{
return "";
}
}
}));
feedbackul.add(new AttributeModifier("style", true, new Model("list-style-type:none")));
}
}
示例2: populateItem
import org.apache.wicket.AttributeModifier; //導入依賴的package包/類
@Override
protected void populateItem(Item<Var> item) {
String name = item.getModel().getObject().getName();
item.add(new AjaxLink("show") {
@Override
public void onClick(AjaxRequestTarget target) {
selectedName = name;
Component headerPanel = getPage().get(BasePage.STICKY_HEADER_ID);
VarModel varModel = new VarModel(model.getSessionId(), name);
VarPanel varPanel = new VarPanel(BasePage.STICKY_HEADER_ID, varModel, VarsRefreshingView.this);
headerPanel = headerPanel.replaceWith(varPanel);
target.add(headerPanel);
Component varsPanel = getPage().get(BasePage.LEFT_NAV_ID);
target.add(varsPanel);
}
}.add(new Label("name", name)));
String type = item.getModel().getObject().getValue().getTypeAsShortString();
item.add(new Label("type", type));
if (name.equals(selectedName)) {
item.add(new AttributeModifier("class", "success"));
}
}
示例3: loadNavbar
import org.apache.wicket.AttributeModifier; //導入依賴的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);
}
示例4: onConfigure
import org.apache.wicket.AttributeModifier; //導入依賴的package包/類
@Override
public void onConfigure(final Component component) {
component.setOutputMarkupId(true);
component.add(AttributeModifier.replace("data-toggle", "tooltip"));
component.add(new AttributeModifier("data-placement", getDataPlacement()) {
@Override
protected String newValue(String currentValue, String replacementValue) {
if (StringUtils.isEmpty(currentValue)) {
return replacementValue;
}
return currentValue;
}
});
}
示例5: getClassModifier
import org.apache.wicket.AttributeModifier; //導入依賴的package包/類
protected AttributeModifier getClassModifier(ListItem<AssignmentEditorDto> item){
return AttributeModifier.append("class", new AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
AssignmentEditorDto dto = item.getModel().getObject();
ObjectReferenceType targetRef = dto.getTargetRef();
if (targetRef != null && targetRef.getType() != null) {
return WebComponentUtil.getBoxThinCssClasses(targetRef.getType());
} else {
return GuiStyleConstants.CLASS_OBJECT_RESOURCE_BOX_THIN_CSS_CLASSES;
}
}
});
}
示例6: initLayout
import org.apache.wicket.AttributeModifier; //導入依賴的package包/類
protected void initLayout() {
setOutputMarkupId(true);
headerRow = new WebMarkupContainer(ID_HEADER_ROW);
headerRow.add(AttributeModifier.append("class", createHeaderClassModel(getModel())));
headerRow.setOutputMarkupId(true);
add(headerRow);
initHeaderRow();
WebMarkupContainer body = new WebMarkupContainer(ID_BODY);
body.setOutputMarkupId(true);
body.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
AssignmentEditorDto editorDto = AssignmentEditorPanel.this.getModel().getObject();
return !editorDto.isMinimized();
}
});
add(body);
initBodyLayout(body);
}
示例7: initLayout
import org.apache.wicket.AttributeModifier; //導入依賴的package包/類
private void initLayout(IModel<String> model, IModel<String> titleModel) {
AjaxLink link = new AjaxLink(ID_LINK) {
@Override
public void onClick(AjaxRequestTarget target) {
onClickPerformed(target);
}
};
Label image = new Label(ID_IMAGE);
image.add(AttributeModifier.replace("class", model));
if (titleModel != null) {
image.add(AttributeModifier.replace("title", titleModel));
}
link.add(image);
link.setOutputMarkupId(true);
add(link);
}
示例8: addOrReplaceProperties
import org.apache.wicket.AttributeModifier; //導入依賴的package包/類
private void addOrReplaceProperties(IModel<ContainerWrapper> model, final Form form, boolean isToBeReplaced){
ListView<ItemWrapper> properties = new ListView<ItemWrapper>("properties",
new PropertyModel(model, "properties")) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<ItemWrapper> item) {
item.add(new PrismPropertyPanel("property", item.getModel(), form, pageBase));
item.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return item.getModel().getObject().isVisible();
}
});
item.add(AttributeModifier.append("class", createStyleClassModel(item.getModel())));
}
};
properties.setReuseItems(true);
if (isToBeReplaced) {
replace(properties);
} else {
add(properties);
}
}
示例9: initLayout
import org.apache.wicket.AttributeModifier; //導入依賴的package包/類
private void initLayout() {
final TextField input = initTextField();
input.add(new AjaxFormComponentUpdatingBehavior("blur") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
//nothing to do, just update model data
}
});
input.add(new Behavior() {
@Override
public void bind(Component component) {
super.bind(component);
component.add(AttributeModifier.replace("onkeydown",
Model.of("if(event.keyCode == 13) {event.preventDefault();}")));
}
});
input.setOutputMarkupId(true);
add(input);
}
示例10: TextDetailsPanel
import org.apache.wicket.AttributeModifier; //導入依賴的package包/類
public TextDetailsPanel(String id, IModel<T> model, Class clazz){
super(id);
final TextField<T> text = new TextField<>(ID_INPUT, model);
text.setType(clazz);
add(text);
Label details = new Label(ID_DETAILS);
details.add(AttributeModifier.replace("title", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return createAssociationTooltip();
}
}));
details.add(new InfoTooltipBehavior(){
@Override
public String getDataPlacement(){
return "bottom";
}
});
add(details);
}
示例11: AsyncDashboardPanel
import org.apache.wicket.AttributeModifier; //導入依賴的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);
}
示例12: initLayout
import org.apache.wicket.AttributeModifier; //導入依賴的package包/類
private void initLayout(IModel<String> titleModel, String icon, String boxCssClasses) {
if (boxCssClasses == null) {
boxCssClasses = GuiStyleConstants.CLASS_BOX_DEFAULT;
}
WebMarkupContainer dashboardParent = new WebMarkupContainer(ID_DASHBOARD_PARENT);
dashboardParent.add(new AttributeAppender("class", " " + boxCssClasses));
add(dashboardParent);
WebMarkupContainer dashboardTitle = new WebMarkupContainer(ID_DASHBOARD_TITLE);
dashboardParent.add(dashboardTitle);
Label title = new Label(ID_TITLE);
title.setRenderBodyOnly(true);
title.setDefaultModel(titleModel);
dashboardTitle.add(title);
WebMarkupContainer dashboardContent = new WebMarkupContainer(ID_DASHBOARD_CONTENT);
dashboardContent.add(getMainComponent(ID_CONTENT));
dashboardParent.add(dashboardContent);
WebMarkupContainer iconI = new WebMarkupContainer(ID_ICON);
iconI.add(AttributeModifier.replace("class", icon));
dashboardTitle.add(iconI);
}
示例13: createCapabilityButton
import org.apache.wicket.AttributeModifier; //導入依賴的package包/類
private void createCapabilityButton(String id) {
AjaxLink<Boolean> button = new AjaxLink<Boolean>(id, new PropertyModel<Boolean>(getModel(), id)) {
@Override
public void onClick(AjaxRequestTarget target) {
// TODO:
}
};
button.add(new AttributeModifier("class",
button.getModelObject() ? "btn btn-app btn-resource-capability bg-light-blue"
: "btn btn-app btn-resource-capability bg-gray text-light-blue"));
button.add(new Label("label", new ResourceModel("CapabilitiesType." + id)));
add(button);
}
示例14: createPasswordPanel
import org.apache.wicket.AttributeModifier; //導入依賴的package包/類
private void createPasswordPanel(WebMarkupContainer staticRegistrationForm) {
// ProtectedStringType initialPassword = null;
PasswordPanel password = new PasswordPanel(ID_PASSWORD,
new PropertyModel<ProtectedStringType>(userModel, "credentials.password.value"), false, true);
password.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
password.getBaseFormComponent().setRequired(true);
staticRegistrationForm.add(password);
Label help = new Label(ID_TOOLTIP);
final StringResourceModel tooltipText = createStringResource("PageSelfRegistration.password.policy");
help.add(AttributeModifier.replace("title", tooltipText));
help.add(new InfoTooltipBehavior());
help.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return StringUtils.isNotEmpty(tooltipText.getObject());
}
});
staticRegistrationForm.add(help);
}
示例15: populateItem
import org.apache.wicket.AttributeModifier; //導入依賴的package包/類
@Override
protected void populateItem(Item<Count> item) {
//model for actual value
final PropertyModel<String> valueModel = new PropertyModel<>(item.getModel(), "name");
//checkbox
final Component selector = createValueCheckbox("selector", valueModel.getObject());
item.add(selector);
//label
item.add(new WebMarkupContainer("label")
//child label
.add(new FieldValueLabel("name", valueModel, fieldNameModel))
//count label
.add(new Label("count", new PropertyModel<String>(item.getModel(), "count")))
//reference to checkbox
.add(new AttributeModifier("for", selector.getMarkupId()))
.add(new AttributeAppender("class", valueModel, " "))
);
//description as tooltip (title)
final IModel<FieldValueDescriptor> descriptorModel = new MapValueModel<>(descriptorsModel, valueModel);
final IModel<String> descriptionModel = new PropertyModel<>(descriptorModel, "description");
item.add(new AttributeModifier("title", descriptionModel));
}