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);
}
use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.
the class SingleButtonPanel method initLayout.
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);
}
use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.
the class TablePanel method setTableCssClass.
public void setTableCssClass(String cssClass) {
Validate.notEmpty(cssClass, "Css class must not be null or empty.");
DataTable table = getDataTable();
table.add(new AttributeAppender("class", new Model(cssClass), " "));
}
use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.
the class BoxedTablePanel method initLayout.
private void initLayout(List<IColumn<T, String>> columns, ISortableDataProvider provider, int pageSize) {
setOutputMarkupId(true);
WebMarkupContainer box = new WebMarkupContainer(ID_BOX);
box.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
String boxCssClasses = getAdditionalBoxCssClasses();
if (boxCssClasses == null) {
return "";
} else {
return " " + boxCssClasses;
}
}
}));
add(box);
WebMarkupContainer tableContainer = new WebMarkupContainer(ID_TABLE_CONTAINER);
tableContainer.setOutputMarkupId(true);
DataTable<T, String> table = new SelectableDataTable<T>(ID_TABLE, columns, provider, pageSize) {
@Override
protected Item<T> newRowItem(String id, int index, IModel<T> rowModel) {
Item<T> item = super.newRowItem(id, index, rowModel);
return customizeNewRowItem(item, rowModel);
}
};
table.setOutputMarkupId(true);
tableContainer.add(table);
box.add(tableContainer);
TableHeadersToolbar headersTop = new TableHeadersToolbar(table, provider);
headersTop.setOutputMarkupId(true);
table.addTopToolbar(headersTop);
box.add(createHeader(ID_HEADER));
box.add(createFooter(ID_FOOTER));
}
Aggregations