예제 #1
2
  public static void message(String msg, StackPane pane) {

    Label warningL = new Label(msg);
    Labels.setLabelStyle(warningL, Custom.TEXT_SIZE_LARGER, true);
    warningL.setTextAlignment(TextAlignment.CENTER);

    StackPane warningPane = new StackPane();
    warningPane.getChildren().add(warningL);
    warningPane.setStyle(Custom.WINDOW_STYLING);
    warningPane.setMinWidth(Custom.SCREEN_WIDTH * 95 / 100);
    warningPane.setMaxWidth(Custom.SCREEN_WIDTH * 95 / 100);
    warningPane.setMinHeight(Custom.SCREEN_HEIGHT * 2 / 5);
    warningPane.setMaxHeight(Custom.SCREEN_HEIGHT * 2 / 5);
    warningPane.setBorder(
        new Border(
            new BorderStroke(
                Paint.valueOf("#000000"),
                BorderStrokeStyle.SOLID,
                new CornerRadii(30),
                new BorderWidths(5))));

    pane.getChildren().add(warningPane);

    PauseTransition pause = new PauseTransition(Duration.millis(1500));
    pause.setOnFinished(
        (f) -> {
          pane.getChildren().remove(warningPane);
          goBack();
        });
    pause.play();
  }
예제 #2
0
  @Override
  void setUpScene() {
    Line baseline = new Line(0, getMyHeight() * 2 / 3, getMyWidth(), getMyHeight() * 2 / 3);
    baseline.setStrokeWidth(8);
    baseline.setFill(Color.ROSYBROWN);
    Line midline =
        new Line(getMyWidth() * .55, getMyHeight() * 2 / 3, getMyWidth() * .45, getMyHeight());
    midline.setStrokeWidth(8);
    Circle midCirc = new Circle(getMyWidth() / 2, getMyHeight() * 5 / 6, 15);
    midCirc.setStrokeWidth(6);
    Label timerLabel = new Label(Double.toString(getTimeRemaining()));
    timerLabel.setTextFill(Color.BLACK);
    timerLabel.setStyle("-fx-font-size: 4em;");
    timerLabel.setLayoutX(getMyWidth() / 2 - getMyWidth() * .05);
    timerLabel.setLayoutY(getMyHeight() * .2);
    setTimerLabel(timerLabel);
    setThrowBalllbl(new Label("'Space' -> Throw Ball"));
    getThrowBalllbl().visibleProperty().set(false);
    getThrowBalllbl().setStyle("-fx-font-size: 3em;");
    getThrowBalllbl().setLayoutY(getMyHeight() - 50);

    getMyRoot()
        .getChildren()
        .addAll(
            getTimerLabel(),
            getTimerButtonVBox(),
            getThrowBalllbl(),
            baseline,
            midline,
            midCirc,
            getMyPlayerIV(),
            villainPlayerIV,
            getMyLivesHBox(),
            getEnemyLivesHBox());
  }
 private Label createNoMatchingUsersLabel() {
   Label noMatchingUsersLabel = new Label(MESSAGE_NO_MATCHES);
   noMatchingUsersLabel.setPrefHeight(40);
   noMatchingUsersLabel.setPrefWidth(398);
   noMatchingUsersLabel.setAlignment(Pos.CENTER);
   return noMatchingUsersLabel;
 }
  private void populateAdminHeaders() {

    HashMap<String, String> adminMap = Main.getAdminDetails();
    adminAgencyName.setText(adminMap.get("name"));
    adminMobileLabel.setText(adminMap.get("mobile"));
    adminAddrLabel.setText(adminMap.get("addr"));
  }
  private boolean handleSitLeave(
      boolean bSit,
      int iPlayerPosition,
      Label lblPlayer,
      TextField txtPlayer,
      ToggleButton btnSitLeave,
      HBox HBoxPlayerCards) {
    if (bSit == false) {
      Player p = new Player(txtPlayer.getText(), iPlayerPosition);
      mainApp.AddPlayerToTable(p);
      lblPlayer.setText(txtPlayer.getText());
      lblPlayer.setVisible(true);
      btnSitLeave.setText("Leave");
      txtPlayer.setVisible(false);
      bSit = true;
    } else {
      mainApp.RemovePlayerFromTable(iPlayerPosition);
      btnSitLeave.setText("Sit");
      txtPlayer.setVisible(true);
      lblPlayer.setVisible(false);
      HBoxPlayerCards.getChildren().clear();
      bSit = false;
    }

    return bSit;
  }
예제 #6
0
  public void openImageFile(Resource resource) {
    Tab tab = new Tab();
    tab.setClosable(true);
    if (resource == null) {
      Dialogs.create()
          .owner(tabPane)
          .title("Datei nicht vorhanden")
          .message(
              "Die angeforderte Datei ist nicht vorhanden und kann deshalb nicht geöffnet werden.")
          .showError();
      return;
    }
    tab.setText(resource.getFileName());

    ImageResource imageResource = (ImageResource) resource;
    ImageViewerPane pane = new ImageViewerPane();
    pane.setImageResource(imageResource);

    ImageView imageView = pane.getImageView();
    imageView.setImage(imageResource.asNativeFormat());
    imageView.setFitHeight(-1);
    imageView.setFitWidth(-1);

    Label imagePropertiesLabel = pane.getImagePropertiesLabel();
    imagePropertiesLabel.setText(imageResource.getImageDescription());

    tab.setContent(pane);
    tab.setUserData(resource);
    tabPane.getTabs().add(tab);
    tabPane.getSelectionModel().select(tab);
  }
예제 #7
0
  private void updateGeometry() {
    final List<Geometry> geoms = new ArrayList<>();
    if (coords.size() == 1) {
      // single point
      final Geometry geom = GEOMETRY_FACTORY.createPoint(coords.get(0));
      JTS.setCRS(geom, map.getCanvas().getObjectiveCRS2D());
      geoms.add(geom);
    } else if (coords.size() == 2) {
      // line
      final Geometry geom =
          GEOMETRY_FACTORY.createLineString(coords.toArray(new Coordinate[coords.size()]));
      JTS.setCRS(geom, map.getCanvas().getObjectiveCRS2D());
      geoms.add(geom);
    } else if (coords.size() > 2) {
      // polygon
      final Coordinate[] ringCoords = coords.toArray(new Coordinate[coords.size() + 1]);
      ringCoords[coords.size()] = coords.get(0);
      final LinearRing ring = GEOMETRY_FACTORY.createLinearRing(ringCoords);
      final Geometry geom = GEOMETRY_FACTORY.createPolygon(ring, new LinearRing[0]);
      JTS.setCRS(geom, map.getCanvas().getObjectiveCRS2D());
      geoms.add(geom);
    }
    layer.getGeometries().setAll(geoms);

    if (geoms.isEmpty()) {
      uiArea.setText("-");
    } else {
      uiArea.setText(
          NumberFormat.getNumberInstance()
              .format(
                  MeasureUtilities.calculateArea(
                      geoms.get(0), map.getCanvas().getObjectiveCRS2D(), uiUnit.getValue())));
    }
  }
  private void updateIdentity() {
    Identity identity = clientConfiguration.getSelectedIdentity();

    browseNav.setManaged(identity != null);
    contactsNav.setManaged(identity != null);
    syncNav.setManaged(identity != null);
    // inviteNav.setManaged(identity != null);
    selectedIdentity.setVisible(identity != null);
    // feebbackNav.setVisible(identity != null);

    avatarContainer.setVisible(identity != null);
    if (identity == null) {
      return;
    }

    final String currentAlias = identity.getAlias();
    if (currentAlias.equals(lastAlias)) {
      return;
    }

    new AvatarView(e -> currentAlias).getViewAsync(avatarContainer.getChildren()::setAll);
    alias.setText(currentAlias);
    lastAlias = currentAlias;

    if (clientConfiguration.getAccount() == null) {
      return;
    }
    mail.setText(clientConfiguration.getAccount().getUser());
  }
예제 #9
0
 private void setPrefix(String str) {
   if (!prefixLb.isVisible()) {
     prefixLb.setVisible(true);
     prefixLb.setManaged(true);
   }
   prefixLb.setText(str);
 }
 public void setResults(BenchmarkResult results) {
   double p = (double) results.score / 100;
   double marginalError = (1.96 * Math.sqrt((p * (1 - p)) / results.signatures.size())) * 100;
   pctLabel.setText(
       results.score
           + "% \u00B1 "
           + Math.round(marginalError)
           + "% ("
           + results.matched
           + "/"
           + results.signatures.size()
           + ")");
   for (SignatureResult result : results.signatures) {
     if (result.matched) {
       Label lbl =
           new Label(
               ""
                   + String.format(
                       "0x%06X -> 0x%06X", result.sourcePosition, result.matchedPosition)
                   + result.toString());
       lbl.setFont(Font.font("monospace"));
       resultList.getItems().add(lbl);
     }
   }
 }
 /**
  * Sets the text for the labels that shows the character fields pertaining to the user's character
  * and account:
  *
  * <ul>
  *   <li>Username
  *   <li>Character attributes: strength, speed, endurance, agility
  * </ul>
  */
 private void showAccountAttributes() {
   usernameLabel.setText(Main.account.getUsername());
   strengthLabel.setText(Integer.toString(attributes.getStrength()));
   speedLabel.setText(Integer.toString(attributes.getSpeed()));
   enduranceLabel.setText(Integer.toString(attributes.getEndurance()));
   agilityLabel.setText(Integer.toString(attributes.getAgility()));
 }
예제 #12
0
  public Notification(Stage stage, int type, String message) {
    try {
      FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Notification.fxml"));
      fxmlLoader.setController(this);
      vbox = (VBox) fxmlLoader.load();
    } catch (IOException e) {
      e.printStackTrace();
    }

    if (type == INFO) {
      fxLabelTitle.setText("Information");
      fxImageViewLogo.setImage(
          new Image(vbox.getClass().getResource(IMAGE_DIRECTORY + "info.png").toExternalForm()));
    } else if (type == SUCCESS) {
      fxLabelTitle.setText("Success");
      fxImageViewLogo.setImage(
          new Image(vbox.getClass().getResource(IMAGE_DIRECTORY + "success.png").toExternalForm()));
    } else if (type == WARNING) {
      fxLabelTitle.setText("Warning");
      fxImageViewLogo.setImage(
          new Image(vbox.getClass().getResource(IMAGE_DIRECTORY + "warning.png").toExternalForm()));
    } else if (type == ERROR) {
      fxLabelTitle.setText("Error");
      fxImageViewLogo.setImage(
          new Image(vbox.getClass().getResource(IMAGE_DIRECTORY + "error.png").toExternalForm()));
    }

    if (!message.equals("")) {
      fxLabelMessage.setText(message);
    }

    show(stage);
  }
예제 #13
0
 /**
  * Utility method to discover the {@code Paint} used by {@code Label}
  *
  * @return Base Paint use of Labels
  */
 public static Paint getBaseTextColor() {
   final Label label = new Label(BASE_COLOR);
   final Scene scene = new Scene(new Group(label));
   scene.getRoot().styleProperty().setValue(getStyleProperty().getValue());
   label.applyCss();
   return label.getTextFill();
 }
예제 #14
0
  @Override
  public void bindData(Star data) throws NullPointerException {
    titleOut.setText(data.getTitle());
    ratingOut.setText(new DecimalFormat("#.#").format(data.getRating()));

    new Thread(
            () -> {
              Image image =
                  new Image(
                      "file:"
                          + PersistenceManager.getInstance().getRootPath()
                          + EAltaiPersistence.STAR_MAIN_IMG_RELATIVE_PATH.getValue()
                          + data.getMainImage());
              double imgH = image.getHeight();
              double imgW = image.getWidth();

              Rectangle2D viewPort;
              if (imgH > imgW) {
                viewPort = new Rectangle2D(0, (imgH / 2) - (imgW / 2), imgW, imgW);
              } else if (imgH < imgW) {
                viewPort = new Rectangle2D((imgW / 2) - (imgH / 2), 0, imgH, imgH);
              } else {
                viewPort = new Rectangle2D(0, 0, imgH, imgW);
              }

              Platform.runLater(
                  () -> {
                    mainImg.setViewport(viewPort);
                    mainImg.setImage(image);
                  });
            })
        .start();
  }
예제 #15
0
  private void runThread() {
    try {
      while (!isFinished) {
        Thread.sleep(everyupdates);
        currentTime += 1;

        if (currentTime < taskSeconds) {
          Platform.runLater(
              () -> {
                double percentageToShow = (currentTime * 100 / taskSeconds);
                double progressPercentage = (currentTime * 1.0 / taskSeconds);

                lblStatus.setText(String.format("%s %%", Double.toString(percentageToShow)));
                prgStatus.setProgress(progressPercentage);
                lblRemainingTime.setText(
                    String.format("Remaining time: %s seconds", taskSeconds - currentTime));
              });

        } else {
          isFinished = true;
        }
      }

      listener.onProgressFinished();
    } catch (Exception ex) {

    }
  }
  /** Handle the KeyEvent when ENTER is pressed in TextInput */
  private void handleInput() {
    upPressed = false;
    String input;
    String response;
    input = textInput.getText();
    cmdHistory.addCommand(input);

    try {
      if (input.equals(COMMAND_HELP)) {
        mainApp.switchToHelp();
        textInput.clear();
        return;
      }

      logicOut = TaskieLogic.getInstance().execute(input);

      // logicOut can never be null as returned by Logic
      assert !(logicOut == null);
      // main list can never be empty as the first element is always a description of the content in
      // the list
      assert !(logicOut.getMain().isEmpty());

      populate(logicOut.getMain(), logicOut.getAll());
      response = logicOut.getFeedback();
      feedbackLabel.setText(response);
      textInput.clear();
    } catch (UnrecognisedCommandException e) {
      logger.log(Level.FINE, "invalid command at input", e);
      feedbackLabel.setText(INVALID_COMMAND_MESSAGE);
    }
  }
예제 #17
0
 /** Sets the events for each label in the grid. */
 private void setEvents() {
   for (Label label : labels) {
     label.setOnMouseClicked(
         event -> {
           int index = gridPane.getRowIndex(label);
           chosenPlugin[0] = plugins.get(index).get(0);
           curIndex = index;
           chosenPlugin[1] = plugins.get(index).get(1);
           chosenPreview = preview.get(index).get(0);
           description = appData.get(index).get(1);
           goToNextScreen("/fxml/PluginInfo.fxml");
         });
   }
   for (ImageView image : iconsView) {
     image.setOnMouseClicked(
         event -> {
           int index = gridPane.getRowIndex(image);
           chosenPlugin[0] = plugins.get(index).get(0);
           curIndex = index;
           chosenPlugin[1] = plugins.get(index).get(1);
           chosenPreview = preview.get(index).get(0);
           description = appData.get(index).get(1);
           goToNextScreen("/fxml/PluginInfo.fxml");
         });
   }
 }
예제 #18
0
 /** Action taken on button click Continue. Creates a player or displays an error. */
 @FXML
 public final void confirmChoices() {
   if (textName.getText().isEmpty()) {
     lblWarning.setText("Please enter a name.");
   } else {
     if (playerCount > 0) {
       // Gets the currently picked color
       final String pickedColor = cmbColor.getValue();
       // Create new player
       final Player tempPlayer =
           new Player(textName.getText(), cmbRace.getValue(), cmbColor.getValue());
       main.addPlayer(tempPlayer); // Add new player
       // Remove picked Color from list
       cmbColor.getItems().remove(pickedColor);
       // Sets combo boxes back to zero index
       cmbColor.getSelectionModel().select(0);
       cmbRace.getSelectionModel().select(0);
       textName.clear();
       lblWarning.setText("");
       playerCount--; // Decrement player count after creation
       playerNum++; // Increment player Label number
       lblPlayerNum.setText("Player " + playerNum + ": Choose Your Options");
     } else {
       // If just one player, and end case for last player
       final Player tempPlayer =
           new Player(textName.getText(), cmbRace.getValue(), cmbColor.getValue());
       main.addPlayer(tempPlayer);
       // Display the map Screen to start game
       main.showMapScreen();
     }
   }
 }
예제 #19
0
  public TelaAux(String mensagem) {
    this.mensagem = mensagem;

    BorderPane root = new BorderPane();
    Scene scene = new Scene(root, 450, 80, Color.LIGHTGRAY);

    VBox boxtexto = new VBox(10);

    Label texto = new Label(getMensagem());
    Button ok = new Button("OK");
    ok.setStyle("-fx-cursor: hand;");

    boxtexto.getChildren().addAll(texto, ok);
    boxtexto.setAlignment(Pos.CENTER);

    root.setCenter(boxtexto);
    texto.setFont(new Font(15));
    setScene(scene);
    setOpacity(0.9);
    initModality(
        Modality.APPLICATION_MODAL); // Responsável por só ser possível voltar ao sg ong se fechar a
    // janela.
    show();

    ok.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent arg0) {
            close();
          }
        });
  }
예제 #20
0
  public AlertHandler(String message, EventHandler<ActionEvent> confirmHandler) {
    super(14);

    // add controls to the popup.
    final Label promptMessage = new Label(message);
    final ImageView alertImage = new ImageView(ResourceUtil.getImage("alert_48.png"));
    alertImage.setFitHeight(32);
    alertImage.setPreserveRatio(true);
    promptMessage.setGraphic(alertImage);
    promptMessage.setWrapText(true);
    promptMessage.setPrefWidth(350);

    // action button text setup.
    HBox buttonBar = new HBox(20);
    final Button confirmButton = new Button(getString("dialog.continue"));
    confirmButton.setDefaultButton(true);

    buttonBar.getChildren().addAll(confirmButton);

    // layout the popup.
    setPadding(new Insets(10));
    getStyleClass().add("alert-dialog");
    getChildren().addAll(promptMessage, buttonBar);

    final DropShadow dropShadow = new DropShadow();
    setEffect(dropShadow);

    // confirm and close the popup.
    confirmButton.setOnAction(confirmHandler);
  }
예제 #21
0
  public void confirm(ActionEvent event) {
    String name = nameField.getText();
    if (S.isEmpty(name)) {
      tipsLabel.setText("错误:工具名字不能为空!");
      nameField.requestFocus();
      return;
    }
    String command = commandText.getText();
    String order = orderField.getText();
    ToolsTray bandeja = (ToolsTray) parentCombo.getSelectionModel().getSelectedItem();
    Integer parentId = bandeja.getId();
    ToolType toolType = (ToolType) typeCombo.getSelectionModel().getSelectedItem();
    String type = toolType.getToolType();

    ToolsTray toolsTray = new ToolsTray();
    toolsTray.setTrayName(name);
    toolsTray.setCommand(command);
    toolsTray.setParentId(parentId);
    toolsTray.setToolOrder(order);
    toolsTray.setToolType(type);
    if (null == id) {
      dao.insert(toolsTray);
      id = toolsTray.getId();
      tipsLabel.setText("添加成功:" + name);
    } else {
      toolsTray.setId(id);
      dao.update(toolsTray);
      tipsLabel.setText("更新成功:" + name);
    }
    refresh(null);
  }
예제 #22
0
 public void setTime() {
   DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
   DateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
   Date date = new Date();
   timeLabel.setText(timeFormat.format(date));
   dateLabel.setText(dateFormat.format(date));
 }
예제 #23
0
  @FXML
  private void buttonListenerEdit(ActionEvent event) {
    Employee emp = new Employee();

    try {
      emp.setId(Integer.parseInt(tfInfoId.getText()));
      emp.setName(tfInfoName.getText());
      emp.setPosition(tfInfoPos.getText());
      emp.setStreet(tfInfoStreet.getText());
      StringTokenizer tokens = new StringTokenizer(tfInfoCSZ.getText(), ","); // REQ#2
      String cityState = tokens.nextToken().toString();
      String zip = tokens.nextToken();
      emp.setCity(cityState.substring(0, cityState.length() - 3));
      emp.setState(cityState.substring(cityState.length() - 2));
      emp.setZip(zip);
      emp.setPayRate(Double.parseDouble(tfInfoPayRate.getText()));
      Environment.updateEmployee(emp);
      lblEditConfirm.setText("Employee Updated");
    } catch (MinimumWageException e) { // REQ#11 REQ#12
      lblWageError.setVisible(true);
    } catch (Exception e) {
      lblEditConfirm.setText("Error Could Not Update Employee");
    }

    if (rbHourly.isSelected()) {
      initialize();
      populateHourlyEmployee();
    } else if (rbSalary.isSelected()) {
      initialize();
      populateSalaryEmployee();
    }
  }
 public void setKoersen(String koersen) {
   Platform.runLater(
       () -> {
         label1.setText(koersen);
         label2.setText(koersen);
       });
 }
예제 #25
0
  /**
   * uploads File into currently selected Task.
   *
   * @param event
   * @throws ClassNotFoundException
   * @throws IOException
   * @throws SQLException
   */
  @FXML
  private void uploadFile(ActionEvent event)
      throws ClassNotFoundException, IOException, SQLException {

    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Open Resource File");
    File file = fileChooser.showOpenDialog(mainStage).getAbsoluteFile();

    // FileUtils.copyFileToDirectory(file, FileUtils.getFile(super.getPath(file.getName())), true);
    File selectedDir = new File(super.getPath("files"));
    FileUtils.copyFileToDirectory(file, new File(selectedDir.getAbsolutePath()));
    shl.getCurrentTab().addFile("File-" + file.getName(), file);

    download.setText("Upload done!");
    download.setTextFill(Color.GREEN);

    super.saveShell();
    super.saveLog(
        shl.getCurrentUser().getID()
            + " - "
            + shl.getCurrentUser().getName()
            + " - "
            + "UPLOADED "
            + file.getName());

    System.out.println("File uploaded as " + file.toString());
  }
  @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.");
  }
  public void initialize() throws IOException {

    lblMessage.setText("");
    lblMessage.setText("Send Oil Change Reminder Message?");

    btnCancelMessage.setOnAction(
        e -> {
          // System.exit(0);
          Stage stageBox = (Stage) btnCancelMessage.getScene().getWindow();
          stageBox.close();
        });
    btnSendMessage.setOnAction(
        e -> {
          lblMessage.setText("");
          lblMessage.setText("Message Sent!");

          try {
            btnCancelMessage.setAlignment(Pos.CENTER);
            btnSendMessage.setVisible(false);
            btnCancelMessage.setText("Done!");
            Parent stageBox = btnCancelMessage.getParent();
            ((BorderPane) stageBox).setCenter(btnCancelMessage);
          } catch (Exception exception) {
          }
        });
  }
예제 #28
0
 /** {@inheritDoc} */
 @Override
 protected Modello buildEntity() {
   Modello modello = new Modello();
   try {
     if (id != 0) {
       modello.setId(id);
     }
     modello.setTipoCarburante(tipoCarburante.getSelectionModel().getSelectedItem());
     modello.setCapacitàBagagliaio(Integer.parseInt(capacitàBagagliaio.getText()));
     modello.setNumeroPorte(Integer.parseInt(numeroPorte.getText()));
     modello.setMarca(marca.getText());
     modello.setNome(nome.getText());
     modello.setEmissioniCO2(Double.parseDouble(emissioniCO2.getText()));
     modello.setNumeroPosti(Integer.parseInt(numeroPosti.getText()));
     modello.setPotenza(Integer.parseInt(potenza.getText()));
     modello.setPeso(Integer.parseInt(peso.getText()));
     modello.setTrasmissioneAutomatica(trasmissioneAutomatica.selectedProperty().get());
     if (!fascia.getText().isEmpty())
       modello.setFascia((Fascia) controller.processRequest("ReadFascia", fascia.getText()));
     else modello.setFascia(null);
     return modello;
   } catch (Exception e) {
     return null;
   }
 }
예제 #29
0
  @Override
  public void initialize() {
    disputesTable = new TableView<>();
    VBox.setVgrow(disputesTable, Priority.SOMETIMES);
    disputesTable.setMinHeight(150);
    root.getChildren().add(disputesTable);

    TableColumn<Dispute, Dispute> tradeIdColumn = getTradeIdColumn();
    disputesTable.getColumns().add(tradeIdColumn);
    TableColumn<Dispute, Dispute> roleColumn = getRoleColumn();
    disputesTable.getColumns().add(roleColumn);
    TableColumn<Dispute, Dispute> dateColumn = getDateColumn();
    disputesTable.getColumns().add(dateColumn);
    TableColumn<Dispute, Dispute> contractColumn = getContractColumn();
    disputesTable.getColumns().add(contractColumn);
    TableColumn<Dispute, Dispute> stateColumn = getStateColumn();
    disputesTable.getColumns().add(stateColumn);

    disputesTable.getSortOrder().add(dateColumn);
    disputesTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    Label placeholder = new Label("There are no open tickets");
    placeholder.setWrapText(true);
    disputesTable.setPlaceholder(placeholder);
    disputesTable.getSelectionModel().clearSelection();

    disputeChangeListener = (observableValue, oldValue, newValue) -> onSelectDispute(newValue);
  }
 private void setFg(int change) {
   int tmp = cfg + change;
   if (tmp >= 0 && tmp < this.figures.size() && this.figures.size() > 0) {
     cfg += change;
     GenericElement fg = this.figures.get(cfg);
     fgName.setText((String) fg.getAttr("name").getValue());
     fgLive.setText(fg.getAttr("live").getValue().toString());
     fgType.setText((String) fg.getAttr("type").getValue());
     fgDestroy.setText(fg.getAttr("destroy").getValue().toString());
     fgDescription.setText((String) fg.getAttr("description").getValue());
     // validate if the picture already exist
     try {
       fgGC.setFill(Color.WHITE);
       fgGC.fillRect(0, 0, 200, 200);
       fgGC.drawImage(
           new Image(new File((String) fg.getAttr("picture").getValue()).toURI().toString()),
           0,
           0,
           200,
           200);
     } catch (Exception npe) {
       npe.printStackTrace();
     }
   }
 }