Example usage for javax.swing AbstractListModel AbstractListModel

List of usage examples for javax.swing AbstractListModel AbstractListModel

Introduction

In this page you can find the example usage for javax.swing AbstractListModel AbstractListModel.

Prototype

AbstractListModel

Source Link

Usage

From source file:volker.streaming.music.gui.FormatPanel.java

private void initComponents() {
    formatLabel = new JLabel("How should your track info be displayed:");
    formatArea = new JTextArea(config.getFormat());
    formatLighter = new DefaultHighlighter();
    // TODO allow configuration of this color
    formatPainter = new DefaultHighlighter.DefaultHighlightPainter(new Color(200, 200, 255));
    formatArea.setHighlighter(formatLighter);
    formatArea.getDocument().addDocumentListener(new DocumentListener() {
        @Override/*from   w w  w.  j a v a2  s. c om*/
        public void removeUpdate(DocumentEvent e) {
            formatUpdated();
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            formatUpdated();
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            formatUpdated();
        }
    });

    ImageIcon infoIcon = null;
    try {
        InputStream is = getClass().getResourceAsStream("info.png");
        if (is == null) {
            LOG.error("Couldn't find the info image.");
        } else {
            infoIcon = new ImageIcon(ImageIO.read(is));
            is.close();
        }
    } catch (IOException e1) {
        LOG.error("Couldn't find the info image.", e1);
    }
    if (infoIcon == null) {
        formatInfoButton = new JButton("?");
    } else {
        formatInfoButton = new JButton(infoIcon);
        formatInfoButton.setBorder(BorderFactory.createEmptyBorder());
    }

    formatInfoButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            showFormatHelp();
        }
    });

    templateLabel = new JLabel("Your template:");

    tagLabel = new JLabel("Available tags:");
    tagList = new JList<String>(new AbstractListModel<String>() {
        private static final long serialVersionUID = -8886588605378873151L;

        @Override
        public int getSize() {
            return properTags.size();
        }

        @Override
        public String getElementAt(int index) {
            return properTags.get(index);
        }
    });
    tagScrollPane = new JScrollPane(tagList);

    previewLabel = new JLabel("Preview:");
    previewField = new JTextField();
    previewField.setEditable(false);
    previewField.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
    previewField.setBackground(new Color(255, 255, 150));

    formatUpdated();
    highlightTags();

    nullMessageLabel = new JLabel("Message to display when no song is found:");
    nullMessageField = new JTextField(config.getNoTrackMessage() == null ? "" : config.getNoTrackMessage());
    nullMessageField.getDocument().addDocumentListener(new DocumentListener() {
        public void action() {
            config.setNoTrackMessage(nullMessageField.getText());
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            action();
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            action();
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            action();
        }
    });

    hline = new JSeparator(SwingConstants.HORIZONTAL);
    fileLabel = new JLabel("Location of text file:");
    fileChooser = new JFileChooser();
    fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
    fileField = new JTextField(15);
    if (config.getOutputFile() != null) {
        fileField.setText(config.getOutputFile().getAbsolutePath());
    }
    fileField.getDocument().addDocumentListener(new DocumentListener() {
        public void action() {
            config.setOutputFile(new File(fileField.getText()));
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            action();
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            action();
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            action();
        }
    });
    fileButton = new JButton("Browse");
    fileButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            browseFile();
        }
    });
}

From source file:org.wings.SList.java

/**
 * Construct a SList that displays the elements in the specified
 * array./*from w w  w  .  j  av a  2  s . com*/
 */
public SList(final Object[] listData) {
    this(new AbstractListModel() {
        public int getSize() {
            return listData.length;
        }

        public Object getElementAt(int i) {
            return listData[i];
        }
    });
}

From source file:org.wings.SList.java

/**
 * Construct a SList that displays the elements in the specified
 * Vector.//w w  w  . j av  a2 s .c  o m
 */
public SList(final List listData) {
    this(new AbstractListModel() {
        public int getSize() {
            return listData.size();
        }

        public Object getElementAt(int i) {
            return listData.get(i);
        }
    });
}

From source file:org.wings.SList.java

/**
 * Constructs a SList with an empty model.
 *///  w  ww .  j  a  v a 2s  . co  m
public SList() {
    this(new AbstractListModel() {
        public int getSize() {
            return 0;
        }

        public Object getElementAt(int i) {
            return "No Data Model";
        }
    });
}

From source file:edu.ku.brc.ui.ChooseFromListDlg.java

/**
 * Create the UI for the dialog./*from   w w w. j  a  v  a 2  s.  c  o m*/
 * 
 * @param altName title for dialog
 * @param desc the list to be selected from
 * @param includeCancelBtn  indicates whether to create and display a cancel btn
 * @param includeHelpBtn indicates whether to create and display a help btn
 * @param helpContext help context identifier
 * @param titleArg title for dialog
 * @param desc the list to be selected from
 * @param includeCancelBtn indicates whether to create and display a cancel btn
 */
public void createUI() {
    setTitle(title);

    boolean hasDesc = StringUtils.isNotEmpty(desc);
    PanelBuilder builder = new PanelBuilder(
            new FormLayout("f:max(300px;p):g", "p," + (hasDesc ? "2px,p," : "") + "5px,p"));
    CellConstraints cc = new CellConstraints();
    //builder.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 10));
    builder.setDefaultDialogBorder();

    int y = 1;
    if (hasDesc) {
        JLabel lbl = createLabel(desc, SwingConstants.CENTER);
        builder.add(lbl, cc.xy(1, y));
        y += 2;
    }

    try {
        ListModel listModel = new AbstractListModel() {
            public int getSize() {
                return items.size();
            }

            public Object getElementAt(int index) {
                return items.get(index).toString();
            }
        };

        list = new JList(listModel);
        if (icon != null) {
            list.setCellRenderer(getListCellRenderer()); // icon comes from the base
            // class (it's probably size
            // 16)
        }
        list.setSelectionMode(isMultiSelect ? ListSelectionModel.MULTIPLE_INTERVAL_SELECTION
                : ListSelectionModel.SINGLE_SELECTION);
        list.setVisibleRowCount(10);

        if (selectedIndices != null) {
            list.setSelectedIndices(selectedIndices);
        }

        list.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                if (e.getClickCount() == 2) {
                    okBtn.doClick(); // emulate button click
                }
            }
        });
        list.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {
                if (!e.getValueIsAdjusting()) {
                    updateUIState();
                }
            }
        });
        JScrollPane listScroller = new JScrollPane(list);
        builder.add(listScroller, cc.xy(1, y));
        y += 2;

        // Bottom Button UI
        okBtn = createButton(StringUtils.isNotEmpty(okLabel) ? okLabel : getResourceString("OK"));
        okBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                isCancelled = false;
                btnPressed = OK_BTN;
                setVisible(false);
            }
        });
        getRootPane().setDefaultButton(okBtn);

        if ((whichBtns & CANCEL_BTN) == CANCEL_BTN) {
            cancelBtn = createButton(
                    StringUtils.isNotEmpty(cancelLabel) ? cancelLabel : getResourceString("CANCEL"));
            cancelBtn.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    isCancelled = true;
                    btnPressed = CANCEL_BTN;
                    setVisible(false);
                }
            });
        }

        if ((whichBtns & HELP_BTN) == HELP_BTN) {
            helpBtn = createButton(
                    StringUtils.isNotEmpty(cancelLabel) ? cancelLabel : getResourceString("HELP"));
            if (StringUtils.isNotEmpty(helpContext)) {
                HelpMgr.registerComponent(helpBtn, helpContext);
            } else {
                helpBtn.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent ae) {
                        btnPressed = HELP_BTN;
                    }
                });
            }
        }

        if ((whichBtns & APPLY_BTN) == APPLY_BTN) {
            applyBtn = createButton(
                    StringUtils.isNotEmpty(applyLabel) ? applyLabel : getResourceString("Apply"));
            applyBtn.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    btnPressed = APPLY_BTN;
                    if (isCloseOnApply) {
                        isCancelled = false;
                        setVisible(false);
                    }
                }
            });
        }

        JPanel bb;
        if (whichBtns == OK_BTN) {
            bb = ButtonBarFactory.buildOKBar(okBtn);

        } else if (whichBtns == OKCANCEL) {
            bb = ButtonBarFactory.buildOKCancelBar(okBtn, cancelBtn);

        } else if (whichBtns == OKCANCELAPPLY) {
            bb = ButtonBarFactory.buildOKCancelApplyBar(okBtn, cancelBtn, applyBtn);

        } else if (whichBtns == OKHELP) {
            bb = ButtonBarFactory.buildOKHelpBar(okBtn, helpBtn);

        } else if (whichBtns == OKCANCELHELP) {
            bb = ButtonBarFactory.buildOKCancelHelpBar(okBtn, cancelBtn, helpBtn);

        } else if (whichBtns == OKCANCELAPPLYHELP) {
            bb = ButtonBarFactory.buildOKCancelApplyHelpBar(okBtn, cancelBtn, applyBtn, helpBtn);

        } else {
            bb = ButtonBarFactory.buildOKBar(okBtn);
        }

        builder.add(bb, cc.xy(1, y));
        y += 2;

        updateUIState();

    } catch (Exception ex) {
        edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(ChooseFromListDlg.class, ex);
        log.error(ex);
    }

    setContentPane(builder.getPanel());
    pack();
    // setLocationRelativeTo(locationComp);
}

From source file:mendeley2kindle.MainUIFrame.java

public void openMendeley(File path) {
    try {//from   w w w  .ja v  a2s.  c  o  m
        mendeley.open(path.getPath());

        final List<MCollection> list = mendeley.findCollections();
        ListModel model = new AbstractListModel() {
            private static final long serialVersionUID = 1L;

            @Override
            public Object getElementAt(int i) {
                return list.get(i);
            }

            @Override
            public int getSize() {
                return list.size();
            }
        };
        collectionsJList.setModel(model);
        if (mendeley.isOpened) {
            mainButton.removeActionListener(mainButton.getActionListeners()[0]);
            if (kindle.isOpened()) {
                fireEnableComponents();
                mainButton.addActionListener(new SyncListener());
                mainButton.setText("Export to Kindle");
            } else {
                mainButton.addActionListener(new SelectKindleListener());
                mainButton.setText("Select Kindle device");
            }
        }
    } catch (SQLException e) {
        e.printStackTrace();
    }
}

From source file:org.wings.SList.java

/**
 * A convenience method that constructs a ListModel from an array of Objects
 * and then applies setModel to it./*from   w ww. j ava 2s  . c om*/
 *
 * @param listData an array of Objects containing the items to display
 *                 in the list
 * @see #setModel
 */
public void setListData(final Object[] listData) {
    setModel(new AbstractListModel() {
        public int getSize() {
            return listData.length;
        }

        public Object getElementAt(int i) {
            return listData[i];
        }
    });
}

From source file:org.wings.SList.java

/**
 * A convenience method that constructs a ListModel from a List
 * and then applies setModel to it./* w w w.j a v  a  2 s  .  c  om*/
 *
 * @param listData a Vector containing the items to display in the list
 * @see #setModel
 */
public void setListData(final List listData) {
    setModel(new AbstractListModel() {
        public int getSize() {
            return listData.size();
        }

        public Object getElementAt(int i) {
            return listData.get(i);
        }
    });
}

From source file:net.nikr.eve.jeveasset.gui.tabs.tracker.TrackerTab.java

private void updateOwners() {
    updateLock = true;/*from w w w  .  j  a v  a2  s .  c o m*/
    Set<String> owners = new TreeSet<String>(Settings.get().getTrackerData().keySet());
    final List<String> ownersList;
    if (jAllProfiles.isSelected()) {
        ownersList = new ArrayList<String>(owners);
    } else {
        ownersList = new ArrayList<String>();
        for (String s : owners) {
            if (program.getOwnerNames(false).contains(s)) {
                ownersList.add(s);
            }
        }
    }
    if (owners.isEmpty()) {
        jOwners.setEnabled(false);
        jOwners.setModel(new AbstractListModel<String>() {
            @Override
            public int getSize() {
                return 1;
            }

            @Override
            public String getElementAt(int index) {
                return TabsTracker.get().noDataFound();
            }
        });
    } else {
        jOwners.setEnabled(true);
        jOwners.setModel(new AbstractListModel<String>() {
            @Override
            public int getSize() {
                return ownersList.size();
            }

            @Override
            public String getElementAt(int index) {
                return ownersList.get(index);
            }
        });
        jOwners.selectAll();
    }
    updateLock = false;
}

From source file:com.mirth.connect.connectors.file.FileReader.java

private void initComponents() {
    schemeLabel = new JLabel();
    schemeLabel.setText("Method:");
    schemeComboBox = new MirthComboBox();
    schemeComboBox.setModel(new DefaultComboBoxModel(new String[] { "file", "ftp", "sftp", "smb", "webdav" }));
    schemeComboBox.setToolTipText(/*  w  w w .j  a  va 2 s  . c  o m*/
            "The basic method used to access files to be read - file (local filesystem), FTP, SFTP, Samba share, or WebDAV");
    schemeComboBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            schemeComboBoxActionPerformed(evt);
        }
    });

    testConnectionButton = new JButton();
    testConnectionButton.setText("Test Read");
    testConnectionButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            testConnectionActionPerformed(evt);
        }
    });

    advancedSettingsButton = new JButton(new ImageIcon(Frame.class.getResource("images/wrench.png")));
    advancedSettingsButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            advancedFileSettingsActionPerformed();
        }
    });

    summaryLabel = new JLabel("Advanced Options:");
    summaryField = new JLabel("");

    directoryLabel = new JLabel();
    directoryLabel.setText("Directory:");
    directoryField = new MirthTextField();
    directoryField.setToolTipText("The directory (folder) in which the files to be read can be found.");

    hostLabel = new JLabel();
    hostLabel.setText("ftp://");
    hostField = new MirthTextField();
    hostField.setToolTipText(
            "The name or IP address of the host (computer) on which the files to be read can be found.");
    pathLabel = new JLabel();
    pathLabel.setText("/");
    pathField = new MirthTextField();
    pathField.setToolTipText("The directory (folder) in which the files to be read can be found.");

    filenameFilterLabel = new JLabel();
    filenameFilterLabel.setText("Filename Filter Pattern:");
    fileNameFilterField = new MirthTextField();
    fileNameFilterField.setToolTipText(
            "<html>The pattern which names of files must match in order to be read.<br>Files with names that do not match the pattern will be ignored.</html>");
    filenameFilterRegexCheckBox = new MirthCheckBox();
    filenameFilterRegexCheckBox.setBackground(UIConstants.BACKGROUND_COLOR);
    filenameFilterRegexCheckBox.setText("Regular Expression");
    filenameFilterRegexCheckBox.setToolTipText(
            "<html>If Regex is checked, the pattern is treated as a regular expression.<br>If Regex is not checked, it is treated as a pattern that supports wildcards and a comma separated list.</html>");

    directoryRecursionLabel = new JLabel();
    directoryRecursionLabel.setText("Include All Subdirectories:");

    directoryRecursionYesRadio = new MirthRadioButton();
    directoryRecursionYesRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    directoryRecursionYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    directoryRecursionYesRadio.setText("Yes");
    directoryRecursionYesRadio.setToolTipText(
            "<html>Select Yes to traverse directories recursively and search for files in each one.</html>");
    directoryRecursionYesRadio.setMargin(new Insets(0, 0, 0, 0));
    directoryRecursionYesRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            directoryRecursionYesRadioActionPerformed(evt);
        }
    });

    directoryRecursionNoRadio = new MirthRadioButton();
    directoryRecursionNoRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    directoryRecursionNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    directoryRecursionNoRadio.setSelected(true);
    directoryRecursionNoRadio.setText("No");
    directoryRecursionNoRadio.setToolTipText(
            "<html>Select No to only search for files in the selected directory/location, ignoring subdirectories.</html>");
    directoryRecursionNoRadio.setMargin(new Insets(0, 0, 0, 0));

    directoryRecursionButtonGroup = new ButtonGroup();
    directoryRecursionButtonGroup.add(directoryRecursionYesRadio);
    directoryRecursionButtonGroup.add(directoryRecursionNoRadio);

    ignoreDotFilesLabel = new JLabel();
    ignoreDotFilesLabel.setText("Ignore . files:");

    ignoreDotFilesYesRadio = new MirthRadioButton();
    ignoreDotFilesYesRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    ignoreDotFilesYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    ignoreDotFilesYesRadio.setText("Yes");
    ignoreDotFilesYesRadio.setToolTipText("Select Yes to ignore all files starting with a period.");
    ignoreDotFilesYesRadio.setMargin(new Insets(0, 0, 0, 0));

    ignoreDotFilesNoRadio = new MirthRadioButton();
    ignoreDotFilesNoRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    ignoreDotFilesNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    ignoreDotFilesNoRadio.setText("No");
    ignoreDotFilesNoRadio.setToolTipText("Select No to process files starting with a period.");
    ignoreDotFilesNoRadio.setMargin(new Insets(0, 0, 0, 0));

    ignoreDotFilesButtonGroup = new ButtonGroup();
    ignoreDotFilesButtonGroup.add(ignoreDotFilesYesRadio);
    ignoreDotFilesButtonGroup.add(ignoreDotFilesNoRadio);

    anonymousLabel = new JLabel();
    anonymousLabel.setText("Anonymous:");

    anonymousYesRadio = new MirthRadioButton();
    anonymousYesRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    anonymousYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    anonymousYesRadio.setText("Yes");
    anonymousYesRadio
            .setToolTipText("Connects to the file anonymously instead of using a username and password.");
    anonymousYesRadio.setMargin(new Insets(0, 0, 0, 0));
    anonymousYesRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            anonymousYesActionPerformed(evt);
        }
    });

    anonymousNoRadio = new MirthRadioButton();
    anonymousNoRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    anonymousNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    anonymousNoRadio.setSelected(true);
    anonymousNoRadio.setText("No");
    anonymousNoRadio
            .setToolTipText("Connects to the file using a username and password instead of anonymously.");
    anonymousNoRadio.setMargin(new Insets(0, 0, 0, 0));
    anonymousNoRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            anonymousNoActionPerformed(evt);
        }
    });

    anonymousButtonGroup = new ButtonGroup();
    anonymousButtonGroup.add(anonymousYesRadio);
    anonymousButtonGroup.add(anonymousNoRadio);

    usernameLabel = new JLabel();
    usernameLabel.setText("Username:");
    usernameField = new MirthTextField();
    usernameField.setToolTipText("The user name used to gain access to the server.");

    passwordLabel = new JLabel();
    passwordLabel.setText("Password:");
    passwordField = new MirthPasswordField();
    passwordField.setToolTipText("The password used to gain access to the server.");

    timeoutLabel = new JLabel();
    timeoutLabel.setText("Timeout (ms):");
    timeoutField = new MirthTextField();
    timeoutField.setToolTipText("The socket timeout (in ms) for connecting to the server.");

    secureModeLabel = new JLabel();
    secureModeLabel.setText("Secure Mode:");

    secureModeYesRadio = new MirthRadioButton();
    secureModeYesRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    secureModeYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    secureModeYesRadio.setText("Yes");
    secureModeYesRadio.setToolTipText(
            "<html>Select Yes to connect to the server via HTTPS.<br>Select No to connect via HTTP.</html>");
    secureModeYesRadio.setMargin(new Insets(0, 0, 0, 0));
    secureModeYesRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            secureModeYesActionPerformed(evt);
        }
    });

    secureModeNoRadio = new MirthRadioButton();
    secureModeNoRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    secureModeNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    secureModeNoRadio.setSelected(true);
    secureModeNoRadio.setText("No");
    secureModeNoRadio.setToolTipText(
            "<html>Select Yes to connect to the server via HTTPS.<br>Select No to connect via HTTP.</html>");
    secureModeNoRadio.setMargin(new Insets(0, 0, 0, 0));
    secureModeNoRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            secureModeNoActionPerformed(evt);
        }
    });

    secureModeButtonGroup = new ButtonGroup();
    secureModeButtonGroup.add(secureModeYesRadio);
    secureModeButtonGroup.add(secureModeNoRadio);

    passiveModeLabel = new JLabel();
    passiveModeLabel.setText("Passive Mode:");

    passiveModeYesRadio = new MirthRadioButton();
    passiveModeYesRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    passiveModeYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    passiveModeYesRadio.setText("Yes");
    passiveModeYesRadio.setToolTipText(
            "<html>Select Yes to connect to the server in \"passive mode\".<br>Passive mode sometimes allows a connection through a firewall that normal mode does not.</html>");
    passiveModeYesRadio.setMargin(new Insets(0, 0, 0, 0));

    passiveModeNoRadio = new MirthRadioButton();
    passiveModeNoRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    passiveModeNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    passiveModeNoRadio.setSelected(true);
    passiveModeNoRadio.setText("No");
    passiveModeNoRadio.setToolTipText(
            "Select Yes to connect to the server in \"normal mode\" as opposed to passive mode.");
    passiveModeNoRadio.setMargin(new Insets(0, 0, 0, 0));

    passiveModeButtonGroup = new ButtonGroup();
    passiveModeButtonGroup.add(passiveModeYesRadio);
    passiveModeButtonGroup.add(passiveModeNoRadio);

    validateConnectionLabel = new JLabel();
    validateConnectionLabel.setText("Validate Connection:");

    validateConnectionYesRadio = new MirthRadioButton();
    validateConnectionYesRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    validateConnectionYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    validateConnectionYesRadio.setText("Yes");
    validateConnectionYesRadio
            .setToolTipText("Select Yes to test the connection to the server before each operation.");
    validateConnectionYesRadio.setMargin(new Insets(0, 0, 0, 0));

    validateConnectionNoRadio = new MirthRadioButton();
    validateConnectionNoRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    validateConnectionNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    validateConnectionNoRadio.setText("No");
    validateConnectionNoRadio
            .setToolTipText("Select No to skip testing the connection to the server before each operation.");
    validateConnectionNoRadio.setMargin(new Insets(0, 0, 0, 0));

    validateConnectionButtonGroup = new ButtonGroup();
    validateConnectionButtonGroup.add(validateConnectionYesRadio);
    validateConnectionButtonGroup.add(validateConnectionNoRadio);

    afterProcessingActionLabel = new JLabel();
    afterProcessingActionLabel.setText("After Processing Action:");

    afterProcessingActionComboBox = new MirthComboBox();
    afterProcessingActionComboBox.setModel(new DefaultComboBoxModel(new String[] { "None", "Move", "Delete" }));
    afterProcessingActionComboBox.setToolTipText(
            "<html>Select Move to move and/or rename the file after successful processing.<br/>Select Delete to delete the file after successful processing.</html>");
    afterProcessingActionComboBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            afterProcessingActionComboBoxActionPerformed(evt);
        }
    });

    moveToDirectoryLabel = new JLabel();
    moveToDirectoryLabel.setText("Move-to Directory:");
    moveToDirectoryField = new MirthTextField();
    moveToDirectoryField.setToolTipText(
            "<html>If successfully processed files should be moved to a different directory (folder), enter that directory here.<br>The directory name specified may include template substitutions from the list to the right.<br>If this field is left empty, successfully processed files will not be moved to a different directory.</html>");

    moveToFileNameLabel = new JLabel();
    moveToFileNameLabel.setText("Move-to File Name:");
    moveToFileNameField = new MirthTextField();
    moveToFileNameField.setToolTipText(
            "<html>If successfully processed files should be renamed, enter the new name here.<br>The filename specified may include template substitutions from the list to the right.<br>If this field is left empty, successfully processed files will not be renamed.</html>");

    errorReadingActionLabel = new JLabel();
    errorReadingActionLabel.setText("Error Reading Action:");

    errorReadingActionComboBox = new MirthComboBox();
    errorReadingActionComboBox.setModel(new DefaultComboBoxModel(new String[] { "None", "Move", "Delete" }));
    errorReadingActionComboBox.setToolTipText(
            "<html>Select Move to move and/or rename files that have failed to be read in.<br/>Select Delete to delete files that have failed to be read in.</html>");
    errorReadingActionComboBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            errorReadingActionComboBoxActionPerformed(evt);
        }
    });

    errorResponseActionLabel = new JLabel();
    errorResponseActionLabel.setText("Error in Response Action:");

    errorResponseActionComboBox = new MirthComboBox();
    errorResponseActionComboBox
            .setModel(new DefaultComboBoxModel(new String[] { "After Processing Action", "Move", "Delete" }));
    errorResponseActionComboBox.setToolTipText(
            "<html>Select Move to move and/or rename the file if an ERROR response is returned.<br/>Select Delete to delete the file if an ERROR response is returned.<br/>If After Processing Action is selected, the After Processing Action will apply.<br/>This action is only available if Process Batch Files is disabled.</html>");
    errorResponseActionComboBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            errorResponseActionComboBoxActionPerformed(evt);
        }
    });

    errorMoveToDirectoryLabel = new JLabel();
    errorMoveToDirectoryLabel.setText("Error Move-to Directory:");
    errorMoveToDirectoryField = new MirthTextField();
    errorMoveToDirectoryField.setToolTipText(
            "<html>If files which cause processing errors should be moved to a different directory (folder), enter that directory here.<br>The directory name specified may include template substitutions from the list to the right.<br>If this field is left empty, files which cause processing errors will not be moved to a different directory.</html>");

    errorMoveToFileNameLabel = new JLabel();
    errorMoveToFileNameLabel.setText("Error Move-to File Name:");
    errorMoveToFileNameField = new MirthTextField();
    errorMoveToFileNameField.setToolTipText(
            "<html>If files which cause processing errors should be renamed, enter the new name here.<br/>The filename specified may include template substitutions from the list to the right.<br/>If this field is left empty, files which cause processing errors will not be renamed.</html>");

    variableListScrollPane = new JScrollPane();
    variableListScrollPane.setBorder(null);
    variableListScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    variableListScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);

    mirthVariableList = new MirthVariableList();
    mirthVariableList.setBorder(BorderFactory.createEtchedBorder());
    mirthVariableList.setModel(new AbstractListModel() {
        String[] strings = { "channelName", "channelId", "DATE", "COUNT", "UUID", "SYSTIME",
                "originalFilename" };

        public int getSize() {
            return strings.length;
        }

        public Object getElementAt(int i) {
            return strings[i];
        }
    });
    variableListScrollPane.setViewportView(mirthVariableList);

    checkFileAgeLabel = new JLabel();
    checkFileAgeLabel.setText("Check File Age:");

    checkFileAgeYesRadio = new MirthRadioButton();
    checkFileAgeYesRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    checkFileAgeYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    checkFileAgeYesRadio.setText("Yes");
    checkFileAgeYesRadio
            .setToolTipText("Select Yes to skip files that are created within the specified age below.");
    checkFileAgeYesRadio.setMargin(new Insets(0, 0, 0, 0));
    checkFileAgeYesRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            checkFileAgeYesActionPerformed(evt);
        }
    });

    checkFileAgeNoRadio = new MirthRadioButton();
    checkFileAgeNoRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    checkFileAgeNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    checkFileAgeNoRadio.setSelected(true);
    checkFileAgeNoRadio.setText("No");
    checkFileAgeNoRadio.setToolTipText("Select No to process files regardless of age.");
    checkFileAgeNoRadio.setMargin(new Insets(0, 0, 0, 0));
    checkFileAgeNoRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            checkFileAgeNoActionPerformed(evt);
        }
    });

    checkFileAgeButtonGroup = new ButtonGroup();
    checkFileAgeButtonGroup.add(checkFileAgeYesRadio);
    checkFileAgeButtonGroup.add(checkFileAgeNoRadio);

    fileAgeLabel = new JLabel();
    fileAgeLabel.setText("File Age (ms):");
    fileAgeField = new MirthTextField();
    fileAgeField.setToolTipText(
            "If Check File Age Yes is selected, only the files created that are older than the specified value in milliseconds will be processed.");

    fileSizeLabel = new JLabel();
    fileSizeLabel.setText("File Size (bytes):");
    fileSizeMinimumField = new MirthTextField();
    fileSizeMinimumField.setToolTipText("<html>The minimum size (in bytes) of files to be accepted.</html>");
    fileSizeDashLabel = new JLabel();
    fileSizeDashLabel.setText("-");
    fileSizeMaximumField = new MirthTextField();
    fileSizeMaximumField.setToolTipText(
            "<html>The maximum size (in bytes) of files to be accepted.<br/>This option has no effect if Ignore Maximum is checked.</html>");
    ignoreFileSizeMaximumCheckBox = new MirthCheckBox();
    ignoreFileSizeMaximumCheckBox.setBackground(UIConstants.BACKGROUND_COLOR);
    ignoreFileSizeMaximumCheckBox.setText("Ignore Maximum");
    ignoreFileSizeMaximumCheckBox.setToolTipText(
            "<html>If checked, only the minimum file size will be checked against incoming files.</html>");
    ignoreFileSizeMaximumCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            ignoreFileSizeMaximumCheckBoxActionPerformed(evt);
        }
    });

    sortFilesByLabel = new JLabel();
    sortFilesByLabel.setText("Sort Files By:");
    sortByComboBox = new MirthComboBox();
    sortByComboBox.setModel(new DefaultComboBoxModel(new String[] { "Date", "Name", "Size" }));
    sortByComboBox.setToolTipText(
            "<html>Selects the order in which files should be processed, if there are multiple files available to be processed.<br>Files can be processed by Date (oldest last modification date first), Size (smallest first) or name (a before z, etc.).</html>");

    fileTypeLabel = new JLabel();
    fileTypeLabel.setText("File Type:");

    fileTypeBinary = new MirthRadioButton();
    fileTypeBinary.setBackground(UIConstants.BACKGROUND_COLOR);
    fileTypeBinary.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    fileTypeBinary.setText("Binary");
    fileTypeBinary.setToolTipText(
            "<html>Select Binary if files contain binary data; the contents will be Base64 encoded before processing.<br>Select Text if files contain text data; the contents will be encoded using the specified character set encoding.</html>");
    fileTypeBinary.setMargin(new Insets(0, 0, 0, 0));
    fileTypeBinary.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            fileTypeBinaryActionPerformed(evt);
        }
    });

    fileTypeText = new MirthRadioButton();
    fileTypeText.setBackground(UIConstants.BACKGROUND_COLOR);
    fileTypeText.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    fileTypeText.setSelected(true);
    fileTypeText.setText("Text");
    fileTypeText.setToolTipText(
            "<html>Select Binary if files contain binary data; the contents will be Base64 encoded before processing.<br>Select Text if files contain text data; the contents will be encoded using the specified character set encoding.</html>");
    fileTypeText.setMargin(new Insets(0, 0, 0, 0));
    fileTypeText.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            fileTypeASCIIActionPerformed(evt);
        }
    });

    fileTypeButtonGroup = new ButtonGroup();
    fileTypeButtonGroup.add(fileTypeBinary);
    fileTypeButtonGroup.add(fileTypeText);

    encodingLabel = new JLabel();
    encodingLabel.setText("Encoding:");

    charsetEncodingComboBox = new MirthComboBox();
    charsetEncodingComboBox.setModel(new DefaultComboBoxModel(new String[] { "Default", "UTF-8", "ISO-8859-1",
            "UTF-16 (le)", "UTF-16 (be)", "UTF-16 (bom)", "US-ASCII" }));
    charsetEncodingComboBox.setToolTipText(
            "If File Type Text is selected, select the character set encoding (ASCII, UTF-8, etc.) to be used in reading the contents of each file.");
}