Java 类javafx.beans.property.LongPropertyBase 实例源码

项目:Medusa    文件:Clock.java   
private void init(final ZonedDateTime TIME) {
    time                    = new ObjectPropertyBase<ZonedDateTime>(TIME) {
        @Override protected void invalidated() {
            if (!isRunning() && isAnimated()) {
                long animationDuration = getAnimationDuration();
                timeline.stop();
                final KeyValue KEY_VALUE = new KeyValue(currentTime, TIME.toEpochSecond());
                final KeyFrame KEY_FRAME = new KeyFrame(javafx.util.Duration.millis(animationDuration), KEY_VALUE);
                timeline.getKeyFrames().setAll(KEY_FRAME);
                timeline.setOnFinished(e -> fireUpdateEvent(FINISHED_EVENT));
                timeline.play();
            } else {
                currentTime.set(TIME.toEpochSecond());
                fireUpdateEvent(FINISHED_EVENT);
            }
        }
        @Override public Object getBean() { return Clock.this; }
        @Override public String getName() { return "time"; }
    };
    currentTime             = new LongPropertyBase(time.get().toEpochSecond()) {
        @Override protected void invalidated() {}
        @Override public Object getBean() { return Clock.this; }
        @Override public String getName() { return "currentTime"; }
    };
    zoneId                  = time.get().getZone();
    timeline                = new Timeline();
    timeline.setOnFinished(e -> fireUpdateEvent(FINISHED_EVENT));
    updateInterval          = LONG_INTERVAL;
    _checkSectionsForValue  = false;
    _checkAreasForValue     = false;
    sections                = FXCollections.observableArrayList();
    _secondsVisible         = false;
    _highlightSections      = false;
    areas                   = FXCollections.observableArrayList();
    _areasVisible           = false;
    _highlightAreas         = false;
    _text                   = "";
    _discreteSeconds        = true;
    _discreteMinutes        = true;
    _discreteHours          = false;
    _secondsVisible         = false;
    _titleVisible           = false;
    _textVisible            = false;
    _dateVisible            = false;
    _dayVisible             = false;
    _nightMode              = false;
    _running                = false;
    _autoNightMode          = false;
    _backgroundPaint        = Color.TRANSPARENT;
    _borderPaint            = Color.TRANSPARENT;
    _borderWidth            = 1;
    _foregroundPaint        = Color.TRANSPARENT;
    _titleColor             = DARK_COLOR;
    _textColor              = DARK_COLOR;
    _dateColor              = DARK_COLOR;
    _hourTickMarkColor      = DARK_COLOR;
    _minuteTickMarkColor    = DARK_COLOR;
    _tickLabelColor         = DARK_COLOR;
    _alarmColor             = DARK_COLOR;
    _hourTickMarksVisible   = true;
    _minuteTickMarksVisible = true;
    _tickLabelsVisible      = true;
    _hourColor              = DARK_COLOR;
    _minuteColor            = DARK_COLOR;
    _secondColor            = DARK_COLOR;
    _knobColor              = DARK_COLOR;
    _lcdDesign              = LcdDesign.STANDARD;
    _alarmsEnabled          = false;
    _alarmsVisible          = false;
    alarms                  = FXCollections.observableArrayList();
    alarmsToRemove          = new ArrayList<>();
    _lcdCrystalEnabled      = false;
    _shadowsEnabled         = false;
    _lcdFont                = LcdFont.DIGITAL_BOLD;
    _locale                 = Locale.US;
    _tickLabelLocation      = TickLabelLocation.INSIDE;
    _animated               = false;
    animationDuration       = 10000;
    _customFontEnabled      = false;
    _customFont             = Fonts.robotoRegular(12);
}