Updated to Commons Net 1.3.0

Added Anti-Aliasing
Fixed a problem with uploading binary files.
This commit is contained in:
Erik C. Thauvin 2005-02-06 08:52:18 +00:00
parent 3fac476ddf
commit b3a9e880ce
14 changed files with 86 additions and 40 deletions

View file

@ -0,0 +1,49 @@
/*
* @(#)AntiAliasedThinlet.java
*
* Copyright (C) 2004 by Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* $Id$
*
*/
package net.thauvin.lifeblogger;
import thinlet.Thinlet;
import java.awt.*;
/**
* The <code>AntiAliasedThinlet</code> class implements an anti-aliased {@link thinlet.Thinlet Thinlet} component.
*
* @author Erik C. Thauvin
* @version $Revision$, $Date$
*
* @created Nov 25, 2004
* @since 1.0
*/
public class AntiAliasedThinlet extends Thinlet
{
/**
* Creates a new AntiAliasedThinlet object.
*/
public AntiAliasedThinlet()
{
super();
}
/**
* Paints the components inside the graphics clip area.
*
* @param g The graphics clip area.
*
* @see thinlet.Thinlet#paint(java.awt.Graphics)
*/
public void paint(Graphics g)
{
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
super.paint(g);
}
}

View file

@ -65,7 +65,7 @@ import javax.swing.*;
* @created Jul 19, 2004
* @since 1.0
*/
public class LifeBlogger extends Thinlet
public class LifeBlogger extends AntiAliasedThinlet
{
private static final String DRIVER = "SQLite.JDBCDriver";
private static final String PREFS =
@ -628,7 +628,7 @@ public class LifeBlogger extends Thinlet
}
catch (Exception e)
{
showException(e);
handleException(e);
}
}
@ -637,7 +637,7 @@ public class LifeBlogger extends Thinlet
*
* @param thr The exception.
*/
protected final void showException(Throwable thr)
protected final void handleException(Throwable thr)
{
final StringWriter writer = new StringWriter();
thr.printStackTrace(new PrintWriter(writer));

View file

@ -36,22 +36,20 @@
*/
package net.thauvin.lifeblogger;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPReply;
import org.apache.commons.net.ftp.FTP;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
/**
* The <code>LifeFTP</code> class stores/uploads a file to a FTP server.
*
* @author <a href="http://www.thauvin.net/erik/">Erik C. Thauvin</a>
* @version $Revision$, $Date$
*
* @created Jul 20, 2004
* @since 1.0
*/
@ -71,8 +69,8 @@ public class LifeFTP extends LifeBlog
* @throws IOException If an error occurs while creating the object.
*/
public LifeFTP(LifeBlogger thinlet, String host, String login, String password, String path, String filename,
File file)
throws IOException
File file)
throws IOException
{
super(thinlet, host, login, password, path, filename, file);
}
@ -116,16 +114,18 @@ public class LifeFTP extends LifeBlog
if (success)
{
final BufferedInputStream bis = new BufferedInputStream(new FileInputStream(getFile()));
if (!getFilename().endsWith(".txt"))
{
ftp.setFileTransferMode(FTP.BINARY_FILE_TYPE);
ftp.setFileType(FTP.BINARY_FILE_TYPE);
}
ftp.storeFile(getFilename(), bis);
ftp.enterLocalPassiveMode();
bis.close();
final InputStream is = new FileInputStream(getFile());
ftp.storeFile(getFilename(), is);
is.close();
success = FTPReply.isPositiveCompletion(ftp.getReplyCode());
@ -138,6 +138,9 @@ public class LifeFTP extends LifeBlog
getThinlet().closeDialog(getDialog());
getThinlet().postDialog(getPath() + (getPath().endsWith("/") ? "" : "/") + getFilename(), getFilename());
}
ftp.logout();
}
}
@ -146,7 +149,7 @@ public class LifeFTP extends LifeBlog
catch (IOException e)
{
getThinlet().closeDialog(getDialog());
getThinlet().showException(e);
getThinlet().handleException(e);
}
}
}

View file

@ -177,7 +177,7 @@ public class LifeMediaObject extends LifeBlog
catch (IOException e)
{
getThinlet().closeDialog(getDialog());
getThinlet().showException(e);
getThinlet().handleException(e);
}
finally
{

View file

@ -143,7 +143,7 @@ public class LifePost extends LifeAction
catch (IOException e)
{
getThinlet().closeDialog(getDialog());
getThinlet().showException(e);
getThinlet().handleException(e);
}
}

View file

@ -1,5 +1,5 @@
/* Created by JReleaseInfo AntTask from Open Source Competence Group */
/* Creation date Wed Sep 29 05:39:16 PDT 2004 */
/* Creation date Sun Feb 06 00:48:16 PST 2005 */
package net.thauvin.lifeblogger;
import java.util.Date;
@ -12,28 +12,28 @@ import java.util.Date;
public class ReleaseInfo {
/** buildDate (set during build process to 1096461556906L). */
private static Date buildDate = new Date(1096461556906L);
/** buildDate (set during build process to 1107679696812L). */
private static Date buildDate = new Date(1107679696812L);
/**
* Get buildDate (set during build process to Wed Sep 29 05:39:16 PDT 2004).
* Get buildDate (set during build process to Sun Feb 06 00:48:16 PST 2005).
* @return Date buildDate
*/
public static final Date getBuildDate() { return buildDate; }
/**
* Get buildNumber (set during build process to 1).
* Get buildNumber (set during build process to 5).
* @return int buildNumber
*/
public static final int getBuildNumber() { return 1; }
public static final int getBuildNumber() { return 5; }
/** version (set during build process to "0.1.1"). */
private static String version = new String("0.1.1");
/** version (set during build process to "0.1.2"). */
private static String version = new String("0.1.2");
/**
* Get version (set during build process to "0.1.1").
* Get version (set during build process to "0.1.2").
* @return String version
*/
public static final String getVersion() { return version; }