Search in sources :

Example 31 with Panel

use of org.apache.wicket.markup.html.panel.Panel in project wiquery by WiQuery.

the class DatePickerTestCase method setUp.

@Override
@Before
public void setUp() {
    super.setUp();
    Panel panel = new InputTestPanel("panelId");
    datePicker = new DatePicker<Date>("anId");
    datePicker.setMarkupId(datePicker.getId());
    panel.add(datePicker);
    tester.startComponentInPage(panel);
}
Also used : InputTestPanel(org.odlabs.wiquery.ui.InputTestPanel) Panel(org.apache.wicket.markup.html.panel.Panel) InputTestPanel(org.odlabs.wiquery.ui.InputTestPanel) Date(java.util.Date) Before(org.junit.Before)

Example 32 with Panel

use of org.apache.wicket.markup.html.panel.Panel in project midpoint by Evolveum.

the class DefinitionStagePanel method initLayout.

protected void initLayout(PageBase pageBase) {
    TextField nameField = new TextField<>(ID_NAME, new PropertyModel<>(getModel(), StageDefinitionDto.F_NAME));
    add(nameField);
    TextArea descriptionField = new TextArea<>(ID_DESCRIPTION, new PropertyModel<>(getModel(), StageDefinitionDto.F_DESCRIPTION));
    add(descriptionField);
    TextField durationField = new TextField<>(ID_DURATION, new PropertyModel<>(getModel(), StageDefinitionDto.F_DURATION));
    add(durationField);
    add(WebComponentUtil.createHelp(ID_STAGE_DURATION_HELP));
    TextField notifyBeforeDeadlineField = new TextField<>(ID_NOTIFY_BEFORE_DEADLINE, new PropertyModel<>(getModel(), StageDefinitionDto.F_NOTIFY_BEFORE_DEADLINE));
    add(notifyBeforeDeadlineField);
    add(WebComponentUtil.createHelp(ID_NOTIFY_BEFORE_DEADLINE_HELP));
    add(new CheckBox(ID_NOTIFY_ONLY_WHEN_NO_DECISION, new PropertyModel<>(getModel(), StageDefinitionDto.F_NOTIFY_ONLY_WHEN_NO_DECISION)));
    add(WebComponentUtil.createHelp(ID_NOTIFY_WHEN_NO_DECISION_HELP));
    TextField reviewerNameField = new TextField<>(ID_REVIEWER_NAME, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_NAME));
    add(reviewerNameField);
    TextArea reviewerDescriptionField = new TextArea<>(ID_REVIEWER_DESCRIPTION, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_DESCRIPTION));
    add(reviewerDescriptionField);
    add(new CheckBox(ID_USE_TARGET_OWNER, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_TARGET_OWNER)));
    add(new CheckBox(ID_USE_TARGET_APPROVER, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_TARGET_APPROVER)));
    add(WebComponentUtil.createHelp(ID_TARGET_HELP));
    add(new CheckBox(ID_USE_OBJECT_OWNER, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_OBJECT_OWNER)));
    add(new CheckBox(ID_USE_OBJECT_APPROVER, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_OBJECT_APPROVER)));
    add(WebComponentUtil.createHelp(ID_OBJECT_HELP));
    AjaxCheckBox useObjectManagerCheckbox = new AjaxCheckBox(ID_USE_OBJECT_MANAGER, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_OBJECT_MANAGER_PRESENT)) {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            target.add(DefinitionStagePanel.this.get(ID_USE_OBJECT_MANAGER_DETAILS));
        }
    };
    add(useObjectManagerCheckbox);
    WebMarkupContainer useObjectManagerDetails = new WebMarkupContainer(ID_USE_OBJECT_MANAGER_DETAILS);
    useObjectManagerDetails.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            return useObjectManagerCheckbox.getModelObject();
        }
    });
    useObjectManagerDetails.setOutputMarkupId(true);
    add(useObjectManagerDetails);
    add(WebComponentUtil.createHelp(ID_USE_OBJECT_MANAGER_HELP));
    TextField orgTypeField = new TextField<>(ID_USE_OBJECT_MANAGER_ORG_TYPE, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_OBJECT_MANAGER + "." + ManagerSearchDto.F_ORG_TYPE));
    orgTypeField.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
    useObjectManagerDetails.add(orgTypeField);
    useObjectManagerDetails.add(WebComponentUtil.createHelp(ID_USE_OBJECT_MANAGER_ORG_TYPE_HELP));
    CheckBox allowSelf = new CheckBox(ID_USE_OBJECT_MANAGER_ALLOW_SELF, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_OBJECT_MANAGER + "." + ManagerSearchDto.F_ALLOW_SELF));
    allowSelf.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
    useObjectManagerDetails.add(allowSelf);
    useObjectManagerDetails.add(WebComponentUtil.createHelp(ID_USE_OBJECT_MANAGER_ALLOW_SELF_HELP));
    try {
        ItemPanelSettingsBuilder builder = new ItemPanelSettingsBuilder().visibilityHandler(iw -> ItemVisibility.AUTO);
        Panel defaultOwnerRefPanel = pageBase.initItemPanel(ID_DEFAULT_REVIEWER_REF, ObjectReferenceType.COMPLEX_TYPE, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_DEFAULT_REVIEWERS), builder.build());
        add(defaultOwnerRefPanel);
        add(WebComponentUtil.createHelp(ID_DEFAULT_REVIEWER_REF_HELP));
        Panel additionalOwnerRefPanel = pageBase.initItemPanel(ID_ADDITIONAL_REVIEWER_REF, ObjectReferenceType.COMPLEX_TYPE, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_ADDITIONAL_REVIEWERS), builder.build());
        add(additionalOwnerRefPanel);
        add(WebComponentUtil.createHelp(ID_ADDITIONAL_REVIEWER_REF_HELP));
    } catch (SchemaException e) {
    }
    DropDownChoice outcomeStrategy1 = new DropDownChoice<>(ID_OUTCOME_STRATEGY, new PropertyModel<>(getModel(), StageDefinitionDto.F_OUTCOME_STRATEGY), WebComponentUtil.createReadonlyModelFromEnum(AccessCertificationCaseOutcomeStrategyType.class), new EnumChoiceRenderer<>(this));
    add(outcomeStrategy1);
    add(WebComponentUtil.createHelp(ID_OUTCOME_STRATEGY_HELP));
    DropDownChoice<AccessCertificationResponseType> outcomeIfNoReviewers = new DropDownChoice<>(ID_OUTCOME_IF_NO_REVIEWERS, new PropertyModel<>(getModel(), StageDefinitionDto.F_OUTCOME_IF_NO_REVIEWERS), WebComponentUtil.createReadonlyModelFromEnum(AccessCertificationResponseType.class), new EnumChoiceRenderer<>(this));
    add(outcomeIfNoReviewers);
    add(WebComponentUtil.createHelp(ID_OUTCOME_IF_NO_REVIEWERS_HELP));
    Label stopReviewOn = new Label(ID_STOP_REVIEW_ON, new IModel<String>() {

        @Override
        public String getObject() {
            List<AccessCertificationResponseType> stopOn = getModelObject().getStopReviewOn();
            return CertMiscUtil.getStopReviewOnText(stopOn, getPageBase());
        }
    });
    add(stopReviewOn);
    add(WebComponentUtil.createHelp(ID_STOP_REVIEW_ON_HELP));
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) TextArea(org.apache.wicket.markup.html.form.TextArea) PropertyModel(org.apache.wicket.model.PropertyModel) EmptyOnBlurAjaxFormUpdatingBehaviour(com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour) Label(org.apache.wicket.markup.html.basic.Label) AjaxCheckBox(org.apache.wicket.ajax.markup.html.form.AjaxCheckBox) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AccessCertificationResponseType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationResponseType) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ItemPanelSettingsBuilder(com.evolveum.midpoint.gui.impl.prism.panel.ItemPanelSettingsBuilder) ItemHeaderPanel(com.evolveum.midpoint.gui.impl.prism.panel.ItemHeaderPanel) Panel(org.apache.wicket.markup.html.panel.Panel) BasePanel(com.evolveum.midpoint.gui.api.component.BasePanel) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) AccessCertificationCaseOutcomeStrategyType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseOutcomeStrategyType) CheckBox(org.apache.wicket.markup.html.form.CheckBox) AjaxCheckBox(org.apache.wicket.ajax.markup.html.form.AjaxCheckBox) TextField(org.apache.wicket.markup.html.form.TextField) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 33 with Panel

use of org.apache.wicket.markup.html.panel.Panel in project midpoint by Evolveum.

the class PagePostAuthentication method initStaticLayout.

@Override
protected WebMarkupContainer initStaticLayout() {
    Task task = createSimpleTask(OPERATION_LOAD_WRAPPER);
    OperationResult result = new OperationResult(OPERATION_LOAD_WRAPPER);
    PrismObjectWrapperFactory<UserType> factory = findObjectWrapperFactory(userModel.getObject().asPrismObject().getDefinition());
    WrapperContext context = new WrapperContext(task, result);
    try {
        objectWrapper = factory.createObjectWrapper(userModel.getObject().asPrismObject(), ItemStatus.NOT_CHANGED, context);
    } catch (SchemaException e) {
        result.recordFatalError(getString("PagePostAuthentication.message.couldntPerformPostAuth.fatalError"));
        showResult(result);
        throw new RestartResponseException(PageLogin.class);
    }
    WebMarkupContainer wrappers = new WebMarkupContainer(ID_WRAPPER_CONTENT);
    try {
        Panel main = initItemPanel(ID_MAIN_PANEL, UserType.COMPLEX_TYPE, PrismContainerWrapperModel.fromContainerWrapper(Model.of(objectWrapper), ItemPath.EMPTY_PATH), null);
        wrappers.add(main);
        Panel password = initItemPanel(ID_PASSWORD_PANEL, PasswordType.COMPLEX_TYPE, PrismContainerWrapperModel.fromContainerWrapper(Model.of(objectWrapper), ItemPath.create(UserType.F_CREDENTIALS, CredentialsType.F_PASSWORD)), null);
        wrappers.add(password);
    } catch (SchemaException e) {
        LOGGER.error("Cannot create panel, {}", e.getMessage(), e);
        getSession().error("Unexpected error occurred. Please contact system administrator.");
        throw new RestartResponseException(PageLogin.class);
    }
    return wrappers;
}
Also used : WrapperContext(com.evolveum.midpoint.gui.api.factory.wrapper.WrapperContext) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) Panel(org.apache.wicket.markup.html.panel.Panel) Task(com.evolveum.midpoint.task.api.Task) RestartResponseException(org.apache.wicket.RestartResponseException) PageLogin(com.evolveum.midpoint.web.page.login.PageLogin) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 34 with Panel

use of org.apache.wicket.markup.html.panel.Panel in project midpoint by Evolveum.

the class AbstractPageObjectDetails method initSummaryPanel.

private Panel initSummaryPanel() {
    LoadableDetachableModel<O> summaryModel = objectDetailsModels.getSummaryModel();
    Panel summaryPanel = createSummaryPanel(ID_SUMMARY, summaryModel);
    summaryPanel.add(new VisibleBehaviour(() -> objectDetailsModels.getObjectStatus() != ItemStatus.ADDED));
    return summaryPanel;
}
Also used : MessagePanel(com.evolveum.midpoint.gui.api.component.result.MessagePanel) DetailsNavigationPanel(com.evolveum.midpoint.gui.impl.component.menu.DetailsNavigationPanel) Panel(org.apache.wicket.markup.html.panel.Panel) OperationalButtonsPanel(com.evolveum.midpoint.gui.impl.page.admin.component.OperationalButtonsPanel) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour)

Example 35 with Panel

use of org.apache.wicket.markup.html.panel.Panel in project midpoint by Evolveum.

the class WebComponentUtil method createPanel.

// TODO
public static <T extends ObjectType> Panel createPanel(Class<? extends Panel> panelClass, String markupId, ObjectDetailsModels<T> objectDetailsModels, ContainerPanelConfigurationType panelConfig) {
    if (panelClass == null) {
        return null;
    }
    if (AbstractAssignmentTypePanel.class.isAssignableFrom(panelClass)) {
        try {
            Panel panel = ConstructorUtils.invokeConstructor(panelClass, markupId, objectDetailsModels.getObjectWrapperModel(), panelConfig);
            panel.setOutputMarkupId(true);
            return panel;
        } catch (Throwable e) {
            LOGGER.trace("No constructor found for (String, LoadableModel, ContainerPanelConfigurationType). Continue with lookup.", e);
        }
    }
    try {
        Panel panel = ConstructorUtils.invokeConstructor(panelClass, markupId, objectDetailsModels, panelConfig);
        panel.setOutputMarkupId(true);
        return panel;
    } catch (Throwable e) {
        e.printStackTrace();
        LOGGER.trace("No constructor found for (String, LoadableModel, ContainerPanelConfigurationType). Continue with lookup.", e);
    }
    return null;
}
Also used : AbstractAssignmentTypePanel(com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.component.assignmentType.AbstractAssignmentTypePanel) BasePanel(com.evolveum.midpoint.gui.api.component.BasePanel) TabbedPanel(com.evolveum.midpoint.web.component.TabbedPanel) InputPanel(com.evolveum.midpoint.web.component.prism.InputPanel) DropDownChoicePanel(com.evolveum.midpoint.web.component.input.DropDownChoicePanel) DynamicFormPanel(com.evolveum.midpoint.web.component.prism.DynamicFormPanel) MainObjectListPanel(com.evolveum.midpoint.gui.api.component.MainObjectListPanel) Panel(org.apache.wicket.markup.html.panel.Panel)

Aggregations

Panel (org.apache.wicket.markup.html.panel.Panel)76 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)27 ArrayList (java.util.ArrayList)21 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)18 BasePanel (com.evolveum.midpoint.gui.api.component.BasePanel)16 ITab (org.apache.wicket.extensions.markup.html.tabs.ITab)16 Before (org.junit.Before)16 AbstractTab (org.apache.wicket.extensions.markup.html.tabs.AbstractTab)15 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)13 AjaxBootstrapTabbedPanel (de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel)12 ResourceModel (org.apache.wicket.model.ResourceModel)11 DivTestPanel (org.odlabs.wiquery.ui.DivTestPanel)11 ItemPanelSettingsBuilder (com.evolveum.midpoint.gui.impl.prism.panel.ItemPanelSettingsBuilder)10 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)10 List (java.util.List)9 Test (org.junit.Test)9 IModel (org.apache.wicket.model.IModel)8 Model (org.apache.wicket.model.Model)6 ActionsPanel (org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel)5 Label (org.apache.wicket.markup.html.basic.Label)5