private void loadFileContent() {
    // String openFileName = file.getAbsolutePath();
    StringBuffer sb = new StringBuffer();
    try (FileInputStream fis = new FileInputStream(file);
        BufferedInputStream bis = new BufferedInputStream(fis)) {
      while (bis.available() > 0) {
        sb.append((char) bis.read());
      }
    } catch (Exception e) {
      throw new RuntimeException("Cannot load file " + file.getName(), e);
    }
    textArea.setText(sb.toString());

    // Set the change listener to detect text modification
    this.textArea
        .textProperty()
        .addListener(
            new ChangeListener<String>() {
              @Override
              public void changed(
                  final ObservableValue<? extends String> observable,
                  final String oldValue,
                  final String newValue) {
                // this will run whenever text is changed
                // System.out.println("ChangeListener");
                setModified();
              }
            });
  }
Beispiel #2
0
 public void setScore(Score score) {
   ScoreInfo info = score.getInfo();
   lblTitle.setText(info.getTitle());
   txtWorkNumber.setText(info.getWorkNumber());
   txtWorkTitle.setText(info.getWorkTitle());
   txtMovementNumber.setText(info.getMovementNumber());
   txtMovementTitle.setText(info.getMovementTitle());
   // creators
   String s = "-";
   if (info.getCreators().size() > 0) {
     s = "";
     for (Creator creator : info.getCreators())
       s += (creator.getType() != null ? creator.getType() + ": " : "") + creator.getName() + "\n";
   }
   txtCreators.setText(s);
   // rights
   s = "-";
   if (info.getRights().size() > 0) {
     s = "";
     for (Rights rights : info.getRights())
       s += (rights.getType() != null ? rights.getType() + ": " : "") + rights.getText() + "\n";
   }
   txtRights.setText(s);
   // parts
   s = "-";
   if (score.getStavesList().getParts().size() > 0) {
     s = "";
     for (int i : range(score.getStavesList().getParts())) {
       Part part = score.getStavesList().getParts().get(i);
       s += i + ": " + part.getName() + "\n";
     }
   }
   txtParts.setText(s);
 }
  @FXML
  private void buttonCheckClicked(Event event) {
    DefectSet leftSide = new DefectSet(prefix);
    DefectSet rightSide = new DefectSet(prefix);

    leftSide.load(textInputLeft.getText(), textPrefix.getText(), textMax.getText());
    rightSide.load(textInputRight.getText(), textPrefix.getText(), textMax.getText());

    labelInputLeft.setText(leftSide.size() + " defect(s) found.");
    labelInputRight.setText(rightSide.size() + " defect(s) found.");

    DefectSet outputLeft = leftSide.subtract(rightSide);
    DefectSet outputRight = rightSide.subtract(leftSide);
    DefectSet intersect = leftSide.intersect(rightSide);

    textOutputLeft.setStyle("-fx-text-fill: blue;");
    textOutputLeft.setText(outputLeft.listAll());
    labelOutputLeft.setText(outputLeft.size() + " missed defect(s) found.");

    textOutputRight.setStyle("-fx-text-fill: red;");
    textOutputRight.setText(outputRight.listAll());
    labelOutputRight.setText(outputRight.size() + " missed defect(s) found.");

    textOutputCenter.setStyle("-fx-text-fill: green;");
    textOutputCenter.setText(intersect.listAll());
    labelOutputCenter.setText(intersect.size() + " defect(s) covered by both side.");
  }
 private void setOperaciones() {
   txtArea.setText("");
   ArrayList aux = interprete.getOperaciones();
   int i = 0;
   while (i < aux.size()) {
     txtArea.setText(txtArea.getText() + "\n" + aux.get(i++));
   }
 }
Beispiel #5
0
  @Override
  public void start(Stage primaryStage) {

    Label inputLabel = new Label("Input");

    TextArea input = new TextArea();
    input.setFont(MONOSPACE_FONT);
    setSize(input, INPUT_WIDTH, INPUT_HEIGHT);

    Label outputLabel = new Label("Output");

    TextArea output = new TextArea();
    output.setEditable(false);
    output.setFont(MONOSPACE_FONT);
    setSize(output, OUTPUT_WIDTH, OUTPUT_HEIGHT);

    TextArea codeArea = new TextArea();
    codeArea.setFont(MONOSPACE_FONT);
    setSize(codeArea, EDITOR_WIDTH, EDITOR_HEIGHT);

    Button runButton = new Button("Run");
    runButton.setOnAction(
        e -> {
          try {
            output.setText(new A_RayCode(codeArea.getText(), input.getText()).runAndGetOutput());
          } catch (RuntimeException exception) {
            output.setText("Error");
            exception.printStackTrace();
          }
        });

    Button clearOutput = new Button("Clear Output");
    clearOutput.setOnAction(
        e -> {
          output.setText("");
        });

    HBox buttonPane = new HBox();
    buttonPane.setSpacing(PANE_SPACING);
    buttonPane.setAlignment(Pos.CENTER_RIGHT);
    buttonPane.getChildren().addAll(clearOutput, runButton);

    VBox mainPane = new VBox();
    mainPane.setPadding(MAIN_PANE_INSETS);
    mainPane.setSpacing(PANE_SPACING);

    mainPane.getChildren().addAll(codeArea, buttonPane, inputLabel, input, outputLabel, output);

    BorderPane content = new BorderPane(mainPane);

    Scene scene = new Scene(content, WIDTH, HEIGHT);

    primaryStage.setScene(scene);
    primaryStage.setResizable(false);
    primaryStage.show();
  }
  public void setMovie(Movie movie) {
    ratingChoiceBox.valueProperty().bindBidirectional(movie.getCustomRatingProperty());
    customCommentText.textProperty().bindBidirectional(movie.getCustomCommentProperty());

    movieCoverImageView.setImage(movie.getImg());
    plotText.setText(movie.getPlot());
    titleLabel.setText(movie.getTitle());
    yearLabel.setText(Integer.toString(movie.getYear()));
    directorLabel.setText(movie.getDirector());
    genreLabel.setText(movie.getGenre());
    actorsText.setText(movie.getActors());
    runtimeLabel.setText(movie.getRuntime());
    ratingLabel.setText(Double.toString(movie.getRating()) + "/10");
  }
 @FXML
 private void onClear(ActionEvent event) {
   scoreboard.clear();
   String string = scoreboard.toString();
   scoreboardArea.setText(string);
   serialize();
 }
 private void onRequestUpload() {
   if (tempAttachments.size() < 3) {
     FileChooser fileChooser = new FileChooser();
     fileChooser.setTitle("Open file to attach");
     /* if (Utilities.isUnix())
     fileChooser.setInitialDirectory(new File(System.getProperty("user.home")));*/
     File result = fileChooser.showOpenDialog(stage);
     if (result != null) {
       try {
         URL url = result.toURI().toURL();
         try (InputStream inputStream = url.openStream()) {
           byte[] filesAsBytes = ByteStreams.toByteArray(inputStream);
           if (filesAsBytes.length <= Connection.getMaxMsgSize()) {
             tempAttachments.add(
                 new DisputeDirectMessage.Attachment(result.getName(), filesAsBytes));
             inputTextArea.setText(
                 inputTextArea.getText() + "\n[Attachment " + result.getName() + "]");
           } else {
             new Popup().error("The max. allowed file size is 100 kB.").show();
           }
         } catch (java.io.IOException e) {
           e.printStackTrace();
           log.error(e.getMessage());
         }
       } catch (MalformedURLException e2) {
         e2.printStackTrace();
         log.error(e2.getMessage());
       }
     }
   } else {
     new Popup().error("You cannot send more then 3 attachments in one message.").show();
   }
 }
 private void onSelect(SetStroke stroke) {
   if (stroke != null) {
     name.setText(stroke.getName());
     abbr.setText(stroke.getAbbr());
     notes.setText(stroke.getNotes());
   }
 }
Beispiel #10
0
 /** Mets l'UI en état de chargement. */
 private void nowLoading() {
   notGood.setDisable(true);
   good.setDisable(true);
   text.setDisable(true);
   text.setText("");
   progress.setProgress(-1);
 }
Beispiel #11
0
  private void generateLineNumbers(int breakCount) {
    StringBuilder builder = new StringBuilder();

    final int maxDigits = Integer.toString(breakCount).length();

    for (int i = 0; i < breakCount; i++) {
      String marker = StringUtil.padLineNumber(i + 1, maxDigits);

      builder.append(marker).append(C_NEWLINE);
    }

    taLineNumbers.setText(builder.toString());
    taLineNumbers.setMaxWidth(40 + maxDigits * 25);

    sbSource = (ScrollBar) taSource.lookup(".scroll-bar:vertical");
    sbLineNum = (ScrollBar) taLineNumbers.lookup(".scroll-bar:vertical");

    if (sbLineNum != null) {
      sbLineNum.setOpacity(0.0);
    }

    if (sbSource != null && sbLineNum != null && !scrollLinked) {
      linkScrollBars();
    }
  }
  /**
   * Initializes the controller class.
   *
   * @param url
   * @param rb
   */
  @Override
  public void initialize(URL url, ResourceBundle rb) {
    setupTable();
    inflateTable();

    atracaoTableView.setRowFactory(
        (TableView<Atracao> atracaoTablewView) -> {
          final TableRow<Atracao> row = new TableRow<>();
          row.addEventFilter(
              MouseEvent.MOUSE_PRESSED,
              (MouseEvent event) -> {
                final int index = row.getIndex();
                this.currentSelectedRow = index;
                if (index >= 0 && index < atracaoTablewView.getItems().size()) {
                  atracaoTableView.getSelectionModel().select(index);
                  textField1.setText(atracaoTableView.getItems().get(index).getIdAtracao());
                  textArea2.setText(atracaoTableView.getItems().get(index).getDescricao());
                  textField3.setText(
                      atracaoTableView.getItems().get(index).getClassificacaoEtaria());
                  textField4.setText(atracaoTableView.getItems().get(index).getLocal());
                  textField5.setText(atracaoTableView.getItems().get(index).getEvento());
                  textField6.setText(atracaoTableView.getItems().get(index).getData());
                  event.consume();
                }
              });
          return row;
        });
  }
  private void onTableSelectionChanged() {
    List<SQLHistoryEntry> selectedRows = getSelectedRowObjects();

    if (0 < selectedRows.size()) {
      _txtSqlPreview.setText(selectedRows.get(0).getSql());
    }
  }
 public void reset(ActionEvent event) {
   id = null;
   nameField.setText("");
   orderField.setText("");
   pathField.setText("");
   commandText.setText("");
   refresh(null);
 }
  private void setField(TextArea field, ConfigDataHolder data) {
    field.clear();
    StringBuilder sb = new StringBuilder();
    for (Cluding i : getData()) {
      sb.append(i.toString());
      sb.append(CRLF);
    }

    field.setText(sb.toString());
  }
  @FXML
  public void decipherButtonClick(ActionEvent event) {
    deOpenLabel.setText("");
    enSaveLabel.setText("");
    switch (choiceBox.getSelectionModel().getSelectedItem()) {
      case "Simple ASCII Cipher":
        textArea.setText(CipherMaker.decipherSimple(textArea.getText()));
        break;
      case "Cesar Chiper":
        textArea.setText(CipherMaker.decipherCesar(textArea.getText()));
        break;
      case "Vigenere":
        if (!textArea.getText().equals("")) {
          TextInputDialog dialog = new TextInputDialog();
          dialog.setTitle("Cipher-Code");
          dialog.setHeaderText("Type in a Password to decipher your text with!");
          dialog.setContentText("Enter your password here...");

          Optional<String> result = dialog.showAndWait();
          if (result.isPresent()) {
            textArea.setText(CipherMaker.decipherVigenere(textArea.getText(), result.get()));
          }
        }
        break;
      case "RC4":
        if (!textArea.getText().equals("")) {
          TextInputDialog dialog = new TextInputDialog();
          dialog.setTitle("Cipher-Code");
          dialog.setHeaderText("Type in the number to decipher!");
          dialog.setContentText("Enter your number here...");

          Optional<String> result = dialog.showAndWait();
          if (result.isPresent() && result.get().matches("[0-9]+")) {
            textArea.setText(
                CipherMaker.decipherRC4(textArea.getText(), Integer.parseInt(result.get())));
          } else {
            deOpenLabel.setText("Decipher not possible...");
          }
        }

        break;
    }
  }
Beispiel #17
0
  public void setDetails(model.model.Details details) {
    this.details = details;

    year.setText(Integer.toString(details.year));
    sectionIntroText.setText(details.sectionIntroText);
    presentationText.setText(details.presentationText);
    congratulationText.setText(details.congratulationText);
    congratulationTitle.setText(details.congratulationTitle);
    // polytechImage.setText(details.polytechImage == null ? "" : "Image présente en mémoire");
  }
  @FXML
  public void clear() {
    User_name.requestFocus();
    User_name.setText(null);

    pass.setText(null);
    Erromassage.setText("");
    note.setText(null);
    CB1.setSelected(false);
    CB2.setSelected(false);
  }
Beispiel #19
0
  /** *************************Read File Data************************** */
  private void readFile(TreeItem<StrucTree> item) throws SQLException {
    StringBuilder pos = new StringBuilder("");

    if (item.getValue().isFile()
        && (Objects.equals(tempFileData, "") || tempFileId != item.getValue().getID())) {
      //    		System.out.println(getLine(item.getValue().getLine(),pos).toString());
      tempFileData = getLine(item.getValue().getLine(), pos).toString();
      tempFileId = item.getValue().getID();
      fileData.setText(tempFileData);
    }
  }
Beispiel #20
0
  public PaneBookCafe() {
    this.getStylesheets().add("css/textArea.css");

    this.setWidth(400.0);
    this.setHeight(400.0);

    text.setText("SEI AL BOOKCAFE! " + "\nfai il pieno di energia..e rilancia il dado!!");
    hbox.getChildren().add(new ImageView(new Image("file:icone/caffe.gif")));
    vbox.getChildren().addAll(text, hbox);
    getChildren().add(vbox);
  }
  public void open(File f) {
    Properties open = new Properties();
    InputStream input = null;

    try {
      input = new FileInputStream(f);
      open.load(input);

      selectProviderCb.setValue(open.getProperty("provider"));
      selectGrainCb.setValue(open.getProperty("grain"));
      weightTf.setText(open.getProperty("weight"));
      infoTa.setText(open.getProperty("info"));

      for (Entry<String, TextField> entry : propertiesTf.entrySet()) {
        String propertyName = entry.getKey();
        TextField tf = entry.getValue();
        CheckBox cb = propertiesCb.get(propertyName);

        tf.setText(open.getProperty(propertyName));
        if (open.getProperty(propertyName + "_ENABLED").equals("ON")) {
          tf.setDisable(false);
          cb.setSelected(true);
        } else {
          tf.setDisable(true);
          cb.setSelected(false);
        }
      }

      mainStage.setTitle(f.getName());
    } catch (Exception ex) {
      infoTa.setText("Не могу открыть файл");
    } finally {
      if (input != null) {
        try {
          input.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
  }
  @FXML
  public void compute() {
    double[][] transformedTrajectory = getTransformedTrajectory();
    if (transformedTrajectory == null) return;

    // compute and display RP
    BufferedImage rp =
        DRQA.getRPImage(
            transformedTrajectory, transformedTrajectory, recurrenceThresholdSlider.getValue());
    rpImageView.setImage(SwingFXUtils.toFXImage(rp, null));
    applyImageScale();

    // compute and display CRT
    DRQA.conditional_ww_limit = Integer.parseInt(crtLimit.getText());
    DRQA.CRT_LOG_SCALE = logScaleCheckBox.isSelected();
    drqa =
        new DRQA(
            transformedTrajectory, transformedTrajectory, recurrenceThresholdSlider.getValue());
    BufferedImage crt = drqa.getCRTImage(DRQA.conditional_ww_limit, drqa.conditional_ww);
    crtImageView.setImage(SwingFXUtils.toFXImage(crt, null));
    String[] stats = drqa.crtStatistics().split("\t");
    crtStats.setText(
        String.format(
            "mean row: %.2f\tmean col: %.2f\ncorrelation: %.2f\nmax row: %s\tmax col: %s\nlocal maxima: %s\nentropy: %.2f",
            Double.parseDouble(stats[0]),
            Double.parseDouble(stats[1]),
            Double.parseDouble(stats[2]),
            stats[3],
            stats[4],
            stats[5],
            Double.parseDouble(stats[6])));

    drqa.computeRQA(2, 2, 2);
    rqaMeasures.setText(drqa.printableString(DRQA.STANDARD_RQA));

    updateTimeSeriesChart();
    updateDistanceDistributionChart();
    updateLineLengthHistogram(
        null, null, lineLengthTypeSelector.getSelectionModel().getSelectedIndex());
  }
  /** Initializes the controller. */
  @FXML
  private void initialize() {
    closeButton.setGraphic(new FontAwesomeIconView(FontAwesomeIcon.TIMES));

    try {
      licenseTextArea.setText(
          new String(
              Files.readAllBytes(
                  Paths.get(SmartRace.class.getResource("/licenses/gnu_gpl_v3.txt").getPath()))));
    } catch (IOException ex) {
      log.error(ex.getMessage(), ex);
    }
  }
Beispiel #24
0
 @Override
 public void handle(ActionEvent event) {
   if (!commentaarveld.getText().isEmpty()) {
     if (exclamationField == null) {
       System.out.println("! = null");
     }
     if (commentaarveld == null) {
       System.out.println("Commentaarveld = null");
     }
     String timeStamp =
         new SimpleDateFormat("dd/MM/yyyy - HH:mm").format(Calendar.getInstance().getTime());
     exclamationField.setText(
         exclamationField.getText() + timeStamp + ": " + commentaarveld.getText() + "\n");
   }
 }
  @FXML
  public void Selecteditem() throws SQLException {

    TuserPermission InsertData = (TuserPermission) tableUser.getSelectionModel().getSelectedItem();
    selected = InsertData.getId();
    String Sql = " SELECT * FROM users WHERE id =  '" + InsertData.getId() + "'";
    DB.rs = DB.statemen.executeQuery(Sql);

    if (DB.rs.next()) {

      User_name.setText(DB.rs.getString("user_name"));
      pass.setText(DB.rs.getString("pass"));
      note.setText(DB.rs.getString("note"));
      CB1.setSelected(DB.rs.getBoolean("permission1"));
      CB2.setSelected(DB.rs.getBoolean("permission2"));
    }
  }
 public void init() {
   idLabel.setText(pro.getId());
   nameInput.setText(pro.getName());
   priceLabel.setText(pro.getPrice());
   String tagStr = "";
   boolean isa = true;
   if (pro.getTags() != null) {
     for (String tag : pro.getTags()) {
       if (isa) {
         tagStr += tag;
         continue;
       }
       tagStr += "," + tag;
     }
   }
   tagInput.setText(tagStr);
 }
  public void newFile() {
    infoTa.setText("");
    selectProviderCb.setValue(providers.get(0).getName());
    weightTf.setText("0.0");

    for (Entry<String, TextField> entry : propertiesTf.entrySet()) {
      String propertyName = entry.getKey();
      TextField tf = entry.getValue();
      CheckBox cb = propertiesCb.get(propertyName);

      tf.setText("0.0");
      tf.setDisable(true);
      cb.setSelected(false);
    }

    file = null;
    mainStage.setTitle("unknown");
  }
Beispiel #28
0
  /** *************************File Input************************** */
  @FXML
  public void locateFile() throws IOException {
    FileChooser chooser = new FileChooser();
    FileChooser.ExtensionFilter extFilter =
        new FileChooser.ExtensionFilter("TXT files (*.txt)", "*.txt");

    chooser.getExtensionFilters().add(extFilter);
    extFilter = new FileChooser.ExtensionFilter("JAVA files (*.jar,*.java)", "*.jar", "*.java");
    chooser.getExtensionFilters().add(extFilter);

    chooser.setTitle("Open File");
    File file = chooser.showOpenDialog(root.getScene().getWindow());
    if (file != null) {
      String inputFileData = readFile(file);
      //    		System.out.println(inputFileData);
      fileData.setText(inputFileData);
    }
  }
Beispiel #29
0
  public void loadSource(File filename) {
    sourceFile = filename;

    if (sourceFile != null) {
      lblTitle.setText(sourceFile.getName());

      // add parent folder so source can be loaded in TriView
      sandboxStage.addSourceFolder(sourceFile.getParentFile());

      String source = ResourceLoader.readFile(sourceFile);

      if (source != null) {
        source = source.replace("\t", "    ");

        taSource.setText(source.trim());

        setModified(false);

        setVMLanguage();
      }
    }
  }
  public void save(File f) {
    Properties save = new Properties();
    OutputStream output = null;

    try {
      save.setProperty("provider", selectProviderCb.getValue());
      save.setProperty("grain", selectGrainCb.getValue());
      save.setProperty("weight", weightTf.getText());
      save.setProperty("info", infoTa.getText());

      for (Entry<String, TextField> entry : propertiesTf.entrySet()) {
        TextField tf = entry.getValue();
        String propertyName = entry.getKey();

        save.setProperty(propertyName, tf.getText());
        if (tf.isDisable()) {
          save.setProperty(propertyName + "_ENABLED", "OFF");
        } else {
          save.setProperty(propertyName + "_ENABLED", "ON");
        }
      }

      output = new FileOutputStream(f);
      save.store(output, null);
      mainStage.setTitle(f.getName());
    } catch (Exception ex) {
      infoTa.setText("Не могу сохранить в файл");
    } finally {
      if (output != null) {
        try {
          output.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
  }