pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alejandro Vilar" <alejandro.vi...@synacom.com.bo>
Subject RE: Display Bean Data In Table View
Date Sat, 08 May 2010 21:07:45 GMT
Hi, it seems the problem is in your WTKX file:
tableData="rams.db.DB.expenseList", you could put expenseList variable into
your WTKXSerializer:

DB db=new DB();
WTKXSerializer wtkxSerializer = new WTKXSerializer();
wtkxSerializer.put("expenseList", db.showExpenses());
wtkxSerializer.readObject("thisMonth.wtkx");

and replace the reference in you WTKX file like this:
tableData="$expenseList", or:

DB db=new DB();
WTKXSerializer wtkxSerializer = new WTKXSerializer();
wtkxSerializer.readObject("thisMonth.wtkx");
TableView table=(TableView)wtkxSerializer.get("expense");
table.setTableData(db.showExpenses());


another way is creating a Expense list as follows:

package rams.entity;
import org.apache.pivot.collections.ArrayList;
public class ExpenseList extends ArrayList<Expense> {
    public ExpenseList() {
	  //Connect to database and get all expenses into this list
    }
}

Modify your WTKX file like this:

<TableView wtkx:id="expense" xmlns:entities="rams.entity"
	<tableData>
		<entities:ExpenseList/>
	</tableData>
	<columns>
		<TableView.Column name="expenseId" width="135"
headerData="Expense ID"/>
		<TableView.Column name="expenseDate" width="135"
headerData="Expense Date"/>
		<TableView.Column name="expenseDescription" width="135"
headerData="Description"/>
		<TableView.Column name="expenseType" width="135"
headerData="Type"/>
		<TableView.Column name="remarks" width="135"
headerData="Remarks"/>
		<TableView.Column name="amount" width="135"
headerData="Amount"/>
	</columns>
</TableView>

If you don't want load expenses stuff in ExpenseList's constructor you could
try this too:

package rams.entity;
import org.apache.pivot.collections.ArrayList;
public class ExpenseList extends ArrayList<Expense> {
    private boolean auto;
    public boolean isAuto() {
        return auto;
    }
    public void setAuto(boolean auto) {
	  if(auto){
            //Connect to database and get all expenses into this list
	  }
        this.auto = auto;
    }
}

And modify your WTKX file like this:

<TableView wtkx:id="expense" xmlns:entities="rams.entity"
	<tableData>
		<entities:ExpenseList auto="true"/>
	</tableData>
	...


Hope this helps,
Alejandro

-----Original Message-----
From: GB [mailto:nrganeshbabu@yahoo.com] 
Sent: Sábado, 08 de Mayo de 2010 07:48 a.m.
To: user@pivot.apache.org
Subject: Re: Display Bean Data In Table View


With the above set up, I get the following exception:

run:
log4j:WARN No appenders could be found for logger (rams.Main).
log4j:WARN Please initialize the log4j system properly.
An error occurred while processing input at line number 01
An error occurred while processing  element <TableView> starting at line
number 6 in file
/C:/Users/gbnr/1G/MyApps/ApachePivotApps/RAMS/src/rams/thisMonth.wtkx:
java.lang.IllegalArgumentException:
org.apache.pivot.serialization.SerializationException: Unexpected character
in input stream.
        at org.apache.pivot.wtk.TableView.setTableData(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.pivot.beans.BeanDictionary.put(Unknown Source)
        at org.apache.pivot.beans.BeanDictionary.put(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.processEndElement(Unknown
Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.processEndElement(Unknown
Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.processEndElement(Unknown
Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at rams.Main.startup(Main.java:54)
        at
org.apache.pivot.wtk.DesktopApplicationContext$HostFrame.processWindowEvent(
Unknown
Source)
        at java.awt.Window.processEvent(Window.java:1820)
        at java.awt.Component.dispatchEventImpl(Component.java:4630)
        at java.awt.Container.dispatchEventImpl(Container.java:2099)
        at java.awt.Window.dispatchEventImpl(Window.java:2475)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java
:269)
        at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:18
4)
        at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
:174)
        at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: org.apache.pivot.serialization.SerializationException: Unexpected
character in input stream.
        at org.apache.pivot.serialization.JSONSerializer.readValue(Unknown
Source)
        at org.apache.pivot.serialization.JSONSerializer.readObject(Unknown
Source)
        at org.apache.pivot.serialization.JSONSerializer.parse(Unknown
Source)
        at org.apache.pivot.serialization.JSONSerializer.parseList(Unknown
Source)
        ... 32 more
An error occurred while processing  element <wtkx:include> starting at line
number 37 in file
/C:/Users/gbnr/1G/MyApps/ApachePivotApps/RAMS/src/rams/vidyaMain.wtkx:
java.lang.IllegalArgumentException:
org.apache.pivot.serialization.SerializationException: Unexpected character
in input stream.
        at org.apache.pivot.wtk.TableView.setTableData(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.pivot.beans.BeanDictionary.put(Unknown Source)
        at org.apache.pivot.beans.BeanDictionary.put(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.processEndElement(Unknown
Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.processEndElement(Unknown
Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.processEndElement(Unknown
Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at rams.Main.startup(Main.java:54)
        at
org.apache.pivot.wtk.DesktopApplicationContext$HostFrame.processWindowEvent(
Unknown
Source)
        at java.awt.Window.processEvent(Window.java:1820)
        at java.awt.Component.dispatchEventImpl(Component.java:4630)
        at java.awt.Container.dispatchEventImpl(Container.java:2099)
        at java.awt.Window.dispatchEventImpl(Window.java:2475)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java
:269)
        at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:18
4)
        at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
:174)
        at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: org.apache.pivot.serialization.SerializationException: Unexpected
character in input stream.
        at org.apache.pivot.serialization.JSONSerializer.readValue(Unknown
Source)
        at org.apache.pivot.serialization.JSONSerializer.readObject(Unknown
Source)
        at org.apache.pivot.serialization.JSONSerializer.parse(Unknown
Source)
        at org.apache.pivot.serialization.JSONSerializer.parseList(Unknown
Source)
        ... 32 more
An error occurred while processing  element <wtkx:include> starting at line
number 5 in file
/C:/Users/gbnr/1G/MyApps/ApachePivotApps/RAMS/src/rams/vidya.wtkx:
java.lang.IllegalArgumentException:
org.apache.pivot.serialization.SerializationException: Unexpected character
in input stream.
        at org.apache.pivot.wtk.TableView.setTableData(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.pivot.beans.BeanDictionary.put(Unknown Source)
        at org.apache.pivot.beans.BeanDictionary.put(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.processEndElement(Unknown
Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.processEndElement(Unknown
Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.processEndElement(Unknown
Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at rams.Main.startup(Main.java:54)
        at
org.apache.pivot.wtk.DesktopApplicationContext$HostFrame.processWindowEvent(
Unknown
Source)
        at java.awt.Window.processEvent(Window.java:1820)
        at java.awt.Component.dispatchEventImpl(Component.java:4630)
        at java.awt.Container.dispatchEventImpl(Container.java:2099)
        at java.awt.Window.dispatchEventImpl(Window.java:2475)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java
:269)
        at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:18
4)
        at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
:174)
        at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: org.apache.pivot.serialization.SerializationException: Unexpected
character in input stream.
        at org.apache.pivot.serialization.JSONSerializer.readValue(Unknown
Source)
        at org.apache.pivot.serialization.JSONSerializer.readObject(Unknown
Source)
        at org.apache.pivot.serialization.JSONSerializer.parse(Unknown
Source)
        at org.apache.pivot.serialization.JSONSerializer.parseList(Unknown
Source)
        ... 32 more
java.lang.IllegalArgumentException:
org.apache.pivot.serialization.SerializationException: Unexpected character
in input stream.
        at org.apache.pivot.wtk.TableView.setTableData(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.pivot.beans.BeanDictionary.put(Unknown Source)
        at org.apache.pivot.beans.BeanDictionary.put(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.processEndElement(Unknown
Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.processEndElement(Unknown
Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.processEndElement(Unknown
Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(Unknown Source)
        at rams.Main.startup(Main.java:54)
        at
org.apache.pivot.wtk.DesktopApplicationContext$HostFrame.processWindowEvent(
Unknown
Source)
        at java.awt.Window.processEvent(Window.java:1820)
        at java.awt.Component.dispatchEventImpl(Component.java:4630)
        at java.awt.Container.dispatchEventImpl(Container.java:2099)
        at java.awt.Window.dispatchEventImpl(Window.java:2475)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java
:269)
        at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:18
4)
        at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
:174)
        at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: org.apache.pivot.serialization.SerializationException: Unexpected
character in input stream.
        at org.apache.pivot.serialization.JSONSerializer.readValue(Unknown
Source)
        at org.apache.pivot.serialization.JSONSerializer.readObject(Unknown
Source)
        at org.apache.pivot.serialization.JSONSerializer.parse(Unknown
Source)
        at org.apache.pivot.serialization.JSONSerializer.parseList(Unknown
Source)
        ... 32 more
BUILD SUCCESSFUL (total time: 7 seconds)

-- 
View this message in context:
http://apache-pivot-users.399431.n3.nabble.com/Display-Bean-Data-In-Table-Vi
ew-tp785464p785488.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.


Mime
View raw message