Autocompletion feature for Terminal

UI Components for JSF
Post Reply
hatspencer
Posts: 4
Joined: 01 Sep 2010, 21:08

27 May 2016, 23:09

Hi!

I was missing an autocompletion feature from the Terminal for a long time, so I just forked the GitHub project and added a simple extension. In short, I just added a new attribute with a method expression, and in that method I return the autocompleted command, if applicable. The value of the input box is replaced in case of completion.

Code: Select all

<p:terminal id="terminal" 
	commandHandler="#{terminalController.handleCommand}"
	autoCompleteHandler="#{terminalController.autoCompleteCommand}" />
I've just bound this to TAB. I think it is a good start, it feels really terminal-ish :) I saw there is an open issue for this feature, here Cagatay refers implementing something similar to textarea. What do you think?

P.S.: In my implementation I created a new class which extends the code of org.primefaces.component.terminal.Terminal.java. I did so because Terminal.java is generated. Noob question incoming: am I not able to change the source of that class?

User avatar
sudheer
PrimeFaces Core Developer
Posts: 4345
Joined: 16 Oct 2011, 19:19
Location: Singapore

28 May 2016, 14:52

You can add the new attributes in terminal.xml file and maven-jsf plugin will generate Terminal.java file.Then you can create a PR with all the changes.
Author,Speaker
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/

___________________
Sudheer Jonna

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 42 guests