@Test
  public void observableList() throws Exception {
    ObservableList<String> source = FXCollections.observableArrayList();
    source.addAll("alpha", "beta");
    ObservableList<String> dest = ObservableMirrors.mirrorList(source, gate);
    Queue<ListChangeListener.Change<? extends String>> changes = new LinkedList<>();
    dest.addListener(changes::add);

    // Expect a single change with two added items.
    source.addAll("gamma", "delta");
    assertEquals(1, gate.getTaskQueueSize());
    gate.waitAndRun();
    ListChangeListener.Change<? extends String> change = changes.poll();
    change.next();
    assertTrue(change.wasAdded());
    assertEquals(2, change.getAddedSize());
    assertEquals(ImmutableList.of("gamma", "delta"), change.getAddedSubList());

    // Expect four queued changes with coherent/correct deltas unaffected by later changes to the
    // src list.
    source.remove(3); // remove delta
    source.add("phi");
    source.remove(3); // remove phi
    source.add("epsilon");
    assertEquals(4, gate.getTaskQueueSize());
    gate.waitAndRun();
    gate.waitAndRun();
    change = changes.poll();
    change.next();
    assertTrue(change.wasRemoved());
    assertEquals(1, change.getRemovedSize());
    assertEquals("delta", change.getRemoved().get(0));
    change = changes.poll();
    change.next();
    assertTrue(change.wasAdded());
    assertEquals("phi", change.getAddedSubList().get(0));
    gate.waitAndRun();
    changes.poll();
    gate.waitAndRun();
    changes.poll();

    // Expect a set on the source list to show up as a replace event on the dest list.
    source.set(0, "zero");
    gate.waitAndRun();
    change = changes.poll();
    change.next();
    assertTrue(change.toString(), change.wasReplaced());
    assertEquals(0, change.getFrom());
    assertEquals(1, change.getTo());
    assertEquals("zero", change.getAddedSubList().get(0));
  }
  private void initData() {

    typeData.clear();
    typeData.addAll(ToolType.allToolTypes());

    List<ToolsTray> bandejaList =
        dao.query(ToolsTray.class, Cnd.where("toolType", "=", C.TOOL_TYPE_TRAY_FOLDER));

    superData.clear();
    ToolsTray bandeja1 = new ToolsTray();
    bandeja1.setId(C.ROOT_PARENT_ID);
    bandeja1.setTrayName("--无父目录--");
    superData.add(bandeja1);
    superData.addAll(bandejaList);

    searchData.clear();
    ToolsTray bandeja = new ToolsTray();
    bandeja.setTrayName("--全部--");
    searchData.add(bandeja);
    searchData.add(bandeja1);
    searchData.addAll(bandejaList);

    tableData.clear();
    tableData.addAll(dao.query(ToolsTray.class, null));
  }
  @FXML
  private void genararb(ActionEvent event) {
    tablabloque.getColumns().clear();
    String[] titulos = {
      "Numero", "bloque", "Fecha De Creacion", "Fecha De Modificacion",
    };

    for (int i = 0; i < titulos.length; i++) {
      final int j = i;
      this.titulo = new TableColumn(titulos[i]);
      this.titulo.setCellValueFactory(
          new Callback<
              TableColumn.CellDataFeatures<ObservableList, String>, ObservableValue<String>>() {
            @Override
            public ObservableValue<String> call(
                TableColumn.CellDataFeatures<ObservableList, String> parametro) {
              return new SimpleStringProperty((String) parametro.getValue().get(j));
            }
          });
      tablabloque.getColumns().addAll(titulo);
      // Asignamos un tamaño a ls columnnas
      titulo.setMinWidth(120);

      // Centrar los datos de la tabla
      titulo.setCellFactory(
          new Callback<TableColumn<String, String>, TableCell<String, String>>() {
            @Override
            public TableCell<String, String> call(TableColumn<String, String> p) {
              TableCell cell =
                  new TableCell() {
                    @Override
                    protected void updateItem(Object t, boolean bln) {
                      if (t != null) {
                        super.updateItem(t, bln);
                        setText(t.toString());
                        setAlignment(Pos.CENTER); // Setting the Alignment
                      }
                    }
                  };
              return cell;
            }
          });
    }

    tbbloque = FXCollections.observableArrayList();
    for (Tbbloque bloq : resultsbloque) {
      ObservableList<String> row = FXCollections.observableArrayList();
      row.add(bloq.getId().toString());
      row.add(bloq.getNombre());
      row.add(df1.format(bloq.getFechacreacion()));
      System.out.print(bloq.getFechacreacion());
      String fecha =
          bloq.getFechamodificacion() == null
              ? bloq.getFechamodificacion() + ""
              : df1.format(bloq.getFechamodificacion());
      row.add(fecha);
      tbbloque.addAll(row);
    }
    tablabloque.setItems(tbbloque);
  }
  public void editar(int opcion, int codigo, String campo, int lista) {

    if (tablaResultados.getSelectionModel().getSelectedItem() != null) {
      if (!nombre.equalsIgnoreCase(campo)) {
        consulta.editarGCJT(opcion, codigo, campo);
        if (consulta.getMensaje() != null) {
          Utilidades.mensajeAdvertencia(
              null, consulta.getMensaje(), "Error al editar la selección", "Error Guardar Cambios");
        } else {
          Utilidades.mensaje(
              null,
              "Los cambios se han guardado correctamente",
              "Editando Selección",
              "Actualización Exitosa");
          listaDatos.clear();
          listaDatos.addAll(consulta.llenarLista2(lista));
        }
      } else {
        Utilidades.mensaje(
            null, "No se han presentado cambios", "Editando Selección", "Editar Selección");
      }
    } else {
      Utilidades.mensaje(
          null, "Debe seleccionar un item de la lista", "Editando Selección", "Editar Selección");
    }
  }
Example #5
0
  public void updateRobotList() {
    HashMap<String, RobotViewModel> robots = RobotRepository.getInstance().getRobots();

    ObservableList<RobotViewModel> observableRobots = FXCollections.observableArrayList();
    observableRobots.addAll(robots.values());
    list_robots.setItems(observableRobots);
  }
  private void CargarTabla() {
    tablabloque.getColumns().clear();
    String[] titulos = {
      "Bloque", "Pregunta",
    };

    for (int i = 0; i < titulos.length; i++) {
      final int j = i;
      this.titulo = new TableColumn(titulos[i]);
      this.titulo.setCellValueFactory(
          new Callback<
              TableColumn.CellDataFeatures<ObservableList, String>, ObservableValue<String>>() {
            @Override
            public ObservableValue<String> call(
                TableColumn.CellDataFeatures<ObservableList, String> parametro) {
              return new SimpleStringProperty((String) parametro.getValue().get(j));
            }
          });
      tablabloque.getColumns().addAll(titulo);
      // Asignamos un tamaño a ls columnnas
      if (i == 0) {
        titulo.setMinWidth(120);
      } else {
        titulo.setMinWidth(450);
      }

      // Centrar los datos de la tabla
      titulo.setCellFactory(
          new Callback<TableColumn<String, String>, TableCell<String, String>>() {
            @Override
            public TableCell<String, String> call(TableColumn<String, String> p) {
              TableCell cell =
                  new TableCell() {
                    @Override
                    protected void updateItem(Object t, boolean bln) {
                      if (t != null) {
                        super.updateItem(t, bln);
                        setText(t.toString());
                        setAlignment(Pos.CENTER); // Setting the Alignment
                      }
                    }
                  };
              return cell;
            }
          });
    }

    tbbloque = FXCollections.observableArrayList();
    for (Tbbloquesxpregunta bloqxpreg : resultsbloqxpreg) {
      ObservableList<String> row = FXCollections.observableArrayList();
      row.add(bloqxpreg.getIdbloque().getNombre());
      row.add(bloqxpreg.getIdpregunta().getNombre());
      tbbloque.addAll(row);
    }
    tablabloque.setItems(tbbloque);
  }
  @FXML
  public void listar(ActionEvent evento) {

    listaDatos.clear();
    if (comboListar.getSelectionModel().getSelectedIndex() == 0) {
      listaDatos.addAll(consulta.llenarLista2(6));
    }
    if (comboListar.getSelectionModel().getSelectedIndex() == 1) {
      listaDatos.addAll(consulta.llenarLista2(7));
    }
    if (comboListar.getSelectionModel().getSelectedIndex() == 2) {
      listaDatos.addAll(consulta.llenarLista2(8));
    }
    if (comboListar.getSelectionModel().getSelectedIndex() == 3) {
      listaDatos.addAll(consulta.llenarLista2(5));
    }
    txtfNombre.setText("");
    txtfNombre.setDisable(true);
  }
 /** Creates and returns data for PieChart. */
 private ObservableList<Data> getPieData() {
   ObservableList<Data> pieData = FXCollections.observableArrayList();
   pieData.addAll(
       new PieChart.Data("java", 17.56),
       new PieChart.Data("C", 17.06),
       new PieChart.Data("PHP", 6.0),
       new PieChart.Data("(Visual)Basic", 4.76),
       new PieChart.Data("Other", 31.37));
   return pieData;
 }
  public void search(ActionEvent event) {

    ToolsTray bandeja = (ToolsTray) searchCombo.getSelectionModel().getSelectedItem();
    List<ToolsTray> bandejaList;
    if (null == bandeja || null == bandeja.getId()) {
      bandejaList = dao.query(ToolsTray.class, null);
    } else {
      bandejaList = dao.query(ToolsTray.class, Cnd.where("parentId", "=", bandeja.getId()));
    }
    tableData.clear();
    tableData.addAll(bandejaList);
  }
Example #10
0
  private void setupVMLanguages() {
    List<String> vmLanguageList = config.getVMLanguageList();

    addVMLanguages(config);

    vmLanguageList = config.getVMLanguageList();

    Collections.sort(vmLanguageList);

    languageList.addAll(vmLanguageList);

    comboBoxVMLanguage.getSelectionModel().select(VM_LANGUAGE_JAVA);
  }
Example #11
0
 void updatePlaylists() {
   if (interfaceDisabled) return;
   final ObservableList<Playlist> items = playlistsView.getItems();
   items.clear();
   items.addAll(Cache.playlists());
   if (Settings.rememberedPlaylistId != null)
     for (Playlist p : items) {
       if (p.getId().equals(Settings.rememberedPlaylistId)) {
         rememberedPlaylist = p;
         break;
       }
     }
 }
  @Override
  @SuppressWarnings("unchecked")
  public void getSettings(final Map<NewFileWizard.Settings, Object> map) {
    fileNameField.setText((String) map.get(NewFileWizard.Settings.DATABASE_NAME));
    defaultCurrencyField.setText(map.get(NewFileWizard.Settings.DEFAULT_CURRENCY).toString());

    final ObservableList<CurrencyNode> currencyNodes = FXCollections.observableArrayList();
    currencyNodes.addAll(
        (Collection<? extends CurrencyNode>) map.get(NewFileWizard.Settings.CURRENCIES));
    currencyNodes.add((CurrencyNode) map.get(NewFileWizard.Settings.DEFAULT_CURRENCY));
    FXCollections.sort(currencyNodes);

    currenciesList.getItems().setAll(currencyNodes);
  }
Example #13
0
  private void setUpCreditDescription() {
    ListView<String> centerView = new ListView<>();
    centerView.setEditable(false);
    centerView.setDisable(true);
    ObservableList<String> data = FXCollections.observableArrayList();
    data.addAll(
        "Условия кредита:",
        "  - от 1 года до 3х лет",
        "  - до 50 млн. рублей",
        "  - досрочное погашение",
        "  - ежемесячная уплата процентов");
    centerView.setItems(data);
    centerView.getStyleClass().add("credit-view_list-view");

    this.setCenter(centerView);
  }
Example #14
0
  /** Sestaví nové okno. */
  public Stage build() {
    if (onCloseEvent != null) stage.setOnCloseRequest(onCloseEvent);
    if (onHidingEvent != null) stage.setOnHiding(onHidingEvent);

    scene.setRoot(root);
    ObservableList<String> styleSheets = scene.getStylesheets();
    styleSheets.addAll(
        styles
            .stream()
            .map(style -> "file:///" + (fm.getFolderCSS() + style).replace("\\", "/"))
            .collect(Collectors.toList()));

    stage.setScene(scene);
    stage.setOnCloseRequest(event -> stage.close());
    return stage;
  }
  @FXML
  void initialize() {
    assert null != gridPane
        : "fx:id=\"gridPane\" was not injected: check your FXML file 'UploadMonetization.fxml'.";
    assert null != monetizeOverlay
        : "fx:id=\"monetizeOverlay\" was not injected: check your FXML file 'UploadMonetization.fxml'.";
    assert null != monetizeProduct
        : "fx:id=\"monetizeProduct\" was not injected: check your FXML file 'UploadMonetization.fxml'.";
    assert null != monetizeSyndication
        : "fx:id=\"monetizeSyndication\" was not injected: check your FXML file 'UploadMonetization.fxml'.";
    assert null != monetizeTrueView
        : "fx:id=\"monetizeTrueView\" was not injected: check your FXML file 'UploadMonetization.fxml'.";

    monetizeSyndication.setItems(syndicationList);
    syndicationList.addAll(Syndication.values());
    monetizeSyndication.getSelectionModel().selectFirst();
  }
  private void drawRebootSuspectLine(XYChart<Number, ? extends Number> target) {

    if (target.getData().isEmpty() || target.getData().get(0).getData().isEmpty()) {
      return;
    }

    AnchorPane anchor =
        (AnchorPane)
            target
                .getParent()
                .getChildrenUnmodifiable()
                .stream()
                .filter(n -> n instanceof AnchorPane)
                .findAny()
                .get();
    ObservableList<Node> anchorChildren = anchor.getChildren();
    anchorChildren.clear();

    NumberAxis xAxis = (NumberAxis) target.getXAxis();
    Axis yAxis = target.getYAxis();
    Label chartTitle =
        (Label)
            target
                .getChildrenUnmodifiable()
                .stream()
                .filter(n -> n.getStyleClass().contains("chart-title"))
                .findFirst()
                .get();

    double startX = xAxis.getLayoutX() + 4.0d;
    double yPos = yAxis.getLayoutY() + chartTitle.getLayoutY() + chartTitle.getHeight();
    List<Rectangle> rectList =
        summaryData
            .get()
            .getRebootSuspectList()
            .stream()
            .map(d -> d.atZone(ZoneId.systemDefault()).toEpochSecond())
            .map(
                s ->
                    new Rectangle(
                        xAxis.getDisplayPosition(s) + startX, yPos, 4d, yAxis.getHeight()))
            .peek(r -> ((Rectangle) r).setStyle("-fx-fill: yellow;"))
            .collect(Collectors.toList());
    anchorChildren.addAll(rectList);
  }
  /**
   * Populate the ListView and TreeView (left and right window respectively) with content returned
   * by TaskieLogic.
   *
   * @param mainList ArrayList to be displayed on left window wrapped in LogicOutput class returned
   *     by Logic
   * @param allList 2D ArrayList to be displayed on right window wrapped in LogicOutput class
   *     returned by Logic
   */
  private void populate(ArrayList<String> mainList, ArrayList<ArrayList<String>> allList) {
    clearNode();
    populateNode(overdueNode, allList.get(OVERDUE_LOGICOUT_INDEX));
    populateNode(todayNode, allList.get(TODAY_LOGICOUT_INDEX));
    populateNode(tomorrowNode, allList.get(TOMORROW_LOGICOUT_INDEX));
    populateNode(everythingElseNode, allList.get(EVERYTHING_ELSE_LOGICOUT_INDEX));

    String mainFeedback = mainList.get(FEEDBACK_LOGICOUT_INDEX);
    ArrayList<String> mainRemovedFirst = mainList;

    // Extract the first element of mainList and display it on the mainListFeedbackLabel
    // Display the rest of the list on mainListView
    mainRemovedFirst.remove(FEEDBACK_LOGICOUT_INDEX);
    obeservableMainList.removeAll(obeservableMainList);
    obeservableMainList.addAll(mainRemovedFirst);
    mainListFeedbackLabel.setText(mainFeedback);
    mainListView.setItems(obeservableMainList);
  }
Example #18
0
  @FXML
  void refreshPlaylists() {
    infoLabel.setText(res.getString("refreshing"));
    log.info("Refreshing playlists");

    ObservableList<Playlist> items = playlistsView.getItems();
    items.clear();
    items.addAll(Cache.playlists());

    if (Settings.rememberedPlaylistId != null)
      for (Playlist p : items) {
        if (p.getId().equals(Settings.rememberedPlaylistId)) {
          rememberedPlaylist = p;
          break;
        }
      }

    infoLabel.setText(res.getString("playlists_refreshed"));
    log.info("Playlists refreshed");
  }
  private void onListChanged() {
    Log.traceCall();
    list.clear();
    list.addAll(
        tradeManager
            .getTrades()
            .stream()
            .map(PendingTradesListItem::new)
            .collect(Collectors.toList()));

    // we sort by date, earliest first
    list.sort((o1, o2) -> o2.getTrade().getDate().compareTo(o1.getTrade().getDate()));

    // TODO improve selectedItem handling
    // selectedItem does not get set to null if we dont have the view visible
    // So if the item gets removed form the list, and a new item is added we need to check if the
    // old
    // selectedItem is in the new list, if not we know it is an invalid one
    if (list.size() == 1) onSelectTrade(list.get(0));
    else if (list.size() > 1 && (selectedItem == null || !list.contains(selectedItem)))
      onSelectTrade(list.get(0));
    else if (list.size() == 0) onSelectTrade(null);
  }
  private void eliminar(int opcion, int codigo, int lista) {

    if (tablaResultados.getSelectionModel().getSelectedItem() != null) {
      consulta.editarGCJT(opcion, codigo, "");
      if (consulta.getMensaje() != null) {
        Utilidades.mensajeAdvertencia(
            null, consulta.getMensaje(), "Error al eliminar la selección", "Error Guardar Cambios");
      } else {
        Utilidades.mensaje(
            null,
            "La selección se ha eliminado correctamente",
            "Eliminado Selección",
            "Actualización Exitosa");
        listaDatos.clear();
        listaDatos.addAll(consulta.llenarLista2(lista));
      }
    } else {
      Utilidades.mensaje(
          null,
          "Debe seleccionar un item de la lista",
          "Eliminando Selección",
          "Eliminar Selección");
    }
  }
  // METODO ENCARGADO DE CARGAR LOS DATOS A LA TABLA PROVEEDORES
  private void cargarDatosTablaProveedores(ResultSet resultadoProveedores, TableView tabla) {
    tabla.getColumns().clear();
    proveedor = FXCollections.observableArrayList();
    ResultSet resultadoDatosTablaProveedores = resultadoProveedores;

    try {
      // TITULOS DE LAS COLUMNAS
      String[] titulos = {
        "CODIGO", "RUT", "NOMBRE", "TELEFONO", "EMAIL", "TIPO_DE_PRODUCTOS", "ESTADO"
      };

      // AGREGAMOS LOS DATOS A LA TABLA DINAMICAMENTE
      for (int i = 0; i < resultadoDatosTablaProveedores.getMetaData().getColumnCount(); i++) {
        final int j = i;
        col = new TableColumn(titulos[i]);
        col.setCellValueFactory(
            new Callback<
                TableColumn.CellDataFeatures<ObservableList, String>, ObservableValue<String>>() {
              public ObservableValue<String> call(
                  TableColumn.CellDataFeatures<ObservableList, String> parametro) {
                return new SimpleStringProperty((String) parametro.getValue().get(j));
              }
            });
        tabla.getColumns().addAll(col);
        // ASIGNAMOS UN TAMAÑO A LAS COLUMNAS
        col.setMinWidth(140);
        System.out.println("Column [" + i + "] ");
        // CENTRAMOS LOS DATOS EN LA TABLA
        col.setCellFactory(
            new Callback<TableColumn<String, String>, TableCell<String, String>>() {
              @Override
              public TableCell<String, String> call(TableColumn<String, String> p) {
                TableCell cell =
                    new TableCell() {
                      @Override
                      protected void updateItem(Object t, boolean bln) {
                        if (t != null) {
                          super.updateItem(t, bln);
                          System.out.println(t);
                          setText(t.toString());
                          setAlignment(Pos.CENTER_LEFT);
                        }
                      }
                    };
                return cell;
              }
            });
      }

      // CARGAMOS DE LA BASE DE DATOS
      while (resultadoDatosTablaProveedores.next()) {
        // ITERACION DE FILA}
        ObservableList<String> row = FXCollections.observableArrayList();
        for (int i = 1; i <= resultadoDatosTablaProveedores.getMetaData().getColumnCount(); i++) {
          // ITERACION DE COLUMNA
          row.add(resultadoDatosTablaProveedores.getString(i));
        }
        System.out.println("Row [i] added " + row);
        proveedor.addAll(row);
      }
      // FINALMENTE AGREGAMOS A LA TABLA JEFE DE SUCURSAL
      tabla.setItems(proveedor);
      resultadoDatosTablaProveedores.close();
    } catch (SQLException e) {
      System.out.println("Error " + e);
    }
  }
Example #22
0
  public void handle(ActionEvent event) {
    BorderPane pane = new BorderPane();
    Scene scene = new Scene(pane, 550, 300, Color.WHITE);
    Stage stage = new Stage();
    stage.setTitle("Zathura Enterprise ™");
    pane.setPadding(new Insets(20, 20, 20, 20));

    ContaCorrenteController cc = new ContaCorrenteController();
    PessoaFisicaController pfc = new PessoaFisicaController();
    PessoaFisica pf = new PessoaFisica();

    List<String> pfN = new ArrayList<String>();
    List<String> pfC = new ArrayList<String>();
    List<String> lc = new ArrayList<String>();

    try {
      for (int i = 0; i < cc.listarContas().size(); i++) {
        if ('1' == cc.listarContas().get(i).getAtivo()) {
          lc.add(MascaraDeFormatacao.formatar("#####-#", cc.listarContas().get(i).getNumero()));
          pf = pfc.exibir(cc.listarContas().get(i).getCpfCliente());
          pfN.add(pf.getNome());
          pfC.add(MascaraDeFormatacao.formatar("###.###.###-##", pf.getCpf()));
        }
      }

    } catch (ConexaoException e) {
      Erro erro = new Erro(e.getMessage());
      erro.handle(null);
    } catch (PessoaFisicaNullPointerException e) {
      Erro erro = new Erro(e.getMessage());
      erro.handle(null);
    } catch (EnderecoNullPointerException e) {
      Erro erro = new Erro(e.getMessage());
      erro.handle(null);
    }

    ObservableList<String> data = FXCollections.observableArrayList();
    ListView<String> listN = new ListView<String>(data); // LISTA NOME
    listN.setPrefSize(200, 250);
    data.addAll(pfN);
    listN.setItems(data);

    ObservableList<String> data1 = FXCollections.observableArrayList();
    ListView<String> listCPF = new ListView<String>(data); // LISTA CPF
    listCPF.setPrefSize(100, 250);
    data1.addAll(pfC);
    listCPF.setItems(data1);

    ObservableList<String> data2 = FXCollections.observableArrayList();
    ListView<String> listC = new ListView<String>(data); // LISTA CONTA
    listC.setPrefSize(100, 250);
    data2.addAll(lc);
    listC.setItems(data2);

    VBox vbC = new VBox(10);
    Label nome = new Label("Conta");
    nome.setFont(Font.font("Courier New", FontWeight.THIN, 14));
    vbC.getChildren().addAll(nome, listC);

    VBox vbN = new VBox(10);
    Label nome2 = new Label("Nome Completo");
    nome2.setFont(Font.font("Courier New", FontWeight.THIN, 14));
    vbN.getChildren().addAll(nome2, listN);

    VBox vbCPF = new VBox(10);
    Label nome3 = new Label("CPF");
    nome3.setFont(Font.font("Courier New", FontWeight.THIN, 14));
    vbCPF.getChildren().addAll(nome3, listCPF);

    pane.setLeft(vbC); // CONTA
    pane.setCenter(vbN); // NOME
    pane.setRight(vbCPF); // CPF
    stage.setScene(scene);
    stage.showAndWait();
  }
 @Override
 public void initialize(URL location, ResourceBundle resources) {
   java.util.List<ClienteEntity> listaClientes = ControladorCliente.getCliente();
   dataCliente.addAll(listaClientes);
 }
Example #24
0
  @SuppressWarnings("unchecked")
  public StackPane viewStock(String categoryId, String categoryName) {
    stack = new StackPane();

    GridPane grid = new GridPane();

    grid.setVgap(8);
    grid.setPadding(new Insets(30));
    final ObservableList<ItemVO> dataTable;
    // final ObservableList<ItemVO> dataTable1;
    // final ObservableList<ItemVO> dataTable2;
    ObservableList<CategoryTypeVO> typeList;

    Rectangle roundRect =
        RectangleBuilder.create()
            .x(50)
            .y(50)
            .width(Screen.getPrimary().getVisualBounds().getWidth() - 428)
            .height(Screen.getPrimary().getVisualBounds().getHeight() - 150)
            .arcWidth(30)
            .arcHeight(30)
            .build();

    roundRect.setFill(Color.DARKGRAY);
    roundRect.setOpacity(0.2);
    roundRect.setStroke(Color.TRANSPARENT);

    HBox hlabel = new HBox();
    hlabel.setMaxWidth(Screen.getPrimary().getVisualBounds().getWidth() - 170);
    hlabel.setMaxHeight(30);
    hlabel.setStyle("-fx-background-color:black;");
    hlabel.setOpacity(0.3);
    hlabel.setLayoutX(20);

    try {
      typeList = FXCollections.observableArrayList();
      typeList = UtiliesDAO.getUtiliesDAO().fetchTypes(categoryId);

      dataTable = FXCollections.observableArrayList();
      dataTable.addAll(stockDetailsService.viewStock(categoryId));

      /*dataTable1 = FXCollections.observableArrayList();
      dataTable2 = FXCollections.observableArrayList();

      for(int i=0;i<dataTable.size();i++)
      {
      	dataTable1.add(dataTable.get(i++));
      	if(i<=dataTable.size()-1)
      	{
      		dataTable2.add(dataTable.get(i));
      	}
      }*/

      final Label label = new Label(categoryName + " Stock");

      final Text text5 = new Text(25, 175, categoryName + " Stock");
      text5.setFill(Color.DARKORANGE);
      // text5.setFont(Font.font ("Edwardian Script ITC", 50));
      text5.setFont(Font.loadFont("file:resources/fonts/ITCEDSCR.TTF", 50));
      final Light.Distant light = new Light.Distant();
      light.setAzimuth(-135.0);
      final Lighting lighting = new Lighting();
      lighting.setLight(light);
      lighting.setSurfaceScale(9.0);
      text5.setEffect(lighting);

      label.setAlignment(Pos.CENTER_LEFT);
      // grid.add(label,1,0);

      final TableView<ItemVO> table1 = new TableView<ItemVO>();
      table1.setEditable(false);
      // table1.setMaxSize(roundRect.getWidth()*0.41, roundRect.getHeight()*0.519);//400,300
      table1.setMinSize(roundRect.getWidth() * 0.41, roundRect.getHeight() * 0.519); // 400,300
      table1.setMaxSize(roundRect.getWidth() - 50, roundRect.getHeight() - 200);

      table1.getSelectionModel().setCellSelectionEnabled(false);

      table1.setStyle("-fx-background-color: transparent;");

      TableColumn<ItemVO, String> itemName = new TableColumn<ItemVO, String>("Item");
      itemName.setResizable(false);
      itemName.setMaxWidth(roundRect.getWidth() * 0.5);
      itemName.setMinWidth(roundRect.getWidth() * 0.5); // 200
      itemName.setCellValueFactory(new PropertyValueFactory<ItemVO, String>("itemName"));

      TableColumn<ItemVO, Integer> quantity = new TableColumn<ItemVO, Integer>("Quantity#");
      quantity.setResizable(false);
      quantity.setMinWidth(roundRect.getWidth() * 0.107); // 200

      /*quantity.setCellValueFactory(
      new PropertyValueFactory<ItemVO, Integer>("quantity"));*/

      for (final CategoryTypeVO type : typeList) {
        TableColumn<ItemVO, Integer> col = new TableColumn<ItemVO, Integer>(type.getTypeName());
        col.setMinWidth(roundRect.getWidth() * 0.107); // 100
        col.setResizable(false);

        col.setCellValueFactory(
            new Callback<CellDataFeatures<ItemVO, Integer>, ObservableValue<Integer>>() {
              @Override
              public ObservableValue<Integer> call(CellDataFeatures<ItemVO, Integer> item) {
                ItemVO itemVO = item.getValue();
                if (itemVO == null) {
                  return null;
                  // or perhaps
                  // return new ReadOnlyObjectWrapper<Integer>(null);
                } else {
                  ObservableMap<String, ItemTypeVO> itemTypesMap =
                      FXCollections.observableHashMap();
                  itemTypesMap = item.getValue().getListType();

                  return new ReadOnlyObjectWrapper<Integer>(
                      itemTypesMap.get(type.getTypeId()).getQuantity());
                }
              }
            });
        col.setCellFactory(
            new Callback<TableColumn<ItemVO, Integer>, TableCell<ItemVO, Integer>>() {

              @Override
              public TableCell<ItemVO, Integer> call(TableColumn<ItemVO, Integer> paramP) {
                // TODO Auto-generated method stub
                return new TableCell<ItemVO, Integer>() {
                  @Override
                  public void updateItem(Integer item, boolean empty) {
                    super.updateItem(item, empty);
                    if (!isEmpty()) {
                      setText(item.toString());
                      if (item <= 5) {
                        this.getStyleClass().add("celllow");
                        setTextFill(Color.RED);
                      }
                    }
                  }
                };
              }
            });
        quantity.getColumns().add(col);
      }

      if (quantity.getColumns().size() >= 5 && quantity.getColumns().size() <= 7) {
        itemName.setMinWidth(itemName.getWidth() - (quantity.getColumns().size() - 4) * 100);
      }
      if (quantity.getColumns().size() > 7) {
        itemName.setMinWidth(itemName.getWidth() - ((7 - 4) * 100));
      }

      table1.setItems(dataTable);
      final TableColumn[] columns1 = {itemName, quantity};
      table1.getColumns().addAll(columns1);
      table1
          .getColumns()
          .addListener(
              new ListChangeListener() {
                public boolean suspended;

                @Override
                public void onChanged(Change change) {
                  change.next();
                  if (change.wasReplaced() && !suspended) {
                    this.suspended = true;
                    table1.getColumns().setAll(columns1);
                    this.suspended = false;
                  }
                }
              });

      /*//final TableView<ItemVO> table2 = new TableView<ItemVO>();
      table2.setEditable(false);

      table2.setMaxSize(roundRect.getWidth()*0.41, roundRect.getHeight()*0.519);
      table2.setMinSize(roundRect.getWidth()*0.35, roundRect.getHeight()*0.519);//400,300
      table2.setStyle("-fx-background-color: transparent;");

      TableColumn<ItemVO,String> itemName2 = new TableColumn<ItemVO,String> ("Item");
      itemName2.setMinWidth(roundRect.getWidth()*0.3);//200

      itemName2.setCellValueFactory(
      		new PropertyValueFactory<ItemVO, String>("itemName"));

      TableColumn<ItemVO, Integer>  quantity2 = new TableColumn<ItemVO, Integer> ("Quantity#");
      quantity2.setMinWidth(roundRect.getWidth()*0.107);//200
      quantity.setCellValueFactory(
      		new PropertyValueFactory<ItemVO, Integer>("quantity"));



      for (final CategoryTypeVO type : typeList)
      {
      	  TableColumn<ItemVO, Integer> col2 = new TableColumn<ItemVO, Integer>(type.getTypeName());
      	  col2.setMinWidth(roundRect.getWidth()*0.107);//100
      	  col2.setResizable(false);

      	  col2.setCellValueFactory(new Callback<CellDataFeatures<ItemVO,Integer>, ObservableValue<Integer>>() {
      	    @Override
      	    public ObservableValue<Integer> call(CellDataFeatures<ItemVO,Integer> item)
      	    {
      	    	ItemVO itemVO = item.getValue();
      	    	if (itemVO == null)
      	    	{
      	    	  return null ;
      	    	// or perhaps
      	    	// return new ReadOnlyObjectWrapper<Integer>(null);
      	    	}
      	    	else
      	    	{
      		    	ObservableMap<String,ItemTypeVO> itemTypesMap = FXCollections.observableHashMap();
      		    	itemTypesMap = item.getValue().getListType();

      		    	return new ReadOnlyObjectWrapper<Integer>(itemTypesMap.get(type.getTypeId()).getQuantity());

      	    	}

      	    }

      	  });
      	 col2.setCellFactory(new Callback<TableColumn<ItemVO,Integer>, TableCell<ItemVO,Integer>>() {

      		@Override
      		public TableCell<ItemVO, Integer> call(TableColumn<ItemVO, Integer> paramP) {
      			// TODO Auto-generated method stub
      			return new TableCell<ItemVO, Integer>(){
      				@Override
      				public void updateItem(Integer item, boolean empty)
      				{
      					super.updateItem(item, empty);
      					if(item!=null)
      					{
      						setText(item.toString());
      						if(item<=5)
      						{
      							this.getStyleClass().add("celllow");
      							setTextFill(Color.RED);
      						}
      					}

      				}
      			};

      		}
      	});
      	  quantity2.getColumns().add(col2);
      	}


      table2.setItems(dataTable2);
      final TableColumn[] columns2 = {itemName2, quantity2};
      table2.getColumns().addAll(columns2);
      table2.getColumns().addListener(new ListChangeListener() {
            public boolean suspended;

            @Override
            public void onChanged(Change change) {
                change.next();
                if (change.wasReplaced() && !suspended) {
                    this.suspended = true;
                    table2.getColumns().setAll(columns2);
                    this.suspended = false;
                }
            }
        });*/

      Rectangle qtyRect = RectangleBuilder.create().x(50).y(50).width(10).height(10).build();

      qtyRect.setFill(Color.rgb(240, 128, 128));

      grid.add(table1, 0, 12);
      // grid.add(table2,1,12);
      grid.setAlignment(Pos.TOP_CENTER);

      Text man_text = new Text(CommonConstants.STAR_MSG);
      man_text.setFill(Color.DARKKHAKI);
      man_text.setFont(Font.font("Arial", 12));

      Text msg_qty = new Text(CommonConstants.QTY_MSG1);
      msg_qty.setFill(Color.DARKKHAKI);
      msg_qty.setFont(Font.font("Arial", 12));

      Text msg_qtyLow = new Text(CommonConstants.QTY_LOW);
      msg_qtyLow.setFill(Color.DARKKHAKI);
      msg_qtyLow.setFont(Font.font("Arial", 12));

      StackPane.setMargin(grid, new Insets(10, 0, 0, 0));

      StackPane.setMargin(qtyRect, new Insets(197, 850, 100, 0));
      StackPane.setAlignment(qtyRect, Pos.BASELINE_CENTER);
      StackPane.setMargin(msg_qtyLow, new Insets(197, 765, 100, 0));
      StackPane.setAlignment(msg_qtyLow, Pos.BASELINE_CENTER);

      StackPane.setAlignment(roundRect, Pos.TOP_CENTER);
      StackPane.setMargin(text5, new Insets(50, 8, 8, 8));
      StackPane.setAlignment(text5, Pos.TOP_CENTER);
      StackPane.setMargin(man_text, new Insets(197, 100, 20, 0));
      StackPane.setAlignment(man_text, Pos.BASELINE_RIGHT);
      StackPane.setMargin(msg_qty, new Insets(210, 95, 20, 0));
      StackPane.setAlignment(msg_qty, Pos.BASELINE_RIGHT);

      stack.getChildren().addAll(text5, roundRect, grid, man_text, msg_qty, qtyRect, msg_qtyLow);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return stack;
  }
Example #25
0
  public MyTab createTab() {

    MyTab tab =
        new MyTab() {
          @Override
          public ButtonType close() {
            if (Objects.nonNull(this.getPath()))
              closedPaths.add(Optional.ofNullable(current.currentTab().getPath()));

            ButtonType closeType = super.close();

            Platform.runLater(
                () -> {
                  ObservableList<Tab> tabs = controller.getTabPane().getTabs();
                  if (tabs.isEmpty()) {
                    controller.newDoc(null);
                  }
                });

            return closeType;
          }
        };

    tab.setOnCloseRequest(
        event -> {
          event.consume();
          tab.close();
        });

    MenuItem menuItem0 = new MenuItem("Close");
    menuItem0.setOnAction(
        actionEvent -> {
          tab.close();
        });

    MenuItem menuItem1 = new MenuItem("Close All");
    menuItem1.setOnAction(
        actionEvent -> {
          ObservableList<Tab> tabs = controller.getTabPane().getTabs();
          ObservableList<Tab> clonedTabs = FXCollections.observableArrayList(tabs);
          if (clonedTabs.size() > 0) {
            clonedTabs.forEach(
                (closedTab) -> {
                  MyTab myTab = (MyTab) closedTab;
                  myTab.close();
                });
          }
        });

    MenuItem menuItem2 = new MenuItem("Close Others");
    menuItem2.setOnAction(
        actionEvent -> {
          ObservableList<Tab> blackList = FXCollections.observableArrayList();
          blackList.addAll(controller.getTabPane().getTabs());

          blackList.remove(tab);

          blackList.forEach(
              t -> {
                MyTab closeTab = (MyTab) t;
                closeTab.close();
              });
        });
    //
    //        MenuItem menuItem3 = new MenuItem("Close Unmodified");
    //        menuItem3.setOnAction(actionEvent -> {
    //
    //            ObservableList<Tab> clonedTabs = FXCollections.observableArrayList();
    //            clonedTabs.addAll(controller.getTabPane().getTabs());
    //
    //
    //            for (Tab clonedTab : clonedTabs) {
    //                MyTab myTab = (MyTab) clonedTab;
    //                if (!myTab.getTabText().contains(" *"))
    //                    threadService.runActionLater(()->{
    //                        myTab.close();
    //                    });
    //            }
    //        });

    MenuItem menuItem4 = new MenuItem("Select Next Tab");
    menuItem4.setOnAction(
        actionEvent -> {
          TabPane tabPane = controller.getTabPane();
          if (tabPane.getSelectionModel().isSelected(tabPane.getTabs().size() - 1))
            tabPane.getSelectionModel().selectFirst();
          else tabPane.getSelectionModel().selectNext();
        });

    MenuItem menuItem5 = new MenuItem("Select Previous Tab");
    menuItem5.setOnAction(
        actionEvent -> {
          SingleSelectionModel<Tab> selectionModel = controller.getTabPane().getSelectionModel();
          if (selectionModel.isSelected(0)) selectionModel.selectLast();
          else selectionModel.selectPrevious();
        });

    MenuItem menuItem6 = new MenuItem("Reopen Closed Tab");
    menuItem6.setOnAction(
        actionEvent -> {
          if (closedPaths.size() > 0) {
            int index = closedPaths.size() - 1;
            closedPaths.get(index).filter(pathResolver::isAsciidoc).ifPresent(this::addTab);
            closedPaths.get(index).filter(pathResolver::isMarkdown).ifPresent(this::addTab);
            closedPaths.get(index).filter(pathResolver::isImage).ifPresent(this::addImageTab);
            closedPaths.remove(index);
          }
        });

    MenuItem menuItem7 = new MenuItem("Open File Location");

    menuItem7.setOnAction(
        event -> {
          current
              .currentPath()
              .ifPresent(
                  path -> {
                    controller
                        .getHostServices()
                        .showDocument(path.getParent().toUri().toASCIIString());
                  });
        });

    MenuItem menuItem8 = new MenuItem("New File");
    menuItem8.setOnAction(controller::newDoc);

    MenuItem gotoWorkdir = new MenuItem("Go to Workdir");
    gotoWorkdir.setOnAction(
        event -> {
          current.currentPath().map(Path::getParent).ifPresent(directoryService::changeWorkigDir);
        });

    ContextMenu contextMenu = new ContextMenu();
    contextMenu
        .getItems()
        .addAll(
            menuItem0,
            menuItem1,
            menuItem2,
            new SeparatorMenuItem(),
            menuItem4,
            menuItem5,
            menuItem6,
            new SeparatorMenuItem(),
            gotoWorkdir,
            new SeparatorMenuItem(),
            menuItem7,
            menuItem8);

    tab.contextMenuProperty().setValue(contextMenu);
    Label label = tab.getLabel();

    label.setOnMouseClicked(
        mouseEvent -> {
          if (mouseEvent.getButton().equals(MouseButton.SECONDARY)) {
            tab.select();
          } else if (mouseEvent.getClickCount() > 1) {
            controller.adjustSplitPane();
          }
        });

    return tab;
  }
Example #26
0
  public ChooseStudent(Stage primaryStage) {
    data.addAll(new Student("Fahmi", "1300001", "3"));
    data.addAll(new Student("Ahmad", "1300002", "3"));
    data.addAll(new Student("Nasuha", "1300003", "3"));
    data.addAll(new Student("Kimi", "1300004", "3"));
    data.addAll(new Student("Alia", "1300005", "3"));
    data.addAll(new Student("Ariff", "1400001", "2"));
    data.addAll(new Student("Faiz", "1400002", "2"));
    data.addAll(new Student("Osman", "1400003", "2"));
    data.addAll(new Student("Hadi", "1200001", "4"));
    data.addAll(new Student("Nabilah", "1300006", "3"));
    data.addAll(new Student("Syafiqah", "1500001", "1"));
    data.addAll(new Student("Amalina", "1200002", "1"));
    data.addAll(new Student("Intan", "1500002", "1"));
    data.addAll(new Student("Rahman", "1400004", "1"));
    data.addAll(new Student("Hazim", "1000001", "6"));
    data.addAll(new Student("Azri", "1100001", "5"));
    data.addAll(new Student("Hanif", "1100002", "5"));
    data.addAll(new Student("Nazim", "1100003", "5"));
    data.addAll(new Student("Faris", "1400005", "2"));
    data.addAll(new Student("Firdaus", "1500003", "1"));
    Button addnewsub = new Button("ADD NEW SUBJECT");
    suboptions.addAll(new Subject("Bahasa Malaysia", "BM501", "Cikgu Suraya", 55.55));
    addnewsub.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            new AddNewSubject();
          }
        });
    table = new TableView<Student>();
    table.getColumns().addAll(Student.getColumn(table));
    table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    Button report = new Button("REPORT");
    table.setItems(data);
    table.setOnMouseClicked(
        new EventHandler<javafx.scene.input.MouseEvent>() {
          @Override
          public void handle(MouseEvent event) {
            if (event.getClickCount() > 0) {
              if (table.getSelectionModel().getSelectedIndex() >= 0) {
                new AddSubject(primaryStage, table.getSelectionModel().getSelectedItem(), data);
              }
            }
          }
        });
    final TextField searchField = new TextField();
    searchField.setPromptText("Search ID...");
    searchField
        .textProperty()
        .addListener(
            new InvalidationListener() {

              @Override
              public void invalidated(Observable o) {

                if (searchField.textProperty().get().isEmpty()) {

                  table.setItems(data);

                  return;
                }

                ObservableList<Student> tableItems = FXCollections.observableArrayList();

                ObservableList<TableColumn<Student, ?>> cols = table.getColumns();

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

                  for (int j = 0; j < cols.size(); j++) {

                    TableColumn col = cols.get(j);

                    String cellValue = col.getCellData(data.get(i)).toString();

                    cellValue = cellValue.toLowerCase();

                    if (cellValue.contains(searchField.textProperty().get().toLowerCase())) {

                      tableItems.add(data.get(i));

                      break;
                    }
                  }
                }

                table.setItems(tableItems);
              }
            });
    HBox hb = new HBox();
    hb.getChildren().addAll(searchField, addnewsub);
    VBox vb = new VBox();
    vb.getChildren().addAll(table, hb);
    Scene scene2 = new Scene(vb, 800, 500);
    primaryStage.setScene(scene2);
    primaryStage.show();
  }
 @Override
 public void initialize(URL location, ResourceBundle resources) {
   // Set measurement result into scene
   domainName.setText(StaticVars.currentDomainName);
   domainNameLabel.setText(StaticVars.currentLabel);
   domainNameResponseTime.setText(StaticVars.currentResponseTime + " second(s)");
   domainNameDateMeasured.setText(String.valueOf(StaticVars.currentDate));
   if (StaticVars.methodType == 1) {
     labelSiteComposition.setVisible(false);
     chartCompositionDangerousity.setVisible(false);
   } else {
     if (StaticVars.currentLabel.equals("normal")) {
       labelSiteComposition.setVisible(false);
       chartCompositionDangerousity.setVisible(false);
     } else {
       if (!StaticVars.currentLabel.equals("malicious (unknown type)")
           && !StaticVars.currentLabel.equals("unknown")) {
         Triplet<Double, Double, Double> compositionDangerousity = StaticVars.currentComposition;
         ObservableList<PieChart.Data> pieChartElements = FXCollections.observableArrayList();
         pieChartElements.addAll(
             new PieChart.Data("Malware", compositionDangerousity.getValue0()),
             new PieChart.Data("Phishing", compositionDangerousity.getValue1()),
             new PieChart.Data("Spamming", compositionDangerousity.getValue2()));
         chartCompositionDangerousity.setData(pieChartElements);
         chartCompositionDangerousity.setLegendSide(Side.RIGHT);
         chartCompositionDangerousity.setLabelLineLength(10);
       } else {
         labelSiteComposition.setVisible(false);
         chartCompositionDangerousity.setVisible(false);
       }
     }
   }
   // Save this reputation result into eksternal file
   historySitesReputation thisResultReputation = new historySitesReputation();
   thisResultReputation.setCompositionDangerousity(StaticVars.currentComposition);
   thisResultReputation.setLabelNormality(StaticVars.currentLabel);
   thisResultReputation.setResponseTime(Long.parseLong(StaticVars.currentResponseTime));
   thisResultReputation.setMeasureDate(StaticVars.currentDate);
   switch (StaticVars.reputationType) {
     case 1:
       thisResultReputation.setReputationType("DNS");
       break;
     case 2:
       thisResultReputation.setReputationType("Spesific");
       break;
     case 3:
       thisResultReputation.setReputationType("Trust");
       break;
     case 4:
       thisResultReputation.setReputationType("DNS+Spesific");
       break;
     case 5:
       thisResultReputation.setReputationType("DNS+Trust");
       break;
     case 6:
       thisResultReputation.setReputationType("Spesific+Trust");
       break;
     case 7:
       thisResultReputation.setReputationType("DNS+Spesific+Trust");
       break;
   }
   switch (StaticVars.methodType) {
     case 1:
       thisResultReputation.setMethodType("supervised");
       break;
     case 2:
       thisResultReputation.setMethodType("unsupervised");
       break;
     case 3:
       thisResultReputation.setMethodType("hybrid");
       break;
   }
   List<Pair<String, historySitesReputation>> oldHistoryReputation =
       reputationResultController.loadHistoryReputation();
   Pair<String, historySitesReputation> addedHistoryReputation =
       new Pair<String, historySitesReputation>(
           StaticVars.currentDomainName, thisResultReputation);
   oldHistoryReputation.add(addedHistoryReputation);
   reputationResultController.saveHistoryReputation(oldHistoryReputation);
 }
 private void receiveUsers(List<String> users) {
   observableUsers.clear();
   observableUsers.addAll(users);
   assingUsersList();
 }
 private void receiveChatrooms(List<String> chatroomsList) {
   chatrooms.clear();
   chatrooms.addAll(chatroomsList);
   assingChatRooms();
 }
Example #30
0
  @FXML
  public void initialize() {
    System.out.println("<main_contr>: controller initiation");
    //		observableTeams = FXCollections.observableArrayList(BetterDataGenerator.generateTeams());
    observableTeams = FXCollections.observableArrayList();

    teamsTable.setPlaceholder(new Label("No matching data"));

    FilteredList<Team> filteredTeams = new FilteredList<>(observableTeams, p -> false);
    teamSearcherTextField
        .textProperty()
        .addListener(
            (observable, oldValue, newValue) -> {
              if (newValue != null
                  && newValue.length() == 3
                  && oldValue.length() < newValue.length()) {
                System.out.println("<main_contr>: query to db for '" + newValue + "'");
                observableTeams.clear();
                observableTeams.addAll(dbHandle.loadTeams());
              }

              filteredTeams.setPredicate(
                  team -> {
                    if (newValue == null || newValue.isEmpty() || newValue.length() < 3) {
                      return false;
                    }

                    String lowerCaseFilter = newValue.toLowerCase();
                    if (lowerCaseFilter.equals("all")) {
                      return true;
                    } else if (team.getTeamName().toLowerCase().contains(lowerCaseFilter)) {
                      return true;
                    } else if (team.getSupervisor() != null
                        && team.getSupervisor()
                            .toString()
                            .toLowerCase()
                            .contains(lowerCaseFilter)) {
                      return true;
                    }
                    return false;
                  });
            });

    FilteredList<Team> orphanTeams =
        new FilteredList<>(
            observableTeams,
            team -> {
              if (team.getSupervisor() == null) {
                return true;
              } else {
                return false;
              }
            });

    SortedList<Team> sortedFilteredTeams = new SortedList<>(filteredTeams);
    sortedFilteredTeams.comparatorProperty().bind(teamsTable.comparatorProperty());
    teamsTable.setItems(sortedFilteredTeams);

    SortedList<Team> sortedOrphanTeams = new SortedList<>(orphanTeams);
    sortedOrphanTeams.comparatorProperty().bind(orphanTeamsTable.comparatorProperty());
    orphanTeamsTable.setItems(sortedOrphanTeams);

    teamsTable.setRowFactory(
        p -> {
          TableRow<Team> row = new TableRow<>();
          row.setOnMouseClicked(
              event -> {
                if (event.getClickCount() == 2 && !row.isEmpty()) {
                  Team selectedTeam = row.getItem();
                  handleTeamDoubleClick(selectedTeam);
                }
              });
          return row;
        });
  }