Ejemplo n.º 1
1
  @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));
  }
Ejemplo n.º 2
0
  private ObservableList getGender() {
    ObservableList<String> maritalStatus = FXCollections.observableArrayList();
    maritalStatus.add("Male");
    maritalStatus.add("Female");

    return maritalStatus;
  }
Ejemplo n.º 3
0
  /** Loads the name of all ingredients and puts them in ingredientlist. */
  public void updateIngredients() {
    ArrayList<ArrayList<String>> dataSet;
    ObservableList<String> itemList =
        FXCollections.observableArrayList(); // Observable arraylist for the listview

    try {
      System.out.println("- Main updateIngredientsRecipList");

      dataSet = fetchData("Ingredients", "Name"); // Gives the arraylist the ingredientnames

      for (ArrayList<String> element : dataSet) {
        itemList.add(element.get(0)); // For every element in the array, get name
      }

      System.out.println("- end of Main updateIngredientsRecipList");
    } catch (SQLException e) {
      e.printStackTrace();
    }
    recipeIngredients.setItems(itemList); // Sets the Listview to show the obs arraylist

    itemList.clear();
    try {
      dataSet = fetchData("Units", "*");

      for (ArrayList<String> element : dataSet) {
        itemList.add(element.get(1));
      }
    } catch (SQLException e) {
      e.printStackTrace();
    }
    ingredientUnit.setItems(itemList);
  }
Ejemplo n.º 4
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));
  }
Ejemplo n.º 5
0
  /**
   * Add filters according to the current emulation and chip model of the currently played tune.
   *
   * @param tune currently played tune
   * @param num SID chip number
   * @param filters resulting filter list to add matching filter names to
   * @param filter combo box to select currently selected filter
   */
  private void addFilters(
      final SidTune tune, int num, ObservableList<String> filters, ComboBox<String> filter) {
    EmulationSection emulationSection = util.getConfig().getEmulationSection();

    boolean filterEnable = emulationSection.isFilterEnable(num);

    Emulation emulation = Emulation.getEmulation(emulationSection, tune, num);
    ChipModel model = ChipModel.getChipModel(emulationSection, tune, num);
    String filterName = filterEnable ? emulationSection.getFilterName(num, emulation, model) : null;

    filters.clear();
    filters.add("");
    for (IFilterSection filterSection : util.getConfig().getFilterSection()) {
      if (emulation.equals(Emulation.RESIDFP)) {
        if (filterSection.isReSIDfpFilter6581() && model == ChipModel.MOS6581) {
          filters.add(filterSection.getName());
        } else if (filterSection.isReSIDfpFilter8580() && model == ChipModel.MOS8580) {
          filters.add(filterSection.getName());
        }
      } else {
        if (filterSection.isReSIDFilter6581() && model == ChipModel.MOS6581) {
          filters.add(filterSection.getName());
        } else if (filterSection.isReSIDFilter8580() && model == ChipModel.MOS8580) {
          filters.add(filterSection.getName());
        }
      }
    }
    if (filterEnable) {
      filter.getSelectionModel().select(filterName);
    } else {
      filter.getSelectionModel().select(0);
    }
  }
Ejemplo n.º 6
0
  private final void defineStretching() {
    //////////// give resizing hints
    ObservableList<RowConstraints> rows = getRowConstraints();
    logger.info("original row constraints size" + rows.size());

    RowConstraints rc;

    rc = new RowConstraints();
    // rc.setPercentHeight( 0 );
    rc.setVgrow(Priority.NEVER);
    rc.setMinHeight(StaticConst.GU);
    rows.add(rc);
    rc = new RowConstraints();
    // rc.setPercentHeight( 100 );
    rc.setVgrow(Priority.ALWAYS);
    rows.add(rc);
    rc = new RowConstraints();
    // rc.setPercentHeight( 0 );
    rc.setVgrow(Priority.NEVER);
    rows.add(rc);

    ObservableList<ColumnConstraints> ccs = getColumnConstraints();
    logger.info("original column constraints size" + ccs.size());
    ColumnConstraints cc;

    cc = new ColumnConstraints();
    cc.setHgrow(Priority.ALWAYS);
    ccs.add(cc);
  }
  @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);
  }
Ejemplo n.º 8
0
  private ObservableList getYesNo() {
    ObservableList<String> YesNoList = FXCollections.observableArrayList();
    YesNoList.add("Yes");
    YesNoList.add("No");

    return YesNoList;
  }
  @Override
  public void start(Stage stage) throws Exception {
    Parent root = createLayout();
    scene =
        SceneBuilder.create()
            .fill(new Color(0.5, 0.5, 0.5, 1.0))
            .root(root)
            .width(600)
            .height(400)
            .build();
    stage.setScene(scene);
    stage.show();

    // Add values to the spinner controls
    String[] months = new DateFormatSymbols().getMonths();
    ObservableList<String> dayList = FXCollections.observableArrayList();
    ObservableList<String> monthList = FXCollections.observableArrayList(months);
    ObservableList<String> yearList = FXCollections.observableArrayList();
    for (int i = 1; i <= 31; i++) {
      dayList.add(Integer.toString(i));
    }
    for (int i = 1970; i <= 2013; i++) {
      yearList.add(Integer.toString(i));
    }
    spinnerControlDay.setItems(dayList);
    spinnerControlMonth.setItems(monthList);
    spinnerControlYear.setItems(yearList);
  }
Ejemplo n.º 10
0
  /**
   * Constructor
   *
   * @param eventBus
   */
  public CyclistController(EventBus eventBus) {
    this._eventBus = eventBus;
    _workspaces.add("/Users/yarden/software");
    _workspaces.add("/Users/yarden");

    load();
  }
  public void initLibrarianLayout() {
    ObservableList<Menu> menuList = this.menubar.getMenus();
    menuList.clear();

    Menu checkoutMenu = new Menu("Checkout");
    MenuItem checkoutBookItem = new MenuItem("checkout book");
    checkoutBookItem.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            showContentView(PUBLICATION_CHECKOUT);
          }
        });

    //        MenuItem recordItem = new MenuItem("checkout record");
    //        recordItem.setOnAction(new EventHandler<ActionEvent>() {
    //            @Override
    //            public void handle(ActionEvent event) {
    //                System.out.print("checkout record");
    //            }
    //        });

    ObservableList<MenuItem> itemList = checkoutMenu.getItems();
    itemList.add(checkoutBookItem);
    //        itemList.add(recordItem);
    menuList.add(checkoutMenu);
    showContentView(PUBLICATION_CHECKOUT);
  }
 public Asset indexAsset(Path file) throws IOException {
   Asset asset;
   asset = getAsset(file);
   assert asset != null;
   assets.add(asset);
   paths.add(file);
   return asset;
 }
Ejemplo n.º 13
0
 @FXML
 private void Reload(ActionEvent event) {
   System.out.println("Test Reload");
   handeller.setOptionword(hang.OptionSize);
   Toption.setText(hang.optionword);
   data.add("   ------------   ");
   data.add("Option : " + hang.optionword);
 }
Ejemplo n.º 14
0
  private ObservableList getOwnerShip() {
    ObservableList<String> owenerShipList = FXCollections.observableArrayList();
    owenerShipList.add("Rental");
    owenerShipList.add("Home Owner");
    owenerShipList.add("Sharer");
    owenerShipList.add("Informal Settler");

    return owenerShipList;
  }
Ejemplo n.º 15
0
 // saad kõik andmed
 public ObservableList<Kodut66.Input> getInput() {
   ObservableList<Kodut66.Input> andmed =
       FXCollections.observableArrayList(); // siin listis storeb kõiki andmeid
   andmed.add(new Kodut66.Input("Makroökonoomika", 302, "04.01.2016"));
   andmed.add(new Kodut66.Input("Füüsika", 221, "10.12.2015"));
   andmed.add(new Kodut66.Input("Java", 304, "12.01.2016"));
   andmed.add(new Kodut66.Input("Infotöötlus", 306, "17.12.2015"));
   return andmed;
 }
Ejemplo n.º 16
0
  private ObservableList getOccupancy() {
    ObservableList<String> owenerShipList = FXCollections.observableArrayList();
    owenerShipList.add("Employed");
    owenerShipList.add("Unemployed");
    owenerShipList.add("Self-Employed");
    owenerShipList.add("Retired");

    return owenerShipList;
  }
  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);
  }
Ejemplo n.º 18
0
  private ObservableList getMaritalStatus() {
    ObservableList<String> maritalStatus = FXCollections.observableArrayList();
    maritalStatus.add("Married");
    maritalStatus.add("Live-in");
    maritalStatus.add("Single");
    maritalStatus.add("Seperated");
    maritalStatus.add("Widowed");

    return maritalStatus;
  }
Ejemplo n.º 19
0
  @FXML
  private void handleButton(ActionEvent event)
      throws ClassNotFoundException, InstantiationException, IllegalAccessException {

    try {
      conn = DbConn.connect();
      String sql =
          "SELECT patient_id, first_name, last_name, date_of_birth FROM PR_PATIENT where first_name LIKE '%"
              + search_first.getText()
              + "%'";
      // "SELECT patient_id, first_name, last_name, date_of_birth FROM PR_PATIENT where first_name
      // LIKE '%"+search_first.getText()+"%'";

      ResultSet rs =
          conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY)
              .executeQuery(sql);
      ObservableList<Object> data = FXCollections.observableArrayList();

      for (int i = 0; i < rs.getMetaData().getColumnCount(); i++) {
        final int j = i;
        TableColumn col = new TableColumn(rs.getMetaData().getColumnName(i + 1));
        col.setCellValueFactory(
            new Callback<CellDataFeatures<ObservableList, String>, ObservableValue<String>>() {
              public ObservableValue<String> call(CellDataFeatures<ObservableList, String> param) {
                return new SimpleStringProperty(param.getValue().get(j).toString());
              }
            });

        search_results.getColumns().addAll(col);
      }

      while (rs.next()) {

        ObservableList<String> row = FXCollections.observableArrayList();
        for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) {

          row.add(rs.getString(i));
        }
        System.out.println(row);
        data.add(row);
        // search_results.setItems(row);

      }
      search_results.setItems(data);
      // search_results.setItems(table);

      // ObservableList<Patient> data = search_results.getItems();
      // data.add(new Patient (FirstName.getText(), LastName.getText(), DOB.getText()));
      // FirstName.setText("");
      rs.close();

    } catch (SQLException e) {
      System.out.println("Error " + e.getMessage());
    }
  }
Ejemplo n.º 20
0
  public void setData(Data data) {
    super.setData(data);
    // JeevesMain.currentGUI.currentproject = this; //I DON'T THINK THIS WILL WORK AT ALL BUT LET'S
    // SEE
    List<Data> uidesign = (List) data.getInnerDataList("uidesign");
    if (uidesign != null)
      uidesign.forEach(
          element -> {
            UIElement s = (UIElement) Element.create(element);
            uielements.add(s);
          });
    List<Data> trigs = (List) data.getInnerDataList("triggers");
    if (trigs != null)
      trigs.forEach(
          trig -> {
            Trigger t = (Trigger) Element.create(trig);
            t.setReadOnly(false);
            triggers.add(t);
          });
    List<Data> exprs = (List) data.getInnerDataList("expressions");
    if (exprs != null)
      exprs.forEach(
          expr -> {
            Expression e = (Expression) Element.create(expr);
            e.setReadOnly(false);
            expressions.add(e);
          });
    List<Data> vars = (List) data.getInnerDataList("variables");
    if (vars != null)
      vars.forEach(
          var -> {
            UserVariable v = (UserVariable) Element.create(var);
            v.setReadOnly(false);
            variables.add(v);
          });
    List<Data> surs = (List) data.getInnerDataList("surveys");
    if (surs != null)
      surs.forEach(
          survey -> {
            if (survey != null) {
              Survey s = (Survey) Element.create(survey);
              surveys.add(s);
            }
          });

    //	data.get(")
    elementData.add("description", getDescription());
    elementData.add("triggers", getTriggerData());
    elementData.add("expressions", getExpressionData());
    elementData.add("variables", getVariableData());
    elementData.add("surveys", getSurveyData());
    elementData.add("uidesign", getUIElementData());
  }
 private void updateScores() {
   switch (selectedGame) {
     case "wordex":
       game = "ΛΕΞΟΜΑΝΤΕΙΑ";
       break;
     case "wordsearch":
       game = "ΚΡΥΠΤΟΛΕΞΟ";
       break;
     case "splitwords":
       game = "ΑΝΤΙΣΤΟΙΧΙΣΗ";
       break;
     case "wordsFromALetter":
       game = "ΛΕΞΕΙΣ ΑΠΟ ΓΡΑΜΜΑ";
       break;
     case "correctSpelling":
       game = "ΣΩΣΤΗ ΟΡΘΟΓΡΑΦΙΑ";
       break;
     case "correctSpelling2":
       game = "ΣΩΣΤΗ ΟΡΘΟΓΡΑΦΙΑ 2";
       break;
     case "namesAnimalsPlants":
       game = "ΟΝΟΜΑTA, ΖΩΑ, ΦΥΤΑ";
       break;
     case "coloredBoxes":
       game = "ΧΡΩΜΑΤΙΣΤΑ ΚΟΥΤΙΑ";
       break;
     case "matchCards":
       game = "ΤΑΙΡΙΑΞΕ ΚΑΡΤΕΣ";
       break;
     case "faceNameHouse":
       game = "Face Name House";
       break;
   }
   try {
     gameScores = db.getScores(game);
     gScoresContents = FXCollections.observableArrayList();
     Collections.sort(gameScores, Collections.reverseOrder());
     for (int i = 0; i < Math.min(gameScores.size(), 5); i++) {
       gScoresContents.add(gameScores.get(i));
     }
     gScores.setItems(gScoresContents);
     personalScores = db.getScores(player, game);
     pScoresContents = FXCollections.observableArrayList();
     Collections.sort(personalScores, Collections.reverseOrder());
     for (int i = 0; i < Math.min(personalScores.size(), 5); i++) {
       pScoresContents.add(personalScores.get(i));
     }
     pScores.setItems(pScoresContents);
   } catch (SQLException ex) {
     // TODO handle score exceptions
   }
 }
Ejemplo n.º 22
0
  @Override
  public Pane getVisSettings() {

    GridPane pane = new GridPane();
    pane.setPadding(new Insets(10, 0, 0, 0));
    pane.setHgap(5);
    pane.setVgap(5);

    // Dimension selection box
    ComboBox<String> dimCombo = new ComboBox<>();
    ObservableList<String> dimensions = FXCollections.observableArrayList();
    dimensions.add("X");
    dimensions.add("Y");
    dimensions.add("Z");
    dimCombo.setItems(dimensions);
    dimCombo.setValue(dimensions.get(2));
    dimCombo
        .valueProperty()
        .addListener(
            (ov, oldStr, newStr) -> {
              if (newStr.equals("X")) {
                renderer.setViewingDimension(0);
              } else if (newStr.equals("Y")) {
                renderer.setViewingDimension(1);
              } else {
                renderer.setViewingDimension(2);
              }
              renderer.render();
              Controller.getInstance().updateHistogram();
            });

    Label dimLabel = new Label();
    dimLabel.setText("Projection dimension: ");
    dimLabel.setLabelFor(dimCombo);

    pane.add(dimLabel, 0, 0);
    pane.add(dimCombo, 1, 0);

    // Scale checkbox
    CheckBox scaleBox = new CheckBox("Scale: ");
    scaleBox.setSelected(true);
    scaleBox
        .selectedProperty()
        .addListener(
            (ov, old_val, new_val) -> {
              renderer.setScaling(new_val);
              renderer.render();
            });
    pane.add(scaleBox, 0, 1);

    return pane;
  }
Ejemplo n.º 23
0
  /**
   * updates the items we search for with the text in the searchbox and the currently selected
   * Searchradiobutton
   *
   * @param newVal
   */
  public void renewSearch(String newVal) {
    listView.getSelectionModel().clearSelection();
    searchItems.clear();

    if (newVal.equals("")) {
      listView.setItems(items);
      log.info("All items are displayed");
    } else {

      if (searchToggle.getSelectedToggle().equals(nameSearch)) {
        itemsMap.forEach(
            (a, b) -> {
              if (b.getName().toLowerCase().contains(newVal.toLowerCase())) {
                searchItems.add(b);
              }
            });
        log.info("Only items with '" + newVal + "' in their name are displayed");

      } else if (searchToggle.getSelectedToggle().equals(amountSearch)) {
        itemsMap.forEach(
            (a, b) -> {
              if (String.valueOf(b.getAmount()).contains(newVal)) {
                searchItems.add(b);
              }
            });
        log.info("Only items with '" + newVal + "' as their amount are displayed");

      } else if (searchToggle.getSelectedToggle().equals(barcodeSearch)) {
        itemsMap.forEach(
            (a, b) -> {
              if (b.getGtin().contains(newVal)) {
                searchItems.add(b);
              }
            });
        log.info("Only items with '" + newVal + "' in their barcode are displayed");

      } else if (searchToggle.getSelectedToggle().equals(categorieSearch)) {
        itemsMap.forEach(
            (a, b) -> {
              for (String cat : b.getCategories()) {
                if (cat.toLowerCase().contains(newVal.toLowerCase())) {
                  searchItems.add(b);
                  break;
                }
              }
            });
        log.info("Only items with '" + newVal + "' in their categories are displayed");
      }

      listView.setItems(searchItems);
    }
  }
Ejemplo n.º 24
0
 public void addElement(Element elem) {
   System.out.println("Adding an element woo!");
   if (elem instanceof UserVariable) {
     variables.add(0, (UserVariable) elem);
   } else if (elem instanceof Trigger) {
     triggers.add((Trigger) elem);
   } else if (elem instanceof Expression) {
     expressions.add((Expression) elem);
   } else if (elem instanceof Survey) {
     surveys.add((Survey) elem);
   } else if (elem instanceof UIElement) {
     uielements.add((UIElement) elem);
   }
 }
Ejemplo n.º 25
0
 public ObservableList<String> getAgentList(AbstractTask task, ArrayList<Agent> workerList) {
   ObservableList<String> agentSelectorStrings = FXCollections.observableArrayList();
   int index = 1;
   agentSelectorStrings.add("Any");
   workerList.add(0, null);
   for (Agent agent : AgentManager.getInstance().getAgents()) {
     if (agent.eligibleForTask(task)) {
       agentSelectorStrings.add("#" + index + ": " + agent);
       workerList.add(index, agent);
       index++;
     }
   }
   return agentSelectorStrings;
 }
Ejemplo n.º 26
0
 /** Constructor */
 public MainApp() {
   // Add some sample data
   personData.add(new Person("Hans", "Muster"));
   personData.add(new Person("Ruth", "Mueller"));
   personData.add(new Person("Heinz", "Kurz"));
   personData.add(new Person("Cornelia", "Meier"));
   personData.add(new Person("Werner", "Meyer"));
   personData.add(new Person("Lydia", "Kunz"));
   personData.add(new Person("Anna", "Best"));
   personData.add(new Person("Stefan", "Meier"));
   personData.add(new Person("Martin", "Mueller"));
 }
Ejemplo n.º 27
0
 // pobranie piosenek z dysków
 private void loadAlbums() {
   IPath.getmusicFiles();
   fileList.addAll(IPath.musicFiles);
   for (int i = 0; i < IPath.musicFolders.size(); i++) {
     albumList.add(new Album(IPath.musicFolders.get(i)));
   }
 }
Ejemplo n.º 28
0
 /**
  * Generates a list of the macros that have been created.
  *
  * @return The list of macros.
  */
 public ObservableList<String> getMacroList() {
   ObservableList<String> macroNames = FXCollections.observableArrayList();
   for (String key : recordedTaskMacros.keySet()) {
     macroNames.add(key);
   }
   return macroNames;
 }
Ejemplo n.º 29
0
  /** Starts a new thread to load music. */
  protected void startLoadingMusic() {
    MultiThreadedUtility.submitTask(
        () -> {
          try {
            int i = 0;

            List<Path> paths = AudioUtil.getAudioFiles(false);
            for (Path path : paths) {
              try {
                Music musicTrack = new Music(path.toUri().toString());

                Log.getLogger().log(LogLevel.DEBUG, "[Audio Factory] Loaded music " + path);
                music.add(musicTrack);
                i++;
              } catch (Exception ex) {
                Log.getLogger().log(LogLevel.DEBUG, "[Audio Factory] Unable to load music " + path);
              }
            }

            Log.getLogger().log(LogLevel.INFO, "[Audio Factory] Loaded " + i + " music files");
          } finally {
            musicLoaded = true;
          }
        },
        false);
  }
Ejemplo n.º 30
0
  /**
   * Description of loadDate()) Constructs a person bean from each line of text from the input file
   * and adds it to an observable list.
   */
  private void loadData() {
    try {
      // System.out.println(Paths.get("mydata.txt").toAbsolutePath());
      // List<String> lines = Files.readAllLines(Paths.get("build/resource/mydata.txt"),
      // Charset.defaultCharset());
      BufferedReader br = new BufferedReader(new FileReader("build/resource/mydata.txt"));
      String line;
      String data[] = new String[4];

      while (true) {
        line = br.readLine();
        if (line == null) {
          break;
        } else {
          data = line.split(",");
          System.out.println(data);
          PersonBean p = new PersonBean(data[0], data[1], data[2], new Integer(data[3]));
          personData.add(p);
        }
      } // *****End for
      br.close();
      System.out.println("Loaded " + data.length + " rows of data.");
    } catch (Exception e) {
      System.out.println("There was a problem loading the file:" + e.getMessage());
      e.printStackTrace();
    }
  }