Пример #1
0
  public SitesPanel(Connection dbConn) {
    this.dbConn = dbConn;
    this.setLayout(new BorderLayout());

    topPanel.setAlignmentX(CENTER_ALIGNMENT);
    topPanel.add(siteIDL);
    topPanel.add(siteIDF);
    topPanel.add(updateB);
    updateB.addActionListener(this);

    sitesTableModel.setColumnIdentifiers(
        new String[] {"Site ID", "Given Name", "Surname", "Suburb", "State"});
    sitesTableModel.addTableModelListener(this);
    sitesTableListModel.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION);
    sitesTable.setAutoCreateRowSorter(true);
    tableScroll.setPreferredSize(new Dimension(940, 600));
    tablePanel.add(tableScroll);

    updateSites();

    sitesTable
        .getColumnModel()
        .getColumn(4)
        .setCellEditor(
            new DefaultCellEditor(
                new JComboBox<String>(
                    new String[] {"", "NSW", "VIC", "QLD", "ACT", "WA", "SA", "TAS", "NT"})));

    this.add(topPanel, BorderLayout.NORTH);
    this.add(tablePanel, BorderLayout.CENTER);
  }
Пример #2
0
  @Override
  protected void setFingeringListWidget() {
    JPanel panel = new JPanel();
    panel.setLayout(new GridBagLayout());

    JLabel label = new JLabel("Fingering list: ");
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 0;
    gbc.gridy = 0;
    panel.add(label, gbc);

    DefaultTableModel model = getTableModel();
    fingeringList = new JideTable(model);
    resetTableData(0);
    fingeringList.setAutoscrolls(true);
    JScrollPane scrollPane = new JScrollPane(fingeringList);
    scrollPane.setBorder(new LineBorder(Color.BLACK));
    scrollPane.setPreferredSize(new Dimension(componentWidth, 210));
    scrollPane.setMinimumSize(new Dimension(250, 200));
    gbc.gridy = 1;
    gbc.weighty = 1.0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.gridheight = GridBagConstraints.REMAINDER;
    gbc.insets = new Insets(0, 15, 0, 0);
    panel.add(scrollPane, gbc);

    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 0;
    gbc.gridy = 3;
    gbc.insets = new Insets(0, 0, 10, 10);
    add(panel, gbc);
    model.addTableModelListener(this);
  }
Пример #3
0
 /**
  * Fills JTable with selected group
  *
  * @param words data to be displayed in table
  * @param newSet true if creating new set, false otherwise
  */
 public void setGroup(final Vector<Word> words, boolean newSet) {
   Object[] columns = {"Word", "Translation"};
   if (newSet) {
     tableModel = new DefaultTableModel(5, 2);
     tableModel.setColumnIdentifiers(columns);
   } else {
     Object[][] rows = new Object[words.size()][2];
     int i = 0;
     for (Word word : words) {
       rows[i][0] = word.getToTranslate();
       rows[i][1] = word.getTranslation();
       i++;
     }
     tableModel = new DefaultTableModel(rows, columns);
   }
   // table = new JTable(tableModel);
   table.setModel(tableModel);
   tableModel.addTableModelListener(
       new TableModelListener() {
         public void tableChanged(TableModelEvent arg0) {
           getRootPane().setDefaultButton(saveButton);
           saveButton.setEnabled(true);
         }
       });
 }
  public VariableCaseEditorPanel() {

    setLayout(new BorderLayout());

    /*
     * Add title
     */
    JPanel pa = new JPanel();
    pa.add(titleLabel = new JLabel("Variable Case Editor"));
    add(BorderLayout.NORTH, pa);

    /*
     * Build and add table
     */
    table = new JTable();
    add(BorderLayout.CENTER, new JScrollPane(table));
    model = new DefaultTableModel(new String[] {"Key", "Value"}, 0);
    table.setModel(model);

    /*
     * Build and add +/- var buttons
     */
    JPanel bPan = new JPanel();
    bPan.add(addVarButton = new JButton("Add"));
    bPan.add(removeVarButton = new JButton("Remove"));
    add(BorderLayout.SOUTH, bPan);
    addVarButton.setActionCommand(ADD_VARIABLE_ACTION);
    addVarButton.addActionListener(this);
    removeVarButton.setActionCommand(REMOVE_VARIABLE_ACTION);
    removeVarButton.addActionListener(this);

    model.addTableModelListener(this);
  }
Пример #5
0
    public ReplicatedTreeView(ReplicatedTree tree, Object title) throws Exception {
      this.tree = tree;
      tree.addReplicatedTreeListener(this);

      addNotify();
      setTitle("ReplicatedTreeDemo: mbr=" + title);

      tree_model = new DefaultTreeModel(root);
      jtree = new JTree(tree_model);
      jtree.setDoubleBuffered(true);
      jtree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

      JScrollPane scroll_pane = new JScrollPane(jtree);

      populateTree();

      getContentPane().add(scroll_pane, BorderLayout.CENTER);
      addWindowListener(this);

      table_model.setColumnIdentifiers(new String[] {"Name", "Value"});
      table_model.addTableModelListener(this);

      setTableColumnWidths();

      tablePanel = new JPanel();
      tablePanel.setLayout(new BorderLayout());
      tablePanel.add(table.getTableHeader(), BorderLayout.NORTH);
      tablePanel.add(table, BorderLayout.CENTER);

      getContentPane().add(tablePanel, BorderLayout.SOUTH);

      jtree.addTreeSelectionListener(this); // REVISIT

      MouseListener ml =
          new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
              int selRow = jtree.getRowForLocation(e.getX(), e.getY());
              TreePath selPath = jtree.getPathForLocation(e.getX(), e.getY());
              if (selRow != -1) {
                selected_node = makeFQN(selPath.getPath());
                jtree.setSelectionPath(selPath);

                if (e.getModifiers() == java.awt.event.InputEvent.BUTTON3_MASK) {
                  operationsPopup.show(e.getComponent(), e.getX(), e.getY());
                }
              }
            }
          };

      jtree.addMouseListener(ml);

      createMenus();
      setLocation(50, 50);
      setSize(
          getInsets().left + getInsets().right + 485, getInsets().top + getInsets().bottom + 367);

      init();
      setVisible(true);
    }
Пример #6
0
  public AddEditFormFrame(LexiconList list) {

    this.lexList = list;

    setTitle("Forms");
    setSize(200, 400);
    setResizable(false);
    setLayout(null);
    setLocationRelativeTo(null);
    setVisible(true);
    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(1, 1, 200, 300);
    formTable = new JTable();
    formTable.setPreferredSize(new Dimension(200, 320));
    model = (DefaultTableModel) formTable.getModel();
    model.setColumnIdentifiers(new String[] {"Forms"});
    for (String form : lexList.getPossibleForms()) model.addRow(new String[] {form});
    scrollPane.setViewportView(formTable);
    add(scrollPane);

    JButton addForm = new JButton("Add Form");
    addForm.setBounds(50, 320, 80, 30);
    add(addForm);

    addForm.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            model.addRow(new String[] {""});
          }
        });

    formTable.addKeyListener(
        new KeyListener() {

          @Override
          public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_DELETE) {
              if (formTable.getSelectedRowCount() > 0) {
                int n =
                    JOptionPane.showConfirmDialog(
                        null,
                        "Are you sure you want to delete all selected forms?",
                        "An Inane Question",
                        JOptionPane.YES_NO_OPTION);
                if (n == JOptionPane.YES_OPTION) {
                  for (int i = formTable.getSelectedRows().length - 1; i >= 0; i--) {
                    lexList.deletePossibleForm(
                        (String) model.getValueAt(formTable.getSelectedRows()[i], 0));
                    model.removeRow(formTable.getSelectedRows()[i]);
                  }
                }
              }
            }
          }

          public void keyReleased(KeyEvent e) {}

          public void keyTyped(KeyEvent e) {}
        });

    model.addTableModelListener(
        new TableModelListener() {
          public void tableChanged(TableModelEvent arg0) {
            int row = arg0.getFirstRow();
            int column = arg0.getColumn();
            if (column >= 0 && row >= 0) {
              if (row >= lexList.getPossibleForms().size()) {
                lexList.addNewPossibleForm((String) model.getValueAt(row, column));
              } else {
                lexList.renamePossibleForm(
                    lexList.getPossibleForms().get(row), (String) model.getValueAt(row, column));
              }
            }
          }
        });
  }
  private JTable createPropertiesPanel() {
    DefaultTableModel model =
        new DefaultTableModel(1, 2) {
          @Override
          public boolean isCellEditable(int row, int column) {
            return column == 1;
          }
        };
    model.setValueAt(Bundle.PathLabel_Text(), 0, 0);
    model.setValueAt(ToolAdapterIO.getUserAdapterPath(), 0, 1);
    model.addTableModelListener(
        l -> {
          String newPath = model.getValueAt(0, 1).toString();
          File path = new File(newPath);
          if (!path.exists()
              && SnapDialogs.Answer.YES
                  == SnapDialogs.requestDecision(
                      "Path does not exist",
                      "The path you have entered does not exist.\nDo you want to create it?",
                      true,
                      "Don't ask me in the future")) {
            if (!path.mkdirs()) {
              SnapDialogs.showError("Path could not be created!");
            }
          }
          if (path.exists()) {
            File oldPath = ToolAdapterIO.getUserAdapterPath();
            ToolAdapterOperatorDescriptor[] operatorDescriptors =
                ToolAdapterActionRegistrar.getActionMap()
                    .values()
                    .toArray(
                        new ToolAdapterOperatorDescriptor
                            [ToolAdapterActionRegistrar.getActionMap().values().size()]);
            for (ToolAdapterOperatorDescriptor descriptor : operatorDescriptors) {
              ToolAdapterActionRegistrar.removeOperatorMenu(descriptor);
            }
            ToolAdapterIO.setAdaptersPath(Paths.get(newPath));
            if (!newPath.equals(oldPath.getAbsolutePath())) {
              Collection<ToolAdapterOpSpi> toolAdapterOpSpis =
                  ToolAdapterIO.searchAndRegisterAdapters();
              for (ToolAdapterOpSpi spi : toolAdapterOpSpis) {
                ToolAdapterActionRegistrar.registerOperatorMenu(
                    (ToolAdapterOperatorDescriptor) spi.getOperatorDescriptor());
              }
              refreshContent();
            }
          }
        });
    JTable table = new JTable(model);
    TableColumn labelColumn = table.getColumnModel().getColumn(0);
    labelColumn.setPreferredWidth((CHECK_COLUMN_WIDTH + LABEL_COLUMN_WIDTH) / 2);
    TableColumn pathColumn = table.getColumnModel().getColumn(1);
    pathColumn.setPreferredWidth(COLUMN_WIDTH);
    pathColumn.setCellEditor(new FileChooserCellEditor());
    table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
    table.setRowHeight(PATH_ROW_HEIGHT);
    table.setBorder(BorderFactory.createLineBorder(Color.black));
    table.addFocusListener(
        new FocusListener() {
          @Override
          public void focusGained(FocusEvent e) {}

          @Override
          public void focusLost(FocusEvent e) {
            Object source = e.getSource();
            if (!table.equals(source)) {
              table.editingCanceled(new ChangeEvent(source));
              table.clearSelection();
            }
          }
        });
    return table;
  }
Пример #8
0
  public MarkingCode(
      final String courseID,
      final Activity act,
      final int stud_id,
      String student_name,
      Object[] stud_list) {
    super(act.getName(), CANT_NAV);
    initComponents();
    this.student_list = stud_list;
    this.activity = act;
    this.stud_name = student_name;

    student_name_label.setText(student_name);
    id_label.setText(Integer.toString(stud_id));

    max_grade_field.setEditable(false);
    grade_field.setEditable(false);

    float max = 0;

    this.testsuite_activity = act;
    this.courseID = courseID;
    this.actName = act.getName();
    this.studentID = stud_id;

    String last_indice_check = student_name + " - " + studentID;
    if (last_indice_check.equalsIgnoreCase((String) stud_list[stud_list.length - 1]))
      this.next_button.setEnabled(false);

    System.out.println("Trying to read submission");
    paths = CourseAccess.accessSubmissionPath(courseID, act.getName());
    Scanner in = null;
    String submission = "";
    try {
      in = new Scanner(new FileReader(paths[0] + "/" + stud_id + "/" + act.getName() + ".py"));
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }
    while (in.hasNext()) {
      submission += in.nextLine() + "\n";
    }
    in.close();
    submission_text_area.setText(submission);

    String solution = "";
    try {
      in = new Scanner(new FileReader(paths[1]));
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }
    while (in.hasNext()) {
      solution += in.nextLine() + "\n";
    }
    in.close();
    solution_text_area.setText(solution);

    // Populate the Rubric Table code below this:
    grade_field.setText("");
    Object[][] temp = CourseAccess.accessRubricItems(courseID, act.getName());
    if (temp.length != 0) {
      table = new Object[temp.length][3];
      for (int i = 0; i < table.length; i++) {
        table[i][0] = temp[i][0];
        table[i][1] = 0;
        table[i][2] = temp[i][1];
        max += (float) temp[i][1];
      }
      DefaultTableModel tm =
          new DefaultTableModel(table, COLUMN_NAMES) {
            public boolean isCellEditable(int row, int column) {
              if (column == 0 || column == 2) return false;
              return true;
            }
          };
      ;
      tm.addTableModelListener(
          new javax.swing.event.TableModelListener() {
            public void tableChanged(TableModelEvent e) {
              table_change_actionPerformed(e);
            }
          });
      ;
      rubric_table.setModel(tm);
    }
    Object[] grades = GradeAccess.accessGrades(courseID, act.getName(), stud_id);
    System.out.println(grades.length);
    if (grades.length != 0) {
      for (int i = 0; i < grades.length; i++) {
        table[i][1] = grades[i];
        System.out.println(grades[i]);
      }
      DefaultTableModel tm =
          new DefaultTableModel(table, COLUMN_NAMES) {
            public boolean isCellEditable(int row, int column) {
              if (column == 0 || column == 2) return false;
              return true;
            }
          };
      ;
      tm.addTableModelListener(
          new javax.swing.event.TableModelListener() {
            public void tableChanged(TableModelEvent e) {
              table_change_actionPerformed(e);
            }
          });
      ;
      rubric_table.setModel(tm);
      float gradeTotal = 0;
      for (int i = 0; i < rubric_table.getRowCount(); i++)
        gradeTotal += Float.parseFloat(rubric_table.getModel().getValueAt(i, 1).toString());
      String currentGrade = "" + gradeTotal;
      grade_field.setText(currentGrade);
    }
    String maxField = "" + max;
    max_grade_field.setText(maxField);
    rubric_table.getColumnModel().getColumn(0).setPreferredWidth(500);
  }
Пример #9
0
 private void initializeComponents() {
   setLayout(new GridBagLayout());
   {
     JPanel sideButtons = new JPanel(new GridBagLayout());
     add(
         sideButtons,
         new GridBagConstraints(
             1,
             0,
             1,
             1,
             0,
             0,
             GridBagConstraints.CENTER,
             GridBagConstraints.BOTH,
             new Insets(0, 0, 0, 0),
             0,
             0));
     {
       JButton newButton = new JButton("New");
       sideButtons.add(
           newButton,
           new GridBagConstraints(
               0,
               -1,
               1,
               1,
               0,
               0,
               GridBagConstraints.CENTER,
               GridBagConstraints.HORIZONTAL,
               new Insets(0, 0, 6, 0),
               0,
               0));
       newButton.addActionListener(
           new ActionListener() {
             public void actionPerformed(ActionEvent event) {
               newEmitter("Untitled", true);
             }
           });
     }
     {
       JButton deleteButton = new JButton("Delete");
       sideButtons.add(
           deleteButton,
           new GridBagConstraints(
               0,
               -1,
               1,
               1,
               0,
               0,
               GridBagConstraints.CENTER,
               GridBagConstraints.HORIZONTAL,
               new Insets(0, 0, 6, 0),
               0,
               0));
       deleteButton.addActionListener(
           new ActionListener() {
             public void actionPerformed(ActionEvent event) {
               deleteEmitter();
             }
           });
     }
     {
       sideButtons.add(
           new JSeparator(JSeparator.HORIZONTAL),
           new GridBagConstraints(
               0,
               -1,
               1,
               1,
               0,
               0,
               GridBagConstraints.CENTER,
               GridBagConstraints.HORIZONTAL,
               new Insets(0, 0, 6, 0),
               0,
               0));
     }
     {
       JButton saveButton = new JButton("Save");
       sideButtons.add(
           saveButton,
           new GridBagConstraints(
               0,
               -1,
               1,
               1,
               0,
               0,
               GridBagConstraints.CENTER,
               GridBagConstraints.HORIZONTAL,
               new Insets(0, 0, 6, 0),
               0,
               0));
       saveButton.addActionListener(
           new ActionListener() {
             public void actionPerformed(ActionEvent event) {
               saveEffect();
             }
           });
     }
     {
       JButton openButton = new JButton("Open");
       sideButtons.add(
           openButton,
           new GridBagConstraints(
               0,
               -1,
               1,
               1,
               0,
               0,
               GridBagConstraints.CENTER,
               GridBagConstraints.HORIZONTAL,
               new Insets(0, 0, 6, 0),
               0,
               0));
       openButton.addActionListener(
           new ActionListener() {
             public void actionPerformed(ActionEvent event) {
               openEffect();
             }
           });
     }
     {
       JButton upButton = new JButton("Up");
       sideButtons.add(
           upButton,
           new GridBagConstraints(
               0,
               -1,
               1,
               1,
               0,
               1,
               GridBagConstraints.SOUTH,
               GridBagConstraints.HORIZONTAL,
               new Insets(0, 0, 6, 0),
               0,
               0));
       upButton.addActionListener(
           new ActionListener() {
             public void actionPerformed(ActionEvent event) {
               move(-1);
             }
           });
     }
     {
       JButton downButton = new JButton("Down");
       sideButtons.add(
           downButton,
           new GridBagConstraints(
               0,
               -1,
               1,
               1,
               0,
               0,
               GridBagConstraints.CENTER,
               GridBagConstraints.HORIZONTAL,
               new Insets(0, 0, 0, 0),
               0,
               0));
       downButton.addActionListener(
           new ActionListener() {
             public void actionPerformed(ActionEvent event) {
               move(1);
             }
           });
     }
   }
   {
     JScrollPane scroll = new JScrollPane();
     add(
         scroll,
         new GridBagConstraints(
             0,
             0,
             1,
             1,
             1,
             1,
             GridBagConstraints.CENTER,
             GridBagConstraints.BOTH,
             new Insets(0, 0, 0, 6),
             0,
             0));
     {
       emitterTable =
           new JTable() {
             public Class getColumnClass(int column) {
               return column == 1 ? Boolean.class : super.getColumnClass(column);
             }
           };
       emitterTable.getTableHeader().setReorderingAllowed(false);
       emitterTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
       scroll.setViewportView(emitterTable);
       emitterTableModel = new DefaultTableModel(new String[0][0], new String[] {"Emitter", ""});
       emitterTable.setModel(emitterTableModel);
       emitterTable
           .getSelectionModel()
           .addListSelectionListener(
               new ListSelectionListener() {
                 public void valueChanged(ListSelectionEvent event) {
                   if (event.getValueIsAdjusting()) return;
                   emitterSelected();
                 }
               });
       emitterTableModel.addTableModelListener(
           new TableModelListener() {
             public void tableChanged(TableModelEvent event) {
               if (event.getColumn() != 1) return;
               emitterChecked(
                   event.getFirstRow(), (Boolean) emitterTable.getValueAt(event.getFirstRow(), 1));
             }
           });
     }
   }
 }
 @Override
 public void addTableModelListener(TableModelListener l) {
   super.addTableModelListener(l);
 }
Пример #11
0
  /** prepares the whole frame to be displayed */
  public void prepareFrame() {
    setLocation(200, 100);
    setSize(400, 400);
    mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());

    //  PREPARATION OF THE NORTH PANEL
    JPanel northPanel = new JPanel();
    northPanel.setLayout(new BoxLayout(northPanel, BoxLayout.X_AXIS));
    addRowButton = new JButton("+");
    addRowButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            eventQueue.add(new WordEvent(WordEvent.ADD_ROW));
          }
        });
    removeRowButton = new JButton("-");
    removeRowButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            eventQueue.add(new WordEvent(WordEvent.REMOVE_ROWS));
          }
        });
    deleteButton = new JButton("del");
    deleteButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            eventQueue.add(new WordEvent(WordEvent.DELETE_GROUP));
          }
        });

    northPanel.add(addRowButton);
    northPanel.add(removeRowButton);
    northPanel.add(deleteButton);
    mainPanel.add(northPanel, BorderLayout.NORTH);
    // NOTRH PANEL END

    // PREPARATION OF THE SOUTH PANEL
    JPanel southPanel = new JPanel();
    southPanel.setLayout(new BoxLayout(southPanel, BoxLayout.X_AXIS));
    saveButton = new JButton("Save changes");
    saveButton.setEnabled(false);
    saveButton.setVisible(true);
    saveButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            Thread myThread =
                new Thread(
                    new Runnable() {
                      public void run() {
                        model.editGroup(tableModel.getDataVector());
                      }
                    });
            myThread.start();
            saveButton.setEnabled(false);
          }
        });
    cancelButton = new JButton("Cancel changes");
    cancelButton.setEnabled(true);
    cancelButton.setVisible(true);
    cancelButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            eventQueue.add(new WordEvent(WordEvent.PREPARE_EDIT));
          }
        });

    southPanel.add(saveButton);
    southPanel.add(cancelButton);
    mainPanel.add(southPanel, BorderLayout.SOUTH);
    // SOUTH PANEL END

    JPanel centerPanel = new JPanel();
    centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.Y_AXIS));
    JLabel groupName = new JLabel(model.getCurrentGroup());
    centerPanel.add(groupName);
    Object[] columns = {"Word", "Translation"};
    tableModel = new DefaultTableModel(5, 2);
    tableModel.setColumnIdentifiers(columns);

    table = new JTable(tableModel);
    JScrollPane scrollPane = new JScrollPane(table);
    table.setFillsViewportHeight(true);
    tableModel.addTableModelListener(
        new TableModelListener() {
          public void tableChanged(TableModelEvent arg0) {
            getRootPane().setDefaultButton(saveButton);
            saveButton.setEnabled(true);
          }
        });
    centerPanel.add(scrollPane);
    mainPanel.add(centerPanel, BorderLayout.CENTER);

    getRootPane().setDefaultButton(cancelButton);
    mainPanel.setVisible(true);
    add(mainPanel);
  }
Пример #12
0
  /* (non-Javadoc)
   * @see edu.ku.brc.af.auth.PermissionPanelContainerIFace#updateData(edu.ku.brc.specify.datamodel.SpPrincipal, edu.ku.brc.specify.datamodel.SpPrincipal, java.util.Hashtable, java.util.Hashtable, java.lang.String)
   */
  public void updateData(
      final SpPrincipal principalArg,
      final SpPrincipal overrulingPrincipalArg,
      final Hashtable<String, SpPermission> existingPerms,
      final Hashtable<String, SpPermission> overrulingPerms,
      final String userType) {
    // save principal used when saving permissions later
    this.principal = principalArg;

    model =
        new DefaultTableModel() {
          public Class<?> getColumnClass(int columnIndex) {
            switch (columnIndex) {
              case 0:
                return ImageIcon.class;
              case 1:
                return String.class;
                // the wrapper for permissions and their overriding values and descriptions
              default:
                return GeneralPermissionTableCellValueWrapper.class;
            }
          }

          public boolean isCellEditable(int row, int column) {
            return !readOnly && (column >= 2);
          }
        };

    addColumnHeaders(model);

    IconManager.IconSize iconSize = IconManager.IconSize.Std20;
    icon = IconManager.getIcon("SystemSetup", iconSize);

    JLabel label = UIHelper.createLabel("XXXX");
    label.setIcon(icon);

    rowDataList.clear();

    List<PermissionEditorRowIFace> perms =
        enumerator.getPermissions(principalArg, existingPerms, overrulingPerms, userType);
    Collections.sort(perms, new ComparatorByStringRepresentation<PermissionEditorRowIFace>(true));
    for (PermissionEditorRowIFace permWrapper : perms) {
      rowDataList.add(permWrapper);
    }

    if (model == null) {
      return;
    }

    while (model.getRowCount() > 0) {
      model.removeRow(0);
    }

    for (PermissionEditorRowIFace permWrapper : rowDataList) {
      permWrapper.addTableRow(model, icon);
    }

    table.setModel(model);
    table.setRowHeight(label.getPreferredSize().height + 5);

    /*int rows   = 15;
    int height = 0;
       for(int row = 0; row < rows; row++)
       {
           height += table.getRowHeight(row);
       }*/

    table.setPreferredScrollableViewportSize(
        new Dimension(table.getPreferredScrollableViewportSize().width, 50));

    TableColumn column = table.getColumnModel().getColumn(0);
    int cellWidth = iconSize.size() + 4;
    column.setMinWidth(cellWidth);
    column.setMaxWidth(cellWidth);
    column.setPreferredWidth(cellWidth);

    // For Strings with no changes made to the table, the render is a DefaultTableCellRender.
    // DefaultTableCellRenderer dtcr = (DefaultTableCellRenderer) column.getCellRenderer();
    // set the alignment to center
    // dtcr.setHorizontalAlignment(SwingConstants.CENTER);

    column = table.getColumnModel().getColumn(1);
    column.setMinWidth(100);
    column.setMaxWidth(400);
    column.setPreferredWidth(200);

    model.addTableModelListener(
        new TableModelListener() {
          public void tableChanged(TableModelEvent e) {
            if (listener != null) {
              listener.stateChanged(new ChangeEvent(this));
            }
          }
        });

    setCellRenderer();
  }