Re: Scheduler in GWT?

2014-08-05 Thread Xi
Hi,

You can find the concept of Scheduler with this 
link http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsDelayed.html .

You should juste test it in your codes and in your business logic, then 
you will get your response. 

Normally, it is here for resolving performance issues, but if you can't 
use it in the correct way, it could be a cause of a performance issue just 
like other APIs.


Le mardi 5 août 2014 09:11:10 UTC+2, Mohammed Sameen a écrit :
>
> Hi,
> What is Scheduler in GWT?What is the use of Scheduler?Is there any 
> performance issue if we use scheduler commands?Thanks in Advance...
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Explicit Access to GWT Serialization Logic

2013-11-07 Thread Xi
Hi,

I've made a framework (*gwt-storage, *
https://github.com/seanchenxi/gwt-storage) to realize the "Object <-> 
String" serialization/deserialization in client side, I *reused the RPC 
serialization/deserialization logic to do it*. You can check out the source 
code, (package *com/seanchenxi/gwt/storage/client/serializer*), maybe this 
can help you to find out your way. 

It's a pretty simple framework, the GWT RPC 
serialization/deserialization logic is asymmetrical between client and 
server, I just write a SerializationStreamWriter (more like a copy of *
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter*) for 
client side Object to String serialization, and I reused  *
com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader* to do 
client side deserialization.

If you have any question, send me a mail. ;)

Hope helpful !


Le mercredi 6 novembre 2013 10:59:42 UTC+1, Manikanda raj S a écrit :
>
> I have been using GWT RPC calls until now and it was really helpful. But 
> now i wanted to split the Servlet part and Client Part of the GWT. Since 
> GWT RPC is serializing the request and response data, i need to change them 
> to XML/JSON in order to split the GWT code as client & Servlet part or if i 
> could gain access to Serialization logic, i could simply add some code to 
> use 'RequestBuilder' and then explicitly serialize/deserialize in client & 
> servlet side. Marc Hacker already requested for the explicit access to the 
> serialization logic, but he wasn't answered. Can anyone let me know how to 
> access the serialize/deserialize classes in GWT.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.


Re: 请问gwt的学习应该是怎样的步骤呢

2013-08-05 Thread Xi
学习GWT要先从它的几个特点出发:

第一,写程序时,要分清楚,哪些类或者代码是在客户端用的,哪些是在服务器端用的,那些是用来客户端和服务器端沟通的。因为GWT 
的客户端的代码是要重新转换(编译)成javascript,因而有很大的局限性,,例如,所有的stream类都不能在客户端用(详见 
http://www.gwtproject.org/doc/latest/RefJreEmulation.html)。在写程序时,客户端的代码和服务器端的代码有着很明显的分界线。

第二,就是asynchronous call。GWT 的客户端与服务器端的沟通是通过RPC来实现的,而它就是用的asynchronous call。

第三,就是要会用HTML和CSS,以及javascript的特性(单线程,)啦,因这三个就是GWT的本质。

之后就是, 这个官方的 tuto 很好哦 : 
http://www.gwtproject.org/doc/latest/tutorial/gettingstarted.html。强烈推荐!



Le mercredi 31 juillet 2013 04:05:47 UTC+2, buha...@gmail.com a écrit :
>
>
> 我现在是大一的学生,只学习了Java和C,仅仅是书本知识,如果想学gwt的话,应该怎样安排呢,我看到gwt不仅仅涉及了Java,请各位长辈给点意见,十分感谢。

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Saving results from GWT-RPC call on client

2013-03-20 Thread Xi
Hi, 

I've made a framework to do the serialization/deserialization of object 
in client side. Just like monkeyboy's solution, it is based on GWT RPC's 
serialization/deserialization. *But the difference is*, my framework is 
more like *an extension of localStorage/sessionStorage*, that provides the 
possibility of *put/get an object item **directly into/from 
localStorage/sessionSotrage*.

You can find it here : *http://code.google.com/p/gwt-storage/ *

This solution is already used in our applications in production. So, if 
you have any question (performance, serialization/deserialization timing, 
...), I would be very pleased to exchange with you. 

Hope this helps.
Best regards.

 Xi

Le mercredi 10 octobre 2012 07:13:20 UTC+2, JeanV a écrit :
>
> I was wondering if there's anyway to save the returned results from an RPC 
> call to an HTML5 enabled browser. Basically the only way I have found would 
> be to convert the results into strings and use LocalStorage to save them to 
> the browser. I guess my question then would be how can IsSerializable java 
> objects be converted to a string and back.
> Any help would be appreciated.
>
> Jean
>
>

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




Re: How to make use of FileApi in the new Elemental?

2013-02-12 Thread Xi
Hi,

Yes, you can use Elemental to access the html5 FileAPI. I'm using it in 
my personal project.
See the file in attachement, a utility class of file api I created in 
my project. Feel free to use it (*if it works for you* ;)).

Hope this is helpful. 

Le mardi 12 février 2013 10:28:30 UTC+1, membersound a écrit :
>
> Hi,
>
> can I make use of the new Elemental (
> https://developers.google.com/web-toolkit/articles/elemental) to have 
> access to the HTML5 FileAPI?
> Are there any examples yet? Is that yet possible?
>
> Thanks
>

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


package com.seanchenxi.gwt.webrtc.client.file;

import java.util.logging.Logger;

import com.google.gwt.core.client.JavaScriptObject;
import elemental.client.Browser;
import elemental.dom.DOMException;
import elemental.html.DOMFileSystem;
import elemental.html.Entry;
import elemental.html.EntryCallback;
import elemental.html.ErrorCallback;
import elemental.html.FileError;
import elemental.html.FileSystemCallback;
import elemental.html.StorageInfoErrorCallback;
import elemental.html.StorageInfoQuotaCallback;
import elemental.html.VoidCallback;
import elemental.html.Window;
import elemental.js.html.JsFileError;
import elemental.js.util.Json;


public class FileUtilities {

private final static Logger log = Logger.getLogger(FileUtilities.class.getName());

public static void newFileSystem(int type, final double size, final FileSystemCallback successCallback, final ErrorCallback errorCallback){
final int storageType = (type != Window.PERSISTENT || type != Window.TEMPORARY) ? Window.TEMPORARY : type;
Browser.getWindow().getWebkitStorageInfo().requestQuota(storageType, size, new StorageInfoQuotaCallback() {
@Override
public boolean onStorageInfoQuotaCallback(double grantedQuotaInBytes){
Browser.getWindow().webkitRequestFileSystem(storageType, size, successCallback, errorCallback);
return true;
}
}, new StorageInfoErrorCallback() {
@Override
public boolean onStorageInfoErrorCallback(DOMException error){
log.severe("onStorageInfoErrorCallback:\n" + Json.stringify((JavaScriptObject)error));
return errorCallback.onErrorCallback(Json.parse("{\"code\":" + FileError.QUOTA_EXCEEDED_ERR+"}").cast());
}
}
);
}

public static void getFile(DOMFileSystem fileSystem, String name, EntryCallback successCallback, ErrorCallback errorCallback) {
getFile(fileSystem, name, false, successCallback, errorCallback);
}

public static void getFile(DOMFileSystem fileSystem, String name, boolean createIfNotExist, EntryCallback successCallback, ErrorCallback errorCallback) {
fileSystem.getRoot().getFile(name, Json.parse("{\"create\": "+createIfNotExist+"}"), successCallback, errorCallback);
}

public static void removeFile(DOMFileSystem fileSystem, String name,final VoidCallback successCallback, final ErrorCallback errorCallback) {
getFile(fileSystem, name, new EntryCallback() {
@Override
public boolean onEntryCallback(Entry entry){
entry.remove(successCallback, errorCallback);
return true;
}
}, new ErrorCallback() {
@Override
public boolean onErrorCallback(FileError error){
successCallback.onVoidCallback();
return true;
}
});
}

public static void createFile(final DOMFileSystem fileSystem, final String name, final EntryCallback successCallback, final ErrorCallback errorCallback, boolean override) {
//Delete file if exists first.
if (override) {
removeFile(fileSystem, name, new VoidCallback() {
@Override
public void onVoidCallback(){
getFile(fileSystem, name, true, successCallback, errorCallback);
}
},errorCallback);
} else {
getFile(fileSystem, name, override, successCallback, errorCallback);
}
}
}


Re: using autobeans in a gwt-rpc call

2012-12-21 Thread Xi
gwt-rpc call needs concrete class type to do the serialization. So the 
generated autobean proxy won' t be serialized. 

If you do want to send your autobean object to server side, you need to 
use com.google.gwt.http.client.RequestBuilder (client side) to send the 
encoded string to server side, and create a servlet to handle this request.

I attached two files (used in our project), hope these can help you.


Le jeudi 20 décembre 2012 14:55:50 UTC+1, Cenk Oguz a écrit :
>
> I have a small application where I am using autobeans extensively both on 
> server and gwt side. I have an issue though with gwt-rpc calls, autobeans 
> are apparently not serializable which causes gwt to fail with: 
>
> com.google.gwt.user.client.rpc.SerializationException: Type '$Proxy85' was 
> not included in the set of types which can be serialized by this 
> SerializationPolicy
>
> Is there any obvious way that autobeans could be sent client->server side? 
> Gwt-rpc is not good enough? Sending it over as a JSON string imposes some 
> manual labor, seems overkill, would rather just go with POJOs in that case.
>
> /Cenk
>

-- 
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/-/NMbom9Fr3WMJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

package com.exemple.client.service;

import com.google.gwt.core.client.GWT;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.StatusCodeException;
import com.exemple.client.ClientAutoBeanUtils;
import com.exemple.domain.autobean.ServerInfoBean;

public class ServerInfoService {
	
	public final static String PATH = "/serverInfo";

	public void getServerInfo(final AsyncCallback callback){
	
		RequestBuilder request = new RequestBuilder(RequestBuilder.POST, PATH);
		request.setCallback(new RequestCallback() {			
			@Override
			public void onResponseReceived(Request request, Response response) {
if(callback == null) return;
if(200 == response.getStatusCode()){
	try{
		callback.onSuccess(ClientAutoBeanUtils.decode(response.getText(), ServerInfoBean.class));
	}catch(Exception caught){
		callback.onFailure(caught);
	}
}else{
	callback.onFailure(new StatusCodeException(response.getStatusCode(), response.getText()));
}
			}
			
			@Override
			public void onError(Request request, Throwable exception) {
if(callback != null){
	callback.onFailure(exception);
}else if(GWT.getUncaughtExceptionHandler() != null){
	GWT.getUncaughtExceptionHandler().onUncaughtException(exception);
}
			}
		});
		try {
			request.send();
		} catch (RequestException exception) {
			if(callback != null){
callback.onFailure(exception);
			}else if(GWT.getUncaughtExceptionHandler() != null){
GWT.getUncaughtExceptionHandler().onUncaughtException(exception);
			}
		}
		
	}
	
}
package com.exemple.server.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.web.bindery.autobean.shared.AutoBean;
import com.exemple.client.service.ServerInfoService;
import com.exemple.domain.autobean.ServerInfoBean;
import com.exemple.server.ServerAutoBeanUtils;

@WebServlet(ServerInfoService.PATH)
public class ServerInfoServlet extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		resp.sendRedirect("/");
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		AutoBean bean = ServerAutoBeanUtils.createServerInfoBean();
		bean.as().setAvailable(true);
		bean.as().setVersion("");
		String responsePayload = ServerAutoBeanUtils.encode(bean);
		// now you can write your response into resp...
	}
}


Re: cannot use css background-image

2012-03-30 Thread Xi
First, the path "images/XX.png" is completely different with 
"/images/XX.png". So verify your css file's path and his relative path to 
the folder "images"

Then you should add a " *'* " before "images/line.png". Means it should 
like this : background-image:url(*'*images/line.png'); or don not use " *'*", 
like this : background-image:url(images/line.png);

Hope helpful...

Le vendredi 30 mars 2012 11:38:53 UTC+2, tong123123 a écrit :
>
> the css is simple
>
> .backGroundImage1{
> background-image:url(images/line.png');
> background-repeat:repeat-x;
> }
>
>
>
> the gwt code is
>
> public class TestFlowPanelLeft extends FlowPanel {
>
> public void onLoad(){
> Image image1 = new Image();
> image1.setUrl("/images/smallImg1.JPG");
> image1.setSize("100px", "100px");
> image1.setStyleName("floatLeft");   
> FlowPanel flowPanel1 = new FlowPanel();   
> flowPanel1.add(image1);   
> this.add(flowPanel1);   
> HorizontalPanel line1 = new HorizontalPanel();
> line1.addStyleName("backGroundImage1");
> line1.setWidth("200px");
> this.add(line1);
> }
>
> }
>
>
> the image1 can be shown, so it proof the path "/images/XX.png" is correct, 
> but the backGroundImage1 cannot be shown, what is the reason?
> also, I cannot use ImageBundle and already give up after several try, so I 
> still prefer to use this method.
>
> I try to use background image because I want to do something like
> Title1
>abc
>   def
>
> Title2
>   fbg
>
>
> the "" cannot be hardcode use "--" because when the browser 
> window minimize, the line will broken to two line, so I want to use image 
> of line and set its width to 100% of a horizontalpanel, in fact, is this 
> method feasible?
>
>

-- 
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/-/pY78z4WLq4kJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: GWT Slider

2011-10-08 Thread Xi
Try this:
http://nivo.dev7studios.com/

very simple to use, and works for all browers...


On 7 oct, 22:21, mkn  wrote:
> Hi
>
> I need for a project a slider (an important requirement). Therefore I
> tested the following sliders:
>
> -SmartGWT => there is a huge overhead. My page has only sliders (10 of
> them) but since SmartGWT is a full-fledged library it takes up to 5
> seconds to display the page (respectively to load the SmartGWT
> javascripts). This is not acceptable because the user sees 5 seconds
> long a white page.
> -JQuery slider => for unknown reason, this slider does not work in
> IE8.
> -GWT Incubator => does not work with GWT 2.4
>
> Does anyone else have an idea what else I could try?

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: byte array to Image

2011-09-16 Thread Xi
Hi,

I've used http://sourceforge.net/projects/migbase64/ in my
application, to convert the byte array to a base64 string, which works
pretty well and efficient
My code is like : String base64 = "data:image/png;base64," +
Base64.encodeToString(bytes,false);
And at the client side, you just set the value into an image
element's "src" attribute.

But be careful, IE CAN NOT take charge of an image that bigger
than 32KB by using the "Base64" way.

Hope this can help you.

On 16 sep, 12:54, AgitoM  wrote:
> Hi all,
>
> From a web service I am receiving a byte array that represents a
> image.
> I need to somehow squeeze this byte array into a image widget or
> similar widget on my client side.
>
> First I tried to convert the byte array to a base64 string:
> String base64 = Base64Utils.toBase64(image);
> base64 = "data:image/png;base64,"+base64;
>
> This didn't work. The developer of the web service informed me that I
> should not convert the byte array to a base64 string, and just use it
> directly.
>
> To test if the byte array represented a correct image, I saved the
> byte array to a physical image:
> InputStream in = new ByteArrayInputStream(image);
> BufferedImage bImage = ImageIO.read(in);
>
> File outputfile = new File("saved.png");
> ImageIO.write(bImage, "png", outputfile);
>
> This succesfully resulted in a physical image being created.
>
> However I don't want to write the file and then send the URL to the
> image widget on my client side.
>
> Anybody have any suggestion about how I can get this byte array
> squeezed into a image?
> Or convert this byte array to a base64 string that does work?

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



UserService.getCurrentUser() is not working for me

2010-05-18 Thread Xi Zhang
Hi there:

I am a beginner of GWT.

The problem I am having is I couldn't get Google account
authentication. I simply added UserService.getCurrentUser() to the
default project trying to return the user name trough RPC call but it
didn't work. I tried upload the project to GAE and the result is the
same.

Anyone knows why this is happening?

Thanks,.

Xi Zhang

-- 
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-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



How to user Google account authentication along with RPC?

2010-05-16 Thread Xi Zhang
Hi there:

I am using Google account as authentication of my application. I am
trying to use a RPC call to retrieve the user information using
com.google.appengine.api.users.UserServiceFactory.

So far I have something like:

@SuppressWarnings("serial")
public class MyAppImpl extends  RemoteServiceServlet  implements
MyAppService   {
  public SvUser getUser() {
  User userG = UserServiceFactory.getUserService().getCurrentUser();
 if (userG == null){
return null;
 }else{
 return new SvUser(userG.getUserId(), userG.getNickname(),
userG.getEmail());
  }
 }
}

where SvUser is a serializable DTO. The RPC is working properly,
however I can only get a null as return value, which indicates that I
cannot retrieve anything from Google.

Is there something I am missing in the code? Or it's not working under
development mode?

Thanks!

-- 
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-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.