Hum... I see, well... I've never worked with smartgwt. i think you can do this in a less complicated way.
Regards, _____________________ Ing. Gabriel Gutiérrez On Mon, Apr 20, 2009 at 8:52 AM, Neo <[email protected]> wrote: > > I thought of this option but even that wont work out. I have a > TreeGrid object and to populate it I have created a class which > extends DataSource. > > TreeGrid treeGrid = new TreeGrid(); > TaskXmlDS taskXmlDS = TaskXmlDS.getInstance(); > treeGrid.setDataSource(taskXmlDS); > > import com.smartgwt.client.data.DataSource; > import com.smartgwt.client.data.fields.DataSourceIntegerField; > import com.smartgwt.client.data.fields.DataSourceTextField; > > public class TaskXmlDS extends DataSource { > > private static TaskXmlDS instance = null; > > public static TaskXmlDS getInstance() { > if (instance == null) { > instance = new TaskXmlDS("taskXmlDS"); > } > return instance; > } > > public TaskXmlDS(String id) { > > setID(id); > setRecordXPath("/tasks/task"); > > DataSourceTextField taskNameField = new DataSourceTextField > ("taskName", "Task Name" , 128); > DataSourceTextField taskNameDesc = new DataSourceTextField > ("taskDesc", "Description", 100); > DataSourceTextField taskStartTime = new DataSourceTextField > ("taskStartTime", "Start Time", 80); > DataSourceTextField taskEndTime = new DataSourceTextField > ("taskEndTime", "End Time", 80); > > DataSourceIntegerField taskIdField = new > DataSourceIntegerField > ("taskId", "Task ID"); > taskIdField.setPrimaryKey(true); > taskIdField.setRequired(true); > > DataSourceIntegerField taskParentId = new > DataSourceIntegerField > ("taskParentId", "Parent ID"); > taskParentId.setRequired(true); > taskParentId.setForeignKey(id + ".taskId"); > taskParentId.setRootValue("1"); > > setFields(taskIdField, taskParentId, taskNameField, > taskNameDesc, > taskStartTime, taskEndTime); > setDataURL("tasks.data.xml"); > setClientOnly(true); > } > } > > > In the second last line of code I need to pass the name of an XML > file. > This is why I want to create a XML file. > > > > On Apr 20, 6:43 pm, Gabriel Ernesto Gutierrez Añez > <[email protected]> wrote: > > You don't have to create it, you can return the hole XML as an String. > > > > Regards, > > _____________________ > > Ing. Gabriel Gutiérrez > > > > On Mon, Apr 20, 2009 at 8:28 AM, Neo <[email protected]> wrote: > > > > > Hi, > > > > > In my server side code I fetch some data from the database and create > > > an ArrayList. The list holds the database's data. Next, I create a > > > XML file using the data in the arraylist. When I try to create a file > > > the file gets created in the project's root directory instead of > > > getting created in the current directory ,i.e, the "server" directory. > > > This is the line of code I am using : > > > > > package com.myorg.gwt.desk.server; > > > > > public class ProdDeskServerUtil { > > > > > public static void writeListToFile(List<Task> taskList) > > > { > > > Iterator<Task> taskListIterator = taskList.iterator(); > > > PrintWriter out = null; > > > try > > > { > > > out = new PrintWriter(new > > > FileOutputStream("tasks.data.xml")); > > > ...... > > > } > > > } > > > } > > > > > How can i create a file in the current directory ? > > > > > Once the file gets created how should i read the file from the client > > > side code ? > > > > > My aim is to feed this XML file into a TreeView widget. > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "GWT-Ext Developer Forum" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/gwt-ext?hl=en -~----------~----~----~----~------~----~------~--~---
