2 * jSite - a tool for uploading websites into Freenet
3 * Copyright (C) 2006 David Roden
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 package de.todesbaum.jsite.gui;
22 import java.awt.BorderLayout;
23 import java.awt.Dimension;
24 import java.awt.FlowLayout;
25 import java.awt.GridBagConstraints;
26 import java.awt.GridBagLayout;
27 import java.awt.Insets;
28 import java.awt.Toolkit;
29 import java.awt.datatransfer.Clipboard;
30 import java.awt.datatransfer.ClipboardOwner;
31 import java.awt.datatransfer.StringSelection;
32 import java.awt.datatransfer.Transferable;
33 import java.awt.event.ActionEvent;
34 import java.awt.event.KeyEvent;
35 import java.io.IOException;
36 import java.text.MessageFormat;
38 import javax.swing.AbstractAction;
39 import javax.swing.Action;
40 import javax.swing.JButton;
41 import javax.swing.JComponent;
42 import javax.swing.JFileChooser;
43 import javax.swing.JLabel;
44 import javax.swing.JList;
45 import javax.swing.JOptionPane;
46 import javax.swing.JPanel;
47 import javax.swing.JScrollPane;
48 import javax.swing.JTextField;
49 import javax.swing.ListSelectionModel;
50 import javax.swing.border.EmptyBorder;
51 import javax.swing.event.DocumentEvent;
52 import javax.swing.event.DocumentListener;
53 import javax.swing.event.ListSelectionEvent;
54 import javax.swing.event.ListSelectionListener;
55 import javax.swing.text.AbstractDocument;
56 import javax.swing.text.AttributeSet;
57 import javax.swing.text.BadLocationException;
58 import javax.swing.text.Document;
59 import javax.swing.text.DocumentFilter;
61 import de.todesbaum.jsite.application.Freenet7Interface;
62 import de.todesbaum.jsite.application.Project;
63 import de.todesbaum.jsite.i18n.I18n;
64 import de.todesbaum.jsite.i18n.I18nContainer;
65 import de.todesbaum.util.swing.SortedListModel;
66 import de.todesbaum.util.swing.TLabel;
67 import de.todesbaum.util.swing.TWizard;
68 import de.todesbaum.util.swing.TWizardPage;
71 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
73 public class ProjectPage extends TWizardPage implements ListSelectionListener, DocumentListener, ClipboardOwner {
75 private Freenet7Interface freenetInterface;
77 protected Action projectLocalPathBrowseAction;
78 protected Action projectAddAction;
79 protected Action projectDeleteAction;
80 protected Action projectCloneAction;
81 protected Action projectCopyURIAction;
82 protected Action projectGenerateKeyAction;
84 private JFileChooser pathChooser;
85 private SortedListModel projectListModel;
86 private JScrollPane projectScrollPane;
87 private JList projectList;
88 private JTextField projectNameTextField;
89 private JTextField projectDescriptionTextField;
90 private JTextField projectLocalPathTextField;
91 private JTextField projectPublicKeyTextField;
92 private JTextField projectPrivateKeyTextField;
93 private JTextField projectPathTextField;
95 public ProjectPage(final TWizard wizard) {
97 setLayout(new BorderLayout(12, 12));
99 setHeading(I18n.getMessage("jsite.project.heading"));
100 setDescription(I18n.getMessage("jsite.project.description"));
102 I18nContainer.getInstance().registerRunnable(new Runnable() {
105 setHeading(I18n.getMessage("jsite.project.heading"));
106 setDescription(I18n.getMessage("jsite.project.description"));
111 protected void dialogInit() {
114 pathChooser = new JFileChooser();
115 projectListModel = new SortedListModel();
116 projectList = new JList(projectListModel);
117 projectList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
118 projectList.addListSelectionListener(this);
119 projectList.setPreferredSize(new Dimension(150, projectList.getPreferredSize().height));
121 add(projectScrollPane = new JScrollPane(projectList), BorderLayout.LINE_START);
122 add(createInformationPanel(), BorderLayout.CENTER);
129 public void pageAdded(TWizard wizard) {
130 super.pageAdded(wizard);
131 projectList.clearSelection();
132 this.wizard.setPreviousName(I18n.getMessage("jsite.menu.nodes.manage-nodes"));
133 this.wizard.setNextName(I18n.getMessage("jsite.wizard.next"));
134 this.wizard.setQuitName(I18n.getMessage("jsite.wizard.quit"));
135 this.wizard.setNextEnabled(false);
140 public void addListSelectionListener(ListSelectionListener listener) {
141 projectList.addListSelectionListener(listener);
146 public void removeListSelectionListener(ListSelectionListener listener) {
147 projectList.removeListSelectionListener(listener);
150 private void createActions() {
151 projectLocalPathBrowseAction = new AbstractAction(I18n.getMessage("jsite.project.action.browse")) {
153 public void actionPerformed(ActionEvent actionEvent) {
154 actionLocalPathBrowse();
157 projectLocalPathBrowseAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.browse.tooltip"));
158 projectLocalPathBrowseAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_B);
159 projectLocalPathBrowseAction.setEnabled(false);
161 projectAddAction = new AbstractAction(I18n.getMessage("jsite.project.action.add-project")) {
163 public void actionPerformed(ActionEvent actionEvent) {
167 projectAddAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.add-project.tooltip"));
168 projectAddAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_A);
170 projectDeleteAction = new AbstractAction(I18n.getMessage("jsite.project.action.delete-project")) {
172 public void actionPerformed(ActionEvent actionEvent) {
176 projectDeleteAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.delete-project.tooltip"));
177 projectDeleteAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_D);
178 projectDeleteAction.setEnabled(false);
180 projectCloneAction = new AbstractAction(I18n.getMessage("jsite.project.action.clone-project")) {
182 public void actionPerformed(ActionEvent actionEvent) {
186 projectCloneAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.clone-project.tooltip"));
187 projectCloneAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_L);
188 projectCloneAction.setEnabled(false);
190 projectCopyURIAction = new AbstractAction(I18n.getMessage("jsite.project.action.copy-uri")) {
192 public void actionPerformed(ActionEvent actionEvent) {
196 projectCopyURIAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.copy-uri.tooltip"));
197 projectCopyURIAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_U);
198 projectCopyURIAction.setEnabled(false);
200 projectGenerateKeyAction = new AbstractAction(I18n.getMessage("jsite.project.action.generate-new-key")) {
202 public void actionPerformed(ActionEvent actionEvent) {
203 actionGenerateNewKey();
206 projectGenerateKeyAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.generate-new-key.tooltip"));
207 projectGenerateKeyAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_G);
208 projectGenerateKeyAction.setEnabled(false);
210 I18nContainer.getInstance().registerRunnable(new Runnable() {
212 @SuppressWarnings("synthetic-access")
214 projectLocalPathBrowseAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.browse"));
215 projectLocalPathBrowseAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.browse.tooltip"));
216 projectAddAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.add-project"));
217 projectAddAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.add-project.tooltip"));
218 projectDeleteAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.delete-project"));
219 projectDeleteAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.delete-project.tooltip"));
220 projectCloneAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.clone-project"));
221 projectCloneAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.clone-project.tooltip"));
222 projectCopyURIAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.copy-uri"));
223 projectCopyURIAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.copy-uri.tooltip"));
224 projectGenerateKeyAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.generate-new-key"));
225 projectGenerateKeyAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.generate-new-key.tooltip"));
226 pathChooser.setApproveButtonText(I18n.getMessage("jsite.project.action.browse.choose"));
231 private JComponent createInformationPanel() {
232 JPanel informationPanel = new JPanel(new BorderLayout(12, 12));
234 JPanel informationTable = new JPanel(new GridBagLayout());
236 JPanel functionButtons = new JPanel(new FlowLayout(FlowLayout.LEADING, 12, 12));
237 functionButtons.setBorder(new EmptyBorder(-12, -12, -12, -12));
238 functionButtons.add(new JButton(projectAddAction));
239 functionButtons.add(new JButton(projectDeleteAction));
240 functionButtons.add(new JButton(projectCloneAction));
241 functionButtons.add(new JButton(projectCopyURIAction));
243 informationPanel.add(functionButtons, BorderLayout.PAGE_START);
244 informationPanel.add(informationTable, BorderLayout.CENTER);
246 final JLabel projectInformationLabel = new JLabel("<html><b>" + I18n.getMessage("jsite.project.project.information") + "</b></html>");
247 informationTable.add(projectInformationLabel, new GridBagConstraints(0, 0, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
249 projectNameTextField = new JTextField();
250 projectNameTextField.getDocument().putProperty("name", "project.name");
251 projectNameTextField.getDocument().addDocumentListener(this);
252 projectNameTextField.setEnabled(false);
254 final TLabel projectNameLabel = new TLabel(I18n.getMessage("jsite.project.project.name") + ":", KeyEvent.VK_N, projectNameTextField);
255 informationTable.add(projectNameLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
256 informationTable.add(projectNameTextField, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
258 projectDescriptionTextField = new JTextField();
259 projectDescriptionTextField.getDocument().putProperty("name", "project.description");
260 projectDescriptionTextField.getDocument().addDocumentListener(this);
261 projectDescriptionTextField.setEnabled(false);
263 final TLabel projectDescriptionLabel = new TLabel(I18n.getMessage("jsite.project.project.description") + ":", KeyEvent.VK_D, projectDescriptionTextField);
264 informationTable.add(projectDescriptionLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
265 informationTable.add(projectDescriptionTextField, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
267 projectLocalPathTextField = new JTextField();
268 projectLocalPathTextField.getDocument().putProperty("name", "project.localpath");
269 projectLocalPathTextField.getDocument().addDocumentListener(this);
270 projectLocalPathTextField.setEnabled(false);
272 final TLabel projectLocalPathLabel = new TLabel(I18n.getMessage("jsite.project.project.local-path") + ":", KeyEvent.VK_L, projectLocalPathTextField);
273 informationTable.add(projectLocalPathLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
274 informationTable.add(projectLocalPathTextField, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
275 informationTable.add(new JButton(projectLocalPathBrowseAction), new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
277 final JLabel projectAddressLabel = new JLabel("<html><b>" + I18n.getMessage("jsite.project.project.address") + "</b></html>");
278 informationTable.add(projectAddressLabel, new GridBagConstraints(0, 4, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(12, 0, 0, 0), 0, 0));
280 projectPublicKeyTextField = new JTextField(27);
281 projectPublicKeyTextField.getDocument().putProperty("name", "project.publickey");
282 projectPublicKeyTextField.getDocument().addDocumentListener(this);
283 projectPublicKeyTextField.setEnabled(false);
285 final TLabel projectPublicKeyLabel = new TLabel(I18n.getMessage("jsite.project.project.public-key") + ":", KeyEvent.VK_U, projectPublicKeyTextField);
286 informationTable.add(projectPublicKeyLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
287 informationTable.add(projectPublicKeyTextField, new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
288 informationTable.add(new JButton(projectGenerateKeyAction), new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
290 projectPrivateKeyTextField = new JTextField(27);
291 projectPrivateKeyTextField.getDocument().putProperty("name", "project.privatekey");
292 projectPrivateKeyTextField.getDocument().addDocumentListener(this);
293 projectPrivateKeyTextField.setEnabled(false);
295 final TLabel projectPrivateKeyLabel = new TLabel(I18n.getMessage("jsite.project.project.private-key") + ":", KeyEvent.VK_R, projectPrivateKeyTextField);
296 informationTable.add(projectPrivateKeyLabel, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
297 informationTable.add(projectPrivateKeyTextField, new GridBagConstraints(1, 6, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
299 projectPathTextField = new JTextField();
300 projectPathTextField.getDocument().putProperty("name", "project.path");
301 projectPathTextField.getDocument().addDocumentListener(this);
302 ((AbstractDocument) projectPathTextField.getDocument()).setDocumentFilter(new DocumentFilter() {
308 public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr) throws BadLocationException {
309 super.insertString(fb, offset, string.replaceAll("/", ""), attr);
316 public void replace(FilterBypass fb, int offset, int length, String text, AttributeSet attrs) throws BadLocationException {
317 super.replace(fb, offset, length, text.replaceAll("/", ""), attrs);
320 projectPathTextField.setEnabled(false);
322 final TLabel projectPathLabel = new TLabel(I18n.getMessage("jsite.project.project.path") + ":", KeyEvent.VK_P, projectPathTextField);
323 I18nContainer.getInstance().registerRunnable(new Runnable() {
326 projectInformationLabel.setText("<html><b>" + I18n.getMessage("jsite.project.project.information") + "</b></html>");
327 projectNameLabel.setText(I18n.getMessage("jsite.project.project.name") + ":");
328 projectDescriptionLabel.setText(I18n.getMessage("jsite.project.project.description") + ":");
329 projectLocalPathLabel.setText(I18n.getMessage("jsite.project.project.local-path") + ":");
330 projectAddressLabel.setText("<html><b>" + I18n.getMessage("jsite.project.project.address") + "</b></html>");
331 projectPublicKeyLabel.setText(I18n.getMessage("jsite.project.project.public-key") + ":");
332 projectPrivateKeyLabel.setText(I18n.getMessage("jsite.project.project.private-key") + ":");
333 projectPathLabel.setText(I18n.getMessage("jsite.project.project.path") + ":");
336 informationTable.add(projectPathLabel, new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
337 informationTable.add(projectPathTextField, new GridBagConstraints(1, 7, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
339 return informationPanel;
342 public void setProjects(Project[] projects) {
343 projectListModel.clear();
344 for (Project project: projects) {
345 projectListModel.add(project);
349 public Project[] getProjects() {
350 return (Project[]) projectListModel.toArray(new Project[projectListModel.size()]);
354 * @param freenetInterface
355 * The freenetInterface to set.
357 public void setFreenetInterface(Freenet7Interface freenetInterface) {
358 this.freenetInterface = freenetInterface;
361 public Project getSelectedProject() {
362 return (Project) projectList.getSelectedValue();
365 private void setTextField(DocumentEvent documentEvent) {
366 Document document = documentEvent.getDocument();
367 String propertyName = (String) document.getProperty("name");
368 Project project = (Project) projectList.getSelectedValue();
369 if (project == null) {
373 String text = document.getText(0, document.getLength()).trim();
374 if ("project.name".equals(propertyName)) {
375 project.setName(text);
376 projectList.repaint();
377 } else if ("project.description".equals(propertyName)) {
378 project.setDescription(text);
379 } else if ("project.localpath".equals(propertyName)) {
380 project.setLocalPath(text);
381 } else if ("project.privatekey".equals(propertyName)) {
382 project.setInsertURI(text);
383 } else if ("project.publickey".equals(propertyName)) {
384 project.setRequestURI(text);
385 } else if ("project.path".equals(propertyName)) {
386 project.setPath(text);
388 } catch (BadLocationException e) {
396 protected void actionLocalPathBrowse() {
397 Project project = (Project) projectList.getSelectedValue();
398 if (project == null) {
401 pathChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
402 if (pathChooser.showDialog(this, I18n.getMessage("jsite.project.action.browse.choose")) == JFileChooser.APPROVE_OPTION) {
403 projectLocalPathTextField.setText(pathChooser.getSelectedFile().getPath());
407 protected void actionAdd() {
408 String[] keyPair = null;
409 if (!freenetInterface.hasNode()) {
410 JOptionPane.showMessageDialog(this, I18n.getMessage("jsite.project-files.no-node-selected"), null, JOptionPane.ERROR_MESSAGE);
414 keyPair = freenetInterface.generateKeyPair();
415 } catch (IOException ioe1) {
416 JOptionPane.showMessageDialog(this, MessageFormat.format(I18n.getMessage("jsite.project.keygen.io-error"), ioe1.getMessage()), null, JOptionPane.ERROR_MESSAGE);
419 Project newProject = new Project();
420 newProject.setName(I18n.getMessage("jsite.project.new-project.name"));
421 newProject.setInsertURI(keyPair[0]);
422 newProject.setRequestURI(keyPair[1]);
423 newProject.setEdition(0);
424 projectListModel.add(newProject);
425 projectScrollPane.revalidate();
426 projectScrollPane.repaint();
427 projectList.setSelectedIndex(projectListModel.size() - 1);
430 protected void actionDelete() {
431 int selectedIndex = projectList.getSelectedIndex();
432 if (selectedIndex > -1) {
433 if (JOptionPane.showConfirmDialog(this, MessageFormat.format(I18n.getMessage("jsite.project.action.delete-project.confirm"), ((Project) projectList.getSelectedValue()).getName()), null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION) {
434 projectListModel.remove(selectedIndex);
435 projectList.clearSelection();
436 if (projectListModel.getSize() != 0) {
437 projectList.setSelectedIndex(Math.min(selectedIndex, projectListModel.getSize() - 1));
443 protected void actionClone() {
444 int selectedIndex = projectList.getSelectedIndex();
445 if (selectedIndex > -1) {
446 Project newProject = new Project((Project) projectList.getSelectedValue());
447 newProject.setName(MessageFormat.format(I18n.getMessage("jsite.project.action.clone-project.copy"), newProject.getName()));
448 projectListModel.add(newProject);
449 projectList.setSelectedIndex(projectListModel.indexOf(newProject));
453 protected void actionCopyURI() {
454 int selectedIndex = projectList.getSelectedIndex();
455 if (selectedIndex > -1) {
456 Project selectedProject = (Project) projectList.getSelectedValue();
457 Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
458 clipboard.setContents(new StringSelection(selectedProject.getFinalRequestURI(0)), this);
462 protected void actionGenerateNewKey() {
463 if (JOptionPane.showConfirmDialog(this, I18n.getMessage("jsite.project.warning.generate-new-key"), null, JOptionPane.OK_CANCEL_OPTION) == JOptionPane.CANCEL_OPTION) {
466 int selectedIndex = projectList.getSelectedIndex();
467 if (selectedIndex > -1) {
468 Project selectedProject = (Project) projectList.getSelectedValue();
469 String[] keyPair = null;
471 keyPair = freenetInterface.generateKeyPair();
472 } catch (IOException ioe1) {
473 JOptionPane.showMessageDialog(this, MessageFormat.format(I18n.getMessage("jsite.project.keygen.io-error"), ioe1.getMessage()), null, JOptionPane.ERROR_MESSAGE);
476 selectedProject.setInsertURI(keyPair[0]);
477 selectedProject.setRequestURI(keyPair[1]);
478 projectPublicKeyTextField.setText(selectedProject.getRequestURI());
479 projectPrivateKeyTextField.setText(selectedProject.getInsertURI());
484 // INTERFACE ListSelectionListener
490 public void valueChanged(ListSelectionEvent listSelectionEvent) {
491 int selectedRow = projectList.getSelectedIndex();
492 Project selectedProject = (Project) projectList.getSelectedValue();
493 projectNameTextField.setEnabled(selectedRow > -1);
494 projectDescriptionTextField.setEnabled(selectedRow > -1);
495 projectLocalPathTextField.setEnabled(selectedRow > -1);
496 projectPublicKeyTextField.setEnabled(selectedRow > -1);
497 projectPrivateKeyTextField.setEnabled(selectedRow > -1);
498 projectPathTextField.setEnabled(selectedRow > -1);
499 projectLocalPathBrowseAction.setEnabled(selectedRow > -1);
500 projectDeleteAction.setEnabled(selectedRow > -1);
501 projectCloneAction.setEnabled(selectedRow > -1);
502 projectCopyURIAction.setEnabled(selectedRow > -1);
503 projectGenerateKeyAction.setEnabled(selectedRow > -1);
504 if (selectedRow > -1) {
505 projectNameTextField.setText(selectedProject.getName());
506 projectDescriptionTextField.setText(selectedProject.getDescription());
507 projectLocalPathTextField.setText(selectedProject.getLocalPath());
508 projectPublicKeyTextField.setText(selectedProject.getRequestURI());
509 projectPrivateKeyTextField.setText(selectedProject.getInsertURI());
510 projectPathTextField.setText(selectedProject.getPath());
512 projectNameTextField.setText("");
513 projectDescriptionTextField.setText("");
514 projectLocalPathTextField.setText("");
515 projectPublicKeyTextField.setText("");
516 projectPrivateKeyTextField.setText("");
517 projectPathTextField.setText("");
522 // INTERFACE ChangeListener
526 // INTERFACE DocumentListener
532 public void insertUpdate(DocumentEvent documentEvent) {
533 setTextField(documentEvent);
539 public void removeUpdate(DocumentEvent documentEvent) {
540 setTextField(documentEvent);
546 public void changedUpdate(DocumentEvent documentEvent) {
547 setTextField(documentEvent);
551 // INTERFACE ClipboardOwner
557 public void lostOwnership(Clipboard clipboard, Transferable contents) {