Esempio n. 1
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));
  }
Esempio n. 2
0
 // czyœci dane okna z bibliotek¹
 private void clearData() {
   IPath.musicFiles.clear();
   IPath.musicFolders.clear();
   IPath.users.clear();
   playlistList.clear();
   albumList.clear();
   fileList.clear();
 }
Esempio n. 3
0
 @Override
 protected void finalize() throws Throwable {
   try {
     tableData.clear();
     superData.clear();
     typeData.clear();
     searchData.clear();
   } finally {
     super.finalize();
   }
 }
 private void getusers() throws IOException {
   users.clear();
   int num = FromServer.readInt();
   for (int i = 0; i < num; i++) users.add(FromServer.readUTF());
   cbselectuser.getItems().clear();
   cbselectuser.getItems().addAll(users);
 }
 private void gettars() throws IOException {
   tars.clear();
   int num = FromServer.readInt();
   for (int i = 0; i < num; i++) tars.add(FromServer.readUTF());
   cbbackups.getItems().clear();
   cbbackups.getItems().addAll(tars);
 }
  /** 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);
  }
 private void getgroupuser(String name) throws IOException {
   users.clear();
   ToServer.writeUTF("group_users");
   ToServer.writeUTF(repo);
   int num = FromServer.readInt();
   for (int i = 0; i < num; i++) users.add(FromServer.readUTF());
 }
Esempio n. 8
0
  private void loadHistory() {
    history.clear();

    if (!Files.exists(streamPath, LinkOption.NOFOLLOW_LINKS)) {
      logger.debug("no stream exist ({})", streamPath);
      return;
    }
    logger.info("load history ({})", streamPath);

    try (InputStream inStream = Files.newInputStream(streamPath, StandardOpenOption.READ)) {
      try (ObjectInputStream oStream = new ObjectInputStream(inStream)) {
        Object o = null;
        while (inStream.available() > 0 && (o = oStream.readObject()) != null) {
          HistoryEntry dev = (HistoryEntry) o;
          logger.debug("read dev: {}", dev);
          if (!history.contains(dev)) {
            history.add(dev);
          } else {
            logger.error("device already exist ({})", dev);
          }
        }
      }
    } catch (Exception e) {
      logger.error(e.getMessage(), e);
      try {
        Files.deleteIfExists(streamPath);
      } catch (IOException e1) {
      }
    }
  }
  public void populateProdTypeValues() {
    try {

      Connection con = Main.dbConnection;
      if (!con.isValid(0)) {
        con = Main.reconnect();
      }
      productTypeValues.clear();
      PreparedStatement stmt =
          con.prepareStatement(
              "select value, code, seq, lov_lookup_id from lov_lookup where code='PRODUCT_TYPE' order by seq");
      ResultSet rs = stmt.executeQuery();
      while (rs.next()) {
        productTypeValues.add(rs.getString(1));
      }
      typeTF.getItems().addAll(productTypeValues);
    } catch (SQLException e) {

      Main._logger.debug("Error :", e);
      e.printStackTrace();
    } catch (Exception e) {

      Main._logger.debug("Error :", e);
      e.printStackTrace();
    }
  }
 public void SucheNachPolizist(int PersonenID) {
   Hauptprogramm.setMittlereAnsicht(getPolizistAnsicht());
   PolizistDatenListe.clear();
   ResultSet AnfrageAntwort;
   try {
     AnfrageAntwort =
         DH.getAnfrageObjekt()
             .executeQuery(
                 "SELECT PERSON.PersonenID, PERSON.Name, PERSON.Geburtsdatum, PERSON.Nationalität, PERSON.Geschlecht, PERSON.Todesdatum, POLIZIST.Dienstgrad "
                     + "FROM PERSON, POLIZIST WHERE PERSON.PersonenID = POLIZIST.PersonenID AND POLIZIST.PersonenID = "
                     + PersonenID);
     while (AnfrageAntwort.next()) {
       String Todesdatum = "";
       if (AnfrageAntwort.getObject(6) != null) {
         Todesdatum = AnfrageAntwort.getString(6);
       }
       PolizistDatenListe.add(
           new PolizistDaten(
               AnfrageAntwort.getInt(1),
               AnfrageAntwort.getString(2),
               AnfrageAntwort.getString(3),
               AnfrageAntwort.getString(4),
               AnfrageAntwort.getString(5),
               Todesdatum,
               AnfrageAntwort.getString(7)));
     }
   } catch (SQLException e) {
     IM.setErrorText("Unbekannter Fehler bei aktualisieren der Ansicht", e);
   }
 }
  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");
    }
  }
  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 void addFiles(final FileManager fileManager) {
    tableItems.clear();

    for (final FileInfo fileInfo : fileManager.getMap().keySet()) {
      addFile(fileManager, fileInfo);
    }
  }
Esempio n. 14
0
 public void load3(Event event) {
   f.clear();
   String extra;
   String[] extra1;
   HashMap<String, Integer> h = new HashMap<String, Integer>();
   try {
     BufferedReader x = new BufferedReader(new FileReader("./src/Expenses.txt"));
     extra = x.readLine();
     extra = x.readLine();
     extra = x.readLine();
     while ((extra = x.readLine()) != null) {
       extra1 = extra.split(" ");
       if (h.containsKey(extra1[0])) {
         h.put(extra1[0], h.get(extra1[0]) + Integer.parseInt(extra1[1]));
       }
       h.put(extra1[0], Integer.parseInt(extra1[1]));
     }
     Set<String> keys = h.keySet();
     for (String key : keys) {
       f.add(new PieChart.Data(key, h.get(key)));
     }
     x.close();
     chr.setData(f);
   } catch (IOException ex) {
     ex.printStackTrace();
   }
 }
Esempio n. 15
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);
    }
  }
 public void ZeigeSuchResultate(ResultSet R) {
   Hauptprogramm.setMittlereAnsicht(getPolizistAnsicht());
   PolizistDatenListe.clear();
   ResultSet AnfrageAntwort;
   try {
     AnfrageAntwort = R;
     while (AnfrageAntwort.next()) {
       String Todesdatum = "";
       if (AnfrageAntwort.getObject(6) != null) {
         Todesdatum = AnfrageAntwort.getString(6);
       }
       PolizistDatenListe.add(
           new PolizistDaten(
               AnfrageAntwort.getInt(1),
               AnfrageAntwort.getString(2),
               AnfrageAntwort.getString(3),
               AnfrageAntwort.getString(4),
               AnfrageAntwort.getString(5),
               Todesdatum,
               AnfrageAntwort.getString(7)));
     }
   } catch (SQLException e) {
     IM.setErrorText("Unbekannter Fehler bei aktualisieren der Ansicht", e);
   }
 }
 private void getgroupe() throws IOException {
   groups.clear();
   int num = FromServer.readInt();
   for (int i = 0; i < num; i++) groups.add(FromServer.readUTF());
   cbgroup.getItems().clear();
   cbgroup.getItems().addAll(groups);
 }
  private void readDataFromServer() {
    setStatus("Attempting to read from server", false, false, false);
    removeSeriesTempuratureData();
    _positionReadings.clear();

    try {
      _osw.write(READ_DATA);
      _osw.flush();

      // TMM - loop until all of the strings are read
      // The first string is the number of records being sent
      String message = _br.readLine();
      int messLen = Integer.parseInt(message);
      System.out.println("number of messages: " + messLen);
      for (int i = 0; i < messLen; i++) {
        message = _br.readLine();
        if (message == null) {
          break;
        }
        System.out.println("Message received: " + message);
        parseMessage(message);
      }
      setStatus("Data successfully read from server", false, true, true);
      chartTemperatureReadings();
    } catch (IOException | IllegalStateException | NumberFormatException e) {
      System.out.println("Problem in client " + e);
      setStatus("Problem reading data from server", false, false, true);
    }
  }
Esempio n. 19
0
 public final void update() {
   availableSets.clear();
   for (File file : Configuration.stopwordSets.toFile().listFiles()) {
     if (!file.getName().startsWith(".")) {
       availableSets.add(file.getName());
     }
   }
 }
 @Test
 public void testItemsClear() {
   int index = 0;
   indicesList.addIndices(index);
   report.clear();
   //        new PrintingListChangeListener("clear", indicesList);
   items.clear();
   assertEquals(1, report.getEventCount());
   assertTrue(wasSingleRemoved(report.getLastChange()));
 }
Esempio n. 21
0
 public void setTableData(ObservableList<PortfolioData> recs) {
   ObservableList<PortfolioData> data = this.getItems();
   if (data == null) setItems(recs);
   else {
     data.clear();
     if (recs != null) {
       setItems(recs);
     }
   }
 }
 /**
  * Since extraction of IndicesBase Changed behaviour of sourceChange: valid only from before
  * endChange to after endChange!
  */
 @Test
 @Ignore
 public void testChangeOnClearItems() {
   int[] indices = new int[] {3, 5, 1};
   indicesList.addIndices(indices);
   report.clear();
   ListChangeReport itemsReport = new ListChangeReport(items);
   //        new PrintingListChangeListener("Items removed before", indicesList);
   items.clear();
   assertEquals(itemsReport.getLastChange(), indicesList.getSourceChange());
 }
Esempio n. 23
0
 @FXML
 private void deleteList(ActionEvent event) {
   if (mp != null) {
     mp.dispose();
   }
   if (!fileList.isEmpty() || !listName.isEmpty()) {
     fileList.clear();
     listName.clear();
     listView.setItems(listName);
   }
 }
Esempio n. 24
0
  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);
  }
Esempio n. 25
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);
    }
  }
Esempio n. 26
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;
       }
     }
 }
  /** Update the filtered officials list */
  public void updateOfficialFiltersResult() {
    for (Official official : officialFilteredList) {
      official.getSkillLevels().removeListener(mapChangeListener);
    }
    officialFilteredList.clear();
    for (Official official : gameData.getOfficials()) {
      if (overallFilterMatcher.test(official)) {
        officialFilteredList.add(official);

        official.getSkillLevels().addListener(mapChangeListener);
      }
    }
    updateSkills();
  }
Esempio n. 28
0
  void generateBackupPaths() {
    ObservableList restorePaths = FXCollections.observableArrayList();
    restorePaths.clear();
    vBarBDirs.getChildren().clear();
    //        cbRestoreDirectory.getItems().clear();
    String[] backupArr = constants.getValue("s_dumpDir").split(";");
    for (final String dir : backupArr) {
      restorePaths.add(dir);
      HBox hbox = new HBox();
      Label lbl = new Label(dir);
      Button btn = new Button("Delete");
      btn.setOnAction(
          new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
              String nString = constants.getValue("s_dumpDir");
              nString = nString.replaceAll(";" + dir, "");
              nString = nString.replaceAll(dir, "");
              constants.addValue("s_dumpDir", nString);
              System.out.println(constants.getValue("s_dumpDir"));
              txtDir.setText(nString);
              generateBackupPaths();
            }
          });
      hbox.getChildren().add(lbl);
      hbox.getChildren().add(btn);
      vBarBDirs.getChildren().add(hbox);
    }

    try {

      cbRestoreDirectory.setItems(restorePaths);
      cbRestoreDirectory.setValue(restorePaths.get(0));
      generateRestore(restorePaths.get(0).toString());
    } catch (Exception e) {
      e.printStackTrace();
    }
    cbRestoreDirectory
        .valueProperty()
        .addListener(
            new ChangeListener<String>() {
              @Override
              public void changed(ObservableValue ov, String t, String t1) {
                //                System.out.println(ov);
                //                System.out.println(t);
                //                System.out.println(t1);
                generateRestore(t1);
              }
            });
  }
Esempio n. 29
0
 @Override
 public void mvcGroupInit(@Nonnull Map<String, Object> args) {
   stateProperty()
       .addListener(
           (observable, oldValue, newValue) -> {
             switch (newValue) {
               case RUNNING:
                 repositories.clear();
                 break;
               case READY:
                 setSubscription(null);
             }
           });
 }
  private void flipContent() {
    final ObservableList<Node> children = content.getChildren();
    children.clear();

    final Node currentView = views.get(currentViewIndex);
    children.add(currentView);

    if (currentView instanceof FlameGraphCanvas) {
      final FlameGraphCanvas flameGraphCanvas = (FlameGraphCanvas) currentView;
      final Scene scene = flameGraphCanvas.getScene();
      flameGraphCanvas.setHeight(scene.getHeight());
      flameGraphCanvas.setWidth(scene.getHeight());
      flameGraphCanvas.refresh();
    }
  }