Package javax.faces.component

Examples of javax.faces.component.UISelectItems


        selectMany.getAttributes().put("disabledClass", "disabledClass");
        selectMany.getAttributes().put("styleClass", "styleClass");
        selectMany.getAttributes().put("tabindex", new Integer(5));
        selectMany.getAttributes().put("title", "title");
       
        UISelectItems uiSelectItems = new UISelectItems();
        selectMany.setValue(null);
        selectMany.setId("myCheckboxlist");
        SelectItem item1 = new SelectItem("Red", "Red", null);
        item1.setDisabled(true);
        SelectItem item2 = new SelectItem("Blue", "Blue", null);
       
        SelectItem item3 = new SelectItem("Green", "Green", null);
        SelectItem item4 = new SelectItem("Yellow", "Yellow", null);
        SelectItem[] itemsArray = {item3, item4};
        SelectItemGroup itemGroup = new SelectItemGroup("group", null, true,
                itemsArray);
        SelectItem[] selectItems = {item1, item2, itemGroup};
        Object selectedValues[] = null;
        uiSelectItems.setValue(selectItems);
        selectMany.getChildren().add(uiSelectItems);
        root.getChildren().add(selectMany);
       
        SelectManyCheckboxListRenderer selectManyCheckboxListRenderer =
                new SelectManyCheckboxListRenderer();
View Full Code Here


   
    public void testSelectManyMenuRenderer(UIComponent root)
    throws IOException {
        System.out.println("Testing SelectManyMenuRenderer");
        UISelectMany selectMany = new UISelectMany();
        UISelectItems uiSelectItems = new UISelectItems();
        selectMany.setValue(null);
        selectMany.setId("myMenu");
        SelectItem item1 = new SelectItem("Red", "Red", null);
        SelectItem item2 = new SelectItem("Blue", "Blue", null);
        SelectItem item3 = new SelectItem("Green", "Green", null);
        SelectItem item4 = new SelectItem("Yellow", "Yellow", null);
        SelectItem[] selectItems = {item1, item2, item3, item4};
        Object selectedValues[] = null;
        uiSelectItems.setValue(selectItems);
        uiSelectItems.setId("manyMenuitems");
        selectMany.getChildren().add(uiSelectItems);
        root.getChildren().add(selectMany);
       
        MenuRenderer selectManyMenuRenderer =
                new MenuRenderer();
View Full Code Here

   
    public void testSelectOneMenuRenderer(UIComponent root)
    throws IOException {
        System.out.println("Testing SelectOneMenuRenderer");
        UISelectOne selectOne = new UISelectOne();
        UISelectItems uiSelectItems = new UISelectItems();
        selectOne.setValue(null);
        selectOne.setId("myOnemenu");
        SelectItem item1 = new SelectItem("Red", "Red", null);
        SelectItem item2 = new SelectItem("Blue", "Blue", null);
        SelectItem item3 = new SelectItem("Green", "Green", null);
        SelectItem item4 = new SelectItem("Yellow", "Yellow", null);
        SelectItem[] selectItems = {item1, item2, item3, item4};
        String selectedValue = null;
        uiSelectItems.setValue(selectItems);
        uiSelectItems.setId("manySelectOneitems");
        selectOne.getChildren().add(uiSelectItems);
        root.getChildren().add(selectOne);
       
        MenuRenderer selectOneMenuRenderer =
                new MenuRenderer();
View Full Code Here


    public void testListboxRenderer(UIComponent root) throws IOException {
        System.out.println("Testing ListboxRenderer");
        UISelectOne selectOne = new UISelectOne();
        UISelectItems uiSelectItems = new UISelectItems();
        selectOne.setValue(null);
        selectOne.setId("myListbox");
        SelectItem item1 = new SelectItem(new Long(100), "Long1", null);
        SelectItem item2 = new SelectItem(new Long(101), "Long2", null);
        SelectItem item3 = new SelectItem(new Long(102), "Long3", null);
        SelectItem item4 = new SelectItem(new Long(103), "Long4", null);
        SelectItem[] selectItems = {item1, item2, item3, item4};
        uiSelectItems.setValue(selectItems);
        uiSelectItems.setId("items");
        Converter converter = application.createConverter("javax.faces.Number");
        selectOne.setConverter(converter);
        selectOne.getChildren().add(uiSelectItems);
        root.getChildren().add(selectOne);
View Full Code Here

    item3.setValue(new SelectItem("Rhode Island"));
     
    UISelectItem item4 = new UISelectItem();
    item4.setValue(new SelectItem("South Carolina"));
   
    UISelectItems items = new UISelectItems();
      items.setValue(selectItems);
   
    pickList = (UIPickList)application.createComponent("org.richfaces.PickList");
    pickList.setValueExpression("value", new MockValueExpression(selected) );
   
      pickList.getChildren().add(item1);
View Full Code Here


    // Set up instance variables required by this test case.
    public void setUp() {
        super.setUp();
        component = new UISelectItems();
        expectedFamily = UISelectItems.COMPONENT_FAMILY;
        expectedId = null;
        expectedRendererType = null;
    }
View Full Code Here

    // Test attribute-property transparency
    public void testAttributesTransparency() {

        super.testAttributesTransparency();
        UISelectItems selectItems = (UISelectItems) component;

        assertEquals(selectItems.getValue(),
                     component.getAttributes().get("value"));
        SelectItem item = new SelectItem("foo");
        selectItems.setValue(item);
        assertEquals(item, component.getAttributes().get("value"));
        selectItems.setValue(null);
        assertNull(component.getAttributes().get("value"));
        component.getAttributes().put("value", "bar");
        assertEquals("bar", selectItems.getValue());
        component.getAttributes().put("value", null);
        assertNull(selectItems.getValue());

    }
View Full Code Here

    // Test a pristine UISelectItems instance
    public void testPristine() {

        super.testPristine();
        UISelectItems selectItems = (UISelectItems) component;
        assertNull("no value", selectItems.getValue());

    }
View Full Code Here

    // Test setting properties to invalid values
    public void testPropertiesInvalid() throws Exception {

        super.testPropertiesInvalid();
        UISelectItems selectItems = (UISelectItems) component;

    }
View Full Code Here

    // Test setting properties to valid values
    public void testPropertiesValid() throws Exception {

        super.testPropertiesValid();
        UISelectItems selectItems = (UISelectItems) component;

        // value
        SelectItem item = new SelectItem("foo");
        selectItems.setValue(item);
        assertEquals("expected value",
                     item, selectItems.getValue());
        selectItems.setValue(null);
        assertNull("erased value", selectItems.getValue());
    }
View Full Code Here

TOP

Related Classes of javax.faces.component.UISelectItems

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.