2 * Copyright (C) 2007 Esmertec AG.
3 * Copyright (C) 2007 The Android Open Source Project
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 package com.android.mms.dom.smil;
20 import com.android.mms.layout.LayoutManager;
22 import org.w3c.dom.NodeList;
23 import org.w3c.dom.smil.SMILLayoutElement;
24 import org.w3c.dom.smil.SMILRootLayoutElement;
26 public class SmilLayoutElementImpl extends SmilElementImpl implements
28 SmilLayoutElementImpl(SmilDocumentImpl owner, String tagName) {
29 super(owner, tagName);
32 public boolean getResolved() {
33 // TODO Auto-generated method stub
37 public String getType() {
38 return this.getAttribute("type");
41 public NodeList getRegions() {
42 return this.getElementsByTagName("region");
45 public SMILRootLayoutElement getRootLayout() {
46 NodeList childNodes = this.getChildNodes();
47 SMILRootLayoutElement rootLayoutNode = null;
48 int childrenCount = childNodes.getLength();
49 for (int i = 0; i < childrenCount; i++) {
50 if (childNodes.item(i).getNodeName().equals("root-layout")) {
51 rootLayoutNode = (SMILRootLayoutElement)childNodes.item(i);
54 if (null == rootLayoutNode) {
55 // root-layout node is not set. Create a default one.
56 rootLayoutNode = (SMILRootLayoutElement) getOwnerDocument().createElement("root-layout");
57 rootLayoutNode.setWidth(LayoutManager.getInstance().getLayoutParameters().getWidth());
58 rootLayoutNode.setHeight(LayoutManager.getInstance().getLayoutParameters().getHeight());
59 appendChild(rootLayoutNode);
61 return rootLayoutNode;