Beispiel #1
0
 // ******************** Constructors **************************************
 public LcdSkin(Gauge gauge) {
   super(gauge);
   width = PREFERRED_WIDTH;
   height = PREFERRED_HEIGHT;
   valueOffsetLeft = 0.0;
   valueOffsetRight = 0.0;
   digitalFontSizeFactor = 1.0;
   backgroundTextBuilder = new StringBuilder();
   valueFormatString =
       new StringBuilder("%.")
           .append(Integer.toString(gauge.getDecimals()))
           .append("f")
           .toString();
   otherFormatString =
       new StringBuilder("%.")
           .append(Integer.toString(gauge.getTickLabelDecimals()))
           .append("f")
           .toString();
   sections = gauge.getSections();
   sectionColorMap = new HashMap<>(sections.size());
   updateSectionColors();
   FOREGROUND_SHADOW.setOffsetX(0);
   FOREGROUND_SHADOW.setOffsetY(1);
   FOREGROUND_SHADOW.setColor(Color.rgb(0, 0, 0, 0.5));
   FOREGROUND_SHADOW.setBlurType(BlurType.TWO_PASS_BOX);
   FOREGROUND_SHADOW.setRadius(2);
   init();
   initGraphics();
   registerListeners();
 }
    private void configureEffect() {
      handEffect.setOffsetX(radius / 40);
      handEffect.setOffsetY(radius / 40);
      handEffect.setRadius(6);
      handEffect.setColor(Color.web("#000000"));

      Lighting lighting = new Lighting();
      Light.Distant light = new Light.Distant();
      light.setAzimuth(225);
      lighting.setLight(light);
      handEffect.setInput(lighting);

      handEffectGroup.setEffect(handEffect);
    }
Beispiel #3
0
  public MovieTile(Movie movie, Scene scene) {
    super();
    this.movie = movie;

    HBox hbox = new HBox(2);
    //	hbox.setPrefHeight(500);
    hbox.prefWidthProperty().bind(scene.widthProperty().divide(8));
    // hbox.prefHeightProperty().bind(scene.heightProperty().divide(2));

    ImageView imgView = new ImageView();
    imgView.setImage(new Image("file:" + movie.title.getValue() + ".jpg"));
    imgView.fitWidthProperty().bind(hbox.widthProperty().divide(2));
    //	imgView.setPreserveRatio(true);
    imgView.setSmooth(true);
    DropShadow ds = new DropShadow();
    ds.setRadius(10);
    ds.setOffsetX(-5);
    ds.setOffsetY(2);
    ds.setColor(Color.color(0, 0, 0, 0.3));
    imgView.setEffect(ds);

    VBox vbox = new VBox(2);

    HBox titleBox = new HBox(2);
    Text nameField = new Text();
    nameField.setTextOrigin(VPos.TOP);
    nameField.setStroke(Color.BLACK);
    nameField.textProperty().bind(movie.title);
    Text dateField = new Text();
    dateField.setTextOrigin(VPos.TOP);
    dateField.setStroke(Color.GRAY);
    dateField
        .textProperty()
        .bind(new SimpleStringProperty(" (").concat(movie.releaseDate).concat(")"));
    titleBox.getChildren().addAll(nameField, dateField);

    Text genreField = new Text();
    // genreField.prefHeightProperty().bind(hbox.heightProperty().divide(5/1));
    genreField.textProperty().bind(movie.genre);

    TextField comField = new TextField();
    // comField.prefHeightProperty().bind(hbox.heightProperty().divide(5/2));
    comField.textProperty().bind(movie.comments);
    vbox.getChildren().addAll(titleBox, genreField, comField);
    VBox.setVgrow(comField, Priority.ALWAYS);

    hbox.getChildren().addAll(imgView, vbox);
    this.getChildren().addAll(hbox);
  }
Beispiel #4
0
  // ******************** Drawing related ***********************************
  public final void drawLed() {
    final double SIZE =
        control.getPrefWidth() < control.getPrefHeight()
            ? control.getPrefWidth()
            : control.getPrefHeight();
    final double WIDTH = SIZE;
    final double HEIGHT = SIZE;

    led.setStyle("-fx-led: " + Util.colorToCssColor(control.getColor()));

    final Shape IBOUNDS = new Rectangle(0, 0, WIDTH, HEIGHT);
    IBOUNDS.setOpacity(0.0);

    final Shape LED_FRAME;
    final Shape LED_OFF;
    final Shape HIGHLIGHT;

    switch (control.getType()) {
      case SQUARE:
        LED_FRAME = new Rectangle(0.0625 * WIDTH, 0.0625 * HEIGHT, 0.875 * WIDTH, 0.875 * HEIGHT);
        LED_OFF = new Rectangle(0.1875 * WIDTH, 0.1875 * HEIGHT, 0.625 * WIDTH, 0.625 * HEIGHT);
        ledOn = new Rectangle(0.1875 * WIDTH, 0.1875 * HEIGHT, 0.625 * WIDTH, 0.625 * HEIGHT);
        HIGHLIGHT = new Rectangle(0.25 * WIDTH, 0.25 * HEIGHT, 0.5 * WIDTH, 0.1875 * HEIGHT);
        break;
      case VERTICAL:
        LED_FRAME = new Rectangle(0.25 * WIDTH, 0.0625 * HEIGHT, 0.5 * WIDTH, 0.875 * HEIGHT);
        LED_OFF = new Rectangle(0.3125 * WIDTH, 0.125 * HEIGHT, 0.375 * WIDTH, 0.75 * HEIGHT);
        ledOn = new Rectangle(0.3125 * WIDTH, 0.125 * HEIGHT, 0.375 * WIDTH, 0.75 * HEIGHT);
        HIGHLIGHT = new Rectangle(0.3125 * WIDTH, 0.125 * HEIGHT, 0.375 * WIDTH, 0.375 * HEIGHT);
        break;
      case HORIZONTAL:
        LED_FRAME = new Rectangle(0.0625 * WIDTH, 0.25 * HEIGHT, 0.875 * WIDTH, 0.5 * HEIGHT);
        LED_OFF = new Rectangle(0.125 * WIDTH, 0.3125 * HEIGHT, 0.75 * WIDTH, 0.375 * HEIGHT);
        ledOn = new Rectangle(0.125 * WIDTH, 0.3125 * HEIGHT, 0.75 * WIDTH, 0.375 * HEIGHT);
        HIGHLIGHT = new Rectangle(0.125 * WIDTH, 0.3125 * HEIGHT, 0.75 * WIDTH, 0.1875 * HEIGHT);
        break;
      case ROUND:
      default:
        LED_FRAME = new Circle(0.5 * WIDTH, 0.5 * HEIGHT, 0.4375 * WIDTH);
        LED_OFF = new Circle(0.5 * WIDTH, 0.5 * HEIGHT, 0.3125 * WIDTH);
        ledOn = new Circle(0.5 * WIDTH, 0.5 * HEIGHT, 0.3125 * WIDTH);
        HIGHLIGHT = new Circle(0.5 * WIDTH, 0.5 * HEIGHT, 0.2 * WIDTH);
        break;
    }

    LED_FRAME.getStyleClass().add("frame");

    LED_OFF.getStyleClass().clear();
    LED_OFF.getStyleClass().add("off");
    LED_OFF.setStyle("-fx-led: " + Util.colorToCssColor(control.getColor()));

    ledOn.getStyleClass().clear();
    ledOn.getStyleClass().add("on");
    ledOn.setStyle("-fx-led: " + Util.colorToCssColor(control.getColor()));
    ledOn.setVisible(control.isOn());

    HIGHLIGHT.getStyleClass().add("highlight");

    if (LED_FRAME.visibleProperty().isBound()) {
      LED_FRAME.visibleProperty().unbind();
    }
    LED_FRAME.visibleProperty().bind(control.frameVisibleProperty());

    final InnerShadow INNER_SHADOW = new InnerShadow();
    INNER_SHADOW.setWidth(0.180 * SIZE);
    INNER_SHADOW.setHeight(0.180 * SIZE);
    INNER_SHADOW.setRadius(0.15 * SIZE);
    INNER_SHADOW.setColor(Color.BLACK);
    INNER_SHADOW.setBlurType(BlurType.GAUSSIAN);
    LED_OFF.setEffect(INNER_SHADOW);

    final DropShadow GLOW = new DropShadow();
    GLOW.setSpread(0.35);
    GLOW.setRadius(0.16 * ledOn.getLayoutBounds().getWidth());
    GLOW.setColor(control.getColor());
    GLOW.setBlurType(BlurType.GAUSSIAN);
    GLOW.setInput(INNER_SHADOW);
    ledOn.setEffect(GLOW);

    led.getChildren().setAll(IBOUNDS, LED_FRAME, LED_OFF, ledOn, HIGHLIGHT);

    led.setCache(true);
  }