--- /dev/null
+build
+dist
--- /dev/null
+<?xml version="1.0"?>
+<project name="XEMELIOS-web" basedir=".">
+ <property file="${user.home}/.ant.properties"/>
+ <property name="default.gwt.devmode.port" value="8888"/>
+
+ <path id="xemelios.classpath">
+ <pathelement path="../api-plugin/build/classes"/>
+ <pathelement path="../auth-aphm/build/classes"/>
+ <pathelement path="../auth-basic/build/classes"/>
+ <pathelement path="../auth-dgcp/build/classes"/>
+ <pathelement path="../auth-ldap/build/classes"/>
+ <pathelement path="../auth-noauth/build/classes"/>
+ <pathelement path="../auth-std-db/build/classes"/>
+ <pathelement path="../batch/build/classes"/>
+ <pathelement path="../cfg-paye/build/classes"/>
+ <pathelement path="../cg-colloc/build/classes"/>
+ <pathelement path="../cg-etat/build/classes"/>
+ <pathelement path="../control-core/build/classes"/>
+ <pathelement path="../core/build/classes"/>
+ <pathelement path="../doc-budg/build/classes"/>
+ <pathelement path="../edmn/build/classes"/>
+ <pathelement path="../erar/build/classes"/>
+ <pathelement path="../etat-frais/build/classes"/>
+ <pathelement path="../etat-frais-spl/build/classes"/>
+ <pathelement path="../import-batch/build/classes"/>
+ <pathelement path="../mysql-persistence/build/classes"/>
+ <pathelement path="../pes-aller/build/classes"/>
+ <pathelement path="../quittancement/build/classes"/>
+ <pathelement path="../ref-collec-spl/build/classes"/>
+ <pathelement path="../rsa/build/classes"/>
+ <pathelement path="../starter/build/classes"/>
+ <pathelement path="../swing-utils/build/classes"/>
+ <pathelement path="../versement/build/classes"/>
+ <pathelement path="../xemelios-core/build/classes"/>
+ <pathelement path="../xml-marshall/build/classes"/>
+ <!--fileset dir="lib" includes="*.jar"/-->
+ <fileset dir="../core/lib" includes="*.jar"/>
+ <fileset dir="../mysql-persistence/lib" includes="*.jar"/>
+ <fileset dir="../swing-utils/lib" includes="*.jar"/>
+ <fileset dir="../xemelios-core/lib" includes="*.jar"/>
+ </path>
+
+ <resources id="xemelios.jar.files">
+ <fileset dir="../api-plugin/build/jars" includes="*.jar"/>
+ <fileset dir="../auth-aphm/build/jars" includes="*.jar"/>
+ <fileset dir="../auth-basic/build/jars" includes="*.jar"/>
+ <fileset dir="../auth-dgcp/build/jars" includes="*.jar"/>
+ <fileset dir="../auth-ldap/build/jars" includes="*.jar"/>
+ <fileset dir="../auth-noauth/build/jars" includes="*.jar"/>
+ <fileset dir="../auth-std-db/build/jars" includes="*.jar"/>
+ <fileset dir="../batch/build/jars" includes="*.jar"/>
+ <fileset dir="../cfg-paye/build/jars" includes="*.jar"/>
+ <fileset dir="../cg-colloc/build/jars" includes="*.jar"/>
+ <fileset dir="../cg-etat/build/jars" includes="*.jar"/>
+ <fileset dir="../control-core/build/jars" includes="*.jar"/>
+ <fileset dir="../core/build/jars" includes="*.jar"/>
+ <fileset dir="../doc-budg/build/jars" includes="*.jar"/>
+ <fileset dir="../edmn/build/jars" includes="*.jar"/>
+ <fileset dir="../erar/build/jars" includes="*.jar"/>
+ <fileset dir="../etat-frais/build/jars" includes="*.jar"/>
+ <fileset dir="../etat-frais-spl/build/jars" includes="*.jar"/>
+ <fileset dir="../import-batch/build/jars" includes="*.jar"/>
+ <fileset dir="../mysql-persistence/build/jars" includes="*.jar"/>
+ <fileset dir="../pes-aller/build/jars" includes="*.jar"/>
+ <fileset dir="../quittancement/build/jars" includes="*.jar"/>
+ <fileset dir="../ref-collec-spl/build/jars" includes="*.jar"/>
+ <fileset dir="../rsa/build/jars" includes="*.jar"/>
+ <fileset dir="../starter/build/jars" includes="*.jar"/>
+ <fileset dir="../swing-utils/build/jars" includes="*.jar"/>
+ <fileset dir="../versement/build/jars" includes="*.jar"/>
+ <fileset dir="../xemelios-core/build/jars" includes="*.jar"/>
+ <fileset dir="../xml-marshall/build/jars" includes="*.jar"/>
+ <!--fileset dir="lib" includes="*.jar"/-->
+ <fileset dir="../core/lib" includes="*.jar"/>
+ <fileset dir="../mysql-persistence/lib" includes="*.jar"/>
+ <fileset dir="../swing-utils/lib" includes="*.jar"/>
+ <fileset dir="../xemelios-core/lib" includes="*.jar"/>
+ </resources>
+
+ <target name="prepare">
+ <condition property="gwt.devmode.port" value="${user.gwt.devmode.port}" else="${default.gwt.devmode.port}">
+ <isset property="user.gwt.devmode.port"/>
+ </condition>
+ </target>
+
+ <!--path id="compile.classpath">
+ <fileset dir="../auth-aphm/build/jars" includes="*.jar"/>
+ <fileset dir="../auth-basic/build/jars" includes="*.jar"/>
+ <fileset dir="../auth-dgcp/build/jars" includes="*.jar"/>
+ <fileset dir="../auth-ldap/build/jars" includes="*.jar"/>
+ <fileset dir="../auth-std-db/build/jars" includes="*.jar"/>
+ <fileset dir="../batch/build/jars" includes="*.jar"/>
+ <fileset dir="../bourses/build/jars" includes="*.jar"/>
+ <fileset dir="../cfg-paye/build/jars" includes="*.jar"/>
+ <fileset dir="../cg-colloc/build/jars" includes="*.jar"/>
+ <fileset dir="../cg-etat/build/jars" includes="*.jar"/>
+ <fileset dir="../core/build/jars" includes="*.jar"/>
+ <fileset dir="../edmn/build/jars" includes="*.jar"/>
+ <fileset dir="../erar/build/jars" includes="*.jar"/>
+ <fileset dir="../etat-frais/build/jars" includes="*.jar"/>
+ <fileset dir="../etat-frais-spl/build/jars" includes="*.jar"/>
+ <fileset dir="../factures-sans-engagement-tiers/build/jars" includes="*.jar"/>
+ <fileset dir="../import-batch/build/jars" includes="*.jar"/>
+ <fileset dir="../mysql-persistence/build/jars" includes="*.jar"/>
+ <fileset dir="../pes-aller/build/jars" includes="*.jar"/>
+ <fileset dir="../quittancement/build/jars" includes="*.jar"/>
+ <fileset dir="../ref-collec-spl/build/jars" includes="*.jar"/>
+ <fileset dir="../rsa/build/jars" includes="*.jar"/>
+ <fileset dir="../starter/build/jars" includes="*.jar"/>
+ <fileset dir="../xml-marshall/build/jars" includes="*.jar"/>
+ <fileset dir="../xemelios-core/lib">
+ <include name="iText-2.1.7.jar"/>
+ <include name="core-renderer.jar"/>
+ </fileset>
+ <fileset dir="../mysql-persistence/lib">
+ <include name="mysql-connector-java-5.0.6-bin.jar"/>
+ </fileset>
+ <fileset dir="../core/lib" includes="*.jar">
+ <include name="*.jar"/>
+ <exclude name="jxl.jar"/>
+ <exclude name="relaxngDatatype.jar"/>
+ <exclude name="swing-worker.jar"/>
+ <exclude name="log4j.jar"/>
+ </fileset>
+ <fileset dir="web/war/WEB-INF/lib" includes="*.jar"/>
+ <fileset dir="${gwt-2.1.dir}" includes="*.jar"/>
+ </path-->
+
+ <target name="dev-mode" depends="clean,prepare,compile,update-web,clean-logs">
+ <java classname="com.google.gwt.dev.DevMode" fork="true">
+ <jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,address=8001,suspend=n"/>
+ <arg value="-port"/>
+ <arg value="${gwt.devmode.port}"/>
+ <arg value="-logdir"/>
+ <arg value="logs"/>
+ <arg value="-logLevel"/>
+ <arg value="INFO"/>
+ <arg value="-war"/>
+ <arg value="build/war"/>
+ <arg value="-startupUrl"/>
+ <arg value="http://localhost:${gwt.devmode.port}/index.jsp"/>
+ <arg value="fr.gouv.finances.dgfip.xemelios.web2.gwt.XemeliosStarter"/>
+ <classpath>
+ <pathelement location="src"/>
+ <fileset dir="${GWT_2_HOME}" includes="*.jar"/>
+ <path refid="xemelios.classpath"/>
+ <pathelement location="build/war/WEB-INF/classes"/>
+ <fileset dir="web/war/WEB-INF/lib" includes="*.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="gwt-compile" depends="clean,prepare,compile,update-web,clean-logs">
+ <java classname="com.google.gwt.dev.Compiler" fork="true">
+ <arg value="-logLevel"/>
+ <arg value="INFO"/>
+ <arg value="-style"/>
+ <arg value="DETAILED"/>
+ <arg value="-war"/>
+ <arg value="build/war"/>
+ <arg value="-compileReport"/>
+ <arg value="fr.gouv.finances.dgfip.xemelios.web2.gwt.XemeliosStarter"/>
+ <classpath>
+ <pathelement location="src"/>
+ <fileset dir="${GWT_2_HOME}" includes="*.jar"/>
+ <path refid="xemelios.classpath"/>
+ <pathelement location="build/war/WEB-INF/classes"/>
+ <fileset dir="web/war/WEB-INF/lib" includes="*.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+
+ <target name="compile">
+ <mkdir dir="build/war/WEB-INF/classes"/>
+ <javac
+ srcdir="src"
+ destdir="build/war/WEB-INF/classes"
+ encoding="ISO-8859-1"
+ debug="true">
+ <classpath>
+ <fileset dir="${GWT_2_HOME}" includes="*.jar"/>
+ <path refid="xemelios.classpath"/>
+ <pathelement location="build/war/WEB-INF/classes"/>
+ <fileset dir="web/war/WEB-INF/lib" includes="*.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="build/war/WEB-INF/classes">
+ <fileset dir="src">
+ <exclude name="**/*.java"/>
+ <exclude name="**/CVS"/>
+ <include name="**/*"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="update-web">
+ <copy todir="build/war">
+ <fileset dir="web/war">
+ <include name="**/*"/>
+ <exclude name="**/CVS"/>
+ </fileset>
+ </copy>
+ <copy todir="build/war/WEB-INF/lib">
+ <resources refid="xemelios.jar.files"/>
+ </copy>
+ </target>
+
+ <target name="clean" depends="clean-logs">
+ <delete dir="build"/>
+ <delete dir="logs"/>
+ </target>
+ <target name="clean-logs">
+ <delete dir="logs"/>
+ </target>
+
+</project>
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright
+ * 2010 axYus - www.axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.app;
+
+import java.io.File;
+
+import javax.servlet.ServletContextEvent;
+
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+import org.apache.log4j.xml.DOMConfigurator;
+
+import fr.gouv.finances.dgfip.utils.ClassPathUtils;
+
+public class Application {
+ private static Logger logger = null;
+ static private final String configFileParameterName = "lo4j";
+
+ static public void start(ServletContextEvent event) {
+ try {
+ initLog4j(event);
+ } catch (RuntimeException re) {
+ re.printStackTrace();
+ throw (re);
+ }
+ try {
+ XemeliosHelper.init(event);
+ } catch (Exception e) {
+ logger.error(e, e);
+ throw new RuntimeException(e);
+ }
+ logger.info(ClassPathUtils.displayClassPathInfos());
+ }
+
+ static public void stop(ServletContextEvent event) {
+ XemeliosHelper.shutdown();
+ LogManager.shutdown();
+ }
+
+ static private void initLog4j(ServletContextEvent event) {
+ String confFileAsString = event.getServletContext().getInitParameter(configFileParameterName);
+ if (confFileAsString == null) {
+ confFileAsString = "./WEB-INF/log4j.xml";
+ }
+ File confFile = null;
+ if (confFileAsString.startsWith("./")) {
+ confFile = new File(event.getServletContext().getRealPath("/"), confFileAsString.substring(2));
+ } else {
+ confFile = new File(confFileAsString);
+ }
+ event.getServletContext().log("Initialisation de Log4J à partir du fichier : " + confFile);
+ if (!confFile.exists()) {
+ throw new IllegalArgumentException("Fichier de configuration log4j spécifié non trouvable : " + confFile.getAbsolutePath());
+ }
+ System.setProperty("webApp.home", event.getServletContext().getRealPath("/"));
+ System.setProperty("webApp.name", new File(event.getServletContext().getRealPath("/")).getName());
+ DOMConfigurator.configureAndWatch(confFile.getAbsolutePath());
+ logger = Logger.getLogger(Application.class);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.app;
+
+import fr.gouv.finances.cp.utils.PropertiesExpansion;
+import fr.gouv.finances.cp.xemelios.data.impl.MySqlDataLayer;
+import fr.gouv.finances.dgfip.utils.Pair;
+import fr.gouv.finances.dgfip.xemelios.auth.AuthEngine;
+import fr.gouv.finances.dgfip.xemelios.auth.UnauthorizedException;
+import fr.gouv.finances.dgfip.xemelios.auth.XemeliosUser;
+import fr.gouv.finances.dgfip.xemelios.common.Constants;
+import fr.gouv.finances.dgfip.xemelios.common.config.DocumentModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.DocumentsModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.ElementModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.EtatModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.Loader;
+import fr.gouv.finances.dgfip.xemelios.data.DataAccessException;
+import fr.gouv.finances.dgfip.xemelios.data.DataConfigurationException;
+import fr.gouv.finances.dgfip.xemelios.data.DataLayerManager;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.HasMenuType;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import javax.servlet.ServletContextEvent;
+import org.apache.log4j.Logger;
+
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.Menu;
+
+/**
+ * @author CBO
+ */
+public class XemeliosHelper {
+
+ private static final Logger logger = Logger.getLogger(XemeliosHelper.class);
+ static private DocumentsModel documentsModel;
+ static private AuthEngine authEngine;
+ private static PropertiesExpansion applicationProperties;
+
+ static public void init(ServletContextEvent event) {
+ logger.debug(event.getServletContext().getServletContextName());
+ PropertiesExpansion pe = new PropertiesExpansion();
+ pe.setProperty(MySqlDataLayer.PROP_CONFIG_FILE_NAME, event.getServletContext().getRealPath("/WEB-INF/mysql.properties"));
+ for(Enumeration<String> enumer = event.getServletContext().getInitParameterNames(); enumer.hasMoreElements();) {
+ String key = enumer.nextElement();
+ pe.setProperty(key, event.getServletContext().getInitParameter(key));
+ }
+ applicationProperties = pe;
+ try {
+ String documentDefsDirsName = event.getServletContext().getInitParameter("documents-def.dir");
+ if (documentDefsDirsName == null) {
+ documentDefsDirsName = event.getServletContext().getRealPath("WEB-INF/documents-def");
+ } else {
+ String baseDir = event.getServletContext().getRealPath("/");
+logger.debug("baseDir is "+baseDir);
+ File f = new File(baseDir).getParentFile().getParentFile().getParentFile().getParentFile();
+ if(event.getServletContext().getInitParameter("baseDir")!=null) {
+ baseDir = event.getServletContext().getInitParameter("baseDir");
+ f = new File(baseDir);
+ }
+ documentDefsDirsName = documentDefsDirsName.replace("%basedir%", f.getCanonicalPath()).replace("\n", "").trim();
+ }
+ XemeliosHelper.documentsModel = Loader.getDocumentsInfos(documentDefsDirsName);
+ } catch (Exception e) {
+ throw new RuntimeException("Erreur lors du chargement des documents depuis " + System.getProperty(Constants.SYS_PROP_DOC_DEF_DIR), e);
+ }
+ try {
+ DataLayerManager.setApplicationProperties(applicationProperties);
+ DataLayerManager.regiterDataImpl("mysql", MySqlDataLayer.class);
+ DataLayerManager.setDataImpl("mysql");
+ } catch (DataConfigurationException dce) {
+ throw new RuntimeException("Erreur lors de la configuration de la couche d'accès aux données", dce);
+ }
+ AuthEngine.Holder.init("web.authEngineClassName");
+ }
+
+ public static Menu getMenu(XemeliosUser user) {
+ Menu mnu = loadMenu(user);
+// logger.debug("menu=\n"+mnu.toString());
+ return mnu;
+ }
+
+ public static void shutdown() {
+ try {
+ DataLayerManager.getImplementation().shutdown();
+ } catch (DataConfigurationException dce) {
+ throw new RuntimeException(dce);
+ }
+ }
+
+ static public DocumentsModel getDocumentsModel() {
+ return XemeliosHelper.documentsModel;
+ }
+
+ static public DocumentModel getDocumentModel(String documentId) {
+ for (DocumentModel dm : documentsModel.getDocuments()) {
+ if (documentId.equals(dm.getId())) {
+ return dm;
+ }
+ }
+ return null;
+ }
+
+ static public List<Pair> getCollectivites(XemeliosUser user, DocumentModel documentModel) throws DataConfigurationException, DataAccessException {
+ try {
+ return new ArrayList<Pair>(DataLayerManager.getImplementation().getCollectivites(documentModel, null, user));
+ } catch (UnauthorizedException ex) {
+ return new ArrayList<Pair>();
+ }
+ }
+
+ static public Pair getCollectivite(XemeliosUser user, DocumentModel documentModel, String collectiviteId) throws DataConfigurationException, DataAccessException {
+ for (Pair pair : getCollectivites(user, documentModel)) {
+ if (collectiviteId.equals(pair.key)) {
+ return pair;
+ }
+ }
+ return null;
+ }
+
+ static public List<Pair> getBudgets(XemeliosUser user, DocumentModel documentModel, String collectiviteId) throws DataConfigurationException, DataAccessException, UnauthorizedException {
+ return new ArrayList<Pair>(DataLayerManager.getImplementation().getBudgets(documentModel, getCollectivite(user, documentModel, collectiviteId), user));
+ }
+
+ static public Pair getBudget(XemeliosUser user, DocumentModel documentModel, String collectiviteId, String budgetId) throws DataConfigurationException, DataAccessException, UnauthorizedException {
+ for (Pair pair : getBudgets(user, documentModel, collectiviteId)) {
+ if (budgetId.equals(pair.key)) {
+ return pair;
+ }
+ }
+ return null;
+ }
+
+ public static AuthEngine getAuthEngine() {
+ return authEngine;
+ }
+
+ static private Menu loadMenu(XemeliosUser user) {
+ Menu toReturn = new Menu(HasMenuType.TYPE_NONE, null, null, null, false);
+
+ // TODO add control entries
+
+ // search menus
+ Menu searchMenu = new Menu(HasMenuType.TYPE_SEARCH);
+ for (DocumentModel dm : documentsModel.getDocuments()) {
+ logger.debug("processing "+dm.getId());
+ if(dm.getDisplayInMenuIf()!=null && !"true".equals(getApplicationProperties().getProperty(dm.getDisplayInMenuIf()))) {
+ logger.debug("skipping because "+dm.getDisplayInMenuIf()+" is not set to true");
+ continue;
+ }
+ if (user.hasDocument(dm.getId())) {
+ Enumeration<EtatModel> enumer2 = dm.getEtats().elements();
+ Menu searchEntry = new Menu(HasMenuType.TYPE_PARENT, dm.getId(), null, dm.getTitre(), false);
+ while (enumer2.hasMoreElements()) {
+ EtatModel em = enumer2.nextElement();
+ if (em.getDisplayInMenuIf() != null && !"true".equals(getApplicationProperties().getProperty(em.getDisplayInMenuIf()))) {
+ logger.debug(em.getId()+": skipping because "+em.getDisplayInMenuIf()+" is not set to true");
+ continue;
+ }
+ Menu tmpMnu = null;
+ if (!dm.isGroupMenuItem()) {
+ tmpMnu = new Menu(HasMenuType.TYPE_PARENT, em.getId(), null, em.getTitre(), false);
+ } else {
+ tmpMnu = searchEntry;
+ }
+ for (ElementModel elm : em.getSearchableElements()) {
+ if (!elm.isDisplay()) {
+ logger.debug(elm.getId()+": skipping bescause isDisplay is set to false");
+ continue;
+ }
+ tmpMnu.addChild(new Menu(HasMenuType.TYPE_SEARCH, elm.getId(), dm.getId() + "/" + em.getId() + "/" + elm.getId(), elm.getTitre(), true));
+// logger.debug("adding "+dm.getId() + "/" + em.getId() + "/" + elm.getId());
+ }
+ if (tmpMnu != searchEntry) {
+ if (tmpMnu.getChilds().size() > 0) {
+ searchEntry.addChild(tmpMnu);
+ }
+ }
+ }
+ if(searchEntry.getChilds().size()>0) {
+ searchMenu.addChild(searchEntry);
+ } else {
+ logger.debug("do not add menu because it is empty");
+ }
+ }
+ }
+ toReturn.addChild(searchMenu);
+
+ if (user.hasRole(XemeliosUser.ROLE_SEARCH)) {
+ Menu navigateMenu = new Menu(HasMenuType.TYPE_NAVIGATE);
+ for (DocumentModel dm : documentsModel.getDocuments()) {
+ if(dm.getDisplayInMenuIf()!=null && !"true".equals(getApplicationProperties().getProperty(dm.getDisplayInMenuIf()))) {
+ logger.debug("skipping "+dm.getId()+" because "+dm.getDisplayInMenuIf()+" is not set to true");
+ }
+ if (user.hasDocument(dm.getId())) {
+ if (dm.isBrowsable()) {
+// logger.debug("adding navigation to "+dm.getId());
+ navigateMenu.addChild(new Menu(HasMenuType.TYPE_NAVIGATE, dm.getId(), dm.getId(), dm.getTitre(), false, dm.getNavigateToDocumentWebClassName()) );
+ }
+ }
+ }
+ toReturn.addChild(navigateMenu);
+ }
+
+ // TODO: add here companion tools
+ return toReturn;
+ }
+
+ private XemeliosHelper() {
+ }
+
+ /**
+ * Renvoie les propriétés définies pour l'application
+ * @return
+ */
+ public static PropertiesExpansion getApplicationProperties() {
+ return applicationProperties;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.connexion;
+
+import fr.gouv.finances.dgfip.xemelios.auth.AuthEngine;
+import fr.gouv.finances.dgfip.xemelios.auth.XemeliosUser;
+import fr.gouv.finances.dgfip.xemelios.web2.app.XemeliosHelper;
+import fr.gouv.finances.dgfip.xemelios.web2.utils.AttributeHelper;
+import fr.gouv.finances.dgfip.xemelios.web2.utils.StdDispatchAction;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.log4j.Logger;
+import org.apache.struts.Globals;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
+
+/**
+ * @author CBO
+ */
+public class ConnexionAction extends StdDispatchAction {
+
+ @SuppressWarnings("rawtypes")
+ static private final ThreadLocal threadLocalRequestHolder = new ThreadLocal();
+ private static final Logger logger = Logger.getLogger(StdDispatchAction.class);
+
+ @SuppressWarnings("rawtypes")
+ static public ThreadLocal getThreadLocalRequestHolder() {
+ return ConnexionAction.threadLocalRequestHolder;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
+ // On nettoie la session tout en conservant l'�ventuel message d'erreur :
+ ActionMessages actionMessages = (ActionMessages) request.getSession().getAttribute(Globals.ERROR_KEY);
+ request.getSession().invalidate();
+ if (actionMessages != null) {
+ request.getSession().setAttribute(Globals.ERROR_KEY, actionMessages);
+ }
+ if (getAuthEngine().isLoginRequired() || getAuthEngine().isPasswordRequired()) {
+ // Le systeme d'authentification n�cessite une saisie de l'utilisateur, on redirige vers une page de saisie :
+ return displayUserUI(mapping, request);
+ } else {
+ // Le systeme d'authentification ne n�cessite pas de saisie de l'utilisateur, on l'interroge donc directement.
+ // Pour les SSO transmettant des informations dans la requete on rend accessible, le temps de l'interrogation, l'objet Request :
+ getThreadLocalRequestHolder().set(request);
+ XemeliosUser user = getAuthEngine().createUser(null, null);
+ // Une fois l'authentification effectu�e on retire l'objet Request :
+ getThreadLocalRequestHolder().remove();
+ if (user != null) {
+ return processSuccessfullAuthentification(mapping, request, user);
+ } else {
+ // Echec d�finitif :
+ response.sendError(HttpServletResponse.SC_FORBIDDEN);
+ return null;
+ }
+ }
+ }
+
+ public ActionForward processUserInputs(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
+ final ConnexionForm connexionForm = (ConnexionForm) form;
+ XemeliosUser user = getAuthEngine().createUser(
+ getAuthEngine().isLoginRequired() ? connexionForm.getLogin() : null,
+ getAuthEngine().isPasswordRequired() ? connexionForm.getPassword() : null);
+ if (user != null) {
+ return processSuccessfullAuthentification(mapping, request, user);
+ } else {
+ ActionMessages errors = new ActionMessages();
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("connexion.erreur.authentificationFail"));
+ saveErrors(request, errors);
+ return displayUserUI(mapping, request);
+ }
+ }
+
+ private ActionForward displayUserUI(ActionMapping mapping, HttpServletRequest request) {
+ logger.info("authEngine is " + getAuthEngine().getClass().getName());
+ request.setAttribute("isLoginRequired", getAuthEngine().isLoginRequired());
+ request.setAttribute("isPasswordRequired", getAuthEngine().isPasswordRequired());
+ return mapping.getInputForward();
+ }
+
+ private AuthEngine getAuthEngine() {
+ return AuthEngine.Holder.getAuthEngine();
+ }
+
+ private ActionForward processSuccessfullAuthentification(ActionMapping mapping, HttpServletRequest request, XemeliosUser user) {
+ AttributeHelper.setUser(request.getSession(), user);
+ AttributeHelper.setMenu(request.getSession(), XemeliosHelper.getMenu(user));
+ return mapping.findForward("success");
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.connexion;
+
+import org.apache.commons.digester.Digester;
+import org.apache.struts.action.ActionForm;
+
+/**
+ * @author CBO
+ */
+@SuppressWarnings("serial")
+public class ConnexionForm extends ActionForm {
+
+ private String login;
+ private String password;
+
+ public String getLogin() {
+ return login;
+ }
+
+ public void setLogin(String login) {
+ this.login = login;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.connexion;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.struts.action.Action;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+/**
+ * @author CBO
+ */
+public class DeconnexionAction extends Action {
+
+ @Override
+ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
+ request.getSession().invalidate();
+ return mapping.findForward("success");
+ }
+
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
+
+<module rename-to="XeMeLios"> <!-- " -->
+ <inherits name="com.google.gwt.user.User"/>
+ <!--inherits name="com.google.gwt.logging.Logging"/-->
+
+ <!-- Inherit the default GWT style sheet. You can change -->
+ <!-- the theme of your GWT application by uncommenting -->
+ <!-- any one of the following lines. -->
+ <inherits name='com.google.gwt.user.theme.standard.Standard'/>
+ <!-- inherits name="com.google.gwt.user.theme.chrome.Chrome"/ -->
+ <!-- inherits name="com.google.gwt.user.theme.dark.Dark"/-->
+
+ <!-- configuration des loggers -->
+ <!--set-property name="gwt.logging.simpleRemoteHandler" value="ENABLED" />
+ <set-property name="gwt.logging.logLevel" value="ALL"/>
+ <set-property name="gwt.logging.enabled" value="TRUE"/>
+ <set-property name="gwt.logging.consoleHandler" value="ENABLED"/>
+ <set-property name="gwt.logging.developmentModeHandler" value="ENABLED"/-->
+
+
+ <entry-point class="fr.gouv.finances.dgfip.xemelios.web2.gwt.client.XemeliosStarterEntryPoint"/>
+ <source path="client"/>
+ <source path="shared"/>
+ <!-- Do not define servlets here, use web.xml -->
+</module>
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client;
+
+import com.google.gwt.resources.client.ImageResource;
+
+/**
+ *
+ * @author chm
+ */
+public interface Displayable {
+ public String getId();
+ public String getLibelle();
+ public String getResource();
+}
--- /dev/null
+/*
+ * Copyright
+ * 2010 axYus - www.axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.CollectiviteTreeDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.CritereItemDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.InitParametersDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.LabelValueDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.ListResultatDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.Menu;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchInitParametersDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchParameterDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchResultDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SelectOneCritereItemDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.StoredSearchDTO;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ * @author cmarchand
+ */
+@RemoteServiceRelativePath("XeMeLios")
+public interface XemeliosService extends RemoteService {
+
+ /**
+ * Renvoie le menu de l'utilisateur.
+ * @return
+ */
+ public Menu getMenu();
+
+ /**
+ * Renvoie l'utilisateur connecté
+ * @return
+ */
+ public String getConnectedUser();
+
+ /**
+ * Renvoie l'arbre des collectivité (avec les collectivités parentes
+ * @param documentId
+ * @param includeBudgetSK
+ * @return
+ */
+ public CollectiviteTreeDTO getCollectiviteTree(String documentId, boolean includeBudgetSK);
+
+ /**
+ * Renvoie la liste des collectivités pour un type de document donné,
+ * et ayant pour parents les éventuels passés
+ * @param documentId
+ * @param parents
+ * @return
+ */
+ public List<LabelValueDTO> getCollectivites(String documentId, String[] parents);
+
+// accès aux configurations des documents
+ /**
+ * Renvoie, pour le document donné, l'état navigable par défaut
+ * @param documentId
+ * @return
+ */
+ public String getDefaultBrowsableEtat(String documentId);
+
+ /**
+ * Renvoie, pour un état donné, l'élément navigable par défaut
+ * @param documentId
+ * @param etatId
+ * @return
+ */
+ public String getDefaultBrowsableElement(String documentId, String etatId);
+
+ /**
+ * Renvoie le libellé de l'élément désigné
+ * @param docId
+ * @param etatId
+ * @param elementId
+ * @return
+ */
+ public String getLibelleElement(String docId, String etatId, String elementId);
+ /**
+ * Renvoie la liste des budgets pour ce document et cette collectivité
+ * @param documentId
+ * @param collectiviteId
+ * @return
+ */
+ public List<LabelValueDTO> getBudgetsFromDocument(String documentId, String collectiviteId);
+ /**
+ * Renvoie les special-keys de niveau 1 pour ce document, cette collectivité et ce budget
+ * @param documentId
+ * @param collectivite
+ * @param budget
+ * @return
+ */
+ public List<LabelValueDTO> getSpecialKeys1(String documentId, String collectivite, String budget);
+
+ /**
+ * Renvoie les special-keys de niveau 2 pour cette collectivité, ce budget
+ * et cette special-key de niveau 1
+ * @param documentId
+ * @param collectivite
+ * @param budget
+ * @param sk1
+ * @return
+ */
+ public List<LabelValueDTO> getSpecialKeys2(String documentId, String collectivite, String budget, String sk1);
+ /**
+ * Renvoie les collectivités parentes de niveau <code>level</code> ayant pour parents <code>parents</code>
+ * et appartenant au document <code>documentId</code>
+ * @param documentId
+ * @param level
+ * @param parents
+ * @return
+ */
+ public List<LabelValueDTO> getParentCollectivites(String documentId, int level, String[] parents);
+ /**
+ * Renvoie la liste des budgets pour la collectivité
+ * @param searchSessionId
+ * @param collectiviteId
+ * @return
+ */
+ public ArrayList<LabelValueDTO> getBudgets(String searchSessionId, String collectiviteId);
+ /**
+ * Initialise une fenêtre de recherche
+ * @param documentId
+ * @param etatId
+ * @param elementId
+ * @return
+ */
+ public InitParametersDTO initSearchWindow(String documentId, String etatId, String elementId);
+
+ /**
+ * Renvoie les informations du critere demandé
+ * @param searchSessionId
+ * @param collectiviteId
+ * @param budgetId
+ * @param critereId
+ * @param selectId
+ * @param inputValuesById
+ * @param pluginId
+ * @return Le critere
+ */
+ public SelectOneCritereItemDTO getUpdatedSelectOneCritereItemDTO(String searchSessionId, String collectiviteId, String budgetId, String critereId, String selectId, Map<String,String> inputValuesById, String pluginId);
+
+ /**
+ * Renvoie la définition du critère
+ * @param searchSessionId Session de recherche
+ * @param collectiviteId Collectivite
+ * @param budgetId Budget
+ * @param critereId Critere
+ * @param pluginId Plugin, le cas échéant, null sinon
+ * @return
+ */
+ public ArrayList<CritereItemDTO> getCritereDefinition(String searchSessionId, String collectiviteId, String budgetId, String critereId, String pluginId);
+
+ /**
+ * Execute la recherche et renvoie le résultat
+ * @param searchSessionId
+ * @param collectiviteId
+ * @param budgetId
+ * @param searchParams
+ * @param pluginId null si ce n'est pas une recherche sur plugin
+ * @return
+ */
+ public SearchResultDTO search(String searchSessionId, String collectiviteId, String budgetId, List<SearchParameterDTO> searchParams, String pluginId);
+
+ /**
+ * Execute un export basé sur un plugin
+ * @param searchSessionId
+ * @param collectiviteId
+ * @param budgetId
+ * @param pluginId
+ * @param searchParams
+ * @return l'Url à laquelle l'export est disponible
+ */
+ public String processPluginExport(String searchSessionId, String collectiviteId, String budgetId, String pluginId, List<SearchParameterDTO> searchParams);
+
+ /**
+ * Renvoie la liste des recherche enregistrées sous le nom de l'utilisateur connecté
+ * @param searchSessionId
+ * @return
+ */
+ public List<StoredSearchDTO> getSavedPrivateSearchs(String searchSessionId);
+
+ /**
+ * Enregistre la recherche
+ * @param searchSessionId
+ * @param searchParams
+ * @param requestName
+ * @return
+ */
+ public String saveRequest(String searchSessionId, List<SearchParameterDTO> searchParams, String requestName);
+ /**
+ * Enregistre la recherche
+ * @param searchSessionId
+ * @param searchParams
+ * @param requestName
+ * @param requestId
+ * @return
+ */
+ public String saveRequest(String searchSessionId, List<SearchParameterDTO> searchParams, String requestName, String requestId);
+
+ /**
+ * Renvoie la liste des recherches enregistrées utilisables
+ * @param searchSessionId
+ * @return
+ */
+ public List<StoredSearchDTO> getStoredSearchs(String searchSessionId);
+
+ /**
+ * Renvoie les paramètres d'initialisation pour un plugin donné
+ * @param searchSessionId
+ * @param pluginId
+ * @return
+ */
+ public SearchInitParametersDTO getSearchInitParameters(String searchSessionId, String pluginId);
+ /**
+ * La même, pour les requêtes enregistrées
+ * @param searchSessionId
+ * @param searchId
+ * @return
+ */
+ public SearchInitParametersDTO getSearchInitParametersForSavedSearch(String searchSessionId, String searchId);
+
+ /**
+ * Renvoie la liste de recherche actuellement configurée pour la fenêtre spécifiée
+ * @param searchSessionId
+ * @return
+ */
+ public ListResultatDTO getListResultatDTO(String searchSessionId);
+
+ /**
+ * Permet de définir pour cette recherche les champs à afficher et l'ordre de tri
+ * @param searchSessionId
+ * @param lr
+ * @return
+ */
+ public String setListResultatDTO(String searchSessionId, ListResultatDTO lr);
+ /**
+ * Fake method pour faire ajouter les types là où il faut
+ * @return
+ */
+ public Integer getInteger();
+ public Date getDate();
+ public BigDecimal getBigDecimal();
+
+ /**
+ * Permet de charger une page spécifique d'un résultat de recherche
+ * @param searchSessionId
+ * @param pageNumber
+ * @return
+ */
+ public SearchResultDTO loadPage(String searchSessionId, int pageNumber);
+
+ /**
+ * Récupère une liste de valeurs
+ * @param searchSessionId
+ * @param collectivite
+ * @param budget
+ * @param path
+ * @return
+ */
+ public List<String> getDistinctValues(String searchSessionId, String collectivite, String budget, String path);
+ /**
+ * Détruit le contexte de recherche
+ * @param searchSessionId
+ */
+ public void destroySearchSession(String searchSessionId);
+
+ /**
+ * Indique si une recherche est possible dans ce document
+ * @param documentId
+ * @return <tt>true</tt> si une recherche est possible dans ce document, <tt>false</tt> sinon
+ */
+ public boolean canSearch(String documentId, String etatId);
+}
--- /dev/null
+/*
+ * Copyright
+ * 2010 axYus - www.axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.CollectiviteTreeDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.CritereItemDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.InitParametersDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.LabelValueDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.ListResultatDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.Menu;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchInitParametersDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchParameterDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchResultDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SelectOneCritereItemDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.StoredSearchDTO;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ * @author cmarchand
+ */
+public interface XemeliosServiceAsync {
+
+ /**
+ * Renvoie le menu de l'utilisateur.
+ * En fait, ne contient que la partie paramétrable du menu
+ * @param asyncCallback
+ */
+ public void getMenu(AsyncCallback<Menu> asyncCallback);
+
+ /**
+ * Renvoie l'utilisateur connecté (son ID)
+ * @param asyncCallback
+ */
+ public void getConnectedUser(AsyncCallback<String> asyncCallback);
+
+ /**
+ * Renvoie l'arbre des collectivités, avec les collectivités parentes et
+ * éventuellement les budgets
+ * @param documentId
+ * @param includeBudgetSK
+ * @param asyncCallback
+ */
+ public void getCollectiviteTree(String documentId, boolean includeBudgetSK, AsyncCallback<CollectiviteTreeDTO> asyncCallback);
+
+ /**
+ * Renvoie la liste des collectivité pour le type de document donné, et ayant
+ * pour parents les éventuels parents passés
+ * @param documentId
+ * @param parents
+ * @param asyncCallback
+ */
+ public void getCollectivites(String documentId, String[] parents, AsyncCallback<List<LabelValueDTO>> asyncCallback);
+
+ /**
+ * Renvoie l'état naigable par défaut pour ce document
+ * @param documentId
+ * @param asyncCallback
+ */
+ public void getDefaultBrowsableEtat(String documentId, AsyncCallback<String> asyncCallback);
+
+ /**
+ * Renvoie l'élément navigable par défaut pour cet état
+ * @param documentId
+ * @param etatId
+ * @param asyncCallback
+ */
+ public void getDefaultBrowsableElement(String documentId, String etatId, AsyncCallback<String> asyncCallback);
+ /**
+ * Renvoie la liste des budgets pour ce document et cette collectivité
+ * @param documentId
+ * @param collectiviteId
+ * @param asyncCallback
+ */
+ public void getBudgetsFromDocument(String documentId, String collectiviteId, AsyncCallback<List<LabelValueDTO>> asyncCallback);
+ /**
+ * Renvoie le libellé de l'élément
+ * @param docId
+ * @param etatId
+ * @param elementId
+ * @param asyncCallback
+ */
+ public void getLibelleElement(String docId, String etatId, String elementId, AsyncCallback<String> asyncCallback);
+
+ /**
+ * Renvoie les special-keys de niveau 1
+ * @param documentId
+ * @param collectivite
+ * @param budget
+ * @param asyncCallback
+ */
+ public void getSpecialKeys1(String documentId, String collectivite, String budget, AsyncCallback<List<LabelValueDTO>> asyncCallback);
+ /**
+ * Renvoie les special-keys de niveau 2
+ * @param documentId
+ * @param collectivite
+ * @param budget
+ * @param sk2
+ * @param asyncCallback
+ */
+ public void getSpecialKeys2(String documentId, String collectivite, String budget, String sk2, AsyncCallback<List<LabelValueDTO>> asyncCallback);
+ /**
+ * Renvoie les collectivités parentes de niveau <code>level</code> ayant pour parents <code>parents</code>
+ * et appartenant au document <code>documentId</code>
+ * @param documentId
+ * @param level
+ * @param parents
+ * @param asyncCallback
+ */
+ public void getParentCollectivites(String documentId, int level, String[] parents, AsyncCallback<List<LabelValueDTO>> asyncCallback);
+ /**
+ *
+ * @param searchSessionId
+ * @param collectiviteId
+ * @param asyncCallback
+ */
+ public void getBudgets(String searchSessionId, String collectiviteId, AsyncCallback<ArrayList<LabelValueDTO>> asyncCallback);
+ /**
+ * Initialise une nouvelle fenêtre de recherche
+ * @param documentId
+ * @param etatId
+ * @param elementId
+ * @param asyncCallback
+ */
+ public void initSearchWindow(String documentId, String etatId, String elementId, AsyncCallback<InitParametersDTO> asyncCallback);
+
+ /**
+ * Renvoie les informations requises concernant le critere demandé
+ * @param searchSessionId La session de recherche
+ * @param collectiviteId La collectivite
+ * @param budgetId Le budget
+ * @param critereId Le critere
+ * @param selectId L'input
+ * @param inputValuesById Les valeurs de l'input
+ * @param pluginId Le plugin (le cas échéant, ou null si pas de plugin)
+ * @param async
+ */
+ public void getUpdatedSelectOneCritereItemDTO(String searchSessionId, String collectiviteId, String budgetId, String critereId, String selectId, Map<String,String> inputValuesById, String pluginId, AsyncCallback<SelectOneCritereItemDTO> async);
+
+ /**
+ * Renvoie le contenu du critere
+ * @param searchSessionId
+ * @param collectiviteId
+ * @param budgetId
+ * @param critereId
+ * @param pluginId
+ * @param async
+ */
+ public void getCritereDefinition(String searchSessionId, String collectiviteId, String budgetId, String critereId, String pluginId, AsyncCallback<ArrayList<CritereItemDTO>> async);
+
+ /**
+ * Effectue la recherche
+ * @param searchSessionId
+ * @param collectiviteId
+ * @param budgetId
+ * @param searchParams
+ * @param pluginId
+ * @param async
+ */
+ public void search(String searchSessionId, String collectiviteId, String budgetId, List<SearchParameterDTO> searchParams, String pluginId, AsyncCallback<SearchResultDTO> async);
+
+ /**
+ * Execute un export basé sur un plugin, et renvoie l'URL à laquelle l'export est disponible
+ * @param searchSessionId
+ * @param collectiviteId
+ * @param budgetId
+ * @param pluginId
+ * @param searchParams
+ * @param async
+ */
+ public void processPluginExport(String searchSessionId, String collectiviteId, String budgetId, String pluginId, List<SearchParameterDTO> searchParams, AsyncCallback<String> async);
+
+ /**
+ * Renvoie la liste des recherches enregistrées qui correspondent à la session de recherche
+ * @param searchSessionId
+ * @param async
+ */
+ public void getSavedPrivateSearchs(String searchSessionId, AsyncCallback<List<StoredSearchDTO>> async);
+ /**
+ * Enregistre la recherche
+ * @param searchSessionId
+ * @param searchParams
+ * @param requestName
+ * @param async
+ */
+ public void saveRequest(String searchSessionId, List<SearchParameterDTO> searchParams, String requestName, AsyncCallback<String> async);
+ /**
+ * Enregistre la recherche sou selle déjà existante
+ * @param searchSessionId
+ * @param searchParams
+ * @param requestName
+ * @param requestId
+ * @param async
+ */
+ public void saveRequest(String searchSessionId, List<SearchParameterDTO> searchParams, String requestName, String requestId, AsyncCallback<String> async);
+ /**
+ * Renvoie la liste des recherches utilisables
+ * @param searchSessionId
+ * @param async
+ */
+ public void getStoredSearchs(String searchSessionId, AsyncCallback<List<StoredSearchDTO>> async);
+ /**
+ * Renvoie les critères d'initionalisation du plugin
+ * @param searchSessionId
+ * @param pluginId
+ * @param async
+ */
+ public void getSearchInitParameters(String searchSessionId, String pluginId, AsyncCallback<SearchInitParametersDTO> async);
+ /**
+ * Renvoie les critères d'initialisation d'une requête enregistrée
+ * @param searchSessionId
+ * @param searchId
+ * @param async
+ */
+ public void getSearchInitParametersForSavedSearch(String searchSessionId, String searchId, AsyncCallback<SearchInitParametersDTO> async);
+
+ /**
+ * Renvoie la liste de résultat de recherche
+ * @param searchSessionId
+ * @param asyncCallback
+ */
+ public void getListResultatDTO(String searchSessionId, AsyncCallback<ListResultatDTO> asyncCallback);
+
+ /**
+ * Permet de définir les champs à afficher et la façon de trier pour cette fenêtre de recherche
+ * @param searchSessionId
+ * @param lr
+ * @param asyncCallback
+ */
+ public void setListResultatDTO(String searchSessionId, ListResultatDTO lr, AsyncCallback<String> asyncCallback);
+
+ /**
+ * fake method pour déclarer les Integer dans la serialization
+ * @param asyncCallback
+ */
+ public void getInteger(AsyncCallback<Integer> asyncCallback);
+ /**
+ * Fake method pour déclarer les Date dans la serialisation
+ * @param asyncCallback
+ */
+ public void getDate(AsyncCallback<Date> asyncCallback);
+ /**
+ * Fake method pour déclarer les BigDecimal dans la SerializationPolicy
+ * @param asyncCallback
+ */
+ public void getBigDecimal(AsyncCallback<BigDecimal> asyncCallback);
+
+ public void loadPage(String searchSessionId, int pageNumber, AsyncCallback<SearchResultDTO> asyncCallback);
+ public void getDistinctValues(String searchSessionId, String collectivite, String budget, String path, AsyncCallback<List<String>> asyncCallback);
+ public void destroySearchSession(String searchSessionId, AsyncCallback asyncCallback);
+ public void canSearch(String documentId, String etatId, AsyncCallback<Boolean> asyncCallback);
+}
--- /dev/null
+/*
+ * Copyright
+ * 2010 axYus - www.axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client;
+
+import com.google.gwt.core.client.EntryPoint;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.RootLayoutPanel;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.root.Tabs;
+
+/**
+ * Main entry point.
+ *
+ * @author cmarchand
+ */
+public class XemeliosStarterEntryPoint implements EntryPoint {
+ /**
+ * Creates a new instance of XemeliosStarterEntryPoint
+ */
+ public XemeliosStarterEntryPoint() {
+ }
+
+ /**
+ * The entry point method, called automatically by loading a module
+ * that declares an implementing class as an entry-point
+ */
+ @Override
+ public void onModuleLoad() {
+ Tabs tabs = new Tabs();
+ RootLayoutPanel.get().add(tabs);
+ RootLayoutPanel.get().setHeight(Integer.toString(Window.getClientHeight()));
+ RootLayoutPanel.get().setWidth(Integer.toString(Window.getClientWidth()));
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.service;
+
+import com.google.gwt.core.client.GWT;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.XemeliosService;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.XemeliosServiceAsync;
+//import java.util.logging.Level;
+//import java.util.logging.Logger;
+
+/**
+ * @author CBO
+ */
+public class ServiceLocator {
+ static private XemeliosServiceAsync xemeliosService;
+// private static final Logger logger = Logger.getLogger(ServiceLocator.class.getName());
+
+ static public XemeliosServiceAsync getXemeliosService() {
+ if (xemeliosService == null) {
+ xemeliosService = (XemeliosServiceAsync) GWT.create(XemeliosService.class);
+// ServiceDefTarget endpoint = (ServiceDefTarget) xemeliosService;
+// logger.log(Level.SEVERE, "GWTUtils.getContextPath()="+GWTUtils.getContextPath());
+// endpoint.setServiceEntryPoint(GWTUtils.getContextPath() + "fr.gouv.finances.dgfip.xemelios.web2.gwt/XemeliosService");
+// logger.log(Level.SEVERE, "serviceEntryPoint="+endpoint.getServiceEntryPoint());
+// Window.alert(endpoint.getServiceEntryPoint());
+ }
+ return xemeliosService;
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.utils;
+
+/**
+ * @author CBO
+ */
+public interface DoneListener<T> {
+
+ void done(T result);
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2010 axYus - www.axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.utils;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.rpc.StatusCodeException;
+
+/**
+ *
+ * @author cmarchand
+ */
+public class GWTUtils {
+ static public final int REMOTE_ERROR_FOR_REDIRECTION_CODE = 1000;
+
+ static public String getContextPath() {
+ return GWT.getModuleBaseURL().replace(GWT.getModuleName() + "/", "");
+ }
+ public static void openUrlInNewWindow(String url) {
+ // TODO
+ }
+ public static void handleRPCError(Throwable pThrowable) {
+ try {
+ throw pThrowable;
+ } catch(StatusCodeException sce) {
+ if (sce.getStatusCode() == GWTUtils.REMOTE_ERROR_FOR_REDIRECTION_CODE) {
+ GWTUtils.setURL(sce.getMessage());
+ } else {
+ handleUnExpectedRPCError(pThrowable);
+ }
+ } catch(Throwable t) {
+ handleUnExpectedRPCError(pThrowable);
+ }
+ }
+ private static void handleUnExpectedRPCError(Throwable throwable) {
+ Window.alert("Erreur innatendue" + (throwable != null ? " : " + throwable.toString() : ""));
+ }
+ public static native void setURL(String url) /*-{
+ $wnd.top.location.href = url;
+ }-*/;
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2010 axYus - www.axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets;
+
+import com.google.gwt.user.client.ui.HasHorizontalAlignment;
+import com.google.gwt.user.client.ui.HasVerticalAlignment;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.Widget;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.root.RootClientBundle;
+
+/**
+ *
+ * @author cmarchand
+ */
+public class AccueilWidget extends HorizontalPanel {
+ public AccueilWidget() {
+ super();
+ initComponents();
+ }
+ private void initComponents() {
+ setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
+ setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
+ setWidth("100%");
+ setHeight("100%");
+ Image image = new Image(RootClientBundle.INSTANCE.getXemeliosLogo());
+ add(image);
+ }
+ public void replaceWidget(Widget newWidget) {
+ while(getWidgetCount()>0) remove(0);
+ add(newWidget);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2010 axYus - www.axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.common;
+
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.resources.client.ImageResource;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.Image;
+
+/**
+ * An image that can be enabled / disabled
+ * @author cmarchand
+ */
+public class DisableImage extends Composite {
+
+ private ImageResource enabledImage;
+ private ImageResource disabledImage;
+ private boolean enabled = true;
+ private Image image;
+
+ public DisableImage(ImageResource enabledImage, ImageResource disabledImage, String title) {
+ super();
+ this.enabledImage = enabledImage;
+ this.disabledImage = disabledImage;
+ image = new Image(enabledImage);
+ image.setTitle(title);
+ initWidget(image);
+ }
+ public void setEnabled(boolean enable) {
+ this.enabled = enable;
+ refreshImage();
+ }
+
+ private void refreshImage() {
+ image.setResource(enabled ? enabledImage : disabledImage);
+ }
+
+ public HandlerRegistration addClickHandler(ClickHandler handler) {
+ return image.addClickHandler(handler);
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2010 axYus - www.axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.common;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.DialogBox;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.Grid;
+import com.google.gwt.user.client.ui.HTMLTable;
+import com.google.gwt.user.client.ui.HasHorizontalAlignment;
+import com.google.gwt.user.client.ui.HasVerticalAlignment;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.InlineHTML;
+import com.google.gwt.user.client.ui.ScrollPanel;
+import com.google.gwt.user.client.ui.SourcesTableEvents;
+import com.google.gwt.user.client.ui.TableListener;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.LabelValueDTO;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Christophe Marchand
+ * Permet de choisir un élément dans une liste
+ */
+public class DlgChooseOnePair extends DialogBox implements ClickHandler {
+
+ protected FlexTable itemContainer;
+ private SelectListenerCollection selectListeners;
+
+ public DlgChooseOnePair(String title) {
+ setText(title);
+ this.selectListeners = new SelectListenerCollection();
+ VerticalPanel mainPanel = new VerticalPanel();
+ Grid header = getHeader();
+ mainPanel.add(header);
+ ScrollPanel scrollPanel = new ScrollPanel();
+ scrollPanel.setSize("350", "200");
+ this.itemContainer = new FlexTable();
+ itemContainer.setWidth("100%");
+ itemContainer.addClickHandler(this);
+ itemContainer.setStyleName("table-collapsed");
+ itemContainer.setCellSpacing(0);
+ scrollPanel.add(itemContainer);
+ mainPanel.add(scrollPanel);
+ // Les boutons Annuler et Valider :
+ mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
+ mainPanel.add(createButtonsPanel());
+ // Le widget Principal :
+ setWidget(mainPanel);
+ }
+
+ /**
+ * Construit l'entete
+ * @return
+ */
+ public Grid getHeader() {
+ Grid header = new Grid(1,2);
+ header.setWidth("100%");
+ header.setCellSpacing(0);
+ header.setStyleName("table-collapsed");
+ header.setWidget(0,0, new InlineHTML("Code"));
+ header.setWidget(0,1, new InlineHTML("Libellé"));
+ HTMLTable.CellFormatter cf = header.getCellFormatter();
+ cf.setAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE);
+ cf.setWidth(0, 0, "50%");
+ cf.setStyleName(0, 0, "cell-header");
+ cf.setAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE);
+ cf.setStyleName(0, 1, "cell-header");
+ cf.setWidth(0, 1, "50%");
+ return header;
+ }
+
+ public void addSelectListener(SelectListener selectListener) {
+ this.selectListeners.add(selectListener);
+ }
+
+ private Widget createButtonsPanel() {
+ HorizontalPanel horizontalPanel = new HorizontalPanel();
+ Button cancelButton = new Button();
+ cancelButton.setText("Annuler");
+ cancelButton.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ cancel();
+ }
+ });
+ horizontalPanel.add(cancelButton);
+ return horizontalPanel;
+ }
+
+ private void cancel() {
+ hide();
+ }
+
+ public void setItems(List<? extends LabelValueDTO> items) {
+ this.itemContainer.clear();
+ for (final LabelValueDTO item : items) {
+ int row = itemContainer.getRowCount();
+ itemContainer.insertRow(row);
+ itemContainer.addCell(row);
+ itemContainer.addCell(row);
+ HTMLTable.CellFormatter cf = itemContainer.getCellFormatter();
+ cf.setStyleName(row, 0, "clickable-cell");
+ cf.setWidth(row, 0, "50%");
+ cf.setWidth(row, 1, "50%");
+ cf.setStyleName(row, 1, "clickable-cell");
+ itemContainer.setWidget(row, 0, new InlineHTML(item.getId()));
+ itemContainer.setWidget(row, 1, new InlineHTML(item.getLibelle()));
+ itemContainer.getWidget(row, 0).getElement().setAttribute("code", item.getId());
+ itemContainer.getWidget(row, 1).getElement().setAttribute("code", item.getLibelle());
+ }
+ }
+
+ @Override
+ public void onClick(ClickEvent event) {
+ HTMLTable.Cell cell = itemContainer.getCellForEvent(event);
+ selectListeners.fireSelect(new LabelValueDTO(itemContainer.getWidget(cell.getRowIndex(), 0).getElement().getAttribute("code"), itemContainer.getWidget(cell.getRowIndex(), 1).getElement().getAttribute("code")));
+ hide();
+ }
+
+ static public interface SelectListener {
+
+ void onSelect(Object selectedItem);
+ }
+
+ static public class SelectListenerCollection extends ArrayList<SelectListener> {
+
+ public void fireSelect(Object selectedItem) {
+ for (SelectListener listener : this) {
+ listener.onSelect(selectedItem);
+ }
+ }
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.common;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.MouseOutEvent;
+import com.google.gwt.event.dom.client.MouseOutHandler;
+import com.google.gwt.event.dom.client.MouseOverEvent;
+import com.google.gwt.event.dom.client.MouseOverHandler;
+import com.google.gwt.resources.client.ImageResource;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.FocusPanel;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.Widget;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * @author CBO
+ */
+public class ImageButton extends Composite {
+ private static final Logger logger = Logger.getLogger(ImageButton.class.getName());
+
+ private FocusPanel focusPanel;
+ private Image image;
+ private Image disabledImage;
+ private boolean enabled = true;
+ private String toolTip;
+ private long timestamp;
+
+ // TODO: use an ImageResource
+
+ public ImageButton(String image, String toolTip) {
+ this(image, image, toolTip);
+ }
+ public ImageButton(ImageResource imageRsc, String toolTip) {
+ this(imageRsc, imageRsc, toolTip);
+ }
+
+ public ImageButton(ImageResource imageEnabledRsc, ImageResource imageDisabledRsc, String toolTip) {
+ timestamp = System.currentTimeMillis();
+ this.enabled = true;
+ this.focusPanel = new FocusPanel();
+ this.image = new Image(imageEnabledRsc);
+ this.disabledImage = new Image(imageDisabledRsc);
+ this.toolTip = toolTip;
+ this.focusPanel.add(this.image);
+ this.focusPanel.addMouseOverHandler(new MouseOverHandler() {
+ public void onMouseOver(MouseOverEvent moe) {
+ mouseEnter();
+ }
+ });
+ this.focusPanel.addMouseOutHandler(new MouseOutHandler() {
+ public void onMouseOut(MouseOutEvent moe) {
+ mouseLeave();
+ }
+ });
+ this.focusPanel.setTitle(toolTip);
+ initWidget(this.focusPanel);
+ setStyleName("imageButton");
+ mouseLeave();
+ }
+
+ public ImageButton(String image, String disabledImage, String toolTip) {
+ timestamp = System.currentTimeMillis();
+ this.enabled = true;
+ this.focusPanel = new FocusPanel();
+ this.image = new Image(image);
+ this.disabledImage = new Image(disabledImage);
+ Image.prefetch(disabledImage);
+ Image.prefetch(image);
+ this.toolTip = toolTip;
+ this.focusPanel.add(this.image);
+ this.focusPanel.addMouseOverHandler(new MouseOverHandler() {
+ public void onMouseOver(MouseOverEvent moe) {
+ mouseEnter();
+ }
+ });
+ this.focusPanel.addMouseOutHandler(new MouseOutHandler() {
+ public void onMouseOut(MouseOutEvent moe) {
+ mouseLeave();
+ }
+ });
+ this.focusPanel.setTitle(toolTip);
+ initWidget(this.focusPanel);
+ setStyleName("imageButton");
+ mouseLeave();
+ }
+
+ public void setEnable(boolean enabled) {
+ this.enabled = enabled;
+ focusPanel.setWidget(this.enabled ? image : disabledImage);
+ focusPanel.setTitle(this.enabled ? toolTip : "");
+ if (!enabled) {
+ mouseLeave();
+ }
+ }
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ private void mouseEnter() {
+ if (enabled) {
+// DOM.setStyleAttribute(getElement(), "border-style", "outset");
+// DOM.setStyleAttribute(getElement(), "border-width", "1px");
+// DOM.setStyleAttribute(getElement(), "margin", "0px");
+// DOM.setStyleAttribute(getElement(), "cursor", "hand");
+ }
+ }
+
+ private void mouseLeave() {
+// DOM.setStyleAttribute(getElement(), "margin", "1px");
+// DOM.setStyleAttribute(getElement(), "border-width", "0px");
+// DOM.setStyleAttribute(getElement(), "cursor", "default");
+ }
+
+ public void addClickHandler(final ClickHandler cl) {
+ focusPanel.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent ce) {
+ if (ImageButton.this.enabled) {
+// ClickEvent nce = new ClickEvent()
+ cl.onClick(ce);
+ mouseLeave();
+ }
+ }
+ });
+ }
+
+ public boolean equals(ImageButton other) {
+ logger.log(Level.ALL, "ImageButton.equals(ImageButton)");
+ return other.toolTip.equals(toolTip) && other.timestamp==timestamp;
+ }
+ public boolean equals(Widget other) {
+ if(other instanceof ImageButton) return equals((ImageButton)other);
+ return false;
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2011 axYus - www.axyus.com
+ * 201 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.common;
+
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.PopupPanel;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.SearchResources;
+
+/**
+ * Un panneau semi transparent qui affiche un truc qui tourne
+ * @author cmarchand
+ */
+public class WorkingPanel extends PopupPanel {
+
+ public WorkingPanel() {
+ super(false, false);
+ setGlassEnabled(false);
+ Image image = new Image(SearchResources.INSTANCE.getSearchingImage());
+ setWidget(image);
+ }
+ public int getImageWidth() { return getWidget().getOffsetWidth(); }
+ public int getImageHeight() { return getWidget().getOffsetHeight(); }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2010 axYus - www.axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.navigate;
+
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.ListBox;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.ColAndBudListener;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.LabelValueDTO;
+
+public class DlgSelectCollectivite extends DlgSelectNavigationTarget {
+ protected ColAndBudListener listener;
+
+ public DlgSelectCollectivite(String documentId, ColAndBudListener listener) {
+ super(documentId);
+ this.listener = listener;
+ }
+
+ @Override
+ public boolean shouldIncludeBudgetSK() { return false; }
+
+ @Override
+ public void pbOkClicked() {
+ for(ListBox cbx:listBoxes) {
+ if(cbx.getSelectedIndex()<0) {
+ Window.alert("Vous devez renseigner cette valeur.");
+ cbx.setFocus(true);
+ return;
+ }
+ }
+ LabelValueDTO coll = new LabelValueDTO(cbxCollectivite.getValue(cbxCollectivite.getSelectedIndex()), cbxCollectivite.getItemText(cbxCollectivite.getSelectedIndex()));
+ listener.setCollectivite(coll);
+ hide();
+ }
+
+ @Override
+ public String getDialogTitle() { return "Choisir une collectivité"; }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2010 axYus - www.axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.navigate;
+
+import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.event.dom.client.ChangeHandler;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.DialogBox;
+import com.google.gwt.user.client.ui.Grid;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.HasHorizontalAlignment;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.ListBox;
+import com.google.gwt.user.client.ui.TextArea;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.service.ServiceLocator;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.utils.GWTUtils;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.common.DlgChooseOnePair;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.PostRunnable;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.SearchResources;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.CollectiviteTreeDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.LabelValueDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.ParentCollectiviteDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SpecialKeyDefDTO;
+import java.util.ArrayList;
+import java.util.List;
+
+public class DlgSelectNavigationTarget extends DialogBox {
+ private String documentId;
+ private VerticalPanel vPane;
+ private Grid container;
+ private int insertedRows = 0;
+ private Button pbOk, pbCancel;
+ private Label lblCollectivite;
+ protected ListBox cbxCollectivite, cbxBudget;
+ private ArrayList<PnlCollectivite> addedCollectivites;
+ protected ArrayList<ListBox> listBoxes;
+ private TextArea logger = null;
+ private boolean debug = false;
+ private boolean onChangeEnabled = true;
+ private int calls = 0;
+ private String retUrl;
+ private String choosenCollectivite;
+ PostRunnable runner;
+
+ public DlgSelectNavigationTarget(String documentId) {
+ super(false,true);
+ setText(new HTML(getDialogTitle()).getHTML());
+ this.documentId = documentId;
+ listBoxes = new ArrayList<ListBox>();
+ initComponents();
+ }
+ public DlgSelectNavigationTarget(String documentId, PostRunnable runner) {
+ super(false,true);
+ this.runner = runner;
+ setText(new HTML(getDialogTitle()).getHTML());
+ this.documentId = documentId;
+ listBoxes = new ArrayList<ListBox>();
+ initComponents();
+ }
+
+ protected void initComponents() {
+ vPane = new VerticalPanel();
+ container = new Grid(2,3);
+ container.setWidget(0,1,new Image(SearchResources.INSTANCE.getSearchingImage()));
+ vPane.add(container);
+ container.setWidget(1,0,lblCollectivite = new Label(new HTML("Collectivité").getHTML()));
+ cbxCollectivite = new ListBox();
+ listBoxes.add(cbxCollectivite);
+ cbxCollectivite.setVisibleItemCount(1);
+ cbxCollectivite.setName("collectivite");
+ container.setWidget(1,1,cbxCollectivite);
+ if(shouldIncludeBudgetSK()) {
+ // dans tous les cas, on met le budget
+ addRow("Budget",cbxBudget=new ListBox());
+ listBoxes.add(cbxBudget);
+ cbxBudget.setVisibleItemCount(1);
+ cbxBudget.setName("budget");
+ cbxCollectivite.addChangeHandler(new ChangeHandler() {
+ @Override
+ public void onChange(ChangeEvent event) {
+ onCollectiviteChanged();
+ }
+ });
+ }
+ HorizontalPanel buttonPane = new HorizontalPanel();
+ buttonPane.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
+ pbOk = new Button(new HTML("Ok").getHTML(), new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ pbOkClicked();
+ }
+ });
+ pbCancel = new Button(new HTML("Annuler").getHTML(),new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ hide();
+ }
+ });
+ buttonPane.add(pbCancel);
+ buttonPane.add(pbOk);
+ vPane.add(buttonPane);
+ if(debug) {
+ vPane.add(logger = new TextArea());
+ logger.setWidth("100%");
+ logger.setCharacterWidth(150);
+ logger.setHeight("200px");
+ logger.setReadOnly(true);
+ }
+ center();
+ setWidget(vPane);
+ setVisible(true);
+ initializeData();
+ }
+ private int getCalls() { return calls; }
+ protected void initializeData() {
+ ServiceLocator.getXemeliosService().getCollectiviteTree(documentId, shouldIncludeBudgetSK(), new AsyncCallback<CollectiviteTreeDTO>() {
+ public void onFailure(Throwable caught) {
+ GWTUtils.handleRPCError(caught);
+ }
+ public void onSuccess(CollectiviteTreeDTO result) {
+ lblCollectivite.setText(new HTML(result.getLibelleCollectivite()).getHTML());
+ addedCollectivites = new ArrayList<PnlCollectivite>();
+ boolean firstInsert = true;
+ if(result.getCollectivitesParentModelCount()>0) {
+ for(int i=result.getCollectivitesParentModelCount()-1;i>=0;i--) {
+ PnlCollectivite[] parentItems = new PnlCollectivite[addedCollectivites.size()];
+ addedCollectivites.toArray(parentItems);
+ PnlCollectivite pnl = new PnlCollectivite(result.getParentModel(i),parentItems,i);
+ if(firstInsert) {
+ container.setWidget(0, 0, pnl.getLabel());
+ container.setWidget(0, 1, pnl.getTextBox());
+ container.setWidget(0, 2, pnl.getButton());
+ insertedRows++;
+ firstInsert = false;
+ } else {
+ insertRow(pnl);
+ }
+ addedCollectivites.add(pnl);
+ if(i==0) {
+ // on ajoute un Listener pour remplir les collectivites
+ pnl.setListener(new Listener() {
+ public void run() {
+ updateCollectiviteList();
+ }
+ });
+ }
+ }
+ } else {
+ // pour masquer l'image du chargement
+ container.setWidget(0, 1, new HTML());
+ }
+ // ajout des special keys si presentes
+ if(shouldIncludeBudgetSK() && result.getSpecialKeys()!=null) {
+ cbxBudget.addChangeHandler(new ChangeHandler() {
+ @Override
+ public void onChange(ChangeEvent event) {
+ onListChanged(cbxBudget);
+ }
+ });
+ cbxBudget.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ onOtherLstChanged(cbxBudget);
+ }
+ });
+ for(SpecialKeyDefDTO sk:result.getSpecialKeys()) {
+ SpecialKeyListBox cbx = new SpecialKeyListBox(sk);
+ addRow(sk.getLibelle(), cbx);
+ if(!listBoxes.isEmpty()) {
+ final ListBox previous = listBoxes.get(listBoxes.size()-1);
+ if(previous!=cbx) {
+ previous.addChangeHandler(new ChangeHandler() {
+ @Override
+ public void onChange(ChangeEvent event) {
+ onListChanged(previous);
+ }
+ });
+ previous.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ onOtherLstChanged(previous);
+ }
+ });
+ }
+ }
+ listBoxes.add(cbx);
+ }
+ }
+ // si pas de parent, on charge la liste des collectivites
+ if(addedCollectivites.isEmpty()) {
+ updateCollectiviteList();
+ }
+ }
+ });
+ }
+ protected void clearFields(PnlCollectivite sender) {
+ boolean found = false;
+ for(PnlCollectivite pnl:addedCollectivites) {
+ if(!found) {
+ found = (pnl==sender);
+ } else {
+ if(found) {
+ pnl.clearData();
+ }
+ }
+ }
+ if(found) {
+ clearListBoxesDescendant(cbxCollectivite);
+ cbxCollectivite.clear();
+ }
+ }
+
+ protected void updateCollectiviteList() {
+ String[] parentCollectivites = new String[addedCollectivites.size()];
+ for(int i=0;i<addedCollectivites.size();i++) {
+ PnlCollectivite pnl = addedCollectivites.get(i);
+ if(pnl.getKey()!=null && pnl.getKey().length()>0) {
+ parentCollectivites[pnl.parentModel.getLevel()] = pnl.getKey();
+ }
+ }
+ ServiceLocator.getXemeliosService().getCollectivites(documentId, parentCollectivites, new AsyncCallback<List<LabelValueDTO>>() {
+ public void onFailure(Throwable caught) {
+ GWTUtils.handleRPCError(caught);
+ }
+ public void onSuccess(List<LabelValueDTO> result) {
+ while(cbxCollectivite.getItemCount()>0) cbxCollectivite.removeItem(0);
+ for(LabelValueDTO v:result) {
+ cbxCollectivite.addItem(v.getLibelle(), v.getId());
+ }
+ if(cbxCollectivite.getItemCount()>=1) cbxCollectivite.setSelectedIndex(0);
+ onListChanged(cbxCollectivite);
+ }
+ });
+ }
+
+ protected void insertRow(PnlCollectivite pnl) {
+ container.resizeRows(container.getRowCount()+1);
+ for(int i=container.getRowCount()-1;i>insertedRows;i--) {
+ container.setWidget(i, 0, container.getWidget(i-1, 0));
+ container.setWidget(i, 1, container.getWidget(i-1, 1));
+ container.setWidget(i, 2, container.getWidget(i-1, 2));
+ }
+ container.setWidget(insertedRows, 0, pnl.getLabel());
+ container.setWidget(insertedRows, 1, pnl.getTextBox());
+ container.setWidget(insertedRows, 2, pnl.getButton());
+ insertedRows++;
+ }
+ protected void addRow(String text, ListBox cbx) {
+ int lastRow = container.getRowCount();
+ container.resizeRows(lastRow+1);
+ container.setWidget(lastRow, 0, new Label(new HTML(text).getHTML()));
+ container.setWidget(lastRow, 1, cbx);
+ }
+
+ public boolean shouldIncludeBudgetSK() { return true; }
+
+ public void pbOkClicked() {
+ for(ListBox cbx:listBoxes) {
+ if(cbx.getSelectedIndex()<0) {
+ Window.alert("Vous devez renseigner cette valeur.");
+ cbx.setFocus(true);
+ return;
+ }
+ }
+ ServiceLocator.getXemeliosService().getDefaultBrowsableEtat(documentId, new AsyncCallback<String>() {
+ public void onFailure(Throwable caught) {
+ GWTUtils.handleRPCError(caught);
+ }
+ public void onSuccess(String result) {
+ final String etatId = result;
+ ServiceLocator.getXemeliosService().getDefaultBrowsableElement(documentId, etatId, new AsyncCallback<String>() {
+ public void onFailure(Throwable caught) {
+ GWTUtils.handleRPCError(caught);
+ }
+ public void onSuccess(String result) {
+ final String elementId = result;
+ StringBuffer sb = new StringBuffer();
+ sb.append(GWTUtils.getContextPath()).append("displayDocument.do?documentId=").append(documentId);
+ sb.append("&etatId=").append(etatId).append("&elementId=").append(elementId);
+ sb.append("&coll-code=").append(cbxCollectivite.getValue(cbxCollectivite.getSelectedIndex()));
+ sb.append("&budg-code=").append(cbxBudget.getValue(cbxBudget.getSelectedIndex()));
+ ListBox cbx = findNextListBox(cbxBudget);
+ while(cbx!=null) {
+ SpecialKeyListBox sklb = (SpecialKeyListBox)cbx;
+ sb.append("&sp").append(sklb.getSpecialKeyDef().getPos()).append("=").append(sklb.getValue(sklb.getSelectedIndex()));
+ cbx = findNextListBox(sklb);
+ }
+ setRetUrl(sb.toString());
+ setChoosenCollectivte(cbxCollectivite.getValue(cbxCollectivite.getSelectedIndex()));
+ hide();
+ if(runner!=null) {
+ runner.setAdditionalObject("coll-code", getChoosenCollectivite());
+ runner.setAdditionalObject("url", getRetUrl());
+ runner.run();
+ }
+ }
+ });
+ }
+ });
+ }
+
+ public String getDialogTitle() { return "Choisir une collectivité, un budget ..."; }
+
+ protected void onCollectiviteChanged() {
+ if(!onChangeEnabled) {
+ return;
+ }
+ setOnChangeEnabled(false);
+ clearListBoxesDescendant(cbxCollectivite);
+ setOnChangeEnabled(true);
+ if(cbxCollectivite.getSelectedIndex()>=0 && shouldIncludeBudgetSK()) {
+ String value = cbxCollectivite.getValue(cbxCollectivite.getSelectedIndex());
+ ServiceLocator.getXemeliosService().getBudgetsFromDocument(documentId, value, new AsyncCallback<List<LabelValueDTO>>() {
+ public void onFailure(Throwable caught) {
+ GWTUtils.handleRPCError(caught);
+ }
+ public void onSuccess(List<LabelValueDTO> result) {
+ for(LabelValueDTO lbl:result) {
+ cbxBudget.addItem(lbl.getLibelle(), lbl.getId());
+ }
+ if(cbxBudget.getItemCount()>=1) cbxBudget.setSelectedIndex(0);
+ onOtherLstChanged(cbxBudget);
+ }
+ });
+ }
+ }
+ protected void onOtherLstChanged(ListBox eventTarget) {
+ if(!onChangeEnabled) {
+ return;
+ }
+ setOnChangeEnabled(false);
+ clearListBoxesDescendant(eventTarget);
+ setOnChangeEnabled(true);
+ // y a-t-il des special keys ?
+ ListBox theOneToUpdate = findNextListBox(eventTarget);
+ if(theOneToUpdate!=null && eventTarget.getSelectedIndex()>=0) {
+ if(theOneToUpdate instanceof SpecialKeyListBox) {
+ final SpecialKeyListBox skCbx = (SpecialKeyListBox)theOneToUpdate;
+ int pos = skCbx.getSpecialKeyDef().getPos();
+ switch(pos) {
+ case 1: {
+ String collectivite = cbxCollectivite.getValue(cbxCollectivite.getSelectedIndex());
+ String budget = eventTarget.getValue(eventTarget.getSelectedIndex());
+ ++calls;
+ final int localCalls = calls;
+ ServiceLocator.getXemeliosService().getSpecialKeys1(documentId, collectivite, budget, new AsyncCallback<List<LabelValueDTO>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ GWTUtils.handleRPCError(caught);
+ }
+ public void onSuccess(List<LabelValueDTO> result) {
+ final int inCalls = getCalls();
+ if(inCalls!=localCalls) {
+ return;
+ }
+ StringBuffer sb = new StringBuffer();
+ for(LabelValueDTO l:result) sb.append(l.getId()).append(",");
+ setOnChangeEnabled(false);
+ skCbx.clear();
+ for(LabelValueDTO l:result) {
+ skCbx.addItem(l.getLibelle(), l.getId());
+ }
+ setOnChangeEnabled(true);
+ }
+ });
+ }
+ case 2: {
+ if(listBoxes.size()>=4) {
+ String collectivite = cbxCollectivite.getValue(cbxCollectivite.getSelectedIndex());
+ String budget = cbxBudget.getValue(cbxBudget.getSelectedIndex());
+ String sk1 = eventTarget.getValue(eventTarget.getSelectedIndex());
+ ++calls;
+ final int localCalls = calls;
+ ServiceLocator.getXemeliosService().getSpecialKeys2(documentId, collectivite, budget, sk1, new AsyncCallback<List<LabelValueDTO>>() {
+ public void onFailure(Throwable caught) {
+ GWTUtils.handleRPCError(caught);
+ }
+ public void onSuccess(List<LabelValueDTO> result) {
+ final int inCalls = getCalls();
+ if(inCalls!=localCalls) {
+ return;
+ }
+ setOnChangeEnabled(false);
+ skCbx.clear();
+ for(LabelValueDTO l:result) {
+ skCbx.addItem(l.getLibelle(), l.getId());
+ }
+ setOnChangeEnabled(true);
+ }
+ });
+ }
+ }
+ }
+ }
+ }
+ }
+ public void onListChanged(Widget sender) {
+ if(!onChangeEnabled) {
+ return;
+ }
+ setOnChangeEnabled(false);
+ clearListBoxesDescendant((ListBox)sender);
+ setOnChangeEnabled(true);
+ if(sender==cbxCollectivite) {
+ if(cbxCollectivite.getSelectedIndex()>=0 && shouldIncludeBudgetSK()) {
+ String value = cbxCollectivite.getValue(cbxCollectivite.getSelectedIndex());
+ ServiceLocator.getXemeliosService().getBudgetsFromDocument(documentId, value, new AsyncCallback<List<LabelValueDTO>>() {
+ public void onFailure(Throwable caught) {
+ GWTUtils.handleRPCError(caught);
+ }
+ public void onSuccess(List<LabelValueDTO> result) {
+ for(LabelValueDTO lbl:result) {
+ cbxBudget.addItem(lbl.getLibelle(), lbl.getId());
+ }
+ if(cbxBudget.getItemCount()>=1) cbxBudget.setSelectedIndex(0);
+ onListChanged(cbxBudget);
+ }
+ });
+ }
+ } else {
+ // y a-t-il des special keys ?
+ ListBox lstSender = (ListBox)sender;
+ ListBox theOneToUpdate = findNextListBox(lstSender);
+ if(theOneToUpdate!=null && lstSender.getSelectedIndex()>=0) {
+ if(theOneToUpdate instanceof SpecialKeyListBox) {
+ final SpecialKeyListBox skCbx = (SpecialKeyListBox)theOneToUpdate;
+ int pos = skCbx.getSpecialKeyDef().getPos();
+ switch(pos) {
+ case 1: {
+ String collectivite = cbxCollectivite.getValue(cbxCollectivite.getSelectedIndex());
+ String budget = lstSender.getValue(lstSender.getSelectedIndex());
+ ++calls;
+ final int localCalls = calls;
+ ServiceLocator.getXemeliosService().getSpecialKeys1(documentId, collectivite, budget, new AsyncCallback<List<LabelValueDTO>>() {
+ public void onFailure(Throwable caught) {
+ GWTUtils.handleRPCError(caught);
+ }
+ public void onSuccess(List<LabelValueDTO> result) {
+ final int inCalls = getCalls();
+ if(inCalls!=localCalls) {
+ return;
+ }
+ StringBuffer sb = new StringBuffer();
+ for(LabelValueDTO l:result) sb.append(l.getId()).append(",");
+
+ setOnChangeEnabled(false);
+ skCbx.clear();
+ for(LabelValueDTO l:result) {
+ skCbx.addItem(l.getLibelle(), l.getId());
+ }
+ setOnChangeEnabled(true);
+ }
+ });
+ }
+ case 2: {
+ if(listBoxes.size()>=4) {
+ String collectivite = cbxCollectivite.getValue(cbxCollectivite.getSelectedIndex());
+ String budget = cbxBudget.getValue(cbxBudget.getSelectedIndex());
+ String sk1 = lstSender.getValue(lstSender.getSelectedIndex());
+ ++calls;
+ final int localCalls = calls;
+ ServiceLocator.getXemeliosService().getSpecialKeys2(documentId, collectivite, budget, sk1, new AsyncCallback<List<LabelValueDTO>>() {
+ public void onFailure(Throwable caught) {
+ GWTUtils.handleRPCError(caught);
+ }
+ public void onSuccess(List<LabelValueDTO> result) {
+ final int inCalls = getCalls();
+ if(inCalls!=localCalls) {
+ return;
+ }
+ setOnChangeEnabled(false);
+ skCbx.clear();
+ for(LabelValueDTO l:result) {
+ skCbx.addItem(l.getLibelle(), l.getId());
+ }
+ setOnChangeEnabled(true);
+ }
+ });
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ private void setOnChangeEnabled(boolean enable) { onChangeEnabled=enable; }
+
+ private ListBox findNextListBox(ListBox current) {
+ boolean found = false;
+ for(ListBox cbx:listBoxes) {
+ if(found) {
+ return cbx;
+ } else {
+ found = (cbx==current);
+ }
+ }
+ return null;
+ }
+
+ protected void clearListBoxesDescendant(ListBox parent) {
+ boolean found = false;
+ for(ListBox cbx:listBoxes) {
+ if(found) {
+ while(cbx.getItemCount()>0) cbx.removeItem(0);
+ } else {
+ if(cbx==parent) found = true;
+ }
+ }
+ }
+
+ protected class PnlCollectivite extends HorizontalPanel {
+ private ParentCollectiviteDTO parentModel;
+ PnlCollectivite[] parentInputs;
+ private TextBox input;
+ private Button pb;
+ private Label lbl;
+ private String key, value;
+ private Listener listener;
+ public PnlCollectivite(ParentCollectiviteDTO parent, PnlCollectivite[] parentInputs,int count) {
+ super();
+ this.parentModel=parent;
+ this.parentInputs = parentInputs;
+ initComponents(count);
+ }
+ protected void initComponents(int count) {
+ add(lbl = new Label(new HTML(parentModel.getLibelle()).getHTML()));
+ lbl.getElement().setId("lbl"+count);
+ input = new TextBox();
+ input.setMaxLength(60);
+ input.setReadOnly(true);
+ input.getElement().setId("input"+count);
+ input.setWidth("100%");
+ add(input);
+ pb = new Button("...");
+ add(pb);
+ pb.addClickHandler(new ClickHandler() {
+
+ public void onClick(ClickEvent event) {
+ pbOnClick();
+ }
+ });
+ pb.getElement().setId("pb"+count);
+ }
+ public Button getButton() { return pb; }
+ public Label getLabel() { return lbl; }
+ public TextBox getTextBox() { return input; }
+
+ public void pbOnClick() {
+ int parentFilledCount = 0;
+ for(int i=0;i<parentInputs.length;i++) {
+ if(parentInputs[i].getKey()!=null && parentInputs[i].getKey().length()>0)
+ parentFilledCount++;
+ }
+ final String[] parents = new String[parentFilledCount];
+ int index = 0;
+ if(parentFilledCount>0) {
+ for(int i=parentInputs.length-1;i>=0;i--) {
+ if(parentInputs[i].getKey()!=null && parentInputs[i].getKey().length()>0)
+ parents[index] = parentInputs[i].getKey();
+ index++;
+ }
+ }
+ final DlgChooseOnePair dlg = new DlgChooseOnePair(lbl.getText());
+ dlg.show();
+ dlg.center();
+ final String docId = parentModel.getDocumentId();
+ ServiceLocator.getXemeliosService().getParentCollectivites(docId, parentModel.getLevel()+1, parents, new AsyncCallback<List<LabelValueDTO>>() {
+
+ public void onFailure(Throwable caught) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public void onSuccess(List<LabelValueDTO> result) {
+ dlg.setItems(result);
+ dlg.addSelectListener(new DlgChooseOnePair.SelectListener() {
+ public void onSelect(Object selectedItem) {
+ LabelValueDTO obj = (LabelValueDTO)selectedItem;
+ key = obj.getId();
+ value = obj.getLibelle();
+ input.setText(value);
+ clearFields(PnlCollectivite.this);
+ if(listener!=null) {
+ listener.run();
+ }
+ }
+ });
+ }
+ });
+ }
+ public String getKey() { return key; }
+ public void setListener(Listener l) { this.listener = l; }
+ public void clearData() {
+ input.setText("");
+ key = null;
+ value = null;
+ }
+ }
+ private void setRetUrl(String url) {
+ retUrl = url;
+ }
+ /**
+ * Renvoie l'URL qui a été choisie, ou null si rien n'a été choisit
+ * @return
+ */
+ public String getRetUrl() { return retUrl; }
+ private void setChoosenCollectivte(String collectiviteId) {
+ choosenCollectivite = collectiviteId;
+ }
+ public String getChoosenCollectivite() { return choosenCollectivite; }
+ protected static interface Listener {
+ public void run();
+ }
+
+ protected class SpecialKeyListBox extends ListBox {
+ private SpecialKeyDefDTO specialKeyDef;
+ public SpecialKeyListBox(SpecialKeyDefDTO specialKeyDef) {
+ super();
+ this.specialKeyDef=specialKeyDef;
+ setVisibleItemCount(1);
+ setName("special-key"+specialKeyDef.getPos());
+ }
+
+ public SpecialKeyDefDTO getSpecialKeyDef() {
+ return specialKeyDef;
+ }
+
+ public void setSpecialKeyDef(SpecialKeyDefDTO specialKeyDef) {
+ this.specialKeyDef = specialKeyDef;
+ }
+
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2011 axYus - www.axyus.com
+ * 2011 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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 of the License, or
+ * (at your option) any later version.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.navigate.docs;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.DialogBox;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.TabLayoutPanel;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.service.ServiceLocator;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.utils.GWTUtils;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.navigate.DlgSelectNavigationTarget;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.AbstractSearchWidget;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.PostRunnable;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.InitParametersDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.RowResultDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchResultDTO;
+
+/**
+ * Cette classe permet de déterminer et d'afficher la bonne boite de dialogue pour sélectionner
+ * la collectivité vers laquelle on va naviguer
+ * @author cmarchand
+ */
+public class CgCollocChooseNavigationMethod {
+
+ public CgCollocChooseNavigationMethod() {
+ super();
+ }
+
+ public void run(final TabLayoutPanel tabPanel) {
+ ServiceLocator.getXemeliosService().canSearch("cg-colloc", "Accueil", new AsyncCallback<Boolean>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ // on n'affiche pas l'exception, mais on met le comportement par défaut
+ defaultChoose(tabPanel);
+ }
+
+ public void onSuccess(Boolean result) {
+ if(result.booleanValue()) {
+ ownDialogChooser(tabPanel);
+ } else {
+ defaultChoose(tabPanel);
+ }
+ }
+ });
+ }
+
+ protected void defaultChoose(final TabLayoutPanel tabPanel) {
+ final DlgSelectNavigationTarget dlg = new DlgSelectNavigationTarget("cg-colloc", new PostRunnable("cg-colloc") {
+ @Override
+ public void run() {
+ StringBuilder shb = new StringBuilder();
+ String navigationId = Long.toString(System.currentTimeMillis());
+ shb.append("<iframe width=\"100%\" height=\"100%\" id=\"nav.");
+ shb.append(getAdditionalObject("coll-code")).append("-").append(navigationId);
+ shb.append("\" src=\"");
+ shb.append(getAdditionalObject("url")).append("&navigationId=").append(navigationId);
+ shb.append("\" onload=\"javascript:setLastCreatedTabTitle(this.contentWindow.document.title);\"/>");
+ HTML html = new HTML(shb.toString());
+ tabPanel.add(html, "Navigation");
+ }
+ });
+ }
+
+ protected void ownDialogChooser(TabLayoutPanel tabPanel) {
+ CgCollocBudgetChooser ccbc = new CgCollocBudgetChooser(tabPanel);
+ }
+
+ private static class CgCollocBudgetChooser extends DialogBox {
+ private Button cancelButton;
+ private InitParametersDTO searchInitParameters;
+ private AbstractSearchWidget asw;
+ private TabLayoutPanel tabPanel;
+
+ public CgCollocBudgetChooser(TabLayoutPanel tabPanel) {
+ super(false, true);
+ this.tabPanel = tabPanel;
+ setText("Choix du Compte de Gestion");
+ final VerticalPanel mainPanel = new VerticalPanel();
+ cancelButton = new Button("Annuler", new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ hide();
+ }
+ });
+ ServiceLocator.getXemeliosService().initSearchWindow(
+ "ref-collec-spl",
+ "Referentiel",
+ "Collectivite", new AsyncCallback<InitParametersDTO>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ StackTraceElement[] elements = caught.getStackTrace();
+ StringBuilder sb = new StringBuilder();
+ sb.append(caught.getMessage()).append("<div style=\"padding-left: 10px;\">");
+ for(StackTraceElement el:elements) {
+ sb.append(el.toString()).append("<br/>");
+ }
+ sb.append("</div>");
+ mainPanel.add(new HTML(sb.toString(), true));
+ }
+ @Override
+ public void onSuccess(InitParametersDTO result) {
+ // TODO
+ mainPanel.add(createSearcher(result));
+ mainPanel.add(cancelButton);
+ }
+ });
+ setWidget(mainPanel);
+ center();
+ show();
+ }
+ public Widget createSearcher(InitParametersDTO initParameters) {
+ this.searchInitParameters = initParameters;
+ this.asw = new AbstractSearchWidget(
+ "ref-collec-spl",
+ "Referentiel",
+ "Collectivite",
+ initParameters,
+ AbstractSearchWidget.DisplayParameters.newSearchHelperWindowDisplayParameters()) {
+ @Override
+ public void downloadUrl(String url) {
+ // ici, on ne fait rien
+ }
+ public void showRepository() {
+ // ici, on n'affiche jamais le repository
+ }
+
+ @Override
+ protected void handleSearchResult(SearchResultDTO result, boolean firstSearch) {
+ super.handleSearchResult(result, firstSearch);
+ center();
+ }
+ @Override
+ public void onDoubleClickOnRowResult(RowResultDTO row) {
+ //parentWidget.setInputValue(row.getStringValue(searchHelperConfig.getIdColumnToReturn()));
+ StringBuilder shb = new StringBuilder();
+ String navigationId = Long.toString(System.currentTimeMillis());
+ shb.append("<iframe width=\"100%\" height=\"100%\" id=\"nav.");
+ shb.append(row.getStringValue("idColl")).append("-").append(navigationId);
+ shb.append("\" src=\"");
+ shb.append(GWTUtils.getContextPath()).append("displayDocument.do?documentId=cg-colloc&etatId=Accueil&elementId=PageAccueil");
+ shb.append("&coll-code=").append(row.getStringValue("idColl"));
+ shb.append("&budg-code=").append(row.getStringValue("codBudg"));
+ shb.append("&sp1=").append(row.getStringValue("exer"));
+ shb.append("&navigationId=").append(navigationId);
+ shb.append("\" onload=\"javascript:setLastCreatedTabTitle(this.contentWindow.document.title);\"/>");
+ HTML html = new HTML(shb.toString());
+ tabPanel.add(html, "Navigation");
+ hide();
+ }
+
+ };
+ if(searchInitParameters.hasTooMuchCollectivites()) {
+ asw.initCollectivites(searchInitParameters.getDocumentId());
+ } else {
+ asw.initCollectivitesBudgets(searchInitParameters.getCollectivites(), searchInitParameters.getFirstCollectiviteBudgets());
+ }
+ return asw;
+ }
+
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2010 axYus - www.axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.root;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.resources.client.ClientBundle;
+import com.google.gwt.resources.client.ImageResource;
+
+/**
+ *
+ * @author cmarchand
+ */
+public interface RootClientBundle extends ClientBundle {
+ public static final RootClientBundle INSTANCE = GWT.create(RootClientBundle.class);
+
+ @Source("resources/tab-remove.png")
+ public ImageResource getCloseTabIcon();
+
+ @Source("resources/new-tab.png")
+ public ImageResource getAddTabIcon();
+
+ @Source("resources/xemelios-logo.jpeg")
+ public ImageResource getXemeliosLogo();
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2010 axYus - www.axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.root;
+
+import com.google.gwt.dom.client.Style;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.LayoutPanel;
+import com.google.gwt.user.client.ui.TabLayoutPanel;
+import com.google.gwt.user.client.ui.Widget;
+import java.util.ArrayList;
+
+/**
+ * TabLayoutPanel avec un bouton "Ajouter un onglet" un un mecanisme de listener
+ * pour gérer l'affichage du l'image "supprimer l'onglet" dans les onglets
+ * @author cmarchand
+ */
+public abstract class TabLayoutPanelWithAddTabButton extends TabLayoutPanel implements ClickHandler {
+ private ArrayList<TabWidget> tabHeaders;
+ private int lastAddedTab = -1;
+
+ public TabLayoutPanelWithAddTabButton(double barHeight, Style.Unit barUnit) {
+ super(barHeight, barUnit);
+ tabHeaders = new ArrayList<TabWidget>();
+ Image img = new Image(RootClientBundle.INSTANCE.getAddTabIcon());
+ // on cherche la tabBar pour la décaler vers la droite
+ double space = (barHeight-img.getHeight())/2.0;
+ LayoutPanel panel = (LayoutPanel)getWidget();
+ int widgetCount = panel.getWidgetCount();
+ for (int i=0; i<panel.getWidgetCount();i++) {
+ Widget w = panel.getWidget(i);
+ if(w.getStyleName().equals("gwt-TabLayoutPanelTabs")) {
+ panel.setWidgetLeftRight(w, img.getWidth()+2*space-6, Style.Unit.PX, 0, Style.Unit.PX);
+ }
+ }
+ panel.insert(img, 0);
+ panel.setWidgetLeftWidth(img, space, Style.Unit.PX, img.getWidth(), Style.Unit.PX);
+ panel.setWidgetTopHeight(img, space, Style.Unit.PX, img.getHeight(), Style.Unit.PX);
+ img.getElement().setTitle("Ajouter un onglet");
+ img.addClickHandler(this);
+ }
+
+ @Override
+ public void add(Widget child, String text) {
+ TabWidget tabWidget = new TabWidget(text, child);
+ tabHeaders.add(tabWidget);
+ super.add(child, tabWidget);
+ lastAddedTab = getWidgetCount()-1;
+ fireTabAddedEvent();
+ }
+
+ @Override
+ public void insert(Widget child, Widget tab, int beforeIndex) {
+ super.insert(child, tab, beforeIndex);
+ tabHeaders.add((TabWidget)tab);
+ lastAddedTab = beforeIndex;
+ fireTabAddedEvent();
+ }
+
+ @Override
+ public boolean remove(int index) {
+ Widget w = getWidget(index);
+ TabWidget header = null;
+ for(TabWidget tw: tabHeaders) {
+ if(tw.getContent().equals(w)) {
+ header = tw;
+ break;
+ }
+ }
+ boolean ret = super.remove(index);
+ tabHeaders.remove(header);
+ if(lastAddedTab>index) lastAddedTab--;
+ else if(lastAddedTab==index) lastAddedTab = -1;
+ fireTabRemovedEvent();
+ return ret;
+ }
+
+ @Override
+ public boolean remove(Widget w) {
+ TabWidget header = null;
+ int ix = 0;
+ for(TabWidget tw: tabHeaders) {
+ if(tw.getContent().equals(w)) {
+ header = tw;
+ break;
+ }
+ ix++;
+ }
+ boolean ret = super.remove(w);
+ tabHeaders.remove(header);
+ if(lastAddedTab>ix) lastAddedTab--;
+ else if(lastAddedTab==ix) lastAddedTab = -1;
+ fireTabRemovedEvent();
+ return ret;
+ }
+
+ private void fireTabAddedEvent() {
+ if(getWidgetCount()>1) {
+ for(TabWidget tw: tabHeaders) {
+ tw.setCloseIconVisible(true);
+ }
+ }
+ }
+ private void fireTabRemovedEvent() {
+ if(getWidgetCount()<2) {
+ for(TabWidget tw: tabHeaders) {
+ tw.setCloseIconVisible(false);
+ }
+ }
+ }
+
+ @Override
+ public void onClick(ClickEvent event) {
+ addNewTab();
+ }
+
+ public abstract void addNewTab();
+
+ @Override
+ public void setTabHTML(int index, String html) {
+ ((TabWidget)getTabWidget(index)).setHtml(html);
+ }
+
+ public void replaceTabContent(int index, Widget newContent) {
+ TabWidget tab = (TabWidget)getTabWidget(index);
+ tab.setTabContent(newContent);
+ remove(index);
+ insert(newContent, tab, index);
+ }
+
+ public int getLastAddedTabIndex() { return lastAddedTab; }
+ public void setTabTitle(int tabIndex, String title) {
+ if(tabIndex<0) return;
+ TabWidget tab = (TabWidget)getTabWidget(tabIndex);
+ tab.setTabCaption(title);
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2010 axYus - www.axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.root;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HasVerticalAlignment;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.InlineHTML;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ *
+ * @author cmarchand
+ */
+public class TabWidget extends Composite implements ClickHandler {
+
+ private Widget tabContent;
+ private String caption;
+ private HorizontalPanel hPane;
+ private Image closeTab;
+ private InlineHTML html;
+
+ public TabWidget(String caption, Widget tabContent) {
+ super();
+ this.caption = caption;
+ this.tabContent = tabContent;
+ hPane = new HorizontalPanel();
+ hPane.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
+ hPane.add(html = new InlineHTML(caption + " "));
+ closeTab = new Image(RootClientBundle.INSTANCE.getCloseTabIcon());
+ closeTab.setTitle("Fermer l'onglet");
+ closeTab.addClickHandler(this);
+ hPane.add(closeTab);
+ closeTab.setVisible(false);
+ initWidget(hPane);
+ }
+
+ public String getCaption() {
+ return caption;
+ }
+
+ public Widget getContent() {
+ return tabContent;
+ }
+
+ protected void setTabContent(Widget tabContent) {
+ this.tabContent = tabContent;
+ }
+
+ public void setContent(Widget content) {
+ this.tabContent = content;
+ }
+
+ public void setTabCaption(String caption) {
+ this.caption = caption;
+ this.html.setHTML(caption + " ");
+ }
+
+ @Override
+ public void onClick(ClickEvent event) {
+ Widget o = getParent();
+ while (o != null && !(o instanceof TabLayoutPanelWithAddTabButton)) {
+ o = o.getParent();
+ }
+ if (o != null) {
+ TabLayoutPanelWithAddTabButton l = (TabLayoutPanelWithAddTabButton) o;
+ l.remove(tabContent);
+ }
+ }
+
+ public void setCloseIconVisible(boolean visible) {
+ closeTab.setVisible(visible);
+ }
+
+ public void setHtml(String html) {
+ this.html.setHTML(html + " ");
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2010 axYus - www.axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.root;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.dom.client.Style;
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.DockLayoutPanel;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.MenuBar;
+import com.google.gwt.user.client.ui.MenuItem;
+import com.google.gwt.user.client.ui.TabLayoutPanel;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.service.ServiceLocator;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.utils.DoneListener;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.AccueilWidget;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.navigate.DlgSelectNavigationTarget;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.navigate.docs.CgCollocChooseNavigationMethod;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.PostRunnable;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.SearchWidget;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.HasMenuType;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.Menu;
+import java.util.ArrayList;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * La feuille parente de tout Xemelios Web. Contient le menu et les onglets de Xemelios
+ * @author cmarchand
+ */
+public class Tabs extends DockLayoutPanel {
+ private static Logger logger = Logger.getLogger(Tabs.class.getName());
+ private static final int MENU_HEIGHT = 24;
+ private TabLayoutPanelWithAddTabButton tabPanel;
+ private MenuBar menu;
+ private MenuBar mnuSearch;
+ private MenuBar mnuNavigate;
+ private static Tabs INSTANCE = null;
+
+
+ public Tabs() {
+ super(Style.Unit.PX);
+ initComponents();
+ INSTANCE = this;
+ }
+
+ protected final void initComponents() {
+ getElement().setId("Tabs");
+ menu = new MenuBar();
+ menu.setAutoOpen(false);
+ menu.addItem("Accueil", getMenuAccueil());
+ mnuSearch = new MenuBar(true);
+ menu.addItem("Recherche",mnuSearch);
+ mnuNavigate = new MenuBar(true);
+ menu.addItem("Navigation", mnuNavigate);
+ menu.addItem("Exports", getMenuExport());
+ menu.addItem("?", new Command() {
+ @Override
+ public void execute() {
+ Window.alert("affichage de l'aide utilisateurs");
+ }
+ });
+ addNorth(menu, MENU_HEIGHT);
+ tabPanel = new TabLayoutPanelWithAddTabButton(MENU_HEIGHT, Style.Unit.PX) {
+ @Override
+ public void addNewTab() {
+ ServiceLocator.getXemeliosService().getConnectedUser(new AsyncCallback<String> () {
+ public void onFailure(Throwable thrwbl) {
+ add(new AccueilWidget(), "Accueil");
+ tabPanel.selectTab(tabPanel.getWidgetCount()-1);
+ }
+ public void onSuccess(String t) {
+ add(new AccueilWidget(), "Accueil");
+ tabPanel.selectTab(tabPanel.getWidgetCount()-1);
+ }
+ });
+ }
+ };
+ tabPanel.addNewTab();
+ tabPanel.setHeight("100%");
+ tabPanel.setWidth("100%");
+ add(tabPanel);
+ defineJS();
+ ServiceLocator.getXemeliosService().getMenu(new AsyncCallback<Menu>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ logger.log(Level.SEVERE,caught.getMessage());
+ Window.alert("failure: "+caught.getMessage());
+ }
+ @Override
+ public void onSuccess(Menu result) {
+ for(Menu mnu:result.getChilds()) {
+ if(mnu.getMenuType().equals(HasMenuType.TYPE_PARENT)) {
+ if(mnu.getGroupType().equals(HasMenuType.TYPE_SEARCH)) {
+ // on doit construire des menus de recherche
+ ArrayList<MenuBarEntry> searchMnuContent = buildSearchMenu(mnu);
+ for(MenuBarEntry entry:searchMnuContent) {
+ mnuSearch.addItem(entry.getLibelle(), entry.isHtml(), entry.getmBar());
+ }
+ } else if(mnu.getGroupType().equals(HasMenuType.TYPE_NAVIGATE)) {
+ // et ceux de navigation
+ for(Menu child: mnu.getChilds()) {
+ mnuNavigate.addItem(child.getCaption(), new NavigateCommand(child.getHref(), child.getHelperClassName()));
+ }
+ } else {
+ GWT.log(mnu.getId()+" is neither TYPE_SEARCH nor TYPE_SEARCH");
+ }
+ } else {
+ GWT.log(mnu.getId()+" is not TYPE_PARENT");
+ }
+ }
+ }
+ });
+ }
+
+ public TabLayoutPanel getTabPanel() { return tabPanel; }
+
+ public static native void defineJS() /*-{
+ $wnd.setLastCreatedTabTitle = function(title) {
+ $entry(@fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.root.Tabs::__setLastCreatedTabTitle(Ljava/lang/String;) (title));
+ }
+ }-*/;
+ public static void __setLastCreatedTabTitle(String title) {
+ INSTANCE.tabPanel.setTabTitle(INSTANCE.tabPanel.getLastAddedTabIndex(), title);
+ }
+ protected MenuBar getMenuAccueil() {
+ MenuBar ret = new MenuBar(true);
+ MenuItem mnuImports = new MenuItem("Imports...", new Command() {
+ @Override
+ public void execute() {
+ Window.alert("Imports... à faire !");
+ }
+ });
+ MenuItem mnuDisconnect = new MenuItem("Déconnexion", true, new Command() {
+ @Override
+ public void execute() {
+ Window.Location.assign(GWT.getHostPageBaseURL()+"deconnexion.do");
+ }
+ });
+ ret.addItem(mnuImports);
+ ret.addSeparator();
+ ret.addItem(mnuDisconnect);
+ ret.setAutoOpen(false);
+ return ret;
+ }
+ protected MenuBar getMenuExport() {
+ MenuBar ret = new MenuBar(true);
+ MenuItem mnuConfig = new MenuItem("Configurer", new Command() {
+ @Override
+ public void execute() {
+ Window.alert("configuration des exports");
+ }
+ });
+ MenuItem mnuExec = new MenuItem("Exécuter", true, new Command() {
+ @Override
+ public void execute() {
+ Window.alert("Execution d'un export");
+ }
+ });
+ MenuItem mnuMyExports = new MenuItem("Mes exports...", new Command() {
+ @Override
+ public void execute() {
+ Window.alert("mes exports");
+ }
+ });
+ ret.addItem(mnuConfig);
+ ret.addItem(mnuExec);
+ ret.addSeparator();
+ ret.addItem(mnuMyExports);
+ ret.setAutoOpen(false);
+ return ret;
+ }
+ private ArrayList<MenuBarEntry> buildSearchMenu(Menu mnu) {
+ ArrayList<MenuBarEntry> ret = new ArrayList<MenuBarEntry>();
+ for(Menu mnuDoc: mnu.getChilds()) {
+ MenuBar docMenu = new MenuBar(true);
+ docMenu.setAutoOpen(false);
+ for(Menu child: mnuDoc.getChilds()) {
+ fillSearchItems(child,docMenu);
+ }
+ ret.add(new MenuBarEntry(mnuDoc.getCaption(), docMenu));
+ }
+ return ret;
+ }
+ private void fillSearchItems(Menu mnu, MenuBar parent) {
+ if(mnu.getMenuType().equals(HasMenuType.TYPE_PARENT)) {
+ MenuBar inner = new MenuBar(true);
+ inner.setAutoOpen(false);
+ for(Menu child:mnu.getChilds())
+ fillSearchItems(child, inner);
+ parent.addItem(mnu.getCaption(), inner);
+ } else if(mnu.getMenuType().equals(HasMenuType.TYPE_SEARCH)) {
+ parent.addItem(mnu.getCaption(), new SearchCommand(mnu.getHref()));
+ }
+ }
+ private class MenuBarEntry {
+ private MenuBar mBar;
+ private String libelle;
+ private boolean isHtml = false;
+
+ public MenuBarEntry(String libelle, boolean isHtml, MenuBar mBar) {
+ super();
+ this.libelle=libelle;
+ this.isHtml=isHtml;
+ this.mBar=mBar;
+ this.mBar.setAutoOpen(false);
+ }
+ public MenuBarEntry(String libelle, MenuBar mBar) {
+ this(libelle,false,mBar);
+ }
+ public boolean isHtml() { return isHtml; }
+ public String getLibelle() { return libelle; }
+ public MenuBar getmBar() { return mBar; }
+ }
+ private class SearchCommand implements Command {
+ private String docId, etatId, elementId;
+ public SearchCommand(String href) {
+ String[] items = href.split("/");
+ docId = items[0];
+ etatId = items[1];
+ elementId = items[2];
+ }
+ public void execute() {
+// Window.alert("searching "+docId+" / "+etatId+" / "+elementId);
+ final SearchWidget sw = new SearchWidget();
+ sw.init(docId, etatId, elementId, new DoneListener() {
+ public void done(Object result) {
+ int currentTab = tabPanel.getSelectedIndex();
+ tabPanel.replaceTabContent(currentTab, sw);
+ final TabWidget tab = (TabWidget)tabPanel.getTabWidget(currentTab);
+ tab.setHtml(docId);
+ ServiceLocator.getXemeliosService().getLibelleElement(docId, etatId, elementId, new AsyncCallback<String>() {
+ public void onFailure(Throwable caught) {
+ tab.setHtml("<ERROR>");
+ Window.alert(caught.getMessage());
+ }
+ public void onSuccess(String result) {
+ tab.setHtml(result);
+ }
+ });
+ tabPanel.selectTab(currentTab);
+ }
+ });
+ }
+ }
+ private class NavigateCommand implements Command {
+ private String docId;
+ private String helperClassName;
+ public NavigateCommand(String href, String helperClassName) {
+ docId = href;
+ this.helperClassName = helperClassName;
+ }
+ public void execute() {
+ if("fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.navigate.docs.CgCollocChooseNavigationMethod".equals(helperClassName)) {
+ CgCollocChooseNavigationMethod cccnm = new CgCollocChooseNavigationMethod();
+ cccnm.run(getTabPanel());
+ } else {
+ final DlgSelectNavigationTarget dlg = new DlgSelectNavigationTarget(docId, new PostRunnable(docId) {
+ @Override
+ public void run() {
+ StringBuilder shb = new StringBuilder();
+ String navigationId = Long.toString(System.currentTimeMillis());
+ shb.append("<iframe width=\"100%\" height=\"100%\" id=\"nav.");
+ shb.append(getAdditionalObject("coll-code")).append("-").append(navigationId);
+ shb.append("\" src=\"");
+ shb.append(getAdditionalObject("url")).append("&navigationId=").append(navigationId);
+ shb.append("\" onload=\"javascript:setLastCreatedTabTitle(this.contentWindow.document.title);\"/>");
+ HTML html = new HTML(shb.toString());
+ getTabPanel().add(html, "Navigation");
+ }
+ });
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2011 axYus - www.axyus.com
+ * 2011 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search;
+
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.NodeList;
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.event.dom.client.ChangeHandler;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.ComplexPanel;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.HasVerticalAlignment;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.InlineHTML;
+import com.google.gwt.user.client.ui.ListBox;
+import com.google.gwt.user.client.ui.PopupPanel.PositionCallback;
+import com.google.gwt.user.client.ui.ScrollPanel;
+import com.google.gwt.user.client.ui.SplitLayoutPanel;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.service.ServiceLocator;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.utils.GWTUtils;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.common.DlgChooseOnePair;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.navigate.DlgSelectCollectivite;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.common.ImageButton;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.common.WorkingPanel;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.CritereTypeDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.InitParametersDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.LabelValueDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.ListResultatDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchInitParametersDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchParameterDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchResultDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.StoredSearchDTO;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Un SearchWidget qui ne se base pas sur la feuille de style
+ * @author cmarchand
+ */
+public abstract class AbstractSearchWidget extends Composite implements SearchCtxInfoProvider, RequestSaver, ResultOperationListener {
+ private String documentId;
+ private String etatId;
+ private String elementId;
+ private DisplayParameters displayParameters;
+ private InitParametersDTO initParameters;
+ private SearchInitParametersDTO searchInitParameters;
+
+ // colAnBudgChooser
+ private ListBox collectivitesListBox;
+ private ListBox budgetListBox;
+ private ArrayList<ChangeHandler> changeHandlers;
+ private HorizontalPanel divMain;
+ private TextBox dfCollectivite;
+ private Button pbHelpCollectivite;
+ private VerticalPanel mainPanel;
+ private LabelValueDTO currentCollectivite, currentBudget;
+
+ // statusBar
+ private StatusBar statusBar;
+
+ // criteriaTable
+ private CriteriaTable criteriaTable;
+
+ // result table
+ private VerticalPanel resultTableContainer;
+ private ResultTable resultTable;
+
+ // divers
+ private WorkingPanel working;
+ private boolean exportPossible;
+
+ public AbstractSearchWidget(String documentId, String etatId, String elementId, InitParametersDTO initParameters, DisplayParameters displayParameters) {
+ super();
+ this.documentId=documentId;
+ this.etatId=etatId;
+ this.elementId=elementId;
+ this.initParameters = initParameters;
+ setSearchInitParameters(initParameters.getSearchInitParameters());
+ this.displayParameters=displayParameters;
+ initComponents();
+ working = new WorkingPanel();
+ initWidget(mainPanel);
+
+ }
+ private void initComponents() {
+ mainPanel = new VerticalPanel();
+// mainPanel.setSize("500px", "300px");
+ HorizontalPanel toolbarPanel = new HorizontalPanel();
+ toolbarPanel.addStyleName("TopnavBk");
+ toolbarPanel.add(constructColBugChooser());
+ toolbarPanel.add(new InlineHTML(" "));
+ ComplexPanel buttonBar = constructButtonBar();
+ toolbarPanel.add(buttonBar);
+ mainPanel.add(toolbarPanel);
+ statusBar = new StatusBar();
+ statusBar.getPaginationWidget().addChangePageRequestListener(new PaginationWidget.ChangePageRequestListener() {
+ @Override
+ public void onChangePageRequest(PaginationWidget sender, int requestedPageNumber) {
+ loadPage(requestedPageNumber);
+ }
+ });
+ criteriaTable = new CriteriaTable(this);
+ if(displayParameters.isSplitterVisible()) {
+ SplitLayoutPanel slp = new SplitLayoutPanel();
+ slp.addNorth(criteriaTable,80);
+ slp.add(resultTableContainer = new VerticalPanel());
+ slp.setHeight("100%");
+ slp.setWidth("100%");
+ mainPanel.add(slp);
+ } else {
+ criteriaTable.setWidth("100%");
+ criteriaTable.setHeight(("100px"));
+ ScrollPanel scroller = new ScrollPanel(criteriaTable);
+ mainPanel.add(scroller);
+ mainPanel.add(resultTableContainer = new VerticalPanel());
+ }
+ this.mainPanel.add(statusBar);
+ criteriaTable.init(initParameters.getSearchInitParameters());
+ criteriaTable.addEmptyCriterion();
+ resultTableContainer.setWidth("100%");
+ }
+
+ /**
+ * Appele quand la collectivité est modifiée
+ */
+ protected void collectiviteChanged() {
+ if(dfCollectivite==null) {
+ currentCollectivite = new LabelValueDTO(collectivitesListBox.getValue(collectivitesListBox.getSelectedIndex()), collectivitesListBox.getItemText(collectivitesListBox.getSelectedIndex()));
+ }
+ ServiceLocator.getXemeliosService().getBudgets(initParameters.getSearchSessionId(), currentCollectivite.getId(), new AsyncCallback<ArrayList<LabelValueDTO>>() {
+ @Override
+ public void onFailure(Throwable throwable) {
+ GWTUtils.handleRPCError(throwable);
+ }
+ @Override
+ public void onSuccess(ArrayList<LabelValueDTO> budgets) {
+ budgetListBox.clear();
+ for (LabelValueDTO budget : budgets) {
+ budgetListBox.addItem(budget.getLabel(), budget.getValue());
+ }
+ NodeList<Element> options = budgetListBox.getElement().getElementsByTagName("option");
+ for(int i=0;i<options.getLength();i++) {
+ Element option = options.getItem(i);
+ option.setAttribute("style", "width: auto;");
+ }
+ fireOnCollBudgChange();
+ }
+ });
+ }
+ private void fireOnCollBudgChange() {
+ for(ChangeHandler ch:changeHandlers) {
+ ch.onChange(null);
+ }
+ }
+
+ /**
+ * Appelée quand le budget est modifié
+ */
+ protected void budgetChanged() {
+ currentBudget = new LabelValueDTO(budgetListBox.getValue(budgetListBox.getSelectedIndex()), budgetListBox.getItemText(budgetListBox.getSelectedIndex()));
+ criteriaTable.removeAllCriteres();
+ criteriaTable.addEmptyCriterion();
+ }
+
+ protected void loadPage(int pageNumber) {
+ startSearch();
+ ServiceLocator.getXemeliosService().loadPage(getSearchSessionId(), pageNumber, new AsyncCallback<SearchResultDTO>() {
+ public void onFailure(Throwable throwable) {
+ GWTUtils.handleRPCError(throwable);
+ }
+ public void onSuccess(SearchResultDTO result) {
+ handleSearchResult(result, false);
+ }
+ });
+ }
+
+ /**
+ * Construit la barre permettant le choix de collectivité et du budget
+ * @return
+ */
+ protected Widget constructColBugChooser() {
+ this.collectivitesListBox = new ListBox();
+ this.budgetListBox = new ListBox();
+ this.changeHandlers = new ArrayList<ChangeHandler>();
+ collectivitesListBox.addChangeHandler(new ChangeHandler() {
+ public void onChange(ChangeEvent ce) {
+ collectiviteChanged();
+ }
+ });
+ budgetListBox.addChangeHandler(new ChangeHandler() {
+ public void onChange(ChangeEvent e) {
+ budgetChanged();
+ }
+ });
+ collectivitesListBox.addStyleName("limitedWidth");
+ collectivitesListBox.addChangeHandler(new ChangeHandler() {
+ @Override
+ public void onChange(ChangeEvent event) {
+ int selected = collectivitesListBox.getSelectedIndex();
+ currentCollectivite = new LabelValueDTO(collectivitesListBox.getValue(selected), collectivitesListBox.getItemText(selected));
+ collectiviteChanged();
+ }
+ });
+ budgetListBox.addStyleName("limitedWidth");
+ HorizontalPanel hPane = new HorizontalPanel();
+ hPane.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
+ hPane.add(new Image(SearchResources.INSTANCE.getToolbarLeft()));
+ HorizontalPanel inner=new HorizontalPanel();
+ inner.addStyleName("MainCollBudgChooser");
+ inner.add(new InlineHTML("Collectivité : "));
+ inner.add(collectivitesListBox);
+ InlineHTML budgetLabel = new InlineHTML("Budget : ");
+ budgetLabel.getElement().getStyle().setMarginLeft(8.0, Unit.PX);
+ inner.add(budgetLabel);
+ inner.add(budgetListBox);
+ hPane.add(inner);
+ hPane.add(new Image(SearchResources.INSTANCE.getToolbarRight()));
+ collectivitesListBox.setEnabled(displayParameters.isCollectiviteEditable());
+ budgetListBox.setEnabled(displayParameters.isBudgetEditable());
+ return hPane;
+ }
+ public void initCollectivitesBudgets(ArrayList<LabelValueDTO> collectivites, ArrayList<LabelValueDTO> budgets) {
+ this.collectivitesListBox.clear();
+ for (LabelValueDTO lblCollectivite : collectivites) {
+ collectivitesListBox.addItem(lblCollectivite.getLabel(), lblCollectivite.getValue());
+ }
+ for (LabelValueDTO budget : budgets) {
+ budgetListBox.addItem(budget.getLabel(), budget.getValue());
+ }
+ if(collectivitesListBox.getItemCount()>0) {
+ collectivitesListBox.setSelectedIndex(0);
+ currentCollectivite = collectivites.get(0);
+ currentBudget = budgets.get(0);
+ }
+ NodeList<Element> options = collectivitesListBox.getElement().getElementsByTagName("option");
+ for(int i=0;i<options.getLength();i++) {
+ Element option = options.getItem(i);
+ option.setAttribute("style", "width: auto;");
+ }
+ }
+ // when there is too much collectivities
+ public void initCollectivites(String documentId) {
+ divMain.clear();
+ collectivitesListBox = null;
+ dfCollectivite = new TextBox();
+ dfCollectivite.addStyleName("limitedWidth");
+ dfCollectivite.setReadOnly(true);
+ divMain.add(new InlineHTML("Collectivité : "));
+ divMain.add(dfCollectivite);
+ final String docId = documentId;
+ pbHelpCollectivite = new Button("...",new ClickHandler() {
+ public void onClick(ClickEvent ce) {
+ pbHelpCollectivitesClicked(docId);
+ }
+ });
+ pbHelpCollectivite.addStyleName("helpCollectivite");
+ divMain.add(pbHelpCollectivite);
+ divMain.add(new InlineHTML("Budget : "));
+ divMain.add(budgetListBox);
+ }
+ protected void pbHelpCollectivitesClicked(String documentId) {
+ new DlgSelectCollectivite(documentId, new LocalColAndBudListener(this));
+ }
+
+ protected ComplexPanel constructButtonBar() {
+ int buttonCount = 0;
+ HorizontalPanel hPane = new HorizontalPanel();
+ hPane.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
+ hPane.addStyleName("ToolGroups");
+ hPane.add(new Image(SearchResources.INSTANCE.getToolbarLeftStrong()));
+ HorizontalPanel searchPanel = new HorizontalPanel();
+ searchPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
+ searchPanel.addStyleName("ToolGroup");
+ searchPanel.addStyleName("Strong");
+ ImageButton pbSearch = new ImageButton(SearchResources.INSTANCE.getSearchDisabledIcon(), new InlineHTML("Chercher").getHTML());
+ pbSearch.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ search();
+ }
+ });
+ searchPanel.add(pbSearch);
+ hPane.add(searchPanel);
+ buttonCount++;
+ HorizontalPanel inner = new HorizontalPanel();
+ inner.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
+ inner.addStyleName("ToolGroup");
+ inner.addStyleName("Norm");
+ if(displayParameters.isAddCriteriaVisible()) {
+ ImageButton pbAddCriteria = new ImageButton(SearchResources.INSTANCE.getAddCriteriaIcon(), SearchResources.INSTANCE.getAddCriteriaDisabledIcon(), new InlineHTML("Ajouter un ctritère").getHTML());
+ pbAddCriteria.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ addCriteria();
+ }
+ });
+ inner.add(pbAddCriteria);
+ buttonCount++;
+ }
+ if(displayParameters.isClearAllVisible()) {
+ ImageButton pbClearAll = new ImageButton(SearchResources.INSTANCE.getCleanCriteriasIcon(), SearchResources.INSTANCE.getCleanCriteriasDisabledIcon(), new InlineHTML("Supprimer tous les critères").getHTML());
+ pbClearAll.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ clearAllCriterias();
+ }
+ });
+ inner.add(pbClearAll);
+ buttonCount++;
+ }
+ if(displayParameters.isOpenRequestVisible()) {
+ ImageButton pbOpenRequest = new ImageButton(SearchResources.INSTANCE.getOpenSearchIcon(), SearchResources.INSTANCE.getSaveSearchDisabledIcon(), new InlineHTML("Ouvrir une recherche pré-enregistrée").getHTML());
+ pbOpenRequest.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ openRequest();
+ }
+ });
+ inner.add(pbOpenRequest);
+ buttonCount++;
+ }
+ if(displayParameters.isSaveRequestVisible()) {
+ ImageButton pbSaveRequest = new ImageButton(SearchResources.INSTANCE.getSaveSearchIcon(), SearchResources.INSTANCE.getSaveSearchDisabledIcon(), new InlineHTML("Enregistrer les critères de recherche").getHTML());
+ pbSaveRequest.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ saveRequest();
+ }
+ });
+ inner.add(pbSaveRequest);
+ buttonCount++;
+ }
+ if(displayParameters.isShowRepositoryVisible()) {
+ ImageButton pbShowRepository = new ImageButton(SearchResources.INSTANCE.getRepositoryIcon(), SearchResources.INSTANCE.getRepositoryDisabledIcon(), new InlineHTML("Nomenclature").getHTML());
+ pbShowRepository.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ showRepository();
+ }
+ });
+ }
+ if(displayParameters.isSortFieldsVisible()) {
+ ImageButton pbCfgSort = new ImageButton(SearchResources.INSTANCE.getParamsIcon(), SearchResources.INSTANCE.getParamsDisabledIcon(), new InlineHTML("Champs et tris").getHTML());
+ pbCfgSort.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ configSearchParams();
+ }
+ });
+ }
+ hPane.add(inner);
+ hPane.add(new Image(SearchResources.INSTANCE.getToolbarRight()));
+ return hPane;
+ }
+ /**
+ * Lance la recherche
+ */
+ public void search() {
+ if (criteriaTable.checkValidity()) {
+ startSearch();
+ if (getSearchInitParameters().getPluginId() == null) {
+ ServiceLocator.getXemeliosService().search(getSearchSessionId(), getCollectiviteId(), getBudgetId(), criteriaTable.getSearchParameters(), getSearchInitParameters().getPluginId(), new AsyncCallback<SearchResultDTO>() {
+ @Override
+ public void onFailure(Throwable throwable) {
+ GWTUtils.handleRPCError(throwable);
+ endLongWait();
+ }
+ @Override
+ public void onSuccess(SearchResultDTO result) {
+ handleSearchResult(result, true);
+ }
+ });
+ } else {
+ if (getSearchInitParameters().getPluginType() == StoredSearchDTO.TYPE_SEARCH) {
+ ServiceLocator.getXemeliosService().search(getSearchSessionId(), getCollectiviteId(), getBudgetId(), criteriaTable.getSearchParameters(), getSearchInitParameters().getPluginId(), new AsyncCallback<SearchResultDTO>() {
+ @Override
+ public void onFailure(Throwable throwable) {
+ GWTUtils.handleRPCError(throwable);
+ endLongWait();
+ }
+ @Override
+ public void onSuccess(SearchResultDTO result) {
+ handleSearchResult(result, true);
+ }
+ });
+ } else {
+ ServiceLocator.getXemeliosService().processPluginExport(getSearchSessionId(), getCollectiviteId(), getBudgetId(), getSearchInitParameters().getPluginId(), criteriaTable.getSearchParameters(), new AsyncCallback<String>() {
+ @Override
+ public void onFailure(Throwable throwable) {
+ GWTUtils.handleRPCError(throwable);
+ endLongWait();
+ }
+ @Override
+ public void onSuccess(String result) {
+ endLongWait();
+ downloadUrl(GWTUtils.getContextPath() + result);
+ }
+ });
+ }
+ }
+ }
+ }
+ /**
+ * Ajoute un critere de recherche
+ */
+ public void addCriteria() {
+ criteriaTable.addEmptyCriterion();
+ }
+ /**
+ * Supprime tous les critères
+ */
+ public void clearAllCriterias() {
+ criteriaTable.removeAllCriteres();
+ }
+ /**
+ * Ouvre une recherche enregistrée, un plugin, etc...
+ */
+ public void openRequest() {
+ final DlgChooseStoredSearch dlg = new DlgChooseStoredSearch("Ouverture d'une recherche");
+ dlg.show();
+ dlg.center();
+ ServiceLocator.getXemeliosService().getStoredSearchs(getSearchSessionId(), new AsyncCallback<List<StoredSearchDTO>>() {
+ @Override
+ public void onFailure(Throwable throwable) {
+ GWTUtils.handleRPCError(throwable);
+ }
+ @Override
+ public void onSuccess(List<StoredSearchDTO> result) {
+ dlg.setSearchItems(result);
+ dlg.addSelectListener(new DlgChooseOnePair.SelectListener() {
+ @Override
+ public void onSelect(Object selectedItem) {
+ loadSearch((StoredSearchDTO) selectedItem);
+ }
+ });
+ }
+ });
+ }
+ private void loadSearch(StoredSearchDTO storedSearch) {
+ switch (storedSearch.getType()) {
+ case StoredSearchDTO.TYPE_EXPORT:
+ case StoredSearchDTO.TYPE_SEARCH: {
+ ServiceLocator.getXemeliosService().getSearchInitParameters(getSearchSessionId(), storedSearch != null ? storedSearch.getId() : null, new AsyncCallback<SearchInitParametersDTO>() {
+
+ public void onFailure(Throwable throwable) {
+ GWTUtils.handleRPCError(throwable);
+ }
+
+ public void onSuccess(SearchInitParametersDTO result) {
+ setSearchInitParameters(result);
+ }
+ });
+ break;
+ }
+ case StoredSearchDTO.TYPE_SAVED: {
+ ServiceLocator.getXemeliosService().getSearchInitParametersForSavedSearch(getSearchSessionId(), storedSearch.getId(), new AsyncCallback<SearchInitParametersDTO>() {
+ @Override
+ public void onFailure(Throwable throwable) {
+ GWTUtils.handleRPCError(throwable);
+ }
+ @Override
+ public void onSuccess(SearchInitParametersDTO result) {
+ displaySavedRequest(result);
+ }
+ });
+ }
+ }
+ }
+ private void displaySavedRequest(SearchInitParametersDTO params) {
+ criteriaTable.removeAllCriteres();
+ int i=0;
+ for(CritereTypeDTO critere: params.getMandatoryCritereTypes()) {
+ PostRunnable pr = new PostRunnable(Integer.toString(i)) {
+ boolean alreadyRun = false;
+ @Override
+ public void run() {
+ if(!alreadyRun) {
+ criteriaTable.getSelectCritereWidget(getIntValue()).setSelectedCritere((CritereTypeDTO)getAdditionalObject("critere"));
+ criteriaTable.initCriteria(getIntValue(), (PostRunnable)this);
+ alreadyRun = true;
+ }
+ }
+ };
+ pr.setAdditionalObject("critere", critere);
+ pr.setAdditionalInt(i);
+ int row = criteriaTable.addEmptyCriterion(pr);
+ i++;
+ }
+ }
+ /**
+ * Enregistre la requête courante
+ */
+ public void saveRequest() {
+ final SaveRequestDialog dlg = new SaveRequestDialog(this, criteriaTable.getSearchParameters());
+ ServiceLocator.getXemeliosService().getSavedPrivateSearchs(getSearchSessionId(), new AsyncCallback<List<StoredSearchDTO>>() {
+
+ public void onFailure(Throwable throwable) {
+ GWTUtils.handleRPCError(throwable);
+ }
+
+ public void onSuccess(List<StoredSearchDTO> result) {
+ dlg.setItems(result);
+ }
+ });
+ }
+
+ public String getSearchSessionId() {
+ return initParameters.getSearchSessionId();
+ }
+
+ public String getCollectiviteId() {
+ return currentCollectivite!=null ? currentCollectivite.getId() : null;
+ }
+
+ public String getBudgetId() {
+ return currentBudget!=null ? currentBudget.getId() : null;
+ }
+ private void startSearch() {
+ startLongWait();
+ }
+ private void startLongWait() {
+ working.setPopupPositionAndShow(new PositionCallback() {
+ @Override
+ public void setPosition(int offsetWidth, int offsetHeight) {
+ int left = resultTableContainer.getAbsoluteLeft();
+ int top = resultTableContainer.getAbsoluteTop();
+ int startLeft = left + (resultTableContainer.getOffsetWidth()-working.getImageWidth())/2;
+ int startTop = top + (resultTableContainer.getOffsetHeight()-working.getImageHeight())/2;
+ working.setPopupPosition(startLeft, startTop);
+ }
+ });
+ }
+ private void endLongWait() {
+ working.hide();
+ }
+
+ public SearchInitParametersDTO getSearchInitParameters() {
+ return searchInitParameters;
+ }
+
+ public void setSearchInitParameters(SearchInitParametersDTO searchInitParameters) {
+ this.searchInitParameters = searchInitParameters;
+ }
+ /**
+ * Affiche le résultat de recherche
+ * @param result
+ * @param firstSearch true si c'est une première recherche, et pas un changement de page
+ */
+ protected void handleSearchResult(SearchResultDTO result, boolean firstSearch) {
+ if(firstSearch) {
+ while (resultTableContainer.getWidgetCount() > 0) {
+ resultTableContainer.remove(0);
+ }
+ resultTable = new ResultTable(result);
+ resultTable.addResultOperationListener(this);
+ ScrollPanel scroller = new ScrollPanel(resultTable);
+ if(!displayParameters.isSplitterVisible())
+ scroller.setHeight("270px");
+ resultTableContainer.add(scroller);
+ } else {
+ resultTable.getListDataProvider().getList().clear();
+ resultTable.getListDataProvider().getList().addAll(result.getData());
+ }
+ statusBar.getPaginationWidget().setPaginationInfo(result.getPaginationInfo());
+ if (result.getCountAll() <= 0) {
+ statusBar.setText(new HTML(" Aucun "+getSearchInitParameters().getImportableElementLibelle()+" trouvé").getText());
+ exportPossible = false;
+ } else if (result.getCountAll() == 1) {
+ statusBar.setText(new HTML(" 1 "+getSearchInitParameters().getImportableElementLibelle()+" trouvé").getText());
+ exportPossible = true;
+ } else {
+ statusBar.setText(new HTML(" " + result.getCountAll() + " "+getSearchInitParameters().getImportableElementLibelle()+"s trouvés").getText());
+ exportPossible = true;
+ }
+ endLongWait();
+ }
+
+ /**
+ * Appelée lorsque on a un résultat de recherche sur un plugin d'export
+ * @param url
+ */
+ public abstract void downloadUrl(String url);
+ /**
+ * Affiche le référentiel pour la collectivité courante
+ */
+ public abstract void showRepository();
+ @Override
+ public void executeSaveRequest(List<SearchParameterDTO> parameters, String requestName, String requestId) {
+ if (requestId == null || requestId.length() == 0) {
+ ServiceLocator.getXemeliosService().saveRequest(getSearchSessionId(), parameters, requestName, new AsyncCallback<String>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ Window.alert(caught.getMessage());
+ }
+ @Override
+ public void onSuccess(String result) {
+ if (!"OK".equals(result)) {
+ Window.alert("Erreur lors de l'enregistrement de la requete.");
+ }
+ }
+ });
+ } else {
+ ServiceLocator.getXemeliosService().saveRequest(getSearchSessionId(), parameters, requestName, requestId, new AsyncCallback<String>() {
+
+ public void onFailure(Throwable caught) {
+ Window.alert(caught.getMessage());
+ }
+
+ public void onSuccess(String result) {
+ if (!"OK".equals(result)) {
+ Window.alert("Erreur lors de l'enregistrement de la requete.");
+ }
+ }
+ });
+ }
+ }
+ public void configSearchParams() {
+ ServiceLocator.getXemeliosService().getListResultatDTO(getSearchSessionId(), new AsyncCallback<ListResultatDTO>() {
+ public void onFailure(Throwable caught) {
+ Window.alert(caught.getMessage());
+ GWTUtils.handleRPCError(caught);
+ }
+ public void onSuccess(ListResultatDTO result) {
+ DlgSearchParams dsp = new DlgSearchParams(AbstractSearchWidget.this, result);
+ dsp.show();
+ }
+ });
+ }
+
+ public static class DisplayParameters {
+ /**
+ * Permet de déterminer si il faut afficher le bouton d'ajout de critères
+ */
+ private boolean addCriteriaVisible = true;
+ /**
+ * Permet de déterminer si il faut afficher le bouton de recherche en arrière-plan
+ */
+ private boolean searchBackgroundVisible = true;
+ /**
+ * Permet de déterminer si il faut afficher le bouton de suppression de tous les critères
+ */
+ private boolean clearAllVisible = true;
+ /**
+ * Permet de déterminer si il faut afficher le bouton d'accès au repository
+ */
+ private boolean showRepositoryVisible = true;
+ /**
+ * Permet de déterminer si il faut afficher le bouton d'enregistrement de requêtes
+ */
+ private boolean saveRequestVisible = true;
+ /**
+ * Permet de déterminer si il faut afficher le bouton d'ouverture de requêtes
+ */
+ private boolean openRequestVisible = true;
+ /**
+ * Permet de déterminer si il faut afficherle bouton de modification de l'environnement
+ */
+ private boolean environmentVisible = true;
+ /**
+ * Permet de déterminer si il faut afficher le bouton permettant de choisir les champs et les tris
+ */
+ private boolean sortFieldsVisible = true;
+ /**
+ * Permet de détermnier si on affiche les widgets
+ */
+ private boolean widgetsVisible = true;
+ /**
+ * Permet de déterminer si les recherches enregistrées sont incluses
+ */
+ private boolean savedRequestsIncluded = true;
+ /**
+ * Permet de déterminer si les plugins de recherche sont inclus
+ */
+ private boolean searchPluginsIncluded = true;
+ /**
+ * Permet de déterminer si les plugins d'export sont inclus
+ */
+ private boolean exportPluginsIncluded = true;
+ /**
+ * Permet de déterminer si l'utilisateur peut modifier la collectivité
+ */
+ private boolean collectiviteEditable = true;
+ /**
+ * Permet de déterminer si l'utilisateur peut modifier le budget
+ */
+ private boolean budgetEditable = true;
+ /**
+ * Permet de déterminer si on affiche les sommations
+ */
+ private boolean summableVisible = true;
+ /**
+ * Permet de savoir si on affiche ou pas le bouton d'export
+ */
+ private boolean exportVisible = true;
+ /**
+ * Permet de savoir si il faut ou non afficher le slider entre la liste des critères
+ * et le tableau de résultat. Si c'est non, on les mettra dans un VerticalPanel
+ */
+ private boolean splitterVisible = true;
+
+ /**
+ * Renvoie les paramètres d'affichage correspondant à une fenêtre de recherche normale
+ * @return
+ */
+ public static DisplayParameters newSearchWindowDisplayParameters() {
+ return new DisplayParameters();
+ }
+ /**
+ * Renvoie les paramètres d'affichage correspondant à un dialogue de searchHelper
+ * @return
+ */
+ public static DisplayParameters newSearchHelperWindowDisplayParameters() {
+ DisplayParameters ret = new DisplayParameters();
+ ret.setSearchBackgroundVisible(false);
+ ret.setExportPluginsIncluded(false);
+ ret.setEnvironmentVisible(false);
+ ret.setExportVisible(false);
+ ret.setSortFieldsVisible(false);
+ ret.setSummableVisible(false);
+ ret.setSplitterVisible(false);
+ return ret;
+ }
+ protected DisplayParameters() {
+ super();
+ }
+
+ public boolean isAddCriteriaVisible() {
+ return addCriteriaVisible;
+ }
+
+ public void setAddCriteriaVisible(boolean addCriteriaVisible) {
+ this.addCriteriaVisible = addCriteriaVisible;
+ }
+
+ public boolean isClearAllVisible() {
+ return clearAllVisible;
+ }
+
+ public void setClearAllVisible(boolean clearAllVisible) {
+ this.clearAllVisible = clearAllVisible;
+ }
+
+ public boolean isEnvironmentVisible() {
+ return environmentVisible;
+ }
+
+ public void setEnvironmentVisible(boolean environmentVisible) {
+ this.environmentVisible = environmentVisible;
+ }
+
+ public boolean isExportPluginsIncluded() {
+ return exportPluginsIncluded;
+ }
+
+ public void setExportPluginsIncluded(boolean exportPluginsIncluded) {
+ this.exportPluginsIncluded = exportPluginsIncluded;
+ }
+
+ public boolean isOpenRequestVisible() {
+ return openRequestVisible;
+ }
+
+ public void setOpenRequestVisible(boolean openRequestVisible) {
+ this.openRequestVisible = openRequestVisible;
+ }
+
+ public boolean isSaveRequestVisible() {
+ return saveRequestVisible;
+ }
+
+ public void setSaveRequestVisible(boolean saveRequestVisible) {
+ this.saveRequestVisible = saveRequestVisible;
+ }
+
+ public boolean isSavedRequestsIncluded() {
+ return savedRequestsIncluded;
+ }
+
+ public void setSavedRequestsIncluded(boolean savedRequestsIncluded) {
+ this.savedRequestsIncluded = savedRequestsIncluded;
+ }
+
+ public boolean isSearchBackgroundVisible() {
+ return searchBackgroundVisible;
+ }
+
+ public void setSearchBackgroundVisible(boolean searchBackgroundVisible) {
+ this.searchBackgroundVisible = searchBackgroundVisible;
+ }
+
+ public boolean isSearchPluginsIncluded() {
+ return searchPluginsIncluded;
+ }
+
+ public void setSearchPluginsIncluded(boolean searchPluginsIncluded) {
+ this.searchPluginsIncluded = searchPluginsIncluded;
+ }
+
+ public boolean isShowRepositoryVisible() {
+ return showRepositoryVisible;
+ }
+
+ public void setShowRepositoryVisible(boolean showRepositoryVisible) {
+ this.showRepositoryVisible = showRepositoryVisible;
+ }
+
+ public boolean isSortFieldsVisible() {
+ return sortFieldsVisible;
+ }
+
+ public void setSortFieldsVisible(boolean sortFieldsVisible) {
+ this.sortFieldsVisible = sortFieldsVisible;
+ }
+
+ public boolean isWidgetsVisible() {
+ return widgetsVisible;
+ }
+
+ public void setWidgetsVisible(boolean widgetsVisible) {
+ this.widgetsVisible = widgetsVisible;
+ }
+
+ public boolean isBudgetEditable() {
+ return budgetEditable;
+ }
+
+ public void setBudgetEditable(boolean budgetEditable) {
+ this.budgetEditable = budgetEditable;
+ }
+
+ public boolean isCollectiviteEditable() {
+ return collectiviteEditable;
+ }
+
+ public void setCollectiviteEditable(boolean collectiviteEditable) {
+ this.collectiviteEditable = collectiviteEditable;
+ }
+
+ public boolean isSummableVisible() {
+ return summableVisible;
+ }
+
+ public void setSummableVisible(boolean summableVisible) {
+ this.summableVisible = summableVisible;
+ }
+
+ public boolean isExportVisible() {
+ return exportVisible;
+ }
+
+ public void setExportVisible(boolean exportVisible) {
+ this.exportVisible = exportVisible;
+ }
+
+ public boolean isSplitterVisible() {
+ return splitterVisible;
+ }
+
+ public void setSplitterVisible(boolean splitterVisible) {
+ this.splitterVisible = splitterVisible;
+ }
+ }
+
+ private static class LocalColAndBudListener implements ColAndBudListener {
+ private AbstractSearchWidget asw;
+ public LocalColAndBudListener(AbstractSearchWidget asw) {
+ super();
+ this.asw=asw;
+ }
+
+ @Override
+ public void setCollectivite(LabelValueDTO collectivite) {
+ asw.currentCollectivite = collectivite;
+ asw.dfCollectivite.setText(asw.currentCollectivite.getLibelle());
+ asw.collectiviteChanged();
+ }
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search;
+
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.ListBox;
+
+/**
+ * @author CBO
+ */
+public class AndOrChooserWidget extends Composite {
+
+ private ListBox andOrTypeListBox;
+
+ public AndOrChooserWidget() {
+ this.andOrTypeListBox = new ListBox();
+ this.andOrTypeListBox.addItem("ET", "&&");
+ this.andOrTypeListBox.addItem("OU", "||");
+ initWidget(this.andOrTypeListBox);
+ }
+
+ public String getSelectedValue() {
+ return andOrTypeListBox.getValue(andOrTypeListBox.getSelectedIndex());
+ }
+
+ public void setSelectedValue(String value) {
+ if("||".equals(value))
+ andOrTypeListBox.setSelectedIndex(1);
+ else
+ andOrTypeListBox.setSelectedIndex(0);
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search;
+
+import com.google.gwt.dom.client.Style;
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.resources.client.ImageResource;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.HasVerticalAlignment;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.common.DisableImage;
+
+/**
+ * @author CBO
+ * Widget contenant les boutons liés à la fenêtre de recherche (bouton d'ajout d'un critère, bouton de lancement de la recherche, ...)
+ * @TODO : Corriger bug : quand on clique deux fois rapidement il semble qu'il y a trois evenements déclenchés...
+ */
+public class ButtonsBarWidget extends Composite {
+
+ private static final transient String SEARCH="Search";
+ private static final transient String ADD_CRITERIA="AddSearchCriteria";
+ private static final transient String RESET_CRITERIA="ResetSearchCriteria";
+ private static final transient String OPEN_SEARCH="OpenSearch";
+ private static final transient String SAVE_SEARCH="SaveSearch";
+ private static final transient String SORT="Sort";
+ private static final transient String REPOSITORY="Preferences";
+ private static final transient String REPOSITORY_DEACTIVATED = "Preferences-deactivated";
+
+ private DisableImage addCritereButton;
+ private DisableImage searchButton;
+ private DisableImage resetCriteresButton;
+ private DisableImage openSearchButton;
+ private DisableImage saveRequestButton;
+ private DisableImage repositoryButton;
+ private DisableImage searchParamsButton;
+
+ private SearchWidget.AddCriteriaClickListener addCriteriaClickListener;
+
+ public ButtonsBarWidget() {
+
+ searchButton = createAnchor(SearchResources.INSTANCE.getSearchIcon(), SearchResources.INSTANCE.getSearchDisabledIcon(),SEARCH,new HTML("Chercher").getHTML());
+ addCritereButton = createAnchor(SearchResources.INSTANCE.getAddCriteriaIcon(), SearchResources.INSTANCE.getAddCriteriaDisabledIcon(), ADD_CRITERIA,new HTML("Ajouter un ctritère").getHTML());
+ resetCriteresButton = createAnchor(SearchResources.INSTANCE.getCleanCriteriasIcon(), SearchResources.INSTANCE.getCleanCriteriasDisabledIcon(), RESET_CRITERIA,new HTML("Supprimer tous les critères").getHTML());
+ openSearchButton = createAnchor(SearchResources.INSTANCE.getOpenSearchIcon(), SearchResources.INSTANCE.getSaveSearchDisabledIcon(), OPEN_SEARCH,new HTML("Ouvrir une recherche pré-enregistrée").getHTML());
+ saveRequestButton = createAnchor(SearchResources.INSTANCE.getSaveSearchIcon(), SearchResources.INSTANCE.getSaveSearchDisabledIcon(), SAVE_SEARCH,new HTML("Enregistrer les critères de recherche").getHTML());
+ searchParamsButton = createAnchor(SearchResources.INSTANCE.getParamsIcon(), SearchResources.INSTANCE.getParamsDisabledIcon(), SORT,new HTML("Champs et tris").getHTML());
+ repositoryButton = createAnchor(SearchResources.INSTANCE.getRepositoryIcon(), SearchResources.INSTANCE.getRepositoryDisabledIcon(), REPOSITORY, new HTML("Nomenclature").getHTML());
+
+ HorizontalPanel mainPanel = new HorizontalPanel();
+ mainPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
+ mainPanel.getElement().setId("SearchTools");
+ mainPanel.setStyleName("ToolBar");
+ mainPanel.addStyleName("Main");
+ HorizontalPanel toolGroups = new HorizontalPanel();
+// toolGroups.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
+ toolGroups.setStyleName("ToolGroups");
+ toolGroups.add(new Image(SearchResources.INSTANCE.getToolbarLeftStrong()));
+
+ HorizontalPanel hpSearch = new HorizontalPanel();
+// hpSearch.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
+ hpSearch.setStyleName("ToolGroup Strong");
+ hpSearch.add(searchButton);
+ toolGroups.add(hpSearch);
+
+ HorizontalPanel hpCriterias = new HorizontalPanel();
+// hpCriterias.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
+ hpCriterias.setStyleName("ToolGroup Norm hasBackground");
+ hpCriterias.add(addCritereButton);
+ hpCriterias.add(resetCriteresButton);
+ toolGroups.add(hpCriterias);
+
+ Image sep = new Image(SearchResources.INSTANCE.getToolbarVSep());
+ sep.setStyleName("separator");
+
+ HorizontalPanel hpSaved = new HorizontalPanel();
+// hpSaved.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
+ hpSaved.setStyleName("ToolGroup Norm hasBackground");
+ hpSaved.add(sep);
+ hpSaved.add(openSearchButton);
+ hpSaved.add(saveRequestButton);
+ toolGroups.add(hpSaved);
+
+ HorizontalPanel hpRepository = new HorizontalPanel();
+// hpRepository.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
+ hpRepository.setStyleName("ToolGroup Norm hasBackground");
+ Image sep3 = new Image(SearchResources.INSTANCE.getToolbarVSep());
+ sep3.setStyleName("separator");
+ hpRepository.add(sep3);
+ hpRepository.add(repositoryButton);
+ toolGroups.add(hpRepository);
+
+ HorizontalPanel hpSort = new HorizontalPanel();
+// hpSort.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
+ hpSort.setStyleName("ToolGroup Norm hasBackground");
+ Image sep2 = new Image(SearchResources.INSTANCE.getToolbarVSep());
+ sep2.setStyleName("separator");
+ hpSort.add(sep2);
+ hpSort.add(searchParamsButton);
+ toolGroups.add(hpSort);
+
+ toolGroups.add(new Image(SearchResources.INSTANCE.getToolbarRight()));
+
+ mainPanel.add(toolGroups);
+
+ initWidget(mainPanel);
+
+}
+ public void disableRepositoryButton() {
+ repositoryButton.setEnabled(false);
+ repositoryButton.removeStyleName(REPOSITORY);
+ repositoryButton.addStyleName(REPOSITORY_DEACTIVATED);
+ repositoryButton.setTitle(null);
+ }
+
+ public void addClickListener(ClickListenerType clickListenerType, ClickHandler ch) {
+ if (clickListenerType.equals(ClickListenerType.ADD_CRITERE)) {
+ addCriteriaClickListener = (SearchWidget.AddCriteriaClickListener) ch;
+ this.addCritereButton.addClickHandler(ch);
+ } else if (clickListenerType.equals(ClickListenerType.SEARCH)) {
+ this.searchButton.addClickHandler(ch);
+ } else if (clickListenerType.equals(ClickListenerType.RESET_CRITERES)) {
+ this.resetCriteresButton.addClickHandler(ch);
+ } else if (clickListenerType.equals(ClickListenerType.OPEN_SEARCH)) {
+ this.openSearchButton.addClickHandler(ch);
+ } else if (clickListenerType.equals(ClickListenerType.SAVE_REQUEST)) {
+ this.saveRequestButton.addClickHandler(ch);
+ } else if (clickListenerType.equals(ClickListenerType.SEARCH_PARAMS)) {
+ this.searchParamsButton.addClickHandler(ch);
+ } else if (clickListenerType.equals(ClickListenerType.REPOSITORY)) {
+ this.repositoryButton.addClickHandler(ch);
+ }
+ }
+
+ public void setAddCritereEnable(boolean enable) {
+ addCriteriaClickListener.setEnabled(enable);
+ }
+
+ public void enableSearchPossibilities(boolean enable) {
+//Window.alert("ButtonsBarWidget.enableSearchPossibilities(boolean)");
+ setAddCritereEnable(enable);
+ searchButton.setEnabled(enable);
+ resetCriteresButton.setEnabled(enable);
+ openSearchButton.setEnabled(enable);
+ saveRequestButton.setEnabled(enable);
+ searchParamsButton.setEnabled(enable);
+ }
+
+ static public enum ClickListenerType {
+
+ ADD_CRITERE,
+ SEARCH,
+ RESET_CRITERES,
+ OPEN_SEARCH,
+ SAVE_REQUEST,
+ SEARCH_PARAMS,
+ REPOSITORY
+ }
+
+ private static DisableImage createAnchor(ImageResource res, ImageResource dis, String id, String title) {
+ DisableImage anch = new DisableImage(res, dis, title);
+ Style style = anch.getElement().getStyle();
+ style.setMarginTop(8.0, Unit.PX);
+ style.setWidth(28.0, Unit.PX);
+ style.setMarginLeft(2.0, Unit.PX);
+ return anch;
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search;
+
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.NodeList;
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.event.dom.client.ChangeHandler;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HasVerticalAlignment;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.InlineHTML;
+import com.google.gwt.user.client.ui.ListBox;
+import com.google.gwt.user.client.ui.TextBox;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.service.ServiceLocator;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.utils.GWTUtils;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.navigate.DlgSelectCollectivite;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.LabelValueDTO;
+import java.util.ArrayList;
+
+/**
+ * @author CBO
+ * Widget permettant à l'utilisateur de choisir la collectivité et le budget
+ */
+public class ColAndBudChooserWidget extends Composite implements ColAndBudListener {
+
+ private ListBox collectivitesListBox;
+ private ListBox budgetListBox;
+ private ArrayList<ChangeHandler> changeHandlers;
+ private HorizontalPanel divMain;
+ private TextBox dfCollectivite;
+ private Button pbHelpCollectivite;
+ private LabelValueDTO collectivite;
+ private String searchSessionId;
+
+ public ColAndBudChooserWidget(String searchSessionId) {
+ this.searchSessionId = searchSessionId;
+ this.collectivitesListBox = new ListBox();
+ this.budgetListBox = new ListBox();
+ this.changeHandlers = new ArrayList<ChangeHandler>();
+ collectivitesListBox.addChangeHandler(new ChangeHandler() {
+ public void onChange(ChangeEvent ce) {
+ collectiviteChange();
+ }
+ });
+ budgetListBox.addChangeHandler(new ChangeHandler() {
+ public void onChange(ChangeEvent e) {
+ budgetChange();
+ }
+ });
+ collectivitesListBox.addStyleName("limitedWidth");
+ budgetListBox.addStyleName("limitedWidth");
+
+ HorizontalPanel mainPanel = new HorizontalPanel();
+ mainPanel.getElement().setId("NavigationTools");
+ mainPanel.setStyleName("ToolBar");
+ mainPanel.add(new Image(SearchResources.INSTANCE.getToolbarLeft()));
+ divMain = new HorizontalPanel();
+ divMain.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
+ mainPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
+ divMain.addStyleName("MainCollBudgChooser");
+ divMain.add(new InlineHTML("Collectivité : "));
+ divMain.add(collectivitesListBox);
+ InlineHTML budgetLabel = new InlineHTML("Budget : ");
+ budgetLabel.getElement().getStyle().setMarginLeft(8.0, Unit.PX);
+ divMain.add(budgetLabel);
+ divMain.add(budgetListBox);
+ mainPanel.add(divMain);
+ mainPanel.add(new Image(SearchResources.INSTANCE.getToolbarRight()));
+
+ initWidget(mainPanel);
+ }
+
+ public void init(ArrayList<LabelValueDTO> collectivites, ArrayList<LabelValueDTO> budgets) {
+ this.collectivitesListBox.clear();
+ for (LabelValueDTO lblCollectivite : collectivites) {
+ collectivitesListBox.addItem(lblCollectivite.getLabel(), lblCollectivite.getValue());
+ }
+ for (LabelValueDTO budget : budgets) {
+ budgetListBox.addItem(budget.getLabel(), budget.getValue());
+ }
+ if(collectivitesListBox.getItemCount()>0)
+ collectivitesListBox.setSelectedIndex(0);
+ NodeList<Element> options = collectivitesListBox.getElement().getElementsByTagName("option");
+ for(int i=0;i<options.getLength();i++) {
+ Element option = options.getItem(i);
+ option.setAttribute("style", "width: auto;");
+ }
+ }
+ // when there is too much collectivities
+ public void init(String documentId) {
+ divMain.clear();
+ collectivitesListBox = null;
+ dfCollectivite = new TextBox();
+ dfCollectivite.addStyleName("limitedWidth");
+ dfCollectivite.setReadOnly(true);
+ divMain.add(new InlineHTML("Collectivité : "));
+ divMain.add(dfCollectivite);
+ final String docId = documentId;
+ pbHelpCollectivite = new Button("...",new ClickHandler() {
+ public void onClick(ClickEvent ce) {
+ pbHelpCollectivitesClicked(docId);
+ }
+ });
+ pbHelpCollectivite.addStyleName("helpCollectivite");
+ divMain.add(pbHelpCollectivite);
+ divMain.add(new InlineHTML("Budget : "));
+ divMain.add(budgetListBox);
+ }
+
+ protected void pbHelpCollectivitesClicked(String documentId) {
+ new DlgSelectCollectivite(documentId, this);
+ }
+
+ public String getCollectiviteId() {
+ if(collectivitesListBox!=null) {
+ if(collectivitesListBox.getSelectedIndex()>=0)
+ return collectivitesListBox.getValue(collectivitesListBox.getSelectedIndex());
+ else return null;
+ } else {
+ return collectivite!=null ? collectivite.getId() : null;
+ }
+ }
+ public String getCollectiviteLib() {
+ if(collectivitesListBox!=null) {
+ if(collectivitesListBox.getSelectedIndex()>=0)
+ return collectivitesListBox.getItemText(collectivitesListBox.getSelectedIndex());
+ else return null;
+ } else {
+ return collectivite!=null ? collectivite.getLibelle() : null;
+ }
+ }
+
+ public String getBudgetId() {
+ return budgetListBox.getValue(budgetListBox.getSelectedIndex());
+ }
+ public String getBudgetLibelle() {
+ return budgetListBox.getItemText(budgetListBox.getSelectedIndex());
+ }
+
+ public void addChangeHandler(ChangeHandler changeHandler) {
+ changeHandlers.add(changeHandler);
+ }
+
+ private void collectiviteChange() {
+ ServiceLocator.getXemeliosService().getBudgets(searchSessionId, getCollectiviteId(), new AsyncCallback<ArrayList<LabelValueDTO>>() {
+
+ public void onFailure(Throwable throwable) {
+ GWTUtils.handleRPCError(throwable);
+ }
+
+ public void onSuccess(ArrayList<LabelValueDTO> budgets) {
+ budgetListBox.clear();
+ for (LabelValueDTO budget : budgets) {
+ budgetListBox.addItem(budget.getLabel(), budget.getValue());
+ }
+ NodeList<Element> options = budgetListBox.getElement().getElementsByTagName("option");
+ for(int i=0;i<options.getLength();i++) {
+ Element option = options.getItem(i);
+ option.setAttribute("style", "width: auto;");
+ }
+ fireOnchange();
+ }
+ });
+ }
+
+ private void budgetChange() {
+ fireOnchange();
+// searchWidget.resetCriteres();
+ }
+
+ private void fireOnchange() {
+ for(ChangeHandler ch:changeHandlers) {
+ ch.onChange(null);
+ }
+ }
+
+ public void setCollectivite(LabelValueDTO collectivite) {
+ this.collectivite = collectivite;
+ dfCollectivite.setText(this.collectivite.getLibelle());
+ collectiviteChange();
+ }
+
+ public String getSearchSessionId() {
+ return searchSessionId;
+ }
+
+ public void setSearchSessionId(String searchSessionId) {
+ this.searchSessionId = searchSessionId;
+ }
+ /**
+ * Permet de rendre editable/non editable le choix des collectivités
+ * @param editable
+ */
+ public void setCollectiviteEditable(boolean editable) {
+ if(dfCollectivite!=null) dfCollectivite.setEnabled(editable);
+ else collectivitesListBox.setEnabled(editable);
+ }
+ /**
+ * Permet de rendre editable/non editable la liste des budgets
+ * @param editable
+ */
+ public void setBudgetEditable(boolean editable) {
+ budgetListBox.setEnabled(editable);
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2010 axYus - www.axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search;
+
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.LabelValueDTO;
+
+public interface ColAndBudListener {
+ public void setCollectivite(LabelValueDTO collectivite);
+ public static abstract class ColAndBudHandler implements ColAndBudListener {};
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search;
+
+import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.event.dom.client.ChangeHandler;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.Widget;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.service.ServiceLocator;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.utils.GWTUtils;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.common.ImageButton;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.criteria.CritereLineContainer;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.criteria.CritereWidget;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.criteria.CritereWidgetFactory;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.criteria.InputCritereWidget;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.CritereItemDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.CritereTypeDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.PropertyDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchInitParametersDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchParameterDTO;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author CBO
+ */
+public class CriteriaTable extends Composite {
+
+ private SearchCtxInfoProvider searchWidget;
+ private FlexTable flexTable;
+
+ private SearchInitParametersDTO searchInitParameters;
+
+ public CriteriaTable(SearchCtxInfoProvider searchWidget) {
+ this.searchWidget = searchWidget;
+ this.flexTable = new FlexTable();
+ flexTable.setWidget(0, 0, new HTML(" "));
+ flexTable.getRowFormatter().addStyleName(0, "lastCriteriaRow");
+ flexTable.getFlexCellFormatter().setColSpan(0, 0, 4);
+ initWidget(this.flexTable);
+ getElement().setId("Subnav");
+ }
+
+ public void init(SearchInitParametersDTO searchInitParameters) {
+ this.searchInitParameters = searchInitParameters;
+ removeAllCriteres();
+ for (CritereTypeDTO critereType : searchInitParameters.getMandatoryCritereTypes()) {
+ addEmptyCriterion(critereType);
+ }
+ }
+
+ public String getPluginId() {
+ return searchInitParameters.getPluginId();
+ }
+
+ public SearchCtxInfoProvider getMainWidget() {
+ return searchWidget;
+ }
+
+ public void removeAllCriteres() {
+ while (getRowCount() > 1) {
+ removeRow(getRowCount() - 2);
+ }
+ }
+
+ public SelectCritereWidget getSelectCritereWidget(int row) {
+ return (SelectCritereWidget) getWidget(row, SelectCritereWidget.class);
+ }
+
+ public int addEmptyCriterion(PostRunnable... runner) {
+ return addEmptyCriterion(null, runner);
+ }
+
+ private int addEmptyCriterion(CritereTypeDTO critereType, PostRunnable... runner) {
+ final int newCriteriaRowIndex = getRowCount()-1;
+ flexTable.insertRow(newCriteriaRowIndex);
+ if (critereType != null && newCriteriaRowIndex == 0) {
+ // Cas du premier critere de type plugin
+ List<CritereTypeDTO> singletonList = new ArrayList<CritereTypeDTO>();
+ singletonList.add(critereType);
+ SelectCritereWidget selectCritereWidget = new SelectCritereWidget(singletonList, true);
+ setWidget(newCriteriaRowIndex, 0, selectCritereWidget);
+ flexTable.getFlexCellFormatter().setColSpan(newCriteriaRowIndex, 0, 4);
+ flexTable.getRowFormatter().addStyleName(newCriteriaRowIndex, "criteriaRow");
+ } else {
+ ImageButton removeCriterionButton = new ImageButton(SearchResources.INSTANCE.getRemoveCriteriaIcon(), "Supprimer");
+ AndOrChooserWidget andOrChooserWidget = new AndOrChooserWidget();
+ if(critereType!=null) {
+ List<PropertyDTO> props = critereType.getProperties();
+ if(props!=null) {
+ for(PropertyDTO p:props) {
+ if("AND_OR".equals(p.getName())) {
+ andOrChooserWidget.setSelectedValue(p.getValue());
+ break;
+ }
+ }
+ }
+ }
+ if (newCriteriaRowIndex <= 0 || critereType != null) {
+ DOM.setStyleAttribute(removeCriterionButton.getElement(), "visibility", "hidden");
+ } else {
+ removeCriterionButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent ce) {
+ try {
+ ImageButton ib = (ImageButton)((Widget)ce.getSource()).getParent();
+ int row = getRow(ib);
+ if(row>=0)
+ removeRow(row);
+ } catch(Exception ex) {
+ Window.alert(ex.getMessage());
+ }
+ }
+ });
+ }
+ setWidget(newCriteriaRowIndex, 0, removeCriterionButton);
+ setWidget(newCriteriaRowIndex, 1, andOrChooserWidget);
+ if (newCriteriaRowIndex <= 0) {
+ DOM.setStyleAttribute(andOrChooserWidget.getElement(), "visibility", "hidden");
+ }
+ flexTable.getRowFormatter().addStyleName(newCriteriaRowIndex, "criteriaRow");
+ SelectCritereWidget selectCritereWidget = null;
+ if (critereType == null) {
+ selectCritereWidget = new SelectCritereWidget(searchInitParameters.getOptionalCritereTypes(), false);
+ } else {
+ List<CritereTypeDTO> singletonList = new ArrayList<CritereTypeDTO>();
+ singletonList.add(critereType);
+ selectCritereWidget = new SelectCritereWidget(singletonList, true);
+ }
+ setWidget(newCriteriaRowIndex, 2, selectCritereWidget);
+ final Widget widget = selectCritereWidget;
+ selectCritereWidget.addChangeHandler(new ChangeHandler() {
+ @Override
+ public void onChange(ChangeEvent event) {
+ initCriteria(getRow(widget));
+ }
+ });
+ initCriteria(newCriteriaRowIndex,runner);
+ }
+ return newCriteriaRowIndex;
+ }
+
+ public List<SearchParameterDTO> getSearchParameters() {
+ List<SearchParameterDTO> toReturn = new ArrayList<SearchParameterDTO>();
+ for (int i = 0; i < getRowCount()-1; i++) { // on zappe la dernière ligne, qui est juste un filler et qui ne contient pas de critere
+ toReturn.add(getSearchParameter(i));
+ }
+ return toReturn;
+ }
+
+ public boolean checkValidity() {
+ // Il faut au moins un champ :
+ if (getRowCount() <= 0) {
+ Window.alert(new HTML("La recherche doit comporter au moins un critère").getHTML());
+ return false;
+ }
+ // Champs obligatoires :
+ for (int row = 0; row < getRowCount(); row++) {
+ CritereLineContainer criteriaLineContainer = (CritereLineContainer) getWidget(row, CritereLineContainer.class);
+ if (criteriaLineContainer != null) {
+ for (InputCritereWidget inputCritereWidget : criteriaLineContainer.getInputCriteriaWidgets()) {
+ if (!inputCritereWidget.isFilled()) {
+ Window.alert(new HTML("Le champ désigné par le curseur doit être rempli.").getHTML());
+ inputCritereWidget.setFocus();
+ return false;
+ }
+ }
+ }
+ }
+ // Validité des champs :
+ for (int row = 0; row < getRowCount(); row++) {
+ CritereLineContainer criteriaLineContainer = (CritereLineContainer) getWidget(row, CritereLineContainer.class);
+ if (criteriaLineContainer != null) {
+ for (InputCritereWidget inputCritereWidget : criteriaLineContainer.getInputCriteriaWidgets()) {
+ try {
+ inputCritereWidget.checkValidity();
+ } catch(InputCritereWidget.ValidityException ve) {
+ Window.alert(new HTML(ve.getMessageToDisplay() + ", veuillez corriger le champ champ désigné par le curseur.").getHTML());
+ inputCritereWidget.setFocus();
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ private void setWidget(int row, int column, Widget widget) {
+ this.flexTable.setWidget(row, column, widget);
+ }
+
+ private void removeRow(int row) {
+ this.flexTable.removeRow(row);
+ }
+
+ private void clearCell(int row, int column) {
+ if (this.flexTable.getCellCount(row) > column) {
+ this.flexTable.clearCell(row, column);
+ }
+ }
+
+ private int getRowCount() {
+ return this.flexTable.getRowCount();
+ }
+
+ private int getRow(Widget widget) {
+ int retValue = -1;
+ for (int i = 0; i < this.flexTable.getRowCount(); i++) {
+ for (int j = 0; j < this.flexTable.getCellCount(i); j++) {
+ Widget wi = this.flexTable.getWidget(i, j);
+ if (wi!=null && (widget.equals(wi) || widget.equals(wi.getParent()))) {
+ retValue = i;
+ // on a trouvé, on peut renvoyer
+ return retValue;
+ }
+ }
+ }
+ return retValue;
+ }
+
+ public void initCriteria(final int row, CritereTypeDTO critere) {
+ getSelectCritereWidget(row).setSelectedCritere(critere);
+ final SelectCritereWidget selectCritereWidget = getSelectCritereWidget(row);
+ clearCell(row, 3);
+ final ArrayList<PropertyDTO> properties = critere.getProperties();
+ ServiceLocator.getXemeliosService().getCritereDefinition(
+ getMainWidget().getSearchSessionId(),
+ getMainWidget().getCollectiviteId(),
+ getMainWidget().getBudgetId(),
+ selectCritereWidget.getSelectedCritere().getId(),
+ searchInitParameters.getPluginId(),
+ new AsyncCallback<ArrayList<CritereItemDTO>>() {
+ public void onFailure(Throwable throwable) {
+ GWTUtils.handleRPCError(throwable);
+ }
+ public void onSuccess(ArrayList<CritereItemDTO> result) {
+ if (result != null && !result.isEmpty()) {
+ CritereLineContainer criteriaLineContainer = new CritereLineContainer(CriteriaTable.this, selectCritereWidget.getSelectedCritere().getId(), selectCritereWidget.getOffsetHeight());
+ for (CritereItemDTO critereItem : result) {
+ CritereWidget cw = CritereWidgetFactory.createWidget(criteriaLineContainer, critereItem,properties);
+ if (cw != null) {
+ criteriaLineContainer.add(cw);
+ }
+ }
+ setWidget(row, 3, criteriaLineContainer);
+ }
+ }
+ });
+
+ }
+ public void initCriteria(final int row, final PostRunnable... runner) {
+ final SelectCritereWidget selectCritereWidget = getSelectCritereWidget(row);
+ clearCell(row, 3);
+ ServiceLocator.getXemeliosService().getCritereDefinition(
+ getMainWidget().getSearchSessionId(),
+ getMainWidget().getCollectiviteId(),
+ getMainWidget().getBudgetId(),
+ selectCritereWidget.getSelectedCritere().getId(),
+ searchInitParameters.getPluginId(),
+ new AsyncCallback<ArrayList<CritereItemDTO>>() {
+ public void onFailure(Throwable throwable) {
+ GWTUtils.handleRPCError(throwable);
+ }
+ public void onSuccess(ArrayList<CritereItemDTO> result) {
+ List<PostRunnable> runners = Arrays.asList(runner);
+ PostRunnable firstRunnable = runners.isEmpty() ? null : runners.get(0);
+ CritereTypeDTO critereType = firstRunnable!=null ? (CritereTypeDTO)firstRunnable.getAdditionalObject("critere") : null;
+ if (result != null && !result.isEmpty()) {
+ CritereLineContainer criteriaLineContainer = new CritereLineContainer(CriteriaTable.this, selectCritereWidget.getSelectedCritere().getId(), selectCritereWidget.getOffsetHeight());
+ for (CritereItemDTO critereItem : result) {
+ CritereWidget cw = null;
+ if(critereType==null) {
+ cw = CritereWidgetFactory.createWidget(criteriaLineContainer, critereItem);
+ } else {
+ cw = CritereWidgetFactory.createWidget(criteriaLineContainer, critereItem, critereType.getProperties());
+ for(PropertyDTO p:critereType.getProperties()) {
+ if("AND_OR".equals(p.getName())) {
+ AndOrChooserWidget andOrChooserWidget = (AndOrChooserWidget)getWidget(row, AndOrChooserWidget.class);
+ if (andOrChooserWidget != null && row != 0) {
+ andOrChooserWidget.setSelectedValue(p.getValue());
+ break;
+ }
+ }
+ }
+
+ }
+ if (cw != null) {
+ criteriaLineContainer.add(cw);
+ }
+ }
+ setWidget(row, 3, criteriaLineContainer);
+ }
+ for(PostRunnable pr:runners) {
+ pr.run();
+ }
+ }
+ });
+ }
+
+ private SearchParameterDTO getSearchParameter(int row) {
+ SearchParameterDTO toReturn = new SearchParameterDTO();
+ AndOrChooserWidget andOrChooserWidget = (AndOrChooserWidget)getWidget(row, AndOrChooserWidget.class);
+ if (andOrChooserWidget != null && row != 0) {
+ toReturn.setOperator(andOrChooserWidget.getSelectedValue());
+ }
+ toReturn.setCritereModelId(getSelectCritereWidget(row).getSelectedCritere().getId());
+ CritereLineContainer criteriaLineContainer = (CritereLineContainer) getWidget(row, CritereLineContainer.class);
+ if (criteriaLineContainer != null) {
+ for (InputCritereWidget inputCritereWidget : criteriaLineContainer.getInputCriteriaWidgets()) {
+ toReturn.putInputValue(inputCritereWidget.getInputId(), inputCritereWidget.getInputValue());
+ }
+ }
+ return toReturn;
+ }
+
+ private Widget getWidget(int row, Class clazz) {
+ for (int i = 0; i < this.flexTable.getCellCount(row); i++) {
+ Widget widget = this.flexTable.getWidget(row, i);
+ if (widget != null && widget.getClass().equals(clazz)) {
+ return widget;
+ }
+ }
+ return null;
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2011 axYus - www.axyus.com
+ * 2011 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search;
+
+import com.google.gwt.cell.client.ImageResourceCell;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.resources.client.ImageResource;
+import com.google.gwt.user.cellview.client.CellTable;
+import com.google.gwt.user.cellview.client.Column;
+import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
+import com.google.gwt.user.cellview.client.SimplePager;
+import com.google.gwt.user.cellview.client.TextColumn;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.DialogBox;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.view.client.ListDataProvider;
+import com.google.gwt.view.client.SelectionChangeEvent;
+import com.google.gwt.view.client.SingleSelectionModel;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.common.DlgChooseOnePair;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.StoredSearchDTO;
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ *
+ * @author cmarchand
+ */
+public class DlgChooseStoredSearch extends DialogBox {
+ private CellTable<StoredSearchDTO> table;
+ private DlgChooseOnePair.SelectListenerCollection selectListeners;
+ private Column _iconColumn, _textColumn;
+
+ public DlgChooseStoredSearch(String title) {
+ super();
+ setTitle(title);
+ setText(title);
+ setSize("400px", "400px");
+ selectListeners = new DlgChooseOnePair.SelectListenerCollection();
+ VerticalPanel dock = new VerticalPanel();
+ table = new CellTable<StoredSearchDTO>(10);
+ ImageResourceCell irc = new ImageResourceCell();
+ Column<StoredSearchDTO, ImageResource> iconColumn = new Column<StoredSearchDTO, ImageResource>(irc) {
+ @Override
+ public ImageResource getValue(StoredSearchDTO object) {
+ return ResourceConverter.getImageResource(object.getResource());
+ }
+ };
+ iconColumn.setSortable(true);
+ table.addColumn(iconColumn, "Type");
+ TextColumn<StoredSearchDTO> textCol = new TextColumn<StoredSearchDTO>() {
+ @Override
+ public String getValue(StoredSearchDTO object) {
+ return object.getLibelle();
+ }
+ };
+ textCol.setSortable(true);
+ table.addColumn(textCol, "Recherche");
+ final SingleSelectionModel<StoredSearchDTO> selectionModel = new SingleSelectionModel<StoredSearchDTO>();
+ table.setSelectionModel(selectionModel);
+ selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
+ @Override
+ public void onSelectionChange(SelectionChangeEvent event) {
+ StoredSearchDTO selected = selectionModel.getSelectedObject();
+ if (selected != null) {
+ selectListeners.fireSelect(selected);
+ hide();
+ }
+ }
+ });
+ _iconColumn = iconColumn;
+ _textColumn = textCol;
+ dock.add(table);
+ SimplePager pager = new SimplePager();
+ pager.setDisplay(table);
+ dock.add(pager);
+ dock.add(createButtonsPanel());
+ setWidget(dock);
+ }
+ private Widget createButtonsPanel() {
+ HorizontalPanel horizontalPanel = new HorizontalPanel();
+ Button cancelButton = new Button();
+ cancelButton.setText("Annuler");
+ cancelButton.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ cancel();
+ }
+ });
+ horizontalPanel.add(cancelButton);
+ return horizontalPanel;
+ }
+ private void cancel() {
+ hide();
+ }
+
+ public void setSearchItems(List<StoredSearchDTO> items) {
+ if(items!=null) {
+ ListDataProvider<StoredSearchDTO> ldp = new ListDataProvider<StoredSearchDTO>(items);
+ ldp.addDataDisplay(table);
+ // tris des colonnes
+ ListHandler<StoredSearchDTO> listHandler = new ListHandler<StoredSearchDTO>(ldp.getList());
+ listHandler.setComparator(_iconColumn, new Comparator<StoredSearchDTO>() {
+ public int compare(StoredSearchDTO o1, StoredSearchDTO o2) {
+ if(o1==o2) return 0;
+ if(o1!=o2) {
+ return (o2!=null) ? o1.getResource().compareTo(o2.getResource()) : 1;
+ }
+ return -1;
+ }
+ });
+ listHandler.setComparator(_textColumn, new Comparator<StoredSearchDTO>() {
+ public int compare(StoredSearchDTO o1, StoredSearchDTO o2) {
+ if(o1==o2) return 0;
+ if(o1!=o2) {
+ return (o2!=null) ? o1.getLibelle().compareTo(o2.getLibelle()) : 1;
+ }
+ return -1;
+ }
+ });
+ table.addColumnSortHandler(listHandler);
+ } else {
+ table.setRowCount(0);
+ }
+ }
+ public void addSelectListener(DlgChooseOnePair.SelectListener selectListener) {
+ this.selectListeners.add(selectListener);
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2011 axYus - http://www.axyus.com
+ * 2011 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS ; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search;
+
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.logical.shared.CloseEvent;
+import com.google.gwt.event.logical.shared.CloseHandler;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.DialogBox;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.PopupPanel;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.service.ServiceLocator;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.utils.GWTUtils;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.criteria.TextCritereWidget;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.InitParametersDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.RowResultDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchHelperDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchResultDTO;
+
+/**
+ * Boite affichant une recherche et permettant de remplir un champ avec une valeur issue d'une ligne sélectionnée
+ * @author cmarchand
+ */
+public class DlgSearchHelper extends DialogBox {
+ private TextCritereWidget parentWidget;
+ private SearchHelperDTO searchHelperConfig;
+ private SearchContext searchContext;
+ private InitParametersDTO searchInitParameters;
+ private AbstractSearchWidget asw;
+ private Button cancelButton;
+
+ public DlgSearchHelper(SearchHelperDTO searchHelperConfig, SearchContext searchContext, TextCritereWidget parentWidget) {
+ super(false, true);
+ this.parentWidget = parentWidget;
+ this.searchHelperConfig = searchHelperConfig;
+ this.searchContext = searchContext;
+ setText("Rechercher une valeur...");
+ final VerticalPanel mainPanel = new VerticalPanel();
+ cancelButton = new Button("Annuler", new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ hide();
+ }
+ });
+ ServiceLocator.getXemeliosService().initSearchWindow(
+ searchHelperConfig.getTargetDocumentId(),
+ searchHelperConfig.getTargetEtatId(),
+ searchHelperConfig.getTargetElementId(), new AsyncCallback<InitParametersDTO>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ StackTraceElement[] elements = caught.getStackTrace();
+ StringBuilder sb = new StringBuilder();
+ sb.append(caught.getMessage()).append("<div style=\"padding-left: 10px;\">");
+ for(StackTraceElement el:elements) {
+ sb.append(el.toString()).append("<br/>");
+ }
+ sb.append("</div>");
+ mainPanel.add(new HTML(sb.toString(), true));
+ }
+ @Override
+ public void onSuccess(InitParametersDTO result) {
+ // TODO
+ mainPanel.add(createSearcher(result));
+ mainPanel.add(cancelButton);
+ }
+ });
+ setWidget(mainPanel);
+ // on vire le padding sur le contenu de la boit de dialogue
+ Element el = mainPanel.getElement();
+ while(true) {
+ String classNames = el.getClassName();
+ String[] classes = classNames.split(" ", -1);
+ boolean found = false;
+ for(String className: classes) {
+ if("dialogMiddleCenter".equals(className)) {
+ el.getStyle().setPadding(1, Unit.PX);
+ found = true;
+ }
+ }
+ if(found) break;
+ el = el.getParentElement();
+ }
+ addCloseHandler(new CloseHandler<PopupPanel>() {
+ @Override
+ public void onClose(CloseEvent<PopupPanel> event) {
+ destroySearchSession();
+ }
+ });
+ // on centre et on affiche
+ center();
+ show();
+ }
+
+ public Widget createSearcher(InitParametersDTO initParameters) {
+ this.searchInitParameters = initParameters;
+ this.asw = new AbstractSearchWidget(
+ searchHelperConfig.getTargetDocumentId(),
+ searchHelperConfig.getTargetEtatId(),
+ searchHelperConfig.getTargetElementId(),
+ initParameters,
+ AbstractSearchWidget.DisplayParameters.newSearchHelperWindowDisplayParameters()) {
+ @Override
+ public void downloadUrl(String url) {
+ // ici, on ne fait rien
+ }
+ public void showRepository() {
+ // ici, on n'affiche jamais le repository
+ }
+
+ @Override
+ protected void handleSearchResult(SearchResultDTO result, boolean firstSearch) {
+ super.handleSearchResult(result, firstSearch);
+ center();
+ }
+ @Override
+ public void onDoubleClickOnRowResult(RowResultDTO row) {
+ parentWidget.setInputValue(row.getStringValue(searchHelperConfig.getIdColumnToReturn()));
+ hide();
+ }
+
+ };
+ if(searchInitParameters.hasTooMuchCollectivites()) {
+ asw.initCollectivites(searchInitParameters.getDocumentId());
+ } else {
+ asw.initCollectivitesBudgets(searchInitParameters.getCollectivites(), searchInitParameters.getFirstCollectiviteBudgets());
+ }
+ return asw;
+ }
+// private void valueSelected(RowResultDTO row) {
+// String value = row.getStringValue(searchHelperConfig.getIdColumnToReturn());
+// parentWidget.setInputValue(value);
+// hide();
+// }
+ private void destroySearchSession() {
+ if(searchInitParameters!=null) {
+ ServiceLocator.getXemeliosService().destroySearchSession(searchInitParameters.getSearchSessionId(), new AsyncCallback() {
+ public void onFailure(Throwable throwable) {
+ GWTUtils.handleRPCError(throwable);
+ }
+ /**
+ * @TODO : remove search parameters stored in http session
+ */
+ public void onSuccess(Object nullResult) {}
+ });
+ }
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2011 axYus - www.axyus.com
+ * 2011 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search;
+
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.event.dom.client.ChangeHandler;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.CheckBox;
+import com.google.gwt.user.client.ui.DialogBox;
+import com.google.gwt.user.client.ui.Grid;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.HasVerticalAlignment;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.ListBox;
+import com.google.gwt.user.client.ui.ScrollPanel;
+import com.google.gwt.user.client.ui.TabPanel;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.service.ServiceLocator;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.common.ImageButton;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.DisplayableFieldDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.ListResultatDTO;
+
+/**
+ *
+ * @author chm
+ */
+public class DlgSearchParams extends DialogBox {
+ private static final String LBL_PRIMARY_STYLE_NAME = "selectable-listentry";
+ private static final String LBL_SELECTED_STYLE = "selected";
+ private static final String SCROLLPANE_STYLE_NAME = "gwt-BorderedScollPanel";
+
+ public static final transient String DLG_TITLE = "Tris et champs affichés";
+
+ private SearchCtxInfoProvider parent;
+
+ private ListResultatDTO lr;
+
+ public DlgSearchParams(SearchCtxInfoProvider parent, ListResultatDTO lr) {
+ super(false, true);
+ setText(new HTML(DLG_TITLE).getHTML());
+ this.parent = parent;
+ this.lr = lr;
+ initComponents();
+ }
+
+ private void initComponents() {
+ VerticalPanel mainPane = new VerticalPanel();
+ TabPanel tab = new TabPanel();
+ Widget fieldsTab;
+ tab.add(fieldsTab = createDisplayableFieldsTab(), "Champs");
+ tab.add(createSortableFieldsTab(),"Tris");
+ tab.selectTab(tab.getWidgetIndex(fieldsTab));
+ mainPane.add(tab);
+ mainPane.add(new ButtonBar(this));
+
+ setWidget(mainPane);
+ center();
+ }
+
+ protected void okClicked() {
+ int sortFieldCount = 0;
+ boolean error = false;
+ for(DisplayableFieldDTO field:lr.getDisplayableFields()) {
+ if(field.getSortPosition()>=0) sortFieldCount++;
+ if(field.getSortPosition()>=0 && !field.isDisplay()) {
+ Window.alert(new HTML("Vous ne pouvez pas trier suivant un champ qui n'est pas affiché: "+field.getLibelle()).getHTML());
+ error = true;
+ break;
+ }
+ }
+ if(sortFieldCount==0) {
+ error = true;
+ Window.alert(new HTML("Vous devez sélectionner au moins un champ sur lequel trier.").getHTML());
+ }
+ if(!error) {
+ saveSearchParams();
+ }
+ }
+ protected void cancelClicked() {
+ hide();
+ }
+ protected Widget createDisplayableFieldsTab() {
+ return new DisplayableFieldsPanel(lr);
+ }
+ protected Widget createSortableFieldsTab() {
+ return new SortableFieldsPanel(lr);
+ }
+ protected void saveSearchParams() {
+ ServiceLocator.getXemeliosService().setListResultatDTO(parent.getSearchSessionId(), lr, new AsyncCallback<String>() {
+ public void onFailure(Throwable caught) {
+ Window.alert(caught.getMessage());
+ }
+ public void onSuccess(String result) {
+ if(result==null) hide();
+ else Window.alert(result);
+ }
+ });
+ }
+
+
+ /**
+ * The first tab
+ */
+ protected class DisplayableFieldsPanel extends HorizontalPanel {
+ private ListResultatDTO lr;
+ private int selectedCount= 0;
+ private ImageButton buttonUp, buttonDown;
+ private VerticalPanel list;
+ public DisplayableFieldsPanel(ListResultatDTO lr) {
+ super();
+ this.lr=lr;
+ ScrollPanel scroller = new ScrollPanel();
+ scroller.setSize("250px","300px");
+ list = new VerticalPanel();
+ for(DisplayableFieldDTO field:lr.getDisplayableFields()) {
+ list.add(new DisplayableField(field,this));
+ }
+ scroller.add(list);
+ add(scroller);
+ scroller.addStyleName(SCROLLPANE_STYLE_NAME);
+ VerticalPanel vp = new VerticalPanel();
+ buttonUp = new ImageButton(SearchResources.INSTANCE.getBtUp(), SearchResources.INSTANCE.getBtUpDeactivated(), "Monter");
+ buttonUp.setEnable(false);
+ vp.add(buttonUp);
+ buttonDown = new ImageButton(SearchResources.INSTANCE.getBtDown(), SearchResources.INSTANCE.getBtDownDeactivated(), "Descendre");
+ buttonDown.setEnable(false);
+ vp.add(buttonDown);
+ add(vp);
+ buttonUp.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ buttonUpPressed();
+ }
+ });
+ buttonDown.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ buttonDownPressed();
+ }
+ });
+ }
+ protected void notifySelectionChanged(boolean newValue) {
+ if(newValue) selectedCount++;
+ else selectedCount--;
+ buttonDown.setEnable(selectedCount>0);
+ buttonUp.setEnable(selectedCount>0);
+ }
+ protected void buttonUpPressed() {
+ for(int i=1;i<list.getWidgetCount();i++) {
+ Widget wd = list.getWidget(i);
+ if(wd instanceof DisplayableField) {
+ DisplayableField df = (DisplayableField)wd;
+ if(df.isSelected()) {
+ list.remove(i);
+ list.insert(wd, i-1);
+ DisplayableFieldDTO field = lr.getDisplayableFields().remove(i);
+ lr.getDisplayableFields().add(i-1, field);
+ }
+ }
+ }
+ }
+ protected void buttonDownPressed() {
+ for(int i=list.getWidgetCount()-2;i>=0;i--) {
+ Widget wd = list.getWidget(i);
+ if(wd instanceof DisplayableField) {
+ DisplayableField df = (DisplayableField)wd;
+ if(df.isSelected()) {
+ list.remove(i);
+ list.insert(wd, i+1);
+ DisplayableFieldDTO field = lr.getDisplayableFields().remove(i);
+ lr.getDisplayableFields().add(i+1, field);
+ }
+ }
+ }
+ }
+ }
+ /**
+ * The elements that are in the first tab (displayable fields), into the listbox
+ */
+ protected class DisplayableField extends HorizontalPanel {
+ private DisplayableFieldDTO dto;
+ private boolean selected = false;
+ private CheckBox chk;
+ private Label lbl;
+ private DisplayableFieldsPanel parentPane;
+ public DisplayableField(DisplayableFieldDTO dto, DisplayableFieldsPanel parentPane) {
+ super();
+ setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
+ this.dto=dto;
+ this.parentPane=parentPane;
+ chk = new CheckBox();
+ chk.setValue(dto.isDisplay());
+ add(chk);
+ lbl = new Label(dto.getLibelle());
+ lbl.addStyleName("pointer-element");
+ chk.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent evt) {
+ DisplayableField.this.dto.setDisplay(chk.getValue());
+ }
+ });
+ lbl.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent evt) {
+ DisplayableField.this.onSelect();
+ }
+ });
+ lbl.setStylePrimaryName(LBL_PRIMARY_STYLE_NAME);
+ add(lbl);
+ }
+ private void onSelect() {
+ selected = !selected;
+ if(selected) {
+ lbl.setStyleName(LBL_PRIMARY_STYLE_NAME+"-"+LBL_SELECTED_STYLE);
+ } else {
+ lbl.setStyleName(LBL_PRIMARY_STYLE_NAME);
+ }
+
+ parentPane.notifySelectionChanged(selected);
+ }
+ public boolean isSelected() { return selected; }
+ }
+ /**
+ * The second tab
+ */
+ protected class SortableFieldsPanel extends HorizontalPanel {
+ private ListResultatDTO lr;
+ private VerticalPanel leftList;
+ private VerticalPanel rightList;
+ private int leftSelectedCount = 0;
+ protected int rightSelectedCount = 0;
+ private MoveButtonBar moveButtonBar;
+ private SortButtonBar sortButtonBar;
+ public SortableFieldsPanel(ListResultatDTO lr) {
+ super();
+ this.lr=lr;
+ _sfp_initComponents();
+ }
+ private void _sfp_initComponents() {
+ ScrollPanel leftScroller = new ScrollPanel();
+ leftScroller.setSize("150px", "300px");
+ leftList = new VerticalPanel();
+ for(DisplayableFieldDTO field:lr.getDisplayableFields()) {
+ if(field.getSortPosition()==DisplayableFieldDTO.SORT_POSITION_NO_SORT) {
+ leftList.add(new SortableField(field, this));
+ }
+ }
+ leftScroller.addStyleName(SCROLLPANE_STYLE_NAME);
+ leftScroller.add(leftList);
+ add(leftScroller);
+ add(moveButtonBar = new MoveButtonBar(this));
+
+ ScrollPanel rightScroller = new ScrollPanel();
+ rightScroller.setSize("150px","300px");
+ rightScroller.getElement().getStyle().setMarginLeft(5.0, Unit.PX);
+ rightList = new VerticalPanel();
+ for(DisplayableFieldDTO field:lr.getSortedFields()) {
+ rightList.add(new SortedField(field,this));
+ }
+ rightScroller.addStyleName(SCROLLPANE_STYLE_NAME);
+ rightScroller.add(rightList);
+ add(rightScroller);
+ add(sortButtonBar = new SortButtonBar(this));
+ }
+ protected void addAll() {
+ for(int i=leftList.getWidgetCount()-1;i>=0;i--) {
+ SortableField sf = (SortableField)leftList.getWidget(i);
+ DisplayableFieldDTO field = sf.getField();
+ if(field.getSortOrder()==DisplayableFieldDTO.SORT_ORDER_NO_SORT) field.setSortOrder(DisplayableFieldDTO.SORT_ORDER_ASC);
+ field.setSortPosition(rightList.getWidgetCount());
+ rightList.add(new SortedField(field,this));
+ leftList.remove(i);
+ }
+ leftSelectedCount = 0;
+ moveButtonBar.getAddSelectedButton().setEnable(false);
+ }
+ protected void addSelected() {
+ for(int i=leftList.getWidgetCount()-1;i>=0;i--) {
+ SortableField sf = (SortableField)leftList.getWidget(i);
+ if(sf.isSelected()) {
+ DisplayableFieldDTO field = sf.getField();
+ if(field.getSortOrder()==DisplayableFieldDTO.SORT_ORDER_NO_SORT) field.setSortOrder(DisplayableFieldDTO.SORT_ORDER_ASC);
+ field.setSortPosition(rightList.getWidgetCount());
+ rightList.add(new SortedField(field,this));
+ leftList.remove(i);
+ }
+ }
+ leftSelectedCount = 0;
+ moveButtonBar.getAddSelectedButton().setEnable(false);
+ }
+ protected void removeAll() {
+ for(int i=rightList.getWidgetCount()-1;i>=0;i--) {
+ SortedField sf = (SortedField)rightList.getWidget(i);
+ DisplayableFieldDTO field = sf.getField();
+ field.setSortOrder(DisplayableFieldDTO.SORT_ORDER_NO_SORT);
+ field.setSortPosition(DisplayableFieldDTO.SORT_POSITION_NO_SORT);
+ leftList.add(new SortableField(field, this));
+ rightList.remove(i);
+ }
+ rightSelectedCount = 0;
+ getSortButtonBar().getUpButton().setEnable(false);
+ getSortButtonBar().getDownButton().setEnable(false);
+ }
+ protected void removeSelected() {
+ for(int i=rightList.getWidgetCount()-1;i>=0;i--) {
+ SortedField sf = (SortedField)rightList.getWidget(i);
+ if(sf.isSelected()) {
+ DisplayableFieldDTO field = sf.getField();
+ field.setSortOrder(DisplayableFieldDTO.SORT_ORDER_NO_SORT);
+ field.setSortPosition(DisplayableFieldDTO.SORT_POSITION_NO_SORT);
+ leftList.add(new SortableField(field, this));
+ rightList.remove(i);
+ }
+ }
+ rightSelectedCount = 0;
+ getSortButtonBar().getUpButton().setEnable(false);
+ getSortButtonBar().getDownButton().setEnable(false);
+ }
+ protected void notifyLeftListChanged(boolean selected) {
+ if(selected) leftSelectedCount++;
+ else leftSelectedCount--;
+ moveButtonBar.getAddSelectedButton().setEnable(leftSelectedCount>0);
+ }
+ protected MoveButtonBar getMoveButtonBar() { return moveButtonBar; }
+ protected SortButtonBar getSortButtonBar() { return sortButtonBar; }
+ protected VerticalPanel getRightList() { return rightList; }
+ }
+ /**
+ * The elements that are in the second tab (sortable fields), into the first list box
+ */
+ protected class SortableField extends Label {
+ private static final String LBL_PRIMARY_STYLE_NAME = "selectable-listentry";
+ private static final String LBL_SELECTED_STYLE = "selected";
+ private DisplayableFieldDTO field;
+ private boolean selected = false;
+ private SortableFieldsPanel parent;
+ public SortableField(DisplayableFieldDTO field,SortableFieldsPanel parent) {
+ super();
+ this.field=field;
+ this.parent=parent;
+ setText(field.getLibelle());
+ selected = false;
+ setStyleName(LBL_PRIMARY_STYLE_NAME);
+ addStyleName("pointer-element");
+ addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent evt) {
+ selected = !selected;
+ if(selected) {
+ setStyleName(LBL_PRIMARY_STYLE_NAME+"-"+LBL_SELECTED_STYLE);
+ } else {
+ setStyleName(LBL_PRIMARY_STYLE_NAME);
+ }
+ SortableField.this.parent.notifyLeftListChanged(selected);
+ }
+ });
+ }
+ public DisplayableFieldDTO getField() { return field; }
+ public boolean isSelected() { return selected; }
+ }
+ /**
+ * The elements that are in the second tab (sortable fields), in the second listbox
+ */
+ protected class SortedField extends Grid {
+ private DisplayableFieldDTO field;
+ private SortableFieldsPanel parent;
+ private boolean selected = false;
+ private Label lbl;
+ private ListBox lb;
+ public SortedField(DisplayableFieldDTO field,SortableFieldsPanel parent) {
+ super(1,2);
+ getColumnFormatter().setWidth(0, "50%");
+ getColumnFormatter().setWidth(1, "50%");
+ this.field=field;
+ this.parent=parent;
+ lbl = new Label(field.getLibelle());
+ lbl.addStyleName("pointer-element");
+ lbl.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent evt) {
+ selected = !selected;
+ notifySelectedChanged(selected);
+ }
+ });
+ lbl.setStyleName(LBL_PRIMARY_STYLE_NAME);
+ setWidget(0,0,lbl);
+ lb = new ListBox(false);
+ lb.setVisibleItemCount(1);
+ lb.addItem("Ascendant", "ASC");
+ lb.addItem("Descendant", "DESC");
+ lb.setSelectedIndex(field.getSortOrder()==DisplayableFieldDTO.SORT_ORDER_ASC?0:1);
+ lb.addChangeHandler(new ChangeHandler() {
+ public void onChange(ChangeEvent evt) {
+ SortedField.this.field.setSortOrder(lb.getSelectedIndex()==0?DisplayableFieldDTO.SORT_ORDER_ASC:DisplayableFieldDTO.SORT_ORDER_DESC);
+ }
+ });
+ setWidget(0,1,lb);
+ }
+ private void notifySelectedChanged(boolean selected) {
+ if(selected) parent.rightSelectedCount++;
+ else parent.rightSelectedCount--;
+ if(selected) {
+ lbl.setStyleName(LBL_PRIMARY_STYLE_NAME+"-"+LBL_SELECTED_STYLE);
+ } else {
+ lbl.setStyleName(LBL_PRIMARY_STYLE_NAME);
+ }
+ parent.getSortButtonBar().getUpButton().setEnable(parent.rightSelectedCount>0);
+ parent.getSortButtonBar().getDownButton().setEnable(parent.rightSelectedCount>0);
+ parent.getMoveButtonBar().pbRemoveSelected.setEnable(parent.rightSelectedCount>0);
+ }
+ public boolean isSelected() { return selected; }
+ public DisplayableFieldDTO getField() { return field; }
+ }
+
+ protected class ButtonBar extends HorizontalPanel {
+ private DlgSearchParams parent;
+ public ButtonBar(DlgSearchParams parent) {
+ super();
+ this.parent=parent;
+ Button btOk = new Button("Ok", new ClickHandler() {
+ public void onClick(ClickEvent evt) {
+ ButtonBar.this.parent.okClicked();
+ }
+ });
+ add(btOk);
+ Button btCancel = new Button("Annuler", new ClickHandler() {
+ public void onClick(ClickEvent evt) {
+ ButtonBar.this.parent.cancelClicked();
+ }
+ });
+ add(btCancel);
+ }
+ }
+ protected class MoveButtonBar extends VerticalPanel {
+ private SortableFieldsPanel parent;
+ private ImageButton pbAddAll;
+ private ImageButton pbAddSelected;
+ private ImageButton pbRemoveSelected;
+ private ImageButton pbRemoveAll;
+ public MoveButtonBar(SortableFieldsPanel parent) {
+ super();
+ this.parent=parent;
+ pbAddAll = new ImageButton(SearchResources.INSTANCE.getBtAddAll(),"Tout ajouter");
+ pbAddSelected = new ImageButton(SearchResources.INSTANCE.getBtAddSelected(),SearchResources.INSTANCE.getBtAddSelectedDeactivated(),new HTML("Ajouter les séléctionnés").getHTML());
+ pbAddSelected.setEnable(false);
+ pbRemoveSelected = new ImageButton(SearchResources.INSTANCE.getBtDelSelected(),SearchResources.INSTANCE.getBtDelSelectedDeactivated(),new HTML("Retirer les séléctionnés").getHTML());
+ pbRemoveSelected.setEnable(false);
+ pbRemoveAll = new ImageButton(SearchResources.INSTANCE.getBtDelAll(),"Tout retirer");
+
+ pbAddAll.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent evt) {
+ MoveButtonBar.this.parent.addAll();
+ }
+ });
+ pbAddSelected.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent evt) {
+ MoveButtonBar.this.parent.addSelected();
+ }
+ });
+ pbRemoveSelected.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent evt) {
+ MoveButtonBar.this.parent.removeSelected();
+ }
+ });
+ pbRemoveAll.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent evt) {
+ MoveButtonBar.this.parent.removeAll();
+ }
+ });
+ add(pbAddAll);
+ add(pbAddSelected);
+ add(pbRemoveSelected);
+ add(pbRemoveAll);
+ }
+ public ImageButton getAddSelectedButton() { return pbAddSelected; }
+ public ImageButton getRemoveSelectedButton() { return pbRemoveSelected; }
+ }
+ protected class SortButtonBar extends VerticalPanel {
+ private SortableFieldsPanel parent;
+ private ImageButton btUp;
+ private ImageButton btDown;
+ public SortButtonBar(SortableFieldsPanel parent) {
+ super();
+ this.parent=parent;
+ btUp = new ImageButton(SearchResources.INSTANCE.getBtUp(), SearchResources.INSTANCE.getBtUpDeactivated(), "Monter");
+ btDown = new ImageButton(SearchResources.INSTANCE.getBtDown(), SearchResources.INSTANCE.getBtDownDeactivated(), "Descendre");
+ btUp.setEnable(false); btDown.setEnable(false);
+ btUp.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent evt) {
+ _buttonUpPressed();
+ }
+ });
+ btDown.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent evt) {
+ _buttonDownPressed();
+ }
+ });
+ add(btUp);
+ add(btDown);
+ }
+ public ImageButton getUpButton() { return btUp; }
+ public ImageButton getDownButton() { return btDown; }
+ private void _buttonUpPressed() {
+ VerticalPanel list = parent.getRightList();
+ for(int i=1;i<list.getWidgetCount();i++) {
+ Widget wd = list.getWidget(i);
+ if(wd instanceof SortedField) {
+ SortedField sf = (SortedField)wd;
+ if(sf.isSelected()) {
+ list.remove(i);
+ list.insert(wd, i-1);
+ sf.getField().setSortPosition(i-1);
+ }
+ }
+ }
+ }
+ private void _buttonDownPressed() {
+ VerticalPanel list = parent.getRightList();
+ for(int i=list.getWidgetCount()-2;i>=0;i--) {
+ Widget wd = list.getWidget(i);
+ if(wd instanceof SortedField) {
+ SortedField sf = (SortedField)wd;
+ if(sf.isSelected()) {
+ list.remove(i);
+ list.insert(wd, i+1);
+ sf.getField().setSortPosition(i+1);
+ }
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2011 axYus - www.axyus.com
+ * 2011 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search;
+
+import com.google.gwt.cell.client.TextCell;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.cellview.client.CellList;
+import com.google.gwt.user.cellview.client.SimplePager;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.DialogBox;
+import com.google.gwt.user.client.ui.ScrollPanel;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.view.client.ListDataProvider;
+import com.google.gwt.view.client.SelectionChangeEvent;
+import com.google.gwt.view.client.SingleSelectionModel;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.service.ServiceLocator;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.utils.GWTUtils;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.criteria.TextCritereWidget;
+import java.util.List;
+
+/**
+ * Permet de sélectionner parmi une liste de valeurs
+ * @author cmarchand
+ */
+public class DlgSelectFromDistinctValues extends DialogBox {
+ private TextCritereWidget caller;
+ private String collectivite;
+ private String budget;
+ private String searchSessionId;
+ private String helpPath;
+ private ListDataProvider<String> dataProvider;
+
+ public DlgSelectFromDistinctValues(TextCritereWidget caller, String collectivite, String budget, String searchSessionId, String helpPath) {
+ super(false, true);
+ this.caller=caller;
+ this.collectivite=collectivite;
+ this.budget=budget;
+ this.searchSessionId=searchSessionId;
+ this.helpPath=helpPath;
+ initComponents();
+ show();
+ }
+ private void initComponents() {
+ setText("Choisissez une valeur...");
+ VerticalPanel vPane = new VerticalPanel();
+ CellList<String> list = new CellList<String>(new TextCell());
+ list.setPageSize(20);
+ dataProvider = new ListDataProvider<String>();
+ final SingleSelectionModel<String> selectionModel;
+ list.setSelectionModel(selectionModel = new SingleSelectionModel<String>());
+ selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
+ @Override
+ public void onSelectionChange(SelectionChangeEvent event) {
+ caller.setInputValue(selectionModel.getSelectedObject());
+ hide();
+ }
+ });
+ vPane.add(new ScrollPanel(list));
+ dataProvider.addDataDisplay(list);
+ SimplePager pager = new SimplePager();
+ pager.setDisplay(list);
+ vPane.add(pager);
+ Button cancelButton = new Button("Annuler", new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ hide();
+ }
+ });
+ vPane.add(cancelButton);
+ setWidget(vPane);
+ center();
+ }
+
+ @Override
+ public void show() {
+ super.show();
+ ServiceLocator.getXemeliosService().getDistinctValues(searchSessionId, collectivite, budget, helpPath, new AsyncCallback<List<String>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ GWTUtils.handleRPCError(caught);
+ }
+ @Override
+ public void onSuccess(List<String> result) {
+ dataProvider.getList().clear();
+ dataProvider.getList().addAll(result);
+ }
+ });
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2011 axYus - www.axyus.com
+ * 2011 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search;
+
+import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.event.dom.client.ChangeHandler;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.ListBox;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.PaginationInfoDTO;
+import java.util.ArrayList;
+import java.util.EventListener;
+
+/**
+ * @author C.Marchand
+ */
+public class PaginationWidget extends Composite {
+
+ private HorizontalPanel horizontalPanel;
+ private PaginationInfoDTO paginationInfo;
+ private Image firstButton;
+ private Image previousButton;
+ private Image nextButton;
+ private Image lastButton;
+ private ListBox lb;
+ private HTML label1, label2;
+ private ChangePageRequestListenerCollection changePageRequestListenerCollection = new ChangePageRequestListenerCollection();
+
+ public PaginationWidget() {
+ this.horizontalPanel = new HorizontalPanel();
+ this.firstButton = new Image(SearchResources.INSTANCE.getFirstPage());
+ firstButton.setTitle(new HTML("Première page").getHTML());
+ this.previousButton = new Image(SearchResources.INSTANCE.getPreviousPage());
+ previousButton.setTitle(new HTML("Page précédente").getHTML());
+ this.nextButton = new Image(SearchResources.INSTANCE.getNextPage());
+ nextButton.setTitle(new HTML("Page suivante").getHTML());
+ this.lastButton = new Image(SearchResources.INSTANCE.getLastPage());
+ lastButton.setTitle(new HTML("Dernière page").getHTML());
+ horizontalPanel.add(this.firstButton);
+ horizontalPanel.add(new HTML(" "));
+ horizontalPanel.add(this.previousButton);
+ horizontalPanel.getElement().setId("PageNavigation");
+ label1 = new HTML(" ");
+ horizontalPanel.add(label1);
+ horizontalPanel.add(lb=new ListBox());
+ label2 = new HTML(" ");
+ horizontalPanel.add(label2);
+ horizontalPanel.add(this.nextButton);
+ horizontalPanel.add(new HTML(" "));
+ horizontalPanel.add(this.lastButton);
+ update();
+ this.firstButton.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ if(hasPrevious())
+ changePageRequestListenerCollection.fireChangePageRequest(PaginationWidget.this, 0);
+ }
+ });
+ this.previousButton.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ if(hasPrevious())
+ changePageRequestListenerCollection.fireChangePageRequest(PaginationWidget.this, PaginationWidget.this.paginationInfo.getCurrentPageNumber() - 1);
+ }
+ });
+ this.nextButton.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ if(hasNext())
+ changePageRequestListenerCollection.fireChangePageRequest(PaginationWidget.this, PaginationWidget.this.paginationInfo.getCurrentPageNumber() + 1);
+ }
+ });
+ this.lastButton.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ if(hasNext())
+ changePageRequestListenerCollection.fireChangePageRequest(PaginationWidget.this, PaginationWidget.this.paginationInfo.getPageCount() - 1);
+ }
+ });
+ this.lb.addChangeHandler(new ChangeHandler() {
+ @Override
+ public void onChange(ChangeEvent event) {
+ int index = lb.getSelectedIndex();
+ changePageRequestListenerCollection.fireChangePageRequest(PaginationWidget.this, index);
+ }
+ });
+ initWidget(this.horizontalPanel);
+ }
+
+ public void setPaginationInfo(PaginationInfoDTO paginationInfo) {
+ this.paginationInfo = paginationInfo;
+ update();
+ }
+
+ public void addChangePageRequestListener(ChangePageRequestListener changePageRequestListener) {
+ changePageRequestListenerCollection.add(changePageRequestListener);
+ }
+
+ private void update() {
+ if(paginationInfo!=null && paginationInfo.getPageCount()>0) {
+ label1.setHTML(" Page ");
+ label2.setHTML(" / "+paginationInfo.getPageCount()+" ");
+ lb.clear();
+ for(int i=0;i<paginationInfo.getPageCount();i++) {
+ lb.addItem(Integer.toString(i+1),Integer.toString(i));
+ }
+ lb.setSelectedIndex(paginationInfo.getCurrentPageNumber());
+ lb.setEnabled(true);
+ } else {
+ label1.setHTML(" ");
+ label2.setHTML(" ");
+ lb.clear();
+ lb.setEnabled(false);
+ }
+ }
+
+ private boolean hasNext() {
+ return this.paginationInfo != null && this.paginationInfo.getCurrentPageNumber() < (this.paginationInfo.getPageCount() - 1);
+ }
+
+ private boolean hasPrevious() {
+ return this.paginationInfo != null && this.paginationInfo.getCurrentPageNumber() > 0;
+ }
+
+// static public interface PaginationInfo {
+//
+// static public PaginationInfo emptyPage = new PaginationInfo() {
+//
+// public int getPageCount() {
+// return 0;
+// }
+//
+// public int getCurrentPageNumber() {
+// return -1;
+// }
+// };
+//
+// int getPageCount();
+//
+// int getCurrentPageNumber();
+// }
+
+ static public interface ChangePageRequestListener extends EventListener {
+
+ void onChangePageRequest(PaginationWidget sender, int requestedPageNumber);
+ }
+
+ static private class ChangePageRequestListenerCollection extends ArrayList<ChangePageRequestListener> {
+
+ public void fireChangePageRequest(PaginationWidget sender, int requestedPageNumber) {
+ for (ChangePageRequestListener listener : this) {
+ listener.onChangePageRequest(sender,requestedPageNumber);
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search;
+
+import java.util.ArrayList;
+
+/**
+ * A piece of code to run after an AJAX call
+ * @author chm
+ */
+public abstract class PostRunnable {
+ private int intValue;
+ private ArrayList<MapEntry> additionalObjects = new ArrayList<MapEntry>();
+ private String name;
+
+ public PostRunnable(String name) {
+ this.name=name;
+ }
+
+ public abstract void run();
+ public void setAdditionalInt(int value) {
+ this.intValue = value;
+ }
+ public int getIntValue() { return intValue; }
+ public void setAdditionalObject(String objectName, Object value) {
+ additionalObjects.add(new MapEntry(objectName, value));
+ }
+ public Object getAdditionalObject(String objectName) {
+ Object ret = null;
+ for(MapEntry entry:additionalObjects) {
+ if(entry.getName().equals(objectName)) {
+ ret = entry.getValue();
+ break;
+ }
+ }
+ return ret;
+ }
+
+ private static class MapEntry {
+ private String name;
+ private Object value;
+ public MapEntry(String name, Object value) {
+ this.name=name;
+ this.value=value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2011 axYus - www.axyus.com
+ * 2011 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search;
+
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchParameterDTO;
+import java.util.List;
+
+/**
+ * Quelque chose qui est capable d'enregistrer une recherche
+ * @author cmarchand
+ */
+public interface RequestSaver {
+ /**
+ * Enregistre la recheche, sous le nom <tt>requestName</tt>, éventuellement en écransant la recherche <tt>requestId</tt>
+ */
+ public void executeSaveRequest(List<SearchParameterDTO> parameters, String requestName, String requestId);
+}
--- /dev/null
+/*
+ * Copyright
+ * 2011 axYus - www.axyus.com
+ * 2011 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search;
+
+import com.google.gwt.resources.client.ImageResource;
+//import fr.gouv.finances.dgfip.xemelios.ui.ImageResources;
+
+/**
+ *
+ * @author cmarchand
+ */
+public class ResourceConverter {
+
+ public static ImageResource getImageResource(String resourceName) {
+ if("fr/gouv/finances/cp/xemelios/ui/resources/list-search-saved.png".equals(resourceName)) {
+ return SearchResources.INSTANCE.getListSearchSaved();
+ } else if("fr/gouv/finances/cp/xemelios/ui/resources/list-export-plug.png".equals(resourceName)) {
+ return SearchResources.INSTANCE.getListExportPlugin();
+ } else if("fr/gouv/finances/cp/xemelios/ui/resources/list-search-plug.png".equals(resourceName)) {
+ return SearchResources.INSTANCE.getListSearchPlugin();
+ }
+ return null;
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2011 axYus - http://www.axyus.com
+ * 2011 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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 of the License, or
+ * (at your option) any later version.
+ *
+ * XEMELIOS 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 XEMELIOS ; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search;
+
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.RowResultDTO;
+
+/**
+ *
+ * @author cmarchand
+ */
+public interface ResultOperationListener {
+ /**
+ * Appelé lorsqu'un utilisateur double-click sur une ligne de résultat de recherche.
+ * Cette méthode n'est pas appelée si aucune ligne n'est sélectionnée.
+ * @param row
+ */
+ public void onDoubleClickOnRowResult(RowResultDTO row);
+}
--- /dev/null
+/*
+ * Copyright
+ * 2011 axYus - www.axyus.com
+ * 2011 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search;
+
+import com.google.gwt.cell.client.DateCell;
+import com.google.gwt.cell.client.TextCell;
+import com.google.gwt.cell.client.ValueUpdater;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.NativeEvent;
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.google.gwt.i18n.client.NumberFormat;
+import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
+import com.google.gwt.user.cellview.client.CellTable;
+import com.google.gwt.user.cellview.client.Column;
+import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
+import com.google.gwt.user.client.ui.HasHorizontalAlignment;
+import com.google.gwt.view.client.ListDataProvider;
+import com.google.gwt.view.client.SelectionChangeEvent;
+import com.google.gwt.view.client.SingleSelectionModel;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.RowResultDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchResultDTO;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Une table de résultat de recherche
+ * @author cmarchand
+ */
+public class ResultTable extends CellTable<RowResultDTO> {
+ private ListDataProvider<RowResultDTO> listDataProvider;
+ private ListHandler<RowResultDTO> listHandler;
+ private List<ResultOperationListener> operationListeners;
+ private SingleSelectionModel<RowResultDTO> selectionModel;
+
+ public ResultTable(SearchResultDTO result) {
+ super();
+ operationListeners = new ArrayList<ResultOperationListener>();
+ listDataProvider = new ListDataProvider<RowResultDTO>(result.getData());
+ listHandler = new ListHandler<RowResultDTO>(listDataProvider.getList());
+ setPageSize(result.getPaginationInfo().getPageSize());
+ setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
+ String amountFormat = "#,##0.00;-#,##0.00";
+ char __noBreakSpace = '\u0020';
+ final String noBreakSpace = Character.toString(__noBreakSpace);
+ final NumberFormat amountFormatter = NumberFormat.getFormat(amountFormat);
+ for (SearchResultDTO.ColumnDefinition columnDef : result.getColumns()) {
+ if (columnDef.isDisplay()) {
+ final String id = columnDef.getId();
+ final String sLibelle = columnDef.getLibelle();
+ final String format = columnDef.getFormat();
+ SafeHtmlBuilder libelleBuilder = new SafeHtmlBuilder();
+ libelleBuilder.appendEscaped(sLibelle);
+ if ("string".equals(columnDef.getDatatype())) {
+ Column<RowResultDTO,String> column = new Column<RowResultDTO,String>( new TextCell() {
+ private HashSet<String> events;
+ @Override
+ public Set<String> getConsumedEvents() {
+ if(events==null) {
+ events = new HashSet<String>();
+ Set<String> parentsEvents = super.getConsumedEvents();
+ if(parentsEvents!=null)
+ events.addAll(parentsEvents);
+ events.add("dblclick");
+ }
+ return events;
+ }
+ @Override
+ public void onBrowserEvent(Context context, Element parent, String value, NativeEvent event, ValueUpdater<String> valueUpdater) {
+ super.onBrowserEvent(context, parent, value, event, valueUpdater);
+ if("dblclick".equals(event.getType())) {
+ __onRowDoubleClick();
+ }
+ }
+ }) {
+ @Override
+ public String getValue(RowResultDTO object) {
+ String s = object.getStringValue(id);
+ return s;
+ }
+ };
+ column.setSortable(true);
+ addColumn(column, libelleBuilder.toSafeHtml());
+ listHandler.setComparator(column, new Comparator<RowResultDTO>() {
+ public int compare(RowResultDTO o1, RowResultDTO o2) {
+ if(o1==o2) return 0;
+ if(o1!=o2) {
+ return (o2!=null) ? o1.getStringValue(id).compareTo(o2.getStringValue(id)) : 1;
+ }
+ return -1;
+ }
+ });
+ } else if ("integer".equals(columnDef.getDatatype())) {
+ Column<RowResultDTO,String> column = new Column<RowResultDTO,String>(new TextCell() {
+ private HashSet<String> events;
+ @Override
+ public Set<String> getConsumedEvents() {
+ if(events==null) {
+ events = new HashSet<String>();
+ Set<String> parentsEvents = super.getConsumedEvents();
+ if(parentsEvents!=null)
+ events.addAll(parentsEvents);
+ events.add("dblclick");
+ }
+ return events;
+ }
+ @Override
+ public void onBrowserEvent(Context context, Element parent, String value, NativeEvent event, ValueUpdater<String> valueUpdater) {
+ super.onBrowserEvent(context, parent, value, event, valueUpdater);
+ if("dblclick".equals(event.getType())) {
+ __onRowDoubleClick();
+ }
+ }
+ }) {
+ @Override
+ public String getValue(RowResultDTO object) {
+ Long value = object.getLongValue(id);
+ if (value != null) {
+ return value.toString();
+ } else {
+ return null;
+ }
+ }
+ };
+ column.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
+ column.setSortable(true);
+ addColumn(column, libelleBuilder.toSafeHtml());
+ listHandler.setComparator(column, new Comparator<RowResultDTO>() {
+ public int compare(RowResultDTO o1, RowResultDTO o2) {
+ if(o1==o2) return 0;
+ if(o1!=o2) {
+ return (o2!=null) ? o1.getLongValue(id).compareTo(o2.getLongValue(id)) : 1;
+ }
+ return -1;
+ }
+ });
+ } else if ("amount".equals(columnDef.getDatatype())) {
+ Column<RowResultDTO,String> column = new Column<RowResultDTO,String>(new TextCell() {
+ private HashSet<String> events;
+ @Override
+ public Set<String> getConsumedEvents() {
+ if(events==null) {
+ events = new HashSet<String>();
+ Set<String> parentsEvents = super.getConsumedEvents();
+ if(parentsEvents!=null)
+ events.addAll(parentsEvents);
+ events.add("dblclick");
+ }
+ return events;
+ }
+ @Override
+ public void onBrowserEvent(Context context, Element parent, String value, NativeEvent event, ValueUpdater<String> valueUpdater) {
+ super.onBrowserEvent(context, parent, value, event, valueUpdater);
+ if("dblclick".equals(event.getType())) {
+ __onRowDoubleClick();
+ }
+ }
+ }) {
+ @Override
+ public String getValue(RowResultDTO object) {
+ BigDecimal value = object.getBigDecimalValue(id);
+ if (value != null) {
+ return amountFormatter.format(value).replace(",", noBreakSpace).replace(".", ",");
+ } else {
+ return null;
+ }
+ }
+ };
+ column.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
+ column.setSortable(true);
+ addColumn(column, libelleBuilder.toSafeHtml());
+ listHandler.setComparator(column, new Comparator<RowResultDTO>() {
+ public int compare(RowResultDTO o1, RowResultDTO o2) {
+ if(o1==o2) return 0;
+ if(o1!=o2) {
+ return (o2!=null) ? o1.getBigDecimalValue(id).compareTo(o2.getBigDecimalValue(id)) : 1;
+ }
+ return -1;
+ }
+ });
+ } else if ("date".equals(columnDef.getDatatype())) {
+ final DateTimeFormat dtf = DateTimeFormat.getFormat(format);
+ DateCell dateCell = new DateCell(dtf) {
+ private HashSet<String> events;
+ @Override
+ public Set<String> getConsumedEvents() {
+ if(events==null) {
+ events = new HashSet<String>();
+ Set<String> parentsEvents = super.getConsumedEvents();
+ if(parentsEvents!=null)
+ events.addAll(parentsEvents);
+ events.add("dblclick");
+ }
+ return events;
+ }
+ @Override
+ public void onBrowserEvent(Context context, Element parent, Date value, NativeEvent event, ValueUpdater<Date> valueUpdater) {
+ super.onBrowserEvent(context, parent, value, event, valueUpdater);
+ if("dblclick".equals(event.getType())) {
+ __onRowDoubleClick();
+ }
+ }
+ };
+ Column<RowResultDTO, Date> column = new Column<RowResultDTO, Date>(dateCell) {
+ @Override
+ public Date getValue(RowResultDTO object) {
+ Date date = object.getDateValue(id);
+ return date;
+ }
+ };
+ column.setSortable(true);
+ addColumn(column, libelleBuilder.toSafeHtml());
+ listHandler.setComparator(column, new Comparator<RowResultDTO>() {
+ public int compare(RowResultDTO o1, RowResultDTO o2) {
+ if(o1==o2) return 0;
+ if(o1!=o2) {
+ return (o2!=null) ? o1.getDateValue(id).compareTo(o2.getDateValue(id)) : 1;
+ }
+ return -1;
+ }
+ });
+ }
+ }
+ }
+ addColumnSortHandler(listHandler);
+ listDataProvider.addDataDisplay(this);
+
+ // Add a selection model to handle user selection.
+ final SingleSelectionModel<RowResultDTO> __selectionModel = new SingleSelectionModel<RowResultDTO>();
+ setSelectionModel(__selectionModel);
+
+
+ __selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
+ public void onSelectionChange(SelectionChangeEvent event) {
+ RowResultDTO selected = __selectionModel.getSelectedObject();
+ }
+ });
+ selectionModel = __selectionModel;
+ }
+
+ public void addResultOperationListener(ResultOperationListener listener) {
+ operationListeners.add(listener);
+ }
+ public void removeResultOperationListener(ResultOperationListener listener) {
+ operationListeners.remove(listener);
+ }
+
+ public ListDataProvider<RowResultDTO> getListDataProvider() {
+ return listDataProvider;
+ }
+
+ private final void __onRowDoubleClick() {
+ RowResultDTO selected = selectionModel.getSelectedObject();
+ if(selected==null) return;
+ for(ResultOperationListener listener:operationListeners) {
+ listener.onDoubleClickOnRowResult(selected);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search;
+
+import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.event.dom.client.ChangeHandler;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.DialogBox;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Hyperlink;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.ScrollPanel;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.Displayable;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchParameterDTO;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Une boite proposant la liste des requetes enregistrées écrasables, ou un champ pour saisir un nouveau nom
+ * @author chm
+ */
+public class SaveRequestDialog extends DialogBox {
+ private VerticalPanel itemContainer;
+// private SelectListenerCollection selectListeners;
+ private TextBox requestName;
+ private String requestId = null;
+ private RequestSaver parent;
+ private List<SearchParameterDTO> parameters;
+
+ public SaveRequestDialog(RequestSaver parent, List<SearchParameterDTO> parameters) {
+ super(false,true);
+ this.parent=parent;
+ this.parameters=parameters;
+ setText("Enregistrement recherche");
+ VerticalPanel mainPanel = new VerticalPanel();
+ mainPanel.add(new HTML("Saisissez le nom d'une nouvelle recherche, ou<br/>sélectionnez une recherche existante pour la modifier.",true));
+ requestName = new TextBox();
+ requestName.addChangeHandler(new ChangeHandler() {
+ @Override
+ public void onChange(ChangeEvent event) {
+ setRequestId(null);
+ }
+ });
+ requestName.setMaxLength(250);
+ requestName.setWidth("300px");
+ mainPanel.add(requestName);
+ ScrollPanel scrollPanel = new ScrollPanel();
+ scrollPanel.setSize("350px", "300px");
+ scrollPanel.addStyleName("bordered");
+ this.itemContainer = new VerticalPanel();
+ scrollPanel.add(itemContainer);
+ mainPanel.add(scrollPanel);
+ // Les boutons Annuler et Valider :
+ mainPanel.add(createButtonsPanel());
+ // Le widget Principal :
+ setWidget(mainPanel);
+ show(); center();
+ }
+ private void setRequestName(String name) {
+ requestName.setText(name);
+ }
+ private void setRequestId(String id) { requestId = id; }
+
+
+ private Widget createButtonsPanel() {
+ HorizontalPanel horizontalPanel = new HorizontalPanel();
+ Button okButton = new Button();
+ okButton.setText("Ok");
+ okButton.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ ok();
+ }
+ });
+ horizontalPanel.add(okButton);
+ Button cancelButton = new Button();
+ cancelButton.setText("Annuler");
+ cancelButton.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ cancel();
+ }
+ });
+ horizontalPanel.add(cancelButton);
+ return horizontalPanel;
+ }
+
+ private void cancel() {
+ hide();
+ }
+ private void ok() {
+ hide();
+ parent.executeSaveRequest(parameters,requestName.getText(),requestId);
+ }
+
+ public void setItems(List<? extends Displayable> items) {
+ this.itemContainer.clear();
+ for (final Displayable item : items) {
+ ImageHLink hyperlink = new ImageHLink(item);
+ hyperlink.addClickHandler(new ClickHandler() {
+
+ public void onClick(ClickEvent evt) {
+ setRequestName(item.getLibelle());
+ setRequestId(item.getId());
+ }
+ });
+ itemContainer.add(hyperlink);
+ }
+ }
+
+ static private class ImageHLink extends HorizontalPanel {
+ private Image image;
+ private Hyperlink hlink;
+ private final ArrayList<ClickHandler> cls = new ArrayList<ClickHandler>();
+ public ImageHLink(Displayable dd) {
+ if(dd.getResource()!=null) {
+ image = new Image(ResourceConverter.getImageResource(dd.getResource()));
+ } else {
+ image = new Image(SearchResources.INSTANCE.getEmptyImage());
+ }
+ add(image);
+ hlink = new Hyperlink() {
+ @Override
+ public void onBrowserEvent(Event event) {
+ super.onBrowserEvent(event);
+ for(ClickHandler cl:cls) cl.onClick(null);
+ }
+ };
+ hlink.setText(dd.getLibelle());
+ add(hlink);
+ }
+ public void addClickHandler(ClickHandler cl) {
+ cls.add(cl);
+ image.addClickHandler(cl);
+ }
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2011 axYus - http://www.axyus.com
+ * 2011 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS ; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search;
+
+import java.io.Serializable;
+
+/**
+ * Un contexte de recherche. On y stocke plein de chose
+ * @author cmarchand
+ */
+public class SearchContext implements Serializable {
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2011 axYus - http://www.axyus.com
+ * 2011 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS ; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search;
+
+/**
+ * Interface permettant de fournir des informations sur un contexte de recherche,
+ * indépendamment du SearchContext
+ * @author cmarchand
+ */
+public interface SearchCtxInfoProvider {
+ public String getSearchSessionId();
+ public String getCollectiviteId();
+ public String getBudgetId();
+}
--- /dev/null
+/*
+ * Copyright
+ * 2010 axYus - www.axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.resources.client.ClientBundle;
+import com.google.gwt.resources.client.ImageResource;
+
+/**
+ *
+ * @author cmarchand
+ */
+public interface SearchResources extends ClientBundle {
+ public static final SearchResources INSTANCE = GWT.create(SearchResources.class);
+
+ @Source("resources/tb-search.png")
+ public ImageResource getSearchIcon();
+ @Source("resources/tb-search-disabled.png")
+ public ImageResource getSearchDisabledIcon();
+
+ @Source("resources/tb-add-criteria.png")
+ public ImageResource getAddCriteriaIcon();
+ @Source("resources/tb-add-criteria-disabled.png")
+ public ImageResource getAddCriteriaDisabledIcon();
+
+ @Source("resources/tb-clean-criterias.png")
+ public ImageResource getCleanCriteriasIcon();
+ @Source("resources/tb-clean-criterias-disabled.png")
+ public ImageResource getCleanCriteriasDisabledIcon();
+
+ @Source("resources/tb-open-search.png")
+ public ImageResource getOpenSearchIcon();
+ @Source("resources/tb-open-search-disabled.png")
+ public ImageResource getOpenSearchDisabledIcon();
+
+ @Source("resources/tb-save-search.png")
+ public ImageResource getSaveSearchIcon();
+ @Source("resources/tb-save-search-disabled.png")
+ public ImageResource getSaveSearchDisabledIcon();
+
+ @Source("resources/tb-repository.png")
+ public ImageResource getRepositoryIcon();
+ @Source("resources/tb-repository-disabled.png")
+ public ImageResource getRepositoryDisabledIcon();
+
+ @Source("resources/tb-params.png")
+ public ImageResource getParamsIcon();
+ @Source("resources/tb-params-disabled.png")
+ public ImageResource getParamsDisabledIcon();
+
+ @Source("resources/remove-criteria.png")
+ public ImageResource getRemoveCriteriaIcon();
+
+ @Source("resources/toolbar-left-strong.png")
+ public ImageResource getToolbarLeftStrong();
+ @Source("resources/toolbar-vsep.png")
+ public ImageResource getToolbarVSep();
+ @Source("resources/toolbar-right.png")
+ public ImageResource getToolbarRight();
+ @Source("resources/toolbar-left.png")
+ public ImageResource getToolbarLeft();
+
+ @Source("resources/empty.png")
+ public ImageResource getEmptyImage();
+
+ @Source("resources/list-export-plug.png")
+ public ImageResource getListExportPlugin();
+ @Source("resources/list-search-plug.png")
+ public ImageResource getListSearchPlugin();
+ @Source("resources/list-search-saved.png")
+ public ImageResource getListSearchSaved();
+
+ // le truc qui tourne...
+ @Source("resources/searching.gif")
+ public ImageResource getSearchingImage();
+
+ // boutons pour la fenêtre de paramétrage des champs de recherche
+ @Source("resources/bt-add-all.png")
+ public ImageResource getBtAddAll();
+ @Source("resources/bt-add-selected.png")
+ public ImageResource getBtAddSelected();
+ @Source("resources/bt-add-selected-deactivated.png")
+ public ImageResource getBtAddSelectedDeactivated();
+ @Source("resources/bt-del-all.png")
+ public ImageResource getBtDelAll();
+ @Source("resources/bt-del-selected.png")
+ public ImageResource getBtDelSelected();
+ @Source("resources/bt-del-selected-deactivated.png")
+ public ImageResource getBtDelSelectedDeactivated();
+ @Source("resources/bt-down.png")
+ public ImageResource getBtDown();
+ @Source("resources/bt-down-deactivated.png")
+ public ImageResource getBtDownDeactivated();
+ @Source("resources/bt-up.png")
+ public ImageResource getBtUp();
+ @Source("resources/bt-up-deactivated.png")
+ public ImageResource getBtUpDeactivated();
+
+ // les boutons pour la pagination
+ @Source("resources/first-page.png")
+ public ImageResource getFirstPage();
+ @Source("resources/last-page.png")
+ public ImageResource getLastPage();
+ @Source("resources/next-page.png")
+ public ImageResource getNextPage();
+ @Source("resources/previous-page.png")
+ public ImageResource getPreviousPage();
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search;
+
+import com.google.gwt.cell.client.DateCell;
+import com.google.gwt.cell.client.TextCell;
+import com.google.gwt.cell.client.ValueUpdater;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.NativeEvent;
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.event.dom.client.ChangeHandler;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.logical.shared.CloseEvent;
+import com.google.gwt.event.logical.shared.CloseHandler;
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.google.gwt.i18n.client.NumberFormat;
+import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
+import com.google.gwt.user.cellview.client.CellTable;
+import com.google.gwt.user.cellview.client.Column;
+import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
+import com.google.gwt.user.cellview.client.HasKeyboardSelectionPolicy.KeyboardSelectionPolicy;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.DockLayoutPanel;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.HasHorizontalAlignment;
+import com.google.gwt.user.client.ui.HasVerticalAlignment;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.PopupPanel.PositionCallback;
+import com.google.gwt.user.client.ui.ScrollPanel;
+import com.google.gwt.user.client.ui.SplitLayoutPanel;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.view.client.ListDataProvider;
+import com.google.gwt.view.client.SelectionChangeEvent;
+import com.google.gwt.view.client.SingleSelectionModel;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.service.ServiceLocator;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.utils.DoneListener;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.utils.GWTUtils;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.common.DlgChooseOnePair;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.common.WorkingPanel;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.root.Tabs;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.CritereTypeDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.InitParametersDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.ListResultatDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.RowResultDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchInitParametersDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchParameterDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchResultDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.StoredSearchDTO;
+import java.math.BigDecimal;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Widget principal (permettant la recherche)
+ * @author CBO
+ * @author chm
+ */
+public class SearchWidget extends Composite implements SearchCtxInfoProvider, RequestSaver {
+
+ static private SearchWidget searchWidgetInstance = null;
+ private InitParametersDTO initParameters;
+ private SearchInitParametersDTO searchInitParameters;
+ private DockLayoutPanel mainPanel;
+ private ColAndBudChooserWidget colAndBudChooserWidget;
+ private ButtonsBarWidget buttonsBarWidget;
+ private SplitLayoutPanel verticalSplitPanel;
+ private CriteriaTable criteriaTable;
+ private DockLayoutPanel resultTableContainer;
+ private StatusBar statusBar;
+ private boolean exportPossible = false;
+ private Image searchingImage;
+ private WorkingPanel working;
+ private CellTable<RowResultDTO> table;
+ private ListDataProvider<RowResultDTO> listDataProvider;
+ private SingleSelectionModel<RowResultDTO> __selectionModel;
+
+ public SearchWidget() {
+ this.mainPanel = new DockLayoutPanel(Unit.PX);
+ this.mainPanel.setSize("100%", "100%");
+ this.mainPanel.getElement().setId("mainPanel");
+ this.buttonsBarWidget = new ButtonsBarWidget();
+ this.colAndBudChooserWidget = new ColAndBudChooserWidget(null);
+// colAndBudChooserWidget.addChangeHandler(new ChangeHandler() {
+// @Override
+// public void onChange(ChangeEvent event) {
+// resetCriteres();
+// }
+// });
+ HorizontalPanel hp = new HorizontalPanel();
+ hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
+ hp.add(colAndBudChooserWidget);
+ hp.add(buttonsBarWidget);
+ this.mainPanel.addNorth(hp, 54.0);
+ hp.getElement().setId("Topnav".concat(getIdMarker()));
+ this.statusBar = new StatusBar();
+ statusBar.getPaginationWidget().addChangePageRequestListener(new PaginationWidget.ChangePageRequestListener() {
+ @Override
+ public void onChangePageRequest(PaginationWidget sender, int requestedPageNumber) {
+ loadPage(requestedPageNumber);
+ }
+ });
+ this.mainPanel.addSouth(this.statusBar, 44.0);
+ this.verticalSplitPanel = new SplitLayoutPanel();
+ this.criteriaTable = new CriteriaTable(this);
+ this.verticalSplitPanel.addNorth(criteriaTable, 87.0);
+ this.resultTableContainer = new DockLayoutPanel(Unit.PCT);
+ this.resultTableContainer.getElement().setId("resultTableContainer".concat(getIdMarker())); // resultTableContainer
+ this.resultTableContainer.getElement().getStyle().setMarginLeft(1, Unit.PX);
+ this.resultTableContainer.getElement().getStyle().setMarginRight(17, Unit.PX);
+ working = new WorkingPanel();
+ this.verticalSplitPanel.add(resultTableContainer);
+ this.verticalSplitPanel.setSize("100%", "100%");
+ this.verticalSplitPanel.getElement().setId("splitter".concat(getIdMarker()));
+ this.mainPanel.add(this.verticalSplitPanel);
+
+// working.getElement().getStyle().setVisibility(Visibility.HIDDEN);
+ initWidget(this.mainPanel);
+ criteriaTable.getElement().getParentElement().setId("parentSubnav".concat(getIdMarker()));
+ getElement().setId("SearchWidget".concat(getIdMarker()));
+
+ searchingImage = new Image(SearchResources.INSTANCE.getSearchingImage());
+ }
+
+ /**
+ * Méthode permettant de charger les données d'initialisation de la recherche
+ * @param documentId
+ * @param etatId
+ * @param elementId
+ * @param doneListener
+ */
+ public void init(String documentId, String etatId, String elementId, final DoneListener doneListener) {
+ ServiceLocator.getXemeliosService().initSearchWindow(documentId, etatId, elementId, new AsyncCallback<InitParametersDTO>() {
+
+ public void onFailure(Throwable throwable) {
+ GWTUtils.handleRPCError(throwable);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void onSuccess(InitParametersDTO result) {
+ SearchWidget.this.initParameters = result;
+ colAndBudChooserWidget.setSearchSessionId(result.getSearchSessionId());
+ if (result.hasTooMuchCollectivites()) {
+ colAndBudChooserWidget.init(result.getDocumentId());
+ } else {
+ colAndBudChooserWidget.init(result.getCollectivites(), result.getFirstCollectiviteBudgets());
+ }
+ colAndBudChooserWidget.addChangeHandler(new ChangeHandler() {
+ @Override
+ public void onChange(ChangeEvent evt) {
+ collectiviteOrBudgetChange();
+ }
+ });
+ buttonsBarWidget.addClickListener(ButtonsBarWidget.ClickListenerType.ADD_CRITERE, new AddCriteriaClickListener(SearchWidget.this));
+ buttonsBarWidget.addClickListener(ButtonsBarWidget.ClickListenerType.SEARCH, new ClickHandler() {
+
+ public void onClick(ClickEvent evt) {
+ search();
+ }
+ });
+ buttonsBarWidget.addClickListener(ButtonsBarWidget.ClickListenerType.RESET_CRITERES, new ClickHandler() {
+
+ public void onClick(ClickEvent evt) {
+ resetCriteres();
+ }
+ });
+ buttonsBarWidget.addClickListener(ButtonsBarWidget.ClickListenerType.OPEN_SEARCH, new ClickHandler() {
+
+ public void onClick(ClickEvent evt) {
+ openSearch();
+ }
+ });
+ buttonsBarWidget.addClickListener(ButtonsBarWidget.ClickListenerType.SAVE_REQUEST, new ClickHandler() {
+
+ public void onClick(ClickEvent evt) {
+ saveSearch();
+ }
+ });
+ buttonsBarWidget.addClickListener(ButtonsBarWidget.ClickListenerType.SEARCH_PARAMS, new ClickHandler() {
+
+ public void onClick(ClickEvent evt) {
+ searchParams();
+ }
+ });
+ if (SearchWidget.this.initParameters.hasRepository()) {
+ buttonsBarWidget.addClickListener(ButtonsBarWidget.ClickListenerType.REPOSITORY, new ClickHandler() {
+
+ public void onClick(ClickEvent evt) {
+ showRepository();
+ }
+ });
+ } else {
+ buttonsBarWidget.disableRepositoryButton();
+ }
+// statusBar.getPaginationWidget().addChangePageRequestListener(new ChangePageRequestListener() {
+// public void onChangePageRequest(PaginationWidget sender, int requestedPageNumber) {
+// loadPage(requestedPageNumber);
+// }
+// });
+ SearchWidget.searchWidgetInstance = SearchWidget.this;
+// defineJSMethod();
+ Window.addCloseHandler(new CloseHandler<Window>() {
+
+ public void onClose(CloseEvent<Window> ce) {
+ releaseSearchSession();
+ }
+ });
+ setSearchInitParameters(initParameters.getSearchInitParameters());
+ doneListener.done(result);
+ }
+ });
+ }
+
+ public void addCritere() {
+ this.criteriaTable.addEmptyCriterion();
+ }
+
+ public void resetCriteres() {
+ setSearchInitParameters(this.initParameters.getSearchInitParameters());
+ }
+
+ public void search() {
+ if (criteriaTable.checkValidity()) {
+ startSearch();
+ if (getSearchInitParameters().getPluginId() == null) {
+ ServiceLocator.getXemeliosService().search(getSearchSessionId(), getCollectiviteId(), getBudgetId(), criteriaTable.getSearchParameters(), getSearchInitParameters().getPluginId(), new AsyncCallback<SearchResultDTO>() {
+ @Override
+ public void onFailure(Throwable throwable) {
+ GWTUtils.handleRPCError(throwable);
+ endLongWait();
+ }
+ @Override
+ public void onSuccess(SearchResultDTO result) {
+ handleSearchResult(result, true);
+ }
+ });
+ } else {
+ if (getSearchInitParameters().getPluginType() == StoredSearchDTO.TYPE_SEARCH) {
+ ServiceLocator.getXemeliosService().search(getSearchSessionId(), getCollectiviteId(), getBudgetId(), criteriaTable.getSearchParameters(), getSearchInitParameters().getPluginId(), new AsyncCallback<SearchResultDTO>() {
+ @Override
+ public void onFailure(Throwable throwable) {
+ GWTUtils.handleRPCError(throwable);
+ endLongWait();
+ }
+ @Override
+ public void onSuccess(SearchResultDTO result) {
+ handleSearchResult(result, true);
+ }
+ });
+ } else {
+ ServiceLocator.getXemeliosService().processPluginExport(getSearchSessionId(), getCollectiviteId(), getBudgetId(), getSearchInitParameters().getPluginId(), criteriaTable.getSearchParameters(), new AsyncCallback<String>() {
+ @Override
+ public void onFailure(Throwable throwable) {
+ GWTUtils.handleRPCError(throwable);
+ endLongWait();
+ }
+ @Override
+ public void onSuccess(String result) {
+ endLongWait();
+ downloadUrl(GWTUtils.getContextPath() + result);
+ }
+ });
+ }
+ }
+ }
+ }
+
+ /**
+ * Renvoie un marker propre à l'implémentation. Cela sert à éviter
+ * d'avoir plusieurs éléments avec le même id
+ * @return
+ */
+ public String getIdMarker() {
+ return "";
+ }
+
+ public void saveSearch() {
+ final SaveRequestDialog dlg = new SaveRequestDialog(this, criteriaTable.getSearchParameters());
+ ServiceLocator.getXemeliosService().getSavedPrivateSearchs(getSearchSessionId(), new AsyncCallback<List<StoredSearchDTO>>() {
+
+ public void onFailure(Throwable throwable) {
+ GWTUtils.handleRPCError(throwable);
+ }
+
+ public void onSuccess(List<StoredSearchDTO> result) {
+ dlg.setItems(result);
+ }
+ });
+ }
+
+ public void searchParams() {
+ ServiceLocator.getXemeliosService().getListResultatDTO(getSearchSessionId(), new AsyncCallback<ListResultatDTO>() {
+ public void onFailure(Throwable caught) {
+ Window.alert(caught.getMessage());
+ GWTUtils.handleRPCError(caught);
+ }
+ public void onSuccess(ListResultatDTO result) {
+ DlgSearchParams dsp = new DlgSearchParams(SearchWidget.this, result);
+ dsp.show();
+ }
+ });
+ }
+
+ public void showRepository() {
+ showRepository(initParameters.getDocumentId(), getCollectiviteId());
+ }
+ private Tabs getTabs() {
+ Widget parent = getParent();
+ while(parent.getElement().getId()==null || parent.getElement().getId().length()==0) {
+ if(parent==null || "Tabs".equals(parent.getElement().getId()))
+ break;
+ parent = parent.getParent();
+ }
+ if(parent!=null) {
+ return (Tabs)parent;
+ }
+ return null;
+ }
+ private void showRepository(String documentId, String collectiviteId) {
+ StringBuilder shb = new StringBuilder();
+ shb.append("<iframe width=\"100%\" height=\"100%\" id=\"rep.");
+ shb.append(documentId);
+ shb.append(".");
+ shb.append(collectiviteId);
+ shb.append("\" src=\"");
+ shb.append(GWTUtils.getContextPath());
+ shb.append("showRepository.do?docId=");
+ shb.append(documentId);
+ shb.append("&collectivite=");
+ shb.append(collectiviteId);
+ shb.append("\" onload=\"javascript:setLastCreatedTabTitle(this.contentWindow.document.title);\"/>");
+// Window.alert(shb.toString());
+ HTML html = new HTML(shb.toString());
+ getTabs().getTabPanel().add(html, "Nomenclature");
+ }
+
+ @Override
+ public void executeSaveRequest(List<SearchParameterDTO> parameters, String requestName, String requestId) {
+ if (requestId == null || requestId.length() == 0) {
+ ServiceLocator.getXemeliosService().saveRequest(getSearchSessionId(), parameters, requestName, new AsyncCallback<String>() {
+
+ public void onFailure(Throwable caught) {
+ Window.alert(caught.getMessage());
+ }
+
+ public void onSuccess(String result) {
+ if (!"OK".equals(result)) {
+ Window.alert("Erreur lors de l'enregistrement de la requete.");
+ }
+ }
+ });
+ } else {
+ ServiceLocator.getXemeliosService().saveRequest(getSearchSessionId(), parameters, requestName, requestId, new AsyncCallback<String>() {
+
+ public void onFailure(Throwable caught) {
+ Window.alert(caught.getMessage());
+ }
+
+ public void onSuccess(String result) {
+ if (!"OK".equals(result)) {
+ Window.alert("Erreur lors de l'enregistrement de la requete.");
+ }
+ }
+ });
+ }
+ }
+
+ public void openSearch() {
+ final DlgChooseStoredSearch dlg = new DlgChooseStoredSearch("Ouverture d'une recherche");
+ dlg.show();
+ dlg.center();
+ ServiceLocator.getXemeliosService().getStoredSearchs(getSearchSessionId(), new AsyncCallback<List<StoredSearchDTO>>() {
+
+ public void onFailure(Throwable throwable) {
+ GWTUtils.handleRPCError(throwable);
+ }
+
+ public void onSuccess(List<StoredSearchDTO> result) {
+ dlg.setSearchItems(result);
+ dlg.addSelectListener(new DlgChooseOnePair.SelectListener() {
+
+ public void onSelect(Object selectedItem) {
+ loadSearch((StoredSearchDTO) selectedItem);
+ }
+ });
+ }
+ });
+ }
+
+ private void loadSearch(StoredSearchDTO storedSearch) {
+ switch (storedSearch.getType()) {
+ case StoredSearchDTO.TYPE_EXPORT:
+ case StoredSearchDTO.TYPE_SEARCH: {
+ ServiceLocator.getXemeliosService().getSearchInitParameters(getSearchSessionId(), storedSearch != null ? storedSearch.getId() : null, new AsyncCallback<SearchInitParametersDTO>() {
+
+ public void onFailure(Throwable throwable) {
+ GWTUtils.handleRPCError(throwable);
+ }
+
+ public void onSuccess(SearchInitParametersDTO result) {
+ setSearchInitParameters(result);
+ }
+ });
+ break;
+ }
+ case StoredSearchDTO.TYPE_SAVED: {
+ ServiceLocator.getXemeliosService().getSearchInitParametersForSavedSearch(getSearchSessionId(), storedSearch.getId(), new AsyncCallback<SearchInitParametersDTO>() {
+
+ public void onFailure(Throwable throwable) {
+ GWTUtils.handleRPCError(throwable);
+ }
+
+ public void onSuccess(SearchInitParametersDTO result) {
+ displaySavedRequest(result);
+ }
+ });
+ }
+ }
+ }
+
+ protected void displaySavedRequest(SearchInitParametersDTO params) {
+ criteriaTable.removeAllCriteres();
+ int i=0;
+ for(CritereTypeDTO critere: params.getMandatoryCritereTypes()) {
+ PostRunnable pr = new PostRunnable(Integer.toString(i)) {
+ boolean alreadyRun = false;
+ @Override
+ public void run() {
+ if(!alreadyRun) {
+ criteriaTable.getSelectCritereWidget(getIntValue()).setSelectedCritere((CritereTypeDTO)getAdditionalObject("critere"));
+ criteriaTable.initCriteria(getIntValue(), (PostRunnable)this);
+ alreadyRun = true;
+ }
+ }
+ };
+ pr.setAdditionalObject("critere", critere);
+ pr.setAdditionalInt(i);
+ int row = criteriaTable.addEmptyCriterion(pr);
+ i++;
+ }
+ }
+
+ public void loadPage(int pageNumber) {
+ startSearch();
+ ServiceLocator.getXemeliosService().loadPage(getSearchSessionId(), pageNumber, new AsyncCallback<SearchResultDTO>() {
+ public void onFailure(Throwable throwable) {
+ GWTUtils.handleRPCError(throwable);
+ }
+ public void onSuccess(SearchResultDTO result) {
+ handleSearchResult(result, false);
+ }
+ });
+ }
+
+ private void releaseSearchSession() {
+// ServiceLocator.getXemeliosService().destroySearchSession(getSearchSessionId(), new AsyncCallback() {
+// public void onFailure(Throwable throwable) {
+// GWTUtils.handleRPCError(throwable);
+// }
+// /**
+// * @TODO : remove search parameters stored in http session
+// */
+// public void onSuccess(Object nullResult) {
+//
+// }
+// });
+ }
+
+ private void startSearch() {
+ startLongWait();
+ }
+ private void startLongWait() {
+ working.setPopupPositionAndShow(new PositionCallback() {
+
+ public void setPosition(int offsetWidth, int offsetHeight) {
+ int left = resultTableContainer.getAbsoluteLeft();
+ int top = resultTableContainer.getAbsoluteTop();
+
+ int startLeft = left + (resultTableContainer.getOffsetWidth()-searchingImage.getOffsetWidth())/2;
+ int startTop = top + (resultTableContainer.getOffsetHeight()-searchingImage.getOffsetHeight())/2;
+ working.setPopupPosition(startLeft, startTop);
+ }
+ });
+ }
+ private void endLongWait() {
+ working.hide();
+ }
+
+ /**
+ * Affiche le résultat de recherche
+ * @param result
+ * @param firstSearch true si c'est une première recherche, et pas un changement de page
+ */
+ private void handleSearchResult(SearchResultDTO result, boolean firstSearch) {
+ if(firstSearch) {
+ while (resultTableContainer.getWidgetCount() > 0) {
+ resultTableContainer.remove(0);
+ }
+ listDataProvider = new ListDataProvider<RowResultDTO>(result.getData());
+ ListHandler<RowResultDTO> listHandler = new ListHandler<RowResultDTO>(listDataProvider.getList());
+ table = new CellTable<RowResultDTO>();
+ table.setPageSize(result.getPaginationInfo().getPageSize());
+ table.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
+ String amountFormat = "#,##0.00;-#,##0.00";
+ char __noBreakSpace = '\u0020';
+ final String noBreakSpace = Character.toString(__noBreakSpace);
+ final NumberFormat amountFormatter = NumberFormat.getFormat(amountFormat);
+ for (SearchResultDTO.ColumnDefinition columnDef : result.getColumns()) {
+ if (columnDef.isDisplay()) {
+ final String id = columnDef.getId();
+ final String sLibelle = columnDef.getLibelle();
+ final String format = columnDef.getFormat();
+ SafeHtmlBuilder libelleBuilder = new SafeHtmlBuilder();
+ libelleBuilder.appendEscaped(sLibelle);
+ if ("string".equals(columnDef.getDatatype())) {
+ Column<RowResultDTO,String> column = new Column<RowResultDTO,String>( new TextCell() {
+ private HashSet<String> events;
+ @Override
+ public Set<String> getConsumedEvents() {
+ if(events==null) {
+ events = new HashSet<String>();
+ Set<String> parentsEvents = super.getConsumedEvents();
+ if(parentsEvents!=null)
+ events.addAll(parentsEvents);
+ events.add("dblclick");
+ }
+ return events;
+ }
+ @Override
+ public void onBrowserEvent(Context context, Element parent, String value, NativeEvent event, ValueUpdater<String> valueUpdater) {
+ super.onBrowserEvent(context, parent, value, event, valueUpdater);
+ if("dblclick".equals(event.getType())) {
+ __onRowDoubleClick();
+ }
+ }
+ }) {
+ @Override
+ public String getValue(RowResultDTO object) {
+ String s = object.getStringValue(id);
+ return s;
+ }
+ };
+ column.setSortable(true);
+ table.addColumn(column, libelleBuilder.toSafeHtml());
+ listHandler.setComparator(column, new Comparator<RowResultDTO>() {
+ public int compare(RowResultDTO o1, RowResultDTO o2) {
+ if(o1==o2) return 0;
+ if(o1!=o2) {
+ return (o2!=null) ? o1.getStringValue(id).compareTo(o2.getStringValue(id)) : 1;
+ }
+ return -1;
+ }
+ });
+ } else if ("integer".equals(columnDef.getDatatype())) {
+ Column<RowResultDTO,String> column = new Column<RowResultDTO,String>(new TextCell() {
+ private HashSet<String> events;
+ @Override
+ public Set<String> getConsumedEvents() {
+ if(events==null) {
+ events = new HashSet<String>();
+ Set<String> parentsEvents = super.getConsumedEvents();
+ if(parentsEvents!=null)
+ events.addAll(parentsEvents);
+ events.add("dblclick");
+ }
+ return events;
+ }
+ @Override
+ public void onBrowserEvent(Context context, Element parent, String value, NativeEvent event, ValueUpdater<String> valueUpdater) {
+ super.onBrowserEvent(context, parent, value, event, valueUpdater);
+ if("dblclick".equals(event.getType())) {
+ __onRowDoubleClick();
+ }
+ }
+ }) {
+ @Override
+ public String getValue(RowResultDTO object) {
+ Long value = object.getLongValue(id);
+ if (value != null) {
+ return value.toString();
+ } else {
+ return null;
+ }
+ }
+ };
+ column.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
+ column.setSortable(true);
+ table.addColumn(column, libelleBuilder.toSafeHtml());
+ listHandler.setComparator(column, new Comparator<RowResultDTO>() {
+ public int compare(RowResultDTO o1, RowResultDTO o2) {
+ if(o1==o2) return 0;
+ if(o1!=o2) {
+ return (o2!=null) ? o1.getLongValue(id).compareTo(o2.getLongValue(id)) : 1;
+ }
+ return -1;
+ }
+ });
+ } else if ("amount".equals(columnDef.getDatatype())) {
+ Column<RowResultDTO,String> column = new Column<RowResultDTO,String>(new TextCell() {
+ private HashSet<String> events;
+ @Override
+ public Set<String> getConsumedEvents() {
+ if(events==null) {
+ events = new HashSet<String>();
+ Set<String> parentsEvents = super.getConsumedEvents();
+ if(parentsEvents!=null)
+ events.addAll(parentsEvents);
+ events.add("dblclick");
+ }
+ return events;
+ }
+ @Override
+ public void onBrowserEvent(Context context, Element parent, String value, NativeEvent event, ValueUpdater<String> valueUpdater) {
+ super.onBrowserEvent(context, parent, value, event, valueUpdater);
+ if("dblclick".equals(event.getType())) {
+ __onRowDoubleClick();
+ }
+ }
+ }) {
+ @Override
+ public String getValue(RowResultDTO object) {
+ BigDecimal value = object.getBigDecimalValue(id);
+ if (value != null) {
+ return amountFormatter.format(value).replace(",", noBreakSpace).replace(".", ",");
+ } else {
+ return null;
+ }
+ }
+ };
+ column.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
+ column.setSortable(true);
+ table.addColumn(column, libelleBuilder.toSafeHtml());
+ listHandler.setComparator(column, new Comparator<RowResultDTO>() {
+ public int compare(RowResultDTO o1, RowResultDTO o2) {
+ if(o1==o2) return 0;
+ if(o1!=o2) {
+ return (o2!=null) ? o1.getBigDecimalValue(id).compareTo(o2.getBigDecimalValue(id)) : 1;
+ }
+ return -1;
+ }
+ });
+ } else if ("date".equals(columnDef.getDatatype())) {
+ final DateTimeFormat dtf = DateTimeFormat.getFormat(format);
+ DateCell dateCell = new DateCell(dtf) {
+ private HashSet<String> events;
+ @Override
+ public Set<String> getConsumedEvents() {
+ if(events==null) {
+ events = new HashSet<String>();
+ Set<String> parentsEvents = super.getConsumedEvents();
+ if(parentsEvents!=null)
+ events.addAll(parentsEvents);
+ events.add("dblclick");
+ }
+ return events;
+ }
+ @Override
+ public void onBrowserEvent(Context context, Element parent, Date value, NativeEvent event, ValueUpdater<Date> valueUpdater) {
+ super.onBrowserEvent(context, parent, value, event, valueUpdater);
+ if("dblclick".equals(event.getType())) {
+ __onRowDoubleClick();
+ }
+ }
+ };
+ Column<RowResultDTO, Date> column = new Column<RowResultDTO, Date>(dateCell) {
+ @Override
+ public Date getValue(RowResultDTO object) {
+ Date date = object.getDateValue(id);
+ return date;
+ }
+ };
+ column.setSortable(true);
+ table.addColumn(column, libelleBuilder.toSafeHtml());
+ listHandler.setComparator(column, new Comparator<RowResultDTO>() {
+ public int compare(RowResultDTO o1, RowResultDTO o2) {
+ if(o1==o2) return 0;
+ if(o1!=o2) {
+ return (o2!=null) ? o1.getDateValue(id).compareTo(o2.getDateValue(id)) : 1;
+ }
+ return -1;
+ }
+ });
+ }
+ }
+ }
+ table.addColumnSortHandler(listHandler);
+ resultTableContainer.add(new ScrollPanel(table));
+ listDataProvider.addDataDisplay(table);
+
+ // Add a selection model to handle user selection.
+ final SingleSelectionModel<RowResultDTO> selectionModel = new SingleSelectionModel<RowResultDTO>();
+ table.setSelectionModel(selectionModel);
+
+
+ selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
+ public void onSelectionChange(SelectionChangeEvent event) {
+ RowResultDTO selected = selectionModel.getSelectedObject();
+ }
+ });
+ __selectionModel = selectionModel;
+ } else {
+ listDataProvider.getList().clear();
+ listDataProvider.getList().addAll(result.getData());
+ }
+ statusBar.getPaginationWidget().setPaginationInfo(result.getPaginationInfo());
+ if (result.getCountAll() <= 0) {
+ statusBar.setText(new HTML(" Aucun "+getSearchInitParameters().getImportableElementLibelle()+" trouvé").getText());
+ exportPossible = false;
+ } else if (result.getCountAll() == 1) {
+ statusBar.setText(new HTML(" 1 "+getSearchInitParameters().getImportableElementLibelle()+" trouvé").getText());
+ exportPossible = true;
+ } else {
+ statusBar.setText(new HTML(" " + result.getCountAll() + " "+getSearchInitParameters().getImportableElementLibelle()+"s trouvés").getText());
+ exportPossible = true;
+ }
+ endLongWait();
+ }
+
+ private final void __onRowDoubleClick() {
+ if(__selectionModel.getSelectedObject()!=null) {
+ onDoubleClickOnRowResult(__selectionModel.getSelectedObject());
+ }
+ }
+ public void onDoubleClickOnRowResult(RowResultDTO row) {
+ StringBuilder shb = new StringBuilder();
+ shb.append("<iframe width=\"100%\" height=\"100%\" id=\"rep.");
+ shb.append(row.getDocId());
+ shb.append(".");
+ shb.append(getCollectiviteId());
+ shb.append("\" src=\"");
+ shb.append(GWTUtils.getContextPath());
+ shb.append("displayDocument.do?documentId=").append(initParameters.getDocumentId());
+ shb.append("&etatId=").append(initParameters.getEtatId());
+ shb.append("&elementId=").append(initParameters.getElementId());
+ shb.append("&docId=").append(row.getDocId());
+ shb.append("&coll-code=").append(getCollectiviteId());
+ shb.append("&budg-code=").append(getBudgetId());
+ shb.append("&coll-lib=").append(colAndBudChooserWidget.getCollectiviteLib());
+ shb.append("&budg-lib=").append(colAndBudChooserWidget.getBudgetLibelle());
+ // xsl:param
+ for(Iterator<String> it = row.getKeys().iterator(); it.hasNext();) {
+ String key = it.next();
+ Object value=row.getValue(key);
+ if(value==null) continue;
+ if(key.startsWith("xsl-param:")) {
+ String paramName=key.substring(10);
+ shb.append("&xsl:param=(").append(paramName).append(",").append(value.toString()).append(")");
+ }
+ }
+ shb.append("\" onload=\"javascript:setLastCreatedTabTitle(this.contentWindow.document.title);\"/>");
+ HTML html = new HTML(shb.toString());
+ getTabs().getTabPanel().add(html, "Visualisation");
+ }
+
+ private void collectiviteOrBudgetChange() {
+ resetCriteres();
+ }
+
+ public String getSearchSessionId() {
+ return this.initParameters != null ? initParameters.getSearchSessionId() : null;
+ }
+
+ public String getCollectiviteId() {
+ return this.colAndBudChooserWidget.getCollectiviteId();
+ }
+
+ public String getBudgetId() {
+ return this.colAndBudChooserWidget.getBudgetId();
+ }
+
+ private SearchInitParametersDTO getSearchInitParameters() {
+ return this.searchInitParameters;
+ }
+
+ private void setSearchInitParameters(SearchInitParametersDTO searchInitParameters) {
+ if (colAndBudChooserWidget.getCollectiviteId() != null) {
+ buttonsBarWidget.enableSearchPossibilities(true);
+ this.searchInitParameters = searchInitParameters;
+ criteriaTable.init(getSearchInitParameters());
+ if (getSearchInitParameters().getPluginId() == null) {
+ addCritere();
+ }
+ buttonsBarWidget.setAddCritereEnable(!getSearchInitParameters().getOptionalCritereTypes().isEmpty());
+ } else {
+ buttonsBarWidget.enableSearchPossibilities(false);
+ }
+ }
+
+ private native String transformXml(String searchResultAsXml)/*-{
+ return $wnd.transformXml(searchResultAsXml);
+ }-*/;
+
+ private native void downloadUrl(String url)/*-{
+ $wnd.downloadUrl(url);
+ }-*/;
+
+
+ public static void showPjInfos(String collectivite, String strPj, String strNom, String strSupport) {
+// String[] pjIds = splitString(strPj);
+// String[] pjNoms = splitString(strNom);
+// String[] pjSupports = splitString(strSupport);
+// if(pjIds.length!=pjNoms.length && pjIds.length!=pjSupports.length) {
+// Window.alert("pjIds, pjNoms et pjSupports n'ont pas la même taille !");
+// return;
+// } else if(pjIds.length==0) return;
+// else {
+// PjRefInfoDTO[] pjs = new PjRefInfoDTO[pjIds.length];
+// for(int i=0;i<pjIds.length;i++) {
+// pjs[i] = new PjRefInfoDTO(collectivite,pjIds[i],pjNoms[i],pjSupports[i]);
+// }
+// ShowAvailablesPJsDialogBox db = new ShowAvailablesPJsDialogBox(pjs);
+// db.show();
+// db.center();
+// }
+ }
+
+ private static String[] splitString(String s) {
+ int splitters = 0;
+ for (int i = 0; i < s.length(); i++) {
+ if (s.charAt(i) == '|') {
+ splitters++;
+ }
+ }
+ String[] ret = new String[splitters + 1];
+ int found = 0;
+ int pos = s.indexOf('|');
+ while (pos >= 0) {
+ ret[found] = s.substring(0, pos);
+ found++;
+ s = s.substring(pos + 1);
+ pos = s.indexOf('|');
+ }
+ ret[found] = s;
+ return ret;
+ }
+
+ static public boolean _isExportPossible() {
+ return SearchWidget.searchWidgetInstance != null ? SearchWidget.searchWidgetInstance.exportPossible : false;
+ }
+
+ static public String _getSearchSessionId() {
+ return SearchWidget.searchWidgetInstance != null ? SearchWidget.searchWidgetInstance.getSearchSessionId() : null;
+ //return SearchWidget.this.getSearchSessionId();
+ }
+
+ static public void _configExport() {
+// DlgSelectExport dlg = new DlgSelectExport();
+// dlg.show();
+ }
+
+ static public void _complexExport(String searchSessionId) {
+// if(_isExportPossible()) {
+// DlgSelectExport dlg = new DlgSelectExport(searchSessionId);
+// dlg.show();
+// }
+ }
+
+ static public void _openNavigation(String documentId) {
+// DlgSelectNavigationTarget nt = new DlgSelectNavigationTarget(documentId);
+ }
+
+ public static class AddCriteriaClickListener implements ClickHandler {
+
+ private SearchWidget sw;
+ private boolean enabled = true;
+
+ public AddCriteriaClickListener(SearchWidget sw) {
+ super();
+ this.sw = sw;
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ public void onClick(ClickEvent ce) {
+ if (enabled) {
+ sw.addCritere();
+ }
+ }
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search;
+
+import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.event.dom.client.ChangeHandler;
+import com.google.gwt.user.client.ui.ChangeListener;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.ListBox;
+import com.google.gwt.user.client.ui.Widget;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.CritereTypeDTO;
+import java.util.List;
+
+/**
+ * @author CBO
+ */
+public class SelectCritereWidget extends Composite {
+
+ private List<CritereTypeDTO> criteres;
+ private boolean readOnly;
+ private ListBox critereListBox;
+
+ public SelectCritereWidget(List<CritereTypeDTO> criteres, boolean readOnly) {
+ this.criteres = criteres;
+ this.readOnly = readOnly;
+ if (!readOnly) {
+ this.critereListBox = new ListBox();
+ for (CritereTypeDTO critere : criteres) {
+ this.critereListBox.addItem(critere.getLibelle(), critere.getId());
+ }
+ initWidget(this.critereListBox);
+ } else {
+ initWidget(new Label(criteres.get(0).getLibelle()));
+ }
+ }
+
+ public void addChangeHandler(final ChangeHandler changeHandler) {
+ if (!readOnly) {
+ this.critereListBox.addChangeHandler(new ChangeHandler() {
+ public void onChange(ChangeEvent evt) {
+ changeHandler.onChange(evt);
+ }
+ });
+ }
+ }
+
+ public CritereTypeDTO getSelectedCritere() {
+ if (!this.readOnly) {
+ if (this.critereListBox.getSelectedIndex() >= 0) {
+ return this.criteres.get(this.critereListBox.getSelectedIndex());
+ } else {
+ return null;
+ }
+ } else {
+ return !criteres.isEmpty() ? criteres.get(0) : null;
+ }
+ }
+
+ public void setSelectedCritere(CritereTypeDTO critere) {
+ if(!this.readOnly) {
+ int index = -1;
+ for(int i=0;i<criteres.size();i++) {
+ if(criteres.get(i).equals(critere)) {
+ index = i;
+ break;
+ }
+ }
+ this.critereListBox.setSelectedIndex(index);
+// this.critereListBox.
+// changeListener.onChange(SelectCritereWidget.this);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search;
+
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.HasHorizontalAlignment;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+
+/**
+ * @author CBO
+ */
+public class StatusBar extends Composite {
+
+ private HorizontalPanel mainPanel;
+ private HTML text;
+ private PaginationWidget paginationWidget;
+
+ public StatusBar() {
+ this.mainPanel = new HorizontalPanel();
+ this.text = new HTML(" ");
+ this.mainPanel.add(this.text);
+ this.paginationWidget = new PaginationWidget();
+ HorizontalPanel rightPanel = new HorizontalPanel();
+ rightPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
+ rightPanel.setWidth("98%");
+ rightPanel.add(paginationWidget);
+ this.mainPanel.add(rightPanel);
+ this.mainPanel.setWidth("98%");
+ text.getElement().setId("ResultInfo");
+ initWidget(this.mainPanel);
+ }
+
+ public void setText(String text) {
+ this.text.setText(text);
+ }
+
+ public PaginationWidget getPaginationWidget() {
+ return paginationWidget;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.criteria;
+
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HasVerticalAlignment;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Widget;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.CriteriaTable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author CBO
+ */
+public class CritereLineContainer extends Composite {
+
+ private CriteriaTable criteriaTable;
+ private String critereId;
+ private HorizontalPanel horizontalPanel;
+ private int __height;
+// private FlowPanel fp;
+
+ public CritereLineContainer(CriteriaTable criteriaTable, String critereId, int height) {
+ this.criteriaTable = criteriaTable;
+ this.critereId = critereId;
+ this.__height = height;
+ this.horizontalPanel = new HorizontalPanel();
+ horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
+// this.fp = new FlowPanel();
+// fp.setStylePrimaryName("nowrap");
+// fp.getElement().getStyle().setProperty("white-space", "nowrap");
+ initWidget(this.horizontalPanel);
+ }
+
+ public CriteriaTable getCriteriaTable() {
+ return criteriaTable;
+ }
+
+ public String getCritereId() {
+ return critereId;
+ }
+
+ public void add(CritereWidget critereWidget) {
+// critereWidget.setHeight(Integer.toString(__height).concat("px"));
+ horizontalPanel.add(critereWidget);
+ }
+
+ public List<InputCritereWidget> getInputCriteriaWidgets() {
+ List<InputCritereWidget> toReturn = new ArrayList<InputCritereWidget>();
+ for (int i = 0; i < horizontalPanel.getWidgetCount(); i++) {
+ Widget widget = horizontalPanel.getWidget(i);
+ if (widget instanceof InputCritereWidget) {
+ toReturn.add((InputCritereWidget) widget);
+ }
+ }
+ return toReturn;
+ }
+
+ InputCritereWidget getInputCritereWidget(String inputId) {
+ for (InputCritereWidget inputCritereWidget : getInputCriteriaWidgets()) {
+ if (inputCritereWidget.getInputId().equals(inputId)) {
+ return inputCritereWidget;
+ }
+ }
+ return null;
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.criteria;
+
+import com.google.gwt.user.client.ui.Composite;
+
+/**
+ * @author CBO
+ * Classe de base de tous les composants graphiques affichés dans une ligne de critère de recherche
+ */
+abstract public class CritereWidget extends Composite {
+
+ private CritereLineContainer critereLineContainer;
+
+ public CritereWidget(CritereLineContainer critereLineContainer) {
+ this.critereLineContainer = critereLineContainer;
+ }
+
+ public CritereLineContainer getCritereLineContainer() {
+ return this.critereLineContainer;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.criteria;
+
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.CritereItemDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.CritereItemVisitor;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.DateCritereItemDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.LabelCritereItemDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.NumericCritereItemDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.PropertyDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SelectOneCritereItemDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.TextCritereItemDTO;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author CBO
+ * Fabrique permettant de créer les composants graphiques affichés pour la saisie d'un critère de recherche à partir des DTO
+ */
+public class CritereWidgetFactory {
+
+ static public CritereWidget createWidget(CritereLineContainer criteriaLineContainer, CritereItemDTO critereItem) {
+ CriteriaWidgetFactoryCritereItemVisitor criteriaWidgetFactoryCritereItemVisitor = new CriteriaWidgetFactoryCritereItemVisitor(criteriaLineContainer);
+ critereItem.accept(criteriaWidgetFactoryCritereItemVisitor);
+ return criteriaWidgetFactoryCritereItemVisitor.toReturn;
+ }
+ static public CritereWidget createWidget(CritereLineContainer criteriaLineContainer, CritereItemDTO critereItem,ArrayList<PropertyDTO> properties) {
+ CriteriaWidgetFactoryCritereItemVisitor criteriaWidgetFactoryCritereItemVisitor = new CriteriaWidgetFactoryCritereItemVisitor(criteriaLineContainer);
+ critereItem.accept(criteriaWidgetFactoryCritereItemVisitor,properties);
+ return criteriaWidgetFactoryCritereItemVisitor.toReturn;
+ }
+
+ static public class InputCritereWidgetRepository {
+
+ private Map<String, InputCritereWidget> widgetByInputId = new HashMap<String, InputCritereWidget>();
+
+ public void add(InputCritereWidget inputCritereWidget) {
+ widgetByInputId.put(inputCritereWidget.getInputId(), inputCritereWidget);
+ }
+
+ public InputCritereWidget getWidget(String inputId) {
+ return widgetByInputId.get(inputId);
+ }
+ }
+
+ static private class CriteriaWidgetFactoryCritereItemVisitor implements CritereItemVisitor {
+
+ private CritereLineContainer critereLineContainer;
+ private CritereWidget toReturn;
+
+ public CriteriaWidgetFactoryCritereItemVisitor(CritereLineContainer critereLineContainer) {
+ this.critereLineContainer = critereLineContainer;
+ }
+
+ public void visit(LabelCritereItemDTO labelCritereItem) {
+ this.toReturn = new LabelCritereWidget(critereLineContainer, labelCritereItem.getLibelle());
+ }
+
+ public void visit(final SelectOneCritereItemDTO selectOneCritereItem) {
+ this.toReturn = new SelectOneCritereWidget(critereLineContainer, selectOneCritereItem);
+ }
+
+ public void visit(TextCritereItemDTO inputTextCritereItem) {
+ this.toReturn = new TextCritereWidget(critereLineContainer, inputTextCritereItem);
+ }
+
+ public void visit(DateCritereItemDTO inputDateCritereItem) {
+ this.toReturn = new DateCritereWidget(critereLineContainer, inputDateCritereItem);
+ }
+
+ public void visit(NumericCritereItemDTO numericCritereItem) {
+ this.toReturn = new NumericCritereWidget(critereLineContainer, numericCritereItem);
+ }
+ public void visit(LabelCritereItemDTO labelCritereItem,ArrayList<PropertyDTO> properties) {
+ this.toReturn = new LabelCritereWidget(critereLineContainer, labelCritereItem.getLibelle());
+ }
+
+ public void visit(final SelectOneCritereItemDTO selectOneCritereItem, ArrayList<PropertyDTO> properties) {
+ this.toReturn = new SelectOneCritereWidget(critereLineContainer, selectOneCritereItem,properties);
+ }
+
+ public void visit(TextCritereItemDTO inputTextCritereItem, ArrayList<PropertyDTO> properties) {
+ this.toReturn = new TextCritereWidget(critereLineContainer, inputTextCritereItem,properties);
+ }
+
+ public void visit(DateCritereItemDTO inputDateCritereItem,ArrayList<PropertyDTO> properties) {
+ this.toReturn = new DateCritereWidget(critereLineContainer, inputDateCritereItem,properties);
+ }
+
+ public void visit(NumericCritereItemDTO numericCritereItem, ArrayList<PropertyDTO> properties) {
+ this.toReturn = new NumericCritereWidget(critereLineContainer, numericCritereItem,properties);
+ }
+ }
+
+ private CritereWidgetFactory() {
+ // unused
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.criteria;
+
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.google.gwt.user.datepicker.client.DateBox;
+import com.google.gwt.user.datepicker.client.DatePicker;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.DateCritereItemDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.PropertyDTO;
+import java.util.Date;
+import java.util.List;
+
+public class DateCritereWidget extends InputCritereWidget {
+
+ private DateCritereItemDTO dateCritereItem;
+ private DateTimeFormat dateFormat;
+ private DateBox textBox;
+ private DatePicker datePicker;
+ private DateBox.Format dateBoxFormatter;
+
+ private void init() {
+ this.dateCritereItem = (DateCritereItemDTO)getInputCritereItem();
+ this.dateFormat = DateTimeFormat.getFormat(dateCritereItem.getFormat());
+ dateBoxFormatter = new DateBox.DefaultFormat(dateFormat);
+ datePicker = new DatePicker();
+ this.textBox = new DateBox(datePicker,new Date(),dateBoxFormatter);
+ textBox.getElement().getStyle().setPadding(0, Unit.PX);
+
+ }
+ public DateCritereWidget(CritereLineContainer critereLineContainer, DateCritereItemDTO critereItem) {
+ super(critereLineContainer, critereItem);
+ init();
+ if(critereItem.getLastInputValue()!=null) {
+ textBox.setValue(dateFormat.parse(critereItem.getLastInputValue()));
+ }
+ initWidget(textBox);
+ }
+ public DateCritereWidget(CritereLineContainer critereLineContainer, DateCritereItemDTO critereItem, List<PropertyDTO> properties) {
+ super(critereLineContainer, critereItem);
+ init();
+ String lastValue = null;
+ for(PropertyDTO prop: properties) {
+ if(prop.getName().equals(getInputId())) {
+ lastValue = prop.getValue();
+ }
+ }
+ if(lastValue==null) {
+ lastValue = critereItem.getLastInputValue();
+ }
+ if(lastValue!=null) {
+ textBox.setValue(dateFormat.parse(lastValue));
+ }
+ initWidget(textBox);
+ }
+
+ @Override
+ public void setFocus() {
+ this.textBox.setFocus(true);
+ }
+
+ @Override
+ public String getInputValue() {
+ return dateFormat.format(textBox.getValue());
+ }
+
+ @Override
+ public void refresh() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void checkValidity() throws ValidityException {
+ if (isFilled()) {
+ try {
+ this.dateFormat.parse(getInputValue());
+ } catch(IllegalArgumentException pe) {
+ throw new ValidityException("La valeur \"" + getInputValue() + "\" n'est pas une date valide, le format attendu est " + dateCritereItem.getFormat());
+ }
+ }
+ }
+
+ @Override
+ public void setInputValue(String value) {
+ textBox.setValue(dateFormat.parse(value));
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ textBox.setEnabled(enabled);
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.criteria;
+
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.InputCritereItemDTO;
+
+
+/**
+ * @author CBO
+ * Classe de base de tous les composants affichés dans une ligne de critère qui ont une valeur
+ */
+abstract public class InputCritereWidget extends CritereWidget {
+
+ private InputCritereItemDTO inputCritereItem;
+
+ public String getInputId() {
+ return inputCritereItem.getInputId();
+ }
+
+ public InputCritereWidget(CritereLineContainer critereLineContainer, InputCritereItemDTO inputCritereItem) {
+ super(critereLineContainer);
+ this.inputCritereItem = inputCritereItem;
+ }
+
+ public boolean isFilled() {
+ return getInputValue() != null && !getInputValue().trim().equals("");
+ }
+
+ public InputCritereItemDTO getInputCritereItem() {
+ return inputCritereItem;
+ }
+
+ abstract public void setFocus();
+
+ abstract public void refresh();
+
+ abstract public void checkValidity() throws ValidityException;
+
+ abstract public String getInputValue();
+
+ abstract public void setInputValue(String value);
+
+ abstract public void setEnabled(boolean enabled);
+
+ static public class ValidityException extends Exception {
+
+ private String messageToDisplay;
+
+ public ValidityException(String messageToDisplay) {
+ this.messageToDisplay = messageToDisplay;
+ }
+
+ public String getMessageToDisplay() {
+ return this.messageToDisplay;
+ }
+
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.criteria;
+
+import com.google.gwt.user.client.ui.Label;
+
+/**
+ * @author CBO
+ * Represente d'afficher un texte
+ */
+public class LabelCritereWidget extends CritereWidget {
+
+ public LabelCritereWidget(CritereLineContainer critereLineContainer, String text) {
+ super(critereLineContainer);
+ Label label = new Label(text);
+ initWidget(label);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.criteria;
+
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.google.gwt.event.dom.client.KeyPressEvent;
+import com.google.gwt.event.dom.client.KeyPressHandler;
+import com.google.gwt.i18n.client.NumberFormat;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.ValueBoxBase.TextAlignment;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.NumericCritereItemDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.PropertyDTO;
+import java.util.List;
+
+/**
+ * @author CBO
+ */
+public class NumericCritereWidget extends InputCritereWidget {
+
+ private TextBox textBox;
+
+ private void init() {
+ this.textBox = new TextBox();
+ this.textBox.setAlignment(TextAlignment.RIGHT);
+ textBox.getElement().getStyle().setPadding(0, Unit.PX);
+ this.textBox.addKeyPressHandler(new KeyPressHandler() {
+ @Override
+ public void onKeyPress(KeyPressEvent event) {
+ char keyCode = event.getCharCode();
+ if ((!Character.isDigit(keyCode)) && (keyCode != (char) KeyCodes.KEY_TAB) && (keyCode != 44) && (keyCode != 45) && (keyCode != (char) KeyCodes.KEY_BACKSPACE) && (keyCode != (char) KeyCodes.KEY_DELETE) && (keyCode != (char) KeyCodes.KEY_ENTER) && (keyCode != (char) KeyCodes.KEY_HOME) && (keyCode != (char) KeyCodes.KEY_END) && (keyCode != (char) KeyCodes.KEY_LEFT) && (keyCode != (char) KeyCodes.KEY_UP) && (keyCode != (char) KeyCodes.KEY_RIGHT) && (keyCode != (char) KeyCodes.KEY_DOWN)) {
+ textBox.cancelKey();
+ }
+
+ }
+ });
+ }
+ public NumericCritereWidget(CritereLineContainer critereLineContainer, NumericCritereItemDTO critereItem) {
+ super(critereLineContainer, critereItem);
+ init();
+ if(critereItem.getLastInputValue()!=null) {
+ textBox.setText(critereItem.getLastInputValue());
+ }
+ initWidget(textBox);
+ }
+ public NumericCritereWidget(CritereLineContainer critereLineContainer, NumericCritereItemDTO critereItem,List<PropertyDTO> properties) {
+ super(critereLineContainer, critereItem);
+ String lastValue = null;
+ for(PropertyDTO prop: properties) {
+ if(prop.getName().equals(getInputId())) {
+ lastValue = prop.getValue();
+ }
+ }
+ if(lastValue==null) {
+ lastValue = critereItem.getLastInputValue();
+ }
+ if(lastValue!=null) {
+ textBox.setText(lastValue);
+ }
+ initWidget(textBox);
+ }
+
+ @Override
+ public void setFocus() {
+ this.textBox.setFocus(true);
+ }
+
+ @Override
+ public String getInputValue() {
+ return textBox.getText();
+ }
+
+ @Override
+ public void refresh() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void checkValidity() throws ValidityException {
+ if (isFilled()) {
+ try {
+ NumberFormat.getDecimalFormat().parse(getInputValue());
+ } catch (NumberFormatException nfe) {
+ throw new ValidityException("La valeur \"" + getInputValue() + "\" n'est pas une valeur numérique valide");
+ }
+ }
+ }
+
+ @Override
+ public void setInputValue(String value) {
+ textBox.setText(value);
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ textBox.setEnabled(enabled);
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.criteria;
+
+import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.event.dom.client.ChangeHandler;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.ListBox;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.service.ServiceLocator;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.utils.GWTUtils;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.InputCritereItemDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.LabelValueDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.PropertyDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SelectOneCritereItemDTO;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.Map;
+
+/**
+ * @author CBO
+ * Permet de choisir une valeur parmi plusieurs
+ */
+public class SelectOneCritereWidget extends InputCritereWidget {
+
+ private SelectOneCritereItemDTO selectOneCritereItem;
+ private ListBox listBox;
+
+ public SelectOneCritereWidget(final CritereLineContainer critereLineContainer, final SelectOneCritereItemDTO selectOneCritereItem) {
+ super(critereLineContainer, selectOneCritereItem);
+ this.selectOneCritereItem = selectOneCritereItem;
+ this.listBox = new ListBox();
+ fillListBox(selectOneCritereItem.getItems(), selectOneCritereItem.getSelectedItem());
+ if (!selectOneCritereItem.getCriteresDependants().isEmpty()) {
+ addChangeHandler(new ChangeHandler() {
+ public void onChange(ChangeEvent evt) {
+ for (InputCritereItemDTO inputCritereItemDTO : selectOneCritereItem.getCriteresDependants()) {
+ InputCritereWidget dependantInputCritereWidget = critereLineContainer.getInputCritereWidget(inputCritereItemDTO.getInputId());
+ dependantInputCritereWidget.refresh();
+ }
+ }
+ });
+ }
+ addNotNullChangeListener();
+ if(selectOneCritereItem.getLastInputValue()!=null) {
+ String lastValue = selectOneCritereItem.getLastInputValue();
+ for(int i=0;i<listBox.getItemCount();i++) {
+ if(listBox.getValue(i).equals(lastValue)) {
+ listBox.setSelectedIndex(i);
+ break;
+ }
+ }
+ }
+ initWidget(listBox);
+ }
+ public SelectOneCritereWidget(final CritereLineContainer critereLineContainer, final SelectOneCritereItemDTO selectOneCritereItem,ArrayList<PropertyDTO> properties) {
+ super(critereLineContainer, selectOneCritereItem);
+ this.selectOneCritereItem = selectOneCritereItem;
+ this.listBox = new ListBox();
+ fillListBox(selectOneCritereItem.getItems(), selectOneCritereItem.getSelectedItem());
+ if (!selectOneCritereItem.getCriteresDependants().isEmpty()) {
+ addChangeHandler(new ChangeHandler() {
+ public void onChange(ChangeEvent evt) {
+ for (InputCritereItemDTO inputCritereItemDTO : selectOneCritereItem.getCriteresDependants()) {
+ InputCritereWidget dependantInputCritereWidget = critereLineContainer.getInputCritereWidget(inputCritereItemDTO.getInputId());
+ dependantInputCritereWidget.refresh();
+ }
+ }
+ });
+ }
+ addNotNullChangeListener();
+ String lastValue = null;
+ for(PropertyDTO prop: properties) {
+ if(prop.getName().equals(getInputId())) {
+ lastValue = prop.getValue();
+ }
+ }
+ if(lastValue==null) {
+ lastValue = selectOneCritereItem.getLastInputValue();
+ }
+ if(lastValue!=null) {
+ for(int i=0;i<listBox.getItemCount();i++) {
+ if(listBox.getValue(i).equals(lastValue)) {
+ listBox.setSelectedIndex(i);
+ break;
+ }
+ }
+ }
+ initWidget(listBox);
+ }
+ private void addNotNullChangeListener() {
+ addChangeHandler(new ChangeHandler() {
+ public void onChange(ChangeEvent evt) {
+ // cas des not null et null
+ // FIXME: faire qqchose de plus propre
+// Window.alert("in NotNullListener.onChange, value is"+getInputValue());
+ if(getInputId().contains("OPERATEUR:")) {
+ String valueId = getInputId().replace("OPERATEUR","VALEUR");
+ InputCritereWidget valueWidget = getCritereLineContainer().getInputCritereWidget(valueId);
+ if(valueWidget!=null) {
+ if("xem:StringIsNull".equals(getInputValue()) || "xem:StringIsNotNull".equals(getInputValue())) {
+ valueWidget.setInputValue("--");
+ valueWidget.setEnabled(false);
+ } else {
+ valueWidget.setInputValue("");
+ valueWidget.setEnabled(true);
+ }
+ }
+ }
+ }
+ });
+ }
+
+ private void updateListBoxContent(ArrayList<LabelValueDTO> items, LabelValueDTO selectedItem) {
+ selectOneCritereItem.setItems(items);
+ selectOneCritereItem.setSelectedItem(selectedItem);
+ fillListBox(items, selectedItem);
+ }
+
+ public void fillListBox(Collection<LabelValueDTO> labelValues, LabelValueDTO selectedItem) {
+ listBox.clear();
+ int index = 0;
+ for (LabelValueDTO labelValue : labelValues) {
+ listBox.addItem(labelValue.getLabel(), labelValue.getValue());
+ if (labelValue.equals(selectOneCritereItem.getSelectedItem())) {
+ listBox.setSelectedIndex(index);
+ }
+ index++;
+ }
+ }
+
+ public void addChangeHandler(ChangeHandler changeHandler) {
+ listBox.addChangeHandler(changeHandler);
+ }
+
+ @Override
+ public void checkValidity() throws ValidityException {
+
+ }
+
+ @Override
+ public void setFocus() {
+ this.listBox.setFocus(true);
+ }
+
+ @Override
+ public String getInputId() {
+ return this.selectOneCritereItem.getInputId();
+ }
+
+ @Override
+ public String getInputValue() {
+ return listBox.getValue(listBox.getSelectedIndex());
+ }
+
+ @Override
+ public void refresh() {
+ Map<String, String> inputValues = new HashMap<String, String>();
+ for (InputCritereItemDTO criteresMaitre : selectOneCritereItem.getCriteresMaitres()) {
+ InputCritereWidget inputWidget = getCritereLineContainer().getInputCritereWidget(criteresMaitre.getInputId());
+ inputValues.put(inputWidget.getInputId(), inputWidget.getInputValue());
+ ServiceLocator.getXemeliosService().getUpdatedSelectOneCritereItemDTO(
+ getCritereLineContainer().getCriteriaTable().getMainWidget().getSearchSessionId(),
+ getCritereLineContainer().getCriteriaTable().getMainWidget().getCollectiviteId(),
+ getCritereLineContainer().getCriteriaTable().getMainWidget().getBudgetId(),
+ getCritereLineContainer().getCritereId(),
+ getInputId(),
+ inputValues,
+ getCritereLineContainer().getCriteriaTable().getPluginId(),
+ new AsyncCallback<SelectOneCritereItemDTO>() {
+ public void onFailure(Throwable throwable) {
+ GWTUtils.handleRPCError(throwable);
+ }
+ public void onSuccess(SelectOneCritereItemDTO result) {
+ if (result != null) {
+ updateListBoxContent(result.getItems(), result.getSelectedItem());
+ }
+ }
+ });
+ }
+ }
+
+ @Override
+ public void setInputValue(String value) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ listBox.setEnabled(enabled);
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.criteria;
+
+import com.google.gwt.dom.client.Style.BorderStyle;
+import com.google.gwt.dom.client.Style.FontStyle;
+import com.google.gwt.dom.client.Style.FontWeight;
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.logical.shared.ValueChangeEvent;
+import com.google.gwt.event.logical.shared.ValueChangeHandler;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.KeyboardListenerAdapter;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.Widget;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.utils.DoneListener;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.DlgSearchHelper;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.DlgSelectFromDistinctValues;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.widgets.search.SearchContext;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.PropertyDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchHelperDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.TextCritereItemDTO;
+import java.util.List;
+
+public class TextCritereWidget extends InputCritereWidget {
+
+ private TextBox textBox;
+ private Button helpButton;
+ private HorizontalPanel panel;
+ private TextCritereItemDTO critereItem;
+
+ private Widget mainWidget;
+
+ public TextCritereWidget(CritereLineContainer critereLineContainer, TextCritereItemDTO critereItem) {
+ super(critereLineContainer, critereItem);
+ this.critereItem = critereItem;
+ this.textBox = new TextBox();
+ textBox.getElement().getStyle().setPadding(0, Unit.PX);
+ mainWidget=textBox;
+// if (critereItem.isUppercase()) {
+// textBox.addKeyboardListener(new KeyboardListenerAdapter() {
+//
+// @Override
+// public void onKeyPress(Widget sender, char keyCode, int modifiers) {
+// if (Character.isLowerCase(keyCode)) {
+// ((TextBox) sender).setKey(Character.toUpperCase(keyCode));
+// }
+// }
+// });
+// }
+ if(critereItem.getLastInputValue()!=null) {
+ textBox.setText(critereItem.getLastInputValue());
+ }
+ if(critereItem.getHelpPath()!=null || critereItem.getSearchHelper()!=null) {
+ final String helpPath = critereItem.getHelpPath();
+ helpButton = new Button("...");
+ helpButton.addStyleName("zoneSaisissable");
+ helpButton.setTitle(new HTML("Liste des éléments").getHTML());
+ helpButton.setHeight("16px");
+ helpButton.setWidth("16px");
+ helpButton.getElement().getStyle().setPadding(0, Unit.PX);
+ helpButton.getElement().getStyle().setFontSize(10, Unit.PX);
+ panel = new HorizontalPanel();
+ panel.add(textBox);
+ panel.add(helpButton);
+ mainWidget = panel;
+ if(critereItem.getHelpPath()!=null) {
+ helpButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ String searchSessionId = getCritereLineContainer().getCriteriaTable().getMainWidget().getSearchSessionId();
+ String collectivite = getCritereLineContainer().getCriteriaTable().getMainWidget().getCollectiviteId();
+ String budget = getCritereLineContainer().getCriteriaTable().getMainWidget().getBudgetId();
+ DlgSelectFromDistinctValues dlg = new DlgSelectFromDistinctValues(TextCritereWidget.this, collectivite, budget, searchSessionId,helpPath);
+ }
+ });
+ } else {
+ final SearchHelperDTO sh = critereItem.getSearchHelper();
+ helpButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ DlgSearchHelper helper = new DlgSearchHelper(sh, new SearchContext(), TextCritereWidget.this);
+ }
+ });
+ }
+ }
+ initWidget(mainWidget);
+ }
+ public TextCritereWidget(CritereLineContainer critereLineContainer, TextCritereItemDTO critereItem,List<PropertyDTO> properties) {
+ super(critereLineContainer, critereItem);
+ this.textBox = new TextBox();
+ if (critereItem.isUppercase()) {
+// textBox.addKeyboardListener(new KeyboardListenerAdapter() {
+// @Override
+// public void onKeyPress(Widget sender, char keyCode, int modifiers) {
+// if (Character.isLowerCase(keyCode)) {
+// ((TextBox) sender).setKey(Character.toUpperCase(keyCode));
+// }
+// }
+// });
+ textBox.addValueChangeHandler(new ValueChangeHandler<String>() {
+ @Override
+ public void onValueChange(ValueChangeEvent<String> event) {
+ if(textBox.getValue()!=null) {
+ textBox.setValue(textBox.getValue().toUpperCase());
+ }
+ }
+ });
+ }
+ String lastValue=null;
+ for(PropertyDTO prop: properties) {
+ if(prop.getName().equals(getInputId())) {
+ lastValue = prop.getValue();
+ }
+ }
+ if(lastValue==null) {
+ lastValue = critereItem.getLastInputValue();
+ }
+ if(lastValue!=null) {
+ textBox.setText(lastValue);
+ }
+ initWidget(textBox);
+ }
+
+ @Override
+ public void checkValidity() throws ValidityException {
+ if (getInputValue() != null && getInputValue().contains("\"")) {
+ throw new ValidityException(new HTML("Les guillemets ne sont pas autoriés").getHTML());
+ }
+ }
+
+ @Override
+ public void setFocus() {
+ this.textBox.setFocus(true);
+ }
+
+ @Override
+ public void refresh() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public String getInputValue() {
+ if(critereItem.isUppercase()) return textBox.getValue().toUpperCase();
+ else return textBox.getText();
+ }
+ public void setInputValue(String text) {
+ textBox.setText(text);
+ }
+ public void setEnabled(boolean enabled) {
+ textBox.setEnabled(enabled);
+ }
+}
--- /dev/null
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.server;
+
+/**
+ *
+ * @author chm
+ */
+public class ExportResult {
+ private byte[] buffer;
+ private String mimeType;
+
+ public ExportResult(byte[] buffer, String mimeType) {
+ this.buffer=buffer;
+ this.mimeType=mimeType;
+ }
+
+ public byte[] getBuffer() {
+ return buffer;
+ }
+
+ public void setBuffer(byte[] buffer) {
+ this.buffer = buffer;
+ }
+
+ public String getMimeType() {
+ return mimeType;
+ }
+
+ public void setMimeType(String mimeType) {
+ this.mimeType = mimeType;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.server;
+
+/**
+ * @author CBO
+ */
+public class NoDataFoundException extends RuntimeException {
+
+ private String documentId;
+
+ public NoDataFoundException(String documentId) {
+ this.documentId = documentId;
+ }
+
+ public String getDocumentId() {
+ return documentId;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.server;
+
+import fr.gouv.finances.dgfip.utils.Pair;
+import fr.gouv.finances.dgfip.xemelios.common.config.DocumentModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.ElementModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.EtatModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.ListeResultatModel;
+import fr.gouv.finances.dgfip.xemelios.data.DataResultSet;
+import fr.gouv.finances.dgfip.xemelios.web2.app.XemeliosHelper;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchSessionDTO;
+import java.util.HashMap;
+import java.util.Map;
+import javax.servlet.http.HttpSession;
+
+/**
+ * Permet de gérer les données à conserver sur le serveur pour chaque fenêtre de recherche
+ * @author CBO
+ */
+public class SearchSessionContainer {
+
+ private int lastId = 0;
+ private Map<String, SearchSession> map = new HashMap<String, SearchSession>();
+
+ private SearchSessionContainer() {
+ super();
+ }
+
+ public static SearchSessionContainer getInstance(HttpSession session) {
+ SearchSessionContainer searchSessionContainer = (SearchSessionContainer) session.getAttribute("searchSessionContainer");
+ if (searchSessionContainer == null) {
+ searchSessionContainer = new SearchSessionContainer();
+ session.setAttribute("searchSessionContainer", searchSessionContainer);
+ }
+ return searchSessionContainer;
+ }
+
+ public SearchSession createSearchSession(String documentId, String etatId, String elementId) {
+ lastId++;
+ SearchSession searchSession = new SearchSession("" + lastId, documentId, etatId, elementId);
+ map.put("" + lastId, searchSession);
+ return searchSession;
+ }
+
+ public void destroySearchSession(String id) {
+ map.remove(id);
+ }
+
+ public SearchSession getSearchSession(String id) {
+ return map.get(id);
+ }
+
+ /**
+ * Contient l'état serveur d'une fenêtre de recherche (conserveée en session)
+ */
+ static public class SearchSession {
+
+ // Identifiant de fenêtre :
+ private String id;
+ // Document, etat et element :
+ private String documentId;
+ private String etatId;
+ private String elementId;
+ // Pour la pagination :
+ private DataResultSet dataResultSet;
+ private ListeResultatModel lrm;
+ private Pair collectivite;
+ private Pair budget;
+
+ SearchSession(String id, String documentId, String etatId, String elementId) {
+ this.id = id;
+ this.documentId = documentId;
+ this.etatId = etatId;
+ this.elementId = elementId;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getDocumentId() {
+ return documentId;
+ }
+
+ public String getElementId() {
+ return elementId;
+ }
+
+ public String getEtatId() {
+ return etatId;
+ }
+
+ public DocumentModel getDocumentModel() {
+ return XemeliosHelper.getDocumentModel(documentId);
+ }
+
+ public EtatModel getEtatModel() {
+ return getDocumentModel().getEtatById(etatId);
+ }
+
+ public ElementModel getElementModel() {
+ return getEtatModel().getElementById(elementId);
+ }
+
+ public DataResultSet getDataResultSet() {
+ return dataResultSet;
+ }
+
+ public void setDataResultSet(DataResultSet dataResultSet) {
+ this.dataResultSet = dataResultSet;
+ }
+
+ public ListeResultatModel getLrm() {
+ return lrm;
+ }
+
+ public void setLrm(ListeResultatModel lrm) {
+ this.lrm = lrm;
+ }
+
+ public Pair getBudget() {
+ return budget;
+ }
+
+ public void setBudget(Pair budget) {
+ this.budget = budget;
+ }
+
+ public Pair getCollectivite() {
+ return collectivite;
+ }
+
+ public void setCollectivite(Pair collectivite) {
+ this.collectivite = collectivite;
+ }
+
+ public SearchSessionDTO getSearchSessionDTO() {
+ return new SearchSessionDTO(id, documentId, etatId, elementId, collectivite.key, budget.key);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright
+ * 2010 axYus - www.axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.server;
+
+import com.google.gwt.user.server.rpc.RemoteServiceServlet;
+import fr.gouv.finances.cp.utils.xml.marshal.XmlMarshallable;
+import fr.gouv.finances.dgfip.utils.Amount;
+import fr.gouv.finances.dgfip.utils.Pair;
+import fr.gouv.finances.dgfip.xemelios.auth.UnauthorizedException;
+import fr.gouv.finances.dgfip.xemelios.auth.XemeliosUser;
+import fr.gouv.finances.dgfip.xemelios.common.Constants;
+import fr.gouv.finances.dgfip.xemelios.common.config.ChampModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.CritereModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.CritereRefModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.DocumentModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.ElementModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.HiddenModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.InputModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.ListeResultatModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.OptionModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.PJRefInfo;
+import fr.gouv.finances.dgfip.xemelios.common.config.ParentModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.PjRefHandler;
+import fr.gouv.finances.dgfip.xemelios.common.config.PluginModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.PropertyModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.RechercheModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.RecherchePaireModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.ResourceRefModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.SelectModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.SpecialKeyEntryModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.SpecialKeyModel;
+import fr.gouv.finances.dgfip.xemelios.data.DataAccessException;
+import fr.gouv.finances.dgfip.xemelios.data.DataConfigurationException;
+import fr.gouv.finances.dgfip.xemelios.data.DataHandler;
+import fr.gouv.finances.dgfip.xemelios.data.DataLayerManager;
+import fr.gouv.finances.dgfip.xemelios.data.DataResultSet;
+import fr.gouv.finances.dgfip.xemelios.plugins.ExportPlugin;
+import fr.gouv.finances.dgfip.xemelios.plugins.SearchPlugin;
+import fr.gouv.finances.dgfip.xemelios.utils.MimeTypes;
+import fr.gouv.finances.dgfip.xemelios.web2.app.XemeliosHelper;
+
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.XemeliosService;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.CollectiviteTreeDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.CritereItemDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.CritereTypeDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.DateCritereItemDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.DisplayableFieldDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.InitParametersDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.InputCritereItemDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.LabelCritereItemDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.LabelValueDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.ListResultatDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.Menu;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.NumericCritereItemDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.PaginationInfoDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.ParentCollectiviteDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.RowResultDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchHelperDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchInitParametersDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchParameterDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SearchResultDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SelectOneCritereItemDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.SpecialKeyDefDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.StoredSearchDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.TextCritereItemDTO;
+import fr.gouv.finances.dgfip.xemelios.web2.utils.AttributeHelper;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.math.BigDecimal;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Vector;
+import javax.servlet.ServletException;
+import org.apache.log4j.Logger;
+import org.xml.sax.SAXException;
+
+/**
+ *
+ * @author cmarchand
+ */
+public class XemeliosServiceImpl extends RemoteServiceServlet implements XemeliosService {
+ public static final String DOC_ID_ENTRY = "__docId__";
+
+ private static final Logger logger = Logger.getLogger(XemeliosServiceImpl.class);
+
+ @Override
+ public void init() throws ServletException {
+ super.init();
+// getSerializationPolicy(DOC_ID_ENTRY, DOC_ID_ENTRY)
+ }
+
+// @Override
+// protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+// Thread currentThread = Thread.currentThread();
+// ClassLoader oldContextClassLoader = currentThread.getContextClassLoader();
+// currentThread.setContextClassLoader(this.getClass().getClassLoader());
+// super.service(req, resp);
+// currentThread.setContextClassLoader(oldContextClassLoader);
+// }
+// @Override
+// protected void onBeforeRequestDeserialized(String serializedRequest) {
+// logger.debug("onBeforeRequestDeserialized="+serializedRequest);
+// super.onBeforeRequestDeserialized(serializedRequest);
+// }
+//
+// @Override
+// protected void onAfterResponseSerialized(String serializedResponse) {
+// logger.debug("onAfterResponseSerialized="+serializedResponse);
+// super.onAfterResponseSerialized(serializedResponse);
+// }
+
+
+ @Override
+ public Menu getMenu() {
+ logger.debug("getMenu()");
+ XemeliosUser user = getXemeliosUser();
+ return XemeliosHelper.getMenu(user);
+ }
+
+ private XemeliosUser getXemeliosUser() {
+ return AttributeHelper.getUser(getThreadLocalRequest().getSession());
+ }
+
+ @Override
+ public String getConnectedUser() {
+ logger.debug("getConnectedUser()");
+ return getXemeliosUser().getDisplayName();
+ }
+
+ @Override
+ public CollectiviteTreeDTO getCollectiviteTree(String documentId, boolean includeBudgetSK) {
+ XemeliosUser user = getXemeliosUser();
+ DocumentModel dm = XemeliosHelper.getDocumentModel(documentId);
+ CollectiviteTreeDTO ret = new CollectiviteTreeDTO();
+ ret.setDocumentId(documentId);
+ ret.setLibelleCollectivite(/*escapeHtml(*/dm.getLibelleCollectivite())/*)*/;
+ for (int i = 0; i < dm.getCollectivitePath().getParentsCount(); i++) {
+ ParentModel pm = dm.getCollectivitePath().getParent(i);
+ ParentCollectiviteDTO pc = new ParentCollectiviteDTO();
+ pc.setDocumentId(documentId);
+ pc.setLevel(i);
+ pc.setLibelle(/*escapeHtml(*/pm.getLibelle())/*)*/;
+ ret.addParentCollectivite(pc);
+ }
+ for (SpecialKeyModel skm : dm.getSpecialKeys()) {
+ ret.addSpecialKey(new SpecialKeyDefDTO().setData(documentId, skm.getLibelle(), skm.getPos()));
+ }
+ return ret;
+ }
+ @Override
+ public List<LabelValueDTO> getCollectivites(String documentId, String[] parents) {
+ XemeliosUser user = getXemeliosUser();
+ List<LabelValueDTO> ret = new ArrayList<LabelValueDTO>();
+ DocumentModel dm = XemeliosHelper.getDocumentModel(documentId);
+ Pair[] remoteParents = new Pair[parents.length];
+ for (int i = 0; i < parents.length; i++) {
+ remoteParents[i] = parents[i] != null ? new Pair(parents[i], parents[i]) : null;
+ }
+ try {
+ List<Pair> v = DataLayerManager.getImplementation().getCollectivites(dm, remoteParents, user);
+ for (Pair p : v) {
+ logger.debug("adding (" + p.key + "," + p.libelle + ")");
+ ret.add(new LabelValueDTO(p.key, p.libelle));
+ }
+ } catch (Exception ex) {
+ logger.error("getCollectivites(String, String[])", ex);
+ }
+ return ret;
+ }
+ @Override
+ public String getDefaultBrowsableEtat(String documentId) {
+ List<LabelValueDTO> ret = new ArrayList<LabelValueDTO>();
+ DocumentModel dm = XemeliosHelper.getDocumentModel(documentId);
+ return dm.getDefaultBrowsableEtat().getId();
+ }
+ @Override
+ public String getDefaultBrowsableElement(String documentId, String etatId) {
+ List<LabelValueDTO> ret = new ArrayList<LabelValueDTO>();
+ DocumentModel dm = XemeliosHelper.getDocumentModel(documentId);
+ return dm.getEtatById(etatId).getBrowsableElement().getId();
+ }
+
+ public String getLibelleElement(String docId, String etatId, String elementId) {
+ return XemeliosHelper.getDocumentModel(docId).getEtatById(etatId).getElementById(elementId).getTitre();
+ }
+ public void destroySearchSession(String searchSessionId) {
+ SearchSessionContainer.getInstance(getThreadLocalRequest().getSession()).destroySearchSession(searchSessionId);
+ }
+ @Override
+ public List<LabelValueDTO> getBudgetsFromDocument(String documentId, String collectiviteId) {
+ DocumentModel dm = XemeliosHelper.getDocumentModel(documentId);
+ try {
+ return pairsToLabelValueDTOs(XemeliosHelper.getBudgets(getXemeliosUser(), dm, collectiviteId));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ @Override
+ public List<LabelValueDTO> getSpecialKeys1(String documentId, String collectivite, String budget) {
+ XemeliosUser user = getXemeliosUser();
+ List<LabelValueDTO> ret = new ArrayList<LabelValueDTO>();
+ DocumentModel dm = XemeliosHelper.getDocumentModel(documentId);
+ try {
+ List<Pair> v = DataLayerManager.getImplementation().getSpecialKeys1(dm, new Pair(collectivite, collectivite), new Pair(budget, budget), true, user);
+ for (Pair p : v) {
+ ret.add(new LabelValueDTO(p.key, p.libelle));
+ }
+ } catch (Exception ex) {
+ logger.error("getSpecialKeys1(String,String,String)", ex);
+ }
+ return ret;
+ }
+
+ @Override
+ public List<LabelValueDTO> getSpecialKeys2(String documentId, String collectivite, String budget, String sk1) {
+ XemeliosUser user = getXemeliosUser();
+ List<LabelValueDTO> ret = new ArrayList<LabelValueDTO>();
+ DocumentModel dm = XemeliosHelper.getDocumentModel(documentId);
+ try {
+ List<Pair> v = DataLayerManager.getImplementation().getSpecialKeys2(dm, new Pair(collectivite, collectivite), new Pair(budget, budget), new Pair(sk1, sk1), true, user);
+ for (Pair p : v) {
+ ret.add(new LabelValueDTO(p.key, p.libelle));
+ }
+ } catch (Exception ex) {
+ logger.error("getSpecialKeys2(String,String,String,String)", ex);
+ }
+ return ret;
+ }
+
+ @Override
+ public List<LabelValueDTO> getParentCollectivites(String documentId, int level, String[] parents) {
+ XemeliosUser user = getXemeliosUser();
+ List<LabelValueDTO> ret = new ArrayList<LabelValueDTO>();
+ DocumentModel dm = XemeliosHelper.getDocumentModel(documentId);
+ Pair[] remoteParents = new Pair[parents.length];
+ for (int i = 0; i < parents.length; i++) {
+ remoteParents[i] = new Pair(parents[i], parents[i]);
+ }
+ try {
+ List<Pair> v = DataLayerManager.getImplementation().getParentCollectivites(dm, level, remoteParents, user);
+ for (Pair p : v) {
+ ret.add(new LabelValueDTO(p.key, p.libelle));
+ }
+ } catch (Exception ex) {
+ logger.error("getParentCollectivites(String, int, String[])", ex);
+ }
+ return ret;
+ }
+
+ @Override
+ public ArrayList<LabelValueDTO> getBudgets(String searchSessionId, String collectiviteId) {
+ logger.debug("getBudgets("+searchSessionId+","+collectiviteId+")");
+ try {
+ return pairsToLabelValueDTOs(XemeliosHelper.getBudgets(getXemeliosUser(), getSearchSession(searchSessionId).getDocumentModel(), collectiviteId));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private SearchSessionContainer.SearchSession getSearchSession(String searchSessionId) {
+ return SearchSessionContainer.getInstance(getThreadLocalRequest().getSession()).getSearchSession(searchSessionId);
+ }
+
+ /**
+ * Retourne les parametres necessaires a l'initialisation du widget d'elaboration des criteres de recherche
+ * @param documentId
+ * @param etatId
+ * @param elementId
+ * @return
+ */
+ @Override
+ public InitParametersDTO initSearchWindow(String documentId, String etatId, String elementId) {
+ logger.debug("initSearchSession("+documentId+","+etatId+","+elementId+")");
+ SearchSessionContainer.SearchSession searchSession = SearchSessionContainer.getInstance(getThreadLocalRequest().getSession()).createSearchSession(documentId, etatId, elementId);
+ int collectiviteCount = 0;
+ try {
+ collectiviteCount = DataLayerManager.getImplementation().getCollectivitesCount(searchSession.getDocumentModel(), getXemeliosUser());
+ } catch (Exception ex) {
+ logger.error("initSearchWindow(String,String,String)", ex);
+ }
+ ArrayList<LabelValueDTO> collectivites = new ArrayList<LabelValueDTO>();
+ if (collectiviteCount <= Constants.MAX_DISPLAYED_COLLECTIVITES) {
+ collectivites = getCollectivites(searchSession.getId(), getXemeliosUser());
+ }
+ ArrayList<LabelValueDTO> budgetsForFirstCollectivite = null;
+ if (!collectivites.isEmpty()) {
+ budgetsForFirstCollectivite = getBudgets(searchSession.getId(), collectivites.iterator().next().getValue());
+ } else {
+ budgetsForFirstCollectivite = new ArrayList<LabelValueDTO>();
+ }
+ // Creation ListeResultatModel et placement dans la session de recherche
+ String importableElementLibelle = null;
+ try {
+ ElementModel elementModel = searchSession.getElementModel();
+ ListeResultatModel lrm = elementModel.getListeResultat().clone();
+ lrm.setParent(elementModel);
+ searchSession.setLrm(lrm);
+ importableElementLibelle = elementModel.getParent().getImportableElement().getTitre();
+ } catch (Exception saxe) {
+ throw new RuntimeException(saxe);
+ }
+ return new InitParametersDTO(
+ searchSession.getId(),
+ collectivites,
+ budgetsForFirstCollectivite,
+ collectiviteCount > Constants.MAX_DISPLAYED_COLLECTIVITES,
+ searchSession.getDocumentModel().getId(),
+ etatId, elementId,
+ // TODO: en cas de searchHelper, c'est ici qu'il faut mettre les critere obligatoires
+ new SearchInitParametersDTO(new ArrayList<CritereTypeDTO>(), getCriteres(searchSession.getId()), importableElementLibelle),
+ searchSession.getDocumentModel().getReferentielXsltFile() != null);
+ }
+
+ private ArrayList<LabelValueDTO> getCollectivites(String searchSessionId, XemeliosUser user) {
+ try {
+ return pairsToLabelValueDTOs(XemeliosHelper.getCollectivites(user, getSearchSession(searchSessionId).getDocumentModel()));
+ } catch (DataConfigurationException dce) {
+ throw new RuntimeException(dce);
+ } catch (DataAccessException dae) {
+ throw new NoDataFoundException(getSearchSession(searchSessionId).getDocumentId());
+ }
+ }
+
+ private ArrayList<CritereTypeDTO> getCriteres(String searchSessionId) {
+ ArrayList<CritereTypeDTO> toReturn = new ArrayList<CritereTypeDTO>();
+ for (CritereModel cm : getSearchSession(searchSessionId).getElementModel().getAvailableCriteres()) {
+ toReturn.add(new CritereTypeDTO(cm.getId(), cm.getLibelle()));
+ }
+ return toReturn;
+ }
+
+ @Override
+ public SearchResultDTO search(String searchSessionId, String collectiviteId, String budgetId, List<SearchParameterDTO> searchParams, String pluginId) {
+ if (pluginId == null) {
+ return simpleSearch(searchSessionId, collectiviteId, budgetId, searchParams);
+ } else {
+ return pluginSearch(searchSessionId, collectiviteId, budgetId, searchParams, pluginId);
+ }
+ }
+ @Override
+ public String processPluginExport(String searchSessionId, String collectiviteId, String budgetId, String pluginId, List<SearchParameterDTO> searchParams) {
+ // TODO
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ String mimeType = null;
+ try {
+ Pair collectivite = XemeliosHelper.getCollectivite(getXemeliosUser(), getSearchSession(searchSessionId).getDocumentModel(), collectiviteId);
+ Pair budget = XemeliosHelper.getBudget(getXemeliosUser(), getSearchSession(searchSessionId).getDocumentModel(), collectiviteId, budgetId);
+ PluginModel plugin = getPluginModel(searchSessionId, pluginId);
+ Class clazz = Class.forName(plugin.getPluginClass());
+ Constructor cc = clazz.getConstructor(XemeliosUser.class);
+ ExportPlugin xp = (ExportPlugin) cc.newInstance(getXemeliosUser());
+ xp.setPluginModel(plugin);
+ xp.setCollectivite(collectivite);
+ xp.setBudget(budget);
+ xp.setParameters(getParameters(searchParams));
+ xp.setElementModel(getSearchSession(searchSessionId).getElementModel());
+ xp.setOutputStream(baos);
+ // To avoid NPE in plugin implementations
+ xp.setProgressListener(new ExportPlugin.ProgressListener() {
+ public void setProgressInfos(int arg0, String msg) {
+ }
+ public void pushProgress() {
+ }
+ public void setProgressVisible(boolean arg0) {
+ }
+ });
+ xp.computeParameters();
+ mimeType = MimeTypes.getMimeType(xp.getDefaultFileExtension().toLowerCase());
+ xp.doExport();
+ baos.flush();
+ baos.close();
+ } catch(Exception ex) {
+ logger.error("processPluginExport(String,List<SearchParameterDTO>)",ex);
+ }
+ getThreadLocalRequest().getSession().setAttribute("export-"+searchSessionId, new ExportResult(baos.toByteArray(),mimeType));
+ return "getExportResult.do?searchSessionId="+searchSessionId;
+ }
+ @Override
+ public List<StoredSearchDTO> getSavedPrivateSearchs(String searchSessionId) {
+ try {
+ List<StoredSearchDTO> toReturn = new ArrayList<StoredSearchDTO>();
+ for(RechercheModel rm:DataLayerManager.getImplementation().getSavedRequests(getSearchSession(searchSessionId).getElementModel(), getXemeliosUser(), false)) {
+ toReturn.add(new StoredSearchDTO(rm.getId(),rm.getDisplayName(),StoredSearchDTO.TYPE_SAVED,rm.getResource()));
+ }
+ Collections.sort(toReturn, new Comparator<StoredSearchDTO>() {
+ public int compare(StoredSearchDTO o1, StoredSearchDTO o2) {
+ return o1.getLibelle().compareToIgnoreCase(o2.getLibelle());
+ }
+ });
+ return toReturn;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ @Override
+ public String saveRequest(String searchSessionId, List<SearchParameterDTO> searchParams, String requestName) {
+ String ret = "OK";
+ Exception exceptionThrown = null;
+ SearchSessionContainer.SearchSession searchSession = getSearchSession(searchSessionId);
+ XemeliosUser user = getXemeliosUser();
+ StringBuffer xpathQuery = new StringBuffer();
+ Vector<CritereModel> critereModels = new Vector<CritereModel>();
+ try {
+ for(SearchParameterDTO searchParam:searchParams) {
+ processSearchParameter(searchSession.getElementModel(), searchParam, critereModels, xpathQuery, user);
+ }
+ } catch(SAXException saxEx) {
+ exceptionThrown = saxEx;
+ }
+ RechercheModel rm = new RechercheModel(RechercheModel.QN);
+ rm.setName(requestName);
+ for(CritereModel cm:critereModels) try { rm.addChild(cm, CritereModel.QN); } catch(Exception ex) { exceptionThrown = ex; }
+ if(exceptionThrown==null) {
+ try {
+ DataLayerManager.getImplementation().saveRequest(searchSession.getElementModel(), rm, user);
+ } catch (DataConfigurationException ex) {
+ exceptionThrown = ex;
+ }
+ }
+ if(exceptionThrown!=null) {
+ logger.error("saveRequest(String,List<SearchParameterDTO>,String)",exceptionThrown);
+ ret = "ERROR";
+ }
+ return ret;
+ }
+ @Override
+ public String saveRequest(String searchSessionId, List<SearchParameterDTO> searchParams, String requestName, String requestId) {
+ String ret = "OK";
+ Exception exceptionThrown = null;
+ SearchSessionContainer.SearchSession searchSession = getSearchSession(searchSessionId);
+ XemeliosUser user = getXemeliosUser();
+ StringBuffer xpathQuery = new StringBuffer();
+ Vector<CritereModel> critereModels = new Vector<CritereModel>();
+ try {
+ for(SearchParameterDTO searchParam:searchParams) {
+ processSearchParameter(searchSession.getElementModel(), searchParam, critereModels, xpathQuery, user);
+ }
+ } catch(SAXException saxEx) {
+ exceptionThrown = saxEx;
+ }
+ RechercheModel rm = new RechercheModel(RechercheModel.QN);
+ rm.setName(requestName);
+ rm.setId(requestId);
+ for(CritereModel cm:critereModels) try { rm.addChild(cm, CritereModel.QN); } catch(Exception ex) { exceptionThrown = ex; }
+ if(exceptionThrown==null) {
+ try {
+ DataLayerManager.getImplementation().saveRequest(searchSession.getElementModel(), rm, user);
+ } catch (DataConfigurationException ex) {
+ exceptionThrown = ex;
+ }
+ }
+ if(exceptionThrown!=null) {
+ logger.error("saveRequest(String,List<SearchParameterDTO>,String,String)",exceptionThrown);
+ ret = "ERROR";
+ }
+ return ret;
+ }
+ @Override
+ public List<StoredSearchDTO> getStoredSearchs(String searchSessionId) {
+ try {
+ String persistence = DataLayerManager.getImplementation().getLayerName();
+ List<StoredSearchDTO> toReturn = new ArrayList<StoredSearchDTO>();
+ for (PluginModel pm : getSearchSession(searchSessionId).getElementModel().getPlugins()) {
+ if (pm.getPluginType().equals(PluginModel.TYPE_SEARCH) && pm.isAvailableFor(persistence)) {
+ toReturn.add(new StoredSearchDTO(pm.getId(), pm.getDisplayName(), StoredSearchDTO.TYPE_SEARCH, pm.getResource()));
+ } else if (pm.getPluginType().equals(PluginModel.TYPE_EXPORT) && pm.isAvailableFor(persistence)) {
+ toReturn.add(new StoredSearchDTO(pm.getId(), pm.getDisplayName(), StoredSearchDTO.TYPE_EXPORT, pm.getResource()));
+ }
+ }
+ for(RechercheModel rm:DataLayerManager.getImplementation().getSavedRequests(getSearchSession(searchSessionId).getElementModel(), getXemeliosUser(), false)) {
+ toReturn.add(new StoredSearchDTO(rm.getId(),rm.getDisplayName(),StoredSearchDTO.TYPE_SAVED,rm.getResource()));
+ }
+
+ Collections.sort(toReturn, new Comparator<StoredSearchDTO>() {
+
+ public int compare(StoredSearchDTO o1, StoredSearchDTO o2) {
+ return o1.getLibelle().compareToIgnoreCase(o2.getLibelle());
+ }
+ });
+ return toReturn;
+ } catch (Exception e) {
+ logger.error("getStoredSearchs", e);
+ throw new RuntimeException(e);
+ }
+ }
+ @Override
+ public SearchInitParametersDTO getSearchInitParameters(String searchSessionId, String pluginId) {
+ try {
+ PluginModel pm = getPluginModel(searchSessionId, pluginId);
+ if (pm != null) {
+ ArrayList<CritereTypeDTO> requiredCriteresTypes = new ArrayList<CritereTypeDTO>();
+ for (CritereModel cm : pm.getCriteres()) {
+ requiredCriteresTypes.add(new CritereTypeDTO(cm.getId(), cm.getLibelle()));
+ }
+ ArrayList<CritereTypeDTO> optionalCriteresTypes = new ArrayList<CritereTypeDTO>();
+ for (CritereRefModel crm : pm.getCriteresOp()) {
+ CritereModel cm = getSearchSession(searchSessionId).getElementModel().getCritere(crm.getIdRef());
+ optionalCriteresTypes.add(new CritereTypeDTO(cm.getId(), cm.getLibelle()));
+ }
+ String importableElementLibelle = getSearchSession(searchSessionId).getEtatModel().getImportableElement().getTitre();
+ return new SearchInitParametersDTO(requiredCriteresTypes, optionalCriteresTypes, importableElementLibelle, pluginId, pluginTypeStrToInt(pm.getPluginType()));
+ }
+ return null;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+
+ public SearchInitParametersDTO getSearchInitParametersForSavedSearch(String searchSessionId, String searchId) {
+ try {
+ SearchSessionContainer.SearchSession ss = getSearchSession(searchSessionId);
+ XemeliosUser user = getXemeliosUser();
+ ElementModel em = ss.getElementModel();
+ RechercheModel rm = DataLayerManager.getImplementation().getSavedRequest(em, user, searchId);
+ ArrayList<CritereTypeDTO> requiredCriteresTypes = new ArrayList<CritereTypeDTO>();
+ for (CritereModel cm : rm.getCriteres()) {
+ Properties props = new Properties();
+ CritereTypeDTO critere = new CritereTypeDTO(cm.getId(), cm.getLibelle());
+ for(PropertyModel pm:cm.getValeurs()) {
+ critere.addProperty(pm.getName(), pm.getValue());
+ }
+ requiredCriteresTypes.add(critere);
+ }
+ return new SearchInitParametersDTO(requiredCriteresTypes, ss.getEtatModel().getImportableElement().getTitre());
+ } catch(Exception ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ private SearchResultDTO simpleSearch(String searchSessionId, String collectiviteId, String budgetId, List<SearchParameterDTO> searchParams) {
+ logger.debug("simpleSearch("+searchSessionId+","+collectiviteId+","+budgetId+"...)");
+ try {
+ Pair collectivite = XemeliosHelper.getCollectivite(getXemeliosUser(), getSearchSession(searchSessionId).getDocumentModel(), collectiviteId);
+ Pair budget = XemeliosHelper.getBudget(getXemeliosUser(), getSearchSession(searchSessionId).getDocumentModel(), collectiviteId, budgetId);
+ StringBuffer xpathQuery = new StringBuffer();
+ ElementModel elementModel = getSearchSession(searchSessionId).getElementModel();
+ xpathQuery.append(elementModel.getPath().getPath());
+ Vector<CritereModel> critereModels = new Vector<CritereModel>();
+ XemeliosUser user = getXemeliosUser();
+ for (SearchParameterDTO searchParam : searchParams) {
+ processSearchParameter(elementModel, searchParam, critereModels, xpathQuery,user);
+ }
+ // TODO champs optionnels...
+ DataResultSet dataResultSet = DataLayerManager.getImplementation().search(
+ elementModel,
+ collectivite,
+ budget,
+ xpathQuery.toString(),
+ getSearchSession(searchSessionId).getLrm(),
+ critereModels, getXemeliosUser());
+ // On conserve le dataResultSet pour pouvoir changer de page sans re-executer la recherche :
+ getSearchSession(searchSessionId).setDataResultSet(dataResultSet);
+ // On conserve aussi la collectivite et le budget :
+ getSearchSession(searchSessionId).setCollectivite(collectivite);
+ getSearchSession(searchSessionId).setBudget(budget);
+ return dataResultToSearchResult(dataResultSet, getSearchSession(searchSessionId).getLrm(), collectivite, budget,searchSessionId);
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+ private SearchResultDTO pluginSearch(String searchSessionId, String collectiviteId, String budgetId, List<SearchParameterDTO> searchParams, String pluginId) {
+ try {
+ Pair collectivite = XemeliosHelper.getCollectivite(getXemeliosUser(), getSearchSession(searchSessionId).getDocumentModel(), collectiviteId);
+ Pair budget = XemeliosHelper.getBudget(getXemeliosUser(), getSearchSession(searchSessionId).getDocumentModel(), collectiviteId, budgetId);
+ PluginModel plugin = getPluginModel(searchSessionId, pluginId);
+ Class clazz = Class.forName(plugin.getPluginClass());
+ Constructor cc = clazz.getConstructor(XemeliosUser.class);
+ SearchPlugin xp = (SearchPlugin) cc.newInstance(getXemeliosUser());
+ xp.setPluginModel(plugin);
+ xp.setCollectivite(collectivite);
+ xp.setBudget(budget);
+ xp.setParameters(getParameters(searchParams));
+ xp.setElementModel(getSearchSession(searchSessionId).getElementModel());
+ xp.setListeResultatModel(getSearchSession(searchSessionId).getLrm());
+ DataResultSet dataResultSet = xp.getResultSet();
+ // On conserve le dataResultSet pour pouvoir changer de page sans ré-exécuter la recherche :
+ getSearchSession(searchSessionId).setDataResultSet(dataResultSet);
+ // On conserve aussi la collectivite et le budget :
+ getSearchSession(searchSessionId).setCollectivite(collectivite);
+ getSearchSession(searchSessionId).setBudget(budget);
+ return dataResultToSearchResult(dataResultSet, getSearchSession(searchSessionId).getLrm(), collectivite, budget,searchSessionId);
+ } catch(Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ private Hashtable<String, String> getParameters(List<SearchParameterDTO> searchParams) {
+ Hashtable<String, String> toReturn = new Hashtable<String, String>();
+ for (SearchParameterDTO searchParam : searchParams) {
+ for (Map.Entry<String, String> entry : searchParam.getInputValues()) {
+ toReturn.put(entry.getKey(), entry.getValue());
+ }
+ }
+ return toReturn;
+ }
+ private static int pluginTypeStrToInt(String pluginType) {
+ if(PluginModel.TYPE_EXPORT.equals(pluginType)) return StoredSearchDTO.TYPE_EXPORT;
+ else if(PluginModel.TYPE_SEARCH.equals(pluginType)) return StoredSearchDTO.TYPE_SEARCH;
+ else return 0;
+ }
+
+ private void processSearchParameter(ElementModel elementModel, SearchParameterDTO searchParam, Vector<CritereModel> critereModels, StringBuffer xpathQuery,XemeliosUser user) throws SAXException {
+ CritereModel critereModel = elementModel.getCritere(searchParam.getCritereModelId()).clone();
+ if (searchParam.getOperator() != null) {
+ critereModel.addChild(new PropertyModel("AND_OR", searchParam.getOperator()), PropertyModel.QN);
+ if ("||".equals(searchParam.getOperator())) {
+ xpathQuery.append("|").append(elementModel.getPath().getPath());
+ }
+ }
+ String data = critereModel.getPath().getPath();
+ int pos = data.indexOf("##");
+ while (pos >= 0) {
+ int endPos = data.indexOf("##", pos + 2);
+ String pattern = data.substring(pos, endPos + 2);
+ String paramName = pattern.substring(2, pattern.length() - 2);
+// logger.debug("replacing " + paramName);
+ String paramValue = searchParam.getValue(paramName);
+ if (paramValue != null) {
+ // est-ce que le champ est un input et est-il de type date
+ for (XmlMarshallable champ : critereModel.getInputs()) {
+ if (champ instanceof InputModel) {
+ InputModel input = (InputModel) champ;
+ if ("VALEUR:".concat(input.getId()).equals(paramName)) {
+ // on enregistre la valeur dans les lastInput
+ try {
+ DataLayerManager.getImplementation().setLastInputValue(input.getId(),paramValue,user);
+ } catch(Exception ex) {
+ throw new RuntimeException(ex);
+ }
+ if ("date".equals(input.getDatatype())) {
+ // il faut convertir la date
+ SimpleDateFormat sdf = new SimpleDateFormat(XemeliosHelper.getApplicationProperties().getProperty(Constants.SYS_PROP_DATE_FORMAT));
+ Date d;
+ try {
+ d = sdf.parse(paramValue);
+ sdf = new SimpleDateFormat(input.getXmlDateFormat());
+ paramValue = sdf.format(d);
+ } catch (ParseException ex) {
+ logger.info("invalid date format: " + paramValue);
+ paramValue = "\"\"";
+ }
+ }
+ break;
+ } else if("OPERATEUR:".concat(input.getId()).equals(paramName)) {
+ try {
+ DataLayerManager.getImplementation().setLastInputValue(input.getId().concat(".OPERATEUR"),paramValue,user);
+ } catch(Exception ex) {
+ throw new RuntimeException(ex);
+ }
+
+ }
+ }
+ }
+ data = data.replace(pattern, paramValue);
+ } else {
+ data = data.replace(pattern, "\"\"");
+ }
+ pos = data.indexOf("##");
+ critereModel.addChild(new PropertyModel(paramName, paramValue), PropertyModel.QN);
+ }
+ data = data.replaceAll("\\{", "[").replaceAll("\\}", "]");
+ critereModels.add(critereModel);
+ xpathQuery.append(data);
+ }
+
+// private static String escapeHtml(String s) {
+// StringBuilder ret = new StringBuilder();
+// for (char c : s.toCharArray()) {
+// switch (c) {
+// case 'à':
+// ret.append("à");
+// break;
+// case 'ä':
+// ret.append("ä");
+// break;
+// case 'â':
+// ret.append("â");
+// break;
+// case 'é':
+// ret.append("é");
+// break;
+// case 'è':
+// ret.append("è");
+// break;
+// case 'ë':
+// ret.append("ë");
+// break;
+// case 'ê':
+// ret.append("ê");
+// break;
+// case 'ï':
+// ret.append("ï");
+// break;
+// case 'î':
+// ret.append("î");
+// break;
+// case 'ô':
+// ret.append("ô");
+// break;
+// case 'ö':
+// ret.append("ö");
+// break;
+// case 'ù':
+// ret.append("ù");
+// break;
+// case 'û':
+// ret.append("û");
+// break;
+// case 'ü':
+// ret.append("ü");
+// break;
+// case 'ÿ':
+// ret.append("ÿ");
+// break;
+// case '?':
+// ret.append("ŷ");
+// break;
+// case 'ç':
+// ret.append("ç");
+// break;
+// default:
+// ret.append(c);
+// }
+// }
+// return ret.toString();
+// }
+//
+ private static LabelValueDTO pairToLabelValueDTO(Pair pair) {
+ return new LabelValueDTO(pair.key, pair.libelle);
+ }
+
+ private static ArrayList<LabelValueDTO> pairsToLabelValueDTOs(List<Pair> pairs) {
+ ArrayList<LabelValueDTO> toReturn = new ArrayList<LabelValueDTO>();
+ for (Pair pair : pairs) {
+ toReturn.add(pairToLabelValueDTO(pair));
+ }
+ return toReturn;
+ }
+
+ @Override
+ public SelectOneCritereItemDTO getUpdatedSelectOneCritereItemDTO(String searchSessionId, String collectiviteId, String budgetId, String critereId, String selectId, Map<String, String> inputValuesById, String pluginId) {
+ logger.debug("getUpdatedSelectOneCritereItemDTO("+searchSessionId+","+collectiviteId+","+budgetId+","+critereId+","+selectId+",...,"+pluginId+")");
+ String smId = selectId.substring(selectId.indexOf(":") + 1);
+ CritereModel critereModel = getCritereModel(searchSessionId, critereId, pluginId);
+ for (XmlMarshallable xm : critereModel.getInputs()) {
+ if (xm instanceof SelectModel) {
+ SelectModel sm = (SelectModel) xm;
+ if (sm.getId().equals(smId)) {
+ // On a trouve le composant :
+ Collection<Pair> data = null;
+ data = sm.getNewRecipient();
+ if (sm.getOptions() != null) {
+ for (OptionModel om : sm.getOptions()) {
+ data.add(new Pair(om.getValue(), om.getLibelle()));
+ }
+ }
+ for (RecherchePaireModel rpm : sm.getRecherches()) {
+ if (rpm.getPath() != null) {
+ // on fait une requete dans le referentiel pour remplir la liste
+ try {
+ Collection<Pair> localData = null;
+ localData = rpm.getNewRecipient();
+
+ localData.addAll(DataLayerManager.getImplementation().queryRepository(getSearchSession(searchSessionId).getDocumentModel(), new Pair(collectiviteId, null), rpm, getXemeliosUser()));
+ data.addAll(localData);
+ } catch (Exception dbEx) {
+ throw new RuntimeException(dbEx);
+ }
+ }
+ }
+ // Il y a des dependances, on recherche les ##VALEUR:id##
+ for (SpecialKeyEntryModel skem : sm.getSpecialKeys()) {
+ if (skem.isDepends()) {
+ String path = skem.getKey1().getData();
+ String itemName = path.substring(2, path.length() - 2);
+ Collection<Pair> tmp = sm.getNewRecipient();
+ try {
+ if (skem.getPos() == 2) {
+ tmp.addAll(DataLayerManager.getImplementation().getSpecialKeys2(getSearchSession(searchSessionId).getDocumentModel(), new Pair(collectiviteId, null), new Pair(budgetId, null), new Pair(inputValuesById.get(itemName), inputValuesById.get(itemName)), skem.isDistinct(), getXemeliosUser()));
+ } else {
+ throw new RuntimeException("Not yet implemented");
+ }
+ } catch (UnauthorizedException ex) {
+ // on ajoute rien, et voilà !
+ } catch (DataConfigurationException ex) {
+ throw new RuntimeException(ex);
+ } catch (DataAccessException ex) {
+ throw new RuntimeException(ex);
+ }
+ data.addAll(tmp);
+ }
+ }
+ // Il y a des dependances, on recherche les ##VALEUR:id##
+ for (SpecialKeyEntryModel skem : sm.getSpecialKeys()) {
+ if (!skem.isDepends()) {// Si pas de dependance, on peut remplir maintenant :
+ try {
+ data.addAll(DataLayerManager.getImplementation().getSpecialKeys1(getSearchSession(searchSessionId).getDocumentModel(), new Pair(collectiviteId, null), new Pair(budgetId, null), skem.isDistinct(), getXemeliosUser()));
+ } catch (Exception dbEx) {
+ throw new RuntimeException(dbEx);
+ }
+ }
+ }
+ for (ResourceRefModel rrm : sm.getResources()) {
+ for (XmlMarshallable it : getSearchSession(searchSessionId).getDocumentModel().getResource(rrm.getRefId()).getData()) {
+ if (it instanceof OptionModel) {
+ OptionModel om = (OptionModel) it;
+ data.add(new Pair(om.getValue(), om.getLibelle()));
+ }
+ }
+ }
+ SelectOneCritereItemDTO selectOneCritereItem = new SelectOneCritereItemDTO("VALEUR:" + sm.getId());
+ for (Pair pair : data) {
+ LabelValueDTO labelValue = new LabelValueDTO(pair.key, pair.libelle);
+ selectOneCritereItem.addItem(labelValue);
+ if (sm.getValue() != null && sm.getValue().equals(pair.key)) {
+ selectOneCritereItem.setSelectedItem(labelValue);
+ }
+ }
+ return selectOneCritereItem;
+ }
+ }
+ }
+ return null;
+ }
+
+ private CritereModel getCritereModel(String searchSessionId, String critereId, String pluginId) {
+ if (pluginId == null) {
+ return getSearchSession(searchSessionId).getElementModel().getCritere(critereId);
+ } else {
+ for (CritereModel cm : getPluginModel(searchSessionId, pluginId).getCriteres()) {
+ if (cm.getId().equals(critereId)) {
+ return cm;
+ }
+ }
+ // On a pas trouve dans les criteres, on cherche dans les criteres optionnels :
+ for (CritereRefModel crm : getPluginModel(searchSessionId, pluginId).getCriteresOp()) {
+ CritereModel cm = getSearchSession(searchSessionId).getElementModel().getCritere(crm.getIdRef());
+ if (cm.getId().equals(critereId)) {
+ return cm;
+ }
+ }
+ }
+ return null;
+ }
+
+ private PluginModel getPluginModel(String searchSessionId, String pluginId) {
+ try {
+ String persistence = DataLayerManager.getImplementation().getLayerName();
+ for (PluginModel pm : getSearchSession(searchSessionId).getElementModel().getPlugins()) {
+ if ((pm.getPluginType().equals(PluginModel.TYPE_SEARCH) || pm.getPluginType().equals(PluginModel.TYPE_EXPORT)) && pm.isAvailableFor(persistence) && pluginId.equals(pm.getId())) {
+ return pm;
+ }
+ }
+ return null;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public ArrayList<CritereItemDTO> getCritereDefinition(String searchSessionId, String collectiviteId, String budgetId, String critereId, String pluginId) {
+ logger.debug("getCritereDefinition("+searchSessionId+","+collectiviteId+","+budgetId+","+critereId+","+pluginId+")");
+ Map<String, SelectOneCritereItemDTO> selectOneCritereItemByKey1 = new HashMap<String, SelectOneCritereItemDTO>();
+ ArrayList<CritereItemDTO> toReturn = new ArrayList<CritereItemDTO>();
+
+ CritereModel critereModel = getCritereModel(searchSessionId, critereId, pluginId);
+
+ for (XmlMarshallable xm : critereModel.getInputs()) {
+ if (xm instanceof InputModel) {
+ InputModel im = (InputModel) xm;
+ if (im.getLibelle() != null) {
+ LabelCritereItemDTO labelCritereItem = new LabelCritereItemDTO();
+ labelCritereItem.setLibelle(im.getLibelle());
+ toReturn.add(labelCritereItem);
+ }
+ String datatype = im.getDatatype();
+ if (datatype != null && !im.hasToRemoveOperator()) {
+ Pair pairs[] = null;
+ try {
+ pairs = DataLayerManager.getImplementation().getOperators(datatype);
+ String lastInputValue = DataLayerManager.getImplementation().getLastInputValue(im.getId() + ".OPERATEUR", getXemeliosUser());
+ if (pairs.length > 0) {
+ SelectOneCritereItemDTO operatorsSelect = new SelectOneCritereItemDTO("OPERATEUR:" + im.getId(), lastInputValue);
+ for (Pair pair : pairs) {
+ operatorsSelect.addItem(new LabelValueDTO(pair.key, pair.libelle));
+ }
+ toReturn.add(operatorsSelect);
+ }
+
+ } catch (Exception dbEx) {
+ throw new RuntimeException(dbEx);
+ }
+ }
+ InputCritereItemDTO input = null;
+ String lastInputValue = null;
+ try {
+ lastInputValue = DataLayerManager.getImplementation().getLastInputValue(im.getId(), getXemeliosUser());
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ }
+// String inputId =
+ if ("date".equals(im.getDatatype())) {
+ input = new DateCritereItemDTO("VALEUR:" + im.getId(), XemeliosHelper.getApplicationProperties().getProperty(Constants.SYS_PROP_DATE_FORMAT), lastInputValue);
+ } else if ("numeric".equals(im.getDatatype())) {
+ input = new NumericCritereItemDTO("VALEUR:" + im.getId(), lastInputValue);
+ } else {
+ input = new TextCritereItemDTO("VALEUR:" + im.getId(), lastInputValue);
+ ((TextCritereItemDTO) input).setUppercase(im.isUppercase());
+ ((TextCritereItemDTO) input).setHelpPath(im.getHelpPath());
+ if(im.getSearchHelper()!=null) {
+ SearchHelperDTO searchHelper = new SearchHelperDTO(im.getSearchHelper().getDocumentId(), im.getSearchHelper().getEtatId(), im.getSearchHelper().getElementId(), im.getSearchHelper().getReturnValueColumnId());
+ searchHelper.setConfigXPath(im.getSearchHelper().getConfigXPath());
+ ((TextCritereItemDTO)input).setSearchHelper(searchHelper);
+ }
+ }
+ toReturn.add(input);
+ } else if (xm instanceof SelectModel) {
+ SelectModel sm = (SelectModel) xm;
+ String lastInputValue = null;
+ try {
+ lastInputValue = DataLayerManager.getImplementation().getLastInputValue(sm.getId(), getXemeliosUser());
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ }
+ if (sm.getLibelle() != null) {
+ LabelCritereItemDTO labelCritereItem = new LabelCritereItemDTO();
+ labelCritereItem.setLibelle(sm.getLibelle());
+ toReturn.add(labelCritereItem);
+ }
+ Collection<Pair> data = null;
+ data = sm.getNewRecipient();
+ if (sm.getOptions() != null) {
+ for (OptionModel om : sm.getOptions()) {
+ data.add(new Pair(om.getValue(), om.getLibelle()));
+ }
+ }
+ for (RecherchePaireModel rpm : sm.getRecherches()) {
+ if (rpm.getPath() != null) {
+ // on fait une requete dans le referentiel pour remplir la liste
+ try {
+ Collection<Pair> localData = null;
+ localData = rpm.getNewRecipient();
+
+ localData.addAll(DataLayerManager.getImplementation().queryRepository(getSearchSession(searchSessionId).getDocumentModel(), new Pair(collectiviteId, null), rpm, getXemeliosUser()));
+ data.addAll(localData);
+ } catch (Exception dbEx) {
+ throw new RuntimeException(dbEx);
+ }
+ }
+ }
+ for (SpecialKeyEntryModel skem : sm.getSpecialKeys()) {
+ if (!skem.isDepends()) {
+ // Si pas de dependance, on peut remplir maintenant :
+ try {
+ data.addAll(DataLayerManager.getImplementation().getSpecialKeys1(getSearchSession(searchSessionId).getDocumentModel(), new Pair(collectiviteId, null), new Pair(budgetId, null), skem.isDistinct(), getXemeliosUser()));
+ } catch (Exception dbEx) {
+ throw new RuntimeException(dbEx);
+ }
+ }
+ }
+ for (ResourceRefModel rrm : sm.getResources()) {
+ for (XmlMarshallable it : getSearchSession(searchSessionId).getDocumentModel().getResource(rrm.getRefId()).getData()) {
+ if (it instanceof OptionModel) {
+ OptionModel om = (OptionModel) it;
+ data.add(new Pair(om.getValue(), om.getLibelle()));
+ }
+ }
+ }
+ SelectOneCritereItemDTO selectOneCritereItem = new SelectOneCritereItemDTO("VALEUR:" + sm.getId(), lastInputValue);
+ LabelValueDTO firstLabelValue = null;
+ int idx = 0;
+ for (Pair pair : data) {
+ LabelValueDTO labelValue = new LabelValueDTO(pair.key, pair.libelle);
+ if (idx == 0) {
+ firstLabelValue = labelValue;
+ }
+ idx++;
+ selectOneCritereItem.addItem(labelValue);
+ if (sm.getValue() != null && sm.getValue().equals(pair.key)) {
+ selectOneCritereItem.setSelectedItem(labelValue);
+ }
+ }
+ if (selectOneCritereItem.getSelectedItem() == null && firstLabelValue != null) {
+ selectOneCritereItem.setSelectedItem(firstLabelValue);
+ }
+ toReturn.add(selectOneCritereItem);
+ selectOneCritereItemByKey1.put("##VALEUR:" + sm.getId() + "##", selectOneCritereItem);
+ }
+ }
+ // Definition des dependances entre les champs :
+ for (XmlMarshallable xm : critereModel.getInputs()) {
+ if (xm instanceof SelectModel) {
+ SelectModel sm = (SelectModel) xm;
+ for (SpecialKeyEntryModel skem : sm.getSpecialKeys()) {
+ if (skem.isDepends()) {
+ SelectOneCritereItemDTO masterS = selectOneCritereItemByKey1.get(skem.getKey1().getData());
+ InputCritereItemDTO child = selectOneCritereItemByKey1.get("##VALEUR:" + sm.getId() + "##");
+ masterS.addCritereDependant(child);
+ child.addCritereMaitre(masterS);
+ }
+ }
+ }
+ }
+ // Définition des valeurs des champs dependants :
+ for (XmlMarshallable xm : critereModel.getInputs()) {
+ if (xm instanceof SelectModel) {
+ SelectModel sm = (SelectModel) xm;
+ for (SpecialKeyEntryModel skem : sm.getSpecialKeys()) {
+ if (skem.isDepends()) {
+ SelectOneCritereItemDTO child = selectOneCritereItemByKey1.get("##VALEUR:" + sm.getId() + "##");
+ Map<String, String> inputValuesById = new HashMap<String, String>();
+ for (InputCritereItemDTO inputCritereItemDTO : child.getCriteresMaitres()) {
+ if (inputCritereItemDTO instanceof SelectOneCritereItemDTO) {
+ SelectOneCritereItemDTO masterS = (SelectOneCritereItemDTO) inputCritereItemDTO;
+ if (masterS.getSelectedItem() != null) {
+ inputValuesById.put(inputCritereItemDTO.getInputId(), masterS.getSelectedItem().getValue());
+ }
+ }
+ }
+ SelectOneCritereItemDTO updatedSelectItems = getUpdatedSelectOneCritereItemDTO(searchSessionId, collectiviteId, budgetId, critereId, child.getInputId(), inputValuesById, pluginId);
+ if (updatedSelectItems != null) {
+ child.setItems(updatedSelectItems.getItems());
+ child.setSelectedItem(updatedSelectItems.getSelectedItem());
+ }
+ }
+ }
+ }
+ }
+ return toReturn;
+ }
+ private SearchResultDTO dataResultToSearchResult(DataResultSet dataResultSet, ListeResultatModel lrm,Pair collectivite, Pair budget,String searchSessionId) throws IOException, ParseException, SAXException {
+ SearchResultDTO toReturn = new SearchResultDTO();
+ try {
+ toReturn.getAdditionalInfos().setNavigable(lrm.getParent().getXslt()!=null);
+ for (ChampModel champModel : lrm.getListeChamps()) {
+ if(!champModel.isAfficheDefaut()) continue;
+ SearchResultDTO.ColumnDefinition columnDef = new SearchResultDTO.ColumnDefinition(champModel.getId(), champModel.getLibelle(), champModel.getDatatype(), champModel.isSommePossible());
+ if(ChampModel.DATATYPE_DATE.equals(champModel.getDatatype())) {
+ if(champModel.getDateFormat()!=null)
+ columnDef.setFormat(champModel.getDateFormat());
+ else
+ columnDef.setFormat(XemeliosHelper.getApplicationProperties().getProperty(Constants.SYS_PROP_DATE_FORMAT));
+ }
+ toReturn.addColumnDefinition(columnDef);
+ }
+ SearchResultDTO.ColumnDefinition docIdColumn = new SearchResultDTO.ColumnDefinition(DOC_ID_ENTRY, DOC_ID_ENTRY, "string", false);
+ docIdColumn.setDisplay(false);
+ toReturn.addColumnDefinition(docIdColumn);
+ for (HiddenModel hidden : lrm.getHiddens()) {
+ toReturn.addColumnDefinition(new SearchResultDTO.ColumnDefinition(hidden.getName()));
+ }
+logger.debug("début ajout données");
+ while (dataResultSet.hasNext()) {
+ DataHandler dataHandler = dataResultSet.next();
+ if(dataHandler!=null) {
+ RowResultDTO line = new RowResultDTO();
+ line.setDocId(dataHandler.getDocumentId());
+ int i = 0;
+ for (ChampModel champModel : lrm.getListeChamps()) {
+ if(!champModel.isAfficheDefaut()) {
+ // nothing to do, but do not continue !
+ } else {
+ Object value = dataHandler.getValueAtColumn(i);
+ String sVal = value != null ? value.toString() : null;
+ if(value instanceof PjRefHandler) {
+ PjRefHandler pjs = (PjRefHandler)value;
+ for(PJRefInfo pj:pjs.getPjs()) {
+ // TODO
+ }
+ } else {
+ /*if (value instanceof Date) {
+ SimpleDateFormat sdf = new SimpleDateFormat(XemeliosHelper.getApplicationProperties().getProperty(Constants.SYS_PROP_DATE_FORMAT));
+ sVal = sdf.format((Date) value);
+ } else*/ if(value instanceof Amount && value!=null) {
+ value = ((Amount)value).add(new BigDecimal(0.0));
+ }
+ if(value!=null &&
+ (
+ (value instanceof String) ||
+ (value instanceof BigDecimal) ||
+ (value instanceof Integer) ||
+ (value instanceof Date)
+ )
+ )
+ line.put(champModel.getId(), value);
+ }
+ }
+ i++;
+ }
+// line.put(DOC_ID_ENTRY, dataHandler.getDocumentId());
+ for (HiddenModel hidden : lrm.getHiddens()) {
+ Object value = dataHandler.getValueAtColumn(i);
+ if(value!=null)
+ line.put(hidden.getName(), value);
+ i++;
+ }
+// logger.debug(line);
+ toReturn.addDataRow(line);
+ }
+ }
+logger.debug("données ajoutées");
+ PaginationInfoDTO paginationInfoDTO = new PaginationInfoDTO();
+ paginationInfoDTO.setCurrentPageNumber(dataResultSet.getCurrentPage());
+ paginationInfoDTO.setPageCount(dataResultSet.getEstimatedPageCount());
+ paginationInfoDTO.setPageSize(getSearchSession(searchSessionId).getElementModel().getMaxDisplay());
+ toReturn.setCountAll(dataResultSet.getEstimatedSize());
+ toReturn.setPaginationInfo(paginationInfoDTO);
+ } catch(Throwable t) {
+ logger.error("dataResultToSearchResult", t);
+ }
+//logger.debug("returning result: "+toReturn);
+ return toReturn;
+ }
+
+ public ListResultatDTO getListResultatDTO(String searchSessionId) {
+ SearchSessionContainer.SearchSession ss = getSearchSession(searchSessionId);
+ ListeResultatModel lrm = ss.getLrm();
+ ListResultatDTO ret = new ListResultatDTO();
+ String _ordre = lrm.getTriDefaut();
+ String[] ordre = _ordre.split(",");
+ String[] sort = lrm.getOrdre().split(",");
+ ArrayList<DisplayableFieldDTO> sortedFields = new ArrayList<DisplayableFieldDTO>();
+ for(ChampModel cm:lrm.getListeChamps()) {
+ if(!cm.isAffichable()) continue;
+ DisplayableFieldDTO field = new DisplayableFieldDTO(cm.getId(), cm.getLibelle(), cm.isAfficheDefaut());
+ int ordrePos = findInStringArray(ordre,field.getId());
+ if(ordrePos>=0) {
+ field.setSortPosition(ordrePos);
+ field.setSortOrder("DESC".equals(sort[ordrePos])?DisplayableFieldDTO.SORT_ORDER_DESC:DisplayableFieldDTO.SORT_ORDER_ASC);
+ sortedFields.add(field);
+ }
+ ret.addField(field);
+ }
+ Collections.sort(sortedFields, new Comparator<DisplayableFieldDTO>() {
+ public int compare(DisplayableFieldDTO o1, DisplayableFieldDTO o2) {
+ return o1.getSortPosition()-o2.getSortPosition();
+ }
+ });
+ for(DisplayableFieldDTO field:sortedFields) ret.addSortField(field);
+ return ret;
+ }
+ public String setListResultatDTO(String searchSessionId, ListResultatDTO lr) {
+ try {
+ SearchSessionContainer.SearchSession ss = getSearchSession(searchSessionId);
+ ListeResultatModel lrm = ss.getLrm();
+ ArrayList<DisplayableFieldDTO> sortedFieldsLst = new ArrayList<DisplayableFieldDTO>();
+ for(DisplayableFieldDTO field:lr.getDisplayableFields()) sortedFieldsLst.add(field);
+ Collections.sort(sortedFieldsLst, new Comparator<DisplayableFieldDTO>() {
+ public int compare(DisplayableFieldDTO o1, DisplayableFieldDTO o2) {
+ return o1.getSortPosition()-o2.getSortPosition();
+ }
+ });
+ StringBuffer sortedFields = new StringBuffer();
+ StringBuffer sortOrders = new StringBuffer();
+ Vector<ChampModel> modified = new Vector<ChampModel>();
+ for(int i=0;i<lr.getDisplayableFields().size();i++) {
+ DisplayableFieldDTO field = lr.getDisplayableFields().get(i);
+ ChampModel cm = lrm.getChamps().get(field.getId());
+ if(cm==null) throw new Exception("Champ "+field.getId()+" non trouvé !");
+ else cm = cm.clone();
+ if(field.getSortOrder()!=DisplayableFieldDTO.SORT_ORDER_NO_SORT && field.getSortPosition()>=0 && !field.isDisplay()) {
+ throw new Exception(field.getId()+": on ne peut pas trier sur un champ non affiché.");
+ }
+ cm.setAfficheDefaut(field.isDisplay());
+ // tris
+ DisplayableFieldDTO field2 = sortedFieldsLst.get(i);
+ if(field2.getSortPosition()>=0) {
+ sortedFields.append(field2.getId()).append(",");
+ sortOrders.append(field2.getSortOrder()==DisplayableFieldDTO.SORT_ORDER_DESC?"DESC":"ASC").append(",");
+ }
+ modified.add(cm);
+ }
+ if(sortedFields.length()>0) sortedFields.deleteCharAt(sortedFields.length()-1);
+ if(sortOrders.length()>0) sortOrders.deleteCharAt(sortOrders.length()-1);
+ lrm.setTriDefaut(sortedFields.toString());
+ lrm.setOrdre(sortOrders.toString());
+ lrm.changeAllDisplayableChamps(modified);
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+ return null;
+ }
+// private static String jsEscape(String s) {
+// StringBuffer ret = new StringBuffer();
+// for(char c:s.toCharArray()) {
+// switch(c) {
+// case '\'': { ret.append("\\'"); break; }
+// case '"' : { ret.append("\\\""); break; }
+// default: ret.append(c);
+// }
+// }
+// logger.debug(ret.toString());
+// return ret.toString();
+// }
+ private int findInStringArray(String[] array,String what) {
+ int ret = -1;
+ for(int i=0;i<array.length;i++) {
+ if(what.equals(array[i])) {
+ ret = i;
+ break;
+ }
+ }
+ return ret;
+ }
+ public Integer getInteger() { return new Integer(0); }
+ public Date getDate() { return new Date(); }
+ public BigDecimal getBigDecimal() { return new BigDecimal(0); }
+
+ @Override
+ public SearchResultDTO loadPage(String searchSessionId, int pageNumber) {
+ try {
+ DataResultSet dataResultSet = getSearchSession(searchSessionId).getDataResultSet();
+ dataResultSet.setPage(pageNumber);
+ return dataResultToSearchResult(dataResultSet, getSearchSession(searchSessionId).getLrm(), getSearchSession(searchSessionId).getCollectivite(), getSearchSession(searchSessionId).getBudget(),searchSessionId);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ @Override
+ public List<String> getDistinctValues(String searchSessionId, String collectivite, String budget, String path) {
+ SearchSessionContainer.SearchSession searchSession = getSearchSession(searchSessionId);
+ XemeliosUser user = getXemeliosUser();
+ ElementModel element = searchSession.getElementModel();
+ Collection<String> coll = new Vector<String>();
+ try {
+ coll = DataLayerManager.getImplementation().getDistinctValues(element, new Pair(collectivite,collectivite), new Pair(budget,budget), path, user);
+ } catch(Exception ex) {
+ logger.error("getDistinctValues("+searchSessionId+","+collectivite+","+budget+","+path+")",ex);
+ coll.add(ex.getMessage());
+ }
+ ArrayList<String> list = new ArrayList<String>();
+ list.addAll(coll);
+ return list;
+ }
+ @Override
+ public boolean canSearch(String documentId, String etatId) {
+ boolean bRet = false;
+ XemeliosUser user = getXemeliosUser();
+ if(user.hasDocument(documentId)) {
+ DocumentModel dm = XemeliosHelper.getDocumentModel(documentId);
+ try {
+ bRet = DataLayerManager.getImplementation().canSearch(dm, dm.getEtatById(etatId), user);
+ } catch(Exception ex) {
+ // il n'y a vraiment pas de raison que ça se déclenche, mais on va toujours logger...
+ logger.error("canSearch("+documentId+","+etatId+")/"+user.getId()+":",ex);
+ }
+ }
+ return bRet;
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2010 axYus - www.axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+
+public class CollectiviteTreeDTO implements Serializable {
+ private String documentId;
+ private String libelleCollectivite;
+ private ArrayList<ParentCollectiviteDTO> parentModels;
+ private ArrayList<SpecialKeyDefDTO> specialKeys;
+
+ public CollectiviteTreeDTO() {
+ super();
+ parentModels = new ArrayList<ParentCollectiviteDTO>();
+ }
+
+ public String getDocumentId() {
+ return documentId;
+ }
+
+ public void setDocumentId(String documentId) {
+ this.documentId = documentId;
+ }
+ public int getCollectivitesParentModelCount() {
+ return parentModels.size();
+ }
+ public ParentCollectiviteDTO getParentModel(int i) {
+ return parentModels.get(i);
+ }
+ public void addParentCollectivite(ParentCollectiviteDTO pc) {
+ parentModels.add(pc);
+ }
+
+ public String getLibelleCollectivite() {
+ return libelleCollectivite;
+ }
+
+ public void setLibelleCollectivite(String libelleCollectivite) {
+ this.libelleCollectivite = libelleCollectivite;
+ }
+
+ public ArrayList<SpecialKeyDefDTO> getSpecialKeys() { return specialKeys; }
+
+ public void addSpecialKey(SpecialKeyDefDTO sk) {
+ if(specialKeys==null) specialKeys = new ArrayList<SpecialKeyDefDTO>();
+ specialKeys.add(sk);
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright
+ * 2009 axYus - www.axyus.com
+ * 2009 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+
+/**
+ *
+ * @author chm
+ */
+public class ConfigExportDTO implements java.io.Serializable {
+ private String id, docID, etatID, owner, dateCreation, code, libelle;
+ private ExportModelDTO exportModel = null;
+
+ public ConfigExportDTO() {
+ super();
+ }
+
+ public ConfigExportDTO(String id, String docId, String etatId, String owner, String dateCreation, String code, String libelle) {
+ this();
+ this.id=id;
+ this.docID=docId;
+ this.etatID=etatId;
+ this.owner=owner;
+ this.dateCreation=dateCreation;
+ this.code=code;
+ this.libelle=libelle;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public String getDateCreation() {
+ return dateCreation;
+ }
+
+ public void setDateCreation(String dateCreation) {
+ this.dateCreation = dateCreation;
+ }
+
+ public String getDocID() {
+ return docID;
+ }
+
+ public void setDocID(String docID) {
+ this.docID = docID;
+ }
+
+ public String getEtatID() {
+ return etatID;
+ }
+
+ public void setEtatID(String etatID) {
+ this.etatID = etatID;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLibelle() {
+ return libelle;
+ }
+
+ public void setLibelle(String libelle) {
+ this.libelle = libelle;
+ }
+
+ public String getOwner() {
+ return owner;
+ }
+
+ public void setOwner(String owner) {
+ this.owner = owner;
+ }
+
+ public ExportModelDTO getExportModel() {
+ return exportModel;
+ }
+
+ public void setExportModel(ExportModelDTO exportModel) {
+ this.exportModel = exportModel;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import java.util.ArrayList;
+
+/**
+ * @author CBO
+ */
+abstract public class CritereItemDTO implements java.io.Serializable {
+ private String lastInputValue = null;
+
+ public CritereItemDTO() {
+
+ }
+
+ abstract public void accept(CritereItemVisitor critereItemVisitor);
+ abstract public void accept(CritereItemVisitor critereItemVisitor, ArrayList<PropertyDTO> properties);
+ public String getLastInputValue() { return lastInputValue; };
+ public void setLastInputValue(String lastInputValue) { this.lastInputValue=lastInputValue; }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import java.util.ArrayList;
+
+/**
+ * @author CBO
+ */
+public interface CritereItemVisitor {
+
+ void visit(LabelCritereItemDTO labelCritereItem);
+
+ void visit(SelectOneCritereItemDTO SelectOneCritereItem);
+
+ void visit(TextCritereItemDTO inputTextCritereItem);
+
+ void visit(DateCritereItemDTO inputDateCritereItem);
+
+ void visit(NumericCritereItemDTO numericCritereItem);
+
+ void visit(LabelCritereItemDTO labelCritereItem, ArrayList<PropertyDTO> properties);
+
+ void visit(SelectOneCritereItemDTO SelectOneCritereItem, ArrayList<PropertyDTO> properties);
+
+ void visit(TextCritereItemDTO inputTextCritereItem, ArrayList<PropertyDTO> properties);
+
+ void visit(DateCritereItemDTO inputDateCritereItem, ArrayList<PropertyDTO> properties);
+
+ void visit(NumericCritereItemDTO numericCritereItem, ArrayList<PropertyDTO> properties);
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import java.util.ArrayList;
+
+/**
+ * @author CBO
+ */
+public class CritereTypeDTO implements java.io.Serializable {
+
+ private String id;
+ private String libelle;
+ private ArrayList<PropertyDTO> props;
+
+ public CritereTypeDTO() {
+ super();
+ props = new ArrayList<PropertyDTO>();
+ }
+
+ public CritereTypeDTO(String id, String libelle) {
+ this();
+ setId(id);
+ setLibelle(libelle);
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLibelle() {
+ return libelle;
+ }
+
+ public void setLibelle(String libelle) {
+ this.libelle = libelle;
+ }
+ public void addProperty(String pName, String value) {
+ PropertyDTO p = new PropertyDTO(pName,value);
+ props.add(p);
+ }
+
+ public ArrayList<PropertyDTO> getProperties() {
+ return props;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if(obj instanceof CritereTypeDTO) {
+ CritereTypeDTO other = (CritereTypeDTO)obj;
+ return getId().equals(other.getId());
+ } else {
+ return getId().equals(obj.toString());
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 3;
+ hash = 71 * hash + (this.id != null ? this.id.hashCode() : 0);
+ return hash;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import java.util.ArrayList;
+
+public class DateCritereItemDTO extends InputCritereItemDTO {
+
+ private String format;
+
+ protected DateCritereItemDTO() {/*used by gwt*/
+
+ }
+
+ public DateCritereItemDTO(String inputId, String format) {
+ super(inputId);
+ this.format = format;
+ }
+ public DateCritereItemDTO(String inputId, String format,String lastInputValue) {
+ this(inputId,format);
+ setLastInputValue(lastInputValue);
+ }
+
+ public String getFormat() {
+ return format;
+ }
+
+ @Override
+ public void accept(CritereItemVisitor critereItemVisitor) {
+ critereItemVisitor.visit(this);
+ }
+ @Override
+ public void accept(CritereItemVisitor critereItemVisitor,ArrayList<PropertyDTO> properties) {
+ critereItemVisitor.visit(this,properties);
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2009 axYus - www.axyus.com
+ * 2009 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+/**
+ *
+ * @author chm
+ */
+public class DisplayableFieldDTO implements java.io.Serializable {
+
+ public static final int SORT_POSITION_NO_SORT = -1;
+ public static final int SORT_ORDER_NO_SORT = -1;
+ public static final int SORT_ORDER_ASC = 0;
+ public static final int SORT_ORDER_DESC = 1;
+ private String id, libelle;
+ private boolean display;
+ private int sortPosition = -1;
+ private int sortOrder = -1;
+
+ public DisplayableFieldDTO() {
+ super();
+ id = null;
+ libelle = null;
+ display = false;
+ }
+ public DisplayableFieldDTO(String id, String libelle) {
+ this();
+ this.id=id;
+ this.libelle=libelle;
+ }
+ public DisplayableFieldDTO(String id, String libelle,boolean display) {
+ this(id,libelle);
+ this.display=display;
+ }
+ public DisplayableFieldDTO(String id,String libelle, boolean display, int sortPosition, int sortOrder) {
+ this(id,libelle,display);
+ this.sortPosition=sortPosition;
+ this.sortOrder=sortOrder;
+ }
+
+ public boolean isDisplay() {
+ return display;
+ }
+
+ public void setDisplay(boolean display) {
+ this.display = display;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLibelle() {
+ return libelle;
+ }
+
+ public void setLibelle(String libelle) {
+ this.libelle = libelle;
+ }
+
+ public int getSortOrder() {
+ return sortOrder;
+ }
+
+ public void setSortOrder(int sortOrder) {
+ this.sortOrder = sortOrder;
+ }
+
+ public int getSortPosition() {
+ return sortPosition;
+ }
+
+ public void setSortPosition(int sortPosition) {
+ this.sortPosition = sortPosition;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final DisplayableFieldDTO other = (DisplayableFieldDTO) obj;
+ if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 5;
+ hash = 59 * hash + (this.id != null ? this.id.hashCode() : 0);
+ return hash;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append("<champ id=\"").append(id).append("\" libelle=\"").append(libelle).append("\" display=\"").append(Boolean.toString(display)).append("\" sort-pos=\"").append(sortPosition).append("\" order=\"").append(sortOrder).append("\"/>");
+ return sb.toString();
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2009 axYus - www.axyus.com
+ * 2009 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import java.util.ArrayList;
+
+/**
+ *
+ * @author chm
+ */
+public class DocumentDTO implements java.io.Serializable {
+ private String id, libelle;
+ private ArrayList<EtatDTO> etats;
+
+ public DocumentDTO() {
+ super();
+ }
+
+ public DocumentDTO (String id, String libelle) {
+ this();
+ this.id=id;
+ this.libelle=libelle;
+ this.etats = new ArrayList<EtatDTO>();
+ }
+
+ public void addEtat(EtatDTO etat) {
+ etats.add(etat);
+ }
+
+ public ArrayList<EtatDTO> getEtats() {
+ return etats;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLibelle() {
+ return libelle;
+ }
+
+ public void setLibelle(String libelle) {
+ this.libelle = libelle;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2009 axYus - www.axyus.com
+ * 2009 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import java.util.ArrayList;
+
+/**
+ *
+ * @author chm
+ */
+public class DocumentsDTO implements java.io.Serializable {
+
+ private ArrayList<DocumentDTO> documents;
+
+ public DocumentsDTO() {
+ super();
+ documents = new ArrayList<DocumentDTO>();
+ }
+
+ public void addDocument(DocumentDTO doc) {
+ documents.add(doc);
+ }
+
+ public ArrayList<DocumentDTO> getDocuments() {
+ return documents;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2009 axYus - www.axyus.com
+ * 2009 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+/**
+ *
+ * @author chm
+ */
+//public class EtatDTO implements java.io.Serializable {
+public class EtatDTO implements java.io.Serializable {
+ private String id, libelle;
+ private boolean exportable=false, multiPage=false;
+
+ public EtatDTO() {
+ super();
+ }
+
+ public EtatDTO(String id, String libelle, boolean exportable, boolean multiPage) {
+ this();
+ this.id=id;
+ this.libelle=libelle;
+ this.exportable=exportable;
+ this.multiPage=multiPage;
+ }
+
+ public boolean isExportable() {
+ return exportable;
+ }
+
+ public void setExportable(boolean exportable) {
+ this.exportable = exportable;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLibelle() {
+ return libelle;
+ }
+
+ public void setLibelle(String libelle) {
+ this.libelle = libelle;
+ }
+
+ public boolean isMultiPage() {
+ return multiPage;
+ }
+
+ public void setMultiPage(boolean multiPage) {
+ this.multiPage = multiPage;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2009 axYus - www.axyus.com
+ * 2009 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+/**
+ *
+ * @author chm
+ */
+public class ExportChampDTO implements java.io.Serializable {
+
+ private String id=null, libelle=null;
+ private boolean editable=false, selectionne=false, identifiant=false;
+ private ExportElementDTO parent=null;
+
+ public ExportChampDTO() {
+ super();
+ }
+ public ExportChampDTO(String id, String libelle, boolean editable, boolean selectionne, boolean identifiant) {
+ this();
+ this.id=id;
+ this.libelle=libelle;
+ this.editable=editable;
+ this.selectionne=selectionne;
+ this.identifiant=identifiant;
+ }
+
+ public boolean isEditable() {
+ return editable;
+ }
+
+ public void setEditable(boolean editable) {
+ this.editable = editable;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public boolean isIdentifiant() {
+ return identifiant;
+ }
+
+ public void setIdentifiant(boolean identifiant) {
+ this.identifiant = identifiant;
+ }
+
+ public String getLibelle() {
+ return libelle;
+ }
+
+ public void setLibelle(String libelle) {
+ this.libelle = libelle;
+ }
+
+ public boolean isSelectionne() {
+ return selectionne;
+ }
+
+ public void setSelectionne(boolean selectionne) {
+ this.selectionne = selectionne;
+ }
+
+ public ExportElementDTO getParent() {
+ return parent;
+ }
+
+ public void setParent(ExportElementDTO parent) {
+ this.parent = parent;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2009 axYus - www.axyus.com
+ * 2009 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import java.util.ArrayList;
+
+/**
+ *
+ * @author chm
+ */
+//public class ExportElementDTO implements java.io.Serializable {
+public class ExportElementDTO implements java.io.Serializable {
+ private String id=null, libelle=null;
+ private ExportElementDTO parent=null;
+ private ArrayList<ExportChampDTO> champs = null;
+ private ArrayList<ExportElementDTO> enfants=null;
+
+ public ExportElementDTO() {
+ super();
+ champs = new ArrayList<ExportChampDTO>();
+ enfants = new ArrayList<ExportElementDTO>();
+ }
+ public ExportElementDTO(String id, String libelle) {
+ this();
+ this.id=id;
+ this.libelle=libelle;
+ }
+
+ public ArrayList<ExportChampDTO> getChamps() {
+ return champs;
+ }
+
+ public void setChamps(ArrayList<ExportChampDTO> champs) {
+ this.champs = champs;
+ }
+
+ public ArrayList<ExportElementDTO> getEnfants() {
+ return enfants;
+ }
+
+ public void setEnfants(ArrayList<ExportElementDTO> enfants) {
+ this.enfants = enfants;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+ public void addChamp(ExportChampDTO champ) {
+ champs.add(champ);
+ champ.setParent(this);
+ }
+ public void addEnfant(ExportElementDTO enfant) {
+ enfants.add(enfant);
+ enfant.setParent(this);
+ }
+
+ public String getLibelle() {
+ return libelle;
+ }
+
+ public void setLibelle(String libelle) {
+ this.libelle = libelle;
+ }
+
+ public ExportElementDTO getParent() {
+ return parent;
+ }
+
+ public void setParent(ExportElementDTO parent) {
+ this.parent = parent;
+ }
+ public boolean hasChampSelected() {
+ boolean ret = hasOwnChampSelected();
+ if(!ret) {
+ for(ExportElementDTO el:getEnfants()) {
+ if(el.hasChampSelected()) {
+ ret = true;
+ break;
+ }
+ }
+ }
+ return ret;
+ }
+ private boolean hasOwnChampSelected() {
+ boolean ret = false;
+ for(ExportChampDTO champ:getChamps()) {
+ if(champ.isSelectionne()) {
+ ret = true;
+ break;
+ }
+ }
+ return ret;
+ }
+
+ public void ensureKeysSelected() {
+ // warning, check if it is hasOwnChampSelected or hasChampSelected
+ if(hasOwnChampSelected()) {
+ selectKeys();
+ }
+ for(ExportElementDTO el:getEnfants()) {
+ el.ensureKeysSelected();
+ }
+ }
+ private void selectKeys() {
+ for(ExportChampDTO champ:getChamps()) {
+ if(champ.isIdentifiant()) champ.setSelectionne(true);
+ }
+ }
+ public ExportChampDTO getChampById(String id) {
+ for(ExportChampDTO champ:getChamps()) {
+ if(champ.getId().equals(id)) return champ;
+ }
+ return null;
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2009 axYus - www.axyus.com
+ * 2009 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+/**
+ * This class wrapps an ExportModel, with all exportable fields
+ * @author chm
+ */
+public class ExportModelDTO implements java.io.Serializable {
+
+ private String docId=null, etatId=null;
+ private String id=null, code=null, libelle=null;
+ private ExportElementDTO element = null;
+
+ public ExportModelDTO() {
+ super();
+ }
+ public ExportModelDTO(String id, String code, String libelle) {
+ this();
+ this.id=id;
+ this.code=code;
+ this.libelle=libelle;
+ }
+ public ExportModelDTO(String docId, String etatId, String id, String code, String libelle) {
+ this(id,code,libelle);
+ this.docId=docId;
+ this.etatId=etatId;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public String getDocId() {
+ return docId;
+ }
+
+ public void setDocId(String docId) {
+ this.docId = docId;
+ }
+
+ public ExportElementDTO getElement() {
+ return element;
+ }
+
+ public void setElement(ExportElementDTO element) {
+ this.element = element;
+ }
+
+ public String getEtatId() {
+ return etatId;
+ }
+
+ public void setEtatId(String etatId) {
+ this.etatId = etatId;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLibelle() {
+ return libelle;
+ }
+
+ public void setLibelle(String libelle) {
+ this.libelle = libelle;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2010 axYus - www.axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+/**
+ *
+ * @author cmarchand
+ */
+public interface HasMenuType {
+
+ /**
+ * Une entrée de menu ouvrant une fenêtre de recherche
+ */
+ String TYPE_SEARCH = "search";
+ /**
+ * Une entrée de menu pour naviguer dans le document
+ */
+ String TYPE_NAVIGATE = "navigate";
+ /**
+ * Une entrée de menu ouvrant une analyse
+ */
+ String TYPE_CONTROL = "control";
+ /**
+ * Une entrée de menu ouvrant un outil compagnon
+ */
+ String TYPE_COMPANION = "companion";
+ /**
+ * Une entrée de menu ouvrant une URL
+ */
+ String TYPE_LINK = "link";
+ /**
+ * Un menu ouvrant un sous-menu
+ */
+ String TYPE_PARENT = "parent";
+ /**
+ * Ce n'est pas un menu, juste un conteneur pour d'autres choses
+ */
+ String TYPE_NONE = "none";
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import java.util.ArrayList;
+
+/**
+ * @author CBO
+ */
+//public class InitParametersDTO implements java.io.Serializable {
+public class InitParametersDTO implements java.io.Serializable {
+
+ private String searchSessionId;
+ private ArrayList<LabelValueDTO> collectivites;
+ private ArrayList<LabelValueDTO> firstCollectiviteBudgets;
+ private SearchInitParametersDTO searchInitParameters;
+ private boolean hasRepository = true;
+ private boolean hasTooMuchCollectivites = false;
+ private String documentId, etatId, elementId;
+
+ public InitParametersDTO() {
+ }
+
+ public InitParametersDTO(String searchSessionId, ArrayList<LabelValueDTO> collectivites, ArrayList<LabelValueDTO> firstCollectiviteBudgets, boolean hasTooMuchCollectivites, String documentId, String etatId, String elementId, SearchInitParametersDTO searchInitParameters, boolean hasRepository) {
+ this.searchSessionId = searchSessionId;
+ this.collectivites = collectivites;
+ this.firstCollectiviteBudgets = firstCollectiviteBudgets;
+ this.searchInitParameters = searchInitParameters;
+ //this.critereTypes = critereTypes;
+ this.hasTooMuchCollectivites = hasTooMuchCollectivites;
+ this.hasRepository=hasRepository;
+ this.documentId=documentId;
+ this.etatId=etatId;
+ this.elementId=elementId;
+ }
+
+ public String getSearchSessionId() {
+ return searchSessionId;
+ }
+
+ public ArrayList<LabelValueDTO> getCollectivites() {
+ return collectivites;
+ }
+
+ public void setCollectivites(ArrayList<LabelValueDTO> collectivites) {
+ this.collectivites = collectivites;
+ }
+
+ public ArrayList<LabelValueDTO> getFirstCollectiviteBudgets() {
+ return firstCollectiviteBudgets;
+ }
+
+ public void setFirstCollectiviteBudgets(ArrayList<LabelValueDTO> firstCollectiviteBudgets) {
+ this.firstCollectiviteBudgets = firstCollectiviteBudgets;
+ }
+
+ public SearchInitParametersDTO getSearchInitParameters() {
+ return searchInitParameters;
+ }
+
+ public void setSearchInitParameters(SearchInitParametersDTO searchInitParameters) {
+ this.searchInitParameters = searchInitParameters;
+ }
+ public boolean hasRepository() { return hasRepository; }
+
+ public boolean hasTooMuchCollectivites() { return hasTooMuchCollectivites; }
+
+ public String getDocumentId() { return documentId; }
+
+ public String getElementId() {
+ return elementId;
+ }
+
+ public String getEtatId() {
+ return etatId;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import java.util.ArrayList;
+
+/**
+ * @author CBO
+ */
+abstract public class InputCritereItemDTO extends CritereItemDTO {
+
+ private String inputId;
+ private ArrayList<InputCritereItemDTO> criteresDependants;
+ private ArrayList<InputCritereItemDTO> criteresMaitres;
+
+ protected InputCritereItemDTO() {
+ this(null);
+ }
+
+ public InputCritereItemDTO(String inputId) {
+ this.inputId = inputId;
+ this.criteresDependants = new ArrayList<InputCritereItemDTO>();
+ this.criteresMaitres = new ArrayList<InputCritereItemDTO>();
+ }
+
+ public void addCritereMaitre(SelectOneCritereItemDTO critereMaitre) {
+ this.criteresMaitres.add(critereMaitre);
+ }
+
+ public ArrayList<InputCritereItemDTO> getCriteresMaitres() {
+ return criteresMaitres;
+ }
+
+ public String getInputId() {
+ return inputId;
+ }
+
+ public void addCritereDependant(InputCritereItemDTO critereItem) {
+ this.criteresDependants.add(critereItem);
+ }
+
+ public ArrayList<InputCritereItemDTO> getCriteresDependants() {
+ return criteresDependants;
+ }
+
+ @Override
+ public String toString() {
+ return getInputId();
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import java.util.ArrayList;
+
+/**
+ * @author CBO
+ */
+public class LabelCritereItemDTO extends CritereItemDTO {
+
+ private String libelle;
+
+ public LabelCritereItemDTO() {
+ }
+
+ public String getLibelle() {
+ return this.libelle;
+ }
+
+ public void setLibelle(String libelle) {
+ this.libelle = libelle;
+ }
+
+ public void accept(CritereItemVisitor critereItemVisitor) {
+ critereItemVisitor.visit(this);
+ }
+ public void accept(CritereItemVisitor critereItemVisitor, ArrayList<PropertyDTO> properties) {
+ critereItemVisitor.visit(this,properties);
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.Displayable;
+
+/**
+ * @author CBO
+ */
+public class LabelValueDTO implements java.io.Serializable, Displayable {
+
+ private String value;
+ private String label;
+
+ public LabelValueDTO() {
+
+ }
+
+ public LabelValueDTO(String value, String label) {
+ this.value = value;
+ this.label = label;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getId() {
+ return value;
+ }
+
+ public String getLibelle() {
+ return label;
+ }
+
+ public String getResource() {
+ return null;
+ }
+
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2009 axYus - www.axyus.com
+ * 2009 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import java.util.ArrayList;
+
+/**
+ *
+ * @author chm
+ */
+public class ListResultatDTO implements java.io.Serializable {
+ private ArrayList<DisplayableFieldDTO> fields;
+ private ArrayList<DisplayableFieldDTO> sortFields;
+
+ public ListResultatDTO() {
+ super();
+ fields=new ArrayList<DisplayableFieldDTO>();
+ sortFields=new ArrayList<DisplayableFieldDTO>();
+ }
+ public void addField(DisplayableFieldDTO field) {
+ if(!fields.contains(field)) fields.add(field);
+ }
+ public void mountField(int index) {
+ if(index>0) {
+ DisplayableFieldDTO field = fields.remove(index);
+ fields.add(index-1, field);
+ }
+ }
+ public void lowField(int index) {
+ if(index<fields.size()-1) {
+ DisplayableFieldDTO field = fields.remove(index);
+ fields.add(index+1, field);
+ }
+ }
+ public boolean addSortField(DisplayableFieldDTO field) {
+ if(!field.isDisplay() || field.getSortOrder()==DisplayableFieldDTO.SORT_ORDER_NO_SORT || field.getSortPosition()==DisplayableFieldDTO.SORT_POSITION_NO_SORT) return false;
+ sortFields.add(field.getSortPosition(), field);
+ return true;
+ }
+ public DisplayableFieldDTO removeSortField(int position) {
+ return sortFields.remove(position);
+ }
+ public ArrayList<DisplayableFieldDTO> getDisplayableFields() {
+ return fields;
+ }
+ public ArrayList<DisplayableFieldDTO> getSortedFields() {
+ return sortFields;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("<lr>\n");
+ sb.append("\t<fields>\n");
+ for(DisplayableFieldDTO field:fields) {
+ sb.append("\t\t").append(field.toString()).append("\n");
+ }
+ sb.append("\t</fields>\n");
+ sb.append("\t<sort>\n");
+ for(DisplayableFieldDTO field:sortFields) {
+ sb.append("\t\t").append(field.toString()).append("\n");
+ }
+ sb.append("\t</sort>\n</lr>\n");
+ return sb.toString();
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+
+public class Menu implements Serializable, HasMenuType {
+
+ private String id;
+ private String caption;
+ private String href;
+ private boolean page;
+ private String helperClassName;
+ private ArrayList<Menu> childs = new ArrayList<Menu>();
+ /**
+ * Pour permettre le traitement dans l'IHM
+ */
+ private String menuType;
+ /**
+ * Quand c'est un parent, de quoi est-il le parent
+ */
+ private String groupType;
+
+ public Menu() {
+ super();
+ }
+ public Menu(String groupType) {
+ super();
+ this.menuType = HasMenuType.TYPE_PARENT;
+ this.groupType = groupType;
+ }
+ public Menu(String menuType, String id, String href, String caption, boolean page) {
+ this();
+ this.menuType=menuType;
+ this.id = id;
+ this.href= href;
+ this.caption = caption;
+ this.page = page;
+ }
+ public Menu(String menuType, String id, String href, String caption, boolean page, String helperClassName) {
+ this(menuType, id, href, caption, page);
+ this.helperClassName = helperClassName;
+ }
+
+ public String getMenuType() {
+ return menuType;
+ }
+
+ public String getGroupType() {
+ return groupType;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getCaption() {
+ return caption;
+ }
+
+ public String getHref() {
+ return href;
+ }
+
+ public boolean isPage() {
+ return page;
+ }
+
+ public ArrayList<Menu> getChilds() {
+ return childs;
+ }
+
+ public void addChild(Menu menu) {
+ childs.add(menu);
+ }
+
+ @Override
+ public String toString() {
+ return toString("");
+ }
+
+ public String getHelperClassName() {
+ return helperClassName;
+ }
+
+ public void setHelperClassName(String helperClassName) {
+ this.helperClassName = helperClassName;
+ }
+
+ protected String toString(String prefix) {
+ StringBuilder sb = new StringBuilder();
+ sb.append(prefix).append("id=").append(id).append(" type=").append(menuType).append(" caption=\"").append(caption).append("\" page=").append(page).append("\n");
+ for(Menu child:childs) {
+ sb.append(child.toString(prefix.concat(" ")));
+ }
+ return sb.toString();
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import java.util.ArrayList;
+
+/**
+ * @author CBO
+ */
+public class NumericCritereItemDTO extends InputCritereItemDTO {
+
+ protected NumericCritereItemDTO() {
+ }
+
+ public NumericCritereItemDTO(String inputId) {
+ super(inputId);
+ }
+ public NumericCritereItemDTO(String inputId, String lastInputValue) {
+ this(inputId);
+ setLastInputValue(lastInputValue);
+ }
+
+ @Override
+ public void accept(CritereItemVisitor critereItemVisitor) {
+ critereItemVisitor.visit(this);
+ }
+
+ @Override
+ public void accept(CritereItemVisitor critereItemVisitor, ArrayList<PropertyDTO> properties) {
+ critereItemVisitor.visit(this,properties);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+//import fr.gouv.finances.dgfip.xemelios.web.gwt.client.widget.PaginationWidget.PaginationInfo;
+
+import java.io.Serializable;
+
+
+/**
+ * @author CBO
+ */
+public class PaginationInfoDTO implements Serializable {
+
+ private int pageCount;
+ private int currentPageNumber;
+ private int pageSize;
+
+ public int getPageCount() {
+ return pageCount;
+ }
+
+ public void setPageCount(int pageCount) {
+ this.pageCount = pageCount;
+ }
+
+ public int getCurrentPageNumber() {
+ return currentPageNumber;
+ }
+
+ public void setCurrentPageNumber(int currentPageNumber) {
+ this.currentPageNumber = currentPageNumber;
+ }
+
+ public int getPageSize() {
+ return pageSize;
+ }
+
+ public void setPageSize(int pageSize) {
+ this.pageSize = pageSize;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2010 axYus - www.axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import java.io.Serializable;
+
+public class ParentCollectiviteDTO implements Serializable {
+ private String documentId;
+ private String libelle;
+ private int level;
+
+ public ParentCollectiviteDTO() {
+ super();
+ }
+
+ public String getDocumentId() {
+ return documentId;
+ }
+
+ public void setDocumentId(String documentId) {
+ this.documentId = documentId;
+ }
+
+ public int getLevel() {
+ return level;
+ }
+
+ public void setLevel(int level) {
+ this.level = level;
+ }
+
+ public String getLibelle() {
+ return libelle;
+ }
+
+ public void setLibelle(String libelle) {
+ this.libelle = libelle;
+ }
+ @Override
+ public String toString() { return Integer.toString(level)+" - "+libelle; }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+/**
+ * Permet de transporter les informations d'une PJ entre le client et le serveur
+ * @author chm
+ */
+public class PjRefInfoDTO implements java.io.Serializable {
+ private String collectivite, id=null, nom=null, support=null;
+ public PjRefInfoDTO() {
+ super();
+ }
+ public PjRefInfoDTO(String collectivite, String id, String nom, String support) {
+ this();
+ this.collectivite=collectivite;
+ this.id=id;
+ this.nom=nom;
+ this.support=support;
+ }
+
+ public String getCollectivite() {
+ return collectivite;
+ }
+
+ public void setCollectivite(String collectivite) {
+ this.collectivite = collectivite;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getNom() {
+ return nom;
+ }
+
+ public void setNom(String nom) {
+ this.nom = nom;
+ }
+
+ public String getSupport() {
+ return support;
+ }
+
+ public void setSupport(String support) {
+ this.support = support;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+/**
+ *
+ * @author chm
+ */
+public class PropertyDTO implements java.io.Serializable {
+
+ String name;
+ String value;
+
+ public PropertyDTO() {
+ super();
+ }
+
+ public PropertyDTO(String name, String value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() { return name+"="+value; }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2011 axYus - www.axyus.com
+ * 2011 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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 of the License, or
+ * (at your option) any later version.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Set;
+
+/**
+ *
+ * @author cmarchand
+ */
+public class RowResultDTO /*extends HashMap<String, Object>*/ implements Serializable {
+ private String __docId;
+ private HashMap<String, Object> data;
+
+ public RowResultDTO() {
+ super();
+ data = new HashMap<String, Object>();
+ }
+
+ public String getStringValue(String key) {
+ return (String)data.get(key);
+ }
+
+ public Long getLongValue(String key) {
+ Object o = data.get(key);
+ if(o instanceof Integer) return new Long((Integer)o);
+ else return (Long)o;
+ }
+
+ public Date getDateValue(String key) {
+ return (Date)data.get(key);
+ }
+
+ public BigDecimal getBigDecimalValue(String key) {
+ return (BigDecimal)data.get(key);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("{");
+ for(String key:data.keySet()) {
+ Object value=data.get(key);
+ sb.append(key.toString()).append("=").append(value.toString()).append("(").append(value.getClass().getName()).append("), ");
+ }
+ sb.deleteCharAt(sb.length()-1);
+ sb.deleteCharAt(sb.length()-1);
+ sb.append("}");
+ return sb.toString();
+ }
+
+ public String getDocId() {
+ return __docId;
+ }
+
+ public void setDocId(String __docId) {
+ this.__docId = __docId;
+ }
+
+ public void put(String key, Object value) {
+ data.put(key, value);
+ }
+ public Set<String> getKeys() {
+ return data.keySet();
+ }
+ public Object getValue(String key) {
+ return data.get(key);
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2011 axYus - www.axyus.com
+ * 2011 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import java.io.Serializable;
+
+/**
+ * Porte les informations nécessaires à un search-helper
+ * @author cmarchand
+ */
+public class SearchHelperDTO implements Serializable {
+
+ private String targetDocumentId;
+ private String targetEtatId;
+ private String targetElementId;
+ private String idColumnToReturn;
+ private String configXPath;
+
+ public SearchHelperDTO() {
+ super();
+ }
+ public SearchHelperDTO(String targetDocumentId, String targetEtatId, String targetElementId) {
+ this();
+ this.targetDocumentId=targetDocumentId;
+ this.targetEtatId=targetEtatId;
+ this.targetElementId=targetElementId;
+ }
+ public SearchHelperDTO(String targetDocumentId, String targetEtatId, String targetElementId, String idColumnToReturn) {
+ this(targetDocumentId, targetEtatId, targetElementId);
+ this.idColumnToReturn = idColumnToReturn;
+ }
+
+ public String getIdColumnToReturn() {
+ return idColumnToReturn;
+ }
+
+ public String getTargetDocumentId() {
+ return targetDocumentId;
+ }
+
+ public String getTargetElementId() {
+ return targetElementId;
+ }
+
+ public String getTargetEtatId() {
+ return targetEtatId;
+ }
+
+ public String getConfigXPath() {
+ return configXPath;
+ }
+
+ public void setConfigXPath(String configXPath) {
+ this.configXPath = configXPath;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import java.util.ArrayList;
+
+/**
+ * @author CBO
+ * Représente les données nécessaires à l'initialisation d'une recherche.
+ * Cette classe est utilisée dans deux cas :
+ * - Quand on arrive sur la page de recherche
+ * - Quand on ouvre un plugin de recherche
+ */
+public class SearchInitParametersDTO implements java.io.Serializable {
+
+ private String pluginId;
+ private int pluginType = 0;
+ private ArrayList<CritereTypeDTO> mandatoryCritereTypes;
+ private ArrayList<CritereTypeDTO> optionalCritereTypes;
+ private String importableElementLibelle;
+
+ private SearchInitParametersDTO() {
+
+ }
+ /**
+ * Use this constructor when it is a simple search
+ * @param mandatoryCritereTypes
+ */
+ public SearchInitParametersDTO(ArrayList<CritereTypeDTO> mandatoryCritereTypes, String importableElementLibelle) {
+ this.mandatoryCritereTypes = mandatoryCritereTypes;
+ this.importableElementLibelle = importableElementLibelle;
+ }
+ public SearchInitParametersDTO(ArrayList<CritereTypeDTO> mandatoryCritereTypes, ArrayList<CritereTypeDTO> optionalCritereTypes, String importableElementLibelle) {
+ this(mandatoryCritereTypes, importableElementLibelle);
+ this.optionalCritereTypes=optionalCritereTypes;
+ }
+
+ /**
+ * Use this constructor when search is based on a plugin
+ * @param mandatoryCritereTypes
+ * @param optionalCritereTypes
+ * @param pluginId
+ */
+ public SearchInitParametersDTO(ArrayList<CritereTypeDTO> mandatoryCritereTypes, ArrayList<CritereTypeDTO> optionalCritereTypes, String importableElementLibelle, String pluginId, int pluginType) {
+ this(mandatoryCritereTypes,optionalCritereTypes, importableElementLibelle);
+ this.pluginId = pluginId;
+ this.pluginType=pluginType;
+ }
+
+ public ArrayList<CritereTypeDTO> getMandatoryCritereTypes() {
+ return mandatoryCritereTypes;
+ }
+
+ public ArrayList<CritereTypeDTO> getOptionalCritereTypes() {
+ return optionalCritereTypes;
+ }
+
+ public String getPluginId() {
+ return pluginId;
+ }
+
+ public int getPluginType() {
+ return pluginType;
+ }
+
+ public String getImportableElementLibelle() {
+ return importableElementLibelle;
+ }
+
+ public void setImportableElementLibelle(String importableElementLibelle) {
+ this.importableElementLibelle = importableElementLibelle;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+/**
+ * @author CBO
+ */
+public class SearchParameterDTO implements java.io.Serializable {
+
+ private String critereModelId;
+ private String operator;
+ private Map<String, String> inputValues = new HashMap<String, String>();
+
+ public SearchParameterDTO() {
+ }
+
+ public String getCritereModelId() {
+ return critereModelId;
+ }
+
+ public void setCritereModelId(String critereModelId) {
+ this.critereModelId = critereModelId;
+ }
+
+ public String getOperator() {
+ return operator;
+ }
+
+ public void setOperator(String operator) {
+ this.operator = operator;
+ }
+
+ public void putInputValue(String inputId, String value) {
+ this.inputValues.put(inputId, value);
+ }
+
+ public Set<Entry<String, String>> getInputValues() {
+ return inputValues.entrySet();
+ }
+
+ public String getValue(String inputId) {
+ return this.inputValues.get(inputId);
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author CBO
+ */
+public class SearchResultDTO implements java.io.Serializable {
+
+// private String xml;
+ private PaginationInfoDTO PaginationInfo;
+ private int countAll;
+ private AdditionalInformations additionalInfos;
+ private ArrayList<ColumnDefinition> columns;
+ private ArrayList<RowResultDTO> data;
+
+ public SearchResultDTO() {
+ super();
+ additionalInfos = new AdditionalInformations();
+ columns = new ArrayList<ColumnDefinition>();
+ data = new ArrayList<RowResultDTO>();
+ }
+
+// public String getXml() {
+// return xml;
+// }
+//
+// public void setXml(String xml) {
+// this.xml = xml;
+// }
+
+ public PaginationInfoDTO getPaginationInfo() {
+ return PaginationInfo;
+ }
+
+ public void setPaginationInfo(PaginationInfoDTO PaginationInfo) {
+ this.PaginationInfo = PaginationInfo;
+ }
+
+ public int getCountAll() {
+ return countAll;
+ }
+
+ public void setCountAll(int countAll) {
+ this.countAll = countAll;
+ }
+
+ public AdditionalInformations getAdditionalInfos() {
+ return additionalInfos;
+ }
+
+ public ArrayList<ColumnDefinition> getColumns() {
+ return columns;
+ }
+ /**
+ * Permet d'ajouter une nouelle colonne.
+ * Attention, l'ordre dans lequel les colonnes sont ajoutées sera l'ordre utilisé pour l'affichage
+ * @param column
+ */
+ public void addColumnDefinition(ColumnDefinition column) {
+ columns.add(column);
+ }
+ public void addDataRow(RowResultDTO row) {
+ data.add(row);
+ }
+ /**
+ * Renvoie les données
+ * @return
+ */
+ public List<RowResultDTO> getData() {
+ return data;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("paginationInfo=").append(PaginationInfo).append("\n");
+ sb.append("additionalInfo=").append(additionalInfos).append("\n");
+ sb.append("columnDef=").append(columns).append("\n");
+ sb.append("data=").append(data).append("n");
+ return sb.toString();
+ }
+
+ /**
+ * Additional informations on search result, as<ul><li>navigability</li><li>XeMeLios row-widgets</li></ul>
+ */
+ public static class AdditionalInformations implements java.io.Serializable {
+ /**
+ * Indique si on peut ou non visualiser le document
+ */
+ private boolean navigable = false;
+
+ public AdditionalInformations() {
+ super();
+ }
+
+ public boolean isNavigable() {
+ return navigable;
+ }
+
+ public void setNavigable(boolean navigable) {
+ this.navigable = navigable;
+ }
+
+ @Override
+ public String toString() {
+ return Boolean.toString(navigable);
+ }
+
+ }
+ public static class ColumnDefinition implements java.io.Serializable {
+ /**
+ * Identifiant de la colonne
+ */
+ private String id;
+ /**
+ * Libelle de la colonne
+ */
+ private String libelle;
+ /**
+ * Datatype de la colonne
+ */
+ private String datatype;
+ /**
+ * Format à adopter pour l'affichage (a ce jour, seulement pour les date/time)
+ */
+ private String format;
+ /**
+ * Indique si on peut faire ou non des opérations d'aggrégation sur cette colonne
+ */
+ private boolean aggregate;
+ /**
+ * Indique si on doit ou non afficher la colonne
+ */
+ private boolean display;
+ public ColumnDefinition() {
+ super();
+ display = true;
+ }
+ /**
+ * Crée une nouvelle définition de colonne visible
+ * @param id
+ * @param libelle
+ * @param datatype
+ * @param aggregate
+ */
+ public ColumnDefinition(String id, String libelle, String datatype, boolean aggregate) {
+ this();
+ this.id = id;
+ this.libelle = libelle;
+ this.datatype = datatype;
+ this.aggregate = aggregate;
+ }
+ /**
+ * Crée une nouvelle définition de colonne hidden ({@link fr.gouv.finances.dgfip.xemelios.common.config.HiddenModel})
+ * @param id
+ */
+ public ColumnDefinition(String id) {
+ this();
+ this.id = id;
+ this.libelle = id;
+ this.display = false;
+ }
+ public boolean isAggregate() {
+ return aggregate;
+ }
+
+ public void setAggregate(boolean aggregate) {
+ this.aggregate = aggregate;
+ }
+
+ public String getDatatype() {
+ return datatype;
+ }
+
+ public void setDatatype(String datatype) {
+ this.datatype = datatype;
+ }
+
+ public String getFormat() {
+ return format;
+ }
+
+ public void setFormat(String format) {
+ this.format = format;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLibelle() {
+ return libelle;
+ }
+
+ public void setLibelle(String libelle) {
+ this.libelle = libelle;
+ }
+
+ public boolean isDisplay() {
+ return display;
+ }
+
+ public void setDisplay(boolean display) {
+ this.display = display;
+ }
+
+ @Override
+ public String toString() {
+ return id;
+ }
+
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2009 axYus - www.axyus.com
+ * 2009 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+/**
+ *
+ * @author Christophe Marchand <christophe.marchand@axyus.com>
+ */
+public class SearchSessionDTO implements java.io.Serializable {
+ private String searchSessionId=null;
+ private String documentId = null;
+ private String etatId = null;
+ private String elementId = null;
+ private String collectivite=null;
+ private String budget=null;
+
+ public SearchSessionDTO() {
+ super();
+ }
+ public SearchSessionDTO(String searchSessionId, String documentId, String etatId, String elementId, String collectivite, String budget) {
+ this();
+ this.searchSessionId=searchSessionId;
+ this.documentId=documentId;
+ this.etatId=etatId;
+ this.elementId=elementId;
+ this.collectivite=collectivite;
+ this.budget=budget;
+ }
+
+ public String getBudget() {
+ return budget;
+ }
+
+ public void setBudget(String budget) {
+ this.budget = budget;
+ }
+
+ public String getCollectivite() {
+ return collectivite;
+ }
+
+ public void setCollectivite(String collectivite) {
+ this.collectivite = collectivite;
+ }
+
+ public String getDocumentId() {
+ return documentId;
+ }
+
+ public void setDocumentId(String documentId) {
+ this.documentId = documentId;
+ }
+
+ public String getElementId() {
+ return elementId;
+ }
+
+ public void setElementId(String elementId) {
+ this.elementId = elementId;
+ }
+
+ public String getEtatId() {
+ return etatId;
+ }
+
+ public void setEtatId(String etatId) {
+ this.etatId = etatId;
+ }
+
+ public String getSearchSessionId() {
+ return searchSessionId;
+ }
+
+ public void setSearchSessionId(String searchSessionId) {
+ this.searchSessionId = searchSessionId;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import java.util.ArrayList;
+
+/**
+ * @author CBO
+ */
+public class SelectOneCritereItemDTO extends InputCritereItemDTO {
+
+ private ArrayList<LabelValueDTO> items;
+ private LabelValueDTO selectedItem;
+
+ protected SelectOneCritereItemDTO() {
+ }
+
+ public SelectOneCritereItemDTO(String inputId) {
+ super(inputId);
+ this.items = new ArrayList<LabelValueDTO>();
+ }
+ public SelectOneCritereItemDTO(String inputId,String lastInputValue) {
+ this(inputId);
+ setLastInputValue(lastInputValue);
+ }
+
+ public void addItem(LabelValueDTO item) {
+ this.items.add(item);
+ }
+
+ public LabelValueDTO getSelectedItem() {
+ return this.selectedItem;
+ }
+
+ public void setSelectedItem(LabelValueDTO selectedItem) {
+ this.selectedItem = selectedItem;
+ }
+
+ public ArrayList<LabelValueDTO> getItems() {
+ return items;
+ }
+
+ public void setItems(ArrayList<LabelValueDTO> items) {
+ this.items = items;
+ }
+
+ public void accept(CritereItemVisitor critereItemVisitor) {
+ critereItemVisitor.visit(this);
+ }
+ @Override
+ public void accept(CritereItemVisitor critereItemVisitor, ArrayList<PropertyDTO> properties) {
+ critereItemVisitor.visit(this,properties);
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2010 axYus - www.axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import java.io.Serializable;
+
+public class SpecialKeyDefDTO implements Serializable {
+ private String documentId;
+ private String libelle;
+ private int pos;
+
+ public SpecialKeyDefDTO() {
+ super();
+ }
+ public SpecialKeyDefDTO setData(String documentId, String libelle, int pos) {
+ this.documentId=documentId;
+ this.libelle=libelle;
+ this.pos=pos;
+ return this;
+ }
+
+ public String getDocumentId() {
+ return documentId;
+ }
+
+ public void setDocumentId(String documentId) {
+ this.documentId = documentId;
+ }
+
+ public int getPos() {
+ return pos;
+ }
+
+ public void setPos(int level) {
+ this.pos = level;
+ }
+
+ public String getLibelle() {
+ return libelle;
+ }
+
+ public void setLibelle(String libelle) {
+ this.libelle = libelle;
+ }
+ @Override
+ public String toString() { return Integer.toString(pos)+" - "+libelle; }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.client.Displayable;
+
+/**
+ * @author CBO
+ */
+public class StoredSearchDTO implements java.io.Serializable, Displayable {
+ public static final int TYPE_SEARCH = 1;
+ public static final int TYPE_EXPORT = 2;
+ public static final int TYPE_SAVED = 3;
+
+ private String id;
+ private String libelle;
+ private int type;
+ private String resource;
+
+ public String getResource() {
+ return resource;
+ }
+
+ public void setResource(String resource) {
+ this.resource = resource;
+ }
+
+ public StoredSearchDTO() {
+ }
+
+ public StoredSearchDTO(String id, String libelle, int type, String resource) {
+ this.id=id;
+ this.libelle=libelle;
+ this.type=type;
+ this.resource=resource;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLibelle() {
+ return libelle;
+ }
+
+ public void setLibelle(String libelle) {
+ this.libelle = libelle;
+ }
+
+ public void setType(int type) {
+ this.type=type;
+ }
+ public int getType() {
+ return type;
+ }
+
+ @Override
+ public String toString() {
+ return getLibelle();
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.gwt.shared;
+
+import java.util.ArrayList;
+
+/**
+ * @author CBO
+ * @author CHM
+ */
+public class TextCritereItemDTO extends InputCritereItemDTO {
+
+ private boolean uppercase;
+ private String helpPath;
+ private SearchHelperDTO searchHelper;
+
+ protected TextCritereItemDTO() {
+ }
+
+ public TextCritereItemDTO(String inputId) {
+ super(inputId);
+ }
+ public TextCritereItemDTO(String inputId,String lastInputValue) {
+ this(inputId);
+ setLastInputValue(lastInputValue);
+ }
+
+ public boolean isUppercase() {
+ return uppercase;
+ }
+
+ public void setUppercase(boolean uppercase) {
+ this.uppercase = uppercase;
+ }
+
+ @Override
+ public void accept(CritereItemVisitor critereItemVisitor) {
+ critereItemVisitor.visit(this);
+ }
+ @Override
+ public void accept(CritereItemVisitor critereItemVisitor, ArrayList<PropertyDTO> properties) {
+ critereItemVisitor.visit(this,properties);
+ }
+
+ public String getHelpPath() {
+ return helpPath;
+ }
+
+ public void setHelpPath(String helpPath) {
+ this.helpPath = helpPath;
+ }
+
+ public SearchHelperDTO getSearchHelper() {
+ return searchHelper;
+ }
+
+ public void setSearchHelper(SearchHelperDTO searchHelper) {
+ this.searchHelper = searchHelper;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.navigate;
+
+import fr.gouv.finances.dgfip.utils.Pair;
+import fr.gouv.finances.dgfip.utils.xml.FactoryProvider;
+import fr.gouv.finances.dgfip.utils.xml.transform.CustomURIResolver;
+import fr.gouv.finances.dgfip.xemelios.auth.XemeliosUser;
+import fr.gouv.finances.dgfip.xemelios.common.config.DocumentModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.ElementModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.EtatModel;
+import fr.gouv.finances.dgfip.xemelios.data.DataLayerManager;
+import fr.gouv.finances.dgfip.xemelios.web2.app.XemeliosHelper;
+import fr.gouv.finances.dgfip.xemelios.web2.utils.AttributeHelper;
+import fr.gouv.finances.dgfip.xemelios.web2.utils.StdDispatchAction;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.w3c.dom.Document;
+
+public class DisplayDocumentAction extends StdDispatchAction {
+ private static final Logger logger = Logger.getLogger(DisplayDocumentAction.class);
+
+ @Override
+ public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
+ logger.debug(request.getQueryString());
+ Hashtable<String,Object> parameters = new Hashtable<String,Object>();
+ String documentId=null, etatId=null, elementId = null, docId = null;
+ String collectiviteCode=null, budgetCode=null, collectiviteLib=null, budgetLib=null;
+ String sk1=null, sk2=null;
+ HttpSession session = request.getSession();
+ XemeliosUser user = AttributeHelper.getUser(session);
+
+ for(Enumeration<String> names=request.getParameterNames();names.hasMoreElements();) {
+ String paramName = names.nextElement();
+ if(paramName.startsWith("xsl-param:")) {
+ String xslParamName = paramName.substring("xsl-param:".length());
+ String paramValue = URLDecoder.decode(request.getParameter(paramName), "UTF-8").trim();
+ parameters.put(xslParamName,paramValue);
+ } else if(paramName.equals("xsl:param")) {
+ // ignore it here
+ } else if("elementId".equals(paramName)) {
+ elementId = URLDecoder.decode(request.getParameter(paramName), "UTF-8").trim();
+ } else if("etatId".equals(paramName)) {
+ etatId = URLDecoder.decode(request.getParameter(paramName), "UTF-8").trim();
+ } else if("documentId".equals(paramName)) {
+ documentId = URLDecoder.decode(request.getParameter(paramName), "UTF-8").trim();
+ } else if("docId".equals(paramName)) {
+ docId = URLDecoder.decode(request.getParameter(paramName), "UTF-8").trim();
+ } else if("coll-code".equals(paramName)) {
+ collectiviteCode = URLDecoder.decode(request.getParameter(paramName), "UTF-8").trim();
+ } else if("budg-code".equals(paramName)) {
+ budgetCode = URLDecoder.decode(request.getParameter(paramName), "UTF-8").trim();
+ } else if("coll-lib".equals(paramName)) {
+ collectiviteLib = URLDecoder.decode(request.getParameter(paramName), "UTF-8").trim();
+ } else if("budg-lib".equals(paramName)) {
+ budgetLib = URLDecoder.decode(request.getParameter(paramName), "UTF-8").trim();
+ } else if("sp1".equals(paramName)) {
+ sk1 = URLDecoder.decode(request.getParameter(paramName), "UTF-8").trim();
+ } else if("sp2".equals(paramName)) {
+ sk2 = URLDecoder.decode(request.getParameter(paramName), "UTF-8").trim();
+ }
+ }
+ String[] xslParamsArray = request.getParameterValues("xsl:param");
+ if(xslParamsArray!=null) {
+ for(String xslParam:xslParamsArray) {
+ int virg = xslParam.indexOf(',');
+ String pName = xslParam.substring(1,virg);
+ String pValue = URLDecoder.decode(xslParam,"UTF-8").substring(virg+1,xslParam.length()-1);
+ parameters.put(pName,pValue);
+ }
+ }
+
+ Pair collectivite = new Pair(collectiviteCode,collectiviteLib);
+ Pair budget = new Pair(budgetCode,budgetLib);
+
+ if(documentId!=null && etatId!=null && elementId!=null) {
+ DocumentModel documentModel = XemeliosHelper.getDocumentModel(documentId);
+ if(documentModel==null) throw new IllegalArgumentException("documentId parameter ("+documentId+") does not correspond to an existing document id.");
+ EtatModel etatModel = documentModel.getEtatById(etatId);
+ if(etatModel==null) throw new IllegalArgumentException("etatId parameter ("+etatId+") does not correspond to an existing etat id within "+documentId+" document.");
+ ElementModel elementModel = etatModel.getElementById(elementId);
+ if(elementModel==null) throw new IllegalArgumentException("elementId parameter ("+elementId+") does not correspond to an existing element id within "+documentId+" document / "+etatId+" etat.");
+
+ XPath xp = XPathFactory.newInstance().newXPath();
+ xp.setNamespaceContext(documentModel.getNamespaces());
+ Document doc = null;
+ if(sk1==null && sk2==null)
+ doc = DataLayerManager.getImplementation().getDocumentAsDom(etatModel, collectivite, budget, docId, user);
+ else {
+ ArrayList<String> docs = DataLayerManager.getImplementation().getDocumentListFromSpecialKeys(elementModel, collectivite.key, budget.key, sk1, sk2, null, user);
+ if(docs.size()==1) {
+ doc = DataLayerManager.getImplementation().getDocumentAsDom(etatModel, collectivite, budget, docs.get(0), user);
+ } else if(docs.size()==0) {
+ throw new Exception("Document introuvable");
+ } else {
+ throw new Exception("Plusieurs documents répondent à ces critères");
+ }
+ }
+ if(doc==null) throw new Exception("Document introuvable: "+docId);
+ String idRepository = null;
+ if(documentModel.getReferenceNomenclaturePath()!=null && documentModel.getReferenceNomenclaturePath().getCodePath()!=null) {
+ idRepository = (String)xp.evaluate(documentModel.getReferenceNomenclaturePath().getCodePath().getPath(),doc.getDocumentElement(),XPathConstants.STRING);
+ }
+ if(idRepository!=null && !(idRepository.length()>0)){
+ idRepository=null;
+ }
+
+ Document repository = DataLayerManager.getImplementation().getRepositoryAsDom(documentModel,collectivite,idRepository,user);
+ if(repository!=null)
+ parameters.put("repository",repository);
+ parameters.put("config",XemeliosHelper.getDocumentsModel().getSmallDOM());
+ parameters.put("collectivite",collectiviteCode);
+ parameters.put("budget",budgetCode);
+ if(collectivite.libelle!=null)
+ parameters.put("collectivite-lib",collectivite.libelle);
+ if(budget.libelle!=null)
+ parameters.put("budget-lib",budget.libelle);
+ parameters.put("browser-destination", "internal"); // il faut une destination "internal" pour avoir les liens.
+ File f = null;
+ f = new File(new File(new File(System.getProperty("user.home")),"xemelios/documents-def-ovrrd"),elementModel.getXslt());
+ if(!f.exists())
+ f = new File(documentModel.getBaseDirectory(),elementModel.getXslt());
+ logger.debug("XSL: "+f);
+ InputStream is = new FileInputStream(f);
+ TransformerFactory tFactory = FactoryProvider.getTransformerFactory();
+ tFactory.setURIResolver(new CustomURIResolver(tFactory.getURIResolver(), f.getParentFile().toURI().toURL().toExternalForm()));
+ Transformer firstTrans = tFactory.newTransformer(new StreamSource(is));
+ logger.debug("firstTrans="+firstTrans);
+ for(String key:parameters.keySet()) {
+ if(key!=null) {
+ if(parameters.get(key)!=null) {
+ logger.debug("passing xsl param: "+key+","+parameters.get(key));
+ firstTrans.setParameter(key, parameters.get(key));
+ }
+ }
+ }
+ firstTrans.setParameter("config", XemeliosHelper.getDocumentsModel().getSmallDOM());
+ firstTrans.setParameter("displayedDocId", docId);
+ /* Ajout d'un paramètre pour l'impression*/
+ firstTrans.setParameter("is.web", "1");
+ firstTrans.setParameter("context.path", request.getContextPath());
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ firstTrans.transform(new DOMSource(doc), new StreamResult(baos));
+ is.close();
+
+ File xslFile = new File(getServlet().getServletContext().getRealPath("/utils/href-converter.xsl"));
+
+ tFactory = FactoryProvider.getTransformerFactory();
+ Transformer transformer = tFactory.newTransformer(new StreamSource(xslFile));
+ transformer.setParameter("server",request.getServerName());
+ transformer.setParameter("context",request.getContextPath());
+ transformer.setParameter("port",request.getServerPort());
+ transformer.setParameter("navigationId", request.getParameter("navigationId"));
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ AttributeHelper.setPreviousView(session,request.getParameter("navigationId"), request.getServletPath()+"?"+request.getQueryString());
+ transformer.transform(new StreamSource(bais), new StreamResult(response.getOutputStream()));
+ }
+ return null;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.navigate;
+
+import fr.gouv.finances.dgfip.utils.IoUtils;
+import fr.gouv.finances.dgfip.utils.Pair;
+import fr.gouv.finances.dgfip.utils.xml.FactoryProvider;
+import fr.gouv.finances.dgfip.utils.xml.transform.CustomURIResolver;
+import fr.gouv.finances.dgfip.xemelios.auth.XemeliosUser;
+import fr.gouv.finances.dgfip.xemelios.common.config.DocumentModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.ElementModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.EtatModel;
+import fr.gouv.finances.dgfip.xemelios.data.DataLayerManager;
+import fr.gouv.finances.dgfip.xemelios.web2.app.XemeliosHelper;
+import fr.gouv.finances.dgfip.xemelios.web2.utils.AttributeHelper;
+import fr.gouv.finances.dgfip.xemelios.web2.utils.StdDispatchAction;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Vector;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+import net.sf.saxon.xpath.XPathFactoryImpl;
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.w3c.dom.Document;
+
+public class NavigateAction extends StdDispatchAction {
+ private static final Logger logger = Logger.getLogger(NavigateAction.class);
+
+ @Override
+ public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
+ logger.debug(request.getQueryString());
+ HttpSession session = request.getSession();
+ XemeliosUser user = AttributeHelper.getUser(session);
+ XPathFactory xpf = new XPathFactoryImpl();
+
+ String docId = request.getParameter("docId");
+ String etatId = request.getParameter("etatId");
+ String elementId = request.getParameter("elementId");
+ String collectivite = request.getParameter("collectivite");
+ String budget = request.getParameter("budget");
+ String path = request.getParameter("path");
+ String sp1 = request.getParameter("sp1");
+ String sp2 = request.getParameter("sp2");
+ String sp3 = request.getParameter("sp3");
+ String[] xslParamsArray = request.getParameterValues("xsl:param");
+
+ if(docId==null || docId.length()==0) throw new IllegalArgumentException("parameter docId is not specified");
+ DocumentModel documentModel = XemeliosHelper.getDocumentModel(docId);
+ if(documentModel==null) throw new IllegalArgumentException(docId+" is not a valid document ID");
+ if(etatId==null || etatId.length()==0) throw new IllegalArgumentException("parameter etatId is not specified");
+ EtatModel etatModel = documentModel.getEtatById(etatId);
+ if(etatModel==null) throw new IllegalArgumentException(etatId+" is not a valid etat ID within "+documentModel.getTitre());
+ if(elementId==null || elementId.length()==0) throw new IllegalArgumentException("parameter elementId is not specified");
+ ElementModel elementModel = etatModel.getElementById(elementId);
+ if(elementModel==null) throw new IllegalArgumentException(elementId+" is not a valid element ID within "+documentModel.getTitre()+" / "+etatModel.getTitre());
+ if(collectivite==null || collectivite.length()==0) throw new IllegalArgumentException("parameter collectivite is not specified");
+ // TODO: mettre la hierarchie des collectivites
+ // TODO: creer une getCollectiviteByCode
+ Vector<Pair> collectivites = DataLayerManager.getImplementation().getCollectivites(documentModel, null, user);
+ Pair coll = null;
+ for(Pair p:collectivites) {
+ if(p.key.equals(collectivite)) {
+ coll=p;
+ break;
+ }
+ }
+ if(coll==null) throw new IllegalArgumentException(collectivite+" is not a valid collectivite ID for "+documentModel.getId());
+ if(budget==null || budget.length()==0) throw new IllegalArgumentException("parameter budget is no specified");
+ Vector<Pair> budgets = DataLayerManager.getImplementation().getBudgets(documentModel, coll, user);
+ Pair budg = null;
+ for(Pair p:budgets) {
+ if(p.key.equals(budget)) {
+ budg = p;
+ break;
+ }
+ }
+ if(budg==null) throw new IllegalArgumentException(budget+" is not a valid budget ID within collectivite "+collectivite);
+ String documentId = null;
+ String errorMessage = null;
+ if(path==null) {
+ ArrayList<String> documents = DataLayerManager.getImplementation().getDocumentListFromSpecialKeys(elementModel,coll.key,budg.key,sp1,sp2,null,user);
+ if(documents.size()==0) {
+ errorMessage = "Le document est introuvable";
+ } else if(documents.size()>1 && !etatModel.isMultiPage()) {
+ errorMessage = "Plusieurs documents répondant à ces critères ont été trouvés.";
+ } else {
+ docId = documents.get(0);
+ }
+ } else {
+// config XPath
+ String _path = new String(path);
+ int pos = _path.indexOf('%');
+ while(pos>=0) {
+ int closing = _path.indexOf('%', pos+1);
+ if(closing<0) throw new RuntimeException("a '%' is not closed! : "+_path);
+ String paramName = _path.substring(pos+1, closing);
+ if(request.getParameter(paramName)!=null && request.getParameter(paramName).length()>0) {
+ String begin = _path.substring(0,pos);
+ String end = _path.substring(closing+1);
+ String replacedValue = request.getParameter(paramName);
+ _path = begin.concat(replacedValue).concat(end);
+ pos = _path.indexOf('%', pos);
+ } else {
+ pos = _path.indexOf('%', closing);
+ }
+ }
+ path = _path;
+
+ if(path!=null && path.startsWith("[")) {
+ path = elementModel.getPath().getFormattedPath()+path;
+ }
+ ArrayList<String> documents = DataLayerManager.getImplementation().getDocumentListFromXPath(elementModel,coll.key,budg.key,sp1,sp2,null,path, user);
+ if(documents.size()==0) {
+ //errorMessage = "Le document est introuvable";
+ errorMessage = "Aucun "+documentModel.getEtatById(etatId).getTitre()+" trouvé";
+ } else if(documents.size()>1 && !etatModel.isMultiPage()) {
+ errorMessage = "Plusieurs documents répondant à ces critères ont été trouvés.";
+ } else {
+ documentId = documents.get(0);
+ }
+ }
+ if(documentId!=null) {
+logger.debug("found "+documentId);
+ Document doc = DataLayerManager.getImplementation().getDocumentAsDom(etatModel,coll,budg,documentId, user);
+ File f = null;
+ f = new File(new File(new File(System.getProperty("user.home")),"xemelios/documents-def-ovrrd"),elementModel.getXslt());
+ if(!f.exists())
+ f = new File(etatModel.getParent().getBaseDirectory(),elementModel.getXslt());
+ InputStream is = IoUtils.getInputStream(f.getPath());
+ Hashtable<String,Object> parameters = new Hashtable<String,Object>();
+ if(xslParamsArray!=null) {
+ for(String xslParam:xslParamsArray) {
+ int virg = xslParam.indexOf(',');
+ String pName = xslParam.substring(1,virg);
+ String pValue = xslParam.substring(virg+1,xslParam.length()-1);
+
+ int pos2 = pValue.indexOf('%'); // interprétation des xsl:param avec valeurs de formulaires
+ while(pos2>=0) {
+ int closing = pValue.indexOf('%', pos2+1);
+ if(closing<0) throw new RuntimeException("a '%' is not closed! : "+pValue);
+ String paramNam = pValue.substring(pos2+1, closing);
+ if(request.getParameter(paramNam)!=null) {
+ String begin = pValue.substring(0,pos2);
+ String end = pValue.substring(closing+1);
+ String replacedValue = request.getParameter(paramNam);
+ pValue = begin.concat(replacedValue).concat(end);
+ pos2 = pValue.indexOf('%', pos2);
+ } else {
+ pos2 = pValue.indexOf('%', closing);
+ }
+ }
+ parameters.put(pName,pValue);
+ logger.debug("Adding xsl:param("+pName+","+pValue+")");
+ }
+ }
+ parameters.put("browser-destination", "internal"); // il faut une destination "internal" pour avoir les liens.
+ XPath xp = xpf.newXPath();
+ xp.setNamespaceContext(documentModel.getNamespaces());
+ String idRepository = null;
+ if(documentModel.getReferenceNomenclaturePath()!=null && documentModel.getReferenceNomenclaturePath().getCodePath()!=null) {
+ idRepository = (String)xp.evaluate(documentModel.getReferenceNomenclaturePath().getCodePath().getPath(),doc.getDocumentElement(),XPathConstants.STRING);
+ }
+ if(idRepository!=null && idRepository.length()==0) idRepository=null;
+ Document repository = DataLayerManager.getImplementation().getRepositoryAsDom(documentModel, coll,idRepository,user);
+ if(repository!=null)
+ parameters.put("repository", repository);
+ // on passe la config
+ parameters.put("config",XemeliosHelper.getDocumentsModel().getSmallDOM());
+ parameters.put("collectivite",collectivite);
+ parameters.put("budget",budget);
+ TransformerFactory tFactory = FactoryProvider.getTransformerFactory();
+ tFactory.setURIResolver(new CustomURIResolver(tFactory.getURIResolver(), f.getParentFile().toURI().toURL().toExternalForm()));
+ Transformer transformer = tFactory.newTransformer(new StreamSource(f));
+ for(String pName:parameters.keySet()) {
+ logger.info("passing xsl param: ("+pName+","+parameters.get(pName)+")");
+ transformer.setParameter(pName, parameters.get(pName));
+ }
+ /* Ajout d'un paramètre pour l'impression*/
+ transformer.setParameter("is.web", "1");
+ transformer.setParameter("context.path", request.getContextPath());
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ transformer.transform(new DOMSource(doc), new StreamResult(baos));
+
+ File xslFile = new File(getServlet().getServletContext().getRealPath("/utils/href-converter.xsl"));
+
+ tFactory = FactoryProvider.getTransformerFactory();
+ Transformer secondTransformer = tFactory.newTransformer(new StreamSource(xslFile));
+ secondTransformer.setParameter("server",request.getServerName());
+ secondTransformer.setParameter("context",request.getContextPath());
+ secondTransformer.setParameter("port",request.getServerPort());
+ secondTransformer.setParameter("navigationId", request.getParameter("navigationId"));
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ AttributeHelper.setPreviousView(session, request.getParameter("navigationId"), request.getServletPath()+"?"+request.getQueryString());
+ secondTransformer.transform(new StreamSource(bais), new StreamResult(response.getOutputStream()));
+ } else {
+ String url = AttributeHelper.getPreviousView(session,request.getParameter("navigationId")).concat("&xsl:param=(error.message,").concat(errorMessage).concat(")");
+ return new ActionForward(url);
+ }
+ return null;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2009 axYus - www.axyus.com
+ * 2009 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.navigate;
+
+import fr.gouv.finances.dgfip.xemelios.web2.utils.StdDispatchAction;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+/**
+ *
+ * @author chm
+ */
+public class ResourceProvider extends StdDispatchAction {
+ private static final Logger logger = Logger.getLogger(ResourceProvider.class);
+
+ @Override
+ public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
+ String query = request.getQueryString();
+ int pos = query.indexOf("&");
+ if(pos>=0) {
+ query = query.substring(0, pos);
+ }
+// logger.debug("query="+query);
+ return new ActionForward("/WEB-INF/resources/"+query);
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2009 axYus - www.axyus.com
+ * 2009 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.navigate;
+
+import fr.gouv.finances.dgfip.utils.IoUtils;
+import fr.gouv.finances.dgfip.utils.Pair;
+import fr.gouv.finances.dgfip.utils.xml.FactoryProvider;
+import fr.gouv.finances.dgfip.xemelios.auth.XemeliosUser;
+import fr.gouv.finances.dgfip.xemelios.common.config.DocumentModel;
+import fr.gouv.finances.dgfip.xemelios.common.config.Loader;
+import fr.gouv.finances.dgfip.xemelios.data.DataLayerManager;
+import fr.gouv.finances.dgfip.xemelios.web2.utils.AttributeHelper;
+import fr.gouv.finances.dgfip.xemelios.web2.utils.StdDispatchAction;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Iterator;
+import java.util.Vector;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.XMLConstants;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ *
+ * @author Christophe Marchand <christophe.marchand@axyus.com>
+ */
+public class ShowReferentiel extends StdDispatchAction {
+
+ private static final org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(ShowReferentiel.class);
+
+ @Override
+ protected ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
+ XemeliosUser user = AttributeHelper.getUser(request.getSession());
+
+ String docId = request.getParameter("docId");
+ String collectivite = request.getParameter("collectivite");
+ try {
+ DocumentModel dm = Loader.getDocumentsInfos(null).getDocumentById(docId);
+ Pair coll = new Pair(collectivite, collectivite);
+ // TODO : fusion nomenclatures pour afficher le referentiel
+ Vector<Document> vXmlData = DataLayerManager.getImplementation().getRepositorysAsDom(dm, coll, user);
+ if (vXmlData.size() == 0) {
+ return mapping.findForward("noRef");
+ }
+
+ XPath xp = XPathFactory.newInstance().newXPath();
+ xp.setNamespaceContext(new LocalNSCtx(dm.getNamespaces().getNamespaceURI("n")));
+
+ Vector<Node> vRepository = new Vector<Node>();
+ Node repository;
+ for (Document docXml : vXmlData) {
+ repository = (Node) xp.evaluate("//n:" + dm.getReferentiel(), docXml.getDocumentElement(), XPathConstants.NODE);
+ vRepository.add(repository);
+ }
+ Document docRoot = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
+
+ Element el = docRoot.createElementNS(vXmlData.get(0).getDocumentElement().getNamespaceURI(), vXmlData.get(0).getDocumentElement().getNodeName());
+ docRoot.appendChild(el);
+ //docRoot.appendChild(docRoot.adoptNode(vXmlData.get(0).getDocumentElement()));
+
+ for (int i = 0; i < vXmlData.get(0).getDocumentElement().getChildNodes().getLength(); i++) {
+ Node current = vXmlData.get(0).getDocumentElement().getChildNodes().item(i);
+ if (!current.getNodeName().equals("Nomenclatures") && Node.TEXT_NODE != current.getNodeType()) {
+ docRoot.adoptNode(current);
+ docRoot.getDocumentElement().appendChild(current);
+ }
+ }
+
+ if (vRepository != null && vRepository.size() > 0) {
+ for (int i = 0; i < vRepository.size(); i++) {
+ Node nomencl = vRepository.get(i);
+ if (nomencl != null) {
+ docRoot.adoptNode(nomencl);
+ docRoot.getDocumentElement().appendChild(nomencl);
+ }
+ }
+ }
+
+ File f = new File(new File(dm.getBaseDirectory()), dm.getReferentielXsltFile());
+ InputStream is = IoUtils.getInputStream(f.getPath());
+ //InputStream htmlStream = DematTransform.transform(docRoot.getDocumentElement(),is,f.getParentFile().toURI().toURL().toExternalForm());
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ TransformerFactory factory = FactoryProvider.getTransformerFactory();
+ Transformer t = factory.newTransformer(new StreamSource(f));
+ t.transform(new DOMSource(docRoot), new StreamResult(baos));
+ OutputStream os = response.getOutputStream();
+ os.write(baos.toByteArray());
+ os.flush();
+ os.close();
+
+ } catch (Exception ex) {
+ logger.error("while displaying repository: ", ex);
+ }
+
+
+ return null;
+ }
+
+ private static class LocalNSCtx implements NamespaceContext {
+
+ private static String URI;
+
+ public LocalNSCtx(String uri) {
+ URI = uri;
+ }
+
+ public String getNamespaceURI(String prefix) {
+ if ("".equals(prefix)) {
+ return XMLConstants.NULL_NS_URI;
+ } else if ("n".equals(prefix)) {
+ return URI;
+ } else if (XMLConstants.XML_NS_PREFIX.equals(prefix)) {
+ return XMLConstants.XML_NS_URI;
+ } else if (XMLConstants.XMLNS_ATTRIBUTE.equals(prefix)) {
+ return XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
+ } else {
+ return XMLConstants.NULL_NS_URI;
+ }
+ }
+
+ public String getPrefix(String namespaceURI) {
+ if (URI.equals(namespaceURI)) {
+ return "n";
+ } else if (XMLConstants.XML_NS_URI.equals(namespaceURI)) {
+ return XMLConstants.XML_NS_PREFIX;
+ } else if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) {
+ return XMLConstants.XMLNS_ATTRIBUTE;
+ } else {
+ return XMLConstants.DEFAULT_NS_PREFIX;
+ }
+ }
+
+ public Iterator getPrefixes(String namespaceURI) {
+ return new StringIterator(getPrefix(namespaceURI));
+ }
+ }
+
+ private static class StringIterator<String> implements Iterator<String> {
+
+ private String s;
+ private boolean get = false;
+
+ public StringIterator(String s) {
+ super();
+ this.s = s;
+ }
+
+ public boolean hasNext() {
+ return !get;
+ }
+
+ public String next() {
+ get = true;
+ return s;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.utils;
+
+import fr.gouv.finances.dgfip.xemelios.auth.XemeliosUser;
+import fr.gouv.finances.dgfip.xemelios.web2.gwt.shared.Menu;
+import java.util.LinkedHashMap;
+import java.util.Map.Entry;
+
+import javax.servlet.http.HttpSession;
+
+/**
+ * @author CBO
+ */
+public class AttributeHelper {
+
+ static private final String USER_SAN = "xemeliosUser";
+ static private final String MENU_SAN = "menu";
+// static private final String FIL_ARIANE_SAN = "filAriane";
+// private static final String NAV_CTX = "naivgation.context";
+ private static final String PREVIOUS_VIEW = "previous.view";
+
+ static public XemeliosUser getUser(HttpSession session) {
+ return (XemeliosUser) session.getAttribute(USER_SAN);
+ }
+
+ static public void setUser(HttpSession session, XemeliosUser user) {
+ session.setAttribute(USER_SAN, user);
+ }
+
+ static public Menu getMenu(HttpSession session) {
+ return (Menu) session.getAttribute(MENU_SAN);
+ }
+
+ static public void setMenu(HttpSession session, Menu menu) {
+ session.setAttribute(MENU_SAN, menu);
+ }
+
+// static public FilAriane getFilAriane(HttpSession session) {
+// return (FilAriane) session.getAttribute(FIL_ARIANE_SAN);
+// }
+//
+// static public void setFilAriane(HttpSession session, FilAriane filAriane) {
+// session.setAttribute(FIL_ARIANE_SAN, filAriane);
+// }
+// public static void setNavigationContext(HttpSession session, NavigationContext ctx) {
+// session.setAttribute(NAV_CTX,ctx);
+// }
+// public static NavigationContext getNavigationContext(HttpSession session) {
+// return (NavigationContext)session.getAttribute(NAV_CTX);
+// }
+ public static void setPreviousView(HttpSession session, String navigationId, String previousView) {
+ LinkedHashMap<String,String> table = (LinkedHashMap<String,String>)session.getAttribute(PREVIOUS_VIEW);
+ if(table==null) {
+ table = new LinkedHashMap<String, String>(5,0.3f,true) {
+
+ @Override
+ protected boolean removeEldestEntry(Entry<String, String> eldest) {
+ // pour ne pas faire grossir intempestivement la chose...
+ return size()>10;
+ }
+
+ };
+ session.setAttribute(PREVIOUS_VIEW, table);
+ }
+ table.put(navigationId, previousView);
+ }
+ public static String getPreviousView(HttpSession session, String navigationId) {
+ LinkedHashMap<String,String> table = (LinkedHashMap<String,String>)session.getAttribute(PREVIOUS_VIEW);
+ if(table==null) return null;
+ return table.get(navigationId);
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2010 axYus - www.axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.utils;
+
+import fr.gouv.finances.dgfip.xemelios.web2.app.Application;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+public class ServletContextListenerImpl implements ServletContextListener {
+
+ @Override
+ public void contextDestroyed(ServletContextEvent evt) {
+ Application.stop(evt);
+
+ }
+
+ @Override
+ public void contextInitialized(ServletContextEvent evt) {
+ Application.start(evt);
+
+ }
+
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.utils;
+
+import fr.gouv.finances.dgfip.xemelios.auth.XemeliosUser;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import org.apache.struts.Globals;
+import org.apache.struts.action.ActionErrors;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.actions.DispatchAction;
+
+/**
+ * @author CBO
+ */
+public class StdDispatchAction extends DispatchAction {
+
+ protected String getMessage(HttpServletRequest request, String key) {
+ return getResources(request).getMessage(getLocale(request), key);
+ }
+
+ protected String getMessage(HttpServletRequest request, String key, Object arg) {
+ return getResources(request).getMessage(getLocale(request), key, arg);
+ }
+
+ protected String getMessage(HttpServletRequest request, String key, Object arg1, Object arg2) {
+ return getResources(request).getMessage(getLocale(request), key, arg1, arg1);
+ }
+
+ protected String getMessage(HttpServletRequest request, String key, Object args[]) {
+ return getResources(request).getMessage(getLocale(request), key, args);
+ }
+
+ protected boolean validate(ActionMapping mapping, ActionForm form, HttpServletRequest request) {
+ ActionErrors errors = form.validate( mapping, request );
+
+ if ( errors != null && !errors.isEmpty() ) {
+ request.getSession().setAttribute(Globals.ERROR_KEY, errors);
+ return false;
+ }
+ else return true;
+ }
+
+ protected boolean hasRole(HttpSession session, String role) {
+ XemeliosUser user = AttributeHelper.getUser(session);
+ return user != null && user.hasRole(role);
+ }
+
+ /**
+ * Vérifie que l'utilisateur dispose des bons droits, si ce n'est pas le cas,
+ * une exception est levée
+ * @param session
+ * @param role role à tester
+ * @return
+ */
+ protected void checkRole(HttpSession session, String role) throws UnauthorizedAccessException {
+ if (!hasRole(session, role))
+ throw new UnauthorizedAccessException();
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 T.Antalick - thomas.antalick@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.utils;
+
+/**
+ * Jett�e en cas d'acc�s interdit
+ * @author thomas.antalick
+ */
+@SuppressWarnings("serial")
+public class UnauthorizedAccessException extends Exception {
+
+ public UnauthorizedAccessException(String message) {
+ super(message);
+ }
+
+ public UnauthorizedAccessException() {
+ super();
+ }
+}
--- /dev/null
+/*
+ * Copyright
+ * 2008 axYus - www.axyus.com
+ * 2008 C.Bosquet - charles.bosquet@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.web2.utils.filter;
+
+import fr.gouv.finances.dgfip.xemelios.auth.XemeliosUser;
+import fr.gouv.finances.dgfip.xemelios.web2.utils.AttributeHelper;
+import java.io.IOException;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import org.apache.log4j.MDC;
+
+/**
+ * @author CBO
+ */
+public class Log4jMDCServletFilter implements Filter {
+
+ static private long conversationId = 0;
+
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+ try {
+ if (MDC.get("user") == null) {
+ MDC.put("user", getUser(request));
+ }
+ if (MDC.get("ip") == null) {
+ MDC.put("ip", getIP(request));
+ }
+ if (MDC.get("convId") == null) {
+ MDC.put("convId", getConversationId());
+ }
+ chain.doFilter(request, response);
+ } finally {
+ MDC.remove("user");
+ MDC.remove("ip");
+ MDC.remove("convId");
+ }
+ }
+
+ private HttpSession getNullableSession(ServletRequest request) {
+ if (request instanceof HttpServletRequest) {
+ return ((HttpServletRequest) request).getSession(false);
+ } else {
+ return null;
+ }
+ }
+
+ private synchronized String getConversationId() {
+ return "" + conversationId++;
+ }
+
+ private String getUser(ServletRequest request) {
+ HttpSession session = getNullableSession(request);
+ if (session != null) {
+ XemeliosUser user = AttributeHelper.getUser(session);
+ if (user != null) {
+ return user.getDisplayName() != null ? user.getDisplayName() : "anonyme";
+ }
+ }
+ return "anonyme";
+ }
+
+ private String getIP(ServletRequest request) {
+ return request.getRemoteAddr();
+ }
+
+ public void init(FilterConfig filterConfig) throws ServletException {
+ }
+
+ public void destroy() {
+ }
+}
+
+
--- /dev/null
+application.nom=XeMeLios
+application.release=X.x.x.y
+
+errors.header=<table border="0" width="100%"><tr><td class="texteErreur"><ul>
+errors.footer=</ul></td></tr></table>
+errors.prefix=<li>
+errors.suffix=</li>
+errors.required=Le champ {0} est obligatoire
+errors.numeric=Le champ {0} doit \u00EAtre au format num\u00E9rique
+errors.date=Le champ {0} doit \u00EAtre au format jj/mm/aaaa
+
+commun.valider=Valider
+
+connexion.titreEcran=Connexion
+connexion.codeEcran=A010
+connexion.identifiant=Identifiant
+connexion.motDePasse=Mot de passe
+connexion.erreur.authentificationFail=Identifiant ou mot de passe incorrect, ou utilisateur invalide
+connexion.sessionExpiree=Votre session a expir\u00E9
+
+accueil.codeEcran=A010
+accueil.titreEcran=Accueil
+
+search.codeEcran=A020
+search.titreEcran=<h1>Recherche - </h1><h2>{0}</h2>
+search.noDataFound=Aucun document de type {0} n'a \u00E9t\u00E9 import\u00E9.<br/>Vous devez en importer au moins un avant d'effecter une recherche.
+
+imports.codeEcran=A030
+imports.titreEcran=Imports
+imports.file=Fichier
+imports.drop.date=Date dépôt
+imports.status=Statut
+imports.date.process=Date traitement
+imports.new.import=Nouvel import
+imports.file.to.import=Fichier à importer:
+imports.file.type=Type du fichier:
+imports.import=Importer
+
+import-detail.file=Fichier
+import-detail.fileType=Type du fichier
+import-detail.selectFileType=Sélectionnez un type de fichier
+import-detail.collectivite=Collectivité
+import-detail.selectCollectivite=Sélectionnez une collectivité
+import-detail.existing-collectivite=Collectivité existante
+import-detail.codeCollectivite=Code collectivité (SIREN ou IdColl)
+import-detail.libCollectivite=Libellé collectivité
+import-detail.existing-budget=Budget existant
+import-detail.selectBudget=Sélectionnez un budget
+import-detail.codeBudget=Code Budget
+import-detail.libBudget=Libellé budget
+
+exports.codeEcran=A040
+exports.titreEcran=<h1>Mes exports</h1>
+exports.Nom=Nom
+exports.Document=Document
+exports.Etat=Etat
+exports.SubmitDate=Date
+exports.Status=Statut
+exports.Comment=Commentaire
+exports.Priority=Priorité
+
+noReferentiel.codeEcran=A050
+noReferentiel.titreEcran=Visualisation d'un référentiel
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Context antiJARLocking="true" path="/xemelios"/>
--- /dev/null
+<%@ page language="java" pageEncoding="ISO-8859-15" contentType="text/html; charset=ISO-8859-15" %>
+
+<%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean" %>
+<%@ taglib prefix="html" uri="http://struts.apache.org/tags-html" %>
+<% boolean isLoginRequired = ((Boolean)request.getAttribute("isLoginRequired")).booleanValue();
+ boolean isPasswordRequired = ((Boolean)request.getAttribute("isPasswordRequired")).booleanValue(); %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
+ <head>
+ <link rel="stylesheet" href="css/standard.css" type="text/css"/>
+ <!--[if IE 6]>
+ <link rel="stylesheet" href="css/ie6.css" type="text/css"/>
+ <![endif]-->
+ <!--[if IE 5]>
+ <link rel="stylesheet" href="css/ie6.css" type="text/css"/>
+ <link rel="stylesheet" href="css/ie5.5.css" type="text/css"/>
+ <![endif]-->
+ <link rel="icon" type="image/png" href="<%=request.getContextPath()%>/img/favicon.png"/>
+ <title><bean:message key="application.nom"/> - <bean:message key="connexion.titreEcran"/> - <bean:message key="connexion.codeEcran"/></title>
+ <script>
+ // Remove frames :
+ if (top.location != self.location) {
+ top.location = self.location;
+ }
+ function setFocus() {
+ <% if(isLoginRequired) {%>
+ document.connexionForm.login.focus();
+ <% } else if(isPasswordRequired) {%>
+ document.connexionForm.password.focus();
+ <% } %>
+ }
+
+ function go() {
+ document.forms['connexionForm'].submit();
+ }
+ </script>
+ </head>
+ <body onload="setFocus()">
+
+ <%@ include file="/WEB-INF/jsp/include/message.jsp" %>
+ <div id="LoginContainer">
+ <div id="LoginLogoPanel"><br /><bean:message key="application.release"/><br />
+ </div>
+ <div id="LoginPanel">
+ <html:form action="connexion" method="POST">
+ <html:hidden property="dispatchMethod" value="processUserInputs"/>
+ <input type="hidden" name="dispatchMethod" value="processUserInputs"/>
+ <table id="logintable">
+ <% if(isLoginRequired) { %>
+ <tr>
+ <td class="text"> <bean:message key="connexion.identifiant"/> </td>
+ <td class="Operator"><html:text property="login" styleClass="zoneSaisissable"/></td>
+ </tr>
+ <% } %>
+
+ <%if(isPasswordRequired) { %>
+ <tr>
+ <td class="text"> <bean:message key="connexion.motDePasse"/></td>
+ <td class="Operator"><html:password property="password" styleClass="zoneSaisissable"/></td>
+ </tr>
+ <% } %>
+ <tr>
+ <td colspan="2" style="text-align: center;">
+ <a id="loginbtn" href="javascript:go();"><bean:message key="commun.valider"/></a>
+ <input type="image" src="<%=request.getContextPath()%>/img/1x1blank.gif" style="border: none;"/>
+ </td>
+ </tr>
+ </table>
+ </html:form>
+ </div>
+ </div>
+ </body>
+</html>
--- /dev/null
+<%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean" %>
+<%@ taglib prefix="html" uri="http://struts.apache.org/tags-html" %>
+<script>
+ function hideDialog() {
+ var dialogBox = document.getElementById("dialogBox");
+ dialogBox.style.visibility = "hidden";
+ }
+
+ function showDialog(content) {
+ var dialogBox = document.getElementById("dialogBox");
+ var dialogContent = document.getElementById("dialogContent");
+ dialogContent.innerHTML = content;
+ dialogBox.style.visibility = "visible";
+ }
+</script>
+<div id="dialogBox" style="visibility: hidden; position: absolute; left: 165px; top: 50px; width: 640px; border-style: solid; border-width: 1px; border-color: #00006A; background-color: white; z-index: 1000;">
+ <table border="0" width="100%">
+ <tr>
+ <td style="width: 100%" id="dialogContent"></td>
+ <td valign="top" align="right">
+ <a href="javascript:hideDialog();"><img src="<%= request.getContextPath() %>/img/bt-fermer.png" border="0"></a>
+ </td>
+ </tr>
+ </table>
+</div>
+<%
+ {
+ org.apache.struts.action.ActionMessages attributeErrors = (org.apache.struts.action.ActionMessages) request.getAttribute(org.apache.struts.Globals.ERROR_KEY);
+ org.apache.struts.action.ActionMessages sessionErrors = (org.apache.struts.action.ActionMessages) request.getSession().getAttribute(org.apache.struts.Globals.ERROR_KEY);
+ org.apache.struts.action.ActionMessages attributeMessages = (org.apache.struts.action.ActionMessages) request.getAttribute(org.apache.struts.Globals.MESSAGE_KEY);
+ org.apache.struts.action.ActionMessages sessionMessages = (org.apache.struts.action.ActionMessages) request.getSession().getAttribute(org.apache.struts.Globals.MESSAGE_KEY);
+ if ((attributeErrors != null && !attributeErrors.isEmpty()) || (sessionErrors != null && !sessionErrors.isEmpty()) || (attributeMessages != null && !attributeMessages.isEmpty()) || (sessionMessages != null && !sessionMessages.isEmpty())) {
+%>
+<div id="errorDiv" style="visibility: hidden; ">
+ <table border="0" width="100%">
+ <tr>
+ <td>
+ <html:errors name="<%=org.apache.struts.Globals.ERROR_KEY%>"/>
+ <html:errors name="<%=org.apache.struts.Globals.MESSAGE_KEY%>"/>
+ </td>
+ </tr>
+ </table>
+</div>
+<script>
+ showDialog(document.getElementById("errorDiv").innerHTML);
+</script>
+<%
+ }
+ }
+%>
\ No newline at end of file
--- /dev/null
+libs.CopyLibs.classpath=\
+ ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration PUBLIC "-//Apache Software Foundation//DTD log4j Configuration 1.0//EN" "log4j.dtd">
+<log4j:configuration threshold="all" debug="false">
+
+ <appender name="console.appender" class="org.apache.log4j.ConsoleAppender">
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%-5p %X{user} %X{ip} [%c] %d{dd-MM-yyyy HH:mm:ss} : %m%n"/>
+ </layout>
+ </appender>
+
+ <appender name="file.appender" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="logs/xemelios.log"/>
+ <!-- <param name="File" value="${webApp.home}/log.txt"/-->
+ <param name="Append" value="true"/>
+ <param name="MaxFileSize" value="500KB"/>
+ <param name="MaxBackupIndex" value="1"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%-5p %X{user} %X{ip} [%c] %d{dd-MM-yyyy HH:mm:ss} : %m%n"/>
+ </layout>
+ </appender>
+
+ <logger name="org.apache">
+ <level value="warn"/>
+ </logger>
+
+ <!--logger name="fr.gouv.finances.cp.xemelios.data">
+ <level value="info"/>
+ </logger-->
+ <logger name="fr.gouv.finances.dgfip.xemelios.data.utils.jdbc">
+ <level value="error"/>
+ </logger>
+
+ <root>
+ <level value="debug"/>
+ <appender-ref ref="console.appender"/>
+ <appender-ref ref="file.appender"/>
+ </root>
+
+</log4j:configuration>
--- /dev/null
+# jndi.poolname=java:/comp/env/jdbc/xemeliosDB
+driver.class=com.mysql.jdbc.Driver
+database.url=jdbc:mysql://localhost/xemelios
+user=xemelios
+password=Am/xL6*::
+max.active=24
+max.wait=8
\ No newline at end of file
--- /dev/null
+<?xml version="1.0"?>
+<!--
+ Copyright
+ 2009 axYus - www.axyus.com
+ 2009 C.Marchand - christophe.marchand@axyus.com
+
+ This file is part of XEMELIOS.
+
+ XEMELIOS 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.
+
+ XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://www.w3.org/1999/xhtml">
+<xsl:param name="title"/>
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:variable name="debug" select="'true'"/>
+
+ <xsl:template match="/">
+ <html>
+ <head>
+ <title>Source XML de <xsl:value-of select="$title"/></title>
+ <style type="text/css">
+ span { font-family: monospace; font-size: 12px; }
+ .expander-content {
+ padding-left: 1em;
+ }
+
+ .expander {
+ text-align: center;
+ vertical-align: top;
+ width: 1em;
+ display: inline-block;
+ margin-left: -1em;
+ }
+
+ #top > .expander-open, #top > .expander-closed {
+ margin-left: 1em;
+ }
+
+ .expander-closed > .expander-content {
+ display: none;
+ }
+ .comment {
+ font-family: monospace;
+ font-size: 12px;
+ white-space: pre;
+ }
+ #top > .expander-open {
+ font-family: monospace;
+ font-size: 12px;
+ white-space: pre;
+ }
+ *|*:root {
+ background-color: white;
+ }
+ #viewsource {
+ font-family: monospace;
+ font-size: 12px;
+ font-weight: normal;
+ color: black;
+ white-space: pre;
+ }
+ #viewsource.wrap {
+ white-space: pre-wrap;
+ }
+ pre {
+ font: inherit;
+ color: inherit;
+ white-space: inherit;
+ margin: 0;
+ }
+ .start-tag {
+ color: purple;
+ font-weight: bold;
+ font-size: 12px;
+ }
+ .end-tag {
+ color: purple;
+ font-weight: bold;
+ font-size: 12px;
+ }
+ .comment {
+ color: green;
+ font-style: italic;
+ }
+ .cdata {
+ color: #CC0066;
+ }
+ .doctype {
+ color: steelblue;
+ font-style: italic;
+ }
+ .pi {
+ color: orchid;
+ font-style: italic;
+ }
+ .entity {
+ color:#FF4500;
+ font-weight: normal;
+ }
+ .text {
+ font-weight: normal;
+ }
+ .attribute-name {
+ color: black;
+ font-weight: bold;
+ }
+ .attribute-value {
+ color: blue;
+ font-weight: normal;
+ }
+ .summary {
+ display: block;
+ background-color: #FFFFCC;
+ width: 90%;
+ border: solid;
+ border-width: 1pt;
+ font-family: sans-serif;
+ }
+ .popup {
+ font-weight: normal;
+ }
+ .markupdeclaration {
+ color: steelblue;
+ font-style: italic;
+ }
+ .error, .error > .start-tag, .error > .end-tag,
+ .error > .comment, .error > .cdata, .error > .doctype,
+ .error > .pi, .error > .entity, .error > .attribute-name,
+ .error > .attribute-value {
+ color: red;
+ font-weight: bold;
+ }
+ </style>
+ </head>
+ <body><xsl:apply-templates/></body>
+ </html>
+ </xsl:template>
+
+ <xsl:template match="*">
+ <xsl:if test="not(namespace-uri(.) = 'http://projets.admisource.gouv.fr/xemelios/namespaces#added' or namespace-uri(.) = 'http://projets.admisource.gouv.fr/xemelios/namespaces#anomally' or starts-with(local-name(.),'added:') or starts-with(local-name(.),'ano:')) or $debug='true'">
+ <div>
+ <xsl:text><</xsl:text>
+ <span class="start-tag"><xsl:value-of select="name(.)"/></span>
+ <xsl:apply-templates select="@*"/>
+ <xsl:text>/></xsl:text>
+ </div>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="*[node()]">
+ <xsl:if test="not(namespace-uri(.) = 'http://projets.admisource.gouv.fr/xemelios/namespaces#added' or namespace-uri(.) = 'http://projets.admisource.gouv.fr/xemelios/namespaces#anomally' or starts-with(local-name(.),'added:') or starts-with(local-name(.),'ano:')) or $debug='true'">
+ <div>
+ <xsl:text><</xsl:text>
+ <span class="start-tag"><xsl:value-of select="name(.)"/></span>
+ <xsl:apply-templates select="@*"/>
+ <xsl:text>></xsl:text>
+
+ <span class="text"><xsl:value-of select="."/></span>
+
+ <xsl:text></</xsl:text>
+ <span class="end-tag"><xsl:value-of select="name(.)"/></span>
+ <xsl:text>></xsl:text>
+ </div>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="*[* or processing-instruction() or comment() or string-length(.) > 50]">
+ <xsl:if test="not(namespace-uri(.) = 'http://projets.admisource.gouv.fr/xemelios/namespaces#added' or namespace-uri(.) = 'http://projets.admisource.gouv.fr/xemelios/namespaces#anomally' or starts-with(local-name(.),'added:') or starts-with(local-name(.),'ano:')) or $debug='true'">
+ <div class="expander-open">
+ <xsl:call-template name="expander"/>
+
+ <xsl:text><</xsl:text>
+ <span class="start-tag"><xsl:value-of select="name(.)"/></span>
+ <xsl:apply-templates select="@*"/>
+ <xsl:text>></xsl:text>
+
+ <div class="expander-content"><xsl:apply-templates/></div>
+
+ <xsl:text></</xsl:text>
+ <span class="end-tag"><xsl:value-of select="name(.)"/></span>
+ <xsl:text>></xsl:text>
+ </div>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="@*">
+ <xsl:if test="not(namespace-uri(.) = 'http://projets.admisource.gouv.fr/xemelios/namespaces#added' or namespace-uri(.) = 'http://projets.admisource.gouv.fr/xemelios/namespaces#anomally' or starts-with(local-name(.),'added:') or starts-with(local-name(.),'ano:')) or $debug='true'">
+ <xsl:text> </xsl:text>
+ <span class="attribute-name"><xsl:value-of select="name(.)"/></span>
+ <xsl:text>=</xsl:text>
+ <span class="attribute-value">"<xsl:value-of select="."/>"</span>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="text()">
+ <xsl:if test="normalize-space(.)">
+ <xsl:value-of select="."/>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="processing-instruction()">
+ <div class="pi">
+ <xsl:text><?</xsl:text>
+ <xsl:value-of select="name(.)"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>?></xsl:text>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="processing-instruction()[string-length(.) > 50]">
+ <div class="expander-open">
+ <xsl:call-template name="expander"/>
+
+ <span class="pi">
+ <xsl:text> <?</xsl:text>
+ <xsl:value-of select="name(.)"/>
+ </span>
+ <div class="expander-content pi"><xsl:value-of select="."/></div>
+ <span class="pi">
+ <xsl:text>?></xsl:text>
+ </span>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="comment()">
+ <div class="comment">
+ <xsl:text><!--</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>--></xsl:text>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="comment()[string-length(.) > 50]">
+ <div class="expander-open">
+ <xsl:call-template name="expander"/>
+
+ <span class="comment">
+ <xsl:text><!--</xsl:text>
+ </span>
+ <div class="expander-content comment">
+ <xsl:value-of select="."/>
+ </div>
+ <span class="comment">
+ <xsl:text>--></xsl:text>
+ </span>
+ </div>
+ </xsl:template>
+
+ <xsl:template name="expander">
+ <!--div class="expander">−</div-->
+ </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>\r
+<!DOCTYPE log4j:configuration PUBLIC "-//Apache Software Foundation//DTD log4j Configuration 1.0//EN" "log4j.dtd">\r
+\r
+<log4j:configuration threshold="all" debug="false">\r
+\r
+ <appender name="rollingFile" class="org.apache.log4j.RollingFileAppender">\r
+ <param name="File" value="xemelios.log" />\r
+ <param name="MaxFileSize" value="100KB"/>\r
+ <param name="MaxBackupIndex" value="5"/>\r
+ <layout class="org.apache.log4j.PatternLayout">\r
+ <param name="ConversionPattern" value="%-5p [%c{2}] %t %d{HH:mm:ss,SSS}: %m%n"/>\r
+ </layout>\r
+ </appender>\r
+ \r
+ <appender name="console.appender" class="org.apache.log4j.ConsoleAppender">\r
+ <layout class="org.apache.log4j.PatternLayout">\r
+ <param name="ConversionPattern" value="%-5p [%c{3}] %t: %m%n"/>\r
+ </layout>\r
+ </appender>\r
+ \r
+ <logger name="httpclient">\r
+ <level value="error"/>\r
+ <appender-ref ref="console.appender"/>\r
+ </logger>\r
+ \r
+ <logger name="org.apache.commons">\r
+ <level value="info"/>\r
+ <appender-ref ref="console.appender"/>\r
+ </logger>\r
+\r
+ <logger name="fr.gouv.finances">\r
+ <level value="info"/>\r
+ <appender-ref ref="rollingFile"/>\r
+ </logger>\r
+\r
+ <logger name="fr.gouv.finances.dgfip.xemelios.data.utils.jdbc">\r
+ <level value="error"/>\r
+ <appender-ref ref="rollingFile"/>\r
+ </logger>\r
+\r
+</log4j:configuration>\r
--- /dev/null
+<html xmlns:o="urn:schemas-microsoft-com:office:office"\r
+xmlns:x="urn:schemas-microsoft-com:office:excel"\r
+xmlns="http://www.w3.org/TR/REC-html40">\r
+\r
+<head>\r
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">\r
+<meta name=ProgId content=Excel.Sheet>\r
+<style>\r
+<!--table\r
+ {mso-displayed-decimal-separator:"\.";\r
+ mso-displayed-thousand-separator:" ";}\r
+@page\r
+ {margin:.98in .79in .98in .79in;\r
+ mso-header-margin:.49in;\r
+ mso-footer-margin:.49in;}\r
+tr\r
+ {mso-height-source:auto;}\r
+col\r
+ {mso-width-source:auto;}\r
+br\r
+ {mso-data-placement:same-cell;}\r
+.style0\r
+ {mso-number-format:General;\r
+ text-align:general;\r
+ vertical-align:bottom;\r
+ white-space:nowrap;\r
+ mso-rotate:0;\r
+ mso-background-source:auto;\r
+ mso-pattern:auto;\r
+ color:windowtext;\r
+ font-size:10.0pt;\r
+ font-weight:400;\r
+ font-style:normal;\r
+ text-decoration:none;\r
+ font-family:Arial;\r
+ mso-generic-font-family:auto;\r
+ mso-font-charset:0;\r
+ border:none;\r
+ mso-protection:locked visible;\r
+ mso-style-name:Normal;\r
+ mso-style-id:0;}\r
+td\r
+ {mso-style-parent:style0;\r
+ padding-top:1px;\r
+ padding-right:1px;\r
+ padding-left:1px;\r
+ mso-ignore:padding;\r
+ color:windowtext;\r
+ font-size:10.0pt;\r
+ font-weight:400;\r
+ font-style:normal;\r
+ text-decoration:none;\r
+ font-family:Arial;\r
+ mso-generic-font-family:auto;\r
+ mso-font-charset:0;\r
+ mso-number-format:General;\r
+ text-align:general;\r
+ vertical-align:bottom;\r
+ border:none;\r
+ mso-background-source:auto;\r
+ mso-pattern:auto;\r
+ mso-protection:locked visible;\r
+ white-space:nowrap;\r
+ mso-rotate:0;}\r
+.axyusTitre\r
+ {\r
+ font-size:14.0pt;\r
+ font-weight:bold;\r
+ text-align:left;}\r
+.axyusNomsChamps\r
+ {\r
+ font-size:12.0pt;\r
+ font-weight:bold;\r
+ text-align:left;}\r
+.axyusText\r
+ {mso-style-parent:style0;\r
+ mso-number-format:"\@";\r
+ text-align:left;}\r
+.axyusInteger\r
+ {mso-style-parent:style0;\r
+ mso-number-format:0;\r
+ white-space:normal;}\r
+.axyusFloat\r
+ {mso-style-parent:style0;\r
+ mso-number-format:"0\.00";\r
+ white-space:normal;}\r
+.axyusDate\r
+ {mso-style-parent:style0;\r
+ mso-number-format:"Short Date";}\r
+-->\r
+</style>\r
+\r
+</head>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE struts-config PUBLIC
+"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
+"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
+
+<struts-config>
+ <form-beans>
+ <form-bean name="connexionForm" type="fr.gouv.finances.dgfip.xemelios.web2.connexion.ConnexionForm"/>
+ </form-beans>
+
+ <action-mappings>
+ <action path="/connexion" parameter="dispatchMethod" input="/WEB-INF/jsp/connexion.jsp" validate="false" scope="request" type="fr.gouv.finances.dgfip.xemelios.web2.connexion.ConnexionAction" name="connexionForm">
+ <forward name="success" path="/welcomeGWT.html?gwt.codesvr=127.0.0.1:9997" redirect="true"/>
+ <!--forward name="success" path="/welcomeGWT.html" redirect="true"/-->
+ </action>
+ <action path="/deconnexion" parameter="dispatchMethod" validate="false" scope="request" type="fr.gouv.finances.dgfip.xemelios.web2.connexion.DeconnexionAction">
+ <forward name="success" path="/index.jsp" redirect="true"/>
+ </action>
+ <action path="/showRepository" parameter="dispatchMethod" validate="false" scope="request" type="fr.gouv.finances.dgfip.xemelios.web2.navigate.ShowReferentiel">
+ <forward name="noRef" path="/WEB-INF/jsp/search/noReferentiel.jsp"/>
+ </action>
+ <action path="/navigation" parameter="dispatchMethod" validate="false" scope="request" type="fr.gouv.finances.dgfip.xemelios.web2.navigate.NavigateAction">
+ <forward name="simple.error" path="/WEB-INF/jsp/simple-error.jsp"/>
+ </action>
+ <action path="/displayDocument" parameter="dispatchMethod" validate="false" scope="request" type="fr.gouv.finances.dgfip.xemelios.web2.navigate.DisplayDocumentAction"/>
+ <action path="/resource" parameter="dispatchMethod" validate="false" scope="request" type="fr.gouv.finances.dgfip.xemelios.web2.navigate.ResourceProvider">
+ <forward name="simple.error" path="/WEB-INF/jsp/simple-error.jsp"/>
+ </action>
+ </action-mappings>
+
+ <message-resources null="false" parameter="messages"/>
+
+</struts-config>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Copyright
+ * 2010 axYus - www.axyus.com
+ * 2010 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS 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 of the License, or
+ * (at your option) any later version.
+ *
+ * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+ -->
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
+ <!-- context params -->
+ <context-param>
+ <param-name>documents-def.dir</param-name>
+ <param-value>
+ %basedir%/src/carte-achat/conf,
+ %basedir%/src/cfg-paye/conf,
+ %basedir%/src/cg-colloc/conf,
+ %basedir%/src/cg-etat/conf,
+ %basedir%/src/edmn/conf,
+ %basedir%/src/erar/conf,
+ %basedir%/src/etat-frais/conf,
+ %basedir%/src/etat-frais-spl/conf,
+ %basedir%/src/facture-depense/conf,
+ %basedir%/src/facture-recette/conf,
+ %basedir%/src/manifeste/conf,
+ %basedir%/src/pes-aller/conf,
+ %basedir%/src/pes-facture/conf,
+ %basedir%/src/quittancement/conf,
+ %basedir%/src/rapport/conf,
+ %basedir%/src/ref-collec-spl/conf,
+ %basedir%/src/versement/conf
+ </param-value>
+ <description>Liste des répertoires où on trouve la conf des documents. Si pas renseignée, WEB-INF/documents-def est utilisé</description>
+ </context-param>
+ <context-param>
+ <param-name>baseDir</param-name>
+ <param-value>/home/cmarchand/devel/XEMELIOS_NB/XEMELIOS</param-value>
+ <description>En mode développement, permet de spécifier le répertoire de base. Cette valeur permettra de remplacer le %basedir% mit dans documents-def.dir</description>
+ </context-param>
+ <context-param>
+ <param-name>xemelios.date.format</param-name>
+ <param-value>dd-MM-yyyy</param-value>
+ </context-param>
+ <!-- filters -->
+ <filter>
+ <filter-name>Log4jMDCServletFilter</filter-name>
+ <filter-class>fr.gouv.finances.dgfip.xemelios.web2.utils.filter.Log4jMDCServletFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>Log4jMDCServletFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+ <!-- listeners -->
+ <listener>
+ <listener-class>fr.gouv.finances.dgfip.xemelios.web2.utils.ServletContextListenerImpl</listener-class>
+ </listener>
+ <session-config>
+ <session-timeout>30</session-timeout>
+ </session-config>
+ <servlet>
+ <servlet-name>action</servlet-name>
+ <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
+ <init-param>
+ <param-name>config</param-name>
+ <param-value>/WEB-INF/struts-config.xml</param-value>
+ </init-param>
+ <load-on-startup>2</load-on-startup>
+ </servlet>
+ <servlet>
+ <servlet-name>XemeliosService</servlet-name>
+ <servlet-class>fr.gouv.finances.dgfip.xemelios.web2.gwt.server.XemeliosServiceImpl</servlet-class>
+ </servlet>
+ <!-- mappings -->
+ <servlet-mapping>
+ <servlet-name>action</servlet-name>
+ <url-pattern>*.do</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>XemeliosService</servlet-name>
+ <url-pattern>/fr.gouv.finances.dgfip.xemelios.web2.gwt.XemeliosStarter/XeMeLios</url-pattern>
+ <url-pattern>/fr.gouv.finances.dgfip.xemelios.web2.gwt/XeMeLios</url-pattern>
+ <url-pattern>/XeMeLios/XeMeLios</url-pattern>
+ </servlet-mapping>
+ <welcome-file-list>
+ <welcome-file>index.jsp</welcome-file>
+ </welcome-file-list>
+</web-app>
--- /dev/null
+/* This is a very basic stylesheet for the date-picker. Feel free to create your own. */
+
+/* The wrapper div */
+div.datePicker
+ {
+ position:absolute;
+ min-width:250px;
+ width:250px;
+ z-index:9999;
+ text-align:center;
+
+ /* Change the font-size to suit your design's CSS. The following line is for the demo that has a 12px font-size defined on the body tag */
+ /*font:900 0.8em/0.8em Verdana, Sans-Serif;*/
+ font-size: 10px;
+
+ /* For Example: If using the YUI font CSS, uncomment the following line to get a 10px font-size within the datePicker */
+ /* font:900 77%/77% Verdana; */
+
+ background:transparent;
+
+ /* Mozilla & Webkit extensions to stop text-selection. Remove if you wish to validate the CSS */
+ -moz-user-select:none;
+ -khtml-user-select:none;
+ }
+/* Styles for the static datePickers */
+div.staticDP
+ {
+ position:relative;
+ top:5px;
+ left:0;
+ }
+/* The iframe hack to cover selectlists in Internet Explorer <= v6 */
+iframe.iehack
+ {
+ position:absolute;
+ background:#fff;
+ z-index:9998;
+ padding:0;
+ border:0;
+ display:none;
+ margin:0;
+ }
+/* The "button" created beside each input for non-static datePickers */
+a.date-picker-control:link,
+a.date-picker-control:visited,
+a.date-picker-control:hover,
+a.date-picker-control:active,
+a.date-picker-control:focus
+ {
+ position:relative;
+ /* Moz & FF */
+ display: -moz-inline-stack;
+ border:0 none;
+ padding:0;
+ margin:0 0 0 4px;
+ background:transparent url(../img/datePicker/cal.gif) no-repeat 50% 50%;
+ min-width:16px;
+ line-height:1;
+ cursor:pointer;
+ visibility:visible;
+ text-decoration:none;
+ vertical-align:middle;
+ }
+/* Feed IE6 the following rule, IE7 should handle the min-width declared above */
+* html a.date-picker-control
+ {
+ width:16px;
+ }
+a.date-picker-control
+ {
+ /* IE, Safari & Opera. Seperate CSS rule seems to be required. */
+ display:inline-block;
+ }
+a.date-picker-control span
+ {
+ display:block;
+ width:16px;
+ height:16px;
+ margin:auto 0;
+ }
+/* The next & previous buttons */
+div.datePicker th span
+ {
+ display:inline;
+ padding:0;
+ margin:0;
+ color:#000;
+ text-align:center;
+ line-height:1em;
+ border-width:0;
+ /*font-family: georgia, times new roman, palatino, times, bookman, serif;*/
+ background:transparent;
+ font-weight:bold;
+ cursor:pointer;
+ }
+div.datePicker th span.month-display,
+div.datePicker th span.year-display
+ {
+ text-transform:uppercase;
+ letter-spacing:1px;
+ /*font:normal 1.2em Verdana, Sans-Serif;*/
+ font-size: 10px;
+ cursor:default;
+ }
+div.datePicker th span.prev-but,
+div.datePicker th span.next-but
+ {
+ /*font-size:1.8em;*/
+ font-size: 10px;
+ cursor:pointer !important;
+ }
+
+div.datePicker th span.today-but
+ {
+ text-align:center;
+ margin:0 auto;
+ /*font:normal 1em Verdana, Sans-Serif;*/
+ font-size: 10px;
+ width:100%;
+ text-decoration:none;
+ /*line-height:1.6em;*/
+ text-transform:uppercase;
+ cursor:pointer !important
+ }
+div.datePicker thead th span.fd-disabled
+ {
+ color:#aaa;
+ cursor:default !important;
+ }
+/* The mon, tue, wed etc day buttons */
+div.datePicker th span.fd-day-header
+ {
+ text-align:center;
+ margin:0 auto;
+ /*font:900 1em Verdana, Sans-Serif;
+ height:1.4em;
+ width:2em;*/
+ text-decoration:none;
+ text-transform:lowercase;
+ /*line-height:1.4em;*/
+ }
+/* The table */
+div.datePicker table
+ {
+ position:relative;
+ margin:0;
+ padding:0;
+ border:1px solid #ccc;
+ background:#fff url(../img/datePicker/gradient-e5e5e5-ffffff.gif) repeat-x 0 -20px;
+ text-align:center;
+ width:100%;
+ border-spacing:2px;
+ table-layout:fixed;
+ border-collapse:separate;
+ }
+/* Common TD & TH styling */
+div.datePicker table td
+ {
+ border:1px solid #ccc;
+ padding:0;
+ text-align:center;
+ vertical-align:middle;
+ /* Opera requires a line-height bigger than 1em in order to redraw properly */
+ /*line-height:1.2em;*/
+ cursor:pointer;
+ background:#fff url(../img/datePicker/gradient-e5e5e5-ffffff.gif) repeat-x 0 -40px;
+ /*width:3em;*/
+ /*height:3em !important;
+ height:2.8em;*/
+ width: 20px;
+ height: 20px;
+ outline:none;
+ }
+div.datePicker table th
+ {
+ border:0 none;
+ padding:0;
+ /*line-height:1em;*/
+ font-weight:bold;
+ color:#222;
+ text-align:center;
+ vertical-align:middle;
+ }
+div.datePicker table td.date-picker-unused
+ {
+ background:#fff url(../img/datePicker/backstripes.gif);
+ border-color:#dcdcdc;
+ padding:0;
+ cursor:default !important;
+ }
+div.datePicker table thead th.date-picker-title
+ {
+ width:auto;
+ height:auto;
+ /*padding:0.4em 0;*/
+ }
+/* The "mon tue wed etc" day header button styles */
+div.datePicker table th.date-picker-day-header
+ {
+ text-transform:lowercase;
+ font-size: 12px;
+ /*width:3em;*/
+ }
+div.datePicker table th.date-picker-day-header span
+ {
+ display:block;
+ }
+/* The "todays date" style */
+div.datePicker table td.date-picker-today
+ {
+ background:#fff url(../img/datePicker/bullet2.gif) no-repeat 0 0;
+ color:rgb(100,100,100) !important;
+ }
+/* The "selected date" style */
+div.datePicker table td.date-picker-selected-date
+ {
+ color:#333 !important;
+ border-color:#333 !important;
+ }
+/* the "highlight days" style */
+td.date-picker-highlight
+ {
+ color:#a86666;
+ }
+/* The date "out of range" style */
+div.datePicker table td.out-of-range
+ {
+ color:#ccc !important;
+ font-style:oblique;
+ background:#fcfcfc !important;
+ cursor:default !important;
+ }
+/* The "disabled days" style */
+div.datePicker table td.day-disabled
+ {
+ color:#aaa !important;
+ background:transparent !important;
+ cursor:default !important;
+ }
+/* The "active cursor" style */
+div.datePicker table tbody td.date-picker-hover
+ {
+ background:#fff url(../media/bg_header.jpg) no-repeat 0 0;
+ cursor:pointer;
+ border-color:rgb(100,130,170);
+ color:rgb(100,130,170);
+ }
+/*
+ Quirksmode necessity?
+ ---------------------
+
+ If your HTML document renders in quirksmode (i.e. has no doctype declaration)
+ then uncomment the following CSS rule to set a less drastic font-size in IE
+
+div.datePicker table th,
+div.datePicker table td
+ {
+ font-size:100%;
+ }
+*/
+
+/* Remove the images for Internet Explorer <= v6 using the "* html" hack */
+* html div.datePicker table td
+ {
+ background-image:none;
+ }
+* html div.datePicker table td.date-picker-unused
+ {
+ background:#f2f2f2;
+ }
\ No newline at end of file
--- /dev/null
+#SearchTools {
+ width: 275px;
+}
--- /dev/null
+/**
+ * Disable menus for Internet Explorer
+ * Doing them in javascript is much easier
+ */
+
+.Menu:hover>.Items {
+ display: none;
+}
+
+
+div {
+ /* Set HasLayout to make things easier */
+ zoom: 1;
+}
+
+
+html, body {
+ /* No min height support */
+ height: 100%;
+}
+
+#MainContainer {
+ height: 100%;
+}
+
+
+/* login page */
+
+
+#LoginLogoPanel {
+ background-image: url('../img/login_logo.gif');
+}
+
+#LoginPanel {
+ background-image: url('../img/login-panel-bk.gif');
+}
+
+ul#loginconnect
+{
+ margin-left: 145px;
+ top: 0px;
+}
+ul#loginconnect li#loginbtn a
+{
+ background-image: url('../img/login_btn_bk.gif');
+}
+
+
+
+#Topbar span {
+ /* No transparent png support */
+ background-image: url('../img/down-arrow.gif');
+}
+
+/* #Data */
+#resultTableContainer .TopRight {
+ right: -1px;
+}
+
+#NavigationTools .Main {
+ padding-top: 9px;
+}
+
+.Toolbar select {
+ vertical-align: middle;
+}
+
+.Toolbar .Main {
+ background-image: url('../img/toolbar-bk.gif');
+}
+
+.Toolbar .Left {
+ background-image: url('../img/toolbar-left.gif');
+}
+
+.Toolbar .Right {
+ background-image: url('../img/toolbar-right.gif');
+}
+
+#SearchTools .Left {
+ background-image: url('../img/toolbar-left-strong.gif');
+}
+
+a.Icon {
+ background-image: url('../img/icons.gif');
+}
+
+#SearchTools {
+ /* floats must have a specified width */
+ width: 251px;
+}
+
+.Tab {
+ padding-top: 9px;
+ background-image: url('../img/tab-bk.gif');
+}
+
+.Tabs .Selected {
+ background-image: url('../img/tab-selected-bk.gif');
+}
+
+.Tab .Left {
+ background-image: url('../img/tab-left.gif');
+}
+
+.Tab .Right {
+ background-image: url('../img/tab-right.gif');
+ right: -11px;
+}
+
+.Tabs .Selected .Left {
+ background-image: url('../img/tab-selected-left.gif');
+}
+
+.Tabs .Selected .Right {
+ background-image: url('../img/tab-selected-right.gif');
+}
+
+#NewTab {
+ background-image: url('../img/new-tab.gif');
+}
+
+.helpCollectivite {
+ width: auto;
+ height: 24px;
+}
\ No newline at end of file
--- /dev/null
+/**
+ * Disable menus for Internet Explorer
+ * Doing them in javascript is much easier
+ */
+.Menu:hover>.Items {
+ display: none;
+}
+
+.helpCollectivite {
+ width: auto;
+ height: 24px;
+}
\ No newline at end of file
--- /dev/null
+/**
+ * Tags
+ */
+
+html, body {
+ margin: 0;
+ padding: 0;
+ height: 100%;
+ font-family: arial, sans-serif;
+ font-size: 11px;
+ font-style: normal;
+}
+
+a {
+ color: #055496;
+ text-decoration: none;
+}
+
+img {
+ border: none;
+}
+
+select {
+ color: #145b99;
+ border: solid 1px #6a8ead;
+ font-size: 11px;
+ background: #f3f7fb;
+}
+
+h1 {
+ font-size: 12px;
+ color: #ff9900;
+ display: inline;
+}
+
+h2 {
+ color: white;
+ font-size: 14px;
+ display: inline;
+}
+
+
+/* Login page style */
+
+
+#LoginContainer {
+ position: relative;
+ clear: both;
+ background: transparent url('../img/login-bk.jpg') repeat-x left top;
+ align: center;
+ padding-top: 150px;
+ padding-bottom: 100px;
+}
+
+
+#LoginLogoPanel {
+ width: 277px;
+ margin: 0 auto;
+ height: 35px;
+ text-align:right;
+ line-height: 12px;
+ vertical-align: baseline;
+ align : right bottom;
+ font: 10px arial, sans-serif;
+ color: #6A8EAD;
+ background: transparent url('../img/login_logo.png') no-repeat left top;
+ padding-top: 0px;
+
+}
+
+#LoginPanel {
+ width: 287px;
+ margin: 0 auto;
+ height: 131px;
+ background: transparent url('../img/login-panel-bk.png') no-repeat center top;
+ padding-left: 15px;
+ padding-right: 15px;
+ padding-top: 25px;
+
+}
+
+
+
+#logintable {
+ margin: 0 auto;
+ width: auto;
+}
+
+#logintable td.text {
+ padding-right: 10px;
+ color:#145b99;
+ font: 11px arial, sans-serif;
+ font-weight: bold;
+ line-height: 30px;
+
+}
+
+#logintable input {
+ border: 1px solid #6a8ead;
+ background: #f3f7fb;
+ font: 12px arial, sans-serif;
+ color:#333333;
+}
+
+
+#loginbtn
+{
+ margin-left: 100px;
+ margin-top: 20px;
+ display: block ;
+ width: 112px ;
+ color: #FFFFFF ;
+ font-size: 12px;
+ font-weight: bold;
+ text-decoration: none ;
+ text-align: center;
+ line-height: 29px ;
+ width: 112px;
+ background: transparent url('../img/login_btn_bk.png') no-repeat left top;
+}
+#loginbtn:hover
+{
+ text-decoration: underline;
+}
+
+/**
+ * Top bar that contains the menus.
+ */
+
+#Topbar {
+ height: 34px;
+ background: #e2ebf3 url('../img/topbar-bk.gif') repeat-x left top;
+ font-size: 12px;
+}
+
+#Topbar a:visited {
+ color: #055496;
+}
+
+#Topbar a.Menu,
+#Topbar div.Menu {
+ display: block;
+ float: left;
+ padding: 0 22px 0 20px;
+ line-height: 34px;
+ background: transparent url('../img/topbar-vsep.gif') no-repeat right top;
+ cursor: pointer;
+ position: relative;
+}
+
+#Topbar span {
+ font-weight: bold;
+ color: #055496;
+ padding-right: 20px;
+ background: transparent url('../img/down-arrow.png') no-repeat right 4px;
+}
+
+/**
+ * Menus (Firefox / Safari only)
+ */
+
+.Menu .Items {
+ display: none;
+ line-height: normal;
+ font-size: 11px;
+ padding: 0;
+ margin: 0;
+ min-width: 150px;
+ position: absolute;
+ top: 100%;
+ left: 0;
+ z-index: 1000;
+}
+
+.Menu:hover>.Items {
+ display: block;
+}
+
+.Menu .Items li {
+ list-style: none;
+ padding: 5px 5px;
+ line-height: normal;
+ border: 1px solid #265682;
+ border-top: none;
+ background: #dce6f0;
+ color: #055496;
+ position: relative;
+}
+
+.Menu li.Deep:hover,
+.Menu li:hover {
+ background-color: #658daf;
+}
+
+.Menu li:hover>a {
+ color: white;
+}
+
+.Menu a {
+ display: block;
+}
+
+.Menu li.Deep {
+ background: #dce6f0 url('../img/right-arrow.png') no-repeat 95% 6px;
+}
+
+.Menu .Items .Items {
+ position: absolute;
+ left: 100%;
+ top: 0;
+}
+
+/**
+ * Topnav (Navigation and Search Tools)
+ */
+
+#TabTitle {
+ background: white url('../img/topnav-bk.jpg') repeat-y left top;
+ padding: 10px 30px 1px 0;
+ color: white;
+ margin-bottom: -1px;
+}
+
+#Topnav {
+ background: white url('../img/topnav-bk.jpg') repeat-y left top;
+ padding: 10px 30px;
+ color: white;
+}
+.TopnavBk {
+ background: white url('../img/topnav-bk.jpg') repeat-y left top;
+ color: white;
+}
+
+#TopbarTitle {
+ padding-top: 5px;
+ margin-bottom: 10px;
+}
+select.limitedWidth {
+ width: 200px;
+ margin-top: 12px;
+}
+input.limitedWidth {
+ width: 200px;
+ margin-top: 12px;
+}
+select.limitedWidth option {
+ width: auto;
+}
+.helpCollectivite {
+ width: auto;
+ height: 24px;
+ margin-top: 12px;
+}
+
+/* Toolbar Class */
+
+.Toolbar {
+ color: #476885;
+ position: relative;
+}
+.MainCollBudgChooser {
+ background: transparent url('../img/toolbar-bk.png') repeat-x left top;
+ line-height: 39px;
+ height: 44px;
+ padding-top: 1px;
+ vertical-align: baseline;
+ color: #476885;
+}
+.Main {
+/* background: transparent url('../img/toolbar-bk.png') repeat-x left top; */
+ line-height: 39px;
+ height: 44px;
+ padding-top: 1px;
+ vertical-align: baseline;
+ color: #476885;
+}
+.Toolbar, .Main tr td {
+ vertical-align: baseline;
+}
+.Toolbar, .Main {
+ vertical-align: baseline;
+}
+.Toolbar, .MainCollBudgChooser tr td {
+ vertical-align: baseline;
+}
+.Toolbar, .MainCollBudgChooser {
+ vertical-align: baseline;
+}
+
+.Toolbar .Decorator {
+ position: absolute;
+ width: 12px;
+ height: 45px;
+ top: 0;
+}
+
+.Toolbar .Left {
+ left: 0;
+ background: transparent url('../img/toolbar-left.png') no-repeat left top;
+}
+.Toolbar .Right {
+ right: 0;
+ background: transparent url('../img/toolbar-right.png') no-repeat left top;
+}
+
+.Main select {
+ margin-right: 20px;
+}
+.ToolGroup {
+ vertical-align: baseline;
+}
+
+/* Navigation and Search toolbars */
+#NavigationTools {
+ margin-right: 30px;
+}
+
+#SearchTools {
+ float: right;
+}
+
+#SearchTools .Left {
+ background-image: url('../img/toolbar-left-strong.png');
+}
+
+/* Icons for the Search toolbar */
+/*
+a.Icon {
+ display: block;
+ height: 24px;
+ background: transparent url('../img/icons.png') no-repeat left top;
+ margin: 0 3px;
+}
+
+a.Icon span {
+ display: none;
+}
+
+a.Search {
+ background-position: left top;
+ width: 22px;
+}
+
+a.AddSearchCriteria {
+ background-position: -23px top;
+ width: 21px;
+}
+
+a.ResetSearchCriteria {
+ background-position: -43px top;
+ width: 23px;
+}
+
+a.OpenSearch {
+ background-position: -66px top;
+ width: 23px;
+}
+
+a.SaveSearch {
+ background-position: -89px top;
+ width: 23px;
+}
+
+a.Preferences {
+ background-position: -112px top;
+ width: 22px;
+}
+a.Preferences-deactivated {
+ background: transparent url('../img/deactivated-repository.png') no-repeat left top;
+ width: 22px;
+}
+
+a.Sort {
+ background-position: -134px top;
+ width: 27px;
+}
+*/
+/* ToolGroups */
+
+.ToolGroups {
+ padding: 0;
+ margin: 0;
+ white-space: nowrap;
+ orphans: 3;
+ widows: 3;
+}
+
+.hasBackground {
+ background: transparent url('../img/toolbar-bk.png') repeat-x left top;
+}
+
+.ToolGroup {
+ padding: 0 3px;
+ margin: 0;
+ height: 45px;
+ background: transparent url('../img/toolbar-vsep.png') no-repeat left top;
+ position: relative;
+ float: left;
+}
+
+.ToolGroup,
+.ToolGroup a.Icon {
+ float: left;
+}
+
+.ToolGroup a.Icon {
+ margin-top: 8px;
+}
+
+.ToolGroups .Strong {
+ background: transparent url('../img/toolbar-bk-strong2.png') repeat-x left top; /* '../img/toolbar-bk-strong.png' */
+}
+.ToolGroups .Norm {
+ background: transparent url('../img/toolbar-bk.png') repeat-x left top;
+}
+.ToolGroup .Strong {
+ background: transparent url('../img/toolbar-bk-strong2.png') repeat-x left top; /* '../img/toolbar-bk-strong.png' */
+}
+.ToolGroup .Norm {
+ background: transparent url('../img/toolbar-bk.png') repeat-x left top;
+}
+
+
+/**
+ * Subnav: the search criterias
+ */
+
+#parentSubnav {
+ background: #d1e1ef;
+}
+
+#Subnav {
+ background: #d1e1ef;
+ color: #145b99;
+ padding: 6px 30px;
+}
+
+#CriteriaTable td.Criteria select {
+ width: 230px;
+}
+
+#CriteriaTable td.Operator {
+ padding-left: 20px;
+}
+
+#CriteriaTable td.Operator input {
+ border: 1px solid #6a8ead;
+ background: #f3f7fb;
+}
+/* .Slider */
+.vsplitter {
+ height: 6px;
+ background: transparent url('../img/slider.gif') no-repeat center center;
+ cursor: move;
+ margin-top: 6px;
+}
+
+/**
+ * Data section
+ */
+#resultTableContainer {
+ margin: 10px 30px;
+ position: relative;
+ background-color: white;
+}
+#resultTableContainer table {
+ width: 100%;
+ table-layout: auto;
+ border-collapse: collapse;
+ border-spacing: 0;
+ margin-bottom: 12px;
+}
+
+#resultTableContainer table th {
+ position: relative;
+ color: white;
+ background: #255e8e url('../img/data-header-bk.gif') repeat-x left top;
+ border: solid 1px #9db7cc;
+ border-top: none;
+ height: 52px;
+ position: relative;
+}
+
+#resultTableContainer table th.First {
+ /* border-left: none; */
+}
+#resultTableContainer table th.Last {
+ border-right: none;
+}
+#resultTableContainer table td {
+ border: solid 1px #9db7cc;
+ padding: 5px;
+}
+#resultTableContainer table tr.Odd td {
+ background: #eff4f8;
+}
+#resultTableContainer .TopLeft,
+#resultTableContainer .TopRight {
+ width: 11px;
+ height: 11px;
+ position: absolute;
+ top: 0;
+}
+#resultTableContainer .TopLeft {
+ left: 0;
+}
+#resultTableContainer .TopRight {
+ right: 0;
+}
+
+
+#PageNavigation {
+ float: right;
+ color: #7691a7;
+ margin-bottom: 10px;
+}
+
+/* Page Navigation */
+
+
+#PageNavigation span,
+#PageNavigation a {
+ padding: 0 2px;
+}
+
+#PageNavigation img {
+ vertical-align: middle;
+}
+
+#ResultInfo {
+ color: #7691a7;
+ font-size: 10px;
+}
+
+/**
+ * Sticky Footer: stays at the bottom on short pages,
+ * follows the flow on long pages.
+ */
+
+#MainContainer {
+ min-height: 100%;
+ position: relative;
+ clear: both;
+}
+
+#Bottom {
+ height: 55px;
+}
+
+#Footer {
+ clear: both;
+ position: relative;
+ height: 55px;
+ background: #376793 url('../img/footer-bk.jpg') repeat-x left top;
+ width: 100%;
+ margin-top: -55px;
+ font-size: 12px;
+}
+
+/* Tabs */
+
+.Tabs {
+ padding: 0;
+ margin: 0;
+ float: left;
+ padding-left: 12px;
+}
+
+.Tabs .Selected a {
+ font-weight: bold;
+}
+
+.Tab {
+ float: left;
+ position: relative;
+ background: transparent url('../img/tab-bk.png') repeat-x left top;
+ height: 36px;
+ line-height: 33px;
+ margin: 0 12px;
+ list-style: none;
+ padding: 0 7px;
+}
+
+.Tabs .Selected {
+ background-image: url('../img/tab-selected-bk.png');
+}
+
+.Tab .Left,
+.Tab .Right {
+ position: absolute;
+ height: 36px;
+ width: 11px;
+ top: 0;
+}
+
+.Tabs .Selected .Remove {
+ opacity: 1;
+}
+
+.Tab .Remove {
+ opacity: .7;
+ margin-left: 3px;
+}
+
+.Tab .Left {
+ background: transparent url('../img/tab-left.png') no-repeat left top;
+ left: -11px;
+}
+
+.Tab .Right {
+ background: transparent url('../img/tab-right.png') no-repeat left top;
+ right: -11px;
+}
+
+.Tabs .Selected .Left {
+ background-image: url('../img/tab-selected-left.png');
+}
+
+.Tabs .Selected .Right {
+ background-image: url('../img/tab-selected-right.png');
+}
+
+.Tab a {
+ color: #055496;
+}
+.Tab img {
+ vertical-align: middle;
+}
+
+#NewTab {
+ float: left;
+ color: white;
+ padding-right: 20px;
+ line-height: 34px;
+ text-decoration: underline;
+ background: transparent url('../img/new-tab.png') no-repeat right 11px;
+ margin-left: 10px;
+}
+
+
+td {
+ font-size: 10px;
+}
+
+a, a:hover, a:visited {
+ color: #000000;
+}
+
+.bandeauHaut {
+ height: 20px;
+ background: url(../img/fondBandeauHaut.png) no-repeat;
+ vertical-align: bottom;
+}
+
+.appVersion {
+ width: 100%;
+ text-align: right;
+ font-size: 11px;
+ height: 30px;
+ color: #FFFFFF;
+}
+
+span.filAriane {
+ float: left;
+ height: 20;
+ margin: 0 200
+}
+
+.filAriane {
+ font-size: 11px;
+ line-height: normal;
+ color: #6699CC;
+}
+
+a.filAriane, a:hover.filAriane, a:visited.filAriane {
+ color: #6699CC;
+}
+
+span.deconnexion {
+ float: right;
+}
+
+.deconnexion {
+ font-size: 11px;
+ line-height: normal;
+ color: #6699CC;
+}
+
+span.aide {
+ float: right;
+ line-height: normal;
+}
+
+.nomUtilisateur {
+ width: 140;
+ color: #6699CC;
+ font-size: 10px;
+ font-style: normal;
+ font-weight: normal;
+ line-height: 14px;
+ text-align: center;
+ margin: 0 0 20 0;
+}
+
+.bandeauGauche {
+ width: 140px;
+ vertical-align: top;
+}
+
+.menu {
+ margin-right: 3px;
+}
+
+.titreEcran {
+ background-image: url("../img/fondTitreEcran.gif");
+ background-repeat: no-repeat;
+ background-position: top left;
+ height:23px;
+ font-style: normal;
+ line-height: 23px;
+ font-weight: bold;
+ color: #FFFFFF;
+ text-align: left;
+ font-size: 11px;
+ padding-left: 7px;
+}
+
+.codeEcran {
+ text-align: right;
+ font-size: 10px;
+ color: #FF6060;
+}
+.criteriaRow {
+ height: 20px;
+ line-height: 20px;
+}
+.lastCriteriaRow {
+ line-height: 100%;
+ height: 100%;
+}
+.paveType1 {
+ background-color: #BACFE3;
+ border-color: #6699CC;
+ border-style: solid;
+ border-width: 2px;
+ display:table;
+ padding: 3px;
+ margin-bottom: 3px;
+}
+
+.paveType2 {
+ background-color: #FFFFFF;
+ border-color: #6699CC;
+ border-style: solid;
+ border-width: 2px;
+ display:table;
+ padding: 3px;
+ margin-bottom: 3px;
+}
+
+.libelleZone, .gwt-Label {
+ margin: 0;
+ padding: 3 0 0 15;
+ color: #000000;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 10px;
+ font-style: normal;
+ font-weight: normal;
+ line-height: 14px;
+ text-decoration: none;
+ text-align: left;
+ vertical-align : middle;
+}
+
+.libelleZoneObligatoire {
+ margin: 0;
+ padding: 3 0 0 14;
+ color: #000000;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 10px;
+ font-style: normal;
+ font-weight: normal;
+ line-height: 14px;
+ text-decoration: none;
+ text-align: left;
+ background: url(../img/required.gif) top left no-repeat;
+}
+
+.zoneNonSaisissable {
+ padding: 3 0 0 0;
+ color: #000000;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 10px;
+ font-style: normal;
+ font-weight: bold;
+ line-height: 14px;
+ text-decoration: none;
+ text-align: left;
+ background-color: transparent;
+ border-width:0px;
+}
+
+input.zoneNonSaisissable {
+}
+
+.zoneSaisissable, .gwt-ListBox, .gwt-TextBox, .gwt-DateBox {
+ color: #000000;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 10px;
+ font-style: normal;
+ font-weight: normal;
+ text-decoration: none;
+ text-align: left;
+ border: 1px solid #6a8ead;
+}
+.gwt-Hyperlink {
+ cursor: pointer;
+}
+
+.liste {
+
+}
+
+.actionListe {
+ font-weight: bold;
+ color: #000000;
+ font-size: 10px;
+ font-style: normal;
+ line-height: 14px;
+ color: #000000;
+ display: block;
+}
+
+.pagination {
+ font-size: 12px;
+}
+
+.enteteListePaire {
+ background-color: #BACFE3;
+ font-weight: bold;
+ color: #000000;
+ text-align: center;
+ font-size: 10px;
+ font-style: normal;
+ line-height: 14px;
+ text-decoration: none;
+}
+
+.enteteListeImpaire {
+ background-color: #D4E2F1;
+ font-weight: bold;
+ color: #000000;
+ text-align: center;
+ font-size: 10px;
+ font-style: normal;
+ line-height: 14px;
+ text-decoration: none;
+ margin-right: 10px;
+}
+
+th.enteteListeTriable, th.enteteListeTriable, th.enteteListeTriable {
+ background-position: right;
+ background-image: url(../img/tri/triable.gif);
+ background-repeat: no-repeat;
+}
+
+th.enteteListeTriable a, th.enteteListeTriable a:hover, th.enteteListeTriable a:visited {
+ color: #000000;
+ display: block;
+ width: 100%;
+ padding-right: 10px;
+}
+
+th.enteteListeTrieeAsc, th.enteteListeTrieeAsc, th.enteteListeTrieeAsc {
+ background-position: right;
+ background-image: url(../img/tri/asc.gif);
+ background-repeat: no-repeat;
+}
+
+th.enteteListeTrieeAsc a, th.enteteListeTrieeAsc a:hover, th.enteteListeTrieeAsc a:visited {
+ color: #000000;
+ display: block;
+ width: 100%;
+}
+
+th.enteteListeTrieeDesc, th.enteteListeTrieeDesc, th.enteteListeTrieeDesc {
+ background-position: right;
+ background-image: url(../img/tri/desc.gif);
+ background-repeat: no-repeat;
+}
+
+th.enteteListeTrieeDesc a, th.enteteListeTrieeDesc a:hover, th.enteteListeTrieeDesc a:visited {
+ color: #000000;
+ display: block;
+ width: 100%;
+}
+
+.ligneListePaire {
+ background-color: #D4E2F1;
+ color: #000000;
+ text-align: left;
+ font-size: 10px;
+ font-style: normal;
+ font-weight: normal;
+ line-height: 14px;
+ text-decoration: none;
+}
+
+.ligneListeImpaire {
+ background-color: #FFFFFF;
+ color: #000000;
+ text-align: left;
+ font-size: 10px;
+ font-style: normal;
+ font-weight: normal;
+ line-height: 14px;
+ text-decoration: none;
+}
+
+.ligneListeSelectionnee {
+ background-color: #E0ACB7; /*#D4E2F1; #8DABCA;#E0ACB7 ; #ffb6ad;*/
+ color: #000000;
+ text-align: left;
+ font-size: 10px;
+ font-style: normal;
+ font-weight: normal;
+ line-height: 14px;
+ text-decoration: none;
+}
+
+.boutonStandardPair {
+ background-color: #BACFE3;
+ border-right-width: medium;
+ border-bottom-width: medium;
+ border-right-style: solid;
+ border-bottom-style: solid;
+ border-right-color: #2C6095;
+ border-bottom-color: #2C6095;
+ font-size: 10px;
+ text-align: center;
+}
+
+.boutonStandardImpair {
+ background-color: #D4E2F1;
+ border-right-width: medium;
+ border-bottom-width: medium;
+ border-right-style: solid;
+ border-bottom-style: solid;
+ border-right-color: #6699CC;
+ border-bottom-color: #6699CC;
+ font-size: 10px;
+ text-align: center;
+}
+
+.boutonPetitImpair {
+ background-color: #BACFE3;
+ border-right-style: solid;
+ border-bottom-style: solid;
+ border-right-color: #2C6095;
+ border-bottom-color: #2C6095;
+ font-size: 10px;
+ text-align: center;
+}
+
+.texteErreur {
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ font-style: normal;
+ line-height: 16px;
+ font-weight: bold;
+ color: #000000;
+ text-decoration: none;
+}
+
+#errorDiv {
+ position: absolute;
+ left: 165px;
+ top: 50px;
+ width: 400px;
+ border-style: solid;
+ border-width: 1px;
+ border-color: #00006A;
+ background-color: white;
+ z-index: 1000;
+}
+
+.titreEcranAide {
+ color : #6699CC;
+ font-size: 12px;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-weight: bold;
+}
+
+.section {
+ padding: 10px 0px 10px 10px;
+ border-color: #6699CC;
+ border-style: solid;
+ border-width: 2px;
+}
+
+.legendeSection {
+ margin-bottom: 10px;
+ color: #000000;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ font-style: normal;
+ font-weight: bold;
+}
+
+.titreParagraphe {
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 13px;
+ font-style: normal;
+ line-height: 16px;
+ font-weight: bold;
+}
+
+.gwt-VerticalSplitPanel {
+}
+
+.gwt-VerticalSplitPanel .vsplitter {
+ cursor: move;
+ border: 0px;
+ height: 6px;
+ background: #D1E1EF url('../img/slider.gif') no-repeat center center; /* transparent*/
+ margin-top: 0px;
+}
+.bordered {
+ border: black solid 1px;
+}
+.gwt-TabBar {
+ border-bottom-color: #7A8A99;
+ border-bottom-style: solid;
+ border-bottom-width: 1px;
+ text-align: center;
+}
+.gwt-TabBar .gwt-TabBarFirst {
+ content: url(../img/tab-first.png);
+}
+.gwt-TabBar .gwt-TabBarItem {
+ background-color: #EEEEEE;
+ text-align: center;
+ white-space: nowrap;
+}
+.gwt-TabBar .gwt-TabBarItem-wrapper {
+ border-style: none;
+ border-top-style: solid;
+ border-right-style: solid;
+ border-color: #7A8A99;
+ border-width: 1px;
+ text-align: center;
+}
+.gwt-TabBar .gwt-TabBarItem-selected {
+ background-color: #B8CFE5;
+ color: blue;
+ text-align: center;
+ white-space: nowrap;
+}
+.gwt-TabBar .gwt-TabBarItem-wrapper-selected {
+ border-style: none;
+ border-top-style: solid;
+ border-right-style: solid;
+ border-color: #7A8A99;
+ border-width: 1px;
+}
+.selectable-listentry {
+ background-color: inherited;
+ color: inherited;
+ cursor: default;
+}
+.selectable-listentry-selected {
+ background-color: #0066CC;
+ color: white;
+ cursor: default;
+}
+.gwt-CheckBox-selected {
+ background-color: #0066CC;
+ color: white;
+}
+.gwt-BorderedScollPanel {
+ border-style: outset;
+ border-color: black;
+ border-width: 1px;
+}
+
+#menubar {
+ margin: 0 0 0 0;
+}
+
+.tabContainer {
+ border-top: solid 2px #6699CC;
+}
+
+.rTabActive, .rTab {
+ display: inline;
+}
+
+.rTabActive .rTabCell1 {
+ width: 0px; background: url('../img/tabs/ral.gif') no-repeat;
+}
+
+.rTabActive .rTabCell2 {
+ background: url('../img/tabs/rar.gif') no-repeat 100% 0px;
+}
+
+.rTab .rTabCell1 {
+ width: 0px; background: url('../img/tabs/rl.gif') no-repeat;
+}
+
+.rTab .rTabCell2 {
+ background: url('../img/tabs/rr.gif') no-repeat 100% 0px;
+}
+
+.rTabActive td a, .rTabActive td a:link, .rTabActive td a:visited, .rTabActive td a:active, .rTab td a, .rTab td a:link, .rTab td a:visited, .rTab td a:active {
+ font-family: Verdana,Helvetica,sans-serif; font-weight: bold; font-size: 12px; text-decoration: none; color: #FFFFFF;
+}
+
+.rTab td a:hover {
+ color: #FF200C;
+}
+
+table#SearchWidget { margin-left: -1px; }
+
+.separator { margin-top: 1px; width: 1px; float: left; }
+
+.gwt-HTML-header {
+ background-color: #3366ff;
+ color: white;
+ font-weight: bold;
+ font-size: 13px;
+ width: 100%;
+ height: 100%;
+}
+
+.TblListExport {
+ border-collapse: collapse;
+ border: #999999 solid 1px;
+ width: 100%;
+}
+.TblListExport tr td {
+ border: #999999 solid 1px;
+ margin-left: 5px;
+ margin-right: 5px;
+ margin-top: 2px;
+ margin-bottom: 2px;
+ padding: 0px;
+ font-size: 11px;
+ cursor: hand;
+}
+.highlited {
+ background-color: yellow;
+}
+
+.pointer-element { cursor: pointer; }
+
+.clickable-cell {
+ cursor: pointer;
+ text-align: left;
+ border-style: solid;
+ border-width: 1px;
+}
+.cell-header {
+ text-align: center;
+ background-color: #CCCCCC;
+ font-weight: bold;
+ border-style: solid;
+ border-width: 1px;
+}
+.table-collapsed {
+ border-collapse: collapse;
+}
+
+.gwt-TabLayoutPanelTabs {
+ left: 24px;
+}
+
+.working-panel {
+ filter:alpha(opacity=60);
+ opacity:0.6;
+ background-color:#000;
+ background-image: url('../img/searching.gif') no-repeat center center;
+}
\ No newline at end of file
--- /dev/null
+<%@ page
+ language="java"
+ pageEncoding="ISO-8859-15"
+ contentType="text/html; charset=ISO-8859-15"
+ import="org.apache.log4j.Logger, java.io.ByteArrayOutputStream, java.io.PrintStream"
+ isErrorPage="true" %>
+
+<%!
+ static public String stackToString(Throwable throwable) {
+ if (throwable == null) {
+ return null;
+ }
+ java.io.StringWriter buffer = new java.io.StringWriter();
+ java.io.PrintWriter writer = new java.io.PrintWriter(buffer);
+ throwable.printStackTrace(writer);
+ try {
+ buffer.close();
+ } catch (java.io.IOException ioe) {
+ throw new RuntimeException(ioe);
+ }
+ return buffer.toString();
+ }
+%>
+<%
+ Logger logger = Logger.getLogger("ERROR.REPORTER");
+ String codeErreur = request.getRemoteAddr() + ":" + Long.toString(System.currentTimeMillis());
+ if (exception == null) {
+ exception = (java.lang.Exception) request.getSession().getAttribute(fr.gouv.finances.dgfip.xemelios.web.WebAppCst.SessionAttributes.ajaxExceptionKey);
+ }
+ logger.error(codeErreur, exception);
+%>
+<html>
+ <head>
+ <link rel="stylesheet" href="css/standard.css" type="text/css">
+ <link rel="icon" type="image/png" href="<%=request.getContextPath()%>/img/favicon.png"/>
+ </head>
+ <body>
+ <table border="0" width="100%" cellspacing="0" cellpadding="0">
+ <tr>
+ <td valign="top" align="left">
+ Une erreur inattendue est survenue.<br/>
+ Veuillez contacter votre administrateur en lui précisant le code suivant : <%= codeErreur%>
+ </td>
+ </tr>
+ </table>
+ <div style="height: 0; visibility: hidden; overflow: hidden">
+ <%= stackToString(exception) %>
+ </div>
+ </body>
+</html>
\ No newline at end of file
--- /dev/null
+<%
+ if (request.getQueryString() != null) {
+ response.sendRedirect(request.getContextPath() + "/connexion.do?" + request.getQueryString());
+ } else {
+ response.sendRedirect(request.getContextPath() + "/connexion.do");
+ }
+%>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="" version="2.0">
+ <!-- warning: do not change output encoding ! -->
+ <xsl:output method="xhtml" encoding="ISO-8859-1" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" />
+ <xsl:character-map name="accents">
+ <xsl:output-character character="à" string="&agrave;"/>
+ <xsl:output-character character="é" string="&eacute;"/>
+ <xsl:output-character character="è" string="&egrave;"/>
+ <xsl:output-character character="ê" string="&ecirc;"/>
+ <xsl:output-character character="ë" string="&euml;"/>
+ <xsl:output-character character="î" string="&icirc;"/>
+ <xsl:output-character character="ï" string="&iuml;"/>
+ <xsl:output-character character="ô" string="&ocirc;"/>
+ <xsl:output-character character="ù" string="&ugrave;"/>
+ <xsl:output-character character="ü" string="&uuml;"/>
+ </xsl:character-map>
+
+ <xsl:param name="server"/>
+ <xsl:param name="context"/>
+ <xsl:param name="port"/>
+ <xsl:param name="navigationId"/>
+
+ <xsl:template match="@*|node()">
+ <xsl:choose>
+ <xsl:when test="contains('|href|src|action|',concat('|',name(.),'|'))">
+ <xsl:variable name="href" select="."/>
+ <!-- depends on protocol : http, ftp, https remain unchanged ; xemelios is modified -->
+ <xsl:variable name="protocol" select="substring-before($href,':')"/>
+ <xsl:variable name="newHref">
+ <xsl:choose>
+ <xsl:when test="$protocol = 'xemelios'">
+ <!-- form is : xemelios:/query?docId=PES_Aller&etatId=PES_RecetteAller&elementId=BordereauRecette&collectivite=26620926100012&budget=00&path=[@added:primary-key='2008-02-100015']&xsl:param=(mandatId,100018) -->
+ <xsl:variable name="uri" select="substring-after($href,'/')"/>
+ <xsl:variable name="params">
+ <xsl:choose>
+ <xsl:when test="contains($uri,'?')"><xsl:value-of select="substring-after($uri,'?')"/></xsl:when>
+ <xsl:otherwise></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="servlet">
+ <xsl:choose>
+ <xsl:when test="contains($uri,'?')"><xsl:value-of select="substring-before($uri,'?')"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$uri"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$servlet = 'query'">http://<xsl:value-of select="$server"/>:<xsl:value-of select="$port"/><xsl:value-of select="$context"/>/navigation.do?<xsl:value-of select="$params"/>&navigationId=<xsl:value-of select="$navigationId"/></xsl:when>
+ <xsl:when test="$servlet = 'attachment'">http://<xsl:value-of select="$server"/>:<xsl:value-of select="$port"/><xsl:value-of select="$context"/>/attachment.do?<xsl:value-of select="$params"/>&navigationId=<xsl:value-of select="$navigationId"/></xsl:when>
+ <xsl:when test="$servlet = 'resource'">http://<xsl:value-of select="$server"/>:<xsl:value-of select="$port"/><xsl:value-of select="$context"/>/resource.do?<xsl:value-of select="$params"/>&navigationId=<xsl:value-of select="$navigationId"/></xsl:when>
+ <xsl:when test="$servlet = 'customLink'">http://<xsl:value-of select="$server"/>:<xsl:value-of select="$port"/><xsl:value-of select="$context"/>/customLink.do?<xsl:value-of select="$params"/>&navigationId=<xsl:value-of select="$navigationId"/></xsl:when>
+ <xsl:otherwise>http://<xsl:value-of select="$server"/>:<xsl:value-of select="$port"/>/<xsl:value-of select="$servlet"/>?<xsl:value-of select="$params"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="{name(.)}"><xsl:value-of select="$newHref"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:template>
+</xsl:stylesheet>
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN">
+<html>
+ <head>
+ <!-- meta name='gwt:module' content='fr.gouv.finances.dgfip.xemelios.web2.gwt.XemeliosStarter=fr.gouv.finances.dgip.xemelios.web2.gwt.XemeliosStarter' -->
+ <title>XeMeLios V5</title>
+ <link rel="stylesheet" href="css/standard.css" type="text/css"/>
+ </head>
+ <body>
+ <script type="text/javascript" src="XeMeLios/XeMeLios.nocache.js"></script>
+ </body>
+</html>