@Test public void testCreateElement() { Element elem = barcodeElemFactory.createElement(); assertThat( elem, is( notNullValue() ) ); assertThat( elem.getName(), is( equalTo( StringUtils.EMPTY ) ) ); assertThat( elem.getElementType(), is( instanceOf( SimpleBarcodesType.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.getAttribute( NAMESPACE, SimpleBarcodesAttributeNames.TYPE_ATTRIBUTE ), is( nullValue() ) ); assertThat( (Boolean) elem.getAttribute( NAMESPACE, SimpleBarcodesAttributeNames.CHECKSUM_ATTRIBUTE ), is( equalTo( false ) ) ); assertThat( elem.getAttribute( NAMESPACE, SimpleBarcodesAttributeNames.BAR_WIDTH_ATTRIBUTE ), is( nullValue() ) ); assertThat( elem.getAttribute( NAMESPACE, SimpleBarcodesAttributeNames.BAR_HEIGHT_ATTRIBUTE ), is( nullValue() ) ); assertThat( (Boolean) elem.getAttribute( NAMESPACE, SimpleBarcodesAttributeNames.SHOW_TEXT_ATTRIBUTE ), is( equalTo( true ) ) ); assertThat( elem.getAttributeExpression( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE ), is( nullValue() ) ); barcodeElemFactory.setName( "elem_name" ); barcodeElemFactory.setContent( "elem_content" ); barcodeElemFactory.setFieldname( "field_name" ); barcodeElemFactory.setFormula( "test_formula" ); barcodeElemFactory.setType( "elem_type" ); barcodeElemFactory.setChecksum( true ); barcodeElemFactory.setBarWidth( 200 ); barcodeElemFactory.setBarHeight( 500 ); barcodeElemFactory.setShowText( false ); elem = barcodeElemFactory.createElement(); assertThat( elem, is( notNullValue() ) ); assertThat( elem.getName(), is( equalTo( barcodeElemFactory.getName() ) ) ); assertThat( elem.getElementType(), is( instanceOf( SimpleBarcodesType.class ) ) ); assertThat( elem.getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE ), is( equalTo( barcodeElemFactory.getContent() ) ) ); assertThat( (String) elem.getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD ), is( equalTo( barcodeElemFactory.getFieldname() ) ) ); assertThat( (String) elem.getAttribute( NAMESPACE, SimpleBarcodesAttributeNames.TYPE_ATTRIBUTE ), is( equalTo( barcodeElemFactory.getType() ) ) ); assertThat( (Boolean) elem.getAttribute( NAMESPACE, SimpleBarcodesAttributeNames.CHECKSUM_ATTRIBUTE ), is( equalTo( true ) ) ); assertThat( (Integer) elem.getAttribute( NAMESPACE, SimpleBarcodesAttributeNames.BAR_WIDTH_ATTRIBUTE ), is( equalTo( barcodeElemFactory.getBarWidth() ) ) ); assertThat( (Integer) elem.getAttribute( NAMESPACE, SimpleBarcodesAttributeNames.BAR_HEIGHT_ATTRIBUTE ), is( equalTo( barcodeElemFactory.getBarHeight() ) ) ); assertThat( (Boolean) elem.getAttribute( NAMESPACE, SimpleBarcodesAttributeNames.SHOW_TEXT_ATTRIBUTE ), is( equalTo( false ) ) ); 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( barcodeElemFactory.getFormula() ) ) ); }
public Element createElement() { final Element element = new Element(); applyElementName( element ); applyStyle( element.getStyle() ); element.setElementType( new SimpleBarcodesType() ); 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 ( getType() != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.TYPE_ATTRIBUTE, getType() ); } if ( getChecksum() != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.CHECKSUM_ATTRIBUTE, getChecksum() ); } if ( barWidth != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.BAR_WIDTH_ATTRIBUTE, barWidth ); } if ( barHeight != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.BAR_HEIGHT_ATTRIBUTE, barHeight ); } if ( showText != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.SHOW_TEXT_ATTRIBUTE, showText ); } return element; }
BarcodeElementFactory extends AbstractContentElementFactory { public Element createElement() { final Element element = new Element(); applyElementName( element ); applyStyle( element.getStyle() ); element.setElementType( new SimpleBarcodesType() ); 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 ( getType() != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.TYPE_ATTRIBUTE, getType() ); } if ( getChecksum() != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.CHECKSUM_ATTRIBUTE, getChecksum() ); } if ( barWidth != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.BAR_WIDTH_ATTRIBUTE, barWidth ); } if ( barHeight != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.BAR_HEIGHT_ATTRIBUTE, barHeight ); } if ( showText != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.SHOW_TEXT_ATTRIBUTE, showText ); } return element; } }
BarcodeElementFactory extends AbstractContentElementFactory { public Element createElement() { final Element element = new Element(); applyElementName( element ); applyStyle( element.getStyle() ); element.setElementType( new SimpleBarcodesType() ); 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 ( getType() != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.TYPE_ATTRIBUTE, getType() ); } if ( getChecksum() != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.CHECKSUM_ATTRIBUTE, getChecksum() ); } if ( barWidth != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.BAR_WIDTH_ATTRIBUTE, barWidth ); } if ( barHeight != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.BAR_HEIGHT_ATTRIBUTE, barHeight ); } if ( showText != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.SHOW_TEXT_ATTRIBUTE, showText ); } return element; } BarcodeElementFactory(); }
BarcodeElementFactory extends AbstractContentElementFactory { public Element createElement() { final Element element = new Element(); applyElementName( element ); applyStyle( element.getStyle() ); element.setElementType( new SimpleBarcodesType() ); 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 ( getType() != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.TYPE_ATTRIBUTE, getType() ); } if ( getChecksum() != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.CHECKSUM_ATTRIBUTE, getChecksum() ); } if ( barWidth != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.BAR_WIDTH_ATTRIBUTE, barWidth ); } if ( barHeight != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.BAR_HEIGHT_ATTRIBUTE, barHeight ); } if ( showText != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.SHOW_TEXT_ATTRIBUTE, showText ); } return element; } BarcodeElementFactory(); String getFormula(); void setFormula( String formula ); Object getContent(); void setContent( Object content ); String getFieldname(); void setFieldname( String fieldname ); Object getNullValue(); void setNullValue( Object nullValue ); String getType(); void setType( String type ); Integer getBarHeight(); void setBarHeight( Integer barHeight ); Integer getBarWidth(); void setBarWidth( Integer barWidth ); Boolean getChecksum(); void setChecksum( Boolean checksum ); Boolean getShowText(); void setShowText( Boolean showText ); String getFontName(); void setFontName( String fontName ); Integer getFontSize(); void setFontSize( Integer fontSize ); Boolean getBold(); void setBold( Boolean bold ); Boolean getItalic(); void setItalic( Boolean italic ); Element createElement(); }
BarcodeElementFactory extends AbstractContentElementFactory { public Element createElement() { final Element element = new Element(); applyElementName( element ); applyStyle( element.getStyle() ); element.setElementType( new SimpleBarcodesType() ); 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 ( getType() != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.TYPE_ATTRIBUTE, getType() ); } if ( getChecksum() != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.CHECKSUM_ATTRIBUTE, getChecksum() ); } if ( barWidth != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.BAR_WIDTH_ATTRIBUTE, barWidth ); } if ( barHeight != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.BAR_HEIGHT_ATTRIBUTE, barHeight ); } if ( showText != null ) { element.setAttribute( SimpleBarcodesAttributeNames.NAMESPACE, SimpleBarcodesAttributeNames.SHOW_TEXT_ATTRIBUTE, showText ); } return element; } BarcodeElementFactory(); String getFormula(); void setFormula( String formula ); Object getContent(); void setContent( Object content ); String getFieldname(); void setFieldname( String fieldname ); Object getNullValue(); void setNullValue( Object nullValue ); String getType(); void setType( String type ); Integer getBarHeight(); void setBarHeight( Integer barHeight ); Integer getBarWidth(); void setBarWidth( Integer barWidth ); Boolean getChecksum(); void setChecksum( Boolean checksum ); Boolean getShowText(); void setShowText( Boolean showText ); String getFontName(); void setFontName( String fontName ); Integer getFontSize(); void setFontSize( Integer fontSize ); Boolean getBold(); void setBold( Boolean bold ); Boolean getItalic(); void setItalic( Boolean italic ); Element createElement();  }