|
From: <de...@us...> - 2010-09-24 21:19:36
|
Revision: 5955
http://fudaa.svn.sourceforge.net/fudaa/?rev=5955&view=rev
Author: deniger
Date: 2010-09-24 21:19:29 +0000 (Fri, 24 Sep 2010)
Log Message:
-----------
Modified Paths:
--------------
trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java
trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java
trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedStatisticSaver.java
trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java
Added Paths:
-----------
trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/persist/XppCustomDriver.java
Modified: trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java
===================================================================
--- trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java 2010-09-24 08:56:13 UTC (rev 5954)
+++ trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java 2010-09-24 21:19:29 UTC (rev 5955)
@@ -812,7 +812,6 @@
int w = getWidth()+1;
CtuluListSelection memory = new CtuluListSelection(w * getHeight());
Envelope envReel = _clipReel.getEnv();
- long t0 = System.currentTimeMillis();
for (idxElt = 0; idxElt < n; idxElt++) {
if (!modelToUse.isPainted(idxElt)) {
continue;
@@ -888,19 +887,20 @@
}
}
_g.drawLine(minX, minY, maxX, maxY);
- } else if (((maxX - minX) == 1 && (maxY - minY) == 1)) {
- double value = modelToUse.getDatatFor(idxElt, 0);
- final Color c = EbliLib.getAlphaColor(paletteCouleur_ == null ? null : ((BPalettePlage) paletteCouleur_) // on utilise getIsoModelAbstract car on est bien dans le cas ou il n'y a pas d'adapteur
- .getColorFor(value), alpha_);
- _g.setColor(c);
- for (int iPoly = 1; iPoly < nbPt; iPoly++) {
- _g.drawLine(x[iPoly], y[iPoly],x[iPoly-1], y[iPoly-1]);
- int idxDone = x[iPoly] + y[iPoly] * w;
- if (idxDone >= 0 && !memory.isSelected(idxDone)) {
- memory.add(idxDone);
- }
- }
- _g.drawLine(x[0], y[0],x[nbPt-1], y[nbPt-1]);
+ //TODO optimisation a revoir
+// } else if (((maxX - minX) == 1 && (maxY - minY) == 1)) {
+// double value = modelToUse.getDatatFor(idxElt, 0);
+// final Color c = EbliLib.getAlphaColor(paletteCouleur_ == null ? null : ((BPalettePlage) paletteCouleur_) // on utilise getIsoModelAbstract car on est bien dans le cas ou il n'y a pas d'adapteur
+// .getColorFor(value), alpha_);
+// _g.setColor(c);
+// for (int iPoly = 1; iPoly < nbPt; iPoly++) {
+// _g.drawLine(x[iPoly], y[iPoly],x[iPoly-1], y[iPoly-1]);
+// int idxDone = x[iPoly] + y[iPoly] * w;
+// if (idxDone >= 0 && !memory.isSelected(idxDone)) {
+// memory.add(idxDone);
+// }
+// }
+// _g.drawLine(x[0], y[0],x[nbPt-1], y[nbPt-1]);
} else {
v_ = modelToUse.fillWithData(idxElt, v_);
Modified: trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java
===================================================================
--- trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2010-09-24 08:56:13 UTC (rev 5954)
+++ trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2010-09-24 21:19:29 UTC (rev 5955)
@@ -1,12 +1,18 @@
package org.fudaa.fudaa.tr.post;
import java.awt.BorderLayout;
+import java.awt.Color;
import java.awt.Dimension;
+import java.awt.EventQueue;
import java.awt.Graphics;
+import java.awt.Graphics2D;
import java.awt.Point;
+import java.awt.Shape;
+import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.awt.print.PageFormat;
import java.awt.print.Printable;
+import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@@ -14,7 +20,6 @@
import java.util.Map;
import java.util.Set;
-import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JMenu;
@@ -52,6 +57,7 @@
import org.fudaa.ebli.impression.EbliPrinter;
import org.fudaa.ebli.ressource.EbliResource;
import org.fudaa.ebli.visuallibrary.EbliNode;
+import org.fudaa.ebli.visuallibrary.EbliScene;
import org.fudaa.ebli.visuallibrary.EbliWidgetController;
import org.fudaa.ebli.visuallibrary.EbliWidgetControllerInterface;
import org.fudaa.ebli.visuallibrary.EbliWidgetEditModeListener;
@@ -70,12 +76,10 @@
import org.fudaa.fudaa.tr.TrLauncherDefault;
import org.fudaa.fudaa.tr.common.TrCourbeImporter;
import org.fudaa.fudaa.tr.common.TrLib;
-import org.fudaa.fudaa.tr.common.TrProjet;
import org.fudaa.fudaa.tr.common.TrResource;
import org.fudaa.fudaa.tr.common.TrCourbeImporter.Target;
import org.fudaa.fudaa.tr.post.actions.TrPostActionBilan;
import org.fudaa.fudaa.tr.post.actions.TrPostActionChooseAndCreateCalque;
-import org.fudaa.fudaa.tr.post.actions.TrPostActionController;
import org.fudaa.fudaa.tr.post.dialogSpec.TrPostWizardCreateScope;
import org.fudaa.fudaa.tr.post.dialogSpec.TrPostWizardImportScope;
import org.fudaa.fudaa.tr.post.profile.MvProfileTreeModel;
@@ -202,9 +206,13 @@
* @param _controller
*/
private void changeSouth(final EbliWidgetInterface _controller) {
- if (panelSouthSuiviSouris_ != null) this.remove(this.panelSouthSuiviSouris_);
+ if (panelSouthSuiviSouris_ != null) {
+ this.remove(this.panelSouthSuiviSouris_);
+ }
this.panelSouthSuiviSouris_ = _controller.getController().getTracableComponent();
- if (panelSouthSuiviSouris_ == null) panelSouthSuiviSouris_ = defaultSouth_;
+ if (panelSouthSuiviSouris_ == null) {
+ panelSouthSuiviSouris_ = defaultSouth_;
+ }
this.add(panelSouthSuiviSouris_, BorderLayout.SOUTH);
this.revalidate();
}
@@ -344,8 +352,9 @@
for (final Iterator<EbliNode> it = ((Set<EbliNode>) getScene().getSelectedObjects()).iterator(); it.hasNext();) {
final EbliNode node = it.next();
if (!(node.getCreator() instanceof EbliWidgetCreatorLegende)
- && !(node.getCreator() instanceof org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorLegende)) projet_.nodesCopyied
- .add(node);
+ && !(node.getCreator() instanceof org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorLegende)) {
+ projet_.nodesCopyied.add(node);
+ }
}
// -- reinit de la commande cut si on voulait faire un ctrl+x
projet_.nodesCutted = null;
@@ -365,7 +374,9 @@
if (controller_ != null) {
final Set<EbliNode> noeudContenus = (Set<EbliNode>) controller_.getSceneCourante().getObjects();
- if (noeudContenus.size() == 1) getScene().setSelectedObjects(noeudContenus);
+ if (noeudContenus.size() == 1) {
+ getScene().setSelectedObjects(noeudContenus);
+ }
getScene().refresh();
}
}
@@ -382,8 +393,9 @@
for (final Iterator<EbliNode> it = ((Set<EbliNode>) getScene().getSelectedObjects()).iterator(); it.hasNext();) {
final EbliNode node = it.next();
if (!(node.getCreator() instanceof EbliWidgetCreatorLegende)
- && !(node.getCreator() instanceof org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorLegende)) projet_.nodesCutted
- .add(node);
+ && !(node.getCreator() instanceof org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorLegende)) {
+ projet_.nodesCutted.add(node);
+ }
}
// -- suppression des nodes depuis cetet kliste pour eviter les concourant
@@ -400,8 +412,9 @@
projet_.nodesCopyied = null;
// --creation de la commande undo/redo --//
- if (projet_.nodesCutted != null && projet_.nodesCutted.size() != 0) getScene().getCmdMng().addCmd(
- new CommandUndoRedoCut(projet_.nodesCutted));
+ if (projet_.nodesCutted != null && projet_.nodesCutted.size() != 0) {
+ getScene().getCmdMng().addCmd(new CommandUndoRedoCut(projet_.nodesCutted));
+ }
}
@@ -409,10 +422,12 @@
throw new IllegalAccessError("not supported");
}
- public void editStart(final Widget _w, JComponent _editor) {
+ public void editStart(final Widget _w, final JComponent _editor) {
editorEnCours_ = _editor;
final EbliNode node = (EbliNode) controller_.getSceneCourante().findObject(_w);
- if (node == null || !node.hasWidget() || node.getWidget().getController() == null) editStop(null, null);
+ if (node == null || !node.hasWidget() || node.getWidget().getController() == null) {
+ editStop(null, null);
+ }
if (node.getCreator() instanceof EbliWidgetCreatorVueCalque) {
// -- etape 1: ajout du tree dans fudaaImplementation --//
@@ -464,7 +479,7 @@
}
- public void editStop(final Widget _w, JComponent _editor) {
+ public void editStop(final Widget _w, final JComponent _editor) {
editorEnCours_ = null;
changeTree(getScene());
changeToolbarScene();
@@ -625,8 +640,11 @@
// --recuperation des noeuds copies --//
if (projet_.nodesCopyied != null) {
- ArrayList<EbliNode> listeNodeUndo = EbliWidgetActionDuplicate.duplicateInScene(projet_.nodesCopyied, getScene());
- if (listeNodeUndo.size() != 0) getScene().getCmdMng().addCmd(new CommandUndoRedoPaste(listeNodeUndo));
+ final ArrayList<EbliNode> listeNodeUndo = EbliWidgetActionDuplicate.duplicateInScene(projet_.nodesCopyied,
+ getScene());
+ if (listeNodeUndo.size() != 0) {
+ getScene().getCmdMng().addCmd(new CommandUndoRedoPaste(listeNodeUndo));
+ }
// reinitialisation de la liste
projet_.nodesCopyied = null;
@@ -643,8 +661,9 @@
}
// --creation de la commande undo/redo --//
- if (projet_.nodesCutted != null && projet_.nodesCutted.size() != 0) getScene().getCmdMng().addCmd(
- new CommandUndoRedoPaste(projet_.nodesCutted));
+ if (projet_.nodesCutted != null && projet_.nodesCutted.size() != 0) {
+ getScene().getCmdMng().addCmd(new CommandUndoRedoPaste(projet_.nodesCutted));
+ }
// reinit de la liste
projet_.nodesCutted = null;
@@ -654,8 +673,56 @@
}
}
- public int print(Graphics _g, PageFormat _format, int _page) {
- return EbliPrinter.printComponent(_g, _format, controller_.getSceneCourante().getView(), false, _page);
+ public int print(final Graphics _g, final PageFormat _format, final int _page) {
+ if (_page != 0) { return Printable.NO_SUCH_PAGE; }
+ final EbliScene scene = getScene();
+ // Sauvegarde de Clip pour restauration finale.
+ final Shape s = _g.getClip();
+ // Utilisation de methode de Graphics2d.
+ final Graphics2D g2d = (Graphics2D) _g;
+ AffineTransform transform = g2d.getTransform();
+
+ // Initialisation du graphics et translation de l 'origine.
+ final double[] coord = EbliPrinter.initGraphics(g2d, _format);
+ final Dimension dimension = scene.getDefaultImageDimension();
+
+ // Calcul du facteur d'echelle.
+ final int wComp = dimension.width;
+ final int hComp = dimension.height;
+ final double facteur = EbliPrinter.echelle(_format, wComp, hComp);
+ final double wCompDessine = wComp * facteur;
+ final double hCompDessine = hComp * facteur;
+ // definition de la zone d'impression
+ double xCentre = (_format.getImageableWidth() - wCompDessine) / 2;
+ double yCentre = (_format.getImageableHeight() - hCompDessine) / 2;
+// if (_format.getOrientation() == PageFormat.LANDSCAPE) {
+// xCentre = 0;
+// yCentre = 0;
+// }
+ g2d.translate(xCentre, yCentre);
+ try {
+ Runnable runnable = new Runnable() {
+
+ @Override
+ public void run() {
+ scene.produceImage(g2d, (int) wCompDessine, (int) hCompDessine, null);
+
+ }
+ };
+ if (!EventQueue.isDispatchThread()) {
+ EventQueue.invokeAndWait(runnable);
+ } else {
+ runnable.run();
+ }
+ } catch (Exception e) {
+ FuLog.error(e);
+ }
+ g2d.setTransform(transform);
+ g2d.setColor(Color.RED);
+ g2d.drawRect((int) _format.getImageableX(), (int) _format.getImageableY(), (int) _format.getImageableWidth(),
+ (int) _format.getImageableHeight());
+ g2d.setClip(s);
+ return Printable.PAGE_EXISTS;
}
public BufferedImage produceImage(final int _w, final int _h, final Map _params) {
@@ -694,8 +761,12 @@
super.setTitle(_title);
if (ecrasePrevious_) {
previousTitleFrame = title;
- if (menus_ != null) menus_[0].setText(_title);
- } else ecrasePrevious_ = true;
+ if (menus_ != null) {
+ menus_[0].setText(_title);
+ }
+ } else {
+ ecrasePrevious_ = true;
+ }
}
public void setTitle(final String _title, final boolean ecrasePrevious) {
@@ -716,10 +787,10 @@
}
@SuppressWarnings("serial")
- public void startExport(CtuluUI impl) {
- Collection<EbliNode> nodes = controller_.getSceneCourante().getNodes();
- Collection<CtuluExportDataInterface> exportables = new ArrayList<CtuluExportDataInterface>();
- for (EbliNode node : nodes) {
+ public void startExport(final CtuluUI impl) {
+ final Collection<EbliNode> nodes = controller_.getSceneCourante().getNodes();
+ final Collection<CtuluExportDataInterface> exportables = new ArrayList<CtuluExportDataInterface>();
+ for (final EbliNode node : nodes) {
if (node.getController().isDataExportable()) {
exportables.add((CtuluExportDataInterface) node.getController());
}
@@ -732,19 +803,19 @@
exportables.iterator().next().startExport(impl);
return;
}
- BuComboBox cb = new BuComboBox(exportables.toArray());
+ final BuComboBox cb = new BuComboBox(exportables.toArray());
cb.setRenderer(new CtuluCellTextRenderer() {
@Override
- protected void setValue(Object value) {
+ protected void setValue(final Object value) {
setText(((CtuluExportDataInterface) value).getTitle());
}
});
- CtuluDialogPanel pn = new CtuluDialogPanel(false);
+ final CtuluDialogPanel pn = new CtuluDialogPanel(false);
pn.setLayout(new BorderLayout());
pn.addLabel(TrResource.getS("Choisir la source de donn\xE9es"));
pn.add(cb);
- boolean afficheModaleOk = pn.afficheModaleOk(impl.getParentComponent(), getTitle());
+ final boolean afficheModaleOk = pn.afficheModaleOk(impl.getParentComponent(), getTitle());
if (afficheModaleOk) {
((CtuluExportDataInterface) cb.getSelectedItem()).startExport(impl);
}
Modified: trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedStatisticSaver.java
===================================================================
--- trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedStatisticSaver.java 2010-09-24 08:56:13 UTC (rev 5954)
+++ trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/data/TrPostDataCreatedStatisticSaver.java 2010-09-24 21:19:29 UTC (rev 5955)
@@ -23,7 +23,9 @@
public class TrPostDataCreatedStatisticSaver implements TrPostDataCreatedSaver {
public TrPostDataCreated restore(H2dVariableType _newVar, final TrPostSource _src, final CtuluUI _ui, final Map _shortName, TrPostSourcesManager srcMng, CtuluAnalyze log) {
- return TrPostDataCreatedStatistic.createFrom(this, _src, _shortName, _ui);
+ TrPostDataCreatedStatistic stat = TrPostDataCreatedStatistic.createFrom(this, _src, _shortName, _ui);
+ stat.updateValues();
+ return stat;
}
double[] data_;
@@ -38,7 +40,7 @@
}
public TrPostDataCreatedStatisticSaver(final TrPostDataCreatedStatistic _data) {
- data_ = _data.value_;
+// data_ = _data.value_;
statId_ = _data.evaluator_.getStatId();
tBegin_ = _data.tsBegin_;
tEnd_ = _data.tsEnd_;
Modified: trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java
===================================================================
--- trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2010-09-24 08:56:13 UTC (rev 5954)
+++ trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2010-09-24 21:19:29 UTC (rev 5955)
@@ -26,8 +26,14 @@
import com.memoire.fu.FuLib;
import com.memoire.fu.FuLog;
import com.thoughtworks.xstream.XStream;
-import com.thoughtworks.xstream.io.xml.DomDriver;
+import com.thoughtworks.xstream.converters.Converter;
+import com.thoughtworks.xstream.converters.MarshallingContext;
+import com.thoughtworks.xstream.converters.UnmarshallingContext;
+import com.thoughtworks.xstream.io.HierarchicalStreamReader;
+import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
+import com.thoughtworks.xstream.io.xml.StaxDriver;
import com.thoughtworks.xstream.io.xml.XmlFriendlyReplacer;
+import com.thoughtworks.xstream.io.xml.XppDriver;
import com.thoughtworks.xstream.persistence.XmlArrayList;
import org.fudaa.ctulu.CtuluAnalyze;
@@ -60,6 +66,7 @@
import org.fudaa.fudaa.tr.post.TrPostTimeModelSaver;
import org.fudaa.fudaa.tr.post.TrPostUserVariableSaver;
import org.fudaa.fudaa.tr.post.actions.TrPostActionFusionCalques;
+import org.fudaa.fudaa.tr.post.data.TrPostDataCreatedStatisticSaver;
import org.netbeans.api.visual.widget.Widget;
import org.netbeans.modules.visual.anchor.TriangleAnchorShape;
@@ -120,7 +127,7 @@
ProgressionInterface prog_;
File projet_;
- public File getProjet_() {
+ public File getProjet() {
return projet_;
}
@@ -193,27 +200,21 @@
if (projet_ != null) {}
File conteneurProjet = null;
- fileChooser.setFileFilter(new FileFilter()
- {
-
+ fileChooser.setFileFilter(new FileFilter() {
+
@Override
- public String getDescription()
- {
+ public String getDescription() {
return "*.POST (Fichier POST)";
}
-
+
@Override
- public boolean accept(File f)
- {
- if (f.isDirectory())
- {
- return true;
- }
-
+ public boolean accept(File f) {
+ if (f.isDirectory()) { return true; }
+
return false;
}
});
-
+
final int reponse = fileChooser.showSaveDialog(CtuluLibSwing.getFrameAncestor(ui_.getParentComponent()));
if (reponse == JFileChooser.APPROVE_OPTION) {
conteneurProjet = fileChooser.getSelectedFile();
@@ -494,7 +495,7 @@
// -- g\xE9n\xE9ration du xml pour la scene --//
try {
final File fichier = new File(projet + File.separator + setupProject);
- out=EbliLib.createObjectOutpuStream(fichier, getParser());
+ out = EbliLib.createObjectOutpuStream(fichier, getParser());
// --enregistrement du path relatif --//
final File pathRelatif = CtuluLibFile.getRelativePathnameTo(fichier, projet_);
@@ -530,11 +531,10 @@
ObjectOutputStream out = null;
// -- g\xE9n\xE9ration du xml pour la scene --//
try {
- if(!file.exists()){
+ if (!file.exists()) {
file.getParentFile().mkdirs();
}
out = EbliLib.createObjectOutpuStream(file, getParser());
-
// -- redame --//
out.writeObject(XmlCommentaire.getCommentaireSources());
@@ -808,7 +808,7 @@
e.printStackTrace();
} finally {
try {
- in.close();
+ if (in != null) in.close();
} catch (final IOException e) {
e.printStackTrace();
}
@@ -1100,8 +1100,9 @@
*/
private XStream initXmlParser() {
final XmlFriendlyReplacer replacer = new XmlFriendlyReplacer("#", "_");
- final DomDriver domDriver = new DomDriver("UTF-8", replacer);
- final XStream xstream = new XStream(domDriver);
+ // final DomDriver domDriver = new DomDriver("UTF-8", replacer);
+ final XppDriver staxDriver = new XppCustomDriver(replacer);
+ final XStream xstream = new XStream(staxDriver);
// -- creation des alias pour que ce soit + parlant dans le xml file --//
xstream.alias("LAYOUT", EbliSceneSerializeXml.class);
xstream.alias("FRAME", EbliWidgetSerializeXml.class);
@@ -1116,12 +1117,26 @@
xstream.alias("README", XmlCommentaire.class);
xstream.alias("TIMEMODEL", TrPostTimeModelSaver.class);
xstream.alias("USERVAR", TrPostUserVariableSaver.class);
+ xstream.omitField(TrPostDataCreatedStatisticSaver.class, "data_");
xstream.omitField(TriangleAnchorShape.class, "generalPath");
+ xstream.registerLocalConverter(TrPostDataCreatedStatisticSaver.class, "data_", new Converter() {
- // xstream.addImplicitCollection(EbliWidgetSerializeXml.CoupleNomId.class,
- // "FRAMENAME");
- // xstream.alias( "NbElements",Integer.class);
+ @Override
+ public boolean canConvert(Class type) {
+ return true;
+ }
+ @Override
+ public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
+ return null;
+ }
+
+ @Override
+ public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
+
+ }
+ });
+
return xstream;
}
@@ -1426,7 +1441,9 @@
}
// -- on ajoute les noeuds selectionnes a ebliScene --//
- if (listeNodeSelect != null) scenToUpdate.setSelectedObjects(listeNodeSelect);
+ if (listeNodeSelect != null) {
+ if (listeNodeSelect != null) scenToUpdate.setSelectedObjects(listeNodeSelect);
+ }
// mise a jour de la scene
scenToUpdate.refresh();
Added: trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/persist/XppCustomDriver.java
===================================================================
--- trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/persist/XppCustomDriver.java (rev 0)
+++ trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/persist/XppCustomDriver.java 2010-09-24 21:19:29 UTC (rev 5955)
@@ -0,0 +1,46 @@
+package org.fudaa.fudaa.tr.post.persist;
+
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+
+import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
+import com.thoughtworks.xstream.io.xml.PrettyPrintWriter;
+import com.thoughtworks.xstream.io.xml.XmlFriendlyReplacer;
+import com.thoughtworks.xstream.io.xml.XppDriver;
+
+import org.fudaa.ctulu.CtuluLibString;
+
+/**
+ * @author deniger
+ */
+public class XppCustomDriver extends XppDriver {
+
+ /**
+ *
+ */
+ public XppCustomDriver() {}
+
+ /**
+ * @param replacer
+ */
+ public XppCustomDriver(XmlFriendlyReplacer replacer) {
+ super(replacer);
+ }
+
+ private static char[] INDENT = new char[] { ' ', ' ' };
+
+ @Override
+ public HierarchicalStreamWriter createWriter(Writer out) {
+ return new PrettyPrintWriter(out, INDENT, CtuluLibString.LINE_SEP, xmlFriendlyReplacer());
+ }
+
+ /**
+ *
+ */
+ @Override
+ public HierarchicalStreamWriter createWriter(OutputStream out) {
+ return createWriter(new OutputStreamWriter(out));
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|