// --- BEGIN COPYRIGHT BLOCK --- // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; version 2 of the License. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // // (C) 2007 Red Hat, Inc. // All rights reserved. // --- END COPYRIGHT BLOCK --- package com.netscape.admin.certsrv.managecert; import java.util.*; import java.awt.*; import java.awt.event.*; import javax.swing.table.*; import javax.swing.*; import com.netscape.admin.certsrv.*; import com.netscape.admin.certsrv.connection.*; import com.netscape.certsrv.common.*; /** * This class lists out all the CA certificates from the internal token. * * @author chrisho * @version $Revision$, $Date$ * @see com.netscape.admin.certsrv.managecert */ public class ManageCertDialog extends JDialog implements ActionListener, MouseListener { private static final String PANELNAME = "MANAGECERTDIALOG"; static final Dimension DEFAULT_SIZE = new Dimension(460,500); static final Dimension BUTTON_MIN_SIZE = new Dimension(100,30); protected ResourceBundle mResource; private JFrame mParent; private JTable mTable; private ManageCertModel mDataModel; private JButton mClose, mDelete, mEdit, mHelp; private AdminConnection mConn; private static final String HELPINDEX = "configuration-managecert-wizard-certlists-help"; public ManageCertDialog(JFrame parent) { super(parent, true); mParent = parent; setSize(460,500); getRootPane().setDoubleBuffered(true); setLocationRelativeTo(parent); mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName()); setTitle(mResource.getString(PANELNAME+"_TITLE")); setDisplay(); } public void showDialog(AdminConnection conn) { mConn = conn; refresh(); this.show(); } private void refresh() { NameValuePairs response=null; try { response = mConn.search(DestDef.DEST_SERVER_ADMIN, ScopeDef.SC_ALL_CERTLIST, new NameValuePairs()); } catch (EAdminException e) { CMSAdminUtil.showErrorDialog(mParent, mResource, e.toString(), CMSAdminUtil.ERROR_MESSAGE); } if (response == null) { /* we must have gotten timed out */ return; } mDataModel.removeAllRows(); String[] vals = new String[response.size()]; int i=0; for (String entry : response.keySet()) { vals[i++] = entry.trim(); } CMSAdminUtil.bubbleSort(vals); for (i=0; i= 0) { if(e.getClickCount() == 2) { displayCert(); } } } public void mouseReleased(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } private void setButtons() { //enable and disable buttons accordingly if (mTable.getSelectionModel().isSelectionEmpty()) { mDelete.setEnabled(false); mEdit.setEnabled(false); return; } if(mDataModel.getRowCount()< 0) { mDelete.setEnabled(false); mEdit.setEnabled(false); return; } mDelete.setEnabled(true); mEdit.setEnabled(true); } private NameValuePairs getCerts() { int[] rows = mTable.getSelectedRows(); NameValuePairs nvps = new NameValuePairs(); String name = "certName"; for (int i=0; i