Search code examples
javacomboboxsmartgwt

SmartGWT: ComboBox - ValueMap not appearing


I'm still newbie in SmartGWT, currently having a strange problem..

I am using Windows XP and SmartGWT version 3.0, GWT SDK 2.4.0 (using Eclipse IDE).

So my problem is, I kind of copied examples from the SmartGWT showcase: Styled ComboBox

DynamicForm df = new DynamicForm();
ComboBoxItem cb = new ComboBoxItem();
cb.setValueMap("cat", "dog", "bird");
cb.setTitle("Select:");
df.setItems(cb);
...
layout.addMember(df);

And when I run it as Web Application, the valuemap doesn't appear. I mean, the [v] button is there but nothing happens when i clicked it..

Sorry for the noob question, and thanks for your help! :D


UPDATE - 05/03/2012

Here is what appears on my browser:

screenshot removed

Here is the full standalone code:

HelloWorld.java

package com.example.helloworld.client;

import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.ComboBoxItem;


    public class HelloWorld implements EntryPoint {

        public void onModuleLoad() {

            VLayout layout = new VLayout();
            layout.setWidth100();
            layout.setHeight100();

            DynamicForm df = new DynamicForm();
            ComboBoxItem cb = new ComboBoxItem();
            cb.setTitle("Select :");
            cb.setValueMap("Cat", "Dog", "Bird");

            df.setItems(cb);
            layout.addMember(df);

            layout.draw();
        }
    }

HelloWorld.gwt.xml

<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='helloworld'>
  <!-- Inherit the core Web Toolkit stuff.                        -->
  <inherits name='com.google.gwt.user.User'/>

  <!-- Inherit the default GWT style sheet.  You can change       -->
  <!-- the theme of your GWT application by uncommenting          -->
  <!-- any one of the following lines.                            -->

  <!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
  <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
  <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/>     -->

  <!-- Other module inherits                                      -->
  <inherits name="com.smartgwt.SmartGwt" />

  <!-- Specify the app entry point class.                         -->
  <entry-point class='com.example.helloworld.client.HelloWorld'/>

  <!-- Specify the paths for translatable code                    -->
  <source path='client'/>
  <source path='shared'/>
</module>

On the 'Development Mode' tab in Eclipse (the one that shows you link to run on browser), i get this message:

[INFO] [helloworld] - Your *.gwt.xml module configuration prohibits the use of the current doucment rendering mode (document.compatMode=' CSS1Compat').
Modify your application's host HTML page doctype, or update your custom 'document.compatMode' configuration property settings.

There is also a single warning:

The following classpath entry 'C:\some-path\smartgwt-3.0\smartgwt.jar' will not be available on the server's classpath.


UPDATE 2 - HTML and CSS file

HTML:

<!doctype html>
<!-- The DOCTYPE declaration above will set the     -->
<!-- browser's rendering engine into                -->
<!-- "Standards Mode". Replacing this declaration   -->
<!-- with a "Quirks Mode" doctype is not supported. -->

<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">

    <!--                                                               -->
    <!-- Consider inlining CSS to reduce the number of requested files -->
    <!--                                                               -->
    <link type="text/css" rel="stylesheet" href="HelloWorld.css">

    <!--                                           -->
    <!-- Any title is fine                         -->
    <!--                                           -->
    <title>Web Application Starter Project</title>

    <!--                                           -->
    <!-- This script loads your compiled module.   -->
    <!-- If you add any GWT meta tags, they must   -->
    <!-- be added before this line.                -->
    <!--                                           -->
    <script type="text/javascript" language="javascript" src="helloworld/helloworld.nocache.js"></script>
  </head>

  <!--                                           -->
  <!-- The body can have arbitrary html, or      -->
  <!-- you can leave the body empty if you want  -->
  <!-- to create a completely dynamic UI.        -->
  <!--                                           -->
  <body>

    <!-- OPTIONAL: include this if you want history support -->
    <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>

    <!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
    <noscript>
      <div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
        Your web browser must have JavaScript enabled
        in order for this application to display correctly.
      </div>
    </noscript>

  </body>
</html>

and the CSS file:

/** Add css rules here for your application. */


/** Example rules used by the template application (remove for your app) */
h1 {
  font-size: 2em;
  font-weight: bold;
  color: #777777;
  margin: 40px 0px 70px;
  text-align: center;
}

.sendButton {
  display: block;
  font-size: 16pt;
}

/** Most GWT widgets already have a style name defined */
.gwt-DialogBox {
  width: 400px;
}

.dialogVPanel {
  margin: 5px;
}

.serverResponseLabelError {
  color: red;
}

/** Set ids using widget.getElement().setId("idOfElement") */
#closeButton {
  margin: 15px 6px 6px;
}

IMPORTANT UPDATE

I forgot to inform you that I am currently using Google Chrome(18.0.1025.168) for debug / test build. When I ran it on Firefox, it runs OK!

I noticed this thread a bit late.. So this is currently a known bug.

conclusion: do NOT use google chrome for GWT / smartGWT development mode (for now).

Thank you for your help! :D


Solution

  • I forgot to inform you that I am currently using Google Chrome(18.0.1025.168) for debug / test build. When I ran it on Firefox, it runs OK!

    I noticed this thread (smartclient forum) a bit late.. So this is currently a known bug.

    conclusion: do NOT use google chrome for GWT / smartGWT development mode (for now).

    Thank you for your help! :D