dimanche 16 juillet 2017

How to use checkBox with values from async interface in GWT?

I am currently developing an GWT app where I should refactor some Form Panel to use check box not combo box. But I am not familiar with check boxes in GWT. I see option in check boxex to add a list of some objects but I have to set values from metod from async interface. This is example how that is done with combo box:

FormPanel roleFormPanel = new FormPanel(FORM_LABEL_WIDTH);

        RpcProxy<ListLoadResult<GwtRole>> roleUserProxy = new RpcProxy<ListLoadResult<GwtRole>>() {

            @Override
            protected void load(Object loadConfig, AsyncCallback<ListLoadResult<GwtRole>> callback) {
                GWT_ROLE_SERVICE.findAll(currentSession.getSelectedAccount().getId(),
                        callback);
            }
        };

        BaseListLoader<ListLoadResult<GwtRole>> roleLoader = new BaseListLoader<ListLoadResult<GwtRole>>(roleUserProxy);
        ListStore<GwtRole> roleStore = new ListStore<GwtRole>(roleLoader);
        //
        // Role
        rolesCombo = new ComboBox<GwtRole>();
        rolesCombo.setEditable(false);
        rolesCombo.setTypeAhead(false);
        rolesCombo.setAllowBlank(false);
        rolesCombo.setFieldLabel(MSGS.dialogAddRoleComboName());
        rolesCombo.setTriggerAction(TriggerAction.ALL);
        rolesCombo.setStore(roleStore);
        rolesCombo.setDisplayField("name");
        rolesCombo.setValueField("id");

        roleFormPanel.add(rolesCombo);

        //
        // Add form panel to body
        bodyPanel.add(roleFormPanel);

Could someone help me to say me how to show values like this but with check boxes?

Aucun commentaire:

Enregistrer un commentaire