japi-cvs Mailing List for JAPI (Page 5)
Status: Beta
Brought to you by:
christianhujer
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
(115) |
May
(11) |
Jun
(5) |
Jul
(2) |
Aug
(10) |
Sep
(35) |
Oct
(14) |
Nov
(49) |
Dec
(27) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(57) |
Feb
(1) |
Mar
|
Apr
(2) |
May
(25) |
Jun
(134) |
Jul
(76) |
Aug
(34) |
Sep
(27) |
Oct
(5) |
Nov
|
Dec
(1) |
2008 |
Jan
(3) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(63) |
Nov
(30) |
Dec
(43) |
2009 |
Jan
(10) |
Feb
(420) |
Mar
(67) |
Apr
(3) |
May
(61) |
Jun
(21) |
Jul
(19) |
Aug
|
Sep
(6) |
Oct
(16) |
Nov
(1) |
Dec
|
2010 |
Jan
(1) |
Feb
|
Mar
|
Apr
(7) |
May
(3) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
From: <chr...@us...> - 2009-05-22 17:29:06
|
Revision: 1310 http://japi.svn.sourceforge.net/japi/?rev=1310&view=rev Author: christianhujer Date: 2009-05-22 17:28:57 +0000 (Fri, 22 May 2009) Log Message: ----------- [2795499] additionalBundles fails for the second bundle Modified Paths: -------------- libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/ReflectionAction.java Modified: libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/ReflectionAction.java =================================================================== --- libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/ReflectionAction.java 2009-05-21 19:06:53 UTC (rev 1309) +++ libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/ReflectionAction.java 2009-05-22 17:28:57 UTC (rev 1310) @@ -59,7 +59,7 @@ private static final Object[] NO_ARGUMENTS = new Object[0]; /** Action Builder for reading strings. */ - private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.japi.swing"); + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.japi.swing.action"); /** The key used for storing the target object to invoke the method on. * Value Type: {@link Object}. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-21 19:07:01
|
Revision: 1309 http://japi.svn.sourceforge.net/japi/?rev=1309&view=rev Author: christianhujer Date: 2009-05-21 19:06:53 +0000 (Thu, 21 May 2009) Log Message: ----------- Created release tag 0.2.0 for branch 0.2. Added Paths: ----------- libs/swing-action/tags/0.2.0/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-21 19:06:40
|
Revision: 1308 http://japi.svn.sourceforge.net/japi/?rev=1308&view=rev Author: christianhujer Date: 2009-05-21 19:06:32 +0000 (Thu, 21 May 2009) Log Message: ----------- Created branch 0.2. Modified Paths: -------------- libs/swing-action/branches/0.2/libs-swing-action.iml Added Paths: ----------- libs/swing-action/branches/0.2/ Property changes on: libs/swing-action/branches/0.2 ___________________________________________________________________ Added: svn:ignore + bin classes dest developer.properties dist docs Added: svn:externals + ^/common/trunk@1307 common Added: svn:mergeinfo + Modified: libs/swing-action/branches/0.2/libs-swing-action.iml =================================================================== --- libs/swing-action/trunk/libs-swing-action.iml 2009-05-21 18:38:22 UTC (rev 1307) +++ libs/swing-action/branches/0.2/libs-swing-action.iml 2009-05-21 19:06:32 UTC (rev 1308) @@ -43,7 +43,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="JAPI libs-swing-action is a library for creating and managing javax.swing.Action objects. Copyright (C) &#36;today.year Christian Hujer. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA" /> @@ -64,7 +64,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> @@ -85,7 +85,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> @@ -106,7 +106,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> @@ -127,7 +127,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> @@ -148,7 +148,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> @@ -169,7 +169,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> @@ -190,7 +190,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-21 18:38:30
|
Revision: 1307 http://japi.svn.sourceforge.net/japi/?rev=1307&view=rev Author: christianhujer Date: 2009-05-21 18:38:22 +0000 (Thu, 21 May 2009) Log Message: ----------- Created release tag 0.2.0 for branch 0.2. Added Paths: ----------- libs/swing-prefs/tags/0.2.0/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-21 18:37:19
|
Revision: 1306 http://japi.svn.sourceforge.net/japi/?rev=1306&view=rev Author: christianhujer Date: 2009-05-21 18:37:11 +0000 (Thu, 21 May 2009) Log Message: ----------- Created branch 0.2. Modified Paths: -------------- libs/swing-prefs/branches/0.2/libs-swing-prefs.iml Added Paths: ----------- libs/swing-prefs/branches/0.2/ Property changes on: libs/swing-prefs/branches/0.2 ___________________________________________________________________ Added: svn:ignore + bin classes dest developer.properties dist docs Added: svn:externals + ^/common/trunk@1305 common Added: svn:mergeinfo + Modified: libs/swing-prefs/branches/0.2/libs-swing-prefs.iml =================================================================== --- libs/swing-prefs/trunk/libs-swing-prefs.iml 2009-05-21 18:32:25 UTC (rev 1305) +++ libs/swing-prefs/branches/0.2/libs-swing-prefs.iml 2009-05-21 18:37:11 UTC (rev 1306) @@ -44,7 +44,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="JAPI libs-swing-prefs is a library for adding preferences dialogs to an application. Copyright (C) &#36;today.year Christian Hujer. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA" /> @@ -65,7 +65,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> @@ -86,7 +86,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> @@ -107,7 +107,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> @@ -128,7 +128,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> @@ -149,7 +149,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> @@ -170,7 +170,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> @@ -191,7 +191,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-21 18:32:33
|
Revision: 1305 http://japi.svn.sourceforge.net/japi/?rev=1305&view=rev Author: christianhujer Date: 2009-05-21 18:32:25 +0000 (Thu, 21 May 2009) Log Message: ----------- [2794982] Closing the dialog behaves strange Modified Paths: -------------- libs/swing-prefs/trunk/src/prj/net/sf/japi/swing/prefs/PreferencesPane.java Modified: libs/swing-prefs/trunk/src/prj/net/sf/japi/swing/prefs/PreferencesPane.java =================================================================== --- libs/swing-prefs/trunk/src/prj/net/sf/japi/swing/prefs/PreferencesPane.java 2009-05-21 18:21:35 UTC (rev 1304) +++ libs/swing-prefs/trunk/src/prj/net/sf/japi/swing/prefs/PreferencesPane.java 2009-05-21 18:32:25 UTC (rev 1305) @@ -21,6 +21,8 @@ import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Component; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; import java.util.HashMap; import java.util.Map; import javax.swing.Action; @@ -34,6 +36,7 @@ import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; +import javax.swing.WindowConstants; import javax.swing.border.Border; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; @@ -112,6 +115,14 @@ final JDialog dialog = pane.createDialog(parentComponent, prefs.getTitle()); DIALOGS.put(prefs, dialog); dialog.setResizable(true); + dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); + dialog.addWindowListener(new WindowAdapter() { + /** {@inheritDoc} */ + @Override + public void windowClosing(final WindowEvent e) { + pane.cancel(); + } + }); dialog.setModal(modal); dialog.setVisible(true); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-21 18:21:43
|
Revision: 1304 http://japi.svn.sourceforge.net/japi/?rev=1304&view=rev Author: christianhujer Date: 2009-05-21 18:21:35 +0000 (Thu, 21 May 2009) Log Message: ----------- Add missing documentation for mnemonic index. Modified Paths: -------------- libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/ActionBuilder.java Modified: libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/ActionBuilder.java =================================================================== --- libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/ActionBuilder.java 2009-05-21 18:07:53 UTC (rev 1303) +++ libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/ActionBuilder.java 2009-05-21 18:21:35 UTC (rev 1304) @@ -98,6 +98,7 @@ * <tr><td>The keyboard accelerator</td><td><code><var>basename</var> + ".accel"</code></td><td>{@link Action#ACCELERATOR_KEY}</td></tr> * <tr><td>The alternate keyboard accelerator</td><td><code><var>basename</var> + ".accel2"</code></td><td>{@link #ACCELERATOR_KEY_2}</td></tr> * <tr><td>The mnemonic</td><td><code><var>basename</var> + ".mnemonic"</code></td><td>{@link Action#MNEMONIC_KEY}</td></tr> + * <tr><td>The mnemonic index</td><td><code><var>basename</var> + ".mnemonicIdx"</code></tr><td>{@link Action#DISPLAYED_MNEMONIC_INDEX_KEY}</td></tr> * <tr><td>The method name</td><td></td><td>{@link ReflectionAction#REFLECTION_METHOD_NAME}</td></tr> * <tr><td>The method</td><td></td><td>{@link ReflectionAction#REFLECTION_METHOD}</td></tr> * <tr><td>The boolean property name</td><td></td><td>{@link ToggleAction#REFLECTION_PROPERTY_NAME}</td></tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-21 18:08:00
|
Revision: 1303 http://japi.svn.sourceforge.net/japi/?rev=1303&view=rev Author: christianhujer Date: 2009-05-21 18:07:53 +0000 (Thu, 21 May 2009) Log Message: ----------- Add support for the mnemonic index. Modified Paths: -------------- libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/DefaultActionBuilder.java Modified: libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/DefaultActionBuilder.java =================================================================== --- libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/DefaultActionBuilder.java 2009-05-21 13:52:27 UTC (rev 1302) +++ libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/DefaultActionBuilder.java 2009-05-21 18:07:53 UTC (rev 1303) @@ -32,6 +32,7 @@ import static java.util.prefs.Preferences.userNodeForPackage; import javax.swing.Action; import static javax.swing.Action.ACCELERATOR_KEY; +import static javax.swing.Action.DISPLAYED_MNEMONIC_INDEX_KEY; import static javax.swing.Action.LONG_DESCRIPTION; import static javax.swing.Action.MNEMONIC_KEY; import static javax.swing.Action.NAME; @@ -311,6 +312,7 @@ System.err.println("Warning: Action key " + key + " has " + key + ".mnemonic value " + value + " but no text. Either define " + key + ".text or remove " + key + ".mnemonic."); } } + if ((value = getString(key + ".mnemonicIdx")) != null) { action.putValue(DISPLAYED_MNEMONIC_INDEX_KEY, Integer.parseInt(value)); } if ((value = getString(key + ".icon")) != null) { final Icon image = IconManager.getDefaultIconManager().getIcon(value); if (image != null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-21 14:22:47
|
Revision: 1302 http://japi.svn.sourceforge.net/japi/?rev=1302&view=rev Author: christianhujer Date: 2009-05-21 13:52:27 +0000 (Thu, 21 May 2009) Log Message: ----------- Created release tag 0.2.0 for branch 0.2. Added Paths: ----------- libs/swing-misc/tags/0.2.0/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-21 14:22:40
|
Revision: 1301 http://japi.svn.sourceforge.net/japi/?rev=1301&view=rev Author: christianhujer Date: 2009-05-21 13:51:31 +0000 (Thu, 21 May 2009) Log Message: ----------- Created branch 0.2. Added Paths: ----------- libs/swing-misc/branches/0.2/ Property changes on: libs/swing-misc/branches/0.2 ___________________________________________________________________ Added: svn:ignore + bin classes dest developer.properties dist docs Added: svn:externals + ^/common/trunk@1300 common Added: svn:mergeinfo + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-21 14:22:32
|
Revision: 1300 http://japi.svn.sourceforge.net/japi/?rev=1300&view=rev Author: christianhujer Date: 2009-05-21 13:50:21 +0000 (Thu, 21 May 2009) Log Message: ----------- Add import which was missing for documentation. Modified Paths: -------------- libs/swing-misc/trunk/libs-swing-misc.iml libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/JFileField.java Modified: libs/swing-misc/trunk/libs-swing-misc.iml =================================================================== --- libs/swing-misc/trunk/libs-swing-misc.iml 2009-05-21 13:43:35 UTC (rev 1299) +++ libs/swing-misc/trunk/libs-swing-misc.iml 2009-05-21 13:50:21 UTC (rev 1300) @@ -43,7 +43,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="JAPI libs-swing-misc is a library that holds miscellaneous additions to Swing. Copyright (C) &#36;today.year Christian Hujer. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA" /> @@ -64,7 +64,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> @@ -85,7 +85,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> @@ -106,7 +106,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> @@ -127,7 +127,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> @@ -148,7 +148,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> @@ -169,7 +169,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> @@ -190,7 +190,7 @@ <option name="lenBefore" value="80" /> <option name="lenAfter" value="80" /> <option name="box" value="false" /> - <option name="filler" value=" " /> + <option name="filler" value="$TEMPLATE$" /> </value> </option> <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> Modified: libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/JFileField.java =================================================================== --- libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/JFileField.java 2009-05-21 13:43:35 UTC (rev 1299) +++ libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/JFileField.java 2009-05-21 13:50:21 UTC (rev 1300) @@ -22,6 +22,7 @@ import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JTextField; +import javax.swing.JFileChooser; /** Component for selecting a file. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-21 14:22:23
|
Revision: 1299 http://japi.svn.sourceforge.net/japi/?rev=1299&view=rev Author: christianhujer Date: 2009-05-21 13:43:35 +0000 (Thu, 21 May 2009) Log Message: ----------- Improvements. Modified Paths: -------------- libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/CollectionsListModel.java libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/JFileField.java Modified: libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/CollectionsListModel.java =================================================================== --- libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/CollectionsListModel.java 2009-05-21 12:47:00 UTC (rev 1298) +++ libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/CollectionsListModel.java 2009-05-21 13:43:35 UTC (rev 1299) @@ -18,6 +18,7 @@ package net.sf.japi.swing.misc; +import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; @@ -52,6 +53,13 @@ this.list = list; } + /** + * Creates a new CollectionsListModel backed by an ArrayList. + */ + public CollectionsListModel() { + list = new ArrayList<E>(); + } + /** {@inheritDoc} */ public int size() { return list.size(); Modified: libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/JFileField.java =================================================================== --- libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/JFileField.java 2009-05-21 12:47:00 UTC (rev 1298) +++ libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/JFileField.java 2009-05-21 13:43:35 UTC (rev 1299) @@ -52,6 +52,7 @@ * @param labelText The text for the label. * @param initial The initial path. * @param fileSelectionMode The mode for the file selection. + * @see JFileChooser for fileSelectionMode. */ public JFileField(final String labelText, final String initial, final int fileSelectionMode) { setLayout(new FlowLayout(FlowLayout.RIGHT)); @@ -63,12 +64,29 @@ add(chooserButton); } + /** + * Create a JFileField. + * @param initial The initial path. + * @param fileSelectionMode The mode for the file selection. + * @see JFileChooser for fileSelectionMode. + */ + public JFileField(final String initial, final int fileSelectionMode) { + setLayout(new FlowLayout(FlowLayout.RIGHT)); + fileField = new JTextField(initial, DEFAULT_TEXTFIELD_COLUMNS); + chooserButton = new JFileChooserButton(fileField, fileSelectionMode); + label = null; + add(fileField); + add(chooserButton); + } + /** {@inheritDoc} */ @Override public void setEnabled(final boolean enabled) { super.setEnabled(enabled); fileField.setEnabled(enabled); chooserButton.setEnabled(enabled); - label.setEnabled(enabled); + if (label != null) { + label.setEnabled(enabled); + } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-21 12:49:07
|
Revision: 1298 http://japi.svn.sourceforge.net/japi/?rev=1298&view=rev Author: christianhujer Date: 2009-05-21 12:47:00 +0000 (Thu, 21 May 2009) Log Message: ----------- Update Batcher. Now has a simple example that works and much of the desired final structure. Still a long way to go, though. Modified Paths: -------------- progs/batcher/trunk/Batcher.iml progs/batcher/trunk/build.xml progs/batcher/trunk/module.properties progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Main.java Added Paths: ----------- progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/AbstractChangeable.java progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Batch.java progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/BatchList.java progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/BatchRun.java progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Changeable.java progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/ChangeableList.java progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Job.java progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobList.java progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobRun.java progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobRunView.java progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobView.java progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Project.java progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/ShellPane.java progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/SimpleShell.java Modified: progs/batcher/trunk/Batcher.iml =================================================================== --- progs/batcher/trunk/Batcher.iml 2009-05-12 23:42:49 UTC (rev 1297) +++ progs/batcher/trunk/Batcher.iml 2009-05-21 12:47:00 UTC (rev 1298) @@ -21,23 +21,41 @@ <orderEntry type="module-library"> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/common/lib/jlfgr-1_0.jar!/" /> + <root url="jar://$MODULE_DIR$/common/antlib.auto/junit.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> </library> </orderEntry> + <orderEntry type="module" module-name="libs-swing-about" /> + <orderEntry type="module" module-name="libs-swing-action" /> <orderEntry type="module-library"> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/common/antlib.auto/junit.jar!/" /> + <root url="jar://$MODULE_DIR$/lib/japi-lib-swing-action.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> </library> </orderEntry> - <orderEntry type="module" module-name="libs-swing-about" /> - <orderEntry type="module" module-name="libs-swing-action" /> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/japi-lib-swing-misc.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/jlfgr-1_0.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> </component> </module> Modified: progs/batcher/trunk/build.xml =================================================================== --- progs/batcher/trunk/build.xml 2009-05-12 23:42:49 UTC (rev 1297) +++ progs/batcher/trunk/build.xml 2009-05-21 12:47:00 UTC (rev 1298) @@ -24,6 +24,8 @@ <target name="getlibs"> <get src="http://downloads.sourceforge.net/japi/japi-lib-swing-action-0.1.0.jar" dest="lib/japi-lib-swing-action.jar" /> + <get src="http://downloads.sourceforge.net/japi/japi-lib-swing-misc-0.1.0.jar" dest="lib/japi-lib-swing-misc.jar" /> + <get src="http://downloads.sourceforge.net/japi/jlfgr-1_0.jar" dest="lib/jlfgr-1_0.jar" /> </target> </project> Modified: progs/batcher/trunk/module.properties =================================================================== --- progs/batcher/trunk/module.properties 2009-05-12 23:42:49 UTC (rev 1297) +++ progs/batcher/trunk/module.properties 2009-05-21 12:47:00 UTC (rev 1298) @@ -20,5 +20,5 @@ shortname=Batcher title=Batcher package=net.sf.japi.batcher -package.path=net/sf/japi/batcher -main.class=net.sf.japi.batcher.Batcher +package.path=net/sf/japi/progs/batcher +main.class=net.sf.japi.progs.batcher.SimpleShell Added: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/AbstractChangeable.java =================================================================== --- progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/AbstractChangeable.java (rev 0) +++ progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/AbstractChangeable.java 2009-05-21 12:47:00 UTC (rev 1298) @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2009 Christian Hujer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package net.sf.japi.progs.batcher; + +/** Abstract base implementation of {@link Changeable}. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @since 0.1 + */ +public abstract class AbstractChangeable implements Changeable { + + /** Change status. + * @serial include + */ + private boolean changed; + + /** {@inheritDoc} */ + public boolean hasChanged() { + return changed; + } + + /** {@inheritDoc} */ + public void setChanged(final boolean changed) { + this.changed = changed; + } + +} Property changes on: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/AbstractChangeable.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Batch.java =================================================================== --- progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Batch.java (rev 0) +++ progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Batch.java 2009-05-21 12:47:00 UTC (rev 1298) @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2009 Christian Hujer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package net.sf.japi.progs.batcher; + +/** A Batch. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @since 0.1 + */ +public class Batch extends AbstractChangeable { + + /** The title of this batch. + * @serial include + */ + private String title; + +} Property changes on: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Batch.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/BatchList.java =================================================================== --- progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/BatchList.java (rev 0) +++ progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/BatchList.java 2009-05-21 12:47:00 UTC (rev 1298) @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2009 Christian Hujer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package net.sf.japi.progs.batcher; + +/** A list of batches. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @since 0.1 + */ +public class BatchList extends ChangeableList<Batch> { +} Property changes on: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/BatchList.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/BatchRun.java =================================================================== --- progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/BatchRun.java (rev 0) +++ progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/BatchRun.java 2009-05-21 12:47:00 UTC (rev 1298) @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2009 Christian Hujer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package net.sf.japi.progs.batcher; + +/** A batch run. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @since 0.1 + */ +public class BatchRun { + + /** The batch that is run. */ + private Batch batch; + + /** Stops this job. */ + public void stop() { + } +} Property changes on: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/BatchRun.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Changeable.java =================================================================== --- progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Changeable.java (rev 0) +++ progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Changeable.java 2009-05-21 12:47:00 UTC (rev 1298) @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2009 Christian Hujer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package net.sf.japi.progs.batcher; + +import java.io.Serializable; + +/** Interface for application data elements which are queried for the changed state of a project or document. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @since 0.1 + */ +public interface Changeable extends Serializable { + + /** Returns whether or not this Changeable has changed. + * A changeable has changed if itself or one of its components is changed. + * @return <code>true</code> if this changeable has changed, otherwise <code>false</code>. + */ + boolean hasChanged(); + + /** Sets whether or not this Changeable has changed. + * @param changed <code>true</code> if this changeable is changed, otherwise <code>false</code>. + * @note Setting changed to true is a shallow, setting changed to false is a deep operation. + */ + void setChanged(boolean changed); + +} Property changes on: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Changeable.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/ChangeableList.java =================================================================== --- progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/ChangeableList.java (rev 0) +++ progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/ChangeableList.java 2009-05-21 12:47:00 UTC (rev 1298) @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2009 Christian Hujer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package net.sf.japi.progs.batcher; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import javax.swing.AbstractListModel; +import org.jetbrains.annotations.NotNull; + +/** List of Changeables. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @param <C> Changeable type to list. + * @since 0.1 + */ +public class ChangeableList<C extends Changeable> extends AbstractListModel implements Changeable { + + /** Changeables in this ChangeableList. + * @serial include + */ + private List<C> elements = new ArrayList<C>(); + + /** Changed state. + * @serial include + */ + private boolean changed; + + /** Creates a ChangeableList. */ + public ChangeableList() { + } + + /** {@inheritDoc} */ + public boolean hasChanged() { + boolean changed = this.changed; + for (final Iterator<C> it = elements.iterator(); !changed && it.hasNext();) { + changed |= it.next().hasChanged(); + } + return changed; + } + + /** {@inheritDoc} */ + public void setChanged(final boolean changed) { + this.changed = changed; + if (!changed) { + for (final Iterator<C> it = elements.iterator(); it.hasNext();) { + it.next().setChanged(false); + } + } + } + + /** Adds an element to this ChangeableList. + * @param c Element to add. + */ + protected void add(final C c) { + int index = elements.size(); + elements.add(c); + setChanged(true); + fireIntervalAdded(this, index, index); + } + + /** Removes an element from this ChangeableList. + * @param c Element to remove. + */ + protected void remove(final C c) { + int index = elements.indexOf(c); + if (index == -1) { + assert false : "Trying to remove an element from a list which is not there."; + return; + } + elements.remove(c); + setChanged(true); + fireIntervalRemoved(this, index, index); + } + + /** {@inheritDoc} */ + public Object getElementAt(final int index) { + return elements.get(index); + } + + /** {@inheritDoc} */ + public int getSize() { + return elements.size(); + } + +} Property changes on: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/ChangeableList.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Job.java =================================================================== --- progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Job.java (rev 0) +++ progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Job.java 2009-05-21 12:47:00 UTC (rev 1298) @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2009 Christian Hujer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package net.sf.japi.progs.batcher; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Map; +import net.sf.japi.swing.misc.CollectionsListModel; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** A Job. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @since 0.1 + */ +public class Job extends AbstractChangeable { + + /** The title. + * @serial include + */ + private String title; + + /** The environment. + * Inherited from parent if <code>null</code>. + * @serial include + */ + @Nullable private Map<String, String> env; + + /** The command line with its arguments. + * @serial include + */ + private CollectionsListModel<String> command = new CollectionsListModel<String>(new ArrayList<String>()); + + /** The process builder. + * @serial exclude + */ + private transient ProcessBuilder processBuilder; + + /** Creates a Job. + * @param title Title for this Job. + */ + public Job(@NotNull final String title) { + processBuilder = new ProcessBuilder(command); + processBuilder.redirectErrorStream(true); + env = processBuilder.environment(); + this.title = title; + } + + /** Returns the current working directory. + * @return The current working directory. + */ + @Nullable public File getCurrentWorkingDirectory() { + return processBuilder.directory(); + } + + /** Sets the current working directory. + * @param directory The new current working directory. + */ + public void setCurrentWorkingDirectory(@Nullable final File directory) { + processBuilder.directory(directory); + } + + /** Returns the arguments. + * @return Arguments + */ + @NotNull public CollectionsListModel<String> getCommand() { + return command; + } + + /** Starts a process. + * @return Process just started. + * @throws IOException in case the process could not be started. + */ + public Process start() throws IOException { + return processBuilder.start(); + } + +} Property changes on: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Job.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobList.java =================================================================== --- progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobList.java (rev 0) +++ progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobList.java 2009-05-21 12:47:00 UTC (rev 1298) @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2009 Christian Hujer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package net.sf.japi.progs.batcher; + +/** A list of jobs. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @since 0.1 + */ +public class JobList extends ChangeableList<Job> { +} Property changes on: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobList.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobRun.java =================================================================== --- progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobRun.java (rev 0) +++ progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobRun.java 2009-05-21 12:47:00 UTC (rev 1298) @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2009 Christian Hujer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package net.sf.japi.progs.batcher; + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.IOException; +import java.util.List; +import javax.swing.SwingWorker; +import org.jetbrains.annotations.NotNull; + +/** A job run. + * + * A job run can be executed only once. + * If you want to execute the same job a second time, use a new JobRun instance. + * + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @since 0.1 + */ +public class JobRun extends SwingWorker<Object, String> { + + /** The view on which the job run shall be displayed. */ + private final JobRunView jobRunView; + + /** The job that is run. */ + private final Job job; + + /** The output of the job. */ + private String output; + + /** The return value of the job. */ + private int retVal; + + /** Creates a JobRun. + * @param jobRunView JobRunView for displaying the job run. + * @param job Job to run. + */ + public JobRun(@NotNull final JobRunView jobRunView, @NotNull final Job job) { + this.job = job; + this.jobRunView = jobRunView; + } + + /** {@inheritDoc} */ + @Override + public Object doInBackground() { + final StringBuilder sb = new StringBuilder(); + try { + final Process p = job.start(); + final Reader in = /*new BufferedReader*/(new InputStreamReader(p.getInputStream())); + final char[] buf = new char[4096]; + for (int charsRead; (charsRead = in.read(buf)) != -1;) { + publish(new String(buf, 0, charsRead)); + } + } catch (final Throwable e) { + publish(e.toString()); + } + return null; + } + + /** {@inheritDoc} */ + @Override + public void process(final List<String> chunks) { + for (final String s : chunks) { + jobRunView.append(s); + } + } + + /** Stops this JobRun. */ + public void stop() { + cancel(true); + } +} Property changes on: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobRun.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobRunView.java =================================================================== --- progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobRunView.java (rev 0) +++ progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobRunView.java 2009-05-21 12:47:00 UTC (rev 1298) @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2009 Christian Hujer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package net.sf.japi.progs.batcher; + +import java.awt.Color; +import java.awt.Font; +import java.awt.GridLayout; +import javax.swing.ScrollPaneConstants; +import javax.swing.JComponent; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + +/** View to a Job Run. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @since 0.1 + */ +public class JobRunView extends JComponent { + + /** The textArea of this JobRunView. */ + private JTextArea textArea = new JTextArea(25, 80); + + /** Creates a JobRunView. */ + public JobRunView() { + setLayout(new GridLayout(1, 1)); + textArea.setForeground(Color.white); + textArea.setBackground(Color.black); + textArea.setEditable(false); + textArea.setFont(new Font(Font.MONOSPACED, textArea.getFont().getStyle(), textArea.getFont().getSize())); + add(new JScrollPane(textArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED)); + } + + /** Appends a String to this JobRunView. + * @param s String to append. + */ + public void append(final String s) { + textArea.append(s); + } +} Property changes on: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobRunView.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobView.java =================================================================== --- progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobView.java (rev 0) +++ progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobView.java 2009-05-21 12:47:00 UTC (rev 1298) @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2009 Christian Hujer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package net.sf.japi.progs.batcher; + +import java.awt.GridBagLayout; +import java.awt.GridBagConstraints; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JTextField; +import javax.swing.JScrollPane; +import net.sf.japi.swing.misc.JFileField; +import org.jetbrains.annotations.NotNull; + +/** View for a Job. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @since 0.1 + */ +public class JobView extends JComponent implements ActionListener { + + /** The Job of this JobView. + * @serial include + */ + private Job job; + + /** The textfield for the title. + * @serial include + */ + private JTextField titleField; + + /** The filefield for the current working directory. + * @serial include + */ + private JFileField currentWorkingDirectoryField; + + /** The view of the current JobRun. */ + private JobRunView out; + + /** Creates a JobView. + * @param job Job to view. + */ + public JobView(@NotNull final Job job) { + this.job = job; + + //setLayout(new GridBagLayout()); + setLayout(new java.awt.FlowLayout()); + final GridBagConstraints gbc = new GridBagConstraints(); + + titleField = new JTextField(20); + currentWorkingDirectoryField = new JFileField("", "" + job.getCurrentWorkingDirectory(), JFileChooser.DIRECTORIES_ONLY); + + add(new JScrollPane(new JList(job.getCommand())), gbc); + + add(new JLabel("XXX title"), gbc); + add(titleField, gbc); + + add(new JLabel("XXX wd"), gbc); + add(currentWorkingDirectoryField, gbc); + + final JButton start = new JButton("run"); + start.addActionListener(this); + add(start, gbc); + + out = new JobRunView(); + add(out, gbc); + } + + public void actionPerformed(@NotNull final ActionEvent e) { + System.out.println("Run"); + new JobRun(out, job).execute(); + } +} Property changes on: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/JobView.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Main.java =================================================================== --- progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Main.java 2009-05-12 23:42:49 UTC (rev 1297) +++ progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Main.java 2009-05-21 12:47:00 UTC (rev 1298) @@ -17,18 +17,32 @@ package net.sf.japi.progs.batcher; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Font; import java.awt.Frame; import java.awt.Toolkit; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; +import java.beans.PropertyVetoException; +import java.util.Arrays; +import javax.swing.JButton; +import javax.swing.JDesktopPane; import javax.swing.JFrame; +import javax.swing.JInternalFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTabbedPane; +import javax.swing.JTextArea; +import javax.swing.ScrollPaneConstants; import javax.swing.WindowConstants; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import net.sf.japi.swing.action.ActionMethod; import org.jetbrains.annotations.NotNull; -/** Main class of Batcher +/** Main class of Batcher. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @since 0.1 */ @@ -38,33 +52,88 @@ @NotNull private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder(Main.class); - /** - * Main program. + /** Main program. * @param args Command line arguments (ignored). */ public static void main(final String... args) { - new Main(); + new Main(args); } /** The program frame. */ private final JFrame frame; - /** Creates Main. */ - public Main() { + /** Creates Main. + * @param args Command line arguments. + */ + public Main(final String... args) { frame = new JFrame(ACTION_BUILDER.getString("window.title")); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); frame.setJMenuBar(ACTION_BUILDER.createMenuBar(true, "Main", this)); frame.setSize(Toolkit.getDefaultToolkit().getScreenSize()); frame.setExtendedState(Frame.MAXIMIZED_BOTH); frame.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(final WindowEvent e) { + @Override public void windowClosing(final WindowEvent e) { quit(); } }); - frame.setVisible(true); } +// /** Creates Main. +// * @param args Command line arguments +// */ +// public Main(final String... args) { +// frame = new JFrame(ACTION_BUILDER.getString("window.title")); +// frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); +// frame.setJMenuBar(ACTION_BUILDER.createMenuBar(true, "Main", this)); +// frame.setSize(Toolkit.getDefaultToolkit().getScreenSize()); +// frame.setExtendedState(Frame.MAXIMIZED_BOTH); +// frame.addWindowListener(new WindowAdapter() { +// @Override +// public void windowClosing(final WindowEvent e) { +// quit(); +// } +// }); +// final JDesktopPane desktop = new JDesktopPane(); +// frame.add(desktop, BorderLayout.CENTER); +// for (int i = 0; i < 5; i++) { +// final JInternalFrame iFrame = new JInternalFrame("app " + i, true, true, true, false); +// init(iFrame); +// desktop.add(iFrame); +// try { +// iFrame.setMaximum(true); +// } catch (final PropertyVetoException e) { +// System.err.println(e); +// } +// } +// frame.setVisible(true); +// } +// +// public void init(final JInternalFrame frame) { +// frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); +// //final Job job = new Job("foo"); +// //job.getCommand().addAll(Arrays.asList(args)); +// //frame.getContentPane().add(new JobView(job)); +// +// final JTabbedPane tabs = new JTabbedPane(JTabbedPane.BOTTOM, JTabbedPane.SCROLL_TAB_LAYOUT); +// for (int i = 0; i < 40; i++) { +// final JTextArea textArea = new JTextArea(25, 80); +// textArea.setForeground(Color.white); +// textArea.setBackground(Color.black); +// textArea.setEditable(false); +// textArea.setFont(new Font(Font.MONOSPACED, textArea.getFont().getStyle(), textArea.getFont().getSize())); +// final Component c = new JScrollPane(textArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); +// tabs.add("Command " + i, c); +// } +// frame.getContentPane().add(tabs); +// +// final JPanel east = new JPanel(); +// east.add(new JButton("foo")); +// frame.getContentPane().add(east, BorderLayout.WEST); +// +// frame.pack(); +// frame.setVisible(true); +// } +// /** Quits the program. */ @ActionMethod public void quit() { Added: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Project.java =================================================================== --- progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Project.java (rev 0) +++ progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Project.java 2009-05-21 12:47:00 UTC (rev 1298) @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2009 Christian Hujer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package net.sf.japi.progs.batcher; + +import org.jetbrains.annotations.NotNull; + +/** A project. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @since 0.1 + */ +public class Project implements Changeable { + + /** List with all jobs. + * @serial include + */ + private JobList jobList = new JobList(); + + /** List with all batches. + * @serial include + */ + private BatchList batchList = new BatchList(); + + /** The title of this project. + * @serial include + */ + private String title; + + /** Changed state. + * @serial include + */ + private boolean changed; + + /** Create an unnamed project. */ + public Project() { + this("unnamed project"); + } + + /** Create a project. + * @param title The title of this project. + */ + public Project(@NotNull final String title) { + this.title = title; + } + + /** Returns the job list of this project. + * @return The job list. + */ + public JobList getJobList() { + return jobList; + } + + /** Returns the batch list of this project. + * @return The batch list. + */ + public BatchList getBatchList() { + return batchList; + } + + /** Returns the title of this project. + * @return The title. + */ + public String getTitle() { + return title; + } + + /** Sets the title of this project. + * @param title New title of this project. + */ + public void setTitle(@NotNull final String title) { + this.title = title; + setChanged(true); + } + + /** {@inheritDoc} */ + public boolean hasChanged() { + return changed || jobList.hasChanged() || batchList.hasChanged(); + } + + /** {@inheritDoc} */ + public void setChanged(final boolean changed) { + this.changed = changed; + if (!changed) { + jobList.setChanged(changed); + batchList.setChanged(changed); + } + } + +} Property changes on: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Project.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/ShellPane.java =================================================================== --- progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/ShellPane.java (rev 0) +++ progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/ShellPane.java 2009-05-21 12:47:00 UTC (rev 1298) @@ -0,0 +1,179 @@ +/* + * Copyright (C) 2009 Christian Hujer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package net.sf.japi.progs.batcher; + +import javax.swing.JPanel; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.JButton; +import javax.swing.JScrollPane; +import javax.swing.ScrollPaneConstants; +import javax.swing.SwingWorker; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Font; +import java.util.List; +import java.util.ArrayList; +import java.io.Reader; +import java.io.InputStreamReader; + +/** A Shell Pane. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @since 0.1 + */ +public class ShellPane extends JPanel implements ActionListener { + + /** The terminal screen. */ + private final JTextArea textArea = new JTextArea(25, 80); + + /** The textfield to enter commands. */ + private final JTextField command = new JTextField(); + + /** Button for clearing the terminal screen. */ + private final JButton clear = new JButton("clear"); + + /** Button for stopping the current process. */ + private final JButton stop = new JButton("stop"); + + /** ProcessBuilder for starting processes. */ + private final ProcessBuilder processBuilder = new ProcessBuilder().redirectErrorStream(true); + + /** Running shell process. */ + private ShellWorker worker; + + /** Create a ShellPane. */ + public ShellPane() { + setLayout(new BorderLayout()); + command.setForeground(Color.white); + command.setBackground(Color.black); + command.setFont(new Font(Font.MONOSPACED, textArea.getFont().getStyle(), textArea.getFont().getSize())); + textArea.setForeground(Color.white); + textArea.setBackground(Color.black); + textArea.setFont(new Font(Font.MONOSPACED, textArea.getFont().getStyle(), textArea.getFont().getSize())); + textArea.setEditable(false); + add(new JScrollPane(textArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER); + add(command, BorderLayout.SOUTH); + add(clear, BorderLayout.NORTH); + add(stop, BorderLayout.EAST); + command.addActionListener(this); + clear.addActionListener(this); + stop.addActionListener(this); + } + + /** {@inheritDoc} */ + public void actionPerformed(final ActionEvent e) { + if (e.getSource() == command) { + processBuilder.command(parse(command.getText())); + worker = new ShellWorker(); + worker.execute(); + } + if (e.getSource() == clear) { + textArea.setText(""); + } + if (e.getSource() == stop) { + worker.stop(); + } + } + + /** Parses a command String into a list suitable for starting a process with arguments. + * @param text Command String to parse. + * @return List of command and arguments + */ + public List<String> parse(final String text) { + final List<String> strings = new ArrayList<String>(); + final StringBuilder sb = new StringBuilder(); + int state = 0; + for (final char c : text.toCharArray()) { + switch (state) { + case 0: + switch (c) { + case ' ': state = 0; break; + case '"': state = 2; break; + default: state = 1; sb.append(c); break; + } + break; + case 1: + switch (c) { + case ' ': state = 0; strings.add(sb.toString()); sb.setLength(0); break; + case '"': state = 2; break; + default: state = 1; sb.append(c); break; + } + break; + case 2: + switch (c) { + case '"': state = 1; break; + default: state = 2; sb.append(c); break; + } + break; + default: + assert false; + } + } + if (sb.length() != 0) { + strings.add(sb.toString()); + } + return strings; + } + + /** SwingWorker to run a process and read its output. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @since 0.1 + */ + class ShellWorker extends SwingWorker<Object, String> { + + /** The process to run. */ + private Process p; + + /** {@inheritDoc} */ + @Override public Object doInBackground() { + final StringBuilder sb = new StringBuilder(); + try { + p = processBuilder.start(); + try { + final Reader in = new InputStreamReader(p.getInputStream()); + final char[] buf = new char[4096]; + for (int charsRead; !isCancelled() && (charsRead = in.read(buf)) != -1;) { + publish(new String(buf, 0, charsRead)); + } + } finally { + p.destroy(); + } + } catch (final Throwable e) { + publish(e.toString() + "\n"); + } + return null; + } + + /** {@inheritDoc} */ + @Override public void process(final List<String> chunks) { + for (final String s : chunks) { + textArea.append(s); + } + } + + /** Stop. */ + public void stop() { + if (p != null) { + p.destroy(); + } + cancel(true); + } + } +} Property changes on: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/ShellPane.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/SimpleShell.java =================================================================== --- progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/SimpleShell.java (rev 0) +++ progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/SimpleShell.java 2009-05-21 12:47:00 UTC (rev 1298) @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2009 Christian Hujer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package net.sf.japi.progs.batcher; + +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JTabbedPane; + +/** SimpleShell example application. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @since 0.1 + */ +public class SimpleShell implements ActionListener { + + /** Main program of SimpleShell. + * @param args Command line arguments (ignored). + */ + public static void main(final String... args) { + new SimpleShell(); + } + + /** The tabs. */ + private final JTabbedPane tabs; + + /** Create a SimpleShell instance. */ + public SimpleShell() { + final JFrame frame = new JFrame("SimpleShell"); + tabs = new JTabbedPane(); + frame.getContentPane().add(tabs, BorderLayout.CENTER); + final JMenuBar menuBar = new JMenuBar(); + final JMenu file = new JMenu("File"); + menuBar.add(file); + final JMenuItem newFile = new JMenuItem("New"); + newFile.addActionListener(this); + file.add(newFile); + frame.setJMenuBar(menuBar); + frame.pack(); + frame.setVisible(true); + } + public void actionPerformed(final ActionEvent e) { + tabs.add(new ShellPane()); + } +} Property changes on: progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/SimpleShell.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-12 23:42:57
|
Revision: 1297 http://japi.svn.sourceforge.net/japi/?rev=1297&view=rev Author: christianhujer Date: 2009-05-12 23:42:49 +0000 (Tue, 12 May 2009) Log Message: ----------- Created release tag 0.1.0 for branch 0.1. Added Paths: ----------- libs/sql/tags/0.1.0/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-12 23:40:16
|
Revision: 1296 http://japi.svn.sourceforge.net/japi/?rev=1296&view=rev Author: christianhujer Date: 2009-05-12 23:40:15 +0000 (Tue, 12 May 2009) Log Message: ----------- Created branch 0.1. Added Paths: ----------- libs/sql/branches/0.1/ Property changes on: libs/sql/branches/0.1 ___________________________________________________________________ Added: svn:ignore + bin classes dest developer.properties dist docs Added: svn:externals + ^/common/trunk@1295 common Added: svn:mergeinfo + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-12 23:39:08
|
Revision: 1295 http://japi.svn.sourceforge.net/japi/?rev=1295&view=rev Author: christianhujer Date: 2009-05-12 23:39:00 +0000 (Tue, 12 May 2009) Log Message: ----------- Fix checkstyle issues. Modified Paths: -------------- libs/sql/trunk/src/prj/net/sf/japi/sql/DatabaseTreeModel.java libs/sql/trunk/src/prj/net/sf/japi/sql/ResultSetTableModel.java libs/sql/trunk/src/prj/net/sf/japi/sql/SQLHelper.java libs/sql/trunk/src/prj/net/sf/japi/sql/ScrollResultSetTableModel.java Modified: libs/sql/trunk/src/prj/net/sf/japi/sql/DatabaseTreeModel.java =================================================================== --- libs/sql/trunk/src/prj/net/sf/japi/sql/DatabaseTreeModel.java 2009-05-12 23:31:25 UTC (rev 1294) +++ libs/sql/trunk/src/prj/net/sf/japi/sql/DatabaseTreeModel.java 2009-05-12 23:39:00 UTC (rev 1295) @@ -74,7 +74,7 @@ catalogs.add(new CatalogTreeNode(rs.getString(1))); } catch (final SQLException e) { System.err.println(e); - // TODO + // TODO:2009-05-13:christianhujer:Improve error handling. } } } finally { Modified: libs/sql/trunk/src/prj/net/sf/japi/sql/ResultSetTableModel.java =================================================================== --- libs/sql/trunk/src/prj/net/sf/japi/sql/ResultSetTableModel.java 2009-05-12 23:31:25 UTC (rev 1294) +++ libs/sql/trunk/src/prj/net/sf/japi/sql/ResultSetTableModel.java 2009-05-12 23:39:00 UTC (rev 1295) @@ -23,7 +23,8 @@ import java.sql.ResultSet; import java.sql.SQLException; import javax.swing.table.TableModel; -import net.sf.japi.util.ThrowableHandler;import org.jetbrains.annotations.Nullable; +import net.sf.japi.util.ThrowableHandler; +import org.jetbrains.annotations.Nullable; /** Interface for TableModels which handle information from ResultSets. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> Modified: libs/sql/trunk/src/prj/net/sf/japi/sql/SQLHelper.java =================================================================== --- libs/sql/trunk/src/prj/net/sf/japi/sql/SQLHelper.java 2009-05-12 23:31:25 UTC (rev 1294) +++ libs/sql/trunk/src/prj/net/sf/japi/sql/SQLHelper.java 2009-05-12 23:39:00 UTC (rev 1295) @@ -29,8 +29,12 @@ /** A Helper Class to make work with JDBC less painful in some situations. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public class SQLHelper { +public final class SQLHelper { + /** Utility class - do not instantiate. */ + private SQLHelper() { + } + /** The Type information for a two-dimensional Object Array. */ private static final Object[][] OBJECT_ARRAY_ARRAY_INSTANCE = new Object[0][0]; Modified: libs/sql/trunk/src/prj/net/sf/japi/sql/ScrollResultSetTableModel.java =================================================================== --- libs/sql/trunk/src/prj/net/sf/japi/sql/ScrollResultSetTableModel.java 2009-05-12 23:31:25 UTC (rev 1294) +++ libs/sql/trunk/src/prj/net/sf/japi/sql/ScrollResultSetTableModel.java 2009-05-12 23:39:00 UTC (rev 1295) @@ -101,7 +101,7 @@ for (int i = listeners.length - 2; i >= 0; i -= 2) { //noinspection ObjectEquality if (listeners[i] == ThrowableHandler.class) { - ((ThrowableHandler<? super SQLException>)listeners[i+1]).handleThrowable(exception); + ((ThrowableHandler<? super SQLException>) listeners[i + 1]).handleThrowable(exception); } } } @@ -207,13 +207,13 @@ final int type; try { if (metaData == null) { - // TODO: Display error to usage, reset state + // TODO:2009-05-13:christianhujer:Display error to usage, reset state return super.getColumnClass(columnIndex); } type = metaData.getColumnType(columnIndex + 1); } catch (final SQLException e) { handleException(e); - // TODO: reset state + // TODO:2009-05-13:christianhujer:reset state return super.getColumnClass(columnIndex); } switch (type) { @@ -249,7 +249,7 @@ /** {@inheritDoc} */ @Override @Nullable public String getColumnName(final int column) { if (metaData == null) { - // TODO + // TODO:2009-05-13:christianhujer:Return alternative name? return null; } try { @@ -288,7 +288,7 @@ return resultSet != null && resultSet.getConcurrency() == CONCUR_UPDATABLE; } catch (final SQLException e) { handleException(e); - // TODO: reset state + // TODO:2009-05-13:christianhujer:Reset state. return false; } } @@ -302,14 +302,14 @@ } try { if (!resultSet.absolute(rowIndex + 1)) { - // TODO: Display error to usage, reset state + // TODO:2009-05-13:christianhujer:Display error to usage, reset state return; } resultSet.updateObject(columnIndex + 1, aValue); resultSet.updateRow(); } catch (final SQLException e) { handleException(e); - // TODO: reset state + // TODO:2009-05-13:christianhujer:reset state } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-12 23:31:34
|
Revision: 1294 http://japi.svn.sourceforge.net/japi/?rev=1294&view=rev Author: christianhujer Date: 2009-05-12 23:31:25 +0000 (Tue, 12 May 2009) Log Message: ----------- Fetch required libs. Modified Paths: -------------- libs/sql/trunk/build.xml Modified: libs/sql/trunk/build.xml =================================================================== --- libs/sql/trunk/build.xml 2009-05-12 23:25:17 UTC (rev 1293) +++ libs/sql/trunk/build.xml 2009-05-12 23:31:25 UTC (rev 1294) @@ -23,4 +23,8 @@ &commonBuild; + <target name="getlibs"> + <get src="http://downloads.sourceforge.net/japi/japi-lib-util-0.1.0.jar" dest="lib/japi-lib-util.jar" /> + </target> + </project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-12 23:25:30
|
Revision: 1293 http://japi.svn.sourceforge.net/japi/?rev=1293&view=rev Author: christianhujer Date: 2009-05-12 23:25:17 +0000 (Tue, 12 May 2009) Log Message: ----------- Move sql classes to a module of their own. Added Paths: ----------- libs/sql/trunk/src/prj/net/sf/japi/sql/CachedResultSetTableModel.java libs/sql/trunk/src/prj/net/sf/japi/sql/DatabaseTreeModel.java libs/sql/trunk/src/prj/net/sf/japi/sql/ResultSetTableModel.java libs/sql/trunk/src/prj/net/sf/japi/sql/SQLHelper.java libs/sql/trunk/src/prj/net/sf/japi/sql/ScrollResultSetTableModel.java libs/sql/trunk/src/prj/net/sf/japi/sql/package.html Removed Paths: ------------- historic/trunk/src/app/net/sf/japi/sql/CachedResultSetTableModel.java historic/trunk/src/app/net/sf/japi/sql/DatabaseTreeModel.java historic/trunk/src/app/net/sf/japi/sql/ResultSetTableModel.java historic/trunk/src/app/net/sf/japi/sql/SQLHelper.java historic/trunk/src/app/net/sf/japi/sql/ScrollResultSetTableModel.java historic/trunk/src/app/net/sf/japi/sql/package.html Deleted: historic/trunk/src/app/net/sf/japi/sql/CachedResultSetTableModel.java =================================================================== --- historic/trunk/src/app/net/sf/japi/sql/CachedResultSetTableModel.java 2009-05-12 23:24:22 UTC (rev 1292) +++ historic/trunk/src/app/net/sf/japi/sql/CachedResultSetTableModel.java 2009-05-12 23:25:17 UTC (rev 1293) @@ -1,170 +0,0 @@ -/* JAPI - (Yet another (hopefully) useful) Java API - * - * Copyright (C) 2004-2006 Christian Hujer - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -package net.sf.japi.sql; - -import java.sql.ResultSet; -import java.sql.SQLException; -import javax.swing.table.AbstractTableModel; -import javax.swing.table.TableModel; -import net.sf.japi.util.ThrowableHandler; -import org.jetbrains.annotations.Nullable; - -/** An implementation of <code>javax.swing.TableModel</code> for an SQL ResultSet. - * In contrast to @see ResultSetTableModel this implementation reads all data upon setting the ResultSet. - * The advantage is that reading the ResultSet does not require the database connection anymore. - * The disadvantage is that this class requires much memory on large results and may fail for OutOfMemory on huge results. - * This class is fully serializable, at least in the way Swing classes are at all serializable. - * <p/> - * Serialized instances will also serialize the cached data. - * The data source information is not serialized. - * @see ResultSet - * @see TableModel - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @todo maybe setResultSet should throw SQLException? - */ -public class CachedResultSetTableModel extends AbstractTableModel implements ResultSetTableModel { - - /** Serial Version. */ - private static final long serialVersionUID = 1L; - - /** The number of rows. - * @serial include - */ - private int rowCount; - - /** The number of columns. - * @serial include - */ - private int columnCount; - - /** The column titles. - * @serial include - */ - @Nullable private String[] columnTitles; - - /** The Data. - * @serial include - */ - @Nullable private Object[][] data; - - /** The ResultSet. */ - @Nullable private ResultSet resultSet; - - /** Create a CachedResultSetTableModel. */ - public CachedResultSetTableModel() { - } - - /** Create a CachedResultSetTableModel. - * @param rs Initial ResultSet - */ - public CachedResultSetTableModel(@Nullable final ResultSet rs) { - setResultSet(rs); - } - - /** Report an exception to all registered ThrowableHandlers. - * @param exception Exception to report - */ - private void handleException(final SQLException exception) { - final Object[] listeners = listenerList.getListenerList(); - for (int i = listeners.length - 2; i >= 0; i -= 2) { - //noinspection ObjectEquality - if (listeners[i] == ThrowableHandler.class) { - ((ThrowableHandler<? super SQLException>) listeners[i + 1]).handleThrowable(exception); - } - } - } - - /** {@inheritDoc} */ - public void setResultSet(@Nullable final ResultSet resultSet) { - if (resultSet == null) { - this.resultSet = resultSet; - rowCount = 0; - columnCount = 0; - columnTitles = null; - data = null; - } else { - try { - columnTitles = SQLHelper.getColumnLabels(resultSet); - columnCount = columnTitles != null ? columnTitles.length : 0; - rowCount = SQLHelper.getRowCount(resultSet); - data = SQLHelper.getData(resultSet); - this.resultSet = resultSet; - } catch (final SQLException e) { - handleException(e); - rowCount = 0; - columnCount = 0; - columnTitles = null; - data = null; - return; // don't invoke fireTableStructureChanged() twice then. - } - } - fireTableStructureChanged(); - } - - /** {@inheritDoc} */ - @Nullable public ResultSet getResultSet() { - return resultSet; - } - - /** {@inheritDoc} */ - public void addThrowableHandler(final ThrowableHandler<? super SQLException> throwableHandler) { - listenerList.add(ThrowableHandler.class, throwableHandler); - } - - /** {@inheritDoc} */ - public void removeThrowableHandler(final ThrowableHandler<? super SQLException> throwableHandler) { - listenerList.remove(ThrowableHandler.class, throwableHandler); - } - - /** @see TableModel */ - public int getColumnCount() { - return columnCount; - } - - /** @see TableModel */ - public int getRowCount() { - return rowCount; - } - - /** @see TableModel */ - @Nullable public Object getValueAt(final int rowIndex, final int columnIndex) { - try { - return data[rowIndex][columnIndex]; - } catch (final NullPointerException ignore) { - return null; - } catch (final ArrayIndexOutOfBoundsException ignore) { - return null; - } - } - - /** {@inheritDoc} - * Always returns <code>String.class</code>. - */ - @Override public Class<?> getColumnClass(final int columnIndex) { - return String.class; - } - - /** {@inheritDoc} */ - @Override @Nullable public String getColumnName(final int column) { - return columnTitles != null ? columnTitles[column] : null; - } - -} // class CachedResultSetTableModel Deleted: historic/trunk/src/app/net/sf/japi/sql/DatabaseTreeModel.java =================================================================== --- historic/trunk/src/app/net/sf/japi/sql/DatabaseTreeModel.java 2009-05-12 23:24:22 UTC (rev 1292) +++ historic/trunk/src/app/net/sf/japi/sql/DatabaseTreeModel.java 2009-05-12 23:25:17 UTC (rev 1293) @@ -1,250 +0,0 @@ -/* JAPI - (Yet another (hopefully) useful) Java API - * - * Copyright (C) 2004-2006 Christian Hujer - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -package net.sf.japi.sql; - -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; -import javax.swing.event.EventListenerList; -import javax.swing.event.TreeModelEvent; -import javax.swing.event.TreeModelListener; -import javax.swing.tree.TreeModel; -import javax.swing.tree.TreePath; - -/** A TreeModel displaying the catalogs of a database (usually tables and views) as tree. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -@SuppressWarnings({"ObjectEquality"}) -public class DatabaseTreeModel implements TreeModel { - - /** The event listeners. */ - private final EventListenerList listenerList = new EventListenerList(); - - /** The Database nodes in the tree. */ - private final List<CatalogTreeNode> catalogs = new ArrayList<CatalogTreeNode>(); - - /** The Database Metadata of the database this treemodel reflects. */ - private DatabaseMetaData databaseMetaData; - - /** Create a DatabaseTreeModel. - * Thw tree model is not yet connected to databaseMetaData. - */ - public DatabaseTreeModel() { - } - - /** Create a DatabaseTreeModel for a Database. - * @param databaseMetaData Database Metadata for this tree model - * @throws SQLException in case of database problems - */ - public DatabaseTreeModel(final DatabaseMetaData databaseMetaData) throws SQLException { - this.databaseMetaData = databaseMetaData; - refresh(); - } - - /** Refresh the data of this model from the database. - * @throws SQLException in case of database problems - */ - public void refresh() throws SQLException { - catalogs.clear(); - if (databaseMetaData != null) { - final ResultSet rs = databaseMetaData.getCatalogs(); - try { - while (rs.next()) { - try { - catalogs.add(new CatalogTreeNode(rs.getString(1))); - } catch (final SQLException e) { - System.err.println(e); - // TODO - } - } - } finally { - rs.close(); - } - } - fireTreeStructureChanged(); - } - - /** Set the databaseMetaData for this model. - * @param databaseMetaData database meta data for this model - * @throws SQLException in case of database problems - */ - public void setDatabaseMetaData(final DatabaseMetaData databaseMetaData) throws SQLException { - this.databaseMetaData = databaseMetaData; - refresh(); - } - - /** Get the databaseMetaData of this model. - * @return databaseMetaData of this model - */ - public DatabaseMetaData getDatabaseMetaData() { - return databaseMetaData; - } - - /** {@inheritDoc} */ - public void addTreeModelListener(final TreeModelListener l) { - listenerList.add(TreeModelListener.class, l); - } - - /** {@inheritDoc} */ - public Object getChild(final Object parent, final int index) { - if (parent == this) { - return catalogs.get(index); - } else { - assert parent instanceof CatalogTreeNode; - return ((CatalogTreeNode) parent).getTable(index); - } - } - - /** {@inheritDoc} */ - public int getChildCount(final Object parent) { - return parent == this ? catalogs.size() : ((CatalogTreeNode) parent).getTableCount(); - } - - /** {@inheritDoc} */ - public int getIndexOfChild(final Object parent, final Object child) { - return parent == this ? catalogs.indexOf(child) : ((CatalogTreeNode) parent).getTableIndex((CatalogTreeNode.TableTreeNode) child); - } - - /** {@inheritDoc} */ - public Object getRoot() { - return this; - } - - /** {@inheritDoc} */ - public boolean isLeaf(final Object node) { - return node instanceof CatalogTreeNode.TableTreeNode; - } - - /** {@inheritDoc} */ - public void removeTreeModelListener(final TreeModelListener l) { - listenerList.remove(TreeModelListener.class, l); - } - - /** {@inheritDoc} */ - public void valueForPathChanged(final TreePath path, final Object newValue) { - } - - /** Event fire if the tree has changed. */ - private void fireTreeStructureChanged() { - TreeModelEvent e = null; - final Object[] listeners = listenerList.getListenerList(); - for (int i = listeners.length - 2; i >= 0; i -= 2) { - if (listeners[i] == TreeModelListener.class) { - if (e == null) { - e = new TreeModelEvent(this, new Object[] { this }); - } - ((TreeModelListener) listeners[i + 1]).treeStructureChanged(e); - } - } - } - - /** A TreeNode reflecting a Database. */ - public class CatalogTreeNode { - - /** The name of this catalog. */ - private String catalog; - - /** The tables of this catalog. */ - private final List<TableTreeNode> tables = new ArrayList<TableTreeNode>(); - - /** Create a CatalogTreeNode. - * @param catalog Catalog for which to create a CatalogTreeNode. - * @throws SQLException in case of database problems - */ - CatalogTreeNode(final String catalog) throws SQLException { - this.catalog = catalog; - final ResultSet rs = databaseMetaData.getTables(catalog, null, null, null); - try { - while (rs.next()) { - tables.add(new TableTreeNode(rs.getString("TABLE_NAME"))); - } - } finally { - rs.close(); - } - } - - /** Get a table with a certain index. - * @param index index of table to get - * @return table for <var>index</var> - */ - TableTreeNode getTable(final int index) { - return tables.get(index); - } - - /** Get the number of tables. - * @return number of tables - */ - public int getTableCount() { - return tables.size(); - } - - /** Get the index of a table. - * @param table Table to get index of - * @return index of <var>table</var> - */ - public int getTableIndex(final TableTreeNode table) { - return tables.indexOf(table); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return catalog; - } - - /** A TreeNode reflecting a Table. */ - public class TableTreeNode { - - /** The name of this table. */ - private String table; - - /** Create a TableTreeNode. - * @param table Table name for which to create a TableTreeNode. - */ - TableTreeNode(final String table) { - this.table = table; - } - - /** Get the name of the table this TableTreeNode represents. - * @return table name - */ - public String getTableName() { - return catalog + '.' + table; - } - - /** Get the name of the catalog this TableTreeNode is in. - * @return catalog name - */ - public String getCatalogName() { - return catalog; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return table; - } - - } // class TableTreeNode - - } // class CatalogTreeNode - -} // class DatabaseTreeModel Deleted: historic/trunk/src/app/net/sf/japi/sql/ResultSetTableModel.java =================================================================== --- historic/trunk/src/app/net/sf/japi/sql/ResultSetTableModel.java 2009-05-12 23:24:22 UTC (rev 1292) +++ historic/trunk/src/app/net/sf/japi/sql/ResultSetTableModel.java 2009-05-12 23:25:17 UTC (rev 1293) @@ -1,53 +0,0 @@ -/* JAPI - (Yet another (hopefully) useful) Java API - * - * Copyright (C) 2004-2006 Christian Hujer - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -package net.sf.japi.sql; - -import java.sql.ResultSet; -import java.sql.SQLException; -import javax.swing.table.TableModel; -import net.sf.japi.util.ThrowableHandler;import org.jetbrains.annotations.Nullable; - -/** Interface for TableModels which handle information from ResultSets. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public interface ResultSetTableModel extends TableModel { - - /** Set the ResultSet. - * @param resultSet ResultSet, maybe <code>null</code> - */ - void setResultSet(ResultSet resultSet); - - /** Get the ResultSet. - * @return ResultSet or <code>null</code> if there is no current result set - */ - @Nullable ResultSet getResultSet(); - - /** Adds a ThrowableHandler to this model. - * @param throwableHandler ThrowableHandler to add - */ - void addThrowableHandler(ThrowableHandler<? super SQLException> throwableHandler); - - /** Removes a ThrowableHandler from this model. - * @param throwableHandler ThrowableHandler to add - */ - void removeThrowableHandler(ThrowableHandler<? super SQLException> throwableHandler); - -} // interface ResultSetTableModel Deleted: historic/trunk/src/app/net/sf/japi/sql/SQLHelper.java =================================================================== --- historic/trunk/src/app/net/sf/japi/sql/SQLHelper.java 2009-05-12 23:24:22 UTC (rev 1292) +++ historic/trunk/src/app/net/sf/japi/sql/SQLHelper.java 2009-05-12 23:25:17 UTC (rev 1293) @@ -1,100 +0,0 @@ -/* JAPI - (Yet another (hopefully) useful) Java API - * - * Copyright (C) 2004-2006 Christian Hujer - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -package net.sf.japi.sql; - -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -/** A Helper Class to make work with JDBC less painful in some situations. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public class SQLHelper { - - /** The Type information for a two-dimensional Object Array. */ - private static final Object[][] OBJECT_ARRAY_ARRAY_INSTANCE = new Object[0][0]; - - /** Get a ResultSet's Column Names. - * The names are physical. - * For names for display @see #getColumnLabels(ResultSet). - * @param rs ResultSet - * @return column names - * @throws SQLException on SQL problems - */ - public static String[] getColumnNames(final ResultSet rs) throws SQLException { - final ResultSetMetaData md = rs.getMetaData(); - final int columnCount = md.getColumnCount(); - final String[] columnNames = new String[columnCount]; - for (int i = 0; i < columnCount; i++) { - columnNames[i] = md.getColumnName(i + 1); - } - return columnNames; - } - - /** Get a ResultSet's Column Labels. - * The names are for display. - * For physical names @see #getColumnNames(ResultSet). - * @param rs ResultSet - * @return column labels - * @throws SQLException on SQL problems - */ - public static String[] getColumnLabels(final ResultSet rs) throws SQLException { - final ResultSetMetaData md = rs.getMetaData(); - final int columnCount = md.getColumnCount(); - final String[] columnNames = new String[columnCount]; - for (int i = 0; i < columnCount; i++) { - columnNames[i] = md.getColumnLabel(i + 1); - } - return columnNames; - } - - /** Get a ResultSet's result. - * @param rs ResultSet - * @return two-dimensional Array containing the results - * @throws SQLException on SQL problems - */ - public static Object[][] getData(final ResultSet rs) throws SQLException { - final List<Object[]> resultList = new ArrayList<Object[]>(); - final ResultSetMetaData md = rs.getMetaData(); - final int columnCount = md.getColumnCount(); - while (rs.next()) { - final Object[] row = new Object[columnCount]; - for (int i = 0; i < columnCount; i++) { - row[i] = rs.getObject(i + 1); - } - resultList.add(row); - } - return resultList.toArray(OBJECT_ARRAY_ARRAY_INSTANCE); - } - - /** Get a ResultSet's size. - * Warning: The ResultSet's Cursor is moved by invoking this method! - * @param rs ResultSet - * @return the number of rows in this ResultSet - * @throws SQLException on SQL problems - */ - public static int getRowCount(final ResultSet rs) throws SQLException { - return rs.last() ? rs.getRow() : 0; - } - -} // class SQLHelper Deleted: historic/trunk/src/app/net/sf/japi/sql/ScrollResultSetTableModel.java =================================================================== --- historic/trunk/src/app/net/sf/japi/sql/ScrollResultSetTableModel.java 2009-05-12 23:24:22 UTC (rev 1292) +++ historic/trunk/src/app/net/sf/japi/sql/ScrollResultSetTableModel.java 2009-05-12 23:25:17 UTC (rev 1293) @@ -1,365 +0,0 @@ -/* JAPI - (Yet another (hopefully) useful) Java API - * - * Copyright (C) 2004-2006 Christian Hujer - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -package net.sf.japi.sql; - -import java.math.BigDecimal; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -import java.sql.Ref; -import java.sql.ResultSet; -import static java.sql.ResultSet.CONCUR_UPDATABLE; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.sql.Struct; -import java.sql.Time; -import java.sql.Timestamp; -import java.sql.Types; -import javax.sql.RowSet; -import javax.sql.RowSetEvent; -import javax.sql.RowSetListener; -import javax.swing.JTable; -import javax.swing.table.AbstractTableModel; -import javax.swing.table.TableModel; -import net.sf.japi.util.ThrowableHandler; -import org.jetbrains.annotations.Nullable; - -/** An implementation of <code>javax.swing.TableModel</code> for an SQL ResultSet. - * It is required that the ResultSet is absolutely navigatable. - * That feature heavily depends on the JDBC Driver implementation. - * Please note that though this class does NOT store the ResultSet data except some meta data, the {@link JTable} probably will in its own private shadow copy table model. - * @see ResultSet - * @see TableModel - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public class ScrollResultSetTableModel extends AbstractTableModel implements ResultSetTableModel, RowSetListener { - - /** Serial Version. */ - private static final long serialVersionUID = 1L; - - /** The ResultSet. */ - @Nullable private transient ResultSet resultSet; - - /** The ResultSetMetaData. */ - @Nullable private transient ResultSetMetaData metaData; - - /** The number of rows. - * @serial include - */ - private int rowCount; - - /** The number of columns. - * @serial include - */ - private int columnCount; - - /** The column titles. - * @serial include - */ - @Nullable private String[] columnTitles; - - /** Create a ResultSetTableModel. */ - public ScrollResultSetTableModel() { - } - - /** Create a ResultSetTableModel. - * @param rs Initial ResultSet - */ - public ScrollResultSetTableModel(final ResultSet rs) { - setResultSet(rs); - } - - /** {@inheritDoc} */ - public void setResultSet(@Nullable final ResultSet resultSet) { - this.resultSet = resultSet; - updateResultSetData(); - } - - /** Report an exception to all registered ThrowableHandlers. - * @param exception Exception to report - */ - private void handleException(final SQLException exception) { - final Object[] listeners = listenerList.getListenerList(); - for (int i = listeners.length - 2; i >= 0; i -= 2) { - //noinspection ObjectEquality - if (listeners[i] == ThrowableHandler.class) { - ((ThrowableHandler<? super SQLException>)listeners[i+1]).handleThrowable(exception); - } - } - } - - /** {@inheritDoc} */ - @Nullable public ResultSet getResultSet() { - return resultSet; - } - - /** {@inheritDoc} */ - public void addThrowableHandler(final ThrowableHandler<? super SQLException> throwableHandler) { - listenerList.add(ThrowableHandler.class, throwableHandler); - } - - /** {@inheritDoc} */ - public void removeThrowableHandler(final ThrowableHandler<? super SQLException> throwableHandler) { - listenerList.remove(ThrowableHandler.class, throwableHandler); - } - - /** {@inheritDoc} */ - public void rowSetChanged(final RowSetEvent event) { - System.err.println(event); - updateResultSetData(); - } - - /** {@inheritDoc} */ - // Remove ConstantConditions once IntelliJ IDEA is smarter about null - @SuppressWarnings({"ConstantConditions"}) - public void rowChanged(final RowSetEvent event) { - System.err.println(event); - if (resultSet == null) { - return; - } - try { - final int row = resultSet.getRow(); - if (resultSet.rowDeleted()) { - fireTableRowsDeleted(row, row); - } else if (resultSet.rowInserted()) { - fireTableRowsInserted(row, row); - } else if (resultSet.rowUpdated()) { - fireTableRowsUpdated(row, row); - } - } catch (final SQLException e) { - handleException(e); - } - } - - /** {@inheritDoc} */ - public void cursorMoved(final RowSetEvent event) { - System.err.println(event); - // ignore - } - - /** {@inheritDoc} */ - public int getRowCount() { - final ResultSet resultSet = this.resultSet; - if (resultSet == null) { - return 0; - } - try { - return resultSet.last() ? resultSet.getRow() : 0; - } catch (final SQLException e) { - handleException(e); - return 0; - } - //return rowCount; - } - - /** {@inheritDoc} */ - public int getColumnCount() { - if (metaData == null) { - return 0; - } - try { - return metaData.getColumnCount(); - } catch (final SQLException e) { - handleException(e); - return 0; - } - //return columnCount; - } - - /** {@inheritDoc} */ - // Remove ConstantConditions once IntelliJ IDEA is smarter about null - @SuppressWarnings({"ConstantConditions"}) - @Nullable public Object getValueAt(final int rowIndex, final int columnIndex) { - if (resultSet == null) { - return null; - } - try { - resultSet.absolute(rowIndex + 1); - return resultSet.getString(columnIndex + 1); - } catch (final SQLException e) { - handleException(e); - setResultSet(null); - return null; - } - } - - /** {@inheritDoc} */ - @SuppressWarnings({"OverlyComplexMethod", "OverlyLongMethod", "SwitchStatementWithTooManyBranches"}) - @Override public Class<?> getColumnClass(final int columnIndex) { - final int type; - try { - if (metaData == null) { - // TODO: Display error to usage, reset state - return super.getColumnClass(columnIndex); - } - type = metaData.getColumnType(columnIndex + 1); - } catch (final SQLException e) { - handleException(e); - // TODO: reset state - return super.getColumnClass(columnIndex); - } - switch (type) { - case Types.BIT: return Boolean.class; - case Types.TINYINT: return Byte.class; - case Types.SMALLINT: return Short.class; - case Types.INTEGER: return Integer.class; - case Types.BIGINT: return Long.class; - case Types.FLOAT: - case Types.REAL: return Float.class; - case Types.DOUBLE: return Double.class; - case Types.NUMERIC: return Number.class; - case Types.DECIMAL: return BigDecimal.class; - case Types.CHAR: - case Types.VARCHAR: - case Types.LONGVARCHAR: return String.class; - case Types.DATE: return Date.class; - case Types.TIME: return Time.class; - case Types.TIMESTAMP: return Timestamp.class; - case Types.BINARY: - case Types.VARBINARY: - case Types.LONGVARBINARY: return byte[].class; - case Types.OTHER: - case Types.JAVA_OBJECT: return Object.class; - case Types.CLOB: return Clob.class; - case Types.BLOB: return Blob.class; - case Types.REF: return Ref.class; - case Types.STRUCT: return Struct.class; - default: return super.getColumnClass(columnIndex); - } - } - - /** {@inheritDoc} */ - @Override @Nullable public String getColumnName(final int column) { - if (metaData == null) { - // TODO - return null; - } - try { - return metaData.getColumnName(column + 1); - } catch (final SQLException e) { - handleException(e); - return null; - } - //return columnTitles[column]; - } - - /** Insert a row. - * This is a proxy method to the underlying result set. - * @param rowData data for new row - * @throws SQLException in case of SQL problems - */ - // Remove ConstantConditions once IntelliJ IDEA is smarter about null - @SuppressWarnings({"ConstantConditions"}) - public void insert(final String[] rowData) throws SQLException { - if (resultSet != null) { - return; - } - resultSet.moveToInsertRow(); - for (int i = 0; i < rowData.length; i++) { - resultSet.updateString(i + 1, rowData[i]); - } - resultSet.insertRow(); - resultSet.moveToCurrentRow(); - final int row = resultSet.getRow(); - fireTableRowsInserted(row, row); - } - - /** {@inheritDoc} */ - @Override public boolean isCellEditable(final int rowIndex, final int columnIndex) { - try { - return resultSet != null && resultSet.getConcurrency() == CONCUR_UPDATABLE; - } catch (final SQLException e) { - handleException(e); - // TODO: reset state - return false; - } - } - - /** {@inheritDoc} */ - // Remove ConstantConditions once IntelliJ IDEA is smarter about null - @SuppressWarnings({"ConstantConditions"}) - @Override public void setValueAt(final Object aValue, final int rowIndex, final int columnIndex) { - if (resultSet == null) { - return; - } - try { - if (!resultSet.absolute(rowIndex + 1)) { - // TODO: Display error to usage, reset state - return; - } - resultSet.updateObject(columnIndex + 1, aValue); - resultSet.updateRow(); - } catch (final SQLException e) { - handleException(e); - // TODO: reset state - } - } - - /** Updates the data from the result set. */ - private void updateResultSetData() { - if (resultSet == null) { - rowCount = 0; - columnCount = 0; - columnTitles = null; - } else { - try { - metaData = resultSet.getMetaData(); - if (resultSet instanceof RowSet) { - ((RowSet) resultSet).addRowSetListener(this); - } - columnTitles = SQLHelper.getColumnLabels(resultSet); - columnCount = columnTitles != null ? columnTitles.length : 0; - rowCount = SQLHelper.getRowCount(resultSet); - } catch (final SQLException e) { - handleException(e); - resultSet = null; - rowCount = 0; - columnCount = 0; - columnTitles = null; - } - } - fireTableStructureChanged(); - } - - /** Delete a row. - * This is a proxy method to the underlying result set. - * @param n row number to delete (Java row number, 0 .. (number of rows - 1)) - * @throws SQLException in case of SQL problems - */ - // Remove ConstantConditions once IntelliJ IDEA is smarter about null - @SuppressWarnings({"ConstantConditions"}) - public void deleteRow(final int n) throws SQLException { - if (resultSet == null) { - return; - } - resultSet.absolute(n + 1); - resultSet.deleteRow(); - fireTableRowsDeleted(n, n); - } - - /** Get the meta data. - * @return meta data - */ - @Nullable public ResultSetMetaData getMetaData() { - return metaData; - } - -} // class ResultSetTableModel Deleted: historic/trunk/src/app/net/sf/japi/sql/package.html =================================================================== --- historic/trunk/src/app/net/sf/japi/sql/package.html 2009-05-12 23:24:22 UTC (rev 1292) +++ historic/trunk/src/app/net/sf/japi/sql/package.html 2009-05-12 23:25:17 UTC (rev 1293) @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- JAPI - (Yet another (hopefully) useful) Java API - - - - Copyright (C) 2004-2006 Christian Hujer - - - - This program is free software; you can redistribute it and/or - - modify it under the terms of the GNU General Public License as - - published by the Free Software Foundation; either version 2 of the - - License, or (at your option) any later version. - - - - 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. - - - - You should have received a copy of the GNU General Public License - - along with this program; if not, write to the Free Software - - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - - 02111-1307, USA. - --> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> - <head> - <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> - <meta name="Date" content="$Date: 2006-04-03 23:00:14 +0200 (Mon, 03 Apr 2006) $" /> - <title>net.sf.japi.sql</title> - </head> - <body> - <p> - Helpers for {@link java.sql}. - </p> - </body> -</html> Copied: libs/sql/trunk/src/prj/net/sf/japi/sql/CachedResultSetTableModel.java (from rev 1278, historic/trunk/src/app/net/sf/japi/sql/CachedResultSetTableModel.java) =================================================================== --- libs/sql/trunk/src/prj/net/sf/japi/sql/CachedResultSetTableModel.java (rev 0) +++ libs/sql/trunk/src/prj/net/sf/japi/sql/CachedResultSetTableModel.java 2009-05-12 23:25:17 UTC (rev 1293) @@ -0,0 +1,170 @@ +/* JAPI - (Yet another (hopefully) useful) Java API + * + * Copyright (C) 2004-2006 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +package net.sf.japi.sql; + +import java.sql.ResultSet; +import java.sql.SQLException; +import javax.swing.table.AbstractTableModel; +import javax.swing.table.TableModel; +import net.sf.japi.util.ThrowableHandler; +import org.jetbrains.annotations.Nullable; + +/** An implementation of <code>javax.swing.TableModel</code> for an SQL ResultSet. + * In contrast to @see ResultSetTableModel this implementation reads all data upon setting the ResultSet. + * The advantage is that reading the ResultSet does not require the database connection anymore. + * The disadvantage is that this class requires much memory on large results and may fail for OutOfMemory on huge results. + * This class is fully serializable, at least in the way Swing classes are at all serializable. + * <p/> + * Serialized instances will also serialize the cached data. + * The data source information is not serialized. + * @see ResultSet + * @see TableModel + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @todo maybe setResultSet should throw SQLException? + */ +public class CachedResultSetTableModel extends AbstractTableModel implements ResultSetTableModel { + + /** Serial Version. */ + private static final long serialVersionUID = 1L; + + /** The number of rows. + * @serial include + */ + private int rowCount; + + /** The number of columns. + * @serial include + */ + private int columnCount; + + /** The column titles. + * @serial include + */ + @Nullable private String[] columnTitles; + + /** The Data. + * @serial include + */ + @Nullable private Object[][] data; + + /** The ResultSet. */ + @Nullable private ResultSet resultSet; + + /** Create a CachedResultSetTableModel. */ + public CachedResultSetTableModel() { + } + + /** Create a CachedResultSetTableModel. + * @param rs Initial ResultSet + */ + public CachedResultSetTableModel(@Nullable final ResultSet rs) { + setResultSet(rs); + } + + /** Report an exception to all registered ThrowableHandlers. + * @param exception Exception to report + */ + private void handleException(final SQLException exception) { + final Object[] listeners = listenerList.getListenerList(); + for (int i = listeners.length - 2; i >= 0; i -= 2) { + //noinspection ObjectEquality + if (listeners[i] == ThrowableHandler.class) { + ((ThrowableHandler<? super SQLException>) listeners[i + 1]).handleThrowable(exception); + } + } + } + + /** {@inheritDoc} */ + public void setResultSet(@Nullable final ResultSet resultSet) { + if (resultSet == null) { + this.resultSet = resultSet; + rowCount = 0; + columnCount = 0; + columnTitles = null; + data = null; + } else { + try { + columnTitles = SQLHelper.getColumnLabels(resultSet); + columnCount = columnTitles != null ? columnTitles.length : 0; + rowCount = SQLHelper.getRowCount(resultSet); + data = SQLHelper.getData(resultSet); + this.resultSet = resultSet; + } catch (final SQLException e) { + handleException(e); + rowCount = 0; + columnCount = 0; + columnTitles = null; + data = null; + return; // don't invoke fireTableStructureChanged() twice then. + } + } + fireTableStructureChanged(); + } + + /** {@inheritDoc} */ + @Nullable public ResultSet getResultSet() { + return resultSet; + } + + /** {@inheritDoc} */ + public void addThrowableHandler(final ThrowableHandler<? super SQLException> throwableHandler) { + listenerList.add(ThrowableHandler.class, throwableHandler); + } + + /** {@inheritDoc} */ + public void removeThrowableHandler(final ThrowableHandler<? super SQLException> throwableHandler) { + listenerList.remove(ThrowableHandler.class, throwableHandler); + } + + /** @see TableModel */ + public int getColumnCount() { + return columnCount; + } + + /** @see TableModel */ + public int getRowCount() { + return rowCount; + } + + /** @see TableModel */ + @Nullable public Object getValueAt(final int rowIndex, final int columnIndex) { + try { + return data[rowIndex][columnIndex]; + } catch (final NullPointerException ignore) { + return null; + } catch (final ArrayIndexOutOfBoundsException ignore) { + return null; + } + } + + /** {@inheritDoc} + * Always returns <code>String.class</code>. + */ + @Override public Class<?> getColumnClass(final int columnIndex) { + return String.class; + } + + /** {@inheritDoc} */ + @Override @Nullable public String getColumnName(final int column) { + return columnTitles != null ? columnTitles[column] : null; + } + +} // class CachedResultSetTableModel Property changes on: libs/sql/trunk/src/prj/net/sf/japi/sql/CachedResultSetTableModel.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + LF Copied: libs/sql/trunk/src/prj/net/sf/japi/sql/DatabaseTreeModel.java (from rev 1278, historic/trunk/src/app/net/sf/japi/sql/DatabaseTreeModel.java) =================================================================== --- libs/sql/trunk/src/prj/net/sf/japi/sql/DatabaseTreeModel.java (rev 0) +++ libs/sql/trunk/src/prj/net/sf/japi/sql/DatabaseTreeModel.java 2009-05-12 23:25:17 UTC (rev 1293) @@ -0,0 +1,250 @@ +/* JAPI - (Yet another (hopefully) useful) Java API + * + * Copyright (C) 2004-2006 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +package net.sf.japi.sql; + +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; +import javax.swing.event.EventListenerList; +import javax.swing.event.TreeModelEvent; +import javax.swing.event.TreeModelListener; +import javax.swing.tree.TreeModel; +import javax.swing.tree.TreePath; + +/** A TreeModel displaying the catalogs of a database (usually tables and views) as tree. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +@SuppressWarnings({"ObjectEquality"}) +public class DatabaseTreeModel implements TreeModel { + + /** The event listeners. */ + private final EventListenerList listenerList = new EventListenerList(); + + /** The Database nodes in the tree. */ + private final List<CatalogTreeNode> catalogs = new ArrayList<CatalogTreeNode>(); + + /** The Database Metadata of the database this treemodel reflects. */ + private DatabaseMetaData databaseMetaData; + + /** Create a DatabaseTreeModel. + * Thw tree model is not yet connected to databaseMetaData. + */ + public DatabaseTreeModel() { + } + + /** Create a DatabaseTreeModel for a Database. + * @param databaseMetaData Database Metadata for this tree model + * @throws SQLException in case of database problems + */ + public DatabaseTreeModel(final DatabaseMetaData databaseMetaData) throws SQLException { + this.databaseMetaData = databaseMetaData; + refresh(); + } + + /** Refresh the data of this model from the database. + * @throws SQLException in case of database problems + */ + public void refresh() throws SQLException { + catalogs.clear(); + if (databaseMetaData != null) { + final ResultSet rs = databaseMetaData.getCatalogs(); + try { + while (rs.next()) { + try { + catalogs.add(new CatalogTreeNode(rs.getString(1))); + } catch (final SQLException e) { + System.err.println(e); + // TODO + } + } + } finally { + rs.close(); + } + } + fireTreeStructureChanged(); + } + + /** Set the databaseMetaData for this model. + * @param databaseMetaData database meta data for this model + * @throws SQLException in case of database problems + */ + public void setDatabaseMetaData(final DatabaseMetaData databaseMetaData) throws SQLException { + this.databaseMetaData = databaseMetaData; + refresh(); + } + + /** Get the databaseMetaData of this model. + * @return databaseMetaData of this model + */ + public DatabaseMetaData getDatabaseMetaData() { + return databaseMetaData; + } + + /** {@inheritDoc} */ + public void addTreeModelListener(final TreeModelListener l) { + listenerList.add(TreeModelListener.class, l); + } + + /** {@inheritDoc} */ + public Object getChild(final Object parent, final int index) { + if (parent == this) { + return catalogs.get(index); + } else { + assert parent instanceof CatalogTreeNode; + return ((CatalogTreeNode) parent).getTable(index); + } + } + + /** {@inheritDoc} */ + public int getChildCount(final Object parent) { + return parent == this ? catalogs.size() : ((CatalogTreeNode) parent).getTableCount(); + } + + /** {@inheritDoc} */ + public int getIndexOfChild(final Object parent, final Object child) { + return parent == this ? catalogs.indexOf(child) : ((CatalogTreeNode) parent).getTableIndex((CatalogTreeNode.TableTreeNode) child); + } + + /** {@inheritDoc} */ + public Object getRoot() { + return this; + } + + /** {@inheritDoc} */ + public boolean isLeaf(final Object node) { + return node instanceof CatalogTreeNode.TableTreeNode; + } + + /** {@inheritDoc} */ + public void removeTreeModelListener(final TreeModelListener l) { + listenerList.remove(TreeModelListener.class, l); + } + + /** {@inheritDoc} */ + public void valueForPathChanged(final TreePath path, final Object newValue) { + } + + /** Event fire if the tree has changed. */ + private void fireTreeStructureChanged() { + TreeModelEvent e = null; + final Object[] listeners = listenerList.getListenerList(); + for (int i = listeners.length - 2; i >= 0; i -= 2) { + if (listeners[i] == TreeModelListener.class) { + if (e == null) { + e = new TreeModelEvent(this, new Object[] { this }); + } + ((TreeModelListener) listeners[i + 1]).treeStructureChanged(e); + } + } + } + + /** A TreeNode reflecting a Database. */ + public class CatalogTreeNode { + + /** The name of this catalog. */ + private String catalog; + + /** The tables of this catalog. */ + private final List<TableTreeNode> tables = new ArrayList<TableTreeNode>(); + + /** Create a CatalogTreeNode. + * @param catalog Catalog for which to create a CatalogTreeNode. + * @throws SQLException in case of database problems + */ + CatalogTreeNode(final String catalog) throws SQLException { + this.catalog = catalog; + final ResultSet rs = databaseMetaData.getTables(catalog, null, null, null); + try { + while (rs.next()) { + tables.add(new TableTreeNode(rs.getString("TABLE_NAME"))); + } + } finally { + rs.close(); + } + } + + /** Get a table with a certain index. + * @param index index of table to get + * @return table for <var>index</var> + */ + TableTreeNode getTable(final int index) { + return tables.get(index); + } + + /** Get the number of tables. + * @return number of tables + */ + public int getTableCount() { + return tables.size(); + } + + /** Get the index of a table. + * @param table Table to get index of + * @return index of <var>table</var> + */ + public int getTableIndex(final TableTreeNode table) { + return tables.indexOf(table); + } + + /** {@inheritDoc} */ + @Override public String toString() { + return catalog; + } + + /** A TreeNode reflecting a Table. */ + public class TableTreeNode { + + /** The name of this table. */ + private String table; + + /** Create a TableTreeNode. + * @param table Table name for which to create a TableTreeNode. + */ + TableTreeNode(final String table) { + this.table = table; + } + + /** Get the name of the table this TableTreeNode represents. + * @return table name + */ + public String getTableName() { + return catalog + '.' + table; + } + + /** Get the name of the catalog this TableTreeNode is in. + * @return catalog name + */ + public String getCatalogName() { + return catalog; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return table; + } + + } // class TableTreeNode + + } // class CatalogTreeNode + +} // class DatabaseTreeModel Property changes on: libs/sql/trunk/src/prj/net/sf/japi/sql/DatabaseTreeModel.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + LF Copied: libs/sql/trunk/src/prj/net/sf/japi/sql/ResultSetTableModel.java (from rev 1278, historic/trunk/src/app/net/sf/japi/sql/ResultSetTableModel.java) =================================================================== --- libs/sql/trunk/src/prj/net/sf/japi/sql/ResultSetTableModel.java (rev 0) +++ libs/sql/trunk/src/prj/net/sf/japi/sql/ResultSetTableModel.java 2009-05-12 23:25:17 UTC (rev 1293) @@ -0,0 +1,53 @@ +/* JAPI - (Yet another (hopefully) useful) Java API + * + * Copyright (C) 2004-2006 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +package net.sf.japi.sql; + +import java.sql.ResultSet; +import java.sql.SQLException; +import javax.swing.table.TableModel; +import net.sf.japi.util.ThrowableHandler;import org.jetbrains.annotations.Nullable; + +/** Interface for TableModels which handle information from ResultSets. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public interface ResultSetTableModel extends TableModel { + + /** Set the ResultSet. + * @param resultSet ResultSet, maybe <code>null</code> + */ + void setResultSet(ResultSet resultSet); + + /** Get the ResultSet. + * @return ResultSet or <code>null</code> if there is no current result set + */ + @Nullable ResultSet getResultSet(); + + /** Adds a ThrowableHandler to this model. + * @param throwableHandler ThrowableHandler to add + */ + void addThrowableHandler(ThrowableHandler<? super SQLException> throwableHandler); + + /** Removes a ThrowableHandler from this model. + * @param throwableHandler ThrowableHandler to add + */ + void removeThrowableHandler(ThrowableHandler<? super SQLException> throwableHandler); + +} // interface ResultSetTableModel Property changes on: libs/sql/trunk/src/prj/net/sf/japi/sql/ResultSetTableModel.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + LF Copied: libs/sql/trunk/src/prj/net/sf/japi/sql/SQLHelper.java (from rev 1278, historic/trunk/src/app/net/sf/japi/sql/SQLHelper.java) =================================================================== --- libs/sql/trunk/src/prj/net/sf/japi/sql/SQLHelper.java (rev 0) +++ libs/sql/trunk/src/prj/net/sf/japi/sql/SQLHelper.java 2009-05-12 23:25:17 UTC (rev 1293) @@ -0,0 +1,100 @@ +/* JAPI - (Yet another (hopefully) useful) Java API + * + * Copyright (C) 2004-2006 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +package net.sf.japi.sql; + +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +/** A Helper Class to make work with JDBC less painful in some situations. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class SQLHelper { + + /** The Type information for a two-dimensional Object Array. */ + private static final Object[][] OBJECT_ARRAY_ARRAY_INSTANCE = new Object[0][0]; + + /** Get a ResultSet's Column Names. + * The names are physical. + * For names for display @see #getColumnLabels(ResultSet). + * @param rs ResultSet + * @return column names + * @throws SQLException on SQL problems + */ + public static String[] getColumnNames(final ResultSet rs) throws SQLException { + final ResultSetMetaData md = rs.getMetaData(); + final int columnCount = md.getColumnCount(); + final String[] columnNames = new String[columnCount]; + for (int i = 0; i < columnCount; i++) { + columnNames[i] = md.getColumnName(i + 1); + } + return columnNames; + } + + /** Get a ResultSet's Column Labels. + * The names are for display. + * For physical names @see #getColumnNames(ResultSet). + * @param rs ResultSet + * @return column labels + * @throws SQLException on SQL problems + */ + public static String[] getColumnLabels(final ResultSet rs) throws SQLException { + final ResultSetMetaData md = rs.getMetaData(); + final int columnCount = md.getColumnCount(); + final String[] columnNames = new String[columnCount]; + for (int i = 0; i < columnCount; i++) { + columnNames[i] = md.getColumnLabel(i + 1); + } + return columnNames; + } + + /** Get a ResultSet's result. + * @param rs ResultSet + * @return two-dimensional Array containing the results + * @throws SQLException on SQL problems + */ + public static Object[][] getData(final ResultSet rs) throws SQLException { + final List<Object[]> resultList = new ArrayList<Object[]>(); + final ResultSetMetaData md = rs.getMetaData(); + final int columnCount = md.getColumnCount(); + while (rs.next()) { + final Object[] row = new Object[columnCount]; + for (int i = 0; i < columnCount; i++) { + row[i] = rs.getObject(i + 1); + } + resultList.add(row); + } + return resultList.toArray(OBJECT_ARRAY_ARRAY_INSTANCE); + } + + /** Get a ResultSet's size. + * Warning: The ResultSet's Cursor is moved by invoking this method! + * @param rs ResultSet + * @return the number of rows in this ResultSet + * @throws SQLException on SQL problems + */ + public static int getRowCount(final ResultSet rs) throws SQLException { + return rs.last() ? rs.getRow() : 0; + } + +} // class SQLHelper Property changes on: libs/sql/trunk/src/prj/net/sf/japi/sql/SQLHelper.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + LF Copied: libs/sql/trunk/src/prj/net/sf/japi/sql/Scroll... [truncated message content] |
From: <chr...@us...> - 2009-05-12 23:24:45
|
Revision: 1292 http://japi.svn.sourceforge.net/japi/?rev=1292&view=rev Author: christianhujer Date: 2009-05-12 23:24:22 +0000 (Tue, 12 May 2009) Log Message: ----------- Remove obsolete test package. Removed Paths: ------------- historic/trunk/src/test/net/sf/japi/finance/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-12 23:15:30
|
Revision: 1291 http://japi.svn.sourceforge.net/japi/?rev=1291&view=rev Author: christianhujer Date: 2009-05-12 23:15:22 +0000 (Tue, 12 May 2009) Log Message: ----------- Add files to make the module build. Added Paths: ----------- libs/sql/trunk/COPYING libs/sql/trunk/build.xml libs/sql/trunk/module.properties Added: libs/sql/trunk/COPYING =================================================================== --- libs/sql/trunk/COPYING (rev 0) +++ libs/sql/trunk/COPYING 2009-05-12 23:15:22 UTC (rev 1291) @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + Property changes on: libs/sql/trunk/COPYING ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: libs/sql/trunk/build.xml =================================================================== --- libs/sql/trunk/build.xml (rev 0) +++ libs/sql/trunk/build.xml 2009-05-12 23:15:22 UTC (rev 1291) @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2009 Christian Hujer. + ~ + ~ This library is free software; you can redistribute it and/or + ~ modify it under the terms of the GNU Lesser General Public + ~ License as published by the Free Software Foundation; either + ~ version 2.1 of the License, or (at your option) any later version. + ~ + ~ This library 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. + ~ + ~ You should have received a copy of the GNU Lesser General Public + ~ License along with this library; if not, write to the Free Software + ~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + --> +<!DOCTYPE project [ + <!ENTITY commonBuild SYSTEM "common/commonBuild.xml"> +]> +<project name="japi lib sql" default="all"> + + &commonBuild; + +</project> Property changes on: libs/sql/trunk/build.xml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:eol-style + LF Added: libs/sql/trunk/module.properties =================================================================== --- libs/sql/trunk/module.properties (rev 0) +++ libs/sql/trunk/module.properties 2009-05-12 23:15:22 UTC (rev 1291) @@ -0,0 +1,22 @@ +# +# Copyright (C) 2009 Christian Hujer. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# + +update.focus=none +name=japi-lib-sql +shortname=sql +title=Sql Property changes on: libs/sql/trunk/module.properties ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-12 23:06:41
|
Revision: 1290 http://japi.svn.sourceforge.net/japi/?rev=1290&view=rev Author: christianhujer Date: 2009-05-12 23:06:33 +0000 (Tue, 12 May 2009) Log Message: ----------- Add package structure. Added Paths: ----------- libs/sql/trunk/src/prj/net/ libs/sql/trunk/src/prj/net/sf/ libs/sql/trunk/src/prj/net/sf/japi/ libs/sql/trunk/src/prj/net/sf/japi/sql/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-12 22:53:31
|
Revision: 1289 http://japi.svn.sourceforge.net/japi/?rev=1289&view=rev Author: christianhujer Date: 2009-05-12 22:53:23 +0000 (Tue, 12 May 2009) Log Message: ----------- Add structure for new sql lib. Added Paths: ----------- libs/sql/ libs/sql/branches/ libs/sql/tags/ libs/sql/trunk/ libs/sql/trunk/lib/ libs/sql/trunk/src/ libs/sql/trunk/src/doc/ libs/sql/trunk/src/prj/ libs/sql/trunk/src/tst/ Property changes on: libs/sql/trunk ___________________________________________________________________ Added: svn:ignore + bin classes dest developer.properties dist docs Added: svn:externals + ^/common/trunk common This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-12 00:06:53
|
Revision: 1288 http://japi.svn.sourceforge.net/japi/?rev=1288&view=rev Author: christianhujer Date: 2009-05-12 00:06:45 +0000 (Tue, 12 May 2009) Log Message: ----------- Remove unmaintained finance module. Removed Paths: ------------- libs/finance/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-12 00:01:58
|
Revision: 1287 http://japi.svn.sourceforge.net/japi/?rev=1287&view=rev Author: christianhujer Date: 2009-05-12 00:01:45 +0000 (Tue, 12 May 2009) Log Message: ----------- Remove unmaintained finance package. Removed Paths: ------------- historic/trunk/src/app/net/sf/japi/finance/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-11 06:46:40
|
Revision: 1286 http://japi.svn.sourceforge.net/japi/?rev=1286&view=rev Author: christianhujer Date: 2009-05-11 06:46:31 +0000 (Mon, 11 May 2009) Log Message: ----------- Created release tag 0.2.0 for branch 0.2. Added Paths: ----------- libs/xml/tags/0.2.0/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |