Package org.apache.harmony.x.swing.text.html.form

Examples of org.apache.harmony.x.swing.text.html.form.FormOption


                    radioGroupped.put(name, buttonModel);
                }
            }

            private void handleOption(final Tag tag, final AttributeSet attr) {
                FormOption option = null;
                FormOptionGroup currentGroup = (selectModel != null) ? selectModel
                        .getRootOptionGroup().getCurrentGroup() : null;
                       
                if (Tag.OPTION.equals(tag)) {
                    option = new FormOption(currentGroup, attr);
                    openedBlocks.add(Tag.OPTION);
                } else if (Tag.OPTGROUP.equals(tag)) {
                    currentGroup = new FormOptionGroup(currentGroup, attr);
                    option = currentGroup;
                }
View Full Code Here


                    radioGroupped.put(name, buttonModel);
                }
            }

            private void handleOption(final Tag tag, final AttributeSet attr) {
                FormOption option = null;
                FormOptionGroup currentGroup = (selectModel != null) ? selectModel
                        .getRootOptionGroup().getCurrentGroup() : null;
                       
                if (Tag.OPTION.equals(tag)) {
                    option = new FormOption(currentGroup, attr);
                    openedBlocks.add(Tag.OPTION);
                } else if (Tag.OPTGROUP.equals(tag)) {
                    currentGroup = new FormOptionGroup(currentGroup, attr);
                    option = currentGroup;
                }
View Full Code Here

        attr.addAttribute(HTML.Attribute.SELECTED, "true");
        attr.addAttribute(HTML.Attribute.LABEL, label);
        action.start(Tag.OPTGROUP, attr);
        assertEquals(1, model.getSize());
        assertNotNull(model.getElementAt(0));
        FormOption option = (FormOption)model.getElementAt(0);
        assertFalse(option.isSelected());
        assertEquals(label, option.getLabel());
        assertNull(option.getValue());
        reader.handleText(text.toCharArray(), 0);
        assertEquals(1, model.getSize());
        assertNotNull(model.getElementAt(0));
        option = (FormOption)model.getElementAt(0);
        assertFalse(option.isSelected());
        assertEquals(label, option.getLabel());
        assertNull(option.getValue());
        assertEquals(0, option.getDepth());

        attr.addAttribute(HTML.Attribute.SELECTED, "true");
        attr.addAttribute(HTML.Attribute.VALUE, value);
        attr.addAttribute(HTML.Attribute.LABEL, label);
        action.start(Tag.OPTGROUP, attr);
        assertEquals(2, model.getSize());
        assertNotNull(model.getElementAt(1));
        option = (FormOption)model.getElementAt(1);
        assertFalse(option.isSelected());
        assertEquals(label, option.getLabel());
        assertNull(option.getValue());
        reader.handleText(text.toCharArray(), 0);
        assertEquals(2, model.getSize());
        assertNotNull(model.getElementAt(1));
        option = (FormOption)model.getElementAt(1);
        assertFalse(option.isSelected());
        assertEquals(label, option.getLabel());
        assertNull(option.getValue());
        assertEquals(1, option.getDepth());
        action.end(Tag.OPTGROUP);
        action.end(Tag.OPTGROUP);
        action.end(Tag.SELECT);
        assertEquals(3, specAttr.getAttributeCount());
    }
View Full Code Here

        attr.addAttribute(HTML.Attribute.SELECTED, "true");
        attr.addAttribute(HTML.Attribute.LABEL, label);
        action.start(Tag.OPTGROUP, attr);
        assertEquals(1, model.getSize());
        assertNotNull(model.getElementAt(0));
        FormOption option = (FormOption)model.getElementAt(0);
        assertFalse(option.isSelected());
        assertEquals(label, option.getLabel());
        assertNull(option.getValue());
        reader.handleText(text.toCharArray(), 0);
        assertEquals(1, model.getSize());
        assertNotNull(model.getElementAt(0));
        option = (FormOption)model.getElementAt(0);
        assertFalse(option.isSelected());
        assertEquals(label, option.getLabel());
        assertNull(option.getValue());
        assertEquals(0, option.getDepth());

        attr.addAttribute(HTML.Attribute.SELECTED, "true");
        attr.addAttribute(HTML.Attribute.VALUE, value);
        attr.addAttribute(HTML.Attribute.LABEL, label);
        action.start(Tag.OPTGROUP, attr);
        assertEquals(2, model.getSize());
        assertNotNull(model.getElementAt(1));
        option = (FormOption)model.getElementAt(1);
        assertFalse(option.isSelected());
        assertEquals(label, option.getLabel());
        assertNull(option.getValue());
        reader.handleText(text.toCharArray(), 0);
        assertEquals(2, model.getSize());
        assertNotNull(model.getElementAt(1));
        option = (FormOption)model.getElementAt(1);
        assertFalse(option.isSelected());
        assertEquals(label, option.getLabel());
        assertNull(option.getValue());
        assertEquals(1, option.getDepth());
        action.end(Tag.OPTGROUP);
        action.end(Tag.OPTGROUP);
        action.end(Tag.SELECT);
        assertEquals(3, specAttr.getAttributeCount());
    }
View Full Code Here

        return false;
    }

    public static void resetSimpleSelection(final ComboBoxModel model) {
        Object element;
        FormOption option;
        Stack options = new Stack();

        boolean notSelected = true;
        for (int i = model.getSize() - 1; i >= 0; i--) {
            element = model.getElementAt(i);
            if (element instanceof FormOption) {
                option = (FormOption) element;
                notSelected &= !selectElement(option, false, notSelected);
                if (option.isSelected()) {
                    model.setSelectedItem(element);
                }
                options.push(option);
            }
        }
        if (notSelected) {
            while (!options.isEmpty()) {
                option = (FormOption)options.pop();
                if (option.isEnabled()) {
                    model.setSelectedItem(option);
                    break;
                }
            }
        }
View Full Code Here

        }
    }

    public static void resetMultipleSelection(final FormSelectListModel model) {
        Object item;
        FormOption option;

        ListSelectionModel selectionModel = model.getSelectionModel();
        selectionModel.clearSelection();

        for (int i = 0; i < model.getSize(); i++) {
            item = model.getElementAt(i);

            if (item instanceof FormOption) {
                option = (FormOption) item;
                selectElement(option, true, true);
                if (option.isSelected()) {
                    selectionModel.addSelectionInterval(i, i);
                }
            }
        }
    }
View Full Code Here

                    radioGroupped.put(name, buttonModel);
                }
            }

            private void handleOption(final Tag tag, final AttributeSet attr) {
                FormOption option = null;
                FormOptionGroup currentGroup = (selectModel != null) ? selectModel
                        .getRootOptionGroup().getCurrentGroup() : null;
                       
                if (Tag.OPTION.equals(tag)) {
                    option = new FormOption(currentGroup, attr);
                    openedBlocks.add(Tag.OPTION);
                } else if (Tag.OPTGROUP.equals(tag)) {
                    currentGroup = new FormOptionGroup(currentGroup, attr);
                    option = currentGroup;
                }
View Full Code Here

                    radioGroupped.put(name, buttonModel);
                }
            }

            private void handleOption(final Tag tag, final AttributeSet attr) {
                FormOption option = null;
                FormOptionGroup currentGroup = (selectModel != null) ? selectModel
                        .getRootOptionGroup().getCurrentGroup() : null;
                       
                if (Tag.OPTION.equals(tag)) {
                    option = new FormOption(currentGroup, attr);
                    openedBlocks.add(Tag.OPTION);
                } else if (Tag.OPTGROUP.equals(tag)) {
                    currentGroup = new FormOptionGroup(currentGroup, attr);
                    option = currentGroup;
                }
View Full Code Here

                    radioGroupped.put(name, buttonModel);
                }
            }

            private void handleOption(final Tag tag, final AttributeSet attr) {
                FormOption option = null;
                FormOptionGroup currentGroup = (selectModel != null) ? selectModel
                        .getRootOptionGroup().getCurrentGroup() : null;
                       
                if (Tag.OPTION.equals(tag)) {
                    option = new FormOption(currentGroup, attr);
                    openedBlocks.add(Tag.OPTION);
                } else if (Tag.OPTGROUP.equals(tag)) {
                    currentGroup = new FormOptionGroup(currentGroup, attr);
                    option = currentGroup;
                }
View Full Code Here

        return false;
    }

    public static void resetSimpleSelection(final ComboBoxModel model) {
        Object element;
        FormOption option;
        Stack options = new Stack();

        boolean notSelected = true;
        for (int i = model.getSize() - 1; i >= 0; i--) {
            element = model.getElementAt(i);
            if (element instanceof FormOption) {
                option = (FormOption) element;
                notSelected &= !selectElement(option, false, notSelected);
                if (option.isSelected()) {
                    model.setSelectedItem(element);
                }
                options.push(option);
            }
        }
        if (notSelected) {
            while (!options.isEmpty()) {
                option = (FormOption)options.pop();
                if (option.isEnabled()) {
                    model.setSelectedItem(option);
                    break;
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.harmony.x.swing.text.html.form.FormOption

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.