Thanks a lot Thiago its works !!!!
Here the solution :
In JAVA :
@Property
private List<Structure> listOfParentStructures;
private RelationPropertyConduit relationPropertyConduit;
public BeanModel<Structure> getGridModel() {
BeanModel<Structure> model =
this.beanModelSource.createDisplayModel(Structure.class, this.messages);
relationPropertyConduit = new RelationPropertyConduit();
relationPropertyConduit.setListOfParentStructures(this.listOfParentStructures);
model.add("relation", this.relationPropertyConduit).sortable(true);
}
My PropertyConduit (RelationPropertyConduit) :
public class RelationPropertyConduit implements PropertyConduit {
private List<Structure> listOfParentStructures;
/**
* @see org.apache.tapestry5.PropertyConduit#get(java.lang.Object)
*/
public Object get(Object instance) {
Structure structureRelationRow = (Structure) instance;
if (this.listOfParentStructures.contains(structureRelationRow))
{
return "Belong to";
}
return "Combines";
}
@SuppressWarnings("unchecked")
public Class getPropertyType() {
return String.class;
}
@Override
public void set(Object arg0, Object arg1) {
// TODO Auto-generated method stub
}
@Override
public <T extends Annotation> T getAnnotation(Class<T> arg0) {
// TODO Auto-generated method stub
return null;
}
public List<Structure> getListOfParentStructures() {
return listOfParentStructures;
}
public void setListOfParentStructures(List<Structure>
listOfParentStructures) {
this.listOfParentStructures = listOfParentStructures;
}
Thanks ;-)
-----Message d'origine-----
De : Thiago H. de Paula Figueiredo [mailto:[email protected]]
Envoyé : lundi 27 septembre 2010 15:47
À : Tapestry users
Objet : Re: Attribute sortable in grid
On Mon, 27 Sep 2010 10:38:38 -0300, Cucchietti Denis
<[email protected]> wrote:
> Hi Thiago.
Hi!
> I have tried with a property conduit but the problem is my new column is
> not an attribute of my object Structure so I don't know how to use it :
>
> PropertyConduit propCdtAttribute =
> this.propertyConduitSource.create(String.class, "relation");
You should *implement* your own PropertyConduit. PropertyConduitSource
only works for real properties (getXXX() and setXXX()). The above code
tries to access getRelation() in String class, which doesn't exist.
It should be something like this (not tested):
class YourPropertyConduit implements PropertyConduit {
public Object get(Object instance) {
StructureRelationRow structureRelationRow =
(StructureRelationRow)
instance;
if (listOfParentStructures.contains(structureRelationRow)) {
return "Belong to";
}
return "Combines";
}
public void set(Object instance, Object value) {}
public Class getPropertyType() {
return String.class;
}
}
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Ce message et les pièces jointes sont confidentiels et réservés à l'usage
exclusif de ses destinataires. Il peut également être protégé par le secret
professionnel. Si vous recevez ce message par erreur, merci d'en avertir
immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant
être assurée sur Internet, la responsabilité du groupe Atos Origin ne pourra
être recherchée quant au contenu de ce message. Bien que les meilleurs efforts
soient faits pour maintenir cette transmission exempte de tout virus,
l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne
saurait être recherchée pour tout dommage résultant d'un virus transmis.
This e-mail and the documents attached are confidential and intended solely for
the addressee; it may also be privileged. If you receive this e-mail in error,
please notify the sender immediately and destroy it. As its integrity cannot be
secured on the Internet, the Atos Origin group liability cannot be triggered
for the message content. Although the sender endeavours to maintain a computer
virus-free network, the sender does not warrant that this transmission is
virus-free and will not be liable for any damages resulting from any virus
transmitted.