Added image preview.
Base64 encoding is now done thru a temporary file.
This commit is contained in:
parent
891603dea2
commit
3f61e9b35b
5 changed files with 380 additions and 193 deletions
198
LifeBlogger.iws
198
LifeBlogger.iws
|
@ -51,9 +51,9 @@
|
|||
<option name="SHOW_CHANGES_REVISION_SETTINGS">
|
||||
<value>
|
||||
<option name="BRANCH" value="" />
|
||||
<option name="DATE" value="" />
|
||||
<option name="DATE" value="Thu Jul 22 16:32:00 2004" />
|
||||
<option name="USE_BRANCH" value="false" />
|
||||
<option name="USE_DATE" value="false" />
|
||||
<option name="USE_DATE" value="true" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="SHOW_OUTPUT" value="false" />
|
||||
|
@ -71,7 +71,7 @@
|
|||
<option name="PUT_FOCUS_INTO_COMMENT" value="true" />
|
||||
<option name="SHOW_CHECKIN_OPTIONS" value="true" />
|
||||
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Added licenses." />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Added password encoding." />
|
||||
<option name="SAVE_LAST_COMMIT_MESSAGE" value="true" />
|
||||
<option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8" />
|
||||
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
|
||||
|
@ -112,10 +112,19 @@
|
|||
<option name="HIDE_WARNINGS" value="false" />
|
||||
</component>
|
||||
<component name="FileEditorManager" split-orientation="vertical" split-proportion="0.5">
|
||||
<first-group selected-file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeMediaObject.java">
|
||||
<first-group selected-file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/preview.xml">
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeMediaObject.java" pinned="false">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="117" column="43" selection-start="3715" selection-end="3715" vertical-scroll-proportion="2.4542253">
|
||||
<state line="116" column="25" selection-start="3769" selection-end="3769" vertical-scroll-proportion="0.18348624">
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeFTP.java" pinned="false">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="85" column="26" selection-start="2912" selection-end="2912" vertical-scroll-proportion="1.559633">
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
|
@ -124,7 +133,44 @@
|
|||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeBlogger.java" pinned="false">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="543" column="85" selection-start="13608" selection-end="13608" vertical-scroll-proportion="0.346831">
|
||||
<state line="503" column="27" selection-start="12296" selection-end="12296" vertical-scroll-proportion="0.18348624">
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/about.xml" pinned="false">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="1" column="38" selection-start="77" selection-end="77" vertical-scroll-proportion="0.03119266">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/alert.xml" pinned="false">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/preview.xml" pinned="false">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="1" column="40" selection-start="79" selection-end="79" vertical-scroll-proportion="0.03119266">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/main.xml" pinned="false">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="16" column="154" selection-start="844" selection-end="844" vertical-scroll-proportion="0.49908257">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeBlog.java" pinned="false">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="54" column="22" selection-start="2096" selection-end="2096" vertical-scroll-proportion="0.38715595">
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
|
@ -133,14 +179,14 @@
|
|||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/ReleaseInfo.java" pinned="false">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="28" column="53" selection-start="795" selection-end="795" vertical-scroll-proportion="0.19894366">
|
||||
<state line="28" column="53" selection-start="795" selection-end="795" vertical-scroll-proportion="0.19266056">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeMediaObjResponse.java" pinned="false">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="54" column="19" selection-start="2104" selection-end="2104" vertical-scroll-proportion="0.346831">
|
||||
<state line="146" column="75" selection-start="4148" selection-end="4148" vertical-scroll-proportion="0.5743119">
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
|
@ -163,14 +209,14 @@
|
|||
<component name="J2EEProjectPane" />
|
||||
<component name="NamedScopeManager" />
|
||||
<component name="PackagesPane">
|
||||
<expanded_node url="" module="LifeBlogger" type="module" />
|
||||
<expanded_node url="net.thauvin.lifeblogger" module="LifeBlogger" type="package" />
|
||||
<expanded_node url="net.thauvin" module="LifeBlogger" type="package" />
|
||||
<expanded_node url="net" module="LifeBlogger" type="package" />
|
||||
<expanded_node url="net.thauvin" module="LifeBlogger" type="package" />
|
||||
<expanded_node url="net.thauvin.lifeblogger" module="LifeBlogger" type="package" />
|
||||
<expanded_node url="" module="LifeBlogger" type="module" />
|
||||
</component>
|
||||
<component name="ProjectPane">
|
||||
<expanded_node url="" module="LifeBlogger" type="module" />
|
||||
<expanded_node url="file://$PROJECT_DIR$" module="LifeBlogger" type="directory" />
|
||||
<expanded_node url="" module="LifeBlogger" type="module" />
|
||||
</component>
|
||||
<component name="ProjectView">
|
||||
<navigator currentView="ProjectPane" splitterProportion="0.5">
|
||||
|
@ -211,20 +257,6 @@
|
|||
<value defaultName="wholeProject" />
|
||||
</option>
|
||||
</configuration>
|
||||
<configuration selected="false" default="true" type="WebLogic Instance" factoryName="Local">
|
||||
<option name="WORKING_DIRECTORY" />
|
||||
<option name="HOST" value="localhost" />
|
||||
<option name="PORT" value="7001" />
|
||||
<option name="LOCAL" value="true" />
|
||||
<option name="OPEN_IN_BROWSER" value="true" />
|
||||
<option name="OPEN_IN_BROWSER_URL" value="/" />
|
||||
<option name="COMMON_VM_ARGUMENTS" value="" />
|
||||
<option name="DOMAIN_PATH" value="" />
|
||||
<option name="USER" value="weblogic" />
|
||||
<option name="PASSWORD" value="weblogic" />
|
||||
<option name="SERVER_NAME" value="myserver" />
|
||||
<option name="DOMAIN_NAME" value="mydomain" />
|
||||
</configuration>
|
||||
<configuration selected="false" default="true" type="Remote" factoryName="Remote">
|
||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||
<option name="SERVER_MODE" value="false" />
|
||||
|
@ -239,6 +271,20 @@
|
|||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<module name="" />
|
||||
</configuration>
|
||||
<configuration selected="false" default="true" type="WebLogic Instance" factoryName="Local">
|
||||
<option name="WORKING_DIRECTORY" />
|
||||
<option name="HOST" value="localhost" />
|
||||
<option name="PORT" value="7001" />
|
||||
<option name="LOCAL" value="true" />
|
||||
<option name="OPEN_IN_BROWSER" value="true" />
|
||||
<option name="OPEN_IN_BROWSER_URL" value="/" />
|
||||
<option name="COMMON_VM_ARGUMENTS" value="" />
|
||||
<option name="DOMAIN_PATH" value="" />
|
||||
<option name="USER" value="weblogic" />
|
||||
<option name="PASSWORD" value="weblogic" />
|
||||
<option name="SERVER_NAME" value="myserver" />
|
||||
<option name="DOMAIN_NAME" value="mydomain" />
|
||||
</configuration>
|
||||
<configuration selected="false" default="true" type="Applet" factoryName="Applet">
|
||||
<module name="" />
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
|
@ -255,14 +301,14 @@
|
|||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<module name="LifeBlogger" />
|
||||
<RunnerSettings RunnerId="Run" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="1127" />
|
||||
<option name="TRANSPORT" value="0" />
|
||||
<option name="LOCAL" value="false" />
|
||||
</RunnerSettings>
|
||||
<ConfigurationWrapper RunnerId="Run" />
|
||||
<RunnerSettings RunnerId="Run" />
|
||||
<ConfigurationWrapper RunnerId="Debug" />
|
||||
<ConfigurationWrapper RunnerId="Run" />
|
||||
</configuration>
|
||||
</component>
|
||||
<component name="SelectInManager" />
|
||||
|
@ -318,14 +364,14 @@
|
|||
<window_info id="CVS" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="8" />
|
||||
<window_info id="Regex" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="9" />
|
||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="7" />
|
||||
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.21734694" order="0" />
|
||||
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.24795918" order="0" />
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="1" />
|
||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="1" />
|
||||
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="10" />
|
||||
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.39969134" order="6" x="66" y="104" width="924" height="583" />
|
||||
<window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="11" />
|
||||
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.13163266" order="1" />
|
||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="2" />
|
||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33796296" order="2" />
|
||||
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="2" />
|
||||
<window_info id="CVS File View" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="3" />
|
||||
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.39969134" order="4" />
|
||||
|
@ -433,34 +479,6 @@
|
|||
</buildFile>
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="jar://C:/j2sdk1.4.2_05/src.zip!/java/util/prefs/AbstractPreferences.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="614" column="24" selection-start="27794" selection-end="27794" vertical-scroll-proportion="0.37922078">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="jar://C:/j2sdk1.4.2_05/src.zip!/java/util/prefs/Base64.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="37" column="26" selection-start="1053" selection-end="1053" vertical-scroll-proportion="0.42079207">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="jar://$PROJECT_DIR$/lib/thinlet.jar!/thinlet/Thinlet.class">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="438" column="0" selection-start="14804" selection-end="14804" vertical-scroll-proportion="0.4293948">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/about.xml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="1" column="38" selection-start="77" selection-end="77" vertical-scroll-proportion="0.046961326">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/transfer.xml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="1" column="135" selection-start="174" selection-end="174" vertical-scroll-proportion="0.048991356">
|
||||
|
@ -489,34 +507,53 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeBlog.java">
|
||||
<entry file="jar://C:/j2sdk1.4.2_05/src.zip!/java/sql/ResultSet.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="54" column="22" selection-start="2096" selection-end="2096" vertical-scroll-proportion="0.26903552">
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
<state line="437" column="11" selection-start="19743" selection-end="19743" vertical-scroll-proportion="9.399657">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeFTP.java">
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/alert.xml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="85" column="26" selection-start="2912" selection-end="2912" vertical-scroll-proportion="0.26903552">
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/about.xml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="1" column="38" selection-start="77" selection-end="77" vertical-scroll-proportion="0.03119266">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/preview.xml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="1" column="40" selection-start="79" selection-end="79" vertical-scroll-proportion="0.03119266">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/main.xml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="7" column="41" selection-start="287" selection-end="287" vertical-scroll-proportion="0.32162163">
|
||||
<state line="16" column="154" selection-start="844" selection-end="844" vertical-scroll-proportion="0.49908257">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeMediaObject.java">
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeBlog.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="117" column="43" selection-start="3715" selection-end="3715" vertical-scroll-proportion="2.4542253">
|
||||
<state line="54" column="22" selection-start="2096" selection-end="2096" vertical-scroll-proportion="0.38715595">
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeMediaObjResponse.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="146" column="75" selection-start="4148" selection-end="4148" vertical-scroll-proportion="0.5743119">
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
|
@ -525,23 +562,32 @@
|
|||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/ReleaseInfo.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="28" column="53" selection-start="795" selection-end="795" vertical-scroll-proportion="0.19894366">
|
||||
<state line="28" column="53" selection-start="795" selection-end="795" vertical-scroll-proportion="0.19266056">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeMediaObjResponse.java">
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeBlogger.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="54" column="19" selection-start="2104" selection-end="2104" vertical-scroll-proportion="0.346831">
|
||||
<state line="503" column="27" selection-start="12296" selection-end="12296" vertical-scroll-proportion="0.18348624">
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeBlogger.java">
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeMediaObject.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="543" column="85" selection-start="13608" selection-end="13608" vertical-scroll-proportion="0.346831">
|
||||
<state line="116" column="25" selection-start="3769" selection-end="3769" vertical-scroll-proportion="0.18348624">
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeFTP.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="85" column="26" selection-start="2912" selection-end="2912" vertical-scroll-proportion="1.559633">
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
|
|
|
@ -40,18 +40,19 @@ import thinlet.FrameLauncher;
|
|||
import thinlet.Thinlet;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
import java.sql.*;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
|
||||
|
@ -225,11 +226,16 @@ public class LifeBlogger extends Thinlet
|
|||
}
|
||||
}
|
||||
|
||||
final Connection con = DriverManager.getConnection(JDBC_PREFIX + _homeDir.getAbsolutePath() + DATABASE);
|
||||
Connection con = null;
|
||||
Statement st = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
final Statement st = con.createStatement();
|
||||
final ResultSet rs =
|
||||
st.executeQuery("SELECT * FROM HooverObject WHERE MobileFavourite = 'true' ORDER BY TimeStamp DESC");
|
||||
try
|
||||
{
|
||||
con = DriverManager.getConnection(JDBC_PREFIX + _homeDir.getAbsolutePath() + DATABASE);
|
||||
|
||||
st = con.createStatement();
|
||||
rs = st.executeQuery("SELECT * FROM HooverObject WHERE MobileFavourite = 'true' ORDER BY TimeStamp DESC");
|
||||
|
||||
Object row;
|
||||
Object cell;
|
||||
|
@ -281,10 +287,13 @@ public class LifeBlogger extends Thinlet
|
|||
}
|
||||
|
||||
thinlet.setString(find(buttonsPanel, "favslbl"), "text", "Favorites: " + found);
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
st.close();
|
||||
rs.close();
|
||||
con.close();
|
||||
}
|
||||
|
||||
toggleButton(table, find(buttonsPanel, "blogbtn"));
|
||||
}
|
||||
|
@ -304,30 +313,21 @@ public class LifeBlogger extends Thinlet
|
|||
if (selected != -1)
|
||||
{
|
||||
final Object row = getItem(table, selected);
|
||||
final String name = String.valueOf(getProperty(getItem(row, 0), "oid"));
|
||||
final String oid = String.valueOf(getProperty(getItem(row, 0), "oid"));
|
||||
|
||||
final Connection con = DriverManager.getConnection(JDBC_PREFIX + _homeDir.getAbsolutePath() + DATABASE);
|
||||
final String[] info = fileInfo(oid);
|
||||
|
||||
final Statement st = con.createStatement();
|
||||
final ResultSet rs = st.executeQuery("SELECT * FROM BinaryItem WHERE HooverObjectID = " + name);
|
||||
|
||||
if (rs.next())
|
||||
if (info[0].length() > 0)
|
||||
{
|
||||
if ("ftp".equals(_action))
|
||||
{
|
||||
ftpDialog(_homeDir.getAbsolutePath() + "\\DataStore" + rs.getString("Pathname") +
|
||||
rs.getString("Filename"));
|
||||
ftpDialog(info[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
mwDialog(_homeDir.getAbsolutePath() + "\\DataStore" + rs.getString("Pathname") +
|
||||
rs.getString("Filename"), rs.getString("ObjectMimeType"));
|
||||
mwDialog(info[1], info[2]);
|
||||
}
|
||||
}
|
||||
|
||||
st.close();
|
||||
rs.close();
|
||||
con.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -484,6 +484,76 @@ public class LifeBlogger extends Thinlet
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Previews a JPEG image.
|
||||
*
|
||||
* @param table The data table.
|
||||
*
|
||||
* @throws Exception If an error occurs while previewing the image.
|
||||
*/
|
||||
public final void preview(Object table)
|
||||
throws Exception
|
||||
{
|
||||
final int selected = getSelectedIndex(table);
|
||||
|
||||
if (selected != -1)
|
||||
{
|
||||
final Object row = getItem(table, selected);
|
||||
final String oid = String.valueOf(getProperty(getItem(row, 0), "oid"));
|
||||
|
||||
final String[] info = fileInfo(oid);
|
||||
|
||||
if (info[0].length() > 0)
|
||||
{
|
||||
if ((info[2].length() > 0) && info[2].endsWith("jpeg"))
|
||||
{
|
||||
// Retrieve the jpg image
|
||||
final BufferedImage in = ImageIO.read(new File(info[1]));
|
||||
|
||||
final int maxDim = 200;
|
||||
|
||||
final int height = in.getHeight();
|
||||
final int width = in.getWidth();
|
||||
|
||||
// Determine the scale.
|
||||
double scale = (double) maxDim / (double) height;
|
||||
|
||||
if (in.getWidth() > in.getHeight())
|
||||
{
|
||||
scale = (double) maxDim / (double) width;
|
||||
}
|
||||
|
||||
int scaledW = (int) (scale * (double) width);
|
||||
int scaledH = (int) (scale * (double) height);
|
||||
|
||||
// Set the scale.
|
||||
final AffineTransform tx = new AffineTransform();
|
||||
|
||||
if (scale <= 1.0d)
|
||||
{
|
||||
tx.scale(scale, scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
scaledW = width;
|
||||
scaledH = height;
|
||||
}
|
||||
|
||||
final BufferedImage out = new BufferedImage(scaledW, scaledH, BufferedImage.TYPE_INT_RGB);
|
||||
|
||||
final Graphics2D g2d = out.createGraphics();
|
||||
g2d.drawImage(in, tx, null);
|
||||
g2d.dispose();
|
||||
|
||||
final Object preview = parse("preview.xml");
|
||||
setString(preview, "text", info[0]);
|
||||
setIcon(find(preview, "image"), "icon", out);
|
||||
add(preview);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays an exception stacktrace.
|
||||
*
|
||||
|
@ -534,6 +604,50 @@ public class LifeBlogger extends Thinlet
|
|||
}
|
||||
}
|
||||
|
||||
// Returns an array containg the file name, location and mime type.
|
||||
private String[] fileInfo(String objectID)
|
||||
throws SQLException
|
||||
{
|
||||
final String[] info = new String[] { "", "", "" };
|
||||
Connection con = null;
|
||||
Statement st = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
try
|
||||
{
|
||||
con = DriverManager.getConnection(JDBC_PREFIX + _homeDir.getAbsolutePath() + DATABASE);
|
||||
|
||||
st = con.createStatement();
|
||||
rs = st.executeQuery("SELECT * FROM BinaryItem WHERE HooverObjectID = " + objectID);
|
||||
|
||||
if (rs.next())
|
||||
{
|
||||
info[0] = rs.getString("Filename");
|
||||
info[1] = _homeDir.getAbsolutePath() + "\\DataStore" + rs.getString("Pathname") + info[0];
|
||||
info[2] = rs.getString("ObjectMimeType");
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (st != null)
|
||||
{
|
||||
st.close();
|
||||
}
|
||||
|
||||
if (rs != null)
|
||||
{
|
||||
rs.close();
|
||||
}
|
||||
|
||||
if (con != null)
|
||||
{
|
||||
con.close();
|
||||
}
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
// Display the FTP dialog.
|
||||
private void ftpDialog(String file)
|
||||
{
|
||||
|
|
|
@ -91,7 +91,9 @@ public class LifeMediaObject extends LifeBlog
|
|||
public final void run()
|
||||
{
|
||||
FileInputStream fis = null;
|
||||
final BufferedReader input = null;
|
||||
FileOutputStream fos = null;
|
||||
BufferedOutputStream bos = null;
|
||||
Base64.OutputStream out = null;
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -104,31 +106,23 @@ public class LifeMediaObject extends LifeBlog
|
|||
throw new IOException("Unsupported URL protocol: " + url.getProtocol());
|
||||
}
|
||||
|
||||
// The following is a little hackish.
|
||||
// A better way would be to generate the request to a temporary file.
|
||||
final long len = getFile().length();
|
||||
|
||||
if (len > Integer.MAX_VALUE)
|
||||
{
|
||||
throw new IOException("Sorry. The file is too large.");
|
||||
}
|
||||
final File tmpFile = File.createTempFile(ReleaseInfo.getProject(), ".b64");
|
||||
tmpFile.deleteOnExit();
|
||||
|
||||
fis = new FileInputStream(getFile());
|
||||
fos = new FileOutputStream(tmpFile);
|
||||
bos = new BufferedOutputStream(fos);
|
||||
out = new Base64.OutputStream(bos, Base64.ENCODE | Base64.DONT_BREAK_LINES);
|
||||
|
||||
final byte[] bytes = new byte[(int) getFile().length()];
|
||||
final byte[] buf = new byte[1024];
|
||||
int len;
|
||||
|
||||
int offset = 0;
|
||||
int numRead = 0;
|
||||
|
||||
while ((offset < bytes.length) && ((numRead = fis.read(bytes, offset, bytes.length - offset)) >= 0))
|
||||
while ((len = fis.read(buf)) > 0)
|
||||
{
|
||||
offset += numRead;
|
||||
out.write(buf, 0, len);
|
||||
}
|
||||
|
||||
if (offset < bytes.length)
|
||||
{
|
||||
throw new IOException("Could not completely read file: " + getFile().getName());
|
||||
}
|
||||
fis.close();
|
||||
|
||||
final StringBuffer start =
|
||||
new StringBuffer("<?xml version=\"1.0\"?><methodCall><methodName>metaWeblog.newMediaObject</methodName><params><param><value><string>").append(_blogID)
|
||||
|
@ -137,7 +131,6 @@ public class LifeMediaObject extends LifeBlog
|
|||
.append("</string></value></param><param><value><string>")
|
||||
.append(getPassword())
|
||||
.append("</string></value></param><param><value><struct><member><name>bits</name><value><base64>");
|
||||
final String bits = Base64.encodeBytes(bytes);
|
||||
|
||||
final StringBuffer end =
|
||||
new StringBuffer("</base64></value></member><member><name>name</name><value><string>").append(getFilename())
|
||||
|
@ -149,18 +142,28 @@ public class LifeMediaObject extends LifeBlog
|
|||
urlConn.setDoInput(true);
|
||||
urlConn.setDoOutput(true);
|
||||
urlConn.setUseCaches(false);
|
||||
urlConn.setRequestProperty("Content-Length", String.valueOf(start.length() + bits.length() + end.length()));
|
||||
urlConn.setRequestProperty("Content-Length",
|
||||
String.valueOf(start.length() + tmpFile.length() + end.length()));
|
||||
urlConn.setRequestProperty("Content-Type", "text/xml");
|
||||
|
||||
final DataOutputStream output = new DataOutputStream(urlConn.getOutputStream());
|
||||
output.write(start.toString().getBytes());
|
||||
output.flush();
|
||||
output.write(bits.getBytes());
|
||||
output.flush();
|
||||
output.write(end.toString().getBytes());
|
||||
output.flush();
|
||||
final DataOutputStream dos = new DataOutputStream(urlConn.getOutputStream());
|
||||
dos.write(start.toString().getBytes());
|
||||
dos.flush();
|
||||
|
||||
output.close();
|
||||
fis = new FileInputStream(tmpFile);
|
||||
|
||||
while ((len = fis.read(buf)) > 0)
|
||||
{
|
||||
dos.write(buf, 0, len);
|
||||
dos.flush();
|
||||
}
|
||||
|
||||
fis.close();
|
||||
|
||||
dos.write(end.toString().getBytes());
|
||||
dos.flush();
|
||||
|
||||
dos.close();
|
||||
|
||||
final LifeMediaObjResponse xmlrpc = new LifeMediaObjResponse(urlConn.getInputStream());
|
||||
|
||||
|
@ -188,18 +191,6 @@ public class LifeMediaObject extends LifeBlog
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (input != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
input.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
; // Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
if (fis != null)
|
||||
{
|
||||
try
|
||||
|
@ -211,6 +202,42 @@ public class LifeMediaObject extends LifeBlog
|
|||
; // Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
if (bos != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
bos.close();
|
||||
}
|
||||
catch (IOException ignore)
|
||||
{
|
||||
; // Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
if (fos != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
fos.close();
|
||||
}
|
||||
catch (IOException ignore)
|
||||
{
|
||||
; // Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
if (out != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
out.close();
|
||||
}
|
||||
catch (IOException ignore)
|
||||
{
|
||||
; // Do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Created by JReleaseInfo AntTask from Open Source Competence Group */
|
||||
/* Creation date Thu Jul 22 16:15:30 PDT 2004 */
|
||||
/* Creation date Thu Jul 22 22:36:26 PDT 2004 */
|
||||
package net.thauvin.lifeblogger;
|
||||
|
||||
import java.util.Date;
|
||||
|
@ -12,21 +12,21 @@ import java.util.Date;
|
|||
public class ReleaseInfo {
|
||||
|
||||
|
||||
/** buildDate (set during build process to 1090538130250L). */
|
||||
private static Date buildDate = new Date(1090538130250L);
|
||||
/** buildDate (set during build process to 1090560986937L). */
|
||||
private static Date buildDate = new Date(1090560986937L);
|
||||
|
||||
/**
|
||||
* Get buildDate (set during build process to Thu Jul 22 16:15:30 PDT 2004).
|
||||
* Get buildDate (set during build process to Thu Jul 22 22:36:26 PDT 2004).
|
||||
* @return Date buildDate
|
||||
*/
|
||||
public static final Date getBuildDate() { return buildDate; }
|
||||
|
||||
|
||||
/**
|
||||
* Get buildNumber (set during build process to 95).
|
||||
* Get buildNumber (set during build process to 97).
|
||||
* @return int buildNumber
|
||||
*/
|
||||
public static final int getBuildNumber() { return 95; }
|
||||
public static final int getBuildNumber() { return 97; }
|
||||
|
||||
|
||||
/** version (set during build process to "0.1.0"). */
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
</menubar>
|
||||
<panel gap="4" top="3" left="3" bottom="3" right="3" columns="1" weighty="1">
|
||||
|
||||
<table name="table" weightx="1" weighty="1" init="addTableRows(thinlet, table, btns)" action="toggleButton(this, blogbtn)">
|
||||
<table name="table" weightx="1" weighty="1" init="addTableRows(thinlet, table, btns)" action="toggleButton(this, blogbtn)" perform="preview(this)">
|
||||
<header>
|
||||
<column text="Name" width="270"/>
|
||||
<column text="Date"/>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue