diff options
author | Markus Tiede | 2014-07-01 07:26:05 +0000 |
---|---|---|
committer | Markus Tiede | 2014-07-01 07:27:55 +0000 |
commit | e927505d0f305a3e58324be8328fba74d08aa12d (patch) | |
tree | 6b697a4e232de76e01133df36b95afac3f8168fa /org.eclipse.jubula.rc.swing/src | |
parent | cdfaabf1e78cf118e5a73ca12b947ecc8de86169 (diff) | |
download | org.eclipse.jubula.core-e927505d0f305a3e58324be8328fba74d08aa12d.tar.gz org.eclipse.jubula.core-e927505d0f305a3e58324be8328fba74d08aa12d.tar.xz org.eclipse.jubula.core-e927505d0f305a3e58324be8328fba74d08aa12d.zip |
Non-sprint task - fix for http://eclip.se/438518
Diffstat (limited to 'org.eclipse.jubula.rc.swing/src')
4 files changed, 42 insertions, 19 deletions
diff --git a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/adapter/JComboBoxAdapter.java b/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/adapter/JComboBoxAdapter.java index 9bf7e7605..341f56e48 100644 --- a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/adapter/JComboBoxAdapter.java +++ b/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/adapter/JComboBoxAdapter.java @@ -66,14 +66,20 @@ public class JComboBoxAdapter extends JComponentAdapter implements */ public String getText() { String comboBoxText; - if (m_comboBox.isEditable()) { + if (isEditable()) { comboBoxText = TesterUtil.getRenderedText( getComboBoxEditorComponent(m_comboBox), true); } else { - final int selIndex = m_comboBox.getSelectedIndex(); + final int selIndex = getSelectedIndex(); if (selIndex == -1) { - comboBoxText = String.valueOf( - m_comboBox.getSelectedItem()); + comboBoxText = (String) getEventThreadQueuer().invokeAndWait( + "getSelectedItemText", //$NON-NLS-1$ + new IRunnable() { + public Object run() { + return String.valueOf(m_comboBox + .getSelectedItem()); + } + }); } else { final JList jlist = new JList(m_comboBox.getModel()); Object o = getEventThreadQueuer().invokeAndWait( diff --git a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/adapter/JLabelAdapter.java b/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/adapter/JLabelAdapter.java index 08059dfab..58c0b3bd4 100644 --- a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/adapter/JLabelAdapter.java +++ b/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/adapter/JLabelAdapter.java @@ -12,24 +12,31 @@ package org.eclipse.jubula.rc.swing.tester.adapter; import javax.swing.JLabel; +import org.eclipse.jubula.rc.common.driver.IRunnable; import org.eclipse.jubula.rc.common.tester.adapter.interfaces.ITextComponent; + /** * @author BREDEX GmbH */ -public class JLabelAdapter extends JComponentAdapter - implements ITextComponent { +public class JLabelAdapter extends JComponentAdapter implements ITextComponent { /** - * @param objectToAdapt the component + * @param objectToAdapt + * the component */ public JLabelAdapter(Object objectToAdapt) { super(objectToAdapt); - + } /** * {@inheritDoc} */ public String getText() { - return ((JLabel) getRealComponent()).getText(); + return (String) getEventThreadQueuer().invokeAndWait( + "getText", new IRunnable() { //$NON-NLS-1$ + public Object run() { + return ((JLabel) getRealComponent()).getText(); + } + }); } }
\ No newline at end of file diff --git a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/adapter/JListAdapter.java b/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/adapter/JListAdapter.java index 361a68122..a33f5a8d4 100644 --- a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/adapter/JListAdapter.java +++ b/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/adapter/JListAdapter.java @@ -75,7 +75,7 @@ public class JListAdapter extends JComponentAdapter implements IListComponent { public void clickOnIndex(final Integer i, ClickOptions co, double maxWidth) { final int index = i.intValue(); - ListModel model = m_list.getModel(); + final ListModel model = m_list.getModel(); if ((model == null) || (index >= model.getSize()) || (index < 0)) { throw new StepExecutionException("List index '" + i //$NON-NLS-1$ @@ -84,7 +84,7 @@ public class JListAdapter extends JComponentAdapter implements IListComponent { } // Call of JList.ensureIndexIsVisible() is not required, // because the Robot scrolls the click rectangle to visible. - Rectangle r = (Rectangle) getRobotFactory().getEventThreadQueuer() + final Rectangle r = (Rectangle) getRobotFactory().getEventThreadQueuer() .invokeAndWait("getCellBounds", new IRunnable() { //$NON-NLS-1$ public Object run() throws StepExecutionException { @@ -99,13 +99,18 @@ public class JListAdapter extends JComponentAdapter implements IListComponent { } // if possible adjust height and width for items - ListCellRenderer lcr = m_list.getCellRenderer(); - if (lcr != null) { - Component listItem = lcr.getListCellRendererComponent(m_list, model - .getElementAt(index), index, false, false); - Dimension preferredSize = listItem.getPreferredSize(); - r.setSize(preferredSize); - } + getRobotFactory().getEventThreadQueuer().invokeAndWait("getItemSize", new IRunnable() { //$NON-NLS-1$ + public Object run() throws StepExecutionException { + ListCellRenderer lcr = m_list.getCellRenderer(); + if (lcr != null) { + Component listItem = lcr.getListCellRendererComponent( + m_list, model.getElementAt(index), index, false, false); + Dimension preferredSize = listItem.getPreferredSize(); + r.setSize(preferredSize); + } + return null; + } + }); if (maxWidth != JComboBoxAdapter.NO_MAX_WIDTH && r.getWidth() > maxWidth) { diff --git a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/adapter/JTextComponentAdapter.java b/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/adapter/JTextComponentAdapter.java index 5e1e64fc7..a3921b356 100644 --- a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/adapter/JTextComponentAdapter.java +++ b/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/adapter/JTextComponentAdapter.java @@ -39,7 +39,12 @@ public class JTextComponentAdapter extends JComponentAdapter * {@inheritDoc} */ public String getText() { - return m_textComponent.getText(); + return (String) getEventThreadQueuer().invokeAndWait( + "getText", new IRunnable() { //$NON-NLS-1$ + public Object run() { + return m_textComponent.getText(); + } + }); } /** |