1 19 20 package org.netbeans.modules.form.editors2; 21 22 import java.awt.*; 23 import java.beans.*; 24 import java.util.*; 25 import java.io.*; 26 import javax.swing.table.*; 27 28 import org.openide.util.NbBundle; 29 import org.openide.explorer.propertysheet.editors.XMLPropertyEditor; 30 import org.netbeans.modules.form.NamedPropertyEditor; 31 32 36 37 public class TableModelEditor implements PropertyEditor, XMLPropertyEditor, NamedPropertyEditor { 38 39 public TableModelEditor() { 40 support = new PropertyChangeSupport (this); 41 } 42 43 public Object getValue () { 44 return table; 45 } 46 47 public void setValue (Object value) { 48 table = new NbTableModel ((TableModel) value); 49 support.firePropertyChange ("", null, null); } 51 52 public String getAsText () { 53 return null; 54 } 55 56 public void setAsText (String string) { 57 } 58 59 public String getJavaInitializationString () { 60 TableModel m = (TableModel) getValue (); 61 StringBuffer titlesSB = new StringBuffer (); 62 int i = m.getColumnCount (); 63 int j = m.getRowCount (); 64 titlesSB.append ("{\n\t\t"); if (i > 0) { 66 String s = m.getColumnName (0); 67 titlesSB.append ("\"").append (s != null ? s : "").append ('"'); for (int k = 1; k < i; k++) { 69 String s1 = m.getColumnName (k); 70 titlesSB.append (", \"").append (s1 != null ? s1 : "").append ('"'); } 72 } 73 titlesSB.append ("\n\t}"); 75 boolean generateTypes = false; 76 StringBuffer typesSB = new StringBuffer (); 77 typesSB.append ("{\n\t\t"); if (i > 0) { 79 typesSB.append (m.getColumnClass (0).getName ()).append (".class"); if (m.getColumnClass (0) != Object .class) 81 generateTypes = true; 82 for (int k = 1; k < i; k++) { 83 if (m.getColumnClass (k) != Object .class) 84 generateTypes = true; 85 typesSB.append (", ").append (m.getColumnClass (k).getName ()).append (".class"); } 87 } 88 typesSB.append ("\n\t}"); 90 boolean generateEditable = false; 91 StringBuffer editableSB = new StringBuffer (); 92 editableSB.append ("{\n\t\t"); if (i > 0) { 94 editableSB.append (m.isCellEditable (0, 0)); 95 if (!m.isCellEditable (0, 0)) generateEditable = true; 96 for (int k = 1; k < i; k++) { 97 if (!m.isCellEditable (0, k)) generateEditable = true; 98 editableSB.append (", ").append (m.isCellEditable (0, k)); } 100 } 101 editableSB.append ("\n\t}"); 103 StringBuffer dataSB = new StringBuffer (); 104 dataSB.append ("{\n\t\t"); if (j > 0) { 106 for (int l = 0; l < j; l++) { 107 if (l != 0) 108 dataSB.append (",\n\t\t"); if (i == 0) { 110 dataSB.append ("{}"); } else { 112 Object obj = m.getValueAt (l, 0); 113 dataSB.append ('{').append (getAsString (obj)); 114 for (int i1 = 1; i1 < i; i1++) { 115 obj = m.getValueAt (l, i1); 116 dataSB.append (", ").append (getAsString (obj)); } 118 dataSB.append ('}'); 119 } 120 } 121 } 122 dataSB.append ("\n\t}"); if (generateEditable || generateTypes) { 124 return 125 "new javax.swing.table.DefaultTableModel(\n" + "\tnew Object [][] " + dataSB.toString() + ",\n" + "\tnew String [] " + titlesSB.toString() + "\n" + ") {\n" + (generateTypes ? ( 130 "\tClass[] types = new Class [] " + typesSB.toString() + ";\n") : "") + (generateEditable ? ( 133 "\tboolean[] canEdit = new boolean [] " + editableSB.toString() + ";\n") : "") + (generateTypes ? ( 136 "\n" + "\tpublic Class getColumnClass(int columnIndex) {\n" + "\t\treturn types [columnIndex];\n" + "\t}\n") : "") + (generateEditable ? ( 142 "\n" + "\tpublic boolean isCellEditable(int rowIndex, int columnIndex) {\n" + "\t\treturn canEdit [columnIndex];\n" + "\t}\n") : "") + "}"; } else { 149 return 150 "new javax.swing.table.DefaultTableModel(\n" + "\tnew Object [][] " + dataSB.toString() + ",\n" + "\tnew String [] " + titlesSB.toString() + "\n" + ")"; } 155 } 156 157 public String [] getTags () { 158 return null; 159 } 160 161 public boolean isPaintable () { 162 return false; 163 } 164 165 public void paintValue (Graphics g, Rectangle rectangle) { 166 } 167 168 public boolean supportsCustomEditor () { 169 return true; 170 } 171 172 public Component getCustomEditor () { 173 return new CustomTableModelEditor (this); 174 } 175 176 public void addPropertyChangeListener (PropertyChangeListener propertyChangeListener) { 177 support.addPropertyChangeListener (propertyChangeListener); 178 } 179 180 public void removePropertyChangeListener (PropertyChangeListener propertyChangeListener) { 181 support.removePropertyChangeListener (propertyChangeListener); 182 } 183 184 187 private static final String XML_TABLE = "Table"; private static final String XML_COLUMN = "Column"; private static final String XML_DATA = "Data"; 191 private static final String ATTR_COLUMN_COUNT = "columnCount"; private static final String ATTR_ROW_COUNT = "rowCount"; private static final String ATTR_TITLE = "title"; private static final String ATTR_TYPE = "type"; private static final String ATTR_EDITABLE = "editable"; private static final String ATTR_VALUE = "value"; 198 public org.w3c.dom.Node storeToXML(org.w3c.dom.Document doc) { 199 org.w3c.dom.Element tableEl = doc.createElement(XML_TABLE); 200 201 int colCount = table.getColumnCount(); 202 int rowCount = table.getRowCount(); 203 204 tableEl.setAttribute(ATTR_COLUMN_COUNT, Integer.toString(colCount)); 205 tableEl.setAttribute(ATTR_ROW_COUNT, Integer.toString(rowCount)); 206 207 for (int i=0; i < colCount; i++) { 208 NbTableModel.ColumnItem column = table.getColumnItem(i); 209 org.w3c.dom.Element columnEl = doc.createElement(XML_COLUMN); 210 columnEl.setAttribute(ATTR_TITLE, column.title); 211 columnEl.setAttribute(ATTR_TYPE, column.type.getName()); 212 columnEl.setAttribute(ATTR_EDITABLE, column.editable ? "true":"false"); 214 boolean anyData = false; 215 for (int j=0; j < rowCount; j++) 216 if (column.rows.get(j) != null) { 217 anyData = true; 218 break; 219 } 220 221 if (anyData) 222 for (int j=0; j < rowCount; j++) { 223 org.w3c.dom.Element dataEl = doc.createElement(XML_DATA); 224 dataEl.setAttribute(ATTR_VALUE, valueToString(column.rows.get(j))); 225 columnEl.appendChild(dataEl); 226 } 227 228 tableEl.appendChild(columnEl); 229 } 230 231 return tableEl; 232 } 233 234 public void readFromXML(org.w3c.dom.Node element) throws IOException { 235 if (!XML_TABLE.equals(element.getNodeName())) 236 throw new IOException(getReadingErrorMessage()); 238 org.w3c.dom.NamedNodeMap tableAttr = element.getAttributes(); 239 if (tableAttr == null) 240 return; 241 242 IOException ioex = null; 243 org.w3c.dom.Node node; 244 245 int columnCount = -1; 247 int rowCount = -1; 248 249 node = tableAttr.getNamedItem(ATTR_COLUMN_COUNT); 250 if (node != null) { 251 try { 252 columnCount = Integer.parseInt(node.getNodeValue()); 253 } 254 catch (java.lang.NumberFormatException e) { 255 ioex = new IOException(getReadingErrorMessage()); 256 org.openide.ErrorManager.getDefault().annotate(ioex, e); 257 } 258 } 259 260 node = tableAttr.getNamedItem(ATTR_ROW_COUNT); 261 if (node != null) { 262 try { 263 rowCount = Integer.parseInt(node.getNodeValue()); 264 } 265 catch (java.lang.NumberFormatException e) { 266 if (ioex == null) 267 ioex = new IOException(getReadingErrorMessage()); 268 org.openide.ErrorManager.getDefault().annotate(ioex, e); 269 } 270 } 271 272 if (columnCount < 0 || rowCount < 0) { 273 if (ioex == null) 274 ioex = new IOException(getReadingErrorMessage()); 275 throw ioex; 276 } 277 278 java.util.List columns = new ArrayList(columnCount); 279 280 org.w3c.dom.NodeList columnNodes = element.getChildNodes(); 282 for (int i=0, cCount=columnNodes.getLength(); i < cCount; i++) { 283 org.w3c.dom.Node cNode = columnNodes.item(i); 284 if (!XML_COLUMN.equals(cNode.getNodeName())) 285 continue; 286 287 org.w3c.dom.NamedNodeMap columnAttr = cNode.getAttributes(); 288 if (columnAttr == null) 289 continue; 290 291 String title = null; 293 Class type = null; 294 Boolean editable = null; 295 296 node = columnAttr.getNamedItem(ATTR_TITLE); 297 if (node != null) 298 title = node.getNodeValue(); 299 300 node = columnAttr.getNamedItem(ATTR_TYPE); 301 if (node != null) { 302 try { 303 type = Class.forName(node.getNodeValue()); 304 } 305 catch (Exception e) { 306 ioex = new IOException(getReadingErrorMessage()); 307 org.openide.ErrorManager.getDefault().annotate(ioex, e); 308 } 309 } 310 311 node = columnAttr.getNamedItem(ATTR_EDITABLE); 312 if (node != null) 313 editable = Boolean.valueOf(node.getNodeValue()); 314 315 if (title == null || type == null || editable == null) { 316 if (ioex == null) 317 ioex = new IOException(getReadingErrorMessage()); 318 throw ioex; 319 } 320 321 java.util.List columnData = new ArrayList(rowCount); 322 323 org.w3c.dom.NodeList dataNodes = cNode.getChildNodes(); 325 for (int j=0, dCount=dataNodes.getLength(); j < dCount; j++) { 326 org.w3c.dom.Node dNode = dataNodes.item(j); 327 if (!XML_DATA.equals(dNode.getNodeName())) 328 continue; 329 330 org.w3c.dom.NamedNodeMap dataAttr = dNode.getAttributes(); 331 if (dataAttr == null) 332 continue; 333 334 Object value = null; 336 node = dataAttr.getNamedItem(ATTR_VALUE); 337 if (node != null) { 338 try { 339 value = stringToValue(node.getNodeValue(), type); 340 } 341 catch (IllegalArgumentException e) { 342 ioex = new IOException(getReadingErrorMessage()); 343 org.openide.ErrorManager.getDefault().annotate(ioex, e); 344 throw ioex; 345 } 346 } 347 348 columnData.add(value); 349 } 350 351 if (columnData.size() != rowCount) { 353 if (columnData.size() == 0) 354 for (int ii=0; ii < rowCount; ii++) 355 columnData.add(null); 356 else 357 throw new IOException(getReadingErrorMessage()); 358 } 359 360 columns.add(new NbTableModel.ColumnItem(title, 362 type, 363 editable.booleanValue(), 364 columnData)); 365 } 366 367 if (columns.size() != columnCount) 369 throw new IOException(getReadingErrorMessage()); 370 371 table = new NbTableModel(columns, rowCount); 373 } 374 375 377 private static ResourceBundle getBundle() { 378 return NbBundle.getBundle(TableModelEditor.class); 379 } 380 381 private static String getReadingErrorMessage() { 382 return getBundle().getString("ERR_InvalidXMLFormat"); } 384 385 private static String valueToString(Object value) { 386 if (value instanceof Integer || value instanceof Short 387 || value instanceof Byte || value instanceof Long 388 || value instanceof Float || value instanceof Double 389 || value instanceof Boolean || value instanceof Character ) 390 return value.toString(); 391 392 if (value instanceof String ) 393 return (String )value; 394 395 if (value == null) 396 return "null"; 398 return null; } 400 401 private static Object stringToValue(String encoded, Class type) { 402 if ("null".equals(encoded)) return null; 404 405 if (type == Object .class) 406 return encoded; 407 408 if (Integer .class.isAssignableFrom(type) || Integer.TYPE.equals(type)) 409 return Integer.valueOf(encoded); 410 if (Short .class.isAssignableFrom(type) || Short.TYPE.equals(type)) 411 return Short.valueOf(encoded); 412 if (Byte .class.isAssignableFrom(type) || Byte.TYPE.equals(type)) 413 return Byte.valueOf(encoded); 414 if (Long .class.isAssignableFrom(type) || Long.TYPE.equals(type)) 415 return Long.valueOf(encoded); 416 if (Float .class.isAssignableFrom(type) || Float.TYPE.equals(type)) 417 return Float.valueOf(encoded); 418 if (Double .class.isAssignableFrom(type) || Double.TYPE.equals(type)) 419 return Double.valueOf(encoded); 420 if (Boolean .class.isAssignableFrom(type) || Boolean.TYPE.equals(type)) 421 return Boolean.valueOf(encoded); 422 if (Character .class.isAssignableFrom(type) || Character.TYPE.equals(type)) 423 return new Character (encoded.charAt(0)); 424 if (String .class.isAssignableFrom(type)) 425 return encoded; 426 427 throw new IllegalArgumentException (); 428 } 429 430 static String getAsString (Object o) { 431 if (o == null) return "null"; 433 if (o instanceof String ) 434 return "\"" + o + "\""; 436 String s = o.getClass ().getName (); 437 int g = s.lastIndexOf ('.'); 438 if (g >= 0) s = s.substring (g + 1, s.length ()); 439 440 String cast = ""; if (o instanceof Byte ) 442 cast = "(byte) "; else if (o instanceof Short ) 444 cast = "(short) "; 446 return "new " + s + "(" + cast + o + ")"; } 448 449 static Object getDefaultValue (Class c) { 450 return null; 451 } 452 453 public String getDisplayName() { 455 return NbBundle.getBundle(getClass()).getString("CTL_TableModelEditor_DisplayName"); } 457 458 461 public static class NbTableModel extends AbstractTableModel implements Externalizable { 462 463 static final long serialVersionUID = -6843008677521167210L; 464 465 java.util.List columns; 466 int rowCount; 467 468 transient boolean alwaysEditable = false; 469 470 471 public NbTableModel() { 472 } 473 474 public NbTableModel(String [] titles, Class [] types, boolean[] editable) { 475 this(titles,types,editable,4); 476 } 477 478 public NbTableModel(String [] titles, Class [] types, boolean[] editable, int rowCount) { 479 this.rowCount = rowCount; 480 columns = new ArrayList(titles.length); 481 for (int i=0; i < titles.length; i++) 482 columns.add(new ColumnItem(titles[i],types[i],editable[i],rowCount)); 483 } 484 485 public NbTableModel(TableModel createFrom) { 486 ResourceBundle bundle = getBundle(); 487 if (createFrom == null) { 488 rowCount = 4; columns = new ArrayList(20); 490 for (int i=0; i < 4; i++) 491 columns.add(new ColumnItem(bundle.getString("CTL_Title")+" "+Integer.toString(i+1), 492 Object .class, true, rowCount)); 493 } else { 494 rowCount = createFrom.getRowCount(); 495 int colCount = createFrom.getColumnCount(); 496 columns = new ArrayList(colCount); 497 498 if (createFrom instanceof NbTableModel) { 499 NbTableModel model = (NbTableModel) createFrom; 500 501 for (int i=0; i < colCount; i++) { 502 ColumnItem ci = (ColumnItem) model.columns.get(i); 503 columns.add(new ColumnItem(ci)); 504 } 505 } else { 506 for (int i=0; i < colCount; i++) { 507 ColumnItem ci = new ColumnItem(createFrom.getColumnName(i), 508 createFrom.getColumnClass(i), 509 true, rowCount); 510 for (int j=0; j < rowCount; j++) 511 ci.rows.set(j, createFrom.getValueAt(j,i)); 512 columns.add(ci); 513 } 514 } 515 } 516 } 517 518 NbTableModel(java.util.List columns, int rowCount) { 519 this.columns = columns; 520 this.rowCount = rowCount; 521 } 522 523 public Class getColumnClass(int i) { 525 ColumnItem ci = (ColumnItem) columns.get(i); 526 return ci.type; 527 } 528 529 public void setColumnClass(int i, Class type) { 530 ColumnItem ci = (ColumnItem) columns.get(i); 531 ci.type = type; 532 } 533 534 public String getColumnName(int i) { 536 ColumnItem ci = (ColumnItem) columns.get(i); 537 return ci.title; 538 } 539 540 public void setColumnName(int i, String title) { 541 ColumnItem ci = (ColumnItem) columns.get(i); 542 ci.title = title; 543 } 544 545 public int getRowCount() { 547 return rowCount; 548 } 549 550 public int getColumnCount() { 552 return columns.size(); 553 } 554 555 public boolean isColumnEditable(int i) { 556 ColumnItem ci = (ColumnItem) columns.get(i); 558 return ci.editable; 559 } 560 561 public boolean isCellEditable(int i, int j) { 563 if (alwaysEditable) return true; 566 ColumnItem ci = (ColumnItem) columns.get(j); 567 return ci.editable; 568 } 569 570 public void setColumnEditable(int i, boolean editable) { 571 ColumnItem ci = (ColumnItem) columns.get(i); 572 ci.editable = editable; 573 } 574 575 public Object getValueAt(int row, int column) { 577 ColumnItem ci = (ColumnItem) columns.get(column); 578 return ci.rows.get(row); 579 } 580 581 public void setValueAt(Object obj, int row, int column) { 583 ColumnItem ci = (ColumnItem) columns.get(column); 584 ci.rows.set(row, obj); 585 fireTableCellUpdated(row, column); 586 } 587 588 private ColumnItem getColumnItem(int i) { 589 return (ColumnItem) columns.get(i); 590 } 591 592 void setRowCount(int newRowCount) { 593 if (newRowCount == rowCount) return; 594 595 for (int i=0, n=columns.size(); i < n; i++) { 596 java.util.List rows = ((ColumnItem)columns.get(i)).rows; 597 if (newRowCount > rowCount) { 598 for (int nr = newRowCount-rowCount; nr > 0; nr--) 599 rows.add(null); 600 } 601 else { for (int rn = rowCount - newRowCount; rn > 0; rn--) 603 rows.remove(newRowCount + rn - 1); 604 } 605 } 606 607 int rc = rowCount; 608 rowCount = newRowCount; 609 610 if (newRowCount > rc) 611 fireTableRowsInserted(rc, newRowCount - 1); 612 else fireTableRowsDeleted(newRowCount, rc - 1); 614 } 615 616 void addRow(int index) { 618 if (index >= 0 && index <= rowCount) { 619 for (int i=0, n=columns.size(); i < n; i++) 620 ((ColumnItem)columns.get(i)).rows.add(index, null); 621 622 rowCount++; 623 fireTableRowsInserted(index, index); 624 } 625 } 626 627 void removeRow(int index) { 629 if (index >= 0 && index < rowCount) { 630 for (int i=0, n=columns.size(); i < n; i++) 631 ((ColumnItem)columns.get(i)).rows.remove(index); 632 633 rowCount--; 634 fireTableRowsDeleted(index, index); 635 } 636 } 637 638 void moveRow(int fromIndex, int toIndex) { 639 if (columns.size() > 0 640 && fromIndex >= 0 && fromIndex < rowCount 641 && toIndex >= 0 && toIndex < rowCount 642 && fromIndex != toIndex) { 643 644 for (int i=0, n=columns.size(); i < n; i++) { 645 java.util.List rows = ((ColumnItem)columns.get(i)).rows; 646 Object obj = rows.get(toIndex); 647 rows.set(toIndex, rows.get(fromIndex)); 648 rows.set(fromIndex, obj); 649 } 650 fireTableStructureChanged(); 651 } 652 } 653 654 void setColumnCount(int newColumnCount) { 655 ResourceBundle bundle = getBundle(); 656 int colCount = columns.size(); 657 if (newColumnCount == colCount) return; 658 659 if (newColumnCount > colCount) { 660 for (int nc=newColumnCount-colCount; nc > 0; nc--) 661 columns.add(new ColumnItem(bundle.getString("CTL_Title")+" "+Integer.toString(newColumnCount-nc+1), 662 Object .class, true, rowCount)); 663 } else { for (int cn=colCount-newColumnCount; cn > 0; cn--) 665 columns.remove(newColumnCount + cn - 1); 666 } 667 668 fireTableStructureChanged(); 669 } 670 671 void addColumn(int index) { 673 if (index >=0 && index <= columns.size()) { 674 columns.add(index, new ColumnItem(getBundle().getString("CTL_Title")+" "+Integer.toString(index+1), 675 Object .class, true, rowCount)); 676 for (int i=index+1, n=columns.size(); i < n; i++) { 678 ColumnItem ci = (ColumnItem) columns.get(i); 679 renameDefaultColumnTitle(ci, i, i+1); 680 } 681 fireTableStructureChanged(); 682 } 683 } 684 685 void removeColumn(int index) { 687 if (index >=0 && index < columns.size()) { 688 columns.remove(index); 689 690 for (int i=index, n=columns.size(); i < n; i++) { 692 ColumnItem ci = (ColumnItem) columns.get(i); 693 renameDefaultColumnTitle(ci, i+2, i+1); 694 } 695 fireTableStructureChanged(); 696 } 697 } 698 699 void moveColumn(int fromIndex,int toIndex) { 700 if (fromIndex >= 0 && fromIndex < columns.size() 701 && toIndex >= 0 && toIndex < columns.size() 702 && fromIndex != toIndex) { 703 704 ColumnItem ciFrom = (ColumnItem) columns.get(fromIndex); 705 ColumnItem ciTo = (ColumnItem) columns.get(toIndex); 706 707 renameDefaultColumnTitle(ciFrom, fromIndex+1, toIndex+1); 709 renameDefaultColumnTitle(ciTo, toIndex+1, fromIndex+1); 710 711 columns.set(toIndex, ciFrom); 712 columns.set(fromIndex, ciTo); 713 fireTableStructureChanged(); 714 } 715 } 716 717 private static void renameDefaultColumnTitle(ColumnItem ci, int fromIndex, int toIndex) { 720 String fromStr = getBundle().getString("CTL_Title")+" "+Integer.toString(fromIndex); 721 if (fromStr.equals(ci.title)) 722 ci.title = getBundle().getString("CTL_Title")+" "+Integer.toString(toIndex); 723 } 724 725 public void writeExternal(ObjectOutput oo) throws IOException { 726 oo.writeInt(rowCount); 728 int colCount = columns.size(); 729 oo.writeInt(colCount); 730 731 String [] titles = new String [colCount]; 732 boolean[] editable = new boolean[colCount]; 733 for (int i=0; i < colCount; i++) { 734 ColumnItem ci = (ColumnItem) columns.get(i); 735 titles[i] = ci.title; 736 editable[i] = ci.editable; 737 } 738 oo.writeObject(titles); 739 oo.writeObject(editable); 740 for (int i=0; i < colCount; i++) { 741 ColumnItem ci = (ColumnItem) columns.get(i); 742 oo.writeObject(ci.type.getName()); 743 } 744 745 for (int i=0; i < rowCount; i++) 746 for (int j=0; j < colCount; j++) { 747 ColumnItem ci = (ColumnItem) columns.get(j); 748 if (ci.rows.get(i) instanceof Serializable) 749 oo.writeObject(ci.rows.get(i)); 750 else 751 oo.writeObject(null); 752 } 753 } 754 755 public void readExternal(ObjectInput oi) throws IOException, ClassNotFoundException { 756 rowCount = oi.readInt(); 758 int colCount = oi.readInt(); 759 760 columns = new ArrayList(colCount); 761 762 String [] titles = (String []) oi.readObject(); 763 boolean[] editable = (boolean[]) oi.readObject(); 764 765 for (int i=0; i < colCount; i++) 766 columns.add(new ColumnItem(titles[i],Class.forName((String )oi.readObject()), 767 editable[i], rowCount)); 768 769 for (int i=0; i < rowCount; i++) 770 for (int j=0; j < colCount; j++) { 771 ColumnItem ci = (ColumnItem) columns.get(j); 772 ci.rows.set(i, oi.readObject()); 773 } 774 } 775 776 private static class ColumnItem { 778 String title; 779 Class type; 780 boolean editable; 781 java.util.List rows; 783 ColumnItem(String title, Class type, boolean editable, int rowCount) { 784 this.title = title; 785 this.type = type; 786 this.editable = editable; 787 rows = new ArrayList(rowCount); 788 for (int i=0; i < rowCount; i++) 789 rows.add(null); 790 } 791 792 ColumnItem(String title, Class type, boolean editable, java.util.List data) { 793 this.title = title; 794 this.type = type; 795 this.editable = editable; 796 rows = data; 797 } 798 799 ColumnItem(ColumnItem ci) { 800 this.title = ci.title; 801 this.type = ci.type; 802 this.editable = ci.editable; 803 int rowCount = ci.rows.size(); 804 rows = new ArrayList(rowCount); 805 806 for (int i=0; i < rowCount; i++) 807 rows.add(ci.rows.get(i)); 808 } 809 } } 812 815 private NbTableModel table; 816 private PropertyChangeSupport support; 817 } 818 | Popular Tags |