/** * Unset MultiSelectList value * @throws VerificationException if the element doesn't exist */ @Override @PublicAtsApi public void unsetValue( String value ) { if (Arrays.asList(getValues()).contains(value)) { JListFixture listFixture = ((JListFixture) SwingElementLocator.findFixture(this)); listFixture.pressKey(KeyEvent.VK_CONTROL); try { listFixture.clickItem(value); } finally { listFixture.releaseKey(KeyEvent.VK_CONTROL); } } }
/** * Set MultiSelectList value * * @param value the value to set * @throws VerificationException if the element doesn't exist */ @Override @PublicAtsApi public void setValue( String value ) { new SwingElementState(this).waitToBecomeExisting(); JListFixture listFixture = ((JListFixture) SwingElementLocator.findFixture(this)); listFixture.pressKey(KeyEvent.VK_CONTROL); try { listFixture.selectItem(value); } finally { listFixture.releaseKey(KeyEvent.VK_CONTROL); } }
/** * Get MultiSelectList available values * * @return {@link String} array with all the available values * @throws VerificationException if the element doesn't exist */ @PublicAtsApi public String[] getAvailableValues() { new SwingElementState(this).waitToBecomeExisting(); return ((JListFixture) SwingElementLocator.findFixture(this)).contents(); }
/** * Clears the selection * * @throws VerificationException if the element doesn't exist */ @PublicAtsApi public void clearSelection() { new SwingElementState(this).waitToBecomeExisting(); ((JListFixture) SwingElementLocator.findFixture(this)).clearSelection(); }
/** * Get MultiSelectList value * * @throws VerificationException if the element doesn't exist */ @Override @PublicAtsApi public String[] getValues() { new SwingElementState(this).waitToBecomeExisting(); return ((JListFixture) SwingElementLocator.findFixture(this)).selection(); }
/** * Set SingleSelectList value * * @param value the value to set * @throws VerificationException if the element doesn't exist */ @Override @PublicAtsApi public void setValue( String value ) { new SwingElementState(this).waitToBecomeExisting(); ((JListFixture) SwingElementLocator.findFixture(this)).selectItem(value); }
/** * Verify the specified value is NOT selected * * @param notExpectedValue * @throws VerificationException if the element doesn't exist * @throws VerifyNotEqualityException if the verification fails */ @Override @PublicAtsApi public void verifyNotValue( String notExpectedValue ) { new SwingElementState(this).waitToBecomeExisting(); JListFixture listFixture = ((JListFixture) SwingElementLocator.findFixture(this)); String selectedValue = (String) listFixture.component().getSelectedValue(); if ( (notExpectedValue == null && selectedValue == null) || (StringUtils.isNotNullAndEquals(selectedValue, notExpectedValue))) { throw new VerifyNotEqualityException(notExpectedValue, this); } } }
/** * * @param contextMenuItems context menu items to select */ @PublicAtsApi public void rightClick( String... contextMenuItems ) { new SwingElementState(this).waitToBecomeExisting(); JListFixture listFixture = ((JListFixture) SwingElementLocator.findFixture(this)); JPopupMenuFixture popUpMenu = listFixture.showPopupMenu(); popUpMenu.menuItemWithPath(contextMenuItems).click(); }
} else if (componentClass.equals(JList.class)) { return (ComponentFixture<? extends Component>) new JListFixture(containerFixture.robot, (JList) findElement(uiElement)); } else if (componentClass.equals(JCheckBox.class)) {
/** * Get SingleSelectList available values * * @return {@link String} array with all the available values * @throws VerificationException if the element doesn't exist */ @PublicAtsApi public String[] getAvailableValues() { new SwingElementState(this).waitToBecomeExisting(); return ((JListFixture) SwingElementLocator.findFixture(this)).contents(); }
/** * Clears the selection * * @throws VerificationException if the element doesn't exist */ @PublicAtsApi public void clearSelections() { new SwingElementState(this).waitToBecomeExisting(); ((JListFixture) SwingElementLocator.findFixture(this)).clearSelection(); }
/** * Get SingleSelectList value * * @throws VerificationException if the element doesn't exist */ @Override @PublicAtsApi public String getValue() { new SwingElementState(this).waitToBecomeExisting(); String[] selections = ((JListFixture) SwingElementLocator.findFixture(this)).selection(); if (selections.length > 0) { return selections[0]; } return ""; }