Example usage for org.apache.wicket.markup.html.panel Fragment setOutputMarkupId

List of usage examples for org.apache.wicket.markup.html.panel Fragment setOutputMarkupId

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.panel Fragment setOutputMarkupId.

Prototype

public final Component setOutputMarkupId(final boolean output) 

Source Link

Document

Sets whether or not component will output id attribute into the markup.

Usage

From source file:com.evolveum.midpoint.gui.api.component.AbstractPopupTabPanel.java

License:Apache License

@Override
protected void onInitialize() {
    super.onInitialize();
    setOutputMarkupId(true);/* w w  w.  j a  v a 2  s .  com*/
    add(initObjectListPanel());

    Fragment parametersPanelFragment = new Fragment(ID_PARAMETERS_PANEL, ID_PARAMETERS_PANEL_FRAGMENT, this);
    parametersPanelFragment.setOutputMarkupId(true);

    initParametersPanel(parametersPanelFragment);
    add(parametersPanelFragment);
}

From source file:com.evolveum.midpoint.web.page.login.PageAbstractFlow.java

License:Apache License

private void initLayout() {

    //      initAccessBehaviour(mainForm);
    //      add(mainForm);

    Form<?> mainForm = new Form<>(ID_MAIN_FORM);
    mainForm.setMultiPart(true);//from  w  w  w .j  a v a2 s  .  c o  m
    add(mainForm);

    WebMarkupContainer content = null;
    Fragment fragment = null;
    if (!isCustomFormDefined()) {
        fragment = new Fragment(ID_CONTENT_AREA, "staticContent", this);
        content = initStaticLayout();

    } else {
        fragment = new Fragment(ID_CONTENT_AREA, "dynamicContent", this);
        content = initDynamicLayout();

    }

    fragment.setOutputMarkupId(true);
    content.setOutputMarkupId(true);
    initCaptchaAndButtons(fragment);
    fragment.add(content);
    mainForm.add(fragment);

}

From source file:de.alpharogroup.wicket.components.factory.ComponentFactory.java

License:Apache License

/**
 * Factory method for create a new {@link Fragment}.
 *
 * @param <T>//w w  w  .j  a  v  a2 s .c o m
 *            the generic type
 * @param id
 *            the id
 * @param markupId
 *            The associated id of the associated markup fragment
 * @param markupProvider
 *            The component whose markup contains the fragment's markup
 * @param model
 *            The model for this {@link Fragment}
 * @return The new {@link Fragment}.
 */
public static <T> Fragment newFragment(final String id, final String markupId,
        final MarkupContainer markupProvider, final IModel<T> model) {
    final Fragment fragment = new Fragment(id, markupId, markupProvider, model);
    fragment.setOutputMarkupId(true);
    return fragment;
}

From source file:mil.nga.giat.elasticsearch.ElasticConfigurationPanel.java

License:Open Source License

/**
 * Adds Elasticsearch configuration panel link, configure modal dialog and 
 * implements modal callback./*from w ww  .  j av  a  2  s. c o  m*/
 * 
 * @see {@link ElasticConfigurationPage#done}
 */

public ElasticConfigurationPanel(final String panelId, final IModel model) {
    super(panelId, model);
    final FeatureTypeInfo fti = (FeatureTypeInfo) model.getObject();

    final ModalWindow modal = new ModalWindow("modal");
    modal.setInitialWidth(800);
    modal.setTitle(new ParamResourceModel("modalTitle", ElasticConfigurationPanel.this));
    modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
        @Override
        public void onClose(AjaxRequestTarget target) {
            if (_layerInfo != null) {
                GeoServerApplication app = (GeoServerApplication) getApplication();
                final FeatureTypeInfo ft = (FeatureTypeInfo) getResourceInfo();

                app.getCatalog().getResourcePool().clear(ft);
                app.getCatalog().getResourcePool().clear(ft.getStore());
                setResponsePage(new ElasticResourceConfigurationPage(ft));
            }
        }
    });

    if (fti.getMetadata().get(ElasticLayerConfiguration.KEY) == null) {
        modal.add(new OpenWindowOnLoadBehavior());
    }

    modal.setContent(new ElasticConfigurationPage(panelId, model) {
        @Override
        void done(AjaxRequestTarget target, LayerInfo layerInfo, ElasticLayerConfiguration layerConfig) {
            _layerInfo = layerInfo;
            _layerConfig = layerConfig;
            modal.close(target);
        }
    });
    add(modal);

    AjaxLink findLink = new AjaxLink("edit") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            modal.show(target);
        }
    };
    final Fragment attributePanel = new Fragment("esPanel", "esPanelFragment", this);
    attributePanel.setOutputMarkupId(true);
    add(attributePanel);
    attributePanel.add(findLink);
}

From source file:net.tirasa.hct.editor.forms.ComponentForm.java

License:Apache License

public ComponentForm(final String id, final IModel model, final IBreadCrumbModel breadCrumbModel,
        final FeedbackPanel feedmsg, final String siteName) {

    super(id);/* w  ww. ja  v a2  s .  co m*/

    this.model = model;
    this.siteName = siteName;

    setOperationType(model);

    mainContainer = new WebMarkupContainer("main");
    mainContainer.setOutputMarkupId(true);
    this.add(mainContainer);

    final Fragment fragment = new Fragment("typePanel",
            Properties.OP_CREATE.equals(operationType) ? "viewSelect" : "hiddenSelect", mainContainer);
    fragment.setOutputMarkupId(true);
    mainContainer.add(fragment);

    final DocumentPanel documentPanel = new DocumentPanel("summary", operationType, new DocumentBean(),
            siteName);
    documentPanel.setOutputMarkupId(true);
    documentPanel.setVisible(false);
    mainContainer.add(documentPanel);

    setComponentModel();

    if (Properties.OP_CREATE.equals(operationType)) {

        final DropDownChoice type = new DropDownChoice("type", new Model(), typeComponent,
                new TypeChoiceRenderer("id", "name"));
        type.setRequired(true);
        type.setVisible(Properties.OP_CREATE.equals(operationType));
        type.add(new AjaxFormComponentUpdatingBehavior("onchange") {

            private static final long serialVersionUID = -1107858522700306810L;

            @Override
            protected void onUpdate(final AjaxRequestTarget target) {
                final int index = Integer.parseInt(type.getValue());
                switch (index) {
                case 0:
                    component = new DocumentBean();
                    setModel(new CompoundPropertyModel<ComponentType>(component));
                    displayDocumentForm();
                    break;
                case 1:
                    component = new SummaryBean();
                    setModel(new CompoundPropertyModel<ComponentType>(component));
                    setBeanList(component);
                    displaySummaryForm();
                    break;
                case 2:
                    component = new CollectionBean();
                    setModel(new CompoundPropertyModel<ComponentType>(component));
                    displayCollectionForm();
                    break;
                case 3:
                    component = new ResourceBean();
                    setModel(new CompoundPropertyModel<ComponentType>(component));
                    setBeanList(component);
                    displayResourceForm();
                    break;
                default:
                    break;
                }
                target.addComponent(mainContainer);
            }
        });

        fragment.add(type);
    }

    this.add(new AjaxButton("create-button", this) {

        private static final long serialVersionUID = -5783994974426198290L;

        @Override
        protected void onSubmit(final AjaxRequestTarget target, final Form form) {

            try {
                String componentName = component.getComponentName();
                if (component instanceof DocumentBean) {
                    component = (DocumentBean) component;
                }
                if (component instanceof CollectionBean) {
                    component = (CollectionBean) component;
                }
                if (component instanceof SummaryBean) {
                    component = (SummaryBean) component;
                }
                if (component instanceof ResourceBean) {
                    component = (ResourceBean) component;
                }
                if (Properties.OP_CREATE.equals(operationType)) {
                    component.create(siteName);
                } else {
                    component.save();
                }
                LOG.info("Component '" + componentName + "' created by "
                        + ((UserSession) Session.get()).getJcrSession().getUserID());
                Session.get().info(getString("component-created") + ": " + component.getComponentName());
                final List<IBreadCrumbParticipant> l = breadCrumbModel.allBreadCrumbParticipants();
                breadCrumbModel.setActive(l.get(l.size() - 2));
            } catch (RepositoryException e) {
                Session.get().warn(getString("component-create-failed") + " " + component.getComponentName());
                LOG.error("Unable to create component '" + component.getComponentName() + "' : ", e);
            }
        }

        @Override
        protected void onError(final AjaxRequestTarget target, final Form form) {
            target.addComponent(feedmsg);
        }
    }.setDefaultFormProcessing(true));

    this.add(new AjaxButton("cancel-button") {

        private static final long serialVersionUID = 5166479650578194076L;

        @Override
        protected void onSubmit(final AjaxRequestTarget target, final Form form) {
            // one up
            final List<IBreadCrumbParticipant> l = breadCrumbModel.allBreadCrumbParticipants();
            breadCrumbModel.setActive(l.get(l.size() - 2));
        }
    }.setDefaultFormProcessing(false));
}

From source file:org.apache.syncope.client.console.pages.ResultStatusModalPage.java

License:Apache License

private ResultStatusModalPage(final Builder builder) {
    super();//from  ww w .j a  v a2 s. c  o  m
    this.subject = builder.subject;
    statusUtils = new StatusUtils(this.userRestClient);
    if (builder.mode == null) {
        this.mode = Mode.ADMIN;
    } else {
        this.mode = builder.mode;
    }

    final BaseModalPage page = this;

    final WebMarkupContainer container = new WebMarkupContainer("container");
    container.setOutputMarkupId(true);
    add(container);

    final Fragment fragment = new Fragment("resultFrag",
            mode == Mode.SELF ? "userSelfResultFrag" : "propagationResultFrag", this);
    fragment.setOutputMarkupId(true);
    container.add(fragment);

    if (mode == Mode.ADMIN) {
        // add Syncope propagation status
        PropagationStatus syncope = new PropagationStatus();
        syncope.setResource("Syncope");
        syncope.setStatus(PropagationTaskExecStatus.SUCCESS);

        List<PropagationStatus> propagations = new ArrayList<PropagationStatus>();
        propagations.add(syncope);
        propagations.addAll(subject.getPropagationStatusTOs());

        fragment.add(new Label("info",
                ((subject instanceof UserTO) && ((UserTO) subject).getUsername() != null)
                        ? ((UserTO) subject).getUsername()
                        : ((subject instanceof GroupTO) && ((GroupTO) subject).getName() != null)
                                ? ((GroupTO) subject).getName()
                                : String.valueOf(subject.getKey())));

        final ListView<PropagationStatus> propRes = new ListView<PropagationStatus>("resources", propagations) {

            private static final long serialVersionUID = -1020475259727720708L;

            @Override
            protected void populateItem(final ListItem<PropagationStatus> item) {
                final PropagationStatus propTO = (PropagationStatus) item.getDefaultModelObject();

                final ListView attributes = getConnObjectView(propTO);

                final Fragment attrhead;
                if (attributes.getModelObject() == null || attributes.getModelObject().isEmpty()) {
                    attrhead = new Fragment("attrhead", "emptyAttrHeadFrag", page);
                } else {
                    attrhead = new Fragment("attrhead", "attrHeadFrag", page);
                }

                item.add(attrhead);
                item.add(attributes);

                attrhead.add(new Label("resource", propTO.getResource()));

                attrhead.add(new Label("propagation",
                        propTO.getStatus() == null ? "UNDEFINED" : propTO.getStatus().toString()));

                final Image image;
                final String alt, title;
                final ModalWindow failureWindow = new ModalWindow("failureWindow");
                final AjaxLink<?> failureWindowLink = new AjaxLink<Void>("showFailureWindow") {

                    private static final long serialVersionUID = -7978723352517770644L;

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        failureWindow.show(target);
                    }
                };

                switch (propTO.getStatus()) {

                case SUCCESS:
                case SUBMITTED:
                case CREATED:
                    image = new Image("icon", new ContextRelativeResource(
                            IMG_PREFIX + Status.ACTIVE.toString() + Constants.PNG_EXT));
                    alt = "success icon";
                    title = "success";
                    failureWindow.setVisible(false);
                    failureWindowLink.setEnabled(false);
                    break;

                default:
                    image = new Image("icon", new ContextRelativeResource(
                            IMG_PREFIX + Status.SUSPENDED.toString() + Constants.PNG_EXT));
                    alt = "failure icon";
                    title = "failure";
                }

                image.add(new Behavior() {

                    private static final long serialVersionUID = 1469628524240283489L;

                    @Override
                    public void onComponentTag(final Component component, final ComponentTag tag) {
                        tag.put("alt", alt);
                        tag.put("title", title);
                    }
                });
                final FailureMessageModalPage executionFailureMessagePage;
                if (propTO.getFailureReason() == null) {
                    executionFailureMessagePage = new FailureMessageModalPage(failureWindow.getContentId(),
                            StringUtils.EMPTY);
                } else {
                    executionFailureMessagePage = new FailureMessageModalPage(failureWindow.getContentId(),
                            propTO.getFailureReason());
                }

                failureWindow.setPageCreator(new ModalWindow.PageCreator() {

                    private static final long serialVersionUID = -7834632442532690940L;

                    @Override
                    public Page createPage() {
                        return executionFailureMessagePage;
                    }
                });
                failureWindow.setCookieName("failureWindow");
                failureWindow.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
                failureWindowLink.add(image);
                attrhead.add(failureWindowLink);
                attrhead.add(failureWindow);
            }
        };
        fragment.add(propRes);
    }

    final AjaxLink<Void> close = new IndicatingAjaxLink<Void>("close") {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            builder.window.close(target);
        }
    };
    container.add(close);

    setOutputMarkupId(true);
}

From source file:org.apache.syncope.client.console.pages.UserModalPage.java

License:Apache License

@SuppressWarnings({ "unchecked", "rawtypes" })
protected Form setupEditPanel() {
    fragment.add(new Label("id", userTO.getKey() == 0 ? StringUtils.EMPTY : userTO.getUsername()));

    fragment.add(/*from  ww  w.j  a v  a2  s.co  m*/
            new Label("new", userTO.getKey() == 0 ? new ResourceModel("new") : new Model(StringUtils.EMPTY)));

    final Form form = new Form("UserForm");
    form.setModel(new CompoundPropertyModel(userTO));

    //--------------------------------
    // User details
    //--------------------------------
    form.add(new UserDetailsPanel("details", userTO, form, resetPassword, mode == Mode.TEMPLATE));

    form.add(new Label("statuspanel", ""));

    form.add(new Label("pwdChangeInfo", ""));

    form.add(new Label("securityQuestion", ""));
    form.addOrReplace(new SecurityQuestionPanel("securityQuestion", userTO));

    form.add(new Label("accountinformation", ""));
    //--------------------------------

    //--------------------------------
    // Store password internally checkbox
    //--------------------------------
    final Fragment storePwdFragment = new Fragment("storePwdFrag", "storePwdCheck", form);
    storePwdFragment.setOutputMarkupId(true);
    final Label storePasswordLabel = new Label("storePasswordLabel", new ResourceModel("storePassword"));
    storePwdFragment.add(storePasswordLabel);
    storePwdFragment.add(storePassword);
    form.add(userTO.getKey() == 0 && mode != Mode.TEMPLATE ? storePwdFragment
            : new Fragment("storePwdFrag", "emptyFragment", form));
    //--------------------------------

    //--------------------------------
    // Attributes panel
    //--------------------------------
    form.add(new PlainAttrsPanel("plainAttrs", userTO, form, mode));
    //--------------------------------

    //--------------------------------
    // Derived attributes panel
    //--------------------------------
    form.add(new DerAttrsPanel("derAttrs", userTO));
    //--------------------------------

    //--------------------------------
    // Virtual attributes panel
    //--------------------------------
    form.add(new VirAttrsPanel("virAttrs", userTO, mode == Mode.TEMPLATE));
    //--------------------------------

    //--------------------------------
    // Resources panel
    //--------------------------------
    form.add(new ResourcesPanel.Builder("resources").attributableTO(userTO).build());
    //--------------------------------

    //--------------------------------
    // Groups panel
    //--------------------------------
    form.add(new MembershipsPanel("memberships", userTO, mode, null, getPageReference()));
    //--------------------------------

    final AjaxButton submit = getOnSubmit();

    if (mode == Mode.ADMIN) {
        String allowedRoles = userTO.getKey() == 0 ? xmlRolesReader.getEntitlement("Users", "create")
                : xmlRolesReader.getEntitlement("Users", "update");
        MetaDataRoleAuthorizationStrategy.authorize(submit, RENDER, allowedRoles);
    }

    fragment.add(form);
    form.add(submit);
    form.setDefaultButton(submit);

    final AjaxButton cancel = new AjaxButton(CANCEL, new ResourceModel(CANCEL)) {

        private static final long serialVersionUID = 530608535790823587L;

        @Override
        protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
            window.close(target);
        }

        @Override
        protected void onError(final AjaxRequestTarget target, final Form<?> form) {
        }
    };

    cancel.setDefaultFormProcessing(false);
    form.add(cancel);

    return form;
}

From source file:org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksTogglePanel.java

License:Apache License

public void toggleWithContent(final AjaxRequestTarget target, final ActionsPanel<T> actionsPanel,
        final T modelObject) {
    updateHeader(target, modelObject);// ww  w.  jav a2s .  c  om
    modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

        private static final long serialVersionUID = 8804221891699487139L;

        @Override
        public void onClose(final AjaxRequestTarget target) {
            modal.show(false);
        }
    });

    final Fragment frag = new Fragment("actions", "actionsFragment", this);
    frag.setOutputMarkupId(true);
    frag.add(actionsPanel);

    container.addOrReplace(frag);
    target.add(this.container);

    toggle(target, modelObject, true);
}

From source file:org.apache.syncope.client.console.widgets.ReconciliationWidget.java

License:Apache License

public ReconciliationWidget(final String id, final PageReference pageRef) {
    super(id);/*from w w  w . ja  v a2s . c  om*/
    this.pageRef = pageRef;
    setOutputMarkupId(true);
    add(detailsModal);

    overlay = new WebMarkupContainer("overlay");
    overlay.setOutputMarkupPlaceholderTag(true);
    overlay.setVisible(false);
    add(overlay);

    this.reconciliationReportKey = SyncopeConsoleApplication.get().getReconciliationReportKey();

    ReportTO reconciliationReport = null;
    if (SyncopeConsoleSession.get().owns(StandardEntitlement.REPORT_READ)) {
        try {
            reconciliationReport = restClient.read(reconciliationReportKey);
        } catch (Exception e) {
            LOG.error("Could not fetch the expected reconciliation report with key {}, aborting",
                    reconciliationReportKey, e);
        }
    }

    Fragment reportResult = reconciliationReport == null || reconciliationReport.getExecutions().isEmpty()
            ? new Fragment("reportResult", "noExecFragment", this)
            : buildExecFragment();
    reportResult.setOutputMarkupId(true);
    add(reportResult);

    IndicatorAjaxLink<Void> refresh = new IndicatorAjaxLink<Void>("refresh") {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            try {
                restClient.startExecution(reconciliationReportKey, null);

                overlay.setVisible(true);
                target.add(ReconciliationWidget.this);

                SyncopeConsoleSession.get().setCheckReconciliationJob(true);

                SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
            } catch (Exception e) {
                LOG.error("While starting reconciliation report", e);
                SyncopeConsoleSession.get().error("Could not start reconciliation report");
            }
            ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
        }
    };
    MetaDataRoleAuthorizationStrategy.authorize(refresh, Component.RENDER, StandardEntitlement.REPORT_EXECUTE);
    add(refresh);
}

From source file:org.apache.syncope.client.console.widgets.ReconciliationWidget.java

License:Apache License

private Fragment buildExecFragment() {
    Fragment execFragment = new Fragment("reportResult", "execFragment", this);
    execFragment.setOutputMarkupId(true);

    Pair<List<ProgressBean>, ReconciliationReport> execResult;
    try {/*w w w.ja v a 2 s.  co m*/
        execResult = parseReconciliationReportExec();
    } catch (Exception e) {
        LOG.error("Could not parse the reconciliation report result", e);
        execResult = Pair.of(Collections.<ProgressBean>emptyList(), new ReconciliationReport(new Date()));
    }
    final List<ProgressBean> progressBeans = execResult.getLeft();
    final ReconciliationReport report = execResult.getRight();

    List<ITab> tabs = new ArrayList<>();
    tabs.add(new AbstractTab(new ResourceModel("summary")) {

        private static final long serialVersionUID = -6815067322125799251L;

        @Override
        public Panel getPanel(final String panelId) {
            return new ProgressesPanel(panelId, report.getRun(), progressBeans);
        }
    });
    tabs.add(new AbstractTab(Model.of(AnyTypeKind.USER.name())) {

        private static final long serialVersionUID = -6815067322125799251L;

        @Override
        public Panel getPanel(final String panelId) {
            return new AnysReconciliationPanel(panelId, report.getUsers(), pageRef);
        }
    });
    tabs.add(new AbstractTab(Model.of(AnyTypeKind.GROUP.name())) {

        private static final long serialVersionUID = -6815067322125799251L;

        @Override
        public Panel getPanel(final String panelId) {
            return new AnysReconciliationPanel(panelId, report.getGroups(), pageRef);
        }
    });
    for (final Anys anys : report.getAnyObjects()) {
        tabs.add(new AbstractTab(Model.of(anys.getAnyType())) {

            private static final long serialVersionUID = -6815067322125799251L;

            @Override
            public Panel getPanel(final String panelId) {
                return new AnysReconciliationPanel(panelId, anys, pageRef);
            }
        });
    }

    execFragment.add(new AjaxBootstrapTabbedPanel<>("execResult", tabs));

    return execFragment;
}