rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
public String getQName (int i)
public String getQName(int index) { if (index < 0 || index >= attributesList.size())
public String getQName (int i) { return ((Attribute) attributesList.get (i)).name; }
return ((Attribute) attributesList.get (i)).name;
return null; } Attribute attr = (Attribute) attributesList.get(index); return (attr.name == null) ? "" : attr.name;
public String getQName (int i) { return ((Attribute) attributesList.get (i)).name; }
public String getSystemId ()
public String getSystemId() { if (entityStack.empty())
public String getSystemId () { if (entityStack.empty ()) return null; else return (String) entityStack.peek (); }
if (entityStack.empty ())
public String getSystemId () { if (entityStack.empty ()) return null; else return (String) entityStack.peek (); }
return (String) entityStack.peek ();
{ return (String) entityStack.peek(); }
public String getSystemId () { if (entityStack.empty ()) return null; else return (String) entityStack.peek (); }
public String getType (int i)
public String getType(int index)
public String getType (int i) { String type = parser.getAttributeType (elementName, getQName (i)); if (type == null) return "CDATA"; // ... use DeclHandler.attributeDecl to see enumerations if (type == "ENUMERATION") return "NMTOKEN"; return type; }
String type = parser.getAttributeType (elementName, getQName (i));
if (index < 0 || index >= attributesList.size()) { return null; } String type = parser.getAttributeType(elementName, getQName(index));
public String getType (int i) { String type = parser.getAttributeType (elementName, getQName (i)); if (type == null) return "CDATA"; // ... use DeclHandler.attributeDecl to see enumerations if (type == "ENUMERATION") return "NMTOKEN"; return type; }
}
public String getType (int i) { String type = parser.getAttributeType (elementName, getQName (i)); if (type == null) return "CDATA"; // ... use DeclHandler.attributeDecl to see enumerations if (type == "ENUMERATION") return "NMTOKEN"; return type; }
public String getURI (int index)
public String getURI(int index) { if (index < 0 || index >= attributesList.size())
public String getURI (int index) { return ((Attribute) attributesList.get (index)).nameSpace; }
return ((Attribute) attributesList.get (index)).nameSpace;
return null; } return ((Attribute) attributesList.get(index)).nameSpace;
public String getURI (int index) { return ((Attribute) attributesList.get (index)).nameSpace; }
public String getValue (int i)
public String getValue(int index) { if (index < 0 || index >= attributesList.size())
public String getValue (int i) { return ((Attribute) attributesList.get (i)).value; }
return ((Attribute) attributesList.get (i)).value;
return null; } return ((Attribute) attributesList.get(index)).value;
public String getValue (int i) { return ((Attribute) attributesList.get (i)).value; }
void ignorableWhitespace (char ch[], int start, int length)
void ignorableWhitespace(char[] ch, int start, int length)
void ignorableWhitespace (char ch[], int start, int length) throws SAXException { contentHandler.ignorableWhitespace (ch, start, length); }
throw new ArrayIndexOutOfBoundsException ();
{ throw new ArrayIndexOutOfBoundsException(); }
public boolean isDeclared (int index) { if (index < 0 || index >= attributeCount) throw new ArrayIndexOutOfBoundsException (); String type = parser.getAttributeType(elementName, getQName(index)); return (type != null); }
void notationDecl (String name, String ids [])
void notationDecl(String name, String publicId, String systemId, String baseUri)
void notationDecl (String name, String ids []) throws SAXException { try { dtdHandler.notationDecl (name, ids [0], (resolveAll && ids [1] != null) ? absolutize (ids [2], ids [1], true) : ids [1]); } catch (IOException e) { // "can't happen" throw new SAXParseException (e.getMessage (), this, e); } }
try { dtdHandler.notationDecl (name, ids [0], (resolveAll && ids [1] != null) ? absolutize (ids [2], ids [1], true) : ids [1]); } catch (IOException e) {
try { dtdHandler.notationDecl(name, publicId, (resolveAll && systemId != null) ? absolutize(baseUri, systemId, true) : systemId); } catch (IOException e) {
void notationDecl (String name, String ids []) throws SAXException { try { dtdHandler.notationDecl (name, ids [0], (resolveAll && ids [1] != null) ? absolutize (ids [2], ids [1], true) : ids [1]); } catch (IOException e) { // "can't happen" throw new SAXParseException (e.getMessage (), this, e); } }
prefixStack = new NamespaceSupport ();
{ prefixStack = new NamespaceSupport(); }
public void parse (InputSource source) throws SAXException, IOException { synchronized (base) { parser = new XmlParser (); if (namespaces) prefixStack = new NamespaceSupport (); else if (!xmlNames) throw new IllegalStateException (); parser.setHandler (this); try { Reader r = source.getCharacterStream(); InputStream in = source.getByteStream(); parser.doParse (source.getSystemId (), source.getPublicId (), r, in, source.getEncoding ()); } catch (SAXException e) { throw e; } catch (IOException e) { throw e; } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new SAXParseException (e.getMessage (), this, e); } finally { contentHandler.endDocument (); reset(); } } }
throw new IllegalStateException (); parser.setHandler (this);
{ throw new IllegalStateException(); } parser.setHandler(this);
public void parse (InputSource source) throws SAXException, IOException { synchronized (base) { parser = new XmlParser (); if (namespaces) prefixStack = new NamespaceSupport (); else if (!xmlNames) throw new IllegalStateException (); parser.setHandler (this); try { Reader r = source.getCharacterStream(); InputStream in = source.getByteStream(); parser.doParse (source.getSystemId (), source.getPublicId (), r, in, source.getEncoding ()); } catch (SAXException e) { throw e; } catch (IOException e) { throw e; } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new SAXParseException (e.getMessage (), this, e); } finally { contentHandler.endDocument (); reset(); } } }
startExternalEntity (name, source.getSystemId (), true);
} startExternalEntity(name, source.getSystemId(), true);
InputSource resolveEntity (boolean isPE, String name, InputSource in, String baseURI) throws SAXException, IOException { InputSource source; // external entities might be skipped if (isPE && !extPE) return null; if (!isPE && !extGE) return null; // ... or not lexicalHandler.startEntity (name); if (resolver2 != null && useResolver2) { source = resolver2.resolveEntity (name, in.getPublicId (), baseURI, in.getSystemId ()); if (source == null) { in.setSystemId (absolutize (baseURI, in.getSystemId (), false)); source = in; } } else { in.setSystemId (absolutize (baseURI, in.getSystemId (), false)); source = entityResolver.resolveEntity (in.getPublicId (), in.getSystemId ()); if (source == null) source = in; } startExternalEntity (name, source.getSystemId (), true); return source; }
}
public void setContentHandler (ContentHandler handler) { if (handler == null) handler = base; contentHandler = handler; }
}
public void setDTDHandler (DTDHandler handler) { if (handler == null) handler = base; this.dtdHandler = handler; }
}
public void setEntityResolver (EntityResolver resolver) { if (resolver instanceof EntityResolver2) resolver2 = (EntityResolver2) resolver; else resolver2 = null; if (resolver == null) resolver = base; entityResolver = resolver; }
}
public void setErrorHandler (ErrorHandler handler) { if (handler == null) handler = base; this.errorHandler = handler; }
throw new SAXNotSupportedException ("not while parsing");
{ throw new SAXNotSupportedException("not while parsing"); }
public void setFeature (String featureId, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { boolean state; // Features with a defined value, we just change it if we can. state = getFeature (featureId); if (state == value) return; if (parser != null) throw new SAXNotSupportedException ("not while parsing"); if ((FEATURE + "namespace-prefixes").equals (featureId)) { // in this implementation, this only affects xmlns reporting xmlNames = value; // forcibly prevent illegal parser state if (!xmlNames) namespaces = true; return; } if ((FEATURE + "namespaces").equals (featureId)) { namespaces = value; // forcibly prevent illegal parser state if (!namespaces) xmlNames = true; return; } if ((FEATURE + "external-general-entities").equals (featureId)) { extGE = value; return; } if ((FEATURE + "external-parameter-entities") .equals (featureId)) { extPE = value; return; } if ((FEATURE + "resolve-dtd-uris").equals (featureId)) { resolveAll = value; return; } if ((FEATURE + "use-entity-resolver2").equals (featureId)) { useResolver2 = value; return; } throw new SAXNotRecognizedException (featureId); }
if ("en".equals (locale.getLanguage ())) return ;
if ("en".equals(locale.getLanguage())) { return; }
public void setLocale (Locale locale) throws SAXException { if ("en".equals (locale.getLanguage ())) return ; throw new SAXException ("AElfred2 only supports English locales."); }
else if (! (value instanceof DeclHandler)) throw new SAXNotSupportedException (propertyId);
} else if (!(value instanceof DeclHandler)) { throw new SAXNotSupportedException(propertyId); }
public void setProperty (String propertyId, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { // see if the property is recognized getProperty (propertyId); // Properties with a defined value, we just change it if we can. if ((PROPERTY + "declaration-handler").equals (propertyId)) { if (value == null) declHandler = base; else if (! (value instanceof DeclHandler)) throw new SAXNotSupportedException (propertyId); else declHandler = (DeclHandler) value; return ; } if ((PROPERTY + "lexical-handler").equals (propertyId)) { if (value == null) lexicalHandler = base; else if (! (value instanceof LexicalHandler)) throw new SAXNotSupportedException (propertyId); else lexicalHandler = (LexicalHandler) value; return ; } throw new SAXNotSupportedException (propertyId); }
else if (! (value instanceof LexicalHandler)) throw new SAXNotSupportedException (propertyId);
} else if (!(value instanceof LexicalHandler)) { throw new SAXNotSupportedException(propertyId); }
public void setProperty (String propertyId, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { // see if the property is recognized getProperty (propertyId); // Properties with a defined value, we just change it if we can. if ((PROPERTY + "declaration-handler").equals (propertyId)) { if (value == null) declHandler = base; else if (! (value instanceof DeclHandler)) throw new SAXNotSupportedException (propertyId); else declHandler = (DeclHandler) value; return ; } if ((PROPERTY + "lexical-handler").equals (propertyId)) { if (value == null) lexicalHandler = base; else if (! (value instanceof LexicalHandler)) throw new SAXNotSupportedException (propertyId); else lexicalHandler = (LexicalHandler) value; return ; } throw new SAXNotSupportedException (propertyId); }
return ;
public void setProperty (String propertyId, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { // see if the property is recognized getProperty (propertyId); // Properties with a defined value, we just change it if we can. if ((PROPERTY + "declaration-handler").equals (propertyId)) { if (value == null) declHandler = base; else if (! (value instanceof DeclHandler)) throw new SAXNotSupportedException (propertyId); else declHandler = (DeclHandler) value; return ; } if ((PROPERTY + "lexical-handler").equals (propertyId)) { if (value == null) lexicalHandler = base; else if (! (value instanceof LexicalHandler)) throw new SAXNotSupportedException (propertyId); else lexicalHandler = (LexicalHandler) value; return ; } throw new SAXNotSupportedException (propertyId); }
prefixStack.pushContext (); } else if (namespaces) {
{ prefixStack.pushContext(); } } else if (namespaces) {
void startElement (String elname) throws SAXException { ContentHandler handler = contentHandler; // // NOTE: this implementation of namespace support adds something // like six percent to parsing CPU time, in a large (~50 MB) // document that doesn't use namespaces at all. (Measured by PC // sampling, with a bug where endElement processing was omitted.) // [Measurement referred to older implementation, older JVM ...] // // It ought to become notably faster in such cases. Most // costs are the prefix stack calling Hashtable.get() (2%), // String.hashCode() (1.5%) and about 1.3% each for pushing // the context, and two chunks of name processing. // if (!attributes) { if (namespaces) prefixStack.pushContext (); } else if (namespaces) { // now we can patch up namespace refs; we saw all the // declarations, so now we'll do the Right Thing Iterator itt = attributesList.iterator (); while(itt.hasNext()) { Attribute attribute = (Attribute) itt.next(); String qname = attribute.name; int index; // default NS declaration? if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) continue; } else { if ("xmlns".equals(qname)) continue; } //Illegal in the new Namespaces Draft //should it be only in 1.1 docs?? if (qname.equals (":")) fatal ("namespace names consisting of a single colon " + "character are invalid"); index = qname.indexOf (':'); // NS prefix declaration? if (index == 5 && qname.startsWith ("xmlns")) continue; // it's not a NS decl; patch namespace info items if (prefixStack.processName (qname, nsTemp, true) == null) fatal ("undeclared attribute prefix in: " + qname); else { attribute.nameSpace = nsTemp[0]; attribute.localName = nsTemp[1]; } } } // save element name so attribute callbacks work elementName = elname; if (namespaces) { if (prefixStack.processName (elname, nsTemp, false) == null) { fatal ("undeclared element prefix in: " + elname); nsTemp [0] = nsTemp [1] = ""; } handler.startElement (nsTemp [0], nsTemp [1], elname, this); } else handler.startElement ("", "", elname, this); // elementName = null; // elements with no attributes are pretty common! if (attributes) { attributesList.clear(); attributeCount = 0; attributes = false; } }
if (getFeature (FEATURE + "string-interning")) {
if (stringInterning) {
void startElement (String elname) throws SAXException { ContentHandler handler = contentHandler; // // NOTE: this implementation of namespace support adds something // like six percent to parsing CPU time, in a large (~50 MB) // document that doesn't use namespaces at all. (Measured by PC // sampling, with a bug where endElement processing was omitted.) // [Measurement referred to older implementation, older JVM ...] // // It ought to become notably faster in such cases. Most // costs are the prefix stack calling Hashtable.get() (2%), // String.hashCode() (1.5%) and about 1.3% each for pushing // the context, and two chunks of name processing. // if (!attributes) { if (namespaces) prefixStack.pushContext (); } else if (namespaces) { // now we can patch up namespace refs; we saw all the // declarations, so now we'll do the Right Thing Iterator itt = attributesList.iterator (); while(itt.hasNext()) { Attribute attribute = (Attribute) itt.next(); String qname = attribute.name; int index; // default NS declaration? if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) continue; } else { if ("xmlns".equals(qname)) continue; } //Illegal in the new Namespaces Draft //should it be only in 1.1 docs?? if (qname.equals (":")) fatal ("namespace names consisting of a single colon " + "character are invalid"); index = qname.indexOf (':'); // NS prefix declaration? if (index == 5 && qname.startsWith ("xmlns")) continue; // it's not a NS decl; patch namespace info items if (prefixStack.processName (qname, nsTemp, true) == null) fatal ("undeclared attribute prefix in: " + qname); else { attribute.nameSpace = nsTemp[0]; attribute.localName = nsTemp[1]; } } } // save element name so attribute callbacks work elementName = elname; if (namespaces) { if (prefixStack.processName (elname, nsTemp, false) == null) { fatal ("undeclared element prefix in: " + elname); nsTemp [0] = nsTemp [1] = ""; } handler.startElement (nsTemp [0], nsTemp [1], elname, this); } else handler.startElement ("", "", elname, this); // elementName = null; // elements with no attributes are pretty common! if (attributes) { attributesList.clear(); attributeCount = 0; attributes = false; } }
} else {
} } else {
void startElement (String elname) throws SAXException { ContentHandler handler = contentHandler; // // NOTE: this implementation of namespace support adds something // like six percent to parsing CPU time, in a large (~50 MB) // document that doesn't use namespaces at all. (Measured by PC // sampling, with a bug where endElement processing was omitted.) // [Measurement referred to older implementation, older JVM ...] // // It ought to become notably faster in such cases. Most // costs are the prefix stack calling Hashtable.get() (2%), // String.hashCode() (1.5%) and about 1.3% each for pushing // the context, and two chunks of name processing. // if (!attributes) { if (namespaces) prefixStack.pushContext (); } else if (namespaces) { // now we can patch up namespace refs; we saw all the // declarations, so now we'll do the Right Thing Iterator itt = attributesList.iterator (); while(itt.hasNext()) { Attribute attribute = (Attribute) itt.next(); String qname = attribute.name; int index; // default NS declaration? if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) continue; } else { if ("xmlns".equals(qname)) continue; } //Illegal in the new Namespaces Draft //should it be only in 1.1 docs?? if (qname.equals (":")) fatal ("namespace names consisting of a single colon " + "character are invalid"); index = qname.indexOf (':'); // NS prefix declaration? if (index == 5 && qname.startsWith ("xmlns")) continue; // it's not a NS decl; patch namespace info items if (prefixStack.processName (qname, nsTemp, true) == null) fatal ("undeclared attribute prefix in: " + qname); else { attribute.nameSpace = nsTemp[0]; attribute.localName = nsTemp[1]; } } } // save element name so attribute callbacks work elementName = elname; if (namespaces) { if (prefixStack.processName (elname, nsTemp, false) == null) { fatal ("undeclared element prefix in: " + elname); nsTemp [0] = nsTemp [1] = ""; } handler.startElement (nsTemp [0], nsTemp [1], elname, this); } else handler.startElement ("", "", elname, this); // elementName = null; // elements with no attributes are pretty common! if (attributes) { attributesList.clear(); attributeCount = 0; attributes = false; } }
fatal ("namespace names consisting of a single colon " +
{ fatal("namespace names consisting of a single colon " +
void startElement (String elname) throws SAXException { ContentHandler handler = contentHandler; // // NOTE: this implementation of namespace support adds something // like six percent to parsing CPU time, in a large (~50 MB) // document that doesn't use namespaces at all. (Measured by PC // sampling, with a bug where endElement processing was omitted.) // [Measurement referred to older implementation, older JVM ...] // // It ought to become notably faster in such cases. Most // costs are the prefix stack calling Hashtable.get() (2%), // String.hashCode() (1.5%) and about 1.3% each for pushing // the context, and two chunks of name processing. // if (!attributes) { if (namespaces) prefixStack.pushContext (); } else if (namespaces) { // now we can patch up namespace refs; we saw all the // declarations, so now we'll do the Right Thing Iterator itt = attributesList.iterator (); while(itt.hasNext()) { Attribute attribute = (Attribute) itt.next(); String qname = attribute.name; int index; // default NS declaration? if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) continue; } else { if ("xmlns".equals(qname)) continue; } //Illegal in the new Namespaces Draft //should it be only in 1.1 docs?? if (qname.equals (":")) fatal ("namespace names consisting of a single colon " + "character are invalid"); index = qname.indexOf (':'); // NS prefix declaration? if (index == 5 && qname.startsWith ("xmlns")) continue; // it's not a NS decl; patch namespace info items if (prefixStack.processName (qname, nsTemp, true) == null) fatal ("undeclared attribute prefix in: " + qname); else { attribute.nameSpace = nsTemp[0]; attribute.localName = nsTemp[1]; } } } // save element name so attribute callbacks work elementName = elname; if (namespaces) { if (prefixStack.processName (elname, nsTemp, false) == null) { fatal ("undeclared element prefix in: " + elname); nsTemp [0] = nsTemp [1] = ""; } handler.startElement (nsTemp [0], nsTemp [1], elname, this); } else handler.startElement ("", "", elname, this); // elementName = null; // elements with no attributes are pretty common! if (attributes) { attributesList.clear(); attributeCount = 0; attributes = false; } }
index = qname.indexOf (':');
} index = qname.indexOf(':');
void startElement (String elname) throws SAXException { ContentHandler handler = contentHandler; // // NOTE: this implementation of namespace support adds something // like six percent to parsing CPU time, in a large (~50 MB) // document that doesn't use namespaces at all. (Measured by PC // sampling, with a bug where endElement processing was omitted.) // [Measurement referred to older implementation, older JVM ...] // // It ought to become notably faster in such cases. Most // costs are the prefix stack calling Hashtable.get() (2%), // String.hashCode() (1.5%) and about 1.3% each for pushing // the context, and two chunks of name processing. // if (!attributes) { if (namespaces) prefixStack.pushContext (); } else if (namespaces) { // now we can patch up namespace refs; we saw all the // declarations, so now we'll do the Right Thing Iterator itt = attributesList.iterator (); while(itt.hasNext()) { Attribute attribute = (Attribute) itt.next(); String qname = attribute.name; int index; // default NS declaration? if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) continue; } else { if ("xmlns".equals(qname)) continue; } //Illegal in the new Namespaces Draft //should it be only in 1.1 docs?? if (qname.equals (":")) fatal ("namespace names consisting of a single colon " + "character are invalid"); index = qname.indexOf (':'); // NS prefix declaration? if (index == 5 && qname.startsWith ("xmlns")) continue; // it's not a NS decl; patch namespace info items if (prefixStack.processName (qname, nsTemp, true) == null) fatal ("undeclared attribute prefix in: " + qname); else { attribute.nameSpace = nsTemp[0]; attribute.localName = nsTemp[1]; } } } // save element name so attribute callbacks work elementName = elname; if (namespaces) { if (prefixStack.processName (elname, nsTemp, false) == null) { fatal ("undeclared element prefix in: " + elname); nsTemp [0] = nsTemp [1] = ""; } handler.startElement (nsTemp [0], nsTemp [1], elname, this); } else handler.startElement ("", "", elname, this); // elementName = null; // elements with no attributes are pretty common! if (attributes) { attributesList.clear(); attributeCount = 0; attributes = false; } }
if (index == 5 && qname.startsWith ("xmlns"))
if (index == 5 && qname.startsWith("xmlns")) {
void startElement (String elname) throws SAXException { ContentHandler handler = contentHandler; // // NOTE: this implementation of namespace support adds something // like six percent to parsing CPU time, in a large (~50 MB) // document that doesn't use namespaces at all. (Measured by PC // sampling, with a bug where endElement processing was omitted.) // [Measurement referred to older implementation, older JVM ...] // // It ought to become notably faster in such cases. Most // costs are the prefix stack calling Hashtable.get() (2%), // String.hashCode() (1.5%) and about 1.3% each for pushing // the context, and two chunks of name processing. // if (!attributes) { if (namespaces) prefixStack.pushContext (); } else if (namespaces) { // now we can patch up namespace refs; we saw all the // declarations, so now we'll do the Right Thing Iterator itt = attributesList.iterator (); while(itt.hasNext()) { Attribute attribute = (Attribute) itt.next(); String qname = attribute.name; int index; // default NS declaration? if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) continue; } else { if ("xmlns".equals(qname)) continue; } //Illegal in the new Namespaces Draft //should it be only in 1.1 docs?? if (qname.equals (":")) fatal ("namespace names consisting of a single colon " + "character are invalid"); index = qname.indexOf (':'); // NS prefix declaration? if (index == 5 && qname.startsWith ("xmlns")) continue; // it's not a NS decl; patch namespace info items if (prefixStack.processName (qname, nsTemp, true) == null) fatal ("undeclared attribute prefix in: " + qname); else { attribute.nameSpace = nsTemp[0]; attribute.localName = nsTemp[1]; } } } // save element name so attribute callbacks work elementName = elname; if (namespaces) { if (prefixStack.processName (elname, nsTemp, false) == null) { fatal ("undeclared element prefix in: " + elname); nsTemp [0] = nsTemp [1] = ""; } handler.startElement (nsTemp [0], nsTemp [1], elname, this); } else handler.startElement ("", "", elname, this); // elementName = null; // elements with no attributes are pretty common! if (attributes) { attributesList.clear(); attributeCount = 0; attributes = false; } }
if (prefixStack.processName (qname, nsTemp, true) == null) fatal ("undeclared attribute prefix in: " + qname); else {
if (prefixStack.processName(qname, nsTemp, true) == null) { fatal("undeclared attribute prefix in: " + qname); } else {
void startElement (String elname) throws SAXException { ContentHandler handler = contentHandler; // // NOTE: this implementation of namespace support adds something // like six percent to parsing CPU time, in a large (~50 MB) // document that doesn't use namespaces at all. (Measured by PC // sampling, with a bug where endElement processing was omitted.) // [Measurement referred to older implementation, older JVM ...] // // It ought to become notably faster in such cases. Most // costs are the prefix stack calling Hashtable.get() (2%), // String.hashCode() (1.5%) and about 1.3% each for pushing // the context, and two chunks of name processing. // if (!attributes) { if (namespaces) prefixStack.pushContext (); } else if (namespaces) { // now we can patch up namespace refs; we saw all the // declarations, so now we'll do the Right Thing Iterator itt = attributesList.iterator (); while(itt.hasNext()) { Attribute attribute = (Attribute) itt.next(); String qname = attribute.name; int index; // default NS declaration? if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) continue; } else { if ("xmlns".equals(qname)) continue; } //Illegal in the new Namespaces Draft //should it be only in 1.1 docs?? if (qname.equals (":")) fatal ("namespace names consisting of a single colon " + "character are invalid"); index = qname.indexOf (':'); // NS prefix declaration? if (index == 5 && qname.startsWith ("xmlns")) continue; // it's not a NS decl; patch namespace info items if (prefixStack.processName (qname, nsTemp, true) == null) fatal ("undeclared attribute prefix in: " + qname); else { attribute.nameSpace = nsTemp[0]; attribute.localName = nsTemp[1]; } } } // save element name so attribute callbacks work elementName = elname; if (namespaces) { if (prefixStack.processName (elname, nsTemp, false) == null) { fatal ("undeclared element prefix in: " + elname); nsTemp [0] = nsTemp [1] = ""; } handler.startElement (nsTemp [0], nsTemp [1], elname, this); } else handler.startElement ("", "", elname, this); // elementName = null; // elements with no attributes are pretty common! if (attributes) { attributesList.clear(); attributeCount = 0; attributes = false; } }
if (namespaces) { if (prefixStack.processName (elname, nsTemp, false) == null) { fatal ("undeclared element prefix in: " + elname); nsTemp [0] = nsTemp [1] = ""; } handler.startElement (nsTemp [0], nsTemp [1], elname, this); } else handler.startElement ("", "", elname, this);
if (namespaces) { if (prefixStack.processName(elname, nsTemp, false) == null) { fatal("undeclared element prefix in: " + elname); nsTemp[0] = nsTemp[1] = ""; } handler.startElement(nsTemp[0], nsTemp[1], elname, this); } else { handler.startElement("", "", elname, this); }
void startElement (String elname) throws SAXException { ContentHandler handler = contentHandler; // // NOTE: this implementation of namespace support adds something // like six percent to parsing CPU time, in a large (~50 MB) // document that doesn't use namespaces at all. (Measured by PC // sampling, with a bug where endElement processing was omitted.) // [Measurement referred to older implementation, older JVM ...] // // It ought to become notably faster in such cases. Most // costs are the prefix stack calling Hashtable.get() (2%), // String.hashCode() (1.5%) and about 1.3% each for pushing // the context, and two chunks of name processing. // if (!attributes) { if (namespaces) prefixStack.pushContext (); } else if (namespaces) { // now we can patch up namespace refs; we saw all the // declarations, so now we'll do the Right Thing Iterator itt = attributesList.iterator (); while(itt.hasNext()) { Attribute attribute = (Attribute) itt.next(); String qname = attribute.name; int index; // default NS declaration? if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) continue; } else { if ("xmlns".equals(qname)) continue; } //Illegal in the new Namespaces Draft //should it be only in 1.1 docs?? if (qname.equals (":")) fatal ("namespace names consisting of a single colon " + "character are invalid"); index = qname.indexOf (':'); // NS prefix declaration? if (index == 5 && qname.startsWith ("xmlns")) continue; // it's not a NS decl; patch namespace info items if (prefixStack.processName (qname, nsTemp, true) == null) fatal ("undeclared attribute prefix in: " + qname); else { attribute.nameSpace = nsTemp[0]; attribute.localName = nsTemp[1]; } } } // save element name so attribute callbacks work elementName = elname; if (namespaces) { if (prefixStack.processName (elname, nsTemp, false) == null) { fatal ("undeclared element prefix in: " + elname); nsTemp [0] = nsTemp [1] = ""; } handler.startElement (nsTemp [0], nsTemp [1], elname, this); } else handler.startElement ("", "", elname, this); // elementName = null; // elements with no attributes are pretty common! if (attributes) { attributesList.clear(); attributeCount = 0; attributes = false; } }
lexicalHandler.startEntity (name); entityStack.push (systemId);
{ lexicalHandler.startEntity(name); } entityStack.push(systemId);
void startExternalEntity (String name, String systemId, boolean stackOnly) throws SAXException { // The following warning was deleted because the application has the // option of not setting systemId. Sun's JAXP or Xerces seems to // ignore this case. /* if (systemId == null) warn ("URI was not reported to parser for entity " + name); */ if (!stackOnly) // spliced [dtd] needs startEntity lexicalHandler.startEntity (name); entityStack.push (systemId); }
void unparsedEntityDecl (String name, String ids [], String notation)
void unparsedEntityDecl(String name, String publicId, String systemId, String baseUri, String notation)
void unparsedEntityDecl (String name, String ids [], String notation) throws SAXException { try { dtdHandler.unparsedEntityDecl (name, ids [0], resolveAll ? absolutize (ids [2], ids [1], true) : ids [1], notation); } catch (IOException e) { // "can't happen" throw new SAXParseException (e.getMessage (), this, e); } }
try { dtdHandler.unparsedEntityDecl (name, ids [0],
try { dtdHandler.unparsedEntityDecl(name, publicId,
void unparsedEntityDecl (String name, String ids [], String notation) throws SAXException { try { dtdHandler.unparsedEntityDecl (name, ids [0], resolveAll ? absolutize (ids [2], ids [1], true) : ids [1], notation); } catch (IOException e) { // "can't happen" throw new SAXParseException (e.getMessage (), this, e); } }
? absolutize (ids [2], ids [1], true) : ids [1],
? absolutize(baseUri, systemId, true) : systemId,
void unparsedEntityDecl (String name, String ids [], String notation) throws SAXException { try { dtdHandler.unparsedEntityDecl (name, ids [0], resolveAll ? absolutize (ids [2], ids [1], true) : ids [1], notation); } catch (IOException e) { // "can't happen" throw new SAXParseException (e.getMessage (), this, e); } }
public JSlider(int orientation, int minimum, int maximum, int value) {
public JSlider() {
public JSlider(int orientation, int minimum, int maximum, int value) { // TODO } // JSlider()
public Identity(String name)
protected Identity()
public Identity(String name) { this.name = name; this.scope = null; }
this.name = name; this.scope = null;
public Identity(String name) { this.name = name; this.scope = null; }
RESyntax syntax = RESyntax.RE_SYNTAX_PERL5;
RESyntax syntax = RESyntax.RE_SYNTAX_JAVA_1_4;
private Pattern (String regex, int flags) throws PatternSyntaxException { this.regex = regex; this.flags = flags; int gnuFlags = 0; if ((flags & CASE_INSENSITIVE) != 0) gnuFlags |= RE.REG_ICASE; if ((flags & MULTILINE) != 0) gnuFlags |= RE.REG_MULTILINE; if ((flags & DOTALL) != 0) gnuFlags |= RE.REG_DOT_NEWLINE; // not yet supported: // if ((flags & UNICODE_CASE) != 0) gnuFlags = // if ((flags & CANON_EQ) != 0) gnuFlags = // Eventually there will be such a thing as JDK 1_4 syntax RESyntax syntax = RESyntax.RE_SYNTAX_PERL5; if ((flags & UNIX_LINES) != 0) { // Use a syntax set with \n for linefeeds? syntax = new RESyntax(syntax); syntax.setLineSeparator("\n"); } if ((flags & COMMENTS) != 0) { // Use a syntax with support for comments? } try { this.re = new RE(regex, gnuFlags, syntax); } catch (REException e) { throw new PatternSyntaxException(e.getMessage(), regex, e.getPosition()); } }
throw new IOException("Cannot find plugin manager", ex);
final IOException ioe = new IOException("Cannot find plugin manager"); ioe.initCause(ex); throw ioe;
public void connect() throws IOException { try { final PluginManager pluginMgr = (PluginManager) InitialNaming.lookup(PluginManager.NAME); final PluginDescriptor descr = pluginMgr.getRegistry().getPluginDescriptor(pluginId); if (descr == null) { throw new IOException("Plugin " + pluginId + " not found"); } this.jarFile = ((PluginDescriptorModel) descr).getJarFile(); if (this.jarFile == null) { throw new IOException("Plugin jarfile not found"); } } catch (NameNotFoundException ex) { throw new IOException("Cannot find plugin manager", ex); } }
public MalformedURLException(String message)
public MalformedURLException()
public MalformedURLException(String message) { super(message); }
super(message);
public MalformedURLException(String message) { super(message); }
&& !b.getModel().isPressed() && b.isEnabled())
&& ! b.getModel().isPressed() && ! b.getModel().isArmed() && b.isEnabled())
public void update(Graphics g, JComponent c) { AbstractButton b = (AbstractButton) c; if (b.isContentAreaFilled() && UIManager.get(getPropertyPrefix() + "gradient") != null && !b.getModel().isPressed() && b.isEnabled()) { MetalUtils.paintGradient(g, 0, 0, c.getWidth(), c.getHeight(), SwingConstants.VERTICAL, getPropertyPrefix() + "gradient"); paint(g, c); } else super.update(g, c); }
focusColor = defaults.getColor("Button.focus"); b.setForeground(defaults.getColor("Button.foreground")); b.setBackground(defaults.getColor("Button.background")); b.setMargin(defaults.getInsets("Button.margin")); b.setBorder(defaults.getBorder("Button.border")); b.setIconTextGap(defaults.getInt("Button.textIconGap"));
String prefix = getPropertyPrefix(); focusColor = defaults.getColor(prefix + ".focus"); b.setForeground(defaults.getColor(prefix + ".foreground")); b.setBackground(defaults.getColor(prefix + ".background")); b.setMargin(defaults.getInsets(prefix + ".margin")); b.setBorder(defaults.getBorder(prefix + ".border")); b.setIconTextGap(defaults.getInt(prefix + ".textIconGap"));
protected void installDefaults(AbstractButton b) { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); focusColor = defaults.getColor("Button.focus"); b.setForeground(defaults.getColor("Button.foreground")); b.setBackground(defaults.getColor("Button.background")); b.setMargin(defaults.getInsets("Button.margin")); b.setBorder(defaults.getBorder("Button.border")); b.setIconTextGap(defaults.getInt("Button.textIconGap")); b.setInputMap(JComponent.WHEN_FOCUSED, (InputMap) defaults.get("Button.focusInputMap")); b.setOpaque(true); }
(InputMap) defaults.get("Button.focusInputMap"));
(InputMap) defaults.get(prefix + ".focusInputMap"));
protected void installDefaults(AbstractButton b) { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); focusColor = defaults.getColor("Button.focus"); b.setForeground(defaults.getColor("Button.foreground")); b.setBackground(defaults.getColor("Button.background")); b.setMargin(defaults.getInsets("Button.margin")); b.setBorder(defaults.getBorder("Button.border")); b.setIconTextGap(defaults.getInt("Button.textIconGap")); b.setInputMap(JComponent.WHEN_FOCUSED, (InputMap) defaults.get("Button.focusInputMap")); b.setOpaque(true); }
public abstract boolean equals(Object perm);
boolean equals (Object perm);
public abstract boolean equals(Object perm);
public String toString();
String toString();
public String toString();
return currentPolicy;
return getCurrentPolicy();
public static Policy getPolicy() { SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(new SecurityPermission("getPolicy")); return currentPolicy; }
setup(policy);
public static void setPolicy(Policy policy) { SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(new SecurityPermission("setPolicy")); currentPolicy = policy; }
public BevelBorder(int top, int left, int bottom, int right, Color color) { super(top, left, bottom, right); this.c = color; }
public BevelBorder(int bevelType) { if ((bevelType != RAISED) && (bevelType != LOWERED)) throw new IllegalArgumentException(); this.bevelType = bevelType; }
public BevelBorder(int top, int left, int bottom, int right, Color color) { super(top, left, bottom, right); this.c = color; }
{ return false; }
{ return ((highlightOuter == null) || (highlightOuter.getAlpha() == 255)) && ((highlightInner == null) || (highlightInner.getAlpha() == 255)) && ((shadowInner == null) || (shadowInner.getAlpha() == 255)) && ((shadowOuter == null) ||(shadowOuter.getAlpha() == 255)); }
public boolean isBorderOpaque() { return false; }
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { switch (bevelType)
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { }
}
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { }
setBackgroundNonSelectionColor(UIManager.getColor("Tree.nonSelectionBackground"));
setBackgroundNonSelectionColor(UIManager.getColor("Tree.textBackground"));
public DefaultTreeCellRenderer() { setLeafIcon(getDefaultLeafIcon()); setOpenIcon(getDefaultOpenIcon()); setClosedIcon(getDefaultClosedIcon()); setTextNonSelectionColor(UIManager.getColor("Tree.textForeground")); setTextSelectionColor(UIManager.getColor("Tree.selectionForeground")); setBackgroundNonSelectionColor(UIManager.getColor("Tree.nonSelectionBackground")); setBackgroundSelectionColor(UIManager.getColor("Tree.selectionBackground")); setBorderSelectionColor(UIManager.getColor("Tree.selectionBorderColor")); }
protected void firePropertyChange(String value0, Object value1, Object value2)
protected void firePropertyChange(String name, Object oldValue, Object newValue)
protected void firePropertyChange(String value0, Object value1, Object value2) { // Overridden for performance reasons. } // firePropertyChange()
SwingUtilities.layoutCompoundLabel(((JLabel) this), fm, getText(),
SwingUtilities.layoutCompoundLabel((JLabel) this, fm, getText(),
public Dimension getPreferredSize() { Rectangle vr = new Rectangle(); Rectangle ir = new Rectangle(); Rectangle tr = new Rectangle(); FontMetrics fm = getToolkit().getFontMetrics(getFont()); SwingUtilities.layoutCompoundLabel(((JLabel) this), fm, getText(), getIcon(), getVerticalAlignment(), getHorizontalAlignment(), getVerticalTextPosition(), getHorizontalTextPosition(), vr, ir, tr, getIconTextGap()); Rectangle cr = ir.union(tr); return new Dimension(cr.width, cr.height); } // getPreferredSize()
SwingUtilities.layoutCompoundLabel(((JLabel) this), fm, getText(),
SwingUtilities.layoutCompoundLabel((JLabel) this, fm, getText(),
public void paint(Graphics g) { // paint background Rectangle vr = new Rectangle(); Rectangle ir = new Rectangle(); Rectangle tr = new Rectangle(); Insets insets = new Insets(0, 0, 0, 0); Border border = UIManager.getBorder("Tree.selectionBorder"); if (border != null) insets = border.getBorderInsets(this); FontMetrics fm = getToolkit().getFontMetrics(getFont()); SwingUtilities.layoutCompoundLabel(((JLabel) this), fm, getText(), getIcon(), getVerticalAlignment(), getHorizontalAlignment(), getVerticalTextPosition(), getHorizontalTextPosition(), vr, ir, tr, getIconTextGap()); // Reusing one rectangle. Rectangle bounds = getBounds(ir); bounds.x = tr.x - insets.left; bounds.width = tr.width + insets.left+insets.right; g.setColor(super.getBackground()); g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height); super.paint(g); // Paint the border of the focused element only (lead selection) if (hasFocus) { Color b = getBorderSelectionColor(); if (b != null) { g.setColor(b); g.drawRect(bounds.x, bounds.y, bounds.width, bounds.height - 1); } } }
public void repaint(long value0, int value1, int value2, int value3, int value4)
public void repaint(long tm, int x, int y, int width, int height)
public void repaint(long value0, int value1, int value2, int value3, int value4) { // Overridden for performance reasons. } // repaint()
public void setClosedIcon(Icon i)
public void setClosedIcon(Icon icon)
public void setClosedIcon(Icon i) { closedIcon = i; }
closedIcon = i;
closedIcon = icon;
public void setClosedIcon(Icon i) { closedIcon = i; }
public void setLeafIcon(Icon i)
public void setLeafIcon(Icon icon)
public void setLeafIcon(Icon i) { leafIcon = i; }
leafIcon = i;
leafIcon = icon;
public void setLeafIcon(Icon i) { leafIcon = i; }
public void setOpenIcon(Icon i)
public void setOpenIcon(Icon icon)
public void setOpenIcon(Icon i) { openIcon = i; }
openIcon = i;
openIcon = icon;
public void setOpenIcon(Icon i) { openIcon = i; }
return new OtherwiseNode((children == null) ? null : children.clone(stylesheet), (next == null) ? null : next.clone(stylesheet));
TemplateNode ret = new OtherwiseNode(); if (children != null) { ret.children = children.clone(stylesheet);
TemplateNode clone(Stylesheet stylesheet) { return new OtherwiseNode((children == null) ? null : children.clone(stylesheet), (next == null) ? null : next.clone(stylesheet)); }
if (next != null) { ret.next = next.clone(stylesheet); } return ret; }
TemplateNode clone(Stylesheet stylesheet) { return new OtherwiseNode((children == null) ? null : children.clone(stylesheet), (next == null) ? null : next.clone(stylesheet)); }
clearRect(int x, int y, int width, int height);
public abstract void clearRect(int x, int y, int width, int height);
clearRect(int x, int y, int width, int height);
clipRect(int x, int y, int width, int height);
public abstract void clipRect(int x, int y, int width, int height);
clipRect(int x, int y, int width, int height);
copyArea(int x, int y, int width, int height, int dx, int dy);
public abstract void copyArea(int x, int y, int width, int height, int dx, int dy);
copyArea(int x, int y, int width, int height, int dx, int dy);
create();
public abstract Graphics create();
create();
dispose();
public abstract void dispose();
dispose();
draw3DRect(int x, int y, int width, int height, boolean raised)
public void draw3DRect(int x, int y, int width, int height, boolean raised)
draw3DRect(int x, int y, int width, int height, boolean raised){ Color color = getColor(); Color tl = color.brighter(); Color br = color.darker(); if (!raised) { Color tmp = tl; tl = br; br = tmp; } int x1 = x; int y1 = y; int x2 = x + width; int y2 = y + height; setColor(tl); drawLine(x1, y1, x2, y1); drawLine(x1, y2, x1, y1); setColor(br); drawLine(x2, y1, x2, y2); drawLine(x2, y2, x1, y2); setColor(color);}
drawArc(int x, int y, int width, int height, int arcStart, int arcAngle);
public abstract void drawArc(int x, int y, int width, int height, int arcStart, int arcAngle);
drawArc(int x, int y, int width, int height, int arcStart, int arcAngle);
drawBytes(byte[] data, int offset, int length, int x, int y)
public void drawBytes(byte[] data, int offset, int length, int x, int y)
drawBytes(byte[] data, int offset, int length, int x, int y){ String str = new String(data, offset, length); drawString(str, x, y);}
drawChars(char data[], int offset, int length, int x, int y)
public void drawChars(char data[], int offset, int length, int x, int y)
drawChars(char data[], int offset, int length, int x, int y){ drawString(new String(data, offset, length), x, y);}
drawImage(Image image, int x, int y, ImageObserver observer);
public abstract boolean drawImage(Image image, int x, int y, ImageObserver observer);
drawImage(Image image, int x, int y, ImageObserver observer);
drawLine(int x1, int y1, int x2, int y2);
public abstract void drawLine(int x1, int y1, int x2, int y2);
drawLine(int x1, int y1, int x2, int y2);
drawOval(int x, int y, int width, int height);
public abstract void drawOval(int x, int y, int width, int height);
drawOval(int x, int y, int width, int height);
drawPolygon(int xPoints[], int yPoints[], int npoints);
public abstract void drawPolygon(int xPoints[], int yPoints[], int npoints);
drawPolygon(int xPoints[], int yPoints[], int npoints);
drawPolyline(int xPoints[], int yPoints[], int npoints);
public abstract void drawPolyline(int xPoints[], int yPoints[], int npoints);
drawPolyline(int xPoints[], int yPoints[], int npoints);
drawRect(int x, int y, int width, int height)
public void drawRect(int x, int y, int width, int height)
drawRect(int x, int y, int width, int height){ int x1 = x; int y1 = y; int x2 = x + width; int y2 = y + height; drawLine(x1, y1, x2, y1); drawLine(x2, y1, x2, y2); drawLine(x2, y2, x1, y2); drawLine(x1, y2, x1, y1);}
drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight);
public abstract void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight);
drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight);
drawString(String string, int x, int y);
public abstract void drawString(String string, int x, int y);
drawString(String string, int x, int y);
fill3DRect(int x, int y, int width, int height, boolean raised)
public void fill3DRect(int x, int y, int width, int height, boolean raised)
fill3DRect(int x, int y, int width, int height, boolean raised){ fillRect(x, y, width, height); draw3DRect(x, y, width-1, height-1, raised);}
fillArc(int x, int y, int width, int height, int arcStart, int arcAngle);
public abstract void fillArc(int x, int y, int width, int height, int arcStart, int arcAngle);
fillArc(int x, int y, int width, int height, int arcStart, int arcAngle);
fillOval(int x, int y, int width, int height);
public abstract void fillOval(int x, int y, int width, int height);
fillOval(int x, int y, int width, int height);
fillPolygon(int xPoints[], int yPoints[], int npoints);
public abstract void fillPolygon(int xPoints[], int yPoints[], int npoints);
fillPolygon(int xPoints[], int yPoints[], int npoints);
fillRect(int x, int y, int width, int height);
public abstract void fillRect(int x, int y, int width, int height);
fillRect(int x, int y, int width, int height);
fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight);
public abstract void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight);
fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight);
finalize()
public void finalize()
finalize(){ dispose();}
getClip();
public abstract Shape getClip();
getClip();
getClipBounds();
public abstract Rectangle getClipBounds();
getClipBounds();
getClipRect()
public Rectangle getClipRect()
getClipRect(){ return(getClipBounds());}
return(getClipBounds());
return getClipBounds();
getClipRect(){ return(getClipBounds());}
getColor();
public abstract Color getColor();
getColor();