>> IMHO updating LinkDecorator with that attribute is trivial, so if the
>> other developers have nothing
>> against it, I could make that update.
>>
> Do other the develpers agree with this addition?
It looks like the other developers don't really agree.
So I attached to this post for you, an example implementation (as
an extended class - not so nice like it would be just changing the LinkDecorator itself).
You can use it as it is: just change the package name to something you need.
Ahmed.
P.S. Tell me if it works for you.
package com.incorp.control;
import net.sf.click.extras.control.LinkDecorator;
import net.sf.click.control.Table;
import net.sf.click.control.AbstractLink;
import net.sf.click.control.ActionLink;
import net.sf.click.Context;
/**
* Link decorator that accepts a target id with a different name than the source id.
*
*/
public class AdvancedLinkDecorator extends LinkDecorator {
protected String targetIdProperty;
public AdvancedLinkDecorator(Table table, AbstractLink[] links, String idProperty) {
super(table, links, idProperty);
}
public AdvancedLinkDecorator(Table table, AbstractLink[] links, String idProperty, String targetIdProperty) {
super(table, links, idProperty);
this.targetIdProperty = targetIdProperty;
}
protected void initLink(AbstractLink link, Context context, Object value) {
link.setId(null);
if (link instanceof ActionLink) {
((ActionLink) link).setValueObject(value);
} else {
if (value != null) {
if(targetIdProperty!=null)
link.setParameter(targetIdProperty, value.toString());
else
link.setParameter(idProperty, value.toString());
}
}
link.setParameter(Table.PAGE, String.valueOf(table.getPageNumber()));
if (table.getSortedColumn() != null) {
link.setParameter(Table.COLUMN, table.getSortedColumn());
link.setParameter(Table.ASCENDING, Boolean.toString(!table.isSortedAscending()));
link.setParameter(Table.SORT, Boolean.toString(table.isSorted()));
}
}
}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
Click-user mailing list
Click-user@...
https://lists.sourceforge.net/lists/listinfo/click-user