Author: chatellier Date: 2011-03-23 14:44:28 +0000 (Wed, 23 Mar 2011) New Revision: 3199 Log: Revert visitor deletion. Visitor was customized containing a usefull hack. Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/export/RegionEntityVisitor.java Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/export/RegionExplorer.java Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/export/RegionEntityVisitor.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/export/RegionEntityVisitor.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/export/RegionEntityVisitor.java 2011-03-23 14:44:28 UTC (rev 3199) @@ -0,0 +1,73 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2010 Ifremer, Code Lutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.mexico.export; + +import org.nuiton.topia.persistence.EntityVisitor; +import org.nuiton.topia.persistence.HorizontalEntityVisitor; +import org.nuiton.topia.persistence.TopiaEntity; + +import fr.ifremer.isisfish.entities.Equation; + +/** + * Parcourt en largeur du model et délegation à un autre visiteur. + * + * Extend {@link HorizontalEntityVisitor} from topia to add + * a hack about internal entity equation. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class RegionEntityVisitor extends HorizontalEntityVisitor { + + /** + * Constructor. + * + * @param delegateVisitor delegate visitor + */ + public RegionEntityVisitor(EntityVisitor delegateVisitor) { + super(delegateVisitor); + } + + /* + * @see org.nuiton.topia.persistence.EntityVisitor#visit(org.nuiton.topia.persistence.TopiaEntity, java.lang.String, java.lang.Class, java.lang.Object) + */ + @Override + public void visit(TopiaEntity e, String name, Class<?> type, Object value) { + // si c'est une entité + + // FIXME only hack about Equation is used instead of Topia visitor + if (value instanceof TopiaEntity && !(value instanceof Equation)) { + TopiaEntity entity = (TopiaEntity) value; + toVisitEntities.add(entity); + } else { + delegateVisitor.visit(e, name, type, value); + } + } + +} // HorizontallyEntityVisitor Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/export/RegionEntityVisitor.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/export/RegionExplorer.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/export/RegionExplorer.java 2011-03-23 09:00:21 UTC (rev 3198) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/export/RegionExplorer.java 2011-03-23 14:44:28 UTC (rev 3199) @@ -62,7 +62,7 @@ regionExport.beginExport(); - HorizontalEntityVisitor visitor = new HorizontalEntityVisitor(regionExport); + RegionEntityVisitor visitor = new RegionEntityVisitor(regionExport); // explore cells for (Cell cell : region.getCell()) {