Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 394179 | Differences between
and this patch

Collapse All | Expand All

(-)a/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/caps/AbstractButtonCAPs.java (-31 / +2 lines)
Lines 22-40 import org.eclipse.jubula.rc.common.uiadapter.interfaces.IButtonAdapter; Link Here
22
 * @author BREDEX GmbH
22
 * @author BREDEX GmbH
23
 *
23
 *
24
 */
24
 */
25
public abstract class AbstractButtonCAPs extends AbstractWidgetCAPs {
25
public abstract class AbstractButtonCAPs extends AbstractTextVerifiable {
26
26
27
    /**
27
    /**
28
     * Action to read the value of a JButton to store it in a variable in the
29
     * Client
30
     * 
31
     * @param variable the name of the variable
32
     * @return the text value.
33
     */
34
    public String gdReadValue(String variable) {
35
        return ((IButtonAdapter) this.getComponent()).getText();
36
    }
37
    /**
38
     * 
28
     * 
39
     * @return the IButtonAdapter for the component. 
29
     * @return the IButtonAdapter for the component. 
40
     */
30
     */
Lines 51-67 public abstract class AbstractButtonCAPs extends AbstractWidgetCAPs { Link Here
51
41
52
        Verifier.equals(selected, getButtonAdapter().isSelected());
42
        Verifier.equals(selected, getButtonAdapter().isSelected());
53
    }
43
    }
54
    
44
   
55
    /**
56
     * Verifies the passed text.
57
     * 
58
     * @param text The text to verify
59
     * @param operator The RegEx operator used to verify
60
     */
61
    public void gdVerifyText(String text, String operator) {
62
        verifyText(text, operator);
63
    }
64
65
    /**
45
    /**
66
     * Verifies the passed text.
46
     * Verifies the passed text.
67
     * 
47
     * 
Lines 70-83 public abstract class AbstractButtonCAPs extends AbstractWidgetCAPs { Link Here
70
    public void gdVerifyText(String text) {
50
    public void gdVerifyText(String text) {
71
        gdVerifyText(text, MatchUtil.DEFAULT_OPERATOR);
51
        gdVerifyText(text, MatchUtil.DEFAULT_OPERATOR);
72
    }
52
    }
73
    /**
74
     * Verifies the passed text.
75
     * @param text The text to verify
76
     * @param operator The operator used to verify
77
     */
78
    public void verifyText(String text, String operator) {
79
        String value = getButtonAdapter().getText();
80
        Verifier.match(value, text, operator);
81
    }
82
53
83
}
54
}
(-)a/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/caps/AbstractListCAPs.java (+466 lines)
Added Link Here
1
package org.eclipse.jubula.rc.common.caps;
2
3
import java.util.Arrays;
4
5
import org.apache.commons.lang.ArrayUtils;
6
import org.apache.commons.lang.StringUtils;
7
import org.eclipse.jubula.rc.common.CompSystemConstants;
8
import org.eclipse.jubula.rc.common.driver.ClickOptions;
9
import org.eclipse.jubula.rc.common.driver.DragAndDropHelper;
10
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
11
import org.eclipse.jubula.rc.common.implclasses.IndexConverter;
12
import org.eclipse.jubula.rc.common.implclasses.ListSelectionVerifier;
13
import org.eclipse.jubula.rc.common.implclasses.MatchUtil;
14
import org.eclipse.jubula.rc.common.implclasses.Verifier;
15
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IListAdapter;
16
import org.eclipse.jubula.tools.constants.StringConstants;
17
import org.eclipse.jubula.tools.constants.TestDataConstants;
18
import org.eclipse.jubula.tools.objects.event.EventFactory;
19
import org.eclipse.jubula.tools.objects.event.TestErrorEvent;
20
import org.eclipse.jubula.tools.utils.StringParsing;
21
22
/**
23
 * 
24
 * @author BREDEX GmbH
25
 *
26
 */
27
public abstract class AbstractListCAPs extends AbstractTextVerifiable {
28
29
    /** The default separator for enumerations of list values. */
30
    public static final char INDEX_LIST_SEP_CHAR = 
31
        TestDataConstants.VALUE_CHAR_DEFAULT; 
32
    //FIXME this should be in an upper class or Util
33
    /** The default separator of a list of values */
34
    public static final char VALUE_SEPARATOR = 
35
        TestDataConstants.VALUE_CHAR_DEFAULT;
36
    
37
    /**
38
     * Splits the enumeration of values.
39
     * @param values The values to split
40
     * @param separator The separator, may be <code>null</code>
41
     * @return The array of values
42
     */
43
    private String[] split(String values, String separator) {
44
        String[] list = StringParsing.splitToArray(values, ((separator == null)
45
            || (separator.length() == 0) ? INDEX_LIST_SEP_CHAR
46
                : separator.charAt(0)),
47
            TestDataConstants.ESCAPE_CHAR_DEFAULT);
48
        list = StringUtils.stripAll(list);
49
        return list;
50
    }
51
    
52
    /**
53
     * @return The array of selected indices
54
     * @throws StepExecutionException If there are no indices selected
55
     */
56
    private int[] getCheckedSelectedIndices() throws StepExecutionException {
57
        int[] selected = getListAdapter().getSelectedIndices();
58
        if (selected.length == 0) {
59
            throw new StepExecutionException("No list element selected", //$NON-NLS-1$
60
                EventFactory.createActionError(TestErrorEvent.NO_SELECTION));
61
        }
62
        return selected;
63
    }
64
65
    /**
66
     * 
67
     * @return the List Adapter
68
     */
69
    private IListAdapter getListAdapter() {
70
        return ((IListAdapter) getComponent());
71
    }
72
    
73
    /**
74
     * Verifies if the passed index is selected.
75
     * 
76
     * @param index The index to verify
77
     * @param expectSelected Whether the index should be selected.
78
     */
79
    public void gdVerifySelectedIndex(String index, boolean expectSelected) {
80
        int[] selected = getCheckedSelectedIndices();
81
        int implIndex = IndexConverter.toImplementationIndex(
82
                Integer.parseInt(index));
83
84
        boolean isSelected = ArrayUtils.contains(selected, implIndex);
85
        if (expectSelected != isSelected) {
86
            throw new StepExecutionException(
87
                    "Selection check failed for index: " + index,  //$NON-NLS-1$
88
                    EventFactory.createVerifyFailed(
89
                            String.valueOf(expectSelected), 
90
                            String.valueOf(isSelected)));
91
        }
92
    }
93
    
94
    /**
95
     * Verifies if the passed value or enumeration of values is selected. By
96
     * default, the enumeration separator is <code>,</code>
97
     * @param valueList The value or list of values to verify
98
     */
99
    public void gdVerifySelectedValue(String valueList) {
100
        gdVerifySelectedValue(valueList, MatchUtil.DEFAULT_OPERATOR, true);
101
    }
102
    
103
    /**
104
     * Verifies if the passed value is selected.
105
     * 
106
     * @param value The value to verify
107
     * @param operator The operator to use when comparing the 
108
     *                 expected and actual values.
109
     *  @param isSelected if the value should be selected or not.
110
     */
111
    public void gdVerifySelectedValue(String value, String operator,
112
            boolean isSelected) {
113
114
        final String[] current = getListAdapter().getSelectedValues();
115
        final ListSelectionVerifier listSelVerifier =
116
            new ListSelectionVerifier();
117
        for (int i = 0; i < current.length; i++) {
118
            listSelVerifier.addItem(i, current[i], true);
119
        }
120
        listSelVerifier.verifySelection(value, operator, isSelected);
121
    }
122
    
123
    /**
124
     * Verifies if all selected elements of a list match a text.
125
     * @param text The text to verify
126
     * @param operator The operator used to verify
127
     */
128
    public void gdVerifyText(String text, String operator) {
129
        String[] selected = getListAdapter().getSelectedValues();
130
        final int selCount = selected.length;
131
        if (selCount < 1) {
132
            throw new StepExecutionException("No selection", //$NON-NLS-1$
133
                EventFactory.createActionError(TestErrorEvent.NO_SELECTION));
134
        }
135
        for (int i = 0; i < selCount; i++) {
136
            Verifier.match(selected[i], text, operator);
137
        }
138
    }
139
    
140
    /**
141
     * Selects the passed index or enumeration of indices. The enumeration must
142
     * be separated by <code>,</code>, e.g. <code>1, 3,6</code>.
143
     * @param indexList The index or indices to select
144
     * @param extendSelection Whether this selection extends a previous 
145
     *                        selection.
146
     * @param button what mouse button should be used
147
     */
148
    public void gdSelectIndex(String indexList, final String extendSelection,
149
            int button) {
150
        final boolean isExtendSelection = extendSelection
151
                .equals(CompSystemConstants.EXTEND_SELECTION_YES);
152
        selectIndices(IndexConverter
153
                .toImplementationIndices(parseIndices(indexList)), ClickOptions
154
                .create().setClickCount(1).setMouseButton(button),
155
                isExtendSelection);
156
    }
157
    
158
    /**
159
     * Selects the passed value or enumeration of values. By default, the
160
     * enumeration separator is <code>,</code>.
161
     * @param valueList The value or list of values to select
162
     * @param operator If regular expressions are used
163
     * @param searchType Determines where the search begins ("relative" or "absolute")
164
     * @param extendSelection Whether this selection extends a previous 
165
     *                          selection. If <code>true</code>, the first 
166
     *                          element will be selected with CONTROL as a 
167
     *                          modifier.
168
     * @param button what mouse button should be used
169
     */
170
    public void gdSelectValue(String valueList, String operator, 
171
            String searchType, final String extendSelection, int button) {
172
        final boolean isExtendSelection = 
173
            extendSelection.equals(CompSystemConstants.EXTEND_SELECTION_YES);
174
        selectValue(valueList, String.valueOf(VALUE_SEPARATOR), operator, 
175
            searchType, ClickOptions.create()
176
                .setClickCount(1)
177
                .setMouseButton(button), isExtendSelection); 
178
    }
179
    
180
    /**
181
     * Selects the passed value or enumeration of values. By default, the
182
     * enumeration separator is <code>,</code>, but may be changed by
183
     * <code>separator</code>.
184
     * @param valueList The value or list of values to select
185
     * @param separator The separator, optional
186
     * @param operator If regular expressions are used
187
     * @param searchType Determines where the search begins ("relative" or "absolute")
188
     * @param clickCount the amount of clicks to use
189
     * @param extendSelection Whether this selection extends a previous 
190
     *                        selection.
191
     */
192
    public void gdSelectValue(String valueList, String separator,
193
            String operator, final String searchType, int clickCount, 
194
            final String extendSelection) {
195
        final boolean isExtendSelection = 
196
            extendSelection.equals(CompSystemConstants.EXTEND_SELECTION_YES);
197
        selectValue(valueList, separator, operator, searchType, ClickOptions
198
                .create().setClickCount(clickCount), isExtendSelection);
199
    }
200
    
201
    /**
202
     * Verifies if the list contains an element that renderes <code>value</code>.
203
     * @param value The text to verify
204
     */
205
    public void gdVerifyContainsValue(String value) {
206
        Verifier.equals(true, containsValue(value));
207
    }
208
209
    /**
210
     * Verifies if the list contains an element that renderes <code>value</code>.
211
     * @param value The text to verify
212
     * @param operator The operator used to verify
213
     * @param exists if the wanted value should exist or not.
214
     */
215
    public void gdVerifyContainsValue(String value, String operator,
216
            boolean exists) {
217
218
        Verifier.equals(exists, containsValue(value, operator));
219
    }
220
    
221
    /**
222
     * Action to read the value of the current selected item of the JList
223
     * to store it in a variable in the Client
224
     * @param variable the name of the variable
225
     * @return the text value.
226
     */
227
    public String gdReadValue(String variable) {
228
        String[] selected = getListAdapter().getSelectedValues();
229
        if (selected.length > 0) {
230
            return selected[0];
231
        }
232
        throw new StepExecutionException("No list item selected", //$NON-NLS-1$
233
            EventFactory.createActionError(TestErrorEvent.NO_SELECTION));
234
    }
235
    
236
    /**
237
     * Drags the passed value.
238
     *
239
     * @param mouseButton the mouseButton.
240
     * @param modifier the modifier.
241
     * @param value The value to drag
242
     * @param operator If regular expressions are used
243
     * @param searchType Determines where the search begins ("relative" or "absolute")
244
     */
245
    public void gdDragValue(int mouseButton, String modifier, String value,
246
            String operator, final String searchType) {
247
248
        DragAndDropHelper dndHelper = DragAndDropHelper.getInstance();
249
        dndHelper.setModifier(modifier);
250
        dndHelper.setMouseButton(mouseButton);
251
252
        Integer [] indices = getListAdapter().findIndicesOfValues(
253
            new String [] {value}, operator, searchType);
254
        selectIndices(ArrayUtils.toPrimitive(indices), 
255
                ClickOptions.create().setClickCount(0), false);
256
257
        pressOrReleaseModifiers(modifier, true);
258
        getRobot().mousePress(null, null, mouseButton);
259
    }
260
261
    /**
262
     * Drops on the passed value.
263
     *
264
     * @param value The value on which to drop
265
     * @param operator If regular expressions are used
266
     * @param searchType Determines where the search begins ("relative" or "absolute")
267
     * @param delayBeforeDrop the amount of time (in milliseconds) to wait
268
     *                        between moving the mouse to the drop point and
269
     *                        releasing the mouse button
270
     */
271
    public void gdDropValue(String value, String operator,
272
        final String searchType, int delayBeforeDrop) {
273
274
        DragAndDropHelper dndHelper = DragAndDropHelper.getInstance();
275
        try {
276
            Integer [] indices = getListAdapter().findIndicesOfValues(
277
                new String [] {value}, operator, searchType);
278
            selectIndices(ArrayUtils.toPrimitive(indices), 
279
                    ClickOptions.create().setClickCount(0), false);
280
            waitBeforeDrop(delayBeforeDrop);
281
        } finally {
282
            getRobot().mouseRelease(null, null, dndHelper.getMouseButton());
283
            pressOrReleaseModifiers(dndHelper.getModifier(), false);
284
        }
285
    }
286
287
    /**
288
     * Drags the passed index.
289
     *
290
     * @param mouseButton the mouseButton.
291
     * @param modifier the modifier.
292
     * @param index The index to drag
293
     */
294
    public void gdDragIndex(final int mouseButton, final String modifier,
295
            int index) {
296
297
        DragAndDropHelper dndHelper = DragAndDropHelper.getInstance();
298
        dndHelper.setModifier(modifier);
299
        dndHelper.setMouseButton(mouseButton);
300
301
        selectIndices(
302
                new int [] {IndexConverter.toImplementationIndex(index)}, 
303
                ClickOptions.create().setClickCount(0), false);
304
305
        pressOrReleaseModifiers(modifier, true);
306
        getRobot().mousePress(null, null, mouseButton);
307
    }
308
309
    /**
310
     * Drops onto the passed index.
311
     *
312
     * @param index The index on which to drop
313
     * @param delayBeforeDrop the amount of time (in milliseconds) to wait
314
     *                        between moving the mouse to the drop point and
315
     *                        releasing the mouse button
316
     */
317
    public void gdDropIndex(final int index, int delayBeforeDrop) {
318
319
        DragAndDropHelper dndHelper = DragAndDropHelper.getInstance();
320
321
        try {
322
            selectIndices(
323
                    new int [] {IndexConverter.toImplementationIndex(index)}, 
324
                    ClickOptions.create().setClickCount(0), false);
325
            waitBeforeDrop(delayBeforeDrop);
326
        } finally {
327
            getRobot().mouseRelease(null, null, dndHelper.getMouseButton());
328
            pressOrReleaseModifiers(dndHelper.getModifier(), false);
329
        }
330
    }
331
332
    /**
333
     * @param value The value
334
     * @return <code>true</code> if the list contains an element that is rendered with <code>value</code>
335
     */
336
    public boolean containsValue(String value) {
337
        Integer[] indices = getListAdapter().findIndicesOfValues(
338
                new String[] { value },
339
                MatchUtil.EQUALS, CompSystemConstants.SEARCH_TYPE_ABSOLUTE);
340
        return indices.length > 0;
341
    }
342
    
343
    /**
344
     * @param value The value
345
     * @param operator The operator used to verify
346
     * @return <code>true</code> if the list contains an element that is rendered with <code>value</code>
347
     */
348
    public boolean containsValue(String value, String operator) {
349
        Integer[] indices = null;
350
        if (operator.equals(MatchUtil.NOT_EQUALS)) {
351
            indices = getListAdapter().findIndicesOfValues(
352
                    new String[] { value },
353
                MatchUtil.EQUALS, CompSystemConstants.SEARCH_TYPE_ABSOLUTE);
354
            return indices.length == 0;
355
        } 
356
        indices = getListAdapter().findIndicesOfValues(new String[] { value },
357
            operator, CompSystemConstants.SEARCH_TYPE_ABSOLUTE);
358
        return indices.length > 0;
359
    }
360
    
361
    /**
362
     * Selects the passed value or enumeration of values. By default, the
363
     * enumeration separator is <code>,</code>, but may be changed by
364
     * <code>separator</code>.
365
     * @param valueList The value or list of values to select
366
     * @param separator The separator, optional
367
     * @param operator If regular expressions are used
368
     * @param searchType Determines where the search begins ("relative" or "absolute")
369
     * @param co the click options to use
370
     * @param isExtendSelection Whether this selection extends a previous 
371
     *                        selection.
372
     */
373
    private void selectValue(String valueList, String separator,
374
            String operator, final String searchType, ClickOptions co, 
375
            final boolean isExtendSelection) {
376
377
        String[] values = null;
378
        if (StringConstants.EMPTY.equals(valueList)) {
379
            values = new String[1];
380
            values[0] = StringConstants.EMPTY;
381
        } else {
382
            values = split(valueList, separator);
383
        }
384
        Integer[] indices = getListAdapter().findIndicesOfValues(values,
385
                operator, searchType);
386
        Arrays.sort(indices);
387
        if (!operator.equals(MatchUtil.NOT_EQUALS) 
388
                && (indices.length < values.length)) {
389
            throw new StepExecutionException("One or more values not found of set: " //$NON-NLS-1$
390
                + Arrays.asList(values).toString(),
391
                EventFactory.createActionError(TestErrorEvent.NOT_FOUND));
392
        }
393
        selectIndices(ArrayUtils.toPrimitive(indices), co, isExtendSelection);
394
    }
395
    
396
    /**
397
     * Parses the enumeration of indices.
398
     * @param indexList The enumeration of indices
399
     * @return The array of parsed indices
400
     */
401
    private int[] parseIndices(String indexList) {
402
        String[] list = StringParsing.splitToArray(indexList,
403
                INDEX_LIST_SEP_CHAR, TestDataConstants.ESCAPE_CHAR_DEFAULT);
404
        int[] indices = new int[list.length];
405
        for (int i = 0; i < list.length; i++) {
406
            indices[i] = IndexConverter.intValue(list[i]);
407
        }
408
        return indices;
409
    }
410
    
411
    /**
412
     * @param indices The indices to select
413
     * @param co the click options to use
414
     * @param isExtendSelection Whether this selection extends a previous 
415
     *                          selection. If <code>true</code>, the first 
416
     *                          element will be selected with CONTROL as a 
417
     *                          modifier.
418
     */
419
    private void selectIndices(int[] indices, ClickOptions co, 
420
            boolean isExtendSelection) {
421
        Object list = getListAdapter().getRealComponent();
422
        if (indices.length > 0) {
423
            try {
424
                if (isExtendSelection) {
425
                    getRobot().keyPress(list,
426
                            getSystemDefaultModifier());
427
                }
428
429
                // first selection
430
                getListAdapter().clickOnIndex(
431
                        new Integer(indices[0]), co);
432
            } finally {
433
                if (isExtendSelection) {
434
                    getRobot().keyRelease(list,
435
                            getSystemDefaultModifier());
436
                }
437
            }
438
        }
439
        try {
440
            getRobot().keyPress(list,
441
                    getSystemDefaultModifier());
442
            // following selections
443
            for (int i = 1; i < indices.length; i++) {
444
                getListAdapter().clickOnIndex(
445
                        new Integer(indices[i]), co);
446
            }
447
        } finally {
448
            getRobot().keyRelease(list,
449
                    getSystemDefaultModifier());
450
        }
451
    }
452
    
453
    /**
454
     * {@inheritDoc}
455
     */
456
    public String[] getTextArrayFromComponent() {
457
        return null;
458
    }
459
    
460
    /**
461
     * 
462
     * @return -
463
     */
464
    protected abstract int getSystemDefaultModifier();
465
    
466
}
(-)a/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/caps/AbstractTableCAPs.java (-115 / +13 lines)
Lines 11-22 Link Here
11
package org.eclipse.jubula.rc.common.caps;
11
package org.eclipse.jubula.rc.common.caps;
12
12
13
import java.awt.Rectangle;
13
import java.awt.Rectangle;
14
import java.util.StringTokenizer;
15
16
import org.eclipse.jubula.rc.common.CompSystemConstants;
14
import org.eclipse.jubula.rc.common.CompSystemConstants;
17
import org.eclipse.jubula.rc.common.driver.ClickOptions;
15
import org.eclipse.jubula.rc.common.driver.ClickOptions;
18
import org.eclipse.jubula.rc.common.driver.DragAndDropHelper;
16
import org.eclipse.jubula.rc.common.driver.DragAndDropHelper;
19
import org.eclipse.jubula.rc.common.driver.IRobot;
20
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
17
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
21
import org.eclipse.jubula.rc.common.implclasses.IndexConverter;
18
import org.eclipse.jubula.rc.common.implclasses.IndexConverter;
22
import org.eclipse.jubula.rc.common.implclasses.MatchUtil;
19
import org.eclipse.jubula.rc.common.implclasses.MatchUtil;
Lines 24-34 import org.eclipse.jubula.rc.common.implclasses.Verifier; Link Here
24
import org.eclipse.jubula.rc.common.implclasses.table.Cell;
21
import org.eclipse.jubula.rc.common.implclasses.table.Cell;
25
import org.eclipse.jubula.rc.common.logger.AutServerLogger;
22
import org.eclipse.jubula.rc.common.logger.AutServerLogger;
26
import org.eclipse.jubula.rc.common.uiadapter.interfaces.ITableAdapter;
23
import org.eclipse.jubula.rc.common.uiadapter.interfaces.ITableAdapter;
27
import org.eclipse.jubula.rc.common.util.KeyStrokeUtil;
28
import org.eclipse.jubula.tools.constants.InputConstants;
24
import org.eclipse.jubula.tools.constants.InputConstants;
29
import org.eclipse.jubula.tools.objects.event.EventFactory;
25
import org.eclipse.jubula.tools.objects.event.EventFactory;
30
import org.eclipse.jubula.tools.objects.event.TestErrorEvent;
26
import org.eclipse.jubula.tools.objects.event.TestErrorEvent;
31
import org.eclipse.jubula.tools.utils.TimeUtil;
32
27
33
/**
28
/**
34
 * General implementation for tables.
29
 * General implementation for tables.
Lines 564-580 public abstract class AbstractTableCAPs extends AbstractTextInputSupport { Link Here
564
                co, extendSelection);
559
                co, extendSelection);
565
        
560
        
566
    }
561
    }
567
    
562
//FIXME    
568
    /**
563
//    /**
569
     * Action to read the value of the current selected cell of the JTable 
564
//     * Action to read the value of the current selected cell of the JTable 
570
     * to store it in a variable in the Client
565
//     * to store it in a variable in the Client
571
     * @param variable the name of the variable
566
//     * @param variable the name of the variable
572
     * @return the text value.
567
//     * @return the text value.
573
     */
568
//     */
574
    public String gdReadValue(String variable) {
569
//    public String gdReadValue(String variable) {
575
        final Cell selectedCell = getTableAdapter().getSelectedCell();
570
//        final Cell selectedCell = getTableAdapter().getSelectedCell();
576
        return getCellText(selectedCell.getRow(), selectedCell.getCol());
571
//        return getCellText(selectedCell.getRow(), selectedCell.getCol());
577
    }
572
//    }
578
    
573
    
579
    /**
574
    /**
580
     * Action to read the value of the passed cell of the JTable
575
     * Action to read the value of the passed cell of the JTable
Lines 956-990 public abstract class AbstractTableCAPs extends AbstractTextInputSupport { Link Here
956
        return getTableAdapter().getCellText(row, column);
951
        return getTableAdapter().getCellText(row, column);
957
952
958
    }
953
    }
959
    
954
        
960
    /**
961
     * Presses or releases the given modifier.
962
     * @param modifier the modifier.
963
     * @param press if true, the modifier will be pressed.
964
     * if false, the modifier will be released.
965
     */
966
    protected void pressOrReleaseModifiers(String modifier, boolean press) {
967
        final IRobot robot = getRobot();
968
        final StringTokenizer modTok = new StringTokenizer(
969
                KeyStrokeUtil.getModifierString(modifier), " "); //$NON-NLS-1$
970
        while (modTok.hasMoreTokens()) {
971
            final String mod = modTok.nextToken();
972
            final int keyCode = getKeyCode(mod);
973
            if (press) {
974
                robot.keyPress(null, keyCode);
975
            } else {
976
                robot.keyRelease(null, keyCode);
977
            }
978
        }
979
    }
980
    
981
    /**
982
     * Gets the key code for a specific modifier
983
     * @param mod the modifier
984
     * @return the integer key code value
985
     */
986
    protected abstract int getKeyCode(String mod);
987
    
988
    /**
955
    /**
989
     * Checks whether <code>0 <= value < count</code>. 
956
     * Checks whether <code>0 <= value < count</code>. 
990
     * @param value The value to check.
957
     * @param value The value to check.
Lines 1081-1096 public abstract class AbstractTableCAPs extends AbstractTextInputSupport { Link Here
1081
        return true;
1048
        return true;
1082
    }
1049
    }
1083
    
1050
    
1084
    /**
1051
1085
     * Waits the given amount of time. Logs a drop-related error if interrupted.
1086
     *
1087
     * @param delayBeforeDrop the amount of time (in milliseconds) to wait
1088
     *                        between moving the mouse to the drop point and
1089
     *                        releasing the mouse button
1090
     */
1091
    static void waitBeforeDrop(int delayBeforeDrop) {
1092
        TimeUtil.delay(delayBeforeDrop);
1093
    }
1094
    
1052
    
1095
    /**
1053
    /**
1096
     * Sets the specific editor to an replace mode. Means that the next key
1054
     * Sets the specific editor to an replace mode. Means that the next key
Lines 1132-1196 public abstract class AbstractTableCAPs extends AbstractTextInputSupport { Link Here
1132
     */
1090
     */
1133
    protected abstract boolean isMouseOnHeader();
1091
    protected abstract boolean isMouseOnHeader();
1134
1092
1135
    /**
1136
     * Selects the passed row of the JTable. This is actually a selection of the
1137
     * cell <code>(row, 0)</code>.
1138
     *
1139
     * @param row
1140
     *            The row
1141
     * @param extendSelection Should this selection be part of a multiple selection
1142
     * @throws StepExecutionException
1143
     *             If the row is invalid
1144
     * @deprecated the same as gdSelectCell
1145
     * Will be removed!
1146
     */
1147
    public void gdSelectRow(int row, String extendSelection)
1148
        throws StepExecutionException {
1149
        // FIXME this is only here for testing purpose (to get all CaA tests running)
1150
        gdSelectCell(String.valueOf(row), MatchUtil.DEFAULT_OPERATOR, "1", //$NON-NLS-1$
1151
                MatchUtil.DEFAULT_OPERATOR, 
1152
                ClickOptions.create().setClickCount(1), extendSelection);
1153
    }
1154
    
1155
    /**
1156
     * Finds the first column which contains the value <code>value</code>
1157
     * in the given row and selects the cell.
1158
     * 
1159
     * @param row the row
1160
     * @param value the value
1161
     * @param clickCount the mouse clicks.
1162
     * @param regex search using regex
1163
     * @param extendSelection Should this selection be part of a multiple selection
1164
     * @param searchType Determines where the search begins ("relative" or "absolute")
1165
     * @deprecated Will be removed with gdSelectCellByColValue with String parameter
1166
     * for Row/Column
1167
     */
1168
    public void gdSelectCellByColValue(int row, final String value, 
1169
        final String regex, int clickCount, final String extendSelection, 
1170
        final String searchType) {
1171
        // FIXME this is only here for testing purpose (to get all CaA tests running)
1172
        gdSelectCellByColValue(String.valueOf(row), MatchUtil.DEFAULT_OPERATOR,
1173
                value, regex, clickCount, extendSelection, searchType, 1);
1174
1093
1175
    }
1176
    
1177
    /**
1178
     * Finds the first row which contains the value <code>value</code>
1179
     * in column <code>col</code> and selects this row.
1180
     * @param col the column
1181
     * @param value the value
1182
     * @param clickCount the number of clicks.
1183
     * @param regexOp the regex operator
1184
     * @param extendSelection Should this selection be part of a multiple selection
1185
     * @param searchType Determines where the search begins ("relative" or "absolute")
1186
     * @deprecated Will be removed with gdSelectRowByValue with String parameter
1187
     * for Row/Column
1188
     */
1189
    public void gdSelectRowByValue(int col, final String value,
1190
        int clickCount, final String regexOp, final String extendSelection, 
1191
        final String searchType) {
1192
        // FIXME this is only here for testing purpose (to get all CaA tests running)
1193
        gdSelectRowByValue(String.valueOf(col), MatchUtil.DEFAULT_OPERATOR,
1194
                value, regexOp, clickCount, extendSelection, searchType, 1);
1195
    }
1196
}
1094
}
(-)a/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/caps/AbstractTextVerifiable.java (-5 / +10 lines)
Lines 11-16 Link Here
11
package org.eclipse.jubula.rc.common.caps;
11
package org.eclipse.jubula.rc.common.caps;
12
12
13
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
13
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
14
import org.eclipse.jubula.rc.common.implclasses.Verifier;
15
import org.eclipse.jubula.rc.common.uiadapter.interfaces.ITextVerifiable;
14
16
15
/**
17
/**
16
 * This class represents the general implementation for components
18
 * This class represents the general implementation for components
Lines 27-34 public abstract class AbstractTextVerifiable extends AbstractWidgetCAPs { Link Here
27
     * @param variable the name of the variable
29
     * @param variable the name of the variable
28
     * @return the text value.
30
     * @return the text value.
29
     */
31
     */
30
    public abstract String gdReadValue(String variable);
32
    public String gdReadValue(String variable) {
31
    // FIXME this is only a pattern because only Tables uses this at the moment
33
        return ((ITextVerifiable)getComponent()).getText();
34
    }
32
35
33
    /**
36
    /**
34
     * Verifies the rendered text inside the currently component.<br>
37
     * Verifies the rendered text inside the currently component.<br>
Lines 37-43 public abstract class AbstractTextVerifiable extends AbstractWidgetCAPs { Link Here
37
     * @param operator The operation used to verify
40
     * @param operator The operation used to verify
38
     * @throws StepExecutionException If the rendered text cannot be extracted.
41
     * @throws StepExecutionException If the rendered text cannot be extracted.
39
     */
42
     */
40
    public abstract void gdVerifyText(String text, String operator)
43
    public void gdVerifyText(String text, String operator)
41
        throws StepExecutionException;
44
        throws StepExecutionException {
42
    // FIXME this is only a pattern because only Tables uses this at the moment
45
        Verifier.match(((ITextVerifiable)getComponent()).getText(), text,
46
                                    operator);
47
    }
43
}
48
}
(-)a/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/caps/AbstractUICAPs.java (-3 / +8 lines)
Lines 27-39 import org.eclipse.jubula.rc.common.uiadapter.interfaces.IComponentAdapter; Link Here
27
 */
27
 */
28
public abstract class AbstractUICAPs implements IBaseImplementationClass {
28
public abstract class AbstractUICAPs implements IBaseImplementationClass {
29
29
30
    
31
    
32
    /** constants for communication */
30
    /** constants for communication */
33
    protected static final String POS_UNIT_PIXEL = "Pixel"; //$NON-NLS-1$
31
    protected static final String POS_UNIT_PIXEL = "Pixel"; //$NON-NLS-1$
34
    
32
    
35
    /** constants for communication */
33
    /** constants for communication */
36
    protected static final String POS_UNI_PERCENT = "Percent"; //$NON-NLS-1$
34
    protected static final String POS_UNI_PERCENT = "Percent"; //$NON-NLS-1$
35
    
36
    /** */
37
    private IRobotFactory m_robotFactory;    
38
37
    /**    */
39
    /**    */
38
    private IComponentAdapter m_component;
40
    private IComponentAdapter m_component;
39
41
Lines 50-56 public abstract class AbstractUICAPs implements IBaseImplementationClass { Link Here
50
     * Gets the Robot factory. The factory is created once per instance.
52
     * Gets the Robot factory. The factory is created once per instance.
51
     * @return The Robot factory.
53
     * @return The Robot factory.
52
     */
54
     */
53
    protected abstract IRobotFactory getRobotFactory();
55
    protected IRobotFactory getRobotFactory() {
56
        m_robotFactory = m_component.getRobotFactory();
57
        return m_robotFactory;
58
    }
54
    
59
    
55
    /**
60
    /**
56
     * {@inheritDoc}
61
     * {@inheritDoc}
(-)a/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/caps/AbstractWidgetCAPs.java (+45 lines)
Lines 10-21 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jubula.rc.common.caps;
11
package org.eclipse.jubula.rc.common.caps;
12
12
13
import java.util.StringTokenizer;
14
13
import org.eclipse.jubula.rc.common.CompSystemConstants;
15
import org.eclipse.jubula.rc.common.CompSystemConstants;
14
import org.eclipse.jubula.rc.common.driver.ClickOptions;
16
import org.eclipse.jubula.rc.common.driver.ClickOptions;
17
import org.eclipse.jubula.rc.common.driver.IRobot;
15
import org.eclipse.jubula.rc.common.driver.ClickOptions.ClickModifier;
18
import org.eclipse.jubula.rc.common.driver.ClickOptions.ClickModifier;
16
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
19
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
17
import org.eclipse.jubula.rc.common.implclasses.Verifier;
20
import org.eclipse.jubula.rc.common.implclasses.Verifier;
18
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IWidgetAdapter;
21
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IWidgetAdapter;
22
import org.eclipse.jubula.rc.common.util.KeyStrokeUtil;
23
import org.eclipse.jubula.tools.utils.TimeUtil;
19
/**
24
/**
20
 * Implementation of basic functions for a lot of graphics components
25
 * Implementation of basic functions for a lot of graphics components
21
 * except for context menus and menus. 
26
 * except for context menus and menus. 
Lines 482-486 public abstract class AbstractWidgetCAPs extends AbstractUICAPs { Link Here
482
        getWidgetAdapter().showToolTip(text, textSize,
487
        getWidgetAdapter().showToolTip(text, textSize,
483
                timePerWord, windowWidth);
488
                timePerWord, windowWidth);
484
    }
489
    }
490
    
491
    /**
492
     * Presses or releases the given modifier.
493
     * @param modifier the modifier.
494
     * @param press if true, the modifier will be pressed.
495
     * if false, the modifier will be released.
496
     */
497
    protected void pressOrReleaseModifiers(String modifier, boolean press) {
498
        final IRobot robot = getRobot();
499
        final StringTokenizer modTok = new StringTokenizer(
500
                KeyStrokeUtil.getModifierString(modifier), " "); //$NON-NLS-1$
501
        while (modTok.hasMoreTokens()) {
502
            final String mod = modTok.nextToken();
503
            final int keyCode = getKeyCode(mod);
504
            if (press) {
505
                robot.keyPress(null, keyCode);
506
            } else {
507
                robot.keyRelease(null, keyCode);
508
            }
509
        }
510
    }
511
    
512
    /**
513
     * Gets the key code for a specific modifier
514
     * @param mod the modifier
515
     * @return the integer key code value
516
     */
517
    protected int getKeyCode(String mod) {
518
        return getWidgetAdapter().getKeyCode(mod);
519
    }
485
520
521
    /**
522
     * Waits the given amount of time. Logs a drop-related error if interrupted.
523
     *
524
     * @param delayBeforeDrop the amount of time (in milliseconds) to wait
525
     *                        between moving the mouse to the drop point and
526
     *                        releasing the mouse button
527
     */
528
    public static void waitBeforeDrop(int delayBeforeDrop) {
529
        TimeUtil.delay(delayBeforeDrop);
530
    }
486
}
531
}
(-)a/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/uiadapter/interfaces/IButtonAdapter.java (-8 / +1 lines)
Lines 18-24 package org.eclipse.jubula.rc.common.uiadapter.interfaces; Link Here
18
 * @author BREDEX GmbH
18
 * @author BREDEX GmbH
19
 */
19
 */
20
20
21
public interface IButtonAdapter extends IWidgetAdapter {
21
public interface IButtonAdapter extends ITextVerifiable {
22
    /**
22
    /**
23
     * Gets the text from the button
23
     * Gets the text from the button
24
     * @return the text which is saved in the component
24
     * @return the text which is saved in the component
Lines 30-41 public interface IButtonAdapter extends IWidgetAdapter { Link Here
30
     * @return <code>true</code> if the component is selected
30
     * @return <code>true</code> if the component is selected
31
     */
31
     */
32
    public boolean isSelected();
32
    public boolean isSelected();
33
    /**
34
     * Action to read the value of a Button to store it in a variable
35
     * in the Client
36
     * @param variable the name of the variable
37
     * @return the text value.
38
     */
39
    public String  readValue(String variable);
40
   
33
   
41
}
34
}
(-)a/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/uiadapter/interfaces/IComponentAdapter.java (+9 lines)
Lines 9-14 Link Here
9
 *     BREDEX GmbH - initial API and implementation 
9
 *     BREDEX GmbH - initial API and implementation 
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jubula.rc.common.uiadapter.interfaces;
11
package org.eclipse.jubula.rc.common.uiadapter.interfaces;
12
13
import org.eclipse.jubula.rc.common.driver.IRobotFactory;
14
12
/**
15
/**
13
 * This is the main interface for classes which will hold or be the
16
 * This is the main interface for classes which will hold or be the
14
 * component that implement the methods we need for this
17
 * component that implement the methods we need for this
Lines 22-26 public interface IComponentAdapter { Link Here
22
     * @return toolkit specific component
25
     * @return toolkit specific component
23
     */
26
     */
24
    public Object getRealComponent();
27
    public Object getRealComponent();
28
29
    /**
30
     * Gets the toolkit specific RobotFactory
31
     * @return the RobotFactory
32
     */
33
    public IRobotFactory getRobotFactory();
25
   
34
   
26
}
35
}
(-)a/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/uiadapter/interfaces/IListAdapter.java (+42 lines)
Added Link Here
1
package org.eclipse.jubula.rc.common.uiadapter.interfaces;
2
3
import org.eclipse.jubula.rc.common.driver.ClickOptions;
4
5
/**
6
 * 
7
 * @author BREDEX GmbH
8
 *
9
 */
10
public interface IListAdapter extends ITextVerifiable {
11
    /**
12
     * 
13
     * @return The array of selected indices
14
     */
15
    public int[] getSelectedIndices();
16
17
    /**
18
     * Clicks on the index of the passed list.
19
     * @param i The index to click
20
     * @param co the click options to use for selecting an index item
21
     */
22
    public void clickOnIndex(Integer i, ClickOptions co);
23
    
24
    /**
25
     * @return The array of selected values as the renderer shows them
26
     */
27
    public String[] getSelectedValues();
28
    
29
    /**
30
     * Finds the indices of the list elements that are rendered with the passed values.
31
     * @param values The values
32
     * @param operator operator to use
33
     * @param searchType 
34
     *            Determines where the search begins ("relative" or "absolute")
35
     * @return The array of indices. It's length is equal to the length of the
36
     *         values array, but may contains <code>null</code> elements for
37
     *         all values that are not found in the list
38
     */
39
    public Integer[] findIndicesOfValues(final String[] values,
40
        final String operator, final String searchType);
41
42
}
(-)a/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/uiadapter/interfaces/ITableAdapter.java (-1 / +1 lines)
Lines 20-26 import org.eclipse.jubula.rc.common.implclasses.table.Cell; Link Here
20
 * 
20
 * 
21
 * @author BREDEX GmbH
21
 * @author BREDEX GmbH
22
 */
22
 */
23
public interface ITableAdapter extends IWidgetAdapter {
23
public interface ITableAdapter extends ITextVerifiable {
24
    
24
    
25
    
25
    
26
    /**
26
    /**
(-)a/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/uiadapter/interfaces/ITextVerifiable.java (+15 lines)
Added Link Here
1
package org.eclipse.jubula.rc.common.uiadapter.interfaces;
2
/**
3
 * 
4
 * @author BREDEX GmbH
5
 *
6
 */
7
public interface ITextVerifiable extends IWidgetAdapter {
8
9
    /**
10
     * Gets the value of the component, or if there are more
11
     * than the first selected.
12
     * @return the value of the component
13
     */
14
    public String getText();
15
}
(-)a/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/uiadapter/interfaces/IWidgetAdapter.java (+7 lines)
Lines 106-110 public interface IWidgetAdapter extends IComponentAdapter { Link Here
106
     */
106
     */
107
    public void gdDrop(int xPos, String xUnits, int yPos, String yUnits,
107
    public void gdDrop(int xPos, String xUnits, int yPos, String yUnits,
108
            int delayBeforeDrop);
108
            int delayBeforeDrop);
109
    
110
    /**
111
     * Gets the key code for a specific modifier
112
     * @param mod the modifier
113
     * @return the integer key code value
114
     */
115
    public int getKeyCode(String mod);
109
116
110
}
117
}
(-)a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/swing/caps/AbstractButtonCAPs.java (-15 lines)
Lines 11-19 Link Here
11
package org.eclipse.jubula.rc.swing.swing.caps;
11
package org.eclipse.jubula.rc.swing.swing.caps;
12
12
13
13
14
import org.eclipse.jubula.rc.common.driver.IRobotFactory;
15
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IButtonAdapter;
14
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IButtonAdapter;
16
import org.eclipse.jubula.rc.swing.driver.RobotFactoryConfig;
17
15
18
/**
16
/**
19
 * The implementation class for <code>AbstractButton</code> and subclasses. Note
17
 * The implementation class for <code>AbstractButton</code> and subclasses. Note
Lines 27-35 import org.eclipse.jubula.rc.swing.driver.RobotFactoryConfig; Link Here
27
public class AbstractButtonCAPs 
25
public class AbstractButtonCAPs 
28
    extends org.eclipse.jubula.rc.common.caps.AbstractButtonCAPs {
26
    extends org.eclipse.jubula.rc.common.caps.AbstractButtonCAPs {
29
27
30
    /** Robot Factory*/
31
    private IRobotFactory m_robotFactory;
32
33
    /**
28
    /**
34
     * Clicks the button <code>count</code> times.
29
     * Clicks the button <code>count</code> times.
35
     * 
30
     * 
Lines 47-60 public class AbstractButtonCAPs Link Here
47
        return new String[] { returnvalue.getText() };
42
        return new String[] { returnvalue.getText() };
48
    }
43
    }
49
44
50
    /** 
51
     * {@inheritDoc}
52
     */
53
    protected IRobotFactory getRobotFactory() {
54
        if (m_robotFactory == null) {
55
            m_robotFactory = new RobotFactoryConfig().getRobotFactory();
56
        }
57
        return m_robotFactory;
58
    }
59
60
}
45
}
(-)a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/swing/caps/JListCAPs.java (+19 lines)
Added Link Here
1
package org.eclipse.jubula.rc.swing.swing.caps;
2
3
import org.eclipse.jubula.rc.common.caps.AbstractListCAPs;
4
import org.eclipse.jubula.rc.swing.utils.SwingUtils;
5
/**
6
 * 
7
 * @author BREDEX GmbH
8
 *
9
 */
10
public class JListCAPs extends AbstractListCAPs {
11
        
12
    /**
13
     * {@inheritDoc}
14
     */
15
    protected int getSystemDefaultModifier() {
16
        return SwingUtils.getSystemDefaultModifier();
17
    }
18
    
19
}
(-)a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/swing/caps/JMenuBarCAPs.java (-18 / +2 lines)
Lines 26-37 import javax.swing.JPopupMenu; Link Here
26
import javax.swing.MenuElement;
26
import javax.swing.MenuElement;
27
27
28
import org.eclipse.jubula.rc.common.caps.AbstractMenuCAPs;
28
import org.eclipse.jubula.rc.common.caps.AbstractMenuCAPs;
29
import org.eclipse.jubula.rc.common.driver.IRobotFactory;
30
import org.eclipse.jubula.rc.common.implclasses.IBaseImplementationClass;
31
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IComponentAdapter;
29
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IComponentAdapter;
32
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IMenuAdapter;
30
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IMenuAdapter;
33
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IMenuItemAdapter;
31
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IMenuItemAdapter;
34
import org.eclipse.jubula.rc.swing.driver.RobotFactoryConfig;
35
import org.eclipse.jubula.rc.swing.swing.implclasses.WindowHelper;
32
import org.eclipse.jubula.rc.swing.swing.implclasses.WindowHelper;
36
import org.eclipse.jubula.rc.swing.swing.uiadapter.JMenuItemAdapter;
33
import org.eclipse.jubula.rc.swing.swing.uiadapter.JMenuItemAdapter;
37
34
Lines 40-60 import org.eclipse.jubula.rc.swing.swing.uiadapter.JMenuItemAdapter; Link Here
40
 * 
37
 * 
41
 * @author BREDEX GmbH
38
 * @author BREDEX GmbH
42
 */
39
 */
43
public class JMenuBarCAPs extends AbstractMenuCAPs 
40
public class JMenuBarCAPs extends AbstractMenuCAPs {
44
    implements IBaseImplementationClass {
41
            
45
    
46
    /** The robot factory.  */
47
    private IRobotFactory m_robotFactory;
48
    /**
49
     * {@inheritDoc}
50
     */
51
    protected IRobotFactory getRobotFactory() {
52
        if (m_robotFactory == null) {
53
            m_robotFactory = new RobotFactoryConfig().getRobotFactory();
54
        }
55
        return m_robotFactory;
56
    }
57
        
58
    /**
42
    /**
59
     * {@inheritDoc}
43
     * {@inheritDoc}
60
     */
44
     */
(-)a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/swing/caps/JTableCAPs.java (-23 lines)
Lines 23-35 import javax.swing.table.TableColumnModel; Link Here
23
import org.eclipse.jubula.rc.common.caps.AbstractTableCAPs;
23
import org.eclipse.jubula.rc.common.caps.AbstractTableCAPs;
24
import org.eclipse.jubula.rc.common.driver.ClickOptions;
24
import org.eclipse.jubula.rc.common.driver.ClickOptions;
25
import org.eclipse.jubula.rc.common.driver.IEventThreadQueuer;
25
import org.eclipse.jubula.rc.common.driver.IEventThreadQueuer;
26
import org.eclipse.jubula.rc.common.driver.IRobotFactory;
27
import org.eclipse.jubula.rc.common.driver.IRunnable;
26
import org.eclipse.jubula.rc.common.driver.IRunnable;
28
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
27
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
29
import org.eclipse.jubula.rc.common.implclasses.table.Cell;
28
import org.eclipse.jubula.rc.common.implclasses.table.Cell;
30
import org.eclipse.jubula.rc.common.logger.AutServerLogger;
29
import org.eclipse.jubula.rc.common.logger.AutServerLogger;
31
import org.eclipse.jubula.rc.swing.driver.RobotFactoryConfig;
32
import org.eclipse.jubula.rc.swing.swing.driver.KeyCodeConverter;
33
import org.eclipse.jubula.rc.swing.utils.SwingUtils;
30
import org.eclipse.jubula.rc.swing.utils.SwingUtils;
34
/**
31
/**
35
 * Toolkit specific commands for the <code>JTable</code>
32
 * Toolkit specific commands for the <code>JTable</code>
Lines 42-50 public class JTableCAPs extends AbstractTableCAPs { Link Here
42
    private static AutServerLogger log = new AutServerLogger(
39
    private static AutServerLogger log = new AutServerLogger(
43
            JTableCAPs.class);
40
            JTableCAPs.class);
44
41
45
    /** the RobotFactory from the AUT */
46
    private IRobotFactory m_robotFactory;
47
    
48
    /**
42
    /**
49
     * @return the log
43
     * @return the log
50
     */
44
     */
Lines 52-66 public class JTableCAPs extends AbstractTableCAPs { Link Here
52
        return log;
46
        return log;
53
    }    
47
    }    
54
48
55
    /**
56
     * {@inheritDoc}
57
     */
58
    protected IRobotFactory getRobotFactory() {
59
        if (m_robotFactory == null) {
60
            m_robotFactory = new RobotFactoryConfig().getRobotFactory();
61
        }
62
        return m_robotFactory;
63
    }
64
    
49
    
65
    /**
50
    /**
66
     * 
51
     * 
Lines 202-213 public class JTableCAPs extends AbstractTableCAPs { Link Here
202
                });
187
                });
203
    }
188
    }
204
189
205
206
    /**
207
     * {@inheritDoc}
208
     */
209
    protected int getKeyCode(String key) {
210
        return KeyCodeConverter.getKeyCode(key);
211
    }
212
213
}
190
}
(-)a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/swing/caps/JTreeCAPs.java (-38 / +1 lines)
Lines 18-30 import org.eclipse.jubula.rc.common.CompSystemConstants; Link Here
18
import org.eclipse.jubula.rc.common.caps.AbstractTreeCAPs;
18
import org.eclipse.jubula.rc.common.caps.AbstractTreeCAPs;
19
import org.eclipse.jubula.rc.common.driver.DragAndDropHelper;
19
import org.eclipse.jubula.rc.common.driver.DragAndDropHelper;
20
import org.eclipse.jubula.rc.common.driver.IEventThreadQueuer;
20
import org.eclipse.jubula.rc.common.driver.IEventThreadQueuer;
21
import org.eclipse.jubula.rc.common.driver.IRobotFactory;
22
import org.eclipse.jubula.rc.common.driver.IRunnable;
21
import org.eclipse.jubula.rc.common.driver.IRunnable;
23
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
22
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
24
import org.eclipse.jubula.rc.swing.driver.RobotFactoryConfig;
25
import org.eclipse.jubula.tools.objects.event.EventFactory;
23
import org.eclipse.jubula.tools.objects.event.EventFactory;
26
import org.eclipse.jubula.tools.objects.event.TestErrorEvent;
24
import org.eclipse.jubula.tools.objects.event.TestErrorEvent;
27
import org.eclipse.jubula.tools.utils.TimeUtil;
28
/**
25
/**
29
 * Toolkit specific commands for the <code>JTree</code>
26
 * Toolkit specific commands for the <code>JTree</code>
30
 * 
27
 * 
Lines 32-52 import org.eclipse.jubula.tools.utils.TimeUtil; Link Here
32
 */
29
 */
33
public class JTreeCAPs extends AbstractTreeCAPs {
30
public class JTreeCAPs extends AbstractTreeCAPs {
34
31
35
    /** Robot Factory*/
32
   
36
    private IRobotFactory m_robotFactory;
37
38
    
39
    /**
40
     * Waits the given amount of time. Logs a drop-related error if interrupted.
41
     *
42
     * @param delayBeforeDrop the amount of time (in milliseconds) to wait
43
     *                        between moving the mouse to the drop point and
44
     *                        releasing the mouse button
45
     */
46
    static void waitBeforeDrop(int delayBeforeDrop) {
47
        TimeUtil.delay(delayBeforeDrop);
48
    }
49
    
50
    /**
33
    /**
51
     * {@inheritDoc}
34
     * {@inheritDoc}
52
     */
35
     */
Lines 164-189 public class JTreeCAPs extends AbstractTreeCAPs { Link Here
164
    private JTree getTreeComponent() {
147
    private JTree getTreeComponent() {
165
        return (JTree) getComponent().getRealComponent();
148
        return (JTree) getComponent().getRealComponent();
166
    }
149
    }
167
168
    /** 
169
     * {@inheritDoc}
170
     */
171
    protected IRobotFactory getRobotFactory() {
172
        if (m_robotFactory == null) {
173
            m_robotFactory = new RobotFactoryConfig().getRobotFactory();
174
        }
175
        return m_robotFactory;
176
    }
177
    
178
    /**
179
     * Presses or releases the given modifier.
180
     * @param modifier the modifier.
181
     * @param press if true, the modifier will be pressed.
182
     * if false, the modifier will be released.
183
     */
184
    protected void pressOrReleaseModifiers(String modifier, boolean press) {
185
        CapUtil.pressOrReleaseModifiers(modifier, press);
186
    }
187
    
150
    
188
    /**
151
    /**
189
     * @return The event thread queuer.
152
     * @return The event thread queuer.
(-)a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/swing/uiadapter/AbstractComponentAdapter.java (+28 lines)
Added Link Here
1
package org.eclipse.jubula.rc.swing.swing.uiadapter;
2
3
import org.eclipse.jubula.rc.common.driver.IRobotFactory;
4
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IComponentAdapter;
5
import org.eclipse.jubula.rc.swing.driver.RobotFactoryConfig;
6
/**
7
 * 
8
 * @author BREDEX GmbH
9
 *
10
 */
11
public abstract class AbstractComponentAdapter implements IComponentAdapter {
12
13
    /** the RobotFactory from the AUT */
14
    private IRobotFactory m_robotFactory;
15
    
16
    /**
17
     * Gets the Robot factory. The factory is created once per instance.
18
     *
19
     * @return The Robot factory.
20
     */
21
    public IRobotFactory getRobotFactory() {
22
        if (m_robotFactory == null) {
23
            m_robotFactory = new RobotFactoryConfig().getRobotFactory();
24
        }
25
        return m_robotFactory;
26
    }
27
28
}
(-)a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/swing/uiadapter/JListAdapter.java (+233 lines)
Added Link Here
1
package org.eclipse.jubula.rc.swing.swing.uiadapter;
2
3
import java.awt.Component;
4
import java.awt.Dimension;
5
import java.awt.Rectangle;
6
import java.util.HashSet;
7
import java.util.Set;
8
9
import javax.swing.JList;
10
import javax.swing.ListCellRenderer;
11
import javax.swing.ListModel;
12
13
import org.eclipse.jubula.rc.common.CompSystemConstants;
14
import org.eclipse.jubula.rc.common.driver.ClickOptions;
15
import org.eclipse.jubula.rc.common.driver.IRunnable;
16
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
17
import org.eclipse.jubula.rc.common.implclasses.MatchUtil;
18
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IListAdapter;
19
import org.eclipse.jubula.rc.swing.swing.caps.CapUtil;
20
import org.eclipse.jubula.rc.swing.swing.implclasses.JComboBoxImplClass;
21
import org.eclipse.jubula.tools.objects.event.EventFactory;
22
import org.eclipse.jubula.tools.objects.event.TestErrorEvent;
23
/**
24
 * 
25
 * @author marvin
26
 *
27
 */
28
public class JListAdapter extends WidgetAdapter implements IListAdapter {
29
    /** */
30
    private JList m_list;
31
    
32
    /**
33
     * 
34
     * @param objectToAdapt 
35
     */
36
    public JListAdapter(Object objectToAdapt) {
37
        super(objectToAdapt);
38
        m_list = (JList) objectToAdapt;
39
    }
40
    
41
    /**
42
     * {@inheritDoc}
43
     */
44
    public String getText() {
45
        String[] selected = getSelectedValues();
46
        if (selected.length > 0) {
47
            return selected[0];
48
        }
49
        throw new StepExecutionException("No list item selected", //$NON-NLS-1$
50
            EventFactory.createActionError(TestErrorEvent.NO_SELECTION));
51
    }
52
53
    /**
54
     * {@inheritDoc}
55
     */
56
    public int[] getSelectedIndices() {
57
        return (int[])getEventThreadQueuer().invokeAndWait(
58
            "getSelectedIndices", new IRunnable() { //$NON-NLS-1$
59
                public Object run() {
60
                    return m_list.getSelectedIndices();
61
                }
62
            });
63
    }
64
65
    /**
66
     * Clicks on the index of the passed list.
67
     *
68
     * @param i The index to click
69
     * @param co the click options to use
70
     * @param maxWidth the maximal width which is used to select the item
71
     */
72
    public void clickOnIndex(final Integer i,
73
            ClickOptions co, double maxWidth) {
74
        final int index = i.intValue();
75
        ListModel model = m_list.getModel();
76
        if ((model == null) || (index >= model.getSize())
77
            || (index < 0)) {
78
            throw new StepExecutionException("List index '" + i //$NON-NLS-1$
79
                + "' is out of range", //$NON-NLS-1$
80
                EventFactory.createActionError(TestErrorEvent.INVALID_INDEX));
81
        }
82
        // Call of JList.ensureIndexIsVisible() is not required,
83
        // because the Robot scrolls the click rectangle to visible.
84
        Rectangle r = (Rectangle) getRobotFactory().getEventThreadQueuer()
85
                .invokeAndWait("getCellBounds", new IRunnable() { //$NON-NLS-1$
86
87
                    public Object run() throws StepExecutionException {
88
                        return m_list.getCellBounds(index, index);
89
                    }
90
                });        
91
        
92
        if (r == null) {
93
            throw new StepExecutionException(
94
                "List index '" + i + "' is not visible", //$NON-NLS-1$ //$NON-NLS-2$
95
                EventFactory.createActionError(TestErrorEvent.NOT_VISIBLE));
96
        }
97
        
98
        // if possible adjust height and width for items
99
        ListCellRenderer lcr = m_list.getCellRenderer();
100
        if (lcr != null) {
101
            Component listItem = lcr.getListCellRendererComponent(m_list, model
102
                    .getElementAt(index), index, false, false);
103
            Dimension preferredSize = listItem.getPreferredSize();
104
            r.setSize(preferredSize);
105
        }
106
        
107
        if (maxWidth != JComboBoxImplClass.NO_MAX_WIDTH
108
                && r.getWidth() > maxWidth) {
109
            Dimension d = new Dimension();
110
            d.setSize(maxWidth, r.getHeight());
111
            r.setSize(d);
112
        }
113
114
        getRobot().click(m_list, r,
115
                co.setClickType(ClickOptions.ClickType.RELEASED));
116
    }
117
118
    /**
119
     * {@inheritDoc}
120
     */
121
    public String[] getSelectedValues() {
122
        final int[] indices = getSelectedIndices();
123
124
        return (String[])getEventThreadQueuer().invokeAndWait(
125
            "getSelectedValues", new IRunnable() { //$NON-NLS-1$
126
                public Object run() {
127
                    Object[] values = m_list.getSelectedValues();
128
                    String[] selected = new String[values.length];
129
                    ListCellRenderer renderer = m_list.getCellRenderer();
130
                    for (int i = 0; i < values.length; i++) {
131
                        Object value = values[i];
132
                        Component c = renderer.getListCellRendererComponent(
133
                            m_list, value, indices[i], true, false);
134
                        selected[i] = CapUtil.getRenderedText(c);
135
                    }
136
                    return selected;
137
                }
138
            });
139
    }
140
    /**
141
     * {@inheritDoc}
142
     */
143
    public Integer[] findIndicesOfValues(
144
            final String[] values, final String  operator,
145
            final String searchType) {
146
147
        final Set indexSet = new HashSet();
148
        getEventThreadQueuer().invokeAndWait("findIndices", //$NON-NLS-1$
149
            new IRunnable() {
150
                public Object run() {
151
                    ListCellRenderer renderer = m_list.getCellRenderer();
152
                    ListModel model = m_list.getModel();
153
                    for (int i = getStartingIndex(searchType);
154
                            i < model.getSize(); ++i) {
155
                        Object obj = model.getElementAt(i);
156
                        m_list.ensureIndexIsVisible(i);
157
                        Component comp = renderer
158
                                .getListCellRendererComponent(
159
                            m_list, obj, i, false, false);
160
                        String str = CapUtil.getRenderedText(comp);
161
                        if (MatchUtil.getInstance().
162
                            match(str, values, operator)) {
163
                            indexSet.add(new Integer(i));
164
                        }
165
                    }
166
                    return null; // return value is not used
167
                }
168
            });
169
170
        Integer[] indices = new Integer[indexSet.size()];
171
        indexSet.toArray(indices);
172
        return indices;
173
    }
174
    
175
    /**
176
     * Finds the indices of the list elements that are rendered with the passed
177
     * values.
178
     *
179
     * @param values The values
180
     * @param operator operator to use
181
     * @return The array of indices. It's length is equal to the length of the
182
     *         values array, but may contains <code>null</code> elements for
183
     *         all values that are not found in the list
184
     */
185
    public Integer[] findIndicesOfValues(
186
        final String[] values, final String  operator) {
187
188
        return findIndicesOfValues(values, operator, 
189
                CompSystemConstants.SEARCH_TYPE_ABSOLUTE);
190
    }
191
    
192
    /**
193
     * {@inheritDoc}
194
     */
195
    public boolean containsValue(String value, String operator) {
196
        Integer[] indices = null;
197
        if (operator.equals(MatchUtil.NOT_EQUALS)) {
198
            indices = findIndicesOfValues(new String[] { value },
199
                MatchUtil.EQUALS);
200
            return indices.length == 0;
201
        }
202
        indices = findIndicesOfValues(new String[] { value },
203
            operator);
204
        return indices.length > 0;
205
    }
206
    
207
    /**
208
     * Clicks on the index of the passed list.
209
     *
210
     * @param i
211
     *            The index to click
212
     * @param co the click options to use
213
     */
214
    public void clickOnIndex(final Integer i, ClickOptions co) {
215
        clickOnIndex(i, co, JComboBoxImplClass.NO_MAX_WIDTH);
216
    }
217
218
    /**
219
     * @param searchType Determines where the search begins ("relative" or "absolute")
220
     * @return The index from which to begin a search, based on the search type
221
     *         and (if appropriate) the currently selected cell.
222
     */
223
    private int getStartingIndex(final String searchType) {
224
        int startingIndex = 0;
225
        if (searchType.equalsIgnoreCase(
226
                CompSystemConstants.SEARCH_TYPE_RELATIVE)) {
227
            int [] selectedIndices = getSelectedIndices();
228
            // Start from the last selected item
229
            startingIndex = selectedIndices[selectedIndices.length - 1] + 1;
230
        }
231
        return startingIndex;
232
    }
233
}
(-)a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/swing/uiadapter/JMenuAdapter.java (-1 / +2 lines)
Lines 28-34 import org.eclipse.jubula.rc.common.uiadapter.interfaces.IMenuItemAdapter; Link Here
28
 * @author BREDEX GmbH
28
 * @author BREDEX GmbH
29
 *
29
 *
30
 */
30
 */
31
public class JMenuAdapter implements IMenuAdapter {
31
public class JMenuAdapter extends AbstractComponentAdapter
32
    implements IMenuAdapter {
32
    /** The JMenu from the AUT */
33
    /** The JMenu from the AUT */
33
    private JMenu m_menu;
34
    private JMenu m_menu;
34
    
35
    
(-)a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/swing/uiadapter/JMenuBarAdapter.java (-1 / +2 lines)
Lines 28-34 import org.eclipse.jubula.rc.common.uiadapter.interfaces.IMenuItemAdapter; Link Here
28
 * @author BREDEX GmbH
28
 * @author BREDEX GmbH
29
 *
29
 *
30
 */
30
 */
31
public class JMenuBarAdapter implements IMenuAdapter {
31
public class JMenuBarAdapter extends AbstractComponentAdapter
32
    implements IMenuAdapter {
32
    /** The JMenuBar */
33
    /** The JMenuBar */
33
    private JMenuBar m_menuBar;
34
    private JMenuBar m_menuBar;
34
    
35
    
(-)a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/swing/uiadapter/JMenuItemAdapter.java (-17 / +2 lines)
Lines 16-29 import javax.swing.JMenuItem; Link Here
16
import org.eclipse.jubula.rc.common.driver.ClickOptions;
16
import org.eclipse.jubula.rc.common.driver.ClickOptions;
17
import org.eclipse.jubula.rc.common.driver.IEventThreadQueuer;
17
import org.eclipse.jubula.rc.common.driver.IEventThreadQueuer;
18
import org.eclipse.jubula.rc.common.driver.IRobot;
18
import org.eclipse.jubula.rc.common.driver.IRobot;
19
import org.eclipse.jubula.rc.common.driver.IRobotFactory;
20
import org.eclipse.jubula.rc.common.driver.IRunnable;
19
import org.eclipse.jubula.rc.common.driver.IRunnable;
21
import org.eclipse.jubula.rc.common.driver.RobotTiming;
20
import org.eclipse.jubula.rc.common.driver.RobotTiming;
22
import org.eclipse.jubula.rc.common.exception.RobotException;
21
import org.eclipse.jubula.rc.common.exception.RobotException;
23
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
22
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
24
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IMenuAdapter;
23
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IMenuAdapter;
25
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IMenuItemAdapter;
24
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IMenuItemAdapter;
26
import org.eclipse.jubula.rc.swing.driver.RobotFactoryConfig;
27
import org.eclipse.jubula.tools.objects.event.EventFactory;
25
import org.eclipse.jubula.tools.objects.event.EventFactory;
28
import org.eclipse.jubula.tools.objects.event.TestErrorEvent;
26
import org.eclipse.jubula.tools.objects.event.TestErrorEvent;
29
27
Lines 32-46 import org.eclipse.jubula.tools.objects.event.TestErrorEvent; Link Here
32
 * @author BREDEX GmbH
30
 * @author BREDEX GmbH
33
 * 
31
 * 
34
 */
32
 */
35
public class JMenuItemAdapter 
33
public class JMenuItemAdapter extends AbstractComponentAdapter
36
    implements IMenuItemAdapter {
34
    implements IMenuItemAdapter {
37
35
38
    /** the JMenuItem from the AUT    */
36
    /** the JMenuItem from the AUT    */
39
    private JMenuItem m_menuItem;
37
    private JMenuItem m_menuItem;
40
38
41
    /** the RobotFactory from the AUT */
42
    private IRobotFactory m_robotFactory;
43
  
44
    /**
39
    /**
45
     * 
40
     * 
46
     * @param objectToAdapt 
41
     * @param objectToAdapt 
Lines 48-64 public class JMenuItemAdapter Link Here
48
    public JMenuItemAdapter(Object objectToAdapt) {
43
    public JMenuItemAdapter(Object objectToAdapt) {
49
        m_menuItem = (JMenuItem) objectToAdapt;        
44
        m_menuItem = (JMenuItem) objectToAdapt;        
50
    }
45
    }
51
    /**
46
52
     * Gets the Robot factory. The factory is created once per instance.
53
     *
54
     * @return The Robot factory.
55
     */
56
    protected IRobotFactory getRobotFactory() {
57
        if (m_robotFactory == null) {
58
            m_robotFactory = new RobotFactoryConfig().getRobotFactory();
59
        }
60
        return m_robotFactory;
61
    }
62
    /**
47
    /**
63
     * Gets the IEventThreadQueuer.
48
     * Gets the IEventThreadQueuer.
64
     *
49
     *
(-)a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/swing/uiadapter/JPopupMenuAdapter.java (-1 / +2 lines)
Lines 27-33 import org.eclipse.jubula.rc.common.uiadapter.interfaces.IMenuItemAdapter; Link Here
27
 * @author BREDEX GmbH
27
 * @author BREDEX GmbH
28
 *
28
 *
29
 */
29
 */
30
public class JPopupMenuAdapter implements IMenuAdapter {
30
public class JPopupMenuAdapter extends AbstractComponentAdapter
31
    implements IMenuAdapter {
31
    /** */
32
    /** */
32
    private JPopupMenu m_contextMenu;
33
    private JPopupMenu m_contextMenu;
33
    
34
    
(-)a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/swing/uiadapter/JTableAdapter.java (+8 lines)
Lines 374-377 public class JTableAdapter extends WidgetAdapter implements ITableAdapter { Link Here
374
        getRobot().scrollToVisible(m_table, bounds);
374
        getRobot().scrollToVisible(m_table, bounds);
375
        return bounds;
375
        return bounds;
376
    }
376
    }
377
378
    /**
379
     * {@inheritDoc}
380
     */
381
    public String getText() {
382
        final Cell selectedCell = getSelectedCell();
383
        return getCellText(selectedCell.getRow(), selectedCell.getCol());
384
    }
377
}
385
}
(-)a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/swing/uiadapter/WidgetAdapter.java (-16 / +11 lines)
Lines 21-37 import org.eclipse.jubula.rc.common.driver.ClickOptions; Link Here
21
import org.eclipse.jubula.rc.common.driver.DragAndDropHelper;
21
import org.eclipse.jubula.rc.common.driver.DragAndDropHelper;
22
import org.eclipse.jubula.rc.common.driver.IEventThreadQueuer;
22
import org.eclipse.jubula.rc.common.driver.IEventThreadQueuer;
23
import org.eclipse.jubula.rc.common.driver.IRobot;
23
import org.eclipse.jubula.rc.common.driver.IRobot;
24
import org.eclipse.jubula.rc.common.driver.IRobotFactory;
25
import org.eclipse.jubula.rc.common.driver.IRunnable;
24
import org.eclipse.jubula.rc.common.driver.IRunnable;
26
import org.eclipse.jubula.rc.common.driver.RobotTiming;
25
import org.eclipse.jubula.rc.common.driver.RobotTiming;
27
import org.eclipse.jubula.rc.common.exception.RobotException;
26
import org.eclipse.jubula.rc.common.exception.RobotException;
28
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
27
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
29
import org.eclipse.jubula.rc.common.listener.EventLock;
28
import org.eclipse.jubula.rc.common.listener.EventLock;
30
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IWidgetAdapter;
29
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IWidgetAdapter;
31
import org.eclipse.jubula.rc.swing.driver.RobotFactoryConfig;
32
import org.eclipse.jubula.rc.swing.swing.caps.CapUtil;
30
import org.eclipse.jubula.rc.swing.swing.caps.CapUtil;
33
import org.eclipse.jubula.rc.swing.swing.caps.JMenuBarCAPs;
31
import org.eclipse.jubula.rc.swing.swing.caps.JMenuBarCAPs;
34
import org.eclipse.jubula.rc.swing.swing.caps.CapUtil.PopupShownCondition;
32
import org.eclipse.jubula.rc.swing.swing.caps.CapUtil.PopupShownCondition;
33
import org.eclipse.jubula.rc.swing.swing.driver.KeyCodeConverter;
35
import org.eclipse.jubula.rc.swing.swing.implclasses.EventListener;
34
import org.eclipse.jubula.rc.swing.swing.implclasses.EventListener;
36
import org.eclipse.jubula.tools.constants.TimeoutConstants;
35
import org.eclipse.jubula.tools.constants.TimeoutConstants;
37
import org.eclipse.jubula.tools.i18n.I18n;
36
import org.eclipse.jubula.tools.i18n.I18n;
Lines 45-59 import org.eclipse.jubula.tools.utils.TimeUtil; Link Here
45
 * 
44
 * 
46
 * @author BREDEX GmbH 
45
 * @author BREDEX GmbH 
47
 */
46
 */
48
public abstract class WidgetAdapter implements IWidgetAdapter {
47
public abstract class WidgetAdapter extends AbstractComponentAdapter
48
    implements IWidgetAdapter {
49
      
49
      
50
    /** constants for communication */
50
    /** constants for communication */
51
    protected static final String POS_UNIT_PIXEL = "Pixel"; //$NON-NLS-1$
51
    protected static final String POS_UNIT_PIXEL = "Pixel"; //$NON-NLS-1$
52
    /** constants for communication */
52
    /** constants for communication */
53
    protected static final String POS_UNI_PERCENT = "Percent"; //$NON-NLS-1$
53
    protected static final String POS_UNI_PERCENT = "Percent"; //$NON-NLS-1$
54
    
54
    
55
    /** the RobotFactory from the AUT */
55
56
    private IRobotFactory m_robotFactory;
57
    
56
    
58
57
59
     
58
     
Lines 76-92 public abstract class WidgetAdapter implements IWidgetAdapter { Link Here
76
    }
75
    }
77
    
76
    
78
    /**
77
    /**
79
     * Gets the Robot factory. The factory is created once per instance.
80
     *
81
     * @return The Robot factory.
82
     */
83
    protected IRobotFactory getRobotFactory() {
84
        if (m_robotFactory == null) {
85
            m_robotFactory = new RobotFactoryConfig().getRobotFactory();
86
        }
87
        return m_robotFactory;
88
    }
89
    /**
90
     * Gets the IEventThreadQueuer.
78
     * Gets the IEventThreadQueuer.
91
     *
79
     *
92
     * @return The Robot
80
     * @return The Robot
Lines 331-334 public abstract class WidgetAdapter implements IWidgetAdapter { Link Here
331
                xPos, xUnits.equalsIgnoreCase(POS_UNIT_PIXEL),
319
                xPos, xUnits.equalsIgnoreCase(POS_UNIT_PIXEL),
332
                yPos, yUnits.equalsIgnoreCase(POS_UNIT_PIXEL));
320
                yPos, yUnits.equalsIgnoreCase(POS_UNIT_PIXEL));
333
    }
321
    }
322
    
323
    /**
324
     * {@inheritDoc}
325
     */
326
    public int getKeyCode(String mod) {
327
        return KeyCodeConverter.getKeyCode(mod);
328
    }
334
}
329
}
(-)a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/swing/uiadapter/factory/SwingAdapterFactory.java (-1 / +7 lines)
Lines 13-18 package org.eclipse.jubula.rc.swing.swing.uiadapter.factory; Link Here
13
13
14
import javax.swing.JButton;
14
import javax.swing.JButton;
15
import javax.swing.JCheckBox;
15
import javax.swing.JCheckBox;
16
import javax.swing.JList;
16
import javax.swing.JMenuBar;
17
import javax.swing.JMenuBar;
17
import javax.swing.JMenuItem;
18
import javax.swing.JMenuItem;
18
import javax.swing.JPopupMenu;
19
import javax.swing.JPopupMenu;
Lines 23-28 import javax.swing.JTree; Link Here
23
import org.eclipse.jubula.rc.common.uiadapter.factory.IUIAdapterFactory;
24
import org.eclipse.jubula.rc.common.uiadapter.factory.IUIAdapterFactory;
24
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IComponentAdapter;
25
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IComponentAdapter;
25
import org.eclipse.jubula.rc.swing.swing.uiadapter.AbstractButtonAdapter;
26
import org.eclipse.jubula.rc.swing.swing.uiadapter.AbstractButtonAdapter;
27
import org.eclipse.jubula.rc.swing.swing.uiadapter.JListAdapter;
26
import org.eclipse.jubula.rc.swing.swing.uiadapter.JMenuBarAdapter;
28
import org.eclipse.jubula.rc.swing.swing.uiadapter.JMenuBarAdapter;
27
import org.eclipse.jubula.rc.swing.swing.uiadapter.JMenuItemAdapter;
29
import org.eclipse.jubula.rc.swing.swing.uiadapter.JMenuItemAdapter;
28
import org.eclipse.jubula.rc.swing.swing.uiadapter.JPopupMenuAdapter;
30
import org.eclipse.jubula.rc.swing.swing.uiadapter.JPopupMenuAdapter;
Lines 45-51 public class SwingAdapterFactory implements IUIAdapterFactory { Link Here
45
    private static final Class[] SUPPORTEDCLASSES = new Class[] { 
47
    private static final Class[] SUPPORTEDCLASSES = new Class[] { 
46
        JButton.class, JCheckBox.class, JRadioButton.class,
48
        JButton.class, JCheckBox.class, JRadioButton.class,
47
        JMenuBar.class, JMenuItem.class, JTree.class , 
49
        JMenuBar.class, JMenuItem.class, JTree.class , 
48
        JCheckBox.class, JRadioButton.class, JTable.class, JPopupMenu.class};
50
        JCheckBox.class, JRadioButton.class, JTable.class, JPopupMenu.class,
51
        JList.class};
49
    
52
    
50
    /**
53
    /**
51
     * {@inheritDoc}
54
     * {@inheritDoc}
Lines 81-86 public class SwingAdapterFactory implements IUIAdapterFactory { Link Here
81
        } else if (objectToAdapt instanceof JTable) {
84
        } else if (objectToAdapt instanceof JTable) {
82
            returnvalue = new JTableAdapter(objectToAdapt);
85
            returnvalue = new JTableAdapter(objectToAdapt);
83
            
86
            
87
        } else if (objectToAdapt instanceof JList) {
88
            returnvalue = new JListAdapter(objectToAdapt);
89
            
84
        } else if (objectToAdapt instanceof JPopupMenu) {
90
        } else if (objectToAdapt instanceof JPopupMenu) {
85
            returnvalue = new JPopupMenuAdapter(objectToAdapt);
91
            returnvalue = new JPopupMenuAdapter(objectToAdapt);
86
        
92
        
(-)a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/caps/ButtonCAPs.java (-18 / +1 lines)
Lines 12-20 package org.eclipse.jubula.rc.swt.caps; Link Here
12
12
13
13
14
import org.eclipse.jubula.rc.common.caps.AbstractButtonCAPs;
14
import org.eclipse.jubula.rc.common.caps.AbstractButtonCAPs;
15
import org.eclipse.jubula.rc.common.driver.IRobotFactory;
16
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IButtonAdapter;
15
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IButtonAdapter;
17
import org.eclipse.jubula.rc.swt.driver.RobotFactoryConfig;
18
import org.eclipse.jubula.rc.swt.utils.SwtUtils;
16
import org.eclipse.jubula.rc.swt.utils.SwtUtils;
19
17
20
18
Lines 24-33 import org.eclipse.jubula.rc.swt.utils.SwtUtils; Link Here
24
 * @author BREDEX GmbH
22
 * @author BREDEX GmbH
25
 */
23
 */
26
public class ButtonCAPs extends AbstractButtonCAPs {
24
public class ButtonCAPs extends AbstractButtonCAPs {
27
    
25
28
    /** The robot factory. */
29
    private IRobotFactory m_robotFactory;
30
    
31
    /**
26
    /**
32
     * {@inheritDoc}
27
     * {@inheritDoc}
33
     */
28
     */
Lines 37-52 public class ButtonCAPs extends AbstractButtonCAPs { Link Here
37
                        ((IButtonAdapter)getComponent()).getText())};
32
                        ((IButtonAdapter)getComponent()).getText())};
38
    }
33
    }
39
    
34
    
40
    /**
41
     * Gets the Robot factory. The factory is created once per instance.
42
     * @return The Robot factory.
43
     */
44
    protected IRobotFactory getRobotFactory() {
45
        if (m_robotFactory == null) {
46
            m_robotFactory = new RobotFactoryConfig().getRobotFactory();
47
        }
48
        return m_robotFactory;
49
    }
50
51
52
}
35
}
(-)a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/caps/CAPUtil.java (-12 lines)
Lines 20-26 import org.eclipse.jubula.rc.common.util.KeyStrokeUtil; Link Here
20
import org.eclipse.jubula.rc.swt.driver.KeyCodeConverter;
20
import org.eclipse.jubula.rc.swt.driver.KeyCodeConverter;
21
import org.eclipse.jubula.rc.swt.driver.SwtRobot;
21
import org.eclipse.jubula.rc.swt.driver.SwtRobot;
22
import org.eclipse.jubula.tools.utils.EnvironmentUtils;
22
import org.eclipse.jubula.tools.utils.EnvironmentUtils;
23
import org.eclipse.jubula.tools.utils.TimeUtil;
24
import org.eclipse.swt.widgets.Display;
23
import org.eclipse.swt.widgets.Display;
25
/**
24
/**
26
 * Util class for some swt specific commands.
25
 * Util class for some swt specific commands.
Lines 46-62 public class CAPUtil { Link Here
46
    }
45
    }
47
    
46
    
48
    /**
47
    /**
49
     * Waits the given amount of time. Logs a drop-related error if interrupted.
50
     * 
51
     * @param delayBeforeDrop the amount of time (in milliseconds) to wait
52
     *                        between moving the mouse to the drop point and
53
     *                        releasing the mouse button                       
54
     */
55
    public static void waitBeforeDrop(int delayBeforeDrop) {
56
        TimeUtil.delay(delayBeforeDrop);
57
    }
58
    
59
    /**
60
     * Move the mouse pointer from its current position to a few points in
48
     * Move the mouse pointer from its current position to a few points in
61
     * its proximity. This is used to initiate a drag operation.
49
     * its proximity. This is used to initiate a drag operation.
62
     * 
50
     * 
(-)a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/caps/ListCAPs.java (+20 lines)
Added Link Here
1
package org.eclipse.jubula.rc.swt.caps;
2
3
import org.eclipse.jubula.rc.common.caps.AbstractListCAPs;
4
import org.eclipse.jubula.rc.swt.utils.SwtUtils;
5
/**
6
 * 
7
 * @author BREDEX GmbH
8
 *
9
 */
10
public class ListCAPs extends AbstractListCAPs {
11
12
13
    /**
14
     * {@inheritDoc}
15
     */
16
    protected int getSystemDefaultModifier() {
17
        return SwtUtils.getSystemDefaultModifier();
18
    }
19
20
}
(-)a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/caps/MenuCAPs.java (-25 / +2 lines)
Lines 13-22 package org.eclipse.jubula.rc.swt.caps; Link Here
13
import org.apache.commons.lang.Validate;
13
import org.apache.commons.lang.Validate;
14
import org.eclipse.jubula.rc.common.caps.AbstractMenuCAPs;
14
import org.eclipse.jubula.rc.common.caps.AbstractMenuCAPs;
15
import org.eclipse.jubula.rc.common.driver.IEventThreadQueuer;
15
import org.eclipse.jubula.rc.common.driver.IEventThreadQueuer;
16
import org.eclipse.jubula.rc.common.driver.IRobot;
17
import org.eclipse.jubula.rc.common.driver.IRobotFactory;
18
import org.eclipse.jubula.rc.common.driver.IRunnable;
16
import org.eclipse.jubula.rc.common.driver.IRunnable;
19
import org.eclipse.jubula.rc.common.exception.RobotException;
20
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
17
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
21
import org.eclipse.jubula.rc.common.implclasses.IBaseImplementationClass;
18
import org.eclipse.jubula.rc.common.implclasses.IBaseImplementationClass;
22
import org.eclipse.jubula.rc.common.implclasses.MenuUtilBase;
19
import org.eclipse.jubula.rc.common.implclasses.MenuUtilBase;
Lines 24-30 import org.eclipse.jubula.rc.common.uiadapter.interfaces.IComponentAdapter; Link Here
24
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IMenuAdapter;
21
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IMenuAdapter;
25
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IMenuItemAdapter;
22
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IMenuItemAdapter;
26
import org.eclipse.jubula.rc.swt.driver.EventThreadQueuerSwtImpl;
23
import org.eclipse.jubula.rc.swt.driver.EventThreadQueuerSwtImpl;
27
import org.eclipse.jubula.rc.swt.driver.RobotFactoryConfig;
28
import org.eclipse.jubula.rc.swt.driver.RobotSwtImpl;
24
import org.eclipse.jubula.rc.swt.driver.RobotSwtImpl;
29
import org.eclipse.jubula.rc.swt.uiadapter.MenuItemAdapter;
25
import org.eclipse.jubula.rc.swt.uiadapter.MenuItemAdapter;
30
import org.eclipse.jubula.tools.i18n.I18n;
26
import org.eclipse.jubula.tools.i18n.I18n;
Lines 43-63 import org.eclipse.swt.widgets.Shell; Link Here
43
 */
39
 */
44
public class MenuCAPs extends AbstractMenuCAPs 
40
public class MenuCAPs extends AbstractMenuCAPs 
45
    implements IBaseImplementationClass {
41
    implements IBaseImplementationClass {
46
    /** the RobotFactory from the AUT */
42
47
    private IRobotFactory m_robotFactory;
48
    
43
    
49
    /** Test variable for contextMenus*/
44
    /** Test variable for contextMenus*/
50
    private boolean m_isCM = false;
45
    private boolean m_isCM = false;
51
    /**
46
52
     * Gets the IEventThreadQueuer.
53
     * 
54
     * @return The Robot
55
     * @throws RobotException
56
     *             If the Robot cannot be created.
57
     */
58
    protected IRobot getRobot() throws RobotException {
59
        return getRobotFactory().getRobot();
60
    }
61
47
62
    /**
48
    /**
63
     * @return The event thread queuer.
49
     * @return The event thread queuer.
Lines 97-111 public class MenuCAPs extends AbstractMenuCAPs Link Here
97
    public String[] getTextArrayFromComponent() {
83
    public String[] getTextArrayFromComponent() {
98
        return null;
84
        return null;
99
    }
85
    }
100
    /**
101
     * {@inheritDoc}
102
     */
103
    protected IRobotFactory getRobotFactory() {
104
        if (m_robotFactory == null) {
105
            m_robotFactory = new RobotFactoryConfig().getRobotFactory();
106
        }
107
        return m_robotFactory;
108
    }
109
    
86
    
110
    /**
87
    /**
111
     * Tries to select a menu item in a menu defined by a Text-Path
88
     * Tries to select a menu item in a menu defined by a Text-Path
(-)a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/caps/TableCAPs.java (-26 / +3 lines)
Lines 18-31 import org.eclipse.jubula.rc.common.caps.AbstractTableCAPs; Link Here
18
import org.eclipse.jubula.rc.common.driver.ClickOptions;
18
import org.eclipse.jubula.rc.common.driver.ClickOptions;
19
import org.eclipse.jubula.rc.common.driver.IEventThreadQueuer;
19
import org.eclipse.jubula.rc.common.driver.IEventThreadQueuer;
20
import org.eclipse.jubula.rc.common.driver.IRobot;
20
import org.eclipse.jubula.rc.common.driver.IRobot;
21
import org.eclipse.jubula.rc.common.driver.IRobotFactory;
22
import org.eclipse.jubula.rc.common.driver.IRunnable;
21
import org.eclipse.jubula.rc.common.driver.IRunnable;
23
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
22
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
24
import org.eclipse.jubula.rc.common.implclasses.table.Cell;
23
import org.eclipse.jubula.rc.common.implclasses.table.Cell;
25
import org.eclipse.jubula.rc.common.uiadapter.interfaces.ITableAdapter;
24
import org.eclipse.jubula.rc.common.uiadapter.interfaces.ITableAdapter;
26
import org.eclipse.jubula.rc.swt.driver.DragAndDropHelperSwt;
25
import org.eclipse.jubula.rc.swt.driver.DragAndDropHelperSwt;
27
import org.eclipse.jubula.rc.swt.driver.KeyCodeConverter;
28
import org.eclipse.jubula.rc.swt.driver.RobotFactoryConfig;
29
import org.eclipse.jubula.rc.swt.uiadapter.TableAdapter;
26
import org.eclipse.jubula.rc.swt.uiadapter.TableAdapter;
30
import org.eclipse.jubula.rc.swt.utils.SwtUtils;
27
import org.eclipse.jubula.rc.swt.utils.SwtUtils;
31
import org.eclipse.jubula.tools.constants.InputConstants;
28
import org.eclipse.jubula.tools.constants.InputConstants;
Lines 48-55 import org.eclipse.swt.widgets.Widget; Link Here
48
 */
45
 */
49
public class TableCAPs extends AbstractTableCAPs {
46
public class TableCAPs extends AbstractTableCAPs {
50
    
47
    
51
    /**  */
52
    private IRobotFactory m_robotFactory;
53
48
54
    /**
49
    /**
55
     *  Gets the real table component
50
     *  Gets the real table component
Lines 75-87 public class TableCAPs extends AbstractTableCAPs { Link Here
75
        componentTextArray = getTextArrayFromItemArray(itemArray);         
70
        componentTextArray = getTextArrayFromItemArray(itemArray);         
76
        return componentTextArray;
71
        return componentTextArray;
77
    }
72
    }
78
79
    /**
80
     * {@inheritDoc}
81
     */
82
    protected int getKeyCode(String mod) {
83
        return KeyCodeConverter.getKeyCode(mod);
84
    }
85
    
73
    
86
    /**
74
    /**
87
     * {@inheritDoc}
75
     * {@inheritDoc}
Lines 287-303 public class TableCAPs extends AbstractTableCAPs { Link Here
287
        
275
        
288
        return isOnHeader.booleanValue();
276
        return isOnHeader.booleanValue();
289
    }
277
    }
290
291
    /**
292
     * {@inheritDoc}
293
     */
294
    protected IRobotFactory getRobotFactory() {
295
        if (m_robotFactory == null) {
296
            m_robotFactory = new RobotFactoryConfig().getRobotFactory();
297
        }
298
        return m_robotFactory;
299
    }
300
301
    
278
    
302
    /**
279
    /**
303
     * Returns an array of representation strings that corresponds to the given
280
     * Returns an array of representation strings that corresponds to the given
Lines 573-579 public class TableCAPs extends AbstractTableCAPs { Link Here
573
                }            
550
                }            
574
            });
551
            });
575
552
576
            CAPUtil.waitBeforeDrop(delayBeforeDrop);
553
            waitBeforeDrop(delayBeforeDrop);
577
            
554
            
578
        } finally {
555
        } finally {
579
            robot.mouseRelease(dndHelper.getDragComponent(), null, 
556
            robot.mouseRelease(dndHelper.getDragComponent(), null, 
Lines 650-656 public class TableCAPs extends AbstractTableCAPs { Link Here
650
                }            
627
                }            
651
            });
628
            });
652
            
629
            
653
            CAPUtil.waitBeforeDrop(delayBeforeDrop);
630
            waitBeforeDrop(delayBeforeDrop);
654
            
631
            
655
        } finally {
632
        } finally {
656
            robot.mouseRelease(dndHelper.getDragComponent(), null, 
633
            robot.mouseRelease(dndHelper.getDragComponent(), null, 
Lines 726-732 public class TableCAPs extends AbstractTableCAPs { Link Here
726
                }            
703
                }            
727
            });
704
            });
728
705
729
            CAPUtil.waitBeforeDrop(delayBeforeDrop);
706
            waitBeforeDrop(delayBeforeDrop);
730
        
707
        
731
        } finally {
708
        } finally {
732
            robot.mouseRelease(dndHelper.getDragComponent(), null, 
709
            robot.mouseRelease(dndHelper.getDragComponent(), null, 
(-)a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/caps/TreeCAPs.java (-29 / +3 lines)
Lines 13-27 package org.eclipse.jubula.rc.swt.caps; Link Here
13
import java.util.StringTokenizer;
13
import java.util.StringTokenizer;
14
14
15
import org.apache.commons.lang.Validate;
15
import org.apache.commons.lang.Validate;
16
import org.eclipse.jubula.rc.common.AUTServer;
17
import org.eclipse.jubula.rc.common.CompSystemConstants;
16
import org.eclipse.jubula.rc.common.CompSystemConstants;
18
import org.eclipse.jubula.rc.common.caps.AbstractTreeCAPs;
17
import org.eclipse.jubula.rc.common.caps.AbstractTreeCAPs;
19
import org.eclipse.jubula.rc.common.driver.ClickOptions;
18
import org.eclipse.jubula.rc.common.driver.ClickOptions;
20
import org.eclipse.jubula.rc.common.driver.IEventThreadQueuer;
19
import org.eclipse.jubula.rc.common.driver.IEventThreadQueuer;
21
import org.eclipse.jubula.rc.common.driver.IRobot;
20
import org.eclipse.jubula.rc.common.driver.IRobot;
22
import org.eclipse.jubula.rc.common.driver.IRobotFactory;
23
import org.eclipse.jubula.rc.common.driver.IRunnable;
21
import org.eclipse.jubula.rc.common.driver.IRunnable;
24
import org.eclipse.jubula.rc.common.exception.RobotException;
25
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
22
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
26
import org.eclipse.jubula.rc.common.implclasses.IndexConverter;
23
import org.eclipse.jubula.rc.common.implclasses.IndexConverter;
27
import org.eclipse.jubula.rc.common.implclasses.MatchUtil;
24
import org.eclipse.jubula.rc.common.implclasses.MatchUtil;
Lines 42-48 import org.eclipse.jubula.rc.common.implclasses.tree.TreeNodeOperationConstraint Link Here
42
import org.eclipse.jubula.rc.common.util.KeyStrokeUtil;
39
import org.eclipse.jubula.rc.common.util.KeyStrokeUtil;
43
import org.eclipse.jubula.rc.swt.driver.DragAndDropHelperSwt;
40
import org.eclipse.jubula.rc.swt.driver.DragAndDropHelperSwt;
44
import org.eclipse.jubula.rc.swt.driver.KeyCodeConverter;
41
import org.eclipse.jubula.rc.swt.driver.KeyCodeConverter;
45
import org.eclipse.jubula.rc.swt.driver.RobotFactoryConfig;
46
import org.eclipse.jubula.rc.swt.implclasses.TableTreeOperationContext;
42
import org.eclipse.jubula.rc.swt.implclasses.TableTreeOperationContext;
47
import org.eclipse.jubula.rc.swt.implclasses.TreeOperationContext;
43
import org.eclipse.jubula.rc.swt.implclasses.TreeOperationContext;
48
import org.eclipse.jubula.rc.swt.implclasses.tree.ToggleCheckboxOperation;
44
import org.eclipse.jubula.rc.swt.implclasses.tree.ToggleCheckboxOperation;
Lines 133-161 public class TreeCAPs extends AbstractTreeCAPs { Link Here
133
            return m_itemAtPoint;
129
            return m_itemAtPoint;
134
        }
130
        }
135
    }
131
    }
136
    
132
        
137
    /** The robot factory. */
138
    private IRobotFactory m_robotFactory;
139
    
140
    /**
141
     * Gets the Robot factory. The factory is created once per instance.
142
     * @return The Robot factory.
143
     */
144
    protected IRobotFactory getRobotFactory() {
145
        if (m_robotFactory == null) {
146
            m_robotFactory = new RobotFactoryConfig().getRobotFactory();
147
        }
148
        return m_robotFactory;
149
    }
150
    /**
151
     * Gets the Robot. 
152
     * @return The Robot
153
     * @throws RobotException If the Robot cannot be created.
154
     */
155
    protected IRobot getRobot() throws RobotException {
156
        return AUTServer.getInstance().getRobot();
157
    }
158
    
159
    /**
133
    /**
160
     * @return The event thread queuer.
134
     * @return The event thread queuer.
161
     */
135
     */
Lines 260-266 public class TreeCAPs extends AbstractTreeCAPs { Link Here
260
                    CompSystemConstants.EXTEND_SELECTION_NO);
234
                    CompSystemConstants.EXTEND_SELECTION_NO);
261
235
262
            SwtUtils.waitForDisplayIdle(getTree().getDisplay());
236
            SwtUtils.waitForDisplayIdle(getTree().getDisplay());
263
            CAPUtil.waitBeforeDrop(delayBeforeDrop);
237
            waitBeforeDrop(delayBeforeDrop);
264
            
238
            
265
        } finally {
239
        } finally {
266
            robot.mouseRelease(null, null, dndHelper.getMouseButton());
240
            robot.mouseRelease(null, null, dndHelper.getMouseButton());
Lines 331-337 public class TreeCAPs extends AbstractTreeCAPs { Link Here
331
                    CompSystemConstants.EXTEND_SELECTION_NO);
305
                    CompSystemConstants.EXTEND_SELECTION_NO);
332
306
333
            SwtUtils.waitForDisplayIdle(getTree().getDisplay());
307
            SwtUtils.waitForDisplayIdle(getTree().getDisplay());
334
            CAPUtil.waitBeforeDrop(delayBeforeDrop);
308
            waitBeforeDrop(delayBeforeDrop);
335
        } finally {
309
        } finally {
336
            robot.mouseRelease(null, null, dndHelper.getMouseButton());
310
            robot.mouseRelease(null, null, dndHelper.getMouseButton());
337
            pressOrReleaseModifiers(dndHelper.getModifier(),
311
            pressOrReleaseModifiers(dndHelper.getModifier(),
(-)a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/uiadapter/AbstractComponentAdapter.java (+29 lines)
Added Link Here
1
package org.eclipse.jubula.rc.swt.uiadapter;
2
3
import org.eclipse.jubula.rc.common.driver.IRobotFactory;
4
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IComponentAdapter;
5
import org.eclipse.jubula.rc.swt.driver.RobotFactoryConfig;
6
/**
7
 * 
8
 * @author BREDEX GmBH
9
 *
10
 */
11
public abstract class AbstractComponentAdapter implements IComponentAdapter {
12
13
    /** the RobotFactory from the AUT */
14
    private IRobotFactory m_robotFactory;
15
     
16
17
    /**
18
     * Gets the Robot factory. The factory is created once per instance.
19
     *
20
     * @return The Robot factory.
21
     */
22
    public IRobotFactory getRobotFactory() {
23
        if (m_robotFactory == null) {
24
            m_robotFactory = new RobotFactoryConfig().getRobotFactory();
25
        }
26
        return m_robotFactory;
27
    }
28
29
}
(-)a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/uiadapter/ListAdapter.java (+198 lines)
Added Link Here
1
package org.eclipse.jubula.rc.swt.uiadapter;
2
3
import java.util.ArrayList;
4
5
import org.eclipse.jubula.rc.common.CompSystemConstants;
6
import org.eclipse.jubula.rc.common.driver.ClickOptions;
7
import org.eclipse.jubula.rc.common.driver.IRunnable;
8
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
9
import org.eclipse.jubula.rc.common.implclasses.MatchUtil;
10
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IListAdapter;
11
import org.eclipse.jubula.rc.swt.utils.SwtUtils;
12
import org.eclipse.jubula.tools.objects.event.EventFactory;
13
import org.eclipse.jubula.tools.objects.event.TestErrorEvent;
14
import org.eclipse.swt.graphics.Rectangle;
15
import org.eclipse.swt.widgets.List;
16
/**
17
 * 
18
 * @author BREDEX GmbH
19
 *
20
 */
21
public class ListAdapter extends WidgetAdapter implements IListAdapter {
22
23
    /**  */
24
    private List m_list;
25
    /**
26
     * 
27
     * @param objectToAdapt -
28
     */
29
    public ListAdapter(Object objectToAdapt) {
30
        super(objectToAdapt);
31
        m_list = (List) objectToAdapt;
32
    }
33
34
    /**
35
     * {@inheritDoc}
36
     */
37
    public String getText() {
38
        String[] selected = getSelectedValues();
39
        if (selected.length > 0) {
40
            return selected[0];
41
        }
42
        throw new StepExecutionException("No list item selected", //$NON-NLS-1$
43
            EventFactory.createActionError(TestErrorEvent.NO_SELECTION));
44
    }
45
    
46
    /**
47
     * {@inheritDoc}
48
     */
49
    public int[] getSelectedIndices() {
50
        return (int[])getEventThreadQueuer().invokeAndWait(
51
                "getSelectedIndices", new IRunnable() { //$NON-NLS-1$
52
                    public Object run() {
53
                        return m_list.getSelectionIndices();
54
                    }
55
                });
56
    }
57
    /**
58
     * {@inheritDoc}
59
     */
60
    public void clickOnIndex(Integer i, ClickOptions co) {
61
        final int iVal = i.intValue();
62
        scrollIndexToVisible(iVal);
63
        
64
        final Rectangle clickConstraints = 
65
            (Rectangle)getEventThreadQueuer().invokeAndWait(
66
                "setClickConstraints",  //$NON-NLS-1$
67
                new IRunnable() {
68
69
                    public Object run() throws StepExecutionException {
70
                        Rectangle constraints = new Rectangle(0, 0, 0, 0);
71
                        int displayedItemCount = getDisplayedItemCount();
72
                        int numberBelowTop = 0;
73
                        if (displayedItemCount >= m_list.getItemCount()) {
74
                            numberBelowTop = iVal;
75
                        } else {
76
                            numberBelowTop = Math.max(0, iVal 
77
                                - m_list.getItemCount() + displayedItemCount);
78
                        }
79
                        
80
                        // Set the constraints based on the numberBelowTop
81
                        constraints.height = m_list.getItemHeight();
82
                        constraints.width = m_list.getBounds().width;
83
                        constraints.y += (numberBelowTop * constraints.height);
84
                        // explicitly use list relative bounds here - as e.g. on
85
                        // Mac OS systems list.getClientArea() is not relative
86
                        // see bug 353905
87
                        Rectangle actualListBounds =
88
                            new Rectangle(0, 0, m_list.getClientArea().width, 
89
                                    m_list.getClientArea().height);
90
                        return constraints.intersection(actualListBounds);
91
                    }
92
                });
93
        
94
        // Note that we set scrollToVisible false because we have already done
95
        // the scrolling.
96
        getRobot().click(m_list, clickConstraints, 
97
                co.setScrollToVisible(false));
98
99
    }
100
    /**
101
     * {@inheritDoc}
102
     */
103
    public String[] getSelectedValues() {
104
        return (String[])getEventThreadQueuer().invokeAndWait(
105
                "getSelectedValues", new IRunnable() { //$NON-NLS-1$
106
                    public Object run() {
107
                        return m_list.getSelection();
108
                    }
109
                });
110
    }
111
    /**
112
     * {@inheritDoc}
113
     */
114
    public Integer[] findIndicesOfValues(final String[] values,
115
            final String operator, final String searchType) {
116
        final java.util.List indexList = (java.util.List)
117
                getEventThreadQueuer().invokeAndWait("findIndices", //$NON-NLS-1$
118
                    new IRunnable() {
119
                        public Object run() {
120
                            final int valuesLength = values.length;
121
                            final java.util.List idxList = new ArrayList(
122
                                values.length);
123
                            final int listItemCount = m_list.getItemCount();
124
                            final MatchUtil matchUtil = MatchUtil.getInstance();
125
                            for (int i = 0; i < valuesLength; i++) {
126
                                final String value = values[i];
127
                                for (int j = getStartingIndex(searchType); 
128
                                    j < listItemCount; j++) {
129
                                    
130
                                    final String listItem = m_list.getItem(j);
131
                                    if (matchUtil.match(listItem, value, 
132
                                        operator)) {
133
                                        
134
                                        idxList.add(new Integer(j));
135
                                    }
136
                                }
137
                            }
138
                            return idxList;
139
                        }
140
                    });
141
        Integer[] indices = new Integer[indexList.size()];
142
        indexList.toArray(indices);
143
        return indices;
144
    }
145
146
    /**
147
     * @return  the number of items displayed in the list.
148
     */
149
    private int getDisplayedItemCount() {
150
        return ((Integer)getEventThreadQueuer().invokeAndWait(
151
                "getDisplayedItemCount",  //$NON-NLS-1$
152
                new IRunnable() {
153
154
                public Object run() throws StepExecutionException {
155
                    int listHeight = SwtUtils.getWidgetBounds(m_list).height;
156
                    int itemHeight = m_list.getItemHeight();
157
                    
158
                    return new Integer(listHeight / itemHeight);
159
                }
160
            
161
            })).intValue();
162
    }
163
    
164
    /**
165
     * @param index The index to make visible
166
     */
167
    private void scrollIndexToVisible(final int index) {
168
        getEventThreadQueuer().invokeAndWait(
169
            "scrollIndexToVisible",  //$NON-NLS-1$
170
            new IRunnable() {
171
172
                public Object run() throws StepExecutionException {
173
           
174
                    m_list.setTopIndex(index);
175
176
                    return null;
177
                }
178
            
179
            });
180
    }
181
    /**
182
     * @param searchType Determines where the search begins ("relative" or "absolute")
183
     * @return The index from which to begin a search, based on the search type
184
     *         and (if appropriate) the currently selected cell.
185
     */
186
    private int getStartingIndex(final String searchType) {
187
        int startingIndex = 0;
188
        if (searchType.equalsIgnoreCase(
189
                CompSystemConstants.SEARCH_TYPE_RELATIVE)) {
190
            int [] selectedIndices = getSelectedIndices();
191
            // Start from the last selected item, if any item(s) are selected
192
            if (selectedIndices.length > 0) {
193
                startingIndex = selectedIndices[selectedIndices.length - 1] + 1;
194
            }
195
        }
196
        return startingIndex;
197
    }
198
}
(-)a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/uiadapter/MenuAdapter.java (-17 / +2 lines)
Lines 12-23 package org.eclipse.jubula.rc.swt.uiadapter; Link Here
12
12
13
import org.eclipse.jubula.rc.common.driver.IEventThreadQueuer;
13
import org.eclipse.jubula.rc.common.driver.IEventThreadQueuer;
14
import org.eclipse.jubula.rc.common.driver.IRobot;
14
import org.eclipse.jubula.rc.common.driver.IRobot;
15
import org.eclipse.jubula.rc.common.driver.IRobotFactory;
16
import org.eclipse.jubula.rc.common.driver.IRunnable;
15
import org.eclipse.jubula.rc.common.driver.IRunnable;
17
import org.eclipse.jubula.rc.common.exception.RobotException;
16
import org.eclipse.jubula.rc.common.exception.RobotException;
18
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IMenuAdapter;
17
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IMenuAdapter;
19
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IMenuItemAdapter;
18
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IMenuItemAdapter;
20
import org.eclipse.jubula.rc.swt.driver.RobotFactoryConfig;
21
import org.eclipse.swt.widgets.Menu;
19
import org.eclipse.swt.widgets.Menu;
22
import org.eclipse.swt.widgets.MenuItem;
20
import org.eclipse.swt.widgets.MenuItem;
23
21
Lines 26-37 import org.eclipse.swt.widgets.MenuItem; Link Here
26
 * 
24
 * 
27
 * @author BREDEX GmbH
25
 * @author BREDEX GmbH
28
 */
26
 */
29
public class MenuAdapter implements IMenuAdapter {
27
public class MenuAdapter extends AbstractComponentAdapter
28
    implements IMenuAdapter {
30
    /** the Menu from the AUT */
29
    /** the Menu from the AUT */
31
    private Menu m_menu;
30
    private Menu m_menu;
32
    
31
    
33
    /** the RobotFactory from the AUT */
34
    private IRobotFactory m_robotFactory;
35
32
36
    /**
33
    /**
37
     * 
34
     * 
Lines 42-59 public class MenuAdapter implements IMenuAdapter { Link Here
42
    }
39
    }
43
40
44
    /**
41
    /**
45
     * Gets the Robot factory. The factory is created once per instance.
46
     * 
47
     * @return The Robot factory.
48
     */
49
    protected IRobotFactory getRobotFactory() {
50
        if (m_robotFactory == null) {
51
            m_robotFactory = new RobotFactoryConfig().getRobotFactory();
52
        }
53
        return m_robotFactory;
54
    }
55
56
    /**
57
     * Gets the IEventThreadQueuer.
42
     * Gets the IEventThreadQueuer.
58
     * 
43
     * 
59
     * @return The Robot
44
     * @return The Robot
(-)a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/uiadapter/MenuItemAdapter.java (-18 / +2 lines)
Lines 16-22 import org.eclipse.jubula.rc.common.driver.IEventThreadQueuer; Link Here
16
import org.eclipse.jubula.rc.common.driver.IRobot;
16
import org.eclipse.jubula.rc.common.driver.IRobot;
17
import org.eclipse.jubula.rc.common.driver.IRobotEventConfirmer;
17
import org.eclipse.jubula.rc.common.driver.IRobotEventConfirmer;
18
import org.eclipse.jubula.rc.common.driver.IRobotEventInterceptor;
18
import org.eclipse.jubula.rc.common.driver.IRobotEventInterceptor;
19
import org.eclipse.jubula.rc.common.driver.IRobotFactory;
20
import org.eclipse.jubula.rc.common.driver.IRunnable;
19
import org.eclipse.jubula.rc.common.driver.IRunnable;
21
import org.eclipse.jubula.rc.common.driver.InterceptorOptions;
20
import org.eclipse.jubula.rc.common.driver.InterceptorOptions;
22
import org.eclipse.jubula.rc.common.exception.RobotException;
21
import org.eclipse.jubula.rc.common.exception.RobotException;
Lines 25-31 import org.eclipse.jubula.rc.common.listener.EventLock; Link Here
25
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IMenuAdapter;
24
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IMenuAdapter;
26
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IMenuItemAdapter;
25
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IMenuItemAdapter;
27
import org.eclipse.jubula.rc.swt.driver.EventThreadQueuerSwtImpl;
26
import org.eclipse.jubula.rc.swt.driver.EventThreadQueuerSwtImpl;
28
import org.eclipse.jubula.rc.swt.driver.RobotFactoryConfig;
29
import org.eclipse.jubula.rc.swt.driver.RobotFactorySwtImpl;
27
import org.eclipse.jubula.rc.swt.driver.RobotFactorySwtImpl;
30
import org.eclipse.jubula.rc.swt.driver.SelectionSwtEventMatcher;
28
import org.eclipse.jubula.rc.swt.driver.SelectionSwtEventMatcher;
31
import org.eclipse.jubula.rc.swt.driver.ShowSwtEventMatcher;
29
import org.eclipse.jubula.rc.swt.driver.ShowSwtEventMatcher;
Lines 47-61 import org.eclipse.swt.widgets.MenuItem; Link Here
47
 * 
45
 * 
48
 *  @author BREDEX GmbH
46
 *  @author BREDEX GmbH
49
 */
47
 */
50
public class MenuItemAdapter implements IMenuItemAdapter {
48
public class MenuItemAdapter extends AbstractComponentAdapter
49
    implements IMenuItemAdapter {
51
50
52
    /** the MenuItem from the AUT*/
51
    /** the MenuItem from the AUT*/
53
    private MenuItem m_menuItem;
52
    private MenuItem m_menuItem;
54
    
53
    
55
54
56
    /** the RobotFactory from the AUT */
57
    private IRobotFactory m_robotFactory;
58
59
    /**
55
    /**
60
     * 
56
     * 
61
     * @param component graphics component which will be adapted
57
     * @param component graphics component which will be adapted
Lines 66-83 public class MenuItemAdapter implements IMenuItemAdapter { Link Here
66
    }
62
    }
67
    
63
    
68
    /**
64
    /**
69
     * Gets the Robot factory. The factory is created once per instance.
70
     * 
71
     * @return The Robot factory.
72
     */
73
    protected IRobotFactory getRobotFactory() {
74
        if (m_robotFactory == null) {
75
            m_robotFactory = new RobotFactoryConfig().getRobotFactory();
76
        }
77
        return m_robotFactory;
78
    }
79
80
    /**
81
     * Gets the IEventThreadQueuer.
65
     * Gets the IEventThreadQueuer.
82
     * 
66
     * 
83
     * @return The Robot
67
     * @return The Robot
(-)a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/uiadapter/TableAdapter.java (+8 lines)
Lines 523-526 public class TableAdapter extends WidgetAdapter implements ITableAdapter { Link Here
523
        
523
        
524
        return SwtUtils.getCursorControl();
524
        return SwtUtils.getCursorControl();
525
    }
525
    }
526
527
    /**
528
     * {@inheritDoc}
529
     */
530
    public String getText() {
531
        final Cell selectedCell = getSelectedCell();
532
        return getCellText(selectedCell.getRow(), selectedCell.getCol());
533
    }
526
}
534
}
(-)a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/uiadapter/WidgetAdapter.java (-19 / +14 lines)
Lines 11-31 Link Here
11
package org.eclipse.jubula.rc.swt.uiadapter;
11
package org.eclipse.jubula.rc.swt.uiadapter;
12
12
13
import org.eclipse.jubula.rc.common.caps.AbstractMenuCAPs;
13
import org.eclipse.jubula.rc.common.caps.AbstractMenuCAPs;
14
import org.eclipse.jubula.rc.common.caps.AbstractWidgetCAPs;
14
import org.eclipse.jubula.rc.common.driver.ClickOptions;
15
import org.eclipse.jubula.rc.common.driver.ClickOptions;
15
import org.eclipse.jubula.rc.common.driver.IEventThreadQueuer;
16
import org.eclipse.jubula.rc.common.driver.IEventThreadQueuer;
16
import org.eclipse.jubula.rc.common.driver.IRobot;
17
import org.eclipse.jubula.rc.common.driver.IRobot;
17
import org.eclipse.jubula.rc.common.driver.IRobotFactory;
18
import org.eclipse.jubula.rc.common.driver.IRunnable;
18
import org.eclipse.jubula.rc.common.driver.IRunnable;
19
import org.eclipse.jubula.rc.common.driver.RobotTiming;
19
import org.eclipse.jubula.rc.common.driver.RobotTiming;
20
import org.eclipse.jubula.rc.common.exception.RobotException;
20
import org.eclipse.jubula.rc.common.exception.RobotException;
21
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
21
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
22
import org.eclipse.jubula.rc.common.listener.EventLock;
22
import org.eclipse.jubula.rc.common.listener.EventLock;
23
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IWidgetAdapter;
23
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IWidgetAdapter;
24
import org.eclipse.jubula.rc.swt.driver.KeyCodeConverter;
24
import org.eclipse.jubula.rc.swt.caps.CAPUtil;
25
import org.eclipse.jubula.rc.swt.caps.CAPUtil;
25
import org.eclipse.jubula.rc.swt.caps.MenuCAPs;
26
import org.eclipse.jubula.rc.swt.caps.MenuCAPs;
26
import org.eclipse.jubula.rc.swt.driver.DragAndDropHelperSwt;
27
import org.eclipse.jubula.rc.swt.driver.DragAndDropHelperSwt;
27
import org.eclipse.jubula.rc.swt.driver.EventThreadQueuerSwtImpl;
28
import org.eclipse.jubula.rc.swt.driver.EventThreadQueuerSwtImpl;
28
import org.eclipse.jubula.rc.swt.driver.RobotFactoryConfig;
29
import org.eclipse.jubula.rc.swt.implclasses.EventListener;
29
import org.eclipse.jubula.rc.swt.implclasses.EventListener;
30
import org.eclipse.jubula.rc.swt.implclasses.SimulatedTooltip;
30
import org.eclipse.jubula.rc.swt.implclasses.SimulatedTooltip;
31
import org.eclipse.jubula.rc.swt.utils.SwtUtils;
31
import org.eclipse.jubula.rc.swt.utils.SwtUtils;
Lines 45-61 import org.eclipse.swt.widgets.Widget; Link Here
45
 * 
45
 * 
46
 *  @author BREDEX GmbH
46
 *  @author BREDEX GmbH
47
 */
47
 */
48
public abstract class WidgetAdapter implements IWidgetAdapter {
48
public abstract class WidgetAdapter extends AbstractComponentAdapter
49
    implements IWidgetAdapter {
49
    
50
    
50
    /** constants for communication */
51
    /** constants for communication */
51
    protected static final String POS_UNIT_PIXEL = "Pixel"; //$NON-NLS-1$
52
    protected static final String POS_UNIT_PIXEL = "Pixel"; //$NON-NLS-1$
52
    /** constants for communication */
53
    /** constants for communication */
53
    protected static final String POS_UNI_PERCENT = "Percent"; //$NON-NLS-1$
54
    protected static final String POS_UNI_PERCENT = "Percent"; //$NON-NLS-1$
54
55
55
56
 
56
    /** the RobotFactory from the AUT */
57
    private IRobotFactory m_robotFactory;
58
     
59
    /**   */
57
    /**   */
60
    private Control m_component;
58
    private Control m_component;
61
    
59
    
Lines 109-125 public abstract class WidgetAdapter implements IWidgetAdapter { Link Here
109
        return m_component;
107
        return m_component;
110
    }
108
    }
111
    
109
    
112
    /**
110
113
     * Gets the Robot factory. The factory is created once per instance.
114
     *
115
     * @return The Robot factory.
116
     */
117
    protected IRobotFactory getRobotFactory() {
118
        if (m_robotFactory == null) {
119
            m_robotFactory = new RobotFactoryConfig().getRobotFactory();
120
        }
121
        return m_robotFactory;
122
    }
123
    /**
111
    /**
124
     * Gets the Robot
112
     * Gets the Robot
125
     *
113
     *
Lines 396-402 public abstract class WidgetAdapter implements IWidgetAdapter { Link Here
396
                }            
384
                }            
397
            });
385
            });
398
            
386
            
399
            CAPUtil.waitBeforeDrop(delayBeforeDrop);
387
            AbstractWidgetCAPs.waitBeforeDrop(delayBeforeDrop);
400
        } finally {
388
        } finally {
401
            getRobot().mouseRelease(null, null, mouseButton);
389
            getRobot().mouseRelease(null, null, mouseButton);
402
            CAPUtil.pressOrReleaseModifiers(modifier, false);
390
            CAPUtil.pressOrReleaseModifiers(modifier, false);
Lines 424-427 public abstract class WidgetAdapter implements IWidgetAdapter { Link Here
424
                        button), xPos, xUnits.equalsIgnoreCase(POS_UNIT_PIXEL),
412
                        button), xPos, xUnits.equalsIgnoreCase(POS_UNIT_PIXEL),
425
                yPos, yUnits.equalsIgnoreCase(POS_UNIT_PIXEL));
413
                yPos, yUnits.equalsIgnoreCase(POS_UNIT_PIXEL));
426
    }
414
    }
415
    
416
    /**
417
     * {@inheritDoc}
418
     */
419
    public int getKeyCode(String mod) {
420
        return KeyCodeConverter.getKeyCode(mod);
421
    }
427
}
422
}
(-)a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/uiadapter/factory/SWTAdapterFactory.java (-1 / +5 lines)
Lines 13-23 package org.eclipse.jubula.rc.swt.uiadapter.factory; Link Here
13
import org.eclipse.jubula.rc.common.uiadapter.factory.IUIAdapterFactory;
13
import org.eclipse.jubula.rc.common.uiadapter.factory.IUIAdapterFactory;
14
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IComponentAdapter;
14
import org.eclipse.jubula.rc.common.uiadapter.interfaces.IComponentAdapter;
15
import org.eclipse.jubula.rc.swt.uiadapter.ButtonAdapter;
15
import org.eclipse.jubula.rc.swt.uiadapter.ButtonAdapter;
16
import org.eclipse.jubula.rc.swt.uiadapter.ListAdapter;
16
import org.eclipse.jubula.rc.swt.uiadapter.MenuAdapter;
17
import org.eclipse.jubula.rc.swt.uiadapter.MenuAdapter;
17
import org.eclipse.jubula.rc.swt.uiadapter.MenuItemAdapter;
18
import org.eclipse.jubula.rc.swt.uiadapter.MenuItemAdapter;
18
import org.eclipse.jubula.rc.swt.uiadapter.TableAdapter;
19
import org.eclipse.jubula.rc.swt.uiadapter.TableAdapter;
19
import org.eclipse.jubula.rc.swt.uiadapter.TreeAdapter;
20
import org.eclipse.jubula.rc.swt.uiadapter.TreeAdapter;
20
import org.eclipse.swt.widgets.Button;
21
import org.eclipse.swt.widgets.Button;
22
import org.eclipse.swt.widgets.List;
21
import org.eclipse.swt.widgets.Menu;
23
import org.eclipse.swt.widgets.Menu;
22
import org.eclipse.swt.widgets.MenuItem;
24
import org.eclipse.swt.widgets.MenuItem;
23
import org.eclipse.swt.widgets.Table;
25
import org.eclipse.swt.widgets.Table;
Lines 33-39 public class SWTAdapterFactory implements IUIAdapterFactory { Link Here
33
    /** */
35
    /** */
34
    private static final Class[] SUPPORTEDCLASSES = 
36
    private static final Class[] SUPPORTEDCLASSES = 
35
            new Class[]{Button.class, Menu.class, MenuItem.class, Tree.class,
37
            new Class[]{Button.class, Menu.class, MenuItem.class, Tree.class,
36
                Table.class};
38
                Table.class, List.class};
37
    
39
    
38
    
40
    
39
    /**
41
    /**
Lines 58-63 public class SWTAdapterFactory implements IUIAdapterFactory { Link Here
58
            returnvalue = new TreeAdapter(objectToAdapt);
60
            returnvalue = new TreeAdapter(objectToAdapt);
59
        } else if (objectToAdapt instanceof Table) {
61
        } else if (objectToAdapt instanceof Table) {
60
            returnvalue = new TableAdapter(objectToAdapt);
62
            returnvalue = new TableAdapter(objectToAdapt);
63
        } else if (objectToAdapt instanceof List) {
64
            returnvalue = new ListAdapter(objectToAdapt);
61
        }
65
        }
62
        
66
        
63
        
67
        
(-)a/org.eclipse.jubula.toolkit.provider.swing/resources/xml/ComponentConfiguration.xml (-1 / +1 lines)
Lines 48-54 Link Here
48
	
48
	
49
	<toolkitComponent type="javax.swing.JList" visible="false">
49
	<toolkitComponent type="javax.swing.JList" visible="false">
50
		<realizes>guidancer.concrete.List</realizes>
50
		<realizes>guidancer.concrete.List</realizes>
51
		<testerClass>org.eclipse.jubula.rc.swing.swing.implclasses.JListImplClass</testerClass>
51
		<testerClass>org.eclipse.jubula.rc.swing.swing.caps.JListCAPs</testerClass>
52
		<componentClass name="javax.swing.JList" />
52
		<componentClass name="javax.swing.JList" />
53
	</toolkitComponent>
53
	</toolkitComponent>
54
	
54
	
(-)a/org.eclipse.jubula.toolkit.provider.swt/resources/xml/ComponentConfiguration.xml (-2 / +1 lines)
Lines 221-227 Link Here
221
	
221
	
222
	<toolkitComponent type="org.eclipse.swt.widgets.List" visible="false">
222
	<toolkitComponent type="org.eclipse.swt.widgets.List" visible="false">
223
		<realizes>guidancer.concrete.List</realizes>
223
		<realizes>guidancer.concrete.List</realizes>
224
		<testerClass>org.eclipse.jubula.rc.swt.implclasses.ListImplClass</testerClass>
224
		<testerClass>org.eclipse.jubula.rc.swt.caps.ListCAPs</testerClass>
225
		<componentClass name="org.eclipse.swt.widgets.List" />
225
		<componentClass name="org.eclipse.swt.widgets.List" />
226
	</toolkitComponent>
226
	</toolkitComponent>
227
	
227
	
228
- 

Return to bug 394179