You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by ksrijith <ks...@gmail.com> on 2012/07/30 07:35:04 UTC

Tapestry Pallet

Hi,
I trying to use the Pallet component in my custom page. The data gets
populated populated properly. The Available list has the list of "roles"
(Entity object) which hare not already selected. The problem is with the
Select and Deselect button. For some reason they are always disabled. I'm
not sure why this is happening and any insight which I missed out would be
appreciated. Please find the code below:

Java:
	@Persist
	private List<Role> _roles;

	private final ValueEncoder<Role> _encoder = new RoleEncoder();

	@Inject
	SelectModelFactory selectModelFactory;

	public List<Role> getRoles() {
		return new ArrayList<Role>(user.getRoles());
	}

	public void setRoles(List<Role> roles) {
		_roles = roles;
	}

	public ValueEncoder<Role> getEncoder() {
		return _encoder;
	}

	public SelectModel getModel() {
		SelectModel model  =selectModelFactory.create(roleDao.getAll(),
"roleDesc");
		return model;
	}

tml:
<t:palette selected="roles" model="model"
					encoder="encoder" ></t:palette>

Encoder:
public class RoleEncoder implements ValueEncoder<Role> {

	@Inject
	private RoleDao roleDao;

	@Inject
	private Messages messages;

	public String toClient(Role value) {
		return value.getRoleKey();
	}

	public Role toValue(String clientValue) {
		return roleDao.read(clientValue);
	}

}

Thanks,
Srijith



-----
--
Don't Forget to Rate
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-Pallet-tp5714869.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Tapestry Pallet

Posted by ksrijith <ks...@gmail.com>.
Thanks found the issue. I was using t:palette. But since I am using jquery
tapestry plugin I needed to use t:jquery.palette tag instead. Once I used
t:jquery.palette it started working great 


Thanks a lot for pointing to the example 




-----
--
Don't Forget to Rate
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-Pallet-tp5714869p5714872.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Tapestry Pallet

Posted by Emmanuel DEMEY <de...@gmail.com>.
Normally, the select and deselect buttons will be enabled or disabled when
you select an item.
Event if you select a item, the buttons are not clickable ? DO you have a
javascript error ?
There is working sample here :
http://tapestry5-jquery.com/core/docsjquerypalette

2012/7/30 ksrijith <ks...@gmail.com>

> Hi,
> I trying to use the Pallet component in my custom page. The data gets
> populated populated properly. The Available list has the list of "roles"
> (Entity object) which hare not already selected. The problem is with the
> Select and Deselect button. For some reason they are always disabled. I'm
> not sure why this is happening and any insight which I missed out would be
> appreciated. Please find the code below:
>
> Java:
>         @Persist
>         private List<Role> _roles;
>
>         private final ValueEncoder<Role> _encoder = new RoleEncoder();
>
>         @Inject
>         SelectModelFactory selectModelFactory;
>
>         public List<Role> getRoles() {
>                 return new ArrayList<Role>(user.getRoles());
>         }
>
>         public void setRoles(List<Role> roles) {
>                 _roles = roles;
>         }
>
>         public ValueEncoder<Role> getEncoder() {
>                 return _encoder;
>         }
>
>         public SelectModel getModel() {
>                 SelectModel model
>  =selectModelFactory.create(roleDao.getAll(),
> "roleDesc");
>                 return model;
>         }
>
> tml:
> <t:palette selected="roles" model="model"
>                                         encoder="encoder" ></t:palette>
>
> Encoder:
> public class RoleEncoder implements ValueEncoder<Role> {
>
>         @Inject
>         private RoleDao roleDao;
>
>         @Inject
>         private Messages messages;
>
>         public String toClient(Role value) {
>                 return value.getRoleKey();
>         }
>
>         public Role toValue(String clientValue) {
>                 return roleDao.read(clientValue);
>         }
>
> }
>
> Thanks,
> Srijith
>
>
>
> -----
> --
> Don't Forget to Rate
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Tapestry-Pallet-tp5714869.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Emmanuel DEMEY
Ingénieur Etude et Développement
ATOS Worldline
+33 (0)6 47 47 42 02
demey.emmanuel@gmail.com
http://emmanueldemey.fr/

Twitter : @EmmanuelDemey