use of com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour in project midpoint by Evolveum.
the class NavigatorPanel method initNavigation.
private void initNavigation() {
IModel<Integer> model = new AbstractReadOnlyModel<Integer>() {
@Override
public Integer getObject() {
int count = (int) pageable.getPageCount();
if (count < PAGING_SIZE) {
return count;
}
return PAGING_SIZE;
}
};
Loop navigation = new Loop(ID_NAVIGATION, model) {
@Override
protected void populateItem(final LoopItem item) {
final NavigatorPageLink pageLink = new NavigatorPageLink(ID_PAGE_LINK, computePageNumber(item.getIndex())) {
@Override
public void onClick(AjaxRequestTarget target) {
pageLinkPerformed(target, getPageNumber());
}
};
item.add(pageLink);
item.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return pageable.getCurrentPage() == pageLink.getPageNumber() ? "active" : "";
}
}));
}
};
navigation.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return BooleanUtils.isTrue(showPageListingModel.getObject());
}
});
add(navigation);
}
use of com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour in project midpoint by Evolveum.
the class NavigatorPanel method initPrevious.
private void initPrevious() {
WebMarkupContainer previous = new WebMarkupContainer(ID_PREVIOUS);
previous.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return isPreviousEnabled() ? "" : "disabled";
}
}));
add(previous);
AjaxLink previousLink = new AjaxLink(ID_PREVIOUS_LINK) {
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
attributes.setChannel(new AjaxChannel("blocking", AjaxChannel.Type.ACTIVE));
}
@Override
public void onClick(AjaxRequestTarget target) {
previousPerformed(target);
}
};
previousLink.add(new VisibleEnableBehaviour() {
@Override
public boolean isEnabled() {
return isPreviousEnabled();
}
});
previous.add(previousLink);
}
use of com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour in project midpoint by Evolveum.
the class NavigatorPanel method initNext.
private void initNext() {
WebMarkupContainer next = new WebMarkupContainer(ID_NEXT);
next.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return isNextEnabled() ? "" : "disabled";
}
}));
add(next);
AjaxLink nextLink = new AjaxLink(ID_NEXT_LINK) {
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
attributes.setChannel(new AjaxChannel("blocking", AjaxChannel.Type.ACTIVE));
}
@Override
public void onClick(AjaxRequestTarget target) {
nextPerformed(target);
}
};
nextLink.add(new VisibleEnableBehaviour() {
@Override
public boolean isEnabled() {
return isNextEnabled();
}
});
next.add(nextLink);
}
use of com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour in project midpoint by Evolveum.
the class TargetUserSelectorComponent method initLayout.
private void initLayout() {
AjaxLink<String> targetUserButton = new AjaxLink<String>(ID_TARGET_USER_BUTTON) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
if (showUserSelectionPopup) {
initUserSelectionPopup(createStringResource("AssignmentCatalogPanel.selectTargetUser"), true, target);
}
showUserSelectionPopup = true;
}
};
targetUserButton.add(new AttributeAppender("class", "btn btn-default" + (StringUtils.isEmpty(additionalButtonStyle) ? "" : " " + additionalButtonStyle)));
targetUserButton.setOutputMarkupId(true);
targetUserButton.add(new AttributeAppender("title", getTargetUsersButtonTitle()));
add(targetUserButton);
Label label = new Label(ID_TARGET_USER_LABEL, createStringResource("AssignmentCatalogPanel.selectTargetUser"));
label.setRenderBodyOnly(true);
targetUserButton.add(label);
AjaxLink deleteButton = new AjaxLink(ID_DELETE_TARGET_USER_BUTTON) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
showUserSelectionPopup = false;
getRoleCatalogStorage().setTargetUserList(null);
target.add(pageBase);
}
};
deleteButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return getRoleCatalogStorage().getTargetUserList() != null && getRoleCatalogStorage().getTargetUserList().size() > 0;
}
});
targetUserButton.add(deleteButton);
}
use of com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour in project midpoint by Evolveum.
the class RunReportPopupPanel method createInputMarkup.
private WebMarkupContainer createInputMarkup(final IModel<JasperReportValueDto> valueModel, JasperReportParameterDto param) {
param.setEditing(true);
WebMarkupContainer paramValueMarkup = new WebMarkupContainer("valueMarkup");
paramValueMarkup.setOutputMarkupId(true);
InputPanel input = createTypedInputPanel("inputValue", valueModel, "value", param);
paramValueMarkup.add(input);
//buttons
AjaxLink<String> addButton = new AjaxLink<String>(ID_ADD_BUTTON) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
addValue(paramValueMarkup, param, target);
}
};
addButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isAddButtonVisible(param);
}
});
paramValueMarkup.add(addButton);
AjaxLink<String> removeButton = new AjaxLink<String>(ID_REMOVE_BUTTON) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
removeValue(paramValueMarkup, param, valueModel.getObject(), target);
}
};
removeButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isRemoveButtonVisible();
}
});
paramValueMarkup.add(removeButton);
return paramValueMarkup;
}
Aggregations