mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-17 17:04:42 -04:00
fixed problems related to frame-dialog relations
This commit is contained in:
parent
83b29b0caf
commit
2a06732162
@ -40,15 +40,24 @@ public final class Not implements Expression {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Protects this not against simplification
|
* Protects this not against simplification.
|
||||||
|
* So it is possible to create a NAnd: You can create an And and protect the outer Not.
|
||||||
|
* No simplification will take place in this case and you will end up with a NAnd gate.
|
||||||
*
|
*
|
||||||
* @return this for call chaning
|
* @return this for call chaining
|
||||||
*/
|
*/
|
||||||
public Not protect() {
|
public Not protect() {
|
||||||
protect = true;
|
protect = true;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if this not is protected.
|
||||||
|
*/
|
||||||
|
public boolean isProtected() {
|
||||||
|
return protect;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean calculate(Context context) throws ExpressionException {
|
public boolean calculate(Context context) throws ExpressionException {
|
||||||
return !expression.calculate(context);
|
return !expression.calculate(context);
|
||||||
|
@ -20,7 +20,7 @@ import de.neemann.digital.draw.shapes.ShapeFactory;
|
|||||||
import de.neemann.digital.gui.components.*;
|
import de.neemann.digital.gui.components.*;
|
||||||
import de.neemann.digital.gui.components.data.DataSetDialog;
|
import de.neemann.digital.gui.components.data.DataSetDialog;
|
||||||
import de.neemann.digital.gui.components.listing.ROMListingDialog;
|
import de.neemann.digital.gui.components.listing.ROMListingDialog;
|
||||||
import de.neemann.digital.gui.components.table.TableFrame;
|
import de.neemann.digital.gui.components.table.TableDialog;
|
||||||
import de.neemann.digital.gui.state.State;
|
import de.neemann.digital.gui.state.State;
|
||||||
import de.neemann.digital.gui.state.StateManager;
|
import de.neemann.digital.gui.state.StateManager;
|
||||||
import de.neemann.digital.lang.Lang;
|
import de.neemann.digital.lang.Lang;
|
||||||
@ -445,7 +445,7 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E
|
|||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
try {
|
try {
|
||||||
Model model = new ModelDescription(circuitComponent.getCircuit(), library).createModel(false);
|
Model model = new ModelDescription(circuitComponent.getCircuit(), library).createModel(false);
|
||||||
new TableFrame(Main.this, new ModelAnalyser(model).analyse(), shapeFactory).setVisible(true);
|
new TableDialog(Main.this, new ModelAnalyser(model).analyse(), shapeFactory).setVisible(true);
|
||||||
elementState.activate();
|
elementState.activate();
|
||||||
} catch (PinException | NodeException | AnalyseException e1) {
|
} catch (PinException | NodeException | AnalyseException e1) {
|
||||||
showErrorAndStopModel(Lang.get("msg_annalyseErr"), e1);
|
showErrorAndStopModel(Lang.get("msg_annalyseErr"), e1);
|
||||||
@ -459,7 +459,7 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
TruthTable tt = new TruthTable(3).addResult();
|
TruthTable tt = new TruthTable(3).addResult();
|
||||||
new TableFrame(Main.this, tt, shapeFactory).setVisible(true);
|
new TableDialog(Main.this, tt, shapeFactory).setVisible(true);
|
||||||
elementState.activate();
|
elementState.activate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import java.awt.*;
|
|||||||
*
|
*
|
||||||
* @author hneemann
|
* @author hneemann
|
||||||
*/
|
*/
|
||||||
public class AllSolutionsFrame extends JDialog {
|
public class AllSolutionsDialog extends JDialog {
|
||||||
private final JTextArea textArea;
|
private final JTextArea textArea;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,7 +19,7 @@ public class AllSolutionsFrame extends JDialog {
|
|||||||
* @param owner the owner frame
|
* @param owner the owner frame
|
||||||
* @param font the font to use
|
* @param font the font to use
|
||||||
*/
|
*/
|
||||||
public AllSolutionsFrame(Frame owner, Font font) {
|
public AllSolutionsDialog(JFrame owner, Font font) {
|
||||||
super(owner, Lang.get("win_allSolutions"), false);
|
super(owner, Lang.get("win_allSolutions"), false);
|
||||||
setDefaultCloseOperation(HIDE_ON_CLOSE);
|
setDefaultCloseOperation(HIDE_ON_CLOSE);
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ public class AllSolutionsFrame extends JDialog {
|
|||||||
* @param text the text
|
* @param text the text
|
||||||
* @return this for call chaining
|
* @return this for call chaining
|
||||||
*/
|
*/
|
||||||
public AllSolutionsFrame setText(String text) {
|
public AllSolutionsDialog setText(String text) {
|
||||||
textArea.setText(text);
|
textArea.setText(text);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
@ -36,7 +36,7 @@ import java.util.HashSet;
|
|||||||
/**
|
/**
|
||||||
* @author hneemann
|
* @author hneemann
|
||||||
*/
|
*/
|
||||||
public class TableFrame extends JFrame {
|
public class TableDialog extends JDialog {
|
||||||
private static final Color MYGRAY = new Color(230, 230, 230);
|
private static final Color MYGRAY = new Color(230, 230, 230);
|
||||||
private final JLabel label;
|
private final JLabel label;
|
||||||
private final JTable table;
|
private final JTable table;
|
||||||
@ -49,7 +49,7 @@ public class TableFrame extends JFrame {
|
|||||||
private TruthTableTableModel model;
|
private TruthTableTableModel model;
|
||||||
private TableColumn column;
|
private TableColumn column;
|
||||||
private int columnIndex;
|
private int columnIndex;
|
||||||
private AllSolutionsFrame allSolutionsFrame;
|
private AllSolutionsDialog allSolutionsDialog;
|
||||||
private int variables;
|
private int variables;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,8 +58,8 @@ public class TableFrame extends JFrame {
|
|||||||
* @param parent the parent frame
|
* @param parent the parent frame
|
||||||
* @param truthTable the table to show
|
* @param truthTable the table to show
|
||||||
*/
|
*/
|
||||||
public TableFrame(JFrame parent, TruthTable truthTable, ShapeFactory shapeFactory) {
|
public TableDialog(JFrame parent, TruthTable truthTable, ShapeFactory shapeFactory) {
|
||||||
super(Lang.get("win_table"));
|
super(parent, Lang.get("win_table"));
|
||||||
this.shapeFactory = shapeFactory;
|
this.shapeFactory = shapeFactory;
|
||||||
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ public class TableFrame extends JFrame {
|
|||||||
table.setDefaultRenderer(Integer.class, new CenterDefaultTableCellRenderer());
|
table.setDefaultRenderer(Integer.class, new CenterDefaultTableCellRenderer());
|
||||||
table.setRowHeight(25);
|
table.setRowHeight(25);
|
||||||
|
|
||||||
allSolutionsFrame = new AllSolutionsFrame(this, font);
|
allSolutionsDialog = new AllSolutionsDialog(parent, font);
|
||||||
|
|
||||||
header = table.getTableHeader();
|
header = table.getTableHeader();
|
||||||
header.addMouseListener(new MouseAdapter() {
|
header.addMouseListener(new MouseAdapter() {
|
||||||
@ -263,14 +263,14 @@ public class TableFrame extends JFrame {
|
|||||||
sb.append(expr);
|
sb.append(expr);
|
||||||
count++;
|
count++;
|
||||||
if (count == 2)
|
if (count == 2)
|
||||||
allSolutionsFrame.setVisible(true);
|
allSolutionsDialog.setVisible(true);
|
||||||
}
|
}
|
||||||
}.create();
|
}.create();
|
||||||
|
|
||||||
if (sb.length() == 0)
|
if (sb.length() == 0)
|
||||||
label.setText("");
|
label.setText("");
|
||||||
|
|
||||||
allSolutionsFrame.setText(sb.toString());
|
allSolutionsDialog.setText(sb.toString());
|
||||||
} catch (ExpressionException | FormatterException e1) {
|
} catch (ExpressionException | FormatterException e1) {
|
||||||
new ErrorMessage(Lang.get("msg_errorDuringCalculation")).addCause(e1).show();
|
new ErrorMessage(Lang.get("msg_errorDuringCalculation")).addCause(e1).show();
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user