IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

GWT et Vaadin Java Discussion :

Problème affichage composants


Sujet :

GWT et Vaadin Java

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Août 2007
    Messages
    200
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2007
    Messages : 200
    Points : 67
    Points
    67
    Par défaut Problème affichage composants
    Bonjour,
    Je débute en GWT et j'ai le plugin d'ainstallé et qui pointe sur le SDK 2.4.0
    mais j'ai l'impression que la partie dynamique n'apparait pas dans ma page html.
    Ci-dessous mon code ainsi que la capture d'écran de la structure de mon projet:

    Lili.html
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    <html>
    	<head>
     
    		<!--                                           -->
    		<!-- Any title is fine                         -->
    		<!--                                           -->
    		<title>Wrapper HTML for HelloGWT</title>
     
    		<!--                                           -->
    		<!-- Use normal html, such as style            -->
    		<!--                                           -->
    		<style>
    			body,td,a,div,.p{font-family:arial,sans-serif}
    			div,td{color:#000000}
    			a:link,.w,.w a:link{color:#0000cc}
    			a:visited{color:#551a8b}
    			a:active{color:#ff0000}
    		</style>
     
    		<!--                                           -->
    		<!-- The module reference below is the link    -->
    		<!-- between html and your Web Toolkit module  -->		
    		<!--                                           -->
    		<meta name='gwt:module' content='com.mafanta.test.client.Lili'>
     
    	</head>
     
    	<!--                                           -->
    	<!-- The body can have arbitrary html, or      -->
    	<!-- you can leave the body empty if you want  -->
    	<!-- to create a completely dynamic ui         -->
    	<!--                                           -->
    	<body>
     
    		<!--                                            -->
    		<!-- This script is required bootstrap stuff.   -->
    		<!-- You can put it in the HEAD, but startup    -->
    		<!-- is slightly faster if you include it here. -->
    		<!--                                            -->
    		<script language="javascript" src="gwt.js"></script>
     
    		<!-- OPTIONAL: include this if you want history support -->
    		<iframe id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe>
     
    		<h1>HelloGWT</h1>
     
    		<p>
    			This is an example of a host page for the HelloGWT application. 
    			You can attach a Web Toolkit module to any HTML page you like, 
    			making it easy to add bits of AJAX functionality to existing pages 
    			without starting from scratch.
    		</p>
     
    		<table align=center>
    			<tr>
    				<td id="slot1"></td><td id="slot2"></td><td id="slot3"></td>
    			</tr>
    		</table>
    	</body>
    </html>
    Lili.java

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    package com.mafanta.test.client;
     
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.core.client.GWT;
    import com.google.gwt.event.dom.client.ClickEvent;
    import com.google.gwt.event.dom.client.ClickHandler;
    import com.google.gwt.event.dom.client.KeyCodes;
    import com.google.gwt.event.dom.client.KeyUpEvent;
    import com.google.gwt.event.dom.client.KeyUpHandler;
    import com.google.gwt.user.client.rpc.AsyncCallback;
    import com.google.gwt.user.client.ui.Button;
    import com.google.gwt.user.client.ui.DialogBox;
    import com.google.gwt.user.client.ui.HTML;
    import com.google.gwt.user.client.ui.Label;
    import com.google.gwt.user.client.ui.RootPanel;
    import com.google.gwt.user.client.ui.TextBox;
    import com.google.gwt.user.client.ui.VerticalPanel;
    import com.google.gwt.user.client.ui.Widget;
     
    /**
     * Entry point classes define <code>onModuleLoad()</code>.
     */
    public class Lili implements EntryPoint {
    	  /**
               * This is the entry point method.
               */
    	  public void onModuleLoad() {
    	    final Button button = new Button("Click me");
    	    final Label label = new Label();
     
    	    button.addClickHandler(new ClickHandler() {
    	      public void onClick(ClickEvent event) {
    	        if (label.getText().equals(""))
    	          label.setText("Hello World!");
    	        else
    	          label.setText("");
    	      }
    	    });
     
    	    // Assume that the host HTML has elements defined whose
    	    // IDs are "slot1", "slot2".  In a real app, you probably would not want
    	    // to hard-code IDs.  Instead, you could, for example, search for all 
    	    // elements with a particular CSS class and replace them with widgets.
    	    //
    	    RootPanel.get("slot1").add(button);
    	    RootPanel.get("slot2").add(label);
    	    RootPanel.get("slot3").add(label);
    	  }
    }
    Lili.gwt.xml
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     
    <?xml version="1.0" encoding="UTF-8"?>
    <module>
      <!-- Inherit the core Web Toolkit stuff.                        -->
      <inherits name='com.google.gwt.user.User'/>
     
     
      <!-- Specify the app entry point class.                         -->
      <entry-point class='com.mafanta.test.client.Lili'/>
     
     
    </module>
    Images attachées Images attachées  

  2. #2
    in
    in est déconnecté
    Membre expérimenté Avatar de in
    Profil pro
    Inscrit en
    Avril 2003
    Messages
    1 612
    Détails du profil
    Informations personnelles :
    Localisation : France, Finistère (Bretagne)

    Informations forums :
    Inscription : Avril 2003
    Messages : 1 612
    Points : 1 718
    Points
    1 718
    Par défaut
    Apparemment il ne trouve pas le fichier gwt.js.

    Je n'ai jamais utilisé la technique du <meta name='gwt:module' ...
    mais tu peux essayer sans :

    module.gwt.xml, utilise le rename-to pour éviter d'avoir le package dans le nom du module
    <module rename-to="Lili">

    page html :
    retire le meta et modifie le nom du script gwt.js pour Lili/Lili.nocache.js
    Tu peux vérifier le chemin dans le war, j'ai mis ça au pif ...
    "If email had been around before the telephone was invented, people would have said, 'Hey, forget email! With this new telephone invention I can actually talk to people!"

    Besoin d'une nouvelle méthode pour développer ? -> http://www.la-rache.com/

Discussions similaires

  1. [WB18] [COMPOSANT] Problème affichage et exécution de boutons
    Par Simeonn dans le forum WebDev
    Réponses: 0
    Dernier message: 12/07/2013, 14h26
  2. Problème affichage avec composant SWT
    Par alouky88 dans le forum SWT/JFace
    Réponses: 1
    Dernier message: 05/06/2012, 11h42
  3. Problème affichage composant
    Par mamoun_ dans le forum Flex
    Réponses: 3
    Dernier message: 01/11/2009, 18h14
  4. Problème d'affichage Composants
    Par setto dans le forum Débuter
    Réponses: 11
    Dernier message: 10/04/2009, 20h45

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo