Package org.apache.pivot.json

Examples of org.apache.pivot.json.JSONSerializer.readObject()


        try {
            InputStream inputStream = stylesheetLocation.openStream();

            try {
                JSONSerializer serializer = new JSONSerializer();
                Map<String, ?> stylesheet = (Map<String, ?>)serializer.readObject(inputStream);

                for (String name : stylesheet) {
                    Map<String, ?> styles = (Map<String, ?>)stylesheet.get(name);

                    int i = name.lastIndexOf('.') + 1;
View Full Code Here


        try {
            InputStream inputStream = getClass().getResourceAsStream("terra_theme_styles.json");

            try {
                JSONSerializer serializer = new JSONSerializer();
                Map<String, ?> terraThemeStyles = (Map<String, ?>)serializer.readObject(inputStream);

                for (String name : terraThemeStyles) {
                    Component.getNamedStyles().put(packageName + "." + name, (Map<String, ?>)terraThemeStyles.get(name));
                }
            } finally {
View Full Code Here

        try {
            InputStream inputStream = location.openStream();

            try {
                JSONSerializer serializer = new JSONSerializer();
                Map<String, ?> properties = (Map<String, ?>)serializer.readObject(inputStream);

                font = Font.decode((String)properties.get("font"));

                List<String> colorCodes = (List<String>)properties.get("colors");
                numberOfPaletteColors = colorCodes.getLength();
View Full Code Here

        window.requestFocus();

        if (System.in.available() > 0) {
            JSONSerializer jsonSerializer = new JSONSerializer();
            try {
                setValue(jsonSerializer.readObject(System.in));
            } catch (Exception exception) {
                // No-op
            }
        }
    }
View Full Code Here

            && clipboardContent.containsText()) {
            String json = null;
            JSONSerializer jsonSerializer = new JSONSerializer();
            try {
                json = clipboardContent.getText();
                setValue(jsonSerializer.readObject(new StringReader(json)));
            } catch (Exception exception) {
                Prompt.prompt(exception.getMessage(), window);
            }

            window.setTitle(WINDOW_TITLE);
View Full Code Here

                JSONSerializer jsonSerializer = new JSONSerializer();
                FileInputStream fileInputStream = null;
                try {
                    try {
                        fileInputStream = new FileInputStream(file);
                        setValue(jsonSerializer.readObject(fileInputStream));
                    } finally {
                        if (fileInputStream != null) {
                            fileInputStream.close();
                        }
                    }
View Full Code Here

            public void buttonPressed(Button button) {
                JSONSerializer serializer = new JSONSerializer();
                InputStream inputStream = getClass().getResourceAsStream("contact.json");

                try {
                    form.load(serializer.readObject(inputStream));
                    sourceLabel.setText("JSON");
                } catch(Exception exception) {
                    System.err.println(exception);
                }
View Full Code Here

        if (inputStream != null) {
            JSONSerializer serializer = new JSONSerializer(this.charset);

            try {
                resourceMapFromResource = (Map<String, Object>)serializer.readObject(inputStream);
            } finally {
                inputStream.close();
            }
        }
View Full Code Here

                System.out.println("Read null");
            }
        };

        jsonSerializer.getJSONSerializerListeners().add(jsonSerializerListener);
        Object o1 = jsonSerializer.readObject(getClass().getResourceAsStream("map.json"));
        assertEquals(JSON.get(o1, "e.g"), 5);

        jsonSerializer.getJSONSerializerListeners().remove(jsonSerializerListener);
        Object o2 = jsonSerializer.readObject(getClass().getResourceAsStream("map.json"));
View Full Code Here

        jsonSerializer.getJSONSerializerListeners().add(jsonSerializerListener);
        Object o1 = jsonSerializer.readObject(getClass().getResourceAsStream("map.json"));
        assertEquals(JSON.get(o1, "e.g"), 5);

        jsonSerializer.getJSONSerializerListeners().remove(jsonSerializerListener);
        Object o2 = jsonSerializer.readObject(getClass().getResourceAsStream("map.json"));

        assertTrue(o1.equals(o2));

        List<?> d = JSON.get(o1, "d");
        d.remove(0, 1);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.