@Override public Pair<Integer, T> apply(T t) { return new Pair<>(current++, t); } };
Stream<Pair<FontStyle, String>> lines) { .filter(input -> !LimsUtils.isStringBlankOrNull(input.getValue()))// .reduce(0, (offset, input) -> { for (line = 0; line + offset < maxLines && input.getValue().length() > line * numCharsPerLine; line++) { String str; if (line + offset == maxLines - 1 && input.getValue().length() > (line + 1) * numCharsPerLine) { str = input.getValue().substring(line * numCharsPerLine, (line + 1) * numCharsPerLine - 2) + "..."; } else { str = input.getValue().substring(line * numCharsPerLine, Math.min(input.getValue().length(), (line + 1) * numCharsPerLine)); input.getKey(), Justification.LEFT, str);
@Override public LabelCanvas draw(Driver driver, Barcodable barcodable) { LabelCanvas label = driver.start(41, 15); label.textClipped(9, 12, 2, 10, TextDirection.VERTICAL_UP, FontStyle.REGULAR, Justification.LEFT, barcodable.getName()); label.multilineText(11, 12, 2, 9, 7, TextDirection.VERTICAL_UP, Stream.of(// new Pair<>(FontStyle.BOLD, barcodable.getLabelText()), // new Pair<>(FontStyle.REGULAR, unescapeHtml(barcodable.getBarcodeSizeInfo())), // new Pair<>(FontStyle.REGULAR, unescapeHtml(barcodable.getBarcodeExtraInfo())))); return label; } },
@Override protected void populate(Element xml, Pair<PoolableElementView, Partition> entry) { Run r = entry.getValue().getSequencerPartitionContainer().getLastRun(); xml.setAttribute("alias", "L00" + entry.getValue().getPartitionNumber() + ":" + entry.getKey().getDilutionName() + ":" + r.getAlias()); xml.setAttribute("run_center", centreName); if (r.getHealth() == HealthType.Completed) { xml.setAttribute("run_date", DF_TIMESTAMP.format(r.getCompletionDate())); } xml.setAttribute("center_name", centreName); for (Experiment e : submission.getExperiments()) { Element experimentRef = xml.getOwnerDocument().createElementNS(null, "EXPERIMENT_REF"); experimentRef.setAttribute("refname", e.getAlias()); experimentRef.setAttribute("refcenter", centreName); xml.appendChild(experimentRef); } Element dataBlock = xml.getOwnerDocument().createElementNS(null, "DATA_BLOCK"); dataBlock.setAttribute("sector", Integer.toString(entry.getValue().getPartitionNumber())); if (entry.getValue().getPool().getPoolDilutions().size() > 1) { // multiplexed dataBlock.setAttribute("member_name", entry.getKey().getDilutionName()); } }
@Override public LabelCanvas draw(Driver driver, Barcodable barcodable) { LabelCanvas label = driver.start(8.3, 4.08); label.multilineText(0.1, 1, .8, 18, 2, Stream.of(// new Pair<>(FontStyle.BOLD, barcodable.getAlias()))); label.multilineText(0.1, 3, .8, 12, 2, Stream.of(// new Pair<>(FontStyle.REGULAR, LimsUtils.formatDate(barcodable.getBarcodeDate())), // new Pair<>(FontStyle.REGULAR, unescapeHtml(barcodable.getBarcodeSizeInfo())))); label.barcode2d(5.78, 3.8, 0.1, getBarcode(barcodable)); return label; }
@Override public LabelCanvas draw(Driver driver, Barcodable barcodable) { LabelCanvas label = driver.start(8.3, 4.08); label.multilineText(0.1, 1, .8, 18, 2, Stream.of(// new Pair<>(FontStyle.BOLD, barcodable.getAlias()))); label.multilineText(0.1, 3, .8, 12, 2, Stream.of(// new Pair<>(FontStyle.REGULAR, LimsUtils.formatDate(barcodable.getBarcodeDate())), // new Pair<>(FontStyle.REGULAR, unescapeHtml(barcodable.getBarcodeExtraInfo())))); label.barcode2d(5.78, 3.8, 0.1, getBarcode(barcodable)); return label; }
@Override public LabelCanvas draw(Driver driver, Barcodable barcodable) { String barcode = getBarcode(barcodable); LabelCanvas label = driver.start(25.0, 25.0); label.barcode2d(11, 12, 0.3, barcode); label.multilineText(2, 4, 2, 14, 3, Stream.of(// new Pair<>(FontStyle.REGULAR, barcodable.getLabelText()), // new Pair<>(FontStyle.REGULAR, LimsUtils.formatDate(barcodable.getBarcodeDate())))); return label; } },
@Override protected Stream<Pair<PoolableElementView, Partition>> items() { return submission.getExperiments().stream().flatMap(experiment -> experiment.getRunPartitions().stream()).flatMap( rp -> rp.getPartition().getPool().getPoolDilutions().stream() .map(pd -> new Pair<>(pd.getPoolableElementView(), rp.getPartition()))); }
@Override public LabelCanvas draw(Driver driver, Barcodable barcodable) { LabelCanvas label = driver.start(14, 4.666); // This label can handle 10 char/line, but we restrict it to 8 so that the barcodes break in a nice place for projects that people // care about. label.multilineText(10.7, 2.3, 0.5, 8, 2, Stream.of(new Pair<>(FontStyle.REGULAR, barcodable.getAlias()))); label.multilineText(1, 1.375, .8, 18, 2, Stream.of(// new Pair<>(FontStyle.BOLD, barcodable.getAlias()))); label.multilineText(1, 3.375, .8, 12, 2, Stream.of(// new Pair<>(FontStyle.REGULAR, LimsUtils.formatDate(barcodable.getBarcodeDate())), // new Pair<>(FontStyle.REGULAR, unescapeHtml(barcodable.getBarcodeExtraInfo())))); label.barcode2d(6.78, 4, 0.1, barcodable.getAlias()); return label; }
@Override public LabelCanvas draw(Driver driver, Barcodable barcodable) { LabelCanvas label = driver.start(41, 15); String barcode = getBarcode(barcodable); label.barcode2d(2, 2, 0.3, barcode); label.textClipped(7, 3, 3, 12, TextDirection.NORMAL, FontStyle.BOLD, Justification.LEFT, barcodable.getName()); label.multilineText(7, 5, 2, 28, 5, Stream.of(// new Pair<>(FontStyle.REGULAR, barcodable.getLabelText()), // new Pair<>(FontStyle.REGULAR, unescapeHtml(barcodable.getBarcodeExtraInfo())))); return label; } },