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

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


        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


    @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

        if (getContent() instanceof RootObject || getContent() instanceof RootCollection) {
            options.add(new UserActionAbstract("Use as default view for " + getContent().getSpecification().getSingularName(), ActionType.USER) {
                @Override
                public void execute(final Workspace workspace, final View view, final Location at) {
                    final Options viewOptions = Properties.getViewConfigurationOptions(getSpecification());
                    getView().saveOptions(viewOptions);

                    // Options viewOptions =
                    final ObjectSpecification specification = content.getSpecification();
                    final Options settingsOptions = Properties.getDefaultViewOptions(specification);
                    settingsOptions.addOption("spec", getSpecification().getName());
                }
            });
        }
        /*
         * options.add(new UserActionAbstract("Create new specification",
         * UserAction.USER) { // TODO probably needs to be a replace with new
         * view specification public void execute(final Workspace workspace,
         * final View view, final Location at) { UserViewSpecification newSpec =
         * new UserViewSpecification(getView()); Options viewOptions =
         * Properties.getViewConfigurationOptions(newSpec);
         * getView().saveOptions(viewOptions);
         *
         * viewOptions = Properties.getUserViewSpecificationOptions(newSpec);
         * viewOptions.addOption("wrapped-specification",
         * getSpecification().getClass().getName());
         *
         * Toolkit.getViewFactory().addSpecification(newSpec); } });
         */
        options.add(new UserActionAbstract("Save specification", ActionType.USER) {
            @Override
            public void execute(final Workspace workspace, final View view, final Location at) {
                final Options viewOptions = Properties.getViewConfigurationOptions(getSpecification());
                getView().saveOptions(viewOptions);

                Toolkit.getViewFactory().addSpecification(getSpecification());
            }
        });
View Full Code Here

                        final View newView = newSpec.createView(content, view.getViewAxes(), -1);
                        LOG.debug("open view " + newView);
                        workspace.addWindow(newView, new Placement(view));
                        workspace.markDamaged();

                        Options viewOptions = Properties.getViewConfigurationOptions(newSpec);
                        newView.saveOptions(viewOptions);
                        viewOptions = Properties.getUserViewSpecificationOptions(newSpec.getName());
                        viewOptions.addOption("design", specification.getClass().getName());

                        Toolkit.getViewFactory().addSpecification(newSpec);
                    }
                };
View Full Code Here

    private Options options;
    private Options suboptions;

    @Before
    public void setup() throws Exception {
        suboptions = new Options();
        suboptions.addOption("name-3", "value-2");

        options = new Options();
        options.addOption("test", "value");
        options.addOption("anInt", "23");
        options.addOptions("suboptions", suboptions);
    }
View Full Code Here

        assertTrue(names.hasNext());
    }

    @Test
    public void copy() throws Exception {
        final Options copy = new Options();
        copy.copy(options);
        assertEquals("value", copy.getString("test"));
    }
View Full Code Here

        assertEquals("value", copy.getString("test"));
    }

    @Test
    public void addOptions() throws Exception {
        final Options suboptions = options.getOptions("suboptions");
        assertEquals("value-2", suboptions.getString("name-3"));
    }
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.