Example usage for com.google.gwt.websocket.client SocketMessage getStringMessage

List of usage examples for com.google.gwt.websocket.client SocketMessage getStringMessage

Introduction

In this page you can find the example usage for com.google.gwt.websocket.client SocketMessage getStringMessage.

Prototype

public final native String getStringMessage() ;

Source Link

Usage

From source file:org.rest.client.activity.SocketActivity.java

License:Apache License

@Override
public void prepareDownloadData(Callback<String, Throwable> callback) {
    if (exportFileObjectUrl != null) {
        revokeDownloadData();/*from   w  ww.  jav a  2s .c o m*/
    }
    StringBuilder out = new StringBuilder();
    for (SocketMessage message : messages) {
        long time = (long) message.getCreated();
        Date created = new Date(time);
        String date = DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_MEDIUM).format(created);
        boolean isSent = message.isMessageIsSent();
        out.append("[").append(date).append("]");
        out.append(isSent ? " <<< " : " >>> ");
        out.append(message.getStringMessage());
        out.append("\n");
    }
    exportFileObjectUrl = createDownloadDataImpl(out.toString(), "text/plain");
    callback.onSuccess(exportFileObjectUrl);
}