Package org.jsurveylib.model.question

Examples of org.jsurveylib.model.question.Choice


            NodeList choiceNodes = multiConfigElement.getElementsByTagName("choice");
            for (int i = 0; i < choiceNodes.getLength(); i++) {
                Element choiceNode = (Element) choiceNodes.item(i);
                String id = choiceNode.getAttribute("id");
                String label = choiceNode.getAttribute("label");
                Choice choice = qb.buildChoice(id, label);
                choices.add(choice);
            }
            return qb.buildRadioButtons(vertical, leftLabel, rightLabel, choices);
        } else if (questionTypeElement.getElementsByTagName("dropdown").getLength() == 1) {
            Element dropdownConfigElement = (Element) questionTypeElement.getElementsByTagName("dropdown").item(0);

            List<Choice> choices = new Vector<Choice>();
            NodeList choiceNodes = dropdownConfigElement.getElementsByTagName("choice");
            for (int i = 0; i < choiceNodes.getLength(); i++) {
                Element choiceNode = (Element) choiceNodes.item(i);
                String id = choiceNode.getAttribute("id");
                String label = choiceNode.getAttribute("label");
                Choice choice = qb.buildChoice(id, label);
                choices.add(choice);
            }
            return qb.buildDropdown(choices);
        } else if (questionTypeElement.getElementsByTagName("textField").getLength() == 1) {
            return qb.buildTextField();
View Full Code Here


    private void checkAgreementTemplate(Survey survey, String id) {
        RadioButtonsQuestion radio = (RadioButtonsQuestion) survey.getQuestionByID(id);
        assertFalse(radio.getLabel().getText().contains("TEMPLATE"));
        assertFalse(radio.getId().contains("TEMPLATE"));
        for (int i = 1; i <= 7; i++) {
            Choice c = radio.getChoices().get(i - 1);
            assertEquals(String.valueOf(i), c.getId());
            assertEquals(String.valueOf(i), c.getLabel());
        }

    }
View Full Code Here

    public void actionPerformed(ActionEvent e) {
        int index = dropdown.getSelectedIndex();
        //if there are no elements in the list this action gets triggered and the index becomes -1
        //if choices were just updated we don't want to set the type because that will retrigger the script
        if (index != -1) {
            Choice selected = type.getChoices().get(index);
            type.setAnswer(selected.getId());
        }
    }
View Full Code Here

        }

        //search the active element
        for (JRadioButton button : radioButtons) {
            if (button.isSelected()) {
                Choice choice = (Choice) button.getClientProperty("choice");
                type.setAnswer(choice.getId());
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.jsurveylib.model.question.Choice

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.