private void addRadioButtons() { boolean first = true; for ( String resourceSuffix : this.resourceTypes.keySet() ) { Radio radioButton = new Radio( FILE_TYPE ); radioButton.setText( resourceSuffix ); radioButton.setValue( first ); first = false; radioButtonList.add( radioButton ); add( radioButton ); } }
@Override public void ensureDomEventHandlers(final Radio radio) { final Handler handler = new Handler(radio); radio.addClickHandler(handler); radio.addMouseUpHandler(handler); radio.addBlurHandler(handler); radio.addKeyDownHandler(handler); }
@Override public void onKeyDown(KeyDownEvent event) { oldValue = radio.getValue(); }
/** * @see #RadioButton(String, SafeHtml) * * @param name * the group name with which to associate the radio button * @param label * this radio button's label * @param directionEstimator * A DirectionEstimator object used for automatic direction * adjustment. For convenience, * {@link #DEFAULT_DIRECTION_ESTIMATOR} can be used. */ public Radio(String name, String label, DirectionEstimator directionEstimator) { this(name); setDirectionEstimator(directionEstimator); setText(label); }
protected void addRadioButtons() { boolean first = true; radioButtonList.clear(); for (ScenarioSimulationModel.Type sourceType : ScenarioSimulationModel.Type.values()) { Radio radioButton = new Radio(SOURCE_TYPE); radioButton.setText(sourceType.name()); radioButton.setValue(first); radioButton.addValueChangeHandler(this); first = false; radioButtonList.add(radioButton); add(radioButton); } uploadWidget.setVisible(isDMNSelected()); } }
private void initializeFields() { isMultiModuleRadioButton.setValue(true); isConfigureRepositoryCheckBox.setValue(true); isSingleModuleRadioButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { isMultiModuleRadioButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) {
@Override public void select() { modelCreator.setValue(true); } }
/** {@inheritDoc} */ @Override public void setValue(final T value, final boolean fireEvents) { for (Radio child : getRadioChildren()) { try { if (value != null && value.equals(parser.parse(child.getFormValue()))) { child.setValue(true, fireEvents); } } catch (ParseException e) { } } }
/** * @see #RadioButton(String, SafeHtml) * * @param name * the group name with which to associate the radio button * @param label * this radio button's label * @param dir * the text's direction. Note that {@code DEFAULT} means * direction should be inherited from the widget's parent * element. */ public Radio(String name, String label, Direction dir) { this(name); setText(label, dir); }
protected void refreshInput(Map<TYPE, String> optionsValues, TYPE selectedValue) { input.clear(); for (TYPE key : optionsValues.keySet()) { Radio radio; SafeHtml text = getOptionLabel(optionsValues.get(key)); if (field.getInline()) { radio = new InlineRadio(field.getId(), text); } else { radio = new Radio(field.getId(), text); } radio.setFormValue(key.toString()); radio.setEnabled(!field.getReadOnly()); input.add(radio); } if (optionsValues.containsKey(selectedValue)) { input.setValue(selectedValue, true); } }
/** * Creates a new radio button associated with a particular group, and * initialized with the given label (optionally treated as HTML). All radio * buttons associated with the same group name belong to a * mutually-exclusive set. * * Radio buttons are grouped by their name attribute, so changing their name * using the setName() method will also change their associated group. * * @param name * name the group with which to associate the radio button * @param label * this radio button's label * @param asHTML * <code>true</code> to treat the specified label as HTML */ public Radio(String name, String label, boolean asHTML) { this(name); if (asHTML) { setHTML(label); } else { setText(label); } }
/** {@inheritDoc} */ @Override public T getValue() { for (Radio child : getRadioChildren()) { if (child.getValue()) { try { return parser.parse(child.getFormValue()); } catch (ParseException e) { } } } return null; }
/** * Update the radio children names. */ protected void updateChildren() { for (Radio child : getRadioChildren()) { HandlerRegistration reg = valueChangedRegistrations.get(child); if (reg == null) { valueChangedRegistrations.put(child, child.addValueChangeHandler(changeHandler)); } child.setName(name); } }
private void displayCalculationTypes(final Pattern52 selectedPattern, final ConditionCol52 selectedCondition) { final boolean isPredicate = (selectedCondition.getConstraintValueType() == BaseSingleFieldConstraint.TYPE_PREDICATE); final boolean hasEnum = presenter.hasEnum(selectedPattern, selectedCondition); calculationType.setVisible(!isPredicate); optLiteral.setEnabled(!isPredicate); optLiteral.setVisible(!isPredicate); optFormula.setEnabled(!(isPredicate || hasEnum)); optFormula.setVisible(!isPredicate); operatorContainer.setVisible(!isPredicate); optPredicate.setEnabled(isPredicate); optPredicate.setVisible(isPredicate); txtPredicateExpression.setEnabled(isPredicate); predicateExpressionContainer.setVisible(isPredicate); }
private void initialiseCalculationTypes() { optLiteral.addClickHandler(new ClickHandler() { optFormula.addClickHandler(new ClickHandler() { optPredicate.addClickHandler(new ClickHandler() {
@Override protected void setReadOnly(boolean readOnly) { input.getRadioChildren().forEach(radio -> radio.setEnabled(!readOnly)); }
public boolean isDMNSelected() { return radioButtonList.stream() .filter(CheckBox::getValue) .anyMatch(radioButton -> radioButton.getText().equalsIgnoreCase(ScenarioSimulationModel.Type.DMN.name())); }
optLiteral.setValue(true); displayCalculationTypes(availablePatternsSelection, chosenConditionsSelection); break; case BaseSingleFieldConstraint.TYPE_RET_VALUE: optFormula.setValue(true); displayCalculationTypes(availablePatternsSelection, chosenConditionsSelection); break; case BaseSingleFieldConstraint.TYPE_PREDICATE: optPredicate.setValue(true); displayCalculationTypes(availablePatternsSelection, chosenConditionsSelection);
/** {@inheritDoc} */ @Override public void setValue(final T value, final boolean fireEvents) { for (Radio child : getRadioChildren()) { try { if (value != null && value.equals(parser.parse(child.getFormValue()))) { child.setValue(true, fireEvents); } } catch (ParseException e) { } } }