/** * @return * the credentials encrypted file chosen by the user. */ public File getCredentialsFile() { int selectedNicknameIndex = accountNicknameTable.getSelectedRow(); if (selectedNicknameIndex < 0) { return null; } return nicknamesTableModel.getCredentialsFile(selectedNicknameIndex); }
public void removeAll() { int rowCount = this.getRowCount(); for (int i = 0; i < rowCount; i++) { this.removeRow(0); } credentialFileList.clear(); credentialsList.clear(); }
public int addCredentialsFile(ProviderCredentials credentials, File credentialsFile) { int insertRow = Collections.binarySearch(credentialsList, credentials, new Comparator() { public int compare(Object o1, Object o2) { String name1 = ((ProviderCredentials)o1).getFriendlyName(); String name2 = ((ProviderCredentials)o2).getFriendlyName(); int result = name1.compareToIgnoreCase(name2); return result; } }); if (insertRow >= 0) { // We already have an item with this key, replace it. credentialsList.remove(insertRow); credentialFileList.remove(insertRow); this.removeRow(insertRow); } else { insertRow = (-insertRow) - 1; } // New object to insert. credentialsList.add(insertRow, credentials); credentialFileList.add(insertRow, credentialsFile); this.insertRow(insertRow, new Object[] {credentials.getFriendlyName()}); return insertRow; }
browseButton.addActionListener(this); JHtmlLabel accountNicknamesLabel = new JHtmlLabel(accountNicknameText, hyperlinkListener); nicknamesTableModel = new ProviderCredentialsFileTableModel(); accountNicknameTable = new JTable(nicknamesTableModel); accountNicknameTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
browseButton.addActionListener(this); JHtmlLabel accountNicknamesLabel = new JHtmlLabel(accountNicknameText, hyperlinkListener); nicknamesTableModel = new ProviderCredentialsFileTableModel(); accountNicknameTable = new JTable(nicknamesTableModel); accountNicknameTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
/** * Refreshes the table of stored credentials by finding <tt>*.enc</tt> files in the * directory specified as the Cockpit home folder. * */ public void refreshStoredCredentialsTable() { nicknamesTableModel.removeAll(); try { File[] files = cockpitHomeFolder.listFiles(); for (int i = 0; files != null && i < files.length; i++) { File candidateFile = files[i]; if (candidateFile.getName().endsWith(".enc")) { // Load partial details from credentials file. ProviderCredentials credentials = ProviderCredentials.load(null, candidateFile); nicknamesTableModel.addCredentialsFile( credentials, candidateFile); } } } catch (Exception e) { String message = "Unable to find credential files in the folder " + cockpitHomeFolder.getAbsolutePath(); log.error(message, e); ErrorDialog.showDialog(ownerFrame, hyperlinkListener, message, e); } }
/** * Refreshes the table of stored credentials by finding <tt>*.enc</tt> files in the * directory specified as the Cockpit home folder. * */ public void refreshStoredCredentialsTable() { nicknamesTableModel.removeAll(); try { File[] files = cockpitHomeFolder.listFiles(); for (int i = 0; files != null && i < files.length; i++) { File candidateFile = files[i]; if (candidateFile.getName().endsWith(".enc")) { // Load partial details from credentials file. ProviderCredentials credentials = ProviderCredentials.load(null, candidateFile); nicknamesTableModel.addCredentialsFile( credentials, candidateFile); } } } catch (Exception e) { String message = "Unable to find credential files in the folder " + cockpitHomeFolder.getAbsolutePath(); log.error(message, e); ErrorDialog.showDialog(ownerFrame, hyperlinkListener, message, e); } }
public int addCredentialsFile(ProviderCredentials credentials, File credentialsFile) { int insertRow = Collections.binarySearch(credentialsList, credentials, new Comparator() { public int compare(Object o1, Object o2) { String name1 = ((ProviderCredentials)o1).getFriendlyName(); String name2 = ((ProviderCredentials)o2).getFriendlyName(); int result = name1.compareToIgnoreCase(name2); return result; } }); if (insertRow >= 0) { // We already have an item with this key, replace it. credentialsList.remove(insertRow); credentialFileList.remove(insertRow); this.removeRow(insertRow); } else { insertRow = (-insertRow) - 1; } // New object to insert. credentialsList.add(insertRow, credentials); credentialFileList.add(insertRow, credentialsFile); this.insertRow(insertRow, new Object[] {credentials.getFriendlyName()}); return insertRow; }
/** * @return * the credentials encrypted file chosen by the user. */ public File getCredentialsFile() { int selectedNicknameIndex = accountNicknameTable.getSelectedRow(); if (selectedNicknameIndex < 0) { return null; } return nicknamesTableModel.getCredentialsFile(selectedNicknameIndex); }
public void removeAll() { int rowCount = this.getRowCount(); for (int i = 0; i < rowCount; i++) { this.removeRow(0); } credentialFileList.clear(); credentialsList.clear(); }