Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Tiede2014-07-01 03:26:05 -0400
committerMarkus Tiede2014-07-01 03:26:05 -0400
commitfb9927ce12c706f1bb863c2545add492612b49f5 (patch)
treeed08d360dff739fed53c42d702c6f9326c963438
parent716971bdbd3bcb18312ddfde9016002d1476c70b (diff)
downloadorg.eclipse.jubula.core-7.2.tar.gz
org.eclipse.jubula.core-7.2.tar.xz
org.eclipse.jubula.core-7.2.zip
Non-sprint task - fix for http://eclip.se/4385187.2
-rw-r--r--org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/adapter/JComboBoxAdapter.java14
-rw-r--r--org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/adapter/JLabelAdapter.java17
-rw-r--r--org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/adapter/JListAdapter.java23
-rw-r--r--org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/adapter/JTextComponentAdapter.java7
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 6e99fb2c0..6045811a4 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();
+ }
+ });
}
/**

Back to the top