use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class PageResources method deleteResourcePerformed.
private void deleteResourcePerformed(AjaxRequestTarget target, ResourceType single) {
List<ResourceType> selected = isAnyResourceSelected(target, single);
singleDelete = single;
if (selected.isEmpty()) {
return;
}
ConfirmationPanel dialog = new ConfirmationPanel(((PageBase) getPage()).getMainPopupBodyId(), createDeleteConfirmString("pageResources.message.deleteResourceConfirm", "pageResources.message.deleteResourcesConfirm", true)) {
@Override
public void yesPerformed(AjaxRequestTarget target) {
((PageBase) getPage()).hideMainPopup(target);
deleteResourceConfirmedPerformed(target);
}
};
((PageBase) getPage()).showMainPopup(dialog, target);
}
use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class LockoutStatusPanel method initLayout.
private void initLayout(final IModel<LockoutStatusType> model) {
WebMarkupContainer container = new WebMarkupContainer(ID_CONTAINER);
add(container);
Label label = new Label(ID_LABEL, new IModel<String>() {
@Override
public String getObject() {
LockoutStatusType object = model != null ? model.getObject() : null;
String labelValue = object == null ? ((PageBase) getPage()).createStringResource("LockoutStatusType.UNDEFINED").getString() : WebComponentUtil.createLocalizedModelForEnum(object, getLabel()).getObject();
if (!isInitialState) {
labelValue += " " + ((PageBase) getPage()).createStringResource("LockoutStatusPanel.changesSaving").getString();
}
return labelValue;
}
@Override
public void setObject(String s) {
}
@Override
public void detach() {
}
});
label.setOutputMarkupId(true);
container.add(label);
AjaxButton button = new AjaxButton(ID_BUTTON, getButtonModel()) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
PrismPropertyValue oldValue = (PrismPropertyValue) valueWrapper.getOldValue();
if (!isInitialState) {
model.setObject(initialValue);
oldValue.setValue(initialValue);
valueWrapper.setStatus(ValueStatus.NOT_CHANGED);
} else {
model.setObject(LockoutStatusType.NORMAL);
if (oldValue.getValue() != null) {
oldValue.setValue(null);
}
}
isInitialState = !isInitialState;
ajaxRequestTarget.add(getButton());
ajaxRequestTarget.add(getLabel());
}
};
button.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return true;
}
});
button.setOutputMarkupId(true);
container.add(button);
}
use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class WebComponentUtil method dispatchToObjectDetailsPage.
public static void dispatchToObjectDetailsPage(Class<? extends ObjectType> objectClass, String oid, Component component, boolean failIfUnsupported) {
PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, oid);
Class<? extends PageBase> page = getObjectDetailsPage(objectClass);
if (page != null) {
((PageBase) component.getPage()).navigateToNext(page, parameters);
} else if (failIfUnsupported) {
throw new SystemException("Cannot determine details page for " + objectClass);
}
}
use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class PageRequestRole method loadUser.
private void loadUser() {
LOGGER.debug("Loading user and accounts.");
OperationResult result = new OperationResult(OPERATION_LOAD_USER);
try {
String userOid = SecurityUtils.getPrincipalUser().getOid();
Task task = createSimpleTask(OPERATION_LOAD_USER);
user = WebModelServiceUtils.loadObject(UserType.class, userOid, null, (PageBase) getPage(), task, result);
result.recordSuccessIfUnknown();
result.recordSuccessIfUnknown();
} catch (Exception ex) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load accounts", ex);
result.recordFatalError("Couldn't load accounts", ex);
} finally {
result.recomputeStatus();
}
if (!result.isSuccess() && !result.isHandledError()) {
showResult(result);
}
}
use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class PageSelfDashboard method initMyAccounts.
private void initMyAccounts() {
AsyncDashboardPanel<Object, List<SimpleAccountDto>> accounts = new AsyncDashboardPanel<Object, List<SimpleAccountDto>>(ID_ACCOUNTS, createStringResource("PageDashboard.accounts"), GuiStyleConstants.CLASS_SHADOW_ICON_ACCOUNT, GuiStyleConstants.CLASS_OBJECT_SHADOW_BOX_CSS_CLASSES, true) {
private static final long serialVersionUID = 1L;
@Override
protected SecurityContextAwareCallable<CallableResult<List<SimpleAccountDto>>> createCallable(Authentication auth, IModel<Object> callableParameterModel) {
return new SecurityContextAwareCallable<CallableResult<List<SimpleAccountDto>>>(getSecurityEnforcer(), auth) {
@Override
public AccountCallableResult<List<SimpleAccountDto>> callWithContextPrepared() throws Exception {
return loadAccounts();
}
};
}
@Override
protected Component getMainComponent(String markupId) {
return new MyAccountsPanel(markupId, new PropertyModel<List<SimpleAccountDto>>(getModel(), CallableResult.F_VALUE));
}
@Override
protected void onPostSuccess(AjaxRequestTarget target) {
showFetchResult();
super.onPostSuccess(target);
}
@Override
protected void onUpdateError(AjaxRequestTarget target, Exception ex) {
showFetchResult();
super.onUpdateError(target, ex);
}
private void showFetchResult() {
AccountCallableResult<List<SimpleAccountDto>> result = (AccountCallableResult<List<SimpleAccountDto>>) getModel().getObject();
PageBase page = (PageBase) getPage();
for (OperationResult res : result.getFetchResults()) {
if (!WebComponentUtil.isSuccessOrHandledError(res)) {
page.showResult(res);
}
}
}
};
accounts.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
UserInterfaceElementVisibilityType visibilityType = getComponentVisibility(PredefinedDashboardWidgetId.MY_ACCOUNTS);
return WebComponentUtil.getElementVisibility(visibilityType);
}
});
add(accounts);
}
Aggregations