mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
fixed measure editing
fixed trace lead color
This commit is contained in:
Binary file not shown.
+5
@@ -37,6 +37,11 @@ public class AbstractMeasure<T extends Enum<? extends Unit>> implements Serializ
|
||||
public void setUnit(T multiplier) {
|
||||
this.unit = multiplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
return super.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
||||
+12
-2
@@ -30,7 +30,12 @@ public class MeasureEditor extends Container {
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
measure.setValue((Double) evt.getNewValue());
|
||||
try {
|
||||
AbstractMeasure<?> newMeasure = (AbstractMeasure<?>) measure.clone();
|
||||
newMeasure.setValue((Double) evt.getNewValue());
|
||||
property.setValue(newMeasure);
|
||||
} catch (CloneNotSupportedException ex) {
|
||||
}
|
||||
}
|
||||
});
|
||||
add(valueField, BorderLayout.CENTER);
|
||||
@@ -42,7 +47,12 @@ public class MeasureEditor extends Container {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
measure.setUnit((Enum) unitBox.getSelectedItem());
|
||||
try {
|
||||
AbstractMeasure<?> newMeasure = (AbstractMeasure<?>) measure.clone();
|
||||
measure.setUnit((Enum) unitBox.getSelectedItem());
|
||||
property.setValue(newMeasure);
|
||||
} catch (CloneNotSupportedException ex) {
|
||||
}
|
||||
}
|
||||
});
|
||||
add(unitBox, BorderLayout.EAST);
|
||||
|
||||
+3
-13
@@ -151,7 +151,7 @@ public class ComponentProcessor {
|
||||
* @return
|
||||
*/
|
||||
public List<PropertyWrapper> getMutualSelectionProperties(
|
||||
List<IDIYComponent<?>> selectedComponents) {
|
||||
List<IDIYComponent<?>> selectedComponents) throws Exception {
|
||||
if (selectedComponents.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -160,23 +160,13 @@ public class ComponentProcessor {
|
||||
properties.addAll(extractProperties(firstComponent.getClass()));
|
||||
// Initialize values
|
||||
for (PropertyWrapper property : properties) {
|
||||
try {
|
||||
property.readFrom(firstComponent);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
property.readFrom(firstComponent);
|
||||
}
|
||||
for (int i = 1; i < selectedComponents.size(); i++) {
|
||||
IDIYComponent<?> component = selectedComponents.get(i);
|
||||
List<PropertyWrapper> newProperties = extractProperties(component.getClass());
|
||||
for (PropertyWrapper property : newProperties) {
|
||||
try {
|
||||
property.readFrom(component);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
property.readFrom(component);
|
||||
}
|
||||
properties.retainAll(newProperties);
|
||||
// for (PropertyWrapper property : properties) {
|
||||
|
||||
+7
-1
@@ -973,7 +973,13 @@ public class Presenter implements IPlugInPort {
|
||||
|
||||
@Override
|
||||
public List<PropertyWrapper> getMutualSelectionProperties() {
|
||||
return ComponentProcessor.getInstance().getMutualSelectionProperties(selectedComponents);
|
||||
try {
|
||||
return ComponentProcessor.getInstance()
|
||||
.getMutualSelectionProperties(selectedComponents);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Could not get mutual selection properties", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Binary file not shown.
+6
-2
@@ -32,12 +32,16 @@ public class CopperTrace extends AbstractLeadedComponent<Void> {
|
||||
}
|
||||
|
||||
@Override
|
||||
@EditableProperty(name = "Color")
|
||||
public Color getLeadColor(ComponentState componentState) {
|
||||
protected Color getLeadColor(ComponentState componentState) {
|
||||
return componentState == ComponentState.SELECTED
|
||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : leadColor;
|
||||
}
|
||||
|
||||
@EditableProperty(name = "Color")
|
||||
public Color getLeadColor() {
|
||||
return leadColor;
|
||||
}
|
||||
|
||||
public void setLeadColor(Color leadColor) {
|
||||
this.leadColor = leadColor;
|
||||
}
|
||||
|
||||
+11
@@ -55,4 +55,15 @@ public class CurvedTrace extends AbstractCurvedComponent<Void> {
|
||||
@Override
|
||||
public void setValue(Void value) {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Byte getAlpha() {
|
||||
return super.getAlpha();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlpha(Byte alpha) {
|
||||
super.setAlpha(alpha);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user