Visit a choice type (COBOL REDEFINES) which determines which alternative
must be selected.
<p/>

@param choiceType the choice type
@param callback a function that is invoked after the selected alternative
has been visited
335690
public void visitCobolChoiceType(CobolChoiceType choiceType,
            ChoiceTypeAlternativeHandler callback) {

        CobolType alternative = null;

        // If we have a user provided strategy give it a chance to select a
        // alternative
        if (customChoiceStrategy != null) {
            alternative = customChoiceStrategy.choose(curFieldName, choiceType,
                    variables, hostData, lastPos, length);
        }

        // If user strategy did not succeed, try the default one
        if (alternative == null) {
            alternative = defaultChoiceStrategy.choose(curFieldName,
                    choiceType, variables, hostData, lastPos, length);
        }

        // All attempts have failed
        if (alternative == null) {
            throw new CobolChoiceStrategyException(
                    "Unable to select an alternative for choice "
                            + curFieldName + ", path: "
                            + getCurFieldFullCobolName());
        }

        // Make sure the strategy is returning a known alternative
        String alternativeName = choiceType.getAlternativeName(alternative);
        if (alternativeName == null) {
            throw new CobolChoiceStrategyException(
                    "Alternative does not correspond to a known alternative for choice "
                            + curFieldName + ", path: "
                            + getCurFieldFullCobolName());
        }

        callback.preVisit(alternativeName,
                choiceType.getAlternativeIndex(alternativeName), alternative);

        alternative.accept(this);

        // If the alternative chosen is not the largest one, add the difference
        // to an extra offset that will be used if a fixed position item follows
        // this choice
        if (alternative.getMaxBytesLen() < choiceType.getMaxBytesLen()) {
            extraOffset += choiceType.getMaxBytesLen()
                    - alternative.getMaxBytesLen();
        }

        callback.postVisit(alternativeName,
                choiceType.getAlternativeIndex(alternativeName), alternative);

    }
163428
public void setType(int type) {
        this.type = type;
        if(headerAll != null) {
            headerAll.setType(this.type);
        }
        if(headerFirst != null) {
            headerFirst.setType(this.type);
        }
        if(headerLeft != null) {
            headerLeft.setType(this.type);
        }
        if(headerRight != null) {
            headerRight.setType(this.type);
        }
    }
1082326
public function addCallback( $type, $callback ) {
		if ( !isset( $this->callbacks[$type] ) ) {
			$this->callbacks[$type] = [];
		}
		$this->callbacks[$type][] = $callback;
	}
195001
private void initializeSelectionListener() {
        ChoiceMode choiceMode = adapter.getChoiceMode();

        if (choiceMode instanceof MultipleChoiceMode) {
            adapter.setOnItemClickListener(
                    new OnMultiChoiceClickListenerWrapper(multiChoiceListener, getDialog(), 0));
        } else if (choiceMode instanceof SingleChoiceMode) {
            adapter.setOnItemClickListener(
                    new OnItemClickListenerWrapper(singleChoiceListener, getDialog(), 0));
        } else {
            adapter.setOnItemClickListener(
                    new OnItemClickListenerWrapper(singleChoiceListener, getDialog(),
                            DialogInterface.BUTTON_POSITIVE));
        }
    }
129363
function(type, options) {
		L.Util.setOptions(this, options);

		this._ready = google.maps.Map !== undefined;
		if (!this._ready) L.Google.asyncWait.push(this);

		this._type = type || 'SATELLITE';
	}
160804
public static <P extends ICallbackPredicate> CallbackOption<P> of(Priority priority)
		{
			return new CallbackOption<>(null, priority);
		}
476261
function(callOpts) {
			var flag = this.isSelected();

			//		this.debug("fixSelection3AfterClick()");

			this.visit(function(node) {
				node._changeSelectStatusAttrs(flag);
			});
			this.fixSelection3FromEndNodes(callOpts);
		}
987688
public static <P extends ICallbackPredicate> CallbackOption<P> of(P predicate, Priority priority)
		{
			return new CallbackOption<>(checkNotNull(predicate), priority);
		}
1191143
public <T extends Type> T selectCandidate(T[] candidates, T actual, Environment environment) {
		//
		T candidate = null;
		for (int i = 0; i != candidates.length; ++i) {
			T next = candidates[i];
			if (subtypeOperator.isSubtype(next, actual, environment)) {
				if (candidate == null) {
					candidate = next;
				} else {
					candidate = selectCandidate(candidate, next, actual, environment);
				}
			}
		}
		//
		return candidate;
	}
642470
function SelectionField(type, options) {
  Field.call(this, type, options);

  this.arg = new Argument();

  this.menu = new Menu({
    document: this.document,
    maxPredictions: Conversion.maxPredictions
  });
  this.element = this.menu.element;

  this.onFieldChange = util.createEvent('SelectionField.onFieldChange');

  // i.e. Register this.onItemClick as the default action for a menu click
  this.menu.onItemClick.add(this.itemClicked, this);
}
810362
function (source, opts, cb) {
        var callback,
            options;

        if (arguments.length === 2) {
            options = defaults();
            callback = opts;
        } else {
            options = defaults(opts);
            callback = cb;
        }

        try {
            source = api.clean(source);
            callback(null, api.insert(source, getToc(source, options)));
        } catch (err) {
            callback(err, null);
        }
    }
713644
@SuppressWarnings("unchecked")
	public final <TYPE> CallBack<TYPE> poll(TYPE type,long callKey)
	{
		return (CallBack<TYPE>) caches.poll(callKey);
	}
939133
public static void setInputChoiceStrategy(Job job, Class<? extends FromCobolChoiceStrategy> choiceStrategyClass) {
      job.getConfiguration().setClass(CONF_INPUT_RECORD_CHOICE_STRATEGY_CLASS, choiceStrategyClass, FromCobolChoiceStrategy.class);
    }
556368
public void addChoice (Object choice)
    {
        String name = (choice == null) ? "null" : choice.toString();
        addChoice(new Choice(name, choice));
    }
574534
public void setSelectionCriteriaListOnRestore(SelectionCriteria[] selectionCriteriaList)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setSelectionCriteriaListOnRestore", selectionCriteriaList);

        if (selectionCriteriaList != null)
        {
            this.topics = new String[selectionCriteriaList.length];
            for (int i = 0; i < selectionCriteriaList.length; i++)
            {
                topics[i] = (selectionCriteriaList[i] == null) ? null : selectionCriteriaList[i].getDiscriminator();
            }
            this.selectionCriteriaList = selectionCriteriaList;
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setSelectionCriteriaListOnRestore");
    }
798735
public void setType(TYPE type) {
    if(type == null) {
      type = TYPE.UNSET;
    }
    this.type = type;
  }
771132
@Override
    public void handleSelection(final CmsResourceTypeBean selectedType) {

        CmsObject cms = A_CmsUI.getCmsObject();
        m_selectedType = selectedType;
        try {

            CmsNewResourceBuilder builder = new CmsNewResourceBuilder(cms);
            builder.addCallback(new I_Callback() {

                public void onError(Exception e) {

                    m_dialogContext.error(e);
                }

                public void onResourceCreated(CmsNewResourceBuilder builderParam) {

                    finish(Lists.newArrayList(builderParam.getCreatedResource().getStructureId()));
                }
            });

            m_selectedType = selectedType;

            Boolean useDefaultLocation = m_defaultLocationCheckbox.getValue();
            if (useDefaultLocation.booleanValue() && (m_selectedType.getCreatePath() != null)) {
                try {
                    CmsADEConfigData configData = OpenCms.getADEManager().lookupConfiguration(
                        cms,
                        m_folderResource.getRootPath());

                    CmsResourceTypeConfig typeConfig = configData.getResourceType(m_selectedType.getType());
                    if (typeConfig != null) {
                        typeConfig.configureCreateNewElement(cms, m_folderResource.getRootPath(), builder);
                    }
                } catch (Exception e) {
                    m_dialogContext.error(e);
                }

            } else {
                boolean explorerNameGenerationMode = false;
                String sitePath = cms.getRequestContext().removeSiteRoot(m_folderResource.getRootPath());
                String namePattern = m_selectedType.getNamePattern();
                if (CmsStringUtil.isEmptyOrWhitespaceOnly(namePattern)) {
                    namePattern = OpenCms.getWorkplaceManager().getDefaultNamePattern(m_selectedType.getType());
                    explorerNameGenerationMode = true;
                }
                String fileName = CmsStringUtil.joinPaths(sitePath, namePattern);
                builder.setPatternPath(fileName);
                builder.setType(m_selectedType.getType());
                builder.setExplorerNameGeneration(explorerNameGenerationMode);

            }
            CmsPropertyDialogExtension ext = new CmsPropertyDialogExtension(A_CmsUI.get(), null);
            CmsAppWorkplaceUi.get().disableGlobalShortcuts();
            ext.editPropertiesForNewResource(builder);
            finish(new ArrayList<CmsUUID>());

        } catch (Exception e) {
            throw new RuntimeException(e);
        }

    }