Example usage for org.apache.wicket RuntimeConfigurationType DEVELOPMENT

List of usage examples for org.apache.wicket RuntimeConfigurationType DEVELOPMENT

Introduction

In this page you can find the example usage for org.apache.wicket RuntimeConfigurationType DEVELOPMENT.

Prototype

RuntimeConfigurationType DEVELOPMENT

To view the source code for org.apache.wicket RuntimeConfigurationType DEVELOPMENT.

Click Source Link

Usage

From source file:au.org.theark.web.application.BaseApplication.java

License:Open Source License

@Override
protected void init() {
    super.init();
    getMarkupSettings().setStripWicketTags(true);
    IApplicationSettings settings = getApplicationSettings();

    // Mount the pages for nicer looking URL's
    mountPage("login", LoginPage.class);
    mountPage("aaf-login", AAFLoginPage.class);
    mountPage("home", HomePage.class);

    settings.setPageExpiredErrorPage(LoginPage.class);

    // Alow wicket-source for development debugging
    if (getConfigurationType().equals(RuntimeConfigurationType.DEVELOPMENT)) {
        WicketSource.configure(this);
        getDebugSettings().setOutputComponentPath(true);
    }/*from ww w. ja va  2  s. c  o  m*/
}

From source file:ch.tkuhn.nanobrowser.NanobrowserApplication.java

License:Open Source License

public static boolean isInDevelopmentMode() {
    RuntimeConfigurationType dt = RuntimeConfigurationType.DEVELOPMENT;
    return get().getConfigurationType().equals(dt);
}

From source file:com.chitek.ignition.drivers.generictcp.ModuleHook.java

License:Apache License

@Override
public void setup(GatewayContext context) {
    // Register class with BundleUtil for localization
    BundleUtil.get().addBundle(BUNDLE_PREFIX, ModuleHook.class, "GenericTcpDriver");

    // Disable caching in development mode - Without this, the use of bundle util
    // keeps the jar file opened, even after a driver is reloaded by the dev module.
    // Not a big problem, as the temp jar files won't be deleted until the JVM shuts down,
    // but with this option the files can be deleted manually, if all classes are properly
    // unloaded. This allows a quick test for memory leaks.
    if (context.getWebApplication().getConfigurationType() == RuntimeConfigurationType.DEVELOPMENT) {
        context.getWebApplication().getResourceSettings().getLocalizer().clearCache();
        URLConnection con;//w  w w  .  j  av a 2s  . co m
        try {
            con = new URLConnection(new URL("file://null")) {

                @Override
                public void connect() throws IOException {
                    // NOOP - This is just a dummy

                }
            };
            // This will affect all URLConnections - not sure about side effects
            con.setDefaultUseCaches(false);
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
    }

    // Clear Wicket's markup cache. Actually this is only necessary when the module is upgraded to a new version, but there's
    // no way to detect this situation.
    if (context.getWebApplication().getMarkupSettings().getMarkupFactory().hasMarkupCache()) {
        // When the gateway service is started, the is no markup cache yet.
        context.getWebApplication().getResourceSettings().getPropertiesFactory().clearCache();
        context.getWebApplication().getMarkupSettings().getMarkupFactory().getMarkupCache().clear();
    }

    super.setup(context);
}

From source file:com.ecom.web.components.gmap.GMap2.java

License:Apache License

/**
 * @see org.apache.wicket.Component#onBeforeRender()
 *///w  ww.j a  va2 s  . c om
@Override
protected void onBeforeRender() {

    RuntimeConfigurationType configurationType = Application.get().getConfigurationType();
    if (configurationType.equals(RuntimeConfigurationType.DEVELOPMENT)
            && !Application.get().getMarkupSettings().getStripWicketTags()) {
        log.warn("Application is in DEVELOPMENT mode && Wicket tags are not stripped,"
                + " Firefox 3.0 will not render the GMap."
                + " Change to DEPLOYMENT mode  || turn on Wicket tags stripping." + " See:"
                + " http://www.nabble.com/Gmap2-problem-with-Firefox-3.0-to18137475.html.");
    }
    super.onBeforeRender();
}

From source file:com.evolveum.midpoint.gui.api.page.PageBase.java

License:Apache License

private void initLayout() {
    AjaxLink logo = new AjaxLink(ID_LOGO) {
        private static final long serialVersionUID = 1L;

        @Override//from  w  w  w  .jav  a  2 s . c  o m
        public void onClick(AjaxRequestTarget target) {
            SessionStorage storage = MidPointAuthWebSession.getSession().getSessionStorage();
            storage.clearBreadcrumbs();

            Class<? extends Page> page = MidPointApplication.get().getHomePage();
            setResponsePage(page);
        }
    };
    add(logo);

    Label title = new Label(ID_TITLE, createPageTitleModel());
    title.setRenderBodyOnly(true);
    add(title);

    initHeaderLayout();
    initTitleLayout();
    initDebugBarLayout();

    List<SideBarMenuItem> menuItems = createMenuItems();
    SideBarMenuPanel sidebarMenu = new SideBarMenuPanel(ID_SIDEBAR_MENU, new Model((Serializable) menuItems));
    sidebarMenu.add(createUserStatusBehaviour(true));
    add(sidebarMenu);

    WebMarkupContainer version = new WebMarkupContainer(ID_VERSION) {
        private static final long serialVersionUID = 1L;

        @Deprecated
        public String getDescribe() {
            return PageBase.this.getDescribe();
        }
    };
    version.add(new VisibleEnableBehaviour() {
        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return RuntimeConfigurationType.DEVELOPMENT.equals(getApplication().getConfigurationType());
        }
    });
    add(version);

    WebMarkupContainer feedbackContainer = new WebMarkupContainer(ID_FEEDBACK_CONTAINER);
    feedbackContainer.setOutputMarkupId(true);
    add(feedbackContainer);

    FeedbackAlerts feedbackList = new FeedbackAlerts(ID_FEEDBACK);
    feedbackList.setOutputMarkupId(true);
    feedbackContainer.add(feedbackList);

    MainPopupDialog mainPopup = new MainPopupDialog(ID_MAIN_POPUP);
    mainPopup.setOutputMarkupId(true);
    add(mainPopup);
}

From source file:com.evolveum.midpoint.gui.api.page.PageBase.java

License:Apache License

private void initDebugBarLayout() {
    DebugBar debugPanel = new DebugBar(ID_DEBUG_PANEL);
    add(debugPanel);/*from w  w  w  . j  a va2 s . c o m*/

    WebMarkupContainer debugBar = new WebMarkupContainer(ID_DEBUG_BAR);
    debugBar.add(new VisibleEnableBehaviour() {
        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            RuntimeConfigurationType runtime = getApplication().getConfigurationType();
            return RuntimeConfigurationType.DEVELOPMENT.equals(runtime);
        }
    });
    add(debugBar);

    AjaxButton clearCache = new AjaxButton(ID_CLEAR_CACHE, createStringResource("PageBase.clearCssCache")) {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            clearLessJsCache(target);
        }
    };
    debugBar.add(clearCache);
}

From source file:com.evolveum.midpoint.web.page.PageBase.java

License:Apache License

private void initLayout() {
    Label title = new Label(ID_TITLE, createPageTitleModel());
    title.setRenderBodyOnly(true);//  w  w w .  j a v a  2 s  .  co m
    add(title);

    DebugBar debugPanel = new DebugBar(ID_DEBUG_PANEL);
    add(debugPanel);

    TopMenuBar topMenu = new TopMenuBar(ID_TOP_MENU, createMenuItems());
    add(topMenu);

    WebMarkupContainer version = new WebMarkupContainer(ID_VERSION) {

        @Deprecated
        public String getDescribe() {
            return PageBase.this.getDescribe();
        }
    };
    version.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return RuntimeConfigurationType.DEVELOPMENT.equals(getApplication().getConfigurationType());
        }
    });
    add(version);

    WebMarkupContainer pageTitleContainer = new WebMarkupContainer(ID_PAGE_TITLE_CONTAINER);
    pageTitleContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return StringUtils.isNotEmpty(createPageTitleModel().getObject());
        }
    });
    add(pageTitleContainer);

    WebMarkupContainer pageTitle = new WebMarkupContainer(ID_PAGE_TITLE);
    pageTitleContainer.add(pageTitle);
    Label pageTitleReal = new Label(ID_PAGE_TITLE_REAL, createPageTitleModel());
    pageTitleReal.setRenderBodyOnly(true);
    pageTitle.add(pageTitleReal);
    pageTitle.add(new Label(ID_PAGE_SUBTITLE, createPageSubTitleModel()));

    WebMarkupContainer feedbackContainer = new WebMarkupContainer(ID_FEEDBACK_CONTAINER);
    feedbackContainer.setOutputMarkupId(true);
    add(feedbackContainer);

    MainFeedback feedback = new MainFeedback(ID_FEEDBACK);
    feedbackContainer.add(feedback);

    TempFeedback tempFeedback = new TempFeedback(ID_TEMP_FEEDBACK);
    feedbackContainer.add(tempFeedback);

    initDebugBar();
}

From source file:com.evolveum.midpoint.web.page.PageBase.java

License:Apache License

private void initDebugBar() {
    WebMarkupContainer debugBar = new WebMarkupContainer(ID_DEBUG_BAR);
    debugBar.add(new VisibleEnableBehaviour() {

        @Override//  w w w.j  a v a2 s. c o m
        public boolean isVisible() {
            RuntimeConfigurationType runtime = getApplication().getConfigurationType();
            return RuntimeConfigurationType.DEVELOPMENT.equals(runtime);
        }
    });
    add(debugBar);

    AjaxButton clearCache = new AjaxButton(ID_CLEAR_CACHE, createStringResource("PageBase.clearCssCache")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            clearLessJsCache(target);
        }
    };
    debugBar.add(clearCache);
}

From source file:com.evolveum.midpoint.web.page.PageTemplate.java

License:Apache License

private void initLayout() {
    Label title = new Label(ID_TITLE, createPageTitleModel());
    title.setRenderBodyOnly(true);//w w  w.  j a v a 2 s.c om
    add(title);

    DebugBar debugPanel = new DebugBar(ID_DEBUG_PANEL);
    add(debugPanel);

    TopMenuBar topMenu = new TopMenuBar(ID_TOP_MENU, createMenuItems());
    add(topMenu);

    WebMarkupContainer version = new WebMarkupContainer(ID_VERSION) {

        @Deprecated
        public String getDescribe() {
            return PageTemplate.this.getDescribe();
        }
    };
    version.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return RuntimeConfigurationType.DEVELOPMENT.equals(getApplication().getConfigurationType());
        }
    });
    add(version);

    WebMarkupContainer pageTitleContainer = new WebMarkupContainer(ID_PAGE_TITLE_CONTAINER);
    pageTitleContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return StringUtils.isNotEmpty(createPageTitleModel().getObject());
        }
    });
    add(pageTitleContainer);

    WebMarkupContainer pageTitle = new WebMarkupContainer(ID_PAGE_TITLE);
    pageTitleContainer.add(pageTitle);
    Label pageTitleReal = new Label(ID_PAGE_TITLE_REAL, createPageTitleModel());
    pageTitleReal.setRenderBodyOnly(true);
    pageTitle.add(pageTitleReal);
    pageTitle.add(new Label(ID_PAGE_SUBTITLE, createPageSubTitleModel()));

    WebMarkupContainer feedbackContainer = new WebMarkupContainer(ID_FEEDBACK_CONTAINER);
    feedbackContainer.setOutputMarkupId(true);
    add(feedbackContainer);

    MainFeedback feedback = new MainFeedback(ID_FEEDBACK);
    feedbackContainer.add(feedback);

    TempFeedback tempFeedback = new TempFeedback(ID_TEMP_FEEDBACK);
    feedbackContainer.add(tempFeedback);

    //        FeedbackAlerts feedbackList = new FeedbackAlerts(ID_FEEDBACK_LIST);
    //        feedbackList.setOutputMarkupId(true);
    //        add(feedbackList);

    initDebugBar();
}

From source file:com.evolveum.midpoint.web.security.MidPointApplication.java

License:Apache License

@Override
public void init() {
    super.init();

    getComponentInstantiationListeners().add(new SpringComponentInjector(this));

    IResourceSettings resourceSettings = getResourceSettings();
    resourceSettings.setHeaderItemComparator(new PriorityFirstComparator(true));

    resourceSettings.setThrowExceptionOnMissingResource(false);
    getMarkupSettings().setStripWicketTags(true);
    getMarkupSettings().setDefaultBeforeDisabledLink("");
    getMarkupSettings().setDefaultAfterDisabledLink("");

    if (RuntimeConfigurationType.DEVELOPMENT.equals(getConfigurationType())) {
        getDebugSettings().setAjaxDebugModeEnabled(true);
        getDebugSettings().setDevelopmentUtilitiesEnabled(true);
    }/*  ww w . j  ava2 s  .  c o m*/

    //pretty url for resources (e.g. images)
    mountFiles(ImgResources.BASE_PATH, ImgResources.class);

    //exception handling an error pages
    IApplicationSettings appSettings = getApplicationSettings();
    appSettings.setAccessDeniedPage(PageError401.class);
    appSettings.setInternalErrorPage(PageError.class);
    appSettings.setPageExpiredErrorPage(PageError.class);

    mount(new MountedMapper("/error", PageError.class, MidPointPageParametersEncoder.ENCODER));
    mount(new MountedMapper("/error/401", PageError401.class, MidPointPageParametersEncoder.ENCODER));
    mount(new MountedMapper("/error/403", PageError403.class, MidPointPageParametersEncoder.ENCODER));
    mount(new MountedMapper("/error/404", PageError404.class, MidPointPageParametersEncoder.ENCODER));

    getRequestCycleListeners().add(new AbstractRequestCycleListener() {

        @Override
        public IRequestHandler onException(RequestCycle cycle, Exception ex) {
            return new RenderPageRequestHandler(new PageProvider(new PageError(ex)));
        }
    });

    // todo wicket atmosphere was disabled because of form file upload and redirection url problems.
    //        //ajax push (just an experiment)
    //        eventBus = new EventBus(this);
    //        eventBus.getParameters().setLogLevel(AtmosphereLogLevel.DEBUG);
    //
    //        //enable simple task notifications here
    //        taskManager.registerTaskListener(new TaskListener() {
    //
    //            @Override
    //            public void onTaskStart(Task task) {
    //                EventBus bus = getEventBus();
    //                bus.post(new NotifyMessage("Task start", WebMiscUtil.getOrigStringFromPoly(task.getName()) + " started.",
    //                        OperationResultStatus.SUCCESS));
    //            }
    //
    //            @Override
    //            public void onTaskFinish(Task task, TaskRunResult runResult) {
    //                EventBus bus = getEventBus();
    //                bus.post(new NotifyMessage("Task finish", WebMiscUtil.getOrigStringFromPoly(task.getName()) + " finished.",
    //                        OperationResultStatus.parseStatusType(task.getResultStatus())));
    //            }
    //
    //            @Override
    //            public void onTaskThreadStart(Task task, boolean isRecovering) {
    //
    //            }
    //
    //            @Override
    //            public void onTaskThreadFinish(Task task) {
    //
    //            }
    //        });

    //descriptor loader, used for customization
    new DescriptorLoader().loadData(this);
}