@Override public void afterPage() { preferences.setValue( IMPORT_TARGET_ACCOUNT + extractor.getClass().getSimpleName(), getAccount().getUUID()); preferences.setValue( IMPORT_TARGET_PORTFOLIO + extractor.getClass().getSimpleName(), getPortfolio().getUUID()); }
private void preselectDropDowns() { // idea: generally one type of document (i.e. from the same bank) will // be imported into the same account List<Account> activeAccounts = client.getActiveAccounts(); if (!activeAccounts.isEmpty()) { String uuid = preferences.getString(IMPORT_TARGET_ACCOUNT + extractor.getClass().getSimpleName()); // do not trigger selection listener (-> do not user #setSelection) primaryAccount .getCombo() .select( IntStream.range(0, activeAccounts.size()) .filter(i -> activeAccounts.get(i).getUUID().equals(uuid)) .findAny() .orElse(0)); secondaryAccount.getCombo().select(0); } List<Portfolio> activePortfolios = client.getActivePortfolios(); if (!activePortfolios.isEmpty()) { String uuid = preferences.getString(IMPORT_TARGET_PORTFOLIO + extractor.getClass().getSimpleName()); // do not trigger selection listener (-> do not user #setSelection) primaryPortfolio .getCombo() .select( IntStream.range(0, activePortfolios.size()) .filter(i -> activePortfolios.get(i).getUUID().equals(uuid)) .findAny() .orElse(0)); secondaryPortfolio.getCombo().select(0); } }