Hi Kelo,
what is unclear?
The error message clearly states that you tried more than once to set
a center widget.
.. DockPanel.CENTER);
Set breakpoints on both statements which doing this and watch.
Stefan Bachert
http://gwtworld.de
On Jun 11, 5:32 pm, Kelo <
mcac...@gmail.com> wrote:
> Clicking on my ant's script
>
> <target name="devmode" depends="javac" description="Run development
> mode">
> <java failonerror="true" fork="true"
> classname="com.google.gwt.dev.DevMode">
> <classpath>
> <pathelement location="src"/>
> <pathelement location="/Galileo/workspace/Mark5/src"/>
> <path refid="project.class.path"/>
> </classpath>
> <jvmarg value="-Xmx256M"/>
> <jvmarg value="-Xss16M"/>
> <arg value="-noserver"/>
> <arg value="-port"/>
> <arg value="8080"/>
> <arg value="-startupUrl"/>
> <arg value="VCarCli/VCarCli.html"/>
> <arg value="-logLevel"/>
> <arg value="DEBUG"/>
> <!-- Additional arguments like -style PRETTY or -logLevel DEBUG
> -->
> <arg value="-war"/>
> <arg value="D:/Galileo/workspace/VCarCli/war"/>
> <arg value="com.gasban.VCarCli"/>
> </java>
> </target>
>
> When I launch DevMode so on my GWT DevMode Box, app tab shows this
> errors:
>
> 00:00:50,872 [ERROR] Unable to load module entry point class
> com.gasban.client.VCarCli (see associated exception for details)
> java.lang.IllegalArgumentException: Only one CENTER widget may be
> added
> at com.google.gwt.user.client.ui.DockPanel.add(DockPanel.java:166)
> at com.gasban.client.AbstractApp.mostrar(AbstractApp.java:87)
> at com.gasban.client.VCarCli.changeHistory(VCarCli.java:36)
> at com.gasban.client.VCarCli.changeHistory(VCarCli.java:33)
> at com.gasban.client.AbstractApp.onValueChange(AbstractApp.java:53)
> at
> com.google.gwt.event.logical.shared.ValueChangeEvent.dispatch(ValueChangeEvent.java:
> 128)
> at
> com.google.gwt.event.logical.shared.ValueChangeEvent.dispatch(ValueChangeEvent.java:
> 1)
> at com.google.gwt.event.shared.HandlerManager
> $HandlerRegistry.fireEvent(HandlerManager.java:65)
> at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.access
> $1(HandlerManager.java:53)
> at
> com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:
> 178)
> at
> com.google.gwt.user.client.impl.HistoryImpl.fireEvent(HistoryImpl.java:
> 74)
> at
> com.google.gwt.event.logical.shared.ValueChangeEvent.fire(ValueChangeEvent.java:
> 43)
> at
> com.google.gwt.user.client.impl.HistoryImpl.fireHistoryChangedImpl(HistoryImpl.java:
> 81)
> at
> com.google.gwt.user.client.History.fireCurrentHistoryState(History.java:
> 121)
> at com.gasban.client.VCarCli.cargarPanelesSistema(VCarCli.java:77)
> at com.gasban.client.VCarCli.onModuleLoad(VCarCli.java:44)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> 25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:369)
> at
> com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:
> 185)
> at
> com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:
> 380)
> at
> com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:
> 222)
> at java.lang.Thread.run(Thread.java:619)
>
> SWF:
>
> Galileo 3.5.2
> GWT 2.0.3
> jdk1.6.0_17
> jboss-4.0.5
>
> sources:
>
> public class VCarCli extends AbstractApp {
> private static VCarCli instance;
>
> public VCarCli() {
> instance = this;
> }
>
> public static VCarCli getInstance() {
> if (instance != null) return instance;
> return new VCarCli();
> }
>
> @Override
> public void changeHistory(String token, boolean afectaHistoria) {
> PanelEspecialInfo info = list.encontrar(token);
> if (info == null) {
> this.changeHistory("Clientes",false);
> return;
> }
> mostrar(info, afectaHistoria);
> }
>
> /**
> * This is the entry point method.
> */
> public void onModuleLoad() {
> seeds.put("Clientes", (Seed)(new DRSSeed("clientservice")));
> cargarPanelesSistema();
> }
>
> private void cargarPanelesSistema() {
> if (RootPanel.get().getWidgetCount()>0)
> RootPanel.get().remove(0);
> // Carga todos lo Paneles Especiales
> list.agregar(Clientes.init(), false);
> list.agregar(PanelCliente.init());
>
> // Put the sink list on the left, and add the outer dock panel to
> the
> // root.
> sinkContainer = new DockPanel();
> sinkContainer.setStyleName("sv-Contenedor");
>
> VerticalPanel vp = new VerticalPanel();
> vp.setWidth("100%");
> vp.add(description);
> vp.add(sinkContainer);
>
> description.setStyleName("sv-Info");
>
> panel.add(list, DockPanel.WEST);
> panel.add(vp, DockPanel.CENTER);
>
> panel.setCellVerticalAlignment(list, HasAlignment.ALIGN_TOP);
> panel.setCellWidth(vp, "100%");
>
> // Add history listener
> History.addValueChangeHandler(this);
>
> RootPanel.get("panelPrincipal").add(panel);
>
> // Now that we've setup our listener, fire the initial history
> state.
> History.fireCurrentHistoryState();
>
> changeHistory("Clientes",false);
> }
>
> }
>
> public abstract class AbstractApp implements PanelInterface,
> EntryPoint, ValueChangeHandler<String>, SeedInterface {
> protected static PanelEspecialInfo curInfo;
> protected static PanelEspecial curSink;
> protected HTML description = new HTML();
> protected ListaPanelEspecial list = new ListaPanelEspecial();
> protected DockPanel panel = new DockPanel();
> protected DockPanel sinkContainer;
>
> protected HashMap<String,Seed> seeds= new HashMap<String,Seed>();
>
> public Seed getSeed(String seed) {
> return (Seed)seeds.get(seed);
> }
>
> @Override
> public void onValueChange(ValueChangeEvent<String> event) {
> // Ecuentra el PanelEspecialInfo asociado con el contexto de
> historia. Si alguno es
> // encontrado, lo muestra (Este puede no ser encontrado, por
> ejemplo, cuando el usuario vincula
> // una URL no tipificada, o al comienzo, cuando el contexto seria
> "").
> this.changeHistory(event.getValue(),false);
> }
>
> public abstract void changeHistory(String token,boolean
> afectaHistoria);
>
> public PanelEspecial mostrar(PanelEspecialInfo info, boolean
> afectaHistoria) {
> // No hay problema en volver a mostrar el Panel Especial
> existente.
> // Este puede estar ya registrado en la práctica, porque cuando
> el contexto de historia esta
> // configurado nuestro evento onHistoryChanged() intentará
> mostrar el Panel Especial
> // en curso ya visible.
> if (info == curInfo)
> return curInfo.getInstance();
> curInfo = info;
>
> // Remueve el viejo Panel Especial del area de display.
> if (curSink != null) {
> curSink.onHide();
> sinkContainer.remove(curSink.getWidget());
> }
>
> // Toma la nueva instancia Panel Especial, y muestra su
> descripción en la
> // lista de Paneles Especiales.
> curSink = info.getInstance();
> list.fijarSeleccion(info.getName());
> description.setHTML(info.getDescription());
>
> // Si afectaHistoria es verdadero, crea un nuevo item en la pila
> de historia. Este
> // será el último resultado en onHistoryChanged() al que fue
> llamado. De modo que si es
> // nuevamente invocado con el método mostrar(), nada suceder pues
> este requerira el mismo
> // Panel Especial al que ya hemos mostrado.
> if (afectaHistoria)
> History.newItem(info.getName());
>
> // Muestra el nuevo Panel Especial.
> sinkContainer.add(curSink.getWidget(), DockPanel.CENTER);
> sinkContainer.setCellWidth(curSink.getWidget(), "100%");
> sinkContainer.setCellHeight(curSink.getWidget(), "100%");
> sinkContainer.setCellVerticalAlignment(curSink.getWidget(),
> DockPanel.ALIGN_TOP);
> curSink.onShow();
> return curSink;
> }
>
> public PanelEspecial getPanelEspecial(String nombre) {
> return ((PanelEspecialInfo)list.encontrar(nombre)).getInstance();
> }
>
> public PanelEspecial getPanelEspecial() {
> return curSink;
> }
>
> public PanelEspecialInfo getPanelEspecialInfo(String nombre) {
> return (PanelEspecialInfo)list.encontrar(nombre);
> }
>
> public PanelEspecialInfo getPanelEspecialInfo() {
> return curInfo;
> }
>
> }
>
> Anyone can help me ?