Package org.apache.pivot.util

Examples of org.apache.pivot.util.Resources


        if (language != null) {
            Locale.setDefault(new Locale(language));
        }

        // Load and bind to the WTKX source
        Resources resources = new Resources(getClass().getName(), "UTF-8");
        WTKXSerializer wtkxSerializer = new WTKXSerializer(resources);
        window = (Window)wtkxSerializer.readObject(this, "stocktracker.wtkx");
        wtkxSerializer.bind(this, StockTracker.class);

        // Wire up event handlers
View Full Code Here


        String src = properties.get(SRC_KEY);
        if (src == null) {
            throw new IllegalArgumentException(SRC_KEY + " argument is required.");
        }

        Resources resources = null;
        if (properties.containsKey(RESOURCES_KEY)) {
            resources = new Resources(properties.get(RESOURCES_KEY));
        }

        WTKXSerializer wtkxSerializer = new WTKXSerializer(resources);

        ClassLoader classLoader = ThreadUtilities.getClassLoader();
View Full Code Here

        fileBrowserSheet.setMinimumPreferredHeight(180);

        final FileBrowserSheet.Mode mode = fileBrowserSheet.getMode();

        // Load the sheet content
        Resources resources;
        try {
            resources = new Resources(getClass().getName());
        } catch (IOException exception) {
            throw new RuntimeException(exception);
        } catch (SerializationException exception) {
            throw new RuntimeException(exception);
        }
View Full Code Here

    @Override
    public void startup(Display display, Map<String, String> properties) throws Exception {
        String language = properties.get(LANGUAGE_KEY);
        Locale locale = (language == null) ? Locale.getDefault() : new Locale(language);
        Resources resources = new Resources(StockTrackerWindow.class.getName(), locale);

        BXMLSerializer bxmlSerializer = new BXMLSerializer();
        window = (StockTrackerWindow)bxmlSerializer.readObject(getClass().getResource("stock_tracker_window.bxml"),
            resources);
        window.open(display);
View Full Code Here

    private void loadResources(String className) {
        try {
            // load some resources here, just to show its usage from JS files,
            // but only if not already loaded ...
            if (resources == null) {
                resources = new Resources(MAIN_CLASS_NAME, locale);
                logObject("buildResources, load resources from "
                    + "\""
                    + ((className != null && className.length() > 0) ? className : MAIN_CLASS_NAME// set a useful default
                    + "\", with locale " + locale
                );
View Full Code Here

    @Override
    public void startup(Display display, Map<String, String> properties) throws Exception {
        String language = properties.get(LANGUAGE_KEY);
        Locale locale = (language == null) ? Locale.getDefault() : new Locale(language);
        Resources resources = new Resources(getClass().getName(), locale);

        Theme theme = Theme.getTheme();
        Font font = theme.getFont();

        // Search for a font that can support the sample string
        String sampleResource = (String)resources.get("firstName");
        if (font.canDisplayUpTo(sampleResource) != -1) {
            Font[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();

            for (int i = 0; i < fonts.length; i++) {
                if (fonts[i].canDisplayUpTo(sampleResource) == -1) {
View Full Code Here

    private Resources parent;
    private Resources main;

    @Before
    public void before() throws Exception {
        parent = new Resources(getClass().getName() + "Parent");
        assertNotNull("From parent", parent.get("parentKeyString"));
        main = new Resources(parent, getClass().getName(), Locale.ENGLISH);
    }
View Full Code Here

    }

    @Test
    public void testConstructors() throws Exception {
        main = new Resources(parent, getClass().getName(), Charset.defaultCharset());
        testString();

        main = new Resources(parent, getClass().getName(), Charset.defaultCharset());
        testString();

        main = new Resources(parent, getClass().getName(), Locale.ENGLISH);
        testString();

        main = new Resources(parent, getClass().getName(), Locale.ENGLISH, Charset.defaultCharset());
        testString();

        main = new Resources(parent, getClass().getName(), Locale.ENGLISH,
            Charset.defaultCharset());
        testString();

    }
View Full Code Here

        // throw a nice error so the user knows which resource did not load
        URL locationLocal = baseType.getResource(resourceName);
        if (locationLocal == null) {
            throw new IllegalArgumentException("could not find resource \"" + resourceName + "\".");
        }
        return readObject(locationLocal, localize ? new Resources(baseType.getName()) : null);
    }
View Full Code Here

                    String variableValue = JSON.get(namespace, src);
                    src = variableValue;
                }
            }

            Resources resourcesLocal = this.resources;
            if (element.properties.containsKey(INCLUDE_RESOURCES_ATTRIBUTE)) {
                resourcesLocal = new Resources(resourcesLocal,
                    element.properties.get(INCLUDE_RESOURCES_ATTRIBUTE));
            }

            String mimeType = null;
            if (element.properties.containsKey(INCLUDE_MIME_TYPE_ATTRIBUTE)) {
View Full Code Here

TOP

Related Classes of org.apache.pivot.util.Resources

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.