use of org.apache.wicket.ajax.markup.html.AjaxLink in project midpoint by Evolveum.
the class MultiValueDropDownPanel method initLayout.
private void initLayout(final boolean nullValid, final NonEmptyModel<Boolean> readOnlyModel) {
WebMarkupContainer placeholderContainer = new WebMarkupContainer(ID_PLACEHOLDER_CONTAINER);
placeholderContainer.setOutputMarkupPlaceholderTag(true);
placeholderContainer.setOutputMarkupPlaceholderTag(true);
placeholderContainer.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return getModel().getObject().isEmpty();
}
});
add(placeholderContainer);
AjaxLink placeholderAdd = new AjaxLink(ID_PLACEHOLDER_ADD) {
@Override
public void onClick(AjaxRequestTarget target) {
addValuePerformed(target);
}
};
placeholderAdd.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
if (buttonsDisabled()) {
return " " + CSS_DISABLED;
}
return "";
}
}));
placeholderAdd.setOutputMarkupId(true);
placeholderAdd.setOutputMarkupPlaceholderTag(true);
placeholderAdd.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
placeholderContainer.add(placeholderAdd);
ListView repeater = new ListView<T>(ID_REPEATER, getModel()) {
@Override
protected void populateItem(final ListItem<T> item) {
DropDownChoice choice = new DropDownChoice<>(ID_INPUT, createDropDownItemModel(item.getModel()), createChoiceList(), createRenderer());
choice.setNullValid(nullValid);
choice.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
item.add(choice);
WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
item.add(buttonGroup);
initButtons(buttonGroup, item, readOnlyModel);
}
};
repeater.setOutputMarkupId(true);
repeater.setOutputMarkupPlaceholderTag(true);
repeater.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !getModel().getObject().isEmpty();
}
});
add(repeater);
}
use of org.apache.wicket.ajax.markup.html.AjaxLink in project midpoint by Evolveum.
the class MultiValueDropDownPanel method initButtons.
private void initButtons(WebMarkupContainer buttonGroup, final ListItem<T> item, NonEmptyModel<Boolean> readOnlyModel) {
AjaxLink add = new AjaxLink(ID_ADD) {
@Override
public void onClick(AjaxRequestTarget target) {
addValuePerformed(target);
}
};
add.add(new AttributeAppender("class", getPlusClassModifier(item)));
add.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
buttonGroup.add(add);
AjaxLink remove = new AjaxLink(ID_REMOVE) {
@Override
public void onClick(AjaxRequestTarget target) {
removeValuePerformed(target, item);
}
};
remove.add(new AttributeAppender("class", getMinusClassModifier()));
remove.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
buttonGroup.add(remove);
}
use of org.apache.wicket.ajax.markup.html.AjaxLink in project midpoint by Evolveum.
the class NavigatorPanel method initLast.
private void initLast() {
WebMarkupContainer last = new WebMarkupContainer(ID_LAST);
last.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return isLastEnabled() ? "" : "disabled";
}
}));
add(last);
AjaxLink lastLink = new AjaxLink(ID_LAST_LINK) {
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
attributes.setChannel(new AjaxChannel("blocking", AjaxChannel.Type.ACTIVE));
}
@Override
public void onClick(AjaxRequestTarget target) {
lastPerformed(target);
}
};
lastLink.add(new VisibleEnableBehaviour() {
@Override
public boolean isEnabled() {
return BooleanUtils.isTrue(showPageListingModel.getObject()) && isLastEnabled();
}
});
last.add(lastLink);
}
use of org.apache.wicket.ajax.markup.html.AjaxLink in project midpoint by Evolveum.
the class TableConfigurationPanel method initLayout.
// @Override
protected void initLayout() {
WebMarkupContainer cogButton = new WebMarkupContainer(ID_COG_BUTTON);
cogButton.setOutputMarkupId(true);
add(cogButton);
WebMarkupContainer pageSize = new WebMarkupContainer(ID_PAGE_SIZE);
pageSize.setOutputMarkupId(true);
cogButton.add(pageSize);
AjaxLink tableColumns = new AjaxLink(ID_TABLE_COLUMNS) {
@Override
public void onClick(AjaxRequestTarget target) {
tableColumnsPerformed(target);
}
};
cogButton.add(tableColumns);
//todo implement [lazyman]
tableColumns.setVisible(false);
initPopoverLayout();
}
use of org.apache.wicket.ajax.markup.html.AjaxLink in project midpoint by Evolveum.
the class LinkIconPanel method initLayout.
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);
}
Aggregations