Index: topia/src/java/org/codelutin/topia/ui/swing/TopiaComboBoxModel.java diff -u topia/src/java/org/codelutin/topia/ui/swing/TopiaComboBoxModel.java:1.1 topia/src/java/org/codelutin/topia/ui/swing/TopiaComboBoxModel.java:1.2 --- topia/src/java/org/codelutin/topia/ui/swing/TopiaComboBoxModel.java:1.1 Thu Jul 8 13:50:49 2004 +++ topia/src/java/org/codelutin/topia/ui/swing/TopiaComboBoxModel.java Fri Jul 16 16:19:36 2004 @@ -11,55 +11,58 @@ import javax.swing.AbstractListModel; import javax.swing.ComboBoxModel; +import org.codelutin.topia.TopiaContext; import org.codelutin.topia.TopiaQuery; /** * @author pineau - * + * * TODO To change the template for this generated type comment go to Window - * Preferences - Java - Code Style - Code Templates */ public class TopiaComboBoxModel extends AbstractListModel implements ComboBoxModel { - - protected TopiaQuery query = null; - protected List data = null; - protected Object selectedItem = null; - - public TopiaComboBoxModel(TopiaQuery query) { - this.query = query; - // lancer une invocation asynchrone pour la requete - } - - public void setQuery(TopiaQuery query) { - this.query = query; - eventOccured(); - } - - public void eventOccured() { - // TODO : rafraichissement nb column, data, ... - // TODO un peu d'optimisation eventuellement :-) ? - fireContentsChanged(this, 0, data.size()); - } - - public Object getSelectedItem() { - return selectedItem; - } - - public void setSelectedItem(Object selectedItem) { - this.selectedItem = selectedItem; - } - - public int getSize() { - if (data == null) return 0; - return data.size(); - } - - public Object getElementAt(int x) { - if (data == null) return null; - if (x >= getSize()) { - return null; - } - return data.get(x); - } + + protected TopiaQuery query = null; + protected TopiaContext context = null; + protected List data = null; + protected Object selectedItem = null; + + public TopiaComboBoxModel(TopiaContext context, TopiaQuery query) { + this.query = query; + this.context = context; + // lancer une invocation asynchrone pour la requete + } + + public void setQuery(TopiaQuery query) { + this.query = query; + eventOccured(); + } + + public void eventOccured() { + // TODO : rafraichissement nb column, data, ... + // TODO un peu d'optimisation eventuellement :-) ? + fireContentsChanged(this, 0, data.size()); + } + + public Object getSelectedItem() { + return selectedItem; + } + + public void setSelectedItem(Object selectedItem) { + this.selectedItem = selectedItem; + } + + public int getSize() { + if (data == null) return 0; + return data.size(); + } + + public Object getElementAt(int x) { + if (data == null) return null; + if (x >= getSize()) { + return null; + } + return data.get(x); + } } Index: topia/src/java/org/codelutin/topia/ui/swing/TopiaTableModel.java diff -u topia/src/java/org/codelutin/topia/ui/swing/TopiaTableModel.java:1.2 topia/src/java/org/codelutin/topia/ui/swing/TopiaTableModel.java:1.3 --- topia/src/java/org/codelutin/topia/ui/swing/TopiaTableModel.java:1.2 Thu Jul 15 14:37:59 2004 +++ topia/src/java/org/codelutin/topia/ui/swing/TopiaTableModel.java Fri Jul 16 16:19:36 2004 @@ -20,10 +20,10 @@ import javax.swing.table.TableColumnModel; import org.codelutin.generator.Util; -import org.codelutin.topia.TopiaContext; + import org.codelutin.topia.TopiaException; import org.codelutin.topia.TopiaQuery; - +import org.codelutin.topia.TopiaContext; /** * @author pineau * @@ -41,6 +41,10 @@ protected String[] columnNames = null; protected String[] columnOrders = null; protected List data = null; + + public TopiaTableModel(TopiaContext context, TopiaQuery query){ + this(context, query, null, null, null); + } public TopiaTableModel(TopiaContext context, TopiaQuery query, String[] fields) { this(context, query, fields, fields, new String[fields.length]);