branch develop updated (5748d32 -> 43ef7e4)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository tutti. See http://git.codelutin.com/tutti.git from 5748d32 center panel + add FIXME on validator new 43ef7e4 refs #6453 [CAPTURE] compléter l'écran résumé avec un poids label non modifiables en italique The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 43ef7e470b63fabe16bf3b7e0c25289ee43bf73a Author: Kevin Morin <morin@codelutin.com> Date: Tue Jan 20 16:25:19 2015 +0100 refs #6453 [CAPTURE] compléter l'écran résumé avec un poids label non modifiables en italique Summary of changes: .../operation/catches/EditCatchesUIHandler.java | 106 ++++++++++++++------- tutti-ui-swing/src/main/resources/EcranResume.svg | 2 +- 2 files changed, 71 insertions(+), 37 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository tutti. See http://git.codelutin.com/tutti.git commit 43ef7e470b63fabe16bf3b7e0c25289ee43bf73a Author: Kevin Morin <morin@codelutin.com> Date: Tue Jan 20 16:25:19 2015 +0100 refs #6453 [CAPTURE] compléter l'écran résumé avec un poids label non modifiables en italique --- .../operation/catches/EditCatchesUIHandler.java | 106 ++++++++++++++------- tutti-ui-swing/src/main/resources/EcranResume.svg | 2 +- 2 files changed, 71 insertions(+), 37 deletions(-) diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java index 5708064..612fa46 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java @@ -47,7 +47,15 @@ import org.apache.batik.dom.svg.SAXSVGDocumentFactory; import org.apache.batik.dom.svg.SVGOMRectElement; import org.apache.batik.dom.svg.SVGOMTextElement; import org.apache.batik.swing.JSVGCanvas; +import org.apache.batik.swing.JSVGScrollPane; +import org.apache.batik.swing.gvt.GVTTreeRendererAdapter; +import org.apache.batik.swing.gvt.GVTTreeRendererEvent; +import org.apache.batik.swing.svg.GVTTreeBuilderAdapter; +import org.apache.batik.swing.svg.GVTTreeBuilderEvent; +import org.apache.batik.swing.svg.SVGDocumentLoaderAdapter; +import org.apache.batik.swing.svg.SVGDocumentLoaderEvent; import org.apache.batik.util.RunnableQueue; +import org.apache.batik.util.SVGConstants; import org.apache.batik.util.XMLResourceDescriptor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -59,7 +67,10 @@ import org.w3c.dom.Element; import org.w3c.dom.css.CSSStyleDeclaration; import org.w3c.dom.events.EventListener; import org.w3c.dom.events.EventTarget; +import org.w3c.dom.svg.SVGDocument; +import org.w3c.dom.svg.SVGLength; import org.w3c.dom.svg.SVGRect; +import org.w3c.dom.svg.SVGSVGElement; import org.w3c.dom.svg.SVGStylable; import javax.swing.JComponent; @@ -69,8 +80,10 @@ import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.BorderLayout; -import java.awt.Color; +import java.awt.*; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.awt.geom.AffineTransform; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.IOException; @@ -220,12 +233,6 @@ public class EditCatchesUIHandler extends AbstractTuttiTabContainerUIHandler<Edi } }); - TuttiConfiguration config = getConfig(); - WeightUnit catchWeightUnit = WeightUnit.KG; - WeightUnit speciesWeightUnit = config.getSpeciesWeightUnit(); - WeightUnit benthosWeightUnit = config.getBenthosWeightUnit(); - WeightUnit marineLitterWeightUnit = config.getMarineLitterWeightUnit(); - try { // Parse the barChart.svg file into a Document. String parser = XMLResourceDescriptor.getXMLParserClassName(); @@ -237,26 +244,38 @@ public class EditCatchesUIHandler extends AbstractTuttiTabContainerUIHandler<Edi ui.getSvgCanvasPanel().add(canvas, BorderLayout.CENTER); canvas.setRecenterOnResize(true); - canvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC); - canvas.setDocument(svgDocument); + canvas.addGVTTreeBuilderListener(new GVTTreeBuilderAdapter() { + public void gvtBuildCompleted(GVTTreeBuilderEvent e) { + + TuttiConfiguration config = getConfig(); + WeightUnit catchWeightUnit = WeightUnit.KG; + WeightUnit speciesWeightUnit = config.getSpeciesWeightUnit(); + WeightUnit benthosWeightUnit = config.getBenthosWeightUnit(); + WeightUnit marineLitterWeightUnit = config.getMarineLitterWeightUnit(); - initSvgField(CatchBatch.PROPERTY_CATCH_TOTAL_WEIGHT, getModel().getCatchTotalComputedOrNotWeight(), catchWeightUnit); - initSvgField(CatchBatch.PROPERTY_CATCH_TOTAL_REJECTED_WEIGHT, getModel().getCatchTotalRejectedComputedOrNotWeight(), catchWeightUnit); - initSvgField(CatchBatch.PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT, getModel().getSpeciesTotalSortedComputedOrNotWeight(), speciesWeightUnit); - initSvgField(CatchBatch.PROPERTY_BENTHOS_TOTAL_SORTED_WEIGHT, getModel().getBenthosTotalSortedComputedOrNotWeight(), benthosWeightUnit); - initSvgField(CatchBatch.PROPERTY_MARINE_LITTER_TOTAL_WEIGHT, getModel().getMarineLitterTotalComputedOrNotWeight(), marineLitterWeightUnit); + initSvgField(CatchBatch.PROPERTY_CATCH_TOTAL_WEIGHT, getModel().getCatchTotalComputedOrNotWeight(), catchWeightUnit); + initSvgField(CatchBatch.PROPERTY_CATCH_TOTAL_REJECTED_WEIGHT, getModel().getCatchTotalRejectedComputedOrNotWeight(), catchWeightUnit); + initSvgField(CatchBatch.PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT, getModel().getSpeciesTotalSortedComputedOrNotWeight(), speciesWeightUnit); + initSvgField(CatchBatch.PROPERTY_BENTHOS_TOTAL_SORTED_WEIGHT, getModel().getBenthosTotalSortedComputedOrNotWeight(), benthosWeightUnit); + initSvgField(CatchBatch.PROPERTY_MARINE_LITTER_TOTAL_WEIGHT, getModel().getMarineLitterTotalComputedOrNotWeight(), marineLitterWeightUnit); - initSvgField(CatchBatch.PROPERTY_CATCH_TOTAL_SORTED_COMPUTED_WEIGHT, catchWeightUnit); - initSvgField(CatchBatch.PROPERTY_CATCH_TOTAL_SORTED_SORTED_COMPUTED_WEIGHT, catchWeightUnit); - initSvgField(CatchBatch.PROPERTY_CATCH_TOTAL_UNSORTED_COMPUTED_WEIGHT, catchWeightUnit); + initSvgField(CatchBatch.PROPERTY_CATCH_TOTAL_SORTED_COMPUTED_WEIGHT, catchWeightUnit); + initSvgField(CatchBatch.PROPERTY_CATCH_TOTAL_SORTED_SORTED_COMPUTED_WEIGHT, catchWeightUnit); + initSvgField(CatchBatch.PROPERTY_CATCH_TOTAL_UNSORTED_COMPUTED_WEIGHT, catchWeightUnit); - initSvgField(CatchBatch.PROPERTY_SPECIES_TOTAL_COMPUTED_WEIGHT, speciesWeightUnit); - initSvgField(CatchBatch.PROPERTY_SPECIES_TOTAL_UNSORTED_COMPUTED_WEIGHT, speciesWeightUnit); - initSvgField(CatchBatch.PROPERTY_SPECIES_TOTAL_SAMPLE_SORTED_COMPUTED_WEIGHT, speciesWeightUnit); + initSvgField(CatchBatch.PROPERTY_SPECIES_TOTAL_COMPUTED_WEIGHT, speciesWeightUnit); + initSvgField(CatchBatch.PROPERTY_SPECIES_TOTAL_UNSORTED_COMPUTED_WEIGHT, speciesWeightUnit); + initSvgField(CatchBatch.PROPERTY_SPECIES_TOTAL_SAMPLE_SORTED_COMPUTED_WEIGHT, speciesWeightUnit); - initSvgField(CatchBatch.PROPERTY_BENTHOS_TOTAL_COMPUTED_WEIGHT, benthosWeightUnit); - initSvgField(CatchBatch.PROPERTY_BENTHOS_TOTAL_UNSORTED_COMPUTED_WEIGHT, benthosWeightUnit); - initSvgField(CatchBatch.PROPERTY_BENTHOS_TOTAL_SAMPLE_SORTED_COMPUTED_WEIGHT, benthosWeightUnit); + initSvgField(CatchBatch.PROPERTY_BENTHOS_TOTAL_COMPUTED_WEIGHT, benthosWeightUnit); + initSvgField(CatchBatch.PROPERTY_BENTHOS_TOTAL_UNSORTED_COMPUTED_WEIGHT, benthosWeightUnit); + initSvgField(CatchBatch.PROPERTY_BENTHOS_TOTAL_SAMPLE_SORTED_COMPUTED_WEIGHT, benthosWeightUnit); + + } + }); + + canvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC); + canvas.setDocument(svgDocument); } catch (IOException e) { if (log.isErrorEnabled()) { @@ -279,8 +298,33 @@ public class EditCatchesUIHandler extends AbstractTuttiTabContainerUIHandler<Edi log.debug("init " + property + " field"); } - Element labelElement = svgDocument.getElementById(property + "Label"); - labelElement.setTextContent(t("tutti.editCatchBatch.field." + property)); + canvas.getUpdateManager().getUpdateRunnableQueue().invokeLater(new Runnable() { + @Override + public void run() { + Element rectElement = svgDocument.getElementById(property + "Rect"); + SVGOMRectElement rectElem = (SVGOMRectElement) rectElement; + SVGRect bbox = rectElem.getBBox(); + Float x = bbox.getX(); + + Element labelElement = svgDocument.getElementById(property + "Label"); + labelElement.setTextContent(t("tutti.editCatchBatch.field." + property)); + + SVGOMTextElement labelTextElem = (SVGOMTextElement) labelElement; + bbox = labelTextElem.getBBox(); + float width = bbox.getWidth() + 20; + labelElement.setAttribute("x", String.valueOf(x - width / 2)); + + Element labelRectElement = svgDocument.getElementById(property + "LabelRect"); + labelRectElement.setAttribute("width", Float.toString(width)); + labelRectElement.setAttribute("x", String.valueOf(x - width)); + + if (computableData == null) { + SVGStylable field = (SVGStylable) labelElement; + CSSStyleDeclaration style = field.getStyle(); + style.setProperty("font-style", "italic", null); + } + } + }); Color colorComputedWeights = getConfig().getColorComputedWeights(); if (computableData == null) { @@ -338,7 +382,6 @@ public class EditCatchesUIHandler extends AbstractTuttiTabContainerUIHandler<Edi closeUI(ui.getMarineLitterTabContent()); closeUI(ui.getAccidentalTabContent()); closeUI(ui.getIndividualObservationTabContent()); - } @Override @@ -958,15 +1001,6 @@ public class EditCatchesUIHandler extends AbstractTuttiTabContainerUIHandler<Edi rectElement.setAttribute("width", Float.toString(width)); element.setAttribute("x", String.valueOf(x + width / 2)); } - - Element labelElement = svgDocument.getElementById(id + "Label"); - Element labelRectElement = svgDocument.getElementById(id + "LabelRect"); - SVGOMTextElement labelTextElem = (SVGOMTextElement) labelElement; - bbox = labelTextElem.getBBox(); - float width = bbox.getWidth() + 20; - labelRectElement.setAttribute("width", Float.toString(width)); - labelRectElement.setAttribute("x", String.valueOf(x - width)); - labelElement.setAttribute("x", String.valueOf(x - width / 2)); } }); diff --git a/tutti-ui-swing/src/main/resources/EcranResume.svg b/tutti-ui-swing/src/main/resources/EcranResume.svg index 90473ec..efb6873 100644 --- a/tutti-ui-swing/src/main/resources/EcranResume.svg +++ b/tutti-ui-swing/src/main/resources/EcranResume.svg @@ -11,7 +11,7 @@ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="700" height="350" - viewport="0 0 20 10" + viewport="0 0 700 350" id="svg2985" preserveAspectRatio="xMidYMid" version="1.1" -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm