[jsword-svn] r1107 - in trunk: bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install common/src/main/java/org/crosswire/common/util
dmsmith at crosswire.org
dmsmith at crosswire.org
Mon Jul 24 13:45:58 MST 2006
Author: dmsmith
Date: 2006-07-24 13:45:45 -0700 (Mon, 24 Jul 2006)
New Revision: 1107
Modified:
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/EditSitePane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitesPane.java
trunk/common/src/main/java/org/crosswire/common/util/WebResource.java
Log:
Used HeadMethod rather than GetMethod for getting the size and last modified date.
Improved diagnostics.
Fixed a linux bug in the EditSites.
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/EditSitePane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/EditSitePane.java 2006-07-24 12:18:12 UTC (rev 1106)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/EditSitePane.java 2006-07-24 20:45:45 UTC (rev 1107)
@@ -31,6 +31,8 @@
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
import javax.swing.BorderFactory;
import javax.swing.JButton;
@@ -41,6 +43,7 @@
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
+import javax.swing.JRootPane;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JSplitPane;
@@ -233,11 +236,13 @@
dlgMain.getRootPane().registerKeyboardAction(closer, esc, JComponent.WHEN_IN_FOCUSED_WINDOW);
dlgMain.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
dlgMain.setTitle(Msg.EDIT_SITE_TITLE.toString());
+ dlgMain.setResizable(true);
dlgMain.setModal(true);
GuiUtil.setSize(dlgMain, new Dimension(480, 320));
GuiUtil.centerWindow(dlgMain);
dlgMain.setVisible(true);
+ dlgMain.toFront();
}
/**
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitesPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitesPane.java 2006-07-24 12:18:12 UTC (rev 1106)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitesPane.java 2006-07-24 20:45:45 UTC (rev 1107)
@@ -176,7 +176,6 @@
dlgMain.getContentPane().add(this, BorderLayout.CENTER);
dlgMain.getContentPane().add(createButtons(), BorderLayout.SOUTH);
dlgMain.setTitle(Msg.AVAILABLE_BOOKS.toString());
- dlgMain.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
dlgMain.setResizable(true);
//dlgMain.setModal(true);
dlgMain.addWindowListener(new WindowAdapter()
Modified: trunk/common/src/main/java/org/crosswire/common/util/WebResource.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/WebResource.java 2006-07-24 12:18:12 UTC (rev 1106)
+++ trunk/common/src/main/java/org/crosswire/common/util/WebResource.java 2006-07-24 20:45:45 UTC (rev 1107)
@@ -1,15 +1,23 @@
/**
- * Distribution License: JSword is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License, version
- * 2.1 as published by the Free Software Foundation. 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 Lesser General Public License for more details. The License is
- * available on the internet at: http://www.gnu.org/copyleft/lgpl.html or by
- * writing to: Free Software Foundation, Inc. 59 Temple Place - Suite 330
- * Boston, MA 02111-1307, USA Copyright: 2005 The copyright to this program is
- * held by it's authors. ID: $Id: URLFilter.java,v 1.5 2005/07/27 23:26:42
- * dmsmith Exp $
+ * Distribution License:
+ * BibleDesktop is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, version 2 as published by
+ * the Free Software Foundation. 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.
+ *
+ * The License is available on the internet at:
+ * http://www.gnu.org/copyleft/gpl.html
+ * or by writing to:
+ * Free Software Foundation, Inc.
+ * 59 Temple Place - Suite 330
+ * Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2005
+ * The copyright to this program is held by it's authors.
+ *
+ * ID: $Id$
*/
package org.crosswire.common.util;
@@ -25,6 +33,7 @@
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.ProxyHost;
import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.HeadMethod;
import org.apache.commons.httpclient.util.HttpURLConnection;
/**
@@ -68,16 +77,19 @@
*/
public int getSize()
{
- HttpMethod method = new GetMethod(url.getPath());
+ HttpMethod method = new HeadMethod(url.getPath());
try
{
// Execute the method.
- if (client.executeMethod(method) == HttpStatus.SC_OK)
+ int status = client.executeMethod(method);
+ if (status == HttpStatus.SC_OK)
{
HttpURLConnection connection = new HttpURLConnection(method, url);
return connection.getContentLength();
}
+ String reason = HttpStatus.getStatusText(status);
+ Reporter.informUser(this, reason + ": " + url.getFile()); //$NON-NLS-1$
}
catch (Exception e)
{
@@ -95,11 +107,11 @@
* Determine the last modified date of this WebResource.
* <p>Note that the http client may read the entire file.</p>
*
- * @return the size of the file
+ * @return the last mod date of the file
*/
public long getLastModified()
{
- HttpMethod method = new GetMethod(url.getPath());
+ HttpMethod method = new HeadMethod(url.getPath());
try
{
More information about the jsword-svn
mailing list