use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.
the class ProcessInstancesPanel method initLayout.
private void initLayout(UserProfileStorage.TableId tableId, int pageSize, View view, final IModel<String> currentInstanceIdModel) {
BoxedTablePanel<ProcessInstanceDto> table = new BoxedTablePanel<ProcessInstanceDto>(ID_REQUESTS_TABLE, provider, initColumns(view), tableId, pageSize) {
@Override
protected Item<ProcessInstanceDto> customizeNewRowItem(Item<ProcessInstanceDto> item, final IModel<ProcessInstanceDto> rowModel) {
item.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
if (currentInstanceIdModel == null || currentInstanceIdModel.getObject() == null) {
return "";
}
ProcessInstanceDto rowDto = rowModel.getObject();
if (currentInstanceIdModel.getObject().equals(rowDto.getProcessInstanceId())) {
return "info";
} else {
return "";
}
}
}));
return item;
}
};
table.setOutputMarkupId(true);
table.setAdditionalBoxCssClasses("without-box-header-top-border");
add(table);
}
use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.
the class CheckFormGroup method initLayout.
private void initLayout(IModel<String> label, final String tooltipKey, boolean isTooltipInModal, String labelSize, String textSize) {
WebMarkupContainer labelContainer = new WebMarkupContainer(ID_LABEL_CONTAINER);
add(labelContainer);
Label l = new Label(ID_LABEL, label);
if (StringUtils.isNotEmpty(labelSize)) {
labelContainer.add(AttributeAppender.prepend("class", labelSize));
}
labelContainer.add(l);
Label tooltipLabel = new Label(ID_TOOLTIP, new Model<>());
tooltipLabel.add(new AttributeAppender("data-original-title", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return getString(tooltipKey);
}
}));
tooltipLabel.add(new InfoTooltipBehavior(isTooltipInModal));
tooltipLabel.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return tooltipKey != null;
}
});
tooltipLabel.setOutputMarkupId(true);
tooltipLabel.setOutputMarkupPlaceholderTag(true);
labelContainer.add(tooltipLabel);
WebMarkupContainer checkWrapper = new WebMarkupContainer(ID_CHECK_WRAPPER);
if (StringUtils.isNotEmpty(textSize)) {
checkWrapper.add(AttributeAppender.prepend("class", textSize));
}
add(checkWrapper);
CheckBox check = new CheckBox(ID_CHECK, getModel());
check.setLabel(label);
checkWrapper.add(check);
}
use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.
the class MultipleAssignmentSelector method updateBoxedTablePanelStyles.
private void updateBoxedTablePanelStyles(BoxedTablePanel panel) {
panel.getDataTableContainer().add(new AttributeAppender("class", " multiple-assignment-selector-table-container"));
panel.getDataTable().add(new AttributeModifier("class", "multiple-assignment-selector-table"));
panel.getFooterPaging().getParent().add(new AttributeModifier("class", "multiple-assignment-selector-table-footer"));
}
use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.
the class MultiButtonTable method populateCell.
protected void populateCell(WebMarkupContainer cellContainer, final AssignmentEditorDto assignment) {
AjaxLink inner = new AjaxLink(ID_INNER) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
targetObjectDetailsPerformed(assignment, ajaxRequestTarget);
}
};
inner.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
return isMultiUserRequest() || canAssign(assignment);
}
});
cellContainer.add(inner);
Label nameLabel = new Label(ID_INNER_LABEL, assignment.getName());
inner.add(nameLabel);
Label descriptionLabel = new Label(ID_INNER_DESCRIPTION, assignment.getTargetRef() != null ? assignment.getTargetRef().getDescription() : "");
descriptionLabel.setOutputMarkupId(true);
inner.add(descriptionLabel);
AjaxLink detailsLink = new AjaxLink(ID_DETAILS_LINK) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
assignmentDetailsPerformed(assignment, ajaxRequestTarget);
}
};
detailsLink.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
return isMultiUserRequest() || canAssign(assignment);
}
});
cellContainer.add(detailsLink);
Label detailsLinkLabel = new Label(ID_DETAILS_LINK_LABEL, pageBase.createStringResource("MultiButtonPanel.detailsLink"));
detailsLinkLabel.setRenderBodyOnly(true);
detailsLink.add(detailsLinkLabel);
AjaxLink detailsLinkIcon = new AjaxLink(ID_DETAILS_LINK_ICON) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
}
};
detailsLinkIcon.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
return isMultiUserRequest() || canAssign(assignment);
}
});
detailsLink.add(detailsLinkIcon);
AjaxLink addToCartLink = new AjaxLink(ID_ADD_TO_CART_LINK) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
addAssignmentPerformed(assignment, ajaxRequestTarget);
}
};
addToCartLink.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
return isMultiUserRequest() || canAssign(assignment);
}
});
cellContainer.add(addToCartLink);
AjaxLink addToCartLinkIcon = new AjaxLink(ID_ADD_TO_CART_LINK_ICON) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
}
};
addToCartLinkIcon.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
return isMultiUserRequest() || canAssign(assignment);
}
});
addToCartLink.add(addToCartLinkIcon);
WebMarkupContainer icon = new WebMarkupContainer(ID_TYPE_ICON);
icon.add(new AttributeAppender("class", getIconClass(assignment.getType())));
cellContainer.add(icon);
WebMarkupContainer alreadyAssignedIcon = new WebMarkupContainer(ID_ALREADY_ASSIGNED_ICON);
alreadyAssignedIcon.add(new AttributeAppender("title", getAlreadyAssignedIconTitleModel(assignment)));
alreadyAssignedIcon.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return !isMultiUserRequest() && assignment.isAlreadyAssigned();
}
});
cellContainer.add(alreadyAssignedIcon);
}
use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.
the class MultiButtonTable method initLayout.
private void initLayout() {
itemsCount = getModel() != null ? (getModel().getObject() != null ? getModel().getObject().size() : 0) : 0;
RepeatingView rows = new RepeatingView(ID_ROW);
rows.setOutputMarkupId(true);
if (itemsCount > 0 && itemsPerRow > 0) {
int index = 0;
List<AssignmentEditorDto> assignmentsList = getModelObject();
long rowCount = itemsCount % itemsPerRow == 0 ? (itemsCount / itemsPerRow) : (itemsCount / itemsPerRow + 1);
for (int rowNumber = 0; rowNumber < rowCount; rowNumber++) {
WebMarkupContainer rowContainer = new WebMarkupContainer(rows.newChildId());
rows.add(rowContainer);
RepeatingView columns = new RepeatingView(ID_CELL);
columns.setOutputMarkupId(true);
rowContainer.add(columns);
for (int colNumber = 0; colNumber < itemsPerRow; colNumber++) {
WebMarkupContainer colContainer = new WebMarkupContainer(columns.newChildId());
columns.add(colContainer);
WebMarkupContainer itemButtonContainer = new WebMarkupContainer(ID_ITEM_BUTTON_CONTAINER);
itemButtonContainer.setOutputMarkupId(true);
itemButtonContainer.add(new AttributeAppender("class", getBackgroundClass(assignmentsList.get(index))));
colContainer.add(itemButtonContainer);
populateCell(itemButtonContainer, assignmentsList.get(index));
index++;
if (index >= assignmentsList.size()) {
break;
}
}
}
}
add(rows);
}
Aggregations