Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Krauth2017-11-23 09:28:39 -0500
committerMarvin Mueller2017-11-28 09:54:11 -0500
commit2ac9c3e0ad18e24babe9befa5e90d31569a1efec (patch)
tree6068851b115f236884a3ed03045bb9c2ffb14845
parent40e1425e4d03f40ca5e0404587c10b8d43ad6936 (diff)
downloadorg.eclipse.jubula.core-2ac9c3e0ad18e24babe9befa5e90d31569a1efec.tar.gz
org.eclipse.jubula.core-2ac9c3e0ad18e24babe9befa5e90d31569a1efec.tar.xz
org.eclipse.jubula.core-2ac9c3e0ad18e24babe9befa5e90d31569a1efec.zip
Implementation of text input for editable combobox elements in JavaFX
Change-Id: Ib02318490b29413ba5cdc9bea73867b2fbad2e31 Signed-off-by: Marcel Krauth <Marcel.Krauth@bredex.de>
-rw-r--r--org.eclipse.jubula.rc.javafx/src/org/eclipse/jubula/rc/javafx/tester/adapter/ComboBoxAdapter.java26
1 files changed, 24 insertions, 2 deletions
diff --git a/org.eclipse.jubula.rc.javafx/src/org/eclipse/jubula/rc/javafx/tester/adapter/ComboBoxAdapter.java b/org.eclipse.jubula.rc.javafx/src/org/eclipse/jubula/rc/javafx/tester/adapter/ComboBoxAdapter.java
index 865453684..ac25c60bd 100644
--- a/org.eclipse.jubula.rc.javafx/src/org/eclipse/jubula/rc/javafx/tester/adapter/ComboBoxAdapter.java
+++ b/org.eclipse.jubula.rc.javafx/src/org/eclipse/jubula/rc/javafx/tester/adapter/ComboBoxAdapter.java
@@ -14,6 +14,7 @@ import java.lang.reflect.Field;
import java.util.List;
import java.util.concurrent.Callable;
+import org.apache.commons.lang.StringUtils;
import org.eclipse.jubula.rc.common.adaptable.AdapterFactoryRegistry;
import org.eclipse.jubula.rc.common.driver.ClickOptions;
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
@@ -22,6 +23,9 @@ import org.eclipse.jubula.rc.common.tester.adapter.interfaces.IComponent;
import org.eclipse.jubula.rc.common.tester.adapter.interfaces.ITextComponent;
import org.eclipse.jubula.rc.javafx.driver.EventThreadQueuerJavaFXImpl;
import org.eclipse.jubula.rc.javafx.tester.util.NodeTraverseHelper;
+import org.eclipse.jubula.toolkit.enums.ValueSets;
+import org.eclipse.jubula.tools.internal.objects.event.EventFactory;
+import org.eclipse.jubula.tools.internal.utils.TimeUtil;
import com.sun.javafx.scene.control.skin.ComboBoxBaseSkin;
import com.sun.javafx.scene.control.skin.ComboBoxListViewSkin;
@@ -96,7 +100,9 @@ public class ComboBoxAdapter<T extends ComboBox<?>> extends
@Override
public void selectAll() {
- StepExecutionException.throwUnsupportedAction();
+ getRobot().clickAtCurrentPosition(getRealComponent(), 1, 1);
+ TimeUtil.delay(100);
+ getRealComponent().getEditor().selectAll();
}
@Override
@@ -129,7 +135,23 @@ public class ComboBoxAdapter<T extends ComboBox<?>> extends
@Override
public void input(String text, boolean replace)
throws StepExecutionException, IllegalArgumentException {
- StepExecutionException.throwUnsupportedAction();
+ if (!hasFocus()) {
+ TimeUtil.delay(100);
+ getRobot().clickAtCurrentPosition(getRealComponent(), 1, 1);
+ }
+ if (isEditable()) {
+ if (replace) {
+ selectAll();
+ if (StringUtils.EMPTY.equals(text)) {
+ getRobot().keyStroke(ValueSets.KeyStroke.delete.rcValue());
+ }
+ }
+ getRobot().type(getRealComponent(), text);
+ } else {
+ throw new StepExecutionException(
+ "The combobox is not editable", EventFactory //$NON-NLS-1$
+ .createActionError("The combobox is not editable")); //$NON-NLS-1$
+ }
}
@Override

Back to the top