refreshModel();
}
public void refreshModel() {
propertySheet.setNodes(new Node[]{new PreviewNode()});
PreviewModel previewModel = Lookup.getDefault().lookup(PreviewController.class).getModel();
if (previewModel != null) {
ratioSlider.setValue((int) (previewModel.getVisibilityRatio() * 100));
}
//Presets
if (previewModel == null) {
saveButton.setEnabled(false);
labelPreset.setEnabled(false);
presetComboBox.setEnabled(false);
presetComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"---"}));
} else {
saveButton.setEnabled(true);
labelPreset.setEnabled(true);
presetComboBox.setEnabled(true);
PreviewController controller = Lookup.getDefault().lookup(PreviewController.class);
DefaultComboBoxModel comboBoxModel = new DefaultComboBoxModel();
defaultPresetLimit = 0;
for (PreviewPreset preset : controller.getDefaultPresets()) {
comboBoxModel.addElement(preset);
defaultPresetLimit++;
}
PreviewPreset[] userPresets = controller.getUserPresets();
if (userPresets.length > 0) {
comboBoxModel.addElement(NO_SELECTION);
for (PreviewPreset preset : userPresets) {
comboBoxModel.addElement(preset);
}
}
presetComboBox.setSelectedItem(previewModel.getCurrentPreset());
presetComboBox.setModel(comboBoxModel);
}
}