summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Kriese2011-04-18 07:52:03 (EDT)
committerSteffen Kriese2011-04-18 07:52:03 (EDT)
commit4f56f73f40584472bf13960ad950bce3b3b36d1f (patch)
tree2e568a0122c6921bbb021465681d3360ce9f22e0
parent5c6393389957722be65a21a7a879dbc7129f916c (diff)
downloadorg.eclipse.riena-4f56f73f40584472bf13960ad950bce3b3b36d1f.zip
org.eclipse.riena-4f56f73f40584472bf13960ad950bce3b3b36d1f.tar.gz
org.eclipse.riena-4f56f73f40584472bf13960ad950bce3b3b36d1f.tar.bz2
RESOLVED - bug 343139: MultipleChoiceRidget does not visualize marker in statusline
https://bugs.eclipse.org/bugs/show_bug.cgi?id=343139
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/MultipleChoiceRidgetTest.java13
-rw-r--r--org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/internal/ui/ridgets/swt/MultipleChoiceRidget.java44
-rw-r--r--org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/ui/ridgets/swt/AbstractSWTRidget.java3
3 files changed, 59 insertions, 1 deletions
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/MultipleChoiceRidgetTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/MultipleChoiceRidgetTest.java
index 5e124bd..e64ccc6 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/MultipleChoiceRidgetTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/MultipleChoiceRidgetTest.java
@@ -77,6 +77,19 @@ public final class MultipleChoiceRidgetTest extends MarkableRidgetTest {
// testing methods
// ////////////////
+ public void testHasFocus() throws Exception {
+ final IMultipleChoiceRidget choiceRidget = getRidget();
+ assertNotNull(choiceRidget);
+
+ final ChoiceComposite widget = getWidget();
+ assertNotNull(widget);
+
+ assertFalse(choiceRidget.hasFocus());
+ getRidget().setUIControl(widget);
+ widget.getChildren()[0].setFocus();
+ assertTrue(getRidget().hasFocus());
+ }
+
/**
* Test that the control is mapped to the expected ridget.
*/
diff --git a/org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/internal/ui/ridgets/swt/MultipleChoiceRidget.java b/org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/internal/ui/ridgets/swt/MultipleChoiceRidget.java
index 15e1504..44c7c63 100644
--- a/org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/internal/ui/ridgets/swt/MultipleChoiceRidget.java
+++ b/org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/internal/ui/ridgets/swt/MultipleChoiceRidget.java
@@ -46,6 +46,7 @@ import org.eclipse.riena.ui.ridgets.swt.AbstractSWTRidget;
import org.eclipse.riena.ui.ridgets.swt.MarkerSupport;
import org.eclipse.riena.ui.swt.ChoiceComposite;
import org.eclipse.riena.ui.swt.lnf.LnFUpdater;
+import org.eclipse.riena.ui.swt.utils.SWTControlFinder;
import org.eclipse.riena.ui.swt.utils.SwtUtilities;
/**
@@ -89,6 +90,49 @@ public class MultipleChoiceRidget extends AbstractSWTRidget implements IMultiple
}
@Override
+ public boolean hasFocus() {
+ if (getUIControl() != null) {
+ final Control control = getUIControl();
+
+ if (control.isFocusControl()) {
+ return true;
+ }
+
+ if (!(control instanceof Composite)) {
+ return false;
+ }
+
+ final ChildFocusChecker checker = new ChildFocusChecker((Composite) control);
+ checker.run();
+
+ return checker.childHasFocus;
+ }
+ return false;
+ }
+
+ private static class ChildFocusChecker extends SWTControlFinder {
+
+ private boolean childHasFocus = false;
+
+ public ChildFocusChecker(final Composite composite) {
+ super(composite);
+ }
+
+ @Override
+ public void handleBoundControl(final Control control, final String bindingProperty) {
+ super.handleControl(control);
+ }
+
+ @Override
+ public void handleControl(final Control control) {
+ super.handleControl(control);
+ if (control.isFocusControl()) {
+ childHasFocus = true;
+ }
+ }
+ }
+
+ @Override
protected void bindUIControl() {
if (optionsBinding != null) {
createChildren(getUIControl());
diff --git a/org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/ui/ridgets/swt/AbstractSWTRidget.java b/org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/ui/ridgets/swt/AbstractSWTRidget.java
index 8a6da90..801aac0 100644
--- a/org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/ui/ridgets/swt/AbstractSWTRidget.java
+++ b/org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/ui/ridgets/swt/AbstractSWTRidget.java
@@ -13,6 +13,7 @@ package org.eclipse.riena.ui.ridgets.swt;
import org.eclipse.core.databinding.BindingException;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.riena.ui.core.marker.HiddenMarker;
import org.eclipse.riena.ui.swt.utils.SwtUtilities;
@@ -78,7 +79,7 @@ public abstract class AbstractSWTRidget extends AbstractSWTWidgetRidget {
}
@Override
- public final boolean hasFocus() {
+ public boolean hasFocus() {
if (getUIControl() != null) {
final Control control = getUIControl();
return control.isFocusControl();