diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/AttributeConstants.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/AttributeConstants.java index 56ddf9afb27f53172c11eb238f659cb74684dda4..b0283c6bb06649d3f144ea8820366055d9087665 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/AttributeConstants.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/AttributeConstants.java @@ -51,6 +51,7 @@ public final class AttributeConstants { public static final String ATTRIBUTE_COORDINATES = "de.bmotionstudio.gef.editor.attribute.BAttributeCoordinates"; public static final String ATTRIBUTE_MISC = "de.bmotionstudio.gef.editor.attribute.BAttributeMisc"; public static final String ATTRIBUTE_MAIN = "de.bmotionstudio.gef.editor.attribute.BAttributeMain"; + public static final String ATTRIBUTE_CONNECTION = "de.bmotionstudio.gef.editor.attribute.BAttributeConnection"; public static final String EVENT_MOUSECLICK = "de.bmotionstudio.gef.editor.event.OnClickEvent"; public static final String EVENT_MOUSEDBLCLICK = "de.bmotionstudio.gef.editor.event.OnDblClickEvent"; diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/AbstractAttribute.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/AbstractAttribute.java index 0de1ef287ce66ad14499141c51fe22e03cea03e6..a274533a1e953b7fdbdf3d538da52fcba675c965 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/AbstractAttribute.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/AbstractAttribute.java @@ -31,24 +31,30 @@ public abstract class AbstractAttribute implements IPropertySource, Cloneable { private transient BControl control; private transient PropertyDescriptor propertyDescriptor; private transient Object initValue; + private transient Object defaultValue; private transient boolean editable; private transient boolean show; private transient String group; + private transient boolean isInitialized; + // The current value of the attribute private Object value; - public AbstractAttribute(Object value) { - this(value, true, true); - } - - public AbstractAttribute(Object value, boolean isEditable, - boolean showInPropertiesView) { - this.value = value; - this.initValue = value; - this.editable = isEditable; - this.show = showInPropertiesView; + public AbstractAttribute() { } + // public AbstractAttribute(Object value) { + // this(value, true, true); + // } + // + // public AbstractAttribute(Object value, boolean isEditable, + // boolean showInPropertiesView) { + // this.value = value; + // this.initValue = value; + // this.editable = isEditable; + // this.show = showInPropertiesView; + // } + private Object readResolve() { this.initValue = this.value; return this; @@ -202,4 +208,20 @@ public abstract class AbstractAttribute implements IPropertySource, Cloneable { this.control = control; } + public Object getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(Object defaultValue) { + this.defaultValue = defaultValue; + } + + public boolean isInitialized() { + return isInitialized; + } + + public void setInitialized(boolean isInitialized) { + this.isInitialized = isInitialized; + } + } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeAlpha.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeAlpha.java index fe192157564608b16cc527627ed8ff49cd13ec62..41eea7fe4cf1e7e5b45e4bb9c3663568d9a244d1 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeAlpha.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeAlpha.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.SliderPropertyDescriptor; public class BAttributeAlpha extends AbstractAttribute { - public BAttributeAlpha(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { SliderPropertyDescriptor descriptor = new SliderPropertyDescriptor( getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeBackgroundColor.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeBackgroundColor.java index 0023246f77f3519457e9c64abf7ba27698fff49f..a0fc14f98a6360befc1174041a259a3e63f8bd15 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeBackgroundColor.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeBackgroundColor.java @@ -14,10 +14,6 @@ import de.bmotionstudio.gef.editor.model.BControl; public class BAttributeBackgroundColor extends AbstractAttribute { - public BAttributeBackgroundColor(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { return new ColorPropertyDescriptor(getID(), getName()); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeBackgroundVisible.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeBackgroundVisible.java index 05c468b63454bd7836f67c8c319cb7660f76de34..32054a9bcfbcf20d3d71c5b1f8888543cea1fdd4 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeBackgroundVisible.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeBackgroundVisible.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.CheckboxPropertyDescriptor; public class BAttributeBackgroundVisible extends AbstractAttribute { - public BAttributeBackgroundVisible(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { return new CheckboxPropertyDescriptor(getID(), getName()); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeButtonGroup.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeButtonGroup.java index e15182719126fc38f4fd36bd599f1938e6f6c0f0..aefb1043c6432f9211035c47bacd2414f8e4f186 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeButtonGroup.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeButtonGroup.java @@ -11,10 +11,6 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor; public class BAttributeButtonGroup extends AbstractAttribute { - public BAttributeButtonGroup(Object value) { - super(value); - } - @Override protected PropertyDescriptor preparePropertyDescriptor() { return new TextPropertyDescriptor(getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeChecked.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeChecked.java index d3013220cac3d2a736d85297118267822590618b..de45a3afa7ef6ac7a2fd7fef8aa397bc3f4097d9 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeChecked.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeChecked.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.CheckboxPropertyDescriptor; public class BAttributeChecked extends AbstractAttribute { - public BAttributeChecked(Object value) { - super(value); - } - @Override protected PropertyDescriptor preparePropertyDescriptor() { return new CheckboxPropertyDescriptor(getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeColumns.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeColumns.java index 12a636d196f8838fb2daf5c2561d8c3aa829aae2..0ce92a69dfb946a91ed7ae400d66c5d4bc115784 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeColumns.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeColumns.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; public class BAttributeColumns extends AbstractAttribute { - public BAttributeColumns(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnection.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnection.java index 19428d8be059cc602dd29770813165943a53820a..1e5e4a1f744ca396414720aaffa89c47cbb4335f 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnection.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnection.java @@ -11,10 +11,6 @@ import org.eclipse.ui.views.properties.PropertyDescriptor; public class BAttributeConnection extends AbstractAttribute { - public BAttributeConnection(Object value) { - super(value); - } - @Override public PropertyDescriptor preparePropertyDescriptor() { PropertyDescriptor descriptor = new PropertyDescriptor(getID(), diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnectionSourceDecoration.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnectionSourceDecoration.java index 89a5c58c734618d066772afe071dc0d56dfee25b..f62678f88021e50313abdd9c669ef285a0efee00 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnectionSourceDecoration.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnectionSourceDecoration.java @@ -14,10 +14,6 @@ public class BAttributeConnectionSourceDecoration extends AbstractAttribute { public static int DECORATION_NONE = 0; public static int DECORATION_TRIANGLE = 1; - public BAttributeConnectionSourceDecoration(Object value) { - super(value); - } - @Override protected PropertyDescriptor preparePropertyDescriptor() { return new ComboBoxPropertyDescriptor(getID(), getName(), new String[] { diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnectionTargetDecoration.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnectionTargetDecoration.java index fc9f9353cddc3a0533becdac8368e2e67909b373..1e22657db49af91185ec7a3a09933c4c96255995 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnectionTargetDecoration.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnectionTargetDecoration.java @@ -14,10 +14,6 @@ public class BAttributeConnectionTargetDecoration extends AbstractAttribute { public static int DECORATION_NONE = 0; public static int DECORATION_TRIANGLE = 1; - public BAttributeConnectionTargetDecoration(Object value) { - super(value); - } - @Override protected PropertyDescriptor preparePropertyDescriptor() { return new ComboBoxPropertyDescriptor(getID(), getName(), new String[] { diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeCoordinates.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeCoordinates.java index 2aeb359d027bd32783119b814a50786e7f8c476b..01447dc77778aacadc5c49759927c443c0fae044 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeCoordinates.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeCoordinates.java @@ -14,10 +14,6 @@ import de.bmotionstudio.gef.editor.AttributeConstants; public class BAttributeCoordinates extends AbstractAttribute { - public BAttributeCoordinates(Object value) { - super(value); - } - @Override public PropertyDescriptor preparePropertyDescriptor() { PropertyDescriptor descriptor = new PropertyDescriptor(getID(), diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeCustom.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeCustom.java index a2ff6fa20caa0970d0519bad991a4f0b1a0f93c6..3342762ea41d5a1bd5c15dcdd10bfaa5de7c65a1 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeCustom.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeCustom.java @@ -11,10 +11,6 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor; public class BAttributeCustom extends AbstractAttribute { - public BAttributeCustom(Object value) { - super(value); - } - @Override public PropertyDescriptor preparePropertyDescriptor() { return new TextPropertyDescriptor(getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeDirection.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeDirection.java index 899f70124e929d6150108db251f236ec33856895..40f9418e0d102f3fcef33835d9b8bf4e5032af8f 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeDirection.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeDirection.java @@ -16,10 +16,6 @@ public class BAttributeDirection extends AbstractAttribute { public static final int WEST = 2; public static final int EAST = 3; - public BAttributeDirection(Object value) { - super(value); - } - @Override protected PropertyDescriptor preparePropertyDescriptor() { return new ComboBoxPropertyDescriptor(getID(), getName(), new String[] { diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeEnabled.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeEnabled.java index 170e1dfde4ec606c0932fe2fcb03fd8eb0ec7b0e..c8ae7422abfbac9531e3c50dc7a1fd5e7edc880d 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeEnabled.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeEnabled.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.CheckboxPropertyDescriptor; public class BAttributeEnabled extends AbstractAttribute { - public BAttributeEnabled(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { return new CheckboxPropertyDescriptor(getID(), getName()); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFalseValue.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFalseValue.java index 74a13b83fc362de800c0fcc8f04be96177e67318..6ea18bb04de84c3ce408fca33826389887caab6e 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFalseValue.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFalseValue.java @@ -5,10 +5,6 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor; public class BAttributeFalseValue extends AbstractAttribute { - public BAttributeFalseValue(Object value) { - super(value); - } - @Override public PropertyDescriptor preparePropertyDescriptor() { return new TextPropertyDescriptor(getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFillType.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFillType.java index 81abe496879115fa02f1c2bf99682cd727f57344..bd57f9d8331fced4d4615e54ca82a798d563b78f 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFillType.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFillType.java @@ -16,10 +16,6 @@ public class BAttributeFillType extends AbstractAttribute { public static final int SHADED = 2; public static final int GRADIENT = 3; - public BAttributeFillType(Object value) { - super(value); - } - @Override protected PropertyDescriptor preparePropertyDescriptor() { return new ComboBoxPropertyDescriptor(getID(), getName(), new String[] { diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFont.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFont.java index 85986759f8aed85204a780a1d4f54082296b91f0..9c89418c917993b50709ce32f80c38eace929c38 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFont.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFont.java @@ -12,10 +12,6 @@ import de.bmotionstudio.gef.editor.property.FontPropertyDescriptor; public class BAttributeFont extends AbstractAttribute { - public BAttributeFont(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { return new FontPropertyDescriptor(getID(), getName()); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeForegroundColor.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeForegroundColor.java index cf4abf23f94cd929925ae936b74ba1c6aeae5888..8a17fe1387f029e02c9aeb4e83712038a6015974 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeForegroundColor.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeForegroundColor.java @@ -14,10 +14,6 @@ import de.bmotionstudio.gef.editor.model.BControl; public class BAttributeForegroundColor extends AbstractAttribute { - public BAttributeForegroundColor(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { return new ColorPropertyDescriptor(getID(), getName()); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeHeight.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeHeight.java index 5947e5cd808c696ae11196e1b7eddc77c2b98fb7..b0a6191af1cacc545bef905f191f6f5a4368dc83 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeHeight.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeHeight.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; public class BAttributeHeight extends AbstractAttribute { - public BAttributeHeight(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeID.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeID.java index b181122cdbd830bab5682d75b05d494f0fb8e00d..2af7dadd08c395f66de3c039e3f0589e91026b29 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeID.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeID.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.model.BControl; public class BAttributeID extends AbstractAttribute { - public BAttributeID(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { TextPropertyDescriptor descriptor = new TextPropertyDescriptor(getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeImage.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeImage.java index 86f1d299bf2ef2cf3811c6eee0916e062ae9605f..d3938ae21abf2fa4daf34d75e2e98360323fb80a 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeImage.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeImage.java @@ -16,10 +16,6 @@ import de.bmotionstudio.gef.editor.property.ImagePropertyDescriptor; public class BAttributeImage extends AbstractAttribute { - public BAttributeImage(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { return new ImagePropertyDescriptor(getID(), getName()); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLabel.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLabel.java index a3f962a2702da02a2554dd4cb6f2b2476904edda..47b72fb46604377bf1413358d8da5e0a73afc405 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLabel.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLabel.java @@ -11,10 +11,6 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor; public class BAttributeLabel extends AbstractAttribute { - public BAttributeLabel(Object value) { - super(value); - } - @Override protected PropertyDescriptor preparePropertyDescriptor() { return new TextPropertyDescriptor(getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLineStyle.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLineStyle.java index 9e0132d7d607e9eb4d1f08f382ea7894a5489e9b..262e5fd9f207c86ed9ac5f8efa634baf4a574741 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLineStyle.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLineStyle.java @@ -17,10 +17,6 @@ public class BAttributeLineStyle extends AbstractAttribute { public static final int DASHED_DOTTED_CONNECTION = 3; public static final int DASHED_DOTTED_DOTTED_CONNECTION = 4; - public BAttributeLineStyle(Object value) { - super(value); - } - @Override protected PropertyDescriptor preparePropertyDescriptor() { return new ComboBoxPropertyDescriptor(getID(), getName(), new String[] { diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLineWidth.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLineWidth.java index b9503fbf6287dbbfeb8d0729fd759c842cb9e728..b40020c53d0e67dd551de27b0b8da041a677969e 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLineWidth.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLineWidth.java @@ -7,10 +7,6 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; public class BAttributeLineWidth extends AbstractAttribute { - public BAttributeLineWidth(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeMain.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeMain.java index 2870f97b871646f1bc141b5c33f76b3dde21b219..8429e40309d287c54bd43f4c5084aa2202f6b988 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeMain.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeMain.java @@ -11,10 +11,6 @@ import org.eclipse.ui.views.properties.PropertyDescriptor; public class BAttributeMain extends AbstractAttribute { - public BAttributeMain(Object value) { - super(value); - } - @Override public PropertyDescriptor preparePropertyDescriptor() { PropertyDescriptor descriptor = new PropertyDescriptor(getID(), diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeMisc.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeMisc.java index 658f9e91b231ea21d6383cc32298f73424977693..c32fa2681fc10cd3b7feec57da712a1ab11d5a1e 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeMisc.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeMisc.java @@ -11,10 +11,6 @@ import org.eclipse.ui.views.properties.PropertyDescriptor; public class BAttributeMisc extends AbstractAttribute { - public BAttributeMisc(Object value) { - super(value); - } - @Override public PropertyDescriptor preparePropertyDescriptor() { PropertyDescriptor descriptor = new PropertyDescriptor(getID(), diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOffsetH.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOffsetH.java index f173bbfb605a0c922380c2e9db6bae83e9eba08f..f91d9446c4d5e770093a6b1fa33d1f9346dcf678 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOffsetH.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOffsetH.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; public class BAttributeOffsetH extends AbstractAttribute { - public BAttributeOffsetH(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOffsetV.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOffsetV.java index 9fafedfc1c7588060e666ac95d51344bc3c9dfc5..6c8ef25c738659a4104e00e83cbdfd2510197994 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOffsetV.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOffsetV.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; public class BAttributeOffsetV extends AbstractAttribute { - public BAttributeOffsetV(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOrientation.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOrientation.java index 365995bcfef2ae6b62f13a29989d01d5e38d0856..ac0656a50f6ed5df19491f483d73d4583f105c00 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOrientation.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOrientation.java @@ -8,10 +8,6 @@ public class BAttributeOrientation extends AbstractAttribute { public static final int HORIZONTAL = 0; public static final int VERTICAL = 1; - public BAttributeOrientation(Object value) { - super(value); - } - @Override protected PropertyDescriptor preparePropertyDescriptor() { return new ComboBoxPropertyDescriptor(getID(), getName(), new String[] { diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOutlineAlpha.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOutlineAlpha.java index f583a8f03f37c48592c2358a6217a1f2b347b7b3..218e74deb39827dcd8360fab13c0945df4e8d301 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOutlineAlpha.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOutlineAlpha.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.SliderPropertyDescriptor; public class BAttributeOutlineAlpha extends AbstractAttribute { - public BAttributeOutlineAlpha(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { SliderPropertyDescriptor descriptor = new SliderPropertyDescriptor( getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeRows.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeRows.java index b3df0f422b0fab661a49ac893d785b2c3cda0a00..dbd8fdd42d5ae5f3ed1c6f3c9c606241e70512e9 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeRows.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeRows.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; public class BAttributeRows extends AbstractAttribute { - public BAttributeRows(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeShape.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeShape.java index b2200082614890de744321a1e8f86a278dcead36..48547232461d0040a8621ef9bab07845280ac066 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeShape.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeShape.java @@ -16,10 +16,6 @@ public class BAttributeShape extends AbstractAttribute { public static final int SHAPE_TRIANGLE = 2; public static final int SHAPE_DIAMOND = 3; - public BAttributeShape(Object value) { - super(value); - } - @Override protected PropertyDescriptor preparePropertyDescriptor() { return new ComboBoxPropertyDescriptor(getID(), getName(), new String[] { diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeSize.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeSize.java index 1920190f623c1673e57861794d8c816dc21a6796..6244b248374f1b34a0529c6417e5353b2794bdc3 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeSize.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeSize.java @@ -14,9 +14,7 @@ import de.bmotionstudio.gef.editor.AttributeConstants; public class BAttributeSize extends AbstractAttribute { - public BAttributeSize(Object value) { - super(value); - } + public static final String ID = "de.bmotionstudio.gef.editor.attribute.BAttributeSize"; @Override public PropertyDescriptor preparePropertyDescriptor() { diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeText.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeText.java index 97d071630c2c0df0fdc1159ecb2d74de2f47fd23..b5c18d5cb2fd25574d1d944cdb7a07205c259bc4 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeText.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeText.java @@ -11,10 +11,6 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor; public class BAttributeText extends AbstractAttribute { - public BAttributeText(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { return new TextPropertyDescriptor(getID(), getName()); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeTextColor.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeTextColor.java index dbba315d244d7655012a87b6072cc0db9ca37eda..d6e6465095ab97d39429c1884d3c94146979f78d 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeTextColor.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeTextColor.java @@ -14,10 +14,6 @@ import de.bmotionstudio.gef.editor.model.BControl; public class BAttributeTextColor extends AbstractAttribute { - public BAttributeTextColor(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { return new ColorPropertyDescriptor(getID(), getName()); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeTrueValue.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeTrueValue.java index 3d58d1fbd9b9645fb4df65b4b0ed72f3ee1adb24..27ef95ab61e8058fcaa4ac0074a6263f50f5b507 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeTrueValue.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeTrueValue.java @@ -11,10 +11,6 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor; public class BAttributeTrueValue extends AbstractAttribute { - public BAttributeTrueValue(Object value) { - super(value); - } - @Override public PropertyDescriptor preparePropertyDescriptor() { return new TextPropertyDescriptor(getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeValue.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeValue.java index 2b0aaf110088d54fde29b51a5fc1f5125ba80b54..f6f62ad7e605d95ced4751aa3c67008d825f3c1b 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeValue.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeValue.java @@ -11,10 +11,6 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor; public class BAttributeValue extends AbstractAttribute { - public BAttributeValue(Object value) { - super(value); - } - @Override protected PropertyDescriptor preparePropertyDescriptor() { return new TextPropertyDescriptor(getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeVisible.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeVisible.java index bbf89608770e925157c6fcf401e58fcd3338d59b..de3ca30f252777eb3dfb15629c0e776f5a362535 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeVisible.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeVisible.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.CheckboxPropertyDescriptor; public class BAttributeVisible extends AbstractAttribute { - public BAttributeVisible(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { return new CheckboxPropertyDescriptor(getID(), getName()); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeWidth.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeWidth.java index 34844653d9226fbca2ab5020f527fb7d43718cc0..7885372386ae8b8f99b8f7ab76881eb4f88f2ff4 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeWidth.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeWidth.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; public class BAttributeWidth extends AbstractAttribute { - public BAttributeWidth(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeX.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeX.java index e3f911398536a6f4a871fdd8b037608462a064a0..3494ad60a75d272f602f573076858a504e1251e4 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeX.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeX.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; public class BAttributeX extends AbstractAttribute { - public BAttributeX(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeY.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeY.java index 45c5959a7837d01f33fe22d722db436167b3d7fa..1ac072819bf8e01d9e6f04d04d8a04b3941729cc 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeY.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeY.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; public class BAttributeY extends AbstractAttribute { - public BAttributeY(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/AppEditLayoutPolicy.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/AppEditLayoutPolicy.java index d6303ee0e842e868e81c578b68450b0d9e0d1303..1c9a3355a19ffaa07902d930897a020fb5620013 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/AppEditLayoutPolicy.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/AppEditLayoutPolicy.java @@ -147,6 +147,7 @@ public class AppEditLayoutPolicy extends XYLayoutEditPolicy { (BControl) getHost().getModel()); Rectangle constraint = (Rectangle) getConstraintFor(request); + constraint.x = (constraint.x < 0) ? 0 : constraint.x; constraint.y = (constraint.y < 0) ? 0 : constraint.y; @@ -157,19 +158,21 @@ public class AppEditLayoutPolicy extends XYLayoutEditPolicy { .getAttributes().get( AttributeConstants.ATTRIBUTE_HEIGHT); - if (atrWidth != null && !atrWidth.isEditable()) { - constraint.width = Integer.valueOf(atrWidth.getValue() - .toString()); + Integer cWidth = Integer.valueOf(atrWidth.getDefaultValue() + .toString()); + if (!atrWidth.isEditable()) { + constraint.width = cWidth; } else { - constraint.width = (constraint.width <= 0) ? 100 + constraint.width = (constraint.width <= 0) ? cWidth : constraint.width; } - if (atrHeight != null && !atrHeight.isEditable()) { - constraint.height = Integer.valueOf(atrHeight.getValue() - .toString()); + Integer cHeight = Integer.valueOf(atrHeight.getDefaultValue() + .toString()); + if (!atrHeight.isEditable()) { + constraint.height = cHeight; } else { - constraint.height = (constraint.height <= 0) ? 100 + constraint.height = (constraint.height <= 0) ? cHeight : constraint.height; } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/internal/BControlPropertySource.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/internal/BControlPropertySource.java index 0dffa83af3bf68c5c5a3964c8eb79464fb1266e8..625d75213e4d709338b1c3cacff9411096d350f1 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/internal/BControlPropertySource.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/internal/BControlPropertySource.java @@ -19,9 +19,8 @@ public class BControlPropertySource extends AbstractAttribute { private BAttributeMisc miscAttribute; public BControlPropertySource(BControl control) { - super(null); this.control = control; - this.miscAttribute = new BAttributeMisc(null); + this.miscAttribute = new BAttributeMisc(); addChild(this.miscAttribute); init(); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BButton.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BButton.java index 4e504fe9f8b582312cfad166c773d3062fcec261..2e9945b3b10ea689de1eb2f495148a4a68f61428 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BButton.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BButton.java @@ -9,10 +9,6 @@ package de.bmotionstudio.gef.editor.model; import org.eclipse.swt.graphics.RGB; import de.bmotionstudio.gef.editor.AttributeConstants; -import de.bmotionstudio.gef.editor.attribute.BAttributeBackgroundColor; -import de.bmotionstudio.gef.editor.attribute.BAttributeEnabled; -import de.bmotionstudio.gef.editor.attribute.BAttributeText; -import de.bmotionstudio.gef.editor.attribute.BAttributeTextColor; /** * @author Lukas Ladenberger @@ -35,12 +31,13 @@ public class BButton 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 BAttributeEnabled(true)); - getAttribute(AttributeConstants.ATTRIBUTE_HEIGHT).setValue(25); - getAttribute(AttributeConstants.ATTRIBUTE_WIDTH).setValue(100); + initAttribute(AttributeConstants.ATTRIBUTE_TEXT, DEFAULT_TEXT); + initAttribute(AttributeConstants.ATTRIBUTE_BACKGROUND_COLOR, new RGB( + 192, 192, 192)); + initAttribute(AttributeConstants.ATTRIBUTE_TEXT_COLOR, new RGB(0, 0, 0)); + initAttribute(AttributeConstants.ATTRIBUTE_ENABLED, true); + initAttribute(AttributeConstants.ATTRIBUTE_HEIGHT, 25); + initAttribute(AttributeConstants.ATTRIBUTE_WIDTH, 100); } } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BCheckbox.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BCheckbox.java index 32b0235053ac80f1e731fd4c3a05c022bb29aeb2..39cc02f81a4a35c00c4b83f9465eea0feff746aa 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BCheckbox.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BCheckbox.java @@ -9,12 +9,6 @@ package de.bmotionstudio.gef.editor.model; import org.eclipse.swt.graphics.RGB; import de.bmotionstudio.gef.editor.AttributeConstants; -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; -import de.bmotionstudio.gef.editor.attribute.BAttributeTrueValue; /** * @author Lukas Ladenberger @@ -37,14 +31,14 @@ public class BCheckbox extends BControl { @Override protected void initAttributes() { - initAttribute(new BAttributeText(DEFAULT_TEXT)); - initAttribute(new BAttributeTextColor(new RGB(0, 0, 0))); - initAttribute(new BAttributeChecked(true)); - initAttribute(new BAttributeEnabled(true)); - initAttribute(new BAttributeTrueValue("")); - initAttribute(new BAttributeFalseValue("")); - getAttribute(AttributeConstants.ATTRIBUTE_HEIGHT).setValue(21); - getAttribute(AttributeConstants.ATTRIBUTE_HEIGHT).setEditable(false); + initAttribute(AttributeConstants.ATTRIBUTE_TEXT, DEFAULT_TEXT); + initAttribute(AttributeConstants.ATTRIBUTE_TEXT_COLOR, new RGB(0, 0, 0)); + initAttribute(AttributeConstants.ATTRIBUTE_CHECKED, true); + initAttribute(AttributeConstants.ATTRIBUTE_ENABLED, true); + initAttribute(AttributeConstants.ATTRIBUTE_TRUEVALUE, ""); + initAttribute(AttributeConstants.ATTRIBUTE_FALSEVALUE, ""); + initAttribute(AttributeConstants.ATTRIBUTE_HEIGHT, 21, false, false, + AttributeConstants.ATTRIBUTE_SIZE); } @Override diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BComposite.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BComposite.java index bd27178b389ce230c92a0be75cc1d86651f0d9fd..8bfb44d6867ec5b7d26dbc8204373114e8973410 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BComposite.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BComposite.java @@ -8,8 +8,7 @@ package de.bmotionstudio.gef.editor.model; import org.eclipse.swt.graphics.RGB; -import de.bmotionstudio.gef.editor.attribute.BAttributeBackgroundColor; -import de.bmotionstudio.gef.editor.attribute.BAttributeImage; +import de.bmotionstudio.gef.editor.AttributeConstants; /** * @author Lukas Ladenberger @@ -30,8 +29,9 @@ public class BComposite extends BControl { @Override protected void initAttributes() { - initAttribute(new BAttributeBackgroundColor(new RGB(192, 192, 192))); - initAttribute(new BAttributeImage(null)); + initAttribute(AttributeConstants.ATTRIBUTE_BACKGROUND_COLOR, new RGB( + 192, 192, 192)); + initAttribute(AttributeConstants.ATTRIBUTE_IMAGE, null); } @Override diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BConnection.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BConnection.java index 7bc29f41187bf6c9727fdae329b3c39956eebf2a..048da4cfc3c726f28410804f93b96adf8ba02e4f 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BConnection.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BConnection.java @@ -8,14 +8,10 @@ package de.bmotionstudio.gef.editor.model; import org.eclipse.swt.graphics.RGB; -import de.bmotionstudio.gef.editor.attribute.BAttributeConnection; +import de.bmotionstudio.gef.editor.AttributeConstants; import de.bmotionstudio.gef.editor.attribute.BAttributeConnectionSourceDecoration; import de.bmotionstudio.gef.editor.attribute.BAttributeConnectionTargetDecoration; -import de.bmotionstudio.gef.editor.attribute.BAttributeForegroundColor; -import de.bmotionstudio.gef.editor.attribute.BAttributeLabel; import de.bmotionstudio.gef.editor.attribute.BAttributeLineStyle; -import de.bmotionstudio.gef.editor.attribute.BAttributeLineWidth; -import de.bmotionstudio.gef.editor.internal.BControlPropertySource; public class BConnection extends BControl { @@ -121,21 +117,24 @@ public class BConnection extends BControl { @Override protected void initAttributes() { - BAttributeConnection bAttributeConnection = new BAttributeConnection( - null); - initAttribute(bAttributeConnection, BControlPropertySource.ROOT); - initAttribute(new BAttributeLineWidth(1), bAttributeConnection); - initAttribute(new BAttributeLineStyle( - BAttributeLineStyle.SOLID_CONNECTION), bAttributeConnection); - initAttribute(new BAttributeForegroundColor(new RGB(0, 0, 0)), - bAttributeConnection); - initAttribute(new BAttributeConnectionSourceDecoration( - BAttributeConnectionSourceDecoration.DECORATION_NONE), - bAttributeConnection); - initAttribute(new BAttributeConnectionTargetDecoration( - BAttributeConnectionTargetDecoration.DECORATION_NONE), - bAttributeConnection); - initAttribute(new BAttributeLabel("Label..."), bAttributeConnection); + initAttribute(AttributeConstants.ATTRIBUTE_CONNECTION, null); + initAttribute(AttributeConstants.ATTRIBUTE_LINEWIDTH, 1, + AttributeConstants.ATTRIBUTE_CONNECTION); + initAttribute(AttributeConstants.ATTRIBUTE_LINESTYLE, + BAttributeLineStyle.SOLID_CONNECTION, + AttributeConstants.ATTRIBUTE_CONNECTION); + initAttribute(AttributeConstants.ATTRIBUTE_FOREGROUND_COLOR, new RGB(0, + 0, 0), AttributeConstants.ATTRIBUTE_CONNECTION); + initAttribute( + AttributeConstants.ATTRIBUTE_CONNECTION_SOURCE_DECORATION, + BAttributeConnectionSourceDecoration.DECORATION_NONE, + AttributeConstants.ATTRIBUTE_CONNECTION); + initAttribute( + AttributeConstants.ATTRIBUTE_CONNECTION_TARGET_DECORATION, + BAttributeConnectionTargetDecoration.DECORATION_NONE, + AttributeConstants.ATTRIBUTE_CONNECTION); + initAttribute(AttributeConstants.ATTRIBUTE_LABEL, "Label...", + AttributeConstants.ATTRIBUTE_CONNECTION); } } \ No newline at end of file diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BControl.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BControl.java index 0af0557d5e5d946e0e4a40d39b66a0dbc0f764d6..9ca33e48a7e3128bc12551ae8c8f801dc84041e9 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BControl.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BControl.java @@ -29,15 +29,6 @@ import de.bmotionstudio.gef.editor.AttributeConstants; import de.bmotionstudio.gef.editor.BMotionEditorPlugin; import de.bmotionstudio.gef.editor.BMotionStudioImage; import de.bmotionstudio.gef.editor.attribute.AbstractAttribute; -import de.bmotionstudio.gef.editor.attribute.BAttributeCoordinates; -import de.bmotionstudio.gef.editor.attribute.BAttributeCustom; -import de.bmotionstudio.gef.editor.attribute.BAttributeHeight; -import de.bmotionstudio.gef.editor.attribute.BAttributeID; -import de.bmotionstudio.gef.editor.attribute.BAttributeSize; -import de.bmotionstudio.gef.editor.attribute.BAttributeVisible; -import de.bmotionstudio.gef.editor.attribute.BAttributeWidth; -import de.bmotionstudio.gef.editor.attribute.BAttributeX; -import de.bmotionstudio.gef.editor.attribute.BAttributeY; import de.bmotionstudio.gef.editor.internal.BControlPropertySource; import de.bmotionstudio.gef.editor.observer.IObserverListener; import de.bmotionstudio.gef.editor.observer.Observer; @@ -102,6 +93,14 @@ public abstract class BControl implements IAdaptable, Cloneable { /** Property ID to use when the list of incoming connections is modified. */ public static final String TARGET_CONNECTIONS_PROP = "BMS.TargetConn"; + public static final String[] standardAttributes = { + AttributeConstants.ATTRIBUTE_X, + AttributeConstants.ATTRIBUTE_Y, AttributeConstants.ATTRIBUTE_WIDTH, + AttributeConstants.ATTRIBUTE_HEIGHT, + AttributeConstants.ATTRIBUTE_ID, + AttributeConstants.ATTRIBUTE_CUSTOM, + AttributeConstants.ATTRIBUTE_VISIBLE }; + public BControl(Visualization visualization) { this.visualization = visualization; this.children = new BControlList(); @@ -172,7 +171,17 @@ public abstract class BControl implements IAdaptable, Cloneable { private void init() { - // Init ID + // Init custom control attributes + initAttributes(); + + // Init standard control attributes + initStandardAttributes(); + + } + + private void initStandardAttributes() { + + // Init unique ID String ID; if (this instanceof Visualization) ID = "visualization"; @@ -180,25 +189,45 @@ public abstract class BControl implements IAdaptable, Cloneable { ID = UUID.randomUUID().toString(); else ID = (visualization.getMaxIDString(type)); - initAttribute(new BAttributeID(ID), AbstractAttribute.ROOT); - - // Init location and dimension attributes - BAttributeCoordinates coordinatesAtr = new BAttributeCoordinates(null); - initAttribute(coordinatesAtr, AbstractAttribute.ROOT); - initAttribute(new BAttributeX(100), coordinatesAtr); - initAttribute(new BAttributeY(100), coordinatesAtr); - - BAttributeSize sizeAtr = new BAttributeSize(null); - initAttribute(sizeAtr, AbstractAttribute.ROOT); - initAttribute(new BAttributeWidth(100), sizeAtr); - initAttribute(new BAttributeHeight(100), sizeAtr); + initAttribute(AttributeConstants.ATTRIBUTE_ID, ID, + AbstractAttribute.ROOT); + + initAttribute(AttributeConstants.ATTRIBUTE_MISC, "", + AbstractAttribute.ROOT); + + // initAttribute(new BAttributeID(ID), AbstractAttribute.ROOT); + + // Init location and size attributes + initAttribute(AttributeConstants.ATTRIBUTE_COORDINATES, null, + AbstractAttribute.ROOT); + initAttribute(AttributeConstants.ATTRIBUTE_X, 100, + AttributeConstants.ATTRIBUTE_COORDINATES); + initAttribute(AttributeConstants.ATTRIBUTE_Y, 100, + AttributeConstants.ATTRIBUTE_COORDINATES); + + // BAttributeCoordinates coordinatesAtr = new + // BAttributeCoordinates(null); + // initAttribute(coordinatesAtr, AbstractAttribute.ROOT); + // initAttribute(new BAttributeX(100), coordinatesAtr); + // initAttribute(new BAttributeY(100), coordinatesAtr); + + initAttribute(AttributeConstants.ATTRIBUTE_SIZE, null, + AbstractAttribute.ROOT); + initAttribute(AttributeConstants.ATTRIBUTE_WIDTH, 100, + AttributeConstants.ATTRIBUTE_SIZE); + initAttribute(AttributeConstants.ATTRIBUTE_HEIGHT, 100, + AttributeConstants.ATTRIBUTE_SIZE); + + // BAttributeSize sizeAtr = new BAttributeSize(null); + // initAttribute(sizeAtr, AbstractAttribute.ROOT); + // initAttribute(new BAttributeWidth(100), sizeAtr); + // initAttribute(new BAttributeHeight(100), sizeAtr); // Init visible and this attribute - initAttribute(new BAttributeVisible(true), AbstractAttribute.ROOT); - initAttribute(new BAttributeCustom(""), AbstractAttribute.ROOT); - - // Init custom control attributes - initAttributes(); + initAttribute(AttributeConstants.ATTRIBUTE_VISIBLE, true, + AbstractAttribute.ROOT); + initAttribute(AttributeConstants.ATTRIBUTE_CUSTOM, 100, + AbstractAttribute.ROOT); } @@ -738,26 +767,103 @@ public abstract class BControl implements IAdaptable, Cloneable { public abstract String getType(); - protected void initAttribute(AbstractAttribute atr) { - AbstractAttribute matr = getAttributes().get(atr.getID()); - if (matr != null) { - matr.setEditable(atr.isEditable()); - matr.setGroup(atr.getGroup()); - matr.setShow(atr.show()); - } else { - getAttributes().put(atr.getID(), atr); - } + protected void initAttribute(String id, Object defaultValue) { + initAttribute(id, defaultValue, true, true, + AttributeConstants.ATTRIBUTE_MISC); } - protected void initAttribute(AbstractAttribute atr, AbstractAttribute group) { - initAttribute(atr, group.getClass().getName()); + protected void initAttribute(String id, Object defaultValue, String groupID) { + initAttribute(id, defaultValue, true, true, groupID); } - protected void initAttribute(AbstractAttribute atr, String group) { - atr.setGroup(group); - initAttribute(atr); + protected void initAttribute(String id, Object defaultValue, + boolean editable, boolean show) { + initAttribute(id, defaultValue, editable, show, + AttributeConstants.ATTRIBUTE_MISC); } + protected void initAttribute(String id, Object defaultValue, + boolean editable, boolean show, String groupID) { + + AbstractAttribute atr = getAttribute(id); + + // If no attribute exists yet, create a new one and set the value + if (atr == null) { + atr = (AbstractAttribute) reflectiveGet(id); + if (atr != null) { + atr.setValue(defaultValue); + getAttributes().put(atr.getID(), atr); + } else { + return; + } + } + + if (!atr.isInitialized()) { + atr.setDefaultValue(defaultValue); + atr.setGroup(groupID); + atr.setEditable(editable); + atr.setShow(show); + atr.setInitialized(true); + } + + } + + // protected void initAttribute(AbstractAttribute atr) { + // AbstractAttribute matr = getAttributes().get(atr.getID()); + // if (matr != null) { + // matr.setEditable(atr.isEditable()); + // matr.setGroup(atr.getGroup()); + // matr.setShow(atr.show()); + // matr.setDefaultValue(atr.getValue()); + // } else { + // atr.setDefaultValue(atr.getValue()); + // getAttributes().put(atr.getID(), atr); + // } + // } + + private Object reflectiveGet(String className) { + Object newInstance = null; + try { + Class<?> forName = Class.forName(className); + newInstance = forName.newInstance(); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (InstantiationException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + return newInstance; + } + + // protected void initAttribute(AbstractAttribute atr, AbstractAttribute + // group) { + // initAttribute(atr, group.getClass().getName()); + // } + // + // protected void initAttribute(AbstractAttribute atr, String group) { + // atr.setGroup(group); + // initAttribute(atr); + // } + // + // protected void initAttribute(AbstractAttribute atr, boolean editable, + // boolean show) { + // atr.setEditable(editable); + // atr.setShow(show); + // initAttribute(atr); + // } + // + // protected void initAttribute(AbstractAttribute atr, boolean editable) { + // atr.setEditable(editable); + // initAttribute(atr); + // } + // + // protected void initAttribute(AbstractAttribute atr, String group, + // boolean editable) { + // atr.setEditable(editable); + // initAttribute(atr, group); + // } + public boolean canHaveChildren() { return false; } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BImage.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BImage.java index 56bfeb04b8aaed27b1f8b8973aebc1d2a99e4468..4a62e4490f480b66d861cb8c90b6d7c657087b1b 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BImage.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BImage.java @@ -6,7 +6,7 @@ package de.bmotionstudio.gef.editor.model; -import de.bmotionstudio.gef.editor.attribute.BAttributeImage; +import de.bmotionstudio.gef.editor.AttributeConstants; /** * @author Lukas Ladenberger @@ -27,7 +27,7 @@ public class BImage extends BControl { @Override protected void initAttributes() { - initAttribute(new BAttributeImage(null)); + initAttribute(AttributeConstants.ATTRIBUTE_IMAGE, null); } } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BRadioButton.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BRadioButton.java index a05d99e1161b2e256d6e214ab911cd01dbb3a40f..d4fb6291a82a2e261e7235f4c38952ad2a666c26 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BRadioButton.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BRadioButton.java @@ -12,12 +12,6 @@ import org.eclipse.swt.graphics.RGB; import de.bmotionstudio.gef.editor.AttributeConstants; import de.bmotionstudio.gef.editor.ButtonGroupHelper; -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; /** * @author Lukas Ladenberger @@ -45,14 +39,14 @@ public class BRadioButton extends BControl { @Override protected void initAttributes() { - initAttribute(new BAttributeText(DEFAULT_TEXT)); - 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); + initAttribute(AttributeConstants.ATTRIBUTE_TEXT, DEFAULT_TEXT); + initAttribute(AttributeConstants.ATTRIBUTE_TEXT_COLOR, new RGB(0, 0, 0)); + initAttribute(AttributeConstants.ATTRIBUTE_CHECKED, true); + initAttribute(AttributeConstants.ATTRIBUTE_ENABLED, true); + initAttribute(AttributeConstants.ATTRIBUTE_VALUE, ""); + initAttribute(AttributeConstants.ATTRIBUTE_BUTTONGROUP, ""); + initAttribute(AttributeConstants.ATTRIBUTE_HEIGHT, 21, false, false, + AttributeConstants.ATTRIBUTE_SIZE); } @Override diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BShape.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BShape.java index 41acfd9a9e617e68f29573b442f1dc28934534ea..91d912289965f1aff6955b06b639110a2fdd1195 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BShape.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BShape.java @@ -11,14 +11,9 @@ import org.eclipse.swt.graphics.RGB; import de.bmotionstudio.gef.editor.AttributeConstants; import de.bmotionstudio.gef.editor.BMotionStudioImage; -import de.bmotionstudio.gef.editor.attribute.BAttributeAlpha; -import de.bmotionstudio.gef.editor.attribute.BAttributeBackgroundColor; import de.bmotionstudio.gef.editor.attribute.BAttributeDirection; import de.bmotionstudio.gef.editor.attribute.BAttributeFillType; -import de.bmotionstudio.gef.editor.attribute.BAttributeForegroundColor; -import de.bmotionstudio.gef.editor.attribute.BAttributeImage; import de.bmotionstudio.gef.editor.attribute.BAttributeOrientation; -import de.bmotionstudio.gef.editor.attribute.BAttributeOutlineAlpha; import de.bmotionstudio.gef.editor.attribute.BAttributeShape; /** @@ -45,16 +40,21 @@ public class BShape extends BControl { @Override protected void initAttributes() { - initAttribute(new BAttributeBackgroundColor(new RGB(255, 0, 0))); - initAttribute(new BAttributeForegroundColor(new RGB(0, 0, 0))); - initAttribute(new BAttributeImage(null)); - initAttribute(new BAttributeAlpha(255)); - initAttribute(new BAttributeOutlineAlpha(0)); - initAttribute(new BAttributeShape(BAttributeShape.SHAPE_RECTANGLE)); - initAttribute(new BAttributeOrientation( - BAttributeOrientation.HORIZONTAL)); - initAttribute(new BAttributeDirection(BAttributeDirection.NORTH)); - initAttribute(new BAttributeFillType(BAttributeFillType.FILLED)); + initAttribute(AttributeConstants.ATTRIBUTE_BACKGROUND_COLOR, new RGB( + 255, 0, 0)); + initAttribute(AttributeConstants.ATTRIBUTE_FOREGROUND_COLOR, new RGB(0, + 0, 0)); + initAttribute(AttributeConstants.ATTRIBUTE_IMAGE, null); + initAttribute(AttributeConstants.ATTRIBUTE_ALPHA, 255); + initAttribute(AttributeConstants.ATTRIBUTE_OUTLINEALPHA, 0); + initAttribute(AttributeConstants.ATTRIBUTE_SHAPE, + BAttributeShape.SHAPE_RECTANGLE); + initAttribute(AttributeConstants.ATTRIBUTE_ORIENTATION, + BAttributeOrientation.HORIZONTAL); + initAttribute(AttributeConstants.ATTRIBUTE_DIRECTION, + BAttributeDirection.NORTH); + initAttribute(AttributeConstants.ATTRIBUTE_FILLTYPE, + BAttributeFillType.FILLED); } @Override diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTable.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTable.java index 0ff983a25693e6393cbff7f955beabbbab333315..cf3f7cb1c146632586d4fcc39c08daf0333c6c8a 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTable.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTable.java @@ -4,9 +4,7 @@ import org.eclipse.draw2d.ColorConstants; import org.eclipse.draw2d.geometry.Rectangle; import de.bmotionstudio.gef.editor.AttributeConstants; -import de.bmotionstudio.gef.editor.attribute.BAttributeColumns; -import de.bmotionstudio.gef.editor.attribute.BAttributeForegroundColor; -import de.bmotionstudio.gef.editor.attribute.BAttributeRows; +import de.bmotionstudio.gef.editor.attribute.AbstractAttribute; import de.bmotionstudio.gef.editor.command.CreateCommand; public class BTable extends BControl { @@ -43,17 +41,16 @@ public class BTable extends BControl { @Override protected void initAttributes() { - initAttribute(new BAttributeForegroundColor( - ColorConstants.black.getRGB())); - initAttribute(new BAttributeColumns(1)); - initAttribute(new BAttributeRows(1)); - getAttributes().get(AttributeConstants.ATTRIBUTE_SIZE).setShow(false); - getAttributes().get(AttributeConstants.ATTRIBUTE_COORDINATES).setShow( - true); - getAttributes().get(AttributeConstants.ATTRIBUTE_HEIGHT).setEditable( - false); - getAttributes().get(AttributeConstants.ATTRIBUTE_WIDTH).setEditable( - false); + initAttribute(AttributeConstants.ATTRIBUTE_SIZE, null, false, false, + AbstractAttribute.ROOT); + initAttribute(AttributeConstants.ATTRIBUTE_WIDTH, 0, false, false, + AttributeConstants.ATTRIBUTE_SIZE); + initAttribute(AttributeConstants.ATTRIBUTE_HEIGHT, 0, false, false, + AttributeConstants.ATTRIBUTE_SIZE); + initAttribute(AttributeConstants.ATTRIBUTE_FOREGROUND_COLOR, + ColorConstants.black.getRGB()); + initAttribute(AttributeConstants.ATTRIBUTE_COLUMNS, 1); + initAttribute(AttributeConstants.ATTRIBUTE_ROWS, 1); } @Override diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTableCell.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTableCell.java index 8ee5ec9f47041b73c31888e1c1905af87a5284e0..3a37da71a3d2087b455e3ea07d970a780f2368df 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTableCell.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTableCell.java @@ -3,10 +3,6 @@ package de.bmotionstudio.gef.editor.model; import org.eclipse.draw2d.ColorConstants; import de.bmotionstudio.gef.editor.AttributeConstants; -import de.bmotionstudio.gef.editor.attribute.BAttributeBackgroundColor; -import de.bmotionstudio.gef.editor.attribute.BAttributeForegroundColor; -import de.bmotionstudio.gef.editor.attribute.BAttributeText; -import de.bmotionstudio.gef.editor.attribute.BAttributeTextColor; public class BTableCell extends BControl { @@ -18,25 +14,15 @@ public class BTableCell extends BControl { @Override protected void initAttributes() { - - initAttribute(new BAttributeBackgroundColor( - ColorConstants.white.getRGB())); - BAttributeForegroundColor bAttributeForegroundColor = new BAttributeForegroundColor( + initAttribute(AttributeConstants.ATTRIBUTE_BACKGROUND_COLOR, + ColorConstants.white.getRGB()); + initAttribute(AttributeConstants.ATTRIBUTE_FOREGROUND_COLOR, + ColorConstants.black.getRGB(), true, false); + initAttribute(AttributeConstants.ATTRIBUTE_TEXT_COLOR, ColorConstants.black.getRGB()); - bAttributeForegroundColor.setShow(false); - initAttribute(bAttributeForegroundColor); - initAttribute(new BAttributeTextColor(ColorConstants.black.getRGB())); - initAttribute(new BAttributeText("")); - setAttributeValue(AttributeConstants.ATTRIBUTE_HEIGHT, 20); - setAttributeValue(AttributeConstants.ATTRIBUTE_WIDTH, 50); - getAttributes().get(AttributeConstants.ATTRIBUTE_HEIGHT).setEditable( - false); - getAttributes().get(AttributeConstants.ATTRIBUTE_WIDTH).setEditable( - true); - getAttributes().get(AttributeConstants.ATTRIBUTE_HEIGHT).setShow(false); - getAttributes().get(AttributeConstants.ATTRIBUTE_COORDINATES).setShow( - false); - + initAttribute(AttributeConstants.ATTRIBUTE_TEXT, ""); + initAttribute(AttributeConstants.ATTRIBUTE_HEIGHT, 20, false, false, + AttributeConstants.ATTRIBUTE_SIZE); } @Override diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTableColumn.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTableColumn.java index fc64b9ed8123ebd1dfd0499dafd92857e872eb06..6c4bb368ee601432ced67ef61068fd1c845d7993 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTableColumn.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTableColumn.java @@ -3,7 +3,6 @@ package de.bmotionstudio.gef.editor.model; import org.eclipse.draw2d.ColorConstants; import de.bmotionstudio.gef.editor.AttributeConstants; -import de.bmotionstudio.gef.editor.attribute.BAttributeForegroundColor; public class BTableColumn extends BControl { @@ -15,28 +14,10 @@ public class BTableColumn extends BControl { @Override protected void initAttributes() { - - // initAttribute(new BAttributeBackgroundColor( - // ColorConstants.white.getRGB())); - BAttributeForegroundColor bAttributeForegroundColor = new BAttributeForegroundColor( - ColorConstants.black.getRGB()); - bAttributeForegroundColor.setShow(false); - initAttribute(bAttributeForegroundColor); - // initAttribute(new - // BAttributeTextColor(ColorConstants.black.getRGB())); - getAttributes().get(AttributeConstants.ATTRIBUTE_HEIGHT).setEditable( - false); - getAttributes().get(AttributeConstants.ATTRIBUTE_HEIGHT).setShow(false); - getAttributes().get(AttributeConstants.ATTRIBUTE_COORDINATES).setShow( - false); - - // Background Color - // Font - // Foreground Color - - // Width - // Height (not editable) --> determined by number of cells - + initAttribute(AttributeConstants.ATTRIBUTE_FOREGROUND_COLOR, + ColorConstants.black.getRGB(), true, false); + initAttribute(AttributeConstants.ATTRIBUTE_HEIGHT, 0, false, false, + AttributeConstants.ATTRIBUTE_SIZE); } @Override diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BText.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BText.java index 0e713693b0ddcd75bf44869b9842317d47a6eeba..c74bfa38c918a783ea30063f0767df9fdb525549 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BText.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BText.java @@ -8,11 +8,7 @@ package de.bmotionstudio.gef.editor.model; import org.eclipse.swt.graphics.RGB; -import de.bmotionstudio.gef.editor.attribute.BAttributeBackgroundColor; -import de.bmotionstudio.gef.editor.attribute.BAttributeBackgroundVisible; -import de.bmotionstudio.gef.editor.attribute.BAttributeFont; -import de.bmotionstudio.gef.editor.attribute.BAttributeText; -import de.bmotionstudio.gef.editor.attribute.BAttributeTextColor; +import de.bmotionstudio.gef.editor.AttributeConstants; /** * @author Lukas Ladenberger @@ -35,12 +31,13 @@ public class BText extends BControl { @Override protected void initAttributes() { - initAttribute(new BAttributeText(DEFAULT_TEXT)); - initAttribute(new BAttributeBackgroundColor(new RGB(255, 255, 255))); - initAttribute(new BAttributeTextColor(new RGB(0, 0, 0))); - initAttribute(new BAttributeBackgroundVisible(true)); - initAttribute(new BAttributeFont( - "1||9.75|0|WINDOWS|1|-13|0|0|0|400|0|0|0|0|0|0|0|0|")); + initAttribute(AttributeConstants.ATTRIBUTE_TEXT, DEFAULT_TEXT); + initAttribute(AttributeConstants.ATTRIBUTE_BACKGROUND_COLOR, new RGB( + 255, 255, 255)); + initAttribute(AttributeConstants.ATTRIBUTE_TEXT_COLOR, DEFAULT_TEXT); + initAttribute(AttributeConstants.ATTRIBUTE_BACKGROUND_VISIBLE, true); + initAttribute(AttributeConstants.ATTRIBUTE_FONT, + "1||9.75|0|WINDOWS|1|-13|0|0|0|400|0|0|0|0|0|0|0|0|"); } } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTextfield.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTextfield.java index e0d323c5ce2005008306e42cbca002899cd7bf8b..d832ef10832f46d861d50e00bcc1f541b6b83e91 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTextfield.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTextfield.java @@ -7,7 +7,6 @@ package de.bmotionstudio.gef.editor.model; import de.bmotionstudio.gef.editor.AttributeConstants; -import de.bmotionstudio.gef.editor.attribute.BAttributeText; /** * @author Lukas Ladenberger @@ -30,8 +29,9 @@ public class BTextfield extends BControl { @Override protected void initAttributes() { - initAttribute(new BAttributeText(DEFAULT_TEXT)); - getAttribute(AttributeConstants.ATTRIBUTE_HEIGHT).setValue(21); + initAttribute(AttributeConstants.ATTRIBUTE_TEXT, DEFAULT_TEXT); + initAttribute(AttributeConstants.ATTRIBUTE_HEIGHT, 21, + AttributeConstants.ATTRIBUTE_SIZE); } @Override diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/TableObserver.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/TableObserver.java index c872dec8943a50784c163d98d53c3d548c32d875..9ad72ca8e76de21b1fe7c98f8f5e1c0029210c71 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/TableObserver.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/TableObserver.java @@ -23,10 +23,12 @@ public class TableObserver extends Observer { input = input.replaceAll("(\\{[^\\}]+),([^\\}]+\\})", "$1" + tempReplacement + "$2"); } - String[] split = input.split(","); List<String> output = new LinkedList<String>(); - for (String s : split) { - output.add(s.replaceAll(tempReplacement + "", ",").trim()); + if (input.length() > 0) { + String[] split = input.split(","); + for (String s : split) { + output.add(s.replaceAll(tempReplacement + "", ",").trim()); + } } return output; } @@ -36,10 +38,12 @@ public class TableObserver extends Observer { input = input.replaceAll("(\\([^\\)]+)\\|->([^\\)]+\\))", "$1" + tempReplacement + "$2"); } - String[] split = input.split("\\|->"); List<String> output = new LinkedList<String>(); - for (String s : split) { - output.add(s.replaceAll(tempReplacement + "", "\\|->").trim()); + if (input.length() > 0) { + String[] split = input.split("\\|->"); + for (String s : split) { + output.add(s.replaceAll(tempReplacement + "", "\\|->").trim()); + } } return output; } @@ -58,6 +62,7 @@ public class TableObserver extends Observer { String fEval = BMSUtil.parseExpression(expression, control, animation); + fEval = UnicodeTranslator.toAscii(fEval); fEval = fEval.replaceAll("^\\{", ""); fEval = fEval.replaceAll("\\}$", ""); @@ -92,8 +97,10 @@ public class TableObserver extends Observer { // Set content and the correct number of columns for (int i = numberOfOldRows; i < numberOfNewRows + numberOfOldRows; i++) { - String content = UnicodeTranslator.toAscii(rows.get(i - - numberOfOldRows)); + String content = rows.get(i - numberOfOldRows); + + if (content != null && content.length() > 0) + content = UnicodeTranslator.toAscii(content); content = content.replaceAll("^\\(", ""); content = content.replaceAll("\\)$", ""); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardTableObserver.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardTableObserver.java index a2782d2ad05ff09fa5daec6d6a16d87567892619..e816e1d3ee2c517bca6e12dd054b201e29cea5e2 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardTableObserver.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardTableObserver.java @@ -131,7 +131,8 @@ public class WizardTableObserver extends ObserverWizard { } } - final List list = new List(conRight, SWT.SINGLE | SWT.BORDER); + final List list = new List(conRight, SWT.SINGLE | SWT.BORDER + | SWT.V_SCROLL); list.setLayoutData(new GridData(GridData.FILL_BOTH)); list.setItems(relationList.toArray(new String[relationList.size()])); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTablePart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTablePart.java index ce86dc2cff01fb0b1f5d70ecb0ad8b624c9a2677..5d7d2be826c062d2e30341cc3db13bacc7c62065 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTablePart.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTablePart.java @@ -138,6 +138,8 @@ public class BTablePart extends AppAbstractEditPart { private void refreshRows(BControl column, int numberOfRows) { + System.out.println(numberOfRows); + Integer numberOfCurrentRows = column.getChildrenArray().size(); if (numberOfRows < numberOfCurrentRows) {