use of org.apache.wicket.ajax.markup.html.AjaxLink 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.markup.html.AjaxLink in project midpoint by Evolveum.
the class TargetUserSelectorComponent method initLayout.
private void initLayout() {
AjaxLink<String> targetUserButton = new AjaxLink<String>(ID_TARGET_USER_BUTTON) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
if (showUserSelectionPopup) {
initUserSelectionPopup(createStringResource("AssignmentCatalogPanel.selectTargetUser"), true, target);
}
showUserSelectionPopup = true;
}
};
targetUserButton.add(new AttributeAppender("class", "btn btn-default" + (StringUtils.isEmpty(additionalButtonStyle) ? "" : " " + additionalButtonStyle)));
targetUserButton.setOutputMarkupId(true);
targetUserButton.add(new AttributeAppender("title", getTargetUsersButtonTitle()));
add(targetUserButton);
Label label = new Label(ID_TARGET_USER_LABEL, createStringResource("AssignmentCatalogPanel.selectTargetUser"));
label.setRenderBodyOnly(true);
targetUserButton.add(label);
AjaxLink deleteButton = new AjaxLink(ID_DELETE_TARGET_USER_BUTTON) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
showUserSelectionPopup = false;
getRoleCatalogStorage().setTargetUserList(null);
target.add(pageBase);
}
};
deleteButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return getRoleCatalogStorage().getTargetUserList() != null && getRoleCatalogStorage().getTargetUserList().size() > 0;
}
});
targetUserButton.add(deleteButton);
}
use of org.apache.wicket.ajax.markup.html.AjaxLink in project midpoint by Evolveum.
the class RunReportPopupPanel method createInputMarkup.
private WebMarkupContainer createInputMarkup(final IModel<JasperReportValueDto> valueModel, JasperReportParameterDto param) {
param.setEditing(true);
WebMarkupContainer paramValueMarkup = new WebMarkupContainer("valueMarkup");
paramValueMarkup.setOutputMarkupId(true);
InputPanel input = createTypedInputPanel("inputValue", valueModel, "value", param);
paramValueMarkup.add(input);
//buttons
AjaxLink<String> addButton = new AjaxLink<String>(ID_ADD_BUTTON) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
addValue(paramValueMarkup, param, target);
}
};
addButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isAddButtonVisible(param);
}
});
paramValueMarkup.add(addButton);
AjaxLink<String> removeButton = new AjaxLink<String>(ID_REMOVE_BUTTON) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
removeValue(paramValueMarkup, param, valueModel.getObject(), target);
}
};
removeButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isRemoveButtonVisible();
}
});
paramValueMarkup.add(removeButton);
return paramValueMarkup;
}
use of org.apache.wicket.ajax.markup.html.AjaxLink in project midpoint by Evolveum.
the class PageBase method initTitleLayout.
private void initTitleLayout(WebMarkupContainer mainHeader) {
WebMarkupContainer pageTitleContainer = new WebMarkupContainer(ID_PAGE_TITLE_CONTAINER);
pageTitleContainer.add(createUserStatusBehaviour(true));
mainHeader.add(pageTitleContainer);
WebMarkupContainer pageTitle = new WebMarkupContainer(ID_PAGE_TITLE);
pageTitleContainer.add(pageTitle);
String environmentName = "";
if (deploymentInfoModel != null && deploymentInfoModel.getObject() != null && StringUtils.isNotEmpty(deploymentInfoModel.getObject().getName())) {
environmentName = deploymentInfoModel.getObject().getName();
}
Model<String> deploymentNameModel = new Model<String>(StringUtils.isNotEmpty(environmentName) ? environmentName + ": " : "");
Label deploymentName = new Label(ID_DEPLOYMENT_NAME, deploymentNameModel);
deploymentName.add(new VisibleEnableBehaviour() {
public boolean isVisible() {
return StringUtils.isNotEmpty(deploymentNameModel.getObject());
}
});
deploymentName.setRenderBodyOnly(true);
pageTitle.add(deploymentName);
Label pageTitleReal = new Label(ID_PAGE_TITLE_REAL, createPageTitleModel());
pageTitleReal.setRenderBodyOnly(true);
pageTitle.add(pageTitleReal);
ListView breadcrumbs = new ListView<Breadcrumb>(ID_BREADCRUMB, new AbstractReadOnlyModel<List<Breadcrumb>>() {
private static final long serialVersionUID = 1L;
@Override
public List<Breadcrumb> getObject() {
return getBreadcrumbs();
}
}) {
@Override
protected void populateItem(ListItem<Breadcrumb> item) {
final Breadcrumb dto = item.getModelObject();
AjaxLink bcLink = new AjaxLink(ID_BC_LINK) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
redirectBackToBreadcrumb(dto);
}
};
item.add(bcLink);
bcLink.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
return dto.isUseLink();
}
});
WebMarkupContainer bcIcon = new WebMarkupContainer(ID_BC_ICON);
bcIcon.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return dto.getIcon() != null && dto.getIcon().getObject() != null;
}
});
bcIcon.add(AttributeModifier.replace("class", dto.getIcon()));
bcLink.add(bcIcon);
Label bcName = new Label(ID_BC_NAME, dto.getLabel());
bcLink.add(bcName);
item.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return dto.isVisible();
}
});
}
};
mainHeader.add(breadcrumbs);
}
use of org.apache.wicket.ajax.markup.html.AjaxLink in project midpoint by Evolveum.
the class PasswordPanel method initLayout.
private void initLayout(final IModel<ProtectedStringType> model, final boolean isReadOnly) {
setOutputMarkupId(true);
final WebMarkupContainer inputContainer = new WebMarkupContainer(ID_INPUT_CONTAINER) {
@Override
public boolean isVisible() {
return passwordInputVisble;
}
};
inputContainer.setOutputMarkupId(true);
add(inputContainer);
final PasswordTextField password1 = new PasswordTextField(ID_PASSWORD_ONE, new PasswordModel(model));
password1.setRequired(false);
password1.setResetPassword(false);
password1.setOutputMarkupId(true);
password1.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
inputContainer.add(password1);
final PasswordTextField password2 = new PasswordTextField(ID_PASSWORD_TWO, new Model<String>());
password2.setRequired(false);
password2.setResetPassword(false);
password2.setOutputMarkupId(true);
password2.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
inputContainer.add(password2);
password1.add(new AjaxFormComponentUpdatingBehavior("change") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
boolean required = !StringUtils.isEmpty(password1.getModel().getObject());
password2.setRequired(required);
//fix of MID-2463
// target.add(password2);
// target.appendJavaScript("$(\"#"+ password2.getMarkupId() +"\").focus()");
}
});
password2.add(new PasswordValidator(password1, password2));
final WebMarkupContainer linkContainer = new WebMarkupContainer(ID_LINK_CONTAINER) {
@Override
public boolean isVisible() {
return !passwordInputVisble;
}
};
inputContainer.setOutputMarkupId(true);
linkContainer.setOutputMarkupId(true);
add(linkContainer);
final Label passwordSetLabel = new Label(ID_PASSWORD_SET, new ResourceModel("passwordPanel.passwordSet"));
linkContainer.add(passwordSetLabel);
final Label passwordRemoveLabel = new Label(ID_PASSWORD_REMOVE, new ResourceModel("passwordPanel.passwordRemoveLabel"));
passwordRemoveLabel.setVisible(false);
linkContainer.add(passwordRemoveLabel);
AjaxLink link = new AjaxLink(ID_CHANGE_PASSWORD_LINK) {
@Override
public void onClick(AjaxRequestTarget target) {
onLinkClick(target);
}
@Override
public boolean isVisible() {
return !passwordInputVisble;
}
};
link.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !isReadOnly;
}
});
link.setBody(new ResourceModel("passwordPanel.passwordChange"));
link.setOutputMarkupId(true);
linkContainer.add(link);
final WebMarkupContainer removeButtonContainer = new WebMarkupContainer(ID_REMOVE_BUTTON_CONTAINER);
AjaxLink removePassword = new AjaxLink(ID_REMOVE_PASSWORD_LINK) {
@Override
public void onClick(AjaxRequestTarget target) {
onRemovePassword(model, target);
}
};
removePassword.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
PageBase pageBase = (PageBase) getPage();
if (pageBase == null) {
return false;
}
if (pageBase instanceof PageSelfProfile) {
return false;
}
if (pageBase instanceof PageUser && model.getObject() != null && !model.getObject().isEmpty()) {
return true;
}
return false;
}
});
removePassword.setBody(new ResourceModel("passwordPanel.passwordRemove"));
removePassword.setOutputMarkupId(true);
removeButtonContainer.add(removePassword);
add(removeButtonContainer);
}
Aggregations