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);
}
use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testGetWindowSize.
@Test
public void testGetWindowSize() {
UserPreferencesManager m = new JmriUserPreferencesManager();
m.setSaveAllowed(false);
Dimension windowSize = new Dimension(666, 999);
m.setWindowSize(strClass, windowSize);
Dimension savedWindowSize = m.getWindowSize(strClass);
Assert.assertEquals(windowSize, savedWindowSize);
}
use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testIsSaveAllowed.
@Test
public void testIsSaveAllowed() {
UserPreferencesManager m = new JmriUserPreferencesManager();
Assert.assertTrue(m.isSaveAllowed());
m.setSaveAllowed(false);
Assert.assertFalse(m.isSaveAllowed());
m.setSaveAllowed(true);
Assert.assertTrue(m.isSaveAllowed());
}
use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testGetPreferencesClasses.
@Test
public void testGetPreferencesClasses() {
UserPreferencesManager m = new TestJmriUserPreferencesManager();
m.setSaveAllowed(false);
Assert.assertEquals(1, m.getPreferencesClasses().size());
Assert.assertEquals(m.getClass().getName(), m.getPreferencesClasses().get(0));
m.setPreferenceState(strClass, "test1", true);
Assert.assertEquals(2, m.getPreferencesClasses().size());
Assert.assertEquals(strClass, m.getPreferencesClasses().get(1));
}
use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testGetMultipleChoiceDefaultOption.
@Test
public void testGetMultipleChoiceDefaultOption() {
UserPreferencesManager m = new JmriUserPreferencesManager();
m.setSaveAllowed(false);
HashMap<Integer, String> options = new HashMap<>();
options.put(1, "test1");
Assert.assertEquals(0, m.getMultipleChoiceDefaultOption(strClass, "item1"));
m.setMessageItemDetails(strClass, "item1", "description1", options, 0);
Assert.assertEquals(0, m.getMultipleChoiceDefaultOption(strClass, "item1"));
}
Aggregations