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

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

Introduction

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

Prototype

public final native double getCreated() ;

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();//www .j  a v a  2s.  co 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);
}