use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class MultiValueTextFormGroup method initButtons.
private void initButtons(WebMarkupContainer buttonGroup, final ListItem<T> item) {
AjaxLink add = new AjaxLink(ID_ADD) {
@Override
public void onClick(AjaxRequestTarget target) {
addValuePerformed(target, item);
}
};
add.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return isAddButtonVisible(item);
}
});
buttonGroup.add(add);
AjaxLink remove = new AjaxLink(ID_REMOVE) {
@Override
public void onClick(AjaxRequestTarget target) {
removeValuePerformed(target, item);
}
};
remove.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return isRemoveButtonVisible(item);
}
});
buttonGroup.add(remove);
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class MultiStateHorizontalButton method initLayout.
private void initLayout() {
WebMarkupContainer buttonsPanel = new WebMarkupContainer(ID_BUTTONS_CONTAINER);
buttonsPanel.setOutputMarkupId(true);
add(buttonsPanel);
RepeatingView buttons = new RepeatingView(ID_BUTTON);
buttons.setOutputMarkupId(true);
buttonsPanel.add(buttons);
for (String propertyKey : propertyKeysList) {
AjaxSubmitButton button = new AjaxSubmitButton(buttons.newChildId(), pageBase.createStringResource(propertyKey)) {
@Override
public void onSubmit(AjaxRequestTarget ajaxRequestTarget, Form form) {
MultiStateHorizontalButton.this.onStateChanged(propertyKeysList.indexOf(propertyKey), ajaxRequestTarget);
}
@Override
public void onError(AjaxRequestTarget ajaxRequestTarget, Form form) {
MultiStateHorizontalButton.this.onStateChanged(propertyKeysList.indexOf(propertyKey), ajaxRequestTarget);
}
};
button.add(getActiveButtonClassAppender(propertyKeysList.indexOf(propertyKey)));
button.setOutputMarkupId(true);
buttons.add(button);
}
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class FeedbackListView method populateItem.
@Override
protected void populateItem(final ListItem<FeedbackMessage> item) {
final FeedbackMessage message = item.getModelObject();
if (message.getMessage() instanceof OpResult) {
OperationResultPanel panel = new OperationResultPanel("message", new PropertyModel<OpResult>(item.getModel(), "message"), getPage()) {
private static final long serialVersionUID = 1L;
@Override
public void close(AjaxRequestTarget target) {
super.close(target);
message.markRendered();
}
protected void onAfterRender() {
((OpResult) message.getMessage()).setAlreadyShown(true);
super.onAfterRender();
}
;
};
panel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
public boolean isVisible() {
return !((OpResult) item.getModelObject().getMessage()).isAlreadyShown();
}
;
});
panel.setOutputMarkupId(true);
item.add(panel);
} else if (!(message.getMessage() instanceof OpResult)) {
message.markRendered();
ValidationErrorPanel validationPanel = new ValidationErrorPanel("message", item.getModel()) {
private static final long serialVersionUID = 1L;
@Override
public void close(AjaxRequestTarget target) {
super.close(target);
message.markRendered();
}
};
validationPanel.setOutputMarkupId(true);
item.add(validationPanel);
}
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class FocusProjectionsTabPanel method initLayout.
private void initLayout(final PageBase page) {
final WebMarkupContainer shadows = new WebMarkupContainer(ID_SHADOWS);
shadows.setOutputMarkupId(true);
add(shadows);
InlineMenu accountMenu = new InlineMenu(ID_SHADOW_MENU, new Model((Serializable) createShadowMenu()));
accountMenu.setVisible(!getObjectWrapper().isReadonly());
shadows.add(accountMenu);
final ListView<FocusSubwrapperDto<ShadowType>> projectionList = new ListView<FocusSubwrapperDto<ShadowType>>(ID_SHADOW_LIST, projectionModel) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<FocusSubwrapperDto<ShadowType>> item) {
PackageResourceReference packageRef;
final FocusSubwrapperDto<ShadowType> dto = item.getModelObject();
final PropertyModel<ObjectWrapper<F>> objectWrapperModel = new PropertyModel<ObjectWrapper<F>>(item.getModel(), "object");
final Panel shadowPanel;
if (dto.isLoadedOK()) {
packageRef = new PackageResourceReference(ImgResources.class, ImgResources.HDD_PRISM);
shadowPanel = new PrismObjectPanel<F>(ID_SHADOW, new PropertyModel<ObjectWrapper<F>>(item.getModel(), "object"), packageRef, getMainForm(), getPageBase());
} else {
shadowPanel = new SimpleErrorPanel<ShadowType>(ID_SHADOW, item.getModel()) {
private static final long serialVersionUID = 1L;
@Override
public void onShowMorePerformed(AjaxRequestTarget target) {
OperationResult fetchResult = dto.getResult();
if (fetchResult != null) {
showResult(fetchResult);
target.add(page.getFeedbackPanel());
}
}
};
}
shadowPanel.setOutputMarkupId(true);
shadowPanel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
FocusSubwrapperDto<ShadowType> shadowWrapperDto = item.getModelObject();
ObjectWrapper<ShadowType> shadowWrapper = shadowWrapperDto.getObject();
return !shadowWrapper.isMinimalized();
}
});
item.add(shadowPanel);
CheckTableHeader<F> shadowHeader = new CheckTableHeader<F>(ID_SHADOW_HEADER, objectWrapperModel) {
private static final long serialVersionUID = 1L;
@Override
protected void onClickPerformed(AjaxRequestTarget target) {
super.onClickPerformed(target);
onExpandCollapse(target, item.getModel());
target.add(shadows);
}
};
if (item.getModel().getObject().getStatus().equals(UserDtoStatus.DELETE)) {
shadowHeader.add(new AttributeModifier("class", "box-header with-border delete"));
}
item.add(shadowHeader);
}
};
AjaxCheckBox accountCheckAll = new AjaxCheckBox(ID_SHADOW_CHECK_ALL, new Model()) {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
for (FocusSubwrapperDto<ShadowType> dto : projectionList.getModelObject()) {
if (dto.isLoadedOK()) {
ObjectWrapper<ShadowType> accModel = dto.getObject();
accModel.setSelected(getModelObject());
}
}
target.add(shadows);
}
};
shadows.add(accountCheckAll);
shadows.add(projectionList);
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class ThreeStateBooleanPanel method initLayout.
private void initLayout(final String optionOneLabel, final String optionTwoLabel, final String optionThreeLabel, final String buttonCssClass) {
AjaxButton buttonTrue = new AjaxButton(ID_BUTTON_ONE, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
if (optionOneLabel == null) {
return getString("ThreeStateBooleanPanel.true");
} else {
return getString(optionOneLabel);
}
}
}) {
@Override
public void onClick(AjaxRequestTarget target) {
stateChanged(Boolean.TRUE, target);
}
};
buttonTrue.setOutputMarkupId(true);
buttonTrue.add(prepareButtonCssClass(buttonCssClass));
buttonTrue.add(prepareActiveButtonAppender(Boolean.TRUE));
add(buttonTrue);
AjaxButton buttonUndef = new AjaxButton(ID_BUTTON_TWO, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
if (optionTwoLabel == null) {
return getString("ThreeStateBooleanPanel.undef");
} else {
return getString(optionTwoLabel);
}
}
}) {
@Override
public void onClick(AjaxRequestTarget target) {
stateChanged(null, target);
}
};
buttonUndef.setOutputMarkupId(true);
buttonUndef.add(prepareButtonCssClass(buttonCssClass));
buttonUndef.add(prepareActiveButtonAppender(null));
add(buttonUndef);
AjaxButton buttonFalse = new AjaxButton(ID_BUTTON_THREE, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
if (optionThreeLabel == null) {
return getString("ThreeStateBooleanPanel.false");
} else {
return getString(optionThreeLabel);
}
}
}) {
@Override
public void onClick(AjaxRequestTarget target) {
stateChanged(Boolean.FALSE, target);
}
};
buttonFalse.setOutputMarkupId(true);
buttonFalse.add(prepareButtonCssClass(buttonCssClass));
buttonFalse.add(prepareActiveButtonAppender(Boolean.FALSE));
add(buttonFalse);
}
Aggregations