SubmodelComponents now have a label shown when zoomed out
[Mograsim.git] / net.mograsim.logic.ui / src / net / mograsim / logic / ui / model / components / TestSubmodelNANDComponent.java
1 package net.mograsim.logic.ui.model.components;
2
3 import net.mograsim.logic.ui.model.ViewModelModifiable;
4 import net.mograsim.logic.ui.model.wires.GUIWire;
5 import net.mograsim.logic.ui.model.wires.Pin;
6
7 public class TestSubmodelNANDComponent extends SubmodelComponent
8 {
9         public TestSubmodelNANDComponent(ViewModelModifiable model)
10         {
11                 super(model, "TestNAND");
12                 setSize(30, 20);
13                 setSubmodelScale(.5);
14                 initSubmodelComponents();
15         }
16
17         @SuppressWarnings("unused") // GUIWires being created
18         private void initSubmodelComponents()
19         {
20                 Pin A = addSubmodelInterface(1, 0, 5);
21                 Pin B = addSubmodelInterface(1, 0, 15);
22                 Pin Y = addSubmodelInterface(1, 30, 10);
23
24                 GUIAndGate and = new GUIAndGate(submodelModifiable, 1);
25                 and.moveTo(5, 10);
26                 GUINotGate not = new GUINotGate(submodelModifiable, 1);
27                 not.moveTo(30, 15);
28
29                 new GUIWire(submodelModifiable, A, and.getInputPins().get(0));
30                 new GUIWire(submodelModifiable, B, and.getInputPins().get(1));
31                 new GUIWire(submodelModifiable, and.getOutputPin(), not.getInputPins().get(0));
32                 new GUIWire(submodelModifiable, not.getOutputPin(), Y);
33         }
34 }