Package se.kth.speech.skatta.util

Examples of se.kth.speech.skatta.util.ExtendedElement


            m_designer.show(Designer.FINAL_FORM);
        }
    }

    public ExtendedElement save(ExtendedElement parent) {
        ExtendedElement e = parent.getOrCreateChildWithName("dragdropTest");
        e.setAttribute("required", m_requiredButton.isSelected() ? "true" : "false");
        if (m_replayButton.isSelected())
            e.setAttribute("replay", "true");
        e.setAttribute("columns", m_columnsField.getValue().toString());
        if (((Integer) m_copiesField.getValue()).intValue() != 0)
            e.setAttribute("copies", m_copiesField.getValue().toString());
        m_questions.save(e);
        return e;
    }
View Full Code Here


    public ExtendedElement save(ExtendedElement parent) {
        parent.setAttribute("name", m_nameField.getText());
        if (m_passwordField.getText().length() != 0)
            parent.setAttribute("password", m_passwordField.getText());
        ExtendedElement buttonsElement = parent.createChildWithName("buttons");
        buttonsElement.setAttribute("up", m_upField.getText());
        buttonsElement.setAttribute("down", m_downField.getText());
        buttonsElement.setAttribute("next", m_nextField.getText());
        buttonsElement.setAttribute("previous", m_previousField.getText());
        buttonsElement.setAttribute("start", m_startField.getText());
        buttonsElement.setAttribute("end", m_endField.getText());
        parent.createChildWithNameAndText("results", m_resultsField.getText());
        parent.createChildWithNameAndText("stimuli", m_stimuliField.getText());

        ExtendedElement mainElement;
        if (m_standardButton.isSelected())
            mainElement = parent.getOrCreateChildWithName("standardTest");
        else if (m_ddButton.isSelected())
            mainElement = parent.getOrCreateChildWithName("dragdropTest");
        else
            mainElement = parent.getOrCreateChildWithName("timesyncTest");
        mainElement.createChildWithNameAndText("header", m_headerField.getText());
        if (((Integer) m_pauseDelayField.getValue()).intValue() != 0) {
            ExtendedElement pauseElement = mainElement.createChildWithNameAndText("pause", m_pauseMessageField.getText());
            pauseElement.setAttribute("delay", ((Integer) m_pauseDelayField.getValue()).toString());
            pauseElement.setAttribute("unit", m_pauseMinutesButton.isSelected() ? "minutes" : "pages");
        }
        return parent;
    }
View Full Code Here

    }

    public void load(ExtendedElement e) {
        m_nameField.setText(e.attribute("name"));
        m_passwordField.setText(e.attribute("password"));
        ExtendedElement buttons = e.child("buttons");
        m_upField.setText(buttons.attribute("up"));
        m_downField.setText(buttons.attribute("down"));
        m_nextField.setText(buttons.attribute("next"));
        m_previousField.setText(buttons.attribute("previous"));
        m_startField.setText(buttons.attribute("start"));
        m_endField.setText(buttons.attribute("end"));
        m_resultsField.setText(e.textChild("results"));
        m_stimuliField.setText(e.textChild("stimuli"));

        ExtendedElement main = e.child("standardTest");
        if (main != null)
            m_standardButton.setSelected(true);
        else {
            main = e.child("dragdropTest");
            if (main != null)
                m_ddButton.setSelected(true);
            else {
                main = e.child("timesyncTest");
                m_syncButton.setSelected(true);
            }
        }
        m_headerField.setText(main.textChild("header"));
        ExtendedElement pause = main.child("pause");
        if (pause != null) {
            m_pauseMessageField.setText(pause.text());
            m_pauseDelayField.setValue(new Integer(pause.intAttribute("delay")));
            if (pause.attribute("unit").equals("minutes"))
                m_pauseMinutesButton.setSelected(true);
            else m_pausePagesButton.setSelected(true);
        }
    }
View Full Code Here

    public void removeUpdate(DocumentEvent e) {
        insertUpdate(e);
    }

    public ExtendedElement save(ExtendedElement parent) {
        ExtendedElement e = parent.createChildWithName("dropfield");
        e.setAttribute("name", m_nameField.getText());
        e.setAttribute("background", m_backgroundField.getText());
        if (m_leftField.getText().length() != 0)
            e.setAttribute("left", m_leftField.getText());
        if (m_rightField.getText().length() != 0)
            e.setAttribute("right", m_rightField.getText());
        if (m_topField.getText().length() != 0)
            e.setAttribute("top", m_topField.getText());
        if (m_bottomField.getText().length() != 0)
            e.setAttribute("bottom", m_bottomField.getText());
        return e;
    }
View Full Code Here

        add(m_requiredButton);
    }

    public ExtendedElement save(ExtendedElement parent) {
        ExtendedElement e = super.save(parent);
        if (m_requiredButton.isSelected())
            e.setAttribute("required", "true");
        return e;
    }
View Full Code Here

     */
    public TestPlayer(File testFile) throws Exception {
        super("Skatta", GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration());
        myDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();

        ExtendedElement parser = new ExtendedElement(testFile.toURI().toString());

        //String testName = parser.get("test.testHeader.name")[0];
        setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        exitOnDispose = false;
        setUndecorated(true);
        //myFrame.pack();
        setExtendedState(JFrame.MAXIMIZED_BOTH);
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        //myFrame.setBounds(0, 0, 800, 600);
        setBounds(0, 0, screenSize.width, screenSize.height);

        //myFrame.setVisible(true);


        try {
            while (parser.name().equals("testgroup")) {
                String[] choices = parser.textChildren("choice");
                int randChoice = new java.util.Random().nextInt(choices.length);
                File f = parser.pathToFile(choices[randChoice]);
                parser = new ExtendedElement(f.toURL().toURI().toString());
            }
            Test test;
            if (parser.child("standardTest") != null)
                test = new StandardTest(parser, getSize());
            else if (parser.child("timesyncTest") != null)
                test = new SyncTest(parser, getSize());
            else test = new DragDropTest(parser, getSize());

            test.setFocusable(true);

View Full Code Here

        add(columnsLabel);
        add(m_columnsField, "wrap");
    }

    public ExtendedElement save(ExtendedElement parent) {
        ExtendedElement e = super.save(parent);
        if (m_requiredButton.isSelected())
            e.setAttribute("required", "true");
        if (((Integer) m_columnsField.getValue()).intValue() != 1)
            e.setAttribute("columns", m_columnsField.getValue().toString());
        String[] choices = m_optionsField.getText().split("[\n\r]+");
        for (String choice : choices) {
            if (choice.length() != 0)
                e.createChildWithNameAndText("choice", choice);
        }

        return e;
    }
View Full Code Here

        add(m_horizontalButton, "split 2");
        add(m_verticalButton);
    }

    public ExtendedElement save(ExtendedElement parent) {
        ExtendedElement e = super.save(parent);
        if (m_requiredButton.isSelected())
            e.setAttribute("required", "true");
        if (m_lowField.getText().length() != 0)
            e.setAttribute("lowLabel", m_lowField.getText());
        if (m_highField.getText().length() != 0)
            e.setAttribute("highLabel", m_highField.getText());
        String startpos;
        if (m_minButton.isSelected()) startpos = "min";
        else if (m_maxButton.isSelected()) startpos = "max";
        else if (m_centerButton.isSelected()) startpos = "mid";
        else startpos = "rand";
        e.setAttribute("start", startpos);
        if (m_verticalButton.isSelected())
            e.setAttribute("orientation", "vertical");
        e.setAttribute("steps", m_stepsField.getValue().toString());
        if (m_lockButton.isSelected())
            e.setAttribute("lockedToSteps", "true");
        return e;
    }
View Full Code Here

            }
        }
    }

    public ExtendedElement save(ExtendedElement parent) {
        ExtendedElement e = parent.createChildWithName("final");
        e.createChildWithNameAndText("header", m_headerField.getText());
        e.setAttribute("finalMessage", m_finalField.getText());
        m_questions.save(e);
        ExtendedElement questionsNode = e.child("questions");
        ExtendedElement emailWrapperNode = questionsNode == null ? null : questionsNode.child("questions");
        ExtendedElement emailNode = emailWrapperNode == null ? null : emailWrapperNode.child("emailNotification");
        if (emailNode != null) {
            Node emptyGroup = emailNode.getParentNode();
            e.getParentNode().appendChild(emailNode.getElement());
            emptyGroup.getParentNode().removeChild(emptyGroup);
        } else {
            Element emptyGroup = e.child("questions").child("questions").getElement();
            if (!emptyGroup.hasChildNodes())
                emptyGroup.getParentNode().removeChild(emptyGroup);
View Full Code Here

        m_headerField.setText(e.textChild("header"));
        m_finalField.setText(e.attribute("finalMessage"));
        m_questions.load(e.child("questions"));

        Question mailQuestion = new Question(Question.EMAIL, m_designer);
        ExtendedElement mail = e.getSiblingNode(Question.getTypeName(Question.EMAIL));
        if (mail != null)
            mailQuestion.load(mail);
        m_questions.add(mailQuestion);

        QuestionGroup lockedGroup = new QuestionGroup(null, m_designer);
View Full Code Here

TOP

Related Classes of se.kth.speech.skatta.util.ExtendedElement

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.