[freenet-cvs] r19804 - in trunk/apps/jSite/src/de/todesbaum/jsite: gui main

bombe at freenetproject.org bombe at freenetproject.org
Tue May 6 20:00:07 UTC 2008


Author: bombe
Date: 2008-05-06 20:00:07 +0000 (Tue, 06 May 2008)
New Revision: 19804

Modified:
   trunk/apps/jSite/src/de/todesbaum/jsite/gui/ProjectPage.java
   trunk/apps/jSite/src/de/todesbaum/jsite/main/Configuration.java
   trunk/apps/jSite/src/de/todesbaum/jsite/main/Main.java
   trunk/apps/jSite/src/de/todesbaum/jsite/main/Version.java
Log:
version 0.4.9.8
prevent that the project path contains a slash
clean project path on project loading
localize approve button of file chooser

Modified: trunk/apps/jSite/src/de/todesbaum/jsite/gui/ProjectPage.java
===================================================================
--- trunk/apps/jSite/src/de/todesbaum/jsite/gui/ProjectPage.java	2008-05-06 17:16:41 UTC (rev 19803)
+++ trunk/apps/jSite/src/de/todesbaum/jsite/gui/ProjectPage.java	2008-05-06 20:00:07 UTC (rev 19804)
@@ -47,14 +47,16 @@
 import javax.swing.JScrollPane;
 import javax.swing.JTextField;
 import javax.swing.ListSelectionModel;
-import javax.swing.ScrollPaneConstants;
 import javax.swing.border.EmptyBorder;
 import javax.swing.event.DocumentEvent;
 import javax.swing.event.DocumentListener;
 import javax.swing.event.ListSelectionEvent;
 import javax.swing.event.ListSelectionListener;
+import javax.swing.text.AbstractDocument;
+import javax.swing.text.AttributeSet;
 import javax.swing.text.BadLocationException;
 import javax.swing.text.Document;
+import javax.swing.text.DocumentFilter;
 
 import de.todesbaum.jsite.application.Freenet7Interface;
 import de.todesbaum.jsite.application.Project;
@@ -97,7 +99,7 @@
 		dialogInit();
 		setHeading(I18n.getMessage("jsite.project.heading"));
 		setDescription(I18n.getMessage("jsite.project.description"));
-		
+
 		I18nContainer.getInstance().registerRunnable(new Runnable() {
 
 			public void run() {
@@ -205,9 +207,10 @@
 		projectGenerateKeyAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.generate-new-key.tooltip"));
 		projectGenerateKeyAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_G);
 		projectGenerateKeyAction.setEnabled(false);
-		
+
 		I18nContainer.getInstance().registerRunnable(new Runnable() {
 
+			@SuppressWarnings("synthetic-access")
 			public void run() {
 				projectLocalPathBrowseAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.browse"));
 				projectLocalPathBrowseAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.browse.tooltip"));
@@ -221,6 +224,7 @@
 				projectCopyURIAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.copy-uri.tooltip"));
 				projectGenerateKeyAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.generate-new-key"));
 				projectGenerateKeyAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.generate-new-key.tooltip"));
+				pathChooser.setApproveButtonText(I18n.getMessage("jsite.project.action.browse.choose"));
 			}
 		});
 	}
@@ -296,6 +300,24 @@
 		projectPathTextField = new JTextField();
 		projectPathTextField.getDocument().putProperty("name", "project.path");
 		projectPathTextField.getDocument().addDocumentListener(this);
+		((AbstractDocument) projectPathTextField.getDocument()).setDocumentFilter(new DocumentFilter() {
+
+			/**
+			 * {@inheritDoc}
+			 */
+			@Override
+			public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr) throws BadLocationException {
+				super.insertString(fb, offset, string.replaceAll("/", ""), attr);
+			}
+
+			/**
+			 * {@inheritDoc}
+			 */
+			@Override
+			public void replace(FilterBypass fb, int offset, int length, String text, AttributeSet attrs) throws BadLocationException {
+				super.replace(fb, offset, length, text.replaceAll("/", ""), attrs);
+			}
+		});
 		projectPathTextField.setEnabled(false);
 
 		final TLabel projectPathLabel = new TLabel(I18n.getMessage("jsite.project.project.path") + ":", KeyEvent.VK_P, projectPathTextField);
@@ -428,7 +450,7 @@
 			projectList.setSelectedIndex(projectListModel.indexOf(newProject));
 		}
 	}
-	
+
 	protected void actionCopyURI() {
 		int selectedIndex = projectList.getSelectedIndex();
 		if (selectedIndex > -1) {
@@ -437,7 +459,7 @@
 			clipboard.setContents(new StringSelection(selectedProject.getFinalRequestURI(0)), this);
 		}
 	}
-	
+
 	protected void actionGenerateNewKey() {
 		if (JOptionPane.showConfirmDialog(this, I18n.getMessage("jsite.project.warning.generate-new-key"), null, JOptionPane.OK_CANCEL_OPTION) == JOptionPane.CANCEL_OPTION) {
 			return;
@@ -525,7 +547,7 @@
 	public void changedUpdate(DocumentEvent documentEvent) {
 		setTextField(documentEvent);
 	}
-	
+
 	//
 	// INTERFACE ClipboardOwner
 	//

Modified: trunk/apps/jSite/src/de/todesbaum/jsite/main/Configuration.java
===================================================================
--- trunk/apps/jSite/src/de/todesbaum/jsite/main/Configuration.java	2008-05-06 17:16:41 UTC (rev 19803)
+++ trunk/apps/jSite/src/de/todesbaum/jsite/main/Configuration.java	2008-05-06 20:00:07 UTC (rev 19804)
@@ -241,6 +241,9 @@
 					project.setLocalPath(projectNode.getNode("local-path").getValue());
 					project.setName(projectNode.getNode("name").getValue());
 					project.setPath(projectNode.getNode("path").getValue());
+					if (project.getPath().indexOf("/") != -1) {
+						project.setPath(project.getPath().replaceAll("/", ""));
+					}
 					project.setEdition(Integer.parseInt(projectNode.getNode("edition").getValue()));
 					project.setInsertURI(projectNode.getNode("insert-uri").getValue());
 					project.setRequestURI(projectNode.getNode("request-uri").getValue());

Modified: trunk/apps/jSite/src/de/todesbaum/jsite/main/Main.java
===================================================================
--- trunk/apps/jSite/src/de/todesbaum/jsite/main/Main.java	2008-05-06 17:16:41 UTC (rev 19803)
+++ trunk/apps/jSite/src/de/todesbaum/jsite/main/Main.java	2008-05-06 20:00:07 UTC (rev 19804)
@@ -86,7 +86,7 @@
 	private Main() {
 		this(null);
 	}
-	
+
 	private Main(String configFilename) {
 		if (configFilename != null) {
 			configuration = new Configuration(configFilename);
@@ -135,7 +135,7 @@
 				JOptionPane.showMessageDialog(wizard, MessageFormat.format(I18n.getMessage("jsite.about.message"), Version.getVersion()), null, JOptionPane.INFORMATION_MESSAGE, jSiteIcon);
 			}
 		};
-		
+
 		I18nContainer.getInstance().registerRunnable(new Runnable() {
 			public void run() {
 				manageNodeAction.putValue(Action.NAME, I18n.getMessage("jsite.menu.nodes.manage-nodes"));
@@ -172,7 +172,7 @@
 		final JMenu helpMenu = new JMenu(I18n.getMessage("jsite.menu.help"));
 		menuBar.add(helpMenu);
 		helpMenu.add(aboutAction);
-		
+
 		I18nContainer.getInstance().registerRunnable(new Runnable() {
 			public void run() {
 				languageMenu.setText(I18n.getMessage("jsite.menu.languages"));
@@ -183,7 +183,7 @@
 				}
 			}
 		});
-		
+
 		return menuBar;
 	}
 
@@ -467,5 +467,5 @@
 		System.out.println("--debug\tenables some debug output");
 		System.out.println("--config-file <file>\tuse specified configuration file");
 	}
-	
+
 }

Modified: trunk/apps/jSite/src/de/todesbaum/jsite/main/Version.java
===================================================================
--- trunk/apps/jSite/src/de/todesbaum/jsite/main/Version.java	2008-05-06 17:16:41 UTC (rev 19803)
+++ trunk/apps/jSite/src/de/todesbaum/jsite/main/Version.java	2008-05-06 20:00:07 UTC (rev 19804)
@@ -25,7 +25,7 @@
  */
 public class Version {
 
-	private static final String VERSION = "0.4.9.7";
+	private static final String VERSION = "0.4.9.8";
 
 	public static final String getVersion() {
 		return VERSION;




More information about the cvs mailing list