Exemplo n.º 1
0
  private void init() {
    if (control.getPrefWidth() < 0 | control.getPrefHeight() < 0) {
      control.setPrefSize(16, 16);
    }

    if (control.getMinWidth() < 0 | control.getMinHeight() < 0) {
      control.setMinSize(5, 5);
    }

    if (control.getMaxWidth() < 0 | control.getMaxHeight() < 0) {
      control.setMaxSize(1024, 1024);
    }

    led.getStyleClass().setAll("led");

    // Register listeners
    registerChangeListener(control.onProperty(), "ON");
    registerChangeListener(control.blinkingProperty(), "BLINKING");
    registerChangeListener(control.colorProperty(), "COLOR");
    registerChangeListener(control.typeProperty(), "TYPE");
    registerChangeListener(control.prefWidthProperty(), "PREF_WIDTH");
    registerChangeListener(control.prefHeightProperty(), "PREF_HEIGHT");

    if (control.isBlinking()) {
      timer.start();
    }

    initialized = true;
    repaint();
  }
Exemplo n.º 2
0
 // ******************** Methods *******************************************
 @Override
 protected void handleControlPropertyChanged(final String PROPERTY) {
   super.handleControlPropertyChanged(PROPERTY);
   if ("ON".equals(PROPERTY)) {
     ledOn.setVisible(control.isOn());
   } else if ("BLINKING".equals(PROPERTY)) {
     if (control.isBlinking()) {
       timer.start();
     } else {
       timer.stop();
       ledOn.setVisible(false);
     }
   } else if ("COLOR".equals(PROPERTY)) {
     repaint();
   } else if ("TYPE".equals(PROPERTY)) {
     repaint();
   } else if ("PREF_WIDTH".equals(PROPERTY)) {
     repaint();
   } else if ("PREF_HEIGHT".equals(PROPERTY)) {
     repaint();
   }
 }