@Test public void testCreateElement() { Element elem = elemFactory.createElement(); assertThat( elem, is( notNullValue() ) ); assertThat( elem.getName(), is( equalTo( StringUtils.EMPTY ) ) ); assertThat( elem.getElementType(), is( instanceOf( PieSparklineType.class ) ) ); assertThat( elem.getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE ), is( nullValue() ) ); assertThat( elem.getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD ), is( nullValue() ) ); assertThat( elem.getAttributeExpression( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE ), is( nullValue() ) ); assertThat( elem.getAttribute( NAMESPACE, SparklineAttributeNames.START_ANGLE ), is( nullValue() ) ); assertThat( elem.getAttribute( NAMESPACE, SparklineAttributeNames.LOW_SLICE ), is( nullValue() ) ); assertThat( elem.getAttribute( NAMESPACE, SparklineAttributeNames.MEDIUM_SLICE ), is( nullValue() ) ); assertThat( elem.getAttribute( NAMESPACE, SparklineAttributeNames.HIGH_SLICE ), is( nullValue() ) ); assertThat( elem.getAttribute( NAMESPACE, SparklineAttributeNames.COUNTER_CLOCKWISE ), is( nullValue() ) ); elemFactory.setName( "elem_name" ); elemFactory.setContent( "elem_content" ); elemFactory.setFieldname( "field_name" ); elemFactory.setFormula( "test_formula" ); elemFactory.setStartAngle( 100 ); elemFactory.setLowSlice( 5.5 ); elemFactory.setMediumSlice( 10.5 ); elemFactory.setHighSlice( 20.5 ); elemFactory.setCounterClockwise( true ); elem = elemFactory.createElement(); assertThat( elem, is( notNullValue() ) ); assertThat( elem.getName(), is( equalTo( elemFactory.getName() ) ) ); assertThat( elem.getElementType(), is( instanceOf( PieSparklineType.class ) ) ); assertThat( elem.getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE ), is( equalTo( elemFactory .getContent() ) ) ); assertThat( (String) elem.getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD ), is( equalTo( elemFactory.getFieldname() ) ) ); assertThat( (Integer) elem.getAttribute( NAMESPACE, SparklineAttributeNames.START_ANGLE ), is( equalTo( elemFactory .getStartAngle() ) ) ); assertThat( (Double) elem.getAttribute( NAMESPACE, SparklineAttributeNames.LOW_SLICE ), is( equalTo( elemFactory .getLowSlice() ) ) ); assertThat( (Double) elem.getAttribute( NAMESPACE, SparklineAttributeNames.MEDIUM_SLICE ), is( equalTo( elemFactory .getMediumSlice() ) ) ); assertThat( (Double) elem.getAttribute( NAMESPACE, SparklineAttributeNames.HIGH_SLICE ), is( equalTo( elemFactory .getHighSlice() ) ) ); assertThat( (Boolean) elem.getAttribute( NAMESPACE, SparklineAttributeNames.COUNTER_CLOCKWISE ), is( equalTo( elemFactory.getCounterClockwise() ) ) ); Object expressionObj = elem.getAttributeExpression( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE ); assertThat( expressionObj, is( notNullValue() ) ); assertThat( expressionObj, is( instanceOf( FormulaExpression.class ) ) ); assertThat( ( (FormulaExpression) expressionObj ).getFormula(), is( equalTo( elemFactory.getFormula() ) ) ); }
public Element createElement() { final Element element = new Element(); applyElementName( element ); applyStyle( element.getStyle() ); element.setElementType( new PieSparklineType() ); if ( getContent() != null ) { element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, getContent() ); } if ( getFieldname() != null ) { element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD, getFieldname() ); } if ( getFormula() != null ) { final FormulaExpression formulaExpression = new FormulaExpression(); formulaExpression.setFormula( getFormula() ); element.setAttributeExpression( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, formulaExpression ); } if ( startAngle != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.START_ANGLE, startAngle ); } if ( lowSlice != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.LOW_SLICE, lowSlice ); } if ( mediumSlice != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.MEDIUM_SLICE, mediumSlice ); } if ( highSlice != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.HIGH_SLICE, highSlice ); } if ( counterClockwise != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.COUNTER_CLOCKWISE, counterClockwise ); } return element; }
PieSparklineElementFactory extends AbstractContentElementFactory { public Element createElement() { final Element element = new Element(); applyElementName( element ); applyStyle( element.getStyle() ); element.setElementType( new PieSparklineType() ); if ( getContent() != null ) { element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, getContent() ); } if ( getFieldname() != null ) { element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD, getFieldname() ); } if ( getFormula() != null ) { final FormulaExpression formulaExpression = new FormulaExpression(); formulaExpression.setFormula( getFormula() ); element.setAttributeExpression( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, formulaExpression ); } if ( startAngle != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.START_ANGLE, startAngle ); } if ( lowSlice != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.LOW_SLICE, lowSlice ); } if ( mediumSlice != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.MEDIUM_SLICE, mediumSlice ); } if ( highSlice != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.HIGH_SLICE, highSlice ); } if ( counterClockwise != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.COUNTER_CLOCKWISE, counterClockwise ); } return element; } }
PieSparklineElementFactory extends AbstractContentElementFactory { public Element createElement() { final Element element = new Element(); applyElementName( element ); applyStyle( element.getStyle() ); element.setElementType( new PieSparklineType() ); if ( getContent() != null ) { element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, getContent() ); } if ( getFieldname() != null ) { element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD, getFieldname() ); } if ( getFormula() != null ) { final FormulaExpression formulaExpression = new FormulaExpression(); formulaExpression.setFormula( getFormula() ); element.setAttributeExpression( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, formulaExpression ); } if ( startAngle != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.START_ANGLE, startAngle ); } if ( lowSlice != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.LOW_SLICE, lowSlice ); } if ( mediumSlice != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.MEDIUM_SLICE, mediumSlice ); } if ( highSlice != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.HIGH_SLICE, highSlice ); } if ( counterClockwise != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.COUNTER_CLOCKWISE, counterClockwise ); } return element; } PieSparklineElementFactory(); }
PieSparklineElementFactory extends AbstractContentElementFactory { public Element createElement() { final Element element = new Element(); applyElementName( element ); applyStyle( element.getStyle() ); element.setElementType( new PieSparklineType() ); if ( getContent() != null ) { element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, getContent() ); } if ( getFieldname() != null ) { element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD, getFieldname() ); } if ( getFormula() != null ) { final FormulaExpression formulaExpression = new FormulaExpression(); formulaExpression.setFormula( getFormula() ); element.setAttributeExpression( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, formulaExpression ); } if ( startAngle != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.START_ANGLE, startAngle ); } if ( lowSlice != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.LOW_SLICE, lowSlice ); } if ( mediumSlice != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.MEDIUM_SLICE, mediumSlice ); } if ( highSlice != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.HIGH_SLICE, highSlice ); } if ( counterClockwise != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.COUNTER_CLOCKWISE, counterClockwise ); } return element; } PieSparklineElementFactory(); Object getContent(); void setContent( final Object content ); Object getNullValue(); void setNullValue( final Object nullValue ); String getFormula(); void setFormula( final String formula ); Color getHighColor(); void setHighColor( final Color highColor ); Color getLowColor(); void setLowColor( final Color lowColor ); Color getMediumColor(); void setMediumColor( Color mediumColor ); Integer getStartAngle(); void setStartAngle( final Integer startAngle ); Double getHighSlice(); void setHighSlice( Double highSlice ); Double getMediumSlice(); void setMediumSlice( Double mediumSlice ); Double getLowSlice(); void setLowSlice( Double lowSlice ); Boolean getCounterClockwise(); void setCounterClockwise( Boolean counterClockwise ); String getFieldname(); void setFieldname( final String fieldname ); Element createElement(); }
PieSparklineElementFactory extends AbstractContentElementFactory { public Element createElement() { final Element element = new Element(); applyElementName( element ); applyStyle( element.getStyle() ); element.setElementType( new PieSparklineType() ); if ( getContent() != null ) { element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, getContent() ); } if ( getFieldname() != null ) { element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD, getFieldname() ); } if ( getFormula() != null ) { final FormulaExpression formulaExpression = new FormulaExpression(); formulaExpression.setFormula( getFormula() ); element.setAttributeExpression( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, formulaExpression ); } if ( startAngle != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.START_ANGLE, startAngle ); } if ( lowSlice != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.LOW_SLICE, lowSlice ); } if ( mediumSlice != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.MEDIUM_SLICE, mediumSlice ); } if ( highSlice != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.HIGH_SLICE, highSlice ); } if ( counterClockwise != null ) { element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.COUNTER_CLOCKWISE, counterClockwise ); } return element; } PieSparklineElementFactory(); Object getContent(); void setContent( final Object content ); Object getNullValue(); void setNullValue( final Object nullValue ); String getFormula(); void setFormula( final String formula ); Color getHighColor(); void setHighColor( final Color highColor ); Color getLowColor(); void setLowColor( final Color lowColor ); Color getMediumColor(); void setMediumColor( Color mediumColor ); Integer getStartAngle(); void setStartAngle( final Integer startAngle ); Double getHighSlice(); void setHighSlice( Double highSlice ); Double getMediumSlice(); void setMediumSlice( Double mediumSlice ); Double getLowSlice(); void setLowSlice( Double lowSlice ); Boolean getCounterClockwise(); void setCounterClockwise( Boolean counterClockwise ); String getFieldname(); void setFieldname( final String fieldname ); Element createElement();  }