use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class ResourceContentPanel method initButton.
private void initButton(String id, String label, String icon, final String category, final List<TaskType> tasks) {
List<InlineMenuItem> items = new ArrayList<>();
InlineMenuItem item = new InlineMenuItem(getPageBase().createStringResource("ResourceContentResourcePanel.showExisting"), new InlineMenuItemAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
runTask(tasks, target);
}
});
items.add(item);
item = new InlineMenuItem(getPageBase().createStringResource("ResourceContentResourcePanel.newTask"), new InlineMenuItemAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
newTaskPerformed(category, target);
}
});
items.add(item);
DropdownButtonPanel button = new DropdownButtonPanel(id, new DropdownButtonDto(String.valueOf(tasks.size()), icon, label, items));
add(button);
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class ResourceContentPanel method initColumns.
private List<IColumn<SelectableBean<ShadowType>, String>> initColumns() {
List<ColumnTypeDto<String>> columnDefs = Arrays.asList(new ColumnTypeDto<String>("ShadowType.synchronizationSituation", SelectableBean.F_VALUE + ".synchronizationSituation", ShadowType.F_SYNCHRONIZATION_SITUATION.getLocalPart()), new ColumnTypeDto<String>("ShadowType.intent", SelectableBean.F_VALUE + ".intent", ShadowType.F_INTENT.getLocalPart()));
List<IColumn<SelectableBean<ShadowType>, String>> columns = new ArrayList<>();
IColumn<SelectableBean<ShadowType>, String> identifiersColumn = new AbstractColumn<SelectableBean<ShadowType>, String>(createStringResource("pageContentAccounts.identifiers")) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<ShadowType>>> cellItem, String componentId, IModel<SelectableBean<ShadowType>> rowModel) {
SelectableBean<ShadowType> dto = rowModel.getObject();
RepeatingView repeater = new RepeatingView(componentId);
ShadowType value = dto.getValue();
if (value != null) {
for (ResourceAttribute<?> attr : ShadowUtil.getAllIdentifiers(value)) {
repeater.add(new Label(repeater.newChildId(), attr.getElementName().getLocalPart() + ": " + attr.getRealValue()));
}
}
cellItem.add(repeater);
}
};
columns.add(identifiersColumn);
columns.addAll((Collection) ColumnUtils.createColumns(columnDefs));
ObjectLinkColumn<SelectableBean<ShadowType>> ownerColumn = new ObjectLinkColumn<SelectableBean<ShadowType>>(createStringResource("pageContentAccounts.owner")) {
private static final long serialVersionUID = 1L;
@Override
protected IModel<FocusType> createLinkModel(final IModel<SelectableBean<ShadowType>> rowModel) {
return new AbstractReadOnlyModel<FocusType>() {
private static final long serialVersionUID = 1L;
@Override
public FocusType getObject() {
FocusType owner = loadShadowOwner(rowModel);
if (owner == null) {
return null;
}
return owner;
}
};
}
@Override
public void onClick(AjaxRequestTarget target, IModel<SelectableBean<ShadowType>> rowModel, ObjectType targetObjectType) {
ownerDetailsPerformed(target, (FocusType) targetObjectType);
}
};
columns.add(ownerColumn);
columns.add(new LinkColumn<SelectableBean<ShadowType>>(createStringResource("PageAccounts.accounts.result")) {
private static final long serialVersionUID = 1L;
@Override
protected IModel<String> createLinkModel(final IModel<SelectableBean<ShadowType>> rowModel) {
return new AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
return getResultLabel(rowModel);
}
};
}
@Override
public void onClick(AjaxRequestTarget target, IModel<SelectableBean<ShadowType>> rowModel) {
OperationResultType resultType = getResult(rowModel);
OperationResult result = OperationResult.createOperationResult(resultType);
OperationResultPanel body = new OperationResultPanel(ResourceContentPanel.this.getPageBase().getMainPopupBodyId(), new Model<OpResult>(OpResult.getOpResult(pageBase, result)), getPage());
body.setOutputMarkupId(true);
ResourceContentPanel.this.getPageBase().showMainPopup(body, target);
}
});
return columns;
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class PageConnectorHosts method deleteHostPerformed.
private void deleteHostPerformed(AjaxRequestTarget target) {
List<SelectableBean<ConnectorHostType>> selected = WebComponentUtil.getSelectedData(getConnectorHostTable());
if (selected.isEmpty()) {
warn(getString("pageResources.message.noHostSelected"));
target.add(getFeedbackPanel());
return;
}
ConfirmationPanel dialog = new ConfirmationPanel(((PageBase) getPage()).getMainPopupBodyId(), createDeleteConfirmString("pageResources.message.deleteHostConfirm", "pageResources.message.deleteHostsConfirm", false)) {
private static final long serialVersionUID = 1L;
@Override
public void yesPerformed(AjaxRequestTarget target) {
((PageBase) getPage()).hideMainPopup(target);
deleteHostConfirmedPerformed(target);
}
};
((PageBase) getPage()).showMainPopup(dialog, target);
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class PageConnectorHosts method initInlineHostsMenu.
private List<InlineMenuItem> initInlineHostsMenu() {
List<InlineMenuItem> headerMenuItems = new ArrayList<>();
headerMenuItems.add(new InlineMenuItem(createStringResource("PageBase.button.delete"), new HeaderMenuAction(this) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
deleteHostPerformed(target);
}
}));
headerMenuItems.add(new InlineMenuItem(createStringResource("pageResources.button.discoveryRemote"), new HeaderMenuAction(this) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
discoveryRemotePerformed(target);
}
}));
return headerMenuItems;
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class TestConnectionResultPanel method initLayout.
private void initLayout(Page parentPage) {
WebMarkupContainer contentPanel = new WebMarkupContainer(ID_CONTENT_PANEL);
contentPanel.setOutputMarkupId(true);
add(contentPanel);
Label messageLabel = new Label(ID_MESSAGE, ((PageBase) parentPage).createStringResource("TestConnectionResultPanel.message"));
messageLabel.setOutputMarkupId(true);
contentPanel.add(messageLabel);
messageLabel.add(new VisibleEnableBehaviour() {
public boolean isVisible() {
return !isLoaded;
}
});
AjaxLazyLoadPanel resultsPanel = new AjaxLazyLoadPanel(ID_RESULT) {
@Override
public Component getLazyLoadComponent(String id) {
return new TestConnectionMessagesPanel(id, resourceOid, (PageBase) parentPage);
}
@Override
protected void onComponentLoaded(Component component, AjaxRequestTarget target) {
isLoaded = true;
target.add(component);
target.add(messageLabel);
}
};
contentPanel.add(resultsPanel);
AjaxButton ok = new AjaxButton(ID_OK) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
getPageBase().hideMainPopup(target);
okPerformed(target);
}
};
contentPanel.add(ok);
}
Aggregations