Examples of Option


Examples of org.kohsuke.args4j.Option

                public boolean isMultiValued() {
                    return false;
                }
            };
            Option option = p.annotation(Option.class);
            if (option!=null) {
                parser.addOption(setter,option);
            }
            Argument arg = p.annotation(Argument.class);
            if (arg!=null) {
View Full Code Here

Examples of org.maltparserx.core.options.option.Option

   */
  public Option getOption(String optiongroup, String optionname) throws MaltChainedException {   
    if (optionname == null || optionname.length() <= 0) {
      throw new OptionException("The option name '"+optionname+"' cannot be found" );
    }
    Option option;
    if (ambiguous.contains(optionname.toLowerCase())) {
      if (optiongroup == null || optiongroup.length() <= 0) {
        throw new OptionException("The option name '"+optionname+"' is ambiguous use option group name to distinguish the option. ");
      }
      else {
View Full Code Here

Examples of org.mmisw.orrclient.gwt.client.vocabulary.Option

    listBox.addChangeListener(new ChangeListener () {
      public void onChange(Widget sender) {
        String value = listBox.getValue(listBox.getSelectedIndex());
        textBox.setText(value);
       
        Option option = options.get(listBox.getSelectedIndex());
        optionSelected(option);

        _onChange();

        popup.hide();
      }
    });
   
    /////////////////////////////////////////////////////////
    // Use a SuggestBox with a MultiWordSuggestOracle.
    //
    // A map from a suggestion to its corresponding Option:
    final Map<String,Option> suggestions = new HashMap<String,Option>();
    MultiWordSuggestOracle oracle = new MultiWordSuggestOracle("/ :-");
    for ( Option option : options ) {
      String suggestion = option.getName()+ " - " +option.getUri();
      suggestions.put(suggestion, option);
      oracle.add(suggestion);

    }
    final SuggestBox suggestBox = new SuggestBox(oracle);
    suggestBox.setWidth(width);
    suggestBox.addEventHandler(new SuggestionHandler() {
      public void onSuggestionSelected(SuggestionEvent event) {
        String suggestion = event.getSelectedSuggestion().getReplacementString();
        Option option = suggestions.get(suggestion);
        textBox.setText(option.getName());
        optionSelected(option);
       
        _onChange();
       
        popup.hide();
View Full Code Here

Examples of org.molgenis.util.cmdline.Option

    for (int i = 0; i < fields.length; i++)
    {
      // only include the annotated fields
      if (fields[i].isAnnotationPresent(Option.class))
      {
        Option opt = fields[i].getAnnotation(Option.class);
        if (opt.param() == Option.Param.PASSWORD)
        {
          result.put(opt.name(), "xxxxxx");
        }
        else
        {
          result.put(opt.name(), fields[i].get(this));
        }
      }
    }
    return result;
  }
View Full Code Here

Examples of org.nfctools.llcp.parameter.Option

          break;
        case PduConstants.PARAM_RW:
          params.add(new ReceiveWindowSize(pduData[offset + 2] & 0x0F));
          break;
        case PduConstants.PARAM_OPT:
          params.add(new Option(pduData[offset + 2] & 0x01));
          break;

        default:
          throw new IllegalArgumentException("unknown code " + pduData[offset] + " at position " + offset
              + ". [" + NfcUtils.convertBinToASCII(pduData) + "]");
View Full Code Here

Examples of org.openbp.jaspira.option.Option

    if (options != null)
    {
      int n = options.size();
      for (int i = 0; i < n; ++i)
      {
        Option option = (Option) options.get(i);
        option.uninstall();
      }
      options = null;
    }
  }
View Full Code Here

Examples of org.openengsb.core.api.descriptor.AttributeDefinition.Option

        Builder builder = AttributeDefinition.builder(mock);
        builder.name("ONE").id("123");
        MethodUtil.addEnumValues(TestEnum.class, builder);
        AttributeDefinition build = builder.build();
        List<Option> options = build.getOptions();
        Option option0 = options.get(0);
        assertThat(option0.getLabel().getString(Locale.getDefault()), equalTo(TestEnum.ONE.toString()));
        assertThat(option0.getValue().toString(), equalTo(TestEnum.ONE.toString()));
        Option option1 = options.get(1);
        assertThat(option1.getLabel().getString(Locale.getDefault()), equalTo(TestEnum.ONE.toString()));
        assertThat(option1.getValue().toString(), equalTo(TestEnum.TWO.toString()));
    }
View Full Code Here

Examples of org.openmrs.module.htmlformentry.widget.Option

            drugLabels = Arrays.asList(parameters.get(FIELD_DRUG_LABELS).split(","));
        }

    // fill drop down with drug names from database
    List<Option> options = new ArrayList<Option>();
    options.add(new Option("", "", false));

    // drugNames is comma separated list which can contain ID, UUID or drugname
    StringTokenizer tokenizer = new StringTokenizer(drugNames, ",");
    int drugListIndexPos = 0;
        String displayText = "";
        DrugOrderField dof = new DrugOrderField();
    while (tokenizer.hasMoreElements()) {
      String drugName = (String) tokenizer.nextElement();
      Drug drug = null;

      // see if this is a uuid
      if (HtmlFormEntryUtil.isValidUuidFormat(drugName.trim())) {
        drug = conceptService.getDrugByUuid(drugName.trim());
      }

      // if we didn't find by id, find by uuid or name
      if (drug == null){
        drug = conceptService.getDrugByNameOrId(drugName.trim());
      }

      if (drug != null) {
          displayText = drug.getName();
          if (drugLabels != null) {
              displayText = drugLabels.get(drugListIndexPos);
          }
        options.add(new Option(displayText, drug.getDrugId().toString(), false));
        if (drugsUsedAsKey == null) {
            drugsUsedAsKey = new ArrayList<Drug>();
        }
        drugsUsedAsKey.add(drug);
        DrugOrderAnswer doa = new DrugOrderAnswer(drug, displayText);
        dof.addDrugOrderAnswer(doa);
        drugListIndexPos ++;
      } else if (drugName.length() > 0 && drugName.charAt(0) == '/' && drugName.charAt(drugName.length()-1) == '/'){
          options.add(new Option("[ " + drugName.substring(1,drugName.length()-1) + " ]", "~", false));
      } else {
          throw new IllegalArgumentException("No Drug found for drug name/id/uuid " + drugName);
      }
    }

    if (drugsUsedAsKey == null)
      throw new IllegalArgumentException("You must provide a valid drug name, or a valid ID or a valid UUID in " + parameters);

        // there need to be the same number of drugs as drug labels
        if (drugLabels != null && drugsUsedAsKey.size() != drugLabels.size())
            throw new IllegalArgumentException("There are a different number of drugLabels (" + drugLabels.size() + ") than drugs (" + drugsUsedAsKey.size() + ").");


        // Register Drug Widget
        if (checkbox && drugsUsedAsKey.size() == 1){
            CheckboxWidget cb = new CheckboxWidget();
            cb.setLabel(displayText);
            cb.setValue(drugsUsedAsKey.get(0).getDrugId().toString());
            drugWidget = cb;
        } else {
            DropdownWidget dw = new DropdownWidget();
            dw.setOptions(options);
            drugWidget = dw;
        }
        context.registerWidget(drugWidget);
        drugErrorWidget = new ErrorWidget();
        context.registerErrorWidget(drugWidget, drugErrorWidget);

    //start date
    startDateWidget = new DateWidget();
        startDateErrorWidget = new ErrorWidget();
        context.registerWidget(startDateWidget);
        context.registerErrorWidget(startDateWidget, startDateErrorWidget);

        if (!hideDoseAndFrequency){
        // dose validation by drug is done in validateSubmission()
        doseWidget = new NumberFieldWidget(0d, 9999999d, true);
        //set default value (maybe temporarily)
        String defaultDoseStr = parameters.get(CONFIG_DEFAULT_DOSE);
        if (!StringUtils.isEmpty(defaultDoseStr)){
            try {
                defaultDose = Double.valueOf(defaultDoseStr);
                doseWidget.setInitialValue(defaultDose);
            } catch (Exception ex){
                    throw new RuntimeException("optional attribute 'defaultDose' must be numeric or empty.");
            }
        }

        doseErrorWidget = new ErrorWidget();
        context.registerWidget(doseWidget);
        context.registerErrorWidget(doseWidget, doseErrorWidget);

        createFrequencyWidget(context, mss);

        createFrequencyWeekWidget(context, mss);
        }

        if (!usingDurationField){
        discontinuedDateWidget = new DateWidget();
        discontinuedDateErrorWidget = new ErrorWidget();
        context.registerWidget(discontinuedDateWidget);
        context.registerErrorWidget(discontinuedDateWidget, discontinuedDateErrorWidget);
        }
    if (parameters.get(FIELD_DISCONTINUED_REASON) != null){
        String discReasonConceptStr = (String) parameters.get(FIELD_DISCONTINUED_REASON);
        Concept discontineReasonConcept = HtmlFormEntryUtil.getConcept(discReasonConceptStr);
        if (discontineReasonConcept == null)
            throw new IllegalArgumentException("discontinuedReasonConceptId is not set to a valid conceptId or concept UUID");
        dof.setDiscontinuedReasonQuestion(discontineReasonConcept);

        discontinuedReasonWidget = new DropdownWidget();
        discontinuedReasonErrorWidget = new ErrorWidget();

        List<Option> discOptions = new ArrayList<Option>();
        discOptions.add(new Option("", "", false));

        if (parameters.get(FIELD_DISCONTINUED_REASON_ANSWERS) != null){
            //setup a list of the reason concepts
            List<Concept> discReasons = new ArrayList<Concept>();
            String discAnswersString = (String) parameters.get(FIELD_DISCONTINUED_REASON_ANSWERS);
            String[] strDiscAnswers = discAnswersString.split(",");
            for (int i = 0; i < strDiscAnswers.length; i++){
                String thisAnswer = strDiscAnswers[i];
                Concept answer = HtmlFormEntryUtil.getConcept(thisAnswer, "discontinueReasonAnswers includes a value that is not a valid conceptId or concept UUID");
                  discReasons.add(answer);
            }

            if (parameters.get(FIELD_DISCONTINUED_REASON_ANSWER_LABELS) != null){
                // use the listed discontinueReasons, and use labels:
                String discLabelsString = parameters.get(FIELD_DISCONTINUED_REASON_ANSWER_LABELS);
                String[] strDiscAnswerLabels = discLabelsString.split(",");
                //a little validation:
                if (strDiscAnswerLabels.length != discReasons.size())
                    throw new RuntimeException("discontinueReasonAnswers and discontinueReasonAnswerLabels must contain the same number of members.");
                for (int i = 0; i < strDiscAnswerLabels.length; i ++ ){
                    discOptions.add(new Option( strDiscAnswerLabels[i], discReasons.get(i).getConceptId().toString(),false));
                    dof.addDiscontinuedReasonAnswer(new ObsFieldAnswer(strDiscAnswerLabels[i].trim(), discReasons.get(i)));
                }
            } else {
                // use the listed discontinueReasons, and use their ConceptNames.
                for (Concept c: discReasons){
                    discOptions.add(new Option( c.getBestName(Context.getLocale()).getName(), c.getConceptId().toString(),false));
                    dof.addDiscontinuedReasonAnswer(new ObsFieldAnswer(c.getBestName(Context.getLocale()).getName(), c));
                }
            }
        } else {
            //just use the conceptAnswers
            for (ConceptAnswer ca : discontineReasonConcept.getAnswers()){
                discOptions.add(new Option( ca.getAnswerConcept().getBestName(Context.getLocale()).getName(), ca.getAnswerConcept().getConceptId().toString(),false));
                dof.addDiscontinuedReasonAnswer(new ObsFieldAnswer(ca.getAnswerConcept().getBestName(Context.getLocale()).getName(), ca.getAnswerConcept()));
            }
        }
        if (discOptions.size() == 1)
            throw new IllegalArgumentException("discontinue reason Concept doesn't have any ConceptAnswers");
View Full Code Here

Examples of org.ops4j.pax.exam.Option

                systemProperty("pax.exam.osgi.unresolved.fail").value("fail"),
                systemProperty("org.osgi.service.http.port").value(getServerPort()),
                cleanCaches(),
                createTestBundle(),
                addCodeCoverageOption());
        final Option vmOption = (paxRunnerVmOption != null) ? CoreOptions.vmOption(paxRunnerVmOption)
                : null;
        return OptionUtils.combine(base, vmOption);
    }
View Full Code Here

Examples of org.rhq.core.clientapi.descriptor.configuration.Option

            return ret;
        }

        private static Option convert(PropertyDefinitionEnumeration option) {
            Option ret = new Option();
            ret.setName(option.getName());
            ret.setValue(option.getValue());
            return ret;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.