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:com.francetelecom.clara.cloud.presentation.WicketApplication.java

License:Apache License

/**
 * Define application settings/*from w w w .j  a  v  a2s.  co m*/
 */
@Override
protected void init() {
    if (logger.isDebugEnabled()) {
        logger.debug("Wicket application init (configurationType:[{}])", getConfigurationType());
    }
    defineSpringInjector();
    if (!RuntimeConfigurationType.DEVELOPMENT.equals(getConfigurationType())) {
        // change default error/timeout pages in production mode
        //defineErrorPage();
        // remove "wicket:id" from html generated code in production mode
        getMarkupSettings().setStripWicketTags(true);
    } else {
        setupDevelopmentSettings();
    }
    //TODO Remove
    //     getDebugSettings().setAjaxDebugModeEnabled(true);
    IApplicationSettings settings = getApplicationSettings();
    //        https://cwiki.apache.org/WICKET/error-pages-and-feedback-messages.html
    settings.setInternalErrorPage(UnknownExceptionPage.class);
    //        settings.setAccessDeniedPage();
    //        settings.setPageExpiredErrorPage();
    getRequestCycleListeners().add(new ExecutionHandlerRequestCycle(this, new WebPageBaseFactory()));
    //TODO : Not available in Wicket 1.5 because it's enabled by default. Why was it disabled?
    //        getPageSettings().setAutomaticMultiWindowSupport(false);
    //will encrypt/decrypt the URLs generated by the inner one
    IRequestMapper cryptoMapper = new CryptoMapper(getRootRequestMapper(), this);
    setRootRequestMapper(cryptoMapper);
    //        ICryptFactory jasyptCryptFactory = new JasyptCryptFactory(urlEncryptor);
    //        getSecuritySettings().setCryptFactory(jasyptCryptFactory);
    mountBookmarks();
    //        https://cwiki.apache.org/WICKET/request-mapping.html
    //        https://issues.apache.org/jira/browse/WICKET-4488
    //        URL with a previous page version ignores requested page based on mount path
    //        http://apache-wicket.1842946.n4.nabble.com/I-don-t-want-url-page-count-parameter-localhost-8080-context-0-td4481510i40.html
    super.init();

    WicketWebjars.install(this);

    new BeanValidationConfiguration().configure(this);

    // For VMWare SDK logging (vCloud API)
    // call only once during initialization time of your application
    //      Do not work (NPE on undeploy)
    //      SLF4JBridgeHandler.install();        
}

From source file:com.gitblit.wicket.GitBlitWebApp.java

License:Apache License

@Override
public final RuntimeConfigurationType getConfigurationType() {
    if (runtimeManager.isDebugMode()) {
        return RuntimeConfigurationType.DEVELOPMENT;
    }//from w w  w  .  j  av a  2 s .co m
    return RuntimeConfigurationType.DEPLOYMENT;
}

From source file:com.google.code.jqwicket.Utils.java

License:Apache License

/**
 * Returns true, if wicket runs in development mode. Otherwise returns false.
 *
 * @return true, if wicket runs in development mode. Otherwise returns false.
 *//*  w w  w.  ja  v  a  2s.com*/
public static boolean isDevelopmentMode() {
    return RuntimeConfigurationType.DEVELOPMENT.equals(Application.get().getConfigurationType());
}

From source file:com.przemo.projectmanagementweb.Application.java

@Override
public RuntimeConfigurationType getConfigurationType() {
    Properties applicationProperties = new Properties();
    try {/*from  ww w.  j  a  v  a 2  s. com*/
        applicationProperties.load(this.getClass().getResourceAsStream("application.properties"));
        String dm = applicationProperties.get(DEPLOYMENT_MODE).toString();
        return dm.equals("deployment") ? RuntimeConfigurationType.DEPLOYMENT
                : RuntimeConfigurationType.DEVELOPMENT;
    } catch (IOException ex) {
        Logger.getLogger(Application.class.getName()).log(Level.SEVERE, null, ex);
    }
    return super.getConfigurationType();
}

From source file:com.tysanclan.site.projectewok.TysanPage.java

License:Open Source License

public TysanPage(String title, IModel<?> model) {
    super(model);

    notificationWindow = new Dialog("notificationWindow");
    notificationWindow.setTitle("Urgent Message");
    notificationWindow.setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true);

    notificationWindow.add(new ComponentFeedbackPanel("messages", notificationWindow).setOutputMarkupId(true)
            .setOutputMarkupPlaceholderTag(true));
    notificationWindow.setAutoOpen(false);
    notificationWindow.setVisible(false);

    add(notificationWindow);//  w w w .j  a  va 2  s .c o  m

    headerLabel = new Label("header", title);
    titleLabel = new Label("title", title + getTitleSuffix());

    headerLabel.setEscapeModelStrings(false);
    titleLabel.setEscapeModelStrings(false);

    add(headerLabel);
    add(titleLabel);
    add(new FeedbackPanel("feedback").setOutputMarkupId(true));

    Dialog window = new Dialog("debugWindow");
    window.setTitle("Debug Information");
    window.add(new DebugWindow("debugPanel", this.getPageClass()));
    window.setWidth(600);
    window.setHeight(300);
    window.setResizable(false);

    window.add(new AjaxLink<Void>("magicpushbutton") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {

        }

    }.setVisible(ENABLE_MAGIC_PUSHTBUTTON));

    add(window);

    add(new AjaxLink<Dialog>("debugLink", new Model<Dialog>(window)) {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            Dialog _window = getModelObject();
            target.appendJavaScript(_window.open().render().toString());

        }

    }.setVisible(Application.get().getConfigurationType() == RuntimeConfigurationType.DEVELOPMENT));

    User u = getTysanSession().getUser();
    WebMarkupContainer subMenu = new WebMarkupContainer("topMenu");
    if (u != null) {
        if (MemberUtil.isMember(u)) {
            topPanel = new WebMarkupContainer("topbar");
            subMenu = new TysanMemberPanel("topMenu", u);
        } else {
            topPanel = new WebMarkupContainer("topbar");
            subMenu = new TysanUserPanel("topMenu", u);
        }
    } else {
        topPanel = new TysanLoginPanel("topbar");
    }
    add(new TysanMenu("menu", u != null));
    add(subMenu);

    add(topPanel);

    add(new Label("version", TysanApplication.getApplicationVersion()));

    if (u != null) {
        get("version").add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(30)) {
            private static final long serialVersionUID = 1L;

            /**
             * @see org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior#onPostProcessTarget(org.apache.wicket.ajax.AjaxRequestTarget)
             */
            @Override
            protected void onPostProcessTarget(AjaxRequestTarget target) {
                Dialog d = getNotificationWindow();
                TysanSession t = TysanSession.get();
                int i = 0;

                for (SiteWideNotification swn : TysanApplication.get().getActiveNotifications()) {
                    if (t != null && !t.notificationSeen(swn)) {
                        swn.display(d);
                        i++;
                    }
                }

                if (i > 0) {
                    d.setAutoOpen(true);
                    d.setVisible(true);
                    target.add(d);
                    getNotificationWindow().open(target);
                }
            }
        });

    }
    addAnimalPanel();

    add(new Label("year", LocalDate.now().getYear()).setRenderBodyOnly(true));
    add(new WebMarkupContainer("texas").setVisible(isAprilFoolsDay(2017)));
}

From source file:com.userweave.pages.test.jquery.JQuery.java

License:Open Source License

public static boolean addKonquerorHacks(final Page page, IHeaderResponse response) {
    if (page.getSession().getClientInfo() instanceof WebClientInfo
            && ((WebClientInfo) page.getSession().getClientInfo()).getProperties().isBrowserKonqueror()) {
        page.add(new Behavior() {
            private static final long serialVersionUID = 1L;

            @Override//from   www  .  j a v  a 2s . c o m
            public void renderHead(Component component, IHeaderResponse response) {
                response.renderCSSReference(
                        new PackageResourceReference(BasePageSurvey.class, "konquerorhacks.css"));

                if (page.getApplication().getConfigurationType().equals(RuntimeConfigurationType.DEVELOPMENT)) {
                    response.renderJavaScriptReference(
                            "http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js");
                }
            }
        });

        return true;
    }

    return false;
}

From source file:cz.zcu.kiv.eegdatabase.wui.app.EEGDataBaseApplication.java

License:Apache License

@Override
public RuntimeConfigurationType getConfigurationType() {

    return development ? RuntimeConfigurationType.DEVELOPMENT : RuntimeConfigurationType.DEPLOYMENT;
}

From source file:de.alpharogroup.wicket.base.application.BaseWebApplication.java

License:Apache License

/**
 * Checks if is on development mode./*from  w  ww  .  java2  s . co  m*/
 *
 * @return true, if is on development mode
 */
public boolean isOnDevelopmentMode() {
    return getConfigurationType().equals(RuntimeConfigurationType.DEVELOPMENT);
}

From source file:de.alpharogroup.wicket.base.application.BaseWebApplication.java

License:Apache License

/**
 * Sets the application configurations.//from  ww w.  j  av  a 2s. c  o m
 */
protected void onApplicationConfigurations() {
    // set configuration before the application configuration...
    onBeforeApplicationConfigurations();
    // set global configurations for both development and deployment mode...
    onGlobalSettings();
    // set configuration for development...
    if (RuntimeConfigurationType.DEVELOPMENT.equals(this.getConfigurationType())) {
        onDevelopmentModeSettings();
    }
    // set configuration for deployment...
    if (RuntimeConfigurationType.DEPLOYMENT.equals(this.getConfigurationType())) {
        onDeploymentModeSettings();
    }
}

From source file:de.alpharogroup.wicket.base.util.application.ApplicationExtensions.java

License:Apache License

/**
 * Sets the RootRequestMapper for the given application from the given httpPort and httpsPort.
 * Note: if the configuration type is RuntimeConfigurationType.DEVELOPMENT then only HTTP scheme
 * will be returned.//from w  w w .  j  a  va2s  . c  o m
 *
 * @param application
 *            the application
 * @param httpPort
 *            the http port
 * @param httpsPort
 *            the https port
 */
public static void setRootRequestMapperForDevelopment(final Application application, final int httpPort,
        final int httpsPort) {
    application.setRootRequestMapper(
            new HttpsMapper(application.getRootRequestMapper(), new HttpsConfig(httpPort, httpsPort)) {
                @Override
                protected Scheme getDesiredSchemeFor(final Class<? extends IRequestablePage> pageClass) {
                    if (application.getConfigurationType().equals(RuntimeConfigurationType.DEVELOPMENT)) {
                        // is in development mode, returning Scheme.HTTP...
                        return Scheme.HTTP;
                    } else {
                        // not in development mode, letting the mapper decide
                        return super.getDesiredSchemeFor(pageClass);
                    }
                }
            });
}