Example usage for javax.swing JTable setRowSorter

List of usage examples for javax.swing JTable setRowSorter

Introduction

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

Prototype

@BeanProperty(description = "The table's RowSorter")
public void setRowSorter(RowSorter<? extends TableModel> sorter) 

Source Link

Document

Sets the RowSorter.

Usage

From source file:NewFilterTable.java

public NewFilterTable() {
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    String[] columns = { "ID", "Des", "Date", "Fixed" };
    Object[][] rows = { { 1, "C", new Date(), new Date() }, { 2, "G", new Date(), new Date() },
            { 5, "F", new Date(), new Date() } };

    TableModel model = new DefaultTableModel(rows, columns);
    JTable table = new JTable(model);
    final TableRowSorter<TableModel> sorter;
    sorter = new TableRowSorter<TableModel>(model);
    table.setRowSorter(sorter);
    getContentPane().add(new JScrollPane(table));

    JPanel pnl = new JPanel();
    pnl.add(new JLabel("Filter expression:"));
    final JTextField txtFE = new JTextField(25);
    pnl.add(txtFE);/*w ww.  ja  v  a  2 s .c o  m*/
    JButton btnSetFE = new JButton("Set Filter Expression");
    ActionListener al;
    al = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String expr = txtFE.getText();
            sorter.setRowFilter(RowFilter.regexFilter(expr));
            sorter.setSortKeys(null);
        }
    };
    btnSetFE.addActionListener(al);
    pnl.add(btnSetFE);
    getContentPane().add(pnl, BorderLayout.SOUTH);

    setSize(750, 150);
    setVisible(true);
}

From source file:SimpleTableModel.java

public Main() {
    this.setDefaultCloseOperation(EXIT_ON_CLOSE);

    JTable table = new JTable(new SimpleTableModel());

    TableRowSorter sorter = new TableRowSorter(table.getModel());
    table.setRowSorter(sorter);

    RowFilter<SimpleTableModel, Integer> IDFilter = new RowFilter<SimpleTableModel, Integer>() {
        @Override/*from  w  w w .  j  ava 2s . c  om*/
        public boolean include(Entry<? extends SimpleTableModel, ? extends Integer> entry) {
            SimpleTableModel model = entry.getModel();
            int rowIndex = entry.getIdentifier().intValue();
            Integer ID = (Integer) model.getValueAt(rowIndex, 0);
            if (ID.intValue() <= 100) {
                return false; // Do not show rows with an ID <= 100
            }
            return true;
        }
    };

    sorter.setRowFilter(IDFilter);

    Container contentPane = this.getContentPane();
    contentPane.add(new JScrollPane(table), BorderLayout.CENTER);
}

From source file:Visuals.BarChart.java

public JPanel addCharts() {
    ChartPanel barPanel = drawBarChart();
    barPanel.setDomainZoomable(true);/*ww  w  .jav a  2  s. c o  m*/
    JPanel thisBarPanel = new JPanel();
    thisBarPanel.setLayout(new BorderLayout());

    String[][] finalRisks = new String[riskCount][4];
    for (int i = 0; i < riskCount; i++) {
        finalRisks[i][0] = risks[i][0];
        finalRisks[i][1] = risks[i][1];
        finalRisks[i][2] = risks[i][2];
        finalRisks[i][3] = risks[i][3];
    }

    JTable table = new JTable(finalRisks, columns);
    //table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    TableRowSorter<TableModel> sorter = new TableRowSorter<>(table.getModel());
    table.setRowSorter(sorter);
    List<RowSorter.SortKey> sortKeys = new ArrayList<>();

    int columnIndexToSort = 2;
    sortKeys.add(new RowSorter.SortKey(columnIndexToSort, SortOrder.ASCENDING));

    sorter.setSortKeys(sortKeys);
    sorter.sort();

    TableColumn tcol = table.getColumnModel().getColumn(2);
    table.removeColumn(tcol);

    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    table.getColumnModel().getColumn(1).setPreferredWidth(600);
    table.getColumnModel().getColumn(2).setPreferredWidth(600);

    table.setShowHorizontalLines(true);
    table.setRowHeight(40);
    table.setEnabled(false);

    JScrollPane tableScrollPane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    Dimension d = table.getPreferredSize();
    tableScrollPane
            .setPreferredSize(new Dimension((d.width - 400), (table.getRowHeight() + 1) * (riskCount + 1)));

    JLabel right = new JLabel(
            "                                                                                                    ");
    thisBarPanel.add(right, BorderLayout.EAST);
    thisBarPanel.add(barPanel, BorderLayout.CENTER);
    thisBarPanel.add(tableScrollPane, BorderLayout.SOUTH);
    return thisBarPanel;
}

From source file:Visuals.PieChart.java

public JPanel addCharts() {
    ChartPanel piePanel = drawPieChart();
    piePanel.setDomainZoomable(true);/*from   w w w. java  2 s  .c om*/
    JPanel thisPiePanel = new JPanel();

    String[][] finalRisks = new String[riskCount][4];
    for (int i = 0; i < riskCount; i++) {
        finalRisks[i][0] = risks[i][0];
        finalRisks[i][1] = risks[i][1];
        finalRisks[i][2] = risks[i][2];
        finalRisks[i][3] = risks[i][3];
    }

    JTable table = new JTable(finalRisks, columns);
    //table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    TableRowSorter<TableModel> sorter = new TableRowSorter<>(table.getModel());
    table.setRowSorter(sorter);
    List<RowSorter.SortKey> sortKeys = new ArrayList<>();

    int columnIndexToSort = 2;
    sortKeys.add(new RowSorter.SortKey(columnIndexToSort, SortOrder.ASCENDING));

    sorter.setSortKeys(sortKeys);
    sorter.sort();

    TableColumn tcol = table.getColumnModel().getColumn(2);
    table.removeColumn(tcol);

    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    table.getColumnModel().getColumn(1).setPreferredWidth(600);

    table.getColumnModel().getColumn(2).setPreferredWidth(600);

    JLabel right = new JLabel(
            "                                                                                                    ");
    thisPiePanel.add(right, BorderLayout.EAST);

    table.setShowHorizontalLines(true);
    table.setRowHeight(40);

    JScrollPane tableScrollPane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    Dimension d = table.getPreferredSize();
    tableScrollPane
            .setPreferredSize(new Dimension((d.width - 400), (table.getRowHeight() + 1) * (riskCount + 1)));
    table.setEnabled(false);
    thisPiePanel.setLayout(new BorderLayout());
    if (riskCount == 0) {

        thisPiePanel.add(piePanel, BorderLayout.CENTER);
    } else {
        thisPiePanel.add(right, BorderLayout.EAST);
        thisPiePanel.add(piePanel, BorderLayout.CENTER);
        thisPiePanel.add(tableScrollPane, BorderLayout.SOUTH);
    }
    thisPiePanel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
    return thisPiePanel;
}

From source file:DefaultsDisplay.java

protected void initFilters(JTable table) {
    TableRowSorter sorter = new TableRowSorter(table.getModel());
    table.setRowSorter(sorter);

    if (visualsFilter == null) {
        visualsFilter = new RowFilter<UIDefaultsTableModel, Integer>() {
            public boolean include(Entry<? extends UIDefaultsTableModel, ? extends Integer> entry) {
                UIDefaultsTableModel model = entry.getModel();
                Object defaultsValue = model.getValueAt(entry.getIdentifier().intValue(),
                        UIDefaultsTableModel.VALUE_COLUMN);

                return defaultsValue instanceof Color || defaultsValue instanceof Font
                        || defaultsValue instanceof Icon;
            }//from  w w  w  .j a  v  a 2s .co  m
        };
    }

    if (onlyVisualsCheckBox.isSelected()) {
        sorter.setRowFilter(visualsFilter);
    }
}

From source file:de.codesourcery.eve.skills.ui.components.impl.planning.ResourceStatusComponent.java

@Override
protected JPanel createPanel() {
    final JPanel result = new JPanel();

    table.setFillsViewportHeight(true);/*from  w w  w . j  a va2  s. co  m*/

    table.setRowSorter(model.getRowSorter());

    FixedBooleanTableCellRenderer.attach(table);

    table.setDefaultRenderer(Integer.class, new DefaultTableCellRenderer() {
        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);

            if (!(value instanceof Integer)) {
                return this;
            }

            if (column == 0) {
                setHorizontalAlignment(SwingConstants.LEFT);
            } else {
                setHorizontalAlignment(SwingConstants.RIGHT);
            }

            Integer amount = (Integer) value;
            if (amount.intValue() < 0) {
                if (!isSelected) {
                    setBackground(Color.RED);
                } else {
                    setBackground(table.getSelectionBackground());
                }
            } else {
                setBackground(table.getBackground());
            }
            return this;
        }
    });

    addToShoppingListButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            final List<ItemWithQuantity> items = model.getSelectedItems();

            if (items.isEmpty()) {
                return;
            }

            final ShoppingListEditorComponent comp = new ShoppingListEditorComponent(title, "", items);

            comp.setModal(true);
            ComponentWrapper.wrapComponent(comp).setVisible(true);
            if (!comp.wasCancelled() && !comp.getShoppingList().isEmpty()) {
                shoppingListManager.addShoppingList(comp.getShoppingList());
                getComponentCallback().dispose(ResourceStatusComponent.this);
            }

        }
    });

    new GridLayoutBuilder()
            .add(new GridLayoutBuilder.VerticalGroup(new GridLayoutBuilder.Cell(new JScrollPane(table)),
                    new GridLayoutBuilder.FixedCell(addToShoppingListButton)))
            .addTo(result);
    return result;
}

From source file:com.net2plan.gui.utils.onlineSimulationPane.OnlineSimulationPane.java

/**
 * Shows the future event list./*w  w w.ja va2  s  . c om*/
 *
 * @since 0.3.0
 */
public void viewFutureEventList() {
    final JDialog dialog = new JDialog();
    dialog.setTitle("Future event list");
    SwingUtils.configureCloseDialogOnEscape(dialog);
    dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
    dialog.setSize(new Dimension(500, 300));
    dialog.setLocationRelativeTo(null);
    dialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
    dialog.setLayout(new MigLayout("fill, insets 0 0 0 0"));

    final String[] tableHeader = StringUtils.arrayOf("Id", "Time", "Priority", "Type", "To module",
            "Custom object");
    Object[][] data = new Object[1][tableHeader.length];

    DefaultTableModel model = new ClassAwareTableModel();
    model.setDataVector(new Object[1][tableHeader.length], tableHeader);

    JTable table = new AdvancedJTable(model);
    RowSorter<TableModel> sorter = new TableRowSorter<TableModel>(model);
    table.setRowSorter(sorter);
    JScrollPane scrollPane = new JScrollPane(table);
    dialog.add(scrollPane, "grow");

    PriorityQueue<SimEvent> futureEventList = simKernel.getSimCore().getFutureEventList().getPendingEvents();
    if (!futureEventList.isEmpty()) {
        int numEvents = futureEventList.size();
        SimEvent[] futureEventList_array = futureEventList.toArray(new SimEvent[numEvents]);
        Arrays.sort(futureEventList_array, futureEventList.comparator());
        data = new Object[numEvents][tableHeader.length];

        for (int eventId = 0; eventId < numEvents; eventId++) {
            //            List<SimAction> actions = futureEventList_array[eventId].getEventActionList();
            Object customObject = futureEventList_array[eventId].getEventObject();
            data[eventId][0] = eventId;
            data[eventId][1] = StringUtils
                    .secondsToYearsDaysHoursMinutesSeconds(futureEventList_array[eventId].getEventTime());
            data[eventId][2] = futureEventList_array[eventId].getEventPriority();
            data[eventId][3] = futureEventList_array[eventId].getEventType();
            data[eventId][4] = futureEventList_array[eventId].getEventDestinationModule().toString();
            data[eventId][5] = customObject == null ? "none" : customObject;
        }
    }

    model.setDataVector(data, tableHeader);
    table.getTableHeader().addMouseListener(new ColumnFitAdapter());
    table.setDefaultRenderer(Double.class, new CellRenderers.NumberCellRenderer());

    dialog.setVisible(true);
}

From source file:com.intuit.tank.proxy.ProxyApp.java

private JPanel getTransactionTable() {
    JPanel frame = new JPanel(new BorderLayout());
    model = new TransactionTableModel();
    final JTable table = new TransactionTable(model);
    final TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(model);
    table.setRowSorter(sorter);
    final JPopupMenu pm = new JPopupMenu();
    JMenuItem item = new JMenuItem("Delete Selected");
    item.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            int[] selectedRows = table.getSelectedRows();
            if (selectedRows.length != 0) {
                int response = JOptionPane.showConfirmDialog(ProxyApp.this,
                        "Are you sure you want to delete " + selectedRows.length + " Transactions?",
                        "Confirm Delete", JOptionPane.YES_NO_OPTION);
                if (response == JOptionPane.YES_OPTION) {
                    int[] correctedRows = new int[selectedRows.length];
                    for (int i = selectedRows.length; --i >= 0;) {
                        int row = selectedRows[i];
                        int index = (Integer) table.getValueAt(row, 0) - 1;
                        correctedRows[i] = index;
                    }//from w w w.  j a  va 2 s  . c  o  m
                    Arrays.sort(correctedRows);
                    for (int i = correctedRows.length; --i >= 0;) {
                        int row = correctedRows[i];
                        Transaction transaction = model.getTransactionForIndex(row);
                        if (transaction != null) {
                            model.removeTransaction(transaction, row);
                            isDirty = true;
                            saveAction.setEnabled(isDirty && !stopAction.isEnabled());
                        }
                    }
                }
            }
        }
    });
    pm.add(item);
    table.add(pm);

    table.addMouseListener(new MouseAdapter() {
        boolean pressed = false;

        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
                Point p = e.getPoint();
                int row = table.rowAtPoint(p);
                int index = (Integer) table.getValueAt(row, 0) - 1;
                Transaction transaction = model.getTransactionForIndex(index);
                if (transaction != null) {
                    detailsTF.setText(transaction.toString());
                    detailsTF.setCaretPosition(0);
                    detailsDialog.setVisible(true);
                }
            }
        }

        /**
         * @{inheritDoc
         */
        @Override
        public void mousePressed(MouseEvent e) {
            if (e.isPopupTrigger()) {
                pressed = true;
                int[] selectedRows = table.getSelectedRows();
                if (selectedRows.length != 0) {
                    pm.show(e.getComponent(), e.getX(), e.getY());
                }
            }
        }

        /**
         * @{inheritDoc
         */
        @Override
        public void mouseReleased(MouseEvent e) {
            if (!pressed && e.isPopupTrigger()) {
                int[] selectedRows = table.getSelectedRows();
                if (selectedRows.length != 0) {
                    pm.show(e.getComponent(), e.getX(), e.getY());
                }
            }
        }

    });

    JScrollPane pane = new JScrollPane(table);
    frame.add(pane, BorderLayout.CENTER);
    JPanel panel = new JPanel(new BorderLayout());
    JLabel label = new JLabel("Filter: ");
    panel.add(label, BorderLayout.WEST);
    final JLabel countLabel = new JLabel(" Count: 0 ");
    panel.add(countLabel, BorderLayout.EAST);
    final JTextField filterText = new JTextField("");
    filterText.addKeyListener(new KeyAdapter() {
        public void keyTyped(KeyEvent e) {
            String text = filterText.getText();
            if (text.length() == 0) {
                sorter.setRowFilter(null);
            } else {
                try {
                    sorter.setRowFilter(RowFilter.regexFilter(text));
                    countLabel.setText(" Count: " + sorter.getViewRowCount() + " ");
                } catch (PatternSyntaxException pse) {
                    System.err.println("Bad regex pattern");
                }
            }
        }
    });
    panel.add(filterText, BorderLayout.CENTER);

    frame.add(panel, BorderLayout.NORTH);
    return frame;
}

From source file:au.org.ala.delta.editor.ui.ActionSetsDialog.java

private void updateGUI() {
    Map<DirectiveType, List<DirectiveFile>> files = new HashMap<DirectiveFile.DirectiveType, List<DirectiveFile>>();

    for (DirectiveType type : DirectiveType.values()) {
        files.put(type, new ArrayList<DirectiveFile>());
    }//from   w  w w .  j  a  va 2s. co m
    int numFiles = _model.getDirectiveFileCount();
    for (int i = 1; i <= numFiles; i++) {
        DirectiveFile file = _model.getDirectiveFile(i);
        files.get(file.getType()).add(file);
    }
    conforTable.setModel(new DirectiveFileTableModel(files.get(DirectiveType.CONFOR)));
    configureWidths(conforTable);
    intkeyTable.setModel(new DirectiveFileTableModel(files.get(DirectiveType.INTKEY)));
    configureWidths(intkeyTable);
    distTable.setModel(new DirectiveFileTableModel(files.get(DirectiveType.DIST)));
    configureWidths(distTable);
    keyTable.setModel(new DirectiveFileTableModel(files.get(DirectiveType.KEY)));
    configureWidths(keyTable);

    JTable[] tables = { conforTable, intkeyTable, distTable, keyTable };

    for (JTable table : tables) {
        TableRowSorter<? extends TableModel> sorter = new TableRowSorter<DirectiveFileTableModel>(
                (DirectiveFileTableModel) table.getModel());
        table.setRowSorter(sorter);
    }

    updateAction();
}

From source file:edu.ku.brc.specify.extras.ViewToSchemaReview.java

/**
 * /* w  w w.  j a  va2  s  .co m*/
 */
public void checkSchemaAndViews() {

    Hashtable<String, HashSet<String>> viewFieldHash = new Hashtable<String, HashSet<String>>();

    SpecifyAppContextMgr sacm = (SpecifyAppContextMgr) AppContextMgr.getInstance();

    for (ViewIFace view : sacm.getEntirelyAllViews()) {
        //System.err.println(view.getName() + " ----------------------");
        for (AltViewIFace av : view.getAltViews()) {
            ViewDefIFace vd = av.getViewDef();
            if (vd.getType() == ViewType.form) {
                DBTableInfo ti = DBTableIdMgr.getInstance().getByClassName(vd.getClassName());
                if (ti != null) {
                    HashSet<String> tiHash = viewFieldHash.get(ti.getName());
                    if (tiHash == null) {
                        tiHash = new HashSet<String>();
                        viewFieldHash.put(ti.getName(), tiHash);
                    }

                    FormViewDef fvd = (FormViewDef) vd;
                    for (FormRowIFace row : fvd.getRows()) {
                        for (FormCellIFace cell : row.getCells()) {
                            if (cell.getType() == FormCellIFace.CellType.panel) {
                                FormCellPanelIFace panelCell = (FormCellPanelIFace) cell;
                                for (String fieldName : panelCell.getFieldNames()) {
                                    tiHash.add(fieldName);
                                }

                            } else if (cell.getType() == FormCellIFace.CellType.field
                                    || cell.getType() == FormCellIFace.CellType.subview) {
                                String fieldName = cell.getName();
                                if (!cell.isIgnoreSetGet() && !fieldName.equals("this")) {
                                    DBFieldInfo fi = ti.getFieldByName(fieldName);
                                    if (fi != null) {
                                        //System.err.println("Form Field["+fieldName+"] is in schema.");
                                        tiHash.add(fieldName);
                                    } else {
                                        DBRelationshipInfo ri = ti.getRelationshipByName(fieldName);
                                        if (ri == null) {
                                            //System.err.println("Form Field["+fieldName+"] not in table.");
                                        } else {
                                            tiHash.add(fieldName);
                                        }
                                    }
                                } else if (cell instanceof FormCellFieldIFace) {
                                    FormCellFieldIFace fcf = (FormCellFieldIFace) cell;
                                    if (fcf.getUiType() == FormCellFieldIFace.FieldType.plugin) {
                                        String pluginName = fcf.getProperty("name");
                                        if (StringUtils.isNotEmpty(pluginName)) {
                                            checkPluginForNames(fcf, pluginName, tiHash);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    for (DBTableInfo ti : DBTableIdMgr.getInstance().getTables()) {
        int cnt = 0;

        HashSet<String> tiHash = viewFieldHash.get(ti.getName());
        if (tiHash != null) {
            tblTitle2Name.put(ti.getTitle(), ti.getName());

            //System.err.println(ti.getName() + " ----------------------");
            for (DBFieldInfo fi : ti.getFields()) {
                Boolean isInForm = tiHash.contains(fi.getName());
                modelList.add(
                        createRow(ti.getTitle(), fi.getName(), fi.getTitle(), isInForm, fi.isHidden(), cnt++));
            }

            for (DBRelationshipInfo ri : ti.getRelationships()) {
                Boolean isInForm = tiHash.contains(ri.getName());
                modelList.add(
                        createRow(ti.getTitle(), ri.getName(), ri.getTitle(), isInForm, ri.isHidden(), cnt++));
            }
        }
    }

    viewModel = new ViewModel();
    JTable table = new JTable(viewModel);

    sorter = new TableRowSorter<TableModel>(viewModel);
    searchTF = new JAutoCompTextField(20);

    table.setRowSorter(sorter);

    CellConstraints cc = new CellConstraints();
    PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g", "p,4px,f:p:g,2px,p:g"));
    SearchBox searchBox = new SearchBox(searchTF, null);

    filterCBX = UIHelper.createComboBox(new String[] { "None", "Not On Form, Not Hidden", "On Form, Hidden" });

    PanelBuilder searchPB = new PanelBuilder(new FormLayout("p,2px,p, f:p:g, p,2px,p", "p"));
    searchPB.add(UIHelper.createI18NFormLabel("SEARCH"), cc.xy(1, 1));
    searchPB.add(searchBox, cc.xy(3, 1));
    searchPB.add(UIHelper.createI18NFormLabel("Filter"), cc.xy(5, 1));
    searchPB.add(filterCBX, cc.xy(7, 1));

    JLabel legend = UIHelper.createLabel(
            "<HTML><li><font color=\"red\">Red</font> - Not on form and not hidden</li><li><font color=\"magenta\">Magenta</font> - On the form , but is hidden</li><li>Black - Correct</li>");
    legend.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
    PanelBuilder legPB = new PanelBuilder(new FormLayout("p,f:p:g", "p"));
    legPB.add(legend, cc.xy(1, 1));

    pb.add(searchPB.getPanel(), cc.xy(1, 1));
    pb.add(UIHelper.createScrollPane(table), cc.xy(1, 3));
    pb.add(legPB.getPanel(), cc.xy(1, 5));
    pb.setDefaultDialogBorder();

    sorter.setRowFilter(null);

    searchTF.getDocument().addDocumentListener(new DocumentAdaptor() {
        @Override
        protected void changed(DocumentEvent e) {
            SwingUtilities.invokeLater(new Runnable() {

                /* (non-Javadoc)
                 * @see java.lang.Runnable#run()
                 */
                @Override
                public void run() {
                    if (filterCBX.getSelectedIndex() > 0) {
                        blockCBXUpdate = true;
                        filterCBX.setSelectedIndex(-1);
                        blockCBXUpdate = false;
                    }
                    String text = searchTF.getText();
                    sorter.setRowFilter(text.isEmpty() ? null : RowFilter.regexFilter("^(?i)" + text, 0, 1));
                }
            });
        }
    });

    filterCBX.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    if (!blockCBXUpdate) {
                        RowFilter<TableModel, Integer> filter = null;
                        int inx = filterCBX.getSelectedIndex();
                        if (inx > 0) {
                            filter = filterCBX.getSelectedIndex() == 1 ? new NotOnFormNotHiddenRowFilter()
                                    : new OnFormIsHiddenRowFilter();
                        }
                        sorter.setRowFilter(filter);
                    }
                }
            });
        }
    });

    table.setDefaultRenderer(String.class, new BiColorTableCellRenderer(false));
    table.setDefaultRenderer(Boolean.class, new BiColorBooleanTableCellRenderer());
    table.getColumnModel().getColumn(0).setCellRenderer(new TitleCellFadeRenderer());
    table.getColumnModel().getColumn(3).setCellRenderer(new BiColorTableCellRenderer(true));
    table.getColumnModel().getColumn(2).setCellRenderer(new BiColorTableCellRenderer(false) {
        @SuppressWarnings("unchecked")
        @Override
        public Component getTableCellRendererComponent(JTable tableArg, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            JLabel lbl = (JLabel) super.getTableCellRendererComponent(tableArg, value, isSelected, hasFocus,
                    row, column);

            /*if (sorter.getRowFilter() != null)
            {
            System.out.println(" getRowCount:"+sorter.getModel().getRowCount());
            Pair<String, Integer> col1Pair = (Pair<String, Integer>)sorter.getModel().getValueAt(row, 0);
            rowData = modelList.get(col1Pair.second);
                    
            } else
            {
            rowData = modelList.get(row);
            }*/

            //System.out.println(" R2:"+row+"  "+rowData[0]+"/"+rowData[1]+" - "+rowData[3]+"|"+rowData[4]);
            if (value instanceof TableInfo) {
                TableInfo pair = (TableInfo) value;
                Object[] rowData = modelList.get(pair.getSecond());
                lbl.setText(rowData[0].toString());

            } else if (value instanceof Pair<?, ?>) {
                Pair<String, Integer> pair = (Pair<String, Integer>) value;
                Object[] rowData = modelList.get(pair.getSecond());

                boolean isOnForm = rowData[3] instanceof Boolean ? (Boolean) rowData[3]
                        : ((String) rowData[3]).equals("Yes");
                boolean isHidden = rowData[4] instanceof Boolean ? (Boolean) rowData[4]
                        : ((String) rowData[4]).equals("true");

                if (!isOnForm && !isHidden) {
                    lbl.setForeground(Color.RED);

                } else if (isOnForm && isHidden) {
                    lbl.setForeground(Color.MAGENTA);
                } else {
                    lbl.setForeground(Color.BLACK);
                }
                lbl.setText(pair.getFirst());
            } else {
                lbl.setText(value.toString());
            }
            return lbl;
        }

    });

    //UIHelper.makeTableHeadersCentered(table, false);
    UIHelper.calcColumnWidths(table, null);

    //Removing fix all button because fix() method is broken (bug #8087)...

    /*CustomDialog dlg = new CustomDialog((Frame)UIRegistry.getTopWindow(), "", true, CustomDialog.OKCANCELAPPLY, pb.getPanel()) 
    {
    @Override
    protected void applyButtonPressed()
    {
        fix(this);
    }
    };
    dlg.setApplyLabel("Fix All");*/

    CustomDialog dlg = new CustomDialog((Frame) UIRegistry.getTopWindow(), "", true, CustomDialog.OKCANCEL,
            pb.getPanel());

    //... end removing fix all button

    dlg.setVisible(true);

    if (!dlg.isCancelled()) {
        updateSchema();
    }
}