Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to implement the ModelData interface in ext gwt?
    text
    copied!<p>I am trying to use an EditorGrid in a project that I am working on. I am using EditorGrid grid = new EditorGrid (...) </p> <p>ClassGrade is an object that contains the name, grade (as a Grade object), and credit hours for a class. </p> <p>However, ClassGrade must implement ModelData. When I tried to implement the interface, there are a few methods that I am not sure how to correctly implement. </p> <pre><code>@Override public &lt;X&gt; X get(String property) { if (property.equals("name")) return this.getClassName(); if (property.equals("hours")) return this.getHours(); if (property.equals("grade")) return this.getGrade(); return null; } @Override public Map&lt;String, Object&gt; getProperties() { Map&lt;String, Object&gt; propMap = new HashMap&lt;String, Object&gt;(); propMap.put("grade", this.getGrade()); propMap.put("hours", this.getHours()); propMap.put("name", this.getClassName()); return propMap; } @Override public Collection&lt;String&gt; getPropertyNames() { ArrayList&lt;String&gt; props = new ArrayList&lt;String&gt;(); props.add("grade"); props.add("hours"); props.add("name"); return props; } @Override public &lt;X&gt; X remove(String property) { // TODO Auto-generated method stub return null; } @Override public &lt;X&gt; X set(String property, X value) { // TODO Auto-generated method stub return null; } </code></pre> <p>I dont know what to do for the get, remove, and set methods, because I do not know what the X means. I tried using</p> <pre><code> @Override public &lt;X&gt; X get(String property) { if (property.equals("name")) return this.getClassName(); if (property.equals("hours")) return this.getHours(); if (property.equals("grade")) return this.getGrade(); return null; } </code></pre> <p>but that didn't work because the return was not of type X. What am I doing wrong and how do I get this to work? </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload