japi-cvs Mailing List for JAPI (Page 3)
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-07-25 12:40:01
|
Revision: 1360
http://japi.svn.sourceforge.net/japi/?rev=1360&view=rev
Author: christianhujer
Date: 2009-07-25 12:39:50 +0000 (Sat, 25 Jul 2009)
Log Message:
-----------
Add {@listing} taglet.
Added Paths:
-----------
libs/taglets/trunk/src/prj/net/sf/japi/taglets/ListingTaglet.java
Added: libs/taglets/trunk/src/prj/net/sf/japi/taglets/ListingTaglet.java
===================================================================
--- libs/taglets/trunk/src/prj/net/sf/japi/taglets/ListingTaglet.java (rev 0)
+++ libs/taglets/trunk/src/prj/net/sf/japi/taglets/ListingTaglet.java 2009-07-25 12:39:50 UTC (rev 1360)
@@ -0,0 +1,152 @@
+/*
+ * 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
+ */
+
+package net.sf.japi.taglets;
+
+import com.sun.javadoc.Tag;
+import com.sun.tools.doclets.Taglet;
+import de.java2html.Java2Html;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Taglet which includes a listing.
+ * It works like the original <code>{@code}</code> taglet.
+ * As an additional feature, it will treat the first word as a language indicator and try to apply syntax highlighting.
+ * The purpose is to include source code within Javadoc in a more convenient form.
+ * <p>
+ * Currenty, the following languages are supported:
+ * <table>
+ * <tr><th>keyword</th><th>language</th><th>Notes</th></tr>
+ * <tr><td>java</td><td>Java</td><td>Requires <a href="http://www.java2html.de/">java2html</a> by Markus Gebhard.</td></tr>
+ * </table>
+ *
+ * <h4>Example</h4>
+ * {@listing java /** ...
+ * * {@listing java for (final String arg : args) {
+ * * out.println(arg);
+ * * }}
+ * * ...}
+ * will procude the following output:
+ * <p>
+ * ...{@listing java for (final String arg : args) {
+ * out.println(arg);
+ * }}...
+ *
+ * @note The listing tag intentionally is an inline tag.
+ * That prevents javadoc from placing it where it wants - that's what it does with block tags.
+ *
+ * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
+ * @since 1.2
+ */
+public class ListingTaglet implements Taglet {
+
+ /** Pattern which matches a Listing.
+ * The first group is the keyword for the language.
+ * The second group is the remaining text, the listing itself.
+ */
+ private static final Pattern PATTERN = Pattern.compile("\\s*(\\S+)\\s+(.*)", Pattern.MULTILINE | Pattern.DOTALL);
+
+ /** {@inheritDoc} */
+ public boolean inField() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ public boolean inConstructor() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ public boolean inMethod() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ public boolean inOverview() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ public boolean inPackage() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ public boolean inType() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ public boolean isInlineTag() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ public String getName() {
+ return "listing";
+ }
+
+ /** {@inheritDoc} */
+ public String toString(final Tag tag) {
+ final String origText = tag.text();
+ final Matcher matcher = PATTERN.matcher(origText);
+ String text = null;
+ final String listing;
+ if (matcher.matches()) {
+ final String language = matcher.group(1);
+ listing = matcher.group(2).replaceAll("\n ", "\n");
+ if ("java".equalsIgnoreCase(language)) {
+ //noinspection ErrorNotRethrown
+ try {
+ text = Java2Html.convertToHtml(listing);
+ } catch (final NoClassDefFoundError ignore) {
+ System.err.println(tag.position() + ": warning: Java2html not found, cannot convert Java source code to HTML.");
+ }
+ } else {
+ System.err.println(tag.position() + ": warning: Unsupported language" + language);
+ }
+ } else {
+ listing = origText;
+ System.err.println(tag.position() + ": warning: bad formatted {@listing} - disabling features, trying fallback.");
+ }
+ if (text == null) {
+ text = "<pre>" + listing.replaceAll("&", "&").replaceAll("<", "<") + "</pre>";
+ }
+ return text;
+ }
+
+ /** {@inheritDoc} */
+ public String toString(final Tag[] tags) {
+ final StringBuilder sb = new StringBuilder();
+ for (final Tag tag : tags) {
+ sb.append(toString(tag));
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Register this Taglet.
+ * @param tagletMap the map to register this tag to.
+ */
+ public static void register(final Map<String, Taglet> tagletMap) {
+ final Taglet taglet = new ListingTaglet();
+ tagletMap.put(taglet.getName(), taglet);
+ }
+}
Property changes on: libs/taglets/trunk/src/prj/net/sf/japi/taglets/ListingTaglet.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-07-25 12:39:36
|
Revision: 1359
http://japi.svn.sourceforge.net/japi/?rev=1359&view=rev
Author: christianhujer
Date: 2009-07-25 12:39:27 +0000 (Sat, 25 Jul 2009)
Log Message:
-----------
Add {@include} taglet.
Added Paths:
-----------
libs/taglets/trunk/src/prj/net/sf/japi/taglets/IncludeTaglet.java
Added: libs/taglets/trunk/src/prj/net/sf/japi/taglets/IncludeTaglet.java
===================================================================
--- libs/taglets/trunk/src/prj/net/sf/japi/taglets/IncludeTaglet.java (rev 0)
+++ libs/taglets/trunk/src/prj/net/sf/japi/taglets/IncludeTaglet.java 2009-07-25 12:39:27 UTC (rev 1359)
@@ -0,0 +1,166 @@
+/*
+ * 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
+ */
+
+package net.sf.japi.taglets;
+
+import com.sun.javadoc.Tag;
+import com.sun.tools.doclets.Taglet;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.Map;
+import de.java2html.Java2Html;
+
+/**
+ * Taglet which includes a listing from an external file.
+ * <p>
+ * Example: {@include NoteTaglet.java}
+ * Result:
+ * {@include NoteTaglet.java}
+ * The path is relative to the file which contains the {@include} tag.
+ * The taglet will always treat the included file as listing.
+ * <p>
+ * The included file may be processed by <a href="http://www.java2html.de/">java2html</a> by Markus Gebhard if:
+ * <ul>
+ * <li>The file name ends on <code>.java</code></li>
+ * <li><a href="http://www.java2html.de/">java2html</a> by Markus Gebhard is available.
+ * </ul>
+ * For example, if you want to include this in ant, the taglet declaration would look like this:
+ * {@code <taglet name="net.sf.japi.taglets.IncludeTaglet" path="lib/japi-lib-taglets.jar;lib/java2html.jar" />}
+ *
+ * some inline code {@code public class X {
+ * public static void main(final String... args) {
+ * System.out.println("Hello, world");
+ * }
+ * }} in this line.
+ *
+ * @note The include tag intentionally is an inline tag.
+ * That prevents javadoc from placing it where it wants - that's what it does with block tags.
+ *
+ * @warning This is a beta version.
+ * Do not use yet, as the format of the parameters for the include tag might change.
+ *
+ * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
+ * @since 0.2
+ */
+public class IncludeTaglet implements Taglet {
+
+ /** Size for an I/O buffer. */
+ private static final int BUF_SIZE = 4096;
+
+ /** {@inheritDoc} */
+ public boolean inField() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ public boolean inConstructor() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ public boolean inMethod() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ public boolean inOverview() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ public boolean inPackage() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ public boolean inType() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ public boolean isInlineTag() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ public String getName() {
+ return "include";
+ }
+
+ /** {@inheritDoc} */
+ public String toString(final Tag tag) {
+ final StringBuilder src = new StringBuilder();
+ final File f = new File(tag.position().file().getParentFile(), tag.text());
+ try {
+ // FIXME:2009-07-25:christianhujer:This always uses the default encoding.
+ // Instead use the encoding from the doclet or let the user specify.
+ final Reader in = new BufferedReader(new FileReader(f));
+ try {
+ final char[] buf = new char[BUF_SIZE];
+ //noinspection NestedAssignment
+ for (int charsRead; (charsRead = in.read(buf)) != -1;) {
+ src.append(buf, 0, charsRead);
+ }
+ } finally {
+ in.close();
+ }
+ } catch (final FileNotFoundException e) {
+ //Standard.htmlDoclet.configuration().getDocletSpecificMsg().warning(tag.position(), "cannot open file", f.toString(), e.toString());
+ System.err.println(tag.position() + ": warning: cannot open file " + f + ": " + e);
+ return "<p>include " + f + " (error)</p>";
+ } catch (final IOException e) {
+ System.err.println(tag.position() + ": warning: error while reading file " + f + ": " + e);
+ return "<p>include " + f + " (error)</p>";
+ }
+ String text = null;
+ if (f.getName().endsWith(".java")) {
+ //noinspection ErrorNotRethrown
+ try {
+ text = Java2Html.convertToHtml(src.toString());
+ } catch (final NoClassDefFoundError ignore) {
+ System.err.println(tag.position() + ": warning: Java2html not found, cannot convert Java source code to HTML.");
+ }
+ }
+ if (text == null) {
+ text = "<pre>" + src.toString().replaceAll("&", "&").replaceAll("<", "<") + "</pre>";
+ }
+ return text;
+ }
+
+ /** {@inheritDoc} */
+ public String toString(final Tag[] tags) {
+ final StringBuilder sb = new StringBuilder();
+ for (final Tag tag : tags) {
+ sb.append(toString(tag));
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Register this Taglet.
+ * @param tagletMap the map to register this tag to.
+ */
+ public static void register(final Map<String, Taglet> tagletMap) {
+ final Taglet taglet = new IncludeTaglet();
+ tagletMap.put(taglet.getName(), taglet);
+ }
+}
Property changes on: libs/taglets/trunk/src/prj/net/sf/japi/taglets/IncludeTaglet.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-07-25 12:38:58
|
Revision: 1358
http://japi.svn.sourceforge.net/japi/?rev=1358&view=rev
Author: christianhujer
Date: 2009-07-25 12:38:51 +0000 (Sat, 25 Jul 2009)
Log Message:
-----------
Add package documentation.
Added Paths:
-----------
libs/taglets/trunk/src/prj/net/sf/japi/taglets/package-info.java
Added: libs/taglets/trunk/src/prj/net/sf/japi/taglets/package-info.java
===================================================================
--- libs/taglets/trunk/src/prj/net/sf/japi/taglets/package-info.java (rev 0)
+++ libs/taglets/trunk/src/prj/net/sf/japi/taglets/package-info.java 2009-07-25 12:38:51 UTC (rev 1358)
@@ -0,0 +1,2 @@
+/** Contains a lot of useful additional taglets. */
+package net.sf.japi.taglets;
Property changes on: libs/taglets/trunk/src/prj/net/sf/japi/taglets/package-info.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-07-25 12:38:20
|
Revision: 1357
http://japi.svn.sourceforge.net/japi/?rev=1357&view=rev
Author: christianhujer
Date: 2009-07-25 12:38:13 +0000 (Sat, 25 Jul 2009)
Log Message:
-----------
Fix warnings.
Modified Paths:
--------------
libs/taglets/trunk/src/prj/net/sf/japi/taglets/BlockListTaglet.java
libs/taglets/trunk/src/prj/net/sf/japi/taglets/HistoryTaglet.java
libs/taglets/trunk/src/prj/net/sf/japi/taglets/PostconditionTaglet.java
libs/taglets/trunk/src/prj/net/sf/japi/taglets/PreconditionTaglet.java
libs/taglets/trunk/src/prj/net/sf/japi/taglets/ReturnValueTaglet.java
Modified: libs/taglets/trunk/src/prj/net/sf/japi/taglets/BlockListTaglet.java
===================================================================
--- libs/taglets/trunk/src/prj/net/sf/japi/taglets/BlockListTaglet.java 2009-07-25 12:36:49 UTC (rev 1356)
+++ libs/taglets/trunk/src/prj/net/sf/japi/taglets/BlockListTaglet.java 2009-07-25 12:38:13 UTC (rev 1357)
@@ -29,6 +29,7 @@
* @since 0.1
* @todo add user definable background colour
*/
+@SuppressWarnings({"AbstractClassWithoutAbstractMethods"})
public abstract class BlockListTaglet implements Taglet {
/** The name of this Taglet. */
Modified: libs/taglets/trunk/src/prj/net/sf/japi/taglets/HistoryTaglet.java
===================================================================
--- libs/taglets/trunk/src/prj/net/sf/japi/taglets/HistoryTaglet.java 2009-07-25 12:36:49 UTC (rev 1356)
+++ libs/taglets/trunk/src/prj/net/sf/japi/taglets/HistoryTaglet.java 2009-07-25 12:38:13 UTC (rev 1357)
@@ -27,6 +27,7 @@
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.jetbrains.annotations.Nullable;
/**
* Taglet for history.
@@ -97,6 +98,7 @@
}
/** {@inheritDoc} */
+ @Nullable
public String toString(final Tag[] tags) {
if (tags == null || tags.length == 0) {
return null;
Modified: libs/taglets/trunk/src/prj/net/sf/japi/taglets/PostconditionTaglet.java
===================================================================
--- libs/taglets/trunk/src/prj/net/sf/japi/taglets/PostconditionTaglet.java 2009-07-25 12:36:49 UTC (rev 1356)
+++ libs/taglets/trunk/src/prj/net/sf/japi/taglets/PostconditionTaglet.java 2009-07-25 12:38:13 UTC (rev 1357)
@@ -28,6 +28,7 @@
* @see InvariantTaglet
* @see PreconditionTaglet
*/
+@SuppressWarnings({"RefusedBequest"})
public final class PostconditionTaglet extends BlockListTaglet {
/**
Modified: libs/taglets/trunk/src/prj/net/sf/japi/taglets/PreconditionTaglet.java
===================================================================
--- libs/taglets/trunk/src/prj/net/sf/japi/taglets/PreconditionTaglet.java 2009-07-25 12:36:49 UTC (rev 1356)
+++ libs/taglets/trunk/src/prj/net/sf/japi/taglets/PreconditionTaglet.java 2009-07-25 12:38:13 UTC (rev 1357)
@@ -28,6 +28,7 @@
* @see PostconditionTaglet
* @see InvariantTaglet
*/
+@SuppressWarnings({"RefusedBequest"})
public final class PreconditionTaglet extends BlockListTaglet {
/**
Modified: libs/taglets/trunk/src/prj/net/sf/japi/taglets/ReturnValueTaglet.java
===================================================================
--- libs/taglets/trunk/src/prj/net/sf/japi/taglets/ReturnValueTaglet.java 2009-07-25 12:36:49 UTC (rev 1356)
+++ libs/taglets/trunk/src/prj/net/sf/japi/taglets/ReturnValueTaglet.java 2009-07-25 12:38:13 UTC (rev 1357)
@@ -26,6 +26,7 @@
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
* @since 0.1
*/
+@SuppressWarnings({"RefusedBequest"})
public final class ReturnValueTaglet extends BlockListTaglet {
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-07-25 12:36:58
|
Revision: 1356
http://japi.svn.sourceforge.net/japi/?rev=1356&view=rev
Author: christianhujer
Date: 2009-07-25 12:36:49 +0000 (Sat, 25 Jul 2009)
Log Message:
-----------
Add TODO file.
Added Paths:
-----------
libs/taglets/trunk/TODO
Added: libs/taglets/trunk/TODO
===================================================================
--- libs/taglets/trunk/TODO (rev 0)
+++ libs/taglets/trunk/TODO 2009-07-25 12:36:49 UTC (rev 1356)
@@ -0,0 +1,2 @@
+* java2html should be auto-downloaded.
+* tools.jar should be auto-referenced for javadoc.
Property changes on: libs/taglets/trunk/TODO
___________________________________________________________________
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-06-21 09:53:56
|
Revision: 1355
http://japi.svn.sourceforge.net/japi/?rev=1355&view=rev
Author: christianhujer
Date: 2009-06-21 09:53:05 +0000 (Sun, 21 Jun 2009)
Log Message:
-----------
Add facility to monitor all midi devices.
Add optional to filter time events.
Modified Paths:
--------------
tools/midiMonitor/trunk/src/prj/net/sf/japi/tools/midiMonitor/MidiMonitor.java
Added Paths:
-----------
tools/midiMonitor/trunk/src/prj/net/sf/japi/tools/midiMonitor/MidiMonitor.properties
Modified: tools/midiMonitor/trunk/src/prj/net/sf/japi/tools/midiMonitor/MidiMonitor.java
===================================================================
--- tools/midiMonitor/trunk/src/prj/net/sf/japi/tools/midiMonitor/MidiMonitor.java 2009-06-14 09:32:23 UTC (rev 1354)
+++ tools/midiMonitor/trunk/src/prj/net/sf/japi/tools/midiMonitor/MidiMonitor.java 2009-06-21 09:53:05 UTC (rev 1355)
@@ -17,17 +17,22 @@
package net.sf.japi.tools.midiMonitor;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import javax.sound.midi.MidiDevice;
+import javax.sound.midi.MidiMessage;
import javax.sound.midi.MidiSystem;
import javax.sound.midi.MidiUnavailableException;
+import javax.sound.midi.Receiver;
import javax.sound.midi.Transmitter;
import net.sf.japi.io.args.ArgParser;
import net.sf.japi.io.args.CommandWithHelp;
import net.sf.japi.io.args.Option;
import net.sf.japi.io.args.OptionType;
+import net.sf.japi.io.args.RequiredOptionsMissingException;
import net.sf.japi.midi.MonitorReceiver;
import org.jetbrains.annotations.NotNull;
@@ -38,8 +43,13 @@
public class MidiMonitor extends CommandWithHelp {
/** The transmitters that shall be monitored. */
- private final Map<String, Transmitter> transmitters = new HashMap<String, Transmitter>();
+ private final Map<String, List<Transmitter>> transmitters = new HashMap<String, List<Transmitter>>();
+ /** Whether or not to print time events (0xF8).
+ * @see #setNoTime()
+ */
+ private boolean time = true;
+
/** Main program.
* @param args Command line arguments (try --help).
*/
@@ -47,30 +57,72 @@
ArgParser.simpleParseAndRun(new MidiMonitor(), args);
}
+ /** Sets that time events (0xF8) shall be filtered. */
+ @Option("notime")
+ public void setNoTime() {
+ time = false;
+ }
+
+ /** Adds all available transmitters to the list of transmitters to monitor.
+ * @throws MidiUnavailableException if MIDI is unavaialble.
+ */
+ @Option({"a", "all"})
+ public void addAllTransmitters() throws MidiUnavailableException {
+ for (final MidiDevice.Info deviceInfo : MidiSystem.getMidiDeviceInfo()) {
+ addTransmitter(deviceInfo);
+ }
+ }
+
/** Adds a transmitter to the list of transmitters to monitor.
+ * If multiple devices have the same name, the transmitter is added for the first device of that name.
* @param transmitterName Name of the transmitterName to add.
* @throws MidiUnavailableException If MIDI is unavailable.
*/
- @Option(type = OptionType.REQUIRED, value = {"t", "transmitter"})
+ @Option({"t", "transmitter"})
public void addTransmitter(@NotNull final String transmitterName) throws MidiUnavailableException {
for (final MidiDevice.Info deviceInfo : MidiSystem.getMidiDeviceInfo()) {
if (transmitterName.equals(deviceInfo.getName())) {
- final MidiDevice device = MidiSystem.getMidiDevice(deviceInfo);
- if (device.getMaxTransmitters() != 0) {
- device.open();
- transmitters.put(transmitterName, device.getTransmitter());
- return;
- }
+ addTransmitter(deviceInfo);
+ return;
}
}
}
+ /** Adds a transmitter.
+ * @param deviceInfo DeviceInfo for the transmitter to add.
+ * @return <code>true</code> if a transmitter for the specified device was added, otherwise <code>false</code>.
+ * @throws MidiUnavailableException If MIDI is unavailable.
+ */
+ private boolean addTransmitter(@NotNull final MidiDevice.Info deviceInfo) throws MidiUnavailableException {
+ final MidiDevice device = MidiSystem.getMidiDevice(deviceInfo);
+ if (device.getMaxTransmitters() != 0) {
+ device.open();
+ final String deviceName = deviceInfo.getName();
+ if (transmitters.get(deviceName) == null) {
+ transmitters.put(deviceName, new ArrayList<Transmitter>());
+ }
+ transmitters.get(deviceName).add(device.getTransmitter());
+ return true;
+ }
+ return false;
+ }
+
/** {@inheritDoc} */
@SuppressWarnings({"InstanceMethodNamingConvention"})
public int run(@NotNull final List<String> args) throws Exception {
- for (final Map.Entry<String, Transmitter> entry : transmitters.entrySet()) {
- entry.getValue().setReceiver(new MonitorReceiver(entry.getKey()));
+ final Set<Map.Entry<String, List<Transmitter>>> entries = transmitters.entrySet();
+ if (entries.size() == 0) {
+ throw new RequiredOptionsMissingException("-a or at least once -t");
}
+ for (final Map.Entry<String, List<Transmitter>> entry : entries) {
+ for (final Transmitter transmitter : entry.getValue()) {
+ if (time) {
+ transmitter.setReceiver(new MonitorReceiver(entry.getKey()));
+ } else {
+ transmitter.setReceiver(new TimeFilter(new MonitorReceiver(entry.getKey())));
+ }
+ }
+ }
try {
synchronized (this) {
wait();
@@ -81,3 +133,38 @@
return 0;
}
}
+
+/** Filter that filters away MIDI time events.
+ * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
+ * @since 0.2
+ */
+class TimeFilter implements Receiver {
+
+ /** Whether this TimeFilter is open. */
+ private boolean open = true;
+
+ /** The Receiver to which the message shall be forwarded. */
+ private Receiver receiver;
+
+ /** Creates a TimeFilter.
+ * @param receiver Receiver to which messages shall be forwarded.
+ */
+ TimeFilter(@NotNull final Receiver receiver) {
+ this.receiver = receiver;
+ }
+
+ /** {@inheritDoc} */
+ public void close() {
+ open = false;
+ }
+
+ /** {@inheritDoc} */
+ public void send(final MidiMessage message, final long timeStamp) throws IllegalStateException {
+ if (!open) {
+ throw new IllegalStateException("Receiver closed.");
+ }
+ if (message.getStatus() != 0xF8) {
+ receiver.send(message, timeStamp);
+ }
+ }
+}
Added: tools/midiMonitor/trunk/src/prj/net/sf/japi/tools/midiMonitor/MidiMonitor.properties
===================================================================
--- tools/midiMonitor/trunk/src/prj/net/sf/japi/tools/midiMonitor/MidiMonitor.properties (rev 0)
+++ tools/midiMonitor/trunk/src/prj/net/sf/japi/tools/midiMonitor/MidiMonitor.properties 2009-06-21 09:53:05 UTC (rev 1355)
@@ -0,0 +1,3 @@
+setNoTime=Do not monitor time events (0xF8).
+addAllTransmitters=Monitor all available transmitters.
+addTransmitter=Monitor the transmitter with the specified name.
Property changes on: tools/midiMonitor/trunk/src/prj/net/sf/japi/tools/midiMonitor/MidiMonitor.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-06-14 09:32:25
|
Revision: 1354
http://japi.svn.sourceforge.net/japi/?rev=1354&view=rev
Author: christianhujer
Date: 2009-06-14 09:32:23 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
Add missing jars to getlibs.
Modified Paths:
--------------
progs/textedit/trunk/build.xml
Modified: progs/textedit/trunk/build.xml
===================================================================
--- progs/textedit/trunk/build.xml 2009-06-14 09:32:01 UTC (rev 1353)
+++ progs/textedit/trunk/build.xml 2009-06-14 09:32:23 UTC (rev 1354)
@@ -24,8 +24,10 @@
<target name="getlibs">
<get src="http://downloads.sourceforge.net/japi/japi-lib-argparser-0.3.0.jar" dest="lib/japi-lib-argparser.jar" />
+ <get src="http://downloads.sourceforge.net/japi/japi-lib-swing-about-0.1.0.jar" dest="lib/japi-lib-swing-about.jar" />
<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-app-0.1.0.jar" dest="lib/japi-lib-swing-app.jar" />
+ <get src="http://downloads.sourceforge.net/japi/japi-lib-swing-extlib-0.1.0.jar" dest="lib/japi-lib-swing-extlib.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-06-14 09:32:02
|
Revision: 1353
http://japi.svn.sourceforge.net/japi/?rev=1353&view=rev
Author: christianhujer
Date: 2009-06-14 09:32:01 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
Improve exception handling.
Modified Paths:
--------------
progs/jtype/trunk/src/prj/net/sf/japi/jtype/Helper.java
Modified: progs/jtype/trunk/src/prj/net/sf/japi/jtype/Helper.java
===================================================================
--- progs/jtype/trunk/src/prj/net/sf/japi/jtype/Helper.java 2009-06-14 09:31:39 UTC (rev 1352)
+++ progs/jtype/trunk/src/prj/net/sf/japi/jtype/Helper.java 2009-06-14 09:32:01 UTC (rev 1353)
@@ -100,10 +100,14 @@
final List<String> lines = new ArrayList<String>();
@SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"})
final BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
- for (String line; (line = in.readLine()) != null;) {
- lines.add(line);
+ try {
+ for (String line; (line = in.readLine()) != null;) {
+ lines.add(line);
+ }
+ return lines;
+ } finally {
+ in.close();
}
- return lines;
} catch (final IOException e) {
e.printStackTrace();
return Collections.EMPTY_LIST;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-06-14 09:31:40
|
Revision: 1352
http://japi.svn.sourceforge.net/japi/?rev=1352&view=rev
Author: christianhujer
Date: 2009-06-14 09:31:39 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
Improve serialization.
Modified Paths:
--------------
progs/jtype/trunk/src/prj/net/sf/japi/jtype/ReflectionField.java
Modified: progs/jtype/trunk/src/prj/net/sf/japi/jtype/ReflectionField.java
===================================================================
--- progs/jtype/trunk/src/prj/net/sf/japi/jtype/ReflectionField.java 2009-06-14 09:31:05 UTC (rev 1351)
+++ progs/jtype/trunk/src/prj/net/sf/japi/jtype/ReflectionField.java 2009-06-14 09:31:39 UTC (rev 1352)
@@ -19,6 +19,8 @@
import javax.swing.JComponent;
import javax.swing.JLabel;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
import java.awt.GridBagLayout;
@@ -33,6 +35,9 @@
*/
public class ReflectionField extends JComponent {
+ /** Serial version. */
+ private static final long serialVersionUID = 1L;
+
/** The label to update.
* @serial include
*/
@@ -48,10 +53,13 @@
*/
private final Object target;
+ /** The name of the property field. */
+ private final String fieldName;
+
/** The method used to retrieve the value of the property.
* @serial include
*/
- private final Method getter;
+ private transient Method getter;
/** Creates a ReflactionField.
* @param label The label that shall be displayed.
@@ -66,10 +74,16 @@
add(this.label);
this.format = format;
this.target = target;
+ this.fieldName = fieldName;
getter = getGetterMethod(target.getClass(), fieldName);
}
+ /** {@inheritDoc} */
+ private void readObject(@NotNull final ObjectInputStream in) throws ClassNotFoundException, IOException {
+ getter = getGetterMethod(target.getClass(), fieldName);
+ }
+
/** Updates the display to reflect the latest property value. */
public void update() {
try {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-06-14 09:31:06
|
Revision: 1351
http://japi.svn.sourceforge.net/japi/?rev=1351&view=rev
Author: christianhujer
Date: 2009-06-14 09:31:05 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
Add missing jars to getlibs.
Modified Paths:
--------------
progs/jhexedit/trunk/build.xml
Modified: progs/jhexedit/trunk/build.xml
===================================================================
--- progs/jhexedit/trunk/build.xml 2009-06-14 09:30:56 UTC (rev 1350)
+++ progs/jhexedit/trunk/build.xml 2009-06-14 09:31:05 UTC (rev 1351)
@@ -24,7 +24,10 @@
<target name="getlibs">
<get src="http://downloads.sourceforge.net/japi/japi-lib-argparser-0.3.0.jar" dest="lib/japi-lib-argparser.jar" />
+ <get src="http://downloads.sourceforge.net/japi/japi-lib-swing-about-0.1.0.jar" dest="lib/japi-lib-swing-about.jar" />
+ <get src="http://downloads.sourceforge.net/japi/japi-lib-swing-action-0.3.0.jar" dest="lib/japi-lib-swing-action.jar" />
<get src="http://downloads.sourceforge.net/japi/japi-lib-swing-app-0.1.0.jar" dest="lib/japi-lib-swing-app.jar" />
+ <get src="http://downloads.sourceforge.net/japi/japi-lib-swing-extlib-0.1.0.jar" dest="lib/japi-lib-swing-extlib.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-06-14 09:30:57
|
Revision: 1350
http://japi.svn.sourceforge.net/japi/?rev=1350&view=rev
Author: christianhujer
Date: 2009-06-14 09:30:56 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
Add missing jars to getlibs.
Modified Paths:
--------------
progs/jhexview/trunk/build.xml
Modified: progs/jhexview/trunk/build.xml
===================================================================
--- progs/jhexview/trunk/build.xml 2009-06-14 09:30:23 UTC (rev 1349)
+++ progs/jhexview/trunk/build.xml 2009-06-14 09:30:56 UTC (rev 1350)
@@ -24,7 +24,10 @@
<target name="getlibs">
<get src="http://downloads.sourceforge.net/japi/japi-lib-argparser-0.3.0.jar" dest="lib/japi-lib-argparser.jar" />
+ <get src="http://downloads.sourceforge.net/japi/japi-lib-swing-about-0.1.0.jar" dest="lib/japi-lib-swing-about.jar" />
+ <get src="http://downloads.sourceforge.net/japi/japi-lib-swing-action-0.3.0.jar" dest="lib/japi-lib-swing-action.jar" />
<get src="http://downloads.sourceforge.net/japi/japi-lib-swing-app-0.1.0.jar" dest="lib/japi-lib-swing-app.jar" />
+ <get src="http://downloads.sourceforge.net/japi/japi-lib-swing-extlib-0.1.0.jar" dest="lib/japi-lib-swing-extlib.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-06-14 09:30:24
|
Revision: 1349
http://japi.svn.sourceforge.net/japi/?rev=1349&view=rev
Author: christianhujer
Date: 2009-06-14 09:30:23 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
Improve deserialization.
Modified Paths:
--------------
libs/util/trunk/src/prj/net/sf/japi/util/LocaleComparator.java
Modified: libs/util/trunk/src/prj/net/sf/japi/util/LocaleComparator.java
===================================================================
--- libs/util/trunk/src/prj/net/sf/japi/util/LocaleComparator.java 2009-06-14 09:29:54 UTC (rev 1348)
+++ libs/util/trunk/src/prj/net/sf/japi/util/LocaleComparator.java 2009-06-14 09:30:23 UTC (rev 1349)
@@ -18,6 +18,8 @@
package net.sf.japi.util;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import java.io.Serializable;
import java.text.Collator;
import java.util.Comparator;
@@ -36,15 +38,21 @@
private static final long serialVersionUID = 1L;
/** Collator for comparing the names.
- * @serial include
+ * @serial exclude
*/
- @NotNull private final Collator collator = Collator.getInstance();
+ @NotNull private transient Collator collator = Collator.getInstance();
/** Create a LocaleComparator. */
public LocaleComparator() {
}
/** {@inheritDoc} */
+ private void readObject(@NotNull final ObjectInputStream in) throws ClassNotFoundException, IOException {
+ in.defaultReadObject();
+ collator = Collator.getInstance();
+ }
+
+ /** {@inheritDoc} */
public int compare(@Nullable final Locale o1, @Nullable final Locale o2) {
if (o1 == null && o2 == null) {
return 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-06-14 09:30:00
|
Revision: 1348
http://japi.svn.sourceforge.net/japi/?rev=1348&view=rev
Author: christianhujer
Date: 2009-06-14 09:29:54 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
Make passing of null explicit.
Modified Paths:
--------------
libs/util/trunk/src/prj/net/sf/japi/util/Arrays2.java
Modified: libs/util/trunk/src/prj/net/sf/japi/util/Arrays2.java
===================================================================
--- libs/util/trunk/src/prj/net/sf/japi/util/Arrays2.java 2009-06-14 09:29:08 UTC (rev 1347)
+++ libs/util/trunk/src/prj/net/sf/japi/util/Arrays2.java 2009-06-14 09:29:54 UTC (rev 1348)
@@ -1208,7 +1208,7 @@
*/
public static int freqEquals(@NotNull final Object[] array, final int fromIndex, final int toIndex, @Nullable final Object val) {
if (val == null) {
- return freqIdentity(array, fromIndex, toIndex, val);
+ return freqIdentity(array, fromIndex, toIndex, null);
}
int count = 0;
for (int i = fromIndex; i < toIndex; i++) {
@@ -1237,7 +1237,7 @@
*/
public static <T extends Comparable<T>> int freqComparable(@NotNull final T[] array, final int fromIndex, final int toIndex, @Nullable final T val) {
if (val == null) {
- return freqIdentity(array, fromIndex, toIndex, val);
+ return freqIdentity(array, fromIndex, toIndex, null);
}
int count = 0;
for (int i = fromIndex; i < toIndex; i++) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-06-14 09:29:09
|
Revision: 1347
http://japi.svn.sourceforge.net/japi/?rev=1347&view=rev
Author: christianhujer
Date: 2009-06-14 09:29:08 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
Add missing jar to getlibs.
Modified Paths:
--------------
libs/swing-proxyprefs/trunk/build.xml
Modified: libs/swing-proxyprefs/trunk/build.xml
===================================================================
--- libs/swing-proxyprefs/trunk/build.xml 2009-06-14 09:28:41 UTC (rev 1346)
+++ libs/swing-proxyprefs/trunk/build.xml 2009-06-14 09:29:08 UTC (rev 1347)
@@ -24,6 +24,7 @@
&commonBuild;
<target name="getlibs">
+ <get src="http://downloads.sourceforge.net/japi/japi-lib-swing-extlib-0.1.0.jar" dest="lib/japi-lib-swing-extlib.jar" />
<get src="http://downloads.sourceforge.net/japi/japi-lib-swing-prefs-0.1.0.jar" dest="lib/japi-lib-swing-prefs.jar" />
</target>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-06-14 09:28:42
|
Revision: 1346
http://japi.svn.sourceforge.net/japi/?rev=1346&view=rev
Author: christianhujer
Date: 2009-06-14 09:28:41 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
Add missing jar to getlibs.
Modified Paths:
--------------
libs/swing-keyprefs/trunk/build.xml
Modified: libs/swing-keyprefs/trunk/build.xml
===================================================================
--- libs/swing-keyprefs/trunk/build.xml 2009-06-14 09:28:05 UTC (rev 1345)
+++ libs/swing-keyprefs/trunk/build.xml 2009-06-14 09:28:41 UTC (rev 1346)
@@ -25,6 +25,7 @@
<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-extlib-0.1.0.jar" dest="lib/japi-lib-swing-extlib.jar" />
<get src="http://downloads.sourceforge.net/japi/japi-lib-swing-prefs-0.1.0.jar" dest="lib/japi-lib-swing-prefs.jar" />
<get src="http://downloads.sourceforge.net/japi/japi-lib-swing-treetable-0.1.0.jar" dest="lib/japi-lib-swing-treetable.jar" />
</target>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-06-14 09:28:06
|
Revision: 1345
http://japi.svn.sourceforge.net/japi/?rev=1345&view=rev
Author: christianhujer
Date: 2009-06-14 09:28:05 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
getTitle() must be synchronized.
Modified Paths:
--------------
libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/Document.java
Modified: libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/Document.java
===================================================================
--- libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/Document.java 2009-06-14 09:27:41 UTC (rev 1344)
+++ libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/Document.java 2009-06-14 09:28:05 UTC (rev 1345)
@@ -240,7 +240,7 @@
/** Returns the title of this document.
* @return The title of this document.
*/
- @Nullable public final String getTitle() {
+ @Nullable public final synchronized String getTitle() {
return title;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-06-14 09:27:43
|
Revision: 1344
http://japi.svn.sourceforge.net/japi/?rev=1344&view=rev
Author: christianhujer
Date: 2009-06-14 09:27:41 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
Improve nullable / notnull states.
Modified Paths:
--------------
libs/sql/trunk/src/prj/net/sf/japi/sql/CachedResultSetTableModel.java
libs/sql/trunk/src/prj/net/sf/japi/sql/SQLHelper.java
Modified: libs/sql/trunk/src/prj/net/sf/japi/sql/CachedResultSetTableModel.java
===================================================================
--- libs/sql/trunk/src/prj/net/sf/japi/sql/CachedResultSetTableModel.java 2009-06-14 09:27:05 UTC (rev 1343)
+++ libs/sql/trunk/src/prj/net/sf/japi/sql/CachedResultSetTableModel.java 2009-06-14 09:27:41 UTC (rev 1344)
@@ -103,7 +103,7 @@
} else {
try {
columnTitles = SQLHelper.getColumnLabels(resultSet);
- columnCount = columnTitles != null ? columnTitles.length : 0;
+ columnCount = columnTitles.length;
rowCount = SQLHelper.getRowCount(resultSet);
data = SQLHelper.getData(resultSet);
this.resultSet = resultSet;
Modified: libs/sql/trunk/src/prj/net/sf/japi/sql/SQLHelper.java
===================================================================
--- libs/sql/trunk/src/prj/net/sf/japi/sql/SQLHelper.java 2009-06-14 09:27:05 UTC (rev 1343)
+++ libs/sql/trunk/src/prj/net/sf/japi/sql/SQLHelper.java 2009-06-14 09:27:41 UTC (rev 1344)
@@ -25,6 +25,7 @@
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
+import org.jetbrains.annotations.NotNull;
/** A Helper Class to make work with JDBC less painful in some situations.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
@@ -62,6 +63,7 @@
* @return column labels
* @throws SQLException on SQL problems
*/
+ @NotNull
public static String[] getColumnLabels(final ResultSet rs) throws SQLException {
final ResultSetMetaData md = rs.getMetaData();
final int columnCount = md.getColumnCount();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-06-14 09:27:07
|
Revision: 1343
http://japi.svn.sourceforge.net/japi/?rev=1343&view=rev
Author: christianhujer
Date: 2009-06-14 09:27:05 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
Improve exception handling.
Modified Paths:
--------------
libs/net/trunk/src/prj/net/sf/japi/net/Forwarder.java
Modified: libs/net/trunk/src/prj/net/sf/japi/net/Forwarder.java
===================================================================
--- libs/net/trunk/src/prj/net/sf/japi/net/Forwarder.java 2009-06-14 09:26:56 UTC (rev 1342)
+++ libs/net/trunk/src/prj/net/sf/japi/net/Forwarder.java 2009-06-14 09:27:05 UTC (rev 1343)
@@ -76,17 +76,22 @@
/** {@inheritDoc} */
public void run() {
try {
- final Thread c1 = new Copier(s1.getInputStream(), s2.getOutputStream()).start();
- final Thread c2 = new Copier(s2.getInputStream(), s1.getOutputStream()).start();
- c1.join();
- c2.join();
+ try {
+ try {
+ final Thread c1 = new Copier(s1.getInputStream(), s2.getOutputStream()).start();
+ final Thread c2 = new Copier(s2.getInputStream(), s1.getOutputStream()).start();
+ c1.join();
+ c2.join();
+ } finally {
+ s1.close();
+ }
+ } finally {
+ s2.close();
+ }
} catch (final InterruptedException ignore) {
/* ignore */
} catch (final IOException e) {
e.printStackTrace(); // TODO:2009-02-23:christianhujer:Better handling of the exception.
- } finally {
- try { s1.close(); } catch (final IOException ignore) { /* ignore */ }
- try { s2.close(); } catch (final IOException ignore) { /* ignore */ }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-06-14 09:26:57
|
Revision: 1342
http://japi.svn.sourceforge.net/japi/?rev=1342&view=rev
Author: christianhujer
Date: 2009-06-14 09:26:56 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
Add a MidiDeviceListModel.
Added Paths:
-----------
libs/midi/trunk/src/prj/net/sf/japi/midi/gui/MidiDeviceListModel.java
libs/midi/trunk/src/tst/test/
libs/midi/trunk/src/tst/test/net/
libs/midi/trunk/src/tst/test/net/sf/
libs/midi/trunk/src/tst/test/net/sf/japi/
libs/midi/trunk/src/tst/test/net/sf/japi/midi/
libs/midi/trunk/src/tst/test/net/sf/japi/midi/gui/
libs/midi/trunk/src/tst/test/net/sf/japi/midi/gui/MidiDeviceListModelTry.java
Added: libs/midi/trunk/src/prj/net/sf/japi/midi/gui/MidiDeviceListModel.java
===================================================================
--- libs/midi/trunk/src/prj/net/sf/japi/midi/gui/MidiDeviceListModel.java (rev 0)
+++ libs/midi/trunk/src/prj/net/sf/japi/midi/gui/MidiDeviceListModel.java 2009-06-14 09:26:56 UTC (rev 1342)
@@ -0,0 +1,71 @@
+/*
+ * 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
+ */
+
+package net.sf.japi.midi.gui;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.util.Arrays;
+import java.util.List;
+import javax.sound.midi.MidiDevice;
+import javax.sound.midi.MidiSystem;
+import javax.swing.AbstractListModel;
+
+/** ListModel which shows midi devices.
+ * TODO:2009-06-11:christianhujer:Documentation.
+ * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
+ * @since 0.2
+ */
+public class MidiDeviceListModel extends AbstractListModel {
+
+ /** Serial Version. */
+ private static final long serialVersionUID = 1L;
+
+ /** The List with the data. */
+ // IntelliJ IDEA does not detect that the invocation of update() sets deviceInfos.
+ @SuppressWarnings({"InstanceVariableMayNotBeInitializedByReadObject", "InstanceVariableMayNotBeInitialized"})
+ private transient List<MidiDevice.Info> deviceInfos;
+
+ /** Creates a MidiDeviceListModel. */
+ public MidiDeviceListModel() {
+ update();
+ }
+
+ @SuppressWarnings({"JavaDoc"})
+ private void readObject(final ObjectInputStream in) throws ClassNotFoundException, IOException {
+ in.defaultReadObject();
+ update();
+ }
+
+ /** {@inheritDoc} */
+ public int getSize() {
+ return deviceInfos.size();
+ }
+
+ /** {@inheritDoc} */
+ public MidiDevice.Info getElementAt(final int index) {
+ return deviceInfos.get(index);
+ }
+
+ /** Updates the listmodel.
+ * This rescans the MidiSystem for devices.
+ */
+ public void update() {
+ deviceInfos = Arrays.asList(MidiSystem.getMidiDeviceInfo());
+ }
+}
Property changes on: libs/midi/trunk/src/prj/net/sf/japi/midi/gui/MidiDeviceListModel.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ LF
Added: libs/midi/trunk/src/tst/test/net/sf/japi/midi/gui/MidiDeviceListModelTry.java
===================================================================
--- libs/midi/trunk/src/tst/test/net/sf/japi/midi/gui/MidiDeviceListModelTry.java (rev 0)
+++ libs/midi/trunk/src/tst/test/net/sf/japi/midi/gui/MidiDeviceListModelTry.java 2009-06-14 09:26:56 UTC (rev 1342)
@@ -0,0 +1,43 @@
+/*
+ * 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
+ */
+
+package test.net.sf.japi.midi.gui;
+
+import javax.swing.JFrame;
+import javax.swing.JList;
+import javax.swing.JScrollPane;
+import net.sf.japi.midi.gui.MidiDeviceListModel;
+
+/**
+ * TODO:2009-06-11:christianhujer:Documentation.
+ * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
+ * @since 0.2
+ */
+public class MidiDeviceListModelTry {
+
+ /** Tries the MidiDeviceListModel.
+ * @param args Command line arguments (ignored).
+ */
+ public static void main(final String... args) {
+ final JFrame f = new JFrame("foo");
+ final JList list = new JList(new MidiDeviceListModel());
+ f.add(new JScrollPane(list));
+ f.pack();
+ f.setVisible(true);
+ }
+}
Property changes on: libs/midi/trunk/src/tst/test/net/sf/japi/midi/gui/MidiDeviceListModelTry.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-06-14 09:26:26
|
Revision: 1341
http://japi.svn.sourceforge.net/japi/?rev=1341&view=rev
Author: christianhujer
Date: 2009-06-14 09:26:25 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
Extend renderer to work for MidiDevice.Info as well.
Modified Paths:
--------------
libs/midi/trunk/src/prj/net/sf/japi/midi/gui/MidiDeviceListCellRenderer.java
Modified: libs/midi/trunk/src/prj/net/sf/japi/midi/gui/MidiDeviceListCellRenderer.java
===================================================================
--- libs/midi/trunk/src/prj/net/sf/japi/midi/gui/MidiDeviceListCellRenderer.java 2009-06-14 09:25:53 UTC (rev 1340)
+++ libs/midi/trunk/src/prj/net/sf/japi/midi/gui/MidiDeviceListCellRenderer.java 2009-06-14 09:26:25 UTC (rev 1341)
@@ -35,6 +35,8 @@
final Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof MidiDevice) {
setText(((MidiDevice) value).getDeviceInfo().getName());
+ } else if (value instanceof MidiDevice.Info) {
+ setText(((MidiDevice.Info) value).getName());
}
return c;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-06-14 09:26:05
|
Revision: 1340
http://japi.svn.sourceforge.net/japi/?rev=1340&view=rev
Author: christianhujer
Date: 2009-06-14 09:25:53 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
Remove incorrect annotations about null state of variables.
Modified Paths:
--------------
libs/logging/trunk/src/prj/net/sf/japi/log/LoggerFactory.java
Modified: libs/logging/trunk/src/prj/net/sf/japi/log/LoggerFactory.java
===================================================================
--- libs/logging/trunk/src/prj/net/sf/japi/log/LoggerFactory.java 2009-06-14 09:25:09 UTC (rev 1339)
+++ libs/logging/trunk/src/prj/net/sf/japi/log/LoggerFactory.java 2009-06-14 09:25:53 UTC (rev 1340)
@@ -57,7 +57,7 @@
* @throws LogConfigurationError in case the logger couldn't be created
*/
@NotNull public Logger getLogger(final String name) throws LogConfigurationError {
- @Nullable Logger logger = loggers.get(name);
+ Logger logger = loggers.get(name);
if (logger == null) {
logger = createLogger(name);
loggers.put(name, logger);
@@ -87,7 +87,7 @@
// 1a Find explicit configuration for name
// 1b Use default configuration for name
// 2 Use configuration to instanciate Logger
- @NotNull final String loggerClassName = getLoggerClassName(name);
+ final String loggerClassName = getLoggerClassName(name);
try {
//noinspection unchecked
final Class<? extends Logger> loggerClass = (Class<? extends Logger>) forName(loggerClassName);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-06-14 09:25:11
|
Revision: 1339
http://japi.svn.sourceforge.net/japi/?rev=1339&view=rev
Author: christianhujer
Date: 2009-06-14 09:25:09 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
Handle serialization of the getter method.
Modified Paths:
--------------
libs/lang/trunk/src/prj/net/sf/japi/lang/PropertyComparator.java
Modified: libs/lang/trunk/src/prj/net/sf/japi/lang/PropertyComparator.java
===================================================================
--- libs/lang/trunk/src/prj/net/sf/japi/lang/PropertyComparator.java 2009-06-14 09:20:46 UTC (rev 1338)
+++ libs/lang/trunk/src/prj/net/sf/japi/lang/PropertyComparator.java 2009-06-14 09:25:09 UTC (rev 1339)
@@ -18,6 +18,8 @@
package net.sf.japi.lang;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -60,7 +62,7 @@
/** The getter to read the property.
* @serial include
*/
- @Nullable private final Method getter; // TODO:2009-02-16:christianhujer:Handle this field.
+ @Nullable private transient Method getter;
/** Create a PropertyComparator.
* @param targetClass The target class of which properties should be compared, maybe <code>null</code> in which case the target class will be evaluated dynamically.
@@ -75,6 +77,12 @@
}
/** {@inheritDoc} */
+ private void readObject(@NotNull final ObjectInputStream in) throws ClassNotFoundException, IOException {
+ in.defaultReadObject();
+ getter = targetClass == null ? null : getPropertyGetter(targetClass, propertyName);
+ }
+
+ /** {@inheritDoc} */
public int compare(final C o1, final C o2) {
try {
final Method o1Getter = getter != null ? getter : getPropertyGetter(o1.getClass(), propertyName);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-06-14 09:20:49
|
Revision: 1338
http://japi.svn.sourceforge.net/japi/?rev=1338&view=rev
Author: christianhujer
Date: 2009-06-14 09:20:46 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
Add documentation and improve exception handling within the copy routine.
Modified Paths:
--------------
libs/io/trunk/src/prj/net/sf/japi/io/Copier.java
Modified: libs/io/trunk/src/prj/net/sf/japi/io/Copier.java
===================================================================
--- libs/io/trunk/src/prj/net/sf/japi/io/Copier.java 2009-06-14 09:12:43 UTC (rev 1337)
+++ libs/io/trunk/src/prj/net/sf/japi/io/Copier.java 2009-06-14 09:20:46 UTC (rev 1338)
@@ -24,9 +24,23 @@
import org.jetbrains.annotations.NotNull;
/** A Runnable that copies from an InputStream to an OutputStream.
+ *
+ * <h4>Usage example</h4>
+ * <pre>
+ * // Copies data from System.in to System.out.
+ * new Copier(System.in, System.out).start();
+ *
+ * // Copies data from one file to another.
+ * new Copier(new FileInputStream(inputFilename), new FileOutputStream(outputFilename)).start();
+ * </pre>
+ *
+ * @note Copying is done in a separate thread.
+ * The starting thread is not notified of any exceptions that occur.
+ *
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
* @since 0.1
*/
+// TODO:2009-06-14:christianhujer:Implement reasonable exception handling.
public class Copier implements Runnable {
/** Default buffer size when copying. */
@@ -98,20 +112,24 @@
public void run() {
final byte[] buf = new byte[bufSize];
try {
- for (int bytesRead; (bytesRead = in.read(buf)) != -1;) {
- out.write(buf, 0, bytesRead);
+ try {
+ for (int bytesRead; (bytesRead = in.read(buf)) != -1;) {
+ out.write(buf, 0, bytesRead);
+ if (autoFlush) {
+ out.flush();
+ }
+ }
+ } finally {
if (autoFlush) {
out.flush();
}
+ if (autoClose) {
+ out.close();
+ in.close();
+ }
}
} catch (final IOException e) {
System.err.println(e);
- } finally {
- try { out.flush(); } catch (final IOException ignore) { /* ignore */ }
- if (autoClose) {
- try { out.close(); } catch (final IOException ignore) { /* ignore */ }
- try { in.close(); } catch (final IOException ignore) { /* ignore */ }
- }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-06-14 09:12:45
|
Revision: 1337
http://japi.svn.sourceforge.net/japi/?rev=1337&view=rev
Author: christianhujer
Date: 2009-06-14 09:12:43 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
Fixed bug in output: Vendor and Version were mixed up.
Modified Paths:
--------------
tools/midiDeviceLister/trunk/src/prj/net/sf/japi/tools/midiDeviceLister/MidiDeviceLister.java
Modified: tools/midiDeviceLister/trunk/src/prj/net/sf/japi/tools/midiDeviceLister/MidiDeviceLister.java
===================================================================
--- tools/midiDeviceLister/trunk/src/prj/net/sf/japi/tools/midiDeviceLister/MidiDeviceLister.java 2009-06-11 18:51:10 UTC (rev 1336)
+++ tools/midiDeviceLister/trunk/src/prj/net/sf/japi/tools/midiDeviceLister/MidiDeviceLister.java 2009-06-14 09:12:43 UTC (rev 1337)
@@ -44,8 +44,8 @@
public int run(@NotNull final List<String> args) throws Exception {
for (final MidiDevice.Info deviceInfo : MidiSystem.getMidiDeviceInfo()) {
System.out.println("Name: " + deviceInfo.getName());
- System.out.println("Version: " + deviceInfo.getVendor());
- System.out.println("Vendor: " + deviceInfo.getVersion());
+ System.out.println("Version: " + deviceInfo.getVersion());
+ System.out.println("Vendor: " + deviceInfo.getVendor());
System.out.println("Description: " + deviceInfo.getDescription());
final MidiDevice device = MidiSystem.getMidiDevice(deviceInfo);
System.out.println("Maximum transmitters: " + getMaxInfo(device.getMaxTransmitters()));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-06-11 18:51:22
|
Revision: 1336
http://japi.svn.sourceforge.net/japi/?rev=1336&view=rev
Author: christianhujer
Date: 2009-06-11 18:51:10 +0000 (Thu, 11 Jun 2009)
Log Message:
-----------
Rename SpinnerChannelModel to ChannelSpinnerModel.
Modified Paths:
--------------
libs/midi/trunk/src/prj/net/sf/japi/midi/gui/OutputConfigurator.java
Added Paths:
-----------
libs/midi/trunk/src/prj/net/sf/japi/midi/gui/ChannelSpinnerModel.java
Removed Paths:
-------------
libs/midi/trunk/src/prj/net/sf/japi/midi/gui/SpinnerChannelModel.java
Copied: libs/midi/trunk/src/prj/net/sf/japi/midi/gui/ChannelSpinnerModel.java (from rev 1330, libs/midi/trunk/src/prj/net/sf/japi/midi/gui/SpinnerChannelModel.java)
===================================================================
--- libs/midi/trunk/src/prj/net/sf/japi/midi/gui/ChannelSpinnerModel.java (rev 0)
+++ libs/midi/trunk/src/prj/net/sf/japi/midi/gui/ChannelSpinnerModel.java 2009-06-11 18:51:10 UTC (rev 1336)
@@ -0,0 +1,62 @@
+/*
+ * 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
+ */
+
+package net.sf.japi.midi.gui;
+
+import javax.swing.AbstractSpinnerModel;
+import org.jetbrains.annotations.Nullable;
+
+/** A SpinnerModel for MIDI Channels.
+ * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
+ * @since 0.1
+ */
+public class ChannelSpinnerModel extends AbstractSpinnerModel {
+
+ /** The current channel. */
+ private int value;
+
+ /** Creates a SpinnerChannelModel which initially selects channel 0. */
+ public ChannelSpinnerModel() {
+ value = 0;
+ }
+
+ /** {@inheritDoc} */
+ public Object getValue() {
+ return value;
+ }
+
+ /** {@inheritDoc} */
+ public void setValue(final Object value) {
+ final int newValue = (Integer) value;
+ if (newValue < 0x0 || newValue > 0xF) {
+ throw new IllegalArgumentException("Not a valid MIDI channel.");
+ }
+ this.value = newValue;
+ fireStateChanged();
+ }
+
+ /** {@inheritDoc} */
+ @Nullable public Object getNextValue() {
+ return value < 0xF ? value + 1 : null;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable public Object getPreviousValue() {
+ return value > 0x0 ? value - 1 : null;
+ }
+}
Property changes on: libs/midi/trunk/src/prj/net/sf/japi/midi/gui/ChannelSpinnerModel.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ LF
Modified: libs/midi/trunk/src/prj/net/sf/japi/midi/gui/OutputConfigurator.java
===================================================================
--- libs/midi/trunk/src/prj/net/sf/japi/midi/gui/OutputConfigurator.java 2009-06-06 14:23:50 UTC (rev 1335)
+++ libs/midi/trunk/src/prj/net/sf/japi/midi/gui/OutputConfigurator.java 2009-06-11 18:51:10 UTC (rev 1336)
@@ -68,7 +68,7 @@
deviceList.setCellRenderer(new MidiDeviceListCellRenderer());
deviceList.setSelectedIndex(0);
channelSpinner = new JSpinner(new SpinnerNumberModel(0, 0x0, 0xF, 1));
- //channelSpinner = new JSpinner(new SpinnerChannelModel());
+ //channelSpinner = new JSpinner(new ChannelSpinnerModel());
add(new JScrollPane(deviceList));
final Container spinnerPanel = new JPanel();
spinnerPanel.setLayout(new FlowLayout());
Deleted: libs/midi/trunk/src/prj/net/sf/japi/midi/gui/SpinnerChannelModel.java
===================================================================
--- libs/midi/trunk/src/prj/net/sf/japi/midi/gui/SpinnerChannelModel.java 2009-06-06 14:23:50 UTC (rev 1335)
+++ libs/midi/trunk/src/prj/net/sf/japi/midi/gui/SpinnerChannelModel.java 2009-06-11 18:51:10 UTC (rev 1336)
@@ -1,62 +0,0 @@
-/*
- * 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
- */
-
-package net.sf.japi.midi.gui;
-
-import javax.swing.AbstractSpinnerModel;
-import org.jetbrains.annotations.Nullable;
-
-/** A SpinnerModel for MIDI Channels.
- * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
- * @since 0.1
- */
-public class SpinnerChannelModel extends AbstractSpinnerModel {
-
- /** The current channel. */
- private int value;
-
- /** Creates a SpinnerChannelModel which initially selects channel 0. */
- public SpinnerChannelModel() {
- value = 0;
- }
-
- /** {@inheritDoc} */
- public Object getValue() {
- return value;
- }
-
- /** {@inheritDoc} */
- public void setValue(final Object value) {
- final int newValue = (Integer) value;
- if (newValue < 0x0 || newValue > 0xF) {
- throw new IllegalArgumentException("Not a valid MIDI channel.");
- }
- this.value = newValue;
- fireStateChanged();
- }
-
- /** {@inheritDoc} */
- @Nullable public Object getNextValue() {
- return value < 0xF ? value + 1 : null;
- }
-
- /** {@inheritDoc} */
- @Nullable public Object getPreviousValue() {
- return value > 0x0 ? value - 1 : null;
- }
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|