use of org.apache.wicket.ajax.AjaxChannel 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.ajax.AjaxChannel 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.ajax.AjaxChannel 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.ajax.AjaxChannel in project midpoint by Evolveum.
the class AbstractRoleMainPanel method initShoppingCartPanel.
private void initShoppingCartPanel(PageAdminObjectDetails<R> parentPage) {
RoleCatalogStorage storage = parentPage.getSessionStorage().getRoleCatalog();
WebMarkupContainer shoppingCartButtonsPanel = new WebMarkupContainer(ID_SHOPPING_CART_BUTTONS_PANEL);
shoppingCartButtonsPanel.setOutputMarkupId(true);
shoppingCartButtonsPanel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
// Role Catalog page
return PageAssignmentShoppingKart.class.equals(getPreviousPage(parentPage));
}
});
getMainForm().add(shoppingCartButtonsPanel);
AjaxButton addToCartButton = new AjaxButton(ID_ADD_TO_CART_BUTTON, parentPage.createStringResource("PageAssignmentDetails.addToCartButton")) {
private static final long serialVersionUID = 1L;
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
attributes.setChannel(new AjaxChannel("blocking", AjaxChannel.Type.ACTIVE));
}
@Override
public void onClick(AjaxRequestTarget target) {
AssignmentEditorDto dto = AssignmentEditorDto.createDtoFromObject(getObject().asObjectable(), UserDtoStatus.ADD, parentPage);
storage.getAssignmentShoppingCart().add(dto);
target.add(shoppingCartButtonsPanel);
}
};
addToCartButton.setOutputMarkupId(true);
addToCartButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
AssignmentEditorDto dto = AssignmentEditorDto.createDtoFromObject(getObject().asObjectable(), UserDtoStatus.ADD, parentPage);
return storage.isMultiUserRequest() || dto.isAssignable();
}
});
shoppingCartButtonsPanel.add(addToCartButton);
AjaxButton shoppingCartButton = new AjaxButton(ID_SHOPPING_CART_BUTTON) {
private static final long serialVersionUID = 1L;
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
attributes.setChannel(new AjaxChannel("blocking", AjaxChannel.Type.ACTIVE));
}
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
parentPage.navigateToNext(PageAssignmentsList.class);
}
};
shoppingCartButton.setOutputMarkupId(true);
shoppingCartButtonsPanel.add(shoppingCartButton);
Label cartItemsCount = new Label(ID_ITEMS_COUNT, new LoadableModel<String>(true) {
private static final long serialVersionUID = 1L;
@Override
public String load() {
return Integer.toString(storage.getAssignmentShoppingCart().size());
}
});
cartItemsCount.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
if (storage.getAssignmentShoppingCart().size() == 0) {
return false;
} else {
return true;
}
}
});
cartItemsCount.setOutputMarkupId(true);
shoppingCartButton.add(cartItemsCount);
}
use of org.apache.wicket.ajax.AjaxChannel in project midpoint by Evolveum.
the class AssignmentCatalogPanel method initCartButton.
private void initCartButton(WebMarkupContainer headerPanel) {
AjaxButton cartButton = new AjaxButton(ID_CART_BUTTON) {
private static final long serialVersionUID = 1L;
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
attributes.setChannel(new AjaxChannel("blocking", AjaxChannel.Type.ACTIVE));
}
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
pageBase.navigateToNext(PageAssignmentsList.class);
}
};
cartButton.add(new VisibleEnableBehaviour() {
public boolean isVisible() {
return !isCatalogOidEmpty();
}
});
cartButton.setOutputMarkupId(true);
headerPanel.add(cartButton);
Label cartItemsCount = new Label(ID_CART_ITEMS_COUNT, new LoadableModel<String>(true) {
private static final long serialVersionUID = 1L;
@Override
public String load() {
return Integer.toString(getRoleCatalogStorage().getAssignmentShoppingCart().size());
}
});
cartItemsCount.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
SessionStorage storage = pageBase.getSessionStorage();
if (storage.getRoleCatalog().getAssignmentShoppingCart().size() == 0) {
return false;
} else {
return true;
}
}
});
cartItemsCount.setOutputMarkupId(true);
cartButton.add(cartItemsCount);
}
Aggregations