Package org.jsurveylib.model

Examples of org.jsurveylib.model.Page


    public List<Page> getPages() {
        List<Page> pages = new ArrayList<Page>();
        //read all pages
        NodeList pageNodes = xmlRoot.getElementsByTagName("page");
        for (int p = 0; p < pageNodes.getLength(); p++) {
            Page page = new Page();
            pages.add(page);
            Element pageNode = (Element) pageNodes.item(p);
            if (pageNode.hasAttribute("label")) {
                page.setLabel(pageNode.getAttribute("label"));
            }
            if (pageNode.hasAttribute("isSkipped")) {
                page.setSkipped(pageNode.getAttribute("isSkipped").trim().equals("true"));
            }

            try {
                parseSurveyElements(pageNode, page);
            } catch (Exception e) {
View Full Code Here


    public void insertQuestion(Question question, int pageNum, int row) {
        if (idMap.get(question.getId()) != null) {
            throw new IllegalArgumentException("Attempted to insert a question with an id that already exists: " + question.getId());
        }
        try {
            Page p = pages.get(pageNum);
            p.insertQuestion(question, row);
            idMap.put(question.getId(), question);
            fireQuestionInserted(question, pageNum, row);
        } catch (IndexOutOfBoundsException e) {
            IllegalArgumentException i = new IllegalArgumentException("Attempted to insert a question to an invalid page number.");
            i.initCause(e);
View Full Code Here

    }

    @Test
    public void pageOf() throws Exception {
        survey = new Survey(new XMLSurveyReader(new File("src\\test\\org\\jsurveylib\\surveyfiles\\pageof.xml")));
        Page p2 = survey.pageOf("task_comprehension1");
        checkPageNum(2, p2, survey);
        p2 = survey.pageOf("task_easyness3");
        checkPageNum(2, p2, survey);

        Page p3 = survey.pageOf("Y");
        checkPageNum(3, p3, survey);

        Page none = survey.pageOf("WWW");
        assertNull(none);
    }
View Full Code Here

        this.survey = survey;
    }

    public String[][] translate() {
        List<String[]> pageTranslation = new ArrayList<String[]>();
        Page currentPage = survey.getCurrentPage();
        pageTranslation.add(addPage(currentPage, survey.getCurrentPageNumber()));

        pageTranslation.add(addPreviousButton());
        pageTranslation.add(addNextButton());
        pageTranslation.add(addFinishButton());

        for (SurveyElement se : currentPage.getSurveyElements()) {
            if (se instanceof Label) {
                pageTranslation.add(addLabel((Label) se));
            }
            if (se instanceof Question) {
                if (se instanceof FileChooserQuestion) {
View Full Code Here

TOP

Related Classes of org.jsurveylib.model.Page

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.