Search in sources :

Example 36 with Page

use of org.apache.wicket.Page in project webanno by webanno.

the class WicketApplicationBase method initJQueryUI.

protected void initJQueryUI() {
    JQueryUILibrarySettings jqueryUiCfg = JQueryUILibrarySettings.get();
    // Here we ensure that bootstrap is loaded before JQuery UI such that the
    // JQuery UI tooltip that we use e.g. on the annotation page takes precedence over
    // the less powerful Bootstrap tooltip (both are JQuery plugins using the same name!)
    jqueryUiCfg.setJavaScriptReference(BootstrapAwareJQueryUIJavaScriptResourceReference.get());
    getComponentInstantiationListeners().add(component -> {
        if (component instanceof Page) {
            component.add(new JQueryUIResourceBehavior());
        }
    });
}
Also used : JQueryUILibrarySettings(com.googlecode.wicket.jquery.ui.settings.JQueryUILibrarySettings) Page(org.apache.wicket.Page) LoginPage(de.tudarmstadt.ukp.clarin.webanno.ui.core.login.LoginPage) WebPage(org.apache.wicket.markup.html.WebPage) JQueryUIResourceBehavior(de.tudarmstadt.ukp.clarin.webanno.ui.config.JQueryUIResourceBehavior)

Example 37 with Page

use of org.apache.wicket.Page in project webanno by webanno.

the class WicketApplicationBase method initKendo.

protected void initKendo() {
    getComponentInstantiationListeners().add(component -> {
        if (component instanceof Page) {
            component.add(new KendoResourceBehavior());
            component.add(new WicketJQueryFocusPatchBehavior());
        }
    });
}
Also used : WicketJQueryFocusPatchBehavior(de.tudarmstadt.ukp.clarin.webanno.ui.core.kendo.WicketJQueryFocusPatchBehavior) KendoResourceBehavior(de.tudarmstadt.ukp.clarin.webanno.ui.config.KendoResourceBehavior) Page(org.apache.wicket.Page) LoginPage(de.tudarmstadt.ukp.clarin.webanno.ui.core.login.LoginPage) WebPage(org.apache.wicket.markup.html.WebPage)

Example 38 with Page

use of org.apache.wicket.Page in project syncope by apache.

the class WorkflowDirectoryPanel method getActions.

@Override
public ActionsPanel<WorkflowDefinitionTO> getActions(final IModel<WorkflowDefinitionTO> model) {
    final ActionsPanel<WorkflowDefinitionTO> panel = super.getActions(model);
    panel.add(new ActionLink<WorkflowDefinitionTO>() {

        private static final long serialVersionUID = -184018732772021627L;

        @Override
        public void onClick(final AjaxRequestTarget target, final WorkflowDefinitionTO ignore) {
            final IModel<String> wfDefinition = new Model<>();
            try {
                wfDefinition.setObject(IOUtils.toString(restClient.getDefinition(MediaType.APPLICATION_XML_TYPE, model.getObject().getKey())));
            } catch (IOException e) {
                LOG.error("Could not get workflow definition", e);
            }
            utility.header(Model.of(model.getObject().getKey()));
            utility.setContent(new XMLEditorPanel(utility, wfDefinition, false, pageRef) {

                private static final long serialVersionUID = -7688359318035249200L;

                @Override
                public void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
                    if (StringUtils.isNotBlank(wfDefinition.getObject())) {
                        try {
                            restClient.setDefinition(MediaType.APPLICATION_XML_TYPE, model.getObject().getKey(), wfDefinition.getObject());
                            SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
                            target.add(container);
                            utility.show(false);
                            utility.close(target);
                        } catch (SyncopeClientException e) {
                            SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage());
                        }
                        ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
                    }
                }
            });
            utility.show(target);
            target.add(utility);
        }
    }, ActionLink.ActionType.EDIT, StandardEntitlement.WORKFLOW_DEF_SET);
    panel.add(new ActionLink<WorkflowDefinitionTO>() {

        private static final long serialVersionUID = 3109256773218160485L;

        @Override
        public void onClick(final AjaxRequestTarget target, final WorkflowDefinitionTO ignore) {
            modal.header(Model.of(model.getObject().getKey()));
            modal.setContent(new ImageModalPanel<>(modal, restClient.getDiagram(model.getObject().getKey()), pageRef));
            modal.show(target);
            target.add(modal);
        }
    }, ActionLink.ActionType.VIEW, StandardEntitlement.WORKFLOW_DEF_GET);
    panel.add(new ActionLink<WorkflowDefinitionTO>() {

        private static final long serialVersionUID = -184018732772021627L;

        @Override
        public Class<? extends Page> getPageClass() {
            return ModelerPopupPage.class;
        }

        @Override
        public PageParameters getPageParameters() {
            PageParameters parameters = new PageParameters();
            if (modelerCtx != null) {
                parameters.add(Constants.MODELER_CONTEXT, modelerCtx);
            }
            parameters.add(Constants.MODEL_ID_PARAM, model.getObject().getModelId());
            return parameters;
        }

        @Override
        protected boolean statusCondition(final WorkflowDefinitionTO modelObject) {
            return modelerCtx != null;
        }

        @Override
        public void onClick(final AjaxRequestTarget target, final WorkflowDefinitionTO ignore) {
        // do nothing
        }
    }, ActionLink.ActionType.WORKFLOW_MODELER, StandardEntitlement.WORKFLOW_DEF_SET);
    panel.add(new ActionLink<WorkflowDefinitionTO>() {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        protected boolean statusCondition(final WorkflowDefinitionTO modelObject) {
            return !modelObject.isMain();
        }

        @Override
        public void onClick(final AjaxRequestTarget target, final WorkflowDefinitionTO ignore) {
            try {
                restClient.deleteDefinition(model.getObject().getKey());
                SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
                target.add(container);
            } catch (SyncopeClientException e) {
                LOG.error("While deleting workflow definition {}", model.getObject().getName(), e);
                SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage());
            }
            ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
        }
    }, ActionLink.ActionType.DELETE, StandardEntitlement.WORKFLOW_DEF_DELETE, true);
    return panel;
}
Also used : IModel(org.apache.wicket.model.IModel) XMLEditorPanel(org.apache.syncope.client.console.wicket.markup.html.form.XMLEditorPanel) Form(org.apache.wicket.markup.html.form.Form) SyncopeClientException(org.apache.syncope.common.lib.SyncopeClientException) Page(org.apache.wicket.Page) ModelerPopupPage(org.apache.syncope.client.console.pages.ModelerPopupPage) BasePage(org.apache.syncope.client.console.pages.BasePage) IOException(java.io.IOException) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) WorkflowDefinitionTO(org.apache.syncope.common.lib.to.WorkflowDefinitionTO) BasePage(org.apache.syncope.client.console.pages.BasePage) ImageModalPanel(org.apache.syncope.client.console.wicket.markup.html.form.ImageModalPanel)

Example 39 with Page

use of org.apache.wicket.Page in project wicket-orientdb by OrienteerBAP.

the class OrientDefaultExceptionsHandlingListener method onException.

@Override
public IRequestHandler onException(RequestCycle cycle, Exception ex) {
    Throwable th = null;
    if ((th = Exceptions.findCause(ex, OSecurityException.class)) != null || (th = Exceptions.findCause(ex, OValidationException.class)) != null || (th = Exceptions.findCause(ex, OSchemaException.class)) != null || (th = Exceptions.findCause(ex, IllegalStateException.class)) != null && Exceptions.findCause(ex, WicketRuntimeException.class) == null) {
        Page page = extractCurrentPage(false);
        if (page == null) {
            return th instanceof OSecurityException ? new UnauthorizedInstantiationHandler(extractCurrentPage(true)) : null;
        }
        OrientDbWebSession.get().error(th.getMessage());
        return new RenderPageRequestHandler(new PageProvider(page), RenderPageRequestHandler.RedirectPolicy.ALWAYS_REDIRECT);
    } else if ((th = Exceptions.findCause(ex, UnauthorizedActionException.class)) != null) {
        final UnauthorizedActionException unauthorizedActionException = (UnauthorizedActionException) th;
        return new UnauthorizedInstantiationHandler(unauthorizedActionException.getComponent());
    } else {
        return null;
    }
}
Also used : RenderPageRequestHandler(org.apache.wicket.core.request.handler.RenderPageRequestHandler) PageProvider(org.apache.wicket.core.request.handler.PageProvider) WicketRuntimeException(org.apache.wicket.WicketRuntimeException) Page(org.apache.wicket.Page) OSecurityException(com.orientechnologies.orient.core.exception.OSecurityException) OSchemaException(com.orientechnologies.orient.core.exception.OSchemaException) UnauthorizedActionException(org.apache.wicket.authorization.UnauthorizedActionException)

Example 40 with Page

use of org.apache.wicket.Page in project wicket by apache.

the class AutocomponetsGenerationTest method autoComponentsIdsGeneration.

/*
	 * Test for https://issues.apache.org/jira/browse/WICKET-6256
	 */
@Test
public void autoComponentsIdsGeneration() throws Exception {
    Page page = new UniqueIdTest();
    tester.startPage(page);
    // render page again. Autocomponents must have the same id
    tester.startPage(page);
}
Also used : Page(org.apache.wicket.Page) Test(org.junit.Test)

Aggregations

Page (org.apache.wicket.Page)94 Test (org.junit.Test)50 WebPage (org.apache.wicket.markup.html.WebPage)22 Component (org.apache.wicket.Component)11 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)7 IRequestablePage (org.apache.wicket.request.component.IRequestablePage)7 WicketRuntimeException (org.apache.wicket.WicketRuntimeException)6 IRequestHandler (org.apache.wicket.request.IRequestHandler)6 RequestCycle (org.apache.wicket.request.cycle.RequestCycle)6 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)6 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)5 PageProvider (org.apache.wicket.core.request.handler.PageProvider)5 IMarkupFragment (org.apache.wicket.markup.IMarkupFragment)5 DummyPage (org.apache.wicket.resource.DummyPage)5 ArrayList (java.util.ArrayList)4 AbstractAjaxBehavior (org.apache.wicket.behavior.AbstractAjaxBehavior)4 AccessDeniedPage (org.apache.wicket.markup.html.pages.AccessDeniedPage)4 Url (org.apache.wicket.request.Url)4 MockInnerClassPage (org.apache.wicket.util.tester.MockPageParameterPage.MockInnerClassPage)4 SuccessPage (org.apache.wicket.util.tester.apps_1.SuccessPage)4