/** * Constructor. * * @param contentToDisplay * the string to be present in the header row. * @param theEnclosing * a char filling up the rest of the row. * @param theOrientation * the orientation of the text * @param theTable * the parent table. */ public Header(final String contentToDisplay, final char theEnclosing, final Alignment theOrientation, final NiceTable theTable) { super(theTable); this.orientation = theOrientation; this.enclosing = theEnclosing; this.title = Util.combine(new String(new char[] { enclosing }).toString(), SPACE, contentToDisplay, SPACE, new String(new char[] { enclosing }).toString()); }
/** * {@inheritDoc} */ @Override public String draw() { return Util.combine(new String(new char[] { AbstractTabularComponent.BORDER }), Util.repeat(new String(new char[] { content }), getTable().getTotalWidth() - 2), new String(new char[] { AbstractTabularComponent.BORDER }), NEWLINE); }
/** * {@inheritDoc} */ @Override public String draw() { return Util.combine(new String(new char[] { AbstractTabularComponent.BORDER }), Util.pad(title, enclosing, getTable().getTotalWidth() - 2, orientation), new String(new char[] { AbstractTabularComponent.BORDER }), NEWLINE); }
/** * {@inheritDoc} */ @Override public String draw() { final String[] row = new String[data.length]; for (int i = 0; i < data.length; i++) { row[i] = Util.pad(data[i], ' ', getTable().getColumnWidth(i), getTable().getOrientation(i)); } return Util.combine(new String(new char[] { AbstractTabularComponent.BORDER }), SPACE, Util.implode(Util.combine(SPACE, new String(new char[] { AbstractTabularComponent.BORDER }), SPACE), row), SPACE, new String(new char[] { AbstractTabularComponent.BORDER }), NEWLINE); }