Exemplo n.º 1
0
 public void actionPerformed(ActionEvent e) {
   if (e.getActionCommand().equals("Add Column")) {
     PopMessage.popMsg("Invalid new column for this window");
     // defaultModel.addColumn("AddColumn");
   }
   if (e.getActionCommand().equals("Add Row")) defaultModel.addRow(new Vector());
   if (e.getActionCommand().equals("Remove Column")) {
     PopMessage.popMsg("Invalid new column for this window");
     //            int columncount = defaultModel.getColumnCount() - 1;
     //            if (columncount >= 0) {
     //                TableColumnModel columnModel = table.getColumnModel();
     //                TableColumn tableColumn = columnModel.getColumn(columncount);
     //                columnModel.removeColumn(tableColumn);
     //                defaultModel.setColumnCount(columncount);
     //            }
   }
   if (e.getActionCommand().equals("Remove Row")) {
     int rowcount = defaultModel.getRowCount() - 1;
     if (rowcount >= 0) {
       defaultModel.removeRow(rowcount);
       defaultModel.setRowCount(rowcount);
     }
   }
   table.revalidate();
 }
Exemplo n.º 2
0
 /** @param key */
 private void fileTableDate(String key, String tableType) {
   if ("set".equalsIgnoreCase(tableType)) {
     initSetTable(key, tableType);
   } else if ("list".equalsIgnoreCase(tableType)) {
     initListTable(key, tableType);
   } else if ("hash".equalsIgnoreCase(tableType)) {
     initHashTable(key, tableType);
   } else if ("string".equalsIgnoreCase(tableType)) {
     initStringTable(key, tableType);
   } else {
     PopMessage.popMsg("Unsupported table type");
   }
   // fresh
   comboBoxPanel.updateUI();
 }
Exemplo n.º 3
0
  public void showDiffContents(String tableType) {
    comboBoxPanel.removeAll();

    // JLabel tableTypelbl = new JLabel("Add type:" + tableType);

    // comboBoxPanel.setLayout(new BoxLayout(comboBoxPanel, BoxLayout.Y_AXIS));
    // comboBoxPanel.add(tableTypelbl);

    // init the ui
    if ("set".equalsIgnoreCase(tableType)) {
      initSetTable(null, tableType);
    } else if ("list".equalsIgnoreCase(tableType)) {
      initListTable(null, tableType);
    } else if ("hash".equalsIgnoreCase(tableType)) {
      initHashTable(null, tableType);
    } else if ("string".equalsIgnoreCase(tableType)) {
      initStringTable(null, tableType);
    } else {
      PopMessage.popMsg("Unsupported table type");
    }
    // fresh
    comboBoxPanel.updateUI();
  }