本文整理汇总了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.");
}
}
示例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();
}
示例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();
}
示例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;
}
示例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);
}
示例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();
}
示例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;
}
示例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);
}
示例9: setMedia
import org.w3c.dom.stylesheets.MediaList; //导入依赖的package包/类
public void setMedia(final MediaList media) {
media_ = media;
}
示例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;
}
示例11: getMedia
import org.w3c.dom.stylesheets.MediaList; //导入依赖的package包/类
@Override
public MediaList getMedia() {
return media_;
}
示例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;
}
示例13: getMedia
import org.w3c.dom.stylesheets.MediaList; //导入依赖的package包/类
public MediaList getMedia( )
{
return null;
}
示例14: getMedia
import org.w3c.dom.stylesheets.MediaList; //导入依赖的package包/类
public MediaList getMedia() {
return new MediaListImpl(mediaRule.getMediaQueries(), this.containingStyleSheet);
}
示例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);
}