labelFactory.setText("Free / Open Source Software Survey");
labelFactory.setFontName("SansSerif");
labelFactory.setFontSize(new Integer(18));
labelFactory.setBold(Boolean.TRUE);
labelFactory.setAbsolutePosition(new Point2D.Double(X1, 10.0));
labelFactory.setMinimumSize(new FloatDimension(C1_WIDTH + C2_WIDTH + C3_WIDTH + C4_WIDTH, 28.0f));
labelFactory.setHorizontalAlignment(ElementAlignment.CENTER);
pageHeader.addElement(labelFactory.createElement());
// the following expression is used to format the manager name into a message string
// that says 'Respondent: <name>'. The whole string can be centered on the page that way.
// This expression expects to find a marked report property called 'MANAGER_NAME', look
// in the attemptPreview() method to see how this is set up.
// here is the element that displays the string calculated in the expression above.
final MessageFieldElementFactory tfef = new MessageFieldElementFactory();
tfef.setFormatString("Respondent: $(RESPONDENT_NAME)");
tfef.setFontName("SansSerif");
tfef.setFontSize(new Integer(12));
tfef.setBold(Boolean.TRUE);
tfef.setAbsolutePosition(new Point2D.Double(0.0, 38.0));
tfef.setMinimumSize(new FloatDimension(PRINT_WIDTH, 14.0f));
tfef.setHorizontalAlignment(ElementAlignment.CENTER);
pageHeader.addElement(tfef.createElement());
labelFactory.setAbsolutePosition(new Point2D.Double(X1, 58.0));
labelFactory.setText(
"Please note that the questions AND responses presented below were INVENTED for the the purpose of this demo report. They are NOT real.");
labelFactory.setFontName("Serif");
labelFactory.setFontSize(new Integer(11));
labelFactory.setBold(Boolean.FALSE);
labelFactory.setItalic(Boolean.TRUE);
pageHeader.addElement(labelFactory.createElement());
// labels
labelFactory.setFontName("SansSerif");
labelFactory.setFontSize(new Integer(7));
labelFactory.setItalic(Boolean.FALSE);
labelFactory.setBold(Boolean.FALSE);
labelFactory.setVerticalAlignment(ElementAlignment.BOTTOM);
final float delta = C2_WIDTH / 5.0f;
labelFactory.setText("Not Important");
labelFactory.setAbsolutePosition(new Point2D.Double(X2, 70.0));
labelFactory.setMinimumSize(new FloatDimension(delta, 30.0f));
pageHeader.addElement(labelFactory.createElement());
labelFactory.setText("Very Important");
labelFactory.setAbsolutePosition(new Point2D.Double(X2 + 4 * delta, 70.0));
labelFactory.setMinimumSize(new FloatDimension(delta, 30.0f));
pageHeader.addElement(labelFactory.createElement());
addBoxedLabelToBand(pageHeader, null, X1, BOX_TOP, C1_WIDTH, COLUMN_HEADER_BOX_HEIGHT,
"SansSerif", 10, true, Color.black, new Color(220, 255, 220));
addBoxedLabelToBand(pageHeader, null, X2, BOX_TOP, C2_WIDTH, COLUMN_HEADER_BOX_HEIGHT,
"SansSerif", 10, true, Color.black, new Color(220, 255, 220));
final SurveyScale scaleHeader = new SurveyScale(1, 5, null);
scaleHeader.setDrawScaleValues(true);
scaleHeader.setDrawTickMarks(false);
scaleHeader.setScaleValueFont(new Font("SansSerif", Font.PLAIN, 9));
report.getParameterValues().put("SCALE_HEADER", scaleHeader);
final ContentFieldElementFactory dfef = new ContentFieldElementFactory();
dfef.setName("ScaleHeaderElement");
dfef.setAbsolutePosition(new Point2D.Double(X2, BOX_TOP));
dfef.setFieldname("SCALE_HEADER");
dfef.setMinimumSize(new FloatDimension(C2_WIDTH, COLUMN_HEADER_BOX_HEIGHT));
pageHeader.addElement(dfef.createElement());
addBoxedLabelToBand(pageHeader, "Your Response", X3, BOX_TOP, C3_WIDTH, COLUMN_HEADER_BOX_HEIGHT,
"SansSerif", 8, false, Color.black, new Color(220, 255, 220));