imageElement.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.IMAGE_ENCODING_QUALITY, "9" ); imageElement.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.IMAGE_ENCODING_TYPE, "PNG" );
/** * Defines the name for this Element. The name must not be empty, or a NullPointerException is thrown. * <p/> * Names can be used to lookup an element within a band. There is no requirement for element names to be unique. * * @param name * the name of this element */ public void setName( final String name ) { setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.NAME, name ); }
/** * Defines the Xml-ID of this element. This ID is unique within the report-definition, but is not a internal * object-instance ID but a user-defined string. * * @param id * the element id. */ public void setId( final String id ) { setAttribute( AttributeNames.Xml.NAMESPACE, AttributeNames.Xml.ID, id ); }
public void setAttribute( final String namespace, final String name, final Object value ) { setAttribute( namespace, name, value, true ); }
public void setComputedStyle( final SimpleStyleSheet computedStyle ) { if ( computedStyle == null ) { throw new IllegalArgumentException(); } setAttribute( AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.COMPUTED_STYLE, computedStyle, false ); }
public void setElementType( final ElementType elementType ) { if ( elementType == null ) { throw new NullPointerException( "Element.setElementType(..): ElementType cannot be null" ); } setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.ELEMENT_TYPE, elementType, true ); }
public static Element generateFooterElement( final Class aggregationType, final ElementType targetType, final String group, final String fieldName ) { if ( aggregationType == null ) { final Element footerValueElement = new Element(); footerValueElement.setElementType( new LabelType() ); footerValueElement.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, "" ); footerValueElement.setAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ALLOW_METADATA_STYLING, Boolean.TRUE ); footerValueElement.setAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ALLOW_METADATA_ATTRIBUTES, Boolean.FALSE ); return footerValueElement; } final Element element = generateDetailsElement( fieldName, targetType ); element.setAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.AGGREGATION_TYPE, aggregationType ); element.setAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.AGGREGATION_GROUP, group ); return element; }
public static Element generateDetailsElement( final String fieldName, final ElementType targetType ) { final Element detailsElement = new Element(); detailsElement.getStyle().setStyleProperty( ElementStyleKeys.DYNAMIC_HEIGHT, Boolean.TRUE ); detailsElement.setElementType( targetType ); detailsElement.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD, fieldName ); detailsElement.setAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ALLOW_METADATA_STYLING, Boolean.TRUE ); detailsElement.setAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ALLOW_METADATA_ATTRIBUTES, Boolean.TRUE ); return detailsElement; }
public static Element generateHeaderElement( final String fieldName ) { final Element headerElement = new Element(); headerElement.getStyle().setStyleProperty( ElementStyleKeys.DYNAMIC_HEIGHT, Boolean.TRUE ); headerElement.setElementType( new LabelType() ); headerElement.setAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.LABEL_FOR, fieldName ); headerElement.setAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ALLOW_METADATA_STYLING, Boolean.TRUE ); headerElement.setAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ALLOW_METADATA_ATTRIBUTES, Boolean.TRUE ); return headerElement; }
private Element createLiNumElement( final String _liNum ) { final Element linum = new Element(); linum.setName( "point" ); linum.setElementType( LabelType.INSTANCE ); linum.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, _liNum ); return linum; }
/** * Creates a new drawable field element based on the defined properties. * * @return the generated elements * @throws IllegalStateException * if the field name is not set. * @see ElementFactory#createElement() */ public Element createElement() { final Element element = new Element(); applyElementName( element ); applyStyle( element.getStyle() ); element.setElementType( new RectangleType() ); element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.ARC_WIDTH, arcWidth ); element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.ARC_HEIGHT, arcHeight ); return element; }
/** * Creates the resource field element based on the set properties. * * @return the generated element. * @see org.pentaho.reporting.engine.classic.core.elementfactory.ElementFactory#createElement() */ public Element createElement() { final Element element = super.createElement(); element.setElementType( new ResourceFieldType() ); element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.RESOURCE_IDENTIFIER, getResourceBase() ); return element; }
/** * Creates the label element. * * @return the generated label. * @throws IllegalStateException * if the text is not defined. * @see org.pentaho.reporting.engine.classic.core.elementfactory.ElementFactory#createElement() */ public Element createElement() { final Element element = new Element(); element.setElementType( new LabelType() ); applyElementName( element ); applyStyle( element.getStyle() ); element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, getText() ); element.setAttribute( AttributeNames.Excel.NAMESPACE, AttributeNames.Excel.FIELD_FORMULA, getExcelFormula() ); return element; }
public void testGetFirstAttribute() { Element elem = new Element(); elem.setAttribute( "namespace_0", "test_name", "test_value_0" ); elem.setAttribute( "namespace_1", "test_name", "test_value_1" ); assertNotNull( elem.getFirstAttribute( "test_name" ) ); assertEquals( "test_value_0", elem.getFirstAttribute( "test_name" ) ); }
public void testGetId() { Element elem = new Element(); elem.setAttribute( AttributeNames.Xml.NAMESPACE, AttributeNames.Xml.ID, "id_0" ); assertEquals( "id_0", elem.getId() ); }
public void testElementAttributeCopyOnWrite2() { final Element e = new Element(); final Element clone = e.clone(); clone.setAttribute( "namespace", "name", "value" ); assertNull( e.getAttribute( "namespace", "name" ) ); }
public void testElementAttributeCopyOnWrite() { final Element e = new Element(); final Element clone = e.clone(); e.setAttribute( "namespace", "name", "value" ); assertNull( clone.getAttribute( "namespace", "name" ) ); }
private Element createLabel( final String text, float width ) { final Element element = new Element(); element.setElementType( LabelType.INSTANCE ); element.getElementType().configureDesignTimeDefaults( element, Locale.getDefault() ); element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, text ); element.getStyle().setStyleProperty( ElementStyleKeys.MIN_WIDTH, width ); element.getStyle().setStyleProperty( ElementStyleKeys.MIN_HEIGHT, 20f ); return element; } }
public static Element createDataItem( final String text, final float width, final float height ) { final Element label = new Element(); label.setElementType( LabelType.INSTANCE ); label.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, text ); label.getStyle().setStyleProperty( ElementStyleKeys.MIN_WIDTH, width ); label.getStyle().setStyleProperty( ElementStyleKeys.MIN_HEIGHT, height ); return label; }
@Test public void testCSSConversionDefault() { final Element element = new Element(); final Element elementlist = new Element(); elementlist.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, RICHTEXT ); elementlist.setElementType( new LabelType() ); final SimpleStyleResolver styleResolver = new SimpleStyleResolver( true ); final ResolverStyleSheet resolverTarget = new ResolverStyleSheet(); styleResolver.resolve( element, resolverTarget ); RichTextHtmlStyleBuilderFactory richTextBuilder = new RichTextHtmlStyleBuilderFactory(); String codeCss = richTextBuilder.produceTextStyle( null, new SimpleStyleSheet( resolverTarget ) ).toString(); String expected = "color: black; font-size: 10pt; font-family: serif; font-weight: normal; font-style: normal; " + "text-decoration: none; text-align: left; word-spacing: 0pt; letter-spacing: 0pt; white-space: pre"; assertEquals( expected, codeCss ); }