mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-18 09:24:42 -04:00
the description field can be used to define pin assignments
This commit is contained in:
parent
61930b5b73
commit
7c76aa8b0e
@ -72,6 +72,9 @@ public class PinMap {
|
||||
* @throws PinMapException PinMapException
|
||||
*/
|
||||
public PinMap parseString(String assignment) throws PinMapException {
|
||||
if (assignment == null)
|
||||
return this;
|
||||
|
||||
StringTokenizer st = new StringTokenizer(assignment, ";,");
|
||||
while (st.hasMoreTokens()) {
|
||||
String tok = st.nextToken();
|
||||
|
@ -510,4 +510,11 @@ public class Circuit {
|
||||
this.measurementOrdering = measurementOrdering;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return getAttributes().get(Keys.DESCRIPTION);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -486,7 +486,9 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
Model model = new ModelDescription(circuitComponent.getCircuit(), library).createModel(false);
|
||||
new TableDialog(Main.this, new ModelAnalyser(model).analyse(), shapeFactory, filename).setVisible(true);
|
||||
new TableDialog(Main.this, new ModelAnalyser(model).analyse(), shapeFactory, filename)
|
||||
.setPinDescription(circuitComponent.getCircuit().getDescription())
|
||||
.setVisible(true);
|
||||
elementState.activate();
|
||||
} catch (PinException | NodeException | AnalyseException e1) {
|
||||
showErrorAndStopModel(Lang.get("msg_annalyseErr"), e1);
|
||||
|
@ -65,6 +65,7 @@ public class TableDialog extends JDialog {
|
||||
private TableColumn column;
|
||||
private int columnIndex;
|
||||
private AllSolutionsDialog allSolutionsDialog;
|
||||
private String pinDescription;
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
@ -287,6 +288,7 @@ public class TableDialog extends JDialog {
|
||||
if (fileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
|
||||
try {
|
||||
try (OutputStream out = new FileOutputStream(fileChooser.getSelectedFile())) {
|
||||
expressionExporter.getPinMapping().parseString(pinDescription);
|
||||
new BuiderExpressionCreator(expressionExporter.getBuilder(), ExpressionModifier.IDENTITY).create();
|
||||
expressionExporter.writeTo(out);
|
||||
}
|
||||
@ -328,6 +330,7 @@ public class TableDialog extends JDialog {
|
||||
f = new File(f.getParentFile(), name);
|
||||
|
||||
Gal16v8CuplExporter cupl = new Gal16v8CuplExporter(name.substring(0, name.length() - 4));
|
||||
cupl.getPinMapping().parseString(pinDescription);
|
||||
new BuiderExpressionCreator(cupl.getBuilder(), ExpressionModifier.IDENTITY).create();
|
||||
try (FileOutputStream out = new FileOutputStream(f)) {
|
||||
cupl.writeTo(out);
|
||||
@ -362,6 +365,17 @@ public class TableDialog extends JDialog {
|
||||
calculateExpressions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a pin description
|
||||
*
|
||||
* @param pinDescription the pin description
|
||||
* @return this for chained calls
|
||||
*/
|
||||
public TableDialog setPinDescription(String pinDescription) {
|
||||
this.pinDescription = pinDescription;
|
||||
return this;
|
||||
}
|
||||
|
||||
private class CalculationTableModelListener implements TableModelListener {
|
||||
@Override
|
||||
public void tableChanged(TableModelEvent tableModelEvent) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user