Example usage for java.util.prefs Preferences userNodeForPackage

List of usage examples for java.util.prefs Preferences userNodeForPackage

Introduction

In this page you can find the example usage for java.util.prefs Preferences userNodeForPackage.

Prototype

public static Preferences userNodeForPackage(Class<?> c) 

Source Link

Document

Returns the preference node from the calling user's preference tree that is associated (by convention) with the specified class's package.

Usage

From source file:com.moteiv.trawler.Trawler.java

private void loadPrefs() {
    // extract preference data
    Preferences prefs = Preferences.userNodeForPackage(com.moteiv.trawler.Trawler.class);
    // set the data
    vSave.setSelected(prefs.getBoolean(PREF_V_SAVE, true));
    vBlink.setSelected(prefs.getBoolean(PREF_V_BLINK, false));
    vLabels.setSelected(prefs.getBoolean(PREF_V_LABELS, true));
    eLabels.setSelected(prefs.getBoolean(PREF_E_LABELS, true));
    eFilter.setSelected(prefs.getBoolean(PREF_E_FILTER, true));
    vDispose.setValue(prefs.getInt(PREF_V_DISPOSE, NodeData.getNodeDelay() / 1000));
    eDispose.setValue(prefs.getInt(PREF_E_DISPOSE, LinkData.getEdgeDelay() / 1000));
    // update the processing engines to reflect the new data
    processEvent(vSave);//from  w  w  w . j av a 2s  .  c  om
    processEvent(vBlink);
    processEvent(vLabels);
    processEvent(eLabels);
    processEvent(eFilter);
    LinkData.setEdgeDelay(eDispose.getValue() * 1000);
    NodeData.setNodeDelay(vDispose.getValue() * 1000);
}

From source file:au.org.ala.delta.intkey.ui.UIUtils.java

public static String getPreferredLookAndFeel() {
    Preferences prefs = Preferences.userNodeForPackage(Intkey.class);
    if (prefs != null) {
        return prefs.get(LOOK_AND_FEEL_KEY, DEFAULT_LOOK_AND_FEEL);
    }/*w w w  .ja  va 2 s . c  om*/
    return DEFAULT_LOOK_AND_FEEL;
}

From source file:com.mirth.connect.client.ui.ChannelPanel.java

@Override
public void switchPanel() {
    boolean groupViewEnabled = Preferences.userNodeForPackage(Mirth.class).getBoolean("channelGroupViewEnabled",
            true);/* w w  w . j a  v a 2 s.c  o  m*/
    switchTableMode(groupViewEnabled, false);

    if (groupViewEnabled) {
        tableModeGroupsButton.setSelected(true);
        tableModeGroupsButton.setContentFilled(true);
        tableModeChannelsButton.setContentFilled(false);
    } else {
        tableModeChannelsButton.setSelected(true);
        tableModeChannelsButton.setContentFilled(true);
        tableModeGroupsButton.setContentFilled(false);
    }

    List<JXTaskPane> taskPanes = new ArrayList<JXTaskPane>();
    taskPanes.add(channelTasks);

    if (groupViewEnabled) {
        taskPanes.add(groupTasks);
    }

    for (TaskPlugin plugin : LoadedExtensions.getInstance().getTaskPlugins().values()) {
        JXTaskPane taskPane = plugin.getTaskPane();
        if (taskPane != null) {
            taskPanes.add(taskPane);
        }
    }

    parent.setBold(parent.viewPane, 1);
    parent.setPanelName("Channels");
    parent.setCurrentContentPage(ChannelPanel.this);
    parent.setFocus(taskPanes.toArray(new JXTaskPane[taskPanes.size()]), true, true);
    parent.setSaveEnabled(false);

    doRefreshChannels();
}

From source file:loci.slim.ui.DecayGraph.java

/**
 * Restores size from Java Preferences.//from   w  w w  . j av a 2  s  . c  o m
 *
 * @return size
 */
private Dimension getSizeFromPreferences() {
    final Preferences prefs = Preferences.userNodeForPackage(this.getClass());
    return new Dimension(prefs.getInt(WIDTH_KEY, FRAME_SIZE.width),
            prefs.getInt(HEIGHT_KEY, FRAME_SIZE.height));
}

From source file:loci.slim.ui.DecayGraph.java

/**
 * Saves the size to Java Preferences./*  w w  w.  j a  v a 2s  .  co  m*/
 *
 */
private void saveSizeInPreferences(final Dimension size) {
    final Preferences prefs = Preferences.userNodeForPackage(this.getClass());
    prefs.putInt(WIDTH_KEY, size.width);
    prefs.putInt(HEIGHT_KEY, size.height);
}

From source file:com.mirth.connect.client.ui.Frame.java

/**
 * Called to set up this main window frame.
 *///from w  w  w .  j  ava  2s .c o m
public void setupFrame(Client mirthClient) throws ClientException {

    LoginPanel login = LoginPanel.getInstance();

    // Initialize the send message dialog
    editMessageDialog = new EditMessageDialog();

    this.mirthClient = mirthClient;
    login.setStatus("Loading extensions...");
    try {
        loadExtensionMetaData();
    } catch (ClientException e) {
        alertError(this, "Unable to load extensions.");
        throw e;
    }

    // Re-initialize the controller every time the frame is setup
    AuthorizationControllerFactory.getAuthorizationController().initialize();
    channelPanel = new ChannelPanel();
    channelPanel.retrieveGroups();
    channelPanel.retrieveDependencies();
    codeTemplatePanel = new CodeTemplatePanel(this);
    initializeExtensions();

    channelPanel.initPanelPlugins();

    // Load the data type/display name maps now that the extensions have been loaded.
    dataTypeToDisplayName = new LinkedHashMap<String, String>();
    displayNameToDataType = new LinkedHashMap<String, String>();
    for (Entry<String, DataTypeClientPlugin> entry : LoadedExtensions.getInstance().getDataTypePlugins()
            .entrySet()) {
        dataTypeToDisplayName.put(entry.getKey(), entry.getValue().getDisplayName());
        displayNameToDataType.put(entry.getValue().getDisplayName(), entry.getKey());
    }

    setInitialVisibleTasks();
    login.setStatus("Loading preferences...");
    userPreferences = Preferences.userNodeForPackage(Mirth.class);
    userPreferences.put("defaultServer", PlatformUI.SERVER_URL);
    login.setStatus("Loading GUI components...");
    splitPane.setDividerSize(0);
    splitPane.setBorder(BorderFactory.createEmptyBorder());

    contentPanel = (JPanel) getContentPane();
    contentPanel.setLayout(new BorderLayout());
    contentPanel.setBorder(BorderFactory.createEmptyBorder());
    taskPane.setBorder(BorderFactory.createEmptyBorder());

    statusBar = new StatusBar();
    statusBar.setBorder(BorderFactory.createEmptyBorder());
    contentPane.setBorder(BorderFactory.createEmptyBorder());

    buildContentPanel(rightContainer, contentPane, false);

    // Set task pane container background painter
    MattePainter taskPanePainter = new MattePainter(new GradientPaint(0f, 0f,
            UIConstants.JX_CONTAINER_BACKGROUND_COLOR, 0f, 1f, UIConstants.JX_CONTAINER_BACKGROUND_COLOR));
    taskPanePainter.setPaintStretched(true);
    taskPaneContainer.setBackgroundPainter(taskPanePainter);

    // Set main content container title painter
    MattePainter contentTitlePainter = new MattePainter(new GradientPaint(0f, 0f,
            UIConstants.JX_CONTAINER_BACKGROUND_COLOR, 0f, 1f, UIConstants.JX_CONTAINER_BACKGROUND_COLOR));
    contentTitlePainter.setPaintStretched(true);
    rightContainer.setTitlePainter(contentTitlePainter);

    splitPane.add(rightContainer, JSplitPane.RIGHT);
    splitPane.add(taskPane, JSplitPane.LEFT);
    taskPane.setMinimumSize(new Dimension(UIConstants.TASK_PANE_WIDTH, 0));
    splitPane.setDividerLocation(UIConstants.TASK_PANE_WIDTH);

    contentPanel.add(statusBar, BorderLayout.SOUTH);
    contentPanel.add(splitPane, java.awt.BorderLayout.CENTER);

    try {
        PlatformUI.SERVER_ID = mirthClient.getServerId();
        PlatformUI.SERVER_VERSION = mirthClient.getVersion();
        PlatformUI.SERVER_TIMEZONE = mirthClient.getServerTimezone();
        PlatformUI.SERVER_TIME = mirthClient.getServerTime();

        setTitle(getTitle() + " - (" + PlatformUI.SERVER_VERSION + ")");

        PlatformUI.BUILD_DATE = mirthClient.getBuildDate();

        // Initialize ObjectXMLSerializer once we know the server version
        try {
            ObjectXMLSerializer.getInstance().init(PlatformUI.SERVER_VERSION);
        } catch (Exception e) {
        }
    } catch (ClientException e) {
        alertError(this, "Could not get server information.");
    }

    // Display the server timezone information
    statusBar.setTimezoneText(PlatformUI.SERVER_TIMEZONE);
    statusBar.setServerTime(PlatformUI.SERVER_TIME);

    setCurrentTaskPaneContainer(taskPaneContainer);
    login.setStatus("Loading dashboard...");
    doShowDashboard();
    login.setStatus("Loading channel editor...");
    channelEditPanel = new ChannelSetup();
    login.setStatus("Loading alert editor...");
    if (alertEditPanel == null) {
        alertEditPanel = new DefaultAlertEditPanel();
    }
    login.setStatus("Loading message browser...");
    messageBrowser = new MessageBrowser();

    // Refresh code templates after extensions have been loaded
    codeTemplatePanel.doRefreshCodeTemplates(false);

    // Refresh resources
    if (settingsPane == null) {
        settingsPane = new SettingsPane();
    }
    SettingsPanelResources resourcesPanel = (SettingsPanelResources) settingsPane
            .getSettingsPanel(SettingsPanelResources.TAB_NAME);
    if (resourcesPanel != null) {
        resourcesPanel.doRefresh();
    }

    // DEBUGGING THE UIDefaults:

    //         UIDefaults uiDefaults = UIManager.getDefaults(); Enumeration enum1 =
    //         uiDefaults.keys(); while (enum1.hasMoreElements()) { Object key =
    //         enum1.nextElement(); Object val = uiDefaults.get(key);
    ////         if(key.toString().indexOf("ComboBox") != -1)
    //         System.out.println("UIManager.put(\"" + key.toString() + "\",\"" +
    //         (null != val ? val.toString() : "(null)") + "\");"); }

}

From source file:com.mirth.connect.client.ui.browsers.event.EventBrowser.java

public void resetSearchCriteria() {
    startDatePicker.setDate(null);/*from   w  w w. j  a  va 2  s. c om*/
    endDatePicker.setDate(null);
    nameField.setText("");
    allDayCheckBox.setSelected(false);
    levelBoxInformation.setSelected(false);
    levelBoxWarning.setSelected(false);
    levelBoxError.setSelected(false);
    pageSizeField.setText(
            String.valueOf(Preferences.userNodeForPackage(Mirth.class).getInt("eventBrowserPageSize", 100)));

    advancedSearchPopup.reset();
    updateAdvancedSearchButtonFont();
}

From source file:com.github.fritaly.dualcommander.DualCommander.java

public DualCommander() {
    // TODO Generate a fat jar at build time
    super(String.format("Dual Commander %s", Utils.getApplicationVersion()));

    if (logger.isInfoEnabled()) {
        logger.info(String.format("Dual Commander %s", Utils.getApplicationVersion()));
    }//from ww  w  .  j  a v  a  2s .c  o m

    try {
        // Apply the JGoodies L&F
        UIManager.setLookAndFeel(new WindowsLookAndFeel());
    } catch (Exception e) {
        // Not supposed to happen
    }

    // Layout, columns & rows
    setLayout(new MigLayout("insets 0px", "[grow]0px[grow]", "[grow]0px[]"));

    // Create a menu bar
    final JMenu fileMenu = new JMenu("File");
    fileMenu.add(new JMenuItem(preferencesAction));
    fileMenu.add(new JSeparator());
    fileMenu.add(new JMenuItem(quitAction));

    final JMenu helpMenu = new JMenu("Help");
    helpMenu.add(new JMenuItem(aboutAction));

    final JMenuBar menuBar = new JMenuBar();
    menuBar.add(fileMenu);
    menuBar.add(helpMenu);

    setJMenuBar(menuBar);

    this.leftPane = new TabbedPane(preferences);
    this.leftPane.setName("Left");
    this.leftPane.addChangeListener(this);
    this.leftPane.addKeyListener(this);
    this.leftPane.addFocusListener(this);

    this.rightPane = new TabbedPane(preferences);
    this.rightPane.setName("Right");
    this.rightPane.addChangeListener(this);
    this.rightPane.addKeyListener(this);
    this.rightPane.addFocusListener(this);

    // Adding the 2 components to the same sizegroup ensures they always
    // keep the same width
    getContentPane().add(leftPane, "grow, sizegroup g1");
    getContentPane().add(rightPane, "grow, sizegroup g1, wrap");

    // The 7 buttons must all have the same width (they must belong to the
    // same size group)
    final JPanel buttonPanel = new JPanel(
            new MigLayout("insets 0px", StringUtils.repeat("[grow, sizegroup g1]", 7), "[grow]"));
    buttonPanel.add(viewButton, "grow");
    buttonPanel.add(editButton, "grow");
    buttonPanel.add(copyButton, "grow");
    buttonPanel.add(moveButton, "grow");
    buttonPanel.add(mkdirButton, "grow");
    buttonPanel.add(deleteButton, "grow");
    buttonPanel.add(quitButton, "grow");

    getContentPane().add(buttonPanel, "grow, span 2");

    // Register shortcuts at a global level (not on every component)
    final InputMap inputMap = this.leftPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0, true), "view");
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F4, 0, true), "edit");
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0, true), "copy");
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F6, 0, true), "move");
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F7, 0, true), "mkdir");
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F8, 0, true), "delete");
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F4, KeyEvent.ALT_DOWN_MASK), "quit");

    final ActionMap actionMap = this.leftPane.getActionMap();
    actionMap.put("view", viewAction);
    actionMap.put("edit", editAction);
    actionMap.put("copy", copyAction);
    actionMap.put("move", moveAction);
    actionMap.put("mkdir", mkdirAction);
    actionMap.put("delete", deleteAction);
    actionMap.put("quit", quitAction);

    addWindowListener(this);
    addKeyListener(this);

    // Listen to preference change events
    this.preferences.addPropertyChangeListener(this);

    // Reload the last configuration and init the left & right panels
    // accordingly
    final Preferences prefs = Preferences.userNodeForPackage(this.getClass());

    // The user preferences must be loaded first because they're needed to
    // init the UI
    this.preferences.init(prefs.node("user.preferences"));
    this.leftPane.init(prefs.node("left.panel"));
    this.rightPane.init(prefs.node("right.panel"));

    if (logger.isInfoEnabled()) {
        logger.info("Loaded preferences");
    }

    // Init the buttons
    refreshButtons(this.leftPane.getActiveBrowser().getSelection());

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setExtendedState(JFrame.MAXIMIZED_BOTH);

    if (logger.isInfoEnabled()) {
        logger.info("UI initialized");
    }
}

From source file:com.mirth.connect.client.ui.browsers.message.MessageBrowser.java

/**
 * Constructs the MessageFilter (this.filter) based on the current form selections
 *//*from   w  w  w.  j av  a2 s. c om*/
private boolean generateMessageFilter() {
    messageFilter = new MessageFilter();

    // set start/end date
    try {
        messageFilter.setStartDate(getCalendar(mirthDatePicker1, mirthTimePicker1));
        Calendar endCalendar = getCalendar(mirthDatePicker2, mirthTimePicker2);

        if (endCalendar != null && !mirthTimePicker2.isEnabled()) {
            // If the end time picker is disabled, it will be set to 00:00:00 of the day provided.
            // Since our query is using <= instead of <, we add one day and then subtract a millisecond 
            // in order to set the time to the last millisecond of the day we want to search on
            endCalendar.add(Calendar.DATE, 1);
            endCalendar.add(Calendar.MILLISECOND, -1);
        }
        messageFilter.setEndDate(endCalendar);
    } catch (ParseException e) {
        parent.alertError(parent, "Invalid date.");
        return false;
    }

    Calendar startDate = messageFilter.getStartDate();
    Calendar endDate = messageFilter.getEndDate();

    if (startDate != null && endDate != null && startDate.getTimeInMillis() > endDate.getTimeInMillis()) {
        parent.alertError(parent, "Start date cannot be after the end date.");
        return false;
    }

    // Set text search
    String textSearch = StringUtils.trim(textSearchField.getText());

    if (textSearch.length() > 0) {
        messageFilter.setTextSearch(textSearch);
        List<String> textSearchMetaDataColumns = new ArrayList<String>();

        for (MetaDataColumn metaDataColumn : getMetaDataColumns()) {
            if (metaDataColumn.getType() == MetaDataColumnType.STRING) {
                textSearchMetaDataColumns.add(metaDataColumn.getName());
            }
        }

        messageFilter.setTextSearchMetaDataColumns(textSearchMetaDataColumns);
    }

    if (regexTextSearchCheckBox.isSelected()) {
        messageFilter.setTextSearchRegex(true);
    }

    // set status
    Set<Status> statuses = new HashSet<Status>();

    if (statusBoxReceived.isSelected()) {
        statuses.add(Status.RECEIVED);
    }

    if (statusBoxTransformed.isSelected()) {
        statuses.add(Status.TRANSFORMED);
    }

    if (statusBoxFiltered.isSelected()) {
        statuses.add(Status.FILTERED);
    }

    if (statusBoxSent.isSelected()) {
        statuses.add(Status.SENT);
    }

    if (statusBoxError.isSelected()) {
        statuses.add(Status.ERROR);
    }

    if (statusBoxQueued.isSelected()) {
        statuses.add(Status.QUEUED);
    }

    if (!statuses.isEmpty()) {
        messageFilter.setStatuses(statuses);
    }

    if (StringUtils.isNotEmpty(textSearch)
            && Preferences.userNodeForPackage(Mirth.class).getBoolean("textSearchWarning", true)) {
        JCheckBox dontShowTextSearchWarningCheckBox = new JCheckBox(
                "Don't show this message again in the future");

        String textSearchWarning = "<html>Text searching may take a long time, depending on the amount of messages being searched.<br/>Are you sure you want to proceed?</html>";
        String textRegexSearchWarning = "<html>Regular expression pattern matching may take a long time and be a costly operation, depending on the amount of messages being searched.<br/>Are you sure you want to proceed?</html>";
        String searchWarning = (regexTextSearchCheckBox.isSelected()) ? textRegexSearchWarning
                : textSearchWarning;
        Object[] params = new Object[] { searchWarning, dontShowTextSearchWarningCheckBox };
        int result = JOptionPane.showConfirmDialog(this, params, "Select an Option", JOptionPane.YES_NO_OPTION,
                JOptionPane.QUESTION_MESSAGE);
        Preferences.userNodeForPackage(Mirth.class).putBoolean("textSearchWarning",
                !dontShowTextSearchWarningCheckBox.isSelected());

        if (result != JOptionPane.YES_OPTION) {
            return false;
        }
    }

    advancedSearchPopup.applySelectionsToFilter(messageFilter);
    selectedMetaDataIds = messageFilter.getIncludedMetaDataIds();

    if (messageFilter.getMaxMessageId() == null) {
        try {
            Long maxMessageId = parent.mirthClient.getMaxMessageId(channelId);
            messageFilter.setMaxMessageId(maxMessageId);
        } catch (ClientException e) {
            parent.alertThrowable(parent, e);
            return false;
        }
    }

    return true;
}

From source file:com.mirth.connect.client.ui.SettingsPanelAdministrator.java

private void initComponents() {
    setBackground(UIConstants.BACKGROUND_COLOR);

    systemSettingsPanel = new JPanel();
    systemSettingsPanel.setBackground(getBackground());
    systemSettingsPanel.setBorder(BorderFactory.createTitledBorder(
            BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(204, 204, 204)), "System Preferences",
            TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 1, 11)));

    dashboardRefreshIntervalLabel = new JLabel("Dashboard refresh interval (seconds):");
    dashboardRefreshIntervalField = new MirthTextField();
    dashboardRefreshIntervalField.setToolTipText(
            "<html>Interval in seconds at which to refresh the Dashboard. Decrement this for <br>faster updates, and increment it for slower servers with more channels.</html>");

    String toolTipText = "Sets the default page size for browsers (message, event, etc.)";
    messageBrowserPageSizeLabel = new JLabel("Message browser page size:");
    messageBrowserPageSizeField = new MirthTextField();
    messageBrowserPageSizeField.setToolTipText(toolTipText);

    eventBrowserPageSizeLabel = new JLabel("Event browser page size:");
    eventBrowserPageSizeField = new MirthTextField();
    eventBrowserPageSizeField.setToolTipText(toolTipText);

    formatLabel = new JLabel("Format text in message browser:");
    formatButtonGroup = new ButtonGroup();

    toolTipText = "Pretty print messages in the message browser.";
    formatYesRadio = new MirthRadioButton("Yes");
    formatYesRadio.setBackground(systemSettingsPanel.getBackground());
    formatYesRadio.setToolTipText(toolTipText);
    formatButtonGroup.add(formatYesRadio);

    formatNoRadio = new MirthRadioButton("No");
    formatNoRadio.setBackground(systemSettingsPanel.getBackground());
    formatNoRadio.setToolTipText(toolTipText);
    formatButtonGroup.add(formatNoRadio);

    textSearchWarningLabel = new JLabel("Message browser text search confirmation:");
    textSearchWarningButtonGroup = new ButtonGroup();

    toolTipText = "<html>Show a confirmation dialog in the message browser when attempting a text search, warning users<br/>that the query may take a long time depending on the amount of messages being searched.</html>";
    textSearchWarningYesRadio = new MirthRadioButton("Yes");
    textSearchWarningYesRadio.setBackground(systemSettingsPanel.getBackground());
    textSearchWarningYesRadio.setToolTipText(toolTipText);
    textSearchWarningButtonGroup.add(textSearchWarningYesRadio);

    textSearchWarningNoRadio = new MirthRadioButton("No");
    textSearchWarningNoRadio.setBackground(systemSettingsPanel.getBackground());
    textSearchWarningNoRadio.setToolTipText(toolTipText);
    textSearchWarningButtonGroup.add(textSearchWarningNoRadio);

    importChannelLibrariesLabel = new JLabel("Import code template libraries with channels:");
    importChannelLibrariesButtonGroup = new ButtonGroup();

    toolTipText = "<html>When attempting to import channels that have code template<br/>libraries linked to them, select Yes to always include them,<br/>No to never include them, or Ask to prompt the user each time.</html>";
    importChannelLibrariesYesRadio = new MirthRadioButton("Yes");
    importChannelLibrariesYesRadio.setBackground(systemSettingsPanel.getBackground());
    importChannelLibrariesYesRadio.setToolTipText(toolTipText);
    importChannelLibrariesButtonGroup.add(importChannelLibrariesYesRadio);

    importChannelLibrariesNoRadio = new MirthRadioButton("No");
    importChannelLibrariesNoRadio.setBackground(systemSettingsPanel.getBackground());
    importChannelLibrariesNoRadio.setToolTipText(toolTipText);
    importChannelLibrariesButtonGroup.add(importChannelLibrariesNoRadio);

    importChannelLibrariesAskRadio = new MirthRadioButton("Ask");
    importChannelLibrariesAskRadio.setBackground(systemSettingsPanel.getBackground());
    importChannelLibrariesAskRadio.setToolTipText(toolTipText);
    importChannelLibrariesButtonGroup.add(importChannelLibrariesAskRadio);

    exportChannelLibrariesLabel = new JLabel("Export code template libraries with channels:");
    exportChannelLibrariesButtonGroup = new ButtonGroup();

    toolTipText = "<html>When attempting to export channels that have code template<br/>libraries linked to them, select Yes to always include them,<br/>No to never include them, or Ask to prompt the user each time.</html>";
    exportChannelLibrariesYesRadio = new MirthRadioButton("Yes");
    exportChannelLibrariesYesRadio.setBackground(systemSettingsPanel.getBackground());
    exportChannelLibrariesYesRadio.setToolTipText(toolTipText);
    exportChannelLibrariesButtonGroup.add(exportChannelLibrariesYesRadio);

    exportChannelLibrariesNoRadio = new MirthRadioButton("No");
    exportChannelLibrariesNoRadio.setBackground(systemSettingsPanel.getBackground());
    exportChannelLibrariesNoRadio.setToolTipText(toolTipText);
    exportChannelLibrariesButtonGroup.add(exportChannelLibrariesNoRadio);

    exportChannelLibrariesAskRadio = new MirthRadioButton("Ask");
    exportChannelLibrariesAskRadio.setBackground(systemSettingsPanel.getBackground());
    exportChannelLibrariesAskRadio.setToolTipText(toolTipText);
    exportChannelLibrariesButtonGroup.add(exportChannelLibrariesAskRadio);

    userSettingsPanel = new JPanel();
    userSettingsPanel.setBackground(getBackground());
    userSettingsPanel.setBorder(BorderFactory.createTitledBorder(
            BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(204, 204, 204)), "User Preferences",
            TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 1, 11)));

    checkForNotificationsLabel = new JLabel("Check for new notifications on login:");
    notificationButtonGroup = new ButtonGroup();

    checkForNotificationsYesRadio = new MirthRadioButton("Yes");
    checkForNotificationsYesRadio.setBackground(userSettingsPanel.getBackground());
    checkForNotificationsYesRadio.setToolTipText(
            "<html>Checks for notifications from Mirth (announcements, available updates, etc.)<br/>relevant to this version of Mirth Connect whenever user logs in.</html>");
    notificationButtonGroup.add(checkForNotificationsYesRadio);

    checkForNotificationsNoRadio = new MirthRadioButton("No");
    checkForNotificationsNoRadio.setBackground(userSettingsPanel.getBackground());
    checkForNotificationsNoRadio.setToolTipText(
            "<html>Checks for notifications from Mirth (announcements, available updates, etc.)<br/>relevant to this version of Mirth Connect whenever user logs in.</html>");
    notificationButtonGroup.add(checkForNotificationsNoRadio);

    codeEditorSettingsPanel = new JPanel();
    codeEditorSettingsPanel.setBackground(getBackground());
    codeEditorSettingsPanel.setBorder(BorderFactory.createTitledBorder(
            BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(204, 204, 204)), "Code Editor Preferences",
            TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 1, 11)));

    toolTipText = "<html>The auto-completion popup will be triggered<br/>after any of these characters are typed.</html>";
    autoCompleteCharactersLabel = new JLabel("Auto-Complete Characters:");
    autoCompleteCharactersField = new MirthTextField();
    autoCompleteCharactersField.setToolTipText(toolTipText);
    autoCompleteCharactersField.getDocument().addDocumentListener(new DocumentListener() {
        @Override// w  w w  . j a va  2 s . c o m
        public void insertUpdate(DocumentEvent evt) {
            autoCompleteActionPerformed();
        }

        @Override
        public void removeUpdate(DocumentEvent evt) {
            autoCompleteActionPerformed();
        }

        @Override
        public void changedUpdate(DocumentEvent evt) {
            autoCompleteActionPerformed();
        }
    });

    toolTipText = "<html>If selected, auto-completion will be<br/>triggered after any letter is typed.</html>";
    autoCompleteIncludeLettersCheckBox = new MirthCheckBox("Include Letters");
    autoCompleteIncludeLettersCheckBox.setBackground(codeEditorSettingsPanel.getBackground());
    autoCompleteIncludeLettersCheckBox.setToolTipText(toolTipText);
    autoCompleteIncludeLettersCheckBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            autoCompleteActionPerformed();
        }
    });

    toolTipText = "<html>The amount of time to wait after typing<br/>an activation character before opening<br/>the auto-completion popup menu.</html>";
    autoCompleteDelayLabel = new JLabel("Activation Delay (ms):");
    autoCompleteDelayField = new MirthTextField();
    autoCompleteDelayField.setToolTipText(toolTipText);
    autoCompleteDelayField.setDocument(new MirthFieldConstraints(9, false, false, true));

    shortcutKeyLabel = new JLabel("Shortcut Key Mappings:");

    shortcutKeyTable = new MirthTable();
    shortcutKeyTable.setModel(new RefreshTableModel(
            new Object[] { "Action Info", "Name", "Description", "Shortcut Key Mapping" }, 0) {
        @Override
        public boolean isCellEditable(int row, int column) {
            return column == KEY_COLUMN;
        }
    });

    shortcutKeyTable.setDragEnabled(false);
    shortcutKeyTable.setRowSelectionAllowed(false);
    shortcutKeyTable.setRowHeight(UIConstants.ROW_HEIGHT);
    shortcutKeyTable.setFocusable(false);
    shortcutKeyTable.setOpaque(true);
    shortcutKeyTable.setSortable(true);

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        shortcutKeyTable.setHighlighters(HighlighterFactory
                .createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR));
    }

    shortcutKeyTable.getColumnModel().getColumn(NAME_COLUMN).setMinWidth(145);
    shortcutKeyTable.getColumnModel().getColumn(NAME_COLUMN).setPreferredWidth(145);

    shortcutKeyTable.getColumnModel().getColumn(DESCRIPTION_COLUMN).setPreferredWidth(600);

    shortcutKeyTable.getColumnModel().getColumn(KEY_COLUMN).setMinWidth(120);
    shortcutKeyTable.getColumnModel().getColumn(KEY_COLUMN).setPreferredWidth(150);
    shortcutKeyTable.getColumnModel().getColumn(KEY_COLUMN).setCellRenderer(new KeyStrokeCellRenderer());
    shortcutKeyTable.getColumnModel().getColumn(KEY_COLUMN).setCellEditor(new KeyStrokeCellEditor());

    shortcutKeyTable.removeColumn(shortcutKeyTable.getColumnModel().getColumn(ACTION_INFO_COLUMN));

    shortcutKeyTable.getModel().addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent evt) {
            updateRestoreDefaultsButton();
        }
    });

    shortcutKeyScrollPane = new JScrollPane(shortcutKeyTable);

    restoreDefaultsButton = new JButton("Restore Defaults");
    restoreDefaultsButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            restoreDefaults();
        }
    });
}