public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type, engine); } Object v = values.get(value.toLowerCase().intern()); if (v == null) { throw createInvalidIdentifierDOMException(value, engine); } return (Value)v; }
/** * Sets a new value for the given variable * @return the old value or null */ public Object put( String key, Object value ) { int hash = key.hashCode() & 0x7FFFFFFF; int index = hash % table.length; for ( Entry e = table[ index ]; e != null; e = e.next ) { if ( ( e.hash == hash ) && e.key == key ) { Object old = e.value; e.value = value; return old; } } // The key is not in the hash table int len = table.length; if ( count++ >= ( len - ( len >> 2 ) ) ) { // more than 75% loaded: grow rehash(); index = hash % table.length; } Entry e = new Entry( hash, key, value, table[ index ] ); table[ index ] = e; return null; }
public String[] getCssIdentifiers(String propertyName) { StringMap map = getIdentifiers(propertyName); if (map == null) { return new String[0]; } int count = map.size(); List<String> keys = new ArrayList<String>(count); Iterator<String> it = map.keys(); while (it.hasNext()) { String string = it.next(); keys.add(string); } keys.add("inherit"); // NOI18N Collections.sort(keys); return keys.toArray(new String[keys.size()]); }
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type, engine); } Object v = values.get(value.toLowerCase().intern()); if (v == null) { throw createInvalidIdentifierDOMException(value, engine); } return (Value)v; }
/** * Sets a new value for the given variable * @return the old value or null */ public Object put( String key, Object value ) { int hash = key.hashCode() & 0x7FFFFFFF; int index = hash % table.length; for ( Entry e = table[ index ]; e != null; e = e.next ) { if ( ( e.hash == hash ) && e.key == key ) { Object old = e.value; e.value = value; return old; } } // The key is not in the hash table int len = table.length; if ( count++ >= ( len - ( len >> 2 ) ) ) { // more than 75% loaded: grow rehash(); index = hash % table.length; } Entry e = new Entry( hash, key, value, table[ index ] ); table[ index ] = e; return null; }
public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidIdentifierDOMException(value, engine); } Object v = values.get(value.toLowerCase().intern()); if (v == null) { throw createInvalidIdentifierDOMException(value, engine); } return (Value)v; }
/** * Sets a new value for the given variable * @return the old value or null */ public Object put( String key, Object value ) { int hash = key.hashCode() & 0x7FFFFFFF; int index = hash % table.length; for ( Entry e = table[ index ]; e != null; e = e.next ) { if ( ( e.hash == hash ) && e.key == key ) { Object old = e.value; e.value = value; return old; } } // The key is not in the hash table int len = table.length; if ( count++ >= ( len - ( len >> 2 ) ) ) { // more than 75% loaded: grow rehash(); index = hash % table.length; } Entry e = new Entry( hash, key, value, table[ index ] ); table[ index ] = e; return null; }
/** * Implements {@link ValueManager#createStringValue(short,String,CSSEngine)}. */ public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidIdentifierDOMException(value); } Object v = values.get(value.toLowerCase().intern()); if (v == null) { throw createInvalidIdentifierDOMException(value); } return (Value)v; }
/** * Implements {@link ValueManager#createStringValue(short,String,CSSEngine)}. */ public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidIdentifierDOMException(value); } Object v = values.get(value.toLowerCase().intern()); if (v == null) { throw createInvalidIdentifierDOMException(value); } return (Value)v; }
/** * Implements {@link ValueManager#createStringValue(short,String,CSSEngine)}. */ public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidIdentifierDOMException(value); } Object v = values.get(value.toLowerCase().intern()); if (v == null) { throw createInvalidIdentifierDOMException(value); } return (Value)v; }
/** * Implements {@link * ValueManager#createStringValue(short,String,CSSEngine)}. */ public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } Object v = values.get(value.toLowerCase().intern()); if (v == null) { throw createInvalidIdentifierDOMException(value); } return (Value)v; }
/** * Implements {@link * ValueManager#createStringValue(short,String,CSSEngine)}. */ public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } Object v = values.get(value.toLowerCase().intern()); if (v == null) { throw createInvalidIdentifierDOMException(value); } return (Value)v; }
/** * Implements {@link * ValueManager#createStringValue(short,String,CSSEngine)}. */ public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } Object v = values.get(value.toLowerCase().intern()); if (v == null) { throw createInvalidIdentifierDOMException(value); } return (Value)v; }
/** * Implements {@link * ValueManager#createStringValue(short,String,CSSEngine)}. */ public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } Object v = getIdentifiers().get(value.toLowerCase().intern()); if (v == null) { throw createInvalidIdentifierDOMException(value); } return (Value)v; }
/** * Implements {@link * ValueManager#createStringValue(short,String,CSSEngine)}. */ public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } Object v = getIdentifiers().get(value.toLowerCase().intern()); if (v == null) { throw createInvalidIdentifierDOMException(value); } return (Value)v; }
/** * Implements {@link * ValueManager#createStringValue(short,String,CSSEngine)}. */ public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } Object v = getIdentifiers().get(value.toLowerCase().intern()); if (v == null) { throw createInvalidIdentifierDOMException(value); } return (Value)v; }
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return CssValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_IDENT: String s = lu.getStringValue().toLowerCase().intern(); Object v = values.get(s); if (v == null) { throw createInvalidIdentifierDOMException(s, engine); } return (Value)v; } return super.createValue(lu, engine); }
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return CssValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_IDENT: String s = lu.getStringValue().toLowerCase().intern(); Object v = values.get(s); if (v == null) { throw createInvalidIdentifierDOMException(s, engine); } return (Value)v; } return super.createValue(lu, engine); }
/** * Implements {@link ValueManager#createValue(LexicalUnit,CSSEngine)}. */ public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return ValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_IDENT: String s = lu.getStringValue().toLowerCase().intern(); Object v = values.get(s); if (v == null) { throw createInvalidIdentifierDOMException(s); } return (Value)v; default: break; } return super.createValue(lu, engine); }
/** * Implements {@link * ValueManager#computeValue(CSSStylableElement,String,CSSEngine,int,StyleMap,Value)}. */ public Value computeValue(CSSStylableElement elt, String pseudo, CSSEngine engine, int idx, StyleMap sm, Value value) { if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) { String ident = value.getStringValue(); // Search for a direct computed value. Value v = (Value)computedValues.get(ident); if (v != null) { return v; } // Must be a system color... if (values.get(ident) == null) { throw new IllegalStateException("Not a system-color:" + ident ); } return engine.getCSSContext().getSystemColor(ident); } return super.computeValue(elt, pseudo, engine, idx, sm, value); }