use of com.evolveum.midpoint.web.component.AjaxButton in project midpoint by Evolveum.
the class SearchItemPanel method initPopover.
private void initPopover() {
WebMarkupContainer popover = new WebMarkupContainer(ID_POPOVER);
popover.setOutputMarkupId(true);
add(popover);
WebMarkupContainer popoverBody = new WebMarkupContainer(ID_POPOVER_BODY);
popoverBody.setOutputMarkupId(true);
popover.add(popoverBody);
ListView values = new ListView<DisplayableValue>(ID_VALUES, new PropertyModel<List<DisplayableValue>>(popoverModel, SearchItem.F_VALUES)) {
@Override
protected void populateItem(final ListItem<DisplayableValue> item) {
item.add(AttributeModifier.replace("style", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return item.getIndex() != 0 ? "margin-top: 5px;" : null;
}
}));
SearchPopupPanel fragment = createPopoverFragment(item.getModel());
fragment.setRenderBodyOnly(true);
item.add(fragment);
}
};
popoverBody.add(values);
AjaxSubmitButton update = new AjaxSubmitButton(ID_UPDATE, createStringResource("SearchItemPanel.update")) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
updateItemPerformed(target);
}
};
popoverBody.add(update);
AjaxButton close = new AjaxButton(ID_CLOSE, createStringResource("SearchItemPanel.close")) {
@Override
public void onClick(AjaxRequestTarget target) {
closeEditPopoverPerformed(target);
}
};
popoverBody.add(close);
}
use of com.evolveum.midpoint.web.component.AjaxButton in project midpoint by Evolveum.
the class SearchPanel method initPopover.
private void initPopover() {
WebMarkupContainer popover = new WebMarkupContainer(ID_POPOVER);
popover.setOutputMarkupId(true);
add(popover);
final WebMarkupContainer propList = new WebMarkupContainer(ID_PROP_LIST);
propList.setOutputMarkupId(true);
popover.add(propList);
ListView properties = new ListView<Property>(ID_PROPERTIES, new PropertyModel<List<Property>>(moreDialogModel, MoreDialogDto.F_PROPERTIES)) {
@Override
protected void populateItem(final ListItem<Property> item) {
CheckBox check = new CheckBox(ID_CHECK, new PropertyModel<Boolean>(item.getModel(), Property.F_SELECTED));
check.add(new AjaxFormComponentUpdatingBehavior("change") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
//nothing, just update model.
}
});
item.add(check);
AjaxLink propLink = new AjaxLink(ID_PROP_LINK) {
@Override
public void onClick(AjaxRequestTarget target) {
addOneItemPerformed(item.getModelObject(), target);
}
};
item.add(propLink);
Label name = new Label(ID_PROP_NAME, new PropertyModel<>(item.getModel(), Property.F_NAME));
name.setRenderBodyOnly(true);
propLink.add(name);
item.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
Property property = item.getModelObject();
Search search = SearchPanel.this.getModelObject();
if (!search.getAvailableDefinitions().contains(property.getDefinition())) {
return false;
}
MoreDialogDto dto = moreDialogModel.getObject();
String nameFilter = dto.getNameFilter();
String propertyName = property.getName().toLowerCase();
if (StringUtils.isNotEmpty(nameFilter) && !propertyName.contains(nameFilter.toLowerCase())) {
return false;
}
return true;
}
});
}
};
propList.add(properties);
TextField addText = new TextField(ID_ADD_TEXT, new PropertyModel(moreDialogModel, MoreDialogDto.F_NAME_FILTER));
addText.add(new Behavior() {
@Override
public void bind(Component component) {
super.bind(component);
component.add(AttributeModifier.replace("onkeydown", Model.of("if(event.keyCode == 13) {event.preventDefault();}")));
}
});
popover.add(addText);
addText.add(new AjaxFormComponentUpdatingBehavior("keyup") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(propList);
}
});
popover.add(addText);
AjaxButton add = new AjaxButton(ID_ADD, createStringResource("SearchPanel.add")) {
@Override
public void onClick(AjaxRequestTarget target) {
addItemPerformed(target);
}
};
popover.add(add);
AjaxButton close = new AjaxButton(ID_CLOSE, createStringResource("SearchPanel.close")) {
@Override
public void onClick(AjaxRequestTarget target) {
closeMorePopoverPerformed(target);
}
};
popover.add(close);
}
use of com.evolveum.midpoint.web.component.AjaxButton in project midpoint by Evolveum.
the class PagePreviewChanges method initButtons.
private void initButtons(Form mainForm) {
AjaxButton cancel = new AjaxButton(ID_CONTINUE_EDITING, createStringResource("PagePreviewChanges.button.continueEditing")) {
@Override
public void onClick(AjaxRequestTarget target) {
cancelPerformed(target);
}
};
mainForm.add(cancel);
AjaxButton save = new AjaxButton(ID_SAVE, createStringResource("PagePreviewChanges.button.save")) {
@Override
public void onClick(AjaxRequestTarget target) {
savePerformed(target);
}
};
mainForm.add(save);
}
use of com.evolveum.midpoint.web.component.AjaxButton in project midpoint by Evolveum.
the class PageMyPasswordQuestions method initButtons.
public void initButtons(Form mainForm) {
AjaxSubmitButton save = new AjaxSubmitButton(ID_SAVE, createStringResource("PageBase.button.save")) {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
savePerformed(target);
}
};
mainForm.add(save);
AjaxButton back = new AjaxButton(ID_BACK, createStringResource("PageBase.button.back")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
cancelPerformed(target);
}
};
mainForm.add(back);
}
use of com.evolveum.midpoint.web.component.AjaxButton in project midpoint by Evolveum.
the class OrgTreeAssignablePanel method initLayout.
private void initLayout() {
AbstractOrgTabPanel tabbedPanel = new AbstractOrgTabPanel(ID_ORG_TABS, getPageBase()) {
private static final long serialVersionUID = 1L;
@Override
protected Panel createTreePanel(String id, Model<String> model, PageBase pageBase) {
OrgTreePanel panel = new OrgTreePanel(id, model, selectable) {
private static final long serialVersionUID = 1L;
@Override
protected void selectTreeItemPerformed(SelectableBean<OrgType> selected, AjaxRequestTarget target) {
onItemSelect(selected, target);
}
};
panel.setOutputMarkupId(true);
return panel;
}
};
tabbedPanel.setOutputMarkupId(true);
add(tabbedPanel);
AjaxButton assignButton = new AjaxButton(ID_ASSIGN, getPageBase().createStringResource("Button.assign")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
AbstractOrgTabPanel orgPanel = (AbstractOrgTabPanel) getParent().get(ID_ORG_TABS);
OrgTreePanel treePanel = (OrgTreePanel) orgPanel.getPanel();
List<OrgType> selectedOrgs = treePanel.getSelectedOrgs();
assignSelectedOrgPerformed(selectedOrgs, target);
}
};
assignButton.setOutputMarkupId(true);
assignButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return selectable;
}
});
add(assignButton);
}
Aggregations