Package org.apache.pivot.util

Examples of org.apache.pivot.util.Resources


        if (location == null) {
            throw new IllegalArgumentException("Cannot find source file \"" + src + "\".");
        }

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

        if (properties.containsKey(STYLESHEET_KEY)) {
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(RESOURCE_NAME, locale);
        System.out.println("Loaded Resources from: " + resources.getBaseName() + ", for locale " + locale);

        // Search for a font that can support the sample string
        String title = (String)resources.get("title");
        System.out.println("Title from Resources file is: \"" + title + "\"");

        BXMLSerializer bxmlSerializer = new BXMLSerializer();
        window = (Window)bxmlSerializer.readObject(RowEditorDemo.class.getResource("row_editor_demo.bxml"), resources);
        window.open(display);
View Full Code Here

            }

            calendarTablePane.getRows().add(calendarRow);
        }

        Resources resources;
        try {
            resources = new Resources(TerraCalendarSkin.class.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(RESOURCE_NAME, locale);
        System.out.println("Loaded Resources from: " + resources.getBaseName() + ", for locale " + locale);

        // Search for a font that can support the sample string
        String title = (String)resources.get("title");
        System.out.println("Title from Resources file is: \"" + title + "\"");

        BXMLSerializer bxmlSerializer = new BXMLSerializer();
        window = (Window)bxmlSerializer.readObject(RowEditorDemo.class.getResource("row_editor_demo.bxml"), resources);
        window.open(display);
View Full Code Here

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

                    + " tag.");
            }

            String src = element.properties.get(INCLUDE_SRC_ATTRIBUTE);

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

            String mimeType = null;
            if (element.properties.containsKey(INCLUDE_MIME_TYPE_ATTRIBUTE)) {
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

    @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 TableView tableView = null;

    @Override
    public void startup(Display display, Map<String, String> properties)
        throws Exception {
        Resources resources = new Resources(getClass().getName());
        WTKXSerializer wtkxSerializer = new WTKXSerializer(resources);
        window = (Window)wtkxSerializer.readObject(this, "demo.wtkx");
        tableView = (TableView)wtkxSerializer.get("tableView");

        TableViewRowEditor tableViewRowEditor = new TableViewRowEditor();
View Full Code Here

                if (element.type == Element.Type.INCLUDE) {
                    // Process attributes looking for src, resources, and static property
                    // setters only
                    String src = null;
                    Resources resources = this.resources;
                    boolean inline = false;

                    for (Attribute attribute : element.attributes) {
                        if (attribute.localName.equals(INCLUDE_SRC_ATTRIBUTE)) {
                            src = attribute.value;
                        } else if (attribute.localName.equals(INCLUDE_RESOURCES_ATTRIBUTE)) {
                            resources = new Resources(resources, attribute.value);
                        } else if (attribute.localName.equals(INCLUDE_INLINE_ATTRIBUTE)) {
                            inline = Boolean.parseBoolean(attribute.value);
                        } else {
                            if (!Character.isUpperCase(attribute.localName.charAt(0))) {
                                throw new SerializationException("Instance property setters are not"
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.