Example usage for javax.swing.event TableModelListener TableModelListener

List of usage examples for javax.swing.event TableModelListener TableModelListener

Introduction

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

Prototype

TableModelListener

Source Link

Usage

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  ww .  j  av a2 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();
        }
    });
}

From source file:com.diversityarrays.kdxplore.trialmgr.trait.TraitExplorerPanel.java

public TraitExplorerPanel(MessagePrinter mp, OfflineData od, DALClientProvider clientProvider,
        // KdxUploadHandler uploadHandler,
        BackgroundRunner backgroundRunner, ImageIcon addBarcodeIcon,
        Transformer<Trial, Boolean> checkIfEditorActive) {
    super(new BorderLayout());

    this.backgroundRunner = backgroundRunner;
    this.clientProvider = clientProvider;
    // this.uploadHandler = uploadHandler;
    this.messagePrinter = mp;
    this.offlineData = od;
    this.checkIfEditorActive = checkIfEditorActive;

    offlineData.addOfflineDataChangeListener(offlineDataListener);

    editingLocked.setIcon(KDClientUtils.getIcon(ImageId.LOCKED));
    editingLocked.addActionListener(new ActionListener() {
        @Override//from   w  ww.ja va  2s  .  c  o  m
        public void actionPerformed(ActionEvent e) {
            changeEditable(editingLocked.isSelected(), DONT_OVERRIDE);
        }
    });

    changeManager.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            updateUndoRedoActions();
        }
    });

    KDClientUtils.initAction(ImageId.TRASH_24, deleteTraitsAction, "Remove Trait");
    deleteTraitsAction.setEnabled(false);

    KDClientUtils.initAction(ImageId.REFRESH_24, refreshAction, "Refresh Data");

    KDClientUtils.initAction(ImageId.PLUS_BLUE_24, addNewTraitAction, "Add Trait");

    KDClientUtils.initAction(ImageId.UPLOAD_24, uploadTraitsAction, "Upload Traits");

    KDClientUtils.initAction(ImageId.ADD_TRIALS_24, importTraitsAction, "Import Traits");

    KDClientUtils.initAction(ImageId.EXPORT_24, exportTraitsAction, "Export Traits");

    try {
        Class.forName("com.diversityarrays.kdxplore.upload.TraitUploadTask");
    } catch (ClassNotFoundException e1) {
        uploadTraitsAction.setEnabled(false);
        if (RunMode.getRunMode().isDeveloper()) {
            new Toast((JComponent) null,
                    "<HTML>Developer Warning<BR>" + "Trait Upload currently unavailable<BR>", 4000)
                            .showAsError();
        }
    }

    traitPropertiesTable
            .setTransferHandler(TableTransferHandler.initialiseForCopySelectAll(traitPropertiesTable, true));
    traitPropertiesTableModel.addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent e) {
            if (traitPropertiesTableModel.getRowCount() > 0) {
                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        GuiUtil.initialiseTableColumnWidths(traitPropertiesTable);
                    }
                });
                traitPropertiesTableModel.removeTableModelListener(this);
            }
        }
    });

    traitTableModel.addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent e) {
            showCorrectCard();
        }
    });

    TrialManagerPreferences preferences = TrialManagerPreferences.getInstance();
    preferences.addChangeListener(TrialManagerPreferences.BAD_FOR_CALC, badForCalcColorChangeListener);
    badForCalc.setForeground(preferences.getBadForCalcColor());
    badForCalc.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (SwingUtilities.isLeftMouseButton(e)) {
                KdxPreference<Color> pref = TrialManagerPreferences.BAD_FOR_CALC;
                String title = pref.getName();
                KdxplorePreferenceEditor.startEditorDialog(TraitExplorerPanel.this, title, pref);
            }
        }
    });

    traitsTable.setAutoCreateRowSorter(true);
    int index = traitTableModel.getTraitNameColumnIndex();
    if (index >= 0) {
        traitsTable.getColumnModel().getColumn(index).setCellRenderer(traitNameCellRenderer);
    }

    traitsTable.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (SwingUtilities.isLeftMouseButton(e) && 2 == e.getClickCount()) {
                e.consume();

                int vrow = traitsTable.rowAtPoint(e.getPoint());
                if (vrow >= 0) {
                    int mrow = traitsTable.convertRowIndexToModel(vrow);
                    if (mrow >= 0) {
                        Trait trait = traitTableModel.getTraitAtRow(mrow);
                        Integer selectViewRow = null;
                        if (!traitTrialsTableModel.isSelectedTrait(trait)) {
                            selectViewRow = vrow;
                        }
                        if (traitsEditable) {
                            startEditingTraitInternal(trait, selectViewRow, null);
                        } else {
                            warnEditingLocked();
                        }
                    }
                }
            }
        }
    });

    traitsTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    traitsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {

                List<Trait> selectedTraits = getSelectedTraits();
                traitTrialsTableModel.setSelectedTraits(selectedTraits);

                if (selectedTraits.size() == 1) {
                    Trait trait = null;
                    int vrow = traitsTable.getSelectedRow();
                    if (vrow >= 0) {
                        int mrow = traitsTable.convertRowIndexToModel(vrow);
                        if (mrow >= 0) {
                            trait = traitTableModel.getEntityAt(mrow);
                        }
                    }
                    showTraitDetails(trait);
                }

                deleteTraitsAction.setEnabled(selectedTraits.size() > 0);

                showCorrectCard();
            }
        }
    });

    TraitTableModel.initValidationExpressionRenderer(traitsTable);
    if (RunMode.getRunMode().isDeveloper()) {
        TraitTableModel.initTableForRawExpression(traitsTable);
    }
    cardPanel.add(noTraitsComponent, CARD_NO_TRAITS);
    cardPanel.add(selectTraitComponent, CARD_SELECT_TO_EDIT);
    cardPanel.add(new JScrollPane(traitPropertiesTable), CARD_TRAIT_EDITOR);

    JButton undoButton = initAction(undoAction, ImageId.UNDO_24, "Undo",
            KeyStroke.getKeyStroke('Z', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    JButton redoButton = initAction(redoAction, ImageId.REDO_24, "Redo",
            KeyStroke.getKeyStroke('Y', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    Box undoRedoButtons = Box.createHorizontalBox();
    undoRedoButtons.add(undoButton);
    undoRedoButtons.add(redoButton);

    JPanel detailsPanel = new JPanel(new BorderLayout());
    detailsPanel.add(GuiUtil.createLabelSeparator("Details", undoRedoButtons), BorderLayout.NORTH);
    detailsPanel.add(cardPanel, BorderLayout.CENTER);
    detailsPanel.add(legendPanel, BorderLayout.SOUTH);

    PromptScrollPane scrollPane = new PromptScrollPane(traitsTable,
            "Drag/Drop Traits CSV file or use 'Import Traits'");

    TableTransferHandler tth = TableTransferHandler.initialiseForCopySelectAll(traitsTable, true);
    traitsTable.setTransferHandler(new ChainingTransferHandler(flth, tth));

    scrollPane.setTransferHandler(flth);

    if (addBarcodeIcon == null) {
        barcodesMenuAction.putValue(Action.NAME, "Barcodes...");
    } else {
        barcodesMenuAction.putValue(Action.SMALL_ICON, addBarcodeIcon);
    }

    italicsForProtectedCheckbox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            traitNameCellRenderer.setUseItalicsForProtected(italicsForProtectedCheckbox.isSelected());
            traitsTable.repaint();
        }
    });

    Box leftTopControls = Box.createHorizontalBox();
    leftTopControls.add(importTraitsButton);
    leftTopControls.add(barcodesMenuButton);
    leftTopControls.add(new JButton(addNewTraitAction));
    leftTopControls.add(new JButton(uploadTraitsAction));
    leftTopControls.add(new JButton(exportTraitsAction));

    leftTopControls.add(Box.createHorizontalGlue());

    leftTopControls.add(editingLocked);
    leftTopControls.add(fixTraitLevelsButton);
    leftTopControls.add(refreshButton);
    leftTopControls.add(Box.createHorizontalStrut(8));
    leftTopControls.add(new JButton(deleteTraitsAction));
    // leftTopControls.add(Box.createHorizontalStrut(4));

    Box explanations = Box.createHorizontalBox();
    explanations.add(italicsForProtectedCheckbox);
    explanations.add(badForCalc);
    explanations.add(Box.createHorizontalGlue());

    fixTraitLevelsButton.setToolTipText("Fix Traits with " + TraitLevel.UNDECIDABLE.visible + " 'Level'");
    fixTraitLevelsButton.setVisible(false);

    JPanel leftTop = new JPanel(new BorderLayout());
    leftTop.add(leftTopControls, BorderLayout.NORTH);
    leftTop.add(scrollPane, BorderLayout.CENTER);
    leftTop.add(explanations, BorderLayout.SOUTH);

    JPanel leftBot = new JPanel(new BorderLayout());
    leftBot.add(GuiUtil.createLabelSeparator("Used by Trials"), BorderLayout.NORTH);
    leftBot.add(new PromptScrollPane(traitTrialsTable, "Any Trials using selected Traits appear here"));

    JSplitPane leftSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, leftTop, leftBot);
    leftSplit.setResizeWeight(0.5);

    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftSplit, detailsPanel);
    splitPane.setOneTouchExpandable(true);
    splitPane.setResizeWeight(0.5);

    add(splitPane, BorderLayout.CENTER);
}

From source file:com.mgmtp.perfload.loadprofiles.ui.AppFrame.java

private void initModels() {
    EventList<LoadProfileEntity> treeItems = GlazedLists.eventListOf();
    treeModel = new EventsTreeModel(treeItems);
    tree.setModel(treeModel);//from w w  w  . j  a va 2  s.  c o  m

    TableFormat<SelectionDecorator> tableFormat = GlazedLists.tableFormat(SelectionDecorator.class,
            new String[] { "selected", "baseObject.name" }, new String[] { "Selected", "Name" },
            new boolean[] { true, false });

    decoratedClients = GlazedLists.eventListOf();

    EventTableModel<SelectionDecorator> clientsTableModel = new EventTableModel<SelectionDecorator>(
            decoratedClients, tableFormat);
    tblClients.setModel(clientsTableModel);
    tblClients.getColumnModel().getColumn(0).setMaxWidth(24);

    decoratedTargets = GlazedLists.eventListOf();
    oneTimeDecoratedTargets = GlazedLists.eventListOf();

    EventTableModel<SelectionDecorator> targetsTableModel = new EventTableModel<SelectionDecorator>(
            decoratedTargets, tableFormat);
    targetsTableModel.addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(final TableModelEvent e) {
            ModelUtils.updateTargetDecorators(decoratedTargets, oneTimeDecoratedTargets,
                    loadProfilesController.getTargets(), true);
            if (activeLoadProfileEntityPanel instanceof OneTimePanel) {
                activeLoadProfileEntityPanel.repaint();
            }
        }
    });

    tblTargets.setModel(targetsTableModel);
    tblTargets.getColumnModel().getColumn(0).setMaxWidth(24);

    EventList<Target> targets = GlazedLists.<Target>eventListOf();
    EventList<Operation> operations = GlazedLists.<Operation>eventListOf();
    EventList<Client> clients = GlazedLists.<Client>eventListOf();

    stairsPanel.setCboOperationModel(new EventComboBoxModel<Operation>(operations));
    oneTimePanel.setCboOperationModel(new EventComboBoxModel<Operation>(operations));

    loadProfilesController.setTreeItems(treeItems);
    loadProfilesController.setOperations(operations);
    loadProfilesController.setTargets(targets);
    loadProfilesController.setClients(clients);

    oneTimePanel
            .setTblTargetModel(new EventTableModel<SelectionDecorator>(oneTimeDecoratedTargets, tableFormat));
}

From source file:com.diversityarrays.kdxplore.specgroup.SpecimenGroupEditor.java

private JComponent createBottomComponent() {
    // =========//from w ww.  jav a2s.  com
    specimenTableModel = new SpecimenTableModel(null);
    specimenTableModel.addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent e) {
            exportSpecimenList.setEnabled(specimenTableModel.getRowCount() > 0);
        }
    });
    specimenTable = new JTable(specimenTableModel);

    specimenTable.setAutoCreateRowSorter(true);
    specimenTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                deleteSpecimenFromList.setEnabled(specimenTable.getSelectedRowCount() > 0);
            }
        }
    });
    //      specimenTableModel.addTableModelListener(new TableModelListener() {
    //            @Override
    //            public void tableChanged(TableModelEvent e) {
    //                fileDropTarget.setVisible(specimenTableModel.getRowCount() > 0);
    //            }
    //        });
    CompoundBorder border = new CompoundBorder(new LineBorder(Color.DARK_GRAY), new EmptyBorder(4, 2, 4, 2));
    fileDropTarget.setBorder(border);
    fileDropTarget.setBackground(Color.LIGHT_GRAY);
    //      fileDropTarget.setVisible(false);
    deleteSpecimenFromList.setEnabled(false);

    TitledTablePanel specimenTablePanel = new TitledTablePanel("Specimen", specimenTable,
            "Download from database,\n  Drag/drop Specimens or Drag/drop CSV File above");

    //      saveAction.setEnabled(false);
    //      downloadSpecimenList.setEnabled(false);
    exportSpecimenList.setEnabled(false);

    Box otherBox = Box.createHorizontalBox();
    otherBox.add(downloadSpecimensButton);
    otherBox.add(fileDropTarget);
    otherBox.add(Box.createHorizontalGlue());

    otherBox.add(new JButton(exportSpecimenList));
    otherBox.add(Box.createHorizontalGlue());
    otherBox.add(new JLabel("(local)"));
    otherBox.add(new JButton(deleteSpecimenFromList));

    JPanel containerPanel2 = new JPanel(new BorderLayout());
    containerPanel2.add(otherBox, BorderLayout.NORTH);
    containerPanel2.add(specimenTablePanel, BorderLayout.CENTER);

    fileDropTarget.setTransferHandler(flth);

    //        TableTransferHandler tth2 = TableTransferHandler.initialiseForCopySelectAll(specimenTable, true);
    //        ChainingTransferHandler cth = new ChainingTransferHandler(flth, genotypeTransferHandler, tth2);

    TransferHandler cth = genotypeTransferHandler;
    //        ChainingTH cth = new ChainingTH(genotypeTransferHandler, tth2);

    specimenTablePanel.scrollPane.setTransferHandler(cth);

    specimenTablePanel.setTransferHandler(cth);
    specimenTable.setTransferHandler(cth);
    specimenTable.setDragEnabled(true);

    return containerPanel2;
}

From source file:com.github.dougkelly88.FLIMPlateReaderGUI.FLIMClasses.GUIComponents.FLIMPanel.java

private void setControlDefaults() {

    String[] colName = { "Delays (ps)" };
    int max = 16666;
    try {//  w w w .j av a 2 s. c  o m
        max = Integer.parseInt(core_.getProperty("Laser", "Frequency"));
    } catch (Exception e) {
    }

    tableModel_ = new DelayTableModel(colName, (sap_.getDelaysArray()).get(0), 0, max, 25);
    tableModel_.addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent e) {
            sap_.setDelaysArray(0, tableModel_.getData());
            fm_.setGatingData((sap_.getDelaysArray()).get(0));
            var_.delays = tableModel_.getData();
        }
    });
    delayTable_ = new JTable() {
        @Override
        public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
            Component comp = super.prepareRenderer(renderer, row, column);
            int modelRow = convertRowIndexToModel(row);
            int modelColumn = convertColumnIndexToModel(column);
            if (modelColumn != 0 && modelRow != 0) {
                comp.setBackground(Color.GREEN);
            }

            return comp;
        }
    };
    delayTable_.setModel(tableModel_);
    delayTable_.setSurrendersFocusOnKeystroke(true);
    delayTable_.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);

    JScrollPane scroller = new javax.swing.JScrollPane(delayTable_);
    delayTable_.setPreferredScrollableViewportSize(new java.awt.Dimension(60, 100));
    delayTablePanel.setLayout(new BorderLayout());
    delayTablePanel.add(scroller, BorderLayout.CENTER);

    final JPopupMenu popupMenu = new JPopupMenu();
    JMenuItem deleteItem = new JMenuItem("Delete delay");
    deleteItem.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            int r = delayTable_.getSelectedRow();
            tableModel_.removeRow(r);
        }
    });
    JMenuItem addItem = new JMenuItem("Add delay");
    addItem.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            int r = delayTable_.getSelectedRow();
            tableModel_.insertRow(r + 1, 0);
        }
    });
    popupMenu.add(addItem);
    popupMenu.add(deleteItem);
    delayTable_.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            //                System.out.println("pressed");
        }

        public void mouseReleased(MouseEvent e) {
            if (e.isPopupTrigger()) {
                JTable source = (JTable) e.getSource();
                int row = source.rowAtPoint(e.getPoint());
                int column = source.columnAtPoint(e.getPoint());

                if (!source.isRowSelected(row))
                    source.changeSelection(row, column, false, false);

                popupMenu.show(e.getComponent(), e.getX(), e.getY());
            }
        }
    });

    // Set up slider controls
    mcpSlider_ = new SliderControl("MCP voltage (V)", 300, 850, 750);
    mcpVoltagePanel.setLayout(new BorderLayout());
    mcpVoltagePanel.add(mcpSlider_, BorderLayout.SOUTH);
    mcpSlider_.addPropertyChangeListener(new java.beans.PropertyChangeListener() {

        @Override
        public void propertyChange(java.beans.PropertyChangeEvent evt) {
            mcpSliderPropertyChange(evt);
        }
    });

    gatewidthSlider_ = new SliderControl("Gate width (ps)", 200, 7000, 3000);
    gatewidthPanel.setLayout(new BorderLayout());
    gatewidthPanel.add(gatewidthSlider_, BorderLayout.SOUTH);
    gatewidthSlider_.addPropertyChangeListener(new java.beans.PropertyChangeListener() {

        @Override
        public void propertyChange(java.beans.PropertyChangeEvent evt) {
            gatewidthSliderPropertyChange(evt);
        }
    });

    HRIControlsPanel.revalidate();
    HRIControlsPanel.repaint();

    slowDelaySlider_ = new SliderControl("Current delay setting (ps)", 0, 20000, 0);
    slowCurrentDelayPanel.setLayout(new BorderLayout());
    slowCurrentDelayPanel.add(slowDelaySlider_, BorderLayout.SOUTH);
    slowDelaySlider_.addPropertyChangeListener(new java.beans.PropertyChangeListener() {

        @Override
        public void propertyChange(java.beans.PropertyChangeEvent evt) {
            slowDelaySlider_.setValue(tableModel_.validateData(slowDelaySlider_.getValue().intValue()));
            slowDelaySliderPropertyChange(evt);
        }
    });

    fastDelaySlider_ = new SliderControl("Current delay setting (ps)", 0, 20000, 0);
    fastCurrentDelayPanel.setLayout(new BorderLayout());
    fastCurrentDelayPanel.add(fastDelaySlider_, BorderLayout.SOUTH);
    fastDelaySlider_.addPropertyChangeListener(new java.beans.PropertyChangeListener() {

        @Override
        public void propertyChange(java.beans.PropertyChangeEvent evt) {
            fastDelaySlider_.setValue(tableModel_.validateData(fastDelaySlider_.getValue().intValue()));
            fastDelaySliderPropertyChange(evt);
        }
    });

    delayBoxTabbedPane.revalidate();
    delayBoxTabbedPane.repaint();

    fm_ = new FindMaxpoint();
    maxpointGraphPanel.setLayout(new BorderLayout());
    chartPanel_ = new ChartPanel(fm_.getChart());
    maxpointGraphPanel.add(chartPanel_, BorderLayout.NORTH);
    // for some reason maxpointGraphPanel's height and width are returned 0
    // so hardcode for now...
    chartPanel_.setMaximumDrawWidth(500);
    chartPanel_.setMaximumDrawHeight(200);
    chartPanel_.setPreferredSize(new Dimension(500, 200));

    // Set values for other controls based on underlying data to ensure
    // that all controls are in a consistent state. 
    scanDelCheck.setSelected(sap_.getUseScanFLIM());

}

From source file:org.jas.gui.MainWindow.java

public JTable getDescriptionTable() {
    if (descriptionTable == null) {
        descriptionTable = new DescriptionTable();
        descriptionTable.addMouseListener(new MouseAdapter() {

            public void mouseClicked(MouseEvent e) {
                if (e.getButton() == MouseEvent.BUTTON3) {
                    MetadataDialog metadataDialog = new MetadataDialog(MainWindow.this,
                            controlEngineConfigurator, "Alter ALL rows");
                    metadataDialog.setVisible(true);
                }//from  w ww .  ja v  a2s  . com
            }
        });

        descriptionTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

            public void valueChanged(ListSelectionEvent e) {
                if (tableLoaded) {
                    selectedRow = descriptionTable.getSelectedRow();
                    log.info("SETTING SELECTED ROW to : " + selectedRow);
                    updateImage(selectedRow);
                }
            }

        });

        descriptionTable.getModel().addTableModelListener(new TableModelListener() {

            public void tableChanged(TableModelEvent e) {
                if (e.getType() == TableModelEvent.UPDATE && tableLoaded
                        && e.getColumn() != ApplicationState.STATUS_COLUMN) {
                    int column = e.getColumn();
                    int row = e.getFirstRow();
                    String value = getDescriptionTable().getModel().getValueAt(row, column).toString();
                    log.info("value changed: " + value);
                    List<Metadata> metadataList = viewEngineConfigurator.getViewEngine().get(Model.METADATA);
                    Metadata metadata = metadataList.get(row);
                    metadataAdapter.update(metadata, column, value);
                    metadataWithAlbum.add(metadata);

                    getDescriptionTable().getModel().setValueAt(ActionResult.New, row,
                            ApplicationState.STATUS_COLUMN);

                    controlEngineConfigurator.getControlEngine().set(Model.METADATA_ARTIST, metadataWithAlbum,
                            null);
                    getApplyButton().setEnabled(!working);
                    log.info("setting applyButton to : " + !working);
                }
            }
        });

    }

    return descriptionTable;
}

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

private void initMetaDataTable() {
    metaDataTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    DefaultTableModel model = new DefaultTableModel(new Object[][] {}, new String[] { METADATA_NAME_COLUMN_NAME,
            METADATA_TYPE_COLUMN_NAME, METADATA_MAPPING_COLUMN_NAME }) {
        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return true;
        }//w  w w  .  j a  v  a 2 s .  co m

        @Override
        public void setValueAt(Object value, int row, int column) {
            // Enable the revert button if any data was changed.
            if (!value.equals(getValueAt(row, column))) {
                revertMetaDataButton.setEnabled(true);
            }

            super.setValueAt(value, row, column);
        }
    };

    model.addTableModelListener(new TableModelListener() {

        @Override
        public void tableChanged(TableModelEvent e) {
            if (e.getType() == TableModelEvent.UPDATE) {
                parent.setSaveEnabled(true);
            }
        }

    });

    class AlphaNumericCellEditor extends TextFieldCellEditor {

        public AlphaNumericCellEditor() {
            super();
            MirthFieldConstraints constraints = new MirthFieldConstraints("^[a-zA-Z_0-9]*$");
            constraints.setLimit(30);
            getTextField().setDocument(constraints);
        }

        @Override
        protected boolean valueChanged(String value) {
            return true;
        }

    }

    metaDataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    metaDataTable.setDragEnabled(false);
    metaDataTable.setSortable(false);
    metaDataTable.getTableHeader().setReorderingAllowed(false);
    metaDataTable.setModel(model);

    metaDataTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            deleteMetaDataButton.setEnabled(metaDataTable.getSelectedRow() != -1);
        }
    });

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

    metaDataTable.getColumnModel()
            .getColumn(metaDataTable.getColumnModel().getColumnIndex(METADATA_NAME_COLUMN_NAME))
            .setCellEditor(new AlphaNumericCellEditor());
    metaDataTable.getColumnModel()
            .getColumn(metaDataTable.getColumnModel().getColumnIndex(METADATA_MAPPING_COLUMN_NAME))
            .setCellEditor(new AlphaNumericCellEditor());

    TableColumn column = metaDataTable.getColumnModel()
            .getColumn(metaDataTable.getColumnModel().getColumnIndex(METADATA_TYPE_COLUMN_NAME));
    column.setCellRenderer(new MirthComboBoxTableCellRenderer(MetaDataColumnType.values()));
    column.setCellEditor(
            new MirthComboBoxTableCellEditor(metaDataTable, MetaDataColumnType.values(), 1, false, null));
    column.setMinWidth(100);
    column.setMaxWidth(100);

    deleteMetaDataButton.setEnabled(false);
}

From source file:org.nuclos.client.ui.collect.Chart.java

/**
 * @param entityName/*from  ww w.j  a v a2  s. c  om*/
 * @param toolBarOrientation @see JToolbar#setOrientation
 * @param foreignKeyFieldToParent Needs only be specified if not unique. @see #getForeignKeyFieldToParent()
 * @precondition entityName != null
 * @postcondition this.getForeignKeyFieldToParent() == foreignKeyFieldToParent
 */
public Chart(String entityName, int iScrollPane, int toolBarOrientation, String foreignKeyFieldToParent,
        boolean bFromProperties, boolean bSearchable) {
    super(new GridLayout(1, 1));

    this.bFromProperties = bFromProperties;
    this.bSearchable = bSearchable;

    this.subform = new SubForm(entityName, -1, foreignKeyFieldToParent, bFromProperties) {
        private TableModelListener tblmdllistener;

        public void setupTableModelListener() {
            // set all columns visble.
            if (!(getSubformTable().getModel() instanceof CollectableTableModel<?>))
                return;

            CollectableEntity colEntity = DefaultCollectableEntityProvider.getInstance()
                    .getCollectableEntity(subform.getEntityName());
            List<CollectableEntityField> lstclctefColumns = new ArrayList<CollectableEntityField>();
            for (String sFieldName : colEntity.getFieldNames()) {
                if (!sFieldName.equalsIgnoreCase("genericObject"))
                    lstclctefColumns.add(colEntity.getEntityField(sFieldName));
            }
            ((CollectableTableModel<?>) getSubformTable().getModel()).setColumns(lstclctefColumns);

            this.tblmdllistener = new TableModelListener() {
                boolean enabled = Chart.this.isEnabled();

                @Override
                public void tableChanged(TableModelEvent ev) {
                    Chart.this.setEnabled(
                            (subform.getJTable().getModel() instanceof SearchConditionTableModelImpl) ? false
                                    : enabled);

                    String type = getProperty(PROPERTY_TYPE, String.class);
                    if (type != null) {
                        JFreeChart chart = ChartFunction.valueOf(type).createChart(Chart.this);
                        panel.setChart(chart);
                        panel.repaint();
                    }
                }
            };

            getSubformTable().getModel().addTableModelListener(this.tblmdllistener);
        }

        public void removeTableModelListener() {
            getSubformTable().getModel().removeTableModelListener(this.tblmdllistener);
            this.tblmdllistener = null;
        }
    };

    if (iScrollPane != -1) {
        this.scrollPane = new JScrollPane();
    } else
        this.scrollPane = new JPanel(new BorderLayout());

    this.toolbar = UIUtils.createNonFloatableToolBar(toolBarOrientation);

    this.listeners = new ArrayList<ChartToolListener>();

    if (entityName == null) {
        throw new NullArgumentException("entityName");
    }
    this.entityName = entityName;

    String sDataSource = entityName.substring(MasterDataMetaVO.CHART_ENTITY_PREFIX.length()).toLowerCase();

    try {
        DatasourceVO datasourceVO = DatasourceDelegate.getInstance().getChartByName(sDataSource);
        if (datasourceVO != null) {
            final List<DatasourceParameterVO> lstParams = DatasourceDelegate.getInstance()
                    .getParametersFromXML(datasourceVO.getSource());
            for (Iterator iterator = lstParams.iterator(); iterator.hasNext();) {
                DatasourceParameterVO datasourceParameterVO = (DatasourceParameterVO) iterator.next();
                if (datasourceParameterVO.getParameter().equals("genericObject"))
                    iterator.remove();
            }
            if (!lstParams.isEmpty() && !bSearchable && !bFromProperties) {
                JPanel pnl = new JPanel(new BorderLayout());
                ParameterPanel pnlParameters = new ParameterPanel(lstParams, new ChangeListener() {
                    @Override
                    public void stateChanged(ChangeEvent e) {
                        if (e != null && e.getSource() instanceof ParameterPanel) {
                            try {
                                Map<String, Object> mpParams = new HashMap<String, Object>();
                                ((ParameterPanel) e.getSource()).fillParameterMap(lstParams, mpParams);
                                subform.setMapParams(mpParams);
                            } catch (Exception e2) {
                                //ignore.
                            }
                        }
                    }
                });
                pnl.add(pnlParameters, BorderLayout.NORTH);

                JSplitPane splitPane = new JSplitPane(
                        toolBarOrientation == -1 ? JSplitPane.VERTICAL_SPLIT : toolBarOrientation, pnl,
                        scrollPane);
                contentPane.add(splitPane, BorderLayout.CENTER);
            } else
                contentPane.add(scrollPane, BorderLayout.CENTER);
        } else {
            contentPane.add(scrollPane, BorderLayout.CENTER);
        }
    } catch (Exception e) {
        throw new NuclosFatalException("init failed for datasource " + sDataSource, e);
    }

    if (toolBarOrientation == -1) {
        this.toolbar.setVisible(false);
    } else {
        this.toolbar.setOrientation(toolBarOrientation);
    }
    this.foreignKeyFieldToParent = foreignKeyFieldToParent;

    layer = new JXLayer<JComponent>(contentPane, new TranslucentLockableUI());
    layer.setName("JXLayerGlasspane");
    add(layer);

    this.init(iScrollPane);

    toolbarButtons = new HashMap<String, AbstractButton>();
    toolbarMenuItems = new HashMap<String, JMenuItem>();
    toolbarOrder = new ArrayList<String>();
    for (ToolbarFunction func : ToolbarFunction.values()) {
        AbstractButton button = func.createButton();
        JMenuItem mi = func.createMenuItem();
        toolbarButtons.put(func.name(), button);
        toolbarMenuItems.put(func.name(), mi);
        toolbar.add(button);
        if (func.equals(ToolbarFunction.PRINT)) {
            button.addActionListener(panel);
            mi.addActionListener(panel);
        } else {
            button.addActionListener(this);
            mi.addActionListener(this);
        }
        toolbarOrder.add(func.name());
    }

    subform.setReadOnly(true);
    setEnabled(!bFromProperties && !bSearchable);

    addChartToolListener(new ChartToolListener() {

        @Override
        public void toolbarAction(String actionCommand) {
            if (actionCommand.equals(ToolbarFunction.SHOW.name())) {
                actionCommandShow();
            } else if (actionCommand.equals(ToolbarFunction.SAVE.name())) {
                actionCommandSave();
            }
        }
    });

    assert this.getForeignKeyFieldToParent() == foreignKeyFieldToParent;
}

From source file:nl.detoren.ijsco.ui.Mainscreen.java

public JPanel createPanelScenarios() {
    JPanel panel = new JPanel();
    panel.setBackground(Color.RED);
    panel.setLayout(new GridLayout(1, 0));
    schemaModel = new SchemaModel(panel, status.schemas);
    schemaTabel = new JTable(schemaModel) {
        @Override//from   ww  w  . j  ava2 s .  c o  m
        public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
            Component c = super.prepareRenderer(renderer, row, column);
            // Tooltip
            if (c instanceof JComponent) {
                SchemaModel model = (SchemaModel) getModel();
                ((JComponent) c).setToolTipText(model.getToolTip(row, column).toString());
            }
            // Alternate row color
            if (!isRowSelected(row)) {
                c.setBackground(row % 2 == 0 ? Color.WHITE : Color.LIGHT_GRAY);
            }
            return c;
        }
    };
    schemaTabel.getModel().addTableModelListener(new TableModelListener() {

        @Override
        public void tableChanged(TableModelEvent arg0) {
            panel.getParent().getParent().repaint();
        }

    });
    JScrollPane scrollpane = new JScrollPane();
    scrollpane.setViewportView(schemaTabel);
    //panel.add(scrollpane, new ExtendedGridConstraints(0, 2));
    panel.add(scrollpane);
    return panel;
}

From source file:nl.detoren.ijsco.ui.Mainscreen.java

public JPanel createDeelnemersPanel() {
    JPanel panel = new JPanel(false);
    panel.setBackground(Color.BLACK);
    //panel.setLayout(new GridLayout(1, 0));
    panel.setLayout(new BorderLayout());
    JPanel innerPanel = new JPanel();
    JLabel lbAanwezig = new JLabel("Deelnemers: ");
    innerPanel.add(lbAanwezig, BorderLayout.NORTH);
    tfAanwezig = new JLabel(Integer.toString(status.deelnemers.aantalAanwezig()), 10);
    innerPanel.add(tfAanwezig, BorderLayout.NORTH);
    //innerPanel.setLayout(new GridLayout(1, 0));
    innerPanel.add(new JLabel("Naam:"), BorderLayout.NORTH);
    JTextField deelnemer = new JTextField(15);
    ArrayList<String> words = new ArrayList<>();
    if (status.OSBOSpelers != null) {
        for (Speler s : status.OSBOSpelers.values()) {
            words.add(s.getNaam().trim());
            words.add(Integer.toString(s.getKnsbnummer()));
        }//from w  ww. ja  va 2  s. c  o  m
    }
    @SuppressWarnings("unused")
    Suggesties suggesties = new Suggesties(deelnemer, this, words, 2);
    innerPanel.add(deelnemer, BorderLayout.NORTH);
    deelnemer.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            actieVoegSpelerToe(deelnemer.getText().trim());
            deelnemer.setText("");
        }
    });

    JButton btVoegToe = new JButton("Voeg toe");
    btVoegToe.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            actieVoegSpelerToe(deelnemer.getText().trim());
            deelnemer.setText("");
        }
    });
    innerPanel.add(btVoegToe);
    panel.add(innerPanel);
    // panel_deelnemers.add(new JLabel("Deelnemers IJSCO toernooi"));
    deelnemersModel = new DeelnemersModel(panel, status.deelnemers);
    JTable deelnemersTabel = new JTable(deelnemersModel) {
        private static final long serialVersionUID = -8293073016982337108L;

        @Override
        public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
            Component c = super.prepareRenderer(renderer, row, column);
            DeelnemersModel model = (DeelnemersModel) getModel();
            // Tooltip
            if (c instanceof JComponent) {
                ((JComponent) c)
                        .setToolTipText(model.getToolTip(convertRowIndexToModel(row), column).toString());
            }

            // Alternate row color
            if (!isRowSelected(row)) {
                c.setBackground(row % 2 == 0 ? Color.WHITE : Color.LIGHT_GRAY);
            }

            // Highlight overruled entries
            if (status.deelnemers.get(convertRowIndexToModel(row)).isOverruleNaam()
                    || status.deelnemers.get(convertRowIndexToModel(row)).isOverruleNaam()) {
                c.setForeground(Color.BLUE);
            } else {
                c.setForeground(Color.BLACK);
            }
            return c;
        }
    };

    deelnemersTabel.getModel().addTableModelListener(new TableModelListener() {

        @Override
        public void tableChanged(TableModelEvent arg0) {
            status.groepen = null;
            status.schemas = null;
            status.schema = null;
            groepenText.setText("");
            schemaModel.setSchemas(null);
            schemaModel.fireTableDataChanged();
            if (status.deelnemers != null && tfAanwezig != null) {
                tfAanwezig.setText(Integer.toString(status.deelnemers.aantalAanwezig()));
            }
            panel.repaint();
        }

    });

    deelnemersTabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            logger.log(Level.INFO, "MouseEvent on table fired, type : " + e.toString());
            logger.log(Level.INFO, "Popup trigger? : " + e.isPopupTrigger());
            if (e.isPopupTrigger()) {
                int row = deelnemersTabel.rowAtPoint(e.getPoint());
                JPopupMenu popup = new JPopupMenu();
                JMenuItem menuItem = new JMenuItem("Bewerk speler");
                menuItem.addActionListener(new ActionListener() {

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        logger.log(Level.INFO,
                                "Bewerk Speler  : " + deelnemersTabel.convertRowIndexToModel(row));
                        Speler s = status.deelnemers.get(deelnemersTabel.convertRowIndexToModel(row));
                        BewerkSpelerDialoog rd = new BewerkSpelerDialoog(new JFrame(), "Bewerk Speler", s,
                                deelnemersModel);
                        rd.addWindowListener(new WindowAdapter() {
                            @Override
                            public void windowClosed(WindowEvent e) {
                                System.out.println("closing...");
                            }

                        });
                        rd.setVisible(true);
                    }

                });
                popup.add(menuItem);

                menuItem = new JMenuItem("Verwijder Speler");
                popup.add(menuItem);
                menuItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        logger.log(Level.INFO,
                                "Verwijder Speler  : " + deelnemersTabel.convertRowIndexToModel(row));
                        Speler s = status.deelnemers.get(deelnemersTabel.convertRowIndexToModel(row));
                        status.deelnemers.remove(s);
                        deelnemersModel.fireTableDataChanged();
                    }
                });
                popup.show(e.getComponent(), e.getX(), e.getY());

            }
        }
    });

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setViewportView(deelnemersTabel);
    innerPanel.add(scrollPane, BorderLayout.CENTER);

    TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(deelnemersModel);
    deelnemersTabel.setRowSorter(sorter);

    innerPanel.add(new JLabel("Filter op : "));
    JTextField tfFilter = new JTextField(10);
    tfFilter.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            String text = tfFilter.getText();
            logger.log(Level.INFO, "Filter tabel op : " + text);
            if (text.length() == 0) {
                sorter.setRowFilter(null);
            } else {
                sorter.setRowFilter(RowFilter.regexFilter("(?i)" + text));
            }
        }
    });
    innerPanel.add(tfFilter);
    JButton btPasToe = new JButton("Apply");
    btPasToe.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            String text = tfFilter.getText();
            logger.log(Level.INFO, "Filter tabel op : " + text);
            if (text.length() == 0) {
                sorter.setRowFilter(null);
            } else {
                sorter.setRowFilter(RowFilter.regexFilter("(?i)" + text));
            }
        }
    });
    innerPanel.add(btPasToe);
    JButton btWis = new JButton("Wis");
    btWis.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            tfFilter.setText("");
            logger.log(Level.INFO, "Wis filter");
            sorter.setRowFilter(null);
        }
    });
    innerPanel.add(btWis);

    Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(0), 30);
    Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(1), 55);
    Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(2), 170);
    Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(3), 40);
    Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(4), 40);
    Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(5), 30);
    Utils.fixedComponentSize(scrollPane, 400, 580);
    return panel;
}