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

refactoring attribute handling

parent 4bad8480
Branches
No related tags found
No related merge requests found
Showing
with 83 additions and 15 deletions
...@@ -14,6 +14,7 @@ import org.eclipse.ui.views.properties.IPropertyDescriptor; ...@@ -14,6 +14,7 @@ import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource; import org.eclipse.ui.views.properties.IPropertySource;
import org.eclipse.ui.views.properties.PropertyDescriptor; import org.eclipse.ui.views.properties.PropertyDescriptor;
import de.bmotionstudio.gef.editor.AttributeConstants;
import de.bmotionstudio.gef.editor.model.BControl; import de.bmotionstudio.gef.editor.model.BControl;
/** /**
...@@ -40,21 +41,14 @@ public abstract class AbstractAttribute implements IPropertySource, Cloneable { ...@@ -40,21 +41,14 @@ public abstract class AbstractAttribute implements IPropertySource, Cloneable {
// The current value of the attribute // The current value of the attribute
private Object value; private Object value;
public AbstractAttribute() { public AbstractAttribute(Object value) {
this.value = value;
this.defaultValue = value;
this.group = AttributeConstants.ATTRIBUTE_MISC;
this.editable = true;
this.show = true;
} }
// 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() { private Object readResolve() {
this.initValue = this.value; this.initValue = this.value;
return this; return this;
......
...@@ -13,6 +13,10 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; ...@@ -13,6 +13,10 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor;
public class AttributeBlocks extends AbstractAttribute { public class AttributeBlocks extends AbstractAttribute {
public AttributeBlocks(Object value) {
super(value);
}
public PropertyDescriptor preparePropertyDescriptor() { public PropertyDescriptor preparePropertyDescriptor() {
IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor(
getID(), getName()); getID(), getName());
......
...@@ -13,6 +13,10 @@ import org.eclipse.ui.views.properties.PropertyDescriptor; ...@@ -13,6 +13,10 @@ import org.eclipse.ui.views.properties.PropertyDescriptor;
public class AttributeFillColor extends AbstractAttribute { public class AttributeFillColor extends AbstractAttribute {
public AttributeFillColor(Object value) {
super(value);
}
public PropertyDescriptor preparePropertyDescriptor() { public PropertyDescriptor preparePropertyDescriptor() {
return new ColorPropertyDescriptor(getID(), getName()); return new ColorPropertyDescriptor(getID(), getName());
} }
......
...@@ -13,6 +13,10 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; ...@@ -13,6 +13,10 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor;
public class AttributeFillHeight extends AbstractAttribute { public class AttributeFillHeight extends AbstractAttribute {
public AttributeFillHeight(Object value) {
super(value);
}
public PropertyDescriptor preparePropertyDescriptor() { public PropertyDescriptor preparePropertyDescriptor() {
IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor(
getID(), getName()); getID(), getName());
......
...@@ -13,6 +13,10 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; ...@@ -13,6 +13,10 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor;
public class AttributeLights extends AbstractAttribute { public class AttributeLights extends AbstractAttribute {
public AttributeLights(Object value) {
super(value);
}
public PropertyDescriptor preparePropertyDescriptor() { public PropertyDescriptor preparePropertyDescriptor() {
IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor(
getID(), getName()); getID(), getName());
......
...@@ -13,6 +13,10 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; ...@@ -13,6 +13,10 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor;
public class AttributeMeasureInterval extends AbstractAttribute { public class AttributeMeasureInterval extends AbstractAttribute {
public AttributeMeasureInterval(Object value) {
super(value);
}
public PropertyDescriptor preparePropertyDescriptor() { public PropertyDescriptor preparePropertyDescriptor() {
IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor(
getID(), getName()); getID(), getName());
......
...@@ -13,6 +13,10 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; ...@@ -13,6 +13,10 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor;
public class AttributeMeasureMaxPos extends AbstractAttribute { public class AttributeMeasureMaxPos extends AbstractAttribute {
public AttributeMeasureMaxPos(Object value) {
super(value);
}
public PropertyDescriptor preparePropertyDescriptor() { public PropertyDescriptor preparePropertyDescriptor() {
IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor(
getID(), getName()); getID(), getName());
......
...@@ -13,6 +13,10 @@ import de.bmotionstudio.gef.editor.property.CheckboxPropertyDescriptor; ...@@ -13,6 +13,10 @@ import de.bmotionstudio.gef.editor.property.CheckboxPropertyDescriptor;
public class AttributeShowMeasure extends AbstractAttribute { public class AttributeShowMeasure extends AbstractAttribute {
public AttributeShowMeasure(Object value) {
super(value);
}
public PropertyDescriptor preparePropertyDescriptor() { public PropertyDescriptor preparePropertyDescriptor() {
return new CheckboxPropertyDescriptor(getID(), getName()); return new CheckboxPropertyDescriptor(getID(), getName());
} }
......
...@@ -15,6 +15,10 @@ public class AttributeSignalColor extends AbstractAttribute { ...@@ -15,6 +15,10 @@ public class AttributeSignalColor extends AbstractAttribute {
public static final int GREEN = 1; public static final int GREEN = 1;
public static final int NO_COLOR = 2; public static final int NO_COLOR = 2;
public AttributeSignalColor(Object value) {
super(value);
}
@Override @Override
protected PropertyDescriptor preparePropertyDescriptor() { protected PropertyDescriptor preparePropertyDescriptor() {
return new ComboBoxPropertyDescriptor(getID(), getName(), new String[] { return new ComboBoxPropertyDescriptor(getID(), getName(), new String[] {
......
...@@ -16,6 +16,10 @@ public class AttributeSwitchDirection extends AbstractAttribute { ...@@ -16,6 +16,10 @@ public class AttributeSwitchDirection extends AbstractAttribute {
public static final int RIGHT_NORTH = 2; public static final int RIGHT_NORTH = 2;
public static final int LEFT_NORTH = 3; public static final int LEFT_NORTH = 3;
public AttributeSwitchDirection(Object value) {
super(value);
}
@Override @Override
public Object unmarshal(final String s) { public Object unmarshal(final String s) {
return Integer.valueOf(s); return Integer.valueOf(s);
......
...@@ -8,13 +8,16 @@ package de.bmotionstudio.gef.editor.attribute; ...@@ -8,13 +8,16 @@ package de.bmotionstudio.gef.editor.attribute;
import org.eclipse.ui.views.properties.ComboBoxPropertyDescriptor; import org.eclipse.ui.views.properties.ComboBoxPropertyDescriptor;
import org.eclipse.ui.views.properties.PropertyDescriptor; import org.eclipse.ui.views.properties.PropertyDescriptor;
public class AttributeSwitchPosition extends AbstractAttribute { public class AttributeSwitchPosition extends AbstractAttribute {
public static final int LEFT = 0; public static final int LEFT = 0;
public static final int RIGHT = 1; public static final int RIGHT = 1;
public static final int UNKNOWN = 2; public static final int UNKNOWN = 2;
public AttributeSwitchPosition(Object value) {
super(value);
}
@Override @Override
public Object unmarshal(final String s) { public Object unmarshal(final String s) {
return Integer.valueOf(s); return Integer.valueOf(s);
......
...@@ -8,12 +8,15 @@ package de.bmotionstudio.gef.editor.attribute; ...@@ -8,12 +8,15 @@ package de.bmotionstudio.gef.editor.attribute;
import org.eclipse.ui.views.properties.ComboBoxPropertyDescriptor; import org.eclipse.ui.views.properties.ComboBoxPropertyDescriptor;
import org.eclipse.ui.views.properties.PropertyDescriptor; import org.eclipse.ui.views.properties.PropertyDescriptor;
public class AttributeTrackDirection extends AbstractAttribute { public class AttributeTrackDirection extends AbstractAttribute {
public static final int RIGHT = 0; public static final int RIGHT = 0;
public static final int LEFT = 1; public static final int LEFT = 1;
public AttributeTrackDirection(Object value) {
super(value);
}
@Override @Override
public Object unmarshal(final String s) { public Object unmarshal(final String s) {
return Integer.valueOf(s); return Integer.valueOf(s);
......
...@@ -13,6 +13,10 @@ import de.bmotionstudio.gef.editor.property.SliderPropertyDescriptor; ...@@ -13,6 +13,10 @@ import de.bmotionstudio.gef.editor.property.SliderPropertyDescriptor;
public class BAttributeAlpha extends AbstractAttribute { public class BAttributeAlpha extends AbstractAttribute {
public BAttributeAlpha(Object value) {
super(value);
}
public PropertyDescriptor preparePropertyDescriptor() { public PropertyDescriptor preparePropertyDescriptor() {
SliderPropertyDescriptor descriptor = new SliderPropertyDescriptor( SliderPropertyDescriptor descriptor = new SliderPropertyDescriptor(
getID(), getName()); getID(), getName());
......
...@@ -14,6 +14,10 @@ import de.bmotionstudio.gef.editor.model.BControl; ...@@ -14,6 +14,10 @@ import de.bmotionstudio.gef.editor.model.BControl;
public class BAttributeBackgroundColor extends AbstractAttribute { public class BAttributeBackgroundColor extends AbstractAttribute {
public BAttributeBackgroundColor(Object value) {
super(value);
}
public PropertyDescriptor preparePropertyDescriptor() { public PropertyDescriptor preparePropertyDescriptor() {
return new ColorPropertyDescriptor(getID(), getName()); return new ColorPropertyDescriptor(getID(), getName());
} }
......
...@@ -13,6 +13,10 @@ import de.bmotionstudio.gef.editor.property.CheckboxPropertyDescriptor; ...@@ -13,6 +13,10 @@ import de.bmotionstudio.gef.editor.property.CheckboxPropertyDescriptor;
public class BAttributeBackgroundVisible extends AbstractAttribute { public class BAttributeBackgroundVisible extends AbstractAttribute {
public BAttributeBackgroundVisible(Object value) {
super(value);
}
public PropertyDescriptor preparePropertyDescriptor() { public PropertyDescriptor preparePropertyDescriptor() {
return new CheckboxPropertyDescriptor(getID(), getName()); return new CheckboxPropertyDescriptor(getID(), getName());
} }
......
...@@ -11,6 +11,10 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor; ...@@ -11,6 +11,10 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor;
public class BAttributeButtonGroup extends AbstractAttribute { public class BAttributeButtonGroup extends AbstractAttribute {
public BAttributeButtonGroup(Object value) {
super(value);
}
@Override @Override
protected PropertyDescriptor preparePropertyDescriptor() { protected PropertyDescriptor preparePropertyDescriptor() {
return new TextPropertyDescriptor(getID(), getName()); return new TextPropertyDescriptor(getID(), getName());
......
...@@ -13,6 +13,10 @@ import de.bmotionstudio.gef.editor.property.CheckboxPropertyDescriptor; ...@@ -13,6 +13,10 @@ import de.bmotionstudio.gef.editor.property.CheckboxPropertyDescriptor;
public class BAttributeChecked extends AbstractAttribute { public class BAttributeChecked extends AbstractAttribute {
public BAttributeChecked(Object value) {
super(value);
}
@Override @Override
protected PropertyDescriptor preparePropertyDescriptor() { protected PropertyDescriptor preparePropertyDescriptor() {
return new CheckboxPropertyDescriptor(getID(), getName()); return new CheckboxPropertyDescriptor(getID(), getName());
......
...@@ -13,6 +13,10 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; ...@@ -13,6 +13,10 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor;
public class BAttributeColumns extends AbstractAttribute { public class BAttributeColumns extends AbstractAttribute {
public BAttributeColumns(Object value) {
super(value);
}
public PropertyDescriptor preparePropertyDescriptor() { public PropertyDescriptor preparePropertyDescriptor() {
IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor(
getID(), getName()); getID(), getName());
......
...@@ -11,6 +11,10 @@ import org.eclipse.ui.views.properties.PropertyDescriptor; ...@@ -11,6 +11,10 @@ import org.eclipse.ui.views.properties.PropertyDescriptor;
public class BAttributeConnection extends AbstractAttribute { public class BAttributeConnection extends AbstractAttribute {
public BAttributeConnection(Object value) {
super(value);
}
@Override @Override
public PropertyDescriptor preparePropertyDescriptor() { public PropertyDescriptor preparePropertyDescriptor() {
PropertyDescriptor descriptor = new PropertyDescriptor(getID(), PropertyDescriptor descriptor = new PropertyDescriptor(getID(),
......
...@@ -11,6 +11,10 @@ import org.eclipse.ui.views.properties.PropertyDescriptor; ...@@ -11,6 +11,10 @@ import org.eclipse.ui.views.properties.PropertyDescriptor;
public class BAttributeConnectionSourceDecoration extends AbstractAttribute { public class BAttributeConnectionSourceDecoration extends AbstractAttribute {
public BAttributeConnectionSourceDecoration(Object value) {
super(value);
}
public static int DECORATION_NONE = 0; public static int DECORATION_NONE = 0;
public static int DECORATION_TRIANGLE = 1; public static int DECORATION_TRIANGLE = 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment