mmmm ... i don't understand , but:
you should test your service with jUnit , then . try that:
seee:
parametricas = ServiceLocator.getFacadeParametricas();
public class ComunasSelector extends Composite {
private SuggestBox listadoSuggestComunas;
private ComunaSuggestOracle listComunas;
private ComunaTo comunaSeleccionada;
private boolean seleccionValida;
private FacadeParametricasAsync parametricas;
/**
* Construccion por defecto.
*/
public ComunasSelector() {
parametricas = ServiceLocator.getFacadeParametricas();
listComunas = new ComunaSuggestOracle();
listadoSuggestComunas = new SuggestBox(listComunas);
listadoSuggestComunas.addEventHandler(new SuggestionHandler() {
public void onSuggestionSelected(SuggestionEvent event) {
ComunaMultiWordSuggestion comuna =
(ComunaMultiWordSuggestion)event.getSelectedSuggestion();
comunaSeleccionada = comuna.getComuna();
}}
);
listadoSuggestComunas.addFocusListener(getFocusListener());
getParametricas().listarComunas(new DefaultAsyncCallback() {
@Override
protected void doWhenComplete(Object result) {
List<ComunaTo> lista = (List<ComunaTo>)result;
for ( ComunaTo e : lista ) {
listComunas.add( new ComunaMultiWordSuggestion
( e ) );
}
}});
initWidget(listadoSuggestComunas);
}
/**
* Si al momento de perder el foco, la comuna contiene palabras
invalidas
* se se borra el campo. El usuario est obligado a elegir una
opcion valida.
* @return
*/
public FocusListener getFocusListener () {
return new FocusListener() {
public void onFocus(Widget sender) {
}
public void onLostFocus(Widget sender) {
if ( !isSeleccionValida() ) {
comunaSeleccionada = null;
getListadoSuggestComunas().setText("");
}
}};
}
/**
* En caso de de ser comunas para un region en particular.
* @param regionId
*/
public ComunasSelector(int regionId ) {
//TODO, implementar funcionalidad.
}
/**
* @return the comunaSeleccionada
*/
public ComunaTo getComunaSeleccionada() {
return comunaSeleccionada;
}
/**
* @param comunaSeleccionada the comunaSeleccionada to set
*/
public void setComunaSeleccionada(ComunaTo comunaSeleccionada) {
this.comunaSeleccionada = comunaSeleccionada;
}
/**
* @return the listadoSuggestComunas
*/
public SuggestBox getListadoSuggestComunas() {
return listadoSuggestComunas;
}
/**
* @param listadoSuggestComunas the listadoSuggestComunas to set
*/
public void setListadoSuggestComunas(SuggestBox
listadoSuggestComunas) {
this.listadoSuggestComunas = listadoSuggestComunas;
}
/**
* @return the listComunas
*/
public ComunaSuggestOracle getListComunas() {
return listComunas;
}
/**
* @return the seleccionValida
*/
public boolean isSeleccionValida() {
return seleccionValida;
}
/**
* @param seleccionValida the seleccionValida to set
*/
public void setSeleccionValida(boolean seleccionValida) {
this.seleccionValida = seleccionValida;
}
/**
* @return the parametricas
*/
public FacadeParametricasAsync getParametricas() {
return parametricas;
}
/**
* @param parametricas the parametricas to set
*/
public void setParametricas(FacadeParametricasAsync parametricas)
{
this.parametricas = parametricas;
}
}
....
private ComunasSelector suggestComunas;
.....
suggestComunas = new ComunasSelector();
.....
layout.setWidget(INICIO_FORM + 2, 1, suggestComunas );
....
etc..
I hope I have helped
On 27 oct, 02:27, Cage <[email protected]> wrote:
> I tried to import that class in and it able to show a suggestbox in
> new page, but it is not able to got the data from server side, I guess
> the problem should be on the RPC connection, please help, thank you
> very much.
>
> c...@hk
>
> On Oct 27, 1:23 pm, Cage <[email protected]> wrote:
>
> > Hi all,
>
> > I just create a suggestBox with RPC source, and I want to use it in
> > couple of formpanel in difference pages, is it possible? Would you
> > mind to tell me how and where can I found the information abou that.
> > Thank you very much.
>
> > c...@hk
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---