2 * jSite-remote - I18nContainer.java Copyright © 2007 David Roden
4 * This program is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License as published by the Free Software
6 * Foundation; either version 2 of the License, or (at your option) any later
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16 * Place - Suite 330, Boston, MA 02111-1307, USA.
19 package de.todesbaum.jsite.i18n;
21 import java.util.ArrayList;
22 import java.util.Collections;
23 import java.util.Iterator;
24 import java.util.List;
27 * @author David Roden <droden@gmail.com>
30 public class I18nContainer implements Iterable<Runnable> {
32 private static final I18nContainer singleton = new I18nContainer();
33 private final List<Runnable> i18nRunnables = Collections.synchronizedList(new ArrayList<Runnable>());
34 private final List<Runnable> i18nPostRunnables = Collections.synchronizedList(new ArrayList<Runnable>());
36 public static I18nContainer getInstance() {
40 public void registerRunnable(Runnable i18nRunnable) {
41 i18nRunnables.add(i18nRunnable);
44 public void registerPostRunnable(Runnable i18nPostRunnable) {
45 i18nPostRunnables.add(i18nPostRunnable);
48 public Iterator<Runnable> iterator() {
49 List<Runnable> allRunnables = new ArrayList<Runnable>();
50 allRunnables.addAll(i18nRunnables);
51 allRunnables.addAll(i18nPostRunnables);
52 return allRunnables.iterator();