| 1 | package de.uka.ipd.sdq.sensorframework.visualisation.rvisualisation.reportitems; |
| 2 | |
| 3 | import de.uka.ipd.sdq.sensorframework.visualisation.rvisualisation.utils.RConnection; |
| 4 | |
| 5 | /**Report item containing static text. |
| 6 | * @author groenda |
| 7 | */ |
| 8 | public class StaticTextReportItem extends AbstractRReportItem { |
| 9 | |
| 10 | /** The static text represented by this report item. */ |
| 11 | private String myText; |
| 12 | /** Determines if this static text represents a heading. */ |
| 13 | private boolean isHeading; |
| 14 | |
| 15 | /**Initializes a new report item containing static text. |
| 16 | * @param text The static text of this item. |
| 17 | * @param isHeading <code>true</code> if this static text is a heading. |
| 18 | */ |
| 19 | public StaticTextReportItem(final String text, final boolean isHeading) { |
| 20 | super("Static text"); |
| 21 | |
| 22 | setText(text); |
| 23 | this.isHeading = isHeading; |
| 24 | } |
| 25 | |
| 26 | /**Constructs a report item without text that is not a heading. |
| 27 | * |
| 28 | */ |
| 29 | public StaticTextReportItem() { |
| 30 | this("", false); |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * @return The static text that is represented by this report item. |
| 35 | */ |
| 36 | public String getText() { |
| 37 | return myText; |
| 38 | } |
| 39 | |
| 40 | /**Set the static text of this report item. |
| 41 | * @param newText The new static text to set. |
| 42 | */ |
| 43 | public void setText(final String newText) { |
| 44 | if (newText != null) { |
| 45 | myText = newText; |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | /**Checks if the static text is a heading. |
| 50 | * @return <code>true</code> if the text is a heading. |
| 51 | */ |
| 52 | public boolean isHeading() { |
| 53 | return isHeading; |
| 54 | } |
| 55 | |
| 56 | /** {@inheritDoc} |
| 57 | */ |
| 58 | @Override |
| 59 | public void visit(final IReportRenderingVisitor renderingVisitor) { |
| 60 | renderingVisitor.visitStaticTextReportItem(this); |
| 61 | } |
| 62 | |
| 63 | /** {@inheritDoc} |
| 64 | */ |
| 65 | public void generateData(final RConnection re) { |
| 66 | // No implementation needed |
| 67 | } |
| 68 | } |