use of javax.accessibility.Accessible in project spring-framework by spring-projects.
the class ProxyFactoryTests method testExclusionOfNonPublicInterfaces.
@Test
@Ignore("Not implemented yet, see http://jira.springframework.org/browse/SPR-5708")
public void testExclusionOfNonPublicInterfaces() {
JFrame frame = new JFrame();
ProxyFactory proxyFactory = new ProxyFactory(frame);
Object proxy = proxyFactory.getProxy();
assertTrue(proxy instanceof RootPaneContainer);
assertTrue(proxy instanceof Accessible);
}
use of javax.accessibility.Accessible in project android by JetBrains.
the class SunburstVisualTest method populateUi.
@Override
protected void populateUi(@NotNull JPanel panel) {
JPanel controls = VisualTest.createControlledPane(panel, mSunburst);
final JLabel info = new JLabel("<No information yet>");
panel.add(info, BorderLayout.SOUTH);
controls.add(VisualTest.createVariableSlider("Gap", 0, 200, new VisualTests.Value() {
@Override
public void set(int v) {
mSunburst.setGap(v);
}
@Override
public int get() {
return (int) mSunburst.getGap();
}
}));
final JPanel sizeSlider = VisualTest.createVariableSlider("Size", 0, 200, new VisualTests.Value() {
@Override
public void set(int v) {
mSunburst.setSliceWidth(v);
}
@Override
public int get() {
return (int) mSunburst.getSliceWidth();
}
});
controls.add(sizeSlider);
controls.add(VisualTest.createVariableSlider("Angle", 0, 360, new VisualTests.Value() {
@Override
public void set(int v) {
mSunburst.setAngle(v);
}
@Override
public int get() {
return (int) mSunburst.getAngle();
}
}));
controls.add(VisualTest.createVariableSlider("Start", 0, 360, new VisualTests.Value() {
@Override
public void set(int v) {
mSunburst.setStart(v);
}
@Override
public int get() {
return (int) mSunburst.getStart();
}
}));
controls.add(VisualTest.createVariableSlider("Fixed", 1, 100, new VisualTests.Value() {
@Override
public void set(int v) {
mSunburst.setFixed(v);
}
@Override
public int get() {
return (int) mSunburst.getFixed();
}
}));
controls.add(VisualTest.createVariableSlider("Separator", 0, 100, new VisualTests.Value() {
@Override
public void set(int v) {
mSunburst.setSeparator(v);
}
@Override
public int get() {
return (int) mSunburst.getSeparator();
}
}));
controls.add(VisualTest.createButton("Generate", new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
generateLayoutData((DataNode) mSunburst.getData(), 5);
}
}));
controls.add(VisualTest.createButton("Tree A", new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
DataNode g = new DataNode();
g.addDataNode(createTree(1));
g.addDataNode(createValue());
g.addDataNode(createTree(1));
g.addDataNode(createValue());
g.addDataNode(createTree(0));
mSunburst.setData(g);
}
}));
controls.add(VisualTest.createButton("Tree B", new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
DataNode g = new DataNode();
g.addDataNode(createValue());
g.addDataNode(createValue());
g.addDataNode(createTree(0));
mSunburst.setData(g);
}
}));
controls.add(VisualTest.createButton("Value", new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
DataNode g = new DataNode();
g.addDataNode(new DataNode(1, (int) (Math.random() * 50)));
mSunburst.setData(g);
}
}));
controls.add(VisualTest.createCheckbox("Auto size", new ItemListener() {
@Override
public void itemStateChanged(ItemEvent itemEvent) {
final boolean enableAutoSize = itemEvent.getStateChange() == ItemEvent.SELECTED;
mSunburst.setAutoSize(enableAutoSize);
// If auto size is enabled, size shouldn't be controlled by slider
// sizeSlider is a JPanel and its first child is a JSlider
Accessible sliderAccessible = SwingUtilities.getAccessibleChild(sizeSlider, 0);
if (sliderAccessible instanceof JSlider) {
JSlider slider = (JSlider) sliderAccessible;
slider.setEnabled(!enableAutoSize);
// If disabling auto size, set slider width to current slice width
if (!enableAutoSize) {
slider.setValue((int) mSunburst.getSliceWidth());
}
}
}
}));
controls.add(new Box.Filler(new Dimension(0, 0), new Dimension(300, Integer.MAX_VALUE), new Dimension(300, Integer.MAX_VALUE)));
mSunburst.addSelectionListener(new SunburstChart.SliceSelectionListener() {
@Override
public void valueChanged(SunburstChart.SliceSelectionEvent e) {
ValuedTreeNode node = e.getNode();
info.setText(node == null ? "<No selection>" : String.format("Value %d Count %d", node.getValue(), node.getCount()));
}
});
}
use of javax.accessibility.Accessible in project jdk8u_jdk by JetBrains.
the class CAccessibleText method getLineNumberForIndex.
static int getLineNumberForIndex(final Accessible a, int index) {
final Accessible sa = CAccessible.getSwingAccessible(a);
if (!(sa instanceof JTextComponent))
return -1;
final JTextComponent jc = (JTextComponent) sa;
final Element root = jc.getDocument().getDefaultRootElement();
// treat -1 special, returns the current caret position
if (index == -1)
index = jc.getCaretPosition();
// Determine line number (can be -1)
return root.getElementIndex(index);
}
use of javax.accessibility.Accessible in project jdk8u_jdk by JetBrains.
the class CAccessibleText method getRangeForLine.
static int[] getRangeForLine(final Accessible a, final int lineIndex) {
Accessible sa = CAccessible.getSwingAccessible(a);
if (!(sa instanceof JTextComponent))
return null;
final JTextComponent jc = (JTextComponent) sa;
final Element root = jc.getDocument().getDefaultRootElement();
final Element line = root.getElement(lineIndex);
if (line == null)
return null;
return new int[] { line.getStartOffset(), line.getEndOffset() };
}
use of javax.accessibility.Accessible in project android by JetBrains.
the class ASGalleryTest method testAccessible.
public void testAccessible() {
for (int i = 0; i < COLUMNS; i++) {
ModelObject model = objects[i];
Accessible child = gallery.getAccessibleContext().getAccessibleChild(i);
assertNotNull(child);
assertEquals(model.myLabel, child.getAccessibleContext().getAccessibleName());
assertEquals(null, child.getAccessibleContext().getAccessibleDescription());
assertEquals(gallery, child.getAccessibleContext().getAccessibleParent());
assertEquals(i, child.getAccessibleContext().getAccessibleIndexInParent());
}
}
Aggregations