Java 类org.w3c.dom.smil.SMILLayoutElement 实例源码

项目:PeSanKita-android    文件:SmilDocumentImpl.java   
public SMILLayoutElement getLayout() {
    Node headElement = getHead();
    Node layoutElement = null;

    // Find the layout element under <code>HEAD</code>
    layoutElement = headElement.getFirstChild();
    while ((layoutElement != null) && !(layoutElement instanceof SMILLayoutElement)) {
        layoutElement = layoutElement.getNextSibling();
    }

    if (layoutElement == null) {
        // The layout doesn't exist. Create a default one.
        layoutElement = new SmilLayoutElementImpl(this, "layout");
        headElement.appendChild(layoutElement);
    }
    return (SMILLayoutElement) layoutElement;
}
项目:TextSecure    文件:SmilDocumentImpl.java   
public SMILLayoutElement getLayout() {
    Node headElement = getHead();
    Node layoutElement = null;

    // Find the layout element under <code>HEAD</code>
    layoutElement = headElement.getFirstChild();
    while ((layoutElement != null) && !(layoutElement instanceof SMILLayoutElement)) {
        layoutElement = layoutElement.getNextSibling();
    }

    if (layoutElement == null) {
        // The layout doesn't exist. Create a default one.
        layoutElement = new SmilLayoutElementImpl(this, "layout");
        headElement.appendChild(layoutElement);
    }
    return (SMILLayoutElement) layoutElement;
}
项目:qksms    文件:SmilDocumentImpl.java   
public SMILLayoutElement getLayout() {
    Node headElement = getHead();
    Node layoutElement = null;

    // Find the layout element under <code>HEAD</code>
    layoutElement = headElement.getFirstChild();
    while ((layoutElement != null) && !(layoutElement instanceof SMILLayoutElement)) {
        layoutElement = layoutElement.getNextSibling();
    }

    if (layoutElement == null) {
        // The layout doesn't exist. Create a default one.
        layoutElement = new SmilLayoutElementImpl(this, "layout");
        headElement.appendChild(layoutElement);
    }
    return (SMILLayoutElement) layoutElement;
}
项目:TextSecureSMP    文件:SmilDocumentImpl.java   
public SMILLayoutElement getLayout() {
    Node headElement = getHead();
    Node layoutElement = null;

    // Find the layout element under <code>HEAD</code>
    layoutElement = headElement.getFirstChild();
    while ((layoutElement != null) && !(layoutElement instanceof SMILLayoutElement)) {
        layoutElement = layoutElement.getNextSibling();
    }

    if (layoutElement == null) {
        // The layout doesn't exist. Create a default one.
        layoutElement = new SmilLayoutElementImpl(this, "layout");
        headElement.appendChild(layoutElement);
    }
    return (SMILLayoutElement) layoutElement;
}
项目:Silence    文件:SmilDocumentImpl.java   
public SMILLayoutElement getLayout() {
    Node headElement = getHead();
    Node layoutElement = null;

    // Find the layout element under <code>HEAD</code>
    layoutElement = headElement.getFirstChild();
    while ((layoutElement != null) && !(layoutElement instanceof SMILLayoutElement)) {
        layoutElement = layoutElement.getNextSibling();
    }

    if (layoutElement == null) {
        // The layout doesn't exist. Create a default one.
        layoutElement = new SmilLayoutElementImpl(this, "layout");
        headElement.appendChild(layoutElement);
    }
    return (SMILLayoutElement) layoutElement;
}
项目:Securecom-Messaging    文件:SmilDocumentImpl.java   
public SMILLayoutElement getLayout() {
    Node headElement = getHead();
    Node layoutElement = null;

    // Find the layout element under <code>HEAD</code>
    layoutElement = headElement.getFirstChild();
    while ((layoutElement != null) && !(layoutElement instanceof SMILLayoutElement)) {
        layoutElement = layoutElement.getNextSibling();
    }

    if (layoutElement == null) {
        // The layout doesn't exist. Create a default one.
        layoutElement = new SmilLayoutElementImpl(this, "layout");
        headElement.appendChild(layoutElement);
    }
    return (SMILLayoutElement) layoutElement;
}
项目:android-aosp-mms    文件:SmilDocumentImpl.java   
public SMILLayoutElement getLayout() {
    Node headElement = getHead();
    Node layoutElement = null;

    // Find the layout element under <code>HEAD</code>
    layoutElement = headElement.getFirstChild();
    while ((layoutElement != null) && !(layoutElement instanceof SMILLayoutElement)) {
        layoutElement = layoutElement.getNextSibling();
    }

    if (layoutElement == null) {
        // The layout doesn't exist. Create a default one.
        layoutElement = new SmilLayoutElementImpl(this, "layout");
        headElement.appendChild(layoutElement);
    }
    return (SMILLayoutElement) layoutElement;
}
项目:PeSanKita-android    文件:SmilUtil.java   
private static SMILDocument createSmilDocument(PduBody body) {
  Log.w(TAG, "Creating SMIL document from PduBody.");

  SMILDocument document = new SmilDocumentImpl();

  SMILElement smilElement = (SMILElement) document.createElement("smil");
  document.appendChild(smilElement);

  SMILElement headElement = (SMILElement) document.createElement("head");
  smilElement.appendChild(headElement);

  SMILLayoutElement layoutElement = (SMILLayoutElement) document.createElement("layout");
  headElement.appendChild(layoutElement);

  SMILRootLayoutElement rootLayoutElement = (SMILRootLayoutElement) document.createElement("root-layout");
  rootLayoutElement.setWidth(ROOT_WIDTH);
  rootLayoutElement.setHeight(ROOT_HEIGHT);
  layoutElement.appendChild(rootLayoutElement);

  SMILElement bodyElement = (SMILElement) document.createElement("body");
  smilElement.appendChild(bodyElement);

  SMILParElement par = (SMILParElement) document.createElement("par");
  bodyElement.appendChild(par);

  for (int i=0; i<body.getPartsNum(); i++) {
    PduPart part = body.getPart(i);
    SMILRegionElement regionElement = getRegion(document, part);
    SMILMediaElement  mediaElement  = getMediaElement(document, part);

    if (regionElement != null) {
      ((SMILRegionMediaElement)mediaElement).setRegion(regionElement);
      layoutElement.appendChild(regionElement);
    }
    par.appendChild(mediaElement);
  }

  return document;
}
项目:TextSecure    文件:SmilUtil.java   
public static SMILDocument createSmilDocument(SlideDeck deck) {
  Log.w(TAG, "Creating SMIL document from SlideDeck.");

  SMILDocument document = new SmilDocumentImpl();

  SMILElement smilElement = (SMILElement) document.createElement("smil");
  document.appendChild(smilElement);

  SMILElement headElement = (SMILElement) document.createElement("head");
  smilElement.appendChild(headElement);

  SMILLayoutElement layoutElement = (SMILLayoutElement) document.createElement("layout");
  headElement.appendChild(layoutElement);

  SMILRootLayoutElement rootLayoutElement = (SMILRootLayoutElement) document.createElement("root-layout");
  rootLayoutElement.setWidth(ROOT_WIDTH);
  rootLayoutElement.setHeight(ROOT_HEIGHT);
  layoutElement.appendChild(rootLayoutElement);

  SMILElement bodyElement = (SMILElement) document.createElement("body");
  smilElement.appendChild(bodyElement);

  SMILParElement par = (SMILParElement) document.createElement("par");
  bodyElement.appendChild(par);

  for (Slide slide : deck.getSlides()) {
    SMILRegionElement regionElement = slide.getSmilRegion(document);
    SMILMediaElement  mediaElement  = slide.getMediaElement(document);

    if (regionElement != null) {
      ((SMILRegionMediaElement)mediaElement).setRegion(regionElement);
      layoutElement.appendChild(regionElement);
    }
    par.appendChild(mediaElement);
  }

  return document;
}
项目:qksms    文件:SmilHelper.java   
private static boolean setRegion(SMILRegionMediaElement srme,
                                 ArrayList<SMILRegionElement> smilRegions,
                                 SMILLayoutElement smilLayout,
                                 String regionId,
                                 boolean regionPresentInLayout) {
    SMILRegionElement smilRegion = findRegionElementById(smilRegions, regionId);
    if (!regionPresentInLayout && smilRegion != null) {
        srme.setRegion(smilRegion);
        smilLayout.appendChild(smilRegion);
        return true;
    }
    return false;
}
项目:TextSecureSMP    文件:SmilUtil.java   
private static SMILDocument createSmilDocument(PduBody body) {
  Log.w(TAG, "Creating SMIL document from PduBody.");

  SMILDocument document = new SmilDocumentImpl();

  SMILElement smilElement = (SMILElement) document.createElement("smil");
  document.appendChild(smilElement);

  SMILElement headElement = (SMILElement) document.createElement("head");
  smilElement.appendChild(headElement);

  SMILLayoutElement layoutElement = (SMILLayoutElement) document.createElement("layout");
  headElement.appendChild(layoutElement);

  SMILRootLayoutElement rootLayoutElement = (SMILRootLayoutElement) document.createElement("root-layout");
  rootLayoutElement.setWidth(ROOT_WIDTH);
  rootLayoutElement.setHeight(ROOT_HEIGHT);
  layoutElement.appendChild(rootLayoutElement);

  SMILElement bodyElement = (SMILElement) document.createElement("body");
  smilElement.appendChild(bodyElement);

  SMILParElement par = (SMILParElement) document.createElement("par");
  bodyElement.appendChild(par);

  for (int i=0; i<body.getPartsNum(); i++) {
    PduPart part = body.getPart(i);
    SMILRegionElement regionElement = getRegion(document, part);
    SMILMediaElement  mediaElement  = getMediaElement(document, part);

    if (regionElement != null) {
      ((SMILRegionMediaElement)mediaElement).setRegion(regionElement);
      layoutElement.appendChild(regionElement);
    }
    par.appendChild(mediaElement);
  }

  return document;
}
项目:Silence    文件:SmilUtil.java   
private static SMILDocument createSmilDocument(PduBody body) {
  Log.w(TAG, "Creating SMIL document from PduBody.");

  SMILDocument document = new SmilDocumentImpl();

  SMILElement smilElement = (SMILElement) document.createElement("smil");
  document.appendChild(smilElement);

  SMILElement headElement = (SMILElement) document.createElement("head");
  smilElement.appendChild(headElement);

  SMILLayoutElement layoutElement = (SMILLayoutElement) document.createElement("layout");
  headElement.appendChild(layoutElement);

  SMILRootLayoutElement rootLayoutElement = (SMILRootLayoutElement) document.createElement("root-layout");
  rootLayoutElement.setWidth(ROOT_WIDTH);
  rootLayoutElement.setHeight(ROOT_HEIGHT);
  layoutElement.appendChild(rootLayoutElement);

  SMILElement bodyElement = (SMILElement) document.createElement("body");
  smilElement.appendChild(bodyElement);

  SMILParElement par = (SMILParElement) document.createElement("par");
  bodyElement.appendChild(par);

  for (int i=0; i<body.getPartsNum(); i++) {
    PduPart part = body.getPart(i);
    SMILRegionElement regionElement = getRegion(document, part);
    SMILMediaElement  mediaElement  = getMediaElement(document, part);

    if (regionElement != null) {
      ((SMILRegionMediaElement)mediaElement).setRegion(regionElement);
      layoutElement.appendChild(regionElement);
    }
    par.appendChild(mediaElement);
  }

  return document;
}
项目:Securecom-Messaging    文件:SmilUtil.java   
public static SMILDocument createSmilDocument(SlideDeck deck) {
  Log.w(TAG, "Creating SMIL document from SlideDeck.");

  SMILDocument document = new SmilDocumentImpl();

  SMILElement smilElement = (SMILElement) document.createElement("smil");
  document.appendChild(smilElement);

  SMILElement headElement = (SMILElement) document.createElement("head");
  smilElement.appendChild(headElement);

  SMILLayoutElement layoutElement = (SMILLayoutElement) document.createElement("layout");
  headElement.appendChild(layoutElement);

  SMILRootLayoutElement rootLayoutElement = (SMILRootLayoutElement) document.createElement("root-layout");
  rootLayoutElement.setWidth(ROOT_WIDTH);
  rootLayoutElement.setHeight(ROOT_HEIGHT);
  layoutElement.appendChild(rootLayoutElement);

  SMILElement bodyElement = (SMILElement) document.createElement("body");
  smilElement.appendChild(bodyElement);

  SMILParElement par = (SMILParElement) document.createElement("par");
  bodyElement.appendChild(par);

  for (Slide slide : deck.getSlides()) {
    SMILRegionElement regionElement = slide.getSmilRegion(document);
    SMILMediaElement  mediaElement  = slide.getMediaElement(document);

    if (regionElement != null) {
      ((SMILRegionMediaElement)mediaElement).setRegion(regionElement);
      layoutElement.appendChild(regionElement);
    }
    par.appendChild(mediaElement);
  }

  return document;
}
项目:android-aosp-mms    文件:SmilHelper.java   
private static boolean setRegion(SMILRegionMediaElement srme,
                                 ArrayList<SMILRegionElement> smilRegions,
                                 SMILLayoutElement smilLayout,
                                 String regionId,
                                 boolean regionPresentInLayout) {
    SMILRegionElement smilRegion = findRegionElementById(smilRegions, regionId);
    if (!regionPresentInLayout && smilRegion != null) {
        srme.setRegion(smilRegion);
        smilLayout.appendChild(smilRegion);
        return true;
    }
    return false;
}
项目:qksms    文件:SmilHelper.java   
private static SMILDocument createSmilDocument(PduBody pb) {
    if (Config.LOGV) {
        Log.v(TAG, "Creating default SMIL document.");
    }

    SMILDocument document = new SmilDocumentImpl();

    // Create root element.
    // FIXME: Should we create root element in the constructor of document?
    SMILElement smil = (SMILElement) document.createElement("smil");
    smil.setAttribute("xmlns", "http://www.w3.org/2001/SMIL20/Language");
    document.appendChild(smil);

    // Create <head> and <layout> element.
    SMILElement head = (SMILElement) document.createElement("head");
    smil.appendChild(head);

    SMILLayoutElement layout = (SMILLayoutElement) document.createElement("layout");
    head.appendChild(layout);

    // Create <body> element and add a empty <par>.
    SMILElement body = (SMILElement) document.createElement("body");
    smil.appendChild(body);
    SMILParElement par = addPar(document);

    // Create media objects for the parts in PDU.
    int partsNum = pb.getPartsNum();
    if (partsNum == 0) {
        return document;
    }

    DrmManagerClient drmManagerClient = QKSMSApp.getApplication().getDrmManagerClient();

    boolean hasText = false;
    boolean hasMedia = false;
    for (int i = 0; i < partsNum; i++) {
        // Create new <par> element.
        if ((par == null) || (hasMedia && hasText)) {
            par = addPar(document);
            hasText = false;
            hasMedia = false;
        }

        PduPart part = pb.getPart(i);
        String contentType = new String(part.getContentType());

        if (ContentType.isDrmType(contentType)) {
            contentType = drmManagerClient.getOriginalMimeType(part.getDataUri());
        }

        if (contentType.equals(ContentType.TEXT_PLAIN)
                || contentType.equalsIgnoreCase(ContentType.APP_WAP_XHTML)
                || contentType.equals(ContentType.TEXT_HTML)) {
            SMILMediaElement textElement = createMediaElement(
                    ELEMENT_TAG_TEXT, document, part.generateLocation());
            par.appendChild(textElement);
            hasText = true;
        } else if (ContentType.isImageType(contentType)) {
            SMILMediaElement imageElement = createMediaElement(
                    ELEMENT_TAG_IMAGE, document, part.generateLocation());
            par.appendChild(imageElement);
            hasMedia = true;
        } else if (ContentType.isVideoType(contentType)) {
            SMILMediaElement videoElement = createMediaElement(
                    ELEMENT_TAG_VIDEO, document, part.generateLocation());
            par.appendChild(videoElement);
            hasMedia = true;
        } else if (ContentType.isAudioType(contentType)) {
            SMILMediaElement audioElement = createMediaElement(
                    ELEMENT_TAG_AUDIO, document, part.generateLocation());
            par.appendChild(audioElement);
            hasMedia = true;
        } else {
            // TODO: handle other media types.
            Log.w(TAG, "unsupport media type");
        }
    }

    return document;
}
项目:android-aosp-mms    文件:SmilHelper.java   
private static SMILDocument createSmilDocument(PduBody pb) {
    if (Config.LOGV) {
        Log.v(TAG, "Creating default SMIL document.");
    }

    SMILDocument document = new SmilDocumentImpl();

    // Create root element.
    // FIXME: Should we create root element in the constructor of document?
    SMILElement smil = (SMILElement) document.createElement("smil");
    smil.setAttribute("xmlns", "http://www.w3.org/2001/SMIL20/Language");
    document.appendChild(smil);

    // Create <head> and <layout> element.
    SMILElement head = (SMILElement) document.createElement("head");
    smil.appendChild(head);

    SMILLayoutElement layout = (SMILLayoutElement) document.createElement("layout");
    head.appendChild(layout);

    // Create <body> element and add a empty <par>.
    SMILElement body = (SMILElement) document.createElement("body");
    smil.appendChild(body);
    SMILParElement par = addPar(document);

    // Create media objects for the parts in PDU.
    int partsNum = pb.getPartsNum();
    if (partsNum == 0) {
        return document;
    }

    DrmManagerClient drmManagerClient = MmsApp.getApplication().getDrmManagerClient();

    boolean hasText = false;
    boolean hasMedia = false;
    for (int i = 0; i < partsNum; i++) {
        // Create new <par> element.
        if ((par == null) || (hasMedia && hasText)) {
            par = addPar(document);
            hasText = false;
            hasMedia = false;
        }

        PduPart part = pb.getPart(i);
        String contentType = new String(part.getContentType());

        if (ContentType.isDrmType(contentType)) {
            contentType = drmManagerClient.getOriginalMimeType(part.getDataUri());
        }

        if (contentType.equals(ContentType.TEXT_PLAIN)
                || contentType.equalsIgnoreCase(ContentType.APP_WAP_XHTML)
                || contentType.equals(ContentType.TEXT_HTML)) {
            SMILMediaElement textElement = createMediaElement(
                    ELEMENT_TAG_TEXT, document, part.generateLocation());
            par.appendChild(textElement);
            hasText = true;
        } else if (ContentType.isImageType(contentType)) {
            SMILMediaElement imageElement = createMediaElement(
                    ELEMENT_TAG_IMAGE, document, part.generateLocation());
            par.appendChild(imageElement);
            hasMedia = true;
        } else if (ContentType.isVideoType(contentType)) {
            SMILMediaElement videoElement = createMediaElement(
                    ELEMENT_TAG_VIDEO, document, part.generateLocation());
            par.appendChild(videoElement);
            hasMedia = true;
        } else if (ContentType.isAudioType(contentType)) {
            SMILMediaElement audioElement = createMediaElement(
                    ELEMENT_TAG_AUDIO, document, part.generateLocation());
            par.appendChild(audioElement);
            hasMedia = true;
        } else {
            // TODO: handle other media types.
            Log.w(TAG, "unsupport media type");
        }
    }

    return document;
}