Package org.apache.tapestry5

Examples of org.apache.tapestry5.OptionModel


        message = null;
    }

    public SelectModel getClickCountModel()
    {
        OptionModel one = new OptionModelImpl("one", 1);
        OptionModel two = new OptionModelImpl("two", 2);
        OptionModel three = new OptionModelImpl("three", 3);

        return new SelectModelImpl(one, two, three);
    }
View Full Code Here


        verify();
    }

    private void checkOption(List<OptionModel> options, int i, String label, Stooge value)
    {
        OptionModel model = options.get(i);

        assertEquals(model.getLabel(), label);
        assertFalse(model.isDisabled());
        assertSame(model.getValue(), value);
        assertNull(model.getAttributes());
    }
View Full Code Here

    roleModelsList = new ArrayList<OptionModel>();

    allRoles = roleService.findAll();
    for (Role role : allRoles) {
      OptionModel option = new OptionModelImpl(getMessages().get("account." + role.getName()), role.getName());
      roleModelsList.add(option);
    }
  }
View Full Code Here

                       "name", getControlName());
       
        for(Object object: getSelected())
        {

            OptionModel model = valueToOptionModel.get(object);
           
            writer.element("Option",
               
                            "value",model.getValue(),
                           
                            "selected", "selected");
           
            writer.write(model.getLabel());
            writer.end();

        }
            
        writer.end();
       
        String script = "new Tapestry.DgDpPalette('%s', %s)";
       
    
        JSONArray array = new JSONArray();
        for(OptionModel option : model.getOptions())
        {
          array.put(option.getValue() + "-" + getClientId() + "-option");
        }
       
        javascriptSupport.addScript(script,clientId, array);
View Full Code Here

        verify();
    }

    private void checkOption(List<OptionModel> options, int i, String label, Stooge value)
    {
        OptionModel model = options.get(i);

        assertEquals(model.getLabel(), label);
        assertFalse(model.isDisabled());
        assertSame(model.getValue(), value);
        assertNull(model.getAttributes());
    }
View Full Code Here

        message = null;
    }

    public SelectModel getClickCountModel()
    {
        OptionModel one = new OptionModelImpl("one", 1);
        OptionModel two = new OptionModelImpl("two", 2);
        OptionModel three = new OptionModelImpl("three", 3);

        return new SelectModelImpl(one, two, three);
    }
View Full Code Here

    }

    @Test
    public void string_to_option_model_just_label()
    {
        OptionModel model = TapestryInternalUtils.toOptionModel("Just A Label");

        assertEquals(model.getLabel(), "Just A Label");
        assertEquals(model.getValue(), "Just A Label");
    }
View Full Code Here

    }

    @Test
    public void string_to_option_model()
    {
        OptionModel model = TapestryInternalUtils.toOptionModel("my-value=Some Label");

        assertEquals(model.getLabel(), "Some Label");
        assertEquals(model.getValue(), "my-value");
    }
View Full Code Here

    @Test
    public void map_entry_to_option_model()
    {
        Map<String, String> map = Collections.singletonMap("key", "value");
        Map.Entry entry = map.entrySet().iterator().next();
        OptionModel model = TapestryInternalUtils.toOptionModel(entry);

        assertEquals(model.getLabel(), "value");
        assertEquals(model.getValue(), "key");
    }
View Full Code Here

    @Test
    public void object_to_option_model()
    {
        Object object = new Integer(27);
        OptionModel model = TapestryInternalUtils.toOptionModel(object);

        assertEquals(model.getLabel(), "27");
        assertEquals(model.getValue(), object);
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.OptionModel

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.