}
private void initGraphics() {
pane = new Pane();
background = new Region();
if (Clock.Design.IOS6 == getSkinnable().getDesign()) {
background.getStyleClass().setAll("background-ios6");
} else if (Clock.Design.DB == getSkinnable().getDesign()) {
background.getStyleClass().setAll("background-db");
} else if (Clock.Design.BRAUN == getSkinnable().getDesign()) {
background.getStyleClass().setAll("background-braun");
} else if (Clock.Design.BOSCH == getSkinnable().getDesign()) {
background.getStyleClass().setAll("background-bosch");
}
logoLayer = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
ctx = logoLayer.getGraphicsContext2D();
String majorTickStyleClass;
String minorTickStyleClass;
if (Clock.Design.IOS6 == getSkinnable().getDesign()) {
majorTickStyleClass = "major-tick-ios6";
minorTickStyleClass = "minor-tick-ios6";
} else if (Clock.Design.DB == getSkinnable().getDesign()) {
majorTickStyleClass = "major-tick-db";
minorTickStyleClass = "minor-tick-db";
} else if (Clock.Design.BOSCH == getSkinnable().getDesign()) {
majorTickStyleClass = "major-tick-bosch";
minorTickStyleClass = "minor-tick-bosch";
} else {
majorTickStyleClass = "major-tick-braun";
minorTickStyleClass = "minor-tick-braun";
}
int tickLabelCounter = 1;
for (double angle = 0 ; angle < 360 ; angle += 6) {
Region tick = new Region();
if (angle % 30 == 0) {
tick.getStyleClass().setAll(majorTickStyleClass);
Text tickLabel = new Text(Integer.toString(tickLabelCounter));
tickLabel.getStyleClass().setAll("tick-label-braun");
tickLabels.add(tickLabel);
tickLabelCounter++;
} else {
tick.getStyleClass().setAll(minorTickStyleClass);
}
ticks.add(tick);
}
DropShadow dropShadow = new DropShadow();
dropShadow.setColor(Color.rgb(0, 0, 0, 0.65));
dropShadow.setRadius(1.5);
dropShadow.setBlurType(BlurType.TWO_PASS_BOX);
dropShadow.setOffsetY(1);
tickMarkGroup = new Group();
tickMarkGroup.setEffect(dropShadow);
tickMarkGroup.getChildren().setAll(ticks);
tickLabelGroup = new Group();
tickLabelGroup.setEffect(dropShadow);
tickLabelGroup.getChildren().setAll(tickLabels);
tickLabelGroup.setOpacity(Clock.Design.BRAUN == getSkinnable().getDesign() ? 1 : 0);
hourPointer = new Region();
if (Clock.Design.IOS6 == getSkinnable().getDesign()) {
hourPointer.getStyleClass().setAll("hour-pointer-ios6");
} else if (Clock.Design.DB == getSkinnable().getDesign()) {
hourPointer.getStyleClass().setAll("hour-pointer-db");
} else if (Clock.Design.BRAUN == getSkinnable().getDesign()) {
hourPointer.getStyleClass().setAll("hour-pointer-braun");
} else if (Clock.Design.BOSCH == getSkinnable().getDesign()) {
hourPointer.getStyleClass().setAll("hour-pointer-bosch");
}
hourPointer.getTransforms().setAll(hourAngle);
hourPointerFlour = new Region();
hourPointerFlour.getStyleClass().setAll("hour-pointer-braun-flour");
if (Clock.Design.BRAUN == getSkinnable().getDesign()) {
hourPointerFlour.setOpacity(1);
} else {
hourPointerFlour.setOpacity(0);
}
hourPointerFlour.getTransforms().setAll(hourAngle);
minutePointer = new Region();
if (Clock.Design.IOS6 == getSkinnable().getDesign()) {
minutePointer.getStyleClass().setAll("minute-pointer-ios6");
} else if (Clock.Design.DB == getSkinnable().getDesign()) {
minutePointer.getStyleClass().setAll("minute-pointer-db");
} else if (Clock.Design.BRAUN == getSkinnable().getDesign()) {
minutePointer.getStyleClass().setAll("minute-pointer-braun");
} else if (Clock.Design.BOSCH == getSkinnable().getDesign()) {
minutePointer.getStyleClass().setAll("minute-pointer-bosch");
}
minutePointer.getTransforms().setAll(minuteAngle);
minutePointerFlour = new Region();
minutePointerFlour.getStyleClass().setAll("minute-pointer-braun-flour");
if (Clock.Design.BRAUN == getSkinnable().getDesign()) {
minutePointerFlour.setOpacity(1);
} else {
minutePointerFlour.setOpacity(0);
}
minutePointerFlour.getTransforms().setAll(minuteAngle);
DropShadow pointerShadow = new DropShadow();
pointerShadow.setColor(Color.rgb(0, 0, 0, 0.45));
pointerShadow.setRadius(12);
pointerShadow.setBlurType(BlurType.TWO_PASS_BOX);
pointerShadow.setOffsetY(6);
pointerGroup = new Group();
pointerGroup.setEffect(pointerShadow);
pointerGroup.getChildren().setAll(minutePointerFlour, minutePointer, hourPointerFlour, hourPointer);
secondPointer = new Region();
secondPointer.setOpacity(1);
if (Clock.Design.IOS6 == getSkinnable().getDesign()) {
secondPointer.getStyleClass().setAll("second-pointer-ios6");
} else if (Clock.Design.DB == getSkinnable().getDesign()) {
secondPointer.getStyleClass().setAll("second-pointer-db");
} else if (Clock.Design.BRAUN == getSkinnable().getDesign()) {
secondPointer.getStyleClass().setAll("second-pointer-braun");
} else if (Clock.Design.BOSCH == getSkinnable().getDesign()) {
secondPointer.setOpacity(0);
}
secondPointer.getTransforms().setAll(secondAngle);
InnerShadow secondPointerInnerShadow = new InnerShadow();
secondPointerInnerShadow.setColor(Color.rgb(0, 0, 0, 0.3));
secondPointerInnerShadow.setRadius(1);
secondPointerInnerShadow.setBlurType(BlurType.TWO_PASS_BOX);
secondPointerInnerShadow.setOffsetY(-1);
InnerShadow secondPointerInnerHighlight = new InnerShadow();
secondPointerInnerHighlight.setColor(Color.rgb(255, 255, 255, 0.3));
secondPointerInnerHighlight.setRadius(1);
secondPointerInnerHighlight.setBlurType(BlurType.TWO_PASS_BOX);
secondPointerInnerHighlight.setOffsetY(1);
secondPointerInnerHighlight.setInput(secondPointerInnerShadow);
DropShadow secondPointerShadow = new DropShadow();
secondPointerShadow.setColor(Color.rgb(0, 0, 0, 0.45));
secondPointerShadow.setRadius(12);
secondPointerShadow.setBlurType(BlurType.TWO_PASS_BOX);
secondPointerShadow.setOffsetY(6);
secondPointerShadow.setInput(secondPointerInnerHighlight);
secondPointerGroup = new Group();
secondPointerGroup.setEffect(secondPointerShadow);
secondPointerGroup.getChildren().setAll(secondPointer);
secondPointerGroup.setOpacity(getSkinnable().isSecondPointerVisible() ? 1 : 0);
centerKnob = new Region();
if (Clock.Design.IOS6 == getSkinnable().getDesign()) {
centerKnob.getStyleClass().setAll("center-knob-ios6");
} else if (Clock.Design.DB == getSkinnable().getDesign()) {
centerKnob.getStyleClass().setAll("center-knob-db");
} else if (Clock.Design.BRAUN == getSkinnable().getDesign()) {
centerKnob.getStyleClass().setAll("center-knob-braun");
} else if (Clock.Design.BOSCH == getSkinnable().getDesign()) {
centerKnob.getStyleClass().setAll("center-knob-bosch");
}
foreground = new Region();
if (Clock.Design.IOS6 == getSkinnable().getDesign()) {
foreground.getStyleClass().setAll("foreground-ios6");
} else if (Clock.Design.DB == getSkinnable().getDesign()) {
foreground.getStyleClass().setAll("foreground-db");
} else if (Clock.Design.BRAUN == getSkinnable().getDesign()) {