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; }
/** {@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(getMedia().toString()); } sb.append(";"); return sb.toString(); }
public static boolean matchesMedia(final MediaList mediaList, final UserAgentContext rcontext) { if (mediaList == null) { return true; } final int length = mediaList.getLength(); if (length == 0) { return true; } if (rcontext == null) { return false; } for (int i = 0; i < length; i++) { final String mediaName = mediaList.item(i); if (rcontext.isMedia(mediaName)) { return true; } } return false; }