Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 235088 Details for
Bug 414672
New SWT table actions (Checking checked-state of checkboxes in first column)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Table actions: Toggle and Check Checkbox
0010-Add-Table_Checkboxes_complete.patch (text/plain), 12.37 KB, created by
Jan Philipp Wiegmann
on 2013-09-03 04:42:52 EDT
(
hide
)
Description:
Table actions: Toggle and Check Checkbox
Filename:
MIME Type:
Creator:
Jan Philipp Wiegmann
Created:
2013-09-03 04:42:52 EDT
Size:
12.37 KB
patch
obsolete
>From 0c2347dc3e079181f85e4dd78c5ebc729f0d3c86 Mon Sep 17 00:00:00 2001 >From: Jan Wiegmann <Jan.Wiegmann@bredex.de> >Date: Tue, 3 Sep 2013 10:34:55 +0200 >Subject: [PATCH] Added Checkbox actions for tables (Check and Toggle) > >--- > .../eclipse/jubula/rc/swt/tester/TableTester.java | 116 ++++++++++++++++++++- > .../resources/xml/ComponentConfiguration.xml | 4 +- > .../provider/concrete/I18nStrings.properties | 6 +- > .../resources/xml/ComponentConfiguration.xml | 3 +- > .../jubula/tools/i18n/guidancerStrings.properties | 1 + > .../jubula/tools/objects/event/TestErrorEvent.java | 9 +- > 6 files changed, 132 insertions(+), 7 deletions(-) > >diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/TableTester.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/TableTester.java >index 5f5ef2a..d8761c4 100644 >--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/TableTester.java >+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/TableTester.java >@@ -23,6 +23,7 @@ import org.eclipse.jubula.rc.common.implclasses.table.Cell; > import org.eclipse.jubula.rc.common.tester.AbstractTableTester; > import org.eclipse.jubula.rc.common.tester.adapter.interfaces.ITableComponent; > import org.eclipse.jubula.rc.common.tester.adapter.interfaces.ITextInputComponent; >+import org.eclipse.jubula.rc.common.util.Verifier; > import org.eclipse.jubula.rc.swt.driver.DragAndDropHelperSwt; > import org.eclipse.jubula.rc.swt.tester.adapter.StyledTextAdapter; > import org.eclipse.jubula.rc.swt.tester.adapter.TableAdapter; >@@ -306,7 +307,7 @@ public class TableTester extends AbstractTableTester { > "getCellBounds", //$NON-NLS-1$ > new IRunnable() { > public Object run() { >- TableItem ti = table.getItem(row); >+ TableItem ti = table.getItem(row); > int column = (table.getColumnCount() > 0 || col > 0) > ? col : 0; > org.eclipse.swt.graphics.Rectangle r = >@@ -661,4 +662,117 @@ public class TableTester extends AbstractTableTester { > pressOrReleaseModifiers(dndHelper.getModifier(), false); > } > } >+ >+ /** >+ * Verifies whether the checkbox in the row of the selected cell >+ * is checked >+ * >+ * @param checked true if checkbox in cell should be selected, false otherwise >+ * @throws StepExecutionException If no cell is selected or the verification fails. >+ */ >+ public void rcVerifyCheckboxInSelectedRow(boolean checked) >+ throws StepExecutionException { >+ int row = ((ITableComponent) getComponent()).getSelectedCell().getRow(); >+ verifyCheckboxInRow(checked, row); >+ } >+ >+ /** >+ * Verifies whether the checkbox in the row under the mouse pointer is checked >+ * >+ * @param checked true if checkbox in cell is selected, false otherwise >+ */ >+ public void rcVerifyCheckboxInRowAtMousePosition(boolean checked) { >+ int row = getCellAtMousePosition().getRow(); >+ verifyCheckboxInRow(checked, row); >+ } >+ >+ /** >+ * Verifies whether the checkbox in the row with the given >+ * <code>index</code> is checked >+ * >+ * @param checked true if checkbox in cell is selected, false otherwise >+ * @param row the row-index of the cell in which the checkbox-state should be verified >+ */ >+ private void verifyCheckboxInRow(boolean checked, final int row) { >+ Boolean checkIndex = ((Boolean)getEventThreadQueuer().invokeAndWait( >+ "rcVerifyTableCheckboxIndex", new IRunnable() { //$NON-NLS-1$ >+ public Object run() throws StepExecutionException { >+ Table table = getTable(); >+ if ((table.getStyle() & SWT.CHECK) == 0) { >+ throw new StepExecutionException( >+ "No checkbox found", //$NON-NLS-1$ >+ EventFactory.createActionError( >+ TestErrorEvent.CHECKBOX_NOT_FOUND)); >+ } >+ return new Boolean(table.getItem(row). >+ getChecked()); >+ } >+ })); >+ Verifier.equals(checked, checkIndex.booleanValue()); >+ } >+ >+ /** >+ * Toggles the checkbox in the row under the Mouse Pointer >+ */ >+ public void rcToggleCheckboxInRowAtMousePosition() { >+ toggleCheckboxInRow(getCellAtMousePosition().getRow()); >+ } >+ >+ /** >+ * Toggles the checkbox in the selected row >+ */ >+ public void rcToggleCheckboxInSelectedRow() { >+ int row = ((Integer) getEventThreadQueuer().invokeAndWait( >+ "get Selection index", new IRunnable() { //$NON-NLS-1$ >+ public Object run() throws StepExecutionException { >+ return new Integer(getTable().getSelectionIndex()); >+ } >+ })).intValue(); >+ toggleCheckboxInRow(row); >+ } >+ >+ /** >+ * Toggles the checkbox in the row with the given index >+ * @param row the index >+ */ >+ private void toggleCheckboxInRow(final int row) { >+ >+ if (row == -1) { >+ getEventThreadQueuer().invokeAndWait( >+ "No Selection", new IRunnable() { //$NON-NLS-1$ >+ public Object run() throws StepExecutionException { >+ throw new StepExecutionException( >+ "No Selection found ", //$NON-NLS-1$ >+ EventFactory.createActionError( >+ TestErrorEvent.NO_SELECTION)); >+ } >+ }); >+ } >+ >+ ((ITableComponent) getComponent()).scrollCellToVisible(row, 0); >+ >+ final Table table = getTable(); >+ >+ org.eclipse.swt.graphics.Rectangle itemBounds = >+ (org.eclipse.swt.graphics.Rectangle) getEventThreadQueuer(). >+ invokeAndWait( >+ "getTableItem", //$NON-NLS-1$ >+ new IRunnable() { >+ public Object run() throws StepExecutionException { >+ return table.getItem(row).getBounds(); >+ } >+ }); >+ >+ int itemHeight = itemBounds.height; >+ >+ // Creates a Rectangle with bounds around the checkbox of the row >+ org.eclipse.swt.graphics.Rectangle cbxBounds = >+ new org.eclipse.swt.graphics.Rectangle(0, >+ itemBounds.y, itemBounds.x, itemHeight); >+ >+ // Performs a click in the middle of the Rectangle >+ getRobot().click(table, cbxBounds, ClickOptions.create().left(). >+ setScrollToVisible(false), >+ itemBounds.x / 2, true, itemHeight / 2, true); >+ } > } >diff --git a/org.eclipse.jubula.toolkit.provider.concrete/resources/xml/ComponentConfiguration.xml b/org.eclipse.jubula.toolkit.provider.concrete/resources/xml/ComponentConfiguration.xml >index 2f06f92..22594e2 100644 >--- a/org.eclipse.jubula.toolkit.provider.concrete/resources/xml/ComponentConfiguration.xml >+++ b/org.eclipse.jubula.toolkit.provider.concrete/resources/xml/ComponentConfiguration.xml >@@ -1976,8 +1976,8 @@ > <type>java.lang.Integer</type> > <defaultValue>100</defaultValue> > </param> >- </action> >- >+ </action> >+ <action name="CompSystem.VerifyCheckboxInSelectedRow" changed="4.5"> <method>rcVerifyCheckboxInSelectedRow</method> <param name="CompSystem.Checked"> <type>java.lang.Boolean</type> <defaultValue>true</defaultValue> <valueSet> <element name="CompSystem.True" value="true"/> <element name="CompSystem.False" value="false"/> </valueSet> </param> </action> <action name="CompSystem.VerifyCheckboxOfRowAtMousePosition" changed="4.5"> <method>rcVerifyCheckboxInRowAtMousePosition</method> <param name="CompSystem.Checked"> <type>java.lang.Boolean</type> <defaultValue>true</defaultValue> <valueSet> <element name="CompSystem.True" value="true"/> <element name="CompSystem.False" value="false"/> </valueSet> </param> </action> <action name="CompSystem.ToggleCheckboxInSelectedRow" changed="4.5"> <method>rcToggleCheckboxInSelectedRow</method> </action> <action name="CompSystem.ToggleCheckboxOfRowAtMousePosition" changed="4.5"> <method>rcToggleCheckboxInRowAtMousePosition</method> </action> > </concreteComponent> > > <concreteComponent type="guidancer.concrete.TextComponent"> >diff --git a/org.eclipse.jubula.toolkit.provider.concrete/src/org/eclipse/jubula/toolkit/provider/concrete/I18nStrings.properties b/org.eclipse.jubula.toolkit.provider.concrete/src/org/eclipse/jubula/toolkit/provider/concrete/I18nStrings.properties >index dedc309..b8bb478 100644 >--- a/org.eclipse.jubula.toolkit.provider.concrete/src/org/eclipse/jubula/toolkit/provider/concrete/I18nStrings.properties >+++ b/org.eclipse.jubula.toolkit.provider.concrete/src/org/eclipse/jubula/toolkit/provider/concrete/I18nStrings.properties >@@ -73,4 +73,8 @@ CompSystem.Value1=Value 1 > CompSystem.Value2=Value 2 > CompSystem.ValueOperator=Value Operator > CompSystem.PrepareForShutdown=Prepare for AUT termination >-CompSystem.SyncShutdownAndRestart=Synchronize termination and re-start of AUT >\ No newline at end of file >+CompSystem.SyncShutdownAndRestart=Synchronize termination and re-start of AUT >+CompSystem.VerifyCheckboxInSelectedRow=Check Selection of Checkbox in Selected Row >+CompSystem.VerifyCheckboxOfRowAtMousePosition=Check Selection of Checkbox at Mouse Position >+CompSystem.ToggleCheckboxInSelectedRow=Toggle Checkbox in Selected Row >+CompSystem.ToggleCheckboxOfRowAtMousePosition=Toggle Checkbox at Mouse Position >\ No newline at end of file >diff --git a/org.eclipse.jubula.toolkit.provider.swt/resources/xml/ComponentConfiguration.xml b/org.eclipse.jubula.toolkit.provider.swt/resources/xml/ComponentConfiguration.xml >index fbf906b..ac3bca0 100644 >--- a/org.eclipse.jubula.toolkit.provider.swt/resources/xml/ComponentConfiguration.xml >+++ b/org.eclipse.jubula.toolkit.provider.swt/resources/xml/ComponentConfiguration.xml >@@ -229,8 +229,7 @@ > > <toolkitComponent type="org.eclipse.swt.widgets.Table" visible="false"> > <realizes>guidancer.concrete.Table</realizes> >- <testerClass>org.eclipse.jubula.rc.swt.tester.TableTester</testerClass> >- <componentClass name="org.eclipse.swt.widgets.Table" /> >+ <testerClass>org.eclipse.jubula.rc.swt.tester.TableTester</testerClass> <componentClass name="org.eclipse.swt.widgets.Table" /> > </toolkitComponent> > > <toolkitComponent type="org.eclipse.swt.widgets.Tree" observable="false"> >diff --git a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/i18n/guidancerStrings.properties b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/i18n/guidancerStrings.properties >index d4d9ab4..49a0285 100644 >--- a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/i18n/guidancerStrings.properties >+++ b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/i18n/guidancerStrings.properties >@@ -949,6 +949,7 @@ TestErrorEvent.UnsupportedParameterValue=Parameter value "{0}" is not supported > TestErrorEvent.UnsupportedUI=Unsupported UI class\: "{0}" > TestErrorEvent.VerifyFailed=Check Failed > TestErrorEvent.WindowActivationFailed=Window activation failed. >+TestErrorEvent.CheckboxNotFound=Checkbox not found > TestExecutionContributor.AUTNotFound=AUT not found.\nPlease check the AUT configuration. > TestExecutionContributor.AUTStartedRecording=Observation mode > TestExecutionContributor.AUTStartedRecordingCheckMode=Observation mode (Check Mode) >diff --git a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/objects/event/TestErrorEvent.java b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/objects/event/TestErrorEvent.java >index 1aa1344..287a473 100644 >--- a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/objects/event/TestErrorEvent.java >+++ b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/objects/event/TestErrorEvent.java >@@ -22,7 +22,14 @@ import java.util.Map; > * @author BREDEX GmbH > * @created 04.04.2005 > */ >-public class TestErrorEvent { >+public class TestErrorEvent { >+ >+ /** >+ * Checkbox has not been found >+ */ >+ public static final String CHECKBOX_NOT_FOUND = >+ "TestErrorEvent.CheckboxNotFound"; //$NON-NLS-1$ >+ > /** > * unsupported keyboard layout. > */ >-- >1.7.11 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
markus.tiede
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 414672
:
234195
|
234457
| 235088