Hi Bob... this worked..
final PageLink linkToOrder = new PageLink("", "View ", viewer);
LinkDecorator decorator = new LinkDecorator(orderRequestItemsTable,
new AbstractLink[]{linkToOrder}, "order.id", "order") {
protected void renderActionLink(HtmlStringBuffer buffer,
AbstractLink link, Context context, Object row, Object value) {
OrderRequestEnt orderRequestEnt = (OrderRequestEnt) row;
link.removeStyleClass("btn_small");
link.removeStyleClass("btn-primary-orange");
link.removeStyleClass("btn-primary");
if (orderRequestEnt.isTestOrder()) {
link.addStyleClass("btn_small btn-primary-orange");
} else {
link.addStyleClass("btn_small btn-primary");
}
// NB we invoke the super implementation here for default
rendering to continue
super.renderActionLink(buffer, link, context, row, value);
}
};
On Sat, Jul 6, 2013 at 12:25 AM, Bob Schellink <[email protected]> wrote:
> Hi,
>
> You probably want to override the LinkDecorator#renderActionLinks method
> to customize your button style:
>
>
> http://click.apache.org/docs/extras-api/org/apache/click/extras/control/LinkDecorator.html
>
> There is a demo in the javadoc above as well.
>
> regards
>
> Bob
>
>
>
>
> On 2013/07/05 23:37, Kristian Lind wrote:
>
> Hi, I am using a table to show a list of items.
>
> The item in the list is a order request.
>
> *orderRequestItemsTable = new Table("orderRequestItemsTable");*
> *orderRequestItemsTable.setClass(Table.CLASS_ISI);*
> *orderRequestItemsTable.setPageSize(Constants.MAX_PAGE_SIZE);*
> *orderRequestItemsTable.setSortable(false);*
> *orderRequestItemsTable.addStyleClass("dash_table");*
> *.....*
> *orderRequestItemsTable.addColumn(createTableColumn("receivedDate",
> "Received Time Stamp", "20%", "left", null));
> *
> *
> *
> *final PageLink linkToOrder = new PageLink("", "View ", viewer);*
> *linkToOrder.addStyleClass("btn_small btn-primary");*
> *
> *
> *orderRequestItemsTable.addColumn(createTableColumn("Order", "Order",
> "10%", "left",*
> * new LinkDecorator(orderRequestItemsTable, new
> AbstractLink[]{linkToOrder}, "order.id", "order")));*
> * *
> *addControl(orderRequestItemsTable);*
>
>
> The order request object has a boolean variable, and if the value is
> true i want to show a blue button, else a green button.
> In the code above only a blue button is shown...
> *linkToOrder.addStyleClass("btn_small
> btn-primary");*
>
> Thanks....
>
>
> --
> Best regards
>
> Kris
>
>
>
--
Best regards
Kristian Lind