use of com.evolveum.midpoint.web.component.AjaxButton in project midpoint by Evolveum.
the class TypedAssignablePanel method initLayout.
private void initLayout(Class<T> type, final boolean multiselect) {
DropDownChoice<QName> typeSelect = new DropDownChoice(ID_TYPE, typeModel, new ListModel(WebComponentUtil.createAssignableTypesList()), new QNameChoiceRenderer());
typeSelect.add(new OnChangeAjaxBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(get(ID_TABLES_CONTAINER));
target.add(addOrReplace(createCountContainer()));
}
});
typeSelect.setOutputMarkupId(true);
add(typeSelect);
WebMarkupContainer tablesContainer = new WebMarkupContainer(ID_TABLES_CONTAINER);
tablesContainer.setOutputMarkupId(true);
add(tablesContainer);
PopupObjectListPanel<T> listRolePanel = createObjectListPanel(ID_ROLE_TABLE, ID_SELECTED_ROLES, RoleType.COMPLEX_TYPE);
tablesContainer.add(listRolePanel);
PopupObjectListPanel<T> listResourcePanel = createObjectListPanel(ID_RESOURCE_TABLE, ID_SELECTED_RESOURCES, ResourceType.COMPLEX_TYPE);
tablesContainer.add(listResourcePanel);
PopupObjectListPanel<T> listOrgPanel = createObjectListPanel(ID_ORG_TABLE, ID_SELECTED_ORGS, OrgType.COMPLEX_TYPE);
tablesContainer.add(listOrgPanel);
PopupObjectListPanel<T> listServicePanel = createObjectListPanel(ID_SERVICE_TABLE, ID_SELECTED_SERVICES, ServiceType.COMPLEX_TYPE);
tablesContainer.add(listServicePanel);
WebMarkupContainer countContainer = createCountContainer();
add(countContainer);
AjaxButton addButton = new AjaxButton(ID_BUTTON_ASSIGN, createStringResource("userBrowserDialog.button.addButton")) {
@Override
public void onClick(AjaxRequestTarget target) {
List<T> selected = getSelectedData(ID_ROLE_TABLE);
selected.addAll(getSelectedData(ID_RESOURCE_TABLE));
selected.addAll(getSelectedData(ID_ORG_TABLE));
selected.addAll(getSelectedData(ID_SERVICE_TABLE));
TypedAssignablePanel.this.addPerformed(target, selected);
}
};
addButton.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return multiselect;
}
});
add(addButton);
}
use of com.evolveum.midpoint.web.component.AjaxButton in project midpoint by Evolveum.
the class AbstractObjectMainPanel method initLayoutBackButton.
protected void initLayoutBackButton(PageAdminObjectDetails<O> parentPage) {
AjaxButton back = new AjaxButton(ID_BACK, parentPage.createStringResource("pageAdminFocus.button.back")) {
@Override
public void onClick(AjaxRequestTarget target) {
backPerformed(target);
}
};
mainForm.add(back);
}
use of com.evolveum.midpoint.web.component.AjaxButton in project midpoint by Evolveum.
the class UserMenuPanel method initLayout.
private void initLayout() {
WebMarkupContainer iconBox = new WebMarkupContainer(ID_ICON_BOX);
add(iconBox);
NonCachingImage img = new NonCachingImage(ID_PHOTO, new AbstractReadOnlyModel<AbstractResource>() {
@Override
public AbstractResource getObject() {
if (jpegPhoto == null) {
return null;
} else {
return new ByteArrayResource("image/jpeg", jpegPhoto);
}
}
});
img.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
if (userModel != null && userModel.getObject() == null) {
loadModel(null);
}
return jpegPhoto != null;
}
});
iconBox.add(img);
ContextImage icon = new ContextImage(ID_ICON, "img/placeholder.png");
icon.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
if (userModel != null && userModel.getObject() == null) {
loadModel(null);
}
return jpegPhoto == null;
}
});
iconBox.add(icon);
Label usernameLink = new Label(ID_USERNAME_LINK, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return getShortUserName();
}
});
add(usernameLink);
WebMarkupContainer panelIconBox = new WebMarkupContainer(ID_PANEL_ICON_BOX);
add(panelIconBox);
NonCachingImage panelImg = new NonCachingImage(ID_PANEL_PHOTO, new AbstractReadOnlyModel<AbstractResource>() {
@Override
public AbstractResource getObject() {
if (jpegPhoto == null) {
return null;
} else {
return new ByteArrayResource("image/jpeg", jpegPhoto);
}
}
});
panelImg.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
if (userModel != null && userModel.getObject() == null) {
loadModel(null);
}
return jpegPhoto != null;
}
});
panelIconBox.add(panelImg);
ContextImage panelIcon = new ContextImage(ID_PANEL_ICON, "img/placeholder.png");
panelIcon.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
if (userModel != null && userModel.getObject() == null) {
loadModel(null);
}
return jpegPhoto == null;
}
});
panelIconBox.add(panelIcon);
Label username = new Label(ID_USERNAME, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return getShortUserName();
}
});
username.setRenderBodyOnly(true);
add(username);
ExternalLink logoutLink = new ExternalLink(ID_LOGOUT_LINK, new Model<>(RequestCycle.get().getRequest().getContextPath() + "/j_spring_security_logout"), createStringResource("UserMenuPanel.logout"));
add(logoutLink);
AjaxButton editPasswordQ = new AjaxButton(ID_PASSWORD_QUESTIONS, createStringResource("UserMenuPanel.editPasswordQuestions")) {
@Override
public void onClick(AjaxRequestTarget target) {
PageMyPasswordQuestions myPasswordQuestions = new PageMyPasswordQuestions(passwordQuestionsDtoIModel);
setResponsePage(myPasswordQuestions);
}
};
add(editPasswordQ);
if (!isPasswordModelLoaded) {
passwordQuestionsDtoIModel = new LoadableModel<PasswordQuestionsDto>(false) {
private static final long serialVersionUID = 1L;
@Override
protected PasswordQuestionsDto load() {
return loadModel(null);
}
};
isPasswordModelLoaded = true;
}
securityPolicyQuestionsModel = new LoadableModel<List<SecurityQuestionDefinitionType>>(false) {
@Override
protected List<SecurityQuestionDefinitionType> load() {
return loadSecurityPloicyQuestionsModel();
}
};
editPasswordQ.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
if (securityPolicyQuestionsModel == null || securityPolicyQuestionsModel.getObject() == null) {
loadSecurityPloicyQuestionsModel();
}
return hasQuestions() || (securityPolicyQuestionsModel.getObject() != null && securityPolicyQuestionsModel.getObject().size() > 0);
}
});
}
use of com.evolveum.midpoint.web.component.AjaxButton in project midpoint by Evolveum.
the class InlineMenu method initLayout.
@Override
protected void initLayout() {
WebMarkupContainer menuItemContainer = new WebMarkupContainer(ID_MENU_ITEM_CONTAINER);
menuItemContainer.setOutputMarkupId(true);
menuItemContainer.add(new AttributeAppender("class", getMenuItemContainerClass()));
menuItemContainer.add(new AttributeAppender("style", getMenuItemContainerStyle()));
add(menuItemContainer);
AjaxButton menuItemButton = new AjaxButton(ID_MENU_ITEM_BUTTON) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
}
};
menuItemButton.setOutputMarkupId(true);
menuItemButton.add(new AttributeAppender("class", "dropdown-toggle " + getAdditionalButtonClass()));
menuItemButton.add(new AttributeAppender("style", getMenuItemButtonStyle()));
menuItemContainer.add(menuItemButton);
WebMarkupContainer icon = new WebMarkupContainer(ID_MENU_ITEM_ICON);
icon.setOutputMarkupId(true);
icon.add(new AttributeAppender("class", getIconClass()));
menuItemButton.add(icon);
ListView<InlineMenuItem> li = new ListView<InlineMenuItem>(ID_MENU_ITEM, getModel()) {
@Override
protected void populateItem(ListItem<InlineMenuItem> item) {
initMenuItem(item);
}
};
li.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
List list = InlineMenu.this.getModel().getObject();
return list != null && !list.isEmpty();
}
});
menuItemContainer.add(li);
}
use of com.evolveum.midpoint.web.component.AjaxButton in project midpoint by Evolveum.
the class PageDebugView method initButtons.
private void initButtons(final Form mainForm) {
AjaxSubmitButton saveButton = new AjaxSubmitButton("saveButton", createStringResource("pageDebugView.button.save")) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
savePerformed(target);
}
@Override
protected void onError(AjaxRequestTarget target, Form<?> form) {
target.add(getFeedbackPanel());
}
};
mainForm.add(saveButton);
AjaxButton backButton = new AjaxButton("backButton", createStringResource("pageDebugView.button.back")) {
@Override
public void onClick(AjaxRequestTarget target) {
redirectBack();
}
};
mainForm.add(backButton);
}
Aggregations