/**
   * Creates new form FortfuehrungsanlaesseDialog.
   *
   * @param parent DOCUMENT ME!
   * @param modal DOCUMENT ME!
   */
  private FortfuehrungsanlaesseDialog(final Frame parent, final boolean modal) {
    super(parent, modal);

    initComponents();

    final Highlighter istAbgearbeitetHighlighter = new IstAbgearbeitetHighlighter();
    jXTable1.setHighlighters(istAbgearbeitetHighlighter);

    jXTable1.setModel(new FortfuehrungenTableModel());

    jXTable1
        .getColumnModel()
        .getColumn(0)
        .setCellRenderer(jXTable1.getDefaultRenderer(String.class));
    jXTable1
        .getColumnModel()
        .getColumn(1)
        .setCellRenderer(jXTable1.getDefaultRenderer(String.class));
    jXTable1
        .getColumnModel()
        .getColumn(2)
        .setCellRenderer(jXTable1.getDefaultRenderer(String.class));

    jXTable1.getColumnModel().getColumn(0).setPreferredWidth(100);
    jXTable1.getColumnModel().getColumn(1).setPreferredWidth(150);
    jXTable1.getColumnModel().getColumn(2).setPreferredWidth(200);

    jXTable1.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    jXTable1.setDragEnabled(false);

    jXTable1.getTableHeader().setResizingAllowed(true);
    jXTable1.getTableHeader().setReorderingAllowed(false);
    // jXTable1.setSortOrder(1, SortOrder.ASCENDING);

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

              @Override
              public void valueChanged(final ListSelectionEvent e) {
                // If cell selection is enabled, both row and column change events are fired
                if ((e.getSource() == jXTable1.getSelectionModel())
                    && jXTable1.getRowSelectionAllowed()) {
                  fortfuehrungsTableListSelectionChanged(e);
                }
              }
            });

    jProgressBar1.setVisible(false);
  }
  // Initialize JTable
  private void initTable() {
    DialogTableModel tblModel = new DialogTableModel(students);
    studentsTbl.setModel(tblModel);

    studentsTbl.setAutoCreateRowSorter(true);
    studentsTbl.setRowSelectionAllowed(true);
    studentsTbl.getRowSorter().toggleSortOrder(1);
    studentsTbl.setGridColor(Color.gray);
    studentsTbl.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    studentsTbl.setRowHeight(22);

    TableColumn tc = studentsTbl.getColumnModel().getColumn(0);
    tc.setCellEditor(studentsTbl.getDefaultEditor(Boolean.class));
    tc.setCellRenderer(studentsTbl.getDefaultRenderer(Boolean.class));
    tc.setHeaderRenderer(
        new CheckBoxTableHeader(
            new ItemListener() {
              @Override
              public void itemStateChanged(ItemEvent e) {
                Object source = e.getSource();
                if (source instanceof AbstractButton == false) {
                  return;
                }
                boolean checked = e.getStateChange() == ItemEvent.SELECTED;
                for (int x = 0, y = studentsTbl.getRowCount(); x < y; x++) {
                  studentsTbl.setValueAt(new Boolean(checked), x, 0);
                }
              }
            }));
  }
  /** Constructor. */
  public CombinedRulesPanel() {
    super();
    this.combinedRulesTableModel = new CombinedRulesTableModel();
    this.combinedRulesTable =
        new JXTable() {

          private static final long serialVersionUID = 2L;

          @Override
          protected JTableHeader createDefaultTableHeader() {
            return new JXTableHeader(columnModel) {
              private static final long serialVersionUID = 1L;

              @Override
              public void updateUI() {
                super.updateUI();
                // need to do in updateUI to survive toggling of LAF
                if (getDefaultRenderer() instanceof JLabel) {
                  ((JLabel) getDefaultRenderer()).setHorizontalAlignment(JLabel.CENTER);
                }
              }
            };
          }
        };

    this.combinedRulesTable.setModel(combinedRulesTableModel);
    this.combinedRulesTable
        .getSelectionModel()
        .setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    this.combinedRulesTable.setShowGrid(false);

    this.combinedRulesTable.getSelectionModel().addListSelectionListener(this);

    @SuppressWarnings("unused")
    org.jdesktop.swingx.renderer.DefaultTableRenderer renderer =
        (org.jdesktop.swingx.renderer.DefaultTableRenderer)
            combinedRulesTable.getDefaultRenderer(String.class);

    // Make some columns wider than the rest, so that the info fits in.
    TableColumnModel columnModel = combinedRulesTable.getColumnModel();
    columnModel.getColumn(CombinedRulesTableColumns.COMBINED_RULE.ordinal()).setPreferredWidth(10);
    columnModel.getColumn(CombinedRulesTableColumns.RULE_FREQUENCY.ordinal()).setPreferredWidth(10);
    /*
        columnModel.getColumn(SequiturRulesTableColumns.RULE_USE_FREQUENCY.ordinal()).setPreferredWidth(40);
        columnModel.getColumn(SequiturRulesTableColumns.SEQUITUR_RULE.ordinal()).setPreferredWidth(100);
        columnModel.getColumn(SequiturRulesTableColumns.EXPANDED_SEQUITUR_RULE.ordinal()).setPreferredWidth(
            150);
        columnModel.getColumn(SequiturRulesTableColumns.RULE_MEAN_LENGTH.ordinal()).setPreferredWidth(120);
    */

    /*
         * dont need sorter -qz
         *
        TableRowSorter<CombinedRulesTableModel> sorter = new TableRowSorter<CombinedRulesTableModel>(
            combinedRulesTableModel);
        combinedRulesTable.setRowSorter(sorter);
        sorter.setComparator(SequiturRulesTableColumns.EXPANDED_SEQUITUR_RULE.ordinal(),
            expandedRuleComparator);

        DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer();
        rightRenderer.setHorizontalAlignment(SwingConstants.RIGHT);
        this.combinedRulesTable.getColumnModel().getColumn(1).setCellRenderer(rightRenderer);
    */
    this.combinedRulesPanel = new JScrollPane(combinedRulesTable);
  }