Uploaded image for project: 'Forge'
  1. Forge
  2. FORGE-2339

Repeated values when auto-completing a UISelectMany component

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • 3.x Future
    • 2.16.1.Final
    • UI - Shell
    • None

      Having a command defined as:

      import java.util.Arrays;
      
      import javax.inject.Inject;
      
      import org.jboss.forge.addon.ui.command.AbstractUICommand;
      import org.jboss.forge.addon.ui.context.UIBuilder;
      import org.jboss.forge.addon.ui.context.UIContext;
      import org.jboss.forge.addon.ui.context.UIExecutionContext;
      import org.jboss.forge.addon.ui.input.UISelectMany;
      import org.jboss.forge.addon.ui.metadata.UICommandMetadata;
      import org.jboss.forge.addon.ui.result.Result;
      import org.jboss.forge.addon.ui.result.Results;
      import org.jboss.forge.addon.ui.util.Metadata;
      
      public class Comando extends AbstractUICommand {
      
      	@Inject
      	private UISelectMany<String> source;
      
      	@Override
      	public UICommandMetadata getMetadata(UIContext context) {
      		return Metadata.forCommand(Comando.class).name("comando");
      	}
      
      	@Override
      	public void initializeUI(UIBuilder builder) throws Exception {
      		source.setValueChoices(Arrays.asList("Spring")).setDefaultValue(
      				Arrays.asList("Java"));
      		builder.add(source);
      	}
      
      	@Override
      	public Result execute(UIExecutionContext context) throws Exception {
      		return Results.success("Result: " + source.getValue());
      	}
      }
      

      When running in the shell, type:

      comando --source Spring
      

      Keep pressing <TAB> and you should see Spring repeated over and over

              Unassigned Unassigned
              rhn-support-ggastald George Gastaldi
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated: