Show voltage and power ratings in BOM where applicable

This commit is contained in:
bancika
2012-08-24 13:42:22 +00:00
parent 1e34913d1a
commit cce34c9d9a
11 changed files with 71 additions and 16 deletions
@@ -10,7 +10,7 @@ import org.diylc.core.measures.Resistance;
import org.diylc.core.measures.ResistanceUnit;
public abstract class AbstractPotentiometer extends
AbstractTransparentComponent<PotentiometerValue> {
AbstractTransparentComponent<Resistance> {
private static final long serialVersionUID = 1L;
@@ -45,24 +45,20 @@ public abstract class AbstractPotentiometer extends
return true;
}
@Override
public String getValueForDisplay() {
return resistance.toString() + " " + taper.toString();
}
@EditableProperty
public Resistance getResistance() {
@Override
public Resistance getValue() {
return resistance;
}
public void setResistance(Resistance resistance) {
this.resistance = resistance;
}
@Override
public PotentiometerValue getValue() {
return new PotentiometerValue(resistance, taper);
}
@Override
public void setValue(PotentiometerValue value) {
this.resistance = value.getResistance();
this.taper = value.getTaper();
public void setValue(Resistance value) {
this.resistance = value;
}
@EditableProperty
@@ -58,6 +58,11 @@ public class AxialElectrolyticCapacitor extends AbstractLeadedComponent<Capacita
this.value = value;
}
@Override
public String getValueForDisplay() {
return getValue().toString() + " " + getVoltageNew().toString();
}
@Deprecated
public Voltage getVoltage() {
return voltage;
@@ -62,6 +62,11 @@ public class AxialFilmCapacitor extends AbstractLeadedComponent<Capacitance> {
this.voltage = voltage;
}
@Override
public String getValueForDisplay() {
return getValue().toString() + " " + getVoltageNew().toString();
}
@EditableProperty(name = "Voltage")
public org.diylc.core.measures.Voltage getVoltageNew() {
// Backward comptibility
@@ -39,6 +39,11 @@ public class CapacitorSymbol extends AbstractSchematicLeadedSymbol<Capacitance>
this.value = value;
}
@Override
public String getValueForDisplay() {
return getValue().toString() + " " + getVoltageNew().toString();
}
@Deprecated
public Voltage getVoltage() {
return voltage;
@@ -197,7 +197,7 @@ public class PotentiometerPanel extends AbstractPotentiometer {
g2d.drawString(getName(), (int) (bodyRect.getX() + x), (int) (bodyRect.getY() + y));
// Draw value.
rect = fontMetrics.getStringBounds(getValue().toString(), g2d);
rect = fontMetrics.getStringBounds(getValueForDisplay(), g2d);
textHeight = (int) rect.getHeight();
textWidth = (int) rect.getWidth();
@@ -205,7 +205,7 @@ public class PotentiometerPanel extends AbstractPotentiometer {
x = (panelWidth - textWidth) / 2;
y = panelHeight / 2 + fontMetrics.getAscent();
g2d.drawString(getValue().toString(), (int) (bodyRect.getX() + x),
g2d.drawString(getValueForDisplay(), (int) (bodyRect.getX() + x),
(int) (bodyRect.getY() + y));
}
@@ -14,6 +14,7 @@ import org.diylc.core.measures.Capacitance;
import org.diylc.core.measures.CapacitanceUnit;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
import org.diylc.core.measures.VoltageUnit;
@ComponentDescriptor(name = "Ceramic Capacitor (radial)", author = "Branislav Stojkovic", category = "Passive", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "C", description = "Standard radial ceramic capacitor", zOrder = IDIYComponent.COMPONENT)
public class RadialCeramicDiskCapacitor extends AbstractLeadedComponent<Capacitance> {
@@ -26,7 +27,10 @@ public class RadialCeramicDiskCapacitor extends AbstractLeadedComponent<Capacita
public static Color BORDER_COLOR = BODY_COLOR.darker();
private Capacitance value = new Capacitance(470d, CapacitanceUnit.pF);
@Deprecated
private Voltage voltage = Voltage._63V;
private org.diylc.core.measures.Voltage voltageNew = new org.diylc.core.measures.Voltage(63d,
VoltageUnit.V);
public RadialCeramicDiskCapacitor() {
super();
@@ -43,6 +47,26 @@ public class RadialCeramicDiskCapacitor extends AbstractLeadedComponent<Capacita
this.value = value;
}
@Override
public String getValueForDisplay() {
return getValue().toString() + " " + getVoltageNew().toString();
}
@EditableProperty(name = "Voltage")
public org.diylc.core.measures.Voltage getVoltageNew() {
// Backward comptibility
if (voltageNew == null) {
voltageNew = voltage.convertToNewFormat();
voltage = null;
// Clear old value, don't need it anymore
}
return voltageNew;
}
public void setVoltageNew(org.diylc.core.measures.Voltage voltageNew) {
this.voltageNew = voltageNew;
}
@EditableProperty
public Voltage getVoltage() {
return voltage;
@@ -59,6 +59,11 @@ public class RadialElectrolytic extends AbstractLeadedComponent<Capacitance> {
this.value = value;
}
@Override
public String getValueForDisplay() {
return getValue().toString() + " " + getVoltageNew().toString();
}
@Deprecated
public Voltage getVoltage() {
return voltage;
@@ -47,6 +47,11 @@ public class RadialFilmCapacitor extends AbstractLeadedComponent<Capacitance> {
this.value = value;
}
@Override
public String getValueForDisplay() {
return getValue().toString() + " " + getVoltageNew().toString();
}
@Deprecated
public Voltage getVoltage() {
return voltage;
@@ -58,6 +58,11 @@ public class Resistor extends AbstractLeadedComponent<Resistance> {
this.value = value;
}
@Override
public String getValueForDisplay() {
return getValue().toString() + " " + getPowerNew().toString();
}
@Deprecated
public Power getPower() {
return power;
@@ -38,6 +38,11 @@ public class ResistorSymbol extends AbstractSchematicLeadedSymbol<Resistance> {
this.value = value;
}
@Override
public String getValueForDisplay() {
return getValue().toString() + " " + getPowerNew().toString();
}
@Deprecated
public Power getPower() {
return power;