use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class ChooseFocusTypeAndRelationDialogPanel method initLayout.
private void initLayout() {
MessagePanel warningMessage = new MessagePanel(ID_WARNING_FEEDBACK, MessagePanel.MessagePanelType.WARN, getWarningMessageModel());
warningMessage.setOutputMarkupId(true);
warningMessage.add(new VisibleBehaviour(() -> getWarningMessageModel() != null));
add(warningMessage);
DropDownFormGroup<QName> type = new DropDownFormGroup<>(ID_OBJECT_TYPE, Model.of(getDefaultObjectType()), Model.ofList(getSupportedObjectTypes()), new QNameObjectTypeChoiceRenderer(), createStringResource("chooseFocusTypeAndRelationDialogPanel.type"), "chooseFocusTypeAndRelationDialogPanel.tooltip.type", "col-md-4", "col-md-8", true);
type.getInput().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
type.setOutputMarkupId(true);
type.add(new VisibleBehaviour(this::isFocusTypeSelectorVisible));
add(type);
IModel<Map<String, String>> options = new Model(null);
options.setObject(new HashMap<>());
ListMultipleChoicePanel<QName> relation = new ListMultipleChoicePanel<>(ID_RELATION, Model.ofList(getDefaultRelations()), new ListModel<>(getSupportedRelations()), WebComponentUtil.getRelationChoicesRenderer(getPageBase()), options);
relation.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
relation.setOutputMarkupId(true);
add(relation);
WebMarkupContainer relationRequired = new WebMarkupContainer(ID_RELATION_REQUIRED);
relationRequired.add(new VisibleBehaviour((this::isRelationRequired)));
add(relationRequired);
Label label = new Label(ID_INFO_MESSAGE, getModel());
label.add(new VisibleBehaviour(() -> getModel() != null && getModelObject() != null));
add(label);
AjaxButton confirmButton = new AjaxButton(ID_BUTTON_OK, createStringResource("Button.ok")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
DropDownFormGroup<QName> type = getTypePanel(getParent());
QName typeChosen = type.getModelObject();
ListMultipleChoicePanel<QName> relation = getRelationPanel(getParent());
Collection<QName> relationChosen = relation.getModelObject();
if (relationChosen.contains(PrismConstants.Q_ANY)) {
relationChosen = getSupportedRelations();
}
ChooseFocusTypeAndRelationDialogPanel.this.okPerformed(typeChosen, relationChosen, target);
getPageBase().hideMainPopup(target);
}
};
add(confirmButton);
AjaxButton cancelButton = new AjaxButton(ID_CANCEL_OK, createStringResource("Button.cancel")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
getPageBase().hideMainPopup(target);
}
};
add(cancelButton);
AjaxButton configuredButton = new AjaxButton(ID_CONFIGURE_TASK, new StringResourceModel("ConfigureTaskConfirmationPanel.configure", this, null)) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
DropDownFormGroup<QName> type = getTypePanel(getParent());
QName typeChosen = type.getModelObject();
ListMultipleChoicePanel<QName> relation = getRelationPanel(getParent());
Collection<QName> relationChosen = relation.getModelObject();
PrismObject<TaskType> task = getTask(typeChosen, relationChosen, target);
if (task == null) {
return;
}
((PageBase) getPage()).hideMainPopup(target);
WebComponentUtil.dispatchToObjectDetailsPage(task, true, ChooseFocusTypeAndRelationDialogPanel.this);
}
};
configuredButton.add(new VisibleBehaviour(this::isTaskConfigureButtonVisible));
add(configuredButton);
}
use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class ConfirmationPanel method initLayout.
private void initLayout(IModel<String> message) {
WebMarkupContainer panel = new WebMarkupContainer(ID_PANEL);
Label label = new Label(ID_CONFIRM_TEXT, message);
label.setEscapeModelStrings(true);
panel.add(label);
AjaxButton yesButton = new AjaxButton(ID_YES, new StringResourceModel("confirmationDialog.yes", this, null)) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
((PageBase) getPage()).hideMainPopup(target);
yesPerformed(target);
}
};
panel.add(yesButton);
AjaxButton noButton = new AjaxButton(ID_NO, new StringResourceModel("confirmationDialog.no", this, null)) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
noPerformed(target);
}
};
panel.add(noButton);
customInitLayout(panel);
add(panel);
}
use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class ExportingPanel method initLayout.
private void initLayout() {
MidpointForm form = new MidpointForm<>(ID_MAIN_FORM, true);
MessagePanel warningMessage = new MessagePanel(ID_WARNING_MESSAGE, MessagePanel.MessagePanelType.WARN, getWarningMessageModel());
warningMessage.setOutputMarkupId(true);
warningMessage.add(new VisibleBehaviour(() -> getWarningMessageModel() != null));
form.add(warningMessage);
FeedbackAlerts feedbackList = new FeedbackAlerts(ID_FEEDBACK);
feedbackList.setOutputMarkupId(true);
feedbackList.setOutputMarkupPlaceholderTag(true);
form.add(feedbackList);
TextPanel<String> nameField = new TextPanel<>(ID_NAME, nameModel);
form.add(nameField);
BoxedTablePanel<SelectableBean<Integer>> table = createTable(ID_TABLE, dataTable);
form.add(table);
AjaxSubmitButton exportSelected = new AjaxSubmitButton(ID_EXPORT, getPageBase().createStringResource("ExportingPopupPanel.exportSelected")) {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit(AjaxRequestTarget target) {
performSelectedColumns(table);
if (exportedColumnsIndex.isEmpty()) {
LOGGER.warn("None columns selected");
getPageBase().warn(getPageBase().createStringResource("ExportingPanel.message.error.selectColumn").getString());
target.add(feedbackList);
return;
}
((PageBase) getPage()).hideMainPopup(target);
exportPerformed(target);
}
@Override
protected void onError(AjaxRequestTarget target) {
target.add(getPageBase().getFeedbackPanel());
}
};
form.add(exportSelected);
AjaxButton cancelButton = new AjaxButton(ID_CANCEL, new StringResourceModel("Button.cancel", this, null)) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
cancelPerformed(target);
}
};
form.add(cancelButton);
add(form);
}
use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class MainMenuPanel method menuItemPerformed.
private void menuItemPerformed(MenuItem menu) {
LOGGER.trace("menuItemPerformed: {}", menu);
// getSession().getSessionStorage().setActiveMenu(menu.getNameModel());
// getSession().getSessionStorage().setActiveMainMenu(getModelObject().getNameModel());
IPageFactory pFactory = Session.get().getPageFactory();
WebPage page;
if (menu.getParams() == null) {
page = pFactory.newPage(menu.getPageClass());
} else {
page = pFactory.newPage(menu.getPageClass(), menu.getParams());
}
if (!(page instanceof PageBase)) {
setResponsePage(page);
return;
}
PageBase pageBase = (PageBase) page;
// IMPORTANT: we need to re-bundle the name to a new models
// that will not be connected to the old page reference
// otherwise the old page will somehow remain in the memory
// I have no idea how it could do that and especially how
// several old pages can remain in memory. But if the model
// is not re-bundled here then the page size grows and never
// falls.
MainMenuItem mainMenuItem = getModelObject();
String name = mainMenuItem.getNameModel();
Breadcrumb bc = new Breadcrumb(createStringResource(name));
bc.setIcon(new Model<>(mainMenuItem.getIconClass()));
pageBase.addBreadcrumb(bc);
if (mainMenuItem.containsSubMenu() && mainMenuItem.isInsertDefaultBackBreadcrumb()) {
MenuItem first = mainMenuItem.getFirstMenuItem();
BreadcrumbPageClass invisibleBc = new BreadcrumbPageClass(createStringResource(first.getNameModel()), first.getPageClass(), first.getParams());
invisibleBc.setVisible(false);
pageBase.addBreadcrumb(invisibleBc);
}
setResponsePage(page);
}
use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class ConfigureTaskConfirmationPanel method customInitLayout.
@Override
protected void customInitLayout(WebMarkupContainer panel) {
AjaxButton configuredButton = new AjaxButton(ID_CONFIGURE, new StringResourceModel("ConfigureTaskConfirmationPanel.configure", this, null)) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
((PageBase) getPage()).hideMainPopup(target);
WebComponentUtil.dispatchToObjectDetailsPage(getTask(target), true, ConfigureTaskConfirmationPanel.this);
}
};
panel.add(configuredButton);
}
Aggregations