Dear All,

I am trying to doAutoCompleteX and doFillYpsylonItems as described in the 
official 
design library. <https://weekly.ci.jenkins.io/design-library/>
Yet, something is off and autocomplete is not working at all. In fact, the 
Descriptor.calcX methods are not even called when I set a breakpoint. 

I have uploaded a complete sample code 
<https://github.com/mucst/autocomplete>that should run out of the box as 
hpi:run.
Feel fee to fork it off/insert fix if it's easier that way. The RootAction 
loads and all, controls are in place, yet it refuses to fill data with 
autocomplete information and combos/selects are empty.

Otherwise I inline my code here too:

My RootAction:
package io.jenkins.plugins.autocomplete;

import hudson.Extension;
import hudson.model.AutoCompletionCandidates;
import hudson.model.Describable;
import hudson.model.Descriptor;
import hudson.model.RootAction;
import hudson.util.ComboBoxModel;
import hudson.util.ListBoxModel;
import jenkins.model.Jenkins;
import org.kohsuke.stapler.QueryParameter;

import java.util.List;

@Extension
public class MyRootAction implements Describable<MyRootAction>, RootAction {

    @Override
    public String getIconFileName() {
        return "symbol-textbox";
    }

    @Override
    public String getDisplayName() {
        return "Autocomplete Test";
    }

    @Override
    public String getUrlName() {
        return "autocomplete-test";
    }

    @Override
    public Descriptor<MyRootAction> getDescriptor() {
        return Jenkins.get().getDescriptorOrDie(MyRootAction.class);
    }

    @Extension
    public static class DescriptorImpl extends Descriptor<MyRootAction> {

        public AutoCompletionCandidates doAutoCompleteText(@QueryParameter 
String value) {
            AutoCompletionCandidates resp = new AutoCompletionCandidates();
            resp.add("text1");
            resp.add("text2");
            resp.add("text3");
            return resp;
        }

        public ComboBoxModel doFillComboItems() {
            return new ComboBoxModel(List.of("Combo1", "Combo2"));
        }

        public ListBoxModel doFillSelectItems() {
            ListBoxModel resp = new ListBoxModel();
            resp.add("listbox1","1");
            resp.add("listbox2","2");
            resp.add("listbox3","3");
            return resp;
        }



    }
}

index.jelly:

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" 
xmlns:d="jelly:define"
         xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"
         xmlns:i="jelly:fmt" xmlns:p="/lib/hudson/project">
    <l:layout title="Testing AutoComplete">
        <l:main-panel>
            <h2>Test bellow.</h2>
            <f:entry title="Plain text box with autocomplete" field="text">
                <f:textbox />
            </f:entry>

            <f:entry title="This is a combo box" field="combo">
                <f:combobox />
            </f:entry>


            <f:entry title="A Select backed by ListBoxModel" field="select">
                <f:select />
            </f:entry>

        </l:main-panel>
    </l:layout>
</j:jelly>


Thanks
Tamas

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/1e3b0b7e-4e4c-4606-a02c-eff98d9e12cen%40googlegroups.com.

Reply via email to