@Override public void refresh() { Context context = getMainApplication().getContext(); context.setPcbPlacement(null); PCBSize pcbSize = context.getPcbSize(); if (pcbSize == null) pcbSize = SettingsFactory.getApplicationValues().getPcbSize().getValue(); if (pcbSize == PCBSize.Small) smallPCB.setSelected(true); else if (pcbSize == PCBSize.Large) largePCB.setSelected(true); errorBox.setVisible(false); ignoreErrorCheckbox.setSelected(false); updateComponents(); }
public void updateComponents() { Context context = getMainApplication().getContext(); errorBox.setVisible(false); if (smallPCB.isSelected()) context.setPcbSize(PCBSize.Small); else if (largePCB.isSelected()) context.setPcbSize(PCBSize.Large); ApplicationValues applicationValues = SettingsFactory.getApplicationValues(); applicationValues.getPcbSize().setValue(context.getPcbSize()); applicationValues.save(); continueButton.setDisable( radioButtonsBox.isVisible() && !smallPCB.isSelected() && !largePCB.isSelected()); if (context.getPcbSize() != null && !checkSelectedPcbSize()) { errorBox.setVisible(true); continueButton.setDisable(!ignoreErrorCheckbox.isSelected()); } }
private boolean checkSelectedPcbSize() { Context context = getMainApplication().getContext(); return context.getPcbSize().checkFit(context.getBoardWidth(), context.getBoardHeight()); }