i dont think anyone is working for me i just found what seems to be a very big bug in gwt since for some reason its not possible to implement the list interface and i belive it is a potential problem for alot of people other then me
import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.ListIterator; public class SmartQueue<T> implements List<T>{ protected ArrayList<T> m_items; protected int m_Limit=-1; /** * constructor * @param lim = limit of queue to set */ public SmartQueue() { } public SmartQueue(int lim) { m_Limit=lim; } /** * Enqueue a member into head of queue * @param val-val to insert */ public T Enqueue(T val) { m_items.add(0, val); return (m_Limit>0 && m_items.size()>m_Limit) ? Dequeue() : null; } /** * Enqueue a member into a chosen pos at the queue * @param val-val to insert */ public T Enqueue(T val,int at) { m_items.add(at, val); return (m_Limit>0 && m_items.size()>m_Limit) ? Dequeue() : null; } /** * Enqueue a member into head of queue * @param val-val to insert */ public Collection<T> Enqueue(Collection<? extends T> coll) { m_items.addAll(0, coll); if(m_Limit>0 && m_items.size()>m_Limit) { return Dequeue(m_items.size() - m_Limit); } return null; } /** * Enqueue a member into head of queue * @param val-val to insert */ public Collection<T> Enqueue(Collection<? extends T> coll,int at) { m_items.addAll(at, coll); if(m_Limit>0 && m_items.size()>m_Limit) { return Dequeue(m_items.size() - m_Limit); } return null; } /** * Dequeue a member from tail end of queue * @return T - the member of the queue that was removed */ public T Dequeue() { int end = m_items.size()-1; T res = m_items.get(end); m_items.remove(end); return res; } /** * Dequeue a member list from tail end of queue * @return T - the member of the queue that was removed */ public Collection<T> Dequeue(int count) { Collection<T>res = new ArrayList<T>(); for (int i = m_items.size()-count; i < m_items.size(); i++) { res.add(get(i)); m_items.remove(i); } return res; } /** * get the maximum capacity of the queue * @return maximum capacity of the queue */ public int GetLimit() { return m_Limit; } /** * sets maximum capacity of the queue * @param lim-the limit of the queue to set */ public void SetLimit(int lim) { m_Limit=lim; } public void SetItemPosition(int from,int to) { if(from >0 && from < m_items.size()&& to >0 && to < m_items.size()) { Collections.swap(m_items, from, to); } } private Collection<T> GetAndRemoveOverLimit() { if(m_Limit>0 && m_items.size()>m_Limit) { return Dequeue(m_items.size() - m_Limit); } return null; } private void RemoveOverLimit() { if(m_Limit>0 && m_items.size()>m_Limit) { Dequeue(m_items.size() - m_Limit); } } @Override public boolean add(T e) { boolean res = m_items.add(e); RemoveOverLimit(); return res; } @Override public void add(int index, T element) { RemoveOverLimit(); m_items.add(index,element); } @Override public boolean addAll(Collection<? extends T> c) { boolean res =addAll(c); RemoveOverLimit(); return res; } @Override public boolean addAll(int index, Collection<? extends T> c) { boolean res =addAll(index,c); RemoveOverLimit(); return res; } @Override public void clear() { m_items.clear(); } @Override public boolean contains(Object o) { return m_items.contains(o); } @Override public boolean containsAll(Collection<?> c) { // TODO Auto-generated method stub return m_items.containsAll(c); } @Override public T get(int index) { // TODO Auto-generated method stub return m_items.get(index); } @Override public int indexOf(Object o) { // TODO Auto-generated method stub return m_items.indexOf(o); } @Override public boolean isEmpty() { // TODO Auto-generated method stub return m_items.isEmpty(); } @Override public Iterator<T> iterator() { return m_items.iterator(); } @Override public int lastIndexOf(Object o) { return m_items.lastIndexOf(o); } @Override public ListIterator<T> listIterator() { // TODO Auto-generated method stub return m_items.listIterator(); } @Override public ListIterator<T> listIterator(int index) { // TODO Auto-generated method stub return m_items.listIterator(index); } @Override public boolean remove(Object o) { return m_items.remove(o); } @Override public T remove(int index) { // TODO Auto-generated method stub return m_items.get(index); } @Override public boolean removeAll(Collection<?> c) { // TODO Auto-generated method stub return m_items.removeAll(c); } @Override public boolean retainAll(Collection<?> c) { // TODO Auto-generated method stub return m_items.retainAll(c); } @Override public T set(int index, T element) { // TODO Auto-generated method stub return m_items.set(index, element); } @Override public int size() { // TODO Auto-generated method stub return m_items.size(); } @Override public List<T> subList(int fromIndex, int toIndex) { return m_items.subList(fromIndex, toIndex); } @Override public Object[] toArray() { return m_items.toArray(); } @Override public <T> T[] toArray(T[] a) { // TODO Auto-generated method stub return m_items.toArray(a); } } On 23 נובמבר, 14:49, Lothar Kimmeringer <j...@kimmeringer.de> wrote: > ben fenster schrieb: > > > i know !!! > > So why do you try to create a subclass of an interface? > > > but when i try to implement it > > Implement != subclass. > > > and the compile it i get a general > > error saying my main module cant be loaded > > You try to compile it for deployment or are we talking about > the hosted mode? if the latter, what's the error-message > showing up in the details-pane if you click on the main-entry > > > so baby ! show me any class you create that inherites from List and of > > course compile it ! > > I come to the impression that you think that I'm some kind > of support-guy you have the right to use for free. That's > not the case, so please work on your way of asking questions: > > - Don't use exclamation and question marks excessively > - Give as much information as possible to be able to > reproduce or at least understand your problem > - Don't forget: It's you, who want to be helped, so ask > in a way motivating as much people as possible to > help you. > > I never needed to create a new implementation of java.util.List > but alway use ArrayList for the client side of the application. > Most likely java.util.List is not part of the client JRE that > is converted to Javascript leading to the error (but that's just > a guess, the error-message in the details-pane should clearify > that). > > Regards, Lothar -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=.