Search in sources :

Example 1 with RichHyperlinkType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.RichHyperlinkType in project midpoint by Evolveum.

the class AdminGuiConfigPanel method initLayout.

private void initLayout() {
    GenericMultiValueLabelEditPanel<RichHyperlinkType> dashboardLinkEditor = new GenericMultiValueLabelEditPanel<RichHyperlinkType>(ID_DASHBOARD_LINK_EDITOR, new PropertyModel<List<RichHyperlinkType>>(getModel(), "userDashboardLink"), createStringResource("AdminGuiConfigPanel.dashboardLinksConfig"), LABEL_SIZE, INPUT_SIZE, true) {

        private static final long serialVersionUID = 1L;

        @Override
        protected IModel<String> createTextModel(final IModel<RichHyperlinkType> model) {
            return new PropertyModel<String>(model, "label");
        }

        @Override
        protected void editValuePerformed(AjaxRequestTarget target, IModel<RichHyperlinkType> rowModel) {
            RichHyperlinkConfigPanel contentPanel = new RichHyperlinkConfigPanel(getPageBase().getMainPopupBodyId(), rowModel.getObject(), false) {

                private static final long serialVersionUID = 1L;

                @Override
                protected void savePerformed(AjaxRequestTarget target) {
                    closeModalWindow(target);
                    target.add(getDashboardLinkEditorContainer());
                }

                @Override
                public StringResourceModel getTitle() {
                    return createStringResource("AdminGuiConfigPanel.dashboardLinkDialogTitle.title");
                }
            };
            showDialog(contentPanel, target);
        }

        @Override
        protected RichHyperlinkType createNewEmptyItem() {
            RichHyperlinkType link = new RichHyperlinkType();
            link.getAuthorization().add("");
            return link;
        }
    };
    dashboardLinkEditor.setOutputMarkupId(true);
    add(dashboardLinkEditor);
    GenericMultiValueLabelEditPanel<RichHyperlinkType> additionalMenuItemEditor = new GenericMultiValueLabelEditPanel<RichHyperlinkType>(ID_ADDITIONAL_MENU_ITEM_EDITOR, new PropertyModel<List<RichHyperlinkType>>(getModel(), "additionalMenuLink"), createStringResource("AdminGuiConfigPanel.additionalMenuItemConfig"), LABEL_SIZE, INPUT_SIZE, true) {

        private static final long serialVersionUID = 1L;

        @Override
        protected IModel<String> createTextModel(final IModel<RichHyperlinkType> model) {
            return new PropertyModel<String>(model, "label");
        }

        @Override
        protected void editValuePerformed(AjaxRequestTarget target, IModel<RichHyperlinkType> rowModel) {
            RichHyperlinkConfigPanel contentPanel = new RichHyperlinkConfigPanel(getPageBase().getMainPopupBodyId(), rowModel.getObject(), true) {

                private static final long serialVersionUID = 1L;

                @Override
                protected void savePerformed(AjaxRequestTarget target) {
                    closeModalWindow(target);
                    target.add(getAdditionalMenuItemContainer());
                }

                @Override
                public StringResourceModel getTitle() {
                    return createStringResource("AdminGuiConfigPanel.additionalMenuItemDialog.title");
                }
            };
            showDialog(contentPanel, target);
        }

        @Override
        protected RichHyperlinkType createNewEmptyItem() {
            RichHyperlinkType link = new RichHyperlinkType();
            link.getAuthorization().add("");
            return link;
        }
    };
    additionalMenuItemEditor.setOutputMarkupId(true);
    add(additionalMenuItemEditor);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IModel(org.apache.wicket.model.IModel) RichHyperlinkType(com.evolveum.midpoint.xml.ns._public.common.common_3.RichHyperlinkType) GenericMultiValueLabelEditPanel(com.evolveum.midpoint.web.component.form.multivalue.GenericMultiValueLabelEditPanel) PropertyModel(org.apache.wicket.model.PropertyModel) List(java.util.List)

Example 2 with RichHyperlinkType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.RichHyperlinkType in project midpoint by Evolveum.

the class TestPreviewChanges method test130GetAdminGuiConfig.

@Test
public void test130GetAdminGuiConfig() throws Exception {
    final String TEST_NAME = "test130GetAdminGuiConfig";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestPreviewChanges.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    // WHEN
    AdminGuiConfigurationType adminGuiConfiguration = modelInteractionService.getAdminGuiConfiguration(task, result);
    // THEN
    result.computeStatus();
    TestUtil.assertSuccess(result);
    assertAdminGuiConfigurations(adminGuiConfiguration, 0, 1, 3, 1, 0);
    RichHyperlinkType link = adminGuiConfiguration.getUserDashboardLink().get(0);
    assertEquals("Bad link label", "Foo", link.getLabel());
    assertEquals("Bad link targetUrl", "/foo", link.getTargetUrl());
    assertEquals("Bad timezone targetUrl", "Jamaica", adminGuiConfiguration.getDefaultTimezone());
}
Also used : Task(com.evolveum.midpoint.task.api.Task) AdminGuiConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.AdminGuiConfigurationType) RichHyperlinkType(com.evolveum.midpoint.xml.ns._public.common.common_3.RichHyperlinkType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test)

Aggregations

RichHyperlinkType (com.evolveum.midpoint.xml.ns._public.common.common_3.RichHyperlinkType)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 Task (com.evolveum.midpoint.task.api.Task)1 GenericMultiValueLabelEditPanel (com.evolveum.midpoint.web.component.form.multivalue.GenericMultiValueLabelEditPanel)1 AdminGuiConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.AdminGuiConfigurationType)1 List (java.util.List)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 IModel (org.apache.wicket.model.IModel)1 PropertyModel (org.apache.wicket.model.PropertyModel)1 Test (org.testng.annotations.Test)1