summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Kriese2011-08-18 08:36:18 (EDT)
committerSteffen Kriese2011-08-18 08:36:18 (EDT)
commita05d8b43a90fb4a2bcd506ad901a820ca499e0ec (patch)
treeb53dcb35eb16092bacc1a893496f9939e156cfb4
parent9dfb7c6302c15322836c1cf6531d88017daa1c6e (diff)
downloadorg.eclipse.riena-a05d8b43a90fb4a2bcd506ad901a820ca499e0ec.zip
org.eclipse.riena-a05d8b43a90fb4a2bcd506ad901a820ca499e0ec.tar.gz
org.eclipse.riena-a05d8b43a90fb4a2bcd506ad901a820ca499e0ec.tar.bz2
RESOLVED - bug 474: MasterDetails.suggestNewEntry() sollte Fokus auf Details-Bereich setzen
https://www.compeople.eu/support/rundv/reports/show_bug.cgi?id=474
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/MasterDetailsRidgetTest.java15
-rw-r--r--org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/ui/ridgets/swt/AbstractMasterDetailsRidget.java8
2 files changed, 20 insertions, 3 deletions
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/MasterDetailsRidgetTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/MasterDetailsRidgetTest.java
index 9d36c72..6d6da1b 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/MasterDetailsRidgetTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/MasterDetailsRidgetTest.java
@@ -857,14 +857,23 @@ public class MasterDetailsRidgetTest extends AbstractSWTRidgetTest {
ridget.suggestNewEntry();
- assertEquals("", widget.txtColumn1.getText());
- assertEquals("", widget.txtColumn2.getText());
+ assertEquals("", widget.txtColumn1.getText()); //$NON-NLS-1$
+ assertEquals("", widget.txtColumn2.getText()); //$NON-NLS-1$
assertTrue(widget.txtColumn1.isEnabled());
assertTrue(widget.txtColumn2.isEnabled());
assertFalse(widget.getButtonApply().isEnabled());
assertFalse(areDetailsChanged(ridget));
}
+ public void testSuggestNewEntryFirstRidgetHasFocus() {
+ bindToModel(true);
+ final MasterDetailsRidget ridget = getRidget();
+ final ITextRidget firstDetailsRidget = ((MDDelegate) ridget.getDelegate()).txtColumn1;
+ assertFalse(firstDetailsRidget.hasFocus());
+ ridget.suggestNewEntry();
+ assertTrue(firstDetailsRidget.hasFocus());
+ }
+
public void testSuggestNewEntryObjectFalse() {
bindToModel(true);
final MasterDetailsRidget ridget = getRidget();
@@ -875,7 +884,7 @@ public class MasterDetailsRidgetTest extends AbstractSWTRidgetTest {
assertFalse(widget.getButtonApply().isEnabled());
assertFalse(areDetailsChanged(ridget));
- final MDBean newEntry = new MDBean("col1", "col2");
+ final MDBean newEntry = new MDBean("col1", "col2"); //$NON-NLS-1$ //$NON-NLS-2$
ridget.suggestNewEntry(newEntry, false);
assertEquals("col1", widget.txtColumn1.getText());
diff --git a/org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/ui/ridgets/swt/AbstractMasterDetailsRidget.java b/org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/ui/ridgets/swt/AbstractMasterDetailsRidget.java
index dec8dee..d9b3689 100644
--- a/org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/ui/ridgets/swt/AbstractMasterDetailsRidget.java
+++ b/org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/ui/ridgets/swt/AbstractMasterDetailsRidget.java
@@ -424,6 +424,14 @@ public abstract class AbstractMasterDetailsRidget extends AbstractCompositeRidge
setEnabled(false, true); // directy writing -> disable apply
updateDetails(editable);
}
+
+ // set focus to first ridget in detailsarea
+ final Collection<? extends IRidget> ridgets = detailRidgets.getRidgets();
+ if (!ridgets.isEmpty()) {
+ final IRidget[] array = ridgets.toArray(new IRidget[ridgets.size()]);
+ array[ridgets.size() - 1].requestFocus();
+ }
+
} finally {
ignoreChanges = false;
}