use of com.ait.tooling.nativetools.client.collection.MetaData in project lienzo-core by ahome-it.
the class Layer method toJSONObject.
/**
* Serializes this Layer as a {@link com.google.gwt.json.client.JSONObject}
*
* @return JSONObject
*/
@Override
public JSONObject toJSONObject() {
final JSONObject object = new JSONObject();
object.put("type", new JSONString(getNodeType().getValue()));
if (hasMetaData()) {
final MetaData meta = getMetaData();
if (false == meta.isEmpty()) {
object.put("meta", new JSONObject(meta.getJSO()));
}
}
object.put("attributes", new JSONObject(getAttributes().getJSO()));
final NFastArrayList<IPrimitive<?>> list = getChildNodes();
final JSONArray children = new JSONArray();
if (null != list) {
final int size = list.size();
for (int i = 0; i < size; i++) {
final IPrimitive<?> prim = list.get(i);
if (null != prim) {
JSONObject make = prim.toJSONObject();
if (null != make) {
children.set(children.size(), make);
}
}
}
}
object.put("children", children);
object.put("storage", getStorageEngine().toJSONObject());
return object;
}
use of com.ait.tooling.nativetools.client.collection.MetaData in project lienzo-core by ahome-it.
the class Scene method toJSONObject.
/**
* Returns a {@link JSONObject} representation containing the object type, attributes and its respective children.
*
* @return JSONObject
*/
@Override
public final JSONObject toJSONObject() {
final JSONObject object = new JSONObject();
object.put("type", new JSONString(getNodeType().getValue()));
if (hasMetaData()) {
final MetaData meta = getMetaData();
if (false == meta.isEmpty()) {
object.put("meta", new JSONObject(meta.getJSO()));
}
}
object.put("attributes", new JSONObject(getAttributes().getJSO()));
final NFastArrayList<Layer> list = getChildNodes();
final JSONArray children = new JSONArray();
if (list != null) {
final int size = list.size();
for (int i = 0; i < size; i++) {
final Layer layer = list.get(i);
if (null != layer) {
final JSONObject make = layer.toJSONObject();
if (null != make) {
children.set(children.size(), make);
}
}
}
}
object.put("children", children);
object.put("storage", getStorageEngine().toJSONObject());
return object;
}
use of com.ait.tooling.nativetools.client.collection.MetaData in project lienzo-core by ahome-it.
the class Sprite method toJSONObject.
@Override
public JSONObject toJSONObject() {
JSONObject attr = new JSONObject(getAttributes().getJSO());
if (getSerializationMode() == ImageSerializationMode.DATA_URL) {
String url = getURL();
if (false == url.startsWith("data:")) {
attr.put("url", new JSONString(ScratchPad.toDataURL(m_sprite)));
}
}
JSONObject object = new JSONObject();
object.put("type", new JSONString(getShapeType().getValue()));
if (hasMetaData()) {
final MetaData meta = getMetaData();
if (false == meta.isEmpty()) {
object.put("meta", new JSONObject(meta.getJSO()));
}
}
object.put("attributes", attr);
return object;
}
use of com.ait.tooling.nativetools.client.collection.MetaData in project lienzo-core by ahome-it.
the class Viewport method toJSONObject.
/**
* Returns a {@link JSONObject} representation of the {@link Viewport} with its {@link Attributes} as well as its children.
*
* @return {@link JSONObject}
*/
@Override
public final JSONObject toJSONObject() {
final JSONObject object = new JSONObject();
object.put("type", new JSONString(getNodeType().getValue()));
if (hasMetaData()) {
final MetaData meta = getMetaData();
if (false == meta.isEmpty()) {
object.put("meta", new JSONObject(meta.getJSO()));
}
}
object.put("attributes", new JSONObject(getAttributes().getJSO()));
final JSONArray children = new JSONArray();
children.set(0, getScene().toJSONObject());
object.put("children", children);
object.put("storage", getStorageEngine().toJSONObject());
return object;
}
use of com.ait.tooling.nativetools.client.collection.MetaData in project lienzo-core by ahome-it.
the class Shape method toJSONObject.
/**
* Serializes this shape as a {@link JSONObject}
*
* @return JSONObject
*/
@Override
public JSONObject toJSONObject() {
final JSONObject object = new JSONObject();
object.put("type", new JSONString(getShapeType().getValue()));
if (hasMetaData()) {
final MetaData meta = getMetaData();
if (false == meta.isEmpty()) {
object.put("meta", new JSONObject(meta.getJSO()));
}
}
object.put("attributes", new JSONObject(getAttributes().getJSO()));
return object;
}
Aggregations