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
@@ -63,6 +63,11 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
public String toString() { public String toString() {
return name; 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 * Returns the closest odd number, i.e. x when x is odd, or x + 1 when x is
@@ -107,7 +107,8 @@ public interface IDIYComponent<T> extends Serializable {
* @param project * @param project
* @param drawingObserver * @param drawingObserver
*/ */
void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project, void draw(Graphics2D g2d, ComponentState componentState,
boolean outlineMode, Project project,
IDrawingObserver drawingObserver); IDrawingObserver drawingObserver);
/** /**
@@ -127,6 +128,11 @@ public interface IDIYComponent<T> extends Serializable {
*/ */
IDIYComponent<T> clone() throws CloneNotSupportedException; IDIYComponent<T> clone() throws CloneNotSupportedException;
/**
* @return full value for BOM.
*/
String getValueForDisplay();
/** /**
* Checks if two components are equal. * Checks if two components are equal.
* *
@@ -15,12 +15,11 @@ public class PCBLayerFiler implements IComponentFiler {
this.layer = layer; this.layer = layer;
} }
@SuppressWarnings("unchecked")
@Override @Override
public boolean testComponent(IDIYComponent<?> component) { public boolean testComponent(IDIYComponent<?> component) {
Class<?> clazz = component.getClass(); Class<?> clazz = component.getClass();
try { try {
Method m = clazz.getMethod("getLayer", null); Method m = clazz.getMethod("getLayer");
PCBLayer l = (PCBLayer) m.invoke(component); PCBLayer l = (PCBLayer) m.invoke(component);
return layer == l; return layer == l;
} catch (Exception e) { } catch (Exception e) {
@@ -64,8 +64,7 @@ public class BomMaker {
if (type.getBomPolicy() == BomPolicy.NEVER_SHOW) if (type.getBomPolicy() == BomPolicy.NEVER_SHOW)
continue; continue;
String name = component.getName(); String name = component.getName();
String value = component.getValue() == null ? null : component String value = component.getValueForDisplay();
.getValue().toString();
if ((name != null) && (value != null)) { if ((name != null) && (value != null)) {
String key = type.getName() + "|" + value; String key = type.getName() + "|" + value;
if (entryMap.containsKey(key)) { if (entryMap.containsKey(key)) {