|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2011 EclipseSource and others. |
2 |
* Copyright (c) 2011, 2012 EclipseSource and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 10-18
Link Here
|
| 10 |
******************************************************************************/ |
10 |
******************************************************************************/ |
| 11 |
package org.eclipse.rwt.internal.protocol; |
11 |
package org.eclipse.rwt.internal.protocol; |
| 12 |
|
12 |
|
| 13 |
import java.util.*; |
13 |
import java.util.LinkedHashMap; |
|
|
14 |
import java.util.Map; |
| 15 |
import java.util.Set; |
| 14 |
|
16 |
|
| 15 |
import org.eclipse.rwt.internal.theme.JsonObject; |
17 |
import org.eclipse.rwt.internal.theme.JsonArray; |
| 16 |
import org.eclipse.rwt.internal.theme.JsonValue; |
18 |
import org.eclipse.rwt.internal.theme.JsonValue; |
| 17 |
|
19 |
|
| 18 |
|
20 |
|
|
Lines 69-87
Link Here
|
| 69 |
details.put( key, value ); |
71 |
details.put( key, value ); |
| 70 |
} |
72 |
} |
| 71 |
|
73 |
|
| 72 |
JsonObject toJson() { |
74 |
JsonValue toJson() { |
| 73 |
JsonObject json = new JsonObject(); |
75 |
JsonArray json = new JsonArray(); |
| 74 |
json.append( ProtocolConstants.OPERATION_TARGET, target ); |
76 |
json.append( target ); |
| 75 |
json.append( ProtocolConstants.OPERATION_ACTION, action ); |
77 |
json.append( action ); |
| 76 |
if( !details.isEmpty() ) { |
78 |
if( !details.isEmpty() ) { |
| 77 |
Set<String> keySet = details.keySet(); |
79 |
Set<String> keySet = details.keySet(); |
| 78 |
for( String key : keySet ) { |
80 |
for( String key : keySet ) { |
| 79 |
json.append( key, JsonUtil.createJsonValue( details.get( key ) ) ); |
81 |
json.append( JsonUtil.createJsonValue( details.get( key ) ) ); |
| 80 |
} |
82 |
} |
| 81 |
} |
83 |
} |
| 82 |
if( !properties.isEmpty() ) { |
84 |
if( !properties.isEmpty() ) { |
| 83 |
JsonValue jsonObject = JsonUtil.createJsonObject( properties ); |
85 |
JsonValue jsonObject = JsonUtil.createJsonObject( properties ); |
| 84 |
json.append( ProtocolConstants.OPERATION_PROPERTIES, jsonObject ); |
86 |
json.append( jsonObject ); |
| 85 |
} |
87 |
} |
| 86 |
return json; |
88 |
return json; |
| 87 |
} |
89 |
} |