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 :

Smart GWT et inheriting require module


Sujet :

GWT et Vaadin Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Inscrit en
    Décembre 2006
    Messages
    196
    Détails du profil
    Informations forums :
    Inscription : Décembre 2006
    Messages : 196
    Par défaut Smart GWT et inheriting require module
    Bonsoir à tous,

    Je suis en train de développer un petit site GWT avec smart GWT.

    Voici mon *.gwt.xml:
    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
     
    <?xml version="1.0" encoding="UTF-8"?>
    <module rename-to='monsmartgwt'>
      <!-- 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.clean.Clean'/> -->
      <!-- <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"/>
      <inherits name="com.smartgwt.tools.SmartGwtTools"/>
     
      <!-- Specify the app entry point class.                         -->
      <entry-point class='com.site.test.client.MonSmartGWT'/>
     
      <!-- Specify the paths for translatable code                    -->
      <source path='client'/>
      <source path='shared'/>
     
    </module>
    Lorsque je démarre tous va bien jusqu'à ce que je tente de setter les datas dans mon grid.

    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
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
     
     
    import com.site.client.data.CountryData;
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.core.client.GWT;
    import com.smartgwt.client.types.Alignment;
    import com.smartgwt.client.types.ListGridFieldType;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.Canvas;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.ImgButton;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.grid.ListGridRecord;
    import com.smartgwt.client.widgets.layout.HLayout;
     
    /**
     * Entry point classes define <code>onModuleLoad()</code>.
     */
    public class MonSmartGWT implements EntryPoint {
    	/**
             * The message displayed to the user when the server cannot be reached or
             * returns an error.
             */
    	private static final String SERVER_ERROR = "An error occurred while "
    			+ "attempting to contact the server. Please check your network "
    			+ "connection and try again.";
     
    	/**
             * Create a remote service proxy to talk to the server-side Greeting service.
             */
    	private final GreetingServiceAsync greetingService = GWT.create(GreetingService.class);
     
    	/**
             * This is the entry point method.
             */
    	public void onModuleLoad() {
     
    		final ListGrid countryGrid = new ListGrid() {   
    			@Override  
    			protected Canvas createRecordComponent(final ListGridRecord record, Integer colNum) {   
     
    				String fieldName = this.getFieldName(colNum);   
     
    				if (fieldName.equals("iconField")) {   
    					HLayout recordCanvas = new HLayout(3);   
    					recordCanvas.setHeight(22);   
    					recordCanvas.setAlign(Alignment.CENTER);   
    					ImgButton editImg = new ImgButton();   
    					editImg.setShowDown(false);   
    					editImg.setShowRollOver(false);   
    					editImg.setLayoutAlign(Alignment.CENTER);   
    					editImg.setSrc("silk/comment_edit.png");   
    					editImg.setPrompt("Edit Comments");   
    					editImg.setHeight(16);   
    					editImg.setWidth(16);   
    					editImg.addClickHandler(new ClickHandler() {   
    						public void onClick(ClickEvent event) {   
    							SC.say("Edit Comment Icon Clicked for country : " + record.getAttribute("countryName"));   
    						}   
    					});   
     
    					ImgButton chartImg = new ImgButton();   
    					chartImg.setShowDown(false);   
    					chartImg.setShowRollOver(false);   
    					chartImg.setAlign(Alignment.CENTER);   
    					chartImg.setSrc("silk/chart_bar.png");   
    					chartImg.setPrompt("View Chart");   
    					chartImg.setHeight(16);   
    					chartImg.setWidth(16);   
    					chartImg.addClickHandler(new ClickHandler() {   
    						public void onClick(ClickEvent event) {   
    							SC.say("Chart Icon Clicked for country : " + record.getAttribute("countryName"));   
    						}   
    					});   
     
    					recordCanvas.addMember(editImg);   
    					recordCanvas.addMember(chartImg);   
    					return recordCanvas;   
    				} else if (fieldName.equals("buttonField")) {   
    					IButton button = new IButton();   
    					button.setHeight(18);   
    					button.setWidth(65);                       
    					button.setIcon("flags/16/" + record.getAttribute("countryCode") + ".png");   
    					button.setTitle("Info");   
    					button.addClickHandler(new ClickHandler() {   
    						public void onClick(ClickEvent event) {   
    							SC.say(record.getAttribute("countryName") + " info button clicked.");   
    						}   
    					});   
    					return button;   
    				} else {   
    					return null;   
    				}   
     
    			}   
    		};   
    		countryGrid.setShowRecordComponents(true);           
    		countryGrid.setShowRecordComponentsByCell(true);   
    		countryGrid.setCanRemoveRecords(true);   
     
    		countryGrid.setWidth(550);   
    		countryGrid.setHeight(224);   
    		countryGrid.setShowAllRecords(true);   
     
    		ListGridField countryCodeField = new ListGridField("countryCode", "Flag", 40);   
    		countryCodeField.setAlign(Alignment.CENTER);   
    		countryCodeField.setType(ListGridFieldType.IMAGE);   
    		countryCodeField.setImageURLPrefix("flags/16/");   
    		countryCodeField.setImageURLSuffix(".png");   
     
    		ListGridField nameField = new ListGridField("countryName", "Country");   
    		ListGridField capitalField = new ListGridField("capital", "Capital");   
    		ListGridField continentField = new ListGridField("continent", "Continent");   
     
    		ListGridField buttonField = new ListGridField("buttonField", "Info");   
    		buttonField.setAlign(Alignment.CENTER);   
     
    		ListGridField iconField = new ListGridField("iconField", "Comments/Stats");   
    		iconField.setWidth(100);   
     
    		countryGrid.setFields(countryCodeField, nameField, capitalField, continentField, buttonField, iconField);   
    		countryGrid.setCanResizeFields(true);   
    		countryGrid.setData(CountryData.getRecords());   
     
    		countryGrid.draw();   
    	}   	
    }
    Lorsque j'atteint la ligne 126:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    countryGrid.setData(CountryData.getRecords());
    j'ai l'erreur suivante.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    19:59:17.661 [ERROR] [monsmartgwt] Line 126: No source code is available for type com.test.client.data.CountryData; did you forget to inherit a required module?
    Merci d'avance

    Classe Countrydata:
    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
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    
    import java.util.Date;
    public class CountryData {   
      
        private static CountryRecord[] records;   
      
        public static CountryRecord[] getRecords() {   
            if (records == null) {   
                records = getNewRecords();   
            }   
            return records;   
        }   
      
        public static CountryRecord[] getNewRecords() {   
            return new CountryRecord[]{   
                    new CountryRecord("North America", "United States", "US", 9631420, 298444215, 12360, new Date(1776 - 1900, 6, 4), "federal republic", 2, "Washington, DC", true, "http://en.wikipedia.org/wiki/United_states", ""),   
                    new CountryRecord("Asia", "China", "CH", 9596960, 1313973713, 8859, null, "Communist state", 0, "Beijing", false, "http://en.wikipedia.org/wiki/China", ""),   
                    new CountryRecord("Asia", "Japan", "JA", 377835, 127463611, 4018, null, "constitutional monarchy with parliamentary government", 1, "Tokyo", true, "http://en.wikipedia.org/wiki/Japan", "")   
            };   
        }   
    }  
    
    Classe Countrydata:
    
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
     
    import com.smartgwt.client.widgets.grid.ListGridRecord;   
    import java.util.Date;   
     
    public class CountryRecord extends ListGridRecord {   
     
    	public CountryRecord() {   
    	}   
     
    	public CountryRecord(String countryCode, String countryName, String capital, String continent) {   
    		setCountryCode(countryCode);   
    		setCountryName(countryName);   
    		setCapital(capital);   
    		setContinent(continent);   
    	}   
     
    	public CountryRecord(String countryCode, String countryName, int population) {   
    		setCountryCode(countryCode);   
    		setCountryName(countryName);   
    		setPopulation(population);   
    	}   
     
    	public CountryRecord(String continent, String countryName, String countryCode, int area, int population, double gdp,   
    			Date independence, String government, int governmentDesc, String capital, boolean memberG8, String article,   
    			String background) {   
     
    		setContinent(continent);   
    		setCountryName(countryName);   
    		setCountryCode(countryCode);   
    		setArea(area);   
    		setPopulation(population);   
    		setGdp(gdp);   
    		setIndependence(independence);   
    		setGovernment(government);   
    		setGovernmentDesc(governmentDesc);   
    		setCapital(capital);   
    		setMemberG8(memberG8);   
    		setArticle(article);   
    		setBackground(background);   
    	}   
     
    	public void setContinent(String continent) {   
    		setAttribute("continent", continent);   
    	}   
     
    	public String getContinent() {   
    		return getAttributeAsString("continent");   
    	}   
     
    	public void setCountryName(String countryName) {   
    		setAttribute("countryName", countryName);   
    	}   
     
    	public String getCountryName() {   
    		return getAttributeAsString("countryName");   
    	}   
     
    	public void setCountryCode(String countryCode) {   
    		setAttribute("countryCode", countryCode);   
    	}   
     
    	public String getCountryCode() {   
    		return getAttributeAsString("countryCode");   
    	}   
     
    	public void setArea(int area) {   
    		setAttribute("area", area);   
    	}   
     
    	public int getArea() {   
    		return getAttributeAsInt("area");   
    	}   
     
    	public void setPopulation(int population) {   
    		setAttribute("population", population);   
    	}   
     
    	public int getPopulation() {   
    		return getAttributeAsInt("population");   
    	}   
     
    	public void setGdp(double gdp) {   
    		setAttribute("gdp", gdp);   
    	}   
     
    	public double getGdp() {   
    		return getAttributeAsDouble("gdp");   
    	}   
     
    	public void setIndependence(Date independence) {   
    		setAttribute("independence", independence);   
    	}   
     
    	public Date getIndependence() {   
    		return getAttributeAsDate("independence");   
    	}   
     
    	public void setGovernment(String government) {   
    		setAttribute("government", government);   
    	}   
     
    	public String getGovernment() {   
    		return getAttributeAsString("government");   
    	}   
     
    	public void setGovernmentDesc(int governmentDesc) {   
    		setAttribute("government_desc", governmentDesc);   
    	}   
     
    	public int getGovernmentDesc() {   
    		return getAttributeAsInt("government_desc");   
    	}   
     
    	public void setCapital(String capital) {   
    		setAttribute("capital", capital);   
    	}   
     
    	public String getCapital() {   
    		return getAttributeAsString("capital");   
    	}   
     
    	public void setMemberG8(boolean memberG8) {   
    		setAttribute("member_g8", memberG8);   
    	}   
     
    	public boolean getMemberG8() {   
    		return getAttributeAsBoolean("member_g8");   
    	}   
     
    	public void setArticle(String article) {   
    		setAttribute("article", article);   
    	}   
     
    	public String getArticle() {   
    		return getAttributeAsString("article");   
    	}   
     
    	public void setBackground(String background) {   
    		setAttribute("background", background);   
    	}   
     
    	public String getBackground() {   
    		return getAttributeAsString("background");   
    	}   
     
    	public String getFieldValue(String field) {   
    		return getAttributeAsString(field);   
    	}   
    }

  2. #2
    Membre averti
    Femme Profil pro
    Développeur informatique
    Inscrit en
    Juin 2012
    Messages
    23
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Algérie

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juin 2012
    Messages : 23
    Par défaut
    Bonjour,

    à première vue j'ai remarqué que vous avez importé le package

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
     
    import com.site.client.data.CountryData;

    alors que vous cherchez la classe CountryData qui se trouve dans le package
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
     
    com.test.client.data.CountryData

    bon courage

Discussions similaires

  1. Erreur lors de la Compilation d'une Application Smart GWT
    Par mido_bc dans le forum GWT et Vaadin
    Réponses: 2
    Dernier message: 24/11/2011, 16h23
  2. Installer Smart GWT
    Par zyanya dans le forum Eclipse
    Réponses: 2
    Dernier message: 07/04/2011, 13h23
  3. RPC "did you forget to inherit a required module?"
    Par gwinyam dans le forum GWT et Vaadin
    Réponses: 21
    Dernier message: 31/05/2010, 11h21
  4. [SmartGWT] did you forget to inherit a required module?
    Par touille dans le forum GWT et Vaadin
    Réponses: 3
    Dernier message: 05/05/2010, 10h46
  5. problème avec GWT:did you forget to inherit a required module
    Par riadhhwajdii dans le forum GWT et Vaadin
    Réponses: 10
    Dernier message: 03/02/2010, 15h42

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