Search in sources :

Example 1 with AceEditorDialog

use of com.evolveum.midpoint.web.page.admin.configuration.component.AceEditorDialog in project midpoint by Evolveum.

the class PageAccounts method initLayout.

private void initLayout() {
    Form form = new Form(ID_MAIN_FORM);
    form.setOutputMarkupId(true);
    add(form);
    Form accForm = new Form(ID_FORM_ACCOUNT);
    accForm.setOutputMarkupId(true);
    add(accForm);
    Form searchForm = new Form(ID_SEARCH_FORM);
    initSearchForm(searchForm);
    searchForm.setOutputMarkupPlaceholderTag(true);
    searchForm.setOutputMarkupId(true);
    searchForm.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return resourceModel.getObject() != null;
        }
    });
    add(searchForm);
    DropDownChoice<ResourceItemDto> resources = new DropDownChoice<>(ID_RESOURCES, resourceModel, resourcesModel, new ChoiceableChoiceRenderer<ResourceItemDto>());
    form.add(resources);
    initLinks(form, accForm);
    initTotals(form);
    final AjaxDownloadBehaviorFromFile ajaxDownloadBehavior = new AjaxDownloadBehaviorFromFile(true) {

        @Override
        protected File initFile() {
            return downloadFile;
        }
    };
    ajaxDownloadBehavior.setRemoveFile(false);
    form.add(ajaxDownloadBehavior);
    WebMarkupContainer filesContainer = new WebMarkupContainer(ID_FILES_CONTAINER);
    filesContainer.setOutputMarkupId(true);
    accForm.add(filesContainer);
    ModalWindow resultPopup = createModalWindow(ID_RESULT_DIALOG, createStringResource("PageAccounts.result.popoup"), 1100, 560);
    resultPopup.setContent(new AceEditorDialog(resultPopup.getContentId()));
    add(resultPopup);
    filesModel = createFilesModel();
    ListView<String> files = new ListView<String>(ID_FILES, filesModel) {

        @Override
        protected void populateItem(final ListItem<String> item) {
            AjaxLink file = new AjaxLink(ID_FILE) {

                @Override
                public void onClick(AjaxRequestTarget target) {
                    downloadPerformed(target, item.getModelObject(), ajaxDownloadBehavior);
                }
            };
            file.add(new Label(ID_FILE_NAME, item.getModelObject()));
            item.add(file);
        }
    };
    files.setRenderBodyOnly(true);
    filesContainer.add(files);
    WebMarkupContainer accountsContainer = new WebMarkupContainer(ID_ACCOUNTS_CONTAINER);
    accountsContainer.setOutputMarkupId(true);
    accForm.add(accountsContainer);
    ObjectDataProvider provider = new ObjectDataProvider(this, ShadowType.class);
    provider.setOptions(SelectorOptions.createCollection(GetOperationOptions.createRaw()));
    provider.setQuery(ObjectQuery.createObjectQuery(createResourceQueryFilter()));
    TablePanel accounts = new TablePanel(ID_ACCOUNTS, provider, createAccountsColumns(), UserProfileStorage.TableId.CONF_PAGE_ACCOUNTS, getItemsPerPage(UserProfileStorage.TableId.CONF_PAGE_ACCOUNTS));
    accounts.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return resourceModel.getObject() != null;
        }
    });
    accounts.setItemsPerPage(50);
    accountsContainer.add(accounts);
}
Also used : Form(org.apache.wicket.markup.html.form.Form) AjaxDownloadBehaviorFromFile(com.evolveum.midpoint.web.component.AjaxDownloadBehaviorFromFile) Label(org.apache.wicket.markup.html.basic.Label) ObjectDataProvider(com.evolveum.midpoint.web.component.data.ObjectDataProvider) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) ResourceItemDto(com.evolveum.midpoint.web.page.admin.configuration.dto.ResourceItemDto) ListView(org.apache.wicket.markup.html.list.ListView) AceEditorDialog(com.evolveum.midpoint.web.page.admin.configuration.component.AceEditorDialog) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) ListItem(org.apache.wicket.markup.html.list.ListItem) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) ModalWindow(org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 2 with AceEditorDialog

use of com.evolveum.midpoint.web.page.admin.configuration.component.AceEditorDialog in project midpoint by Evolveum.

the class PageAccounts method showShadowResult.

private void showShadowResult(AjaxRequestTarget target, IModel<SelectableBean> rowModel) {
    OperationResultType result = getResult(rowModel);
    String xml;
    ModalWindow aceDialog = (ModalWindow) get(createComponentPath(ID_RESULT_DIALOG));
    AceEditorDialog aceEditor = (AceEditorDialog) aceDialog.get(aceDialog.getContentId());
    try {
        xml = getPrismContext().xmlSerializer().serializeRealValue(result, ShadowType.F_RESULT);
        aceEditor.updateModel(new Model<String>(xml));
    } catch (SchemaException e) {
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't parse result", e);
        aceEditor.updateModel(new Model<String>("Unable to show result. For more information see logs."));
    }
    aceDialog.show(target);
    target.add(getFeedbackPanel());
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) AceEditorDialog(com.evolveum.midpoint.web.page.admin.configuration.component.AceEditorDialog) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) IModel(org.apache.wicket.model.IModel) Model(org.apache.wicket.model.Model) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) PropertyModel(org.apache.wicket.model.PropertyModel) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) ModalWindow(org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow)

Aggregations

AceEditorDialog (com.evolveum.midpoint.web.page.admin.configuration.component.AceEditorDialog)2 ModalWindow (org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow)2 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 AjaxDownloadBehaviorFromFile (com.evolveum.midpoint.web.component.AjaxDownloadBehaviorFromFile)1 ObjectDataProvider (com.evolveum.midpoint.web.component.data.ObjectDataProvider)1 TablePanel (com.evolveum.midpoint.web.component.data.TablePanel)1 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)1 ResourceItemDto (com.evolveum.midpoint.web.page.admin.configuration.dto.ResourceItemDto)1 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)1 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)1 Label (org.apache.wicket.markup.html.basic.Label)1 DropDownChoice (org.apache.wicket.markup.html.form.DropDownChoice)1 Form (org.apache.wicket.markup.html.form.Form)1 ListItem (org.apache.wicket.markup.html.list.ListItem)1 ListView (org.apache.wicket.markup.html.list.ListView)1 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)1 IModel (org.apache.wicket.model.IModel)1