Thread: [Japi-cvs] SF.net SVN: japi: [333] progs/jeduca/trunk/src/net/sf/japi/progs/jeduca
Status: Beta
Brought to you by:
christianhujer
From: <chr...@us...> - 2007-05-12 14:56:53
|
Revision: 333 http://svn.sourceforge.net/japi/?rev=333&view=rev Author: christianhujer Date: 2007-05-12 07:56:50 -0700 (Sat, 12 May 2007) Log Message: ----------- Modified JEduca to incorporate recent JAPI changes. Modified Paths: -------------- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/Main.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/ReviewGUI.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/recent/RecentURLsMenu.java Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/Main.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/Main.java 2007-05-12 14:56:27 UTC (rev 332) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/Main.java 2007-05-12 14:56:50 UTC (rev 333) @@ -29,6 +29,7 @@ /** Main program. * @param args command line arguments + * @throws Throwable in case of problems starting the program. */ public static void main(final String... args) throws Throwable { new ProgramFrame(new Program()); 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-05-12 14:56:27 UTC (rev 332) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/ReviewGUI.java 2007-05-12 14:56:50 UTC (rev 333) @@ -33,7 +33,7 @@ import javax.swing.event.ChangeListener; import net.sf.japi.progs.jeduca.jtest.QuestionCollection; import net.sf.japi.progs.jeduca.jtest.QuestionText; -import net.sf.japi.swing.ColumnLayout; +import net.sf.japi.swing.VerticalFlowLayout; /** Graphical user interface for displaying a review page for all questions. * @author $Author: chris $ @@ -68,7 +68,7 @@ public ReviewGUI(final QuestionCollectionGUI questionCollectionGUI) { this.questionCollectionGUI = questionCollectionGUI; setLayout(new BorderLayout()); - reviews = new JPanel(new ColumnLayout()); + reviews = new JPanel(new VerticalFlowLayout()); add(reviews); } Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/recent/RecentURLsMenu.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/recent/RecentURLsMenu.java 2007-05-12 14:56:27 UTC (rev 332) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/swing/recent/RecentURLsMenu.java 2007-05-12 14:56:50 UTC (rev 333) @@ -25,7 +25,7 @@ import javax.swing.JMenu; import javax.swing.JMenuItem; import net.sf.japi.swing.ActionFactory; -import net.sf.japi.swing.io.CanLoad; +import net.sf.japi.swing.app.CanLoad; /** Class for a menu showing the recently used URLs. * @todo think about serialization of recent and program This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |