use of com.evolveum.midpoint.web.component.form.Form in project midpoint by Evolveum.
the class AbstractObjectMainPanel method initLayoutPreviewButton.
// TEMPORARY
protected void initLayoutPreviewButton(final PageAdminObjectDetails<O> parentPage) {
AjaxSubmitButton previewButton = new AjaxSubmitButton(ID_PREVIEW_CHANGES, parentPage.createStringResource("pageAdminFocus.button.previewChanges")) {
@Override
protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
getDetailsPage().previewPerformed(target);
}
@Override
protected void onError(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
target.add(parentPage.getFeedbackPanel());
}
};
previewButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return AbstractObjectMainPanel.this.isPreviewButtonVisible();
}
@Override
public boolean isEnabled() {
PrismContainerDefinition def = getObjectWrapper().getDefinition();
if (ContainerStatus.MODIFYING.equals(getObjectWrapper().getStatus()) && !def.canModify()) {
return areSavePreviewButtonsEnabled();
}
return true;
}
});
mainForm.add(previewButton);
}
use of com.evolveum.midpoint.web.component.form.Form in project midpoint by Evolveum.
the class AbstractObjectMainPanel method initLayoutSaveButton.
protected void initLayoutSaveButton(final PageAdminObjectDetails<O> parentPage) {
AjaxSubmitButton saveButton = new AjaxSubmitButton(ID_SAVE, parentPage.createStringResource("pageAdminFocus.button.save")) {
@Override
protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
getDetailsPage().savePerformed(target);
}
@Override
protected void onError(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
target.add(parentPage.getFeedbackPanel());
}
};
saveButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return !getObjectWrapper().isReadonly();
}
@Override
public boolean isEnabled() {
//in case user isn't allowed to modify focus data but has
// e.g. #assign authorization, Save button is disabled on page load.
// Save button becomes enabled just if some changes are made
// on the Assignments tab (in the use case with #assign authorization)
PrismContainerDefinition def = getObjectWrapper().getDefinition();
if (ContainerStatus.MODIFYING.equals(getObjectWrapper().getStatus()) && !def.canModify()) {
return areSavePreviewButtonsEnabled();
}
return true;
}
});
mainForm.setDefaultButton(saveButton);
mainForm.add(saveButton);
}
use of com.evolveum.midpoint.web.component.form.Form in project midpoint by Evolveum.
the class FocusMainPanel method createTabPanel.
protected WebMarkupContainer createTabPanel(String panelId, FormSpecificationType formSpecificationType, PageAdminObjectDetails<F> parentPage) {
String panelClassName = formSpecificationType.getPanelClass();
Class<?> panelClass;
try {
panelClass = Class.forName(panelClassName);
} catch (ClassNotFoundException e) {
throw new SystemException("Panel class '" + panelClassName + "' as specified in admin GUI configuration was not found", e);
}
if (AbstractFocusTabPanel.class.isAssignableFrom(panelClass)) {
Constructor<?> constructor;
try {
constructor = panelClass.getConstructor(String.class, Form.class, LoadableModel.class, LoadableModel.class, LoadableModel.class, PageBase.class);
} catch (NoSuchMethodException | SecurityException e) {
throw new SystemException("Unable to locate constructor (String,Form,LoadableModel,LoadableModel,LoadableModel,PageBase) in " + panelClass + ": " + e.getMessage(), e);
}
AbstractFocusTabPanel<F> tabPanel;
try {
tabPanel = (AbstractFocusTabPanel<F>) constructor.newInstance(panelId, getMainForm(), getObjectModel(), assignmentsModel, projectionModel, parentPage);
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new SystemException("Error instantiating " + panelClass + ": " + e.getMessage(), e);
}
return tabPanel;
} else if (AbstractObjectTabPanel.class.isAssignableFrom(panelClass)) {
Constructor<?> constructor;
try {
constructor = panelClass.getConstructor(String.class, Form.class, LoadableModel.class, PageBase.class);
} catch (NoSuchMethodException | SecurityException e) {
throw new SystemException("Unable to locate constructor (String,Form,LoadableModel,PageBase) in " + panelClass + ": " + e.getMessage(), e);
}
AbstractObjectTabPanel<F> tabPanel;
try {
tabPanel = (AbstractObjectTabPanel<F>) constructor.newInstance(panelId, getMainForm(), getObjectModel(), parentPage);
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new SystemException("Error instantiating " + panelClass + ": " + e.getMessage(), e);
}
return tabPanel;
} else {
throw new UnsupportedOperationException("Tab panels that are not subclasses of AbstractObjectTabPanel or AbstractFocusTabPanel are not supported yet (got " + panelClass + ")");
}
}
use of com.evolveum.midpoint.web.component.form.Form in project midpoint by Evolveum.
the class PageAssignmentsList method initLayout.
public void initLayout() {
setOutputMarkupId(true);
Form mainForm = new Form(ID_FORM);
mainForm.setOutputMarkupId(true);
add(mainForm);
AssignmentTablePanel panel = new AssignmentTablePanel<UserType>(ID_ASSIGNMENT_TABLE_PANEL, createStringResource("FocusType.assignment"), assignmentsModel, PageAssignmentsList.this) {
@Override
protected List<InlineMenuItem> createAssignmentMenu() {
List<InlineMenuItem> items = new ArrayList<>();
InlineMenuItem item = new InlineMenuItem(createStringResource("AssignmentTablePanel.menu.unassign"), new InlineMenuItemAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
deleteAssignmentPerformed(target);
}
});
items.add(item);
return items;
}
};
mainForm.add(panel);
WebMarkupContainer targetUserPanel = new TargetUserSelectorComponent(ID_TARGET_USER_PANEL, PageAssignmentsList.this);
targetUserPanel.setOutputMarkupId(true);
mainForm.add(targetUserPanel);
TextArea descriptionInput = new TextArea<String>(ID_DESCRIPTION, descriptionModel);
descriptionInput.add(new AjaxFormComponentUpdatingBehavior("blur") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
getSessionStorage().getRoleCatalog().setRequestDescription(getDescriptionComponent().getValue());
}
});
mainForm.add(descriptionInput);
AjaxButton back = new AjaxButton(ID_BACK, createStringResource("PageAssignmentDetails.backButton")) {
@Override
public void onClick(AjaxRequestTarget target) {
redirectBack();
}
};
mainForm.add(back);
AjaxSubmitButton requestAssignments = new AjaxSubmitButton(ID_REQUEST_BUTTON, createStringResource("PageAssignmentsList.requestButton")) {
@Override
protected void onError(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
target.add(getFeedbackPanel());
}
@Override
protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
if (getSessionStorage().getRoleCatalog().getTargetUserList() == null || getSessionStorage().getRoleCatalog().getTargetUserList().size() <= 1) {
onSingleUserRequestPerformed(target);
} else {
onMultiUserRequestPerformed(target);
}
}
};
requestAssignments.add(new VisibleEnableBehaviour() {
@Override
public boolean isEnabled() {
return getSessionStorage().getRoleCatalog().isMultiUserRequest() || areConflictsResolved();
}
});
mainForm.add(requestAssignments);
AjaxSubmitButton resolveAssignments = new AjaxSubmitButton(ID_RESOLVE_CONFLICTS_BUTTON, createStringResource("PageAssignmentsList.resolveConflicts")) {
@Override
protected void onError(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
target.add(getFeedbackPanel());
}
@Override
protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
PageAssignmentsList.this.navigateToNext(PageAssignmentConflicts.class);
}
};
resolveAssignments.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !getSessionStorage().getRoleCatalog().isMultiUserRequest() && getSessionStorage().getRoleCatalog().getConflictsList() != null && getSessionStorage().getRoleCatalog().getConflictsList().size() > 0;
}
});
mainForm.add(resolveAssignments);
}
use of com.evolveum.midpoint.web.component.form.Form in project midpoint by Evolveum.
the class PageAssignmentConflicts method initLayout.
private void initLayout() {
Form mainForm = new Form(ID_MAIN_FORM);
mainForm.setOutputMarkupId(true);
add(mainForm);
RepeatingView conflictsPanel = new RepeatingView(ID_CONFLICTS_PANEL);
conflictsPanel.setOutputMarkupId(true);
List<AssignmentConflictDto> conflicts = getSessionStorage().getRoleCatalog().getConflictsList();
for (AssignmentConflictDto dto : conflicts) {
AssignmentConflictPanel panel = new AssignmentConflictPanel(conflictsPanel.newChildId(), Model.of(dto));
conflictsPanel.add(panel);
}
mainForm.add(conflictsPanel);
AjaxSubmitButton back = new AjaxSubmitButton(ID_BACK, createStringResource("PageAssignmentConflicts.back")) {
@Override
public void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
redirectBack();
}
};
mainForm.add(back);
AjaxSubmitButton submit = new AjaxSubmitButton(ID_SUBMIT, createStringResource("PageAssignmentConflicts.submit")) {
@Override
public void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
redirectBack();
}
};
mainForm.add(submit);
}
Aggregations