亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? stylesheet.java

?? JAVA的一些源碼 JAVA2 STANDARD EDITION DEVELOPMENT KIT 5.0
?? JAVA
?? 第 1 頁 / 共 5 頁
字號:
/* * @(#)StyleSheet.java	1.85 04/09/14 * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */package javax.swing.text.html;import com.sun.java.swing.SwingUtilities2;import java.util.*;import java.awt.*;import java.io.*;import java.net.*;import javax.swing.Icon;import javax.swing.ImageIcon;import javax.swing.border.*;import javax.swing.event.ChangeListener;import javax.swing.text.*;/** * Support for defining the visual characteristics of * HTML views being rendered.  The StyleSheet is used to * translate the HTML model into visual characteristics. * This enables views to be customized by a look-and-feel, * multiple views over the same model can be rendered * differently, etc.  This can be thought of as a CSS * rule repository.  The key for CSS attributes is an * object of type CSS.Attribute.  The type of the value * is up to the StyleSheet implementation, but the * <code>toString</code> method is required * to return a string representation of CSS value. * <p> * The primary entry point for HTML View implementations * to get their attributes is the  * <a href="#getViewAttributes">getViewAttributes</a> * method.  This should be implemented to establish the * desired policy used to associate attributes with the view. * Each HTMLEditorKit (i.e. and therefore each associated * JEditorPane) can have its own StyleSheet, but by default one * sheet will be shared by all of the HTMLEditorKit instances. * HTMLDocument instance can also have a StyleSheet, which * holds the document-specific CSS specifications. * <p> * In order for Views to store less state and therefore be * more lightweight, the StyleSheet can act as a factory for * painters that handle some of the rendering tasks.  This allows * implementations to determine what they want to cache * and have the sharing potentially at the level that a * selector is common to multiple views.  Since the StyleSheet * may be used by views over multiple documents and typically * the HTML attributes don't effect the selector being used, * the potential for sharing is significant. * <p> * The rules are stored as named styles, and other information * is stored to translate the context of an element to a  * rule quickly.  The following code fragment will display * the named styles, and therefore the CSS rules contained. * <code><pre> * &nbsp;  * &nbsp; import java.util.*; * &nbsp; import javax.swing.text.*; * &nbsp; import javax.swing.text.html.*; * &nbsp;  * &nbsp; public class ShowStyles { * &nbsp;  * &nbsp;     public static void main(String[] args) { * &nbsp; 	HTMLEditorKit kit = new HTMLEditorKit(); * &nbsp; 	HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument(); * &nbsp; 	StyleSheet styles = doc.getStyleSheet(); * &nbsp; 	 * &nbsp; 	Enumeration rules = styles.getStyleNames(); * &nbsp; 	while (rules.hasMoreElements()) { * &nbsp; 	    String name = (String) rules.nextElement(); * &nbsp; 	    Style rule = styles.getStyle(name); * &nbsp; 	    System.out.println(rule.toString()); * &nbsp; 	} * &nbsp; 	System.exit(0); * &nbsp;     } * &nbsp; } * &nbsp;  * </pre></code> * <p> * The semantics for when a CSS style should overide visual attributes * defined by an element are not well defined. For example, the html * <code>&lt;body bgcolor=red&gt;</code> makes the body have a red * background. But if the html file also contains the CSS rule * <code>body { background: blue }</code> it becomes less clear as to * what color the background of the body should be. The current * implemention gives visual attributes defined in the element the * highest precedence, that is they are always checked before any styles. * Therefore, in the previous example the background would have a * red color as the body element defines the background color to be red. * <p> * As already mentioned this supports CSS. We don't support the full CSS * spec. Refer to the javadoc of the CSS class to see what properties * we support. The two major CSS parsing related * concepts we do not currently * support are pseudo selectors, such as <code>A:link { color: red }</code>, * and the <code>important</code> modifier. * <p> * <font color="red">Note: This implementation is currently * incomplete.  It can be replaced with alternative implementations * that are complete.  Future versions of this class will provide * better CSS support.</font> * * @author  Timothy Prinzing * @author  Sunita Mani * @author  Sara Swanson * @author  Jill Nakata * @version 1.85 09/14/04 */public class StyleSheet extends StyleContext {    // As the javadoc states, this class maintains a mapping between    // a CSS selector (such as p.bar) and a Style.    // This consists of a number of parts:    // . Each selector is broken down into its constituent simple selectors,    //   and stored in an inverted graph, for example:    //     p { color: red } ol p { font-size: 10pt } ul p { font-size: 12pt }    //   results in the graph:    //          root    //           |    //           p    //          / \    //         ol ul    //   each node (an instance of SelectorMapping) has an associated    //   specificity and potentially a Style.    // . Every rule that is asked for (either by way of getRule(String) or    //   getRule(HTML.Tag, Element)) results in a unique instance of    //   ResolvedStyle. ResolvedStyles contain the AttributeSets from the    //   SelectorMapping.    // . When a new rule is created it is inserted into the graph, and    //   the AttributeSets of each ResolvedStyles are updated appropriately.    // . This class creates special AttributeSets, LargeConversionSet and    //   SmallConversionSet, that maintain a mapping between StyleConstants    //   and CSS so that developers that wish to use the StyleConstants    //   methods can do so.    // . When one of the AttributeSets is mutated by way of a    //   StyleConstants key, all the associated CSS keys are removed. This is    //   done so that the two representations don't get out of sync. For    //   example, if the developer adds StyleConsants.BOLD, FALSE to an    //   AttributeSet that contains HTML.Tag.B, the HTML.Tag.B entry will    //   be removed.    /**     * Construct a StyleSheet     */    public StyleSheet() {	super();	selectorMapping = new SelectorMapping(0);	resolvedStyles = new Hashtable();	if (css == null) {	    css = new CSS();	}    }    /**     * Fetches the style to use to render the given type     * of HTML tag.  The element given is representing     * the tag and can be used to determine the nesting     * for situations where the attributes will differ     * if nesting inside of elements.     *     * @param t the type to translate to visual attributes     * @param e the element representing the tag; the element     *  can be used to determine the nesting for situations where     *  the attributes will differ if nested inside of other     *  elements     * @return the set of CSS attributes to use to render     *  the tag     */    public Style getRule(HTML.Tag t, Element e) {        SearchBuffer sb = SearchBuffer.obtainSearchBuffer();        try {            // Build an array of all the parent elements.            Vector searchContext = sb.getVector();            for (Element p = e; p != null; p = p.getParentElement()) {                searchContext.addElement(p);            }            // Build a fully qualified selector.            int              n = searchContext.size();            StringBuffer     cacheLookup = sb.getStringBuffer();            AttributeSet     attr;            String           eName;            Object           name;            // >= 1 as the HTML.Tag for the 0th element is passed in.            for (int counter = n - 1; counter >= 1; counter--) {                e = (Element)searchContext.elementAt(counter);                attr = e.getAttributes();                name = attr.getAttribute(StyleConstants.NameAttribute);		eName = name.toString();                cacheLookup.append(eName);                if (attr != null) {                    if (attr.isDefined(HTML.Attribute.ID)) {                        cacheLookup.append('#');                        cacheLookup.append(attr.getAttribute					   (HTML.Attribute.ID));                    }                    else if (attr.isDefined(HTML.Attribute.CLASS)) {                        cacheLookup.append('.');                        cacheLookup.append(attr.getAttribute					   (HTML.Attribute.CLASS));                    }                }                cacheLookup.append(' ');            }            cacheLookup.append(t.toString());	    e = (Element)searchContext.elementAt(0);	    attr = e.getAttributes();	    if (e.isLeaf()) {		// For leafs, we use the second tier attributes.		Object testAttr = attr.getAttribute(t);		if (testAttr instanceof AttributeSet) {		    attr = (AttributeSet)testAttr;		}		else {		    attr = null;		}	    }            if (attr != null) {                if (attr.isDefined(HTML.Attribute.ID)) {                    cacheLookup.append('#');                    cacheLookup.append(attr.getAttribute(HTML.Attribute.ID));                }                else if (attr.isDefined(HTML.Attribute.CLASS)) {                    cacheLookup.append('.');                    cacheLookup.append(attr.getAttribute				       (HTML.Attribute.CLASS));                }            }            Style style = getResolvedStyle(cacheLookup.toString(),					   searchContext, t);	    return style;        }        finally {            SearchBuffer.releaseSearchBuffer(sb);        }    }    /**     * Fetches the rule that best matches the selector given     * in string form. Where <code>selector</code> is a space separated     * String of the element names. For example, <code>selector</code>     * might be 'html body tr td''<p>     * The attributes of the returned Style will change     * as rules are added and removed. That is if you to ask for a rule     * with a selector "table p" and a new rule was added with a selector     * of "p" the returned Style would include the new attributes from     * the rule "p".     */    public Style getRule(String selector) {	selector = cleanSelectorString(selector);	if (selector != null) {	    Style style = getResolvedStyle(selector);	    return style;	}	return null;    }    /**     * Adds a set of rules to the sheet.  The rules are expected to     * be in valid CSS format.  Typically this would be called as     * a result of parsing a &lt;style&gt; tag.     */    public void addRule(String rule) {	if (rule != null) {            //tweaks to control display properties            //see BasicEditorPaneUI            final String baseUnitsDisable = "BASE_SIZE_DISABLE";            final String baseUnits = "BASE_SIZE ";            final String w3cLengthUnitsEnable = "W3C_LENGTH_UNITS_ENABLE";            final String w3cLengthUnitsDisable = "W3C_LENGTH_UNITS_DISABLE";            if (rule == baseUnitsDisable) {                sizeMap = sizeMapDefault;            } else if (rule.startsWith(baseUnits)) {                rebaseSizeMap(Integer.                              parseInt(rule.substring(baseUnits.length())));            } else if (rule == w3cLengthUnitsEnable) {                w3cLengthUnits = true;            } else if (rule == w3cLengthUnitsDisable) {                w3cLengthUnits = false;            } else {                CssParser parser = new CssParser();                try {                    parser.parse(getBase(), new StringReader(rule), false, false);                } catch (IOException ioe) { }            }	}    }    /**     * Translates a CSS declaration to an AttributeSet that represents     * the CSS declaration.  Typically this would be called as a     * result of encountering an HTML style attribute.     */    public AttributeSet getDeclaration(String decl) {	if (decl == null) {	    return SimpleAttributeSet.EMPTY;	}	CssParser parser = new CssParser();	return parser.parseDeclaration(decl);    }    /**     * Loads a set of rules that have been specified in terms of     * CSS1 grammar.  If there are collisions with existing rules,     * the newly specified rule will win.     *     * @param in the stream to read the CSS grammar from     * @param ref the reference URL.  This value represents the     *  location of the stream and may be null.  All relative     *  URLs specified in the stream will be based upon this     *  parameter.     */    public void loadRules(Reader in, URL ref) throws IOException {	CssParser parser = new CssParser();	parser.parse(ref, in, false, false);    }    /**     * Fetches a set of attributes to use in the view for     * displaying.  This is basically a set of attributes that     * can be used for View.getAttributes.     */    public AttributeSet getViewAttributes(View v) {	return new ViewAttributeSet(v);    }    /**     * Removes a named style previously added to the document.     *     * @param nm  the name of the style to remove     */    public void removeStyle(String nm) {	Style       aStyle = getStyle(nm);	if (aStyle != null) {	    String selector = cleanSelectorString(nm);	    String[] selectors = getSimpleSelectors(selector);	    synchronized(this) {		SelectorMapping mapping = getRootSelectorMapping();		for (int i = selectors.length - 1; i >= 0; i--) {		    mapping = mapping.getChildSelectorMapping(selectors[i],                                                              true);		}		Style rule = mapping.getStyle();		if (rule != null) {		    mapping.setStyle(null);		    if (resolvedStyles.size() > 0) {			Enumeration values = resolvedStyles.elements();			while (values.hasMoreElements()) {			    ResolvedStyle style = (ResolvedStyle)values.				                    nextElement();			    style.removeStyle(rule);			}		    }		}	    }	}	super.removeStyle(nm);    }    /**     * Adds the rules from the StyleSheet <code>ss</code> to those of     * the receiver. <code>ss's</code> rules will override the rules of     * any previously added style sheets. An added StyleSheet will never     * override the rules of the receiving style sheet.     *     * @since 1.3     */    public void addStyleSheet(StyleSheet ss) {	synchronized(this) {	    if (linkedStyleSheets == null) {		linkedStyleSheets = new Vector();	    }	    if (!linkedStyleSheets.contains(ss)) {                int index = 0;                if (ss instanceof javax.swing.plaf.UIResource                    && linkedStyleSheets.size() > 1) {                    index = linkedStyleSheets.size() - 1;                }		linkedStyleSheets.insertElementAt(ss, index);		linkStyleSheetAt(ss, index);	    }	}    }    /**     * Removes the StyleSheet <code>ss</code> from those of the receiver.     *     * @since 1.3

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产亚洲一区二区三区四区| 91精品国产欧美一区二区| 99天天综合性| 日韩精品在线看片z| 国产精品久久精品日日| 日本中文字幕一区二区视频 | 日韩一区二区三区四区五区六区| 国产亚洲婷婷免费| 免费在线观看精品| 在线免费视频一区二区| 国产精品久久久久久福利一牛影视 | 亚洲国产成人一区二区三区| 天天色天天操综合| 日本高清视频一区二区| 国产欧美精品在线观看| 日本成人在线看| 欧美日韩一卡二卡三卡| 亚洲另类在线制服丝袜| 不卡的电影网站| 日本一区二区免费在线观看视频| 日本成人在线电影网| 在线成人小视频| 亚洲丰满少妇videoshd| 欧美又粗又大又爽| 亚洲摸摸操操av| 99久精品国产| 亚洲人成电影网站色mp4| 97精品国产露脸对白| 国产精品女人毛片| 成人一区二区三区在线观看| 国产午夜亚洲精品不卡| 国产乱子伦一区二区三区国色天香| 日韩精品一区二区三区在线播放| 日本亚洲最大的色成网站www| 欧美日韩一区三区四区| 午夜精品久久一牛影视| 777久久久精品| 日本美女一区二区三区| 精品国产伦理网| 国产精品一二三区| 中文在线免费一区三区高中清不卡| 丁香婷婷综合网| 亚洲欧洲韩国日本视频| 色婷婷精品久久二区二区蜜臀av| 国产精品久久久久永久免费观看| 91亚洲精品久久久蜜桃网站 | 久久综合色一综合色88| 国产一二三精品| 久久精品这里都是精品| 北条麻妃一区二区三区| 樱桃视频在线观看一区| 欧美三级在线看| 久久精品国产精品青草| 2022国产精品视频| 99riav久久精品riav| 午夜激情久久久| 精品少妇一区二区三区在线视频| 岛国一区二区三区| 亚洲一二三四在线| 欧美xxxx在线观看| 91色九色蝌蚪| 久久av中文字幕片| 亚洲美女淫视频| 日韩视频一区二区| av电影一区二区| 天堂va蜜桃一区二区三区漫画版| 精品久久久久一区二区国产| 91麻豆视频网站| 美腿丝袜亚洲一区| 亚洲欧洲综合另类在线| 日韩视频免费观看高清完整版在线观看| 韩国理伦片一区二区三区在线播放| 国产精品久久久久毛片软件| 欧美电影一区二区三区| 北条麻妃一区二区三区| 久久精品国产精品亚洲综合| 亚洲免费在线视频| 国产色一区二区| 555www色欧美视频| av电影一区二区| 午夜精品久久久久久久99樱桃| 欧美电影免费观看高清完整版| 91亚洲精品久久久蜜桃| 国产精品污网站| 欧美性色黄大片| 亚洲一级片在线观看| 日韩在线卡一卡二| 欧美日本免费一区二区三区| 亚洲福利视频导航| 成人亚洲一区二区一| 日韩视频免费观看高清在线视频| 伊人婷婷欧美激情| 国产99久久久国产精品潘金| 国产xxx精品视频大全| 国产精品毛片a∨一区二区三区| 337p亚洲精品色噜噜狠狠| av网站一区二区三区| 国内精品久久久久影院薰衣草| 亚洲午夜电影网| 亚洲欧洲制服丝袜| 亚洲同性同志一二三专区| 国产三级精品视频| 26uuu亚洲婷婷狠狠天堂| 4438成人网| 欧美日韩免费在线视频| 在线观看亚洲精品视频| 99精品视频在线观看| 成人av在线影院| 国产盗摄精品一区二区三区在线| 精品一区二区三区不卡| 精品一区二区三区在线观看国产 | 三级成人在线视频| 亚洲电影一区二区三区| 亚洲一区在线观看免费| 亚洲人快播电影网| 亚洲精品国产一区二区精华液| 综合色中文字幕| 日韩美女久久久| 玉足女爽爽91| 天天综合色天天综合色h| 日韩av二区在线播放| 日韩高清不卡一区| 精品在线观看免费| 国产精品一区一区三区| 成人晚上爱看视频| 99re在线视频这里只有精品| 99国内精品久久| 色噜噜狠狠色综合欧洲selulu | 国产麻豆欧美日韩一区| 粉嫩一区二区三区在线看 | 国产一区二区三区日韩| 国产激情偷乱视频一区二区三区| 国产不卡免费视频| 91香蕉国产在线观看软件| 欧美午夜精品一区| 日韩一级成人av| 国产女主播一区| 一区二区在线观看免费视频播放| 亚洲婷婷国产精品电影人久久| 一区二区三区在线视频免费观看| 日韩av电影免费观看高清完整版 | 日日夜夜精品视频天天综合网| 日日夜夜精品视频免费| 国产精品中文有码| 在线观看日韩毛片| 欧美变态tickling挠脚心| 中文字幕不卡在线观看| 亚洲午夜私人影院| 狠狠久久亚洲欧美| 91久久精品国产91性色tv| 欧美一级在线观看| 国产精品家庭影院| 日本欧美肥老太交大片| 成人禁用看黄a在线| 欧美视频一区二| 久久久精品蜜桃| 一区二区三区四区视频精品免费 | 福利电影一区二区| 欧洲av在线精品| 久久久www免费人成精品| 亚洲一区二区三区美女| 国产精品亚洲专一区二区三区| 欧美视频在线观看一区| 国产婷婷精品av在线| 午夜精品久久久久久久久久久| 国产成人av资源| 欧美精品v国产精品v日韩精品| 久久亚洲二区三区| 五月婷婷激情综合| 国产v综合v亚洲欧| 欧美一区二区人人喊爽| 综合亚洲深深色噜噜狠狠网站| 精品一区二区三区的国产在线播放| 色域天天综合网| 久久久久久97三级| 麻豆精品蜜桃视频网站| 欧美亚洲综合色| 中文字幕中文字幕中文字幕亚洲无线 | 中文字幕不卡一区| 青娱乐精品视频| 在线观看www91| 综合亚洲深深色噜噜狠狠网站| 国内精品免费**视频| 日韩一级视频免费观看在线| 亚洲一区在线观看网站| av在线这里只有精品| 欧美激情艳妇裸体舞| 精品制服美女丁香| 日韩欧美不卡一区| 日韩激情在线观看| 在线国产电影不卡| 18涩涩午夜精品.www| 国产69精品一区二区亚洲孕妇| 精品va天堂亚洲国产| 日本麻豆一区二区三区视频| 欧美日韩精品久久久| 亚洲国产另类精品专区| 欧美视频中文字幕| 亚洲国产欧美在线| 欧美日韩一区二区在线视频|