/** * Check if the element is visible or not * * @return if the element is visible or not */ @PublicAtsApi public boolean isElementVisible() { try { return SwingElementLocator.findFixture(element).component().isVisible(); } catch (ElementNotFoundException nsee) { lastNotFoundException = nsee; return false; } }
/** * Check if the element is enabled or disabled * * @return if the element is enabled or disabled */ @PublicAtsApi public boolean isElementEnabled() { try { return SwingElementLocator.findFixture(element).component().isEnabled(); } catch (ElementNotFoundException nsee) { lastNotFoundException = nsee; return false; } }
/** * Generic way to find and AWT/Swing component.<br /> * Not recommended for wide use. It might be used in case when the component is very custom * and does not extend Swing component with similar behavior. * * @return instance of the found {@link Component} */ @PublicAtsApi public Component getNativeComponent() { new SwingElementState(this).waitToBecomeExisting(); return SwingElementLocator.findFixture(this).component(); }
/** * Check if the element is editable or not * * @return if the element is editable or not */ @PublicAtsApi public boolean isElementEditable() { try { Component component = SwingElementLocator.findFixture(element).component(); if (component instanceof JTextComponent) { return ((JTextComponent) component).isEditable(); } else if (component instanceof JComboBox) { return ((JComboBox) component).isEditable(); } else if (component instanceof JTree) { return ((JTree) component).isEditable(); } throw new NotSupportedOperationException("Component of type \"" + component.getClass().getName() + "\" doesn't have 'editable' state!"); } catch (ElementNotFoundException nsee) { lastNotFoundException = nsee; return false; } } }