No announcement yet.
  • Filter
  • Time
Clear All
new posts

    Where are those gwt extensions? I could not check out any thing!

    Originally posted by nlotz
    Could you add that to smartgwt-extensions ?

    I could set up automated builds plus a Maven repository, enabling us to get updates automatically.


      I've added DSrequest to the signatures and made operations that don't have endpoints defined fall back to the default behavior. I also corrected a bug in the add dispatching while in bulk mode and removed some dead code.


      That makes sense, how can I get this code into extensions?


      In fact my backend only stores Stocks which only have names. Whenever I fetch from the backend I create StockPrices with random price data in the other two fields. You're right that it's not the most realistic example in the world.
      Attached Files


        Originally posted by benjaminberry
        That makes sense, how can I get this code into extensions?
        Sanjiv will add you as a developer of smartgwt-extensions and after that you should be able to commit to SVN.

        I will populate the project with a Maven build specification in the next few days and add your code if you haven't done so, already.

        @Sanjiv: Do you have a name for the root package of all extensions in mind ? Something like com.smartgwt.ext or com.smartgwt.extensions ?

        In the latter case your code would end up in
        or something similar.

        P.S.: I would vote for extensions instead of ext to avoid confusion with other libraries.


          com.smartgwt.extensions sounds good.

          Benjamin, send me an email (sanjiv dot jivan at gmail) with your google ID. I'll add you as a commiter.



            Hi, I've made 1 change to enable server pagination to your code:

               public GwtRpcDataSource() {
            and now I get this error (in attachment)

            does it means that I can't use server side data pagination with rpc in free (lgpl) version?

            more source files in attachments
            Attached Files
            Last edited by Przemeq; 18 Mar 2009, 11:28.


              supported Tree over GWT-RPC

              Hi, I modified GwtRpcDataSource to support Tree load on demand over GWT-RPC.
              I only tested Fetch right now.
              The method I modified is executeFetch
              protected void executeFetch(final DSRequest request)
              		fetchEndpoint.callEndpoint(new AsyncCallback<Object>()
              			public void onFailure(Throwable caught)
              			public void onSuccess(Object object)
              				Collection<T> resultSet = fetchEndpoint.transformResult(object);
              				 JavaScriptObject obj=request.getAttributeAsJavaScriptObject("parentNode");
              			  	 TreeNode parentNode=new TreeNode(obj);
              			  	 TreeNode[] nodes=new TreeNode[resultSet.size()];
              			  	 int index=0;
              				for (T result: resultSet)
              					DSRequest req = new DSRequest();
              					req.setAttribute(DO_NOT_HANDLE, true);
              					final TreeNode node = new TreeNode();
              					populateRecord(node, result, request);
              				// You have to pass somehow the Tree into DataSource. It is not good to make
              				//DataSource depend on Tree. But this is the only way I can make it work.
              				tree.addList(nodes, parentNode);
              				// This approach does not work
              		}, request, parameters);
              My populateRecord is different
              	protected abstract void populateRecord(ListGridRecord record, T object, DSRequest request);
              An example popupateRecord implementation
              protected void populateRecord(ListGridRecord record, Node node, DSRequest request)
              		record.setAttribute("name", node.getName());
              		 JavaScriptObject obj=request.getAttributeAsJavaScriptObject("parentNode");
              	  	 TreeNode parentNode=new TreeNode(obj);
              		//need to set id based on request
              		record.setAttribute("id", parentNode.getAttribute("id")+"."+node.getName());
              		record.setAttribute("folder", true);


                Do you plan an intergration of a RPC datasource in smartGWT ?


                  Originally posted by ben75000
                  Do you plan an intergration of a RPC datasource in smartGWT ?
                  Yeah, I think a standard way for doing this would be appreciated :)


                    Another implementation.


                    Just posted another GWT-RPC implementation with working RPC service example.



                      Ben, thanks again for posting this example, which has helped a number of users, and thanks everyone else for the various refinements. However the approach shown by Alius in this thread uses some new SmartClient APIs to provide a cleaner integration approach that is able to support paging and has a few other advantages - please take a look.


                        It's a bit frustrating that this is what you had in mind and when I had asked explicitly how users should tackle this problem you previously pointed at overloading transformRequest in the fashion I did.

                        If alius does not go searching through your source then we'd all be stuck with an inferior approach to this problem. But now that he has this is the new standard. This makes me wonder if there aren't other enhancements to this approach that haven't been made public yet.

                        You have not clearly communicated to the community what SmartGWT EE is going to do, only that it's coming and that the hardest problems people are trying to solve right now with your product may go away with it. In the mean time you seem content to let users fumble around the dark about how you want them to uses datasources and gwt-rpc. This is not productive for your end users.



                          Hi Benjamin,
                          I had responded to your earlier post here saying :

                          I understand the issue you're running into and although do-able, it's not super convenient integrating gwt-rpc due to the points you raise. A couple of key API's have been incorporated into SmartClient to support getting gwt-rpc integration to be smoother. I will have to validate and then incorporate them.

                          You could proceed the path you're taking and update the code when the feature is incorporated. This is a priority along with other features like i18n and exposing the ResultSet API. So "star" the issue in tracker if it is important to you.
                          The issue tracker has a voting system which is considered when priotitizing tasks. i18n is on the top of the list and support for it has just been added. Adding the ResultSet API also has a lot of votes and is equally important.

                          Please rest assured that there are no hiding games being played here. Why else would the custom datasource feature be added to SmartClient. It was added specifically to support GWT-RPC and you'll notice that earlier builds / releases of SC didn't have this feature. It takes some time to validate and test such a solution before pushing it out and alius got there first.

                          Yes, there are still some API gaps between SmartClient and SmartGWT and if you discover an API you need which is missing, file an issue. Or if a particular feature is important to you, make sure there is a feature request in tracker for it, and that you "star" it.



                            Hi Benjamin,

                            Sorry you ended up frustrated, but, realize this is just a matter of timing. We needed to add features to SmartClient to address GWT-RPC integration. Until those features were added, your approach was the right one, the best that could be achieved in the absence of the new features. That's why we stickied the thread and recommended it.

                            Alius discovered the new features in not-quite-final form while we were still working on examples, and in particular trying to figure out a way around the somewhat awkward need to copyValues() as shown in Alius' example. Just normal development cycle stuff, not secret APIs.

                            In retrospect, copyValues() is not so bad, just imperfect, and we probably should have just posted a sample with a similar approach, since the new APIs do enable paging.

                            As far as SmartGWT EE, we're not trying to be secretive about that either, as we've touched on elsewhere it basically allows integration with the SmartClient Server. The DMI feature gives you the ability to do something similar to GWT-RPC, but with no need for a special RemoteService class or any other extra classes involved. Values are populated into your Java beans via reflection, with automatic validation, as well as the ability to compose together a series of calls as a single HTTP request via queuing. If you want more details, there's an example here where both the XML DataSource format and server-side code involved are identical in SmartGWT EE.


                              Well sometimes I also get this feeling of hidden api's but then I think... well they are at beta2, what do you want... give it a little time to sort things up. Actually my implementation of the rpc is worse than this one here and the other new one discovered so...


                                Urgent ... Can't fetch data

                                hi all,
                                i tried to use these classes my datagrid is not filling :(
                                there is caption "Loading Data" and nothing more.
                                what i did wrong ?
                                here is my code snippets :
                                1.Panel which contains datagrid :
                                public class RouterTab extends HLayout {
                                    private static DataSource dataSource = null;
                                    private VLayout vLayout = null;
                                    public RouterTab() {
                                        vLayout = new VLayout();
                                    private void createDataGrid() throws IllegalStateException {
                                        dataSource = RouterDataSource.getInstance();
                                        final ListGrid listGrid = new ListGrid();
                                        ClientSession.getInstance().getLogger().info("setting datasource RouterDataSource...", null);
                                        ClientSession.getInstance().getLogger().info("fetching data ...", null);
                                        listGrid.addRecordDoubleClickHandler(new RecordDoubleClickHandler() {
                                            public void onRecordDoubleClick(RecordDoubleClickEvent event) {
                                                GWT.log("clicked on record", null);
                                        GWT.log(RouterDataSource.getInstance().getTitle(), null);
                                2. datasource :
                                public class RouterDataSource extends GwtRpcDataSource<GWTMgtNetRouter> {
                                    public static String DATA_SOURCE_ID = "RouterDataSourceDS";
                                    private static RouterDataSource instance = null;
                                    public static RouterDataSource getInstance() {
                                        if (instance == null) {
                                            instance = new RouterDataSource();
                                        return instance;
                                    public RouterDataSource() {
                                        setFetchEndpoint(new GwtRpcDataSourceEndpoint<GWTMgtNetRouter>() {
                                            public void callEndpoint(AsyncCallback callback, Object... parameters) {
                                                ClientSession.getInstance().getLogger().info("event", null);
                                                MgtNetServiceAsync mgtNetService = ClientSession.getInstance().getMgtNetService();
                                                GWTUserContext context = ClientSession.getInstance().getGWTUserContext();
                                                mgtNetService.getMgtNetRouters(context, callback);
                                        setUpdateEndpoint(new GwtRpcDataSourceEndpoint<GWTMgtNetRouter>() {
                                            public void callEndpoint(AsyncCallback callback, Object... parameters) {
                                                MgtNetServiceAsync stockService = GWT.create(MgtNetService.class);
                                                ListGridRecord record = (ListGridRecord) parameters[0];
                                            // edit
                                            //stockService.editStock(record.getAttributeAsInt("id"), record.getAttribute("symbol"), callback);
                                        setRemoveEndpoint(new GwtRpcDataSourceEndpoint<GWTMgtNetRouter>() {
                                            public void callEndpoint(AsyncCallback callback, Object... parameters) {
                                                MgtNetServiceAsync stockService = GWT.create(MgtNetService.class);
                                                ListGridRecord record = (ListGridRecord) parameters[0];
                                            // remove
                                            //stockService.removeStock(record.getAttributeAsInt("id"), callback);
                                        setAddEndpoint(new GwtRpcDataSourceEndpoint<GWTMgtNetRouter>() {
                                            public void callEndpoint(AsyncCallback callback, Object... parameters) {
                                                MgtNetServiceAsync stockService = GWT.create(MgtNetService.class);
                                                ListGridRecord record = (ListGridRecord) parameters[0];
                                            // add
                                            //stockService.addStock(record.getAttribute("symbol"), callback);
                                        DataSourceIntegerField idDataField = new DataSourceIntegerField("id", "ID");
                                        DataSourceTextField nameDataField = new DataSourceTextField("name", "Router Name");
                                        DataSourceTextField ipAddressDataField = new DataSourceTextField("ipadress", "IP Adress");
                                        DataSourceDateField regDateDataField = new DataSourceDateField("regdate", "Register Date");
                                        DataSourceDateField updDateDataField = new DataSourceDateField("upddate", "Update Date");
                                        setFields(idDataField, nameDataField, ipAddressDataField, regDateDataField, updDateDataField);
                                    protected void populateRecord(ListGridRecord record, GWTMgtNetRouter gWTMgtNetRouter) {
                                        record.setAttribute("id", gWTMgtNetRouter.getId().intValue());
                                        record.setAttribute("name", gWTMgtNetRouter.getName());
                                        record.setAttribute("ipadress", gWTMgtNetRouter.getIpAddress());
                                        record.setAttribute("regdate", gWTMgtNetRouter.getRegDate());
                                        record.setAttribute("upddate", gWTMgtNetRouter.getUpdDate());

                                what i did incorrect ?
                                setFetchEndpoint is not invoked .....

                                Paata Lominadze.
                                Magticom LTD.