r421 - trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/common
Author: chatellier Date: 2010-12-15 17:21:36 +0000 (Wed, 15 Dec 2010) New Revision: 421 Log: Personnalisation du titre du graphique Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/common/CommonHandler.java trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/common/DataHandler.java trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/common/LengthStructureMatrixRenderer.java Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/common/CommonHandler.java =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/common/CommonHandler.java 2010-12-15 17:10:28 UTC (rev 420) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/common/CommonHandler.java 2010-12-15 17:21:36 UTC (rev 421) @@ -33,11 +33,6 @@ import javax.swing.JOptionPane; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import fr.ifremer.coser.ui.control.ControlHandler; - /** * Common application handler. * @@ -49,8 +44,6 @@ */ public class CommonHandler { - private static final Log log = LogFactory.getLog(ControlHandler.class); - /** * Install le curseur sablier. * Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/common/DataHandler.java =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/common/DataHandler.java 2010-12-15 17:10:28 UTC (rev 420) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/common/DataHandler.java 2010-12-15 17:21:36 UTC (rev 421) @@ -30,8 +30,6 @@ import javax.swing.JFrame; import javax.swing.SwingUtilities; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.nuiton.math.matrix.MatrixND; import org.nuiton.math.matrix.viewer.MatrixViewerPanel; import org.nuiton.math.matrix.viewer.renderer.MatrixInfoTableRenderer; @@ -52,8 +50,6 @@ */ public class DataHandler extends CommonHandler { - private static final Log log = LogFactory.getLog(DataHandler.class); - /** * Display lengthStructure matrix in matrixviewerpanel. * @@ -77,7 +73,7 @@ JFrame matrixViewerFrame = new JFrame(_("coser.ui.graph.lengthStructure")); matrixViewerFrame.setName("lengthstructureframe"); MatrixViewerPanel panel = new MatrixViewerPanel(); - panel.addMatrixRenderer(new LengthStructureMatrixRenderer()); + panel.addMatrixRenderer(new LengthStructureMatrixRenderer(project, container)); panel.addMatrixRenderer(new MatrixInfoTableRenderer()); panel.addMatrix(matrix); matrixViewerFrame.add(panel); Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/common/LengthStructureMatrixRenderer.java =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/common/LengthStructureMatrixRenderer.java 2010-12-15 17:10:28 UTC (rev 420) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/common/LengthStructureMatrixRenderer.java 2010-12-15 17:21:36 UTC (rev 421) @@ -23,14 +23,21 @@ package fr.ifremer.coser.ui.common; +import static org.nuiton.i18n.I18n._; + import java.util.List; +import org.jfree.chart.JFreeChart; import org.jfree.data.category.CategoryDataset; import org.jfree.data.category.DefaultCategoryDataset; import org.nuiton.math.matrix.MatrixND; import org.nuiton.math.matrix.viewer.renderer.MatrixChartRenderer; import org.nuiton.math.matrix.viewer.renderer.jfreechart.GraphMatrixNDDataset; +import fr.ifremer.coser.bean.AbstractDataContainer; +import fr.ifremer.coser.bean.Project; +import fr.ifremer.coser.bean.Selection; + /** * JFreeChart matrix panel renderer. * @@ -45,6 +52,30 @@ */ public class LengthStructureMatrixRenderer extends MatrixChartRenderer { + protected Project project; + + protected AbstractDataContainer container; + + public LengthStructureMatrixRenderer(Project project, AbstractDataContainer container) { + this.project = project; + this.container = container; + } + + /** + * Pour modification du titre du graphique. + * + * Coser : projecttitle : selectiontitle + */ + protected JFreeChart getJFreeChart(MatrixND matrix) { + String title = "Coser: " + project.getName(); + if (container instanceof Selection) { + title += ": " + ((Selection)container).getName(); + } + JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, + getCategoryPlot(matrix), true); + return chart; + } + @Override protected CategoryDataset getCategoryDataset(MatrixND matrix) { return getLengthStructureDataSet(matrix);
participants (1)
-
chatellierï¼ users.labs.libre-entreprise.org