@Test public void testGetData() { Number[] result = expression.getData(); assertThat( result, is( equalTo( new Number[] {} ) ) ); expression.setField( new String[] { RAW_PARAM } ); doReturn( 1.0 ).when( dataRow ).get( RAW_PARAM ); result = expression.getData(); assertThat( result, is( equalTo( new Number[] { 1.0 } ) ) ); expression.setRawDataField( RAW_PARAM ); doReturn( 1.0 ).when( dataRow ).get( RAW_PARAM ); result = expression.getData(); assertThat( result, is( equalTo( new Number[] { 1.0 } ) ) ); }
protected Number[] getData() { if ( rawDataField != null ) { final Object o = getDataRow().get( rawDataField ); final Number[] retval = ElementTypeUtils.getData( o ); if ( retval != null ) { return retval; } } final ArrayList numbers = new ArrayList(); final Object[] values = getFieldValues(); for ( int i = 0; i < values.length; i++ ) { final Object value = values[i]; if ( value instanceof Number ) { final Number n = (Number) value; numbers.add( n ); } } return (Number[]) numbers.toArray( new Number[numbers.size()] ); }
SparklineExpression extends ColumnAggregationExpression { protected Number[] getData() { if ( rawDataField != null ) { final Object o = getDataRow().get( rawDataField ); final Number[] retval = ElementTypeUtils.getData( o ); if ( retval != null ) { return retval; } } final ArrayList numbers = new ArrayList(); final Object[] values = getFieldValues(); for ( int i = 0; i < values.length; i++ ) { final Object value = values[i]; if ( value instanceof Number ) { final Number n = (Number) value; numbers.add( n ); } } return (Number[]) numbers.toArray( new Number[numbers.size()] ); } }
SparklineExpression extends ColumnAggregationExpression { protected Number[] getData() { if ( rawDataField != null ) { final Object o = getDataRow().get( rawDataField ); final Number[] retval = ElementTypeUtils.getData( o ); if ( retval != null ) { return retval; } } final ArrayList numbers = new ArrayList(); final Object[] values = getFieldValues(); for ( int i = 0; i < values.length; i++ ) { final Object value = values[i]; if ( value instanceof Number ) { final Number n = (Number) value; numbers.add( n ); } } return (Number[]) numbers.toArray( new Number[numbers.size()] ); } SparklineExpression(); }
SparklineExpression extends ColumnAggregationExpression { protected Number[] getData() { if ( rawDataField != null ) { final Object o = getDataRow().get( rawDataField ); final Number[] retval = ElementTypeUtils.getData( o ); if ( retval != null ) { return retval; } } final ArrayList numbers = new ArrayList(); final Object[] values = getFieldValues(); for ( int i = 0; i < values.length; i++ ) { final Object value = values[i]; if ( value instanceof Number ) { final Number n = (Number) value; numbers.add( n ); } } return (Number[]) numbers.toArray( new Number[numbers.size()] ); } SparklineExpression(); String getType(); void setType( final String type ); String getRawDataField(); void setRawDataField( final String rawDataField ); Color getColor(); void setColor( final Color color ); Color getBackgroundColor(); void setBackgroundColor( final Color backgroundColor ); Color getHighColor(); void setHighColor( final Color highColor ); Color getLastColor(); void setLastColor( final Color lastColor ); Color getMediumColor(); void setMediumColor( Color mediumColor ); Color getLowColor(); void setLowColor( Color lowColor ); Double getHighSlice(); void setHighSlice( Double highSlice ); Double getMediumSlice(); void setMediumSlice( Double mediumSlice ); Double getLowSlice(); void setLowSlice( Double lowSlice ); boolean isCounterClockWise(); void setCounterClockWise( boolean counterClockWise ); int getStartAngle(); void setStartAngle( int startAngle ); int getSpacing(); void setSpacing( final int spacing ); Object getValue(); }
SparklineExpression extends ColumnAggregationExpression { protected Number[] getData() { if ( rawDataField != null ) { final Object o = getDataRow().get( rawDataField ); final Number[] retval = ElementTypeUtils.getData( o ); if ( retval != null ) { return retval; } } final ArrayList numbers = new ArrayList(); final Object[] values = getFieldValues(); for ( int i = 0; i < values.length; i++ ) { final Object value = values[i]; if ( value instanceof Number ) { final Number n = (Number) value; numbers.add( n ); } } return (Number[]) numbers.toArray( new Number[numbers.size()] ); } SparklineExpression(); String getType(); void setType( final String type ); String getRawDataField(); void setRawDataField( final String rawDataField ); Color getColor(); void setColor( final Color color ); Color getBackgroundColor(); void setBackgroundColor( final Color backgroundColor ); Color getHighColor(); void setHighColor( final Color highColor ); Color getLastColor(); void setLastColor( final Color lastColor ); Color getMediumColor(); void setMediumColor( Color mediumColor ); Color getLowColor(); void setLowColor( Color lowColor ); Double getHighSlice(); void setHighSlice( Double highSlice ); Double getMediumSlice(); void setMediumSlice( Double mediumSlice ); Double getLowSlice(); void setLowSlice( Double lowSlice ); boolean isCounterClockWise(); void setCounterClockWise( boolean counterClockWise ); int getStartAngle(); void setStartAngle( int startAngle ); int getSpacing(); void setSpacing( final int spacing ); Object getValue(); static final Color DEFAULT_COLOR; static final Color DEFAULT_HIGH_COLOR; static final Color DEFAULT_MEDIUM_COLOR; static final Color DEFAULT_LOW_COLOR; static final Color DEFAULT_LAST_COLOR; }