Ignore:
Timestamp:
2001-04-04T22:44:38+12:00 (23 years ago)
Author:
daven
Message:

turned on the BerryBasket. Try right-clicking on a result in the results List
to add one - no delete yet. Re-sizing maybe improved as well - no
guarantees yet though.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/BerryBasketModel.java

    r2225 r2281  
    2727
    2828
    29 class BerryBasketModel extends AbstractTableModel
    30 {
     29class BerryBasketModel extends AbstractTableModel {
    3130
    32  String[] content = {"Doc1", "Doc2", "Doc3"};
    33  String[] columnTitles = {"Document", "Person", "Date"};
     31    private ArrayList columnTitles;
     32    private ArrayList berryBasket;
     33
     34    private String DOCUMENT = "Document";
     35    private String DATE = "Date";
    3436 
    3537 
    36     public BerryBasketModel()
    37     {
    38         super();
    39     }
     38    public BerryBasketModel()
     39    {
     40    super();
     41    berryBasket = new ArrayList();
     42    columnTitles = new ArrayList();
     43    columnTitles.add(DOCUMENT);
     44    //columnTitles.add("User");
     45    columnTitles.add(DATE);
     46    }
    4047
    41     public void add(Berry berry)
    42     {
    43         System.out.println("adding to BerryBasketModel: "  + berry.toString());
    44         //addElement(berry);
    45     }
     48    public void add(Berry berry) {
     49    System.out.println("adding to BerryBasketModel: "  + berry.toString());
     50    berryBasket.add(0, berry);
     51    fireTableRowsInserted(0,0);
     52    }
     53   
     54    public int getColumnCount() {
     55    return columnTitles.size();
     56    }
    4657
     58    public String getColumnName(int column) {
     59    return (String) columnTitles.get(column);
     60    }
     61
     62    public int getRowCount() {
     63    return berryBasket.size();
     64    }
    4765   
    48     public int getColumnCount() { return columnTitles.length; }
    49    
    50     public int getRowCount() { return content.length;}
    51    
    52     public Object getValueAt(int row, int col) {
    53          // get Berry object
    54          // extract document title (say), person, date info from Berry object
    55          // depending on column number
    56          // column reordering shouldn't matter, all
    57          // gets dealt with automatically
    58          return Color.black;
    59     }
    60    
    61     public String getColumnName(int col) {
    62                return columnTitles[col];
     66    public Object getValueAt(int row, int column) {
     67    // get Berry object
     68    // extract document title (say), person, date info from Berry object
     69    // depending on column number
     70    // column reordering shouldn't matter, all
     71    // gets dealt with automatically
     72
     73    Berry berry = (Berry) berryBasket.get(row);
     74
     75    if (column == columnTitles.indexOf(DOCUMENT)) return berry.toString();
     76
     77    if (column == columnTitles.indexOf(DATE)) return berry.getDateAdded();
     78
     79    // shouldn't get here but display something anyway
     80    return "row" + row + "col" + column;
    6381    }
    6482   
Note: See TracChangeset for help on using the changeset viewer.