@Override
 public void acaoFinalizar() {
   if (validarFormulario()) {
     String idContaOrigem = contaOrigem.getSelectionModel().getSelectedItem().getIdCategoria();
     String idContaDestino = contaDestino.getSelectionModel().getSelectedItem().getIdCategoria();
     if (acao == Acao.CADASTRAR) {
       Transferencia item =
           new Transferencia(
               null,
               idContaOrigem,
               idContaDestino,
               itemController.getIdItem(),
               descricao.getText(),
               valor.getText(),
               data.getValue(),
               Datas.getHoraAtual());
       item.cadastrar();
       new Conta().alterarSaldo(Operacao.DECREMENTAR, idContaOrigem, valor.getText());
       new Conta().alterarSaldo(Operacao.INCREMENTAR, idContaDestino, valor.getText());
       Kernel.principal.acaoTransferencia();
       Janela.showTooltip(Status.SUCESSO, idioma.getMensagem("operacao_sucesso"), Duracao.CURTA);
       Animacao.fadeInOutClose(formulario);
     } else {
       Boolean contaOrigemMudou = !(Modelo.getIdContaOrigem().equals(idContaOrigem));
       if (contaOrigemMudou) {
         new Conta()
             .alterarSaldo(Operacao.INCREMENTAR, Modelo.getIdContaOrigem(), Modelo.getValor());
         new Conta().alterarSaldo(Operacao.DECREMENTAR, idContaOrigem, Modelo.getValor());
       }
       Modelo.setIdContaOrigem(contaOrigem.getValue());
       Boolean contaDestinoMudou = !(Modelo.getIdContaDestino().equals(idContaDestino));
       if (contaDestinoMudou) {
         new Conta()
             .alterarSaldo(Operacao.DECREMENTAR, Modelo.getIdContaDestino(), Modelo.getValor());
         new Conta().alterarSaldo(Operacao.INCREMENTAR, idContaDestino, Modelo.getValor());
       }
       Modelo.setIdContaDestino(contaDestino.getValue());
       Boolean valorMudou = !(Modelo.getValor().equals(valor.getText()));
       if (valorMudou) {
         BigDecimal valorDiferenca = new BigDecimal(Modelo.getValor());
         valorDiferenca = valorDiferenca.subtract(new BigDecimal(valor.getText()));
         new Conta()
             .alterarSaldo(
                 Operacao.INCREMENTAR, Modelo.getIdContaOrigem(), valorDiferenca.toString());
         new Conta()
             .alterarSaldo(
                 Operacao.DECREMENTAR, Modelo.getIdContaDestino(), valorDiferenca.toString());
       }
       Modelo.setValor(valor.getText());
       Modelo.setDescricao(descricao.getText());
       Modelo.setData(data.getValue());
       Modelo.alterar();
       Kernel.principal.acaoTransferencia();
       Janela.showTooltip(Status.SUCESSO, idioma.getMensagem("operacao_sucesso"), Duracao.CURTA);
       Animacao.fadeInOutClose(formulario);
     }
   }
 }
Ejemplo n.º 2
0
 @FXML
 public void handleSaveButtonAction() {
   model.saveSettings(
       (settings) -> {
         if (!goldField.getText().isEmpty()) {
           settings.setGoldThreshold(Integer.parseInt(goldField.getText()));
         }
         if (!elixirField.getText().isEmpty()) {
           settings.setElixirThreshold(Integer.parseInt(elixirField.getText()));
         }
         if (!deField.getText().isEmpty()) {
           settings.setDarkElixirThreshold(Integer.parseInt(deField.getText()));
         }
         if (!maxThField.getText().isEmpty()) {
           settings.setMaxThThreshold(Integer.parseInt(maxThField.getText()));
         }
         settings.setDetectEmptyCollectors(detectEmptyCollectorsCheckBox.isSelected());
         settings.setMatchAllConditions(isMatchAllConditionsCheckBox.isSelected());
         settings.setCollectResources(collectResourcesCheckBox.isSelected());
         settings.setTrainMaxTroops(toInt(trainTroopsSlider.getValue()));
         settings.setLogLevel(logLevelComboBox.getValue());
         settings.setAttackStrategy(autoAttackComboBox.getValue());
         settings.getRaxInfo()[0] = rax1ComboBox.getValue();
         settings.getRaxInfo()[1] = rax2ComboBox.getValue();
         settings.getRaxInfo()[2] = rax3ComboBox.getValue();
         settings.getRaxInfo()[3] = rax4ComboBox.getValue();
         settings.getRaxInfo()[4] = rax5ComboBox.getValue();
         settings.getRaxInfo()[5] = rax6ComboBox.getValue();
         settings.setExtraFunctions(extraFuncCheckBox.isSelected());
       });
   showSettings(false);
 }
Ejemplo n.º 3
0
 private void handleAction() {
   if (xmlLoader.getValue() != null) {
     AbstractGrid newScreen =
         ConfigManager.getAbstractGrid(
             ConfigManager.getString(
                 ConfigManager.scope(this.getClass().getName(), selected.iconName)),
             xmlLoader.getValue());
     nextScreen = newScreen;
   } else {
     Alert uhoh = new Alert(AlertType.ERROR);
     uhoh.setTitle("whoops");
     uhoh.setContentText("please select an XML file");
     uhoh.showAndWait();
   }
 }
  @FXML
  void fromComboBoxAction(ActionEvent event) {
    // fromComboBox.setItems(options);
    /*
    if(fromClicked && toClicked && !lastClicked.equals("from")){
        fromBoxList.setAll(options);
        toBoxList.setAll(options);
        toClicked=false;
        System.out.println("both combo box has been clicked");
    }
    */

    /*System.out.println("now fromBoxList of size "+ fromBoxList.size()+ " will be setAll()");
    fromComboBox.setItems(fromBoxList);
    */

    // fromComboBox=new ComboBox(fromBoxList);
    String s = (String) fromComboBox.getValue();
    c.setFrom(s);

    if (fromComboBox.getValue() == toComboBox.getValue()) {
      toComboBox
          .getSelectionModel()
          .clearSelection(); // to clear the selected option in the other combo box, because the
                             // starting point and destination can't be the same
      c.setTo(null);
      // toComboBox.setButtonCell(null);
      // toComboBox.valueProperty().set(null);
      // toComboBox.getSelectionModel().clearSelection();
    }

    // System.out.println(s.getClass());
    // System.out.println(s);
    System.out.println("from " + s);

    // temp.remove(s);
    /*
    fromClicked=true;
    fromCombo=s;
    lastClicked="from";
    //options.removeAll(s);
    if(fromClicked && !toClicked){
        toBoxList.remove(fromCombo);
        System.out.println("removing "+fromCombo+" from the list and after removing, the size of the toBoxList= "+toBoxList.size());
        toComboBox.setItems(toBoxList);
    }
    */
  }
Ejemplo n.º 5
0
  public void open() throws IOException {

    paneCenter.getChildren().clear();

    String station = (String) cbStations.getValue();

    File f = new File("database\\" + station + "\\status.txt");
    FileReader fr1 = new FileReader(f);
    LineNumberReader ln = new LineNumberReader(fr1);
    int count = 0;
    while (ln.readLine() != null) {
      count++;
    }
    ln.close();
    fr1.close();

    FileReader fr2 = new FileReader(f);
    BufferedReader br = new BufferedReader(fr2);

    paneCenter.add(new Label("Last seen : " + (br.readLine())), 0, 0);

    for (int i = 1; i < count; i++) {
      paneCenter.add(new Label(br.readLine()), 0, i);
    }
    br.close();
    fr2.close();

    addQuantityToCB();
  }
Ejemplo n.º 6
0
  @Override
  public void save(IMemento memento) {
    IMemento group = memento.createChild("agents");
    for (AgentInfo info : _agents) {
      IMemento child = group.createChild("agent");
      child.putString("field", info.field);
      child.putString("value", info.value);
    }

    memento.putString("chart-type", _chartType.getValue().toString());

    String nucId = _filters.getValue();
    if (nucId != null) {
      IMemento filter = memento.createChild("filter");
      filter.putString("nuc-id", nucId);
    }

    // axis options
    IMemento axis = memento.createChild("axis-opt");
    axis.putBoolean("mode", _chart.axisMode().get() == CyclistAxis.Mode.LINEAR);
    axis.putBoolean("force-zero", _chart.forceZero().get());

    // chart options
    IMemento chart = memento.createChild("chart-opt");
    chart.putBoolean("mode", _chart.getMode().get() == ChartMode.LINE);
    chart.putBoolean("total", _chart.getShowTotal().getValue());
  }
Ejemplo n.º 7
0
 public void makeBoard(Cell[][] cells) {
   if (stageGridPane != null) {
     // Устанавливаем размер клетки
     stageGridPane.getColumnConstraints().add(new ColumnConstraints(10));
     stageGridPane.getRowConstraints().add(new RowConstraints(10));
     if (cells[0][0] == null) {
       fillCircuit();
     }
     // Заполняем массив клеток основного поля и выводим его на экран
     for (int i = 1; i < cells.length - 1; i++) {
       stageGridPane.addRow(i);
       for (int j = 1; j < cells[0].length - 1; j++) {
         stageGridPane.addColumn(j);
         Cell tempRect = new Cell(10, 10, Color.WHITE, i, j);
         if (cells[i][j] == null) {
           stageGridPane.add(cells[i][j] = tempRect, i, j);
         } else {
           if (cells[i][j].isRoad) {
             cells[i][j].setFill(Color.BLUE);
           }
         }
         cells[i][j].setStroke(Color.BLACK);
         cells[i][j].setOnMouseClicked(
             t -> {
               switch (CellType.getValue()) {
                 case "Wall":
                   if (tempRect.getFill() == Color.BLACK) {
                     tempRect.setFill(Color.WHITE);
                     tempRect.isBlocked = false;
                   } else {
                     tempRect.setFill(Color.BLACK);
                     tempRect.isBlocked = true;
                   }
                   break;
                 case "Start":
                   if (tempRect.getFill() == Color.GREEN) {
                     tempRect.setFill(Color.WHITE);
                     start = null;
                   } else if (start == null) {
                     tempRect.setFill(Color.GREEN);
                     start = tempRect;
                   }
                   break;
                 case "End":
                   if (tempRect.getFill() == Color.RED) {
                     tempRect.setFill(Color.WHITE);
                     finish = null;
                   } else if (finish == null) {
                     tempRect.setFill(Color.RED);
                     finish = tempRect;
                   }
                   break;
               }
             });
       }
     }
   } else {
     System.err.print("stageGridPane is null");
   }
 }
Ejemplo n.º 8
0
 /**
  * @param event Triggered by set button under the combobox
  *     <p>Sets the game mode to either setter or guesser
  */
 public void setMode(ActionEvent event) {
   if (modeSet.getValue() == "Setter") {
     reset();
     guessSet.setDisable(false);
     guessSet.setText("Set Solution");
     setPins.setDisable(false);
     guessSet.setOnAction(
         new EventHandler<ActionEvent>() {
           @Override
           public void handle(ActionEvent e) {
             setSolution();
           }
         });
   } else {
     reset();
     guessSet.setText("Guess");
     setPins.setDisable(true);
     deleteButton.setDisable(false);
     guessSet.setOnAction(
         new EventHandler<ActionEvent>() {
           @Override
           public void handle(ActionEvent e) {
             addGuess(e);
           }
         });
   }
 }
  @FXML
  public void handleFromKey(KeyEvent evt) {
    /*
    String character = evt.getCharacter();
    if(!character.equals("1"))
    {
        //JOptionPane.showMessageDialog(null,evt.getCharacter());
        System.out.println("You typed " + evt.getCharacter());
        evt.consume();
    }
        */
    KeyCode code = evt.getCode();
    System.out.println("Code " + code);
    /*
       if (KeyCode.DELETE == code) System.out.println("Del");

       char ar[] = evt.getCharacter().toCharArray();
       char ch = ar[evt.getCharacter().toCharArray().length - 1];
       System.out.println("You entered " + String.valueOf(ar));
       if (!(ch >= '0' && ch <= '9') &&
    */
    if (!(code.isDigitKey()) && !(KeyCode.BACK_SPACE.equals(code) || KeyCode.DELETE == code)) {
      System.out.println("The char you entered is not a number");
      evt.consume();
    } else {
      final String text = ((TextField) evt.getSource()).getText();
      System.out.println("You entered " + text);
      /*
      Measurement from = AbstractMeasurement.of(new BigDecimal(text), fromCombo.getValue());
      System.out.println("From " + from);
      Measurement to = from.to(toCombo.getValue());
      System.out.println("To " + to);*/
      if (fromCombo != null
          && fromCombo.getValue() != null
          && toCombo != null
          && toCombo.getValue() != null) {
        UnitConverter converter = fromCombo.getValue().getConverterTo(toCombo.getValue());
        if (text != null && !text.isEmpty()) {
          Number convertedValue = converter.convert(Double.valueOf(text));
          System.out.println("Converted: " + convertedValue);
          toFld.setText(FORMAT.format(convertedValue));
        } else if (toFld.getText() != null && !toFld.getText().isEmpty()) {
          toFld.clear();
        }
      }
    }
  }
Ejemplo n.º 10
0
  private void setFont() {
    FontWeight weight;
    if (bold.isSelected()) {
      weight = FontWeight.BOLD;
    } else {
      weight = FontWeight.NORMAL;
    }

    FontPosture posture;
    if (italic.isSelected()) {
      posture = FontPosture.ITALIC;
    } else {
      posture = FontPosture.REGULAR;
    }

    newText.setFont(Font.font(fontChoice.getValue(), weight, posture, sizeChoice.getValue()));
  }
  @FXML
  protected void handleButtonAction(ActionEvent event) {

    // TODO vaidation...

    Integer length = generateLengthComboBox.getValue();
    if (length == null) {
      // TODO
      return;
    }
    String characterTypeText = generateCharacterTypeComboBox.getValue();
    if (characterTypeText == null) {
      return;
    }
    String generatedText =
        CharacterType.characterTypeOfText(characterTypeText).generate(length.intValue());
    generatedTextField.setText(generatedText);
  }
  @Override
  public void initialize(URL location, ResourceBundle resources) {
    // TODO 自動生成されたメソッド・スタブ
    addOption.setOnAction(
        event -> {
          for (int i = 0; i < cmb.size(); i++) {
            //				System.out.println(cmb.get(i).getValue());
            if (cmb.get(i).getValue() == null) {
              break;
            } else if (i == cmb.size() - 1) {
              addTask.setDisable(false);
            }
          }
        });

    addTask.setOnAction(
        event -> {
          try {
            String url = webView.getEngine().getLocation();
            System.out.println(url);
            Document document = Jsoup.connect(url).get();

            Elements input = document.select("input");

            Map params = new HashMap<String, String>();
            for (ComboBox cmbx : cmb) {
              ValuePair vp = (ValuePair) cmbx.getValue();
              params.put(vp.getName(), vp.getvalue());
            }
            //				System.out.println(input.select("[name=shop_bid]").first());
            //				System.out.println(input.select("[name=shop_bid]").first().val());
            params.put("shop_bid", input.select("[name=shop_bid]").first().val());
            params.put("item_id", input.select("[name=item_id]").first().val());
            params.put("__event", input.select("[name=__event]").first().val());
            params.put("units", "1");

            Map map = new HashMap<String, Long>();

            //				System.out.println(document.select("#stime").size());
            if (document.select("#stime").size() != 0) {
              System.out.println(document.select("#stime"));
              map.put("stime", Long.parseLong((input.select("#stime").first().val())));
              map.put("etime", Long.parseLong((input.select("#etime").first().val())));
            } else {
              map = null;
            }

            BuyTask task = new BuyTask(url, params, map);
            task.call();
            this.getScene().getWindow().hide();
          } catch (Exception e) {
            // TODO 自動生成された catch ブロック
            e.printStackTrace();
          }
        });
  }
 @FXML
 private void handlerEnviar() {
   if (combo.getValue() != "Sucursal") {
     SistemaEncomienda.getInstance()
         .enviarMensaje(
             SistemaEncomienda.getInstance().compararSucursal(combo.getValue().toString()),
             SistemaEncomienda.getInstance()
                 .devolverMensaje(
                     mensaje.getText(),
                     SistemaEncomienda.getInstance().compararSucursal(combo.getValue().toString()),
                     SistemaEncomienda.getInstance()
                         .compararSucursal(SistemaEncomienda.getInstance().getSucursalActual()),
                     asunto.getText()));
     mainApp.mostrarMenuComo(SistemaEncomienda.getInstance().getSucursalActual());
     mainApp.mostrarMessage("Haz enviado un mensaje");
   } else {
     mainApp.mostrarMessage("Elige una sucursal");
   }
 }
  public void setupDialog(Dialog<String> urlInputDialog) {
    urlInputDialog
        .getDialogPane()
        .getButtonTypes()
        .add(new ButtonType("Open...", ButtonData.OK_DONE));
    urlInputDialog.getDialogPane().getButtonTypes().add(ButtonType.CANCEL);

    urlInputDialog.setResultConverter(
        b -> {
          if (b.getButtonData() == ButtonData.OK_DONE && urlCombo.getValue() != null) {
            if (!recentItems.contains(urlCombo.getValue())) {
              recentItems.add(urlCombo.getValue());
            }

            return urlCombo.getValue();
          }
          return null;
        });
  }
  @FXML
  private void asignar(ActionEvent event) {
    Tbbloque bloq = new Tbbloque();
    Tbpregunta preg = new Tbpregunta();

    if (bloque.getValue() != null && pregunta.getValue() != null) {
      for (int i = 0; i < resultsbloque.size(); i++) {
        if (bloque.getValue().equals(resultsbloque.get(i).getNombre())) {
          bloq = resultsbloque.get(i);
        }
      }
      for (int i = 0; i < resultspregunta.size(); i++) {
        if (pregunta.getValue().equals(resultspregunta.get(i).getNombre())) {
          preg = resultspregunta.get(i);
        }
      }
      bloqxpre.setIdbloque(bloq);
      bloqxpre.setIdpregunta(preg);
      bloqxpregbd.create(bloqxpre);
    }
    limpiar();
  }
Ejemplo n.º 16
0
 /**
  * JavaFX event triggered when the user selects a new shape type
  *
  * @param e the JavaFX event
  */
 @FXML
 protected void typeChanged(ActionEvent e) {
   switch (type.getValue()) {
     case TYPE_RECTANGLE:
       shape.setShapeType(ReactiveShape.RECTANGLE);
       break;
     case TYPE_CIRCLE:
       shape.setShapeType(ReactiveShape.CIRCLE);
       break;
     case TYPE_TRIANGLE:
       shape.setShapeType(ReactiveShape.TRIANGLE);
       break;
   }
 }
  public void creatGame(ActionEvent event) throws IOException {

    if (cbst1.getValue() == null || cbst2.getValue() == null) {
      Alert alert = new Alert(AlertType.ERROR);
      alert.setTitle("No Teams Selected");
      alert.setHeaderText(null);
      alert.setContentText("Please select teams.");
      alert.showAndWait();
    } else if (cbst1.getValue().equals(cbst2.getValue())) {
      Alert alert = new Alert(AlertType.ERROR);
      alert.setTitle("Identical teams selected");
      alert.setHeaderText(null);
      alert.setContentText("A team cannot play itself. Please select two different teams.");
      alert.showAndWait();
    } else {
      ((Node) (event.getSource())).getScene().getWindow().hide();
      Stage primaryStage = new Stage();
      Parent root = FXMLLoader.load(getClass().getResource("BatchGamePage.fxml"));
      Scene scene = new Scene(root);
      primaryStage.setScene(scene);
      primaryStage.show();
    }
  }
Ejemplo n.º 18
0
  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();
        }
      }
    }
  }
Ejemplo n.º 19
0
 private Student getStudent() {
   Student stu =
       (this.studentList.getSelectionModel().getSelectedItem() != null)
           ? this.studentList.getSelectionModel().getSelectedItem()
           : this.needToPay.getSelectionModel().getSelectedItem();
   stu.setName(name.getText());
   stu.setAddres(address.getText());
   stu.setDateOfBirth(super.getDateFromPicker(dob));
   stu.setEmail(email.getText());
   stu.setGender(male.isSelected());
   stu.setModification(new Date());
   stu.setNrcNumber(nrc.getText());
   stu.setPhone(phone.getText());
   stu.setTownship(townships.getValue());
   return stu;
 }
Ejemplo n.º 20
0
  public void showHistory() {
    provider = getProvider(selectProviderCb.getValue());

    try {
      FXMLLoader loader =
          new FXMLLoader(getClass().getResource("/main/by/ggtu/dzmitry/view/History.fxml"));
      AnchorPane layout = (AnchorPane) loader.load();
      HistoryController historyController = loader.getController();
      Scene scene = new Scene(layout);
      Stage stage = new Stage();
      stage.setScene(scene);
      stage.show();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  public void addPlayer(ActionEvent event) {

    if (cbst.getValue() == null) {
      Alert alert = new Alert(AlertType.ERROR);
      alert.setTitle("No Team Selected");
      alert.setHeaderText(null);
      alert.setContentText("Please select a team.");
      alert.showAndWait();
    } else {
      TextInputDialog dialog = new TextInputDialog();
      dialog.setTitle("Text Input Dialog");
      dialog.setHeaderText(null);
      dialog.setContentText("Please enter Player name:");
      String actualresult = " ";
      Optional<String> result = dialog.showAndWait();
    }
  }
Ejemplo n.º 22
0
 @Override
 protected Node createStart() {
   Node startButton = super.createStart();
   VBox startGroup = new VBox(10);
   ComboBox<String> levelChoice = new ComboBox<>();
   levelChoice.setOnAction(e -> levelFilename = levelChoice.getValue());
   levelChoice.getItems().addAll(getLevelFilenames());
   if (!levelChoice.getItems().isEmpty()) {
     levelChoice.getSelectionModel().clearAndSelect(0);
     levelFilename = levelChoice.getItems().get(0);
   } else {
     startButton.setDisable(true);
   }
   startGroup.getChildren().add(levelChoice);
   startGroup.getChildren().add(startButton);
   startGroup.setAlignment(Pos.CENTER);
   return startGroup;
 }
 private void CargarComboPreg() {
   pregunta.getItems().clear();
   for (int i = 0; i < resultspregunta.size(); i++) {
     Boolean agregar = true;
     for (int j = 0; j < resultsbloqxpreg.size(); j++) {
       if (resultsbloqxpreg
               .get(j)
               .getIdpregunta()
               .getNombre()
               .equals(resultspregunta.get(i).getNombre())
           && resultsbloqxpreg.get(j).getIdbloque().getNombre().equals(bloque.getValue())) {
         agregar = false;
       }
     }
     if (agregar) {
       pregunta.getItems().add(resultspregunta.get(i).getNombre());
     }
   }
 }
Ejemplo n.º 24
0
  public Node buildNuclideCtrl() {
    VBox vbox = new VBox();
    vbox.getStyleClass().add("infobar");

    Text title = new Text("Nuclide");
    title.getStyleClass().add("title");

    _filters.getStyleClass().add("nuclide");

    _filters.setPromptText("filter");
    _filters.setEditable(true);
    _filters.setItems(_nuclideFilterNames);

    _filters.valueProperty().addListener(o -> selectNuclideFilter(_filters.getValue()));

    vbox.getChildren().addAll(title, _filters);
    ;
    return vbox;
  }
Ejemplo n.º 25
0
 @FXML
 protected void Guardar(ActionEvent event) {
   if (txtCarrera.getText().trim().isEmpty()
       | txtJefe.getText().trim().isEmpty()
       | txtMatricula.getText().trim().isEmpty()
       | txtSiglas.getText().trim().isEmpty()) {
     lblMensaje.setText("Campos vacios");
   } else {
     Carrera nuevaCarrera =
         new Carrera(
             txtCarrera.getText(),
             txtSiglas.getText(),
             txtJefe.getText(),
             Integer.valueOf(txtMatricula.getText()),
             cboAcreditada.getValue());
     cdCarrera datos = new cdCarrera();
     lblMensaje.setText(datos.guardar(nuevaCarrera));
     Limpiar();
     LLenarTabla();
   }
 }
Ejemplo n.º 26
0
  public void showGraph() {
    Stage secondaryStage = new Stage();

    String quantity = (String) cbQuantity.getValue().toString();
    secondaryStage.setTitle(quantity);

    LineChart<Long, Number> lc = null;

    switch (quantity) {
      case "Wind Speed":
        windSerie.add(new XYChart.Series<>("Wind Speed", windData));
        lc = new LineChart<>(new DateAxis(), new NumberAxis("Value", 0, 130, 10), windSerie);
        break;

      case "Temperature":
        temperatureSerie.add(new XYChart.Series<>("Temperature", temperatureData));
        lc = new LineChart<>(new DateAxis(), new NumberAxis("Value", 0, 50, 10), temperatureSerie);
        break;

      case "Rainfall Rate":
        rainfallSerie.add(new XYChart.Series<>("Rainfall Rate", rainfallData));
        lc = new LineChart<>(new DateAxis(), new NumberAxis("Value", 0, 100, 10), rainfallSerie);
        break;

      case "Humidity":
        humiditySerie.add(new XYChart.Series<>("Humidity", humidityData));
        lc = new LineChart<>(new DateAxis(), new NumberAxis("Value", 0, 100, 10), humiditySerie);
        break;

      case "Pressure":
        pressureSerie.add(new XYChart.Series<>("Pressure", pressureData));
        lc = new LineChart<>(new DateAxis(), new NumberAxis("Value", 0, 20, 10), pressureSerie);
        break;
    }

    graphic = new Scene(lc, 500, 250);

    secondaryStage.setScene(graphic);
    secondaryStage.show();
  }
Ejemplo n.º 27
0
  private void runSandbox(File fileToRun) {
    try {
      Platform.runLater(
          new Runnable() {
            @Override
            public void run() {
              taLog.setText(S_EMPTY);
            }
          });

      String language = comboBoxVMLanguage.getValue();

      if (language != null) {
        List<File> compileList = new ArrayList<>();

        for (Tab tab : tabPane.getTabs()) {
          EditorPane pane = (EditorPane) tab.getContent();

          File sourceFile = pane.getSourceFile();

          if (sourceFile != null) {
            if (LanguageManager.isCompilable(language, sourceFile)) {
              compileList.add(sourceFile);
            }
          }
        }

        if (compileList.size() > 0) {
          sandbox.runSandbox(language, compileList, fileToRun);
        } else {
          log("Nothing to compile?");
        }
      }
    } catch (Exception e) {
      logger.error("Sandbox failure", e);
    }
  }
Ejemplo n.º 28
0
  @FXML
  protected void Actualizar(ActionEvent evento) {
    if (carreraModificada != null) {
      if (txtCarrera.getText().trim().isEmpty()
          | txtJefe.getText().trim().isEmpty()
          | txtMatricula.getText().trim().isEmpty()
          | txtSiglas.getText().trim().isEmpty()) {
        lblMensaje.setText("Campos vacios");
      } else {
        carreraModificada.setNombre(txtCarrera.getText());
        carreraModificada.setSiglas(txtSiglas.getText());
        carreraModificada.setJefeCarrera(txtJefe.getText());
        carreraModificada.setMatricula(Integer.valueOf(txtMatricula.getText()));
        carreraModificada.setAcreditada(cboAcreditada.getValue());

        cdCarrera datos = new cdCarrera();
        lblMensaje.setText(datos.actualizar(carreraModificada));
        Limpiar();
        LLenarTabla();
      }
    } else {
      lblMensaje.setText("Seleccione una fila de la tabla");
    }
  }
Ejemplo n.º 29
0
 @FXML
 private void apply() {
   getPresenter().changeLanguageOption(languages.getValue());
   getPresenter().reloadViews();
 }
Ejemplo n.º 30
0
  public void addQuantityToCB() throws IOException {

    temperatureSerie.removeAll();
    pressureSerie.removeAll();
    windSerie.removeAll();
    rainfallSerie.removeAll();
    humiditySerie.removeAll();

    cbQuantity.getItems().clear();

    String station = (String) cbStations.getValue();
    File f = new File("database\\" + station + "\\data.txt");

    FileReader fr1 = new FileReader(f);
    LineNumberReader ln = new LineNumberReader(fr1);
    int count = 0;
    while (ln.readLine() != null) {
      count++;
    }
    ln.close();
    fr1.close();

    FileReader fr2 = new FileReader(f);
    BufferedReader br = new BufferedReader(fr2);

    boolean wsFlag = false;
    boolean prFlag = false;
    boolean teFlag = false;
    boolean huFlag = false;
    boolean rrFlag = false;

    for (int i = 0; i < count; i++) {

      String line = br.readLine();
      String[] words = line.split(" ");

      for (int j = 0; j < words.length; j++) {

        if (words[0].equals("") == false) {

          long timeValue = Long.parseLong(words[0]);

          if (words[j].equals("WS")) {
            windData.add(new XYChart.Data<Long, Number>(timeValue, Integer.parseInt(words[j + 2])));
            if (wsFlag == false) {
              cbQuantity.getItems().add("Wind Speed");

              wsFlag = true;
            }
          } else if (words[j].equals("PR")) {
            pressureData.add(
                new XYChart.Data<Long, Number>(timeValue, Integer.parseInt(words[j + 2])));
            if (prFlag == false) {
              cbQuantity.getItems().add("Pressure");
              prFlag = true;
            }
          } else if (words[j].equals("TE")) {
            temperatureData.add(
                new XYChart.Data<Long, Number>(timeValue, Integer.parseInt(words[j + 2])));
            if (teFlag == false) {
              cbQuantity.getItems().add("Temperature");
              teFlag = true;
            }
          } else if (words[j].equals("HU")) {
            humidityData.add(
                new XYChart.Data<Long, Number>(timeValue, Integer.parseInt(words[j + 2])));
            if (huFlag == false) {
              cbQuantity.getItems().add("Humidity");
              huFlag = true;
            }
          } else if (words[j].equals("RR")) {
            rainfallData.add(
                new XYChart.Data<Long, Number>(timeValue, Integer.parseInt(words[j + 2])));
            if (rrFlag == false) {
              cbQuantity.getItems().add("Rainfall Rate");
              rrFlag = true;
            }
          }
        }
      }
    }
    br.close();
    fr2.close();
  }