All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.qspin.qtaste.javaguifx.server.EditableStateGetter Maven / Gradle / Ivy

The newest version!
/*
    Copyright 2007-2012 QSpin - www.qspin.be

    This file is part of QTaste framework.

    QTaste is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    QTaste is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with QTaste. If not, see .
*/

package com.qspin.qtaste.javaguifx.server;

import javafx.scene.Node;

import com.qspin.qtaste.testsuite.QTasteException;
import com.qspin.qtaste.testsuite.QTasteTestFailException;

/**
 * Component asker which return the editable state of a component.
 *
 * @author simjan
 */
class EditableStateGetter extends ComponentCommander {

    /**
     * @param data the component's name.
     * @return true if the component is editable.
     * @throws QTasteTestFailException if no component is found.
     */
    @Override
    Boolean executeCommand(int timeout, String componentName, Object... data) throws QTasteException {
        Node c = getComponentByName(componentName);
        if (c == null) {
            return false;
        }

        //		if( c instanceof JTextComponent )
        //			return ((JTextComponent) c).isEditable();
        //
        //		else if( c instanceof JComboBox )
        //			return ((JComboBox) c).isEditable();
        //
        //		else if( c instanceof JTable )
        //		{
        //			for (int x = 0; x < ((JTable)c).getColumnCount(); x++)
        //			{
        //				for (int y = 0; y < ((JTable)c).getRowCount(); y++)
        //				{
        //					if ( ((JTable)c).isCellEditable(y, x) )
        //					{
        //						return true;
        //					}
        //				}
        //			}
        //		}
        //		else if( c instanceof JTree )
        //			return ((JTree) c).isEditable();
        //
        //		else
        //			throw new QTasteTestFailException("Cannot get the editable state of a component of type " + c.getClass() + "
        // .");

        return false;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy