@Test public void getStyleProperty_OnIntactSheet() { List<StyleKey> keys = StyleKey.getDefinedStyleKeysList(); ElementStyleSheet sheet = new ElementStyleSheet(); final Float val = 123f; Object property = sheet.getStyleProperty( keys.get( 0 ), val ); assertEquals( "When nothing has been changed, default value should be returned", val, property ); }
public Object getStyleProperty( final StyleKey key, final Object defaultValue ) { final int identifier = key.identifier; if ( properties != null ) { if ( properties.length <= identifier ) { throw new IllegalStateException(); } final byte source = getFlag( identifier ); if ( source != SOURCE_UNDEFINED ) { final Object value = properties[ identifier ]; if ( value == null ) { return defaultValue; } return value; } } putInCache( key, null, SOURCE_FROM_PARENT ); return defaultValue; }
ElementStyleSheet extends AbstractStyleSheet implements Serializable, Cloneable { public Object getStyleProperty( final StyleKey key, final Object defaultValue ) { final int identifier = key.identifier; if ( properties != null ) { if ( properties.length <= identifier ) { throw new IllegalStateException(); } final byte source = getFlag( identifier ); if ( source != SOURCE_UNDEFINED ) { final Object value = properties[ identifier ]; if ( value == null ) { return defaultValue; } return value; } } putInCache( key, null, SOURCE_FROM_PARENT ); return defaultValue; } }
ElementStyleSheet extends AbstractStyleSheet implements Serializable, Cloneable { public Object getStyleProperty( final StyleKey key, final Object defaultValue ) { final int identifier = key.identifier; if ( properties != null ) { if ( properties.length <= identifier ) { throw new IllegalStateException(); } final byte source = getFlag( identifier ); if ( source != SOURCE_UNDEFINED ) { final Object value = properties[ identifier ]; if ( value == null ) { return defaultValue; } return value; } } putInCache( key, null, SOURCE_FROM_PARENT ); return defaultValue; } ElementStyleSheet(); }
ElementStyleSheet extends AbstractStyleSheet implements Serializable, Cloneable { public Object getStyleProperty( final StyleKey key, final Object defaultValue ) { final int identifier = key.identifier; if ( properties != null ) { if ( properties.length <= identifier ) { throw new IllegalStateException(); } final byte source = getFlag( identifier ); if ( source != SOURCE_UNDEFINED ) { final Object value = properties[ identifier ]; if ( value == null ) { return defaultValue; } return value; } } putInCache( key, null, SOURCE_FROM_PARENT ); return defaultValue; } ElementStyleSheet(); long getChangeTracker(); boolean isLocalKey( final StyleKey key ); final Object[] toArray(); Object getStyleProperty( final StyleKey key, final Object defaultValue ); void setBooleanStyleProperty( final StyleKey key, final boolean value ); void setStyleProperty( final StyleKey key, final Object value ); ElementStyleSheet clone(); ElementStyleSheet derive( final boolean preserveId ); StyleKey[] getDefinedPropertyNamesArray(); void addListener( final StyleChangeListener l ); void removeListener( final StyleChangeListener l ); StyleKey[] getPropertyKeys(); List<StyleKey> getPropertyKeyList(); void addAll( final ElementStyleSheet sourceStyleSheet ); void addInherited( final ElementStyleSheet sourceStyleSheet ); void addInherited( final SimpleStyleSheet sourceStyleSheet ); void addDefault( final ElementStyleSheet sourceStyleSheet ); void clear(); long getModificationCount(); long getChangeTrackerHash(); void copyFrom( final ElementStyleSheet style ); }
ElementStyleSheet extends AbstractStyleSheet implements Serializable, Cloneable { public Object getStyleProperty( final StyleKey key, final Object defaultValue ) { final int identifier = key.identifier; if ( properties != null ) { if ( properties.length <= identifier ) { throw new IllegalStateException(); } final byte source = getFlag( identifier ); if ( source != SOURCE_UNDEFINED ) { final Object value = properties[ identifier ]; if ( value == null ) { return defaultValue; } return value; } } putInCache( key, null, SOURCE_FROM_PARENT ); return defaultValue; } ElementStyleSheet(); long getChangeTracker(); boolean isLocalKey( final StyleKey key ); final Object[] toArray(); Object getStyleProperty( final StyleKey key, final Object defaultValue ); void setBooleanStyleProperty( final StyleKey key, final boolean value ); void setStyleProperty( final StyleKey key, final Object value ); ElementStyleSheet clone(); ElementStyleSheet derive( final boolean preserveId ); StyleKey[] getDefinedPropertyNamesArray(); void addListener( final StyleChangeListener l ); void removeListener( final StyleChangeListener l ); StyleKey[] getPropertyKeys(); List<StyleKey> getPropertyKeyList(); void addAll( final ElementStyleSheet sourceStyleSheet ); void addInherited( final ElementStyleSheet sourceStyleSheet ); void addInherited( final SimpleStyleSheet sourceStyleSheet ); void addDefault( final ElementStyleSheet sourceStyleSheet ); void clear(); long getModificationCount(); long getChangeTrackerHash(); void copyFrom( final ElementStyleSheet style );  }