Dependency inversions
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package fabrik.simulator.pic16f84;
|
||||
|
||||
import com.gluonhq.charm.glisten.control.ToggleButtonGroup;
|
||||
import fabrik.simulator.pic16f84.interfaces.IOPortInterface;
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.control.Toggle;
|
||||
@ -10,14 +11,18 @@ import javafx.scene.input.MouseEvent;
|
||||
import java.io.IOException;
|
||||
|
||||
public class ToggleButtonGroupExt {
|
||||
|
||||
private IOPortInterface ioPorts;
|
||||
|
||||
private static ToggleButtonGroupExt me;
|
||||
|
||||
private ToggleButtonGroupExt() {
|
||||
public ToggleButtonGroupExt(IOPortInterface ioPorts) {
|
||||
this.ioPorts = ioPorts;
|
||||
}
|
||||
|
||||
public static ToggleButtonGroupExt get() {
|
||||
public static ToggleButtonGroupExt get(IOPortInterface ioPorts) {
|
||||
if (me == null) {
|
||||
me = new ToggleButtonGroupExt();
|
||||
me = new ToggleButtonGroupExt(ioPorts);
|
||||
}
|
||||
return me;
|
||||
}
|
||||
@ -45,14 +50,14 @@ public class ToggleButtonGroupExt {
|
||||
ToggleButtonGroup parent = (ToggleButtonGroup) ((ToggleButton) mouseEvent.getSource()).getParent();
|
||||
if (parent.getId().contains("TRIS")) {
|
||||
try {
|
||||
IOPorts.setTRISfromUI(parent);
|
||||
ioPorts.setTRISfromUI(parent);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
IOPorts.setPORTfromUI(parent);
|
||||
ioPorts.setPORTfromUI(parent);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user