japi-cvs Mailing List for JAPI (Page 33)
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...> - 2007-09-23 15:57:39
|
Revision: 610 http://japi.svn.sourceforge.net/japi/?rev=610&view=rev Author: christianhujer Date: 2007-09-23 08:57:35 -0700 (Sun, 23 Sep 2007) Log Message: ----------- Fixed several code conventions issues. Modified Paths: -------------- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/AnswerText.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/MCAnswerText.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/MCQuestionText.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/OpenQuestionText.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/QuestionCollection.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/Settings.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/QuestionGUI.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/ReviewGUI.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/SettingsGUI.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/SolutionGUI.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/XMLUtils.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/HelpManager.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/ISwingUtilities.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/io/AbstractCachingImporter.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/io/EndingFileFilter.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/io/FilenameFileFilter.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/io/ImporterFileFilter.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/recent/PrefsRecentURLs.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/util/StringToTextComparatorAdapter.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/util/Text.java Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/AnswerText.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/AnswerText.java 2007-09-10 21:36:27 UTC (rev 609) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/AnswerText.java 2007-09-23 15:57:35 UTC (rev 610) @@ -98,6 +98,7 @@ /** Get the explanation for this answer. * Returns <code>null</code> if this answer has no explanation + * @return Explanation or <code>null</code> if this answer has no explanation. */ public Text getExplanation() { return explanation; Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/MCAnswerText.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/MCAnswerText.java 2007-09-10 21:36:27 UTC (rev 609) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/MCAnswerText.java 2007-09-23 15:57:35 UTC (rev 610) @@ -100,7 +100,7 @@ */ public static int countRightAnswers(final List<MCAnswerText> answers) { int right = 0; - for (MCAnswerText answer : answers) { + for (final MCAnswerText answer : answers) { if (answer.correct) { right++; } @@ -114,7 +114,7 @@ */ public static int countWrongAnswers(final List<MCAnswerText> answers) { int wrong = 0; - for (MCAnswerText answer : answers) { + for (final MCAnswerText answer : answers) { if (!answer.correct) { wrong++; } Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/MCQuestionText.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/MCQuestionText.java 2007-09-10 21:36:27 UTC (rev 609) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/MCQuestionText.java 2007-09-23 15:57:35 UTC (rev 610) @@ -132,7 +132,7 @@ */ public List<MCAnswerText> getRightAnswerTexts() { final List<MCAnswerText> right = new ArrayList<MCAnswerText>(); - for (MCAnswerText answer : answers) { + for (final MCAnswerText answer : answers) { if (answer.isCorrect()) { right.add(answer); } @@ -145,7 +145,7 @@ */ public List<MCAnswerText> getWrongAnswerTexts() { final List<MCAnswerText> wrong = new ArrayList<MCAnswerText>(); - for (MCAnswerText answer : answers) { + for (final MCAnswerText answer : answers) { if (!answer.isCorrect()) { wrong.add(answer); } @@ -177,9 +177,9 @@ final List<MCAnswerText> rightAnswers = getRightAnswerTexts(); final List<MCAnswerText> wrongAnswers = getWrongAnswerTexts(); final List<MCAnswerText> answerTexts = new ArrayList<MCAnswerText>(); - int rightAnswersLeft = rightAnswers.size(); + final int rightAnswersLeft = rightAnswers.size(); if (rightAnswersLeft > 0) { - answerTexts.add(rightAnswers.remove((int) (Math.random() * rightAnswersLeft--))); + answerTexts.add(rightAnswers.remove((int) (Math.random() * rightAnswersLeft))); } final List<MCAnswerText> allAnswers = new ArrayList<MCAnswerText>(); allAnswers.addAll(rightAnswers); @@ -196,7 +196,7 @@ */ @Override public boolean isAnsweredCorrectly() { boolean answeredCorrectly = true; - for (MCAnswerText answer : answers) { + for (final MCAnswerText answer : answers) { answeredCorrectly &= answer.isCheckedCorrectly(); } return answeredCorrectly; @@ -208,7 +208,7 @@ //noinspection CloneCallsConstructors clone.answers = new ArrayList<MCAnswerText>(answers); for (int i = 0, size = clone.answers.size(); i < size; i++) { - clone.answers.set(i, (MCAnswerText) clone.answers.get(i).clone()); + clone.answers.set(i, clone.answers.get(i).clone()); } return clone; } Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/OpenQuestionText.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/OpenQuestionText.java 2007-09-10 21:36:27 UTC (rev 609) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/OpenQuestionText.java 2007-09-23 15:57:35 UTC (rev 610) @@ -92,7 +92,7 @@ /** {@inheritDoc} */ @Override public boolean isAnsweredCorrectly() { - for (String expression : expressions) { + for (final String expression : expressions) { if (answer.matches(expression)) { return true; } Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/QuestionCollection.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/QuestionCollection.java 2007-09-10 21:36:27 UTC (rev 609) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/QuestionCollection.java 2007-09-23 15:57:35 UTC (rev 610) @@ -127,6 +127,7 @@ /** Get a Question from the Collection. * @param index Index of Question to get + * @return Question with the specified index. */ public QuestionText getQuestion(final int index) { return questions.get(index); @@ -261,7 +262,7 @@ */ public int countRightAnswers() { int n = 0; - for (QuestionText question : this) { + for (final QuestionText question : this) { if (question.isAnsweredCorrectly()) { n++; } @@ -274,7 +275,7 @@ */ public int countWrongAnswers() { int n = 0; - for (QuestionText question : this) { + for (final QuestionText question : this) { if (!question.isAnsweredCorrectly()) { n++; } Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/Settings.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/Settings.java 2007-09-10 21:36:27 UTC (rev 609) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/Settings.java 2007-09-23 15:57:35 UTC (rev 610) @@ -144,7 +144,7 @@ /** Inform all registered listeners that the list of recent urls changed. */ private void fireRecentURLsChanged() { final RecentURLsEvent e = new RecentURLsEvent(this); - for (RecentURLsListener listener : listeners) { + for (final RecentURLsListener listener : listeners) { listener.recentURLsChanged(e); } } Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/QuestionGUI.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/QuestionGUI.java 2007-09-10 21:36:27 UTC (rev 609) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/QuestionGUI.java 2007-09-23 15:57:35 UTC (rev 610) @@ -141,7 +141,7 @@ final List<MCAnswerText> answers = ((MCQuestionText)question).getAnswerTexts(); final ButtonGroup gp = ((MCQuestionText)question).countRightAnswers() == 1 ? new ButtonGroup() : null; int i = 1; - for (MCAnswerText answer : answers) { + for (final MCAnswerText answer : answers) { answersPanel.add(new AnswerGUI(answer, gp, i++), gbc); } } else if (question instanceof OpenQuestionText) { Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/ReviewGUI.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/ReviewGUI.java 2007-09-10 21:36:27 UTC (rev 609) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/ReviewGUI.java 2007-09-23 15:57:35 UTC (rev 610) @@ -80,7 +80,7 @@ reviews.removeAll(); checkBoxes = new JCheckBox[col.getSize()]; int i = 0; - for (QuestionText question : col) { + for (final QuestionText question : col) { reviews.add(new ReviewCheckbox(question, i++)); } invalidate(); Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/SettingsGUI.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/SettingsGUI.java 2007-09-10 21:36:27 UTC (rev 609) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/SettingsGUI.java 2007-09-23 15:57:35 UTC (rev 610) @@ -56,7 +56,9 @@ */ private JRadioButton showSolutionsOff; - /** Create a SettingsGUI. */ + /** Create a SettingsGUI. + * @param settings Settings to create a GUI for. + */ public SettingsGUI(final Settings settings) { setLayout(new FlowLayout()); final JPanel solutionPanel = new JPanel(new GridLayout(2, 1)); Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/SolutionGUI.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/SolutionGUI.java 2007-09-10 21:36:27 UTC (rev 609) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/SolutionGUI.java 2007-09-23 15:57:35 UTC (rev 610) @@ -87,7 +87,7 @@ public void setQuestionCollection(final QuestionCollection col) { final StringBuilder sb = new StringBuilder(); sb.append(HTML_START); - for (QuestionText question : col) { + for (final QuestionText question : col) { appendQuestion(sb, question); } sb @@ -127,7 +127,7 @@ */ private static StringBuilder appendMCQuestion(final StringBuilder sb, final MCQuestionText question) { sb.append("<ul>"); - for (MCAnswerText answer : question.getAnswerTexts()) { + for (final MCAnswerText answer : question.getAnswerTexts()) { sb.append("<li><span"); if (answer.isCorrect() && !answer.isCheckedCorrectly()) { sb.append(" class='not'"); Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/io/JTestSer.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/io/JTestSer.java 2007-09-10 21:36:27 UTC (rev 609) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/io/JTestSer.java 2007-09-23 15:57:35 UTC (rev 610) @@ -26,6 +26,7 @@ import java.io.InputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; +import java.io.OutputStream; import java.net.URL; import net.sf.japi.progs.jeduca.jtest.QuestionCollection; import net.sf.japi.progs.jeduca.swing.io.Exporter; @@ -62,11 +63,11 @@ * @throws IOException in case of I/O-problems */ public QuestionCollection load(final String uri) throws IOException { - InputStream in = null; + final InputStream in = new URL(uri).openStream(); try { - return load(in = new URL(uri).openStream()); + return load(in); } finally { - try { in.close(); } catch (Exception e) { /* ignore */ } in = null; + in.close(); } } @@ -89,12 +90,12 @@ * @throws IOException in case of I/O-problems */ public void save(final QuestionCollection col, final File f) throws IOException { - ObjectOutputStream out = null; + final OutputStream fout = new FileOutputStream(f); try { - out = new ObjectOutputStream(new FileOutputStream(f)); + final ObjectOutputStream out = new ObjectOutputStream(fout); out.writeObject(col); } finally { - try { out.close(); } catch (Exception e) { /* ignore */ } out = null; + fout.close(); } } @@ -109,6 +110,7 @@ } /** {@inheritDoc} */ + @Override protected boolean canLoadImpl(final String uri) { try { load(uri); Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/io/XMLUtils.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/io/XMLUtils.java 2007-09-10 21:36:27 UTC (rev 609) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/io/XMLUtils.java 2007-09-23 15:57:35 UTC (rev 610) @@ -35,14 +35,16 @@ /** Get an instance of XMLUtils. * @return instance of XMLUtils */ - public static final XMLUtils getInstance() { + public static XMLUtils getInstance() { return INSTANCE; } /** Quiet error handler. */ private DefaultHandler2 quietHandler = new DefaultHandler2(); - /** Get the quiet error handler. */ + /** Get the quiet error handler. + * @return The quiet error handler. + */ public DefaultHandler2 getQuietHandler() { return quietHandler; } Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/HelpManager.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/HelpManager.java 2007-09-10 21:36:27 UTC (rev 609) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/HelpManager.java 2007-09-23 15:57:35 UTC (rev 610) @@ -43,8 +43,12 @@ /** The HelpManager instances. */ private static Map<String,HelpManager> managers = new WeakHashMap<String,HelpManager>(); - /** Get a HelpManager. */ - public static final HelpManager getHelp(final String key) { + /** Get a HelpManager. + * If no HelpManager already exists, a new one will be created and remembered. + * @param key Key to get HelpManager for. + * @return HelpManager for <var>key</var>. + */ + public static HelpManager getHelp(final String key) { HelpManager help = managers.get(key); if (help == null) { help = new HelpManager(); @@ -70,7 +74,9 @@ dialog.add(new JScrollPane(helpView)); } - /** Show a URL. */ + /** Show a URL. + * @param url URL to show by this HelpManager. + */ public void show(final URL url) { try { helpView.setPage(url); @@ -86,6 +92,7 @@ } /** {@inheritDoc} */ + @Override public void windowClosing(final WindowEvent e) { hide(); } Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/ISwingUtilities.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/ISwingUtilities.java 2007-09-10 21:36:27 UTC (rev 609) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/ISwingUtilities.java 2007-09-23 15:57:35 UTC (rev 610) @@ -36,6 +36,7 @@ /** Create a toolbar. * @param name Name for toolbar * @param actions Actions to create toolbar from + * @return ToolBar for the specified actions. */ public static JToolBar createToolBar(final String name, final Action... actions) { final JToolBar toolBar = new JToolBar(name); @@ -50,6 +51,7 @@ /** Create a toolbar. * @param name Name for toolbar * @param actions Actions to create toolbar from + * @return ToolBar for the specified actions. */ public static JToolBar createToolBar(final String name, final Iterable<Action> actions) { final JToolBar toolBar = new JToolBar(name); Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/io/AbstractCachingImporter.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/io/AbstractCachingImporter.java 2007-09-10 21:36:27 UTC (rev 609) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/io/AbstractCachingImporter.java 2007-09-23 15:57:35 UTC (rev 610) @@ -58,7 +58,7 @@ public final boolean canLoad(final String uri) { Uptodate v = acceptable.get(uri); if (v == null) { acceptable.put(uri, v = new Uptodate()); } - long lastModified = lastMod(uri); + final long lastModified = lastMod(uri); if (lastModified != v.lastModified) { v.lastModified = lastModified; v.canLoad = canLoadImpl(uri); Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/io/EndingFileFilter.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/io/EndingFileFilter.java 2007-09-10 21:36:27 UTC (rev 609) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/io/EndingFileFilter.java 2007-09-23 15:57:35 UTC (rev 610) @@ -67,8 +67,9 @@ } /** {@inheritDoc} */ + @Override public boolean accept(final File f) { - String fileName = f.getName(); + final String fileName = f.getName(); boolean ret; if (negate) { ret = true; @@ -86,6 +87,7 @@ } /** {@inheritDoc} */ + @Override public String getDescription() { return description; } Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/io/FilenameFileFilter.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/io/FilenameFileFilter.java 2007-09-10 21:36:27 UTC (rev 609) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/io/FilenameFileFilter.java 2007-09-23 15:57:35 UTC (rev 610) @@ -68,7 +68,7 @@ /** {@inheritDoc} */ public boolean accept(final File f) { - String fileName = f.getName(); + final String fileName = f.getName(); boolean ret; if (negate) { ret = true; @@ -86,6 +86,7 @@ } /** {@inheritDoc} */ + @Override public String getDescription() { return description; } Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/io/ImporterFileFilter.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/io/ImporterFileFilter.java 2007-09-10 21:36:27 UTC (rev 609) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/io/ImporterFileFilter.java 2007-09-23 15:57:35 UTC (rev 610) @@ -53,17 +53,19 @@ /** Get an ImporterFileFilter. * @param importer Importer to get ImporterFileFilter for + * @return ImporterFileFilter for the specified Importer. */ - public static final <E> ImporterFileFilter<E> getInstanceFor(final Importer<E> importer) { - WeakReference<ImporterFileFilter<E>> ref = (WeakReference<ImporterFileFilter<E>>)(Object)filters.get(importer); - ImporterFileFilter<E> filter = null; - if (ref == null || (filter = (ImporterFileFilter<E>)ref.get()) == null) { + public static <E> ImporterFileFilter<E> getInstanceFor(final Importer<E> importer) { + final WeakReference<ImporterFileFilter<E>> ref = (WeakReference<ImporterFileFilter<E>>) (Object) filters.get(importer); + ImporterFileFilter<E> filter; + if (ref == null || (filter = ref.get()) == null) { filters.put(importer, new WeakReference<ImporterFileFilter>(filter = new ImporterFileFilter<E>(importer))); } return filter; } /** {@inheritDoc} */ + @Override public boolean accept(final File f) { boolean accept = f.isDirectory(); try { @@ -77,6 +79,7 @@ } /** {@inheritDoc} */ + @Override public String getDescription() { return importer.getName(); } @@ -92,10 +95,10 @@ * @param provider JTest IOModuleProvider to create FileFilters for * @return Collection with FileFilters */ - public static final <E> Collection<ImporterFileFilter<E>> createFileFilters(final IOModuleProvider<E> provider) { - List<ImporterFileFilter<E>> filters = new ArrayList<ImporterFileFilter<E>>(); + public static <E> Collection<ImporterFileFilter<E>> createFileFilters(final IOModuleProvider<E> provider) { + final List<ImporterFileFilter<E>> filters = new ArrayList<ImporterFileFilter<E>>(); filters.add(getInstanceFor(provider)); - for (Importer<E> importer : provider.getImporters()) { + for (final Importer<E> importer : provider.getImporters()) { filters.add(getInstanceFor(importer)); } return filters; @@ -106,8 +109,8 @@ * @param chooser JFileChooser to add FileFilters to * @todo recursively add filters for providers that reference providers */ - public static final <E> void attachFileFilters(final JFileChooser chooser, final IOModuleProvider<E> provider) { - for (ImporterFileFilter<E> filter : createFileFilters(provider)) { + public static <E> void attachFileFilters(final JFileChooser chooser, final IOModuleProvider<E> provider) { + for (final ImporterFileFilter<E> filter : createFileFilters(provider)) { chooser.addChoosableFileFilter(filter); } } Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/recent/PrefsRecentURLs.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/recent/PrefsRecentURLs.java 2007-09-10 21:36:27 UTC (rev 609) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/recent/PrefsRecentURLs.java 2007-09-23 15:57:35 UTC (rev 610) @@ -148,7 +148,7 @@ /** Inform all registered listeners that the list of recent urls changed. */ private void fireREcentURlsChanged() { final RecentURLsEvent e = new RecentURLsEvent(this); - for (RecentURLsListener listener : listeners) { + for (final RecentURLsListener listener : listeners) { listener.recentURLsChanged(e); } } Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/util/StringToTextComparatorAdapter.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/util/StringToTextComparatorAdapter.java 2007-09-10 21:36:27 UTC (rev 609) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/util/StringToTextComparatorAdapter.java 2007-09-23 15:57:35 UTC (rev 610) @@ -61,15 +61,17 @@ } /** {@inheritDoc} */ + @Override public boolean equals(final Object obj) { if ((obj == null) || !(obj instanceof StringToTextComparatorAdapter)) { return false; } - StringToTextComparatorAdapter a = (StringToTextComparatorAdapter) obj; + final StringToTextComparatorAdapter a = (StringToTextComparatorAdapter) obj; return (mime == null ? a.mime == null : mime.equals(a.mime)) && comp.equals(a.comp); } /** {@inheritDoc} */ + @Override public int hashCode() { int hc = 0; if (mime != null) { Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/util/Text.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/util/Text.java 2007-09-10 21:36:27 UTC (rev 609) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/util/Text.java 2007-09-23 15:57:35 UTC (rev 610) @@ -101,15 +101,17 @@ } /** {@inheritDoc} */ + @Override public boolean equals(final Object o) { if (o == null || !(o instanceof Text)) { return false; } - Text t = (Text) o; + final Text t = (Text) o; return type.equals(t.type) && text.equals(t.text); } /** {@inheritDoc} */ + @Override public int hashCode() { return type.hashCode() ^ text.hashCode(); } @@ -117,6 +119,7 @@ /** {@inheritDoc} * Simple returns the text the same way as {@link #getText()}. */ + @Override public String toString() { return text; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-09-10 21:36:31
|
Revision: 609 http://japi.svn.sourceforge.net/japi/?rev=609&view=rev Author: christianhujer Date: 2007-09-10 14:36:27 -0700 (Mon, 10 Sep 2007) Log Message: ----------- [ 1791713 ] quotation marks removed from @arg files [ 1791715 ] \" silently changed to \\ in argfiles Modified Paths: -------------- libs/argparser/trunk/src/net/sf/japi/io/args/TokenReader.java libs/argparser/trunk/src/test/net/sf/japi/io/args/TokenReaderTest.java Modified: libs/argparser/trunk/src/net/sf/japi/io/args/TokenReader.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/TokenReader.java 2007-09-09 17:21:28 UTC (rev 608) +++ libs/argparser/trunk/src/net/sf/japi/io/args/TokenReader.java 2007-09-10 21:36:27 UTC (rev 609) @@ -31,7 +31,13 @@ /** * A TokenReader reads arguments from a file, non-recursive. - * That means the arguments are read regarding a certain argument syntax, but remain otherwise unparsed. + * That means the arguments are read regarding a certain argument syntax which should match with bash-like Quoting, but remain otherwise unparsed. + * <h4>Quoting and Escaping</h4> + * <ul> + * <li>\ introduces an escape. The escape character will be ignored, and the character following the escape character looses its special meaning if any.</li> + * <li>" introduces a string. A string is ended with ". Inside a string, \ only escapes ".</li> + * <li>' introduces a literal string. A literal string is ended with '. Inside a literal string, only ' has special meaning.</li> + * </ul> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ public class TokenReader implements Closeable, Iterable<String>, Iterator<String> { @@ -99,6 +105,12 @@ } else if (c == '"') { mode = Mode.STRING; tokenValid = true; + } else if (c == '\'') { + mode = Mode.CHARS; + tokenValid = true; + } else if (c == '\\') { + mode = Mode.ESCAPE; + tokenValid = true; } else { nextToken.append(c); mode = Mode.NORMAL; @@ -112,6 +124,10 @@ return nextToken.toString(); } else if (c == '"') { mode = Mode.STRING; + } else if (c == '\'') { + mode = Mode.CHARS; + } else if (c == '\\') { + mode = Mode.ESCAPE; } else { nextToken.append(c); } @@ -126,9 +142,22 @@ } break; case STRING_ESCAPE: + if (c != '"') { + nextToken.append('\\'); + } nextToken.append(c); mode = Mode.STRING; break; + case ESCAPE: + nextToken.append(c); + mode = Mode.NORMAL; + break; + case CHARS: + if (c == '\'') { + mode = Mode.NORMAL; + } else { + nextToken.append(c); + } default: assert false; } @@ -152,7 +181,13 @@ STRING, /** String Escape - \ inside "". */ - STRING_ESCAPE - } + STRING_ESCAPE, + /** Secape - after \ but outside "". */ + ESCAPE, + + /** String - inside ''. */ + CHARS + } // enum Mode + } // class TokenReader 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-09-09 17:21:28 UTC (rev 608) +++ libs/argparser/trunk/src/test/net/sf/japi/io/args/TokenReaderTest.java 2007-09-10 21:36:27 UTC (rev 609) @@ -151,6 +151,148 @@ reader.next(); } + /** Tests that the TokenReader treats escaped quotes correctly. + * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1791713&group_id=149894&atid=776737">[ 1791713 ] quotation marks removed from @arg files</a> + * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1791715&group_id=149894&atid=776737">[ 1791715 ] \" silently changed to \\ in argfiles</a> + */ + @Test + public void testTokenEscapedQuotesRandom() { + final TokenReader reader = new TokenReader(createStream(" \\\" \\\" \\\" a\\\"a \"\\\"\" a\"\\\"\"a ")); + Assert.assertTrue("Before reading the last token, hasNext() must return true.", reader.hasNext()); + Assert.assertEquals("Expecting token", "\"", reader.next()); + Assert.assertTrue("Before reading the last token, hasNext() must return true.", reader.hasNext()); + Assert.assertEquals("Expecting token", "\"", reader.next()); + Assert.assertTrue("Before reading the last token, hasNext() must return true.", reader.hasNext()); + Assert.assertEquals("Expecting token", "\"", reader.next()); + Assert.assertTrue("Before reading the last token, hasNext() must return true.", reader.hasNext()); + Assert.assertEquals("Expecting token", "a\"a", reader.next()); + Assert.assertTrue("Before reading the last token, hasNext() must return true.", reader.hasNext()); + Assert.assertEquals("Expecting token", "\"", reader.next()); + Assert.assertTrue("Before reading the last token, hasNext() must return true.", reader.hasNext()); + Assert.assertEquals("Expecting token", "a\"a", reader.next()); + Assert.assertFalse("After reading the last token, hasNext() must return false.", reader.hasNext()); + } + + /** Tests that <samp>\n</samp> returns <samp>n</samp>. + * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1791713&group_id=149894&atid=776737">[ 1791713 ] quotation marks removed from @arg files</a> + * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1791715&group_id=149894&atid=776737">[ 1791715 ] \" silently changed to \\ in argfiles</a> + */ + @Test + public void testTokenReaderNormalEscape() { + final TokenReader reader = new TokenReader(createStream("\\n")); + Assert.assertTrue("Before reading the last token, hasNext() must return true.", reader.hasNext()); + Assert.assertEquals("Expecting token", "n", reader.next()); + Assert.assertFalse("After reading the last token, hasNext() must return false.", reader.hasNext()); + } + + /** Tests that <samp>\"</samp> returns <samp>"</samp>. + * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1791713&group_id=149894&atid=776737">[ 1791713 ] quotation marks removed from @arg files</a> + * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1791715&group_id=149894&atid=776737">[ 1791715 ] \" silently changed to \\ in argfiles</a> + */ + @Test + public void testTokenReaderNormalQuote() { + final TokenReader reader = new TokenReader(createStream("\\\"")); + Assert.assertTrue("Before reading the last token, hasNext() must return true.", reader.hasNext()); + Assert.assertEquals("Expecting token", "\"", reader.next()); + Assert.assertFalse("After reading the last token, hasNext() must return false.", reader.hasNext()); + } + + /** Tests that <samp>\'</samp> returns <samp>'</samp>. + * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1791713&group_id=149894&atid=776737">[ 1791713 ] quotation marks removed from @arg files</a> + * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1791715&group_id=149894&atid=776737">[ 1791715 ] \" silently changed to \\ in argfiles</a> + */ + @Test + public void testTokenReaderNormalApos() { + final TokenReader reader = new TokenReader(createStream("\\'")); + Assert.assertTrue("Before reading the last token, hasNext() must return true.", reader.hasNext()); + Assert.assertEquals("Expecting token", "'", reader.next()); + Assert.assertFalse("After reading the last token, hasNext() must return false.", reader.hasNext()); + } + + /** Tests that <samp>"\n"</samp> returns <samp>\n</samp>. + * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1791713&group_id=149894&atid=776737">[ 1791713 ] quotation marks removed from @arg files</a> + * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1791715&group_id=149894&atid=776737">[ 1791715 ] \" silently changed to \\ in argfiles</a> + */ + @Test + public void testTokenReaderQuotesEscape() { + final TokenReader reader = new TokenReader(createStream("\"\\n\"")); + Assert.assertTrue("Before reading the last token, hasNext() must return true.", reader.hasNext()); + Assert.assertEquals("Expecting token", "\\n", reader.next()); + Assert.assertFalse("After reading the last token, hasNext() must return false.", reader.hasNext()); + } + + /** Tests that <samp>"\""</samp> returns <samp>"</samp>. + * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1791713&group_id=149894&atid=776737">[ 1791713 ] quotation marks removed from @arg files</a> + * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1791715&group_id=149894&atid=776737">[ 1791715 ] \" silently changed to \\ in argfiles</a> + */ + @Test + public void testTokenReaderQuotesQuote() { + final TokenReader reader = new TokenReader(createStream("\"\\\"\"")); + Assert.assertTrue("Before reading the last token, hasNext() must return true.", reader.hasNext()); + Assert.assertEquals("Expecting token", "\"", reader.next()); + Assert.assertFalse("After reading the last token, hasNext() must return false.", reader.hasNext()); + } + + /** Tests that <samp>"'"</samp> returns <samp>'</samp>. + * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1791713&group_id=149894&atid=776737">[ 1791713 ] quotation marks removed from @arg files</a> + * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1791715&group_id=149894&atid=776737">[ 1791715 ] \" silently changed to \\ in argfiles</a> + */ + @Test + public void testTokenReaderQuotesApos1() { + final TokenReader reader = new TokenReader(createStream("\"'\"")); + Assert.assertTrue("Before reading the last token, hasNext() must return true.", reader.hasNext()); + Assert.assertEquals("Expecting token", "'", reader.next()); + Assert.assertFalse("After reading the last token, hasNext() must return false.", reader.hasNext()); + } + + /** Tests that <samp>"\'"</samp> returns <samp>\'</samp>. + * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1791713&group_id=149894&atid=776737">[ 1791713 ] quotation marks removed from @arg files</a> + * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1791715&group_id=149894&atid=776737">[ 1791715 ] \" silently changed to \\ in argfiles</a> + */ + @Test + public void testTokenReaderQuotesApos2() { + final TokenReader reader = new TokenReader(createStream("\"\\'\"")); + Assert.assertTrue("Before reading the last token, hasNext() must return true.", reader.hasNext()); + Assert.assertEquals("Expecting token", "\\'", reader.next()); + Assert.assertFalse("After reading the last token, hasNext() must return false.", reader.hasNext()); + } + + /** Tests that <samp>'\n'</samp> returns <samp>\n</samp>. + * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1791713&group_id=149894&atid=776737">[ 1791713 ] quotation marks removed from @arg files</a> + * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1791715&group_id=149894&atid=776737">[ 1791715 ] \" silently changed to \\ in argfiles</a> + */ + @Test + public void testTokenReaderAposEscape1() { + final TokenReader reader = new TokenReader(createStream("'\\n'")); + Assert.assertTrue("Before reading the last token, hasNext() must return true.", reader.hasNext()); + Assert.assertEquals("Expecting token", "\\n", reader.next()); + Assert.assertFalse("After reading the last token, hasNext() must return false.", reader.hasNext()); + } + + /** Tests that <samp>'\\'</samp> returns <samp>\\</samp>. + * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1791713&group_id=149894&atid=776737">[ 1791713 ] quotation marks removed from @arg files</a> + * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1791715&group_id=149894&atid=776737">[ 1791715 ] \" silently changed to \\ in argfiles</a> + */ + @Test + public void testTokenReaderAposEscape2() { + final TokenReader reader = new TokenReader(createStream("'\\\\'")); + Assert.assertTrue("Before reading the last token, hasNext() must return true.", reader.hasNext()); + Assert.assertEquals("Expecting token", "\\\\", reader.next()); + Assert.assertFalse("After reading the last token, hasNext() must return false.", reader.hasNext()); + } + + /** Tests that <samp>'"'</samp> returns <samp>"</samp>. + * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1791713&group_id=149894&atid=776737">[ 1791713 ] quotation marks removed from @arg files</a> + * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1791715&group_id=149894&atid=776737">[ 1791715 ] \" silently changed to \\ in argfiles</a> + */ + @Test + public void testTokenReaderAposQuote() { + final TokenReader reader = new TokenReader(createStream("'\"'")); + Assert.assertTrue("Before reading the last token, hasNext() must return true.", reader.hasNext()); + Assert.assertEquals("Expecting token", "\"", reader.next()); + Assert.assertFalse("After reading the last token, hasNext() must return false.", reader.hasNext()); + } + /** Creates an InputStream for reading from a String. * @param s String to read from. * @return InputStream created from s. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-09-09 17:21:30
|
Revision: 608 http://japi.svn.sourceforge.net/japi/?rev=608&view=rev Author: christianhujer Date: 2007-09-09 10:21:28 -0700 (Sun, 09 Sep 2007) Log Message: ----------- Updating argparser documentation. Now includes requirements. Modified Paths: -------------- libs/argparser/trunk/src/doc/guide/start.xhtml libs/argparser/trunk/src/doc/start.xhtml Added Paths: ----------- libs/argparser/trunk/src/doc/requirements.xhtml Modified: libs/argparser/trunk/src/doc/guide/start.xhtml =================================================================== --- libs/argparser/trunk/src/doc/guide/start.xhtml 2007-09-09 16:32:16 UTC (rev 607) +++ libs/argparser/trunk/src/doc/guide/start.xhtml 2007-09-09 17:21:28 UTC (rev 608) @@ -1,4 +1,4 @@ - +<?xml version="1.0" encoding="utf-8"?> <!-- ~ JAPI libs-argparser is a library for parsing command line arguments. ~ Copyright (C) 2007 Christian Hujer. @@ -36,7 +36,11 @@ The primary target audience are Java developers that write Java programs that have a command line interface. </p> <p> - When writing a program that understands command line + When writing a program that understands command line the basic question is how to pass options and arguments. + There are several requirements that most command line programs should meet: </p> + <ul> + <li>The order of options should not matter.</li> + </ul> </body> </html> Added: libs/argparser/trunk/src/doc/requirements.xhtml =================================================================== --- libs/argparser/trunk/src/doc/requirements.xhtml (rev 0) +++ libs/argparser/trunk/src/doc/requirements.xhtml 2007-09-09 17:21:28 UTC (rev 608) @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ JAPI libs-argparser is a library for parsing command line arguments. + ~ Copyright (C) 2007 Christian Hujer. + ~ + ~ This library is free software; you can redistribute it and/or + ~ modify it under the terms of the GNU Lesser General Public + ~ License as published by the Free Software Foundation; either + ~ version 2.1 of the License, or (at your option) any later version. + ~ + ~ This library is distributed in the hope that it will be useful, + ~ but WITHOUT ANY WARRANTY; without even the implied warranty of + ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + ~ Lesser General Public License for more details. + ~ + ~ You should have received a copy of the GNU Lesser General Public + ~ License along with this library; if not, write to the Free Software + ~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + --> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> + <head> + <title>JAPI Lib ArgParser - Requirements</title> + </head> + <body> + <h1>JAPI Lib ArgParser - Requirements</h1> + <ul> + <li> + REQ001: + The library MUST provide option parsing. + Options start with a "-"-character. + Every option has a unique name. + A name that consists of a single letter is called short option. + A name that consists of more than one letter is called long option. + </li> + <li> + REQ002: + Optional options MUST be possible. + It MUST be possible to declare an option as optional. + An optional option may be omitted. + If an optional option is omitted, the library MUST simply ignore that option. + If an optional option is specified, the library MUST handle the option properly. + </li> + <li> + REQ003: + Mandatory options MUST be possible. + It MUST be possible to declare an option as mandatory. + A mandatory options must not be omitted. + If a mandatory option is omitted, the library MUST NOT process the command. + If a mandatory option is specified, the library MUST handle the option properly. + </li> + <li> + REQ004: + Terminating options MUST be possible. + It MUST be possible to declare an option as terminating. + A terminating option may be omitted. + </li> + <li> + REQ005: + The library MUST support i18n/l10n. + </li> + <li> + REQ006: + Options with names which consist of non-ASCII characters MUST be rejected. + </li> + <li> + REQ007: + It SHOULD be possible to concatenate multiple short options in a single option that looks like a long option starting with one dash. + </li> + <li> + REQ008: + Options that start with two dashs MUST always be treated as long options. + </li> + <li> + REQ009: + If an option that starts with a single dash is not recognized as a long option it SHOULD be treated as concatenated short options. + If treating it as concatenated short options fails, the option SHOULD be reported as unrecognized long option. + </li> + </ul> + </body> +</html> Property changes on: libs/argparser/trunk/src/doc/requirements.xhtml ___________________________________________________________________ Name: svn:mime-type + text/html Name: svn:eol-style + LF Modified: libs/argparser/trunk/src/doc/start.xhtml =================================================================== --- libs/argparser/trunk/src/doc/start.xhtml 2007-09-09 16:32:16 UTC (rev 607) +++ libs/argparser/trunk/src/doc/start.xhtml 2007-09-09 17:21:28 UTC (rev 608) @@ -38,11 +38,13 @@ <li>Bean-like reflective / introspective usage</li> <li>Java standard <abbr>i18n</abbr> / <abbr>l10n</abbr> support using properties files</li> <li>Short (e.g. <code>-f</code>) and long (e.g. <code>--filename</code>) options</li> - <li>Allow long options to be written as <code>--option value</code> as well as <code>--option=value</code></li> + <li>Allow long options to be written with one or two dashes, with or without equals sign: <code>-option value</code>, <code>--option value</code>, <code>-option=value</code> and <code>--option=value</code> are all valid.</li> <li>Concatenation of short options (e.g. <code>-fiz</code> for <code>-f -i -z</code>)</li> - <li>Automatic built-in help (<code>-h</code> and <code>--help</code>)</li> + <li>Automatic built-in help (<code>-h</code>, <code>-help</code> and <code>--help</code>)</li> <li>Mandatory and optional options / switches</li> <li>Automatic conversion of command line arguments to relevant Java types</li> + <li>The order of options does not matter.</li> + <li>Optional logging and log level setting (<code>-l level</code>)</li> </ul> <h2>Target Audience</h2> <ul> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-09-09 16:32:20
|
Revision: 607 http://japi.svn.sourceforge.net/japi/?rev=607&view=rev Author: christianhujer Date: 2007-09-09 09:32:16 -0700 (Sun, 09 Sep 2007) Log Message: ----------- Updated site documentation. Modified Paths: -------------- site/trunk/src/doc/start.xhtml Modified: site/trunk/src/doc/start.xhtml =================================================================== --- site/trunk/src/doc/start.xhtml 2007-09-09 12:07:40 UTC (rev 606) +++ site/trunk/src/doc/start.xhtml 2007-09-09 16:32:16 UTC (rev 607) @@ -28,6 +28,16 @@ JAPI gets additions for financial calculations. New project member z0ra is adding some classes including unit tests to perform financial calculations with JAPI. </p> + <h2>The JAPI sub projects</h2> + <p> + Because of its size and diversity, JAPI has undergone a major refactoring and is now split into several subprojects. + </p> + <dl> + <dt><a href="lib-argparser">JAPI Lib ArgParser</a></dt> + <dd> + JAPI Lib ArgParser is ... (TODO automate this). + </dd> + </dl> <h2>Download JAPI</h2> <p> To <em>download JAPI</em>, go to the <a href="http://sourceforge.net/project/showfiles.php?group_id=149894">Files section of the JAPI Project Page</a>, choose the desired package, release and file type and download it from a mirror of your choice. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-09-09 12:07:42
|
Revision: 606 http://japi.svn.sourceforge.net/japi/?rev=606&view=rev Author: christianhujer Date: 2007-09-09 05:07:40 -0700 (Sun, 09 Sep 2007) Log Message: ----------- Removed unused property. It was in the wrong module, should have been in libs-swing-misc instead. Modified Paths: -------------- libs/swing-tod/trunk/src/net/sf/japi/swing/tod/action.properties libs/swing-tod/trunk/src/net/sf/japi/swing/tod/action_de.properties Modified: libs/swing-tod/trunk/src/net/sf/japi/swing/tod/action.properties =================================================================== --- libs/swing-tod/trunk/src/net/sf/japi/swing/tod/action.properties 2007-09-09 11:56:04 UTC (rev 605) +++ libs/swing-tod/trunk/src/net/sf/japi/swing/tod/action.properties 2007-09-09 12:07:40 UTC (rev 606) @@ -46,7 +46,6 @@ todsUnavailable=No Tips Of The Day available todHeading=Did you know? todIndex=Showing Tip Of The Day {0} of {1}. -optionsChooseFile.icon=general/Open16 saxErrorClear.text=Clear saxErrorClose.text=Close saxError.title=XML Errors Modified: libs/swing-tod/trunk/src/net/sf/japi/swing/tod/action_de.properties =================================================================== --- libs/swing-tod/trunk/src/net/sf/japi/swing/tod/action_de.properties 2007-09-09 11:56:04 UTC (rev 605) +++ libs/swing-tod/trunk/src/net/sf/japi/swing/tod/action_de.properties 2007-09-09 12:07:40 UTC (rev 606) @@ -46,7 +46,6 @@ todsUnavailable=Keine Tipps des Tages verf\xFCgbar todHeading=Wussten Sie schon? todIndex=Zeige Tipp des Tages {0} aus {1}. -optionsChooseFile.icon=general/Open16 dialogDontShowAgain=Show this dialog again next time. saxError.title=XML Fehler saxErrorClear.text=L\xF6schen This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-09-09 11:56:07
|
Revision: 605 http://japi.svn.sourceforge.net/japi/?rev=605&view=rev Author: christianhujer Date: 2007-09-09 04:56:04 -0700 (Sun, 09 Sep 2007) Log Message: ----------- Fixed bug in swing misc with icon for JFileChooserButton not being found. Modified Paths: -------------- libs/swing-misc/trunk/src/net/sf/japi/swing/misc/JFileChooserButton.java Added Paths: ----------- libs/swing-misc/trunk/src/net/sf/japi/swing/misc/action.properties Modified: libs/swing-misc/trunk/src/net/sf/japi/swing/misc/JFileChooserButton.java =================================================================== --- libs/swing-misc/trunk/src/net/sf/japi/swing/misc/JFileChooserButton.java 2007-09-09 10:50:01 UTC (rev 604) +++ libs/swing-misc/trunk/src/net/sf/japi/swing/misc/JFileChooserButton.java 2007-09-09 11:56:04 UTC (rev 605) @@ -35,7 +35,7 @@ public class JFileChooserButton extends JButton { /** Action Builder. */ - private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.japi.swing"); + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.japi.swing.misc"); /** The JTextField to read/write the file path to. * @serial include Added: libs/swing-misc/trunk/src/net/sf/japi/swing/misc/action.properties =================================================================== --- libs/swing-misc/trunk/src/net/sf/japi/swing/misc/action.properties (rev 0) +++ libs/swing-misc/trunk/src/net/sf/japi/swing/misc/action.properties 2007-09-09 11:56:04 UTC (rev 605) @@ -0,0 +1,20 @@ +# +# JAPI libs-swing-misc is a library that holds miscellaneous additions to Swing. +# Copyright (C) 2007 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 +# + +optionsChooseFile.icon=general/Open16 Property changes on: libs/swing-misc/trunk/src/net/sf/japi/swing/misc/action.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. |
From: <chr...@us...> - 2007-09-09 10:50:04
|
Revision: 604 http://japi.svn.sourceforge.net/japi/?rev=604&view=rev Author: christianhujer Date: 2007-09-09 03:50:01 -0700 (Sun, 09 Sep 2007) Log Message: ----------- Added some more todos. Modified Paths: -------------- libs/argparser/trunk/src/net/sf/japi/io/args/ArgParser.java Modified: libs/argparser/trunk/src/net/sf/japi/io/args/ArgParser.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/ArgParser.java 2007-09-08 20:23:33 UTC (rev 603) +++ libs/argparser/trunk/src/net/sf/japi/io/args/ArgParser.java 2007-09-09 10:50:01 UTC (rev 604) @@ -45,6 +45,9 @@ * @todo automatic printout of default values if property getter available. * @todo Add -W long for gnu style long option parsing * @todo Let the programmer choose whether long options with one dash should be supported (for Ragnor). If long options with one dash are supported, short option concatenation should be disabled. + * @todo Abbreviation of long options as long as the abbreviation is unique + * @todo Treat a single dash not as option + * @todo Alternative way of getting arguments by a callback mechanism which processes single arguments. */ public final class ArgParser { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-09-08 20:23:35
|
Revision: 603 http://japi.svn.sourceforge.net/japi/?rev=603&view=rev Author: christianhujer Date: 2007-09-08 13:23:33 -0700 (Sat, 08 Sep 2007) Log Message: ----------- Improved setting the log level, added setting the log configuration. This is still beta. Use with care. Modified Paths: -------------- libs/argparser/trunk/src/net/sf/japi/io/args/LogCommand.java Modified: libs/argparser/trunk/src/net/sf/japi/io/args/LogCommand.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/LogCommand.java 2007-09-08 20:22:46 UTC (rev 602) +++ libs/argparser/trunk/src/net/sf/japi/io/args/LogCommand.java 2007-09-08 20:23:33 UTC (rev 603) @@ -19,7 +19,12 @@ package net.sf.japi.io.args; +import java.io.ByteArrayInputStream; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; import java.util.logging.Level; +import java.util.logging.LogManager; import java.util.logging.Logger; import org.jetbrains.annotations.NotNull; @@ -47,11 +52,29 @@ /** Sets the log level to log. * @param level LogLevel to log. */ - @Option({"l", "level"}) + @Option({"l", "loglevel"}) public void setLevel(@NotNull final Level level) { - log.setLevel(level); + try { + LogManager.getLogManager().readConfiguration(new ByteArrayInputStream((".level=" + level + "\nhandlers=java.util.logging.ConsoleHandler\njava.util.logging.ConsoleHandler.level=" + level).getBytes())); + } catch (final IOException e) { + assert false : "This should never happen because we're reading from RAM."; + } } + /** Initializes the logging system from a properties file. + * @param filename Filename of the file to initialize the logging system with. + * @throws IOException In case of I/O problems reading the properties file. + */ + @Option({"L", "logconfig"}) + public void setLogConfig(@NotNull final String filename) throws IOException { + final InputStream in = new FileInputStream(filename); + try { + LogManager.getLogManager().readConfiguration(in); + } finally { + in.close(); + } + } + /** Returns the logger. * @return The Logger. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-09-08 20:22:48
|
Revision: 602 http://japi.svn.sourceforge.net/japi/?rev=602&view=rev Author: christianhujer Date: 2007-09-08 13:22:46 -0700 (Sat, 08 Sep 2007) Log Message: ----------- Improved documentation. Modified Paths: -------------- libs/argparser/trunk/src/net/sf/japi/io/args/package-info.java Modified: libs/argparser/trunk/src/net/sf/japi/io/args/package-info.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/package-info.java 2007-09-08 20:22:18 UTC (rev 601) +++ libs/argparser/trunk/src/net/sf/japi/io/args/package-info.java 2007-09-08 20:22:46 UTC (rev 602) @@ -34,6 +34,10 @@ * If short options take argument values and they are concatenated, the argument values are separate strings following the concatenated option in exactly the order of the concatenated options. * In <samp>-io foo bar</samp>, given that both, <samp>i</samp> and <samp>o</samp> take an argument value, <samp>foo</samp> is value for <samp>i</samp>, while <samp>bar</samp> is value for <samp>o</samp>. * <p/> + * If there is an ambiguity between concatenated short options and a long option of the same name, the long option takes precedence. + * Users be warned: this ambiguity may cause trouble to you if you use programs in batches and then update them. + * One day -xyz means -x -y -z, the other day after updating the program introduced long option xyz, -xyz means --xyz. + * <p/> * The special option <code>--</code> will stop argument parsing. * All strings that follow the <code>--</code>-option are treated as command arguments, not options, even if they start with <code>-</code>. * <p/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-09-08 20:22:23
|
Revision: 601 http://japi.svn.sourceforge.net/japi/?rev=601&view=rev Author: christianhujer Date: 2007-09-08 13:22:18 -0700 (Sat, 08 Sep 2007) Log Message: ----------- Added todos about -W and long options with one dash. Modified Paths: -------------- libs/argparser/trunk/src/net/sf/japi/io/args/ArgParser.java Modified: libs/argparser/trunk/src/net/sf/japi/io/args/ArgParser.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/ArgParser.java 2007-08-27 20:42:02 UTC (rev 600) +++ libs/argparser/trunk/src/net/sf/japi/io/args/ArgParser.java 2007-09-08 20:22:18 UTC (rev 601) @@ -43,6 +43,8 @@ * @todo better handling of boolean arguments * @todo Handling of - for STDIN as input argument filestream * @todo automatic printout of default values if property getter available. + * @todo Add -W long for gnu style long option parsing + * @todo Let the programmer choose whether long options with one dash should be supported (for Ragnor). If long options with one dash are supported, short option concatenation should be disabled. */ public final class ArgParser { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-09-02 08:07:10
|
Revision: 596 http://japi.svn.sourceforge.net/japi/?rev=596&view=rev Author: christianhujer Date: 2007-08-27 05:32:44 -0700 (Mon, 27 Aug 2007) Log Message: ----------- Added log() method to LogCommand for convenience. Modified Paths: -------------- libs/argparser/trunk/src/net/sf/japi/io/args/LogCommand.java 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-24 08:02:10 UTC (rev 595) +++ libs/argparser/trunk/src/net/sf/japi/io/args/LogCommand.java 2007-08-27 12:32:44 UTC (rev 596) @@ -59,4 +59,13 @@ return log; } + /** Log something. + * @param level Level to log. + * @param key Message key. + * @param args Message arguments + */ + protected void log(@NotNull final Level level, @NotNull final String key, @NotNull final Object... args) { + log.log(level, key, args); + } + } // class LogCommand This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-08-27 20:42:05
|
Revision: 600 http://japi.svn.sourceforge.net/japi/?rev=600&view=rev Author: christianhujer Date: 2007-08-27 13:42:02 -0700 (Mon, 27 Aug 2007) Log Message: ----------- Cosmetic: Added missing javadoc, final modifier. Modified Paths: -------------- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/io/IOModuleProvider.java Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/io/IOModuleProvider.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/io/IOModuleProvider.java 2007-08-27 20:27:43 UTC (rev 599) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/io/IOModuleProvider.java 2007-08-27 20:42:02 UTC (rev 600) @@ -51,7 +51,9 @@ /** Map with instances. */ private static final Map<Class<?>,IOModuleProvider<?>> providers = new HashMap<Class<?>,IOModuleProvider<?>>(); - /** Create a new IOModuleProvider. */ + /** Create a new IOModuleProvider. + * @param type Type to im- or export with this IOModuleProvider. + */ private IOModuleProvider(final Class<T> type) { this.type = type; exporters = new ArrayList<Exporter<T>>(); @@ -105,7 +107,7 @@ * @throws SAXException in case of XML problems */ public T load(final String url) throws IOException, SAXException { - for (Importer<T> module : importers) { + for (final Importer<T> module : importers) { if (module.canLoad(url)) { System.err.println(module); return module.load(url); @@ -150,7 +152,7 @@ /** {@inheritDoc} */ public boolean canLoad(final String url) { - for (Importer<T> module : importers) { + for (final Importer<T> module : importers) { if (module.canLoad(url)) { return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <chr...@us...> - 2007-08-27 18:21:49
|
Revision: 597 http://japi.svn.sourceforge.net/japi/?rev=597&view=rev Author: christianhujer Date: 2007-08-27 06:24:12 -0700 (Mon, 27 Aug 2007) Log Message: ----------- Changed JWGet to be a LogCommand. Modified Paths: -------------- tools/jwget/trunk/src/net/sf/japi/jwget/JWGet.java Added Paths: ----------- tools/jwget/trunk/src/net/sf/japi/jwget/JWGet.properties tools/jwget/trunk/src/net/sf/japi/jwget/JWGet_de.properties Modified: tools/jwget/trunk/src/net/sf/japi/jwget/JWGet.java =================================================================== --- tools/jwget/trunk/src/net/sf/japi/jwget/JWGet.java 2007-08-27 12:32:44 UTC (rev 596) +++ tools/jwget/trunk/src/net/sf/japi/jwget/JWGet.java 2007-08-27 13:24:12 UTC (rev 597) @@ -27,14 +27,16 @@ import java.net.URL; import java.net.URLConnection; import java.util.List; +import java.util.logging.Level; import net.sf.japi.io.args.ArgParser; -import net.sf.japi.io.args.BasicCommand; +import net.sf.japi.io.args.LogCommand; import org.jetbrains.annotations.NotNull; -/** WGet implementation in Java. +/** + * WGet implementation in Java. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public class JWGet extends BasicCommand { +public class JWGet extends LogCommand { /** Size of the I/O buffer. */ private static final int BUF_SIZE = 8192; @@ -50,7 +52,7 @@ public int run(@NotNull final List<String> args) throws Exception { int returnCode = 0; if (args.size() == 0) { - System.err.println("Usage: JWGet url..."); + log(Level.SEVERE, "noarguments"); returnCode++; } final byte[] buf = new byte[BUF_SIZE]; @@ -62,7 +64,7 @@ try { final String location = con.getHeaderField("Content-Location"); final String outputFilename = new File((location != null ? new URL(url, location) : url).getFile()).getName(); - System.err.println(outputFilename); + log(Level.INFO, "writing", arg, outputFilename); final OutputStream out = new FileOutputStream(outputFilename); try { for (int bytesRead; (bytesRead = in.read(buf)) != -1; ) { @@ -75,7 +77,7 @@ in.close(); } } catch (final IOException e) { - System.err.println(e); + log(Level.WARNING, "cannotopen", arg, e); returnCode++; } } Added: tools/jwget/trunk/src/net/sf/japi/jwget/JWGet.properties =================================================================== --- tools/jwget/trunk/src/net/sf/japi/jwget/JWGet.properties (rev 0) +++ tools/jwget/trunk/src/net/sf/japi/jwget/JWGet.properties 2007-08-27 13:24:12 UTC (rev 597) @@ -0,0 +1,22 @@ +# +# JWGet is a simple Java implementation of the unix command wget. +# 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. +# + +cannotopen=Can''t open {0}, reason: {1}. +noarguments=No arguments given. +writing=Writing {0} to file "{1}". Property changes on: tools/jwget/trunk/src/net/sf/japi/jwget/JWGet.properties ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: tools/jwget/trunk/src/net/sf/japi/jwget/JWGet_de.properties =================================================================== --- tools/jwget/trunk/src/net/sf/japi/jwget/JWGet_de.properties (rev 0) +++ tools/jwget/trunk/src/net/sf/japi/jwget/JWGet_de.properties 2007-08-27 13:24:12 UTC (rev 597) @@ -0,0 +1,22 @@ +# +# JWGet is a simple Java implementation of the unix command wget. +# 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. +# + +cannotopen=Kann {0} nicht \xF6ffnen, Grund: {1}. +noarguments=Keine Argumente. +writing=Schreibe {0} in Datei "{1}". Property changes on: tools/jwget/trunk/src/net/sf/japi/jwget/JWGet_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. |
From: <chr...@us...> - 2007-08-27 13:54:14
|
Revision: 598 http://japi.svn.sourceforge.net/japi/?rev=598&view=rev Author: christianhujer Date: 2007-08-27 06:42:01 -0700 (Mon, 27 Aug 2007) Log Message: ----------- Changed FindLongestPath to use new log() method from LogCommand. Modified Paths: -------------- tools/findLongestPath/trunk/src/net/sf/japi/findLongestPath/FindLongestPath.java Modified: tools/findLongestPath/trunk/src/net/sf/japi/findLongestPath/FindLongestPath.java =================================================================== --- tools/findLongestPath/trunk/src/net/sf/japi/findLongestPath/FindLongestPath.java 2007-08-27 13:24:12 UTC (rev 597) +++ tools/findLongestPath/trunk/src/net/sf/japi/findLongestPath/FindLongestPath.java 2007-08-27 13:42:01 UTC (rev 598) @@ -104,7 +104,7 @@ maxPathname = pathname; } if (path.isDirectory()) { - getLog().log(Level.FINE, "descending", path); + log(Level.FINE, "descending", path); for (final File child : path.listFiles()) { find(child); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-08-24 08:02:15
|
Revision: 595 http://japi.svn.sourceforge.net/japi/?rev=595&view=rev Author: christianhujer Date: 2007-08-24 01:02:10 -0700 (Fri, 24 Aug 2007) Log Message: ----------- Fixed test that was not in sync with latest ArgParser change (ArgumentFileNotFoundException). Modified Paths: -------------- libs/argparser/trunk/src/test/net/sf/japi/io/args/ArgParserTest.java Modified: libs/argparser/trunk/src/test/net/sf/japi/io/args/ArgParserTest.java =================================================================== --- libs/argparser/trunk/src/test/net/sf/japi/io/args/ArgParserTest.java 2007-08-23 21:44:36 UTC (rev 594) +++ libs/argparser/trunk/src/test/net/sf/japi/io/args/ArgParserTest.java 2007-08-24 08:02:10 UTC (rev 595) @@ -23,6 +23,7 @@ import java.util.List; import java.util.Set; import net.sf.japi.io.args.ArgParser; +import net.sf.japi.io.args.ArgumentFileNotFoundException; import net.sf.japi.io.args.BasicCommand; import net.sf.japi.io.args.Command; import net.sf.japi.io.args.MissingArgumentException; @@ -88,9 +89,10 @@ * @throws TerminalException (unexpected) * @throws UnknownOptionException (unexpected) * @throws MissingArgumentException (unexpected) + * @throws ArgumentFileNotFoundException (unexpected) */ @Test - public void testCommandWithShortOption() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException { + public void testCommandWithShortOption() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException, ArgumentFileNotFoundException { final MockCommand command = new MockCommand(); ArgParser.parseAndRun(command, "-i", "fooInput"); Assert.assertEquals("Option value must be stored.", "fooInput", command.getInput()); @@ -104,9 +106,10 @@ * @throws TerminalException (unexpected) * @throws UnknownOptionException (unexpected) * @throws MissingArgumentException (unexpected) + * @throws ArgumentFileNotFoundException (unexpected) */ @Test - public void testCommandWithLongOption() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException { + public void testCommandWithLongOption() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException, ArgumentFileNotFoundException { final MockCommand command = new MockCommand(); ArgParser.parseAndRun(command, "--input", "fooInput"); Assert.assertEquals("Option value must be stored.", "fooInput", command.getInput()); @@ -120,9 +123,10 @@ * @throws TerminalException (unexpected) * @throws UnknownOptionException (unexpected) * @throws MissingArgumentException (unexpected) + * @throws ArgumentFileNotFoundException (unexpected) */ @Test - public void testCommandWithLongOptEq() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException { + public void testCommandWithLongOptEq() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException, ArgumentFileNotFoundException { final MockCommand command = new MockCommand(); ArgParser.parseAndRun(command, "--input=fooInput"); Assert.assertEquals("Option value must be stored.", "fooInput", command.getInput()); @@ -136,9 +140,10 @@ * @throws TerminalException (unexpected) * @throws UnknownOptionException (unexpected) * @throws MissingArgumentException (unexpected) + * @throws ArgumentFileNotFoundException (unexpected) */ @Test(expected = RequiredOptionsMissingException.class) - public void testCommandRequiredOptionMissing() throws RequiredOptionsMissingException, TerminalException, UnknownOptionException, MissingArgumentException { + public void testCommandRequiredOptionMissing() throws RequiredOptionsMissingException, TerminalException, UnknownOptionException, MissingArgumentException, ArgumentFileNotFoundException { final MockCommand command = new MockCommand(); try { ArgParser.parseAndRun(command); @@ -153,10 +158,11 @@ * @throws TerminalException (unexpected) * @throws UnknownOptionException (unexpected) * @throws MissingArgumentException (unexpected) + * @throws ArgumentFileNotFoundException (unexpected) * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1751332&group_id=149894&atid=776740">[ 1751332 ] Required options check should be optional / configurable</a> */ @Test - public void testCommandRequiredOptionMissingDisabled() throws RequiredOptionsMissingException, TerminalException, UnknownOptionException, MissingArgumentException { + public void testCommandRequiredOptionMissingDisabled() throws RequiredOptionsMissingException, TerminalException, UnknownOptionException, MissingArgumentException, ArgumentFileNotFoundException { final MockCommand command = new MockCommand(); command.setCheckRequiredOptions(false); ArgParser.parseAndRun(command); @@ -168,9 +174,10 @@ * @throws TerminalException (unexpected) * @throws UnknownOptionException (expected) * @throws MissingArgumentException (unexpected) + * @throws ArgumentFileNotFoundException (unexpected) */ @Test(expected = UnknownOptionException.class) - public void testCommandUnknownOption() throws RequiredOptionsMissingException, TerminalException, UnknownOptionException, MissingArgumentException { + public void testCommandUnknownOption() throws RequiredOptionsMissingException, TerminalException, UnknownOptionException, MissingArgumentException, ArgumentFileNotFoundException { final MockCommand command = new MockCommand(); try { ArgParser.parseAndRun(command, "--output"); @@ -185,9 +192,10 @@ * @throws TerminalException (unexpected) * @throws UnknownOptionException (unexpected) * @throws MissingArgumentException (expected) + * @throws ArgumentFileNotFoundException (unexpected) */ @Test(expected = MissingArgumentException.class) - public void testCommandMissingArgument() throws RequiredOptionsMissingException, TerminalException, UnknownOptionException, MissingArgumentException { + public void testCommandMissingArgument() throws RequiredOptionsMissingException, TerminalException, UnknownOptionException, MissingArgumentException, ArgumentFileNotFoundException { final MockCommand command = new MockCommand(); try { ArgParser.parseAndRun(command, "--input"); @@ -202,9 +210,10 @@ * @throws TerminalException (unexpected) * @throws UnknownOptionException (unexpected) * @throws MissingArgumentException (unexpected) + * @throws ArgumentFileNotFoundException (unexpected) */ @Test - public void testCommandDuplicateOption() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException { + public void testCommandDuplicateOption() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException, ArgumentFileNotFoundException { final MockCommand command = new MockCommand(); ArgParser.parseAndRun(command, "-i", "barBuzz", "-i", "fooInput"); Assert.assertEquals("Option value must be stored.", "fooInput", command.getInput()); @@ -218,9 +227,10 @@ * @throws TerminalException (expected) * @throws UnknownOptionException (unexpected) * @throws MissingArgumentException (unexpected) + * @throws ArgumentFileNotFoundException (unexpected) */ @Test(expected = TerminalException.class) - public void testHelp() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException { + public void testHelp() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException, ArgumentFileNotFoundException { final MockCommand command = new MockCommand(); ArgParser.parseAndRun(command, "-h"); } @@ -231,9 +241,10 @@ * @throws TerminalException (unexpected) * @throws UnknownOptionException (unexpected) * @throws MissingArgumentException (unexpected) + * @throws ArgumentFileNotFoundException (unexpected) */ @Test - public void testStopOptionParsing() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException { + public void testStopOptionParsing() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException, ArgumentFileNotFoundException { final MockCommand command = new MockCommand(); ArgParser.parseAndRun(command, "-i", "foo", "--", "--input"); final List<String> args = command.getArgs(); @@ -247,10 +258,11 @@ * @throws TerminalException (unexpected) * @throws UnknownOptionException (unexpected) * @throws MissingArgumentException (unexpected) + * @throws ArgumentFileNotFoundException (unexpected) * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1750193&group_id=149894&atid=776740">[ 1750193 ] Partial read of command line arguments from a file</a> */ @Test - public void testOptionsFromFileSingleLine() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException { + public void testOptionsFromFileSingleLine() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException, ArgumentFileNotFoundException { final MockCommand command = new MockCommand(); ArgParser.parseAndRun(command, "@src/test/net/sf/japi/io/args/ArgParserTest_OptionsFileSingleLine"); final List<String> args = command.getArgs(); @@ -267,10 +279,11 @@ * @throws TerminalException (unexpected) * @throws UnknownOptionException (unexpected) * @throws MissingArgumentException (unexpected) + * @throws ArgumentFileNotFoundException (unexpected) * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1758846&group_id=149894&atid=776737">[ 1758846 ] Multiple command file inclusion fails</a> */ @Test - public void testOptionsFromFileMultiple() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException { + public void testOptionsFromFileMultiple() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException, ArgumentFileNotFoundException { final MockCommand command = new MockCommand(); ArgParser.parseAndRun(command, "@src/test/net/sf/japi/io/args/ArgParserTest_MultipleOptionsFileMaster"); final List<String> args = command.getArgs(); @@ -287,10 +300,11 @@ * @throws TerminalException (unexpected) * @throws UnknownOptionException (unexpected) * @throws MissingArgumentException (unexpected) + * @throws ArgumentFileNotFoundException (unexpected) * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1750198&group_id=149894&atid=776740">[ 1750198 ] Allow single dash instead of double dash</a> */ @Test - public void testSingleDashOption() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException { + public void testSingleDashOption() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException, ArgumentFileNotFoundException { final MockCommand command = new MockCommand(); ArgParser.parseAndRun(command, "-input", "fooInput"); Assert.assertEquals("Option value must be stored.", "fooInput", command.getInput()); @@ -304,10 +318,11 @@ * @throws TerminalException (unexpected) * @throws UnknownOptionException (unexpected) * @throws MissingArgumentException (unexpected) + * @throws ArgumentFileNotFoundException (unexpected) * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1750198&group_id=149894&atid=776740">[ 1750198 ] Allow single dash instead of double dash</a> */ @Test - public void testSingleDashOptionWithEquals() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException { + public void testSingleDashOptionWithEquals() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException, ArgumentFileNotFoundException { final MockCommand command = new MockCommand(); ArgParser.parseAndRun(command, "-input=fooInput"); Assert.assertEquals("Option value must be stored.", "fooInput", command.getInput()); @@ -330,6 +345,9 @@ /** The command line arguments received from the parser. */ private List<String> args; + /** Option value, saved for verification. */ + private String foo; + /** {@inheritDoc} */ @SuppressWarnings({"InstanceMethodNamingConvention"}) public int run(@NotNull final List<String> args) { @@ -358,12 +376,20 @@ } /** + * Get the value of the foo option. + * @return Value of the foo option. + */ + public String getFoo() { + return foo; + } + + /** * Set the value of the foo option. * @param foo Value of the foo option. */ @Option({"f", "b", "foo", "bar", "buzz"}) public void setFoo(final String foo) { - // ignored + this.foo = foo; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-08-23 21:44:45
|
Revision: 594 http://japi.svn.sourceforge.net/japi/?rev=594&view=rev Author: christianhujer Date: 2007-08-23 14:44:36 -0700 (Thu, 23 Aug 2007) Log Message: ----------- Introduced ArgumentFileNotFoundException in case an argument file was not found. Modified Paths: -------------- libs/argparser/trunk/src/net/sf/japi/io/args/ArgParser.java Added Paths: ----------- libs/argparser/trunk/src/net/sf/japi/io/args/ArgumentFileNotFoundException.java Modified: libs/argparser/trunk/src/net/sf/japi/io/args/ArgParser.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/ArgParser.java 2007-08-23 11:25:42 UTC (rev 593) +++ libs/argparser/trunk/src/net/sf/japi/io/args/ArgParser.java 2007-08-23 21:44:36 UTC (rev 594) @@ -73,8 +73,9 @@ * @throws TerminalException in case argument parsing was stopped * @throws MissingArgumentException in the required argument for an option was missing * @throws UnknownOptionException In case an option was specified that's not supported. + * @throws ArgumentFileNotFoundException in case an argument file was not found. */ - private ArgParser(@NotNull final Command command, @NotNull final String... args) throws TerminalException, RequiredOptionsMissingException, UnknownOptionException, MissingArgumentException { + private ArgParser(@NotNull final Command command, @NotNull final String... args) throws TerminalException, RequiredOptionsMissingException, UnknownOptionException, MissingArgumentException, ArgumentFileNotFoundException { this.command = command; commandClass = command.getClass(); initMethods(); @@ -99,8 +100,9 @@ * @param context File relative to which @-inclusions have to be resolved. * @param args arguments before parsing argument files. * @return all arguments after parsing argument files. + * @throws ArgumentFileNotFoundException in case an argument file was not found. */ - public List<String> getAllArguments(@NotNull final File context, @NotNull final List<String> args) { + public List<String> getAllArguments(@NotNull final File context, @NotNull final List<String> args) throws ArgumentFileNotFoundException { final List<String> argList = new ArrayList<String>(args); for (final ListIterator<String> iterator = argList.listIterator(); iterator.hasNext();) { final String arg = iterator.next(); @@ -123,16 +125,16 @@ * Returns a tokenized unparsed list of arguments from an arguments file. * @param file Argument file to read. * @return all arguments from that argument file. + * @throws ArgumentFileNotFoundException in case an argument file was not found. */ - public List<String> readFromFile(@NotNull final File file) { - final List<String> args = new ArrayList<String>(); + @NotNull public List<String> readFromFile(@NotNull final File file) throws ArgumentFileNotFoundException { final TokenReader in; try { in = new TokenReader(new FileInputStream(file)); } catch (final FileNotFoundException e) { - // TODO TODO TODO TODO TODO - return args; + throw new ArgumentFileNotFoundException(e); } + final List<String> args = new ArrayList<String>(); for (final String token : in) { args.add(token); } @@ -306,6 +308,8 @@ System.err.println(e); } catch (final MissingArgumentException e) { System.err.println(e); + } catch (final ArgumentFileNotFoundException e) { + System.err.println(e); } } @@ -317,8 +321,9 @@ * @throws TerminalException in case a terminal option was encountered. * @throws UnknownOptionException in case an option given was not known. * @throws MissingArgumentException in case an option was missing its argument + * @throws ArgumentFileNotFoundException in case an argument file was not found. */ - public static void parseAndRun(@NotNull final Command command, @NotNull final String... args) throws RequiredOptionsMissingException, TerminalException, UnknownOptionException, MissingArgumentException { + public static void parseAndRun(@NotNull final Command command, @NotNull final String... args) throws RequiredOptionsMissingException, TerminalException, UnknownOptionException, MissingArgumentException, ArgumentFileNotFoundException { new ArgParser(command, args); } Added: libs/argparser/trunk/src/net/sf/japi/io/args/ArgumentFileNotFoundException.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/ArgumentFileNotFoundException.java (rev 0) +++ libs/argparser/trunk/src/net/sf/japi/io/args/ArgumentFileNotFoundException.java 2007-08-23 21:44:36 UTC (rev 594) @@ -0,0 +1,39 @@ +/* + * JAPI libs-argparser is a library for parsing command line arguments. + * Copyright (C) 2007 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.io.args; + +import java.io.FileNotFoundException; +import org.jetbrains.annotations.NotNull; + +/** This type of exception is thrown when an argument file was not found. + * Created by IntelliJ IDEA. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class ArgumentFileNotFoundException extends FileNotFoundException { + + /** Create an ArgumentFileNotFoundException. + * @param cause The FileNotFoundException that caused this ArgumentFileNotFoundException. + */ + public ArgumentFileNotFoundException(@NotNull final FileNotFoundException cause) { + super("Argument file not found: " + cause.getMessage()); + initCause(cause); + } + +} // class ArgumentFileNotFoundException Property changes on: libs/argparser/trunk/src/net/sf/japi/io/args/ArgumentFileNotFoundException.java ___________________________________________________________________ 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. |
From: <chr...@us...> - 2007-08-23 11:25:46
|
Revision: 593 http://japi.svn.sourceforge.net/japi/?rev=593&view=rev Author: christianhujer Date: 2007-08-23 04:25:42 -0700 (Thu, 23 Aug 2007) Log Message: ----------- [ 1778397 ] checkstyle fails for wrong pattern in TagByTextComparator Modified Paths: -------------- libs/taglets/trunk/src/net/sf/japi/taglets/TagByTextComparator.java Modified: libs/taglets/trunk/src/net/sf/japi/taglets/TagByTextComparator.java =================================================================== --- libs/taglets/trunk/src/net/sf/japi/taglets/TagByTextComparator.java 2007-08-23 11:19:24 UTC (rev 592) +++ libs/taglets/trunk/src/net/sf/japi/taglets/TagByTextComparator.java 2007-08-23 11:25:42 UTC (rev 593) @@ -29,7 +29,7 @@ public class TagByTextComparator implements Comparator<Tag> { /** Static instance. */ - public static Comparator<Tag> INSTANCE = new TagByTextComparator(); + public static final Comparator<Tag> INSTANCE = new TagByTextComparator(); /** {@inheritDoc} */ public int compare(final Tag o1, final Tag o2) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-08-23 11:19:27
|
Revision: 592 http://japi.svn.sourceforge.net/japi/?rev=592&view=rev Author: christianhujer Date: 2007-08-23 04:19:24 -0700 (Thu, 23 Aug 2007) Log Message: ----------- Removed magic number. Modified Paths: -------------- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/list/ActionListCellRenderer.java Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/list/ActionListCellRenderer.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/list/ActionListCellRenderer.java 2007-08-23 10:49:24 UTC (rev 591) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/list/ActionListCellRenderer.java 2007-08-23 11:19:24 UTC (rev 592) @@ -40,6 +40,9 @@ */ public class ActionListCellRenderer extends JButton implements ListCellRenderer { + /** The factor to multiply the font with to derive a slightly larger font. */ + private static final double FONT_SCALE = 4.0 / 3.0; + /** Serial Version. */ @SuppressWarnings({"AnalyzingVariableNaming"}) private static final long serialVersionUID = 1L; @@ -53,7 +56,7 @@ setHorizontalAlignment(CENTER); setBorder(new EmptyBorder(3, 3, 3, 3)); final Font f = getFont(); - setFont(f.deriveFont( BOLD, (float) (f.getSize2D() * (4.0/3.0)) )); + setFont(f.deriveFont(BOLD, (float) (f.getSize2D() * FONT_SCALE))); } /** {@inheritDoc} */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-08-23 10:49:36
|
Revision: 591 http://japi.svn.sourceforge.net/japi/?rev=591&view=rev Author: christianhujer Date: 2007-08-23 03:49:24 -0700 (Thu, 23 Aug 2007) Log Message: ----------- Added missing test case for value type of putValue(REFLECTION_ARGUMENTS, value) Modified Paths: -------------- libs/swing-action/trunk/src/test/net/sf/japi/swing/ReflectionActionTest.java Modified: libs/swing-action/trunk/src/test/net/sf/japi/swing/ReflectionActionTest.java =================================================================== --- libs/swing-action/trunk/src/test/net/sf/japi/swing/ReflectionActionTest.java 2007-08-23 08:39:39 UTC (rev 590) +++ libs/swing-action/trunk/src/test/net/sf/japi/swing/ReflectionActionTest.java 2007-08-23 10:49:24 UTC (rev 591) @@ -64,6 +64,15 @@ * @throws Exception (unexpected) */ @Test(expected = IllegalArgumentException.class) + public void testPutValueArgumentsThrows() throws Exception { + testling.putValue(ReflectionAction.REFLECTION_ARGUMENTS, new Object()); + } + + /** + * Tests that {@link ReflectionAction#putValue(String, Object)} works. + * @throws Exception (unexpected) + */ + @Test(expected = IllegalArgumentException.class) public void testPutValueMethodNameThrows() throws Exception { testling.putValue(ReflectionAction.REFLECTION_METHOD_NAME, new Object()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-08-23 08:39:46
|
Revision: 590 http://japi.svn.sourceforge.net/japi/?rev=590&view=rev Author: christianhujer Date: 2007-08-23 01:39:39 -0700 (Thu, 23 Aug 2007) Log Message: ----------- Added unit test for ActionBuilderFactory. Added Paths: ----------- libs/swing-action/trunk/src/test/net/sf/japi/swing/ActionBuilderFactoryTest.java Added: libs/swing-action/trunk/src/test/net/sf/japi/swing/ActionBuilderFactoryTest.java =================================================================== --- libs/swing-action/trunk/src/test/net/sf/japi/swing/ActionBuilderFactoryTest.java (rev 0) +++ libs/swing-action/trunk/src/test/net/sf/japi/swing/ActionBuilderFactoryTest.java 2007-08-23 08:39:39 UTC (rev 590) @@ -0,0 +1,50 @@ +/* + * JAPI libs-swing-action is a library for creating and managing javax.swing.Action objects. + * Copyright (C) 2007 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.swing; + +import net.sf.japi.swing.ActionBuilder; +import net.sf.japi.swing.ActionBuilderFactory; +import net.sf.japi.swing.DefaultActionBuilder; +import org.junit.Assert; +import org.junit.Test; + +/** Test for {@link ActionBuilderFactory}. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class ActionBuilderFactoryTest { + + /** Tests that {@link ActionBuilderFactory#getInstance()} returns the same instance upon two invocations. */ + @Test + public void testGetInstanceIdentity() { + final ActionBuilderFactory instance1 = ActionBuilderFactory.getInstance(); + final ActionBuilderFactory instance2 = ActionBuilderFactory.getInstance(); + Assert.assertSame("Two invocations of ActionBuilderFactory.getInstance() must return the same instance.", instance1, instance2); + } + + /** Tests that {@link ActionBuilderFactory#getActionBuilder(String)} and {@link ActionBuilderFactory#putActionBuilder(String, ActionBuilder)} work. */ + @Test + public void testGetAndPut() { + final ActionBuilderFactory testling = new ActionBuilderFactory() {}; + final ActionBuilder object = new DefaultActionBuilder(); + testling.putActionBuilder("foo", object); + Assert.assertSame("Stored ActionBuilder must be retrievable under its basename.", object, testling.getActionBuilder("foo")); + } + +} // class ActionBuilderFactoryTest Property changes on: libs/swing-action/trunk/src/test/net/sf/japi/swing/ActionBuilderFactoryTest.java ___________________________________________________________________ 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. |
From: <chr...@us...> - 2007-08-23 08:33:56
|
Revision: 589 http://japi.svn.sourceforge.net/japi/?rev=589&view=rev Author: christianhujer Date: 2007-08-23 01:33:50 -0700 (Thu, 23 Aug 2007) Log Message: ----------- Change documentation. This is not really a singleton, just a class with a default instance. Modified Paths: -------------- libs/swing-action/trunk/src/net/sf/japi/swing/ActionBuilderFactory.java Modified: libs/swing-action/trunk/src/net/sf/japi/swing/ActionBuilderFactory.java =================================================================== --- libs/swing-action/trunk/src/net/sf/japi/swing/ActionBuilderFactory.java 2007-08-23 08:25:48 UTC (rev 588) +++ libs/swing-action/trunk/src/net/sf/japi/swing/ActionBuilderFactory.java 2007-08-23 08:33:50 UTC (rev 589) @@ -33,7 +33,7 @@ /** The ActionBuilders. */ @NotNull private final Map<String, ActionBuilder> actionBuilders = new WeakHashMap<String, ActionBuilder>(); - /** The ActionBuilderFactory singleton instance. */ + /** The ActionBuilderFactory default instance. */ private static final ActionBuilderFactory INSTANCE = new ActionBuilderFactory() {}; /** Create an ActionBuilderFactory. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-08-23 08:25:51
|
Revision: 588 http://japi.svn.sourceforge.net/japi/?rev=588&view=rev Author: christianhujer Date: 2007-08-23 01:25:48 -0700 (Thu, 23 Aug 2007) Log Message: ----------- Added putActionBuilder() for tests. Fixed bug in getInstance(): ActionBuilderFactory should be a Singleton. Modified Paths: -------------- libs/swing-action/trunk/src/net/sf/japi/swing/ActionBuilderFactory.java Modified: libs/swing-action/trunk/src/net/sf/japi/swing/ActionBuilderFactory.java =================================================================== --- libs/swing-action/trunk/src/net/sf/japi/swing/ActionBuilderFactory.java 2007-08-20 22:59:24 UTC (rev 587) +++ libs/swing-action/trunk/src/net/sf/japi/swing/ActionBuilderFactory.java 2007-08-23 08:25:48 UTC (rev 588) @@ -23,20 +23,24 @@ import java.util.ResourceBundle; import java.util.WeakHashMap; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** An ActionBuilderFactory provides implementations of {@link ActionBuilder}. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public class ActionBuilderFactory { +public abstract class ActionBuilderFactory { /** The ActionBuilders. */ - @NotNull public final Map<String, ActionBuilder> actionBuilders = new WeakHashMap<String, ActionBuilder>(); + @NotNull private final Map<String, ActionBuilder> actionBuilders = new WeakHashMap<String, ActionBuilder>(); + /** The ActionBuilderFactory singleton instance. */ + private static final ActionBuilderFactory INSTANCE = new ActionBuilderFactory() {}; + /** Create an ActionBuilderFactory. * @return An ActionBuilderFactory. */ public static ActionBuilderFactory getInstance() { - return new ActionBuilderFactory(); + return INSTANCE; } /** Get an ActionBuilder. @@ -49,7 +53,7 @@ * @param baseName Name of ActionBuilder (which even may be <code>null</code> if you are too lazy to invent a key) * @return ActionBuilder for given key. The builder is created in case it didn't already exist. */ - @NotNull public ActionBuilder getActionBuilder(final String baseName) { + @NotNull public ActionBuilder getActionBuilder(@Nullable final String baseName) { ActionBuilder builder = actionBuilders.get(baseName); if (builder == null) { builder = new DefaultActionBuilder(baseName); @@ -58,4 +62,14 @@ return builder; } + /** Stores an ActionBuilder. + * In regular programs, an invocation of this operation should not be needed. + * This operation is designed for tests that want to provide non-default ActionBuilders as Dummies, Stubs or Mocks. + * @param baseName Basename to store an ActionBuilder for. + * @param actionBuilder ActionBuilder to store. + */ + public void putActionBuilder(@Nullable final String baseName, @NotNull final ActionBuilder actionBuilder) { + actionBuilders.put(baseName, actionBuilder); + } + } // class ActionBuilderFactory This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-08-20 22:59:29
|
Revision: 587 http://japi.svn.sourceforge.net/japi/?rev=587&view=rev Author: christianhujer Date: 2007-08-20 15:59:24 -0700 (Mon, 20 Aug 2007) Log Message: ----------- Updated taglets. Activated @history taglet. Modified Paths: -------------- common/trunk/antlib/japi-lib-taglets-trunk.jar common/trunk/commonBuild.xml Modified: common/trunk/antlib/japi-lib-taglets-trunk.jar =================================================================== (Binary files differ) Modified: common/trunk/commonBuild.xml =================================================================== --- common/trunk/commonBuild.xml 2007-08-20 22:58:27 UTC (rev 586) +++ common/trunk/commonBuild.xml 2007-08-20 22:59:24 UTC (rev 587) @@ -236,6 +236,7 @@ <exclude name="test/net/**" /> </packageset> <taglet name="net.sf.japi.taglets.FixmeTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" /> + <taglet name="net.sf.japi.taglets.HistoryTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" /> <taglet name="net.sf.japi.taglets.InvariantTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" /> <taglet name="net.sf.japi.taglets.NoteTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" /> <taglet name="net.sf.japi.taglets.PostconditionTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" /> @@ -287,6 +288,7 @@ > </packageset> <taglet name="net.sf.japi.taglets.FixmeTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" /> + <taglet name="net.sf.japi.taglets.HistoryTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" /> <taglet name="net.sf.japi.taglets.InvariantTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" /> <taglet name="net.sf.japi.taglets.NoteTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" /> <taglet name="net.sf.japi.taglets.PostconditionTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-08-20 22:58:29
|
Revision: 586 http://japi.svn.sourceforge.net/japi/?rev=586&view=rev Author: christianhujer Date: 2007-08-20 15:58:27 -0700 (Mon, 20 Aug 2007) Log Message: ----------- [ 1777777 ] @history taglet Added Paths: ----------- libs/taglets/trunk/src/net/sf/japi/taglets/HistoryTaglet.java libs/taglets/trunk/src/net/sf/japi/taglets/TagByTextComparator.java Added: libs/taglets/trunk/src/net/sf/japi/taglets/HistoryTaglet.java =================================================================== --- libs/taglets/trunk/src/net/sf/japi/taglets/HistoryTaglet.java (rev 0) +++ libs/taglets/trunk/src/net/sf/japi/taglets/HistoryTaglet.java 2007-08-20 22:58:27 UTC (rev 586) @@ -0,0 +1,157 @@ +/* + * JAPI libs-taglets is a library that has some useful additional taglets for javadoc. + * Copyright (C) 2007 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.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Taglet for history. + * Format: history date developer Comment. + * Separate developers and Comment with two whitespace. + * Date must be ISO. + * You shouldn't use it for something your version control system can handle anyway but in a much more reliable way. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class HistoryTaglet implements Taglet { + + /** The pattern to use for checking. */ + private static final Pattern PATTERN = Pattern.compile("^(\\d\\d\\d\\d-\\d\\d-\\d\\d) (.*?) (.*?)$"); + + /** The DateFormat for ISO dates. */ + private static final DateFormat ISO_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); + + /** {@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 false; + } + + /** {@inheritDoc} */ + public String getName() { + return "history"; + } + + /** {@inheritDoc} */ + public String toString(final Tag tag) { + final StringBuilder sb = new StringBuilder(); + sb.append("<DL><DT><B>"); + sb.append("History:"); + sb.append("</B></DT><DD><TABLE><TR><TH>Date</TH><TH>Developer(s)</TH><TH>Changes</TH></TR>"); + append(sb, tag); + sb.append("</TABLE></DD></DL>"); + return sb.toString(); + } + + /** {@inheritDoc} */ + public String toString(final Tag[] tags) { + if (tags == null || tags.length == 0) { + return null; + } + if (tags.length == 1) { + return toString(tags[0]); + } + final StringBuilder sb = new StringBuilder(); + sb.append("<DL><DT><B>"); + sb.append("History:"); + sb.append("</B></DT><DD><TABLE><TR><TH>Date</TH><TH>Developer(s)</TH><TH>Changes</TH></TR>"); + final Tag[] myTags = tags.clone(); + Arrays.sort(myTags, TagByTextComparator.INSTANCE); + for (final Tag tag : tags) { + append(sb, tag); + } + sb.append("</TABLE></DD></DL>"); + return sb.toString(); + } + + /** Appends a tag to the text as a table. + * @param sb StringBuilder to append to. + * @param tag Tag to append + */ + private void append(final StringBuilder sb, final Tag tag) { + final String text = tag.text(); + final Matcher matcher = PATTERN.matcher(text); + if (!matcher.matches()) { + System.err.println(tag.position() + ": warning - @" + getName() + " not formatted correctly."); + return; + } + final String dateText = matcher.group(1); + final String developers = matcher.group(2); + final String comment = matcher.group(3); + try { + ISO_DATE_FORMAT.parse(dateText); + } catch (final ParseException e) { + System.err.println(tag.position() + ": warning - @" + getName() + " has a date in wrong format (not-iso)."); + } + sb.append("<TR><TD>"); + sb.append(dateText); + sb.append("</TD><TD>"); + sb.append(developers); + sb.append("</TD><TD>"); + sb.append(comment); + sb.append("</TD></TR>"); + } + + /** + * 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 HistoryTaglet(); + tagletMap.put(taglet.getName(), taglet); + } + +} // class HistoryTaglet Property changes on: libs/taglets/trunk/src/net/sf/japi/taglets/HistoryTaglet.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: libs/taglets/trunk/src/net/sf/japi/taglets/TagByTextComparator.java =================================================================== --- libs/taglets/trunk/src/net/sf/japi/taglets/TagByTextComparator.java (rev 0) +++ libs/taglets/trunk/src/net/sf/japi/taglets/TagByTextComparator.java 2007-08-20 22:58:27 UTC (rev 586) @@ -0,0 +1,39 @@ +/* + * JAPI libs-taglets is a library that has some useful additional taglets for javadoc. + * Copyright (C) 2007 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 java.util.Comparator; + +/** + * Compares Javadoc Tags by their text. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class TagByTextComparator implements Comparator<Tag> { + + /** Static instance. */ + public static Comparator<Tag> INSTANCE = new TagByTextComparator(); + + /** {@inheritDoc} */ + public int compare(final Tag o1, final Tag o2) { + return o1.text().compareTo(o2.text()); + } + +} // class TagByTextComparator Property changes on: libs/taglets/trunk/src/net/sf/japi/taglets/TagByTextComparator.java ___________________________________________________________________ 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. |