/** * Retrieves the example which has been selected by the user. * * @return the selected example. */ public String getSelected() { return (String) recentDropdown.getSelected(); }
/** * Indicates whether the "Visa" option is selected. * * @return true if the "Visa" option is selected, false otherwise. */ public boolean isVisaCard() { return VISA_CARD.equals(cardTypeSelection.getSelected()); }
/** * Indicates whether the "Other Card" option is selected. * * @return true if the "Other Card" option is selected, false otherwise. */ public boolean isOtherCard() { return OTHER_CARD.equals(cardTypeSelection.getSelected()); } }
/** * Indicates whether the "MasterCard" option is selected. * * @return true if the "MasterCard" option is selected, false otherwise. */ public boolean isMasterCard() { return MASTER_CARD.equals(cardTypeSelection.getSelected()); }
@Override public void execute(final ActionEvent event) { if (!"".equals(selRemove.getSelected())) { int sel = messageList.indexOf(selRemove.getSelected()); messageBox.removeMessages(sel - 1); applySettings(); } } });
/** * @return the Card Type as a string */ public String getCardTypeAsString() { String cardType = null; String selection = (String) cardTypeSelection.getSelected(); if (selection != null) { Input field = mapOptionToField.get(selection); cardType = field.getValueAsString(); } return cardType; }
@Override public void execute(final ActionEvent event) { String selected = (String) drop.getSelected(); text.setText(selected); } });
@Override public void execute(final ActionEvent event) { String selectedOption = (String) dropdown.getSelected(); info.setText(selectedOption); } });
@Override public void execute(final ActionEvent event) { menu.setSelectMode((SelectMode) drop1.getSelected()); } });
@Override public void execute(final ActionEvent event) { String selected = (String) drop.getSelected(); if (selected != null) { selected = selected.replaceAll(" ", "%20"); } text.setText(selected); } });
@Override public void execute(final ActionEvent event) { sub1.setSelectMode((SelectMode) drop2.getSelected()); } });
@Override public void execute(final ActionEvent event) { sub2.setSelectMode((SelectMode) drop3.getSelected()); } });
@Override public void execute(final ActionEvent event) { panel.setType((WPanel.Type) wdPanelType.getSelected()); Size gap = rbsGap.getSelected() == null ? null : (Size) rbsGap.getSelected(); panel.setLayout(new ListLayout((ListLayout.Type) wdListLayoutType.getSelected(), (ListLayout.Alignment) wdListLayoutAlignment.getSelected(), (ListLayout.Separator) wdListLayoutSeparator.getSelected(), wcIsOrdered.isSelected(), gap)); } });
@Override public void execute(final ActionEvent event) { String regionSelected = (String) region.getSelected(); suburb.setOptions(getSuburbs(regionSelected)); suburb.resetData(); } });
/** * Retrieves the current value of {@link #rowsPerPage} as an integer. * * @return the number of rows to display per page. */ public int getRowsPerPageAsInt() { Object selected = getRowsPerPage().getSelected(); if (selected == null) { return 0; } return ((Integer) selected).intValue(); } }
/** * Setup the default values for the configuration options. */ private void setPresets() { TriggerType selectedTrigger = (TriggerType) drpTriggerType.getSelected(); comboField.setVisible( selectedTrigger != TriggerType.DateField && selectedTrigger != TriggerType.NumberField); dateField.setVisible(selectedTrigger == TriggerType.DateField); numberField.setVisible(selectedTrigger == TriggerType.NumberField); // If a group action selected, then target can only be the field (as it is defined in a group) switch ((ControlActionType) drpActionType.getSelected()) { case ENABLEIN_DISABLEIN: case SHOWIN_HIDEIN: drpTargetType.setSelected(TargetType.WFIELD); drpTargetType.setDisabled(true); break; default: drpTargetType.setDisabled(false); } }
/** * {@inheritDoc} */ @Override protected void preparePaintComponent(final Request request) { if (!isInitialised()) { typeText.setText(menu.getType().toString()); menu.setSelectMode((SelectMode) drop1.getSelected()); sub1.setSelectMode((SelectMode) drop2.getSelected()); sub2.setSelectMode((SelectMode) drop3.getSelected()); setInitialised(true); } handleSelectedText(); handleSelectable(); handleDisable(); }
@Override public void execute(final ActionEvent event) { String stateSelected = (String) state.getSelected(); region.setOptions(getRegions(stateSelected)); region.resetData(); suburb.setOptions((String[]) null); suburb.resetData(); } });
@Override public void execute(final ActionEvent event) { styled.reset(); styled.setType((WStyledText.Type) type.getSelected()); styled.setWhitespaceMode((WStyledText.WhitespaceMode) mode.getSelected()); styled.setText(text.getText()); styled.setHtmlClass(useBigTextClass.isSelected() ? "bigText" : null); styled.setEncodeText(cbEncodeText.isSelected()); // text.setRichTextArea(cbEncodeText.isSelected()); } });
@Test public void testDropdown() { WDropdownSpaceHandlingExample example = (WDropdownSpaceHandlingExample) getUi(); // Launch the web browser to the LDE SeleniumWComponentsWebDriver driver = getDriver(); UIContext uic = getUserContextForSession(); UIContextHolder.pushContext(uic); try { WDropdown dropdown = (WDropdown) TreeUtil.findWComponent(example, new String[]{"WDropdown"}). getComponent(); List<?> options = dropdown.getOptions(); for (Object option : options) { driver.findElement(byWComponent(dropdown, option)).click(); driver.findWButtonByText("Submit").click(); Assert.assertEquals("Incorrect option selected", option, dropdown.getSelected()); } } finally { UIContextHolder.popContext(); } } }