Cleaner XML format for .DIY files with less cross-references

pinout update
This commit is contained in:
Branislav Stojkovic
2019-03-09 20:15:36 +01:00
parent 7af919b303
commit f63b422a8c
12 changed files with 74 additions and 10 deletions
@@ -294,7 +294,7 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
}
@Override
public String getSectionName(int pointIndex) {
public String[] getSectionNames(int pointIndex) {
return null;
}
@@ -131,10 +131,11 @@ public interface IDIYComponent<T> extends Serializable {
String getInternalLinkName(int index1, int index2);
/**
* @param pointIndex name of the internal section containing the specified point, or null if the component does not have internal sections.
* @param pointIndex name of the internal section containing the specified point, or null if the component does not have internal sections.
* One point can be shared between multiple sections, in which case, the result may contain more than one element.
* @return
*/
String getSectionName(int pointIndex);
String[] getSectionNames(int pointIndex);
/**
* Draws the component onto the {@link Graphics2D}.
@@ -48,8 +48,8 @@ public class Node implements Comparable<Node> {
}
public String getDisplayName() {
String section = component.getSectionName(pointIndex);
return (section == null ? "" : section + ".") + component.getControlPointNodeName(pointIndex);
String[] section = component.getSectionNames(pointIndex);
return (section == null || section.length > 1 ? "" : section[0] + ".") + component.getControlPointNodeName(pointIndex);
}
@Override
@@ -21,6 +21,7 @@
*/
package org.diylc.presenter;
import java.awt.Color;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -92,7 +93,16 @@ public class ProjectFileManager {
}
};
xStream.autodetectAnnotations(true);
xStream.registerConverter(new PointConverter());
xStream.registerConverter(new PointConverter());
xStream.addImmutableType(Color.class);
xStream.addImmutableType(java.awt.Point.class);
xStream.addImmutableType(org.diylc.core.measures.Voltage.class);
xStream.addImmutableType(org.diylc.core.measures.Resistance.class);
xStream.addImmutableType(org.diylc.core.measures.Capacitance.class);
xStream.addImmutableType(org.diylc.core.measures.Current.class);
xStream.addImmutableType(org.diylc.core.measures.Power.class);
xStream.addImmutableType(org.diylc.core.measures.Inductance.class);
xStream.addImmutableType(org.diylc.core.measures.Size.class);
this.xStreamOld = new XStream(new DomDriver());
xStreamOld.autodetectAnnotations(true);
this.messageDispatcher = messageDispatcher;