Search in sources :

Example 21 with UserPreferencesManager

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));
}
Also used : UserPreferencesManager(jmri.UserPreferencesManager) Test(org.junit.Test)

Example 22 with UserPreferencesManager

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));
}
Also used : UserPreferencesManager(jmri.UserPreferencesManager) Test(org.junit.Test)

Example 23 with UserPreferencesManager

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));
}
Also used : UserPreferencesManager(jmri.UserPreferencesManager) Test(org.junit.Test)

Example 24 with UserPreferencesManager

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"));
}
Also used : UserPreferencesManager(jmri.UserPreferencesManager) Test(org.junit.Test)

Example 25 with UserPreferencesManager

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);
}
Also used : Dimension(java.awt.Dimension) UserPreferencesManager(jmri.UserPreferencesManager) RosterGroupSelector(jmri.jmrit.roster.rostergroup.RosterGroupSelector)

Aggregations

UserPreferencesManager (jmri.UserPreferencesManager)47 Test (org.junit.Test)43 HashMap (java.util.HashMap)10 Dimension (java.awt.Dimension)7 Point (java.awt.Point)5 AppConfigBase (apps.AppConfigBase)2 File (java.io.File)2 JLabel (javax.swing.JLabel)2 RosterGroupSelector (jmri.jmrit.roster.rostergroup.RosterGroupSelector)2 NullProfile (jmri.profile.NullProfile)2 BoxLayout (javax.swing.BoxLayout)1 JCheckBox (javax.swing.JCheckBox)1 JPanel (javax.swing.JPanel)1 ShutDownManager (jmri.ShutDownManager)1