private boolean isInlineElement( final Element element ) { if ( element instanceof Band ) { if ( "inline".equals( element.getStyle().getStyleProperty( BandStyleKeys.LAYOUT, "inline" ) ) ) { return true; } return false; } return true; }
/** * Defines whether this Element should be painted. The detailed implementation is up to the outputtarget. * * @return the current visiblity state. */ public boolean isVisible() { return getStyle().getBooleanStyleProperty( ElementStyleKeys.VISIBLE, true ); }
/** * Checks whether the layout of this element is dynamic and adjusts to the element's printable content. If set to * false, the element's minimum-size will be also used as maximum size. * * @return true, if the Element's layout is dynamic, false otherwise. */ public boolean isDynamicContent() { return getStyle().getBooleanStyleProperty( ElementStyleKeys.DYNAMIC_HEIGHT ); }
/** * Returns the currently set link target for this element. * * @return the link target. */ public String getHRefTarget() { return (String) getStyle().getStyleProperty( ElementStyleKeys.HREF_TARGET ); }
/** * Defines the stylesheet property for the dynamic attribute. Calling this function with either parameter will * override any previously defined value for the dynamic attribute. The value can no longer be inherited from parent * stylesheets. * * @param dynamicContent * the new state of the dynamic flag. */ public void setDynamicContent( final boolean dynamicContent ) { getStyle().setBooleanStyleProperty( ElementStyleKeys.DYNAMIC_HEIGHT, dynamicContent ); }
/** * Redefines the link target for this element. * * @param target * the target */ public void setHRefTarget( final String target ) { getStyle().setStyleProperty( ElementStyleKeys.HREF_TARGET, target ); }
/** * Defines, whether this Element should be visible in the output. The interpretation of this flag is up to the content * processor. * * @param b * the new visibility state */ public void setVisible( final boolean b ) { if ( b ) { getStyle().setStyleProperty( ElementStyleKeys.VISIBLE, Boolean.TRUE ); } else { getStyle().setStyleProperty( ElementStyleKeys.VISIBLE, Boolean.FALSE ); } }
public static Element createHorizontalLine( final float y, final Color color, final Stroke stroke ) { final Element element = createHorizontalLine( y ); element.getStyle().setStyleProperty( ElementStyleKeys.PAINT, color ); element.getStyle().setStyleProperty( ElementStyleKeys.STROKE, stroke ); return element; }
protected void handleInheritedStyle( final String styleClass ) { if ( styleClass != null ) { final HashMap<String, ElementStyleSheet> report = (HashMap<String, ElementStyleSheet>) getRootHandler().getHelperObject( ReportParserUtil.HELPER_OBJ_LEGACY_STYLES ); if ( report != null ) { final ElementStyleSheet existingStyleSheet = report.get( styleClass ); if ( existingStyleSheet != null ) { element.getStyle().addDefault( existingStyleSheet ); } } } }
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 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; }
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 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 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 testIsVisible() { Element elem = new Element(); elem.getStyle().setBooleanStyleProperty( ElementStyleKeys.VISIBLE, true ); assertEquals( true, elem.isVisible() ); }
public void testIsDynamicContent() { Element elem = new Element(); elem.getStyle().setBooleanStyleProperty( ElementStyleKeys.DYNAMIC_HEIGHT, true ); assertEquals( true, elem.isDynamicContent() ); }
public void testElementCreate() { final Element e = new Element(); assertNotNull( e.getDataSource() ); assertNotNull( e.getStyle() ); assertNotNull( e.getName() ); assertTrue( e.isVisible() ); assertNull( e.getParent() ); }
public void testWhitespaceCollapse() { final DefaultRenderableTextFactory textFactory = new DefaultRenderableTextFactory( new HtmlOutputProcessorMetaData( HtmlOutputProcessorMetaData.PAGINATION_NONE ) ); textFactory.startText(); CodePointBuffer buffer = Utf16LE.getInstance().decodeString( "T T T T", null ); //$NON-NLS-1$ final int[] data = buffer.getBuffer(); final Element element = new Element(); final int length = buffer.getLength(); element.getStyle().setStyleProperty( TextStyleKeys.WHITE_SPACE_COLLAPSE, WhitespaceCollapse.DISCARD ); final RenderNode[] renderNodes = textFactory.createText( data, 0, length, SimpleStyleResolver.resolveOneTime( element ), LegacyType.INSTANCE, new InstanceID(), ReportAttributeMap.EMPTY_MAP ); final RenderNode[] finishNodes = textFactory.finishText(); }