com.vaadin.client.ApplicationConfiguration Java Examples

The following examples show how to use com.vaadin.client.ApplicationConfiguration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CubaUIConnector.java    From cuba with Apache License 2.0 6 votes vote down vote up
public CubaUIConnector() {
    VNotification.setRelativeZIndex(true);

    //noinspection Convert2Lambda
    registerRpc(CubaUIClientRpc.class, new CubaUIClientRpc() {
        @Override
        public void updateSystemMessagesLocale(Map<String, String> localeMap) {
            ApplicationConfiguration conf = getConnection().getConfiguration();
            ApplicationConfiguration.ErrorMessage communicationError = conf.getCommunicationError();
            communicationError.setCaption(localeMap.get(CubaUIClientRpc.COMMUNICATION_ERROR_CAPTION_KEY));
            communicationError.setMessage(localeMap.get(CubaUIClientRpc.COMMUNICATION_ERROR_MESSAGE_KEY));

            ApplicationConfiguration.ErrorMessage authError = conf.getAuthorizationError();
            authError.setCaption(localeMap.get(CubaUIClientRpc.AUTHORIZATION_ERROR_CAPTION_KEY));
            authError.setMessage(localeMap.get(CubaUIClientRpc.AUTHORIZATION_ERROR_MESSAGE_KEY));

            ApplicationConfiguration.ErrorMessage sessionExpiredError = conf.getSessionExpiredError();
            sessionExpiredError.setCaption(localeMap.get(CubaUIClientRpc.SESSION_EXPIRED_ERROR_CAPTION_KEY));
            sessionExpiredError.setMessage(localeMap.get(CubaUIClientRpc.SESSION_EXPIRED_ERROR_MESSAGE_KEY));
        }
    });
}
 
Example #2
Source File: SockJSPushConnection.java    From vertx-vaadin with MIT License 5 votes vote down vote up
private String getVersionedPushJs() {
    String pushJs;
    if (ApplicationConfiguration.isProductionMode()) {
        pushJs = "vaadinPushSockJS.js";
    } else {
        pushJs = "vaadinPushSockJS.debug.js";
    }
    // Parameter appended to bypass caches after version upgrade.
    pushJs += "?v=" + Version.getFullVersion();
    return pushJs;
}
 
Example #3
Source File: Bootstrapper.java    From flow with Apache License 2.0 5 votes vote down vote up
private static void doStartApplication(final String applicationId) {
    Profiler.enter("Bootstrapper.startApplication");
    ApplicationConfiguration appConf = getConfigFromDOM(applicationId);
    ApplicationConnection applicationConnection = new ApplicationConnection(
            appConf);
    runningApplications.push(applicationConnection);
    Profiler.leave("Bootstrapper.startApplication");

    ValueMap initialUidl = getJsoConfiguration(applicationId).getUIDL();
    applicationConnection.start(initialUidl);
}
 
Example #4
Source File: GwtAtmoshperePushConnectionTest.java    From flow with Apache License 2.0 5 votes vote down vote up
@Override
protected void gwtSetUp() throws Exception {
    super.gwtSetUp();

    initScheduler(new CustomScheduler());

    registry = new Registry() {
        {
            set(ConstantPool.class, new ConstantPool());
            set(StateTree.class, new StateTree(this));
            set(URIResolver.class, new URIResolver(this));
            set(UILifecycle.class, new UILifecycle());
            set(ApplicationConfiguration.class,
                    new ApplicationConfiguration());
            set(MessageHandler.class, new MessageHandler(this));
            set(PushConfiguration.class, new PushConfiguration(this) {
                @Override
                public JsMap<String, String> getParameters() {
                    return JsCollections.map();
                }
            });
            set(ConnectionStateHandler.class,
                    new DefaultConnectionStateHandler(this));
        }
    };

}
 
Example #5
Source File: Bootstrapper.java    From flow with Apache License 2.0 4 votes vote down vote up
/**
 * Reads the configuration values defined by the bootstrap JavaScript.
 *
 * @param conf
 */
private static void populateApplicationConfiguration(
        ApplicationConfiguration conf, JsoConfiguration jsoConfiguration) {

    /*
     * Resolve potentially relative URLs to ensure they point to the desired
     * locations even if the base URL of the page changes later (e.g. with
     * pushState)
     */
    String serviceUrl = jsoConfiguration
            .getConfigString(ApplicationConstants.SERVICE_URL);

    conf.setWebComponentMode(jsoConfiguration
            .getConfigBoolean(ApplicationConstants.APP_WC_MODE));

    conf.setClientRouting(
            jsoConfiguration.getConfigBoolean(ApplicationConstants.CLIENT_ROUTING));

    if (serviceUrl == null) {
        conf.setServiceUrl(WidgetUtil.getAbsoluteUrl("."));
        conf.setContextRootUrl(WidgetUtil.getAbsoluteUrl(jsoConfiguration
                .getConfigString(ApplicationConstants.CONTEXT_ROOT_URL)));

    } else {
        conf.setServiceUrl(serviceUrl);
        conf.setContextRootUrl(WidgetUtil.getAbsoluteUrl(
                serviceUrl + jsoConfiguration.getConfigString(
                        ApplicationConstants.CONTEXT_ROOT_URL)));
    }

    conf.setUIId(jsoConfiguration
            .getConfigInteger(ApplicationConstants.UI_ID_PARAMETER)
            .intValue());

    conf.setHeartbeatInterval(
            jsoConfiguration.getConfigInteger("heartbeatInterval"));

    conf.setMaxMessageSuspendTimeout(
            jsoConfiguration.getConfigInteger("maxMessageSuspendTimeout"));

    conf.setServletVersion(jsoConfiguration.getVaadinVersion());
    conf.setAtmosphereVersion(jsoConfiguration.getAtmosphereVersion());
    conf.setAtmosphereJSVersion(jsoConfiguration.getAtmosphereJSVersion());
    conf.setSessionExpiredError(
            jsoConfiguration.getConfigError("sessExpMsg"));

    // Debug or production mode?
    conf.setProductionMode(!jsoConfiguration.getConfigBoolean("debug"));
    conf.setRequestTiming(
            jsoConfiguration.getConfigBoolean("requestTiming"));
    conf.setExportedWebComponents(
            jsoConfiguration.getConfigStringArray("webcomponents"));
}
 
Example #6
Source File: Bootstrapper.java    From flow with Apache License 2.0 3 votes vote down vote up
/**
 * Constructs an ApplicationConfiguration object based on the information
 * available in the DOM.
 *
 * @param appId
 *            the application id
 * @return an application configuration object containing the read
 *         information
 */
private static ApplicationConfiguration getConfigFromDOM(String appId) {
    ApplicationConfiguration conf = new ApplicationConfiguration();
    conf.setApplicationId(appId);
    populateApplicationConfiguration(conf, getJsoConfiguration(appId));
    return conf;
}