From d6b1a47c9f4f1615a53d85614cd15ce9d11b0478 Mon Sep 17 00:00:00 2001 From: Lukas Ladenberger <lukas.ladenberger@gmx.de> Date: Tue, 13 Dec 2011 17:25:59 +0100 Subject: [PATCH] fixed bug (Checkboxes return into their original state immediately after checking/unchecking during animation) --- .../gef/editor/part/BCheckboxPart.java | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BCheckboxPart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BCheckboxPart.java index a0efb30c..21ca996c 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BCheckboxPart.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BCheckboxPart.java @@ -36,27 +36,23 @@ public class BCheckboxPart extends AppAbstractEditPart { private ChangeListener changeListener = new ChangeListener() { @Override public void handleStateChanged(ChangeEvent event) { - if (event.getPropertyName().equals(ButtonModel.PRESSED_PROPERTY)) { - - BControl control = (BControl) getModel(); - - // Recheck observer after click - control.getVisualization().getAnimation().checkObserver(); - - if (Boolean.valueOf(control.getAttributeValue( - AttributeConstants.ATTRIBUTE_CHECKED).toString())) { - control.setAttributeValue( - AttributeConstants.ATTRIBUTE_CHECKED, false); - } else { - control.setAttributeValue( - AttributeConstants.ATTRIBUTE_CHECKED, true); + AbstractBMotionFigure f = (AbstractBMotionFigure) getFigure(); + if (f.getModel().isPressed()) { + BControl control = (BControl) getModel(); + // Recheck observer after click + control.getVisualization().getAnimation().checkObserver(); + if (Boolean.valueOf(control.getAttributeValue( + AttributeConstants.ATTRIBUTE_CHECKED).toString())) { + control.setAttributeValue( + AttributeConstants.ATTRIBUTE_CHECKED, false); + } else { + control.setAttributeValue( + AttributeConstants.ATTRIBUTE_CHECKED, true); + } } - } - } - }; @Override -- GitLab