use of com.evolveum.midpoint.gui.api.component.result.MessagePanel in project midpoint by Evolveum.
the class AssignmentPopup method onInitialize.
@Override
protected void onInitialize() {
super.onInitialize();
Form form = new Form(ID_FORM);
form.setOutputMarkupId(true);
add(form);
MultiCompositedButtonPanel newObjectIcon = new MultiCompositedButtonPanel(ID_COMPOSITED_BUTTONS, createNewButtonDescriptionModel()) {
@Override
protected void buttonClickPerformed(AjaxRequestTarget target, AssignmentObjectRelation relationSpec, CompiledObjectCollectionView collectionViews, Class<? extends WebPage> page) {
Form form = (Form) AssignmentPopup.this.get(ID_FORM);
AssignmentPopup.this.getModelObject().setSelectionVisible(false);
addOrReplaceTabPanels(form, relationSpec);
target.add(form);
}
};
form.add(newObjectIcon);
newObjectIcon.add(new VisibleBehaviour(() -> getModelObject() != null && getModelObject().isSelectionVisible()));
addOrReplaceTabPanels(form, null);
MessagePanel warningMessage = new MessagePanel(ID_WARNING_MESSAGE, MessagePanel.MessagePanelType.WARN, getWarningMessageModel());
warningMessage.setOutputMarkupId(true);
warningMessage.add(new VisibleBehaviour(() -> getWarningMessageModel() != null));
add(warningMessage);
form.add(createCancelButton());
form.add(createAddButton());
form.add(createBackButton());
}
use of com.evolveum.midpoint.gui.api.component.result.MessagePanel 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.component.result.MessagePanel 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.component.result.MessagePanel in project midpoint by Evolveum.
the class AbstractPageObjectDetails method initMainPanel.
private void initMainPanel(ContainerPanelConfigurationType panelConfig, MidpointForm form) {
if (panelConfig == null) {
WebMarkupContainer panel = new MessagePanel(ID_MAIN_PANEL, MessagePanel.MessagePanelType.WARN, createStringResource("AbstractPageObjectDetails.noPanels"), false);
panel.add(AttributeAppender.append("style", "margin-top: 20px;"));
form.addOrReplace(panel);
return;
}
getSessionStorage().setObjectDetailsStorage("details" + getType().getSimpleName(), panelConfig);
String panelType = panelConfig.getPanelType();
if (panelType == null) {
return;
}
Class<? extends Panel> panelClass = findObjectPanel(panelConfig.getPanelType());
Panel panel = WebComponentUtil.createPanel(panelClass, ID_MAIN_PANEL, objectDetailsModels, panelConfig);
form.addOrReplace(panel);
}
use of com.evolveum.midpoint.gui.api.component.result.MessagePanel in project midpoint by Evolveum.
the class ObjectBrowserPanel method initLayout.
private void initLayout() {
MessagePanel warningMessage = new MessagePanel(ID_WARNING_MESSAGE, MessagePanel.MessagePanelType.WARN, getWarningMessageModel());
warningMessage.setOutputMarkupId(true);
warningMessage.add(new VisibleBehaviour(() -> getWarningMessageModel() != null));
add(warningMessage);
List<ObjectTypes> supported = new ArrayList<>();
for (QName qname : supportedTypes) {
supported.add(ObjectTypes.getObjectTypeFromTypeQName(qname));
}
WebMarkupContainer typePanel = new WebMarkupContainer(ID_TYPE_PANEL);
typePanel.setOutputMarkupId(true);
typePanel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return supportedTypes.size() != 1;
}
});
add(typePanel);
DropDownChoice<ObjectTypes> typeSelect = new DropDownChoice<>(ID_TYPE, typeModel, new ListModel<>(supported), new EnumChoiceRenderer<>(this));
typeSelect.add(new OnChangeAjaxBehavior() {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
ObjectListPanel<O> listPanel = (ObjectListPanel<O>) get(ID_TABLE);
listPanel = createObjectListPanel(typeModel.getObject(), multiselect);
addOrReplace(listPanel);
target.add(listPanel);
}
});
typePanel.add(typeSelect);
ObjectTypes objType = defaultType != null ? ObjectTypes.getObjectType(defaultType) : null;
ObjectListPanel<O> listPanel = createObjectListPanel(objType, multiselect);
add(listPanel);
AjaxButton addButton = new AjaxButton(ID_BUTTON_ADD, createStringResource("userBrowserDialog.button.addButton")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
List<O> selected = ((PopupObjectListPanel) getParent().get(ID_TABLE)).getSelectedRealObjects();
ObjectTypes type = ObjectBrowserPanel.this.typeModel.getObject();
QName qname = type != null ? type.getTypeQName() : null;
ObjectBrowserPanel.this.addPerformed(target, qname, selected);
}
};
addButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return multiselect;
}
});
add(addButton);
AjaxButton cancelButton = new AjaxButton(ID_BUTTON_CANCEL, createStringResource("Button.cancel")) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
getPageBase().hideMainPopup(ajaxRequestTarget);
}
};
add(cancelButton);
}
Aggregations