private ComponentBuilder<?, ?> commentBox(String label) {
    HorizontalListBuilder list =
        cmp.horizontalList()
            .setBaseStyle(stl.style().setTopBorder(stl.pen1Point()).setLeftPadding(10));
    list.add(cmp.text(label));

    return cmp.verticalList(cmp.text("Comment\n" + label))
        .setStretchType(StretchType.RELATIVE_TO_TALLEST_OBJECT)
        .setStyle(stl.style(stl.pen1Point()));
  }
 private static void addAddressAttribute(
     HorizontalListBuilder list, String label, String value, boolean allowEmptyValue) {
   if (allowEmptyValue || (value != null && !value.isEmpty())) {
     if (label != null && !label.isEmpty()) {
       list.add(
               cmp.text(label + ":").setFixedColumns(8).setStyle(Templates.boldStyle),
               cmp.text(value))
           .newRow();
     } else {
       list.add(cmp.text("").setFixedColumns(8).setStyle(Templates.boldStyle), cmp.text(value))
           .newRow();
     }
   }
 }
 private static ComponentBuilder<?, ?> createNameComponent(String lastName, String firstName) {
   final HorizontalListBuilder list =
       cmp.horizontalList()
           .setBaseStyle(stl.style().setTopBorder(stl.pen1Point()).setLeftPadding(10));
   addAddressAttribute(list, "Address", "", true);
   addAddressAttribute(list, "", "", true);
   addAddressAttribute(list, "", "", true);
   addAddressAttribute(list, "Phone", "", true);
   final HorizontalListBuilder title = cmp.horizontalFlowList();
   title
       .add(
           cmp.text(String.format("Donor: %s %s", firstName, lastName))
               .setStyle(Templates.boldStyle))
       .newRow();
   return cmp.verticalList(title, list);
 }
Exemplo n.º 4
0
 private void addTitle(String reportName, HorizontalListBuilder headerList) {
   headerList
       .add(
           cmp.text(reportName)
               .setStyle(Templates.bold18CenteredStyle)
               .setHorizontalAlignment(HorizontalAlignment.CENTER))
       .newRow()
       .add(cmp.verticalGap(5));
 }
Exemplo n.º 5
0
  private void build() {
    ComponentBuilder<?, ?> cardComponent = createCardComponent();
    HorizontalListBuilder cards = cmp.horizontalFlowList();
    for (int i = 0; i < 10; i++) {
      cards.add(cardComponent);
    }

    try {
      report()
          .setTemplate(Templates.reportTemplate)
          .setTextStyle(stl.style())
          .setPageFormat(PageType.A5)
          .title(Templates.createTitleComponent("Card"), cards)
          .show();
    } catch (DRException e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 6
0
  private void addDatesSubHeader(
      String startDate, String endDate, HorizontalListBuilder headerList) {
    if (startDate.equalsIgnoreCase("null") || endDate.equalsIgnoreCase("null")) return;

    headerList
        .add(
            cmp.text("From " + startDate + " to " + endDate)
                .setStyle(Templates.bold12CenteredStyle)
                .setHorizontalAlignment(HorizontalAlignment.CENTER))
        .newRow();
  }
 private static ComponentBuilder<?, ?> createChurchAddressComponent() {
   final HorizontalListBuilder list =
       cmp.horizontalList()
           .setBaseStyle(stl.style().setTopBorder(stl.pen1Point()).setLeftPadding(10));
   addAddressAttribute(
       list, "Address", Settings.getInstance().getStringValue(Settings.ADDRESS1), false);
   addAddressAttribute(list, "", Settings.getInstance().getStringValue(Settings.ADDRESS2), false);
   final String city = Settings.getInstance().getStringValue(Settings.CITY);
   final String state = Settings.getInstance().getStringValue(Settings.STATE);
   final String zip = Settings.getInstance().getStringValue(Settings.ZIP);
   final String cityStateZip = String.format("%s, %s %s", city, state, zip);
   addAddressAttribute(list, "", cityStateZip, false);
   addAddressAttribute(
       list, "Phone", Settings.getInstance().getStringValue(Settings.PHONE), false);
   final HorizontalListBuilder title = cmp.horizontalFlowList();
   title
       .add(
           cmp.text(Settings.getInstance().getStringValue(Settings.CHURCH_NAME_KEY))
               .setStyle(Templates.boldStyle))
       .newRow();
   return cmp.verticalList(title, list);
 }
Exemplo n.º 8
0
  private ComponentBuilder<?, ?> createCardComponent() {
    HorizontalListBuilder cardComponent = cmp.horizontalList();
    StyleBuilder cardStyle = stl.style(stl.pen1Point()).setPadding(10);
    cardComponent.setStyle(cardStyle);

    ImageBuilder image =
        cmp.image(Templates.class.getResource("images/user_male.png")).setFixedDimension(60, 60);
    cardComponent.add(cmp.hListCell(image).heightFixedOnMiddle());
    cardComponent.add(cmp.horizontalGap(10));

    StyleBuilder boldStyle = stl.style().bold();
    VerticalListBuilder content =
        cmp.verticalList(
            cmp.text("Name:").setStyle(boldStyle),
            cmp.text("Peter Marsh"),
            cmp.text("Address:").setStyle(boldStyle),
            cmp.text("23 Baden Av."),
            cmp.text("City:").setStyle(boldStyle),
            cmp.text("New York"));

    cardComponent.add(content);
    return cardComponent;
  }
Exemplo n.º 9
0
 private void addVerticalGap(HorizontalListBuilder headerList) {
   headerList.add(cmp.line()).add(cmp.verticalGap(10));
 }