Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: jac/aspects/gui/web/List.java


1   /*
2     Copyright (C) 2001-2003 Laurent Martelli <laurent@aopsys.com>
3     
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU Lesser General Public License as
6     published by the Free Software Foundation; either version 2 of the
7     License, or (at your option) any later version.
8   
9     This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU Lesser General Public License for more details.
13  
14    You should have received a copy of the GNU Lesser General Public License
15    along with this program; if not, write to the Free Software
16    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
17  
18  package jac.aspects.gui.web;
19  
20  import jac.aspects.gui.*;
21  import jac.aspects.gui.FieldView;
22  import jac.core.Collaboration;
23  import jac.core.Wrappee;
24  import jac.core.rtti.ClassItem;
25  import jac.core.rtti.ClassRepository;
26  import jac.core.rtti.CollectionItem;
27  import jac.core.rtti.FieldItem;
28  import jac.core.rtti.MetaItem;
29  import jac.core.rtti.MethodItem;
30  import jac.util.Classes;
31  import jac.util.Log;
32  import java.io.PrintWriter;
33  import java.util.Collection;
34  import java.util.Iterator;
35  import java.util.Vector;
36  
37  public class List extends AbstractCollection
38     implements HTMLViewer, CollectionListener
39  {
40     public List(ViewFactory factory, DisplayContext context,
41                 CollectionItem collection, Object substance,
42                 CollectionModel model) {
43        super(factory,context,collection,substance,model);
44     }
45  
46     public void sort() {
47     }
48  
49     // HTMLViewer interface
50  
51     public void genHTML(PrintWriter out) {
52        sort();
53  
54        genAdderAndRemover(out);
55        out.println("<table class=\"list\">");
56        out.println("  <tbody>");
57  
58        for (int index=startIndex; 
59             (!split || index<startIndex+rowsPerPage) && index<model.getRowCount(); 
60             index++) 
61        {
62           String row = (String)((ListModel)model).getElementAt(index);
63           out.println("    <tr"+(selected==index?" class=\"selected\"":"")+">");
64           out.println("      <td><a href=\""+
65                       eventURL("onView")+
66                       "&amp;index="+index+"\">"+row+"</a></td>");
67           if (GuiAC.isRemovable(collection))
68              out.println("      <td><a href=\""+eventURL("onRemove")+
69                          "&amp;index="+index+"\">"+removeLink(index)+"</a></td>");
70           out.println("    </tr>");
71        }
72        out.println("  </tbody>");
73  
74        out.println("</table>");
75     }
76  }