当前位置: 首页>>代码示例>>Java>>正文


Java MediaList类代码示例

本文整理汇总了Java中org.w3c.dom.stylesheets.MediaList的典型用法代码示例。如果您正苦于以下问题:Java MediaList类的具体用法?Java MediaList怎么用?Java MediaList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MediaList类属于org.w3c.dom.stylesheets包,在下文中一共展示了MediaList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fixPotentialEmptyMaskedMediaRule

import org.w3c.dom.stylesheets.MediaList; //导入依赖的package包/类
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.");
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:27,代码来源:CssResourceAwareModelRepairer.java

示例2: readObject

import org.w3c.dom.stylesheets.MediaList; //导入依赖的package包/类
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();
}
 
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:20,代码来源:CSSStyleSheetImpl.java

示例3: getCssText

import org.w3c.dom.stylesheets.MediaList; //导入依赖的package包/类
/**
 * {@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();
}
 
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:21,代码来源:CSSImportRuleImpl.java

示例4: matchesMedia

import org.w3c.dom.stylesheets.MediaList; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:29,代码来源:CSSUtilities.java

示例5: callSetRangeRegion

import org.w3c.dom.stylesheets.MediaList; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:23,代码来源:CssResourceAwareModelRepairer.java

示例6: readObject

import org.w3c.dom.stylesheets.MediaList; //导入依赖的package包/类
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();
	}
 
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:15,代码来源:CSSMediaRuleImpl.java

示例7: equalsMedia

import org.w3c.dom.stylesheets.MediaList; //导入依赖的package包/类
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;
}
 
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:14,代码来源:MediaListImpl.java

示例8: equals

import org.w3c.dom.stylesheets.MediaList; //导入依赖的package包/类
@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);
}
 
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:12,代码来源:MediaListImpl.java

示例9: setMedia

import org.w3c.dom.stylesheets.MediaList; //导入依赖的package包/类
public void setMedia(final MediaList media) {
	media_ = media;
}
 
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:4,代码来源:CSSMediaRuleImpl.java

示例10: CSSMediaRuleImpl

import org.w3c.dom.stylesheets.MediaList; //导入依赖的package包/类
public CSSMediaRuleImpl(final CSSStyleSheetImpl parentStyleSheet, final CSSRule parentRule, final MediaList media) {
	super(parentStyleSheet, parentRule);
	media_ = media;
}
 
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:5,代码来源:CSSMediaRuleImpl.java

示例11: getMedia

import org.w3c.dom.stylesheets.MediaList; //导入依赖的package包/类
@Override
public MediaList getMedia() {
	return media_;
}
 
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:5,代码来源:CSSMediaRuleImpl.java

示例12: CSSImportRuleImpl

import org.w3c.dom.stylesheets.MediaList; //导入依赖的package包/类
public CSSImportRuleImpl(final CSSStyleSheetImpl parentStyleSheet, final CSSRule parentRule, final String href,
		final MediaList media) {
	super(parentStyleSheet, parentRule);
	href_ = href;
	media_ = media;
}
 
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:7,代码来源:CSSImportRuleImpl.java

示例13: getMedia

import org.w3c.dom.stylesheets.MediaList; //导入依赖的package包/类
public MediaList getMedia( )
{
	return null;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:5,代码来源:StyleSheet.java

示例14: getMedia

import org.w3c.dom.stylesheets.MediaList; //导入依赖的package包/类
public MediaList getMedia() {
  return new MediaListImpl(mediaRule.getMediaQueries(), this.containingStyleSheet);
}
 
开发者ID:UprootLabs,项目名称:jStyleDomBridge,代码行数:4,代码来源:CSSMediaRuleImpl.java

示例15: getMedia

import org.w3c.dom.stylesheets.MediaList; //导入依赖的package包/类
/**
 * @return A list of media to which this style sheet is applicable
 */
public MediaList getMedia() {
  return new MediaListImpl(mediaStr, this);
}
 
开发者ID:UprootLabs,项目名称:jStyleDomBridge,代码行数:7,代码来源:JStyleSheetWrapper.java


注:本文中的org.w3c.dom.stylesheets.MediaList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。