mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
fixed measure editing
fixed trace lead color
This commit is contained in:
+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
|
||||
|
||||
Reference in New Issue
Block a user