Package javax.accessibility

Examples of javax.accessibility.AccessibleValue


        // test getAccessibleRole()
        assertTrue("AccessibleRole ok", c.getAccessibleRole() == AccessibleRole.INTERNAL_FRAME);
        // test getAccessibleValue()
        assertTrue("AccessibleValue ok", c.getAccessibleValue() == c);
        // test setCurrentAccessibleValue(), getCurrentAccessibleValue()
        AccessibleValue value = c.getAccessibleValue();
        assertTrue("currentAccessibleValue == 0",
                value.getCurrentAccessibleValue().intValue() == 0);
        Integer currentAccessibleValue = new Integer(4);
        boolean set = value.setCurrentAccessibleValue(currentAccessibleValue);
        assertTrue("setCurrentAccessibleValue returns true", set);
        set = value.setCurrentAccessibleValue(new Float(5));
        assertTrue("setCurrentAccessibleValue returns true", set);
        assertTrue("currentAccessibleValue == 5",
                value.getCurrentAccessibleValue().intValue() == 5);
        assertTrue("the object is not the same",
                value.getCurrentAccessibleValue() != currentAccessibleValue);
        set = value.setCurrentAccessibleValue(null);
        assertFalse("setCurrentAccessibleValue returns false", set);
        // test getMinimumAccessibleValue()
        assertTrue("minimumAccessibleValue ok",
                value.getMinimumAccessibleValue().intValue() == Integer.MIN_VALUE);
        // test getMaximumAccessibleValue()
        assertTrue("maximumAccessibleValue ok",
                value.getMaximumAccessibleValue().intValue() == Integer.MAX_VALUE);
        // test other methods
        assertNull("AccessibleDescription is ok", c.getAccessibleDescription());
        assertTrue("AccessibleChildrenCount == 1", c.getAccessibleChildrenCount() == 1);
    }
View Full Code Here


    harness.check(ac.getAccessibleIcon(), null);
    harness.check(ac.getAccessibleTable(), null);
    harness.check(ac.getAccessibleText(), null);
   
    // the AccessibleContext is also the AccessibleValue...
    AccessibleValue av = ac.getAccessibleValue();
    harness.check(av, ac);
    harness.check(av.getCurrentAccessibleValue(), new Integer(50));
    harness.check(av.getMinimumAccessibleValue(), new Integer(10));
    harness.check(av.getMaximumAccessibleValue(), new Integer(85));
   
    // check that setting the accessible value updates the slider
    ac.addPropertyChangeListener(this);
    boolean b = av.setCurrentAccessibleValue(new Integer(55));
    harness.check(scrollBar.getValue(), 55);
    harness.check(b);
    harness.check(events.size(), 1);
    PropertyChangeEvent e0 = (PropertyChangeEvent) events.get(0);
    harness.check(e0.getPropertyName(),
        AccessibleContext.ACCESSIBLE_VALUE_PROPERTY);
    harness.check(e0.getSource(), ac);
    harness.check(e0.getOldValue(), new Integer(50));
    harness.check(e0.getNewValue(), new Integer(55));
   
    // set the value below the minimum
    events.clear();
    b = av.setCurrentAccessibleValue(new Integer(5));
    harness.check(av.getCurrentAccessibleValue(), new Integer(10));
    harness.check(b);
    harness.check(events.size(), 1);
    e0 = (PropertyChangeEvent) events.get(0);
    harness.check(e0.getPropertyName(),
        AccessibleContext.ACCESSIBLE_VALUE_PROPERTY);
    harness.check(e0.getSource(), ac);
    harness.check(e0.getOldValue(), new Integer(55));
    harness.check(e0.getNewValue(), new Integer(10));
   
    // set the value above the maximum
    events.clear();
    b = av.setCurrentAccessibleValue(new Integer(105));
    harness.check(av.getCurrentAccessibleValue(), new Integer(85));
    harness.check(b);
    harness.check(events.size(), 1);
    e0 = (PropertyChangeEvent) events.get(0);
    harness.check(e0.getPropertyName(),
        AccessibleContext.ACCESSIBLE_VALUE_PROPERTY);
    harness.check(e0.getSource(), ac);
    harness.check(e0.getOldValue(), new Integer(10));
    harness.check(e0.getNewValue(), new Integer(85));
   
    // set the value to null
    events.clear();
    b = av.setCurrentAccessibleValue(null);
    harness.check(av.getCurrentAccessibleValue(), new Integer(85));
    harness.check(events.size(), 0);
    harness.check(!b);
   
    // check the state settings...
    AccessibleStateSet set = ac.getAccessibleStateSet();
View Full Code Here

{
  public void test(TestHarness harness)
  {
    JInternalFrame f = new JInternalFrame("Title");
    AccessibleContext ac = f.getAccessibleContext();
    AccessibleValue av = ac.getAccessibleValue();
    // by trial and error I found that this is equal to the frame's layer
    harness.check(av.getCurrentAccessibleValue(), JLayeredPane.DEFAULT_LAYER);
    f.setLayer(JLayeredPane.PALETTE_LAYER);
    harness.check(av.getCurrentAccessibleValue(), JLayeredPane.PALETTE_LAYER);
  }
View Full Code Here

  public void test(TestHarness harness)
  {
    JInternalFrame f = new JInternalFrame("Title");
    JDesktopIcon icon = f.getDesktopIcon();
    AccessibleContext ac = icon.getAccessibleContext();
    AccessibleValue av = ac.getAccessibleValue();
   
    // by trial and error, I determined that the "value" is the frame's layer
    harness.check(av.getCurrentAccessibleValue(), JLayeredPane.DEFAULT_LAYER);
    ac.addPropertyChangeListener(this);
    av.setCurrentAccessibleValue(JLayeredPane.PALETTE_LAYER);
    harness.check(f.getLayer(), JLayeredPane.PALETTE_LAYER.intValue());
    harness.check(lastEvent, null)// no event is generated
   
    boolean set = av.setCurrentAccessibleValue(null);
    harness.check(!set);
    harness.check(f.getLayer(), JLayeredPane.PALETTE_LAYER.intValue());
  }
View Full Code Here

{
  public void test(TestHarness harness)
  {
    JInternalFrame f = new JInternalFrame("Title");
    AccessibleContext ac = f.getAccessibleContext();
    AccessibleValue av = ac.getAccessibleValue();
    harness.check(av.getMinimumAccessibleValue(),
            new Integer(Integer.MIN_VALUE))// not specified, but the ref
                                              // impl returns this
  }
View Full Code Here

{
  public void test(TestHarness harness)
  {
    JInternalFrame f = new JInternalFrame("Title");
    AccessibleContext ac = f.getAccessibleContext();
    AccessibleValue av = ac.getAccessibleValue();
    harness.check(av.getMaximumAccessibleValue(),
            new Integer(Integer.MAX_VALUE))// not specified, but the ref
                                              // impl returns this
  }
View Full Code Here

    harness.check(ac.getAccessibleIcon(), null);
    harness.check(ac.getAccessibleTable(), null);
    harness.check(ac.getAccessibleText(), null);
   
    // the AccessibleContext is also the AccessibleValue...
    AccessibleValue av = ac.getAccessibleValue();
    harness.check(av, ac);
    harness.check(av.getCurrentAccessibleValue(), new Integer(50));
    harness.check(av.getMinimumAccessibleValue(), new Integer(10));
    harness.check(av.getMaximumAccessibleValue(), new Integer(90));
   
    // check that setting the accessible value updates the slider
    ac.addPropertyChangeListener(this);
    boolean b = av.setCurrentAccessibleValue(new Integer(55));
    harness.check(progressBar.getValue(), 55);
    harness.check(b);
    harness.check(events.size(), 1);
    PropertyChangeEvent e0 = (PropertyChangeEvent) events.get(0);
    harness.check(e0.getPropertyName(),
        AccessibleContext.ACCESSIBLE_VALUE_PROPERTY);
    harness.check(e0.getSource(), ac);
    harness.check(e0.getOldValue(), new Integer(50));
    harness.check(e0.getNewValue(), new Integer(55));
   
    // set the value below the minimum
    events.clear();
    b = av.setCurrentAccessibleValue(new Integer(5));
    harness.check(av.getCurrentAccessibleValue(), new Integer(10));
    harness.check(b);
    harness.check(events.size(), 1);
    e0 = (PropertyChangeEvent) events.get(0);
    harness.check(e0.getPropertyName(),
        AccessibleContext.ACCESSIBLE_VALUE_PROPERTY);
    harness.check(e0.getSource(), ac);
    harness.check(e0.getOldValue(), new Integer(55));
    harness.check(e0.getNewValue(), new Integer(10));
   
    // set the value above the maximum
    events.clear();
    b = av.setCurrentAccessibleValue(new Integer(105));
    harness.check(av.getCurrentAccessibleValue(), new Integer(90));
    harness.check(b);
    harness.check(events.size(), 1);
    e0 = (PropertyChangeEvent) events.get(0);
    harness.check(e0.getPropertyName(),
        AccessibleContext.ACCESSIBLE_VALUE_PROPERTY);
    harness.check(e0.getSource(), ac);
    harness.check(e0.getOldValue(), new Integer(10));
    harness.check(e0.getNewValue(), new Integer(90));
   
    // set the value to null
    events.clear();
    b = av.setCurrentAccessibleValue(null);
    harness.check(av.getCurrentAccessibleValue(), new Integer(90));
    harness.check(events.size(), 0);
    harness.check(!b);
   
    // check the state settings...
    AccessibleStateSet set = ac.getAccessibleStateSet();
View Full Code Here

    JTable t = new JTable(tm);
    JTableHeader th = t.getTableHeader();
    AccessibleContext ac = th.getAccessibleContext();
    Accessible ac0 = ac.getAccessibleChild(0);
    harness.check(ac0.getClass().getName().endsWith("AccessibleJTableHeaderEntry"));
    AccessibleValue ac0av = ac0.getAccessibleContext().getAccessibleValue();
    harness.check(ac0av, null);
   
    MyTableCellRenderer r = new MyTableCellRenderer();
    t.getColumnModel().getColumn(1).setHeaderRenderer(r);
    Accessible ac1 = ac.getAccessibleChild(1);
    harness.check(ac1.getClass().getName().endsWith("AccessibleJTableHeaderEntry"));
    AccessibleValue ac1av = ac1.getAccessibleContext().getAccessibleValue();
    harness.check(ac1av, r.getAccessibleContext().getAccessibleValue());
  }
View Full Code Here

        // test getAccessibleRole()
        assertTrue("AccessibleRole ok", c.getAccessibleRole() == AccessibleRole.INTERNAL_FRAME);
        // test getAccessibleValue()
        assertTrue("AccessibleValue ok", c.getAccessibleValue() == c);
        // test setCurrentAccessibleValue(), getCurrentAccessibleValue()
        AccessibleValue value = c.getAccessibleValue();
        assertTrue("currentAccessibleValue == 0",
                value.getCurrentAccessibleValue().intValue() == 0);
        Integer currentAccessibleValue = new Integer(4);
        boolean set = value.setCurrentAccessibleValue(currentAccessibleValue);
        assertTrue("setCurrentAccessibleValue returns true", set);
        set = value.setCurrentAccessibleValue(new Float(5));
        assertTrue("setCurrentAccessibleValue returns true", set);
        assertTrue("currentAccessibleValue == 5",
                value.getCurrentAccessibleValue().intValue() == 5);
        assertTrue("the object is not the same",
                value.getCurrentAccessibleValue() != currentAccessibleValue);
        set = value.setCurrentAccessibleValue(null);
        assertFalse("setCurrentAccessibleValue returns false", set);
        // test getMinimumAccessibleValue()
        assertTrue("minimumAccessibleValue ok",
                value.getMinimumAccessibleValue().intValue() == Integer.MIN_VALUE);
        // test getMaximumAccessibleValue()
        assertTrue("maximumAccessibleValue ok",
                value.getMaximumAccessibleValue().intValue() == Integer.MAX_VALUE);
        // test other methods
        assertNull("AccessibleDescription is ok", c.getAccessibleDescription());
        assertTrue("AccessibleChildrenCount == 1", c.getAccessibleChildrenCount() == 1);
    }
View Full Code Here

        assertNull(accessibleContext.getAccessibleDescription());
        assertNull(accessibleContext.getAccessibleAction());
        assertSame(accessibleContext.getAccessibleValue(), accessibleContext);
        assertTrue(accessibleContext.getAccessibleStateSet().contains(
                AccessibleState.HORIZONTAL));
        AccessibleValue value = (AccessibleValue) accessibleContext;
        int currentValue = (progressBar.getMinimum() + progressBar.getMaximum()) / 2;
        progressBar.setValue(currentValue);
        assertTrue(controller.isChanged());
        assertEquals(new Integer(currentValue), value.getCurrentAccessibleValue());
        assertEquals(new Integer(progressBar.getMaximum()), value.getMaximumAccessibleValue());
        assertEquals(new Integer(progressBar.getMinimum()), value.getMinimumAccessibleValue());
        value.setCurrentAccessibleValue(new Integer(currentValue + 1));
        assertTrue(controller.isChanged());
        assertEquals(currentValue + 1, progressBar.getValue());
        assertEquals(new Integer(currentValue + 1), value.getCurrentAccessibleValue());
        assertTrue(value.setCurrentAccessibleValue(new Integer(currentValue + 1)));
    }
View Full Code Here

TOP

Related Classes of javax.accessibility.AccessibleValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.