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);
  }
  @Override
  public void start(Stage stage) {

    DropShadow dropShadow = new DropShadow(10.0, Color.rgb(150, 50, 50, .688));
    dropShadow.setOffsetX(4);
    dropShadow.setOffsetY(6);

    StackPane stackPane = new StackPane();
    stackPane.setAlignment(Pos.CENTER);
    stackPane.setEffect(dropShadow);

    Rectangle rectangle = new Rectangle(100, 50, Color.LEMONCHIFFON);
    rectangle.setArcWidth(30);
    rectangle.setArcHeight(30);

    Text text = new Text();
    text.setFont(Font.font("Tahoma", FontWeight.BOLD, 18));

    stackPane.getChildren().addAll(rectangle, text);

    final Scene scene = new Scene(stackPane, 400, 200, Color.LIGHTSKYBLUE);
    stage.setTitle("Custom Binding");

    rectangle.widthProperty().bind(scene.widthProperty().divide(2));
    rectangle.heightProperty().bind(scene.heightProperty().divide(2));

    DoubleBinding opacityBinding =
        new DoubleBinding() {
          {
            // List the dependencies with super.bind()
            super.bind(scene.widthProperty(), scene.heightProperty());
          }

          @Override
          protected double computeValue() {
            // Return the computed value
            double opacity = (scene.getWidth() + scene.getHeight()) / 1000;
            return (opacity > 1.0) ? 1.0 : opacity;
          }
        };
    rectangle.opacityProperty().bind(opacityBinding);
    text.textProperty().bind((Bindings.format("opacity = %.2f", opacityBinding)));

    ObjectBinding<Color> colorBinding =
        new ObjectBinding<Color>() {
          {
            super.bind(scene.fillProperty());
          }

          @Override
          protected Color computeValue() {
            if (scene.getFill() instanceof Color) {
              return ((Color) scene.getFill()).darker();
            } else {
              return Color.GRAY;
            }
          }
        };

    text.fillProperty().bind(colorBinding);

    stage.setScene(scene);
    stage.show();
  }
Beispiel #5
0
  public SerieInfo(final Serie serie) {
    // TODO Auto-generated constructor stub

    GridPane grid = new GridPane();
    FlowPane flow = new FlowPane(Orientation.HORIZONTAL);
    flow.setAlignment(Pos.TOP_LEFT);
    flow.setHgap(40);

    DropShadow dropShadow = new DropShadow();
    dropShadow.setOffsetX(10);
    dropShadow.setOffsetY(10);
    dropShadow.setColor(Color.rgb(50, 50, 50, 0.7));

    Label poster = new Label();
    String style_inner =
        "-fx-font: Gill Sans;"
            + "-fx-font-family: Gill Sans;"
            + "-fx-effect: dropshadow(one-pass-box, black, 8, 0, 4, 4);";
    poster.setStyle(style_inner);

    final Label star = new Label();
    Image stella = new Image("img/greentick.png", 35, 35, true, true, true);
    star.setGraphic(new ImageView(stella));
    star.setVisible(false);

    ImageView image = new ImageView(serie.getPoster());
    poster.setGraphic(image);

    TextArea text = new TextArea();

    text.setPrefSize(600, 160);
    text.setText(serie.getOverview());
    text.setWrapText(true);
    text.setEditable(false);
    /*
     * text.setStyle("-fx-text-fill: black;"+ "-fx-font: Gill Sans;"+
     * "-fx-font-size: 13;" + "-fx-height:400");
     */

    text.setStyle(LABEL_STYLE);
    String name = null;
    if (serie.getNome().length() > 16) {
      name = serie.getNome().substring(0, 15);
      name = name.concat("...");
    } else {

      name = serie.getNome();
    }

    Label nome = new Label(name);
    nome.setTextFill(Color.BLACK);
    nome.setFont(Font.font("Helvetica", 28));

    final Button btn = new Button("  Add   ");
    ImageView imageview = new ImageView(new Image("img/add.png", 12, 12, true, true, true));
    btn.setGraphic(imageview);
    btn.setContentDisplay(ContentDisplay.LEFT);
    /*
     * String buttonCss = SerieInfo.class.getResource("CustomButton.css")
     * .toExternalForm(); btn.getStylesheets().add(buttonCss);
     */
    btn.getStyleClass().add("custom-browse");
    btn.setCursor(Cursor.HAND);
    btn.setTextFill(Color.WHITE);

    btn.addEventHandler(
        MouseEvent.MOUSE_CLICKED,
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent e) {

            star.setVisible(true);

            if (Preferiti.getInstance().addToPreferiti(serie) == false) {

              /*
               * new MyDialog(Guiseries2.stage,
               * Modality.APPLICATION_MODAL, "Warning!", serie);
               */

            } else {

              btn.setDisable(true);
              btn.setText("  Added  ");
              btn.setGraphic(null);
              // torrent...
              DaemonManager manager = new DaemonManager();
              Search search =
                  new Search(
                      serie,
                      manager,
                      "ENG",
                      new SearchListener() {

                        @Override
                        public void SearchListener() {
                          Platform.runLater(
                              new Runnable() {

                                @Override
                                public void run() {

                                  boolean compare = false;
                                  for (int i = 0; i < serie.getStagioni().size(); i++) {

                                    for (int j = 0;
                                        j < serie.getStagioni().get(i).getEpisodiStagione().size();
                                        j++) {

                                      compare = false;

                                      if ((serie
                                              .getStagioni()
                                              .get(i)
                                              .getEpisodiStagione()
                                              .get(j)
                                              .getTorrent()
                                          != null)) {
                                        for (int k = (1 + j);
                                            k
                                                < serie
                                                    .getStagioni()
                                                    .get(i)
                                                    .getEpisodiStagione()
                                                    .size();
                                            k++) {

                                          if (serie
                                                  .getStagioni()
                                                  .get(i)
                                                  .getEpisodiStagione()
                                                  .get(k)
                                                  .getTorrent()
                                              != null) {
                                            if (serie
                                                .getStagioni()
                                                .get(i)
                                                .getEpisodiStagione()
                                                .get(j)
                                                .getTorrent()
                                                .getName()
                                                .equals(
                                                    serie
                                                        .getStagioni()
                                                        .get(i)
                                                        .getEpisodiStagione()
                                                        .get(k)
                                                        .getTorrent()
                                                        .getName())) {

                                              compare = true;
                                            }
                                          }
                                        }

                                        if (compare == false) {

                                          TorrentSeriesElement.getInstance()
                                              .addToTorrents(
                                                  serie
                                                      .getStagioni()
                                                      .get(i)
                                                      .getEpisodiStagione()
                                                      .get(j)
                                                      .getTorrent());
                                          if ((TorrentSeriesElement.getInstance()
                                                      .torrents
                                                      .indexOf(
                                                          serie
                                                              .getStagioni()
                                                              .get(i)
                                                              .getEpisodiStagione()
                                                              .get(j)
                                                              .getTorrent())
                                                  % 2)
                                              == 0) {

                                            TabDownload.mainDownload
                                                .getChildren()
                                                .add(
                                                    TabDownload.addTorrentEvenToDownloadTab(
                                                        serie
                                                            .getStagioni()
                                                            .get(i)
                                                            .getEpisodiStagione()
                                                            .get(j)
                                                            .getTorrent()));

                                          } else {

                                            TabDownload.mainDownload
                                                .getChildren()
                                                .add(
                                                    TabDownload.addTorrentOddToDownloadTab(
                                                        serie
                                                            .getStagioni()
                                                            .get(i)
                                                            .getEpisodiStagione()
                                                            .get(j)
                                                            .getTorrent()));
                                          }

                                          System.out.println(
                                              serie
                                                  .getStagioni()
                                                  .get(i)
                                                  .getEpisodiStagione()
                                                  .get(j)
                                                  .getTorrent()
                                                  .getName());
                                        }
                                      }
                                    }
                                  }

                                  try {

                                    FilmistaDb.getInstance().addSeriesToFilmistaDb(serie);
                                  } catch (ClassNotFoundException e1) {
                                    // TODO Auto-generated
                                    // catch
                                    // block
                                    e1.printStackTrace();
                                  } catch (IOException e1) {
                                    // TODO Auto-generated
                                    // catch
                                    // block
                                    e1.printStackTrace();
                                  } catch (SQLException e1) {
                                    // TODO Auto-generated
                                    // catch
                                    // block
                                    e1.printStackTrace();
                                  }

                                  TabPreferiti.updateTab();
                                }
                              });
                        }
                      });
            }
          }
        });

    flow.getChildren().add(btn);
    flow.getChildren().add(nome);

    if (Preferiti.getInstance().series.contains(serie) == true) {

      btn.setText("  Added  ");
      btn.setDisable(true);
      star.setVisible(true);
      btn.setGraphic(null);
    }

    grid.setHgap(25);
    grid.setVgap(15);
    grid.add(poster, 0, 0, 1, 2);
    grid.add(flow, 1, 0);
    FlowPane paneStar = new FlowPane(Orientation.HORIZONTAL);
    paneStar.setAlignment(Pos.TOP_RIGHT);
    paneStar.getChildren().add(star);
    grid.add(paneStar, 2, 0, 1, 1);
    grid.add(text, 1, 1, 2, 1);

    grid.getColumnConstraints().add(0, new ColumnConstraints());
    grid.getColumnConstraints().add(1, new ColumnConstraints());
    grid.getColumnConstraints().add(2, new ColumnConstraints(150));

    // grid.setGridLinesVisible(true);
    grid.setHgrow(text, Priority.ALWAYS);
    grid.setVgrow(poster, Priority.ALWAYS);

    grid.setPadding(new Insets(25, 25, 25, 25));
    this.setCenter(grid);

    String customCss = SerieInfo.class.getResource("CustomBorder.css").toExternalForm();
    this.getStylesheets().add(customCss);
    this.getStyleClass().add("custom-border");
  }