/** * Check that the equals() method can distinguish all fields. */ public void testEquals() { ColorBar c1 = new ColorBar("Test"); ColorBar c2 = new ColorBar("Test"); assertEquals(c1, c2); c1.setAxis(new NumberAxis("Axis 1")); assertTrue(!c1.equals(c2)); c2.setAxis(new NumberAxis("Axis 1")); assertTrue(c1.equals(c2)); c1.setColorPalette(new GreyPalette()); assertTrue(!c1.equals(c2)); c2.setColorPalette(new GreyPalette()); assertTrue(c1.equals(c2)); }
/** * Constructs a contour plot with the specified axes (other attributes take default values). * * @param dataset The dataset. * @param domainAxis The domain axis. * @param rangeAxis The range axis. * @param colorBar The z-axis axis. */ public ContourPlot(ContourDataset dataset, ValueAxis domainAxis, ValueAxis rangeAxis, ColorBar colorBar) { super(); this.dataset = dataset; if (dataset != null) { dataset.addChangeListener(this); } this.domainAxis = domainAxis; if (domainAxis != null) { domainAxis.setPlot(this); domainAxis.addChangeListener(this); } this.rangeAxis = rangeAxis; if (rangeAxis != null) { rangeAxis.setPlot(this); rangeAxis.addChangeListener(this); } this.colorBar = colorBar; if (colorBar != null) { colorBar.getAxis().setPlot(this); colorBar.getAxis().addChangeListener(this); colorBar.configure(this); } this.colorBarLocation = RectangleEdge.LEFT; this.toolTipGenerator = new StandardContourToolTipGenerator(); }
/** * Receives notification of a change to one of the plot's axes. * * @param event information about the event. */ public void axisChanged(AxisChangeEvent event) { Object source = event.getSource(); if (source.equals(this.rangeAxis) || source.equals(this.domainAxis)) { ColorBar cba = this.colorBar; if (this.colorBar.getAxis().isAutoRange()) { cba.getAxis().configure(); } } super.axisChanged(event); }
/** * Sets the properties of the specified axis to match the properties defined on this panel. * * @param colorBar the color bar. */ public void setAxisProperties(ColorBar colorBar) { super.setAxisProperties(colorBar.getAxis()); colorBar.setColorPalette(this.currentPalette.getPalette()); colorBar.getColorPalette().setInverse(this.invertPalette); //dmo added colorBar.getColorPalette().setStepped(this.stepPalette); //dmo added }
/** * A static method that returns a panel that is appropriate for the axis * type. * * @param colorBar the color bar. * * @return a panel or <code>null</code< if axis is <code>null</code>. */ public static ColorBarPropertyEditPanel getInstance(ColorBar colorBar) { if (colorBar != null) { return new ColorBarPropertyEditPanel(colorBar); } else { return null; } }
/** * Two objects that are equal are required to return the same hashCode. */ public void testHashCode() { ColorBar c1 = new ColorBar("Test"); ColorBar c2 = new ColorBar("Test"); assertTrue(c1.equals(c2)); int h1 = c1.hashCode(); int h2 = c2.hashCode(); assertEquals(h1, h2); }
/** * Constructs a contour plot with the specified axes (other attributes take * default values). * * @param dataset The dataset. * @param domainAxis The domain axis. * @param rangeAxis The range axis. * @param colorBar The z-axis axis. */ public ContourPlot(ContourDataset dataset, ValueAxis domainAxis, ValueAxis rangeAxis, ColorBar colorBar) { super(); this.dataset = dataset; if (dataset != null) { dataset.addChangeListener(this); } this.domainAxis = domainAxis; if (domainAxis != null) { domainAxis.setPlot(this); domainAxis.addChangeListener(this); } this.rangeAxis = rangeAxis; if (rangeAxis != null) { rangeAxis.setPlot(this); rangeAxis.addChangeListener(this); } this.colorBar = colorBar; if (colorBar != null) { colorBar.getAxis().setPlot(this); colorBar.getAxis().addChangeListener(this); colorBar.configure(this); } this.colorBarLocation = RectangleEdge.LEFT; this.toolTipGenerator = new StandardContourToolTipGenerator(); }
/** * Sets the properties of the specified axis to match the properties * defined on this panel. * * @param colorBar the color bar. */ public void setAxisProperties(ColorBar colorBar) { super.setAxisProperties(colorBar.getAxis()); colorBar.setColorPalette(this.currentPalette.getPalette()); colorBar.getColorPalette().setInverse(this.invertPalette); //dmo added colorBar.getColorPalette().setStepped(this.stepPalette); //dmo added }
/** * A static method that returns a panel that is appropriate for the axis * type. * * @param colorBar the color bar. * * @return A panel or <code>null</code< if axis is <code>null</code>. */ public static DefaultColorBarEditor getInstance(ColorBar colorBar) { if (colorBar != null) { return new DefaultColorBarEditor(colorBar); } else { return null; } }
/** * Receives notification of a change to one of the plot's axes. * * @param event information about the event. */ @Override public void axisChanged(AxisChangeEvent event) { Object source = event.getSource(); if (source.equals(this.rangeAxis) || source.equals(this.domainAxis)) { ColorBar cba = this.colorBar; if (this.colorBar.getAxis().isAutoRange()) { cba.getAxis().configure(); } } super.axisChanged(event); }