use of org.apache.wicket.AttributeModifier in project midpoint by Evolveum.
the class NavigatorPanel method initFirst.
private void initFirst() {
WebMarkupContainer first = new WebMarkupContainer(ID_FIRST);
first.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return isFirstEnabled() ? "" : "disabled";
}
}));
add(first);
AjaxLink firstLink = new AjaxLink(ID_FIRST_LINK) {
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
attributes.setChannel(new AjaxChannel("blocking", AjaxChannel.Type.ACTIVE));
}
@Override
public void onClick(AjaxRequestTarget target) {
firstPerformed(target);
}
};
firstLink.add(new VisibleEnableBehaviour() {
@Override
public boolean isEnabled() {
return BooleanUtils.isTrue(showPageListingModel.getObject()) && isFirstEnabled();
}
});
first.add(firstLink);
}
use of org.apache.wicket.AttributeModifier 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 org.apache.wicket.AttributeModifier 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 org.apache.wicket.AttributeModifier 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 org.apache.wicket.AttributeModifier in project midpoint by Evolveum.
the class MyAssignmentsPanel method initLayout.
private void initLayout() {
List<IColumn<AssignmentItemDto, String>> columns = new ArrayList<IColumn<AssignmentItemDto, String>>();
columns.add(new IconColumn<AssignmentItemDto>(null) {
private static final long serialVersionUID = 1L;
@Override
protected IModel<String> createIconModel(final IModel<AssignmentItemDto> rowModel) {
return new AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
AssignmentItemDto item = rowModel.getObject();
if (item.getType() == null) {
return OperationResultStatusPresentationProperties.FATAL_ERROR.getIcon() + " fa-lg";
}
return item.getType().getIconCssClass();
}
};
}
@Override
protected IModel<String> createTitleModel(final IModel<AssignmentItemDto> rowModel) {
return new AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
AssignmentItemDto item = rowModel.getObject();
if (item.getType() == null) {
return MyAssignmentsPanel.this.getString("MyAssignmentsPanel.type.error");
}
switch(item.getType()) {
case CONSTRUCTION:
return MyAssignmentsPanel.this.getString("MyAssignmentsPanel.type.accountConstruction");
case ORG_UNIT:
return MyAssignmentsPanel.this.getString("MyAssignmentsPanel.type.orgUnit");
case ROLE:
return MyAssignmentsPanel.this.getString("MyAssignmentsPanel.type.role");
default:
return MyAssignmentsPanel.this.getString("MyAssignmentsPanel.type.error");
}
}
};
}
});
columns.add(new AbstractColumn<AssignmentItemDto, String>(createStringResource("MyAssignmentsPanel.assignment.displayName")) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<AssignmentItemDto>> cellItem, String componentId, final IModel<AssignmentItemDto> rowModel) {
AssignmentHeaderPanel panel = new AssignmentHeaderPanel(componentId, rowModel);
panel.add(new AttributeModifier("class", "dash-assignment-header"));
cellItem.add(panel);
}
});
ISortableDataProvider provider = new ListDataProvider(this, getModel());
TablePanel accountsTable = new TablePanel<AssignmentItemDto>(ID_ASSIGNMETNS_TABLE, provider, columns);
accountsTable.setShowPaging(false);
add(accountsTable);
}
Aggregations