public void draw(UGraphic ug, double x, double y) { final TextBlock timeHeader = project.getTimeHeader(dayWith); final Row row = getMainRow(); final TextBlock headers = row.header(); final double deltaX = headers.calculateDimension(ug.getStringBounder()).getWidth(); final double deltaY = timeHeader.calculateDimension(ug.getStringBounder()).getHeight(); headers.drawU(ug.apply(new UTranslate(x, (y + deltaY)))); final TextBlock tbRow = row.asTextBloc(project.getTimeConverter(dayWith)); tbRow.drawU(ug.apply(new UTranslate((x + deltaX), (y + deltaY)))); timeHeader.drawU(ug.apply(new UTranslate((x + deltaX), y))); }
public double getWidth(StringBounder stringBounder) { final TextBlock timeHeader = project.getTimeHeader(dayWith); final Row row = getMainRow(); final TextBlock headers = row.header(); return headers.calculateDimension(stringBounder).getWidth() + timeHeader.calculateDimension(stringBounder).getWidth() + 1; }
private Row getMainRow() { final List<Task> tasks = project.getTasks(); final List<Row> rows = new ArrayList<Row>(); for (Task t : tasks) { final String text = t.getCode(); final TextBlock label = Display.create(text).create(fontConfig, HorizontalAlignment.LEFT, new SpriteContainerEmpty()); rows.add(new RowSimple((Day) t.getStart(), (Day) t.getEnd(), HtmlColorUtils.BLACK, TextBlockUtils .withMargin(label, 3, 3))); } final Row row = RowUtils.merge(rows); return row; }