@Override public GanttChartDO newInstance() { return new GanttChartDO().setSettings(new GanttChartSettings()).setStyle(new GanttChartStyle()); }
private GanttTask getExternalGanttObject(final TaskDO task) { final GanttTask ganttObject = convertToGanttObject(task); if (ganttObject.getStartDate() == null) { ganttObject.setStartDate(GanttUtils.getCalculatedStartDate(ganttObject)); } if (ganttObject.getEndDate() == null) { ganttObject.setEndDate(GanttUtils.getCalculatedEndDate(ganttObject)); } // Remove any existing predecessor chain: ganttObject.setPredecessor(null); return ganttObject; }
public GanttChart() { this.style = new GanttChartStyle(); this.settings = new GanttChartSettings(); }
@Test public void createImage() throws IOException { final GanttTask root = createTestChart(); final GanttChartStyle style = new GanttChartStyle(); final GanttChartSettings settings = new GanttChartSettings(); final GanttChart diagram = new GanttChart(root, style, settings, "test-chart"); writeFile("ganttTest.jpg", BatikImageRenderer.getByteArray(diagram.create(), 800, ImageFormat.JPEG)); writeFile("ganttTest.png", BatikImageRenderer.getByteArray(diagram.create(), 800, ImageFormat.PNG)); writeFile("ganttTest.svg", BatikImageRenderer.getByteArray(diagram.create(), 800, ImageFormat.SVG)); writeFile("ganttTest.pdf", BatikImageRenderer.getByteArray(diagram.create(), 800, ImageFormat.PDF)); }
private GanttChart createGanttChart() { if (ganttChartData == null) { return null; } ganttChartData.getRootObject().sortChildren(); final GanttChart ganttChart = new GanttChart(ganttChartData.getRootObject(), getGanttChartStyle(), getSettings(), getData().getName()); // chart.getRootObject().recalculate(); return ganttChart; }
/** * Maximum depth of predecessors for avoiding circular predecessor settings.. */ public static final GanttChartData convertToGanttObjectTree(final TaskTree taskTree, final TaskDO rootTask) { final GanttChartData ganttChartData = new GanttChartData(); convertToGanttObject(ganttChartData, taskTree, rootTask); processPredecessor(ganttChartData, taskTree, ganttChartData.getRootObject()); return ganttChartData; }
private GanttTask findById(final Serializable id) { if (id == null || ganttChartData == null) { return null; } final GanttTask root = ganttChartData.getRootObject(); if (root == null) { return null; } return root.findById(id); }
@Override public AbstractSecuredBasePage onSaveOrUpdate() { getSettings().setOpenNodes(form.ganttChartEditTreeTablePanel.getOpenNodes()); getBaseDao().writeGanttObjects(getData(), ganttChartData.getRootObject()); return null; }
private GanttTask convertToGanttObject(final TaskDO task) { final GanttTask ganttObject = Task2GanttTaskConverter.convertToGanttObject(task); final TaskDO predecessorTask = task.getGanttPredecessor(); if (predecessorTask != null) { ganttObject.setPredecessor(convertToGanttObject(predecessorTask)); } return ganttObject; }
private static Date getPredecessorRelDate(final GanttRelationType relationType, final GanttTask predecessor, final Set<Serializable> startDateSet, final Set<Serializable> endDateSet) { if (relationType == GanttRelationType.START_START || relationType == GanttRelationType.START_FINISH) { final Date calculatedStartDate = getCalculatedStartDate(predecessor, startDateSet, endDateSet); return calculatedStartDate; } else { final Date calculatedEndDate = getCalculatedEndDate(predecessor, startDateSet, endDateSet); return calculatedEndDate; } }
@Override public void onSubmit() { ganttObject.setPredecessor(null); }
@Override public boolean isVisible() { return ganttObject.getPredecessor() != null; } }.setDefaultFormProcessing(false);
@Override public Serializable getPredecessorId() { if (this.predecessor == null) { return null; } return this.predecessor.getId(); }
public GanttChartXLabelBarRenderer(final Date fromDate, final Date toDate, final double diagramWidth, final GanttChartStyle style) { this.fromDate = fromDate; this.toDate = toDate; this.diagramWidth = diagramWidth; this.style = style; this.gridScale = style.getXGridScale(); init(); }
/** * @see org.projectforge.business.gantt.GanttTask#getCalculatedStartDate() */ @Override public Date getCalculatedStartDate() { if (startDateCalculated == false) { calculatedStartDate = GanttUtils.getCalculatedStartDate(this); startDateCalculated = true; } return this.calculatedStartDate; }
/** * Get the next free id for new Gantt tasks to insert (starting with -1). Positive values are reserved for Gantt tasks related to tasks * (of ProjectForge's TaskTree) (the id is equals to the task id). * @return */ public int getNextId() { final Integer id = getNextId(this, -1); return id != null ? id : -1; }
private void drawBothLabelBars(final Document doc, final Element el, final int row, final Date fromDate, final Date toDate, final GanttChartStyle style) { drawLabelBar(doc, el, row, fromDate, toDate, style.setRelativeTimeValues(false)); drawLabelBar(doc, el, row + 1, fromDate, toDate, style.setRelativeTimeValues(true)); }
@Override public GanttTask findByWorkpackageCode(String workpackageCode) { return findBy(new Matcher<GanttTask>() { @Override public boolean match(GanttTask object, Object expression) { return (StringUtils.equals(object.getWorkpackageCode(), (String) expression) == true); } }, workpackageCode); }
/** * Traverses through the child trees. * @return true, if no cyclic references are found (everything seems to be OK), otherwise false. */ public boolean checkCyclicReferences() { return checkCyclicReferences(0); }
protected GanttTreeTableNode(GanttTreeTableNode parent, GanttTask ganttObject) { super(parent, ganttObject.getId()); this.ganttObject = ganttObject; }