Java 类org.w3c.dom.stylesheets.MediaList 实例源码

项目:gwt-eclipse-plugin    文件:CssResourceAwareModelRepairer.java   
private void fixPotentialEmptyMaskedMediaRule(ICSSNode node) {
  CSSMediaRule mediaRule = (CSSMediaRule) node;
  IndexedRegion mediaRuleRegion = (IndexedRegion) mediaRule;

  if (!containsEmptyMaskedMediaRule(mediaRule, mediaRuleRegion)) {
    return;
  }

  // Set the range to a valid value (it won't be proper since we don't have
  // any additional words that can be categorized as CSS_MEDIUM.)
  MediaList mediaList = mediaRule.getMedia();
  IStructuredDocumentRegion[] structuredDocumentRegions = structuredDocument.getStructuredDocumentRegions(
      mediaRuleRegion.getStartOffset(), mediaRuleRegion.getLength());

  // The value we set is a 0-length region starting where the next word would
  // have been
  ITextRegion textRegion = new ContextRegion(CSSRegionContexts.CSS_MEDIUM,
      structuredDocumentRegions[0].getEndOffset()
          - structuredDocumentRegions[0].getStartOffset(), 0, 0);

  try {
    callSetRangeRegion(mediaList, structuredDocumentRegions, textRegion);
  } catch (Throwable e) {
    GWTPluginLog.logError(e, "Could not clean up the @else in the CSS model.");
  }
}
项目:gwt-eclipse-plugin    文件:GssResourceAwareModelRepairer.java   
private void fixPotentialEmptyMaskedMediaRule(ICSSNode node) {
  CSSMediaRule mediaRule = (CSSMediaRule) node;
  IndexedRegion mediaRuleRegion = (IndexedRegion) mediaRule;

  if (!containsEmptyMaskedMediaRule(mediaRule, mediaRuleRegion)) {
    return;
  }

  // Set the range to a valid value (it won't be proper since we don't have
  // any additional words that can be categorized as CSS_MEDIUM.)
  MediaList mediaList = mediaRule.getMedia();
  IStructuredDocumentRegion[] structuredDocumentRegions = structuredDocument.getStructuredDocumentRegions(
      mediaRuleRegion.getStartOffset(), mediaRuleRegion.getLength());

  // The value we set is a 0-length region starting where the next word would
  // have been
  ITextRegion textRegion = new ContextRegion(CSSRegionContexts.CSS_MEDIUM,
      structuredDocumentRegions[0].getEndOffset()
          - structuredDocumentRegions[0].getStartOffset(), 0, 0);

  try {
    callSetRangeRegion(mediaList, structuredDocumentRegions, textRegion);
  } catch (Throwable e) {
    GWTPluginLog.logError(e, "Could not clean up the @else in the CSS model.");
  }
}
项目:LoboEvolution    文件:CSSStyleSheetImpl.java   
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
    baseUri_ = (String) in.readObject();
    cssRules_ = (CSSRuleList) in.readObject();
    if (cssRules_ != null) {
        for (int i = 0; i < cssRules_.getLength(); i++) {
            final CSSRule cssRule = cssRules_.item(i);
            if (cssRule instanceof AbstractCSSRuleImpl) {
                ((AbstractCSSRuleImpl) cssRule).setParentStyleSheet(this);
            }
        }
    }
    disabled_ = in.readBoolean();
    href_ = (String) in.readObject();
    media_ = (MediaList) in.readObject();
    // TODO ownerNode may not be serializable!
    // ownerNode = (Node) in.readObject();
    readOnly_ = in.readBoolean();
    title_ = (String) in.readObject();
}
项目:LoboEvolution    文件:CSSImportRuleImpl.java   
/**
 * {@inheritDoc}
 */
@Override
public String getCssText(final CSSFormat format) {
    final StringBuilder sb = new StringBuilder();
    sb.append("@import");

    final String href = getHref();
    if (null != href) {
        sb.append(" url(").append(href).append(")");
    }

    final MediaList ml = getMedia();
    if (null != ml && ml.getLength() > 0) {
        sb.append(" ").append(((MediaListImpl) getMedia()).getMediaText(format));
    }
    sb.append(";");
    return sb.toString();
}
项目:LoboEvolution    文件:CSSUtilities.java   
/**
 * Matches media.
 *
 * @param mediaList
 *            the media list
 * @param rcontext
 *            the rcontext
 * @return true, if successful
 */
public static boolean matchesMedia(MediaList mediaList, UserAgentContext rcontext) {
    if (mediaList == null) {
        return true;
    }
    int length = mediaList.getLength();
    if (length == 0) {
        return true;
    }
    if (rcontext == null) {
        return false;
    }
    for (int i = 0; i < length; i++) {
        String mediaName = mediaList.item(i);
        if (rcontext.isMedia(mediaName)) {
            return true;
        }
    }
    return false;
}
项目:gwt-eclipse-plugin    文件:CssResourceAwareModelRepairer.java   
/**
 * Calls the {@link MediaList} <code>setRangeRegion</code> method.
 * 
 * @param mediaList the MediaList object that receives the call
 * @param structuredDocumentRegions the first parameter of the method
 * @param textRegion the second parameter of the method
 * @throws Throwable for safeguarding against any reflection issues (nothing
 *           is logged in this method since it doesn't have proper context of
 *           the scenario)
 */
private static void callSetRangeRegion(MediaList mediaList,
    IStructuredDocumentRegion[] structuredDocumentRegions,
    ITextRegion textRegion) throws Throwable {
  ClassLoader classLoader = CSSSourceFormatter.class.getClassLoader();
  Class<?> cssRegionContainerClass = classLoader.loadClass("org.eclipse.wst.css.core.internal.document.CSSRegionContainer");
  Method declaredMethod = cssRegionContainerClass.getDeclaredMethod(
      "setRangeRegion", IStructuredDocumentRegion.class, ITextRegion.class,
      ITextRegion.class);
  declaredMethod.setAccessible(true);
  declaredMethod.invoke(mediaList, structuredDocumentRegions[0], textRegion,
      textRegion);
}
项目:gwt-eclipse-plugin    文件:GssResourceAwareModelRepairer.java   
/**
 * Calls the {@link MediaList} <code>setRangeRegion</code> method.
 * 
 * @param mediaList the MediaList object that receives the call
 * @param structuredDocumentRegions the first parameter of the method
 * @param textRegion the second parameter of the method
 * @throws Throwable for safeguarding against any reflection issues (nothing
 *           is logged in this method since it doesn't have proper context of
 *           the scenario)
 */
private static void callSetRangeRegion(MediaList mediaList,
    IStructuredDocumentRegion[] structuredDocumentRegions,
    ITextRegion textRegion) throws Throwable {
  ClassLoader classLoader = CSSSourceFormatter.class.getClassLoader();
  Class<?> cssRegionContainerClass = classLoader.loadClass("org.eclipse.wst.css.core.internal.document.CSSRegionContainer");
  Method declaredMethod = cssRegionContainerClass.getDeclaredMethod(
      "setRangeRegion", IStructuredDocumentRegion.class, ITextRegion.class,
      ITextRegion.class);
  declaredMethod.setAccessible(true);
  declaredMethod.invoke(mediaList, structuredDocumentRegions[0], textRegion,
      textRegion);
}
项目:LoboEvolution    文件:CSSMediaRuleImpl.java   
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {

        cssRules_ = (CSSRuleList) in.readObject();
        if (cssRules_ != null) {
            for (int i = 0; i < cssRules_.getLength(); i++) {
                final CSSRule cssRule = cssRules_.item(i);
                if (cssRule instanceof AbstractCSSRuleImpl) {
                    ((AbstractCSSRuleImpl) cssRule).setParentRule(this);
                    ((AbstractCSSRuleImpl) cssRule).setParentStyleSheet(getParentStyleSheetImpl());
                }
            }
        }
        media_ = (MediaList) in.readObject();
    }
项目:LoboEvolution    文件:MediaListImpl.java   
private boolean equalsMedia(final MediaList ml) {
    if ((ml == null) || (getLength() != ml.getLength())) {
        return false;
    }
    for (int i = 0; i < getLength(); i++) {
        final String m1 = item(i);
        final String m2 = ml.item(i);
        if (!LangUtils.equals(m1, m2)) {
            return false;
        }
    }
    return true;
}
项目:LoboEvolution    文件:MediaListImpl.java   
@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }
    if (!(obj instanceof MediaList)) {
        return false;
    }
    final MediaList ml = (MediaList) obj;
    return super.equals(obj) && equalsMedia(ml);
}
项目:LoboEvolution    文件:CSSMediaRuleImpl.java   
public void setMedia(final MediaList media) {
    media_ = media;
}
项目:LoboEvolution    文件:CSSMediaRuleImpl.java   
public CSSMediaRuleImpl(final CSSStyleSheetImpl parentStyleSheet, final CSSRule parentRule, final MediaList media) {
    super(parentStyleSheet, parentRule);
    media_ = media;
}
项目:LoboEvolution    文件:CSSMediaRuleImpl.java   
@Override
public MediaList getMedia() {
    return media_;
}
项目:LoboEvolution    文件:CSSStyleSheetImpl.java   
public void setMedia(final MediaList media) {
    media_ = media;
}
项目:LoboEvolution    文件:CSSStyleSheetImpl.java   
@Override
public MediaList getMedia() {
    return media_;
}
项目:LoboEvolution    文件:CSSImportRuleImpl.java   
public void setMedia(final MediaList media) {
    media_ = media;
}
项目:LoboEvolution    文件:CSSImportRuleImpl.java   
public CSSImportRuleImpl(final CSSStyleSheetImpl parentStyleSheet, final CSSRule parentRule, final String href,
        final MediaList media) {
    super(parentStyleSheet, parentRule);
    href_ = href;
    media_ = media;
}
项目:LoboEvolution    文件:CSSImportRuleImpl.java   
@Override
public MediaList getMedia() {
    return media_;
}
项目:birt    文件:StyleSheet.java   
public MediaList getMedia( )
{
    return null;
}
项目:jStyleDomBridge    文件:CSSMediaRuleImpl.java   
public MediaList getMedia() {
  return new MediaListImpl(mediaRule.getMediaQueries(), this.containingStyleSheet);
}
项目:jStyleDomBridge    文件:JStyleSheetWrapper.java   
/**
 * @return A list of media to which this style sheet is applicable
 */
public MediaList getMedia() {
  return new MediaListImpl(mediaStr, this);
}
项目:jStyleDomBridge    文件:CSSImportRuleImpl.java   
public MediaList getMedia() {
  // TODO implement this method
  throw new UnsupportedOperationException();
}
项目:OpenJSharp    文件:CSSImportRule.java   
/**
 *  A list of media types for which this style sheet may be used.
 */
public MediaList getMedia();
项目:OpenJSharp    文件:CSSMediaRule.java   
/**
 *  A list of media types for this rule.
 */
public MediaList getMedia();
项目:openjdk-jdk10    文件:CSSImportRule.java   
/**
 *  A list of media types for which this style sheet may be used.
 */
public MediaList getMedia();
项目:openjdk-jdk10    文件:CSSMediaRule.java   
/**
 *  A list of media types for this rule.
 */
public MediaList getMedia();
项目:openjdk9    文件:CSSImportRule.java   
/**
 *  A list of media types for which this style sheet may be used.
 */
public MediaList getMedia();
项目:openjdk9    文件:CSSMediaRule.java   
/**
 *  A list of media types for this rule.
 */
public MediaList getMedia();
项目:Java8CN    文件:CSSImportRule.java   
/**
 *  A list of media types for which this style sheet may be used.
 */
public MediaList getMedia();
项目:Java8CN    文件:CSSMediaRule.java   
/**
 *  A list of media types for this rule.
 */
public MediaList getMedia();
项目:lookaside_java-1.8.0-openjdk    文件:CSSImportRule.java   
/**
 *  A list of media types for which this style sheet may be used.
 */
public MediaList getMedia();
项目:lookaside_java-1.8.0-openjdk    文件:CSSMediaRule.java   
/**
 *  A list of media types for this rule.
 */
public MediaList getMedia();
项目:javify    文件:CSSImportRule.java   
/**
 *  A list of media types for which this style sheet may be used. 
 */
public MediaList getMedia();
项目:javify    文件:CSSMediaRule.java   
/**
 *  A list of media types for this rule. 
 */
public MediaList getMedia();
项目:jvm-stm    文件:CSSImportRule.java   
/**
 *  A list of media types for which this style sheet may be used. 
 */
public MediaList getMedia();
项目:jvm-stm    文件:CSSMediaRule.java   
/**
 *  A list of media types for this rule. 
 */
public MediaList getMedia();
项目:infobip-open-jdk-8    文件:CSSImportRule.java   
/**
 *  A list of media types for which this style sheet may be used.
 */
public MediaList getMedia();
项目:infobip-open-jdk-8    文件:CSSMediaRule.java   
/**
 *  A list of media types for this rule.
 */
public MediaList getMedia();
项目:OLD-OpenJDK8    文件:CSSImportRule.java   
/**
 *  A list of media types for which this style sheet may be used.
 */
public MediaList getMedia();
项目:OLD-OpenJDK8    文件:CSSMediaRule.java   
/**
 *  A list of media types for this rule.
 */
public MediaList getMedia();