Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8917583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:31:35+00:00 2026-06-15T05:31:35+00:00

I have a my own widget which simulates a multi select list box. It

  • 0

I have a my own widget which simulates a multi select list box.
It will have a list of check boxes.

  public class MultiListBox extends Composite implements IsWidget
  {
    private static MultiListBoxUiBinder uiBinder = GWT
        .create(MultiListBoxUiBinder.class);

    interface MultiListBoxUiBinder extends
        UiBinder<Widget, MultiListBox> {
    }

    public MultiListBox() {
       initWidget(uiBinder.createAndBindUi(this));
    }
    @UiField ScrollPanel scrollPanel;
    @UiField FlowPanel flowPanel;

    private final List<CheckBox> checkboxes = new ArrayList<CheckBox>();
    private final List<String> selectedValues = new  ArrayList<String>();

@Override
public void addItem(final String value, final String text){

    final CheckBox checkbox = new CheckBox(text);
    checkbox.setFormValue(value);

    checkbox.addClickHandler(new ClickHandler()
    {
        public void onClick(final ClickEvent event)
        {
            final CheckBox chkbox = (CheckBox)event.getSource();
            if(chkbox.getValue())
            {
                selectedValues.add(value);
            }
            else
            {
                selectedValues.remove(value);
            }
        }
    });

    flowPanel.add(checkbox);
    checkboxes.add(checkbox);
}

@Override
public List<String> getSelectedValues(){
    return selectedValues;
}

@Override
public void clear() {
    checkboxes.clear();
    selectedValues.clear();
    flowPanel.clear();
}

@Override
public int getItemCount() {
    return checkboxes.size();
}

  }

I am consuming this in my views like

  <my:MultiListBox ui:field="myList"></my:MultiListBox>

Now, I wanted to create a onClick handler for this “myList” field in my view like

    @UiHandler("myList")
    void onMyListCliced(ClickEvent e) {
         //TODO: handle it
    }

Can anyone please guide how to achieve it.

Regards,
Sree

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T05:31:36+00:00Added an answer on June 15, 2026 at 5:31 am

    Your MultiListBox has to implement interface HasClickHandlers (in case of click event).
    If you want to allow usage of other events via UiHandler there is a bunch of other interfaces in a form of Has*Handlers, which you will have to implement on your custom widget.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to hide window after its startup. I have own window-class which is
I'm writing my own class, very similar to a toolbar, which will contain widgets
I have a android.widget.EditText (in multi line read only mode) in which I display
I build a composite widget and would like it to have it's own accelerators
I have own project and i would like add for this class same as
I have own component which works in my testing winform app good but when
I have my own installer program which I use to install several applications I
I'm trying to create a widget (which is basically an iframe) that would have
I have a class which is being operated on by two functions. One function
I am trying to write a web widget which will allow users to display

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.