Index: lutincommandline/src/test/org/codelutin/option/ui/UITest.java diff -u /dev/null lutincommandline/src/test/org/codelutin/option/ui/UITest.java:1.1 --- /dev/null Thu Feb 21 16:04:48 2008 +++ lutincommandline/src/test/org/codelutin/option/ui/UITest.java Thu Feb 21 16:04:43 2008 @@ -0,0 +1,73 @@ +/* +* ##% Copyright (C) 2007, 2008 Code Lutin, Tony Chemit +* +* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* ##% */ +package org.codelutin.option.ui; + +import org.codelutin.i18n.I18n; +import org.codelutin.i18n.LanguageEnum; +import static org.codelutin.i18n.I18n.n_; +import org.codelutin.option.Config; +import org.codelutin.option.ConfigPropertyKey; +import org.codelutin.option.def.ConfigPropertyModifier; +import static org.codelutin.option.ConfigPropertyKey.newConfigPropertyKey; + +import java.io.File; +import java.net.URL; + +/** + * TODO javadoc + * + * @author chemit + */ +public class UITest { + + public static void main(String[] args) throws Exception { + I18n.initISO88591(); + MyConfig config = new MyConfig(); + config.init(); + ConfigUI.showUI(config, ConfigTableModel.TypeModel.all); + } + + private static class MyConfig extends Config { + + static public final ConfigPropertyKey BOOLEAN_PROPERTY_KEY; + static public final ConfigPropertyKey INT_PROPERTY_KEY; + static public final ConfigPropertyKey CLASS_PROPERTY_KEY; + static public final ConfigPropertyKey FILE_PROPERTY_KEY; + static public final ConfigPropertyKey URL_PROPERTY_KEY; + static public final ConfigPropertyKey LANGUAGE_PROPERTY_KEY; + + public MyConfig() { + super("test", "test description"); + } + + protected void init() throws Exception { + loadFromDefaultValue(); + clearModified(); + } + + static { + BOOLEAN_PROPERTY_KEY = newConfigPropertyKey("boolean", Boolean.class, 0, n_("lutinutil.common.boolean.description"), "false"); + INT_PROPERTY_KEY = newConfigPropertyKey("int", Integer.class, ConfigPropertyModifier.MANDATORY.getIntValue(), n_("lutinutil.config.main.int.description")); + CLASS_PROPERTY_KEY = newConfigPropertyKey("class", Class.class, ConfigPropertyModifier.MANDATORY.getIntValue(), n_("lutinutil.config.main.class.description")); + + FILE_PROPERTY_KEY = newConfigPropertyKey("file", File.class, 8, n_("lutinutil.common.file.description"), "/tmp"); + URL_PROPERTY_KEY = newConfigPropertyKey("url", URL.class, 11, n_("lutinutil.common.url.description"), "http://lutinutil.labs.libre-entreprise.org"); + LANGUAGE_PROPERTY_KEY = newConfigPropertyKey("language", LanguageEnum.class, 8, n_("lutinutil.common.language.description"), "fr"); + } + } +}