--- /dev/null
+/*
+ * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ *
+ * Lilie is free software. You can redistribute it and/or modify since
+ * you respect the terms of either (at least one of the both license) :
+ * - under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ * License, or any later version
+ *
+ * There are special exceptions to the terms and conditions of the
+ * licenses as they are applied to this software. View the full text of
+ * the exception in file LICENSE.txt in the directory of this software
+ * distribution.
+ *
+ * Lilie 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
+ * Licenses for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the CeCILL-C along with Lilie. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ */
+
+package org.lilie.services.eliot.notes.applet.utils
+
+import javax.swing.JApplet
+import java.util.logging.Level
+
+/**
+ * Permet de gérer les paramètres courant de l'applet. Ces paramètres peuvent
+ * venir de l'applet ou de n'importe quelle source.En ce qui concerne les
+ * paramétres de l'applet cette classe est capable de les mapper sur ses
+ * propriétés même si elles n'existent pas. Cette fonctionnalité n'est
+ * disponible que pour les paramètres de type string. Pour les autres on est
+ * obligé de faire une implémentation spécifique.
+ * @author othe
+ */
+class ParametresCourant {
+
+ static private ParametresCourant parametresApplet = new ParametresCourant()
+
+ private JApplet applet
+
+ private ParametresCourant() {
+
+ }
+
+ /**
+ * indique quel est l'applet courante
+ */
+ public void setApplet(JApplet applet) {
+ this.applet = applet
+ }
+
+ /**
+ * Permet de retrouver l'instance des paramètres
+ */
+ static public ParametresCourant get() {
+ return parametresApplet
+ }
+
+ /**
+ * Lecture d'un parametre booleen (true, false)
+ * @param name : nom du paramètre
+ * @return le booleen
+ */
+ public boolean readBool(String name) {
+ if (applet) {
+ String resultat = applet.getParameter(name)
+ return (resultat == 'true')
+ } else {
+ return false
+ }
+ }
+
+ /**
+ * Lecture d'un paramètre de type string
+ * @param name : nom du paramètre
+ * @return la chaine
+ */
+ public String readString(String name) {
+ if (applet) {
+ String resultat = applet.getParameter(name)
+ return resultat ? resultat : ""
+ } else {
+ return ""
+ }
+ }
+
+ /**
+ * indique si le log log4j est actif
+ */
+ public boolean log() {
+ readBool('log')
+ }
+
+ /**
+ * Retourne le niveau de log du logger log4j
+ */
+ public Level getLog4jLevel() {
+ return Level.INFO
+ }
+
+ /**
+ * Lecture de l'établissement dans les paramètres de l'applet
+ */
+ public String getEtablissement() {
+ String resultat = readString("uajEtablissement")
+ if (!resultat) {
+ resultat = "Erreur etablissement"
+ }
+ return resultat
+ }
+
+ /**
+ * Type export du fichier courant
+ */
+ Integer typeExport
+
+ /**
+ * Permet de définir automatiquement n'importe quelle paramétre
+ */
+ def getProperty(String name) {
+ switch (name) {
+ case "typeExport": return this.typeExport
+ }
+
+ String value = readString(name)
+ return value
+ }
+
+
+}