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

attribute handling refactoring

parent e71a8184
No related branches found
No related tags found
No related merge requests found
Showing
with 33 additions and 82 deletions
......@@ -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";
......
......@@ -31,23 +31,29 @@ 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() {
}
public AbstractAttribute(Object value, boolean isEditable,
boolean showInPropertiesView) {
this.value = value;
this.initValue = value;
this.editable = isEditable;
this.show = showInPropertiesView;
}
// 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;
......@@ -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;
}
}
......@@ -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());
......
......@@ -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());
}
......
......@@ -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());
}
......
......@@ -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());
......
......@@ -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());
......
......@@ -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());
......
......@@ -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(),
......
......@@ -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[] {
......
......@@ -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[] {
......
......@@ -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(),
......
......@@ -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());
......
......@@ -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[] {
......
......@@ -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());
}
......
......@@ -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());
......
......@@ -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[] {
......
......@@ -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());
}
......
......@@ -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());
}
......
......@@ -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());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment