Java Code Examples for org.jfree.chart.plot.ValueMarker#addChangeListener()

The following examples show how to use org.jfree.chart.plot.ValueMarker#addChangeListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MarkerTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getLabelOffsetType() and setLabelOffsetType()
 * methods.
 */
public void testGetSetLabelOffsetType() {
    // we use ValueMarker for the tests, because we need a concrete
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(LengthAdjustmentType.CONTRACT, m.getLabelOffsetType());
    m.setLabelOffsetType(LengthAdjustmentType.EXPAND);
    assertEquals(LengthAdjustmentType.EXPAND, m.getLabelOffsetType());
    assertEquals(m, this.lastEvent.getMarker());

    // check null argument...
    try {
        m.setLabelOffsetType(null);
        fail("Expected an IllegalArgumentException for null.");
    }
    catch (IllegalArgumentException e) {
        assertTrue(true);
    }
}
 
Example 2
Source File: MarkerTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getLabelFont() and setLabelFont() methods.
 */
public void testGetSetLabelFont() {
    // we use ValueMarker for the tests, because we need a concrete 
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(new Font("SansSerif", Font.PLAIN, 9), m.getLabelFont());
    m.setLabelFont(new Font("SansSerif", Font.BOLD, 10));
    assertEquals(new Font("SansSerif", Font.BOLD, 10), m.getLabelFont());
    assertEquals(m, this.lastEvent.getMarker());
    
    // check null argument...
    try {
        m.setLabelFont(null);
        fail("Expected an IllegalArgumentException for null.");
    }
    catch (IllegalArgumentException e) {
        assertTrue(true);
    }
}
 
Example 3
Source File: MarkerTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getLabel() and setLabel() methods.
 */
public void testGetSetLabel() {
    // we use ValueMarker for the tests, because we need a concrete 
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(null, m.getLabel());
    m.setLabel("XYZ");
    assertEquals("XYZ", m.getLabel());
    assertEquals(m, this.lastEvent.getMarker());
    
    // check null argument...
    m.setLabel(null);
    assertEquals(null, m.getLabel());
}
 
Example 4
Source File: MarkerTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getOutlineStroke() and setOutlineStroke() methods.
 */
public void testGetSetOutlineStroke() {
    // we use ValueMarker for the tests, because we need a concrete 
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(new BasicStroke(0.5f), m.getOutlineStroke());
    m.setOutlineStroke(new BasicStroke(1.1f));
    assertEquals(new BasicStroke(1.1f), m.getOutlineStroke());
    assertEquals(m, this.lastEvent.getMarker());
    
    // check null argument...
    m.setOutlineStroke(null);
    assertEquals(null, m.getOutlineStroke());
}
 
Example 5
Source File: MarkerTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getStroke() and setStroke() methods.
 */
public void testGetSetStroke() {
    // we use ValueMarker for the tests, because we need a concrete 
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(new BasicStroke(0.5f), m.getStroke());
    m.setStroke(new BasicStroke(1.1f));
    assertEquals(new BasicStroke(1.1f), m.getStroke());
    assertEquals(m, this.lastEvent.getMarker());
    
    // check null argument...
    try {
        m.setStroke(null);
        fail("Expected an IllegalArgumentException for null.");
    }
    catch (IllegalArgumentException e) {
        assertTrue(true);
    }
}
 
Example 6
Source File: MarkerTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getLabelAnchor() and setLabelAnchor() methods.
 */
public void testGetSetLabelAnchor() {
    // we use ValueMarker for the tests, because we need a concrete 
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(RectangleAnchor.TOP_LEFT, m.getLabelAnchor());
    m.setLabelAnchor(RectangleAnchor.TOP);
    assertEquals(RectangleAnchor.TOP, m.getLabelAnchor());
    assertEquals(m, this.lastEvent.getMarker());
    
    // check null argument...
    try {
        m.setLabelAnchor(null);
        fail("Expected an IllegalArgumentException for null.");
    }
    catch (IllegalArgumentException e) {
        assertTrue(true);
    }
}
 
Example 7
Source File: MarkerTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getLabelTextAnchor() and setLabelTextAnchor()
 * methods.
 */
public void testGetSetLabelTextAnchor() {
    // we use ValueMarker for the tests, because we need a concrete
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(TextAnchor.CENTER, m.getLabelTextAnchor());
    m.setLabelTextAnchor(TextAnchor.BASELINE_LEFT);
    assertEquals(TextAnchor.BASELINE_LEFT, m.getLabelTextAnchor());
    assertEquals(m, this.lastEvent.getMarker());

    // check null argument...
    try {
        m.setLabelTextAnchor(null);
        fail("Expected an IllegalArgumentException for null.");
    }
    catch (IllegalArgumentException e) {
        assertTrue(true);
    }
}
 
Example 8
Source File: MarkerTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getPaint() and setPaint() methods.
 */
public void testGetSetPaint() {
    // we use ValueMarker for the tests, because we need a concrete
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(Color.gray, m.getPaint());
    m.setPaint(Color.blue);
    assertEquals(Color.blue, m.getPaint());
    assertEquals(m, this.lastEvent.getMarker());

    // check null argument...
    try {
        m.setPaint(null);
        fail("Expected an IllegalArgumentException for null.");
    }
    catch (IllegalArgumentException e) {
        assertTrue(true);
    }
}
 
Example 9
Source File: MarkerTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getLabelOffset() and setLabelOffset() methods.
 */
public void testGetSetLabelOffset() {
    // we use ValueMarker for the tests, because we need a concrete
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(new RectangleInsets(3, 3, 3, 3), m.getLabelOffset());
    m.setLabelOffset(new RectangleInsets(1, 2, 3, 4));
    assertEquals(new RectangleInsets(1, 2, 3, 4), m.getLabelOffset());
    assertEquals(m, this.lastEvent.getMarker());

    // check null argument...
    try {
        m.setLabelOffset(null);
        fail("Expected an IllegalArgumentException for null.");
    }
    catch (IllegalArgumentException e) {
        assertTrue(true);
    }
}
 
Example 10
Source File: MarkerTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getLabelPaint() and setLabelPaint() methods.
 */
public void testGetSetLabelPaint() {
    // we use ValueMarker for the tests, because we need a concrete 
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(Color.black, m.getLabelPaint());
    m.setLabelPaint(Color.red);
    assertEquals(Color.red, m.getLabelPaint());
    assertEquals(m, this.lastEvent.getMarker());
    
    // check null argument...
    try {
        m.setLabelPaint(null);
        fail("Expected an IllegalArgumentException for null.");
    }
    catch (IllegalArgumentException e) {
        assertTrue(true);
    }
}
 
Example 11
Source File: MarkerTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getLabelPaint() and setLabelPaint() methods.
 */
public void testGetSetLabelPaint() {
    // we use ValueMarker for the tests, because we need a concrete
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(Color.black, m.getLabelPaint());
    m.setLabelPaint(Color.red);
    assertEquals(Color.red, m.getLabelPaint());
    assertEquals(m, this.lastEvent.getMarker());

    // check null argument...
    try {
        m.setLabelPaint(null);
        fail("Expected an IllegalArgumentException for null.");
    }
    catch (IllegalArgumentException e) {
        assertTrue(true);
    }
}
 
Example 12
Source File: MarkerTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getLabelFont() and setLabelFont() methods.
 */
public void testGetSetLabelFont() {
    // we use ValueMarker for the tests, because we need a concrete
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(new Font("Tahoma", Font.PLAIN, 9), m.getLabelFont());
    m.setLabelFont(new Font("SansSerif", Font.BOLD, 10));
    assertEquals(new Font("SansSerif", Font.BOLD, 10), m.getLabelFont());
    assertEquals(m, this.lastEvent.getMarker());

    // check null argument...
    try {
        m.setLabelFont(null);
        fail("Expected an IllegalArgumentException for null.");
    }
    catch (IllegalArgumentException e) {
        assertTrue(true);
    }
}
 
Example 13
Source File: MarkerTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getLabelOffsetType() and setLabelOffsetType() 
 * methods.
 */
public void testGetSetLabelOffsetType() {
    // we use ValueMarker for the tests, because we need a concrete 
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(LengthAdjustmentType.CONTRACT, m.getLabelOffsetType());
    m.setLabelOffsetType(LengthAdjustmentType.EXPAND);
    assertEquals(LengthAdjustmentType.EXPAND, m.getLabelOffsetType());
    assertEquals(m, this.lastEvent.getMarker());
    
    // check null argument...
    try {
        m.setLabelOffsetType(null);
        fail("Expected an IllegalArgumentException for null.");
    }
    catch (IllegalArgumentException e) {
        assertTrue(true);
    }
}
 
Example 14
Source File: MarkerTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getLabelTextAnchor() and setLabelTextAnchor() 
 * methods.
 */
public void testGetSetLabelTextAnchor() {
    // we use ValueMarker for the tests, because we need a concrete 
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(TextAnchor.CENTER, m.getLabelTextAnchor());
    m.setLabelTextAnchor(TextAnchor.BASELINE_LEFT);
    assertEquals(TextAnchor.BASELINE_LEFT, m.getLabelTextAnchor());
    assertEquals(m, this.lastEvent.getMarker());
    
    // check null argument...
    try {
        m.setLabelTextAnchor(null);
        fail("Expected an IllegalArgumentException for null.");
    }
    catch (IllegalArgumentException e) {
        assertTrue(true);
    }
}
 
Example 15
Source File: MarkerTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getOutlineStroke() and setOutlineStroke() methods.
 */
public void testGetSetOutlineStroke() {
    // we use ValueMarker for the tests, because we need a concrete
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(new BasicStroke(0.5f), m.getOutlineStroke());
    m.setOutlineStroke(new BasicStroke(1.1f));
    assertEquals(new BasicStroke(1.1f), m.getOutlineStroke());
    assertEquals(m, this.lastEvent.getMarker());

    // check null argument...
    m.setOutlineStroke(null);
    assertEquals(null, m.getOutlineStroke());
}
 
Example 16
Source File: MarkerTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getOutlinePaint() and setOutlinePaint() methods.
 */
public void testGetSetOutlinePaint() {
    // we use ValueMarker for the tests, because we need a concrete
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(Color.gray, m.getOutlinePaint());
    m.setOutlinePaint(Color.yellow);
    assertEquals(Color.yellow, m.getOutlinePaint());
    assertEquals(m, this.lastEvent.getMarker());

    // check null argument...
    m.setOutlinePaint(null);
    assertEquals(null, m.getOutlinePaint());
}
 
Example 17
Source File: MarkerTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getStroke() and setStroke() methods.
 */
public void testGetSetStroke() {
    // we use ValueMarker for the tests, because we need a concrete
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(new BasicStroke(0.5f), m.getStroke());
    m.setStroke(new BasicStroke(1.1f));
    assertEquals(new BasicStroke(1.1f), m.getStroke());
    assertEquals(m, this.lastEvent.getMarker());

    // check null argument...
    try {
        m.setStroke(null);
        fail("Expected an IllegalArgumentException for null.");
    }
    catch (IllegalArgumentException e) {
        assertTrue(true);
    }
}
 
Example 18
Source File: ValueMarkerTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the getValue() and setValue() methods.
 */
public void testGetSetValue() {
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(1.1, m.getValue(), EPSILON);
    m.setValue(33.3);
    assertEquals(33.3, m.getValue(), EPSILON);
    assertEquals(m, this.lastEvent.getMarker());
}
 
Example 19
Source File: ValueMarkerTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the getValue() and setValue() methods.
 */
public void testGetSetValue() {
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(1.1, m.getValue(), EPSILON);
    m.setValue(33.3);
    assertEquals(33.3, m.getValue(), EPSILON);
    assertEquals(m, this.lastEvent.getMarker());
}
 
Example 20
Source File: MarkerTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the getAlpha() and setAlpha() methods.
 */
public void testGetSetAlpha() {
    // we use ValueMarker for the tests, because we need a concrete 
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(0.8f, m.getAlpha(), EPSILON);
    m.setAlpha(0.5f);
    assertEquals(0.5f, m.getAlpha(), EPSILON);
    assertEquals(m, this.lastEvent.getMarker());
}