1 /*
   2  * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 package org.netbeans.jemmy.operators;
  24 
  25 import java.awt.Color;
  26 import java.awt.Component;
  27 import java.awt.Container;
  28 import java.awt.Dimension;
  29 import java.awt.Point;
  30 import java.awt.Rectangle;
  31 import java.util.EventObject;
  32 import java.util.Hashtable;
  33 
  34 import javax.swing.JPopupMenu;
  35 import javax.swing.JScrollPane;
  36 import javax.swing.JTable;
  37 import javax.swing.ListSelectionModel;
  38 import javax.swing.event.ChangeEvent;
  39 import javax.swing.event.ListSelectionEvent;
  40 import javax.swing.event.TableColumnModelEvent;
  41 import javax.swing.event.TableModelEvent;
  42 import javax.swing.plaf.TableUI;
  43 import javax.swing.table.JTableHeader;
  44 import javax.swing.table.TableCellEditor;
  45 import javax.swing.table.TableCellRenderer;
  46 import javax.swing.table.TableColumn;
  47 import javax.swing.table.TableColumnModel;
  48 import javax.swing.table.TableModel;
  49 
  50 import org.netbeans.jemmy.ComponentChooser;
  51 import org.netbeans.jemmy.ComponentSearcher;
  52 import org.netbeans.jemmy.JemmyException;
  53 import org.netbeans.jemmy.Outputable;
  54 import org.netbeans.jemmy.QueueTool;
  55 import org.netbeans.jemmy.TestOut;
  56 import org.netbeans.jemmy.TimeoutExpiredException;
  57 import org.netbeans.jemmy.Timeoutable;
  58 import org.netbeans.jemmy.Timeouts;
  59 import org.netbeans.jemmy.Waiter;
  60 import org.netbeans.jemmy.drivers.DriverManager;
  61 import org.netbeans.jemmy.drivers.TableDriver;
  62 import org.netbeans.jemmy.util.EmptyVisualizer;
  63 
  64 /**
  65  * <BR><BR>Timeouts used: <BR>
  66  * JTableOperator.WaitEditingTimeout - time to wait cell editing<BR>
  67  * ComponentOperator.WaitComponentTimeout - time to wait component displayed
  68  * <BR>
  69  * ComponentOperator.WaitStateTimeout - time to wait for cell contents <BR>
  70  * JTextComponentOperator.ChangeCaretPositionTimeout - maximum time to chenge
  71  * caret position <BR>
  72  * JTextComponentOperator.TypeTextTimeout - maximum time to type text <BR>
  73  * JScrollBarOperator.WholeScrollTimeout - time for the whole scrolling <BR>.
  74  *
  75  * @see Timeouts
  76  *
  77  * @author Alexandre Iline (alexandre.iline@oracle.com)
  78  *
  79  */
  80 public class JTableOperator extends JComponentOperator
  81         implements Outputable, Timeoutable {
  82 
  83     /**
  84      * Identifier for a "cell" property.
  85      *
  86      * @see #getDump
  87      */
  88     public static final String CELL_PREFIX_DPROP = "Cell";
  89 
  90     /**
  91      * Identifier for a "column" property.
  92      *
  93      * @see #getDump
  94      */
  95     public static final String COLUMN_PREFIX_DPROP = "Column";
  96 
  97     /**
  98      * Identifier for a "selected column" property.
  99      *
 100      * @see #getDump
 101      */
 102     public static final String SELECTED_COLUMN_PREFIX_DPROP = "SelectedColumn";
 103 
 104     /**
 105      * Identifier for a "selected row" property.
 106      *
 107      * @see #getDump
 108      */
 109     public static final String SELECTED_ROW_PREFIX_DPROP = "SelectedRow";
 110 
 111     /**
 112      * Identifier for a "column count" property.
 113      *
 114      * @see #getDump
 115      */
 116     public static final String COLUMN_COUNT_DPROP = "Column count";
 117 
 118     /**
 119      * Identifier for a "row count" property.
 120      *
 121      * @see #getDump
 122      */
 123     public static final String ROW_COUNT_DPROP = "Row count";
 124 
 125     private final static long WAIT_EDITING_TIMEOUT = 60000;
 126 
 127     private TestOut output;
 128     private Timeouts timeouts;
 129 
 130     TableDriver driver;
 131 
 132     /**
 133      * Constructor.
 134      *
 135      * @param b a component
 136      */
 137     public JTableOperator(JTable b) {
 138         super(b);
 139         driver = DriverManager.getTableDriver(getClass());
 140     }
 141 
 142     /**
 143      * Constructs a JTableOperator object.
 144      *
 145      * @param cont a container
 146      * @param chooser a component chooser specifying searching criteria.
 147      * @param index an index between appropriate ones.
 148      */
 149     public JTableOperator(ContainerOperator<?> cont, ComponentChooser chooser, int index) {
 150         this((JTable) cont.
 151                 waitSubComponent(new JTableFinder(chooser),
 152                         index));
 153         copyEnvironment(cont);
 154     }
 155 
 156     /**
 157      * Constructs a JTableOperator object.
 158      *
 159      * @param cont a container
 160      * @param chooser a component chooser specifying searching criteria.
 161      */
 162     public JTableOperator(ContainerOperator<?> cont, ComponentChooser chooser) {
 163         this(cont, chooser, 0);
 164     }
 165 
 166     /**
 167      * Constructor. Waits by cell text first. Uses cont's timeout and output for
 168      * waiting and to init operator.
 169      *
 170      * @param cont a container
 171      * @param text Text of a cell which is currently selected.
 172      * @param row a cell row to check.
 173      * @param column a cell row to check.
 174      * @param index Ordinal component index.
 175      * @see ComponentOperator#isCaptionEqual(String, String, boolean, boolean)
 176      * @throws TimeoutExpiredException
 177      */
 178     public JTableOperator(ContainerOperator<?> cont, String text, int row, int column, int index) {
 179         this((JTable) waitComponent(cont,
 180                 new JTableByCellFinder(text, row, column,
 181                         cont.getComparator()),
 182                 index));
 183         copyEnvironment(cont);
 184     }
 185 
 186     /**
 187      * Constructor. Waits by cell text first. Uses cont's timeout and output for
 188      * waiting and to init operator.
 189      *
 190      * @param cont a container
 191      * @param text Text of a cell which is currently selected.
 192      * @param row a cell row to check.
 193      * @param column a cell row to check.
 194      * @see ComponentOperator#isCaptionEqual(String, String, boolean, boolean)
 195      * @throws TimeoutExpiredException
 196      */
 197     public JTableOperator(ContainerOperator<?> cont, String text, int row, int column) {
 198         this(cont, text, row, column, 0);
 199     }
 200 
 201     /**
 202      * Constructor. Waits by text in selected cell first. Uses cont's timeout
 203      * and output for waiting and to init operator.
 204      *
 205      * @param cont a container
 206      * @param text Text of a cell which is currently selected.
 207      * @param index Ordinal component index.
 208      * @see ComponentOperator#isCaptionEqual(String, String, boolean, boolean)
 209      * @throws TimeoutExpiredException
 210      */
 211     public JTableOperator(ContainerOperator<?> cont, String text, int index) {
 212         this(cont, text, -1, -1, index);
 213     }
 214 
 215     /**
 216      * Constructor. Waits component in container first. Uses cont's timeout and
 217      * output for waiting and to init operator.
 218      *
 219      * @param cont a container
 220      * @param text Text of a cell which is currently selected.
 221      * @see ComponentOperator#isCaptionEqual(String, String, boolean, boolean)
 222      * @throws TimeoutExpiredException
 223      */
 224     public JTableOperator(ContainerOperator<?> cont, String text) {
 225         this(cont, text, 0);
 226     }
 227 
 228     /**
 229      * Constructor. Waits component in container first. Uses cont's timeout and
 230      * output for waiting and to init operator.
 231      *
 232      * @param cont a container
 233      * @param index Ordinal component index.
 234      * @throws TimeoutExpiredException
 235      */
 236     public JTableOperator(ContainerOperator<?> cont, int index) {
 237         this((JTable) waitComponent(cont,
 238                 new JTableFinder(),
 239                 index));
 240         copyEnvironment(cont);
 241     }
 242 
 243     /**
 244      * Constructor. Waits component in container first. Uses cont's timeout and
 245      * output for waiting and to init operator.
 246      *
 247      * @param cont a container
 248      * @throws TimeoutExpiredException
 249      */
 250     public JTableOperator(ContainerOperator<?> cont) {
 251         this(cont, 0);
 252     }
 253 
 254     ////////////////////////////////////////////////////////
 255     //Static finds                                        //
 256     ////////////////////////////////////////////////////////
 257     /**
 258      * Searches JTable in container.
 259      *
 260      * @param cont Container to search component in.
 261      * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
 262      * @param index Ordinal component index.
 263      * @return JTable instance or null if component was not found.
 264      */
 265     public static JTable findJTable(Container cont, ComponentChooser chooser, int index) {
 266         return (JTable) findComponent(cont, new JTableFinder(chooser), index);
 267     }
 268 
 269     /**
 270      * Searches 0'th JTable in container.
 271      *
 272      * @param cont Container to search component in.
 273      * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
 274      * @return JTable instance or null if component was not found.
 275      */
 276     public static JTable findJTable(Container cont, ComponentChooser chooser) {
 277         return findJTable(cont, chooser, 0);
 278     }
 279 
 280     /**
 281      * Searches JTable by cell.
 282      *
 283      * @param cont Container to search component in.
 284      * @param text Item text. If null, contents is not checked.
 285      * @param ce Compare text exactly.
 286      * @param ccs Compare text case sensitively.
 287      * @param row Index of row to compare text. If -1, selected row is checked.
 288      * @param column Index of column to compare text. If -1, selected column is
 289      * checked.
 290      * @param index Ordinal component index.
 291      * @return JTable instance or null if component was not found.
 292      * @see ComponentOperator#isCaptionEqual(String, String, boolean, boolean)
 293      */
 294     public static JTable findJTable(Container cont, String text, boolean ce, boolean ccs, int row, int column, int index) {
 295         return findJTable(cont, new JTableByCellFinder(text, row, column, new DefaultStringComparator(ce, ccs)), index);
 296     }
 297 
 298     /**
 299      * Searches JTable by cell.
 300      *
 301      * @param cont Container to search component in.
 302      * @param text Item text. If null, contents is not checked.
 303      * @param ce Compare text exactly.
 304      * @param ccs Compare text case sensitively.
 305      * @param row Index of row to compare text. If -1, selected row is checked.
 306      * @param column Index of column to compare text. If -1, selected column is
 307      * checked.
 308      * @return JTable instance or null if component was not found.
 309      * @see ComponentOperator#isCaptionEqual(String, String, boolean, boolean)
 310      */
 311     public static JTable findJTable(Container cont, String text, boolean ce, boolean ccs, int row, int column) {
 312         return findJTable(cont, text, ce, ccs, row, column, 0);
 313     }
 314 
 315     /**
 316      * Waits JTable in container.
 317      *
 318      * @param cont Container to search component in.
 319      * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
 320      * @param index Ordinal component index.
 321      * @return JTable instance or null if component was not found.
 322      * @throws TimeoutExpiredException
 323      */
 324     public static JTable waitJTable(Container cont, ComponentChooser chooser, int index) {
 325         return (JTable) waitComponent(cont, new JTableFinder(chooser), index);
 326     }
 327 
 328     /**
 329      * Waits 0'th JTable in container.
 330      *
 331      * @param cont Container to search component in.
 332      * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
 333      * @return JTable instance or null if component was not found.
 334      * @throws TimeoutExpiredException
 335      */
 336     public static JTable waitJTable(Container cont, ComponentChooser chooser) {
 337         return waitJTable(cont, chooser, 0);
 338     }
 339 
 340     /**
 341      * Waits JTable by cell.
 342      *
 343      * @param cont Container to search component in.
 344      * @param text Item text. If null, contents is not checked.
 345      * @param ce Compare text exactly.
 346      * @param ccs Compare text case sensitively.
 347      * @param row Index of row to compare text. If -1, selected row is checked.
 348      * @param column Index of column to compare text. If -1, selected column is
 349      * checked.
 350      * @param index Ordinal component index.
 351      * @return JTable instance or null if component was not found.
 352      * @see ComponentOperator#isCaptionEqual(String, String, boolean, boolean)
 353      * @throws TimeoutExpiredException
 354      */
 355     public static JTable waitJTable(Container cont, String text, boolean ce, boolean ccs, int row, int column, int index) {
 356         return waitJTable(cont, new JTableByCellFinder(text, row, column, new DefaultStringComparator(ce, ccs)), index);
 357     }
 358 
 359     /**
 360      * Waits JTable by cell.
 361      *
 362      * @param cont Container to search component in.
 363      * @param text Item text. If null, contents is not checked.
 364      * @param ce Compare text exactly.
 365      * @param ccs Compare text case sensitively.
 366      * @param row Index of row to compare text. If -1, selected row is checked.
 367      * @param column Index of column to compare text. If -1, selected column is
 368      * checked.
 369      * @return JTable instance or null if component was not found.
 370      * @see ComponentOperator#isCaptionEqual(String, String, boolean, boolean)
 371      * @throws TimeoutExpiredException
 372      */
 373     public static JTable waitJTable(Container cont, String text, boolean ce, boolean ccs, int row, int column) {
 374         return waitJTable(cont, text, ce, ccs, row, column, 0);
 375     }
 376 
 377     static {
 378         Timeouts.initDefault("JTableOperator.WaitEditingTimeout", WAIT_EDITING_TIMEOUT);
 379     }
 380 
 381     ////////////////////////////////////////////////////////
 382     //Environment                                         //
 383     ////////////////////////////////////////////////////////
 384     @Override
 385     public void setTimeouts(Timeouts times) {
 386         this.timeouts = times;
 387         super.setTimeouts(timeouts);
 388     }
 389 
 390     @Override
 391     public Timeouts getTimeouts() {
 392         return timeouts;
 393     }
 394 
 395     @Override
 396     public void setOutput(TestOut out) {
 397         output = out;
 398         super.setOutput(output);
 399     }
 400 
 401     @Override
 402     public TestOut getOutput() {
 403         return output;
 404     }
 405 
 406     @Override
 407     public void copyEnvironment(Operator anotherOperator) {
 408         super.copyEnvironment(anotherOperator);
 409         driver
 410                 = (TableDriver) DriverManager.
 411                 getDriver(DriverManager.TABLE_DRIVER_ID,
 412                         getClass(),
 413                         anotherOperator.getProperties());
 414     }
 415 
 416     ////////////////////////////////////////////////////////
 417     //Find methods                                        //
 418     ////////////////////////////////////////////////////////
 419     //text, comparator and index
 420     /**
 421      * Searches cell coordinates.
 422      *
 423      * @param text a text pattern
 424      * @param comparator a string comparision algorithm
 425      * @param index an ordinal cell index
 426      * @return Point indicating coordinates (x - column, y - row)
 427      */
 428     public Point findCell(String text, StringComparator comparator, int index) {
 429         return (findCell(new BySubStringTableCellChooser(text,
 430                 comparator),
 431                 index));
 432     }
 433 
 434     /**
 435      * Searches cell coordinates in the specified rows and columns.
 436      *
 437      * @param text a text pattern
 438      * @param comparator a string comparision algorithm
 439      * @param rows rows to search in
 440      * @param columns columns to search in
 441      * @param index an ordinal cell index
 442      * @return Point indicating coordinates (x - column, y - row)
 443      */
 444     public Point findCell(String text, StringComparator comparator, int[] rows, int[] columns, int index) {
 445         return findCell(new BySubStringTableCellChooser(text, comparator), rows, columns, index);
 446     }
 447 
 448     /**
 449      * Searches cell row index.
 450      *
 451      * @param text a text pattern
 452      * @param comparator a string comparision algorithm
 453      * @param index an ordinal cell index
 454      * @return a row index.
 455      */
 456     public int findCellRow(String text, StringComparator comparator, int index) {
 457         return findCell(text, comparator, index).y;
 458     }
 459 
 460     /**
 461      * Searches cell row index. Searching is performed between cells in one
 462      * column.
 463      *
 464      * @param text a text pattern
 465      * @param comparator a string comparision algorithm
 466      * @param column a column index to search in
 467      * @param index an ordinal cell index
 468      * @return a row index.
 469      */
 470     public int findCellRow(String text, StringComparator comparator, int column, int index) {
 471         return findCell(text, comparator, null, new int[]{column}, index).y;
 472     }
 473 
 474     /**
 475      * Searches cell column visible index.
 476      *
 477      * @param text a text pattern
 478      * @param comparator a string comparision algorithm
 479      * @param index an ordinal cell index
 480      * @return a column index.
 481      */
 482     public int findCellColumn(String text, StringComparator comparator, int index) {
 483         return findCell(text, comparator, index).x;
 484     }
 485 
 486     /**
 487      * Searches cell column index. Searching is performed between cells in one
 488      * row.
 489      *
 490      * @param text a text pattern
 491      * @param comparator a string comparision algorithm
 492      * @param row a row index to search in
 493      * @param index an ordinal cell index
 494      * @return a column index.
 495      */
 496     public int findCellColumn(String text, StringComparator comparator, int row, int index) {
 497         return findCell(text, comparator, new int[]{row}, null, index).x;
 498     }
 499 
 500     //booleans - deprecated
 501     /**
 502      * Searches cell row by cell text.
 503      *
 504      * @param text Text to search by.
 505      * @param ce Compare exactly.
 506      * @param ccs Compare case sensitively.
 507      * @param index Ordinal index in suitable cells.
 508      * @return a row index.
 509      * @see #findCellRow(String, int)
 510      * @deprecated Use findCellRow(String, int) or findCellRow(String,
 511      * StringComparator, int)
 512      */
 513     @Deprecated
 514     public int findCellRow(String text, boolean ce, boolean ccs, int index) {
 515         return findCell(text, ce, ccs, index).y;
 516     }
 517 
 518     /**
 519      * Searches cell column by cell text.
 520      *
 521      * @param text Text to search by.
 522      * @param ce Compare exactly.
 523      * @param ccs Compare case sensitively.
 524      * @param index Ordinal index in suitable cells.
 525      * @return a column index.
 526      * @see #findCellColumn(String, int)
 527      * @deprecated Use findCellColumn(String, int) or findCellColumn(String,
 528      * StringComparator, int)
 529      */
 530     @Deprecated
 531     public int findCellColumn(String text, boolean ce, boolean ccs, int index) {
 532         return findCell(text, ce, ccs, index).x;
 533     }
 534 
 535     /**
 536      * Searches first cell row by cell text.
 537      *
 538      * @param text Text to search by.
 539      * @param ce Compare exactly.
 540      * @param ccs Compare case sensitively.
 541      * @return a row index.
 542      * @see #findCellRow(String)
 543      * @deprecated Use findCellRow(String) or findCellRow(String,
 544      * StringComparator)
 545      */
 546     @Deprecated
 547     public int findCellRow(String text, boolean ce, boolean ccs) {
 548         return findCellRow(text, ce, ccs, 0);
 549     }
 550 
 551     /**
 552      * Searches first cell column by cell text.
 553      *
 554      * @param text Text to search by.
 555      * @param ce Compare exactly.
 556      * @param ccs Compare case sensitively.
 557      * @return a column index.
 558      * @see #findCellColumn(String)
 559      * @deprecated Use findCellColumn(String) or findCellColumn(String,
 560      * StringComparator)
 561      */
 562     @Deprecated
 563     public int findCellColumn(String text, boolean ce, boolean ccs) {
 564         return findCellColumn(text, ce, ccs, 0);
 565     }
 566 
 567     //text and comparator only
 568     /**
 569      * Searches cell row index.
 570      *
 571      * @param text a text pattern
 572      * @param comparator a string comparision algorithm
 573      * @return a row index.
 574      */
 575     public int findCellRow(String text, StringComparator comparator) {
 576         return findCellRow(text, comparator, 0);
 577     }
 578 
 579     /**
 580      * Searches cell column visible index.
 581      *
 582      * @param text a text pattern
 583      * @param comparator a string comparision algorithm
 584      * @return a column index.
 585      */
 586     public int findCellColumn(String text, StringComparator comparator) {
 587         return findCellColumn(text, comparator, 0);
 588     }
 589 
 590     //text and index
 591     /**
 592      * Searches cell row by cell text.
 593      *
 594      * @param text Text to search by.
 595      * @param index Ordinal index in suitable cells.
 596      * @return a row index.
 597      */
 598     public int findCellRow(String text, int index) {
 599         return findCell(text, index).y;
 600     }
 601 
 602     /**
 603      * Searches cell row index. Searching is performed between cells in one
 604      * column.
 605      *
 606      * @param text a text pattern
 607      * @param column a column index to search in
 608      * @param index Ordinal index in suitable cells.
 609      * @return a row index.
 610      */
 611     public int findCellRow(String text, int column, int index) {
 612         return findCell(text, null, new int[]{column}, index).y;
 613     }
 614 
 615     /**
 616      * Searches cell column by cell text.
 617      *
 618      * @param text Text to search by.
 619      * @param index Ordinal index in suitable cells.
 620      * @return a column index.
 621      */
 622     public int findCellColumn(String text, int index) {
 623         return findCell(text, index).x;
 624     }
 625 
 626     /**
 627      * Searches cell column index. Searching is performed between cells in one
 628      * row.
 629      *
 630      * @param text a text pattern
 631      * @param row a row index to search in
 632      * @param index Ordinal index in suitable cells.
 633      * @return a column index.
 634      */
 635     public int findCellColumn(String text, int row, int index) {
 636         return findCell(text, new int[]{row}, null, index).x;
 637     }
 638 
 639     /**
 640      * Searches cell coordinates.
 641      *
 642      * @param text a text pattern
 643      * @param index an ordinal cell index
 644      * @return Point indicating coordinates (x - column, y - row)
 645      */
 646     public Point findCell(String text, int index) {
 647         return findCell(text, getComparator(), index);
 648     }
 649 
 650     /**
 651      * Searches cell coordinates in the specified rows and columns.
 652      *
 653      * @param text a text pattern
 654      * @param rows rows to search in
 655      * @param columns columns to search in
 656      * @param index an ordinal cell index
 657      * @return Point indicating coordinates (x - column, y - row)
 658      */
 659     public Point findCell(String text, int[] rows, int[] columns, int index) {
 660         return findCell(new BySubStringTableCellChooser(text, getComparator()), rows, columns, index);
 661     }
 662 
 663     //text only
 664     /**
 665      * Searches first cell row by cell text.
 666      *
 667      * @param text Text to search by.
 668      * @return a row index.
 669      */
 670     public int findCellRow(String text) {
 671         return findCellRow(text, 0);
 672     }
 673 
 674     /**
 675      * Searches first cell column by cell text.
 676      *
 677      * @param text Text to search by.
 678      * @return a column index.
 679      */
 680     public int findCellColumn(String text) {
 681         return findCellColumn(text, 0);
 682     }
 683 
 684     //component chooser and index
 685     /**
 686      * Searches cell row by rendered component.
 687      *
 688      * @param chooser Component verifying object.
 689      * @param index Ordinal index in suitable cells.
 690      * @return a row index.
 691      */
 692     public int findCellRow(ComponentChooser chooser, int index) {
 693         return findCell(chooser, index).y;
 694     }
 695 
 696     /**
 697      * Searches cell row index. Searching is performed between cells in one
 698      * column.
 699      *
 700      * @param chooser Component verifying object.
 701      * @param column a column index to search in
 702      * @param index Ordinal index in suitable cells.
 703      * @return a row index.
 704      */
 705     public int findCellRow(ComponentChooser chooser, int column, int index) {
 706         return findCell(chooser, null, new int[]{column}, index).y;
 707     }
 708 
 709     /**
 710      * Searches cell column by rendered component.
 711      *
 712      * @param chooser Component verifying object.
 713      * @param index Ordinal index in suitable cells.
 714      * @return a column index.
 715      */
 716     public int findCellColumn(ComponentChooser chooser, int index) {
 717         return findCell(chooser, index).x;
 718     }
 719 
 720     /**
 721      * Searches cell column index. Searching is performed between cells in one
 722      * row.
 723      *
 724      * @param chooser Component verifying object.
 725      * @param row a row index to search in
 726      * @param index Ordinal index in suitable cells.
 727      * @return a column index.
 728      */
 729     public int findCellColumn(ComponentChooser chooser, int row, int index) {
 730         return findCell(chooser, new int[]{row}, null, index).x;
 731     }
 732 
 733     /**
 734      * Searches cell coordinates.
 735      *
 736      * @param chooser Component verifying object.
 737      * @param index an ordinal cell index
 738      * @return Point indicating coordinates (x - column, y - row)
 739      */
 740     public Point findCell(ComponentChooser chooser, int index) {
 741         return findCell(new ByRenderedComponentTableCellChooser(chooser), index);
 742     }
 743 
 744     /**
 745      * Searches cell coordinates.
 746      *
 747      * @param chooser Component verifying object.
 748      * @param rows rows to search in
 749      * @param columns columns to search in
 750      * @param index an ordinal cell index
 751      * @return Point indicating coordinates (x - column, y - row)
 752      */
 753     public Point findCell(ComponentChooser chooser, int[] rows, int[] columns, int index) {
 754         return findCell(new ByRenderedComponentTableCellChooser(chooser), rows, columns, index);
 755     }
 756 
 757     //component chooser only
 758     /**
 759      * Searches cell row by rendered component.
 760      *
 761      * @param chooser Component verifying object.
 762      * @return a row index.
 763      */
 764     public int findCellRow(ComponentChooser chooser) {
 765         return findCellRow(chooser, 0);
 766     }
 767 
 768     /**
 769      * Searches cell column by rendered component.
 770      *
 771      * @param chooser Component verifying object.
 772      * @return a column index.
 773      */
 774     public int findCellColumn(ComponentChooser chooser) {
 775         return findCellColumn(chooser, 0);
 776     }
 777 
 778     /**
 779      * Searches cell coordinates.
 780      *
 781      * @param chooser Component verifying object.
 782      * @return Point indicating coordinates (x - column, y - row)
 783      */
 784     public Point findCell(ComponentChooser chooser) {
 785         return findCell(chooser, 0);
 786     }
 787 
 788     //cell chooser and index
 789     /**
 790      * Searches cell row by TableCellChooser.
 791      *
 792      * @param chooser Cell verifying object.
 793      * @param index Ordinal index in suitable cells.
 794      * @return a row index.
 795      */
 796     public int findCellRow(TableCellChooser chooser, int index) {
 797         return findCell(chooser, index).y;
 798     }
 799 
 800     /**
 801      * Searches cell row index. Searching is performed between cells in one
 802      * column.
 803      *
 804      * @param chooser Cell verifying object.
 805      * @param column a column index to search in
 806      * @param index Ordinal index in suitable cells.
 807      * @return a row index.
 808      */
 809     public int findCellRow(TableCellChooser chooser, int column, int index) {
 810         return findCell(chooser, null, new int[]{column}, index).y;
 811     }
 812 
 813     /**
 814      * Searches cell column by TableCellChooser.
 815      *
 816      * @param chooser ComponentCell verifying object.
 817      * @param index Ordinal index in suitable cells.
 818      * @return a column index.
 819      */
 820     public int findCellColumn(TableCellChooser chooser, int index) {
 821         return findCell(chooser, index).x;
 822     }
 823 
 824     /**
 825      * Searches cell column index. Searching is performed between cells in one
 826      * row.
 827      *
 828      * @param chooser Cell verifying object.
 829      * @param row a row index to search in
 830      * @param index Ordinal index in suitable cells.
 831      * @return a column index.
 832      */
 833     public int findCellColumn(TableCellChooser chooser, int row, int index) {
 834         return findCell(chooser, new int[]{row}, null, index).x;
 835     }
 836 
 837     /**
 838      * Searches cell coordinates.
 839      *
 840      * @param chooser cell verifying object.
 841      * @param index an ordinal cell index
 842      * @return Point indicating coordinates (x - column, y - row)
 843      */
 844     public Point findCell(TableCellChooser chooser, int index) {
 845         return findCell(chooser, null, null, index);
 846     }
 847 
 848     /**
 849      * Searches cell coordinates in the specified rows and columns.
 850      *
 851      * @param chooser cell verifying object.
 852      * @param rows rows to search in
 853      * @param columns columns to search in
 854      * @param index an ordinal cell index
 855      * @return Point indicating coordinates (x - column, y - row)
 856      */
 857     public Point findCell(TableCellChooser chooser, int[] rows, int[] columns, int index) {
 858         TableModel model = getModel();
 859         int[] realRows;
 860         if (rows != null) {
 861             realRows = rows;
 862         } else {
 863             realRows = new int[model.getRowCount()];
 864             for (int i = 0; i < model.getRowCount(); i++) {
 865                 realRows[i] = i;
 866             }
 867         }
 868         int[] realColumns;
 869         if (columns != null) {
 870             realColumns = columns;
 871         } else {
 872             realColumns = new int[model.getColumnCount()];
 873             for (int i = 0; i < model.getColumnCount(); i++) {
 874                 realColumns[i] = i;
 875             }
 876         }
 877         int count = 0;
 878         for (int realRow : realRows) {
 879             for (int realColumn : realColumns) {
 880                 if (chooser.checkCell(this, realRow, realColumn)) {
 881                     if (count == index) {
 882                         return new Point(realColumn, realRow);
 883                     } else {
 884                         count++;
 885                     }
 886                 }
 887             }
 888         }
 889         return new Point(-1, -1);
 890     }
 891 
 892     //cell chooser only
 893     /**
 894      * Searches cell row by TableCellChooser.
 895      *
 896      * @param chooser Cell verifying object.
 897      * @return a row index.
 898      */
 899     public int findCellRow(TableCellChooser chooser) {
 900         return findCellRow(chooser, 0);
 901     }
 902 
 903     /**
 904      * Searches cell column by TableCellChooser.
 905      *
 906      * @param chooser Cell verifying object.
 907      * @return a column index.
 908      */
 909     public int findCellColumn(TableCellChooser chooser) {
 910         return findCellColumn(chooser, 0);
 911     }
 912 
 913     /**
 914      * Searches cell coordinates.
 915      *
 916      * @param chooser cell verifying object.
 917      * @return Point indicating coordinates (x - column, y - row)
 918      */
 919     public Point findCell(TableCellChooser chooser) {
 920         return findCell(chooser, 0);
 921     }
 922 
 923     ////////////////////////////////////////////////////////
 924     //Actions                                             //
 925     ////////////////////////////////////////////////////////
 926     /**
 927      * Does mouse click on the cell.
 928      *
 929      * @param row a row index
 930      * @param column a column index
 931      * @param clickCount a number of clicks
 932      * @param button a mouse button (value of InputEvent.BUTTON*_MASK field)
 933      * @param modifiers Modifiers (combination of InputEvent.*_MASK values)
 934      */
 935     public void clickOnCell(final int row, final int column, final int clickCount, final int button, final int modifiers) {
 936         output.printLine("Click on ("
 937                 + Integer.toString(row) + ", "
 938                 + Integer.toString(column)
 939                 + ") cell");
 940         output.printGolden("Click on cell");
 941         makeComponentVisible();
 942         scrollToCell(row, column);
 943         getQueueTool().invokeSmoothly(new QueueTool.QueueAction<Void>("Path selecting") {
 944             @Override
 945             public Void launch() {
 946                 Point point = getPointToClick(row, column);
 947                 clickMouse(point.x, point.y, clickCount, button, modifiers);
 948                 return null;
 949             }
 950         });
 951     }
 952 
 953     /**
 954      * Does mouse click on the cell with no modifiers.
 955      *
 956      * @param row a row index
 957      * @param column a column index
 958      * @param clickCount a number of clicks
 959      * @param button a mouse button (value of InputEvent.BUTTON*_MASK field)
 960      */
 961     public void clickOnCell(int row, int column, int clickCount, int button) {
 962         clickOnCell(row, column, clickCount, button, 0);
 963     }
 964 
 965     /**
 966      * Does mouse click on the cell by default mouse button with no modifiers.
 967      *
 968      * @param row a row index
 969      * @param column a column index
 970      * @param clickCount a number of clicks
 971      */
 972     public void clickOnCell(int row, int column, int clickCount) {
 973         clickOnCell(row, column, clickCount, getDefaultMouseButton());
 974     }
 975 
 976     /**
 977      * Does single mouse click on the cell.
 978      *
 979      * @param row a row index
 980      * @param column a column index
 981      */
 982     public void clickOnCell(int row, int column) {
 983         clickOnCell(row, column, 1);
 984     }
 985 
 986     /**
 987      * Double clicks on cell to turns it to the editing mode.
 988      *
 989      * @param row a row index
 990      * @param column a column index
 991      * @throws TimeoutExpiredException
 992      */
 993     public void clickForEdit(int row, int column) {
 994         clickOnCell(row, column, 2);
 995     }
 996 
 997     /**
 998      * Changes text of the cell pointed by row and column indexes.
 999      *
1000      * @param row a row index
1001      * @param column a column index
1002      * @param newText a text to enter
1003      * @deprecated Use changeCellObject(int, int, Object) instead.
1004      * @see #changeCellObject(int, int, Object)
1005      * @throws TimeoutExpiredException
1006      */
1007     @Deprecated
1008     public void changeCellText(int row, int column, String newText) {
1009         changeCellObject(row, column, newText);
1010     }
1011 
1012     /**
1013      * Changes value of the cell pointed by row and column indexes. uses editor
1014      * defined by setCellEditor method.
1015      *
1016      * @param row a row index
1017      * @param column a column index
1018      * @param newValue an object to chenge cell value to.
1019      * @throws TimeoutExpiredException
1020      */
1021     public void changeCellObject(int row, int column, Object newValue) {
1022         driver.editCell(this, row, column, newValue);
1023     }
1024 
1025     /**
1026      * Scrolls to a cell if the table lies on a JScrollPane component.
1027      *
1028      * @param row a row index
1029      * @param column a column index
1030      * @throws TimeoutExpiredException
1031      */
1032     public void scrollToCell(int row, int column) {
1033         output.printTrace("Scroll JTable to (" + Integer.toString(row)
1034                 + "," + Integer.toString(column) + ") cell\n    : "
1035                 + toStringSource());
1036         output.printGolden("Scroll JTable to (" + Integer.toString(row)
1037                 + "," + Integer.toString(column) + ")");
1038         makeComponentVisible();
1039         //try to find JScrollPane under.
1040         JScrollPane scroll = (JScrollPane) getContainer(new JScrollPaneOperator.JScrollPaneFinder(ComponentSearcher.
1041                 getTrueChooser("JScrollPane")));
1042         if (scroll == null) {
1043             return;
1044         }
1045         JScrollPaneOperator scroller = new JScrollPaneOperator(scroll);
1046         scroller.copyEnvironment(this);
1047         scroller.setVisualizer(new EmptyVisualizer());
1048         Rectangle rect = getCellRect(row, column, false);
1049         scroller.scrollToComponentRectangle(getSource(),
1050                 (int) rect.getX(),
1051                 (int) rect.getY(),
1052                 (int) rect.getWidth(),
1053                 (int) rect.getHeight());
1054     }
1055 
1056     /**
1057      * Selects a specified cell.
1058      *
1059      * @param row a row index
1060      * @param column a column index
1061      */
1062     public void selectCell(int row, int column) {
1063         driver.selectCell(this, row, column);
1064     }
1065 
1066     /**
1067      * Searches a column by name.
1068      *
1069      * @param name a text pattern
1070      * @param comparator a string comparision algorithm
1071      * @return a column index
1072      */
1073     public int findColumn(String name, StringComparator comparator) {
1074         int columnCount = getColumnCount();
1075         for (int i = 0; i < columnCount; i++) {
1076             if (comparator.equals(getColumnName(i),
1077                     name)) {
1078                 return i;
1079             }
1080         }
1081         return -1;
1082     }
1083 
1084     /**
1085      * Searches a column by name.
1086      *
1087      * @param name a text pattern
1088      * @return a column index
1089      */
1090     public int findColumn(String name) {
1091         return findColumn(name, getComparator());
1092     }
1093 
1094     /**
1095      * Calls popup menu on specified cell.
1096      *
1097      * @param row a row index
1098      * @param column a column index
1099      * @return the menu
1100      */
1101     public JPopupMenu callPopupOnCell(int row, int column) {
1102         output.printLine("Call popup on (" + row + ", " + column + ") cell");
1103         output.printGolden("Call popup on cell");
1104         makeComponentVisible();
1105         Point point = getPointToClick(row, column);
1106         return (JPopupMenuOperator.callPopup(getSource(),
1107                 (int) point.getX(),
1108                 (int) point.getY(),
1109                 getPopupMouseButton()));
1110     }
1111 
1112     ////////////////////////////////////////////////////////
1113     //Gets                                                //
1114     ////////////////////////////////////////////////////////
1115     /**
1116      * Ask renderer for component to be displayed.
1117      *
1118      * @param row cell row index.
1119      * @param column cell column visible index.
1120      * @param isSelected True if the specified cell was selected.
1121      * @param cellHasFocus True if the specified cell has the focus.
1122      * @return Component to be displayed.
1123      */
1124     public Component getRenderedComponent(int row, int column, boolean isSelected, boolean cellHasFocus) {
1125         return (getCellRenderer(row, column).
1126                 getTableCellRendererComponent((JTable) getSource(),
1127                         getValueAt(row, column),
1128                         isSelected,
1129                         cellHasFocus,
1130                         row,
1131                         column));
1132     }
1133 
1134     /**
1135      * Ask renderer for component to be displayed. Uses
1136      * isCellSelected(itemIndex) to determine whether cell is selected. Supposes
1137      * item do not have focus.
1138      *
1139      * @param row cell row index.
1140      * @param column cell column visible index.
1141      * @return Component to be displayed.
1142      */
1143     public Component getRenderedComponent(int row, int column) {
1144         return (getRenderedComponent(row, column, isCellSelected(row, column),
1145                 false));
1146     }
1147 
1148     /**
1149      * Returns a point at the center of the cell rectangle.
1150      *
1151      * @param row a row index
1152      * @param column a column index
1153      * @return a Point in component's coordinate system.
1154      */
1155     public Point getPointToClick(int row, int column) {
1156         Rectangle rect = getCellRect(row, column, false);
1157         return (new Point((int) (rect.getX() + rect.getWidth() / 2),
1158                 (int) (rect.getY() + rect.getHeight() / 2)));
1159     }
1160 
1161     /**
1162      * Creates an operator for a teble header assigned to this table.
1163      *
1164      * @return an JTableHeaderOperator operator
1165      */
1166     public JTableHeaderOperator getHeaderOperator() {
1167         return new JTableHeaderOperator(getTableHeader());
1168     }
1169 
1170     /**
1171      * Waits for an editor.
1172      *
1173      * @param chooser a chhoser specifying criteria to distinguish cell editor.
1174      * @param row a row index
1175      * @param column a column index
1176      * @return a component displayed over the cell and fitting the criteria
1177      * specified by {@code chooser}
1178      */
1179     public Component waitCellComponent(ComponentChooser chooser, int row, int column) {
1180         CellComponentWaiter waiter = new CellComponentWaiter(chooser, row, column);
1181         waiter.setOutput(getOutput());
1182         waiter.setTimeoutsToCloneOf(getTimeouts(), "JTableOperator.WaitEditingTimeout");
1183         try {
1184             return waiter.waitAction(null);
1185         } catch (InterruptedException e) {
1186             throw (new JemmyException("Waiting has been interrupted", e));
1187         }
1188     }
1189 
1190     /**
1191      * Waits for certain cell contents.
1192      *
1193      * @param cellText Text comparing to cell text by
1194      * {@code getComparator()} comparator.
1195      * @param row cell row index. If -1, selected one is checked.
1196      * @param column cell column visible index. If -1, selected one is checked.
1197      */
1198     public void waitCell(String cellText, int row, int column) {
1199         getOutput().printLine("Wait \"" + cellText + "\" text at ("
1200                 + Integer.toString(row) + ","
1201                 + Integer.toString(column) + ")"
1202                 + " position in component \n    : "
1203                 + toStringSource());
1204         getOutput().printGolden("Wait  \"" + cellText + "\" text at ("
1205                 + Integer.toString(row) + ","
1206                 + Integer.toString(column) + ")"
1207                 + " position");
1208         waitState(new JTableByCellFinder(cellText, row, column, getComparator()));
1209     }
1210 
1211     /**
1212      * Returns information about component.
1213      */
1214     @Override
1215     public Hashtable<String, Object> getDump() {
1216         Hashtable<String, Object> result = super.getDump();
1217         TableModel model = ((JTable) getSource()).getModel();
1218         int colCount = model.getColumnCount();
1219         int rowCount = model.getRowCount();
1220         String[][] items = new String[rowCount][colCount];
1221         for (int i = 0; i < rowCount; i++) {
1222             for (int j = 0; j < colCount; j++) {
1223                 if (model.getValueAt(i, j) != null) {
1224                     items[i][j] = model.getValueAt(i, j).toString();
1225                 } else {
1226                     items[i][j] = "null";
1227                 }
1228             }
1229         }
1230         addToDump(result, CELL_PREFIX_DPROP, items);
1231         String[] columns = new String[colCount];
1232         for (int j = 0; j < colCount; j++) {
1233             columns[j] = ((JTable) getSource()).getColumnName(j);
1234         }
1235         addToDump(result, COLUMN_PREFIX_DPROP, columns);
1236         int[] selColNums = ((JTable) getSource()).getSelectedColumns();
1237         String[] selColumns = new String[selColNums.length];
1238         for (int j = 0; j < selColNums.length; j++) {
1239             selColumns[j] = Integer.toString(selColNums[j]);
1240         }
1241         addToDump(result, SELECTED_COLUMN_PREFIX_DPROP, selColumns);
1242         int[] selRowNums = ((JTable) getSource()).getSelectedRows();
1243         String[] selRows = new String[selRowNums.length];
1244         for (int i = 0; i < selRowNums.length; i++) {
1245             selRows[i] = Integer.toString(selRowNums[i]);
1246         }
1247         addToDump(result, SELECTED_ROW_PREFIX_DPROP, selRows);
1248         result.put(COLUMN_COUNT_DPROP, Integer.toString(colCount));
1249         result.put(ROW_COUNT_DPROP, Integer.toString(rowCount));
1250         return result;
1251     }
1252 
1253     ////////////////////////////////////////////////////////
1254     //Mapping                                             //
1255     /**
1256      * Maps {@code JTable.addColumn(TableColumn)} through queue
1257      */
1258     public void addColumn(final TableColumn tableColumn) {
1259         runMapping(new MapVoidAction("addColumn") {
1260             @Override
1261             public void map() {
1262                 ((JTable) getSource()).addColumn(tableColumn);
1263             }
1264         });
1265     }
1266 
1267     /**
1268      * Maps {@code JTable.addColumnSelectionInterval(int, int)} through queue
1269      */
1270     public void addColumnSelectionInterval(final int i, final int i1) {
1271         runMapping(new MapVoidAction("addColumnSelectionInterval") {
1272             @Override
1273             public void map() {
1274                 ((JTable) getSource()).addColumnSelectionInterval(i, i1);
1275             }
1276         });
1277     }
1278 
1279     /**
1280      * Maps {@code JTable.addRowSelectionInterval(int, int)} through queue
1281      */
1282     public void addRowSelectionInterval(final int i, final int i1) {
1283         runMapping(new MapVoidAction("addRowSelectionInterval") {
1284             @Override
1285             public void map() {
1286                 ((JTable) getSource()).addRowSelectionInterval(i, i1);
1287             }
1288         });
1289     }
1290 
1291     /**
1292      * Maps {@code JTable.changeSelection(int, int, boolean, boolean)} through queue
1293      */
1294     public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) {
1295         runMapping(new MapVoidAction("clearSelection") {
1296             @Override
1297             public void map() {
1298                 ((JTable) getSource()).changeSelection(rowIndex, columnIndex, toggle, extend);
1299             }
1300         });
1301     }
1302 
1303     /**
1304      * Maps {@code JTable.clearSelection()} through queue
1305      */
1306     public void clearSelection() {
1307         runMapping(new MapVoidAction("clearSelection") {
1308             @Override
1309             public void map() {
1310                 ((JTable) getSource()).clearSelection();
1311             }
1312         });
1313     }
1314 
1315     /**
1316      * Maps {@code JTable.columnAdded(TableColumnModelEvent)} through queue
1317      */
1318     public void columnAdded(final TableColumnModelEvent tableColumnModelEvent) {
1319         runMapping(new MapVoidAction("columnAdded") {
1320             @Override
1321             public void map() {
1322                 ((JTable) getSource()).columnAdded(tableColumnModelEvent);
1323             }
1324         });
1325     }
1326 
1327     /**
1328      * Maps {@code JTable.columnAtPoint(Point)} through queue
1329      */
1330     public int columnAtPoint(final Point point) {
1331         return (runMapping(new MapIntegerAction("columnAtPoint") {
1332             @Override
1333             public int map() {
1334                 return ((JTable) getSource()).columnAtPoint(point);
1335             }
1336         }));
1337     }
1338 
1339     /**
1340      * Maps {@code JTable.columnMarginChanged(ChangeEvent)} through queue
1341      */
1342     public void columnMarginChanged(final ChangeEvent changeEvent) {
1343         runMapping(new MapVoidAction("columnMarginChanged") {
1344             @Override
1345             public void map() {
1346                 ((JTable) getSource()).columnMarginChanged(changeEvent);
1347             }
1348         });
1349     }
1350 
1351     /**
1352      * Maps {@code JTable.columnMoved(TableColumnModelEvent)} through queue
1353      */
1354     public void columnMoved(final TableColumnModelEvent tableColumnModelEvent) {
1355         runMapping(new MapVoidAction("columnMoved") {
1356             @Override
1357             public void map() {
1358                 ((JTable) getSource()).columnMoved(tableColumnModelEvent);
1359             }
1360         });
1361     }
1362 
1363     /**
1364      * Maps {@code JTable.columnRemoved(TableColumnModelEvent)} through queue
1365      */
1366     public void columnRemoved(final TableColumnModelEvent tableColumnModelEvent) {
1367         runMapping(new MapVoidAction("columnRemoved") {
1368             @Override
1369             public void map() {
1370                 ((JTable) getSource()).columnRemoved(tableColumnModelEvent);
1371             }
1372         });
1373     }
1374 
1375     /**
1376      * Maps {@code JTable.columnSelectionChanged(ListSelectionEvent)}
1377      * through queue
1378      */
1379     public void columnSelectionChanged(final ListSelectionEvent listSelectionEvent) {
1380         runMapping(new MapVoidAction("columnSelectionChanged") {
1381             @Override
1382             public void map() {
1383                 ((JTable) getSource()).columnSelectionChanged(listSelectionEvent);
1384             }
1385         });
1386     }
1387 
1388     /**
1389      * Maps {@code JTable.convertColumnIndexToModel(int)} through queue
1390      */
1391     public int convertColumnIndexToModel(final int i) {
1392         return (runMapping(new MapIntegerAction("convertColumnIndexToModel") {
1393             @Override
1394             public int map() {
1395                 return ((JTable) getSource()).convertColumnIndexToModel(i);
1396             }
1397         }));
1398     }
1399 
1400     /**
1401      * Maps {@code JTable.convertColumnIndexToView(int)} through queue
1402      */
1403     public int convertColumnIndexToView(final int i) {
1404         return (runMapping(new MapIntegerAction("convertColumnIndexToView") {
1405             @Override
1406             public int map() {
1407                 return ((JTable) getSource()).convertColumnIndexToView(i);
1408             }
1409         }));
1410     }
1411 
1412     /**
1413      * Maps {@code JTable.createDefaultColumnsFromModel()} through queue
1414      */
1415     public void createDefaultColumnsFromModel() {
1416         runMapping(new MapVoidAction("createDefaultColumnsFromModel") {
1417             @Override
1418             public void map() {
1419                 ((JTable) getSource()).createDefaultColumnsFromModel();
1420             }
1421         });
1422     }
1423 
1424     /**
1425      * Maps {@code JTable.editCellAt(int, int)} through queue
1426      */
1427     public boolean editCellAt(final int i, final int i1) {
1428         return (runMapping(new MapBooleanAction("editCellAt") {
1429             @Override
1430             public boolean map() {
1431                 return ((JTable) getSource()).editCellAt(i, i1);
1432             }
1433         }));
1434     }
1435 
1436     /**
1437      * Maps {@code JTable.editCellAt(int, int, EventObject)} through queue
1438      */
1439     public boolean editCellAt(final int i, final int i1, final EventObject eventObject) {
1440         return (runMapping(new MapBooleanAction("editCellAt") {
1441             @Override
1442             public boolean map() {
1443                 return ((JTable) getSource()).editCellAt(i, i1, eventObject);
1444             }
1445         }));
1446     }
1447 
1448     /**
1449      * Maps {@code JTable.editingCanceled(ChangeEvent)} through queue
1450      */
1451     public void editingCanceled(final ChangeEvent changeEvent) {
1452         runMapping(new MapVoidAction("editingCanceled") {
1453             @Override
1454             public void map() {
1455                 ((JTable) getSource()).editingCanceled(changeEvent);
1456             }
1457         });
1458     }
1459 
1460     /**
1461      * Maps {@code JTable.editingStopped(ChangeEvent)} through queue
1462      */
1463     public void editingStopped(final ChangeEvent changeEvent) {
1464         runMapping(new MapVoidAction("editingStopped") {
1465             @Override
1466             public void map() {
1467                 ((JTable) getSource()).editingStopped(changeEvent);
1468             }
1469         });
1470     }
1471 
1472     /**
1473      * Maps {@code JTable.getAutoCreateColumnsFromModel()} through queue
1474      */
1475     public boolean getAutoCreateColumnsFromModel() {
1476         return (runMapping(new MapBooleanAction("getAutoCreateColumnsFromModel") {
1477             @Override
1478             public boolean map() {
1479                 return ((JTable) getSource()).getAutoCreateColumnsFromModel();
1480             }
1481         }));
1482     }
1483 
1484     /**
1485      * Maps {@code JTable.getAutoResizeMode()} through queue
1486      */
1487     public int getAutoResizeMode() {
1488         return (runMapping(new MapIntegerAction("getAutoResizeMode") {
1489             @Override
1490             public int map() {
1491                 return ((JTable) getSource()).getAutoResizeMode();
1492             }
1493         }));
1494     }
1495 
1496     /**
1497      * Maps {@code JTable.getCellEditor()} through queue
1498      */
1499     public TableCellEditor getCellEditor() {
1500         return (runMapping(new MapAction<TableCellEditor>("getCellEditor") {
1501             @Override
1502             public TableCellEditor map() {
1503                 return ((JTable) getSource()).getCellEditor();
1504             }
1505         }));
1506     }
1507 
1508     /**
1509      * Maps {@code JTable.getCellEditor(int, int)} through queue
1510      */
1511     public TableCellEditor getCellEditor(final int i, final int i1) {
1512         return (runMapping(new MapAction<TableCellEditor>("getCellEditor") {
1513             @Override
1514             public TableCellEditor map() {
1515                 return ((JTable) getSource()).getCellEditor(i, i1);
1516             }
1517         }));
1518     }
1519 
1520     /**
1521      * Maps {@code JTable.getCellRect(int, int, boolean)} through queue
1522      */
1523     public Rectangle getCellRect(final int i, final int i1, final boolean b) {
1524         return (runMapping(new MapAction<Rectangle>("getCellRect") {
1525             @Override
1526             public Rectangle map() {
1527                 return ((JTable) getSource()).getCellRect(i, i1, b);
1528             }
1529         }));
1530     }
1531 
1532     /**
1533      * Maps {@code JTable.getCellRenderer(int, int)} through queue
1534      */
1535     public TableCellRenderer getCellRenderer(final int i, final int i1) {
1536         return (runMapping(new MapAction<TableCellRenderer>("getCellRenderer") {
1537             @Override
1538             public TableCellRenderer map() {
1539                 return ((JTable) getSource()).getCellRenderer(i, i1);
1540             }
1541         }));
1542     }
1543 
1544     /**
1545      * Maps {@code JTable.getCellSelectionEnabled()} through queue
1546      */
1547     public boolean getCellSelectionEnabled() {
1548         return (runMapping(new MapBooleanAction("getCellSelectionEnabled") {
1549             @Override
1550             public boolean map() {
1551                 return ((JTable) getSource()).getCellSelectionEnabled();
1552             }
1553         }));
1554     }
1555 
1556     /**
1557      * Maps {@code JTable.getColumn(Object)} through queue
1558      */
1559     public TableColumn getColumn(final Object object) {
1560         return (runMapping(new MapAction<TableColumn>("getColumn") {
1561             @Override
1562             public TableColumn map() {
1563                 return ((JTable) getSource()).getColumn(object);
1564             }
1565         }));
1566     }
1567 
1568     /**
1569      * Maps {@code JTable.getColumnClass(int)} through queue
1570      */
1571     public Class<?> getColumnClass(final int i) {
1572         return (runMapping(new MapAction<Class<?>>("getColumnClass") {
1573             @Override
1574             public Class<?> map() {
1575                 return ((JTable) getSource()).getColumnClass(i);
1576             }
1577         }));
1578     }
1579 
1580     /**
1581      * Maps {@code JTable.getColumnCount()} through queue
1582      */
1583     public int getColumnCount() {
1584         return (runMapping(new MapIntegerAction("getColumnCount") {
1585             @Override
1586             public int map() {
1587                 return ((JTable) getSource()).getColumnCount();
1588             }
1589         }));
1590     }
1591 
1592     /**
1593      * Maps {@code JTable.getColumnModel()} through queue
1594      */
1595     public TableColumnModel getColumnModel() {
1596         return (runMapping(new MapAction<TableColumnModel>("getColumnModel") {
1597             @Override
1598             public TableColumnModel map() {
1599                 return ((JTable) getSource()).getColumnModel();
1600             }
1601         }));
1602     }
1603 
1604     /**
1605      * Maps {@code JTable.getColumnName(int)} through queue
1606      */
1607     public String getColumnName(final int i) {
1608         return (runMapping(new MapAction<String>("getColumnName") {
1609             @Override
1610             public String map() {
1611                 return ((JTable) getSource()).getColumnName(i);
1612             }
1613         }));
1614     }
1615 
1616     /**
1617      * Maps {@code JTable.getColumnSelectionAllowed()} through queue
1618      */
1619     public boolean getColumnSelectionAllowed() {
1620         return (runMapping(new MapBooleanAction("getColumnSelectionAllowed") {
1621             @Override
1622             public boolean map() {
1623                 return ((JTable) getSource()).getColumnSelectionAllowed();
1624             }
1625         }));
1626     }
1627 
1628     /**
1629      * Maps {@code JTable.getDefaultEditor(Class)} through queue
1630      */
1631     public TableCellEditor getDefaultEditor(final Class<?> clss) {
1632         return (runMapping(new MapAction<TableCellEditor>("getDefaultEditor") {
1633             @Override
1634             public TableCellEditor map() {
1635                 return ((JTable) getSource()).getDefaultEditor(clss);
1636             }
1637         }));
1638     }
1639 
1640     /**
1641      * Maps {@code JTable.getDefaultRenderer(Class)} through queue
1642      */
1643     public TableCellRenderer getDefaultRenderer(final Class<?> clss) {
1644         return (runMapping(new MapAction<TableCellRenderer>("getDefaultRenderer") {
1645             @Override
1646             public TableCellRenderer map() {
1647                 return ((JTable) getSource()).getDefaultRenderer(clss);
1648             }
1649         }));
1650     }
1651 
1652     /**
1653      * Maps {@code JTable.getEditingColumn()} through queue
1654      */
1655     public int getEditingColumn() {
1656         return (runMapping(new MapIntegerAction("getEditingColumn") {
1657             @Override
1658             public int map() {
1659                 return ((JTable) getSource()).getEditingColumn();
1660             }
1661         }));
1662     }
1663 
1664     /**
1665      * Maps {@code JTable.getEditingRow()} through queue
1666      */
1667     public int getEditingRow() {
1668         return (runMapping(new MapIntegerAction("getEditingRow") {
1669             @Override
1670             public int map() {
1671                 return ((JTable) getSource()).getEditingRow();
1672             }
1673         }));
1674     }
1675 
1676     /**
1677      * Maps {@code JTable.getEditorComponent()} through queue
1678      */
1679     public Component getEditorComponent() {
1680         return (runMapping(new MapAction<Component>("getEditorComponent") {
1681             @Override
1682             public Component map() {
1683                 return ((JTable) getSource()).getEditorComponent();
1684             }
1685         }));
1686     }
1687 
1688     /**
1689      * Maps {@code JTable.getGridColor()} through queue
1690      */
1691     public Color getGridColor() {
1692         return (runMapping(new MapAction<Color>("getGridColor") {
1693             @Override
1694             public Color map() {
1695                 return ((JTable) getSource()).getGridColor();
1696             }
1697         }));
1698     }
1699 
1700     /**
1701      * Maps {@code JTable.getIntercellSpacing()} through queue
1702      */
1703     public Dimension getIntercellSpacing() {
1704         return (runMapping(new MapAction<Dimension>("getIntercellSpacing") {
1705             @Override
1706             public Dimension map() {
1707                 return ((JTable) getSource()).getIntercellSpacing();
1708             }
1709         }));
1710     }
1711 
1712     /**
1713      * Maps {@code JTable.getModel()} through queue
1714      */
1715     public TableModel getModel() {
1716         return (runMapping(new MapAction<TableModel>("getModel") {
1717             @Override
1718             public TableModel map() {
1719                 return ((JTable) getSource()).getModel();
1720             }
1721         }));
1722     }
1723 
1724     /**
1725      * Maps {@code JTable.getPreferredScrollableViewportSize()} through queue
1726      */
1727     public Dimension getPreferredScrollableViewportSize() {
1728         return (runMapping(new MapAction<Dimension>("getPreferredScrollableViewportSize") {
1729             @Override
1730             public Dimension map() {
1731                 return ((JTable) getSource()).getPreferredScrollableViewportSize();
1732             }
1733         }));
1734     }
1735 
1736     /**
1737      * Maps {@code JTable.getRowCount()} through queue
1738      */
1739     public int getRowCount() {
1740         return (runMapping(new MapIntegerAction("getRowCount") {
1741             @Override
1742             public int map() {
1743                 return ((JTable) getSource()).getRowCount();
1744             }
1745         }));
1746     }
1747 
1748     /**
1749      * Maps {@code JTable.getRowHeight()} through queue
1750      */
1751     public int getRowHeight() {
1752         return (runMapping(new MapIntegerAction("getRowHeight") {
1753             @Override
1754             public int map() {
1755                 return ((JTable) getSource()).getRowHeight();
1756             }
1757         }));
1758     }
1759 
1760     /**
1761      * Maps {@code JTable.getRowMargin()} through queue
1762      */
1763     public int getRowMargin() {
1764         return (runMapping(new MapIntegerAction("getRowMargin") {
1765             @Override
1766             public int map() {
1767                 return ((JTable) getSource()).getRowMargin();
1768             }
1769         }));
1770     }
1771 
1772     /**
1773      * Maps {@code JTable.getRowSelectionAllowed()} through queue
1774      */
1775     public boolean getRowSelectionAllowed() {
1776         return (runMapping(new MapBooleanAction("getRowSelectionAllowed") {
1777             @Override
1778             public boolean map() {
1779                 return ((JTable) getSource()).getRowSelectionAllowed();
1780             }
1781         }));
1782     }
1783 
1784     /**
1785      * Maps {@code JTable.getScrollableBlockIncrement(Rectangle, int, int)}
1786      * through queue
1787      */
1788     public int getScrollableBlockIncrement(final Rectangle rectangle, final int i, final int i1) {
1789         return (runMapping(new MapIntegerAction("getScrollableBlockIncrement") {
1790             @Override
1791             public int map() {
1792                 return ((JTable) getSource()).getScrollableBlockIncrement(rectangle, i, i1);
1793             }
1794         }));
1795     }
1796 
1797     /**
1798      * Maps {@code JTable.getScrollableTracksViewportHeight()} through queue
1799      */
1800     public boolean getScrollableTracksViewportHeight() {
1801         return (runMapping(new MapBooleanAction("getScrollableTracksViewportHeight") {
1802             @Override
1803             public boolean map() {
1804                 return ((JTable) getSource()).getScrollableTracksViewportHeight();
1805             }
1806         }));
1807     }
1808 
1809     /**
1810      * Maps {@code JTable.getScrollableTracksViewportWidth()} through queue
1811      */
1812     public boolean getScrollableTracksViewportWidth() {
1813         return (runMapping(new MapBooleanAction("getScrollableTracksViewportWidth") {
1814             @Override
1815             public boolean map() {
1816                 return ((JTable) getSource()).getScrollableTracksViewportWidth();
1817             }
1818         }));
1819     }
1820 
1821     /**
1822      * Maps {@code JTable.getScrollableUnitIncrement(Rectangle, int, int)}
1823      * through queue
1824      */
1825     public int getScrollableUnitIncrement(final Rectangle rectangle, final int i, final int i1) {
1826         return (runMapping(new MapIntegerAction("getScrollableUnitIncrement") {
1827             @Override
1828             public int map() {
1829                 return ((JTable) getSource()).getScrollableUnitIncrement(rectangle, i, i1);
1830             }
1831         }));
1832     }
1833 
1834     /**
1835      * Maps {@code JTable.getSelectedColumn()} through queue
1836      */
1837     public int getSelectedColumn() {
1838         return (runMapping(new MapIntegerAction("getSelectedColumn") {
1839             @Override
1840             public int map() {
1841                 return ((JTable) getSource()).getSelectedColumn();
1842             }
1843         }));
1844     }
1845 
1846     /**
1847      * Maps {@code JTable.getSelectedColumnCount()} through queue
1848      */
1849     public int getSelectedColumnCount() {
1850         return (runMapping(new MapIntegerAction("getSelectedColumnCount") {
1851             @Override
1852             public int map() {
1853                 return ((JTable) getSource()).getSelectedColumnCount();
1854             }
1855         }));
1856     }
1857 
1858     /**
1859      * Maps {@code JTable.getSelectedColumns()} through queue
1860      */
1861     public int[] getSelectedColumns() {
1862         return ((int[]) runMapping(new MapAction<Object>("getSelectedColumns") {
1863             @Override
1864             public Object map() {
1865                 return ((JTable) getSource()).getSelectedColumns();
1866             }
1867         }));
1868     }
1869 
1870     /**
1871      * Maps {@code JTable.getSelectedRow()} through queue
1872      */
1873     public int getSelectedRow() {
1874         return (runMapping(new MapIntegerAction("getSelectedRow") {
1875             @Override
1876             public int map() {
1877                 return ((JTable) getSource()).getSelectedRow();
1878             }
1879         }));
1880     }
1881 
1882     /**
1883      * Maps {@code JTable.getSelectedRowCount()} through queue
1884      */
1885     public int getSelectedRowCount() {
1886         return (runMapping(new MapIntegerAction("getSelectedRowCount") {
1887             @Override
1888             public int map() {
1889                 return ((JTable) getSource()).getSelectedRowCount();
1890             }
1891         }));
1892     }
1893 
1894     /**
1895      * Maps {@code JTable.getSelectedRows()} through queue
1896      */
1897     public int[] getSelectedRows() {
1898         return ((int[]) runMapping(new MapAction<Object>("getSelectedRows") {
1899             @Override
1900             public Object map() {
1901                 return ((JTable) getSource()).getSelectedRows();
1902             }
1903         }));
1904     }
1905 
1906     /**
1907      * Maps {@code JTable.getSelectionBackground()} through queue
1908      */
1909     public Color getSelectionBackground() {
1910         return (runMapping(new MapAction<Color>("getSelectionBackground") {
1911             @Override
1912             public Color map() {
1913                 return ((JTable) getSource()).getSelectionBackground();
1914             }
1915         }));
1916     }
1917 
1918     /**
1919      * Maps {@code JTable.getSelectionForeground()} through queue
1920      */
1921     public Color getSelectionForeground() {
1922         return (runMapping(new MapAction<Color>("getSelectionForeground") {
1923             @Override
1924             public Color map() {
1925                 return ((JTable) getSource()).getSelectionForeground();
1926             }
1927         }));
1928     }
1929 
1930     /**
1931      * Maps {@code JTable.getSelectionModel()} through queue
1932      */
1933     public ListSelectionModel getSelectionModel() {
1934         return (runMapping(new MapAction<ListSelectionModel>("getSelectionModel") {
1935             @Override
1936             public ListSelectionModel map() {
1937                 return ((JTable) getSource()).getSelectionModel();
1938             }
1939         }));
1940     }
1941 
1942     /**
1943      * Maps {@code JTable.getShowHorizontalLines()} through queue
1944      */
1945     public boolean getShowHorizontalLines() {
1946         return (runMapping(new MapBooleanAction("getShowHorizontalLines") {
1947             @Override
1948             public boolean map() {
1949                 return ((JTable) getSource()).getShowHorizontalLines();
1950             }
1951         }));
1952     }
1953 
1954     /**
1955      * Maps {@code JTable.getShowVerticalLines()} through queue
1956      */
1957     public boolean getShowVerticalLines() {
1958         return (runMapping(new MapBooleanAction("getShowVerticalLines") {
1959             @Override
1960             public boolean map() {
1961                 return ((JTable) getSource()).getShowVerticalLines();
1962             }
1963         }));
1964     }
1965 
1966     /**
1967      * Maps {@code JTable.getTableHeader()} through queue
1968      */
1969     public JTableHeader getTableHeader() {
1970         return (runMapping(new MapAction<JTableHeader>("getTableHeader") {
1971             @Override
1972             public JTableHeader map() {
1973                 return ((JTable) getSource()).getTableHeader();
1974             }
1975         }));
1976     }
1977 
1978     /**
1979      * Maps {@code JTable.getUI()} through queue
1980      */
1981     public TableUI getUI() {
1982         return (runMapping(new MapAction<TableUI>("getUI") {
1983             @Override
1984             public TableUI map() {
1985                 return ((JTable) getSource()).getUI();
1986             }
1987         }));
1988     }
1989 
1990     /**
1991      * Maps {@code JTable.getValueAt(int, int)} through queue
1992      */
1993     public Object getValueAt(final int i, final int i1) {
1994         return (runMapping(new MapAction<Object>("getValueAt") {
1995             @Override
1996             public Object map() {
1997                 return ((JTable) getSource()).getValueAt(i, i1);
1998             }
1999         }));
2000     }
2001 
2002     /**
2003      * Maps {@code JTable.isCellEditable(int, int)} through queue
2004      */
2005     public boolean isCellEditable(final int i, final int i1) {
2006         return (runMapping(new MapBooleanAction("isCellEditable") {
2007             @Override
2008             public boolean map() {
2009                 return ((JTable) getSource()).isCellEditable(i, i1);
2010             }
2011         }));
2012     }
2013 
2014     /**
2015      * Maps {@code JTable.isCellSelected(int, int)} through queue
2016      */
2017     public boolean isCellSelected(final int i, final int i1) {
2018         return (runMapping(new MapBooleanAction("isCellSelected") {
2019             @Override
2020             public boolean map() {
2021                 return ((JTable) getSource()).isCellSelected(i, i1);
2022             }
2023         }));
2024     }
2025 
2026     /**
2027      * Maps {@code JTable.isColumnSelected(int)} through queue
2028      */
2029     public boolean isColumnSelected(final int i) {
2030         return (runMapping(new MapBooleanAction("isColumnSelected") {
2031             @Override
2032             public boolean map() {
2033                 return ((JTable) getSource()).isColumnSelected(i);
2034             }
2035         }));
2036     }
2037 
2038     /**
2039      * Maps {@code JTable.isEditing()} through queue
2040      */
2041     public boolean isEditing() {
2042         return (runMapping(new MapBooleanAction("isEditing") {
2043             @Override
2044             public boolean map() {
2045                 return ((JTable) getSource()).isEditing();
2046             }
2047         }));
2048     }
2049 
2050     /**
2051      * Maps {@code JTable.isRowSelected(int)} through queue
2052      */
2053     public boolean isRowSelected(final int i) {
2054         return (runMapping(new MapBooleanAction("isRowSelected") {
2055             @Override
2056             public boolean map() {
2057                 return ((JTable) getSource()).isRowSelected(i);
2058             }
2059         }));
2060     }
2061 
2062     /**
2063      * Maps {@code JTable.moveColumn(int, int)} through queue
2064      */
2065     public void moveColumn(final int i, final int i1) {
2066         runMapping(new MapVoidAction("moveColumn") {
2067             @Override
2068             public void map() {
2069                 ((JTable) getSource()).moveColumn(i, i1);
2070             }
2071         });
2072     }
2073 
2074     /**
2075      * Maps {@code JTable.prepareEditor(TableCellEditor, int, int)} through queue
2076      */
2077     public Component prepareEditor(final TableCellEditor tableCellEditor, final int i, final int i1) {
2078         return (runMapping(new MapAction<Component>("prepareEditor") {
2079             @Override
2080             public Component map() {
2081                 return ((JTable) getSource()).prepareEditor(tableCellEditor, i, i1);
2082             }
2083         }));
2084     }
2085 
2086     /**
2087      * Maps {@code JTable.prepareRenderer(TableCellRenderer, int, int)}
2088      * through queue
2089      */
2090     public Component prepareRenderer(final TableCellRenderer tableCellRenderer, final int i, final int i1) {
2091         return (runMapping(new MapAction<Component>("prepareRenderer") {
2092             @Override
2093             public Component map() {
2094                 return ((JTable) getSource()).prepareRenderer(tableCellRenderer, i, i1);
2095             }
2096         }));
2097     }
2098 
2099     /**
2100      * Maps {@code JTable.removeColumn(TableColumn)} through queue
2101      */
2102     public void removeColumn(final TableColumn tableColumn) {
2103         runMapping(new MapVoidAction("removeColumn") {
2104             @Override
2105             public void map() {
2106                 ((JTable) getSource()).removeColumn(tableColumn);
2107             }
2108         });
2109     }
2110 
2111     /**
2112      * Maps {@code JTable.removeColumnSelectionInterval(int, int)} through queue
2113      */
2114     public void removeColumnSelectionInterval(final int i, final int i1) {
2115         runMapping(new MapVoidAction("removeColumnSelectionInterval") {
2116             @Override
2117             public void map() {
2118                 ((JTable) getSource()).removeColumnSelectionInterval(i, i1);
2119             }
2120         });
2121     }
2122 
2123     /**
2124      * Maps {@code JTable.removeEditor()} through queue
2125      */
2126     public void removeEditor() {
2127         runMapping(new MapVoidAction("removeEditor") {
2128             @Override
2129             public void map() {
2130                 ((JTable) getSource()).removeEditor();
2131             }
2132         });
2133     }
2134 
2135     /**
2136      * Maps {@code JTable.removeRowSelectionInterval(int, int)} through queue
2137      */
2138     public void removeRowSelectionInterval(final int i, final int i1) {
2139         runMapping(new MapVoidAction("removeRowSelectionInterval") {
2140             @Override
2141             public void map() {
2142                 ((JTable) getSource()).removeRowSelectionInterval(i, i1);
2143             }
2144         });
2145     }
2146 
2147     /**
2148      * Maps {@code JTable.rowAtPoint(Point)} through queue
2149      */
2150     public int rowAtPoint(final Point point) {
2151         return (runMapping(new MapIntegerAction("rowAtPoint") {
2152             @Override
2153             public int map() {
2154                 return ((JTable) getSource()).rowAtPoint(point);
2155             }
2156         }));
2157     }
2158 
2159     /**
2160      * Maps {@code JTable.selectAll()} through queue
2161      */
2162     public void selectAll() {
2163         runMapping(new MapVoidAction("selectAll") {
2164             @Override
2165             public void map() {
2166                 ((JTable) getSource()).selectAll();
2167             }
2168         });
2169     }
2170 
2171     /**
2172      * Maps {@code JTable.setAutoCreateColumnsFromModel(boolean)} through queue
2173      */
2174     public void setAutoCreateColumnsFromModel(final boolean b) {
2175         runMapping(new MapVoidAction("setAutoCreateColumnsFromModel") {
2176             @Override
2177             public void map() {
2178                 ((JTable) getSource()).setAutoCreateColumnsFromModel(b);
2179             }
2180         });
2181     }
2182 
2183     /**
2184      * Maps {@code JTable.setAutoResizeMode(int)} through queue
2185      */
2186     public void setAutoResizeMode(final int i) {
2187         runMapping(new MapVoidAction("setAutoResizeMode") {
2188             @Override
2189             public void map() {
2190                 ((JTable) getSource()).setAutoResizeMode(i);
2191             }
2192         });
2193     }
2194 
2195     /**
2196      * Maps {@code JTable.setCellEditor(TableCellEditor)} through queue
2197      */
2198     public void setCellEditor(final TableCellEditor tableCellEditor) {
2199         runMapping(new MapVoidAction("setCellEditor") {
2200             @Override
2201             public void map() {
2202                 ((JTable) getSource()).setCellEditor(tableCellEditor);
2203             }
2204         });
2205     }
2206 
2207     /**
2208      * Maps {@code JTable.setCellSelectionEnabled(boolean)} through queue
2209      */
2210     public void setCellSelectionEnabled(final boolean b) {
2211         runMapping(new MapVoidAction("setCellSelectionEnabled") {
2212             @Override
2213             public void map() {
2214                 ((JTable) getSource()).setCellSelectionEnabled(b);
2215             }
2216         });
2217     }
2218 
2219     /**
2220      * Maps {@code JTable.setColumnModel(TableColumnModel)} through queue
2221      */
2222     public void setColumnModel(final TableColumnModel tableColumnModel) {
2223         runMapping(new MapVoidAction("setColumnModel") {
2224             @Override
2225             public void map() {
2226                 ((JTable) getSource()).setColumnModel(tableColumnModel);
2227             }
2228         });
2229     }
2230 
2231     /**
2232      * Maps {@code JTable.setColumnSelectionAllowed(boolean)} through queue
2233      */
2234     public void setColumnSelectionAllowed(final boolean b) {
2235         runMapping(new MapVoidAction("setColumnSelectionAllowed") {
2236             @Override
2237             public void map() {
2238                 ((JTable) getSource()).setColumnSelectionAllowed(b);
2239             }
2240         });
2241     }
2242 
2243     /**
2244      * Maps {@code JTable.setColumnSelectionInterval(int, int)} through queue
2245      */
2246     public void setColumnSelectionInterval(final int i, final int i1) {
2247         runMapping(new MapVoidAction("setColumnSelectionInterval") {
2248             @Override
2249             public void map() {
2250                 ((JTable) getSource()).setColumnSelectionInterval(i, i1);
2251             }
2252         });
2253     }
2254 
2255     /**
2256      * Maps {@code JTable.setDefaultEditor(Class, TableCellEditor)} through queue
2257      */
2258     public void setDefaultEditor(final Class<?> clss, final TableCellEditor tableCellEditor) {
2259         runMapping(new MapVoidAction("setDefaultEditor") {
2260             @Override
2261             public void map() {
2262                 ((JTable) getSource()).setDefaultEditor(clss, tableCellEditor);
2263             }
2264         });
2265     }
2266 
2267     /**
2268      * Maps {@code JTable.setDefaultRenderer(Class, TableCellRenderer)}
2269      * through queue
2270      */
2271     public void setDefaultRenderer(final Class<?> clss, final TableCellRenderer tableCellRenderer) {
2272         runMapping(new MapVoidAction("setDefaultRenderer") {
2273             @Override
2274             public void map() {
2275                 ((JTable) getSource()).setDefaultRenderer(clss, tableCellRenderer);
2276             }
2277         });
2278     }
2279 
2280     /**
2281      * Maps {@code JTable.setEditingColumn(int)} through queue
2282      */
2283     public void setEditingColumn(final int i) {
2284         runMapping(new MapVoidAction("setEditingColumn") {
2285             @Override
2286             public void map() {
2287                 ((JTable) getSource()).setEditingColumn(i);
2288             }
2289         });
2290     }
2291 
2292     /**
2293      * Maps {@code JTable.setEditingRow(int)} through queue
2294      */
2295     public void setEditingRow(final int i) {
2296         runMapping(new MapVoidAction("setEditingRow") {
2297             @Override
2298             public void map() {
2299                 ((JTable) getSource()).setEditingRow(i);
2300             }
2301         });
2302     }
2303 
2304     /**
2305      * Maps {@code JTable.setGridColor(Color)} through queue
2306      */
2307     public void setGridColor(final Color color) {
2308         runMapping(new MapVoidAction("setGridColor") {
2309             @Override
2310             public void map() {
2311                 ((JTable) getSource()).setGridColor(color);
2312             }
2313         });
2314     }
2315 
2316     /**
2317      * Maps {@code JTable.setIntercellSpacing(Dimension)} through queue
2318      */
2319     public void setIntercellSpacing(final Dimension dimension) {
2320         runMapping(new MapVoidAction("setIntercellSpacing") {
2321             @Override
2322             public void map() {
2323                 ((JTable) getSource()).setIntercellSpacing(dimension);
2324             }
2325         });
2326     }
2327 
2328     /**
2329      * Maps {@code JTable.setModel(TableModel)} through queue
2330      */
2331     public void setModel(final TableModel tableModel) {
2332         runMapping(new MapVoidAction("setModel") {
2333             @Override
2334             public void map() {
2335                 ((JTable) getSource()).setModel(tableModel);
2336             }
2337         });
2338     }
2339 
2340     /**
2341      * Maps {@code JTable.setPreferredScrollableViewportSize(Dimension)}
2342      * through queue
2343      */
2344     public void setPreferredScrollableViewportSize(final Dimension dimension) {
2345         runMapping(new MapVoidAction("setPreferredScrollableViewportSize") {
2346             @Override
2347             public void map() {
2348                 ((JTable) getSource()).setPreferredScrollableViewportSize(dimension);
2349             }
2350         });
2351     }
2352 
2353     /**
2354      * Maps {@code JTable.setRowHeight(int)} through queue
2355      */
2356     public void setRowHeight(final int i) {
2357         runMapping(new MapVoidAction("setRowHeight") {
2358             @Override
2359             public void map() {
2360                 ((JTable) getSource()).setRowHeight(i);
2361             }
2362         });
2363     }
2364 
2365     /**
2366      * Maps {@code JTable.setRowMargin(int)} through queue
2367      */
2368     public void setRowMargin(final int i) {
2369         runMapping(new MapVoidAction("setRowMargin") {
2370             @Override
2371             public void map() {
2372                 ((JTable) getSource()).setRowMargin(i);
2373             }
2374         });
2375     }
2376 
2377     /**
2378      * Maps {@code JTable.setRowSelectionAllowed(boolean)} through queue
2379      */
2380     public void setRowSelectionAllowed(final boolean b) {
2381         runMapping(new MapVoidAction("setRowSelectionAllowed") {
2382             @Override
2383             public void map() {
2384                 ((JTable) getSource()).setRowSelectionAllowed(b);
2385             }
2386         });
2387     }
2388 
2389     /**
2390      * Maps {@code JTable.setRowSelectionInterval(int, int)} through queue
2391      */
2392     public void setRowSelectionInterval(final int i, final int i1) {
2393         runMapping(new MapVoidAction("setRowSelectionInterval") {
2394             @Override
2395             public void map() {
2396                 ((JTable) getSource()).setRowSelectionInterval(i, i1);
2397             }
2398         });
2399     }
2400 
2401     /**
2402      * Maps {@code JTable.setSelectionBackground(Color)} through queue
2403      */
2404     public void setSelectionBackground(final Color color) {
2405         runMapping(new MapVoidAction("setSelectionBackground") {
2406             @Override
2407             public void map() {
2408                 ((JTable) getSource()).setSelectionBackground(color);
2409             }
2410         });
2411     }
2412 
2413     /**
2414      * Maps {@code JTable.setSelectionForeground(Color)} through queue
2415      */
2416     public void setSelectionForeground(final Color color) {
2417         runMapping(new MapVoidAction("setSelectionForeground") {
2418             @Override
2419             public void map() {
2420                 ((JTable) getSource()).setSelectionForeground(color);
2421             }
2422         });
2423     }
2424 
2425     /**
2426      * Maps {@code JTable.setSelectionMode(int)} through queue
2427      */
2428     public void setSelectionMode(final int i) {
2429         runMapping(new MapVoidAction("setSelectionMode") {
2430             @Override
2431             public void map() {
2432                 ((JTable) getSource()).setSelectionMode(i);
2433             }
2434         });
2435     }
2436 
2437     /**
2438      * Maps {@code JTable.setSelectionModel(ListSelectionModel)} through queue
2439      */
2440     public void setSelectionModel(final ListSelectionModel listSelectionModel) {
2441         runMapping(new MapVoidAction("setSelectionModel") {
2442             @Override
2443             public void map() {
2444                 ((JTable) getSource()).setSelectionModel(listSelectionModel);
2445             }
2446         });
2447     }
2448 
2449     /**
2450      * Maps {@code JTable.setShowGrid(boolean)} through queue
2451      */
2452     public void setShowGrid(final boolean b) {
2453         runMapping(new MapVoidAction("setShowGrid") {
2454             @Override
2455             public void map() {
2456                 ((JTable) getSource()).setShowGrid(b);
2457             }
2458         });
2459     }
2460 
2461     /**
2462      * Maps {@code JTable.setShowHorizontalLines(boolean)} through queue
2463      */
2464     public void setShowHorizontalLines(final boolean b) {
2465         runMapping(new MapVoidAction("setShowHorizontalLines") {
2466             @Override
2467             public void map() {
2468                 ((JTable) getSource()).setShowHorizontalLines(b);
2469             }
2470         });
2471     }
2472 
2473     /**
2474      * Maps {@code JTable.setShowVerticalLines(boolean)} through queue
2475      */
2476     public void setShowVerticalLines(final boolean b) {
2477         runMapping(new MapVoidAction("setShowVerticalLines") {
2478             @Override
2479             public void map() {
2480                 ((JTable) getSource()).setShowVerticalLines(b);
2481             }
2482         });
2483     }
2484 
2485     /**
2486      * Maps {@code JTable.setTableHeader(JTableHeader)} through queue
2487      */
2488     public void setTableHeader(final JTableHeader jTableHeader) {
2489         runMapping(new MapVoidAction("setTableHeader") {
2490             @Override
2491             public void map() {
2492                 ((JTable) getSource()).setTableHeader(jTableHeader);
2493             }
2494         });
2495     }
2496 
2497     /**
2498      * Maps {@code JTable.setUI(TableUI)} through queue
2499      */
2500     public void setUI(final TableUI tableUI) {
2501         runMapping(new MapVoidAction("setUI") {
2502             @Override
2503             public void map() {
2504                 ((JTable) getSource()).setUI(tableUI);
2505             }
2506         });
2507     }
2508 
2509     /**
2510      * Maps {@code JTable.setValueAt(Object, int, int)} through queue
2511      */
2512     public void setValueAt(final Object object, final int i, final int i1) {
2513         runMapping(new MapVoidAction("setValueAt") {
2514             @Override
2515             public void map() {
2516                 ((JTable) getSource()).setValueAt(object, i, i1);
2517             }
2518         });
2519     }
2520 
2521     /**
2522      * Maps {@code JTable.tableChanged(TableModelEvent)} through queue
2523      */
2524     public void tableChanged(final TableModelEvent tableModelEvent) {
2525         runMapping(new MapVoidAction("tableChanged") {
2526             @Override
2527             public void map() {
2528                 ((JTable) getSource()).tableChanged(tableModelEvent);
2529             }
2530         });
2531     }
2532 
2533     /**
2534      * Maps {@code JTable.valueChanged(ListSelectionEvent)} through queue
2535      */
2536     public void valueChanged(final ListSelectionEvent listSelectionEvent) {
2537         runMapping(new MapVoidAction("valueChanged") {
2538             @Override
2539             public void map() {
2540                 ((JTable) getSource()).valueChanged(listSelectionEvent);
2541             }
2542         });
2543     }
2544 
2545     //End of mapping                                      //
2546     ////////////////////////////////////////////////////////
2547     private Point findCell(String text, boolean ce, boolean ccs, int index) {
2548         return findCell(text, new DefaultStringComparator(ce, ccs), index);
2549     }
2550 
2551     /**
2552      * Iterface to choose table cell.
2553      */
2554     public interface TableCellChooser {
2555 
2556         /**
2557          * Should be true if item is good.
2558          *
2559          * @param oper Operator used to search item.
2560          * @param row Row be checked.
2561          * @param column Column be checked.
2562          * @return true if cell fits the criteria
2563          */
2564         public boolean checkCell(JTableOperator oper, int row, int column);
2565 
2566         /**
2567          * Item description.
2568          *
2569          * @return the description.
2570          */
2571         public String getDescription();
2572     }
2573 
2574     private static class BySubStringTableCellChooser implements TableCellChooser {
2575 
2576         String subString;
2577         StringComparator comparator;
2578 
2579         public BySubStringTableCellChooser(String subString, StringComparator comparator) {
2580             this.subString = subString;
2581             this.comparator = comparator;
2582         }
2583 
2584         @Override
2585         public boolean checkCell(JTableOperator oper, int row, int column) {
2586             Object value = ((JTable) oper.getSource()).getModel().getValueAt(row, column);
2587             return (comparator.equals((value != null)
2588                     ? value.toString()
2589                     : null,
2590                     subString));
2591         }
2592 
2593         @Override
2594         public String getDescription() {
2595             return "Cell containing \"" + subString + "\" string";
2596         }
2597 
2598         @Override
2599         public String toString() {
2600             return "BySubStringTableCellChooser{" + "subString=" + subString + ", comparator=" + comparator + '}';
2601         }
2602     }
2603 
2604     private static class ByRenderedComponentTableCellChooser implements TableCellChooser {
2605 
2606         ComponentChooser chooser;
2607 
2608         public ByRenderedComponentTableCellChooser(ComponentChooser chooser) {
2609             this.chooser = chooser;
2610         }
2611 
2612         @Override
2613         public boolean checkCell(JTableOperator oper, int row, int column) {
2614             return chooser.checkComponent(oper.getRenderedComponent(row, column));
2615         }
2616 
2617         @Override
2618         public String getDescription() {
2619             return chooser.getDescription();
2620         }
2621 
2622         @Override
2623         public String toString() {
2624             return "ByRenderedComponentTableCellChooser{" + "chooser=" + chooser + '}';
2625         }
2626     }
2627 
2628     /**
2629      * Allows to find component by cell text.
2630      */
2631     public static class JTableByCellFinder implements ComponentChooser {
2632 
2633         String label;
2634         int row;
2635         int column;
2636         StringComparator comparator;
2637 
2638         /**
2639          * Constructs JTableByCellFinder.
2640          *
2641          * @param lb a text pattern
2642          * @param r a row index to look in. If equal to -1, selected row is
2643          * checked.
2644          * @param c a column index to look in. If equal to -1, selected column
2645          * is checked.
2646          * @param comparator specifies string comparision algorithm.
2647          */
2648         public JTableByCellFinder(String lb, int r, int c, StringComparator comparator) {
2649             label = lb;
2650             row = r;
2651             column = c;
2652             this.comparator = comparator;
2653         }
2654 
2655         /**
2656          * Constructs JTableByCellFinder.
2657          *
2658          * @param lb a text pattern
2659          * @param r a row index to look in. If equal to -1, selected row is
2660          * checked.
2661          * @param c a column index to look in. If equal to -1, selected column
2662          * is checked.
2663          */
2664         public JTableByCellFinder(String lb, int r, int c) {
2665             this(lb, r, c, Operator.getDefaultStringComparator());
2666         }
2667 
2668         @Override
2669         public boolean checkComponent(Component comp) {
2670             if (comp instanceof JTable) {
2671                 if (label == null) {
2672                     return true;
2673                 }
2674                 if (((JTable) comp).getRowCount() > row && ((JTable) comp).getColumnCount() > column) {
2675                     int r = row;
2676                     if (r == -1) {
2677                         int[] rows = ((JTable) comp).getSelectedRows();
2678                         if (rows.length != 0) {
2679                             r = rows[0];
2680                         } else {
2681                             return false;
2682                         }
2683                     }
2684                     int c = column;
2685                     if (c == -1) {
2686                         int[] columns = ((JTable) comp).getSelectedColumns();
2687                         if (columns.length != 0) {
2688                             c = columns[0];
2689                         } else {
2690                             return false;
2691                         }
2692                     }
2693                     Object value = ((JTable) comp).getValueAt(r, c);
2694                     if (value == null) {
2695                         return false;
2696                     }
2697                     return (comparator.equals(value.toString(),
2698                             label));
2699                 }
2700             }
2701             return false;
2702         }
2703 
2704         @Override
2705         public String getDescription() {
2706             return ("JTable with text \"" + label + "\" in ("
2707                     + row + ", "
2708                     + column + ") cell");
2709         }
2710 
2711         @Override
2712         public String toString() {
2713             return "JTableByCellFinder{" + "label=" + label + ", row=" + row + ", column=" + column + ", comparator=" + comparator + '}';
2714         }
2715     }
2716 
2717     /**
2718      * Checks component type.
2719      */
2720     public static class JTableFinder extends Finder {
2721 
2722         /**
2723          * Constructs JTableFinder.
2724          *
2725          * @param sf other searching criteria.
2726          */
2727         public JTableFinder(ComponentChooser sf) {
2728             super(JTable.class, sf);
2729         }
2730 
2731         /**
2732          * Constructs JTableFinder.
2733          */
2734         public JTableFinder() {
2735             super(JTable.class);
2736         }
2737     }
2738 
2739     private class CellComponentWaiter extends Waiter<Component, Void> {
2740 
2741         private ComponentChooser chooser;
2742         private int row, column;
2743 
2744         public CellComponentWaiter(ComponentChooser chooser, int row, int column) {
2745             this.chooser = chooser;
2746             this.row = row;
2747             this.column = column;
2748         }
2749 
2750         @Override
2751         public Component actionProduced(Void obj) {
2752             Point pnt = getPointToClick(row, column);
2753             Component comp = getComponentAt(pnt.x, pnt.y);
2754             if (comp != null
2755                     && chooser.checkComponent(comp)) {
2756                 return comp;
2757             } else {
2758                 return null;
2759             }
2760         }
2761 
2762         @Override
2763         public String getDescription() {
2764             return chooser.getDescription();
2765         }
2766 
2767         @Override
2768         public String toString() {
2769             return "CellComponentWaiter{" + "chooser=" + chooser + ", row=" + row + ", column=" + column + '}';
2770         }
2771     }
2772 }