*/
public void removeAnimatorRelatedResources() {
if (appManager instanceof AppManagerForHTML) {
- if (!((AnimatorPart)rootPart).hasAnimation()) {
+ if (!((AnimatorPart) rootPart).hasAnimation()) {
Document editDoc = ((AppManagerForHTML) appManager).getDocument();
NodeList heads = editDoc.getElementsByTagName("head");
Element head = null;
if (heads != null) {
head = (Element) heads.item(0);
} else {
- head = editDoc.createElement("head");
- if(head != null) {
- editDoc.insertBefore(head, editDoc.getFirstChild());
+ head = editDoc.createElement("head");
+ if (head != null) {
+ editDoc.insertBefore(head, editDoc.getFirstChild());
}
}
-
- NodeList scripts = head.getElementsByTagName("script");
- if (scripts != null) {
- int len = scripts.getLength();
- for (int i = 0; i < len; i++) {
- Element script = (Element) scripts.item(i);
- String src = script.getAttribute("src");
- int fileidx = src.lastIndexOf("/");
- String filename = src.substring(fileidx + 1);
- if (filename.equals(AnimatorConstants.ANIMATOR_MODEL_JS_FILE)
- || filename.equals(AnimatorConstants.ANIMATOR_FRAMEWORK_JSPATH)) {
- // elm.removeChild(script);
- script.removeAttribute("src");
- script.setTextContent("");
+ if (head != null) {
+ NodeList scripts = head.getElementsByTagName("script");
+ if (scripts != null) {
+ int len = scripts.getLength();
+ for (int i = 0; i < len; i++) {
+ Element script = (Element) scripts.item(i);
+ String src = script.getAttribute("src");
+ int fileidx = src.lastIndexOf("/");
+ String filename = src.substring(fileidx + 1);
+ if (filename.equals(AnimatorConstants.ANIMATOR_MODEL_JS_FILE)
+ || filename.equals(AnimatorConstants.ANIMATOR_FRAMEWORK_JSPATH)) {
+ // elm.removeChild(script);
+ script.removeAttribute("src");
+ script.setTextContent("");
+ }
}
}
- }
- NodeList links = head.getElementsByTagName("link");
- if (links != null) {
- int len = links.getLength();
- for (int i = 0; i < len; i++) {
- Element link = (Element) links.item(i);
- String src = link.getAttribute("href");
- int fileidx = src.lastIndexOf("/");
- String filename = src.substring(fileidx + 1);
- if (filename.equals(AnimatorConstants.ANIMATOR_MODEL_CSS_FILE)) {
- // elm.removeChild(script);
- link.removeAttribute("href");
- link.removeAttribute("rel");
- link.removeAttribute("type");
- link.setTextContent("");
+ NodeList links = head.getElementsByTagName("link");
+ if (links != null) {
+ int len = links.getLength();
+ for (int i = 0; i < len; i++) {
+ Element link = (Element) links.item(i);
+ String src = link.getAttribute("href");
+ int fileidx = src.lastIndexOf("/");
+ String filename = src.substring(fileidx + 1);
+ if (filename.equals(AnimatorConstants.ANIMATOR_MODEL_CSS_FILE)) {
+ // elm.removeChild(script);
+ link.removeAttribute("href");
+ link.removeAttribute("rel");
+ link.removeAttribute("type");
+ link.setTextContent("");
+ }
}
}
}
super(modelFactory);
}
- /*
+ /*
* (non-Javadoc)
*
* @see
* com.google.gson.JsonDeserializationContext)
*/
@Override
- public AnimatorModel deserialize(JsonElement json, Type arg1,
- JsonDeserializationContext context)
+ public AnimatorModel deserialize(JsonElement json, Type arg1, JsonDeserializationContext context)
throws JsonParseException {
AnimatorAnimation animation = null;
if (getPagePart() != null) {
JsonObject jobject = (JsonObject) json;
- animation = (AnimatorAnimation)getModelFactory().createAnimatorModel(AnimatorModelType.ANIMATION);
+ animation =
+ (AnimatorAnimation) getModelFactory()
+ .createAnimatorModel(AnimatorModelType.ANIMATION);
animation.setId(jobject.get("id").getAsString());
JsonElement jsonElement = jobject.get("name");
AnimatorWidget widget = (AnimatorWidget) animation.getChild(id);
Part widgetPart = null;
if (widget == null) {
- widgetPart = (Part) getPagePart().getChildOfIdPropertyValue(id, true);
- if(widgetPart != null) {
- widget = (AnimatorWidget)getModelFactory().createAnimatorModel(AnimatorModelType.WIDGET);
- if(widget != null) {
- widget.setPartLink(widgetPart);
+ widgetPart = (Part) getPagePart().getChildOfIdPropertyValue(id, true);
+ if (widgetPart != null) {
+ widget =
+ (AnimatorWidget) getModelFactory()
+ .createAnimatorModel(AnimatorModelType.WIDGET);
+ if (widget != null) {
+ widget.setPartLink(widgetPart);
widget.setId(widgetPart.getPropertyValue("id"));
widget.setParent(animation);
animation.addChild(widget);
- }
- }
-// widgetPart = (Part) getPagePart().getChildOfIdPropertyValue(id, true);
-// widget = (AnimatorWidget)getModelFactory().createAnimatorModel(AnimatorModelType.WIDGET);
-// widget.setPartLink(widgetPart);
-// widget.setId(widgetPart.getPropertyValue("id"));
-// widget.setParent(animation);
-// animation.addChild(widget);
+ }
+ }
+ // widgetPart = (Part) getPagePart().getChildOfIdPropertyValue(id, true);
+ // widget =
+ // (AnimatorWidget)getModelFactory().createAnimatorModel(AnimatorModelType.WIDGET);
+ // widget.setPartLink(widgetPart);
+ // widget.setId(widgetPart.getPropertyValue("id"));
+ // widget.setParent(animation);
+ // animation.addChild(widget);
}
- widget.setLock(membersObject.get("lock").getAsBoolean());
- widget.setVisibility(membersObject.get("visibility").getAsBoolean());
-
- if (membersObject.has("animation")) {
- AnimatorSelector selector =
- context.deserialize(membersObject.get("animation")
- .getAsJsonObject(), AnimatorSelector.class);
- selector.setSelector(membersObject.get("selector").getAsString());
- selector.setParent(widget);
- if (widgetPart != null) {
- selector.setPartLink(widgetPart);
+ if (widget != null) {
+ widget.setLock(membersObject.get("lock").getAsBoolean());
+ widget.setVisibility(membersObject.get("visibility").getAsBoolean());
+
+ if (membersObject.has("animation")) {
+ AnimatorSelector selector =
+ context.deserialize(membersObject.get("animation")
+ .getAsJsonObject(), AnimatorSelector.class);
+ selector.setSelector(membersObject.get("selector").getAsString());
+ selector.setParent(widget);
+ if (widgetPart != null) {
+ selector.setPartLink(widgetPart);
+ }
+ widget.addChild(selector);
}
- widget.addChild(selector);
}
}
}