g.setColor(TangoColorFactory.ALUMINIUM_4);
g.fillRect(x - 1, y - 1, 3, 3);
String demandString = Integer.toString(customer.getDemand());
g.drawString(demandString, x - (g.getFontMetrics().stringWidth(demandString) / 2), y - TEXT_SIZE/2);
if (customer instanceof TimeWindowedCustomer) {
TimeWindowedCustomer timeWindowedCustomer = (TimeWindowedCustomer) customer;
g.setColor(TangoColorFactory.ALUMINIUM_3);
int circleX = x - (TIME_WINDOW_DIAMETER / 2);
int circleY = y + 5;
g.drawOval(circleX, circleY, TIME_WINDOW_DIAMETER, TIME_WINDOW_DIAMETER);
g.fillArc(circleX, circleY, TIME_WINDOW_DIAMETER, TIME_WINDOW_DIAMETER,
90 - calculateTimeWindowDegree(maximumTimeWindowTime, timeWindowedCustomer.getReadyTime()),
calculateTimeWindowDegree(maximumTimeWindowTime, timeWindowedCustomer.getReadyTime())
- calculateTimeWindowDegree(maximumTimeWindowTime, timeWindowedCustomer.getDueTime()));
if (timeWindowedCustomer.getArrivalTime() != null) {
if (timeWindowedCustomer.isArrivalAfterDueTime()) {
g.setColor(TangoColorFactory.SCARLET_2);
} else if (timeWindowedCustomer.isArrivalBeforeReadyTime()) {
g.setColor(TangoColorFactory.ORANGE_2);
} else {
g.setColor(TangoColorFactory.ALUMINIUM_6);
}
g.setStroke(TangoColorFactory.THICK_STROKE);
int circleCenterY = y + 5 + TIME_WINDOW_DIAMETER / 2;
int angle = calculateTimeWindowDegree(maximumTimeWindowTime, timeWindowedCustomer.getArrivalTime());
g.drawLine(x, circleCenterY,
x + (int) (Math.sin(Math.toRadians(angle)) * (TIME_WINDOW_DIAMETER / 2 + 3)),
circleCenterY - (int) (Math.cos(Math.toRadians(angle)) * (TIME_WINDOW_DIAMETER / 2 + 3)));
g.setStroke(TangoColorFactory.NORMAL_STROKE);
}