use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testGetSaveWindowSize.
@Test
public void testGetSaveWindowSize() {
UserPreferencesManager m = new JmriUserPreferencesManager();
m.setSaveAllowed(false);
Assert.assertFalse(m.getSaveWindowSize(strClass));
m.setSaveWindowSize(strClass, true);
Assert.assertTrue(m.getSaveWindowSize(strClass));
m.setSaveWindowSize(strClass, false);
Assert.assertFalse(m.getSaveWindowSize(strClass));
}
use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testGetPreferenceItemName.
@Test
public void testGetPreferenceItemName() {
UserPreferencesManager m = new TestJmriUserPreferencesManager();
m.setSaveAllowed(false);
Assert.assertTrue(m.getPreferenceList(strClass).isEmpty());
Assert.assertNull(m.getPreferenceItemName(strClass, 0));
m.setPreferenceState(strClass, "test1", true);
Assert.assertEquals("test1", m.getPreferenceItemName(strClass, 0));
Assert.assertNull("test2", m.getPreferenceItemName(strClass, 1));
m.setPreferenceState(strClass, "test1", false);
Assert.assertEquals("test1", m.getPreferenceItemName(strClass, 0));
Assert.assertNull("test2", m.getPreferenceItemName(strClass, 1));
}
use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testSetSaveWindowSize.
@Test
public void testSetSaveWindowSize() {
UserPreferencesManager m = new JmriUserPreferencesManager();
m.setSaveAllowed(false);
Assert.assertFalse(m.getSaveWindowSize(strClass));
m.setSaveWindowSize(strClass, true);
Assert.assertTrue(m.getSaveWindowSize(strClass));
m.setSaveWindowSize(strClass, false);
Assert.assertFalse(m.getSaveWindowSize(strClass));
}
use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testGetPreferenceList.
@Test
public void testGetPreferenceList() {
UserPreferencesManager m = new TestJmriUserPreferencesManager();
m.setSaveAllowed(false);
Assert.assertTrue(m.getPreferenceList(strClass).isEmpty());
m.setPreferenceState(strClass, "test1", true);
Assert.assertTrue(m.getPreferenceState(strClass, "test1"));
Assert.assertFalse(m.getPreferenceState(strClass, "test2"));
m.setPreferenceState(strClass, "test1", false);
Assert.assertFalse(m.getPreferenceState(strClass, "test1"));
Assert.assertFalse(m.getPreferenceState(strClass, "test2"));
}
use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class RosterFrameAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent event) {
mainFrame = new RosterFrame();
UserPreferencesManager p = InstanceManager.getDefault(jmri.UserPreferencesManager.class);
if (!p.isWindowPositionSaved(mainFrame.getWindowFrameRef())) {
mainFrame.setSize(new Dimension(1024, 600));
mainFrame.setPreferredSize(new Dimension(1024, 600));
}
if (wi instanceof RosterGroupSelector) {
mainFrame.setSelectedRosterGroup(((RosterGroupSelector) wi).getSelectedRosterGroup());
}
mainFrame.setVisible(true);
mainFrame.setAllowQuit(allowQuit);
mainFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
}
Aggregations