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


Java ChangedCharSetException类代码示例

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


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

示例1: _handleEmptyTag

import javax.swing.text.ChangedCharSetException; //导入依赖的package包/类
/**
 * A hooks for operations, preceeding call to handleEmptyTag().
 * Handle the tag with no content, like <br>. As no any
 * nested tags are expected, the tag validator is not involved.
 * @param tag The tag being handled.
 */
private void _handleEmptyTag(TagElement tag)
{
  try
    {
      validator.validateTag(tag, attributes);
      handleEmptyTag(tag);
      HTML.Tag h = tag.getHTMLTag();
      // When a block tag is closed, consume whitespace that follows after
      // it.
      // For some unknown reason a FRAME tag is not treated as block element.
      // However in this case it should be treated as such.
      if (isBlock(h))
        optional(WS);
    }
  catch (ChangedCharSetException ex)
    {
      error("Changed charset exception:", ex.getMessage());
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:26,代码来源:Parser.java

示例2: read

import javax.swing.text.ChangedCharSetException; //导入依赖的package包/类
void read(InputStream in, Document doc) throws IOException
{
    EditorKit kit = getEditorKit();

    try
    {
        kit.read(in, doc, 0);

    } catch (ChangedCharSetException ccse)
    {
        // ignored, may be in the future will be processed
        throw ccse;
    } catch (BadLocationException ble)
    {
        throw new IOException(ble);
    }

}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:19,代码来源:BrowserPane.java

示例3: handleEmptyTag

import javax.swing.text.ChangedCharSetException; //导入依赖的package包/类
protected void handleEmptyTag(final TagElement tag)
        throws ChangedCharSetException {
    if (!ignoreCharSet && (tag.getHTMLTag() == HTML.Tag.META)) {
        String httpEquivValue = (String) getAttributes().getAttribute(HTTP_EQUIV);
        String contentValue = (String) getAttributes().getAttribute(CONTENT);

        if (httpEquivValue != null && contentValue != null &&
                httpEquivValue.equalsIgnoreCase(CONTENT_TYPE) &&
                contentValue.toLowerCase().contains(CHARSET)) {
            // notice that always here ignoreCharSet will be false 
            throw new ChangedCharSetException(contentValue, ignoreCharSet); 
        }
    }
    callback.handleSimpleTag(
            tag.getHTMLTag(), getAttributes(), getCurrentPos());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:17,代码来源:DocumentParser.java

示例4: openDocument

import javax.swing.text.ChangedCharSetException; //导入依赖的package包/类
private void openDocument(File whatFile, HTMLEditorKit.ParserCallback cb)
		throws IOException, BadLocationException {
	if (whatFile == null) {
		whatFile = getFileFromChooser(".", JFileChooser.OPEN_DIALOG,
				extsHTML, Translatrix.getTranslationString("FiletypeHTML"));
	}
	if (whatFile != null) {
		try {
			loadDocument(whatFile, null, cb);
		} catch (ChangedCharSetException ccse) {
			String charsetType = ccse.getCharSetSpec().toLowerCase();
			int pos = charsetType.indexOf("charset");
			if (pos == -1) {
				throw ccse;
			}
			while (pos < charsetType.length()
					&& charsetType.charAt(pos) != '=') {
				pos++;
			}
			pos++; // Places file cursor past the equals sign (=)
			String whatEncoding = charsetType.substring(pos).trim();
			loadDocument(whatFile, whatEncoding, cb);
		}
	}
	refreshOnUpdate();
}
 
开发者ID:lexml,项目名称:lexml-swing-editorhtml,代码行数:27,代码来源:EkitCore.java

示例5: legalTagContext

import javax.swing.text.ChangedCharSetException; //导入依赖的package包/类
/**
 * Create a legal context for a tag.
 */
void legalTagContext(TagElement tag) throws ChangedCharSetException {
    if (legalElementContext(tag.getElement())) {
        markFirstTime(tag.getElement());
        return;
    }

    // Avoid putting a block tag in a flow tag.
    if (tag.breaksFlow() && (stack != null) && !stack.tag.breaksFlow()) {
        endTag(true);
        legalTagContext(tag);
        return;
    }

    // Avoid putting something wierd in the head of the document.
    for (TagStack s = stack ; s != null ; s = s.next) {
        if (s.tag.getElement() == dtd.head) {
            while (stack != s) {
                endTag(true);
            }
            endTag(true);
            legalTagContext(tag);
            return;
        }
    }

    // Everything failed
    error("tag.unexpected", tag.getElement().getName());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:Parser.java

示例6: errorContext

import javax.swing.text.ChangedCharSetException; //导入依赖的package包/类
/**
 * Error context. Something went wrong, make sure we are in
 * the document's body context
 */
void errorContext() throws ChangedCharSetException {
    for (; (stack != null) && (stack.tag.getElement() != dtd.body) ; stack = stack.next) {
        handleEndTag(stack.tag);
    }
    if (stack == null) {
        legalElementContext(dtd.body);
        startTag(makeTag(dtd.body, true));
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:Parser.java

示例7: startingTag

import javax.swing.text.ChangedCharSetException; //导入依赖的package包/类
/**
 * This should fire additional actions in response to the
 * ChangedCharSetException.  The current implementation
 * does nothing.
 * @param tag
 */
private void startingTag(TagElement tag)
{
  try
    {
      startTag(tag);
    }
  catch (ChangedCharSetException cax)
    {
      error("Invalid change of charset");
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:18,代码来源:Parser.java

示例8: m

import javax.swing.text.ChangedCharSetException; //导入依赖的package包/类
void m() throws IOException {
	Collection c = null;
	for (Object object : c) {
		try{
			throw new IOException();
		}catch(ChangedCharSetException e){
			
		}
	}
}
 
开发者ID:mdarefin,项目名称:Convert-For-Each-Loop-to-Lambda-Expression-Eclipse-Plugin,代码行数:11,代码来源:A.java

示例9: handleEmptyTag

import javax.swing.text.ChangedCharSetException; //导入依赖的package包/类
@Override
protected void handleEmptyTag(TagElement tag) throws ChangedCharSetException {

    HTML.Tag htmlTag = tag.getHTMLTag();
    if (appletInfo != null && htmlTag == HTML.Tag.PARAM) {
        SimpleAttributeSet attributes = getAttributes();
        appletInfo.setParameter((String)attributes.getAttribute(HTML.Attribute.NAME), 
            (String)attributes.getAttribute(HTML.Attribute.VALUE));
    }

}
 
开发者ID:shannah,项目名称:cn1,代码行数:12,代码来源:HTMLParser.java

示例10: startTag

import javax.swing.text.ChangedCharSetException; //导入依赖的package包/类
protected void startTag(final TagElement tag)
        throws ChangedCharSetException {

    if (isCurrentTagSimple) {
        handleEmptyTag(tag);
    } else {
        handleStartTag(tag);
    }

}
 
开发者ID:shannah,项目名称:cn1,代码行数:11,代码来源:Parser.java

示例11: iHaveNewEndTag

import javax.swing.text.ChangedCharSetException; //导入依赖的package包/类
/**
 * This method is called by the lexer, when a token that looks like
 * a closing tag is found in the parsed stream.
 * 
 * @param htmlTag a {@link HTMLTag} element that contains all the
 * information related to the closing tag, that was found in the parsed
 * stream.
 * 
 */
public void iHaveNewEndTag(final HTMLTag htmlTag) {
    currentLine = htmlTag.getLine() + 1;
    String tagName = htmlTag.getName();
    Element element = dtd.elementHash.get(tagName);
    TagElement currentTag;
    if (element != null) {
        currentTag = new TagElement(element);
        flushHtmlText(currentTag.breaksFlow());
    } else {
        handleUnrecognizedError(htmlTag);
        element = new Element(
                -1, tagName, false, false, null, null, -1, null, null, null);
        currentTag = new TagElement(element);
        flushHtmlText(currentTag.breaksFlow());
        try {
            attributes.addAttribute("endtag", Boolean.TRUE);
            handleEmptyTag(currentTag);
        } catch (ChangedCharSetException e) {
            // this shouldn't happen
            throw new AssertionError();
        }
    }
    
    currentStartPos = htmlTag.getOffset();
    currentEndPos = htmlTag.getEndPos();
    
    boolean mustBeReported = 
        manageEndElement(element);
    
    if (mustBeReported) {
        handleEndTag(currentTag);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:43,代码来源:Parser.java


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