Show voltage and power ratings in BOM where applicable

This commit is contained in:
bancika
2012-08-24 13:42:37 +00:00
parent cce34c9d9a
commit 0c99b2b6a6
4 changed files with 14 additions and 5 deletions
@@ -64,6 +64,11 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
return name;
}
@Override
public String getValueForDisplay() {
return getValue() == null ? "" : getValue().toString();
}
/**
* Returns the closest odd number, i.e. x when x is odd, or x + 1 when x is
* even.
@@ -107,7 +107,8 @@ public interface IDIYComponent<T> extends Serializable {
* @param project
* @param drawingObserver
*/
void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
void draw(Graphics2D g2d, ComponentState componentState,
boolean outlineMode, Project project,
IDrawingObserver drawingObserver);
/**
@@ -127,6 +128,11 @@ public interface IDIYComponent<T> extends Serializable {
*/
IDIYComponent<T> clone() throws CloneNotSupportedException;
/**
* @return full value for BOM.
*/
String getValueForDisplay();
/**
* Checks if two components are equal.
*
@@ -15,12 +15,11 @@ public class PCBLayerFiler implements IComponentFiler {
this.layer = layer;
}
@SuppressWarnings("unchecked")
@Override
public boolean testComponent(IDIYComponent<?> component) {
Class<?> clazz = component.getClass();
try {
Method m = clazz.getMethod("getLayer", null);
Method m = clazz.getMethod("getLayer");
PCBLayer l = (PCBLayer) m.invoke(component);
return layer == l;
} catch (Exception e) {
@@ -64,8 +64,7 @@ public class BomMaker {
if (type.getBomPolicy() == BomPolicy.NEVER_SHOW)
continue;
String name = component.getName();
String value = component.getValue() == null ? null : component
.getValue().toString();
String value = component.getValueForDisplay();
if ((name != null) && (value != null)) {
String key = type.getName() + "|" + value;
if (entryMap.containsKey(key)) {