/** * Returns an element for the specified type. This implementation assumes, that all elements have a public default * constructor and uses Class.newInstance() to create a new instance of that element. * * @param type * the type. * @return The element. */ public Element getElementForType( final String type ) { return new Element(); }
public ReportElement create() { final Element element = new Element(); element.setElementType( this ); return element; }
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; }
public void testSerialize() throws Exception { final Element e = new Element(); final Element e2 = serializeAndDeserialize( e ); assertNotNull( e2 ); // cannot assert equals, as this is not implemented ... }
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 void testGetId() { Element elem = new Element(); elem.setAttribute( AttributeNames.Xml.NAMESPACE, AttributeNames.Xml.ID, "id_0" ); assertEquals( "id_0", elem.getId() ); }
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; }
public void testCopyInto() { Element e1 = new Element(); e1.setElementType( LabelType.INSTANCE ); Element e2 = new Element(); e2.setElementType( NumberFieldType.INSTANCE ); e2.copyInto( e1 ); Assert.assertEquals( LabelType.INSTANCE, e1.getElementType() ); Assert.assertEquals( NumberFieldType.INSTANCE, e2.getElementType() ); }
public void testGetReportDefinition() { Element elem = new Element(); elem.setParent( null ); assertNull( elem.getReportDefinition() ); ReportDefinition defn = mock( ReportDefinition.class ); Section parent = mock( Section.class ); doReturn( defn ).when( parent ).getReportDefinition(); elem.setParent( parent ); assertNotNull( elem.getReportDefinition() ); assertEquals( defn, elem.getReportDefinition() ); }
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 testGetMasterReport() { Element elem = new Element(); elem.setParent( null ); assertNull( elem.getMasterReport() ); ReportDefinition defn = mock( ReportDefinition.class ); Section parent = mock( Section.class ); doReturn( defn ).when( parent ).getMasterReport(); elem.setParent( parent ); assertNotNull( elem.getMasterReport() ); assertEquals( defn, elem.getMasterReport() ); }
public void testIsVisible() { Element elem = new Element(); elem.getStyle().setBooleanStyleProperty( ElementStyleKeys.VISIBLE, true ); assertEquals( true, elem.isVisible() ); }
public void testSetDynamicContent() { Element elem = new Element(); elem.setDynamicContent( true ); assertEquals( true, elem.getStyle().getBooleanStyleProperty( ElementStyleKeys.DYNAMIC_HEIGHT ) ); }
public void testSetHRefTarget() { Element elem = new Element(); elem.setHRefTarget( "test_target" ); assertEquals( "test_target", elem.getStyle().getStyleProperty( ElementStyleKeys.HREF_TARGET ) ); }
public void testGetHRefTarget() { Element elem = new Element(); elem.getStyle().setStyleProperty( ElementStyleKeys.HREF_TARGET, "test_target" ); assertEquals( "test_target", elem.getHRefTarget() ); } }
public void testIsDynamicContent() { Element elem = new Element(); elem.getStyle().setBooleanStyleProperty( ElementStyleKeys.DYNAMIC_HEIGHT, true ); assertEquals( true, elem.isDynamicContent() ); }
public void testGetAttributeExpressions() { Expression expression = mock( Expression.class ); Element elem = new Element(); elem.setAttributeExpression( "namespace", "test_name", expression ); assertNotNull( elem.getAttributeExpressions() ); assertEquals( expression, elem.getAttributeExpressions().getAttribute( "namespace", "test_name" ) ); }
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" ) ); }
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 void testElementCreate() { final Element e = new Element(); assertNotNull( e.getDataSource() ); assertNotNull( e.getStyle() ); assertNotNull( e.getName() ); assertTrue( e.isVisible() ); assertNull( e.getParent() ); }