Package se.kth.speech.skatta.util

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


        return m_listComponent;
    }

    public ExtendedElement save(ExtendedElement parent) {
        if (!m_activeButton.isSelected()) return null;
        ExtendedElement e = parent.createChildWithName("mouseRecorder");
        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


        }
        m_list.repaint();
    }

    public ExtendedElement save(ExtendedElement parent) {
        ExtendedElement e = parent.createChildWithName("questions");
        LinkedList<ExtendedElement> qgElements = new LinkedList<ExtendedElement>();
        qgElements.add(e);
        int depth = 0;
        for (Question q : m_questions) {
            QuestionGroup qg = q.getGroup();
View Full Code Here

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

    public ExtendedElement save(ExtendedElement parent) {
        ExtendedElement e = parent.createChildWithName("questions");
        if (m_randomButton.isSelected())
            e.setAttribute("random", "true");
        if (((Integer) m_columnsField.getValue()).intValue() != 1)
            e.setAttribute("columns", m_columnsField.getValue().toString());
        return e;
    }
View Full Code Here

        return m_listComponent;
    }

    public ExtendedElement save(ExtendedElement parent) {
        if (!m_activeButton.isSelected()) return null;
        ExtendedElement e = parent.createChildWithName("nameSender");
        e.setAttribute("destination", m_destinationField.getText());
        e.setAttribute("port", m_portField.getValue().toString());
        return e;
    }
View Full Code Here

        add(optionsLabel, "aligny top, w 0");
        add(new JScrollPane(m_optionsField), "grow, pushy, h 20000");
    }

    public ExtendedElement save(ExtendedElement parent) {
        ExtendedElement e = super.save(parent);
        if (m_requiredButton.isSelected())
            e.setAttribute("required", "true");
        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

        m_listComponent = new JLabel(getName());
    }

    public ExtendedElement save(ExtendedElement parent) {
        ExtendedElement e = parent.createChildWithName(Question.getTypeName(m_typeMenu.getSelectedIndex()));
        e.setAttribute("name", m_questionField.getText());
        return e;
    }
View Full Code Here

            m_designer.show(Designer.FINAL_FORM);
        }
    }

    public ExtendedElement save(ExtendedElement parent) {
        ExtendedElement e = parent.getOrCreateChildWithName("standardTest");
        if (m_backButton.isSelected())
            e.setAttribute("backable", "true");
        if (m_loopButton.isSelected())
            e.setAttribute("looping", "true");
        if (((Integer) m_repeatField.getValue()).intValue() != 1)
            e.setAttribute("repetitions", m_repeatField.getValue().toString());
        if (m_stopButton.isSelected() || m_pauseButton.isSelected() || m_repeatButton.isSelected()) {
            ExtendedElement playControlElement = e.createChildWithName("playControls");
            if (m_stopButton.isSelected())
                playControlElement.setAttribute("stop", "true");
            if (m_pauseButton.isSelected())
                playControlElement.setAttribute("pause", "true");
            if (m_repeatButton.isSelected())
                playControlElement.setAttribute("autorepeat", "true");
        }
        if (((Integer) m_perPageField.getValue()).intValue() != 1)
            e.setAttribute("stimuliPerPage", m_perPageField.getValue().toString());
        e.setAttribute("stimulusHeight", m_heightField.getValue().toString());
View Full Code Here

    public void load(ExtendedElement e) {
        m_backButton.setSelected(e.booleanAttribute("backable"));
        m_loopButton.setSelected(e.booleanAttribute("looping"));
        m_repeatField.setValue(new Integer(e.intAttribute("repetitions")));
        ExtendedElement controls = e.child("playControls");
        if (controls != null) {
            m_stopButton.setSelected(controls.booleanAttribute("stop"));
            m_pauseButton.setSelected(controls.booleanAttribute("pause"));
            m_repeatButton.setSelected(controls.booleanAttribute("autorepeat"));
        }
        m_perPageField.setValue(new Integer(e.intAttribute("stimuliPerPage")));
        m_heightField.setValue(new Integer(e.intAttribute("stimulusHeight")));

        m_questions.load(e.child("questions"));
View Full Code Here

     * @param testFile The path to the stored test.
     */
    public Designer(URL testFile) throws ParserConfigurationException, SAXException, IOException, NullPointerException {
        this();
        try {
            ExtendedElement e = new ExtendedElement(testFile.toURI().toString());

            Form f = new InitialForm(this);
            f.load(e.child("initial"));
            m_majorForms[INITIAL_FORM] = f;

            f = new BasicsForm(this);
            f.load(e);
            m_majorForms[BASICS_FORM] = f;

            ExtendedElement main = e.child("standardTest");
            if (main != null) {
                f = new StandardTestForm(this);
                f.load(main);
            } else {
                main = e.child("dragdropTest");
View Full Code Here

                    this, file.getAbsolutePath() + " exists. Overwrite?", "Overwrite?", JOptionPane.YES_NO_OPTION) !=
                    JOptionPane.YES_OPTION)
                return false;
        }

        ExtendedElement testElement = new ExtendedElement(m_document.getDocumentElement(), null);
        for (Form f : m_majorForms) {
            f.save(testElement);
        }

        StreamResult result;
        try {
            result = new StreamResult(new FileOutputStream(file));
        } catch (IOException exc) {
            System.err.println(exc);
            return false;
        }

        TransformerFactory tFactory = TransformerFactory.newInstance();
        Transformer theTransformer;
        try {
            theTransformer = tFactory.newTransformer();
            theTransformer.setOutputProperty(OutputKeys.INDENT, "yes");
            //theTransformer.setOutputProperty(javax.xml.transform.OutputKeys.DOCTYPE_SYSTEM, "xml.dtd");
        } catch (TransformerConfigurationException e) {
            System.err.println(e);
            return false;
        }
        DOMSource source = new DOMSource(m_document);
        try {
            theTransformer.transform(source, result);
        } catch (TransformerException e) {
            System.err.println(e);
            return false;
        }
        testElement.getElement().setTextContent(null);
        return true;
  }
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.