0001: /*
0002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0003: *
0004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
0005: *
0006: * The contents of this file are subject to the terms of either the GNU
0007: * General Public License Version 2 only ("GPL") or the Common
0008: * Development and Distribution License("CDDL") (collectively, the
0009: * "License"). You may not use this file except in compliance with the
0010: * License. You can obtain a copy of the License at
0011: * http://www.netbeans.org/cddl-gplv2.html
0012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
0013: * specific language governing permissions and limitations under the
0014: * License. When distributing the software, include this License Header
0015: * Notice in each file and include the License file at
0016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
0017: * particular file as subject to the "Classpath" exception as provided
0018: * by Sun in the GPL Version 2 section of the License file that
0019: * accompanied this code. If applicable, add the following below the
0020: * License Header, with the fields enclosed by brackets [] replaced by
0021: * your own identifying information:
0022: * "Portions Copyrighted [year] [name of copyright owner]"
0023: *
0024: * Contributor(s): Alexandre Iline.
0025: *
0026: * The Original Software is the Jemmy library.
0027: * The Initial Developer of the Original Software is Alexandre Iline.
0028: * All Rights Reserved.
0029: *
0030: * If you wish your version of this file to be governed by only the CDDL
0031: * or only the GPL Version 2, indicate your decision by adding
0032: * "[Contributor] elects to include this software in this distribution
0033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
0034: * single choice of license, a recipient has the option to distribute
0035: * your version of this file under either the CDDL, the GPL Version 2 or
0036: * to extend the choice of license to its licensees as provided above.
0037: * However, if you add GPL Version 2 code and therefore, elected the GPL
0038: * Version 2 license, then the option applies only if the new code is
0039: * made subject to such option by the copyright holder.
0040: *
0041: *
0042: *
0043: * $Id: JTableOperator.java,v 1.17 2007/10/05 11:35:19 jskrivanek Exp $ $Revision: 1.17 $ $Date: 2007/10/05 11:35:19 $
0044: *
0045: */
0046:
0047: package org.netbeans.jemmy.operators;
0048:
0049: import org.netbeans.jemmy.ComponentChooser;
0050: import org.netbeans.jemmy.ComponentSearcher;
0051: import org.netbeans.jemmy.JemmyException;
0052: import org.netbeans.jemmy.Outputable;
0053: import org.netbeans.jemmy.QueueTool;
0054: import org.netbeans.jemmy.TestOut;
0055: import org.netbeans.jemmy.Timeoutable;
0056: import org.netbeans.jemmy.TimeoutExpiredException;
0057: import org.netbeans.jemmy.Timeouts;
0058: import org.netbeans.jemmy.Waiter;
0059:
0060: import org.netbeans.jemmy.util.EmptyVisualizer;
0061:
0062: import org.netbeans.jemmy.drivers.DriverManager;
0063: import org.netbeans.jemmy.drivers.TableDriver;
0064:
0065: import java.awt.Color;
0066: import java.awt.Component;
0067: import java.awt.Container;
0068: import java.awt.Dimension;
0069: import java.awt.Point;
0070: import java.awt.Rectangle;
0071:
0072: import java.awt.event.KeyEvent;
0073:
0074: import java.util.EventObject;
0075: import java.util.Hashtable;
0076:
0077: import javax.swing.JPopupMenu;
0078: import javax.swing.JScrollPane;
0079: import javax.swing.JTable;
0080: import javax.swing.ListSelectionModel;
0081:
0082: import javax.swing.event.ChangeEvent;
0083: import javax.swing.event.ListSelectionEvent;
0084: import javax.swing.event.TableColumnModelEvent;
0085: import javax.swing.event.TableModelEvent;
0086:
0087: import javax.swing.plaf.TableUI;
0088:
0089: import javax.swing.table.JTableHeader;
0090: import javax.swing.table.TableCellEditor;
0091: import javax.swing.table.TableCellRenderer;
0092: import javax.swing.table.TableColumn;
0093: import javax.swing.table.TableColumnModel;
0094: import javax.swing.table.TableModel;
0095:
0096: import javax.swing.text.JTextComponent;
0097:
0098: /**
0099: * <BR><BR>Timeouts used: <BR>
0100: * JTableOperator.WaitEditingTimeout - time to wait cell editing<BR>
0101: * ComponentOperator.WaitComponentTimeout - time to wait component displayed <BR>
0102: * ComponentOperator.WaitStateTimeout - time to wait for cell contents <BR>
0103: * JTextComponentOperator.ChangeCaretPositionTimeout - maximum time to chenge caret position <BR>
0104: * JTextComponentOperator.TypeTextTimeout - maximum time to type text <BR>
0105: * JScrollBarOperator.WholeScrollTimeout - time for the whole scrolling <BR>.
0106: *
0107: * @see Timeouts
0108: *
0109: * @author Alexandre Iline (alexandre.iline@sun.com)
0110: *
0111: */
0112:
0113: public class JTableOperator extends JComponentOperator implements
0114: Outputable, Timeoutable {
0115:
0116: /**
0117: * Identifier for a "cell" property.
0118: * @see #getDump
0119: */
0120: public static final String CELL_PREFIX_DPROP = "Cell";
0121:
0122: /**
0123: * Identifier for a "column" property.
0124: * @see #getDump
0125: */
0126: public static final String COLUMN_PREFIX_DPROP = "Column";
0127:
0128: /**
0129: * Identifier for a "selected column" property.
0130: * @see #getDump
0131: */
0132: public static final String SELECTED_COLUMN_PREFIX_DPROP = "SelectedColumn";
0133:
0134: /**
0135: * Identifier for a "selected row" property.
0136: * @see #getDump
0137: */
0138: public static final String SELECTED_ROW_PREFIX_DPROP = "SelectedRow";
0139:
0140: /**
0141: * Identifier for a "column count" property.
0142: * @see #getDump
0143: */
0144: public static final String COLUMN_COUNT_DPROP = "Column count";
0145:
0146: /**
0147: * Identifier for a "row count" property.
0148: * @see #getDump
0149: */
0150: public static final String ROW_COUNT_DPROP = "Row count";
0151:
0152: private final static long WAIT_EDITING_TIMEOUT = 60000;
0153:
0154: private TestOut output;
0155: private Timeouts timeouts;
0156:
0157: TableDriver driver;
0158:
0159: /**
0160: * Constructor.
0161: * @param b a component
0162: */
0163: public JTableOperator(JTable b) {
0164: super (b);
0165: driver = DriverManager.getTableDriver(getClass());
0166: }
0167:
0168: /**
0169: * Constructs a JTableOperator object.
0170: * @param cont a container
0171: * @param chooser a component chooser specifying searching criteria.
0172: * @param index an index between appropriate ones.
0173: */
0174: public JTableOperator(ContainerOperator cont,
0175: ComponentChooser chooser, int index) {
0176: this ((JTable) cont.waitSubComponent(new JTableFinder(chooser),
0177: index));
0178: copyEnvironment(cont);
0179: }
0180:
0181: /**
0182: * Constructs a JTableOperator object.
0183: * @param cont a container
0184: * @param chooser a component chooser specifying searching criteria.
0185: */
0186: public JTableOperator(ContainerOperator cont,
0187: ComponentChooser chooser) {
0188: this (cont, chooser, 0);
0189: }
0190:
0191: /**
0192: * Constructor.
0193: * Waits by cell text first.
0194: * Uses cont's timeout and output for waiting and to init operator.
0195: * @param cont a container
0196: * @param text Text of a cell which is currently selected.
0197: * @param row a cell row to check.
0198: * @param column a cell row to check.
0199: * @param index Ordinal component index.
0200: * @see ComponentOperator#isCaptionEqual(String, String, boolean, boolean)
0201: * @throws TimeoutExpiredException
0202: */
0203: public JTableOperator(ContainerOperator cont, String text, int row,
0204: int column, int index) {
0205: this ((JTable) waitComponent(cont, new JTableByCellFinder(text,
0206: row, column, cont.getComparator()), index));
0207: copyEnvironment(cont);
0208: }
0209:
0210: /**
0211: * Constructor.
0212: * Waits by cell text first.
0213: * Uses cont's timeout and output for waiting and to init operator.
0214: * @param cont a container
0215: * @param text Text of a cell which is currently selected.
0216: * @param row a cell row to check.
0217: * @param column a cell row to check.
0218: * @see ComponentOperator#isCaptionEqual(String, String, boolean, boolean)
0219: * @throws TimeoutExpiredException
0220: */
0221: public JTableOperator(ContainerOperator cont, String text, int row,
0222: int column) {
0223: this (cont, text, row, column, 0);
0224: }
0225:
0226: /**
0227: * Constructor.
0228: * Waits by text in selected cell first.
0229: * Uses cont's timeout and output for waiting and to init operator.
0230: * @param cont a container
0231: * @param text Text of a cell which is currently selected.
0232: * @param index Ordinal component index.
0233: * @see ComponentOperator#isCaptionEqual(String, String, boolean, boolean)
0234: * @throws TimeoutExpiredException
0235: */
0236: public JTableOperator(ContainerOperator cont, String text, int index) {
0237: this (cont, text, -1, -1, index);
0238: }
0239:
0240: /**
0241: * Constructor.
0242: * Waits component in container first.
0243: * Uses cont's timeout and output for waiting and to init operator.
0244: * @param cont a container
0245: * @param text Text of a cell which is currently selected.
0246: * @see ComponentOperator#isCaptionEqual(String, String, boolean, boolean)
0247: * @throws TimeoutExpiredException
0248: */
0249: public JTableOperator(ContainerOperator cont, String text) {
0250: this (cont, text, 0);
0251: }
0252:
0253: /**
0254: * Constructor.
0255: * Waits component in container first.
0256: * Uses cont's timeout and output for waiting and to init operator.
0257: * @param cont a container
0258: * @param index Ordinal component index.
0259: * @throws TimeoutExpiredException
0260: */
0261: public JTableOperator(ContainerOperator cont, int index) {
0262: this ((JTable) waitComponent(cont, new JTableFinder(), index));
0263: copyEnvironment(cont);
0264: }
0265:
0266: /**
0267: * Constructor.
0268: * Waits component in container first.
0269: * Uses cont's timeout and output for waiting and to init operator.
0270: * @param cont a container
0271: * @throws TimeoutExpiredException
0272: */
0273: public JTableOperator(ContainerOperator cont) {
0274: this (cont, 0);
0275: }
0276:
0277: ////////////////////////////////////////////////////////
0278: //Static finds //
0279: ////////////////////////////////////////////////////////
0280:
0281: /**
0282: * Searches JTable in container.
0283: * @param cont Container to search component in.
0284: * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
0285: * @param index Ordinal component index.
0286: * @return JTable instance or null if component was not found.
0287: */
0288: public static JTable findJTable(Container cont,
0289: ComponentChooser chooser, int index) {
0290: return ((JTable) findComponent(cont, new JTableFinder(chooser),
0291: index));
0292: }
0293:
0294: /**
0295: * Searches 0'th JTable in container.
0296: * @param cont Container to search component in.
0297: * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
0298: * @return JTable instance or null if component was not found.
0299: */
0300: public static JTable findJTable(Container cont,
0301: ComponentChooser chooser) {
0302: return (findJTable(cont, chooser, 0));
0303: }
0304:
0305: /**
0306: * Searches JTable by cell.
0307: * @param cont Container to search component in.
0308: * @param text Item text. If null, contents is not checked.
0309: * @param ce Compare text exactly.
0310: * @param ccs Compare text case sensitively.
0311: * @param row Index of row to compare text. If -1, selected row is checked.
0312: * @param column Index of column to compare text. If -1, selected column is checked.
0313: * @param index Ordinal component index.
0314: * @return JTable instance or null if component was not found.
0315: * @see ComponentOperator#isCaptionEqual(String, String, boolean, boolean)
0316: */
0317: public static JTable findJTable(Container cont, String text,
0318: boolean ce, boolean ccs, int row, int column, int index) {
0319: return (findJTable(cont, new JTableByCellFinder(text, row,
0320: column, new DefaultStringComparator(ce, ccs)), index));
0321: }
0322:
0323: /**
0324: * Searches JTable by cell.
0325: * @param cont Container to search component in.
0326: * @param text Item text. If null, contents is not checked.
0327: * @param ce Compare text exactly.
0328: * @param ccs Compare text case sensitively.
0329: * @param row Index of row to compare text. If -1, selected row is checked.
0330: * @param column Index of column to compare text. If -1, selected column is checked.
0331: * @return JTable instance or null if component was not found.
0332: * @see ComponentOperator#isCaptionEqual(String, String, boolean, boolean)
0333: */
0334: public static JTable findJTable(Container cont, String text,
0335: boolean ce, boolean ccs, int row, int column) {
0336: return (findJTable(cont, text, ce, ccs, row, column, 0));
0337: }
0338:
0339: /**
0340: * Waits JTable in container.
0341: * @param cont Container to search component in.
0342: * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
0343: * @param index Ordinal component index.
0344: * @return JTable instance or null if component was not found.
0345: * @throws TimeoutExpiredException
0346: */
0347: public static JTable waitJTable(Container cont,
0348: ComponentChooser chooser, int index) {
0349: return ((JTable) waitComponent(cont, new JTableFinder(chooser),
0350: index));
0351: }
0352:
0353: /**
0354: * Waits 0'th JTable in container.
0355: * @param cont Container to search component in.
0356: * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
0357: * @return JTable instance or null if component was not found.
0358: * @throws TimeoutExpiredException
0359: */
0360: public static JTable waitJTable(Container cont,
0361: ComponentChooser chooser) {
0362: return (waitJTable(cont, chooser, 0));
0363: }
0364:
0365: /**
0366: * Waits JTable by cell.
0367: * @param cont Container to search component in.
0368: * @param text Item text. If null, contents is not checked.
0369: * @param ce Compare text exactly.
0370: * @param ccs Compare text case sensitively.
0371: * @param row Index of row to compare text. If -1, selected row is checked.
0372: * @param column Index of column to compare text. If -1, selected column is checked.
0373: * @param index Ordinal component index.
0374: * @return JTable instance or null if component was not found.
0375: * @see ComponentOperator#isCaptionEqual(String, String, boolean, boolean)
0376: * @throws TimeoutExpiredException
0377: */
0378: public static JTable waitJTable(Container cont, String text,
0379: boolean ce, boolean ccs, int row, int column, int index) {
0380: return (waitJTable(cont, new JTableByCellFinder(text, row,
0381: column, new DefaultStringComparator(ce, ccs)), index));
0382: }
0383:
0384: /**
0385: * Waits JTable by cell.
0386: * @param cont Container to search component in.
0387: * @param text Item text. If null, contents is not checked.
0388: * @param ce Compare text exactly.
0389: * @param ccs Compare text case sensitively.
0390: * @param row Index of row to compare text. If -1, selected row is checked.
0391: * @param column Index of column to compare text. If -1, selected column is checked.
0392: * @return JTable instance or null if component was not found.
0393: * @see ComponentOperator#isCaptionEqual(String, String, boolean, boolean)
0394: * @throws TimeoutExpiredException
0395: */
0396: public static JTable waitJTable(Container cont, String text,
0397: boolean ce, boolean ccs, int row, int column) {
0398: return (waitJTable(cont, text, ce, ccs, row, column, 0));
0399: }
0400:
0401: static {
0402: Timeouts.initDefault("JTableOperator.WaitEditingTimeout",
0403: WAIT_EDITING_TIMEOUT);
0404: }
0405:
0406: ////////////////////////////////////////////////////////
0407: //Environment //
0408: ////////////////////////////////////////////////////////
0409:
0410: public void setTimeouts(Timeouts times) {
0411: this .timeouts = times;
0412: super .setTimeouts(timeouts);
0413: }
0414:
0415: public Timeouts getTimeouts() {
0416: return (timeouts);
0417: }
0418:
0419: public void setOutput(TestOut out) {
0420: output = out;
0421: super .setOutput(output);
0422: }
0423:
0424: public TestOut getOutput() {
0425: return (output);
0426: }
0427:
0428: public void copyEnvironment(Operator anotherOperator) {
0429: super .copyEnvironment(anotherOperator);
0430: driver = (TableDriver) DriverManager.getDriver(
0431: DriverManager.TABLE_DRIVER_ID, getClass(),
0432: anotherOperator.getProperties());
0433: }
0434:
0435: ////////////////////////////////////////////////////////
0436: //Find methods //
0437: ////////////////////////////////////////////////////////
0438:
0439: //text, comparator and index
0440:
0441: /**
0442: * Searches cell coordinates.
0443: * @param text a text pattern
0444: * @param comparator a string comparision algorithm
0445: * @param index an ordinal cell index
0446: * @return Point indicating coordinates (x - column, y - row)
0447: */
0448: public Point findCell(String text, StringComparator comparator,
0449: int index) {
0450: return (findCell(new BySubStringTableCellChooser(text,
0451: comparator), index));
0452: }
0453:
0454: /**
0455: * Searches cell coordinates in the specified rows and columns.
0456: * @param text a text pattern
0457: * @param comparator a string comparision algorithm
0458: * @param rows rows to search in
0459: * @param columns columns to search in
0460: * @param index an ordinal cell index
0461: * @return Point indicating coordinates (x - column, y - row)
0462: */
0463: public Point findCell(String text, StringComparator comparator,
0464: int[] rows, int[] columns, int index) {
0465: return (findCell(new BySubStringTableCellChooser(text,
0466: comparator), rows, columns, index));
0467: }
0468:
0469: /**
0470: * Searches cell row index.
0471: * @param text a text pattern
0472: * @param comparator a string comparision algorithm
0473: * @param index an ordinal cell index
0474: * @return a row index.
0475: */
0476: public int findCellRow(String text, StringComparator comparator,
0477: int index) {
0478: return (findCell(text, comparator, index).y);
0479: }
0480:
0481: /**
0482: * Searches cell row index. Searching is performed between cells in one column.
0483: * @param text a text pattern
0484: * @param comparator a string comparision algorithm
0485: * @param column a column index to search in
0486: * @param index an ordinal cell index
0487: * @return a row index.
0488: */
0489: public int findCellRow(String text, StringComparator comparator,
0490: int column, int index) {
0491: return (findCell(text, comparator, null, new int[] { column },
0492: index).y);
0493: }
0494:
0495: /**
0496: * Searches cell column visible index.
0497: * @param text a text pattern
0498: * @param comparator a string comparision algorithm
0499: * @param index an ordinal cell index
0500: * @return a column index.
0501: */
0502: public int findCellColumn(String text, StringComparator comparator,
0503: int index) {
0504: return (findCell(text, comparator, index).x);
0505: }
0506:
0507: /**
0508: * Searches cell column index. Searching is performed between cells in one row.
0509: * @param text a text pattern
0510: * @param comparator a string comparision algorithm
0511: * @param row a row index to search in
0512: * @param index an ordinal cell index
0513: * @return a column index.
0514: */
0515: public int findCellColumn(String text, StringComparator comparator,
0516: int row, int index) {
0517: return (findCell(text, comparator, new int[] { row }, null,
0518: index).x);
0519: }
0520:
0521: //booleans - deprecated
0522:
0523: /**
0524: * Searches cell row by cell text.
0525: * @param text Text to search by.
0526: * @param ce Compare exactly.
0527: * @param ccs Compare case sensitively.
0528: * @param index Ordinal index in suitable cells.
0529: * @return a row index.
0530: * @see #findCellRow(String, int)
0531: * @deprecated Use findCellRow(String, int) or findCellRow(String, StringComparator, int)
0532: */
0533: public int findCellRow(String text, boolean ce, boolean ccs,
0534: int index) {
0535: return (findCell(text, ce, ccs, index).y);
0536: }
0537:
0538: /**
0539: * Searches cell column by cell text.
0540: * @param text Text to search by.
0541: * @param ce Compare exactly.
0542: * @param ccs Compare case sensitively.
0543: * @param index Ordinal index in suitable cells.
0544: * @return a column index.
0545: * @see #findCellColumn(String, int)
0546: * @deprecated Use findCellColumn(String, int) or findCellColumn(String, StringComparator, int)
0547: */
0548: public int findCellColumn(String text, boolean ce, boolean ccs,
0549: int index) {
0550: return (findCell(text, ce, ccs, index).x);
0551: }
0552:
0553: /**
0554: * Searches first cell row by cell text.
0555: * @param text Text to search by.
0556: * @param ce Compare exactly.
0557: * @param ccs Compare case sensitively.
0558: * @return a row index.
0559: * @see #findCellRow(String)
0560: * @deprecated Use findCellRow(String) or findCellRow(String, StringComparator)
0561: */
0562: public int findCellRow(String text, boolean ce, boolean ccs) {
0563: return (findCellRow(text, ce, ccs, 0));
0564: }
0565:
0566: /**
0567: * Searches first cell column by cell text.
0568: * @param text Text to search by.
0569: * @param ce Compare exactly.
0570: * @param ccs Compare case sensitively.
0571: * @return a column index.
0572: * @see #findCellColumn(String)
0573: * @deprecated Use findCellColumn(String) or findCellColumn(String, StringComparator)
0574: */
0575: public int findCellColumn(String text, boolean ce, boolean ccs) {
0576: return (findCellColumn(text, ce, ccs, 0));
0577: }
0578:
0579: //text and comparator only
0580:
0581: /**
0582: * Searches cell row index.
0583: * @param text a text pattern
0584: * @param comparator a string comparision algorithm
0585: * @return a row index.
0586: */
0587: public int findCellRow(String text, StringComparator comparator) {
0588: return (findCellRow(text, comparator, 0));
0589: }
0590:
0591: /**
0592: * Searches cell column visible index.
0593: * @param text a text pattern
0594: * @param comparator a string comparision algorithm
0595: * @return a column index.
0596: */
0597: public int findCellColumn(String text, StringComparator comparator) {
0598: return (findCellColumn(text, comparator, 0));
0599: }
0600:
0601: //text and index
0602:
0603: /**
0604: * Searches cell row by cell text.
0605: * @param text Text to search by.
0606: * @param index Ordinal index in suitable cells.
0607: * @return a row index.
0608: */
0609: public int findCellRow(String text, int index) {
0610: return (findCell(text, index).y);
0611: }
0612:
0613: /**
0614: * Searches cell row index. Searching is performed between cells in one column.
0615: * @param text a text pattern
0616: * @param column a column index to search in
0617: * @param index Ordinal index in suitable cells.
0618: * @return a row index.
0619: */
0620: public int findCellRow(String text, int column, int index) {
0621: return (findCell(text, null, new int[] { column }, index).y);
0622: }
0623:
0624: /**
0625: * Searches cell column by cell text.
0626: * @param text Text to search by.
0627: * @param index Ordinal index in suitable cells.
0628: * @return a column index.
0629: */
0630: public int findCellColumn(String text, int index) {
0631: return (findCell(text, index).x);
0632: }
0633:
0634: /**
0635: * Searches cell column index. Searching is performed between cells in one row.
0636: * @param text a text pattern
0637: * @param row a row index to search in
0638: * @param index Ordinal index in suitable cells.
0639: * @return a column index.
0640: */
0641: public int findCellColumn(String text, int row, int index) {
0642: return (findCell(text, new int[] { row }, null, index).x);
0643: }
0644:
0645: /**
0646: * Searches cell coordinates.
0647: * @param text a text pattern
0648: * @param index an ordinal cell index
0649: * @return Point indicating coordinates (x - column, y - row)
0650: */
0651: public Point findCell(String text, int index) {
0652: return (findCell(text, getComparator(), index));
0653: }
0654:
0655: /**
0656: * Searches cell coordinates in the specified rows and columns.
0657: * @param text a text pattern
0658: * @param rows rows to search in
0659: * @param columns columns to search in
0660: * @param index an ordinal cell index
0661: * @return Point indicating coordinates (x - column, y - row)
0662: */
0663: public Point findCell(String text, int[] rows, int[] columns,
0664: int index) {
0665: return (findCell(new BySubStringTableCellChooser(text,
0666: getComparator()), rows, columns, index));
0667: }
0668:
0669: //text only
0670:
0671: /**
0672: * Searches first cell row by cell text.
0673: * @param text Text to search by.
0674: * @return a row index.
0675: */
0676: public int findCellRow(String text) {
0677: return (findCellRow(text, 0));
0678: }
0679:
0680: /**
0681: * Searches first cell column by cell text.
0682: * @param text Text to search by.
0683: * @return a column index.
0684: */
0685: public int findCellColumn(String text) {
0686: return (findCellColumn(text, 0));
0687: }
0688:
0689: //component chooser and index
0690:
0691: /**
0692: * Searches cell row by rendered component.
0693: * @param chooser Component verifying object.
0694: * @param index Ordinal index in suitable cells.
0695: * @return a row index.
0696: */
0697: public int findCellRow(ComponentChooser chooser, int index) {
0698: return (findCell(chooser, index).y);
0699: }
0700:
0701: /**
0702: * Searches cell row index. Searching is performed between cells in one column.
0703: * @param chooser Component verifying object.
0704: * @param column a column index to search in
0705: * @param index Ordinal index in suitable cells.
0706: * @return a row index.
0707: */
0708: public int findCellRow(ComponentChooser chooser, int column,
0709: int index) {
0710: return (findCell(chooser, null, new int[] { column }, index).y);
0711: }
0712:
0713: /**
0714: * Searches cell column by rendered component.
0715: * @param chooser Component verifying object.
0716: * @param index Ordinal index in suitable cells.
0717: * @return a column index.
0718: */
0719: public int findCellColumn(ComponentChooser chooser, int index) {
0720: return (findCell(chooser, index).x);
0721: }
0722:
0723: /**
0724: * Searches cell column index. Searching is performed between cells in one row.
0725: * @param chooser Component verifying object.
0726: * @param row a row index to search in
0727: * @param index Ordinal index in suitable cells.
0728: * @return a column index.
0729: */
0730: public int findCellColumn(ComponentChooser chooser, int row,
0731: int index) {
0732: return (findCell(chooser, new int[] { row }, null, index).x);
0733: }
0734:
0735: /**
0736: * Searches cell coordinates.
0737: * @param chooser Component verifying object.
0738: * @param index an ordinal cell index
0739: * @return Point indicating coordinates (x - column, y - row)
0740: */
0741: public Point findCell(ComponentChooser chooser, int index) {
0742: return (findCell(new ByRenderedComponentTableCellChooser(
0743: chooser), index));
0744: }
0745:
0746: /**
0747: * Searches cell coordinates.
0748: * @param chooser Component verifying object.
0749: * @param rows rows to search in
0750: * @param columns columns to search in
0751: * @param index an ordinal cell index
0752: * @return Point indicating coordinates (x - column, y - row)
0753: */
0754: public Point findCell(ComponentChooser chooser, int[] rows,
0755: int[] columns, int index) {
0756: return (findCell(new ByRenderedComponentTableCellChooser(
0757: chooser), rows, columns, index));
0758: }
0759:
0760: //component chooser only
0761:
0762: /**
0763: * Searches cell row by rendered component.
0764: * @param chooser Component verifying object.
0765: * @return a row index.
0766: */
0767: public int findCellRow(ComponentChooser chooser) {
0768: return (findCellRow(chooser, 0));
0769: }
0770:
0771: /**
0772: * Searches cell column by rendered component.
0773: * @param chooser Component verifying object.
0774: * @return a column index.
0775: */
0776: public int findCellColumn(ComponentChooser chooser) {
0777: return (findCellColumn(chooser, 0));
0778: }
0779:
0780: /**
0781: * Searches cell coordinates.
0782: * @param chooser Component verifying object.
0783: * @return Point indicating coordinates (x - column, y - row)
0784: */
0785: public Point findCell(ComponentChooser chooser) {
0786: return (findCell(chooser, 0));
0787: }
0788:
0789: //cell chooser and index
0790:
0791: /**
0792: * Searches cell row by TableCellChooser.
0793: * @param chooser Cell verifying object.
0794: * @param index Ordinal index in suitable cells.
0795: * @return a row index.
0796: */
0797: public int findCellRow(TableCellChooser chooser, int index) {
0798: return (findCell(chooser, index).y);
0799: }
0800:
0801: /**
0802: * Searches cell row index. Searching is performed between cells in one column.
0803: * @param chooser Cell verifying object.
0804: * @param column a column index to search in
0805: * @param index Ordinal index in suitable cells.
0806: * @return a row index.
0807: */
0808: public int findCellRow(TableCellChooser chooser, int column,
0809: int index) {
0810: return (findCell(chooser, null, new int[] { column }, index).y);
0811: }
0812:
0813: /**
0814: * Searches cell column by TableCellChooser.
0815: * @param chooser ComponentCell verifying object.
0816: * @param index Ordinal index in suitable cells.
0817: * @return a column index.
0818: */
0819: public int findCellColumn(TableCellChooser chooser, int index) {
0820: return (findCell(chooser, index).x);
0821: }
0822:
0823: /**
0824: * Searches cell column index. Searching is performed between cells in one row.
0825: * @param chooser Cell verifying object.
0826: * @param row a row index to search in
0827: * @param index Ordinal index in suitable cells.
0828: * @return a column index.
0829: */
0830: public int findCellColumn(TableCellChooser chooser, int row,
0831: int index) {
0832: return (findCell(chooser, new int[] { row }, null, index).x);
0833: }
0834:
0835: /**
0836: * Searches cell coordinates.
0837: * @param chooser cell verifying object.
0838: * @param index an ordinal cell index
0839: * @return Point indicating coordinates (x - column, y - row)
0840: */
0841: public Point findCell(TableCellChooser chooser, int index) {
0842: return (findCell(chooser, null, null, index));
0843: }
0844:
0845: /**
0846: * Searches cell coordinates in the specified rows and columns.
0847: * @param chooser cell verifying object.
0848: * @param rows rows to search in
0849: * @param columns columns to search in
0850: * @param index an ordinal cell index
0851: * @return Point indicating coordinates (x - column, y - row)
0852: */
0853: public Point findCell(TableCellChooser chooser, int[] rows,
0854: int[] columns, int index) {
0855: TableModel model = getModel();
0856: int[] realRows;
0857: if (rows != null) {
0858: realRows = rows;
0859: } else {
0860: realRows = new int[model.getRowCount()];
0861: for (int i = 0; i < model.getRowCount(); i++) {
0862: realRows[i] = i;
0863: }
0864: }
0865: int[] realColumns;
0866: if (columns != null) {
0867: realColumns = columns;
0868: } else {
0869: realColumns = new int[model.getColumnCount()];
0870: for (int i = 0; i < model.getColumnCount(); i++) {
0871: realColumns[i] = i;
0872: }
0873: }
0874: int count = 0;
0875: for (int i = 0; i < realRows.length; i++) {
0876: for (int j = 0; j < realColumns.length; j++) {
0877: if (chooser
0878: .checkCell(this , realRows[i], realColumns[j])) {
0879: if (count == index) {
0880: return (new Point(realColumns[j], realRows[i]));
0881: } else {
0882: count++;
0883: }
0884: }
0885: }
0886: }
0887: return (new Point(-1, -1));
0888: }
0889:
0890: //cell chooser only
0891:
0892: /**
0893: * Searches cell row by TableCellChooser.
0894: * @param chooser Cell verifying object.
0895: * @return a row index.
0896: */
0897: public int findCellRow(TableCellChooser chooser) {
0898: return (findCellRow(chooser, 0));
0899: }
0900:
0901: /**
0902: * Searches cell column by TableCellChooser.
0903: * @param chooser Cell verifying object.
0904: * @return a column index.
0905: */
0906: public int findCellColumn(TableCellChooser chooser) {
0907: return (findCellColumn(chooser, 0));
0908: }
0909:
0910: /**
0911: * Searches cell coordinates.
0912: * @param chooser cell verifying object.
0913: * @return Point indicating coordinates (x - column, y - row)
0914: */
0915: public Point findCell(TableCellChooser chooser) {
0916: return (findCell(chooser, 0));
0917: }
0918:
0919: ////////////////////////////////////////////////////////
0920: //Actions //
0921: ////////////////////////////////////////////////////////
0922:
0923: /**
0924: * Does mouse click on the cell.
0925: * @param row a row index
0926: * @param column a column index
0927: * @param clickCount a number of clicks
0928: * @param button a mouse button (value of InputEvent.BUTTON*_MASK field)
0929: * @param modifiers Modifiers (combination of InputEvent.*_MASK values)
0930: */
0931: public void clickOnCell(final int row, final int column,
0932: final int clickCount, final int button, final int modifiers) {
0933: output.printLine("Click on (" + Integer.toString(row) + ", "
0934: + Integer.toString(column) + ") cell");
0935: output.printGolden("Click on cell");
0936: makeComponentVisible();
0937: scrollToCell(row, column);
0938: getQueueTool().invokeSmoothly(
0939: new QueueTool.QueueAction("Path selecting") {
0940: public Object launch() {
0941: Point point = getPointToClick(row, column);
0942: clickMouse(point.x, point.y, clickCount,
0943: button, modifiers);
0944: return (null);
0945: }
0946: });
0947: }
0948:
0949: /**
0950: * Does mouse click on the cell with no modifiers.
0951: * @param row a row index
0952: * @param column a column index
0953: * @param clickCount a number of clicks
0954: * @param button a mouse button (value of InputEvent.BUTTON*_MASK field)
0955: */
0956: public void clickOnCell(int row, int column, int clickCount,
0957: int button) {
0958: clickOnCell(row, column, clickCount, button, 0);
0959: }
0960:
0961: /**
0962: * Does mouse click on the cell by default mouse button with no modifiers.
0963: * @param row a row index
0964: * @param column a column index
0965: * @param clickCount a number of clicks
0966: */
0967: public void clickOnCell(int row, int column, int clickCount) {
0968: clickOnCell(row, column, clickCount, getDefaultMouseButton());
0969: }
0970:
0971: /**
0972: * Does single mouse click on the cell.
0973: * @param row a row index
0974: * @param column a column index
0975: */
0976: public void clickOnCell(int row, int column) {
0977: clickOnCell(row, column, 1);
0978: }
0979:
0980: /**
0981: * Double clicks on cell to turns it to the editing mode.
0982: * @param row a row index
0983: * @param column a column index
0984: * @throws TimeoutExpiredException
0985: */
0986: public void clickForEdit(int row, int column) {
0987: clickOnCell(row, column, 2);
0988: }
0989:
0990: /**
0991: * Changes text of the cell pointed by row and column indexes.
0992: * @param row a row index
0993: * @param column a column index
0994: * @param newText a text to enter
0995: * @deprecated Use changeCellObject(int, int, Object) instead.
0996: * @see #changeCellObject(int, int, Object)
0997: * @throws TimeoutExpiredException
0998: */
0999: public void changeCellText(int row, int column, String newText) {
1000: changeCellObject(row, column, newText);
1001: }
1002:
1003: /**
1004: * Changes value of the cell pointed by row and column indexes.
1005: * uses editor defined by setCellEditor method.
1006: * @param row a row index
1007: * @param column a column index
1008: * @param newValue an object to chenge cell value to.
1009: * @throws TimeoutExpiredException
1010: */
1011: public void changeCellObject(int row, int column, Object newValue) {
1012: driver.editCell(this , row, column, newValue);
1013: }
1014:
1015: /**
1016: * Scrolls to a cell if the table lies on a JScrollPane component.
1017: * @param row a row index
1018: * @param column a column index
1019: * @throws TimeoutExpiredException
1020: */
1021: public void scrollToCell(int row, int column) {
1022: output.printTrace("Scroll JTable to (" + Integer.toString(row)
1023: + "," + Integer.toString(column) + ") cell\n : "
1024: + toStringSource());
1025: output.printGolden("Scroll JTable to (" + Integer.toString(row)
1026: + "," + Integer.toString(column) + ")");
1027: makeComponentVisible();
1028: //try to find JScrollPane under.
1029: JScrollPane scroll = (JScrollPane) getContainer(new JScrollPaneOperator.JScrollPaneFinder(
1030: ComponentSearcher.getTrueChooser("JScrollPane")));
1031: if (scroll == null) {
1032: return;
1033: }
1034: JScrollPaneOperator scroller = new JScrollPaneOperator(scroll);
1035: scroller.copyEnvironment(this );
1036: scroller.setVisualizer(new EmptyVisualizer());
1037: Rectangle rect = getCellRect(row, column, false);
1038: scroller.scrollToComponentRectangle(getSource(), (int) rect
1039: .getX(), (int) rect.getY(), (int) rect.getWidth(),
1040: (int) rect.getHeight());
1041: }
1042:
1043: /**
1044: * Selects a specified cell.
1045: * @param row a row index
1046: * @param column a column index
1047: */
1048: public void selectCell(int row, int column) {
1049: driver.selectCell(this , row, column);
1050: }
1051:
1052: /**
1053: * Searches a column by name.
1054: * @param name a text pattern
1055: * @param comparator a string comparision algorithm
1056: * @return a column index
1057: */
1058: public int findColumn(String name, StringComparator comparator) {
1059: int columnCount = getColumnCount();
1060: for (int i = 0; i < columnCount; i++) {
1061: if (comparator.equals(getColumnName(i), name)) {
1062: return (i);
1063: }
1064: }
1065: return (-1);
1066: }
1067:
1068: /**
1069: * Searches a column by name.
1070: * @param name a text pattern
1071: * @return a column index
1072: */
1073: public int findColumn(String name) {
1074: return (findColumn(name, getComparator()));
1075: }
1076:
1077: /**
1078: * Calls popup menu on specified cell.
1079: * @param row a row index
1080: * @param column a column index
1081: * @return the menu
1082: */
1083: public JPopupMenu callPopupOnCell(int row, int column) {
1084: output.printLine("Call popup on (" + row + ", " + column
1085: + ") cell");
1086: output.printGolden("Call popup on cell");
1087: makeComponentVisible();
1088: Point point = getPointToClick(row, column);
1089: return (JPopupMenuOperator.callPopup(getSource(), (int) point
1090: .getX(), (int) point.getY(), getPopupMouseButton()));
1091: }
1092:
1093: ////////////////////////////////////////////////////////
1094: //Gets //
1095: ////////////////////////////////////////////////////////
1096:
1097: /**
1098: * Ask renderer for component to be displayed.
1099: * @param row cell row index.
1100: * @param column cell column visible index.
1101: * @param isSelected True if the specified cell was selected.
1102: * @param cellHasFocus True if the specified cell has the focus.
1103: * @return Component to be displayed.
1104: */
1105: public Component getRenderedComponent(int row, int column,
1106: boolean isSelected, boolean cellHasFocus) {
1107: return (getCellRenderer(row, column)
1108: .getTableCellRendererComponent((JTable) getSource(),
1109: getValueAt(row, column), isSelected,
1110: cellHasFocus, row, column));
1111: }
1112:
1113: /**
1114: * Ask renderer for component to be displayed.
1115: * Uses isCellSelected(itemIndex) to determine whether cell is selected.
1116: * Supposes item do not have focus.
1117: * @param row cell row index.
1118: * @param column cell column visible index.
1119: * @return Component to be displayed.
1120: */
1121: public Component getRenderedComponent(int row, int column) {
1122: return (getRenderedComponent(row, column, isCellSelected(row,
1123: column), false));
1124: }
1125:
1126: /**
1127: * Returns a point at the center of the cell rectangle.
1128: * @param row a row index
1129: * @param column a column index
1130: * @return a Point in component's coordinate system.
1131: */
1132: public Point getPointToClick(int row, int column) {
1133: Rectangle rect = getCellRect(row, column, false);
1134: return (new Point((int) (rect.getX() + rect.getWidth() / 2),
1135: (int) (rect.getY() + rect.getHeight() / 2)));
1136: }
1137:
1138: /**
1139: * Creates an operator for a teble header assigned to this table.
1140: * @return an JTableHeaderOperator operator
1141: */
1142: public JTableHeaderOperator getHeaderOperator() {
1143: return (new JTableHeaderOperator(getTableHeader()));
1144: }
1145:
1146: /**
1147: * Waits for an editor.
1148: * @param chooser a chhoser specifying criteria to distinguish cell editor.
1149: * @param row a row index
1150: * @param column a column index
1151: * @return a component displayed over the cell and fitting the criteria specified by <code>chooser</code>
1152: */
1153: public Component waitCellComponent(ComponentChooser chooser,
1154: int row, int column) {
1155: CellComponentWaiter waiter = new CellComponentWaiter(chooser,
1156: row, column);
1157: waiter.setOutput(getOutput());
1158: waiter.setTimeouts(getTimeouts().cloneThis());
1159: waiter.getTimeouts().setTimeout(
1160: "Waiter.WaitingTime",
1161: getTimeouts().getTimeout(
1162: "JTableOperator.WaitEditingTimeout"));
1163: try {
1164: return ((Component) waiter.waitAction(null));
1165: } catch (InterruptedException e) {
1166: throw (new JemmyException("Waiting has been interrupted", e));
1167: }
1168: }
1169:
1170: /**
1171: * Waits for certain cell contents.
1172: * @param cellText Text comparing to cell text by <code>getComparator()</code> comparator.
1173: * @param row cell row index. If -1, selected one is checked.
1174: * @param column cell column visible index. If -1, selected one is checked.
1175: */
1176: public void waitCell(String cellText, int row, int column) {
1177: getOutput().printLine(
1178: "Wait \"" + cellText + "\" text at ("
1179: + Integer.toString(row) + ","
1180: + Integer.toString(column) + ")"
1181: + " position in component \n : "
1182: + toStringSource());
1183: getOutput().printGolden(
1184: "Wait \"" + cellText + "\" text at ("
1185: + Integer.toString(row) + ","
1186: + Integer.toString(column) + ")" + " position");
1187: waitState(new JTableByCellFinder(cellText, row, column,
1188: getComparator()));
1189: }
1190:
1191: /**
1192: * Returns information about component.
1193: */
1194: public Hashtable getDump() {
1195: Hashtable result = super .getDump();
1196: TableModel model = ((JTable) getSource()).getModel();
1197: int colCount = model.getColumnCount();
1198: int rowCount = model.getRowCount();
1199: String[][] items = new String[rowCount][colCount];
1200: for (int i = 0; i < rowCount; i++) {
1201: for (int j = 0; j < colCount; j++) {
1202: if (model.getValueAt(i, j) != null) {
1203: items[i][j] = model.getValueAt(i, j).toString();
1204: } else {
1205: items[i][j] = "null";
1206: }
1207: }
1208: }
1209: addToDump(result, CELL_PREFIX_DPROP, items);
1210: String[] columns = new String[colCount];
1211: for (int j = 0; j < colCount; j++) {
1212: columns[j] = ((JTable) getSource()).getColumnName(j);
1213: }
1214: addToDump(result, COLUMN_PREFIX_DPROP, columns);
1215: int[] selColNums = ((JTable) getSource()).getSelectedColumns();
1216: String[] selColumns = new String[selColNums.length];
1217: for (int j = 0; j < selColNums.length; j++) {
1218: selColumns[j] = Integer.toString(selColNums[j]);
1219: }
1220: addToDump(result, SELECTED_COLUMN_PREFIX_DPROP, selColumns);
1221: int[] selRowNums = ((JTable) getSource()).getSelectedRows();
1222: String[] selRows = new String[selRowNums.length];
1223: for (int i = 0; i < selRowNums.length; i++) {
1224: selRows[i] = Integer.toString(selRowNums[i]);
1225: }
1226: addToDump(result, SELECTED_ROW_PREFIX_DPROP, selRows);
1227: result.put(COLUMN_COUNT_DPROP, Integer.toString(colCount));
1228: result.put(ROW_COUNT_DPROP, Integer.toString(rowCount));
1229: return (result);
1230: }
1231:
1232: ////////////////////////////////////////////////////////
1233: //Mapping //
1234:
1235: /**Maps <code>JTable.addColumn(TableColumn)</code> through queue*/
1236: public void addColumn(final TableColumn tableColumn) {
1237: runMapping(new MapVoidAction("addColumn") {
1238: public void map() {
1239: ((JTable) getSource()).addColumn(tableColumn);
1240: }
1241: });
1242: }
1243:
1244: /**Maps <code>JTable.addColumnSelectionInterval(int, int)</code> through queue*/
1245: public void addColumnSelectionInterval(final int i, final int i1) {
1246: runMapping(new MapVoidAction("addColumnSelectionInterval") {
1247: public void map() {
1248: ((JTable) getSource())
1249: .addColumnSelectionInterval(i, i1);
1250: }
1251: });
1252: }
1253:
1254: /**Maps <code>JTable.addRowSelectionInterval(int, int)</code> through queue*/
1255: public void addRowSelectionInterval(final int i, final int i1) {
1256: runMapping(new MapVoidAction("addRowSelectionInterval") {
1257: public void map() {
1258: ((JTable) getSource()).addRowSelectionInterval(i, i1);
1259: }
1260: });
1261: }
1262:
1263: /**Maps <code>JTable.clearSelection()</code> through queue*/
1264: public void clearSelection() {
1265: runMapping(new MapVoidAction("clearSelection") {
1266: public void map() {
1267: ((JTable) getSource()).clearSelection();
1268: }
1269: });
1270: }
1271:
1272: /**Maps <code>JTable.columnAdded(TableColumnModelEvent)</code> through queue*/
1273: public void columnAdded(
1274: final TableColumnModelEvent tableColumnModelEvent) {
1275: runMapping(new MapVoidAction("columnAdded") {
1276: public void map() {
1277: ((JTable) getSource())
1278: .columnAdded(tableColumnModelEvent);
1279: }
1280: });
1281: }
1282:
1283: /**Maps <code>JTable.columnAtPoint(Point)</code> through queue*/
1284: public int columnAtPoint(final Point point) {
1285: return (runMapping(new MapIntegerAction("columnAtPoint") {
1286: public int map() {
1287: return (((JTable) getSource()).columnAtPoint(point));
1288: }
1289: }));
1290: }
1291:
1292: /**Maps <code>JTable.columnMarginChanged(ChangeEvent)</code> through queue*/
1293: public void columnMarginChanged(final ChangeEvent changeEvent) {
1294: runMapping(new MapVoidAction("columnMarginChanged") {
1295: public void map() {
1296: ((JTable) getSource()).columnMarginChanged(changeEvent);
1297: }
1298: });
1299: }
1300:
1301: /**Maps <code>JTable.columnMoved(TableColumnModelEvent)</code> through queue*/
1302: public void columnMoved(
1303: final TableColumnModelEvent tableColumnModelEvent) {
1304: runMapping(new MapVoidAction("columnMoved") {
1305: public void map() {
1306: ((JTable) getSource())
1307: .columnMoved(tableColumnModelEvent);
1308: }
1309: });
1310: }
1311:
1312: /**Maps <code>JTable.columnRemoved(TableColumnModelEvent)</code> through queue*/
1313: public void columnRemoved(
1314: final TableColumnModelEvent tableColumnModelEvent) {
1315: runMapping(new MapVoidAction("columnRemoved") {
1316: public void map() {
1317: ((JTable) getSource())
1318: .columnRemoved(tableColumnModelEvent);
1319: }
1320: });
1321: }
1322:
1323: /**Maps <code>JTable.columnSelectionChanged(ListSelectionEvent)</code> through queue*/
1324: public void columnSelectionChanged(
1325: final ListSelectionEvent listSelectionEvent) {
1326: runMapping(new MapVoidAction("columnSelectionChanged") {
1327: public void map() {
1328: ((JTable) getSource())
1329: .columnSelectionChanged(listSelectionEvent);
1330: }
1331: });
1332: }
1333:
1334: /**Maps <code>JTable.convertColumnIndexToModel(int)</code> through queue*/
1335: public int convertColumnIndexToModel(final int i) {
1336: return (runMapping(new MapIntegerAction(
1337: "convertColumnIndexToModel") {
1338: public int map() {
1339: return (((JTable) getSource())
1340: .convertColumnIndexToModel(i));
1341: }
1342: }));
1343: }
1344:
1345: /**Maps <code>JTable.convertColumnIndexToView(int)</code> through queue*/
1346: public int convertColumnIndexToView(final int i) {
1347: return (runMapping(new MapIntegerAction(
1348: "convertColumnIndexToView") {
1349: public int map() {
1350: return (((JTable) getSource())
1351: .convertColumnIndexToView(i));
1352: }
1353: }));
1354: }
1355:
1356: /**Maps <code>JTable.createDefaultColumnsFromModel()</code> through queue*/
1357: public void createDefaultColumnsFromModel() {
1358: runMapping(new MapVoidAction("createDefaultColumnsFromModel") {
1359: public void map() {
1360: ((JTable) getSource()).createDefaultColumnsFromModel();
1361: }
1362: });
1363: }
1364:
1365: /**Maps <code>JTable.editCellAt(int, int)</code> through queue*/
1366: public boolean editCellAt(final int i, final int i1) {
1367: return (runMapping(new MapBooleanAction("editCellAt") {
1368: public boolean map() {
1369: return (((JTable) getSource()).editCellAt(i, i1));
1370: }
1371: }));
1372: }
1373:
1374: /**Maps <code>JTable.editCellAt(int, int, EventObject)</code> through queue*/
1375: public boolean editCellAt(final int i, final int i1,
1376: final EventObject eventObject) {
1377: return (runMapping(new MapBooleanAction("editCellAt") {
1378: public boolean map() {
1379: return (((JTable) getSource()).editCellAt(i, i1,
1380: eventObject));
1381: }
1382: }));
1383: }
1384:
1385: /**Maps <code>JTable.editingCanceled(ChangeEvent)</code> through queue*/
1386: public void editingCanceled(final ChangeEvent changeEvent) {
1387: runMapping(new MapVoidAction("editingCanceled") {
1388: public void map() {
1389: ((JTable) getSource()).editingCanceled(changeEvent);
1390: }
1391: });
1392: }
1393:
1394: /**Maps <code>JTable.editingStopped(ChangeEvent)</code> through queue*/
1395: public void editingStopped(final ChangeEvent changeEvent) {
1396: runMapping(new MapVoidAction("editingStopped") {
1397: public void map() {
1398: ((JTable) getSource()).editingStopped(changeEvent);
1399: }
1400: });
1401: }
1402:
1403: /**Maps <code>JTable.getAutoCreateColumnsFromModel()</code> through queue*/
1404: public boolean getAutoCreateColumnsFromModel() {
1405: return (runMapping(new MapBooleanAction(
1406: "getAutoCreateColumnsFromModel") {
1407: public boolean map() {
1408: return (((JTable) getSource())
1409: .getAutoCreateColumnsFromModel());
1410: }
1411: }));
1412: }
1413:
1414: /**Maps <code>JTable.getAutoResizeMode()</code> through queue*/
1415: public int getAutoResizeMode() {
1416: return (runMapping(new MapIntegerAction("getAutoResizeMode") {
1417: public int map() {
1418: return (((JTable) getSource()).getAutoResizeMode());
1419: }
1420: }));
1421: }
1422:
1423: /**Maps <code>JTable.getCellEditor()</code> through queue*/
1424: public TableCellEditor getCellEditor() {
1425: return ((TableCellEditor) runMapping(new MapAction(
1426: "getCellEditor") {
1427: public Object map() {
1428: return (((JTable) getSource()).getCellEditor());
1429: }
1430: }));
1431: }
1432:
1433: /**Maps <code>JTable.getCellEditor(int, int)</code> through queue*/
1434: public TableCellEditor getCellEditor(final int i, final int i1) {
1435: return ((TableCellEditor) runMapping(new MapAction(
1436: "getCellEditor") {
1437: public Object map() {
1438: return (((JTable) getSource()).getCellEditor(i, i1));
1439: }
1440: }));
1441: }
1442:
1443: /**Maps <code>JTable.getCellRect(int, int, boolean)</code> through queue*/
1444: public Rectangle getCellRect(final int i, final int i1,
1445: final boolean b) {
1446: return ((Rectangle) runMapping(new MapAction("getCellRect") {
1447: public Object map() {
1448: return (((JTable) getSource()).getCellRect(i, i1, b));
1449: }
1450: }));
1451: }
1452:
1453: /**Maps <code>JTable.getCellRenderer(int, int)</code> through queue*/
1454: public TableCellRenderer getCellRenderer(final int i, final int i1) {
1455: return ((TableCellRenderer) runMapping(new MapAction(
1456: "getCellRenderer") {
1457: public Object map() {
1458: return (((JTable) getSource()).getCellRenderer(i, i1));
1459: }
1460: }));
1461: }
1462:
1463: /**Maps <code>JTable.getCellSelectionEnabled()</code> through queue*/
1464: public boolean getCellSelectionEnabled() {
1465: return (runMapping(new MapBooleanAction(
1466: "getCellSelectionEnabled") {
1467: public boolean map() {
1468: return (((JTable) getSource())
1469: .getCellSelectionEnabled());
1470: }
1471: }));
1472: }
1473:
1474: /**Maps <code>JTable.getColumn(Object)</code> through queue*/
1475: public TableColumn getColumn(final Object object) {
1476: return ((TableColumn) runMapping(new MapAction("getColumn") {
1477: public Object map() {
1478: return (((JTable) getSource()).getColumn(object));
1479: }
1480: }));
1481: }
1482:
1483: /**Maps <code>JTable.getColumnClass(int)</code> through queue*/
1484: public Class getColumnClass(final int i) {
1485: return ((Class) runMapping(new MapAction("getColumnClass") {
1486: public Object map() {
1487: return (((JTable) getSource()).getColumnClass(i));
1488: }
1489: }));
1490: }
1491:
1492: /**Maps <code>JTable.getColumnCount()</code> through queue*/
1493: public int getColumnCount() {
1494: return (runMapping(new MapIntegerAction("getColumnCount") {
1495: public int map() {
1496: return (((JTable) getSource()).getColumnCount());
1497: }
1498: }));
1499: }
1500:
1501: /**Maps <code>JTable.getColumnModel()</code> through queue*/
1502: public TableColumnModel getColumnModel() {
1503: return ((TableColumnModel) runMapping(new MapAction(
1504: "getColumnModel") {
1505: public Object map() {
1506: return (((JTable) getSource()).getColumnModel());
1507: }
1508: }));
1509: }
1510:
1511: /**Maps <code>JTable.getColumnName(int)</code> through queue*/
1512: public String getColumnName(final int i) {
1513: return ((String) runMapping(new MapAction("getColumnName") {
1514: public Object map() {
1515: return (((JTable) getSource()).getColumnName(i));
1516: }
1517: }));
1518: }
1519:
1520: /**Maps <code>JTable.getColumnSelectionAllowed()</code> through queue*/
1521: public boolean getColumnSelectionAllowed() {
1522: return (runMapping(new MapBooleanAction(
1523: "getColumnSelectionAllowed") {
1524: public boolean map() {
1525: return (((JTable) getSource())
1526: .getColumnSelectionAllowed());
1527: }
1528: }));
1529: }
1530:
1531: /**Maps <code>JTable.getDefaultEditor(Class)</code> through queue*/
1532: public TableCellEditor getDefaultEditor(final Class clss) {
1533: return ((TableCellEditor) runMapping(new MapAction(
1534: "getDefaultEditor") {
1535: public Object map() {
1536: return (((JTable) getSource()).getDefaultEditor(clss));
1537: }
1538: }));
1539: }
1540:
1541: /**Maps <code>JTable.getDefaultRenderer(Class)</code> through queue*/
1542: public TableCellRenderer getDefaultRenderer(final Class clss) {
1543: return ((TableCellRenderer) runMapping(new MapAction(
1544: "getDefaultRenderer") {
1545: public Object map() {
1546: return (((JTable) getSource()).getDefaultRenderer(clss));
1547: }
1548: }));
1549: }
1550:
1551: /**Maps <code>JTable.getEditingColumn()</code> through queue*/
1552: public int getEditingColumn() {
1553: return (runMapping(new MapIntegerAction("getEditingColumn") {
1554: public int map() {
1555: return (((JTable) getSource()).getEditingColumn());
1556: }
1557: }));
1558: }
1559:
1560: /**Maps <code>JTable.getEditingRow()</code> through queue*/
1561: public int getEditingRow() {
1562: return (runMapping(new MapIntegerAction("getEditingRow") {
1563: public int map() {
1564: return (((JTable) getSource()).getEditingRow());
1565: }
1566: }));
1567: }
1568:
1569: /**Maps <code>JTable.getEditorComponent()</code> through queue*/
1570: public Component getEditorComponent() {
1571: return ((Component) runMapping(new MapAction(
1572: "getEditorComponent") {
1573: public Object map() {
1574: return (((JTable) getSource()).getEditorComponent());
1575: }
1576: }));
1577: }
1578:
1579: /**Maps <code>JTable.getGridColor()</code> through queue*/
1580: public Color getGridColor() {
1581: return ((Color) runMapping(new MapAction("getGridColor") {
1582: public Object map() {
1583: return (((JTable) getSource()).getGridColor());
1584: }
1585: }));
1586: }
1587:
1588: /**Maps <code>JTable.getIntercellSpacing()</code> through queue*/
1589: public Dimension getIntercellSpacing() {
1590: return ((Dimension) runMapping(new MapAction(
1591: "getIntercellSpacing") {
1592: public Object map() {
1593: return (((JTable) getSource()).getIntercellSpacing());
1594: }
1595: }));
1596: }
1597:
1598: /**Maps <code>JTable.getModel()</code> through queue*/
1599: public TableModel getModel() {
1600: return ((TableModel) runMapping(new MapAction("getModel") {
1601: public Object map() {
1602: return (((JTable) getSource()).getModel());
1603: }
1604: }));
1605: }
1606:
1607: /**Maps <code>JTable.getPreferredScrollableViewportSize()</code> through queue*/
1608: public Dimension getPreferredScrollableViewportSize() {
1609: return ((Dimension) runMapping(new MapAction(
1610: "getPreferredScrollableViewportSize") {
1611: public Object map() {
1612: return (((JTable) getSource())
1613: .getPreferredScrollableViewportSize());
1614: }
1615: }));
1616: }
1617:
1618: /**Maps <code>JTable.getRowCount()</code> through queue*/
1619: public int getRowCount() {
1620: return (runMapping(new MapIntegerAction("getRowCount") {
1621: public int map() {
1622: return (((JTable) getSource()).getRowCount());
1623: }
1624: }));
1625: }
1626:
1627: /**Maps <code>JTable.getRowHeight()</code> through queue*/
1628: public int getRowHeight() {
1629: return (runMapping(new MapIntegerAction("getRowHeight") {
1630: public int map() {
1631: return (((JTable) getSource()).getRowHeight());
1632: }
1633: }));
1634: }
1635:
1636: /**Maps <code>JTable.getRowMargin()</code> through queue*/
1637: public int getRowMargin() {
1638: return (runMapping(new MapIntegerAction("getRowMargin") {
1639: public int map() {
1640: return (((JTable) getSource()).getRowMargin());
1641: }
1642: }));
1643: }
1644:
1645: /**Maps <code>JTable.getRowSelectionAllowed()</code> through queue*/
1646: public boolean getRowSelectionAllowed() {
1647: return (runMapping(new MapBooleanAction(
1648: "getRowSelectionAllowed") {
1649: public boolean map() {
1650: return (((JTable) getSource()).getRowSelectionAllowed());
1651: }
1652: }));
1653: }
1654:
1655: /**Maps <code>JTable.getScrollableBlockIncrement(Rectangle, int, int)</code> through queue*/
1656: public int getScrollableBlockIncrement(final Rectangle rectangle,
1657: final int i, final int i1) {
1658: return (runMapping(new MapIntegerAction(
1659: "getScrollableBlockIncrement") {
1660: public int map() {
1661: return (((JTable) getSource())
1662: .getScrollableBlockIncrement(rectangle, i, i1));
1663: }
1664: }));
1665: }
1666:
1667: /**Maps <code>JTable.getScrollableTracksViewportHeight()</code> through queue*/
1668: public boolean getScrollableTracksViewportHeight() {
1669: return (runMapping(new MapBooleanAction(
1670: "getScrollableTracksViewportHeight") {
1671: public boolean map() {
1672: return (((JTable) getSource())
1673: .getScrollableTracksViewportHeight());
1674: }
1675: }));
1676: }
1677:
1678: /**Maps <code>JTable.getScrollableTracksViewportWidth()</code> through queue*/
1679: public boolean getScrollableTracksViewportWidth() {
1680: return (runMapping(new MapBooleanAction(
1681: "getScrollableTracksViewportWidth") {
1682: public boolean map() {
1683: return (((JTable) getSource())
1684: .getScrollableTracksViewportWidth());
1685: }
1686: }));
1687: }
1688:
1689: /**Maps <code>JTable.getScrollableUnitIncrement(Rectangle, int, int)</code> through queue*/
1690: public int getScrollableUnitIncrement(final Rectangle rectangle,
1691: final int i, final int i1) {
1692: return (runMapping(new MapIntegerAction(
1693: "getScrollableUnitIncrement") {
1694: public int map() {
1695: return (((JTable) getSource())
1696: .getScrollableUnitIncrement(rectangle, i, i1));
1697: }
1698: }));
1699: }
1700:
1701: /**Maps <code>JTable.getSelectedColumn()</code> through queue*/
1702: public int getSelectedColumn() {
1703: return (runMapping(new MapIntegerAction("getSelectedColumn") {
1704: public int map() {
1705: return (((JTable) getSource()).getSelectedColumn());
1706: }
1707: }));
1708: }
1709:
1710: /**Maps <code>JTable.getSelectedColumnCount()</code> through queue*/
1711: public int getSelectedColumnCount() {
1712: return (runMapping(new MapIntegerAction(
1713: "getSelectedColumnCount") {
1714: public int map() {
1715: return (((JTable) getSource()).getSelectedColumnCount());
1716: }
1717: }));
1718: }
1719:
1720: /**Maps <code>JTable.getSelectedColumns()</code> through queue*/
1721: public int[] getSelectedColumns() {
1722: return ((int[]) runMapping(new MapAction("getSelectedColumns") {
1723: public Object map() {
1724: return (((JTable) getSource()).getSelectedColumns());
1725: }
1726: }));
1727: }
1728:
1729: /**Maps <code>JTable.getSelectedRow()</code> through queue*/
1730: public int getSelectedRow() {
1731: return (runMapping(new MapIntegerAction("getSelectedRow") {
1732: public int map() {
1733: return (((JTable) getSource()).getSelectedRow());
1734: }
1735: }));
1736: }
1737:
1738: /**Maps <code>JTable.getSelectedRowCount()</code> through queue*/
1739: public int getSelectedRowCount() {
1740: return (runMapping(new MapIntegerAction("getSelectedRowCount") {
1741: public int map() {
1742: return (((JTable) getSource()).getSelectedRowCount());
1743: }
1744: }));
1745: }
1746:
1747: /**Maps <code>JTable.getSelectedRows()</code> through queue*/
1748: public int[] getSelectedRows() {
1749: return ((int[]) runMapping(new MapAction("getSelectedRows") {
1750: public Object map() {
1751: return (((JTable) getSource()).getSelectedRows());
1752: }
1753: }));
1754: }
1755:
1756: /**Maps <code>JTable.getSelectionBackground()</code> through queue*/
1757: public Color getSelectionBackground() {
1758: return ((Color) runMapping(new MapAction(
1759: "getSelectionBackground") {
1760: public Object map() {
1761: return (((JTable) getSource()).getSelectionBackground());
1762: }
1763: }));
1764: }
1765:
1766: /**Maps <code>JTable.getSelectionForeground()</code> through queue*/
1767: public Color getSelectionForeground() {
1768: return ((Color) runMapping(new MapAction(
1769: "getSelectionForeground") {
1770: public Object map() {
1771: return (((JTable) getSource()).getSelectionForeground());
1772: }
1773: }));
1774: }
1775:
1776: /**Maps <code>JTable.getSelectionModel()</code> through queue*/
1777: public ListSelectionModel getSelectionModel() {
1778: return ((ListSelectionModel) runMapping(new MapAction(
1779: "getSelectionModel") {
1780: public Object map() {
1781: return (((JTable) getSource()).getSelectionModel());
1782: }
1783: }));
1784: }
1785:
1786: /**Maps <code>JTable.getShowHorizontalLines()</code> through queue*/
1787: public boolean getShowHorizontalLines() {
1788: return (runMapping(new MapBooleanAction(
1789: "getShowHorizontalLines") {
1790: public boolean map() {
1791: return (((JTable) getSource()).getShowHorizontalLines());
1792: }
1793: }));
1794: }
1795:
1796: /**Maps <code>JTable.getShowVerticalLines()</code> through queue*/
1797: public boolean getShowVerticalLines() {
1798: return (runMapping(new MapBooleanAction("getShowVerticalLines") {
1799: public boolean map() {
1800: return (((JTable) getSource()).getShowVerticalLines());
1801: }
1802: }));
1803: }
1804:
1805: /**Maps <code>JTable.getTableHeader()</code> through queue*/
1806: public JTableHeader getTableHeader() {
1807: return ((JTableHeader) runMapping(new MapAction(
1808: "getTableHeader") {
1809: public Object map() {
1810: return (((JTable) getSource()).getTableHeader());
1811: }
1812: }));
1813: }
1814:
1815: /**Maps <code>JTable.getUI()</code> through queue*/
1816: public TableUI getUI() {
1817: return ((TableUI) runMapping(new MapAction("getUI") {
1818: public Object map() {
1819: return (((JTable) getSource()).getUI());
1820: }
1821: }));
1822: }
1823:
1824: /**Maps <code>JTable.getValueAt(int, int)</code> through queue*/
1825: public Object getValueAt(final int i, final int i1) {
1826: return ((Object) runMapping(new MapAction("getValueAt") {
1827: public Object map() {
1828: return (((JTable) getSource()).getValueAt(i, i1));
1829: }
1830: }));
1831: }
1832:
1833: /**Maps <code>JTable.isCellEditable(int, int)</code> through queue*/
1834: public boolean isCellEditable(final int i, final int i1) {
1835: return (runMapping(new MapBooleanAction("isCellEditable") {
1836: public boolean map() {
1837: return (((JTable) getSource()).isCellEditable(i, i1));
1838: }
1839: }));
1840: }
1841:
1842: /**Maps <code>JTable.isCellSelected(int, int)</code> through queue*/
1843: public boolean isCellSelected(final int i, final int i1) {
1844: return (runMapping(new MapBooleanAction("isCellSelected") {
1845: public boolean map() {
1846: return (((JTable) getSource()).isCellSelected(i, i1));
1847: }
1848: }));
1849: }
1850:
1851: /**Maps <code>JTable.isColumnSelected(int)</code> through queue*/
1852: public boolean isColumnSelected(final int i) {
1853: return (runMapping(new MapBooleanAction("isColumnSelected") {
1854: public boolean map() {
1855: return (((JTable) getSource()).isColumnSelected(i));
1856: }
1857: }));
1858: }
1859:
1860: /**Maps <code>JTable.isEditing()</code> through queue*/
1861: public boolean isEditing() {
1862: return (runMapping(new MapBooleanAction("isEditing") {
1863: public boolean map() {
1864: return (((JTable) getSource()).isEditing());
1865: }
1866: }));
1867: }
1868:
1869: /**Maps <code>JTable.isRowSelected(int)</code> through queue*/
1870: public boolean isRowSelected(final int i) {
1871: return (runMapping(new MapBooleanAction("isRowSelected") {
1872: public boolean map() {
1873: return (((JTable) getSource()).isRowSelected(i));
1874: }
1875: }));
1876: }
1877:
1878: /**Maps <code>JTable.moveColumn(int, int)</code> through queue*/
1879: public void moveColumn(final int i, final int i1) {
1880: runMapping(new MapVoidAction("moveColumn") {
1881: public void map() {
1882: ((JTable) getSource()).moveColumn(i, i1);
1883: }
1884: });
1885: }
1886:
1887: /**Maps <code>JTable.prepareEditor(TableCellEditor, int, int)</code> through queue*/
1888: public Component prepareEditor(
1889: final TableCellEditor tableCellEditor, final int i,
1890: final int i1) {
1891: return ((Component) runMapping(new MapAction("prepareEditor") {
1892: public Object map() {
1893: return (((JTable) getSource()).prepareEditor(
1894: tableCellEditor, i, i1));
1895: }
1896: }));
1897: }
1898:
1899: /**Maps <code>JTable.prepareRenderer(TableCellRenderer, int, int)</code> through queue*/
1900: public Component prepareRenderer(
1901: final TableCellRenderer tableCellRenderer, final int i,
1902: final int i1) {
1903: return ((Component) runMapping(new MapAction("prepareRenderer") {
1904: public Object map() {
1905: return (((JTable) getSource()).prepareRenderer(
1906: tableCellRenderer, i, i1));
1907: }
1908: }));
1909: }
1910:
1911: /**Maps <code>JTable.removeColumn(TableColumn)</code> through queue*/
1912: public void removeColumn(final TableColumn tableColumn) {
1913: runMapping(new MapVoidAction("removeColumn") {
1914: public void map() {
1915: ((JTable) getSource()).removeColumn(tableColumn);
1916: }
1917: });
1918: }
1919:
1920: /**Maps <code>JTable.removeColumnSelectionInterval(int, int)</code> through queue*/
1921: public void removeColumnSelectionInterval(final int i, final int i1) {
1922: runMapping(new MapVoidAction("removeColumnSelectionInterval") {
1923: public void map() {
1924: ((JTable) getSource()).removeColumnSelectionInterval(i,
1925: i1);
1926: }
1927: });
1928: }
1929:
1930: /**Maps <code>JTable.removeEditor()</code> through queue*/
1931: public void removeEditor() {
1932: runMapping(new MapVoidAction("removeEditor") {
1933: public void map() {
1934: ((JTable) getSource()).removeEditor();
1935: }
1936: });
1937: }
1938:
1939: /**Maps <code>JTable.removeRowSelectionInterval(int, int)</code> through queue*/
1940: public void removeRowSelectionInterval(final int i, final int i1) {
1941: runMapping(new MapVoidAction("removeRowSelectionInterval") {
1942: public void map() {
1943: ((JTable) getSource())
1944: .removeRowSelectionInterval(i, i1);
1945: }
1946: });
1947: }
1948:
1949: /**Maps <code>JTable.rowAtPoint(Point)</code> through queue*/
1950: public int rowAtPoint(final Point point) {
1951: return (runMapping(new MapIntegerAction("rowAtPoint") {
1952: public int map() {
1953: return (((JTable) getSource()).rowAtPoint(point));
1954: }
1955: }));
1956: }
1957:
1958: /**Maps <code>JTable.selectAll()</code> through queue*/
1959: public void selectAll() {
1960: runMapping(new MapVoidAction("selectAll") {
1961: public void map() {
1962: ((JTable) getSource()).selectAll();
1963: }
1964: });
1965: }
1966:
1967: /**Maps <code>JTable.setAutoCreateColumnsFromModel(boolean)</code> through queue*/
1968: public void setAutoCreateColumnsFromModel(final boolean b) {
1969: runMapping(new MapVoidAction("setAutoCreateColumnsFromModel") {
1970: public void map() {
1971: ((JTable) getSource()).setAutoCreateColumnsFromModel(b);
1972: }
1973: });
1974: }
1975:
1976: /**Maps <code>JTable.setAutoResizeMode(int)</code> through queue*/
1977: public void setAutoResizeMode(final int i) {
1978: runMapping(new MapVoidAction("setAutoResizeMode") {
1979: public void map() {
1980: ((JTable) getSource()).setAutoResizeMode(i);
1981: }
1982: });
1983: }
1984:
1985: /**Maps <code>JTable.setCellEditor(TableCellEditor)</code> through queue*/
1986: public void setCellEditor(final TableCellEditor tableCellEditor) {
1987: runMapping(new MapVoidAction("setCellEditor") {
1988: public void map() {
1989: ((JTable) getSource()).setCellEditor(tableCellEditor);
1990: }
1991: });
1992: }
1993:
1994: /**Maps <code>JTable.setCellSelectionEnabled(boolean)</code> through queue*/
1995: public void setCellSelectionEnabled(final boolean b) {
1996: runMapping(new MapVoidAction("setCellSelectionEnabled") {
1997: public void map() {
1998: ((JTable) getSource()).setCellSelectionEnabled(b);
1999: }
2000: });
2001: }
2002:
2003: /**Maps <code>JTable.setColumnModel(TableColumnModel)</code> through queue*/
2004: public void setColumnModel(final TableColumnModel tableColumnModel) {
2005: runMapping(new MapVoidAction("setColumnModel") {
2006: public void map() {
2007: ((JTable) getSource()).setColumnModel(tableColumnModel);
2008: }
2009: });
2010: }
2011:
2012: /**Maps <code>JTable.setColumnSelectionAllowed(boolean)</code> through queue*/
2013: public void setColumnSelectionAllowed(final boolean b) {
2014: runMapping(new MapVoidAction("setColumnSelectionAllowed") {
2015: public void map() {
2016: ((JTable) getSource()).setColumnSelectionAllowed(b);
2017: }
2018: });
2019: }
2020:
2021: /**Maps <code>JTable.setColumnSelectionInterval(int, int)</code> through queue*/
2022: public void setColumnSelectionInterval(final int i, final int i1) {
2023: runMapping(new MapVoidAction("setColumnSelectionInterval") {
2024: public void map() {
2025: ((JTable) getSource())
2026: .setColumnSelectionInterval(i, i1);
2027: }
2028: });
2029: }
2030:
2031: /**Maps <code>JTable.setDefaultEditor(Class, TableCellEditor)</code> through queue*/
2032: public void setDefaultEditor(final Class clss,
2033: final TableCellEditor tableCellEditor) {
2034: runMapping(new MapVoidAction("setDefaultEditor") {
2035: public void map() {
2036: ((JTable) getSource()).setDefaultEditor(clss,
2037: tableCellEditor);
2038: }
2039: });
2040: }
2041:
2042: /**Maps <code>JTable.setDefaultRenderer(Class, TableCellRenderer)</code> through queue*/
2043: public void setDefaultRenderer(final Class clss,
2044: final TableCellRenderer tableCellRenderer) {
2045: runMapping(new MapVoidAction("setDefaultRenderer") {
2046: public void map() {
2047: ((JTable) getSource()).setDefaultRenderer(clss,
2048: tableCellRenderer);
2049: }
2050: });
2051: }
2052:
2053: /**Maps <code>JTable.setEditingColumn(int)</code> through queue*/
2054: public void setEditingColumn(final int i) {
2055: runMapping(new MapVoidAction("setEditingColumn") {
2056: public void map() {
2057: ((JTable) getSource()).setEditingColumn(i);
2058: }
2059: });
2060: }
2061:
2062: /**Maps <code>JTable.setEditingRow(int)</code> through queue*/
2063: public void setEditingRow(final int i) {
2064: runMapping(new MapVoidAction("setEditingRow") {
2065: public void map() {
2066: ((JTable) getSource()).setEditingRow(i);
2067: }
2068: });
2069: }
2070:
2071: /**Maps <code>JTable.setGridColor(Color)</code> through queue*/
2072: public void setGridColor(final Color color) {
2073: runMapping(new MapVoidAction("setGridColor") {
2074: public void map() {
2075: ((JTable) getSource()).setGridColor(color);
2076: }
2077: });
2078: }
2079:
2080: /**Maps <code>JTable.setIntercellSpacing(Dimension)</code> through queue*/
2081: public void setIntercellSpacing(final Dimension dimension) {
2082: runMapping(new MapVoidAction("setIntercellSpacing") {
2083: public void map() {
2084: ((JTable) getSource()).setIntercellSpacing(dimension);
2085: }
2086: });
2087: }
2088:
2089: /**Maps <code>JTable.setModel(TableModel)</code> through queue*/
2090: public void setModel(final TableModel tableModel) {
2091: runMapping(new MapVoidAction("setModel") {
2092: public void map() {
2093: ((JTable) getSource()).setModel(tableModel);
2094: }
2095: });
2096: }
2097:
2098: /**Maps <code>JTable.setPreferredScrollableViewportSize(Dimension)</code> through queue*/
2099: public void setPreferredScrollableViewportSize(
2100: final Dimension dimension) {
2101: runMapping(new MapVoidAction(
2102: "setPreferredScrollableViewportSize") {
2103: public void map() {
2104: ((JTable) getSource())
2105: .setPreferredScrollableViewportSize(dimension);
2106: }
2107: });
2108: }
2109:
2110: /**Maps <code>JTable.setRowHeight(int)</code> through queue*/
2111: public void setRowHeight(final int i) {
2112: runMapping(new MapVoidAction("setRowHeight") {
2113: public void map() {
2114: ((JTable) getSource()).setRowHeight(i);
2115: }
2116: });
2117: }
2118:
2119: /**Maps <code>JTable.setRowMargin(int)</code> through queue*/
2120: public void setRowMargin(final int i) {
2121: runMapping(new MapVoidAction("setRowMargin") {
2122: public void map() {
2123: ((JTable) getSource()).setRowMargin(i);
2124: }
2125: });
2126: }
2127:
2128: /**Maps <code>JTable.setRowSelectionAllowed(boolean)</code> through queue*/
2129: public void setRowSelectionAllowed(final boolean b) {
2130: runMapping(new MapVoidAction("setRowSelectionAllowed") {
2131: public void map() {
2132: ((JTable) getSource()).setRowSelectionAllowed(b);
2133: }
2134: });
2135: }
2136:
2137: /**Maps <code>JTable.setRowSelectionInterval(int, int)</code> through queue*/
2138: public void setRowSelectionInterval(final int i, final int i1) {
2139: runMapping(new MapVoidAction("setRowSelectionInterval") {
2140: public void map() {
2141: ((JTable) getSource()).setRowSelectionInterval(i, i1);
2142: }
2143: });
2144: }
2145:
2146: /**Maps <code>JTable.setSelectionBackground(Color)</code> through queue*/
2147: public void setSelectionBackground(final Color color) {
2148: runMapping(new MapVoidAction("setSelectionBackground") {
2149: public void map() {
2150: ((JTable) getSource()).setSelectionBackground(color);
2151: }
2152: });
2153: }
2154:
2155: /**Maps <code>JTable.setSelectionForeground(Color)</code> through queue*/
2156: public void setSelectionForeground(final Color color) {
2157: runMapping(new MapVoidAction("setSelectionForeground") {
2158: public void map() {
2159: ((JTable) getSource()).setSelectionForeground(color);
2160: }
2161: });
2162: }
2163:
2164: /**Maps <code>JTable.setSelectionMode(int)</code> through queue*/
2165: public void setSelectionMode(final int i) {
2166: runMapping(new MapVoidAction("setSelectionMode") {
2167: public void map() {
2168: ((JTable) getSource()).setSelectionMode(i);
2169: }
2170: });
2171: }
2172:
2173: /**Maps <code>JTable.setSelectionModel(ListSelectionModel)</code> through queue*/
2174: public void setSelectionModel(
2175: final ListSelectionModel listSelectionModel) {
2176: runMapping(new MapVoidAction("setSelectionModel") {
2177: public void map() {
2178: ((JTable) getSource())
2179: .setSelectionModel(listSelectionModel);
2180: }
2181: });
2182: }
2183:
2184: /**Maps <code>JTable.setShowGrid(boolean)</code> through queue*/
2185: public void setShowGrid(final boolean b) {
2186: runMapping(new MapVoidAction("setShowGrid") {
2187: public void map() {
2188: ((JTable) getSource()).setShowGrid(b);
2189: }
2190: });
2191: }
2192:
2193: /**Maps <code>JTable.setShowHorizontalLines(boolean)</code> through queue*/
2194: public void setShowHorizontalLines(final boolean b) {
2195: runMapping(new MapVoidAction("setShowHorizontalLines") {
2196: public void map() {
2197: ((JTable) getSource()).setShowHorizontalLines(b);
2198: }
2199: });
2200: }
2201:
2202: /**Maps <code>JTable.setShowVerticalLines(boolean)</code> through queue*/
2203: public void setShowVerticalLines(final boolean b) {
2204: runMapping(new MapVoidAction("setShowVerticalLines") {
2205: public void map() {
2206: ((JTable) getSource()).setShowVerticalLines(b);
2207: }
2208: });
2209: }
2210:
2211: /**Maps <code>JTable.setTableHeader(JTableHeader)</code> through queue*/
2212: public void setTableHeader(final JTableHeader jTableHeader) {
2213: runMapping(new MapVoidAction("setTableHeader") {
2214: public void map() {
2215: ((JTable) getSource()).setTableHeader(jTableHeader);
2216: }
2217: });
2218: }
2219:
2220: /**Maps <code>JTable.setUI(TableUI)</code> through queue*/
2221: public void setUI(final TableUI tableUI) {
2222: runMapping(new MapVoidAction("setUI") {
2223: public void map() {
2224: ((JTable) getSource()).setUI(tableUI);
2225: }
2226: });
2227: }
2228:
2229: /**Maps <code>JTable.setValueAt(Object, int, int)</code> through queue*/
2230: public void setValueAt(final Object object, final int i,
2231: final int i1) {
2232: runMapping(new MapVoidAction("setValueAt") {
2233: public void map() {
2234: ((JTable) getSource()).setValueAt(object, i, i1);
2235: }
2236: });
2237: }
2238:
2239: /**Maps <code>JTable.tableChanged(TableModelEvent)</code> through queue*/
2240: public void tableChanged(final TableModelEvent tableModelEvent) {
2241: runMapping(new MapVoidAction("tableChanged") {
2242: public void map() {
2243: ((JTable) getSource()).tableChanged(tableModelEvent);
2244: }
2245: });
2246: }
2247:
2248: /**Maps <code>JTable.valueChanged(ListSelectionEvent)</code> through queue*/
2249: public void valueChanged(final ListSelectionEvent listSelectionEvent) {
2250: runMapping(new MapVoidAction("valueChanged") {
2251: public void map() {
2252: ((JTable) getSource()).valueChanged(listSelectionEvent);
2253: }
2254: });
2255: }
2256:
2257: //End of mapping //
2258: ////////////////////////////////////////////////////////
2259:
2260: private Point findCell(String text, boolean ce, boolean ccs,
2261: int index) {
2262: return (findCell(text, new DefaultStringComparator(ce, ccs),
2263: index));
2264: }
2265:
2266: /**
2267: * Iterface to choose table cell.
2268: */
2269: public interface TableCellChooser {
2270: /**
2271: * Should be true if item is good.
2272: * @param oper Operator used to search item.
2273: * @param row Row be checked.
2274: * @param column Column be checked.
2275: * @return true if cell fits the criteria
2276: */
2277: public boolean checkCell(JTableOperator oper, int row,
2278: int column);
2279:
2280: /**
2281: * Item description.
2282: * @return the description.
2283: */
2284: public String getDescription();
2285: }
2286:
2287: private class BySubStringTableCellChooser implements
2288: TableCellChooser {
2289: String subString;
2290: StringComparator comparator;
2291:
2292: public BySubStringTableCellChooser(String subString,
2293: StringComparator comparator) {
2294: this .subString = subString;
2295: this .comparator = comparator;
2296: }
2297:
2298: public BySubStringTableCellChooser(String subString,
2299: boolean ce, boolean ccs) {
2300: this (subString, new DefaultStringComparator(ce, ccs));
2301: }
2302:
2303: public boolean checkCell(JTableOperator oper, int row,
2304: int column) {
2305: Object value = ((JTable) oper.getSource()).getModel()
2306: .getValueAt(row, column);
2307: return (comparator.equals((value != null) ? value
2308: .toString() : null, subString));
2309: }
2310:
2311: public String getDescription() {
2312: return ("Cell containing \"" + subString + "\" string");
2313: }
2314: }
2315:
2316: private class ByRenderedComponentTableCellChooser implements
2317: TableCellChooser {
2318: ComponentChooser chooser;
2319:
2320: public ByRenderedComponentTableCellChooser(
2321: ComponentChooser chooser) {
2322: this .chooser = chooser;
2323: }
2324:
2325: public boolean checkCell(JTableOperator oper, int row,
2326: int column) {
2327: return (chooser.checkComponent(oper.getRenderedComponent(
2328: row, column)));
2329: }
2330:
2331: public String getDescription() {
2332: return (chooser.getDescription());
2333: }
2334: }
2335:
2336: /**
2337: * Allows to find component by cell text.
2338: */
2339: public static class JTableByCellFinder implements ComponentChooser {
2340: String label;
2341: int row;
2342: int column;
2343: StringComparator comparator;
2344:
2345: /**
2346: * Constructs JTableByCellFinder.
2347: * @param lb a text pattern
2348: * @param r a row index to look in. If equal to -1, selected row is checked.
2349: * @param c a column index to look in. If equal to -1, selected column is checked.
2350: * @param comparator specifies string comparision algorithm.
2351: */
2352: public JTableByCellFinder(String lb, int r, int c,
2353: StringComparator comparator) {
2354: label = lb;
2355: row = r;
2356: column = c;
2357: this .comparator = comparator;
2358: }
2359:
2360: /**
2361: * Constructs JTableByCellFinder.
2362: * @param lb a text pattern
2363: * @param r a row index to look in. If equal to -1, selected row is checked.
2364: * @param c a column index to look in. If equal to -1, selected column is checked.
2365: */
2366: public JTableByCellFinder(String lb, int r, int c) {
2367: this (lb, r, c, Operator.getDefaultStringComparator());
2368: }
2369:
2370: public boolean checkComponent(Component comp) {
2371: if (comp instanceof JTable) {
2372: if (label == null) {
2373: return (true);
2374: }
2375: if (((JTable) comp).getRowCount() > row
2376: && ((JTable) comp).getColumnCount() > column) {
2377: int r = row;
2378: if (r == -1) {
2379: int[] rows = ((JTable) comp).getSelectedRows();
2380: if (rows.length != 0) {
2381: r = rows[0];
2382: } else {
2383: return (false);
2384: }
2385: }
2386: int c = column;
2387: if (c == -1) {
2388: int[] columns = ((JTable) comp)
2389: .getSelectedColumns();
2390: if (columns.length != 0) {
2391: c = columns[0];
2392: } else {
2393: return (false);
2394: }
2395: }
2396: Object value = ((JTable) comp).getValueAt(r, c);
2397: if (value == null) {
2398: return (false);
2399: }
2400: return (comparator.equals(value.toString(), label));
2401: }
2402: }
2403: return (false);
2404: }
2405:
2406: public String getDescription() {
2407: return ("JTable with text \"" + label + "\" in ("
2408: + (new Integer(row)).toString() + ", "
2409: + (new Integer(column)).toString() + ") cell");
2410: }
2411: }
2412:
2413: /**
2414: * Checks component type.
2415: */
2416: public static class JTableFinder extends Finder {
2417: /**
2418: * Constructs JTableFinder.
2419: * @param sf other searching criteria.
2420: */
2421: public JTableFinder(ComponentChooser sf) {
2422: super (JTable.class, sf);
2423: }
2424:
2425: /**
2426: * Constructs JTableFinder.
2427: */
2428: public JTableFinder() {
2429: super (JTable.class);
2430: }
2431: }
2432:
2433: private class CellComponentWaiter extends Waiter {
2434: private ComponentChooser chooser;
2435: private int row, column;
2436:
2437: public CellComponentWaiter(ComponentChooser chooser, int row,
2438: int column) {
2439: this .chooser = chooser;
2440: this .row = row;
2441: this .column = column;
2442: }
2443:
2444: public Object actionProduced(Object obj) {
2445: Point pnt = getPointToClick(row, column);
2446: Component comp = getComponentAt(pnt.x, pnt.y);
2447: if (comp != null && chooser.checkComponent(comp)) {
2448: return (comp);
2449: } else {
2450: return (null);
2451: }
2452: }
2453:
2454: public String getDescription() {
2455: return (chooser.getDescription());
2456: }
2457: }
2458: }
|