You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ryan Cuprak <rc...@mac.com> on 2006/08/16 16:54:05 UTC
Re: Quick Contrib:Table question (how to get an
ExpressionEvaluator?)
Thanks,
That is much simpler!
For the ExpressionTableColumn I need a ExpressionEvaluator as the last parameter. I think it is a tapestry service (still digging through the binding files), thought this would work:
@InjectObject("infrastructure:tapestry.ognl.ExpressionEvaluator")
public abstract ExpressionEvaluator getExpressionEvaluator();
(also tried engine-service)
However I get a nice exception that it can't find the service etc.
-Ryan
On Wednesday, August 16, 2006, at 07:10AM, Robert Zeigler <ro...@scazdl.org> wrote:
>If you want, you don't even have to implement ITableColumnModel.
>just do something like:
>.html:
><table jwcid="@contrib:Table" source="ognl:theSource"
>columns="ognl:columnList"/>
>
>.java:
>
>public List getColumnList() {
> List ret = new ArrayList();
> String columnId="callPointH";
> String columnHeader="Call Point H";
> //not that the root of your ognl expression is the current row obj.
> String ognlExpression = "callPoinH";
> boolean sortable=true;
> ret.add(new
>ExpressionTableColumn(columnId,columnHeeader,ognlExpression,sortable);
> return ret;
>}
>
>Ryan Cuprak wrote:
>> Hello,
>> I am working creating a table for which the number of columns is dynamic (user can control which columns they want displayed). What is the proper approach for implementing the behavior?
>>
>> Thus far I created an implementation of ITableColumnModel which then returns the custom set of columns. I initially returned SimpleTableColumn instances but was getting a 'Unable to read OGNL expression '<parsed OGNL expression>' of $TableColumns_203@b3bc23[pages/image/bands.tableColumns]: tableColumnRenderer' exception (src below). After getting this exception I thought my approach might be wrong. Looking over the code I was a little puzzled on how my column would extract the values from the model etc. Looking through the contrib:table source I chanced upon 'ExpressionTableColumn'. There are no java docs so I am not quiet sure how it is supposed to be used. From the title I 'think' this would take ognl expressions and retrieve the values from my data model? However, I am not quiet sure how to contruct an instance - where/what do I use for an ExpressionEvaluator?
>>
>> Page spec:
>> <component id="bands" type="Contrib:Table">
>> <binding name="source" value="tableModel"/>
>> <binding name="columns" value="ognl:tableColumnModel"/>
>> <binding name="rowsClass" value="beans.evenOdd.next"/>
>> <binding name="columnsClass" value="literal:title"/>
>> </component>
>>
>> My TableColumnModel (only one field, was trying to get it working first..):
>> public class BandSummaryColumnModel implements ITableColumnModel {
>>
>> private static final Logger logger = Logger.getLogger(BandSummaryColumnModel.class);
>>
>> private Map<String, ITableColumn> _columns;
>>
>> public BandSummaryColumnModel() {
>> if(logger.isDebugEnabled()) logger.debug("Instantiating BandSummaryColumnModel");
>> _columns = new HashMap<String,ITableColumn>();
>> _columns.put("callPointH",new SimpleTableColumn("callPointH","callPointH",true));
>> }
>>
>> public int getColumnCount() {
>> if(logger.isDebugEnabled()) logger.debug("Column count: " + _columns.size());
>> return _columns.size();
>> }
>>
>> public ITableColumn getColumn(String string) {
>> if(logger.isDebugEnabled()) logger.debug("Column requested: " + string);
>> return _columns.get(string);
>> }
>>
>> public Iterator getColumns() {
>> if(logger.isDebugEnabled()) logger.debug("Column iterator requested");
>> return _columns.entrySet().iterator();
>> }
>> }
>>
>> Thanks!
>> Ryan
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Quick Contrib:Table question (how to get an ExpressionEvaluator?)
Posted by Norbert Sándor <de...@erinors.com>.
... or in 4.1 the service is injected automatically, so you don't need
the @InjectObject annotation.
Regards,
Norbi
Ryan Cuprak wrote:
> D'oh was a simple fix, use service:
> @InjectObject("service:tapestry.ognl.ExpressionEvaluator")
>
> On Wednesday, August 16, 2006, at 07:54AM, Ryan Cuprak <rc...@mac.com> wrote:
>
>
>> Thanks,
>> That is much simpler!
>> For the ExpressionTableColumn I need a ExpressionEvaluator as the last parameter. I think it is a tapestry service (still digging through the binding files), thought this would work:
>> @InjectObject("infrastructure:tapestry.ognl.ExpressionEvaluator")
>> public abstract ExpressionEvaluator getExpressionEvaluator();
>> (also tried engine-service)
>>
>> However I get a nice exception that it can't find the service etc.
>>
>> -Ryan
>>
>> On Wednesday, August 16, 2006, at 07:10AM, Robert Zeigler <ro...@scazdl.org> wrote:
>>
>>
>>> If you want, you don't even have to implement ITableColumnModel.
>>> just do something like:
>>> .html:
>>> <table jwcid="@contrib:Table" source="ognl:theSource"
>>> columns="ognl:columnList"/>
>>>
>>> .java:
>>>
>>> public List getColumnList() {
>>> List ret = new ArrayList();
>>> String columnId="callPointH";
>>> String columnHeader="Call Point H";
>>> //not that the root of your ognl expression is the current row obj.
>>> String ognlExpression = "callPoinH";
>>> boolean sortable=true;
>>> ret.add(new
>>> ExpressionTableColumn(columnId,columnHeeader,ognlExpression,sortable);
>>> return ret;
>>> }
>>>
>>> Ryan Cuprak wrote:
>>>
>>>> Hello,
>>>> I am working creating a table for which the number of columns is dynamic (user can control which columns they want displayed). What is the proper approach for implementing the behavior?
>>>>
>>>> Thus far I created an implementation of ITableColumnModel which then returns the custom set of columns. I initially returned SimpleTableColumn instances but was getting a 'Unable to read OGNL expression '<parsed OGNL expression>' of $TableColumns_203@b3bc23[pages/image/bands.tableColumns]: tableColumnRenderer' exception (src below). After getting this exception I thought my approach might be wrong. Looking over the code I was a little puzzled on how my column would extract the values from the model etc. Looking through the contrib:table source I chanced upon 'ExpressionTableColumn'. There are no java docs so I am not quiet sure how it is supposed to be used. From the title I 'think' this would take ognl expressions and retrieve the values from my data model? However, I am not quiet sure how to contruct an instance - where/what do I use for an ExpressionEvaluator?
>>>>
>>>> Page spec:
>>>> <component id="bands" type="Contrib:Table">
>>>> <binding name="source" value="tableModel"/>
>>>> <binding name="columns" value="ognl:tableColumnModel"/>
>>>> <binding name="rowsClass" value="beans.evenOdd.next"/>
>>>> <binding name="columnsClass" value="literal:title"/>
>>>> </component>
>>>>
>>>> My TableColumnModel (only one field, was trying to get it working first..):
>>>> public class BandSummaryColumnModel implements ITableColumnModel {
>>>>
>>>> private static final Logger logger = Logger.getLogger(BandSummaryColumnModel.class);
>>>>
>>>> private Map<String, ITableColumn> _columns;
>>>>
>>>> public BandSummaryColumnModel() {
>>>> if(logger.isDebugEnabled()) logger.debug("Instantiating BandSummaryColumnModel");
>>>> _columns = new HashMap<String,ITableColumn>();
>>>> _columns.put("callPointH",new SimpleTableColumn("callPointH","callPointH",true));
>>>> }
>>>>
>>>> public int getColumnCount() {
>>>> if(logger.isDebugEnabled()) logger.debug("Column count: " + _columns.size());
>>>> return _columns.size();
>>>> }
>>>>
>>>> public ITableColumn getColumn(String string) {
>>>> if(logger.isDebugEnabled()) logger.debug("Column requested: " + string);
>>>> return _columns.get(string);
>>>> }
>>>>
>>>> public Iterator getColumns() {
>>>> if(logger.isDebugEnabled()) logger.debug("Column iterator requested");
>>>> return _columns.entrySet().iterator();
>>>> }
>>>> }
>>>>
>>>> Thanks!
>>>> Ryan
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Quick Contrib:Table question (how to get an
ExpressionEvaluator?)
Posted by Ryan Cuprak <rc...@mac.com>.
D'oh was a simple fix, use service:
@InjectObject("service:tapestry.ognl.ExpressionEvaluator")
On Wednesday, August 16, 2006, at 07:54AM, Ryan Cuprak <rc...@mac.com> wrote:
>
> Thanks,
> That is much simpler!
> For the ExpressionTableColumn I need a ExpressionEvaluator as the last parameter. I think it is a tapestry service (still digging through the binding files), thought this would work:
> @InjectObject("infrastructure:tapestry.ognl.ExpressionEvaluator")
> public abstract ExpressionEvaluator getExpressionEvaluator();
> (also tried engine-service)
>
> However I get a nice exception that it can't find the service etc.
>
> -Ryan
>
>On Wednesday, August 16, 2006, at 07:10AM, Robert Zeigler <ro...@scazdl.org> wrote:
>
>>If you want, you don't even have to implement ITableColumnModel.
>>just do something like:
>>.html:
>><table jwcid="@contrib:Table" source="ognl:theSource"
>>columns="ognl:columnList"/>
>>
>>.java:
>>
>>public List getColumnList() {
>> List ret = new ArrayList();
>> String columnId="callPointH";
>> String columnHeader="Call Point H";
>> //not that the root of your ognl expression is the current row obj.
>> String ognlExpression = "callPoinH";
>> boolean sortable=true;
>> ret.add(new
>>ExpressionTableColumn(columnId,columnHeeader,ognlExpression,sortable);
>> return ret;
>>}
>>
>>Ryan Cuprak wrote:
>>> Hello,
>>> I am working creating a table for which the number of columns is dynamic (user can control which columns they want displayed). What is the proper approach for implementing the behavior?
>>>
>>> Thus far I created an implementation of ITableColumnModel which then returns the custom set of columns. I initially returned SimpleTableColumn instances but was getting a 'Unable to read OGNL expression '<parsed OGNL expression>' of $TableColumns_203@b3bc23[pages/image/bands.tableColumns]: tableColumnRenderer' exception (src below). After getting this exception I thought my approach might be wrong. Looking over the code I was a little puzzled on how my column would extract the values from the model etc. Looking through the contrib:table source I chanced upon 'ExpressionTableColumn'. There are no java docs so I am not quiet sure how it is supposed to be used. From the title I 'think' this would take ognl expressions and retrieve the values from my data model? However, I am not quiet sure how to contruct an instance - where/what do I use for an ExpressionEvaluator?
>>>
>>> Page spec:
>>> <component id="bands" type="Contrib:Table">
>>> <binding name="source" value="tableModel"/>
>>> <binding name="columns" value="ognl:tableColumnModel"/>
>>> <binding name="rowsClass" value="beans.evenOdd.next"/>
>>> <binding name="columnsClass" value="literal:title"/>
>>> </component>
>>>
>>> My TableColumnModel (only one field, was trying to get it working first..):
>>> public class BandSummaryColumnModel implements ITableColumnModel {
>>>
>>> private static final Logger logger = Logger.getLogger(BandSummaryColumnModel.class);
>>>
>>> private Map<String, ITableColumn> _columns;
>>>
>>> public BandSummaryColumnModel() {
>>> if(logger.isDebugEnabled()) logger.debug("Instantiating BandSummaryColumnModel");
>>> _columns = new HashMap<String,ITableColumn>();
>>> _columns.put("callPointH",new SimpleTableColumn("callPointH","callPointH",true));
>>> }
>>>
>>> public int getColumnCount() {
>>> if(logger.isDebugEnabled()) logger.debug("Column count: " + _columns.size());
>>> return _columns.size();
>>> }
>>>
>>> public ITableColumn getColumn(String string) {
>>> if(logger.isDebugEnabled()) logger.debug("Column requested: " + string);
>>> return _columns.get(string);
>>> }
>>>
>>> public Iterator getColumns() {
>>> if(logger.isDebugEnabled()) logger.debug("Column iterator requested");
>>> return _columns.entrySet().iterator();
>>> }
>>> }
>>>
>>> Thanks!
>>> Ryan
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org