Skip to content
Snippets Groups Projects
Commit af52784d authored by Raphael GIRARDOT's avatar Raphael GIRARDOT
Browse files

code readapted to changes in ProjectUtilities (SCAN-918)

parent 77c8c1cb
No related branches found
No related tags found
No related merge requests found
......@@ -36,7 +36,7 @@ import fr.soleil.lib.project.application.logging.LogbackUtils;
public class Capoeira extends Application {
private static final long serialVersionUID = -3959003027950888176L;
private static final long serialVersionUID = -8547340813419757953L;
private static final Logger LOGGER = LoggerFactory.getLogger(Capoeira.class);
private static final LogViewer LOG_VIEWER = LogbackUtils.getConfiguredLogViewer(Capoeira.class.getName(), true);
......@@ -61,14 +61,13 @@ public class Capoeira extends Application {
private DiffractometerBean hklPanel = null;
protected CapoeiraModel model = null;
private Preferences prefs = Preferences.userNodeForPackage(Capoeira.class);
/**
* This is the default constructor
*/
public Capoeira() {
super();
initialize();
initializeCapoeira();
}
private void clearGUI() {
......@@ -156,7 +155,7 @@ public class Capoeira extends Application {
*
* @return void
*/
private void initialize() {
private void initializeCapoeira() {
this.initializeDocumentationMenu();
this.getContentPane().setLayout(new BorderLayout());
......@@ -198,43 +197,49 @@ public class Capoeira extends Application {
}
}
@Override
protected Preferences recoverPreferences() {
return Preferences.userNodeForPackage(Capoeira.class);
}
@Override
protected void savePreferences() {
if (this.prefs != null) {
this.prefs.putInt("state", this.getExtendedState());
this.setExtendedState(Frame.NORMAL);
final Rectangle bounds = this.getBounds();
this.prefs.putInt("x", (int) bounds.getX());
this.prefs.putInt("y", (int) bounds.getY());
this.prefs.putInt("w", (int) bounds.getWidth());
this.prefs.putInt("h", (int) bounds.getHeight());
this.getHklPanel().savePreferences(this.prefs);
this.prefs.put(DIFFRACTOMETER_DEVICE, this.model.getDiffractometer());
this.prefs.put(DIFFRACTOMETER_PREPARE_DEVICE, this.getHklPanel().getModel());
// this.prefs.put(COMPTER_DEVICE, this.model.getCounter());
this.prefs.put(GAP_REFLEXION, this.model.getGap().toString());
this.prefs.put(URL_DOCUMENTATION, this.model.getUrl());
super.savePreferences();
if (prefs != null) {
prefs.putInt("state", this.getExtendedState());
setExtendedState(Frame.NORMAL);
Rectangle bounds = this.getBounds();
prefs.putInt("x", (int) bounds.getX());
prefs.putInt("y", (int) bounds.getY());
prefs.putInt("w", (int) bounds.getWidth());
prefs.putInt("h", (int) bounds.getHeight());
getHklPanel().savePreferences(prefs);
prefs.put(DIFFRACTOMETER_DEVICE, this.model.getDiffractometer());
prefs.put(DIFFRACTOMETER_PREPARE_DEVICE, this.getHklPanel().getModel());
// prefs.put(COMPTER_DEVICE, model.getCounter());
prefs.put(GAP_REFLEXION, model.getGap().toString());
prefs.put(URL_DOCUMENTATION, model.getUrl());
}
}
@Override
protected void loadPreferences() {
if (this.prefs != null) {
final int x = this.prefs.getInt("x", DEFAULT_WINDOW_X);
final int y = this.prefs.getInt("y", DEFAULT_WINDOW_Y);
this.setLocation(x, y);
final int w = this.prefs.getInt("w", DEFAULT_WINDOW_WIDTH);
final int h = this.prefs.getInt("h", DEFAULT_WINDOW_HEIGHT);
this.setSize(w, h);
final int state = this.prefs.getInt("state", Frame.NORMAL);
this.setExtendedState(state);
this.getHklPanel().loadPreferences(this.prefs);
final double gap = this.prefs.getDouble(GAP_REFLEXION, Double.NaN);
this.model.setGap(gap);
final String url = this.prefs.get(URL_DOCUMENTATION, DEFAULT_DOC_URL);
this.model.setUrl(url);
// getModel().setDiffractometer(prefs.get(DIFFRACTOMETER_DEVICE,"not
// initialized"));
super.loadPreferences();
if (prefs != null) {
final int x = prefs.getInt("x", DEFAULT_WINDOW_X);
final int y = prefs.getInt("y", DEFAULT_WINDOW_Y);
setLocation(x, y);
final int w = prefs.getInt("w", DEFAULT_WINDOW_WIDTH);
final int h = prefs.getInt("h", DEFAULT_WINDOW_HEIGHT);
setSize(w, h);
final int state = prefs.getInt("state", Frame.NORMAL);
setExtendedState(state);
getHklPanel().loadPreferences(prefs);
final double gap = prefs.getDouble(GAP_REFLEXION, Double.NaN);
model.setGap(gap);
final String url = prefs.get(URL_DOCUMENTATION, DEFAULT_DOC_URL);
model.setUrl(url);
// getModel().setDiffractometer(prefs.get(DIFFRACTOMETER_DEVICE,"not initialized"));
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment