use of org.apache.wicket.ajax.markup.html.AjaxLink in project midpoint by Evolveum.
the class OperationResultPanel method initError.
private void initError(WebMarkupContainer operationPanel, final IModel<OpResult> model, Page parentPage) {
Label errorLabel = new Label("errorLabel", parentPage.getString("FeedbackAlertMessageDetails.error"));
errorLabel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
// return true;
return StringUtils.isNotBlank(model.getObject().getExceptionsStackTrace());
}
});
errorLabel.setOutputMarkupId(true);
operationPanel.add(errorLabel);
Label errorMessage = new Label("errorMessage", new PropertyModel<String>(model, "exceptionMessage"));
errorMessage.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
// return true;
return StringUtils.isNotBlank(model.getObject().getExceptionsStackTrace());
}
});
errorMessage.setOutputMarkupId(true);
operationPanel.add(errorMessage);
final Label errorStackTrace = new Label(ID_ERROR_STACK_TRACE, new PropertyModel<String>(model, "exceptionsStackTrace"));
errorStackTrace.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
// return true;
return model.getObject().isShowError();
}
});
errorStackTrace.setOutputMarkupId(true);
operationPanel.add(errorStackTrace);
AjaxLink errorStackTraceLink = new AjaxLink("errorStackTraceLink") {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
OpResult result = OperationResultPanel.this.getModelObject();
result.setShowError(!model.getObject().isShowError());
// hack to be able to expand/collapse OpResult after rendered.
result.setAlreadyShown(false);
// model.getObject().setShowError(!model.getObject().isShowError());
target.add(OperationResultPanel.this);
}
};
errorStackTraceLink.setOutputMarkupId(true);
errorStackTraceLink.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return StringUtils.isNotBlank(model.getObject().getExceptionsStackTrace());
}
});
operationPanel.add(errorStackTraceLink);
}
use of org.apache.wicket.ajax.markup.html.AjaxLink in project midpoint by Evolveum.
the class ValidationErrorPanel method initHeader.
private void initHeader(WebMarkupContainer box) {
WebMarkupContainer iconType = new WebMarkupContainer("iconType");
iconType.setOutputMarkupId(true);
iconType.add(new AttributeAppender("class", new AbstractReadOnlyModel() {
@Override
public Object getObject() {
FeedbackMessage result = getModelObject();
if (result == null) {
return " fa-info";
}
switch(result.getLevel()) {
case FeedbackMessage.INFO:
case FeedbackMessage.DEBUG:
return " fa-info";
case FeedbackMessage.SUCCESS:
return " fa-check";
case FeedbackMessage.ERROR:
case FeedbackMessage.FATAL:
return " fa-ban";
case FeedbackMessage.UNDEFINED:
// TODO:
case FeedbackMessage.WARNING:
default:
return " fa-warning";
}
}
}));
box.add(iconType);
Label message = new Label(ID_MESSAGE, new PropertyModel<Serializable>(getModel(), "message"));
box.add(message);
AjaxLink close = new AjaxLink("close") {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
close(target);
}
};
box.add(close);
}
use of org.apache.wicket.ajax.markup.html.AjaxLink in project midpoint by Evolveum.
the class ObjectPolicyConfigurationEditor method initButtons.
private void initButtons(WebMarkupContainer buttonGroup, final ListItem<ObjectPolicyConfigurationTypeDto> item) {
AjaxLink<String> add = new AjaxLink<String>(ID_BUTTON_ADD) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
addPerformed(target);
}
};
add.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isAddButtonVisible(item);
}
});
buttonGroup.add(add);
AjaxLink<String> remove = new AjaxLink<String>(ID_BUTTON_REMOVE) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
removePerformed(target, item);
}
};
remove.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isRemoveButtonVisible();
}
});
buttonGroup.add(remove);
}
use of org.apache.wicket.ajax.markup.html.AjaxLink in project midpoint by Evolveum.
the class ObjectPolicyConfigurationEditor method initLayout.
protected void initLayout() {
final Label label = new Label(ID_LABEL, createStringResource("objectPolicyConfigurationEditor.label"));
add(label);
ListView<ObjectPolicyConfigurationTypeDto> repeater = new ListView<ObjectPolicyConfigurationTypeDto>(ID_REPEATER, getModel()) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<ObjectPolicyConfigurationTypeDto> item) {
WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
textWrapper.add(AttributeAppender.prepend("class", new AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
if (item.getIndex() > 0) {
return OFFSET_CLASS + " " + CLASS_MULTI_VALUE;
}
return null;
}
}));
item.add(textWrapper);
TextField<String> name = new TextField<>(ID_NAME, createNameModel(item.getModel()));
name.setOutputMarkupId(true);
name.add(new AjaxFormComponentUpdatingBehavior("blur") {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
}
});
name.setEnabled(false);
name.add(AttributeAppender.replace("placeholder", createStringResource("objectPolicyConfigurationEditor.name.placeholder")));
textWrapper.add(name);
FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(name));
textWrapper.add(feedback);
AjaxLink<String> edit = new AjaxLink<String>(ID_BUTTON_EDIT) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
editPerformed(target, item);
}
};
textWrapper.add(edit);
WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
buttonGroup.add(AttributeAppender.append("class", new AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
if (item.getIndex() > 0) {
return CLASS_MULTI_VALUE;
}
return null;
}
}));
item.add(buttonGroup);
initButtons(buttonGroup, item);
}
};
// initDialog();
repeater.setOutputMarkupId(true);
add(repeater);
}
use of org.apache.wicket.ajax.markup.html.AjaxLink in project midpoint by Evolveum.
the class WizardSteps method initLayout.
protected void initLayout() {
ListView<WizardStepDto> linkContainer = new ListView<WizardStepDto>(ID_LINK_REPEATER, getModel()) {
@Override
protected void populateItem(ListItem<WizardStepDto> item) {
final WizardStepDto dto = item.getModelObject();
item.setRenderBodyOnly(true);
AjaxSubmitLink button = new AjaxSubmitLink(ID_LINK) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
changeStepPerformed(target, dto);
}
@Override
protected void onError(AjaxRequestTarget target, Form<?> form) {
target.add(getPageBase().getFeedbackPanel());
}
};
item.add(button);
button.add(new VisibleEnableBehaviour() {
@Override
public boolean isEnabled() {
final boolean enabled = ((PageResourceWizard) getPageBase()).isCurrentStepComplete();
// System.out.println(dto.getName() + " enabled = " + enabled);
return enabled;
}
@Override
public boolean isVisible() {
return dto.isVisible();
}
});
button.add(AttributeModifier.replace("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return dto.getWizardStep() == getActiveStep() ? "current" : null;
}
}));
button.add(AttributeModifier.replace("style", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
final boolean enabled = ((PageResourceWizard) getPageBase()).isCurrentStepComplete();
// TODO respect color scheme (and find a better style for disabled anyway...)
return enabled ? null : "color: #FFF;";
}
}));
Label label = new Label(ID_LABEL, createLabelModel(dto.getName()));
button.add(label);
}
};
add(linkContainer);
AjaxLink help = new AjaxLink(ID_BUTTON_HELP) {
@Override
public void onClick(AjaxRequestTarget target) {
showHelpPerformed(target);
}
};
add(help);
initModals();
}
Aggregations