Package org.apache.isis.core.runtime.userprofile

Examples of org.apache.isis.core.runtime.userprofile.Options


    @Override
    public void write(final Writer writer) throws IOException {
        final StringBuffer xml = new StringBuffer();
        xml.append("<profile>\n");

        final Options options = userProfile.getOptions();
        writeOptions(xml, options, null, 0);

        xml.append("  <perspectives>\n");
        for (final String perspectiveName : userProfile.list()) {
            final PerspectiveEntry perspective = userProfile.getPerspective(perspectiveName);
View Full Code Here


                if (tagName.equals("option")) {
                    optionName = attributes.getValue("id");
                    data.setLength(0);
                } else if (tagName.equals("options")) {
                    final String optionsName = attributes.getValue("id");
                    final Options newOptions = new Options();
                    options.peek().addOptions(optionsName, newOptions);
                    options.push(newOptions);
                } else {
                    throw new SAXException("Invalid element in options: " + tagName);
                }
View Full Code Here

        assertLine("    <option id=\"option1\">value1</option>", 3);
    }

    @Test
    public void recursiveOptions() throws Exception {
        final Options options = new Options();
        options.addOption("option2", "value2");
        profile.getOptions().addOptions("option1", options);
        assertLine("    <options id=\"option1\">", 2);
        assertLine("      <option id=\"option2\">value2</option>", 3);
        assertLine("    </options>", 4);
    }
View Full Code Here

        assertLine("    </options>", 4);
    }

    @Test
    public void emptyOptionsAreIgnored() throws Exception {
        final Options options = new Options();
        profile.getOptions().addOptions("option1", options);
        debug();
        assertLine("  </options>", 2);
    }
View Full Code Here

        assertEquals(30, profile.getOptions().getInteger("width", 30));
    }

    @Test
    public void unknownOptionsCreated() throws Exception {
        final Options options = profile.getOptions().getOptions("");
        assertNotNull(options);
        assertEquals(false, options.names().hasNext());
    }
View Full Code Here

        assertEquals(false, options.names().hasNext());
    }

    @Test
    public void containedOptions() throws Exception {
        final Options options = profile.getOptions().getOptions("opts");
        assertNotNull(options);
        assertEquals("value1", options.getString("option1"));
        assertEquals("value2", options.getString("option2"));
    }
View Full Code Here

        assertEquals("value2", options.getString("option2"));
    }

    @Test
    public void recursiveOptions() throws Exception {
        Options options = profile.getOptions().getOptions("opts");
        options = options.getOptions("options3");
        assertEquals("value4", options.getString("option4"));
        assertEquals("value5", options.getString("option5"));
    }
View Full Code Here

    public static String getDefaultCollectionViewOptions() {
        return getString("view.collection-default");
    }

    public static Options getViewConfigurationOptions(final ViewSpecification specification) {
        final Options settingsOptions = getOptions("views.configuration");
        final String specificationName = specification.getName();
        return settingsOptions.getOptions(specificationName);
    }
View Full Code Here

        final String specificationName = specification.getName();
        return settingsOptions.getOptions(specificationName);
    }

    public static Options getDefaultViewOptions(final ObjectSpecification specification) {
        final Options settingsOptions = getOptions("views.type-default");
        String name;
        if (specification.isCollection()) {
            name = "collection:" + specification.getFacet(TypeOfFacet.class).valueSpec().getFullIdentifier();
        } else {
            name = specification.getFullIdentifier();
        }
        final Options viewOptions = settingsOptions.getOptions(name);
        return viewOptions;
    }
View Full Code Here

        final Options viewOptions = settingsOptions.getOptions(name);
        return viewOptions;
    }

    public static Options getUserViewSpecificationOptions(final String specificationName) {
        final Options settingsOptions = getOptions("views.user-defined");
        return settingsOptions.getOptions(specificationName);
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.core.runtime.userprofile.Options

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.