Tuesday, January 1, 2013

Re: dynamic update data

define some class with a name like ClientContext or something like that. Let that class be the "home" of the client entities you want to manage (like your pizzas). This class is responsble of mantaining this "client entities" both by let you add/remove the entities and also let observers to subscribe to "entity changes". So when you add / remove entities you notify the observers. Then register a Entity change listener and when notified for an entity change, just update all the GUI components that need to be updated when you add/remove pizzas. Something like this:

public class ClientContext {
private List<Pizza> pizzas;
public void add(Pizza p) {
pizzas.add(p);
notifyAllListeners();
}
public void addPizzaListener(PizzaListener l){...}
public void notifyAllListeners(){for(PizzaListener l : listeners){l.notifyPizzasChange(); }}
}

..then on your GUI code...:
ClientContext.getInstance().addPizzaListener(new PizzaListener(){
public void notifyPizzasChange(){update the list box using ClientContext.getInstance().getPizzas()}
})

Hope this can clarify something... Happy new year to you too!

P/D: in these cases, I often find much more useful to have a Map<String, Pizza> for storing the pizzas by id. Also you can use a cheap map using Js Objects directly instead of java.util.Map implementations, like this: http://code.google.com/p/yuigwt/source/browse/trunk/yuigwt/src/org/sgx/yuigwt/yui/util/LWMap.java 

On Tuesday, January 1, 2013 5:29:57 PM UTC+1, Aldin wrote:
Happy New Year!

Your idea is not bad. But I don't know how to achieve your logic. I trying to implement your idea without success.
I can add my new pizza object to ArrayList of pizza objects but how to update the ListBox???


On Mon, Dec 24, 2012 at 6:14 PM, Sebastián Gurin <sebast...@gmail.com> wrote:
If the pizza objects that your client posses are not a very big number, then, instead updating against the server, you can mantain a local collection of pizzas in the client. I mean, write a class like PizzaHome or something like that that contains a collection or a map of pizzas. When you add a new pizza or remove a pizza, make a call to the server for adding/updating and then modify the local pizza home PizzaHome.getInstance().addNew(pizza1). The Pizza home can be an Observable that notify other interested part of your client when the local pizza collection changes. Also from time to time you can synchronize this PizzaHome with your server.

On Monday, December 24, 2012 8:48:00 AM UTC-2, Aldin wrote:
Hi guys,

I am developing pizza ordering application. I have two forms:

1) For inserting new pizza
2) and for ordering.

Here you can see:




When I insert a new pizza and go to check on combo box (picture ordering) I can't see my new pizza in combo box. The new pizza is inserted in my databases. The pizzas in combo box are from my database.

I have one idea.  But I don't think it is good. To use

    Timer t = new Timer() {        public void run() {          //display all pizza from my database every 2 se to combobox        }      };
t.schedule(2000);

Any idea for better approach???
Thanks

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/1VMHjsTx0o4J.

To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/ZpGfUttNR3MJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Re: dynamic update data

Happy New Year!

Your idea is not bad. But I don't know how to achieve your logic. I trying to implement your idea without success.
I can add my new pizza object to ArrayList of pizza objects but how to update the ListBox???


On Mon, Dec 24, 2012 at 6:14 PM, Sebastián Gurin <sebastigurin@gmail.com> wrote:
If the pizza objects that your client posses are not a very big number, then, instead updating against the server, you can mantain a local collection of pizzas in the client. I mean, write a class like PizzaHome or something like that that contains a collection or a map of pizzas. When you add a new pizza or remove a pizza, make a call to the server for adding/updating and then modify the local pizza home PizzaHome.getInstance().addNew(pizza1). The Pizza home can be an Observable that notify other interested part of your client when the local pizza collection changes. Also from time to time you can synchronize this PizzaHome with your server.

On Monday, December 24, 2012 8:48:00 AM UTC-2, Aldin wrote:
Hi guys,

I am developing pizza ordering application. I have two forms:

1) For inserting new pizza
2) and for ordering.

Here you can see:




When I insert a new pizza and go to check on combo box (picture ordering) I can't see my new pizza in combo box. The new pizza is inserted in my databases. The pizzas in combo box are from my database.

I have one idea.  But I don't think it is good. To use

    Timer t = new Timer() {        public void run() {          //display all pizza from my database every 2 se to combobox        }      };
t.schedule(2000);

Any idea for better approach???
Thanks

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/1VMHjsTx0o4J.

To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Updating GWT libraries for supporting xsiframe

I'm the author of some GWT libraries wrapping some JS libraries like YUI, raphaeljs, sizzlejs, etc. In this GWT libraries I need to include the JS files and until now I'm doing this using <script src="jsLibrary.js"></script> in my libraries gwt.xml. This way the end user of my libs do not have to worry about getting or loading the JS library at all, just <inherith> my library and it is ready to work.

But <script> in gwt.xml is not supported by the new xsiframe linker. As I understand from previous discussion and documentation, there are two possible solutions:

1) First solution: let the user be responsible of including the aLibrary.js file in its html host page. This adds extra work to the end user: he has to download the .js minified file and include it on the html host page.

2) Second solution: use a tool like ScriptInjector for loading aLibrary.js file dynamically. With this solution I release the user of the responsabilities of having to get the .js file and put it on the host page, but adds an extra step for our users. For example, in my libraries  "getting started" guides like http://code.google.com/p/gwtsizzle/wiki/GettingStarted the user is able to use the Java API directly withtout loading anything, but now he must first load the "library" async for using it, like this:

MyLib.load(new MyCallback(){
    public void loaded(){
        //now start using the API
    }
})

This two solutions adds extra work to the end user compared to my current solution of symply using <script src="aLib.js"></script> in my library's gwt.xml file. So my question is, am I missing something ? a third solution that I didn't contemplate ? Or simply updating my GWT wrapper libraries to support xsiframe linker will add extra work to my libraies end users ?

Regards and thanks in advance.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/Gah89dluRfkJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Re: gwtsizzle - CSS selectors for GWT dom

Oh another term :( I think I will call it wrapper as you suggested before. I like the first level wrapper vs second level wrapper idea for discriminate between them. Thank you again for all the help!

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/I0tQmK7_KPMJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Re: gwtsizzle - CSS selectors for GWT dom

Yes, I know, sizzle will use querySelector when available and it has an implementation for old browsers. Regards

On Tuesday, January 1, 2013 8:24:51 AM UTC-2, Chris Price wrote:

Not sure which browsers you are targeting or the selectors you require, but querySelector might be an alternative without requiring the extra library.
http://caniuse.com/#feat=queryselector

On 1 Jan 2013 05:14, "Sebastián Gurin" <sebast...@gmail.com> wrote:
Thank you Thomas for the clarification and for taking a look to the project. Didn't know about the new xsiframe. I'm reading some documentation and fixing my projects.

about wrapper/port thing, I thought a wrapper was when you put the JSO as a "pure" java class attribute. Then you delegate all methods to the JSO. You have a little (x2) overhead because of the second call but you gain in language because you work with "pure" java so you can do new MyClass() and inheritance.

In my case I use JSOs for talking directly to JS objects from java, so I didn't called "wrapper" but perhaps you are right, i don't know... iIm pretty confused about terminology here.... you are right it is not a port... I would call it "(direct) Java API for sizzlejs ".

Happy new year and thanks again!

On Monday, December 31, 2012 9:58:44 PM UTC-2, Thomas Broyer wrote:


On Monday, December 31, 2012 10:55:50 PM UTC+1, Sebastián Gurin wrote:
I needed a lightweight solution for CSS selectors in com.google.gwt.dom.client.Element so I made a GWT port of the JavaScript library sizzlejs.com/

Ah, this is not a port, it's a wrapper.
Also note that the <script src=""> in the gwt.xml won't work with the xsiframe linker (and the xsiframe linker is the future)

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/RjoowyRiuDEJ.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/Og5rXrn-F8UJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Re: gwtsizzle - CSS selectors for GWT dom



On Tuesday, January 1, 2013 6:13:32 AM UTC+1, Sebastián Gurin wrote:
Thank you Thomas for the clarification and for taking a look to the project. Didn't know about the new xsiframe. I'm reading some documentation and fixing my projects.

about wrapper/port thing, I thought a wrapper was when you put the JSO as a "pure" java class attribute. Then you delegate all methods to the JSO. You have a little (x2) overhead because of the second call but you gain in language because you work with "pure" java so you can do new MyClass() and inheritance.

I would say there are two "levels" of wrapping: providing a GWT API for a JS lib, and then providing a more Java-like/bean-like API on top of it.
 
In my case I use JSOs for talking directly to JS objects from java, so I didn't called "wrapper" but perhaps you are right, i don't know... iIm pretty confused about terminology here.... you are right it is not a port... I would call it "(direct) Java API for sizzlejs ".

Let's call it a "bridge" then. 

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/4Tiqzl06LmMJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Re: gwtsizzle - CSS selectors for GWT dom

Not sure which browsers you are targeting or the selectors you require, but querySelector might be an alternative without requiring the extra library.
http://caniuse.com/#feat=queryselector

On 1 Jan 2013 05:14, "Sebastián Gurin" <sebastigurin@gmail.com> wrote:
Thank you Thomas for the clarification and for taking a look to the project. Didn't know about the new xsiframe. I'm reading some documentation and fixing my projects.

about wrapper/port thing, I thought a wrapper was when you put the JSO as a "pure" java class attribute. Then you delegate all methods to the JSO. You have a little (x2) overhead because of the second call but you gain in language because you work with "pure" java so you can do new MyClass() and inheritance.

In my case I use JSOs for talking directly to JS objects from java, so I didn't called "wrapper" but perhaps you are right, i don't know... iIm pretty confused about terminology here.... you are right it is not a port... I would call it "(direct) Java API for sizzlejs ".

Happy new year and thanks again!

On Monday, December 31, 2012 9:58:44 PM UTC-2, Thomas Broyer wrote:


On Monday, December 31, 2012 10:55:50 PM UTC+1, Sebastián Gurin wrote:
I needed a lightweight solution for CSS selectors in com.google.gwt.dom.client.Element so I made a GWT port of the JavaScript library sizzlejs.com/

Ah, this is not a port, it's a wrapper.
Also note that the <script src=""> in the gwt.xml won't work with the xsiframe linker (and the xsiframe linker is the future)

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/RjoowyRiuDEJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.