dev@woodstock.java.net

Re: Facelets + Woodstock problem

From: stuartr <stuart.russell_at_sun.com>
Date: Fri, 16 Nov 2007 08:32:27 -0800 (PST)

Yip, I knew all of that dan, but the problem I have is a wee bit unique


1. Ad hoc query hits the DB.
2. I create CachedRowSetDataProvider
( so I have no idea of what is being returned , only column names and types
)
3. As each row is read I need to be able to look at the type and check for
nasty old oracle TIMESTAMP and also Timestamp.
I then create a map of private variabled called <column>_MS_EPOCH which are
a time calculated millisec value .
I then need to access this/these values when creating my link so that a
column on the table
has something link "TAKEMETHERE" which is a hyperlink to a url which has a
param of this variable
something like %TIMEVALUE_MS_EPOCH%
The person who defined the query knows the column so can set up the link (
in their spring config file )
But the app is transparent to what is being queried and processed.

So , I have a converter on the link component to replace any references of
%VARNAME% with the value derived from the row listener wo set the var up (
the converter is told about the rowlistener and thus
can ask about any of these generated vars ).

Ive gotten it working today ( but I dont like the implementation ).
I thought of writing a dynamic proxy for interposing the FieldKey , but
again, its messy.


What I need is the ability to set up "on the fly" field keys within a
provider ( via the row listener )
so that I have access to NEW variables and thus I can access using
#{dataItem.value.MYSPECIALVAR}

now that would be really cool and useful, that you can alter data based on
row values.

Maybe this app is unique and most apps can use the woodstock components
easily, but this is
driven via user set up within a spring config file and the app has no idea
what is being asked, only
that there are queries being run ( the application also generated dynamic
prompts on the screen
using ajax, manipulating the dom . I couldnt find a way in Woodstock to
dynamically create
components and delete components such as within a PanelGrid(table ) ).

Stu






Dan Labrecque wrote:
>
>
> stuartr wrote:
>> Thanks dan but I understand how to add in the converter to the code
>> however
>> I need a converter that is aware of its context and also aware of all the
>> other columns of data within the table.
>> The table is being created within a table model prgrammatically not in
>> the
>> client ( ie i have a binding ).
>>
>
> I'm not sure what you mean by "not in the client"? The JSP example I
> provided is not client-side code. Are you suggesting that components are
> cerated in Java via a binding?
>
>> What I want to do is
>> 1. Put a RowListner into the CachedRowSet ( which I can do ). but put in
>> place a hyperlink on the screen where the hyperlink text has an
>> expression
>> to reference row data items . However one of the row data items I want to
>> convert and format in a specific manner before it is added as part of the
>> link eg
>> i have
>> #{rowDataItem.value.COLUMNX} within the setUrl, but I want to be able to
>> format this data item
>> in a specific manner within the URL definition eg.
>> /myotherwebsiteUrl/servletX?param1=#{rowDataItem.value.COLUMNX}&param2=ABC
>> etc etc
>>
>
> Note that the hyperlink's "url" property does not necessarily need to
> have a binding to the DataProvider directly. Although, if you did this
> in a JSP, you could easily set the above string as the hyperlink's url
> property. The hyperlink also has APIs to assign query params separately,
> which may help. Here is what that looks like in JSP.
>
> <webuijsf:hyperlink id="action1" text="Action 1"
> actionExpression="#{TableBean.groupB.actions.action}">
> *<f:param name="param" value="#{name.value.last}"/>*
> </webuijsf:hyperlink>
>
> Even if you were to do this prgrammatically via Java, you can still
> create value expressions for each param. I believe you would just add a
> UIParameter object as a child of hyperlink. Use the setValueExpression
> API to set a ValueExpression object (i.e.,
> #{rowDataItem.value.COLUMNX}). If you prefer not to work with value
> expressions, you may also access DataProvider directly via RowKey
> objects -- see the Javadoc below.
>
> http://developers.sun.com/docs/jscreator/apis/dataprovider/index.html
>
>> I need to format this for each row on the table.
>>
>
> The hyperlink's APIs will be called for each row of the table, so you
> have the opportunity to change the URL and query params as you see fit.
>
> Dan
>
>>
>>
>>
>>
>> Dan Labrecque wrote:
>>
>>> The table will not format data for you, but the components used in a
>>> table cell will. For example, the staticText tag below is an example of
>>> a formatted date.
>>>
>>> <webuijsf:staticText id="text3"
>>> text="#{StatictextBean.date}" >
>>> <f:convertDateTime pattern="MM/dd/yy" />
>>> </webuijsf:staticText>
>>>
>>> You can find this example here:
>>>
>>> http://webdev2.sun.com/example/faces/statictext/Statictext.jsp
>>>
>>> Regarding row listeners, I'm not certain what you're looking for? You
>>> can add an onMouseOver or onClick attribute to either the tableRowGroup
>>> or tableColumn tags. Setting an attribute to tableRowGroup means it will
>>> be applied to all rows, while tableColumn applies to individual table
>>> cells. Please see the TLD docs below for a list of attributes.
>>>
>>> http://webdev2.sun.com/woodstock-tlddocs
>>>
>>> Dan
>>>
>>> stuartr wrote:
>>>
>>>> Maybe shouldnt respond in this thread however wonder if anyone can help
>>>>
>>>> I have a woodtock table and can display the data, no issue, However I
>>>> want
>>>> to be able to
>>>> put in place a callback to like a listener for each row, and also a
>>>> formatter for particular cells.
>>>> ( The formatter would be the same code as it requires knowledge about
>>>> the
>>>> row to be
>>>> able to format the cell ).
>>>> Cant see anywhere how to do this. Really tearing my hair out as the
>>>> Converter is no use for this.
>>>>
>>>>
>>>> Any help would be appreciated.
>>>>
>>>> Stu
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> stuartr wrote:
>>>>
>>>>
>>>>> Bill
>>>>> Have located under my netbeans environment ( however I am developing
>>>>> under
>>>>> eclipse at this time ).
>>>>> Ran my junit and its looking good so far.
>>>>> Will embed and deploy facelets application , fingers crossed.
>>>>>
>>>>> All being well, I owe you a big thanks and a wee whiskey next time you
>>>>> are
>>>>> in scotland.
>>>>>
>>>>> Forever grateful.
>>>>> ( Man I wish there was more documentation on these providers )
>>>>>
>>>>> Stu
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Bill Edwards - Sun BOS Software wrote:
>>>>>
>>>>>
>>>>>> I think you need the sqlx.jar file. Not sure where this is, but
>>>>>> the Lockhart console ships a copy in /usr/share/webconsole/other.
>>>>>>
>>>>>> stuartr wrote:
>>>>>>
>>>>>>
>>>>>>> Thanks for feedback
>>>>>>>
>>>>>>> However Ive got another problem with woodstock tables displaying
>>>>>>> CachedRowSetDataProvider
>>>>>>> I set up the cachedRowset and cant seem to set the DataProvider as I
>>>>>>> keep
>>>>>>> getting
>>>>>>>
>>>>>>> java.lang.NoClassDefFoundError: com/sun/sql/rowset/CachedRowSetX
>>>>>>> at
>>>>>>> com.sun.data.provider.impl.CachedRowSetDataProvider.setCachedRowSet(CachedRowSetDataProvider.java:189)
>>>>>>> at
>>>>>>> com.sun.data.provider.impl.CachedRowSetDataProvider.<init>(CachedRowSetDataProvider.java:85)
>>>>>>> at
>>>>>>> com.sun.wwops.tie.tdms.sqlBrowser.models.SqlQueryTableModel.getTable(SqlQueryTableModel.java:43)
>>>>>>> at
>>>>>>> com.sun.wwops.tie.tdms.sqlBrowser.models.SqlQueryTableModelTest.testGetTable2(SqlQueryTableModelTest.java:97)
>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>>>>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>>>>>> at java.lang.reflect.Method.invoke(Unknown Source)
>>>>>>> at junit.framework.TestCase.runTest(TestCase.java:154)
>>>>>>> at junit.framework.TestCase.runBare(TestCase.java:127)
>>>>>>> at junit.framework.TestResult$1.protect(TestResult.java:106)
>>>>>>> at junit.framework.TestResult.runProtected(TestResult.java:124)
>>>>>>> at junit.framework.TestResult.run(TestResult.java:109)
>>>>>>> at junit.framework.TestCase.run(TestCase.java:118)
>>>>>>> at junit.framework.TestSuite.runTest(TestSuite.java:208)
>>>>>>> at junit.framework.TestSuite.run(TestSuite.java:203)
>>>>>>> at
>>>>>>> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
>>>>>>> at
>>>>>>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>>>>>>> at
>>>>>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
>>>>>>> at
>>>>>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
>>>>>>> at
>>>>>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
>>>>>>> at
>>>>>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
>>>>>>>
>>>>>>> I have no idea where the CachedRowSetX is defined and cant find any
>>>>>>> references to it on the web.
>>>>>>> Im really getting frustrated with Woodstocks lack of real examples.
>>>>>>>
>>>>>>> Any hlep to get to the bottom of setting up my
>>>>>>> CachedRoiwSetDataprovider
>>>>>>> would be really appreciated.
>>>>>>>
>>>>>>>
>>>>>>> Stu
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Morten Egelund Rasmussen-2 wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Hi!
>>>>>>>>
>>>>>>>> We're using Facelets and Woodstock with Woodstock buttons all over.
>>>>>>>> No
>>>>>>>> problems whatsoever.
>>>>>>>>
>>>>>>>> Use 'actionListener' and 'action' on the button. The ActionListener
>>>>>>>> is
>>>>>>>> executed before the Action.
>>>>>>>>
>>>>>>>> Some ideas:
>>>>>>>>
>>>>>>>> * Check your ActionListener method signature.
>>>>>>>>
>>>>>>>> * Remember to register all backingbeans in faces-config.xml.
>>>>>>>>
>>>>>>>> * Check that faces-config.xml has JSF 1.2 in the header.
>>>>>>>>
>>>>>>>> * Try with <webuijsf:page> and the whole stack in the page and in
>>>>>>>> the
>>>>>>>> Facelets template (dunno if it makes a difference).
>>>>>>>>
>>>>>>>>
>>>>>>>> Let us know if it helps..... Send code snippets if not.
>>>>>>>>
>>>>>>>>
>>>>>>>> Best regards,
>>>>>>>> ~Morten :-)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>>> stuart.russell_at_sun.com 25-10-2007 13:46:04 >>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>> Jason I too have just wasted 4 hours trying to get the
>>>>>>>> actionlisteners
>>>>>>>> and
>>>>>>>> actionExpression working on the Woodstock button component.
>>>>>>>> It just doesnt work .
>>>>>>>> Tried using firebox to find out exactly whats going wrong but
>>>>>>>> getting
>>>>>>>> nowwhere.
>>>>>>>>
>>>>>>>> Have resorted to using the standard commandButton within JSF and it
>>>>>>>> works
>>>>>>>> AOK, no problems.
>>>>>>>>
>>>>>>>> Did anyone get to the button of this issue when integrating with
>>>>>>>> FACELETS.
>>>>>>>>
>>>>>>>> Or
>>>>>>>>
>>>>>>>> Anyone suggest another template engine.
>>>>>>>>
>>>>>>>> Stu
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Jason Suplizio wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> A coworker at my company has the following problem:
>>>>>>>>>
>>>>>>>>> I am trying to use Woodstock and Facelets. Rendering works
>>>>>>>>> correctly,
>>>>>>>>> but
>>>>>>>>> the binding of the "action" components did not work. For example,
>>>>>>>>> a
>>>>>>>>> button
>>>>>>>>> would not invoke its backing beans action. Removing Facelet and
>>>>>>>>> using
>>>>>>>>> Jsp
>>>>>>>>> allowed Woodstock to work properly.
>>>>>>>>>
>>>>>>>>> Tried using the actionExpression and the actionListenerExpression.
>>>>>>>>>
>>>>>>>>> Also note:
>>>>>>>>> The h:commandButton worked as expected.
>>>>>>>>> The w:radioButton also failed in Facelets
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Does anyone have any similar experiences? Do you know of a
>>>>>>>>> solution
>>>>>>>>> for
>>>>>>>>> these issues?
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>> Jason
>>>>>>>>>
>>>>>>>>> PS Is the dev list the wrong place for these questions?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> --
>>>>>>>> View this message in context:
>>>>>>>> http://www.nabble.com/Facelets-%2B-Woodstock-problem-tf4469174.html#a13405134
>>>>>>>> Sent from the Project Woodstock - Dev mailing list archive at
>>>>>>>> Nabble.com.
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: dev-unsubscribe_at_woodstock.dev.java.net
>>>>>>>> For additional commands, e-mail: dev-help_at_woodstock.dev.java.net
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: dev-unsubscribe_at_woodstock.dev.java.net
>>>>>> For additional commands, e-mail: dev-help_at_woodstock.dev.java.net
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
>

-- 
View this message in context: http://www.nabble.com/Facelets-%2B-Woodstock-problem-tf4469174.html#a13796489
Sent from the Project Woodstock - Dev mailing list archive at Nabble.com.