Thread: [Japi-cvs] SF.net SVN: japi: [304] tools/string2bytes/trunk/src/net/sf/japi/ string2bytes
Status: Beta
Brought to you by:
christianhujer
From: <chr...@us...> - 2007-01-16 18:39:29
|
Revision: 304 http://svn.sourceforge.net/japi/?rev=304&view=rev Author: christianhujer Date: 2007-01-16 10:39:27 -0800 (Tue, 16 Jan 2007) Log Message: ----------- Added copyright comments. Modified Paths: -------------- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/EntityCodec.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/IdentityCodec.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/JavaBytesCodec.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/String2Bytes.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/StringCodec.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/URLEncodeCodec.java Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/EntityCodec.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/EntityCodec.java 2007-01-16 18:38:50 UTC (rev 303) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/EntityCodec.java 2007-01-16 18:39:27 UTC (rev 304) @@ -1,3 +1,22 @@ +/* + * String2Bytes is a program for converting Strings into byte arrays. + * Copyright (C) 2007 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + package net.sf.japi.string2bytes; import java.io.UnsupportedEncodingException; Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/IdentityCodec.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/IdentityCodec.java 2007-01-16 18:38:50 UTC (rev 303) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/IdentityCodec.java 2007-01-16 18:39:27 UTC (rev 304) @@ -1,3 +1,22 @@ +/* + * String2Bytes is a program for converting Strings into byte arrays. + * Copyright (C) 2007 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + package net.sf.japi.string2bytes; import java.io.UnsupportedEncodingException; Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/JavaBytesCodec.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/JavaBytesCodec.java 2007-01-16 18:38:50 UTC (rev 303) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/JavaBytesCodec.java 2007-01-16 18:39:27 UTC (rev 304) @@ -1,3 +1,22 @@ +/* + * String2Bytes is a program for converting Strings into byte arrays. + * Copyright (C) 2007 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + package net.sf.japi.string2bytes; import java.io.UnsupportedEncodingException; Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/String2Bytes.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/String2Bytes.java 2007-01-16 18:38:50 UTC (rev 303) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/String2Bytes.java 2007-01-16 18:39:27 UTC (rev 304) @@ -16,6 +16,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + package net.sf.japi.string2bytes; import java.awt.Container; Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/StringCodec.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/StringCodec.java 2007-01-16 18:38:50 UTC (rev 303) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/StringCodec.java 2007-01-16 18:39:27 UTC (rev 304) @@ -1,3 +1,22 @@ +/* + * String2Bytes is a program for converting Strings into byte arrays. + * Copyright (C) 2007 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + package net.sf.japi.string2bytes; import java.io.UnsupportedEncodingException; Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/URLEncodeCodec.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/URLEncodeCodec.java 2007-01-16 18:38:50 UTC (rev 303) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/URLEncodeCodec.java 2007-01-16 18:39:27 UTC (rev 304) @@ -1,3 +1,22 @@ +/* + * String2Bytes is a program for converting Strings into byte arrays. + * Copyright (C) 2007 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + package net.sf.japi.string2bytes; import java.net.URLEncoder; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-01-30 20:51:30
|
Revision: 322 http://svn.sourceforge.net/japi/?rev=322&view=rev Author: christianhujer Date: 2007-01-30 12:51:18 -0800 (Tue, 30 Jan 2007) Log Message: ----------- Commit for preliminary support of configurable codecs. (Unfinnished) Modified Paths: -------------- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecSelectionPanel.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecStep.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecStepsListModel.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/EntityCodec.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/IdentityCodec.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/JavaBytesCodec.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/StringCodec.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/URLEncodeCodec.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/action.properties Added Paths: ----------- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/AbstractStringCodec.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecListModel.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/DoubleListController.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/ListOrderController.java Added: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/AbstractStringCodec.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/AbstractStringCodec.java (rev 0) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/AbstractStringCodec.java 2007-01-30 20:51:18 UTC (rev 322) @@ -0,0 +1,40 @@ +/* + * String2Bytes is a program for converting Strings into byte arrays. + * Copyright (C) 2007 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.japi.string2bytes; + +import org.jetbrains.annotations.Nullable; + +/** + * Base implementation for StringCodecs. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public abstract class AbstractStringCodec implements StringCodec { + + /** {@inheritDoc} */ + @Nullable public String getDisplayName() { + return getClass().getName(); + } + + /** {@inheritDoc} */ + public String toString() { + return getDisplayName(); + } + +} // class AbstractStringCodec Property changes on: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/AbstractStringCodec.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecListModel.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecListModel.java (rev 0) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecListModel.java 2007-01-30 20:51:18 UTC (rev 322) @@ -0,0 +1,52 @@ +/* + * String2Bytes is a program for converting Strings into byte arrays. + * Copyright (C) 2007 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.japi.string2bytes; + +import javax.swing.ListModel; +import javax.swing.event.ListDataListener; + +/** + * ListModel for codecs. + * Immutable, holds all available codecs. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class CodecListModel implements ListModel { + + /** {@inheritDoc} */ + public int getSize() { + return StringCodec.ALL_CODECS.size(); + } + + /** {@inheritDoc} */ + public Object getElementAt(final int i) { + return StringCodec.ALL_CODECS.get(i); + } + + /** {@inheritDoc} */ + public void addListDataListener(final ListDataListener listDataListener) { + // Because we don't fire events, we ignore listeners. + } + + /** {@inheritDoc} */ + public void removeListDataListener(final ListDataListener listDataListener) { + // Because we don't fire events, we ignore listeners. + } + +} // class CodecListModel Property changes on: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecListModel.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecSelectionPanel.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecSelectionPanel.java 2007-01-30 20:48:22 UTC (rev 321) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecSelectionPanel.java 2007-01-30 20:51:18 UTC (rev 322) @@ -23,20 +23,29 @@ import javax.swing.JList; import javax.swing.JLabel; import javax.swing.JScrollPane; +import javax.swing.DefaultListModel; +import javax.swing.JFrame; +import javax.swing.event.ListSelectionListener; +import javax.swing.event.ListSelectionEvent; import java.awt.GridBagLayout; import java.awt.GridBagConstraints; +import net.sf.japi.swing.ActionFactory; +import org.jetbrains.annotations.NotNull; /** * The CodecSelectionPanel allows the selection and configuration of one or more CodecSteps. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public class CodecSelectionPanel extends JPanel { +public class CodecSelectionPanel extends JPanel implements ListSelectionListener { + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.japi.string2bytes"); + /** The list with the available codecs. */ - private JList availableCodecsList = new JList(); + private JList availableCodecsList = new JList(new CodecListModel()); /** The list with the configured codec steps. */ - private JList configuredCodecSteps = new JList(); + private JList configuredCodecSteps = new JList(new CodecStepsListModel()); /** * Creates a CodecSelectionPanel. @@ -44,10 +53,25 @@ public CodecSelectionPanel() { super(new GridBagLayout()); final GridBagConstraints gbc = new GridBagConstraints(); - add(new JLabel("Available Codec"), gbc); - add(new JLabel("Selected Codecs"), gbc); + gbc.fill = GridBagConstraints.BOTH; + gbc.weightx = 1.0; + gbc.gridx = 1; + gbc.gridy = 1; + add(new JLabel(ACTION_FACTORY.getString("availableCodecs.label")), gbc); + gbc.gridx = 3; + add(new JLabel(ACTION_FACTORY.getString("selectedCodecs.label")), gbc); + gbc.gridx = 1; + gbc.weighty = 1.0; + gbc.gridy = 2; add(new JScrollPane(availableCodecsList), gbc); + gbc.gridx = 3; add(new JScrollPane(configuredCodecSteps), gbc); + gbc.weightx = 0.0; + gbc.gridx = 2; + add(new DoubleListController(availableCodecsList, configuredCodecSteps), gbc); + gbc.gridx = 4; + add(new ListOrderController((DefaultListModel) configuredCodecSteps.getModel(), configuredCodecSteps.getSelectionModel()), gbc); + configuredCodecSteps.addListSelectionListener(this); } /** @@ -55,6 +79,15 @@ * @param args Command line arguments (ignored) */ public static void main(final String... args) { + JFrame f = new JFrame(); + f.add(new CodecSelectionPanel()); + f.pack(); + f.setVisible(true); } + /** {@inheritDoc} */ + public void valueChanged(@NotNull final ListSelectionEvent listSelectionEvent) { + // TODO + } + } // class CodecSelectionPanel Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecStep.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecStep.java 2007-01-30 20:48:22 UTC (rev 321) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecStep.java 2007-01-30 20:51:18 UTC (rev 322) @@ -75,4 +75,9 @@ this.codec = codec; } + /** {@inheritDoc} */ + public String toString() { + return codec + " [" + getCharset() + "]"; + } + } // class CodecStep Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecStepsListModel.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecStepsListModel.java 2007-01-30 20:48:22 UTC (rev 321) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecStepsListModel.java 2007-01-30 20:51:18 UTC (rev 322) @@ -28,4 +28,13 @@ * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ public class CodecStepsListModel extends DefaultListModel { + + /** {@inheritDoc} */ + @Override public void insertElementAt(final Object object, final int i) { + if (!(object instanceof StringCodec)) { + throw new IllegalArgumentException(object + " not instanceof " + StringCodec.class); + } + super.insertElementAt(new CodecStep((StringCodec) object, "utf-8"), i); + } + } // class CodecStepsListModel Added: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/DoubleListController.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/DoubleListController.java (rev 0) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/DoubleListController.java 2007-01-30 20:51:18 UTC (rev 322) @@ -0,0 +1,133 @@ +/* + * String2Bytes is a program for converting Strings into byte arrays. + * Copyright (C) 2007 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.japi.string2bytes; + +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import javax.swing.Action; +import javax.swing.DefaultListModel; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JList; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.ActionMethod; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * A Controller that controles two lists, offering to add or remove elements from the second list. + * Elements from the first list can be added to the second list based on the selection made in the first list. + * Elements from the second list can be removed from the second list based on the selection made in the second list. + * The first list, which is not modified by this controller, is called source list. + * The second list, which can be modified by this controller, is called target list. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class DoubleListController extends JComponent implements ListSelectionListener { + + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.japi.string2bytes"); + + /** + * The first list (source list) to operate on. + */ + @NotNull private final JList sourceList; + + /** + * The second list (target list) to operate on. + */ + @NotNull private final JList targetList; + + /** + * The Action for adding elements to the second (target) list based on the selection from the first list. + */ + @NotNull private final Action add = ACTION_FACTORY.createAction(false, "add", this); + + /** + * The Action for removing elements from the second (target) list. + */ + @NotNull private final Action remove = ACTION_FACTORY.createAction(false, "remove", this); + + /** + * Create a DoubleListController. + * @param sourceList First list to operate on (source list). + * @param targetList Second list to operate on (target list). + */ + public DoubleListController(@NotNull final JList sourceList, @NotNull final JList targetList) { + this.sourceList = sourceList; + this.targetList = targetList; + setLayout(new GridBagLayout()); + final GridBagConstraints gbc = new GridBagConstraints(); + gbc.weighty = 1.0; + gbc.gridx = 1; + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.insets = new Insets(5, 5, 5, 5); + gbc.anchor = GridBagConstraints.SOUTH; + gbc.gridy = 1; + add(new JButton(add), gbc); + gbc.anchor = GridBagConstraints.NORTH; + gbc.gridy = 2; + add(new JButton(remove), gbc); + sourceList.addListSelectionListener(this); + targetList.addListSelectionListener(this); + valueChanged(null); + } + + /** + * Action for adding an element to the target list based on the selection from the source list. + */ + @ActionMethod public void add() { + final int index = sourceList.getSelectionModel().getMinSelectionIndex(); + if (index == -1) { + return; + } + final Object element = sourceList.getModel().getElementAt(index); + int targetIndex = targetList.getSelectionModel().getMaxSelectionIndex(); + if (targetIndex == -1) { + targetIndex = targetList.getModel().getSize(); + } + ((DefaultListModel) targetList.getModel()).insertElementAt(element, targetIndex); + } + + /** + * Action for removing an element from the target list. + */ + @ActionMethod public void remove() { + final int index = targetList.getSelectionModel().getMinSelectionIndex(); + if (index == -1) { + return; + } + ((DefaultListModel) targetList.getModel()).remove(index); + } + + /** {@inheritDoc} */ + public void valueChanged(@Nullable final ListSelectionEvent listSelectionEvent) { + @Nullable final Object source = listSelectionEvent != null ? listSelectionEvent.getSource() : null; + if (source == null || source == sourceList || source == sourceList.getSelectionModel()) { + add.setEnabled(sourceList.getSelectionModel().getMinSelectionIndex() >= 0); + } + if (source == null || source == targetList || source == targetList.getSelectionModel()) { + remove.setEnabled(targetList.getSelectionModel().getMinSelectionIndex() >= 0); + } + } + +} // class DoubleListController Property changes on: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/DoubleListController.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/EntityCodec.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/EntityCodec.java 2007-01-30 20:48:22 UTC (rev 321) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/EntityCodec.java 2007-01-30 20:51:18 UTC (rev 322) @@ -23,15 +23,17 @@ import java.util.Formatter; import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.NotNull; /** * A Codec which encodes a String by adding Entities. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public class EntityCodec implements StringCodec { +public class EntityCodec extends AbstractStringCodec { /** {@inheritDoc} */ - public String code(final String input, final String charsetName) throws UnsupportedEncodingException { + @NotNull public String code(@NotNull final String input, final String charsetName) throws UnsupportedEncodingException { final Charset charset = Charset.forName(charsetName); final CharsetEncoder encoder = charset.newEncoder(); final StringBuilder cooked = new StringBuilder(); @@ -47,4 +49,9 @@ return cooked.toString(); } + /** {@inheritDoc} */ + @Nullable public String getDisplayName() { + return "XML entities"; + } + } // class EntityCodec Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/IdentityCodec.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/IdentityCodec.java 2007-01-30 20:48:22 UTC (rev 321) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/IdentityCodec.java 2007-01-30 20:51:18 UTC (rev 322) @@ -20,16 +20,23 @@ package net.sf.japi.string2bytes; import java.io.UnsupportedEncodingException; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.NotNull; /** * A Codec that doesn't perform any conversion. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public class IdentityCodec implements StringCodec { +public class IdentityCodec extends AbstractStringCodec { /** {@inheritDoc} */ - public String code(final String input, final String charsetName) throws UnsupportedEncodingException { + @NotNull public String code(@NotNull final String input, final String charsetName) throws UnsupportedEncodingException { return input; } + /** {@inheritDoc} */ + @Nullable public String getDisplayName() { + return "Identity"; + } + } // class IdentityCodec Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/JavaBytesCodec.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/JavaBytesCodec.java 2007-01-30 20:48:22 UTC (rev 321) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/JavaBytesCodec.java 2007-01-30 20:51:18 UTC (rev 322) @@ -21,15 +21,17 @@ import java.io.UnsupportedEncodingException; import java.util.Formatter; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.NotNull; /** * A Codec which converts the input String into a suitable Java Array source code. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public class JavaBytesCodec implements StringCodec { +public class JavaBytesCodec extends AbstractStringCodec { /** {@inheritDoc} */ - public String code(final String input, final String charsetName) throws UnsupportedEncodingException { + @NotNull public String code(@NotNull final String input, final String charsetName) throws UnsupportedEncodingException { final Formatter result = new Formatter(); result.format("{ "); final byte[] bytes = input.getBytes(charsetName); @@ -44,4 +46,9 @@ return result.toString(); } + /** {@inheritDoc} */ + @Nullable public String getDisplayName() { + return "Java Bytes"; + } + } // class JavaBytesCodec Added: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/ListOrderController.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/ListOrderController.java (rev 0) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/ListOrderController.java 2007-01-30 20:51:18 UTC (rev 322) @@ -0,0 +1,260 @@ +/* + * String2Bytes is a program for converting Strings into byte arrays. + * Copyright (C) 2007 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.japi.string2bytes; + +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import javax.swing.Action; +import javax.swing.DefaultListModel; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JList; +import javax.swing.ListSelectionModel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.ActionMethod; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * A Control for changing the order of items in a {@link JList}. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class ListOrderController extends JComponent implements ListSelectionListener { + + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.japi.string2bytes"); + + /** + * The JList to operate on. + * If <code>null</code>, this ListOrderController is currently disconnected. + */ + @Nullable private DefaultListModel listModel; + + /** + * The list selection model to operate on. + * If <code>null</code>, this ListOrderController is currently disconnected. + */ + @Nullable private ListSelectionModel selectionModel; + + /** + * Action for top. + */ + @NotNull private final Action top = ACTION_FACTORY.createAction(false, "top", this); + + /** + * Action for up. + */ + @NotNull private final Action up = ACTION_FACTORY.createAction(false, "up", this); + + /** + * Action for down. + */ + @NotNull private final Action down = ACTION_FACTORY.createAction(false, "down", this); + + /** + * Action for bottom. + */ + @NotNull private final Action bottom = ACTION_FACTORY.createAction(false, "bottom", this); + + /** + * Create a ListOrderController that's not yet connected to a list. + */ + public ListOrderController() { + this(null, null); + } + + /** + * Create a ListOrderController for a list. + * @param listModel List model to create ListOrderController for. + * @param selectionModel Selection model to create ListOrderController for. + */ + public ListOrderController(@Nullable final DefaultListModel listModel, @Nullable final ListSelectionModel selectionModel) { + setLayout(new GridBagLayout()); + setListAndSelectionModels(listModel, selectionModel); + final GridBagConstraints gbc = new GridBagConstraints(); + gbc.gridwidth = GridBagConstraints.REMAINDER; + gbc.insets = new Insets(5, 5, 5, 5); + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.anchor = GridBagConstraints.SOUTH; + gbc.weighty = 1.0; + add(new JButton(top), gbc); + gbc.anchor = GridBagConstraints.CENTER; + gbc.weighty = 0.0; + add(new JButton(up), gbc); + add(new JButton(down), gbc); + gbc.anchor = GridBagConstraints.NORTH; + gbc.weighty = 1.0; + add(new JButton(bottom), gbc); + } + + /** + * Sets the list model to use. + * @param listModel The list model to use. + */ + public void setListModel(@Nullable final DefaultListModel listModel) { + if (this.listModel == listModel) { + return; + } + this.listModel = listModel; + updateActions(); + } + + /** + * Returns the list model that's currently used. + * @return Currently used list model. + */ + @Nullable public DefaultListModel getListModel() { + return listModel; + } + + /** + * Sets the selection model to use. + * @param selectionModel The selection model to use. + */ + public void setSelectionModel(@Nullable final ListSelectionModel selectionModel) { + if (this.selectionModel == selectionModel) { + return; + } + if (this.selectionModel != null) { + this.selectionModel.removeListSelectionListener(this); + } + this.selectionModel = selectionModel; + if (selectionModel != null) { + selectionModel.addListSelectionListener(this); + } + updateActions(); + } + + /** + * Returns the selection model that's currently used. + * @return Currently used selection model. + */ + @Nullable public ListSelectionModel getSelectionModel() { + return selectionModel; + } + + /** + * Sets the list and selection model to use. + * @param listModel The list model to use. + * @param selectionModel The selection model to use. + */ + public void setListAndSelectionModels(@Nullable final DefaultListModel listModel, @Nullable final ListSelectionModel selectionModel) { + if (this.selectionModel == selectionModel && this.listModel == listModel) { + return; + } + this.listModel = listModel; + setSelectionModel(selectionModel); + } + + /** + * Updates the enabled state of the actions. + * Use this in case all actions need to be updated. + */ + private void updateActions() { + final boolean globalEnabled = listModel != null && selectionModel != null; + final int index = selectionModel != null ? selectionModel.getMinSelectionIndex() : -1; + final int maxIndex = listModel != null ? listModel.size() : -1; + top.setEnabled(globalEnabled && index > 0); + up.setEnabled(globalEnabled && index > 0); + down.setEnabled(globalEnabled && index != -1 && index < maxIndex - 1); + bottom.setEnabled(globalEnabled && index != -1 && index < maxIndex - 1); + } + + /** + * Mode the currently selected entry to top. + */ + @ActionMethod public void top() { + final ListSelectionModel tmpSelectionModel = selectionModel; + final DefaultListModel tmpListModel = listModel; + if (tmpSelectionModel == null || tmpListModel == null) { + return; + } + final int oldIndex = tmpSelectionModel.getMinSelectionIndex(); + final int newIndex = 0; + if (oldIndex <= 0) { + return; + } + tmpListModel.insertElementAt(tmpListModel.remove(oldIndex), newIndex); + tmpSelectionModel.setSelectionInterval(newIndex, newIndex); + } + + /** + * Move the currently selected entry up. + */ + @ActionMethod public void up() { + final ListSelectionModel tmpSelectionModel = selectionModel; + final DefaultListModel tmpListModel = listModel; + if (tmpSelectionModel == null || tmpListModel == null) { + return; + } + final int oldIndex = tmpSelectionModel.getMinSelectionIndex(); + final int newIndex = oldIndex - 1; + if (oldIndex <= 0) { + return; + } + tmpListModel.insertElementAt(tmpListModel.remove(oldIndex), newIndex); + tmpSelectionModel.setSelectionInterval(newIndex, newIndex); + } + + /** + * Move the currently selected entry down. + */ + @ActionMethod public void down() { + final ListSelectionModel tmpSelectionModel = selectionModel; + final DefaultListModel tmpListModel = listModel; + if (tmpSelectionModel == null || tmpListModel == null) { + return; + } + final int oldIndex = tmpSelectionModel.getMinSelectionIndex(); + final int newIndex = oldIndex + 1; + if (oldIndex >= tmpListModel.size() - 1 || oldIndex < 0) { + return; + } + tmpListModel.insertElementAt(tmpListModel.remove(oldIndex), newIndex); + tmpSelectionModel.setSelectionInterval(newIndex, newIndex); + } + + /** + * Move the currently selected entry to bottom. + */ + @ActionMethod public void bottom() { + final ListSelectionModel tmpSelectionModel = selectionModel; + final DefaultListModel tmpListModel = listModel; + if (tmpSelectionModel == null || tmpListModel == null) { + return; + } + final int oldIndex = tmpSelectionModel.getMinSelectionIndex(); + final int newIndex = tmpListModel.size() - 1; + if (oldIndex >= tmpListModel.size() - 1 || oldIndex < 0) { + ... [truncated message content] |
From: <chr...@us...> - 2007-06-30 12:20:10
|
Revision: 475 http://svn.sourceforge.net/japi/?rev=475&view=rev Author: christianhujer Date: 2007-06-30 05:20:08 -0700 (Sat, 30 Jun 2007) Log Message: ----------- Added missing @Nullable / @NotNull annotations. Added missing @Override annotations. Added missing final modifiers. Added missing Javadoc comments. Fixed possible NPE in URLEncodeCodec. Modified Paths: -------------- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/AbstractStringCodec.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecListModel.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecSelectionPanel.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecStep.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecStepsListModel.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/DoubleListController.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/EntityCodec.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/IdentityCodec.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/JavaBytesCodec.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/ListOrderController.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/String2Bytes.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/StringCodec.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/URLEncodeCodec.java Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/AbstractStringCodec.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/AbstractStringCodec.java 2007-06-30 12:04:18 UTC (rev 474) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/AbstractStringCodec.java 2007-06-30 12:20:08 UTC (rev 475) @@ -33,7 +33,7 @@ } /** {@inheritDoc} */ - public String toString() { + @Override @Nullable public String toString() { return getDisplayName(); } Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecListModel.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecListModel.java 2007-06-30 12:04:18 UTC (rev 474) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecListModel.java 2007-06-30 12:20:08 UTC (rev 475) @@ -21,6 +21,7 @@ import javax.swing.ListModel; import javax.swing.event.ListDataListener; +import org.jetbrains.annotations.NotNull; /** * ListModel for codecs. @@ -35,17 +36,17 @@ } /** {@inheritDoc} */ - public Object getElementAt(final int i) { + @NotNull public Object getElementAt(final int i) { return StringCodec.ALL_CODECS.get(i); } /** {@inheritDoc} */ - public void addListDataListener(final ListDataListener listDataListener) { + public void addListDataListener(@NotNull final ListDataListener listDataListener) { // Because we don't fire events, we ignore listeners. } /** {@inheritDoc} */ - public void removeListDataListener(final ListDataListener listDataListener) { + public void removeListDataListener(@NotNull final ListDataListener listDataListener) { // Because we don't fire events, we ignore listeners. } Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecSelectionPanel.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecSelectionPanel.java 2007-06-30 12:04:18 UTC (rev 474) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecSelectionPanel.java 2007-06-30 12:20:08 UTC (rev 475) @@ -39,13 +39,13 @@ public class CodecSelectionPanel extends JPanel implements ListSelectionListener { /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.japi.string2bytes"); + @NotNull private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.japi.string2bytes"); /** The list with the available codecs. */ - private JList availableCodecsList = new JList(new CodecListModel()); + @NotNull private JList availableCodecsList = new JList(new CodecListModel()); /** The list with the configured codec steps. */ - private JList configuredCodecSteps = new JList(new CodecStepsListModel()); + @NotNull private JList configuredCodecSteps = new JList(new CodecStepsListModel()); /** * Creates a CodecSelectionPanel. @@ -78,8 +78,8 @@ * Main method, used to try the CodecSelectionPanel. * @param args Command line arguments (ignored) */ - public static void main(final String... args) { - JFrame f = new JFrame(); + public static void main(@NotNull final String... args) { + final JFrame f = new JFrame(); f.add(new CodecSelectionPanel()); f.pack(); f.setVisible(true); Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecStep.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecStep.java 2007-06-30 12:04:18 UTC (rev 474) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecStep.java 2007-06-30 12:20:08 UTC (rev 475) @@ -76,7 +76,7 @@ } /** {@inheritDoc} */ - public String toString() { + @Override @NotNull public String toString() { return codec + " [" + getCharset() + "]"; } Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecStepsListModel.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecStepsListModel.java 2007-06-30 12:04:18 UTC (rev 474) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecStepsListModel.java 2007-06-30 12:20:08 UTC (rev 475) @@ -22,6 +22,7 @@ import javax.swing.ListModel; import javax.swing.JList; import javax.swing.DefaultListModel; +import org.jetbrains.annotations.NotNull; /** * The CodecStepsListModel is a {@link ListModel} for listing {@link CodecStep}s in a {@link JList}. @@ -30,7 +31,7 @@ public class CodecStepsListModel extends DefaultListModel { /** {@inheritDoc} */ - @Override public void insertElementAt(final Object object, final int i) { + @Override public void insertElementAt(@NotNull final Object object, final int i) { if (!(object instanceof StringCodec)) { throw new IllegalArgumentException(object + " not instanceof " + StringCodec.class); } Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/DoubleListController.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/DoubleListController.java 2007-06-30 12:04:18 UTC (rev 474) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/DoubleListController.java 2007-06-30 12:20:08 UTC (rev 475) @@ -40,12 +40,13 @@ * Elements from the second list can be removed from the second list based on the selection made in the second list. * The first list, which is not modified by this controller, is called source list. * The second list, which can be modified by this controller, is called target list. + * @todo move to an appropriate JAPI swing library module. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ public class DoubleListController extends JComponent implements ListSelectionListener { /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.japi.string2bytes"); + @NotNull private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.japi.string2bytes"); /** * The first list (source list) to operate on. Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/EntityCodec.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/EntityCodec.java 2007-06-30 12:04:18 UTC (rev 474) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/EntityCodec.java 2007-06-30 12:20:08 UTC (rev 475) @@ -43,6 +43,7 @@ if (encoder.canEncode(c)) { cooked.append(c); } else { + //noinspection MagicNumber format.format("&%x;", c & 0xFFFF); } } @@ -50,7 +51,7 @@ } /** {@inheritDoc} */ - @Nullable public String getDisplayName() { + @Override @Nullable public String getDisplayName() { return "XML entities"; } Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/IdentityCodec.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/IdentityCodec.java 2007-06-30 12:04:18 UTC (rev 474) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/IdentityCodec.java 2007-06-30 12:20:08 UTC (rev 475) @@ -35,7 +35,7 @@ } /** {@inheritDoc} */ - @Nullable public String getDisplayName() { + @Override @Nullable public String getDisplayName() { return "Identity"; } Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/JavaBytesCodec.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/JavaBytesCodec.java 2007-06-30 12:04:18 UTC (rev 474) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/JavaBytesCodec.java 2007-06-30 12:20:08 UTC (rev 475) @@ -47,7 +47,7 @@ } /** {@inheritDoc} */ - @Nullable public String getDisplayName() { + @Override @Nullable public String getDisplayName() { return "Java Bytes"; } Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/ListOrderController.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/ListOrderController.java 2007-06-30 12:04:18 UTC (rev 474) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/ListOrderController.java 2007-06-30 12:20:08 UTC (rev 475) @@ -37,12 +37,13 @@ /** * A Control for changing the order of items in a {@link JList}. + * @todo move to an appropriate JAPI swing library module. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ public class ListOrderController extends JComponent implements ListSelectionListener { /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.japi.string2bytes"); + @NotNull private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.japi.string2bytes"); /** * The JList to operate on. Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/String2Bytes.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/String2Bytes.java 2007-06-30 12:04:18 UTC (rev 474) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/String2Bytes.java 2007-06-30 12:20:08 UTC (rev 475) @@ -39,6 +39,7 @@ import net.sf.japi.swing.ActionMethod; import net.sf.japi.swing.ToggleAction; import net.sf.japi.swing.about.AboutDialog; +import org.jetbrains.annotations.NotNull; /** * String2Bytes is a small tool that converts Strings into Bytes. @@ -54,22 +55,22 @@ public class String2Bytes implements ItemListener { /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.japi.string2bytes"); + @NotNull private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.japi.string2bytes"); /** About Dialog. */ - private final AboutDialog aboutDialog = new AboutDialog("net.sf.japi.string2bytes"); + @NotNull private final AboutDialog aboutDialog = new AboutDialog("net.sf.japi.string2bytes"); /** Preferences. */ - private static final Preferences PREFS = Preferences.userNodeForPackage(String2Bytes.class); + @NotNull private static final Preferences PREFS = Preferences.userNodeForPackage(String2Bytes.class); /** Textfield for the input String. */ - private final JTextArea input = new JTextArea(); + @NotNull private final JTextArea input = new JTextArea(); /** Textfield for the output String. */ - private final JTextArea output = new JTextArea(); + @NotNull private final JTextArea output = new JTextArea(); /** ComboBox for selecting the encoding. */ - private final JComboBox encoding = new JComboBox(Charset.availableCharsets().keySet().toArray()); + @NotNull private final JComboBox encoding = new JComboBox(Charset.availableCharsets().keySet().toArray()); /** Whether the Clipboard is used for input. */ private boolean usingClipboardForInput; @@ -78,7 +79,7 @@ private boolean usingClipboardForOutput; /** The application frame. */ - private final JFrame frame; + @NotNull private final JFrame frame; String2Bytes() { ACTION_FACTORY.createActions(true, this, "convert", "encodingDefault", "encodingSystem", "clearInput", "clearOutput"); @@ -141,7 +142,7 @@ * @return Converted String * @throws UnsupportedEncodingException in case the selected encoding is not available (shouldn't happen). */ - public String convert(final String from) throws Exception { + @NotNull public String convert(@NotNull final String from) throws Exception { return new JavaBytesCodec().code(from, encoding.getSelectedItem().toString()); } @@ -185,7 +186,7 @@ * Creates the panel which holds the settings. * @return Newly created panel which holds the settings. */ - private JPanel createSettingsPanel() { + @NotNull private JPanel createSettingsPanel() { final JPanel settingsPanel = new JPanel(); settingsPanel.setBorder(BorderFactory.createTitledBorder("Settings")); settingsPanel.add(createEncodingPanel()); @@ -196,7 +197,7 @@ * Creates the panel which allows the user to select the encoding. * @return Newly created panel for selecting the encoding. */ - private JPanel createEncodingPanel() { + @NotNull private JPanel createEncodingPanel() { encoding.setSelectedItem(PREFS.get("encoding", ACTION_FACTORY.getString("encoding.default"))); encoding.setEditable(true); final JPanel encodingPanel = new JPanel(); @@ -211,7 +212,7 @@ * Creates the input panel. * @return Newly created input panel. */ - private JPanel createInputPanel() { + @NotNull private JPanel createInputPanel() { final JPanel inputPanel = new JPanel(new GridBagLayout()); inputPanel.setBorder(BorderFactory.createTitledBorder(ACTION_FACTORY.getString("border.input.title"))); final GridBagConstraints gbc = new GridBagConstraints(); @@ -233,7 +234,7 @@ * Creates the output panel. * @return Newly created output panel. */ - private JPanel createOutputPanel() { + @NotNull private JPanel createOutputPanel() { final JPanel outputPanel = new JPanel(new GridBagLayout()); outputPanel.setBorder(BorderFactory.createTitledBorder(ACTION_FACTORY.getString("border.output.title"))); final GridBagConstraints gbc = new GridBagConstraints(); @@ -255,7 +256,7 @@ * Creates the command panel which holds the button to perform the conversion. * @return Newly created command panel. */ - private JPanel createCommandPanel() { + @NotNull private JPanel createCommandPanel() { final JPanel commandPanel = new JPanel(); commandPanel.setBorder(BorderFactory.createTitledBorder("Commands")); commandPanel.add(new JButton(ACTION_FACTORY.getAction("convert"))); @@ -263,7 +264,7 @@ } /** {@inheritDoc} */ - public void itemStateChanged(final ItemEvent itemEvent) { + public void itemStateChanged(@NotNull final ItemEvent itemEvent) { if (itemEvent.getStateChange() == ItemEvent.SELECTED) { PREFS.put("encoding", encoding.getSelectedItem().toString()); } @@ -273,7 +274,7 @@ * Main program. * @param args Command line arguments (ignored) */ - public static void main(final String... args) { + public static void main(@NotNull final String... args) { new String2Bytes(); } Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/StringCodec.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/StringCodec.java 2007-06-30 12:04:18 UTC (rev 474) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/StringCodec.java 2007-06-30 12:20:08 UTC (rev 475) @@ -36,7 +36,7 @@ * Unmodifiable list with all Codecs. * @deprecated This will be replaced using a registry. */ - @Deprecated List<? extends StringCodec> ALL_CODECS = Collections.unmodifiableList(Arrays.asList(new IdentityCodec(), new JavaBytesCodec(), new EntityCodec(), new URLEncodeCodec())); + @Deprecated @NotNull List<? extends StringCodec> ALL_CODECS = Collections.unmodifiableList(Arrays.asList(new IdentityCodec(), new JavaBytesCodec(), new EntityCodec(), new URLEncodeCodec())); /** * Convert a String into another String. Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/URLEncodeCodec.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/URLEncodeCodec.java 2007-06-30 12:04:18 UTC (rev 474) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/URLEncodeCodec.java 2007-06-30 12:20:08 UTC (rev 475) @@ -32,12 +32,12 @@ public class URLEncodeCodec extends AbstractStringCodec { /** {@inheritDoc} */ - @NotNull public String code(@NotNull final String input, final String charsetName) throws UnsupportedEncodingException { - return URLEncoder.encode(input, charsetName); + @NotNull public String code(@NotNull final String input, @Nullable final String charsetName) throws UnsupportedEncodingException { + return charsetName == null ? URLEncoder.encode(input) : URLEncoder.encode(input, charsetName); } /** {@inheritDoc} */ - @Nullable public String getDisplayName() { + @Override @Nullable public String getDisplayName() { return "URLEncode"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-08-12 20:46:27
|
Revision: 574 http://japi.svn.sourceforge.net/japi/?rev=574&view=rev Author: christianhujer Date: 2007-08-12 13:46:18 -0700 (Sun, 12 Aug 2007) Log Message: ----------- Extracted implementation DefaultActionBuilder from class ActionBuilder. ActionBuilder now is an interface. Optimized imports. Modified Paths: -------------- historic/trunk/src/app/net/sf/japi/io/ARGV.java historic/trunk/src/app/net/sf/japi/io/IOHelper.java 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/ScrollResultSetTableModel.java historic/trunk/src/app/net/sf/japi/swing/ColumnLayout.java historic/trunk/src/app/net/sf/japi/swing/IconManager.java historic/trunk/src/app/net/sf/japi/swing/JFileField.java historic/trunk/src/app/net/sf/japi/swing/JPropertyEditor.java historic/trunk/src/app/net/sf/japi/swing/bookmarks/BookmarkDropTargetAdapter.java historic/trunk/src/app/net/sf/japi/swing/font/FontFamilyListCellRenderer.java historic/trunk/src/app/net/sf/japi/swing/prefs/AbstractPrefs.java historic/trunk/src/app/net/sf/japi/swing/treetable/TreeTableModelTreeModelAdapter.java historic/trunk/src/app/net/sf/japi/util/Arrays2.java historic/trunk/src/app/net/sf/japi/util/Collections2.java historic/trunk/src/app/net/sf/japi/util/Service.java historic/trunk/src/app/net/sf/japi/util/filter/file/RegexFileFilter.java historic/trunk/src/doc/guide/io/src/CatJAPI.java historic/trunk/src/doc/guide/io/src/SortPlain.java libs/argparser/trunk/src/doc/examples/Recode.java libs/argparser/trunk/src/doc/examples/Uniq.java libs/argparser/trunk/src/net/sf/japi/io/args/LogCommand.java libs/argparser/trunk/src/net/sf/japi/io/args/OptionType.java libs/argparser/trunk/src/net/sf/japi/io/args/converter/BooleanConverter.java libs/argparser/trunk/src/net/sf/japi/io/args/converter/IntegerConverter.java libs/argparser/trunk/src/net/sf/japi/io/args/converter/LogLevelConverter.java libs/argparser/trunk/src/net/sf/japi/io/args/converter/StringConverter.java libs/argparser/trunk/src/test/net/sf/japi/io/args/CommandDummy.java libs/argparser/trunk/src/test/net/sf/japi/io/args/RBMockCommand.java libs/argparser/trunk/src/test/net/sf/japi/io/args/TokenReaderTest.java libs/argparser/trunk/src/test/net/sf/japi/io/args/converter/BooleanConverterTest.java libs/logging/trunk/src/net/sf/japi/log/LoggerFactory.java libs/registry/trunk/src/net/sf/japi/registry/NamedRegistry.java libs/registry/trunk/src/net/sf/japi/registry/NamedService.java libs/swing-action/trunk/src/net/sf/japi/swing/ActionBuilderFactory.java libs/swing-action/trunk/src/net/sf/japi/swing/ActionMethod.java libs/swing-bookmarks/trunk/src/net/sf/japi/swing/bookmarks/BookmarkDropTargetAdapter.java libs/swing-bookmarks/trunk/src/net/sf/japi/swing/bookmarks/Bookmarkable.java libs/swing-extlib/trunk/src/net/sf/japi/swing/RowLayout.java libs/swing-extlib/trunk/src/net/sf/japi/swing/VerticalFlowLayout.java libs/swing-misc/trunk/src/net/sf/japi/swing/misc/LocaleListCellRenderer.java libs/swing-treetable/trunk/src/net/sf/japi/swing/treetable/TreeTableModelTreeModelAdapter.java libs/taglets/trunk/src/net/sf/japi/taglets/FixmeTaglet.java libs/taglets/trunk/src/net/sf/japi/taglets/InvariantTaglet.java libs/taglets/trunk/src/net/sf/japi/taglets/NoteTaglet.java libs/taglets/trunk/src/net/sf/japi/taglets/PostconditionTaglet.java libs/taglets/trunk/src/net/sf/japi/taglets/PreconditionTaglet.java libs/taglets/trunk/src/net/sf/japi/taglets/TodoTaglet.java libs/taglets/trunk/src/net/sf/japi/taglets/WarningTaglet.java libs/taglets/trunk/src/net/sf/japi/taglets/XxxTaglet.java libs/util/trunk/src/net/sf/japi/util/Collections2.java libs/util/trunk/src/net/sf/japi/util/LocaleComparator.java libs/util/trunk/src/net/sf/japi/util/filter/file/RegexFileFilter.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/Program.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/Settings.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/FirstSettingsModule.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/GUIOptionsSettingsModule.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/ListSelectionActionAdapter.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/QuestionGUI.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/io/JTestSer.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/io/JTestV1.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/io/KEduca.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/HelpManager.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/io/AbstractCachingImporter.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/list/ActionListCellRenderer.java tools/prefsbrowser/trunk/src/net/sf/japi/tools/prefsbrowser/PrefsBranchNode.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/CodecStepsListModel.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/EntityCodec.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/IdentityCodec.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/JavaBytesCodec.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/URLEncodeCodec.java Added Paths: ----------- libs/swing-action/trunk/src/net/sf/japi/swing/ActionBuilder.java libs/swing-action/trunk/src/net/sf/japi/swing/DefaultActionBuilder.java libs/swing-action/trunk/src/test/net/sf/japi/swing/DefaultActionBuilderTest.java Removed Paths: ------------- libs/swing-action/trunk/src/net/sf/japi/swing/ActionBuilder.java libs/swing-action/trunk/src/test/net/sf/japi/swing/ActionBuilderTest.java Modified: historic/trunk/src/app/net/sf/japi/io/ARGV.java =================================================================== --- historic/trunk/src/app/net/sf/japi/io/ARGV.java 2007-08-12 16:44:52 UTC (rev 573) +++ historic/trunk/src/app/net/sf/japi/io/ARGV.java 2007-08-12 20:46:18 UTC (rev 574) @@ -23,8 +23,8 @@ import java.io.IOException; import java.util.Iterator; import java.util.NoSuchElementException; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; /** A special delegate of ARGV Reader supplying lines via an Iterator. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> Modified: historic/trunk/src/app/net/sf/japi/io/IOHelper.java =================================================================== --- historic/trunk/src/app/net/sf/japi/io/IOHelper.java 2007-08-12 16:44:52 UTC (rev 573) +++ historic/trunk/src/app/net/sf/japi/io/IOHelper.java 2007-08-12 20:46:18 UTC (rev 574) @@ -20,8 +20,8 @@ package net.sf.japi.io; +import java.io.IOException; import java.io.InputStream; -import java.io.IOException; import java.io.OutputStream; /** A class with helper methods for In- and Output. Modified: historic/trunk/src/app/net/sf/japi/sql/CachedResultSetTableModel.java =================================================================== --- historic/trunk/src/app/net/sf/japi/sql/CachedResultSetTableModel.java 2007-08-12 16:44:52 UTC (rev 573) +++ historic/trunk/src/app/net/sf/japi/sql/CachedResultSetTableModel.java 2007-08-12 20:46:18 UTC (rev 574) @@ -24,8 +24,8 @@ 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; -import net.sf.japi.util.ThrowableHandler; /** 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. Modified: historic/trunk/src/app/net/sf/japi/sql/DatabaseTreeModel.java =================================================================== --- historic/trunk/src/app/net/sf/japi/sql/DatabaseTreeModel.java 2007-08-12 16:44:52 UTC (rev 573) +++ historic/trunk/src/app/net/sf/japi/sql/DatabaseTreeModel.java 2007-08-12 20:46:18 UTC (rev 574) @@ -20,16 +20,16 @@ package net.sf.japi.sql; -import java.sql.SQLException; 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.event.TreeModelEvent; +import javax.swing.tree.TreeModel; import javax.swing.tree.TreePath; -import javax.swing.tree.TreeModel; /** A TreeModel displaying the catalogs of a database (usually tables and views) as tree. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> Modified: historic/trunk/src/app/net/sf/japi/sql/ScrollResultSetTableModel.java =================================================================== --- historic/trunk/src/app/net/sf/japi/sql/ScrollResultSetTableModel.java 2007-08-12 16:44:52 UTC (rev 573) +++ historic/trunk/src/app/net/sf/japi/sql/ScrollResultSetTableModel.java 2007-08-12 20:46:18 UTC (rev 574) @@ -39,8 +39,8 @@ 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; -import net.sf.japi.util.ThrowableHandler; /** An implementation of <code>javax.swing.TableModel</code> for an SQL ResultSet. * It is required that the ResultSet is absolutely navigatable. Modified: historic/trunk/src/app/net/sf/japi/swing/ColumnLayout.java =================================================================== --- historic/trunk/src/app/net/sf/japi/swing/ColumnLayout.java 2007-08-12 16:44:52 UTC (rev 573) +++ historic/trunk/src/app/net/sf/japi/swing/ColumnLayout.java 2007-08-12 20:46:18 UTC (rev 574) @@ -20,10 +20,10 @@ package net.sf.japi.swing; +import java.awt.Component; +import java.awt.Container; import java.awt.Dimension; import java.awt.Insets; -import java.awt.Component; -import java.awt.Container; import java.awt.LayoutManager; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; Modified: historic/trunk/src/app/net/sf/japi/swing/IconManager.java =================================================================== --- historic/trunk/src/app/net/sf/japi/swing/IconManager.java 2007-08-12 16:44:52 UTC (rev 573) +++ historic/trunk/src/app/net/sf/japi/swing/IconManager.java 2007-08-12 20:46:18 UTC (rev 574) @@ -21,13 +21,13 @@ package net.sf.japi.swing; import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.WeakHashMap; -import java.util.List; -import java.util.ArrayList; -import java.util.Iterator; -import java.security.AccessController; -import java.security.PrivilegedAction; import javax.swing.Icon; import javax.swing.ImageIcon; import org.jetbrains.annotations.Nullable; Modified: historic/trunk/src/app/net/sf/japi/swing/JFileField.java =================================================================== --- historic/trunk/src/app/net/sf/japi/swing/JFileField.java 2007-08-12 16:44:52 UTC (rev 573) +++ historic/trunk/src/app/net/sf/japi/swing/JFileField.java 2007-08-12 20:46:18 UTC (rev 574) @@ -23,8 +23,8 @@ import java.awt.BorderLayout; import java.io.File; import javax.swing.JComponent; +import javax.swing.JFileChooser; import javax.swing.JTextField; -import javax.swing.JFileChooser; /** A class that displays a textfield for a file and a button for choosing the file. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> Modified: historic/trunk/src/app/net/sf/japi/swing/JPropertyEditor.java =================================================================== --- historic/trunk/src/app/net/sf/japi/swing/JPropertyEditor.java 2007-08-12 16:44:52 UTC (rev 573) +++ historic/trunk/src/app/net/sf/japi/swing/JPropertyEditor.java 2007-08-12 20:46:18 UTC (rev 574) @@ -20,21 +20,21 @@ package net.sf.japi.swing; +import java.awt.Component; +import java.awt.GridBagConstraints; import static java.awt.GridBagConstraints.REMAINDER; +import java.awt.GridBagLayout; import java.beans.BeanInfo; import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.beans.PropertyEditor; import java.beans.PropertyEditorManager; -import java.awt.Component; -import java.awt.GridBagLayout; -import java.awt.GridBagConstraints; import java.util.HashMap; import java.util.Map; +import javax.swing.JCheckBox; import javax.swing.JComponent; import javax.swing.JLabel; -import javax.swing.JCheckBox; import javax.swing.JTextField; /** User Interface component for editing properties. Modified: historic/trunk/src/app/net/sf/japi/swing/bookmarks/BookmarkDropTargetAdapter.java =================================================================== --- historic/trunk/src/app/net/sf/japi/swing/bookmarks/BookmarkDropTargetAdapter.java 2007-08-12 16:44:52 UTC (rev 573) +++ historic/trunk/src/app/net/sf/japi/swing/bookmarks/BookmarkDropTargetAdapter.java 2007-08-12 20:46:18 UTC (rev 574) @@ -31,8 +31,8 @@ import java.io.IOException; import javax.swing.JTree; import javax.swing.tree.TreePath; +import static net.sf.japi.swing.bookmarks.BookmarkTransferable.getBookmarkDataFlavor; import org.jetbrains.annotations.Nullable; -import static net.sf.japi.swing.bookmarks.BookmarkTransferable.getBookmarkDataFlavor; /** Class for dropping a bookmark over a JTree managing bookmarks. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> Modified: historic/trunk/src/app/net/sf/japi/swing/font/FontFamilyListCellRenderer.java =================================================================== --- historic/trunk/src/app/net/sf/japi/swing/font/FontFamilyListCellRenderer.java 2007-08-12 16:44:52 UTC (rev 573) +++ historic/trunk/src/app/net/sf/japi/swing/font/FontFamilyListCellRenderer.java 2007-08-12 20:46:18 UTC (rev 574) @@ -23,8 +23,8 @@ import java.awt.Component; import java.awt.Font; import java.util.Map; +import javax.swing.DefaultListCellRenderer; import javax.swing.JList; -import javax.swing.DefaultListCellRenderer; /** List cell renderer for letting the user choose the font family. * This list cell renderer displays each font in its font. Modified: historic/trunk/src/app/net/sf/japi/swing/prefs/AbstractPrefs.java =================================================================== --- historic/trunk/src/app/net/sf/japi/swing/prefs/AbstractPrefs.java 2007-08-12 16:44:52 UTC (rev 573) +++ historic/trunk/src/app/net/sf/japi/swing/prefs/AbstractPrefs.java 2007-08-12 20:46:18 UTC (rev 574) @@ -20,12 +20,12 @@ package net.sf.japi.swing.prefs; +import java.awt.LayoutManager; import java.net.URL; -import java.awt.LayoutManager; +import javax.swing.BoxLayout; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JPanel; -import javax.swing.BoxLayout; import net.sf.japi.swing.ColumnLayout; /** Abstract preferences implementation. Modified: historic/trunk/src/app/net/sf/japi/swing/treetable/TreeTableModelTreeModelAdapter.java =================================================================== --- historic/trunk/src/app/net/sf/japi/swing/treetable/TreeTableModelTreeModelAdapter.java 2007-08-12 16:44:52 UTC (rev 573) +++ historic/trunk/src/app/net/sf/japi/swing/treetable/TreeTableModelTreeModelAdapter.java 2007-08-12 20:46:18 UTC (rev 574) @@ -20,10 +20,10 @@ package net.sf.japi.swing.treetable; +import javax.swing.event.EventListenerList; +import javax.swing.event.TreeModelListener; import javax.swing.tree.TreeModel; import javax.swing.tree.TreePath; -import javax.swing.event.TreeModelListener; -import javax.swing.event.EventListenerList; /** * TODO Modified: historic/trunk/src/app/net/sf/japi/util/Arrays2.java =================================================================== --- historic/trunk/src/app/net/sf/japi/util/Arrays2.java 2007-08-12 16:44:52 UTC (rev 573) +++ historic/trunk/src/app/net/sf/japi/util/Arrays2.java 2007-08-12 20:46:18 UTC (rev 574) @@ -24,8 +24,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Comparator; import java.util.List; -import java.util.Comparator; import java.util.Random; import net.sf.japi.util.filter.Filter; Modified: historic/trunk/src/app/net/sf/japi/util/Collections2.java =================================================================== --- historic/trunk/src/app/net/sf/japi/util/Collections2.java 2007-08-12 16:44:52 UTC (rev 573) +++ historic/trunk/src/app/net/sf/japi/util/Collections2.java 2007-08-12 20:46:18 UTC (rev 574) @@ -24,10 +24,10 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.Comparator; +import java.util.Iterator; import java.util.List; import java.util.RandomAccess; -import java.util.Iterator; -import java.util.Comparator; import net.sf.japi.util.filter.Filter; /** This class provides some additional utility methods you might miss in {@link Collections}. Modified: historic/trunk/src/app/net/sf/japi/util/Service.java =================================================================== --- historic/trunk/src/app/net/sf/japi/util/Service.java 2007-08-12 16:44:52 UTC (rev 573) +++ historic/trunk/src/app/net/sf/japi/util/Service.java 2007-08-12 20:46:18 UTC (rev 574) @@ -1,11 +1,9 @@ package net.sf.japi.util; -import static sun.misc.Service.providers; - import java.lang.reflect.InvocationTargetException; - import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import static sun.misc.Service.providers; /** * Service serves as a Proxy for {@link java.util.ServiceLoader}, using {@link sun.misc.Service} as a fallback in case {@link java.util.ServiceLoader} is unavailable. Modified: historic/trunk/src/app/net/sf/japi/util/filter/file/RegexFileFilter.java =================================================================== --- historic/trunk/src/app/net/sf/japi/util/filter/file/RegexFileFilter.java 2007-08-12 16:44:52 UTC (rev 573) +++ historic/trunk/src/app/net/sf/japi/util/filter/file/RegexFileFilter.java 2007-08-12 20:46:18 UTC (rev 574) @@ -21,10 +21,10 @@ package net.sf.japi.util.filter.file; import java.io.File; +import java.util.Arrays; import java.util.regex.Matcher; import java.util.regex.Pattern; import static java.util.regex.Pattern.compile; -import java.util.Arrays; /** A FileFilter implementation that matches against a regular expression. * @see Pattern Modified: historic/trunk/src/doc/guide/io/src/CatJAPI.java =================================================================== --- historic/trunk/src/doc/guide/io/src/CatJAPI.java 2007-08-12 16:44:52 UTC (rev 573) +++ historic/trunk/src/doc/guide/io/src/CatJAPI.java 2007-08-12 20:46:18 UTC (rev 574) @@ -1,5 +1,5 @@ +import java.io.IOException; import static java.lang.System.out; -import java.io.IOException; import net.sf.japi.io.ARGVInputStream; import static net.sf.japi.io.IOHelper.copy; Modified: historic/trunk/src/doc/guide/io/src/SortPlain.java =================================================================== --- historic/trunk/src/doc/guide/io/src/SortPlain.java 2007-08-12 16:44:52 UTC (rev 573) +++ historic/trunk/src/doc/guide/io/src/SortPlain.java 2007-08-12 20:46:18 UTC (rev 574) @@ -1,3 +1,7 @@ +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStreamReader; import static java.lang.System.out; import java.util.ArrayList; import static java.util.Collections.sort; @@ -2,7 +6,2 @@ import java.util.List; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.BufferedReader; -import java.io.FileReader; -import net.sf.japi.io.ARGV; Modified: libs/argparser/trunk/src/doc/examples/Recode.java =================================================================== --- libs/argparser/trunk/src/doc/examples/Recode.java 2007-08-12 16:44:52 UTC (rev 573) +++ libs/argparser/trunk/src/doc/examples/Recode.java 2007-08-12 20:46:18 UTC (rev 574) @@ -29,9 +29,9 @@ import java.io.OutputStreamWriter; import java.io.Reader; import java.io.Writer; -import java.util.List; import java.nio.channels.FileChannel; import java.nio.charset.Charset; +import java.util.List; import net.sf.japi.io.args.ArgParser; import net.sf.japi.io.args.BasicCommand; import net.sf.japi.io.args.Option; Modified: libs/argparser/trunk/src/doc/examples/Uniq.java =================================================================== --- libs/argparser/trunk/src/doc/examples/Uniq.java 2007-08-12 16:44:52 UTC (rev 573) +++ libs/argparser/trunk/src/doc/examples/Uniq.java 2007-08-12 20:46:18 UTC (rev 574) @@ -19,18 +19,18 @@ package examples; -import net.sf.japi.io.args.BasicCommand; -import net.sf.japi.io.args.Option; -import net.sf.japi.io.args.ArgParser; -import org.jetbrains.annotations.NotNull; -import java.util.List; -import java.io.InputStream; +import java.io.BufferedInputStream; +import java.io.BufferedReader; import java.io.FileInputStream; -import java.io.BufferedInputStream; import java.io.IOException; +import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; -import java.io.BufferedReader; +import java.util.List; +import net.sf.japi.io.args.ArgParser; +import net.sf.japi.io.args.BasicCommand; +import net.sf.japi.io.args.Option; +import org.jetbrains.annotations.NotNull; /** Java implementation of the UNIX command <q>uniq</q> to demonstrate how to use the argparser library. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> Modified: libs/argparser/trunk/src/net/sf/japi/io/args/LogCommand.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/LogCommand.java 2007-08-12 16:44:52 UTC (rev 573) +++ libs/argparser/trunk/src/net/sf/japi/io/args/LogCommand.java 2007-08-12 20:46:18 UTC (rev 574) @@ -19,9 +19,9 @@ package net.sf.japi.io.args; +import java.util.logging.Level; +import java.util.logging.Logger; import org.jetbrains.annotations.NotNull; -import java.util.logging.Logger; -import java.util.logging.Level; /** * Subclass of BasicCommand that provides logging through {@link java.util.logging}. Modified: libs/argparser/trunk/src/net/sf/japi/io/args/OptionType.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/OptionType.java 2007-08-12 16:44:52 UTC (rev 573) +++ libs/argparser/trunk/src/net/sf/japi/io/args/OptionType.java 2007-08-12 20:46:18 UTC (rev 574) @@ -18,9 +18,9 @@ */ package net.sf.japi.io.args; +import java.util.Locale; +import java.util.MissingResourceException; import java.util.ResourceBundle; -import java.util.MissingResourceException; -import java.util.Locale; import org.jetbrains.annotations.NotNull; /** Modified: libs/argparser/trunk/src/net/sf/japi/io/args/converter/BooleanConverter.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/converter/BooleanConverter.java 2007-08-12 16:44:52 UTC (rev 573) +++ libs/argparser/trunk/src/net/sf/japi/io/args/converter/BooleanConverter.java 2007-08-12 20:46:18 UTC (rev 574) @@ -19,9 +19,9 @@ package net.sf.japi.io.args.converter; -import org.jetbrains.annotations.NotNull; import java.util.Locale; import java.util.ResourceBundle; +import org.jetbrains.annotations.NotNull; /** * Converter which converts a String into a Boolean. Modified: libs/argparser/trunk/src/net/sf/japi/io/args/converter/IntegerConverter.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/converter/IntegerConverter.java 2007-08-12 16:44:52 UTC (rev 573) +++ libs/argparser/trunk/src/net/sf/japi/io/args/converter/IntegerConverter.java 2007-08-12 20:46:18 UTC (rev 574) @@ -19,8 +19,8 @@ package net.sf.japi.io.args.converter; +import java.util.Locale; import org.jetbrains.annotations.NotNull; -import java.util.Locale; /** * Converter which converts a String into a an Integer. Modified: libs/argparser/trunk/src/net/sf/japi/io/args/converter/LogLevelConverter.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/converter/LogLevelConverter.java 2007-08-12 16:44:52 UTC (rev 573) +++ libs/argparser/trunk/src/net/sf/japi/io/args/converter/LogLevelConverter.java 2007-08-12 20:46:18 UTC (rev 574) @@ -19,8 +19,8 @@ package net.sf.japi.io.args.converter; +import java.util.Locale; import java.util.logging.Level; -import java.util.Locale; import org.jetbrains.annotations.NotNull; /** Modified: libs/argparser/trunk/src/net/sf/japi/io/args/converter/StringConverter.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/converter/StringConverter.java 2007-08-12 16:44:52 UTC (rev 573) +++ libs/argparser/trunk/src/net/sf/japi/io/args/converter/StringConverter.java 2007-08-12 20:46:18 UTC (rev 574) @@ -19,8 +19,8 @@ package net.sf.japi.io.args.converter; +import java.util.Locale; import org.jetbrains.annotations.NotNull; -import java.util.Locale; /** * Simple Converter which "converts" a String into a String by simply returning it. Modified: libs/argparser/trunk/src/test/net/sf/japi/io/args/CommandDummy.java =================================================================== --- libs/argparser/trunk/src/test/net/sf/japi/io/args/CommandDummy.java 2007-08-12 16:44:52 UTC (rev 573) +++ libs/argparser/trunk/src/test/net/sf/japi/io/args/CommandDummy.java 2007-08-12 20:46:18 UTC (rev 574) @@ -19,9 +19,9 @@ package test.net.sf.japi.io.args; +import java.util.List; import net.sf.japi.io.args.BasicCommand; import org.jetbrains.annotations.NotNull; -import java.util.List; /** * A simple BasicCommand implementation as a test mock. Modified: libs/argparser/trunk/src/test/net/sf/japi/io/args/RBMockCommand.java =================================================================== --- libs/argparser/trunk/src/test/net/sf/japi/io/args/RBMockCommand.java 2007-08-12 16:44:52 UTC (rev 573) +++ libs/argparser/trunk/src/test/net/sf/japi/io/args/RBMockCommand.java 2007-08-12 20:46:18 UTC (rev 574) @@ -19,9 +19,9 @@ package test.net.sf.japi.io.args; +import java.util.List; +import java.util.ResourceBundle; import net.sf.japi.io.args.BasicCommand; -import java.util.ResourceBundle; -import java.util.List; import org.jetbrains.annotations.NotNull; /** Modified: libs/argparser/trunk/src/test/net/sf/japi/io/args/TokenReaderTest.java =================================================================== --- libs/argparser/trunk/src/test/net/sf/japi/io/args/TokenReaderTest.java 2007-08-12 16:44:52 UTC (rev 573) +++ libs/argparser/trunk/src/test/net/sf/japi/io/args/TokenReaderTest.java 2007-08-12 20:46:18 UTC (rev 574) @@ -24,8 +24,8 @@ import java.util.NoSuchElementException; import net.sf.japi.io.args.TokenReader; import org.jetbrains.annotations.NotNull; +import org.junit.Assert; import org.junit.Test; -import org.junit.Assert; /** * Test for {@link TokenReader}. Modified: libs/argparser/trunk/src/test/net/sf/japi/io/args/converter/BooleanConverterTest.java =================================================================== --- libs/argparser/trunk/src/test/net/sf/japi/io/args/converter/BooleanConverterTest.java 2007-08-12 16:44:52 UTC (rev 573) +++ libs/argparser/trunk/src/test/net/sf/japi/io/args/converter/BooleanConverterTest.java 2007-08-12 20:46:18 UTC (rev 574) @@ -19,10 +19,10 @@ package test.net.sf.japi.io.args.converter; +import java.util.Locale; import net.sf.japi.io.args.converter.BooleanConverter; +import org.junit.Assert; import org.junit.Test; -import org.junit.Assert; -import java.util.Locale; /** * Tests for {@link BooleanConverter}. Modified: libs/logging/trunk/src/net/sf/japi/log/LoggerFactory.java =================================================================== --- libs/logging/trunk/src/net/sf/japi/log/LoggerFactory.java 2007-08-12 16:44:52 UTC (rev 573) +++ libs/logging/trunk/src/net/sf/japi/log/LoggerFactory.java 2007-08-12 20:46:18 UTC (rev 574) @@ -19,15 +19,14 @@ package net.sf.japi.log; +import static java.lang.Class.forName; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.util.HashMap; +import java.util.Map; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Map; -import java.util.HashMap; -import static java.lang.Class.*; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - /** * The LoggerFactory is used to instanciate a Logger of a specific implementation. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> Modified: libs/registry/trunk/src/net/sf/japi/registry/NamedRegistry.java =================================================================== --- libs/registry/trunk/src/net/sf/japi/registry/NamedRegistry.java 2007-08-12 16:44:52 UTC (rev 573) +++ libs/registry/trunk/src/net/sf/japi/registry/NamedRegistry.java 2007-08-12 20:46:18 UTC (rev 574) @@ -19,13 +19,13 @@ package net.sf.japi.registry; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; import sun.misc.Service; -import java.util.Iterator; -import java.util.Collection; -import java.util.List; -import java.util.ArrayList; /** * Lookup mechanism for {@link NamedService} implementations. Modified: libs/registry/trunk/src/net/sf/japi/registry/NamedService.java ====================================================... [truncated message content] |
From: <chr...@us...> - 2007-08-27 20:27:45
|
Revision: 599 http://japi.svn.sourceforge.net/japi/?rev=599&view=rev Author: christianhujer Date: 2007-08-27 13:27:43 -0700 (Mon, 27 Aug 2007) Log Message: ----------- Added German localization. Modified Paths: -------------- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/String2Bytes.java tools/string2bytes/trunk/src/net/sf/japi/string2bytes/action.properties Added Paths: ----------- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/action_de.properties Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/String2Bytes.java =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/String2Bytes.java 2007-08-27 13:42:01 UTC (rev 598) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/String2Bytes.java 2007-08-27 20:27:43 UTC (rev 599) @@ -189,7 +189,7 @@ */ @NotNull private JPanel createSettingsPanel() { final JPanel settingsPanel = new JPanel(); - settingsPanel.setBorder(BorderFactory.createTitledBorder("Settings")); + settingsPanel.setBorder(BorderFactory.createTitledBorder(ACTION_BUILDER.getString("border.settings.title"))); settingsPanel.add(createEncodingPanel()); return settingsPanel; } @@ -259,7 +259,7 @@ */ @NotNull private JPanel createCommandPanel() { final JPanel commandPanel = new JPanel(); - commandPanel.setBorder(BorderFactory.createTitledBorder("Commands")); + commandPanel.setBorder(BorderFactory.createTitledBorder(ACTION_BUILDER.getString("border.commands.title"))); commandPanel.add(new JButton(ACTION_BUILDER.getAction("convert"))); return commandPanel; } Modified: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/action.properties =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/action.properties 2007-08-27 13:42:01 UTC (rev 598) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/action.properties 2007-08-27 20:27:43 UTC (rev 599) @@ -50,6 +50,8 @@ border.encoding.title=Encoding border.input.title=Input border.output.title=Output +border.commands.title=Commands +border.settings.title=Settings about=<html><h1 align="center">String2Bytes</h1><p>Converter for Strings</p><table><tr><td valign="top" align="right" width="50%">Copyright \xA9 2007</td><td width="50%">Christian Hujer</td></tr><tr><td align="right">Java version:</td><td>{0}</td></tr><tr><td align="right">Build number:</td><td>{1}</td></tr><tr><td align="right">by:</td><td>{2}</td></tr><tr><td align="right">at:</td><td>{3}</td></tr></table></html> Added: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/action_de.properties =================================================================== --- tools/string2bytes/trunk/src/net/sf/japi/string2bytes/action_de.properties (rev 0) +++ tools/string2bytes/trunk/src/net/sf/japi/string2bytes/action_de.properties 2007-08-27 20:27:43 UTC (rev 599) @@ -0,0 +1,53 @@ +# +# String2Bytes is a program for converting Strings into byte arrays. +# Copyright (C) 2007 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., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +usingClipboardForInput.text=Zwischenablage +usingClipboardForInput.shortdescription=Benutze die Zwischenablage als Quelle (Eingabe) f\xFCr die Umwandlung + +clearInput.text=L\xF6schen +clearInput.shortdescription=L\xF6scht das Eingabefenster. + +usingClipboardForOutput.text=Zwischenablage +usingClipboardForOutput.shortdescription=Benutze die Zwischenablage als Ziel (Ausgabe) f\xFCr die Umwandlung + +clearOutput.text=L\xF6schen +clearOutput.shortdescription=L\xF6scht das Ausgabefenster. + +convert.text=Umwandeln +convert.shortdescription=Wandelt die Eingabe in die Ausgabe um. +convert.exception.java.io.UnsupportedEncodingException.title=Umwandlungsfehler +convert.exception.java.io.UnsupportedEncodingException.message=Nicht unterst\xFCtzte Kodierung: {0} + +encodingDefault.text=Voreinstellung +encodingDefault.shortdescription=Setzt die Kodierung auf die Voreinstellung zur\xFCck. + +encodingSystem.text=System +encodingSystem.shortdescription=Setzt die Kodierung auf den Systemwert zur\xFCck. + +border.encoding.title=Kodierung +border.input.title=Eingabe (Quelle) +border.output.title=Ausgabe (Ziel) +border.commands.title=Befehle +border.settings.title=Einstellungen + +about=<html><h1 align="center">String2Bytes</h1><p>Umwandler f\xFCr Strings</p><table><tr><td valign="top" align="right" width="50%">Copyright \xA9 2007</td><td width="50%">Christian Hujer</td></tr><tr><td align="right">Java version:</td><td>{0}</td></tr><tr><td align="right">Build number:</td><td>{1}</td></tr><tr><td align="right">by:</td><td>{2}</td></tr><tr><td align="right">at:</td><td>{3}</td></tr></table></html> + +file.text=Datei +about.text=\xDCber... +quit.text=Beenden Property changes on: tools/string2bytes/trunk/src/net/sf/japi/string2bytes/action_de.properties ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |