Java Code Examples for javafx.fxml.FXML

The following examples show how to use javafx.fxml.FXML. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: dev-tools   Source File: LogsController.java    License: Apache License 2.0 6 votes vote down vote up
@FXML
private void handleGenerate(ActionEvent actionEvent) {
    reset();
    if (!validate()) return;
    setRunning(true);
    CompletableFuture.supplyAsync(() -> {
        Iterator<String> iter = LogsService.logStream(
                logTypeComboBox.getValue(),
                Integer.parseInt(delayLowerField.getText()),
                Integer.parseInt(delayUpperField.getText()),
                Integer.parseInt(limitField.getText())).iterator();
        while (iter.hasNext()) {
            write(iter.next());
            if (!running) break;
        }
        return null;
    }).thenAccept(r -> {
        setRunning(false);
    }).exceptionally(e -> {
        Platform.runLater(() -> {
            setRunning(false);
            logMessage.setText(e.getMessage());
        });
        return null;
    }).whenComplete((i, t) -> closeFile());
}
 
Example 2
@FXML
void toggleBolckSize(ActionEvent event) {
  logger.finest("Toggle block size");
  XYPlot plot = getChart().getXYPlot();
  XYBlockPixelSizeRenderer renderer = (XYBlockPixelSizeRenderer) plot.getRenderer();
  int height = (int) renderer.getBlockHeightPixel();

  if (height == 1) {
    height++;
  } else if (height == 5) {
    height = 1;
  } else if (height < 5 && height != 1) {
    height++;
  }
  renderer.setBlockHeightPixel(height);
  renderer.setBlockWidthPixel(height);
}
 
Example 3
Source Project: dev-tools   Source File: GeneratorController.java    License: Apache License 2.0 6 votes vote down vote up
@FXML
private void handleGeneratePasswordAction(final ActionEvent actionEvent) {
    int length;
    try {
        pwdLength.setBorder(Border.EMPTY);
        length = validatePasswordLength();
    } catch (Exception e) {
        pwdLength.setBorder(Elements.alertBorder);
        return;
    }
    PasswordGenerator generator = new PasswordGenerator.PasswordGeneratorBuilder()
            .withLowerChars(pwdLowChars.isSelected())
            .withDigits(pwdDigits.isSelected())
            .withUpperChars(pwdUpperChars.isSelected())
            .withSymbols(pwdSymbols.isSelected())
            .build();
    generatorResult.setText(generator.generate(length));
}
 
Example 4
@FXML
void toggleKMDRKMY(ActionEvent event) {
  logger.finest("Toggle KMD and RKM Y-Axis");
  XYPlot plot = getChart().getXYPlot();
  if (useRKM_Y) {
    useRKM_Y = false;
    plot.getRangeAxis().setLabel("KMD(" + customYAxisKMBase + ")");
    imageViewKMDRKMY.setImage(iconKMD);
  } else {
    useRKM_Y = true;

    // if the divisor is round(R) switch to round(R)-1 for RKM plot
    yAxisDivisor = checkDivisor(yAxisDivisor, useRKM_Y, customYAxisKMBase, false);
    plot.getRangeAxis().setLabel("RKM(" + customYAxisKMBase + ")");
    imageViewKMDRKMY.setImage(iconRKM);
  }
  kendrickVariableChanged(plot);
}
 
Example 5
@FXML
private void viewIsotopeClick(ActionEvent ae){
    ResultFormula formula = resultTable.getSelectionModel().getSelectedItem();
    if(formula == null)
    {
        MZmineCore.getDesktop().displayMessage(null,
                "Select one result to copy");
        return;
    }

    logger.finest("Showing isotope pattern for formula " + formula.getFormulaAsString());
    IsotopePattern predictedPattern = formula.getPredictedIsotopes();

    if (predictedPattern == null)
        return;

    Feature peak = peakListRow.getBestPeak();

    RawDataFile dataFile = peak.getDataFile();
    int scanNumber = peak.getRepresentativeScanNumber();
    SpectraVisualizerModule.showNewSpectrumWindow(dataFile, scanNumber, null,
            peak.getIsotopePattern(), predictedPattern);
}
 
Example 6
@FXML
public void handleAddAction(ActionEvent actionEvent) {
    try {
        DBCompound compound = IDList.getSelectionModel().getSelectedItem();

        if (compound == null) {
            MZmineCore.getDesktop().displayMessage(null,
                    "Select one result to add as compound identity");
            return;

        }

        peakListRow.addPeakIdentity(compound, false);
        dispose();
    }
    catch (Exception e){
        e.printStackTrace();
    }
}
 
Example 7
@FXML
void toggleAnnotation(ActionEvent event) {
  logger.finest("Toggle annotations");
  XYPlot plot = getChart().getXYPlot();
  XYBlockPixelSizeRenderer renderer = (XYBlockPixelSizeRenderer) plot.getRenderer();
  Boolean itemNameVisible = renderer.getDefaultItemLabelsVisible();
  if (itemNameVisible == false) {
    renderer.setDefaultItemLabelsVisible(true);
  } else {
    renderer.setDefaultItemLabelsVisible(false);
  }
  if (plot.getBackgroundPaint() == Color.BLACK) {
    renderer.setDefaultItemLabelPaint(Color.WHITE);
  } else {
    renderer.setDefaultItemLabelPaint(Color.BLACK);
  }
}
 
Example 8
@FXML
void toggleBolckSize(ActionEvent event) {
  logger.finest("Toggle block size");
  XYPlot plot = getChart().getXYPlot();
  XYBlockPixelSizeRenderer renderer = (XYBlockPixelSizeRenderer) plot.getRenderer();
  int height = (int) renderer.getBlockHeightPixel();

  if (height == 1) {
    height++;
  } else if (height == 5) {
    height = 1;
  } else if (height < 5 && height != 1) {
    height++;
  }
  renderer.setBlockHeightPixel(height);
  renderer.setBlockWidthPixel(height);
}
 
Example 9
Source Project: OpenLabeler   Source File: OpenLabelerController.java    License: Apache License 2.0 5 votes vote down vote up
@FXML
private void onFileOpenDir(ActionEvent actionEvent) {
    DirectoryChooser dirChooser = new DirectoryChooser();
    dirChooser.setTitle(bundle.getString("menu.openMediaDir").replaceAll("_", ""));
    File dir = dirChooser.showDialog(tagBoard.getScene().getWindow());
    openFileOrDir(dir);
}
 
Example 10
Source Project: dev-tools   Source File: EpochController.java    License: Apache License 2.0 5 votes vote down vote up
@FXML
private void handleTsToHumanEpoch(final ActionEvent event) {
    tsToHumanField.setBorder(Border.EMPTY);
    try {
        LocalDateTime dt = EpochService.tsToLocalDateTime(tsToHumanField.getText());
        String result = EpochService.toHumanEpoch(dt);
        tsToHumanResult.setText(result);
    } catch (Exception e) {
        tsToHumanField.setBorder(Elements.alertBorder);
        tsToHumanResult.setText("");
    }
}
 
Example 11
Source Project: mzmine3   Source File: MainWindowController.java    License: GNU General Public License v2.0 5 votes vote down vote up
@FXML
public void handleCancelTask(Event event) {
  var selectedTasks = tasksView.getSelectionModel().getSelectedItems();
  for (WrappedTask t : selectedTasks) {
    t.getActualTask().cancel();
  }
}
 
Example 12
@FXML
public void apply() {
    if (serializableCheckBox.selectedProperty().get()) {
        selectedTable.setJdkSerializable(true);
        BaseConstants.tableNameSetUpTableRecordMap.put(selectedTable.getTableName(), true);
    } else {
        selectedTable.setJdkSerializable(false);
        BaseConstants.tableNameSetUpTableRecordMap.remove(selectedTable.getTableName());
    }
    tableAdvanceSetUpStage.close();
}
 
Example 13
Source Project: OpenLabeler   Source File: OpenLabelerController.java    License: Apache License 2.0 5 votes vote down vote up
@FXML
private void onPaste(ActionEvent event) {
    ObjectModel model = fromClipboard();
    if (model != null) {
        tagBoard.addObjectTag((ObjectModel)model.clone(), bundle.getString("menu.paste"));
    }
}
 
Example 14
@FXML
void shiftDownX(ActionEvent event) {
  logger.finest("Shift X-axis down");
  Double shiftValue = -0.01;
  xAxisShift = xAxisShift + shiftValue;
  XYPlot plot = getChart().getXYPlot();
  kendrickVariableChanged(plot);
}
 
Example 15
Source Project: scan   Source File: Controller.java    License: GNU General Public License v3.0 5 votes vote down vote up
@FXML
private void clear(MouseEvent event) {
    Label label = (Label) event.getSource();
    Parent parent = label.getParent().getParent();
    ObservableList<Node> childrenUnmodifiable = parent.getChildrenUnmodifiable();
    for (Node node : childrenUnmodifiable) {
        if (node instanceof ListView) {
            ((ListView) node).getItems().clear();
        }
    }
}
 
Example 16
@FXML
void chargeUpZ(ActionEvent event) {
  logger.finest("Charge Z-axis up");
  zAxisCharge = zAxisCharge + 1;
  XYPlot plot = getChart().getXYPlot();
  kendrickVariableChanged(plot);
}
 
Example 17
Source Project: dev-tools   Source File: HashController.java    License: Apache License 2.0 5 votes vote down vote up
@FXML
private void handleMoveUp(final ActionEvent event) {
    if (!hashOutput.getText().isEmpty()) {
        hashInput.setText(hashOutput.getText());
        hashOutput.setText("");
    }
}
 
Example 18
Source Project: FlyingAgent   Source File: ScanEachController.java    License: Apache License 2.0 5 votes vote down vote up
@FXML
private void onRefresh() {
    listLocation.getSelectionModel().clearSelection();
    listLocation.setExpanded(false);
    listLocation.depthProperty().set(1);
    System.out.println("On Refresh Called");
    Message message = new Message(null, Message.REFRESH_REQUEST);
    try {
        mainController.putO2AObject(message, AgentController.ASYNC);
    } catch (StaleProxyException e) {
        e.printStackTrace();
    }
}
 
Example 19
@FXML
void divisorUpX(ActionEvent event) {
  logger.finest("Divisor X-axis up");
  int minDivisor = getMinimumRecommendedDivisor(customXAxisKMBase);
  int maxDivisor = getMaximumRecommendedDivisor(customXAxisKMBase);
  if (xAxisDivisor >= minDivisor && xAxisDivisor < maxDivisor) {
    xAxisDivisor++;
    xAxisDivisor = checkDivisor(xAxisDivisor, useRKM_X, customXAxisKMBase, true);
  }
  XYPlot plot = getChart().getXYPlot();
  kendrickVariableChanged(plot);
}
 
Example 20
Source Project: TelegramClone   Source File: HomeController.java    License: MIT License 5 votes vote down vote up
@FXML
void sendMessage(ActionEvent event) {
    try {
        currentlySelectedUser.messagesList.add(new MessageViewModel(messageField.getText(), getCurrentTime(), true, false, null));
        //sending message as: data type > sender > receiver > data
        connection.sendData("text>" + localUser.getUserName() + ">" + currentlySelectedUser.getUserName() + ">" + messageField.getText());
        messageField.clear();
        messagesListView.scrollTo(currentlySelectedUser.messagesList.size());
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
Example 21
@FXML
void miParametersOnAction(ActionEvent event) {
  Platform.runLater(() -> {
    ExitCode exitCode = param.showSetupDialog(true);
    if (exitCode == ExitCode.OK) {
      updateWindowToParameterSetValues();
      featureTable.applyColumnVisibility();
    }
  });
}
 
Example 22
@FXML
void toggleGrid(ActionEvent event) {
  logger.finest("Toggle grid");
  XYPlot plot = getChart().getXYPlot();
  if (plot.getDomainGridlinePaint() == Color.BLACK) {
    plot.setDomainGridlinePaint(Color.WHITE);
    plot.setRangeGridlinePaint(Color.WHITE);
  } else {
    plot.setDomainGridlinePaint(Color.BLACK);
    plot.setRangeGridlinePaint(Color.BLACK);
  }
}
 
Example 23
Source Project: FlyingAgent   Source File: DetailPCController.java    License: Apache License 2.0 5 votes vote down vote up
@FXML
private void onMoreInfo() {
    spinnerMoreInfo.setVisible(true);
    Message message = new Message(null, Message.ASK_REQUEST);
    try {
        mainController.putO2AObject(message, AgentController.ASYNC);
    } catch (StaleProxyException e) {
        e.printStackTrace();
    }
}
 
Example 24
Source Project: mapper-generator-javafx   Source File: ExportController.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * mapper xml 文件夹选择器
 */
@FXML
public void xmlDirectoryScan() {
    File directory = FileDirChooserFactory.createDirectoryScan(null, StringUtils.isEmpty(this.baseDir) ? null : this.baseDir);
    if (directory != null) {
        xmlLocationText.setText(directory.getPath());
        this.baseDir = directory.getPath();
    }
}
 
Example 25
Source Project: mapper-generator-javafx   Source File: ExportController.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * bean 文件夹选择器
 */
@FXML
public void beanDirectoryScan() {
    File directory = FileDirChooserFactory.createDirectoryScan(null, StringUtils.isEmpty(this.baseDir) ? null : this.baseDir);
    if (directory != null) {
        beanLocationText.setText(directory.getPath());
        this.baseDir = directory.getPath();
    }
}
 
Example 26
Source Project: Online-Food-Ordering-System   Source File: LoginController.java    License: MIT License 5 votes vote down vote up
@FXML
    public void MenuScreen(ActionEvent event) throws Exception  {
	Stage primaryStage =new Stage();
	Parent root =FXMLLoader.load(getClass().getResource("Menu.fxml"));
               primaryStage.setTitle("Welcome To Foody Menu");
	Scene scene = new Scene(root);
	primaryStage.setScene(scene);
	primaryStage.show();
               
           // Hide this current window (if this is what you want)
           ((Node)(event.getSource())).getScene().getWindow().hide();
}
 
Example 27
Source Project: mapper-generator-javafx   Source File: ExportController.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * mapper 文件夹选择器
 */
@FXML
public void mapperDirectoryScan() {
    File directory = FileDirChooserFactory.createDirectoryScan(null, StringUtils.isEmpty(this.baseDir) ? null : this.baseDir);
    if (directory != null) {
        mapperLocationText.setText(directory.getPath());
        this.baseDir = directory.getPath();
    }
}
 
Example 28
Source Project: SlidesRemote   Source File: MainController.java    License: Apache License 2.0 5 votes vote down vote up
@FXML
private void onRefresh() {
    comboNetworkName.getItems().clear();
    networkAddresses = NetworkUtils.getMyIPv4Addresses();

    if(!networkAddresses.isEmpty()) {

        for(String key: networkAddresses.keySet()) {
            comboNetworkName.getItems().add(key);
        }
        changeQRCodeImg();
    }
}
 
Example 29
Source Project: SlidesRemote   Source File: MainController.java    License: Apache License 2.0 5 votes vote down vote up
@FXML
private void onStart() {
    socketServer = new SocketServer();
    if(RegexChecker.isIP(lblIpAddress.getText())) {
        socketServer.start();
        lblStatus.setText("Connected");
    } else {
        lblStatus.setText("Disconnected");
    }
}
 
Example 30
@FXML
void chargeUpX(ActionEvent event) {
  logger.finest("Charge X-axis up");
  xAxisCharge = xAxisCharge + 1;
  XYPlot plot = getChart().getXYPlot();
  kendrickVariableChanged(plot);
}