Search in sources :

Example 6 with Configuration

use of com.haulmont.cuba.core.global.Configuration in project cuba by cuba-platform.

the class JmxLogControl method getLogFileLink.

@Override
public String getLogFileLink(String fileName) throws LogControlException {
    // check log file exists
    logControl.getLogFile(fileName);
    Configuration configuration = AppBeans.get(Configuration.NAME);
    GlobalConfig globalConfig = configuration.getConfig(GlobalConfig.class);
    String encodedFileName = URLEncodeUtils.encodeUtf8(fileName);
    return globalConfig.getDispatcherBaseUrl() + "/log/" + encodedFileName;
}
Also used : Configuration(com.haulmont.cuba.core.global.Configuration) GlobalConfig(com.haulmont.cuba.core.global.GlobalConfig)

Example 7 with Configuration

use of com.haulmont.cuba.core.global.Configuration in project cuba by cuba-platform.

the class DesktopAbstractUploadComponent method getActualFileSizeLimit.

protected long getActualFileSizeLimit() {
    final long maxSize;
    if (fileSizeLimit > 0) {
        maxSize = fileSizeLimit;
    } else {
        Configuration configuration = AppBeans.get(Configuration.NAME);
        final long maxUploadSizeMb = configuration.getConfig(ClientConfig.class).getMaxUploadSizeMb();
        maxSize = maxUploadSizeMb * BYTES_IN_MEGABYTE;
    }
    return maxSize;
}
Also used : Configuration(com.haulmont.cuba.core.global.Configuration) ClientConfig(com.haulmont.cuba.client.ClientConfig)

Example 8 with Configuration

use of com.haulmont.cuba.core.global.Configuration in project cuba by cuba-platform.

the class DesktopAbstractUploadField method getFileSizeLimitString.

protected String getFileSizeLimitString() {
    String fileSizeLimitString;
    if (fileSizeLimit > 0) {
        if (fileSizeLimit % BYTES_IN_MEGABYTE == 0) {
            fileSizeLimitString = String.valueOf(fileSizeLimit / BYTES_IN_MEGABYTE);
        } else {
            Datatype<Double> doubleDatatype = Datatypes.getNN(Double.class);
            double fileSizeInMb = fileSizeLimit / ((double) BYTES_IN_MEGABYTE);
            fileSizeLimitString = doubleDatatype.format(fileSizeInMb);
        }
    } else {
        Configuration configuration = AppBeans.get(Configuration.NAME);
        fileSizeLimitString = String.valueOf(configuration.getConfig(ClientConfig.class).getMaxUploadSizeMb());
    }
    return fileSizeLimitString;
}
Also used : Configuration(com.haulmont.cuba.core.global.Configuration) ClientConfig(com.haulmont.cuba.client.ClientConfig)

Example 9 with Configuration

use of com.haulmont.cuba.core.global.Configuration in project cuba by cuba-platform.

the class DesktopAbstractUploadField method getActualFileSizeLimit.

protected long getActualFileSizeLimit() {
    final long maxSize;
    if (fileSizeLimit > 0) {
        maxSize = fileSizeLimit;
    } else {
        Configuration configuration = AppBeans.get(Configuration.NAME);
        final long maxUploadSizeMb = configuration.getConfig(ClientConfig.class).getMaxUploadSizeMb();
        maxSize = maxUploadSizeMb * BYTES_IN_MEGABYTE;
    }
    return maxSize;
}
Also used : Configuration(com.haulmont.cuba.core.global.Configuration) ClientConfig(com.haulmont.cuba.client.ClientConfig)

Example 10 with Configuration

use of com.haulmont.cuba.core.global.Configuration in project cuba by cuba-platform.

the class TopLevelFrame method initUI.

protected void initUI() {
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    glassPane = new DisabledGlassPane();
    JRootPane rootPane = SwingUtilities.getRootPane(this);
    rootPane.setGlassPane(glassPane);
    Configuration configuration = AppBeans.get(Configuration.NAME);
    DesktopConfig config = configuration.getConfig(DesktopConfig.class);
    DesktopResources resources = App.getInstance().getResources();
    if (StringUtils.isNotEmpty(config.getWindowIcon())) {
        setIconImage(resources.getImage(config.getWindowIcon()));
    }
}
Also used : Configuration(com.haulmont.cuba.core.global.Configuration) DisabledGlassPane(com.haulmont.cuba.desktop.sys.DisabledGlassPane)

Aggregations

Configuration (com.haulmont.cuba.core.global.Configuration)34 ClientConfig (com.haulmont.cuba.client.ClientConfig)13 GlobalConfig (com.haulmont.cuba.core.global.GlobalConfig)9 WebConfig (com.haulmont.cuba.web.WebConfig)7 Messages (com.haulmont.cuba.core.global.Messages)4 File (java.io.File)4 IOException (java.io.IOException)4 DesktopConfig (com.haulmont.cuba.desktop.DesktopConfig)3 ThemeConstants (com.haulmont.cuba.gui.theme.ThemeConstants)3 VersionedThemeResource (com.haulmont.cuba.web.toolkit.VersionedThemeResource)3 AppBeans (com.haulmont.cuba.core.global.AppBeans)2 FileStorageException (com.haulmont.cuba.core.global.FileStorageException)2 FileUploadingAPI (com.haulmont.cuba.gui.upload.FileUploadingAPI)2 AppUI (com.haulmont.cuba.web.AppUI)2 WebWindowManager (com.haulmont.cuba.web.WebWindowManager)2 FileResource (com.vaadin.server.FileResource)2 Resource (com.vaadin.server.Resource)2 com.vaadin.ui (com.vaadin.ui)2 TextAttribute (java.awt.font.TextAttribute)2 FileOutputStream (java.io.FileOutputStream)2