Skip to content
Snippets Groups Projects
Commit 7f1eb515 authored by Lukas Ladenberger's avatar Lukas Ladenberger
Browse files

fixed bug (checkbox and radiobutton behaviour)

parent b8e3728b
No related branches found
No related tags found
No related merge requests found
Showing with 390 additions and 346 deletions
......@@ -22,7 +22,7 @@ public class BAttributeButtonGroup extends AbstractAttribute {
@Override
public String getName() {
return "Button";
return "Group Name";
}
}
......@@ -42,4 +42,9 @@ public class CheckboxFigure extends AbstractBMotionFigure {
textLb.setForegroundColor(color);
}
public void setBtEnabled(Boolean bool) {
textLb.setEnabled(bool);
repaint();
}
}
......@@ -47,6 +47,11 @@ public class RadioButtonFigure extends AbstractBMotionFigure {
textLb.setForegroundColor(foregroundColor);
}
public void setBtEnabled(Boolean bool) {
textLb.setEnabled(bool);
repaint();
}
/*
* (non-Javadoc)
*
......
......@@ -11,6 +11,7 @@ import org.eclipse.swt.graphics.RGB;
import de.bmotionstudio.gef.editor.AttributeConstants;
import de.bmotionstudio.gef.editor.attribute.BAttributeButtonGroup;
import de.bmotionstudio.gef.editor.attribute.BAttributeChecked;
import de.bmotionstudio.gef.editor.attribute.BAttributeEnabled;
import de.bmotionstudio.gef.editor.attribute.BAttributeFalseValue;
import de.bmotionstudio.gef.editor.attribute.BAttributeText;
import de.bmotionstudio.gef.editor.attribute.BAttributeTextColor;
......@@ -42,6 +43,7 @@ public class BCheckbox extends BControl {
initAttribute(new BAttributeTextColor(new RGB(0, 0, 0)));
initAttribute(new BAttributeChecked(true));
initAttribute(new BAttributeValue(""));
initAttribute(new BAttributeEnabled(true));
initAttribute(new BAttributeButtonGroup(""));
initAttribute(new BAttributeTrueValue(""));
initAttribute(new BAttributeFalseValue(""));
......@@ -61,4 +63,15 @@ public class BCheckbox extends BControl {
}
}
@Override
public void executeEvent(String eventID) {
if (Boolean.valueOf(getAttributeValue(
AttributeConstants.ATTRIBUTE_CHECKED).toString())) {
setAttributeValue(AttributeConstants.ATTRIBUTE_CHECKED, false);
} else {
setAttributeValue(AttributeConstants.ATTRIBUTE_CHECKED, true);
}
super.executeEvent(eventID);
}
}
......@@ -12,9 +12,9 @@ import org.eclipse.swt.graphics.RGB;
import de.bmotionstudio.gef.editor.AttributeConstants;
import de.bmotionstudio.gef.editor.ButtonGroupHelper;
import de.bmotionstudio.gef.editor.attribute.BAttributeBackgroundColor;
import de.bmotionstudio.gef.editor.attribute.BAttributeButtonGroup;
import de.bmotionstudio.gef.editor.attribute.BAttributeChecked;
import de.bmotionstudio.gef.editor.attribute.BAttributeEnabled;
import de.bmotionstudio.gef.editor.attribute.BAttributeText;
import de.bmotionstudio.gef.editor.attribute.BAttributeTextColor;
import de.bmotionstudio.gef.editor.attribute.BAttributeValue;
......@@ -46,11 +46,11 @@ public class BRadioButton extends BControl {
@Override
protected void initAttributes() {
initAttribute(new BAttributeText(DEFAULT_TEXT));
initAttribute(new BAttributeBackgroundColor(new RGB(192, 192, 192)));
initAttribute(new BAttributeTextColor(new RGB(0, 0, 0)));
initAttribute(new BAttributeChecked(true));
initAttribute(new BAttributeValue(""));
initAttribute(new BAttributeButtonGroup(""));
initAttribute(new BAttributeEnabled(true));
getAttribute(AttributeConstants.ATTRIBUTE_HEIGHT).setValue(21);
getAttribute(AttributeConstants.ATTRIBUTE_HEIGHT).setEditable(false);
}
......@@ -80,4 +80,19 @@ public class BRadioButton extends BControl {
return null;
}
@Override
public void executeEvent(String eventID) {
String btgroupid = getAttributeValue(
AttributeConstants.ATTRIBUTE_BUTTONGROUP).toString();
if (!btgroupid.trim().equals("")) {
Collection<BControl> btGroup = ButtonGroupHelper
.getButtonGroup(btgroupid);
for (BControl control : btGroup) {
control.setAttributeValue(AttributeConstants.ATTRIBUTE_CHECKED, false);
}
}
setAttributeValue(AttributeConstants.ATTRIBUTE_CHECKED, true);
super.executeEvent(eventID);
}
}
......@@ -63,6 +63,7 @@ public abstract class AppAbstractEditPart extends AbstractGraphicalEditPart
if (event.getPropertyName().equals(
ButtonModel.MOUSEOVER_PROPERTY))
getFigure().setCursor(cursorHover);
}
if (event.getPropertyName()
.equals(ButtonModel.PRESSED_PROPERTY)) {
AbstractBMotionFigure f = (AbstractBMotionFigure) getFigure();
......@@ -70,7 +71,6 @@ public abstract class AppAbstractEditPart extends AbstractGraphicalEditPart
executeEvent(AttributeConstants.EVENT_MOUSECLICK);
}
}
}
};
private String[] layoutAttributes = { BControl.PROPERTY_LAYOUT,
......
......@@ -71,6 +71,9 @@ public class BCheckboxPart extends AppAbstractEditPart {
.getDefault(), rgbText));
}
if (aID.equals(AttributeConstants.ATTRIBUTE_ENABLED))
((CheckboxFigure) figure).setBtEnabled(Boolean.valueOf(value.toString()));
}
@Override
......
......@@ -78,6 +78,9 @@ public class BRadioButtonPart extends AppAbstractEditPart {
}
}
if (aID.equals(AttributeConstants.ATTRIBUTE_ENABLED))
((RadioButtonFigure) figure).setBtEnabled(Boolean.valueOf(value.toString()));
}
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment