コード例 #1
0
  {
    filter = new CityFilter();

    cityRPCService = GWT.create(CityRPCService.class);
    stateRPCService = GWT.create(StateRPCService.class);
    countryRPCService = GWT.create(CountryRPCService.class);

    textDescription = new TextItem(Attribute.DESCRIPTION, I18N.$.LABEL_DESCRIPTION());

    selectState = new SelectItem(Attribute.STATE, I18N.$.LABEL_STATE());
    selectState.setPickListHeight(100);

    selectCountry = new SelectItem(Attribute.COUNTRY, I18N.$.LABEL_COUNTRY());
    selectCountry.setPickListHeight(100);
    selectCountry.addChangeHandler(
        new ChangeHandler() {
          public void onChange(final ChangeEvent event) {
            stateRPCService.findByCountryId(
                Integer.parseInt((String) event.getValue()), stateFindCallback);
          }
        });

    fieldDescription = new ListGridField(Attribute.DESCRIPTION, I18N.$.LABEL_DESCRIPTION());
    fieldState = new ListGridField(Attribute.STATE, I18N.$.LABEL_STATE());
    fieldCountry = new ListGridField(Attribute.COUNTRY, I18N.$.LABEL_COUNTRY());
    fieldLastUpdate = new ListGridField(Attribute.LAST_UPDATE, I18N.$.LABEL_LAST_UPDATE());
    fieldLastUpdate.setCellFormatter(GWTUtils.getDateTimeCellFormatter());

    stateFindCallback =
        new AsyncCallback<List<StateDTO>>() {
          public void onFailure(final Throwable throwable) {
            GWTUtils.showError(throwable);
          }

          public void onSuccess(final List<StateDTO> dtos) {
            selectState.setValueMap(GWTUtils.getStateValueMap(dtos));
          }
        };

    countryFindCallback =
        new AsyncCallback<List<CountryDTO>>() {
          public void onFailure(final Throwable throwable) {
            GWTUtils.showError(throwable);
          }

          public void onSuccess(final List<CountryDTO> dtos) {
            selectCountry.setValueMap(GWTUtils.getCountryValueMap(dtos));
          }
        };
  }
コード例 #2
0
 @Override
 protected void clean() {
   super.clean();
   selectState.setValueMap(GWTUtils.getEmptyValueMap());
 }