Changeset 2184 for trunk/java-client/org


Ignore:
Timestamp:
2001-03-15T20:39:37+13:00 (23 years ago)
Author:
daven
Message:

preferences dialog added

Location:
trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient
Files:
6 edited

Legend:

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

    r2162 r2184  
     1
    12/*
    23 *    SimpleGraphicalClient.java
     
    7172    // File Menu
    7273
    73     //fileMenu.add( newSpaceAction = new FileAction("New Space", NEW_SPACE_ID)).setAccelerator(KeyStroke.getKeyStroke('S', Event.CTRL_MASK));;
    74     //fileMenu.add( newGroupAction = new FileAction("New Group", NEW_GROUP_ID)).setAccelerator(KeyStroke.getKeyStroke('G', Event.CTRL_MASK));;
    75     //fileMenu.add( newPersonAction = new FileAction("New Person", NEW_PERSON_ID)).setAccelerator(KeyStroke.getKeyStroke('P', Event.CTRL_MASK));
    7674    //fileMenu.addSeparator();
    77     fileMenu.add( quitAction = new FileAction("Poll Server", POLL_ID)).setAccelerator(KeyStroke.getKeyStroke('P', Event.CTRL_MASK));;
    78     fileMenu.add( quitAction = new FileAction("Collect Garbage", GARBAGE_ID)).setAccelerator(KeyStroke.getKeyStroke('G', Event.CTRL_MASK));;
    79     fileMenu.add( quitAction = new FileAction("Quit", QUIT_ID)).setAccelerator(KeyStroke.getKeyStroke('Q', Event.CTRL_MASK));;
    80 
    81 
    82     editMenu.add( infoAction = new EditAction("Info...", INFO_ID));
    83     editMenu.add( editAction = new EditAction("Edit...", EDIT_ID));
     75    fileMenu.add( quitAction = new FileAction("Poll Server", POLL_ID, this)).setAccelerator(KeyStroke.getKeyStroke('P', Event.CTRL_MASK));
     76    fileMenu.add( quitAction = new FileAction("Collect Garbage", GARBAGE_ID, this)).setAccelerator(KeyStroke.getKeyStroke('G', Event.CTRL_MASK));
     77    fileMenu.add( quitAction = new FileAction("Quit", QUIT_ID, this)).setAccelerator(KeyStroke.getKeyStroke('Q', Event.CTRL_MASK));
     78
     79    // Edit Menu
     80
     81    editMenu.add( prefAction = new EditAction("Preferences", PREF_ID, this));
     82
    8483   
    8584    menuBar.add(fileMenu);                        // Add the file menu
    86     // menuBar.add(editMenu);                        // Add the edit menu
     85    menuBar.add(editMenu);                        // Add the edit menu
    8786   
    8887   
    8988    searchPanel = new SearchPanel(csModel, this);
    90     otherPanel = new JPanel();
    91    
     89       
    9290    content.setLayout(new BoxLayout(content, BoxLayout.X_AXIS));   
    9391    content.add(searchPanel);
    9492   
    95     //csModel.addObserver(this);
    96     addWindowListener(new WindowHandler());
    97     //jlist.addMouseListener( new MouseHandler(this));
    98    
     93        addWindowListener(new WindowHandler());
     94       
    9995    pack();
    10096    searchPanel.searchTextField.requestFocus();
     
    112108  // action objects
    113109
    114   abstract class CSAction extends AbstractAction
    115   {
    116    int menuItemID;
    117  
    118           CSAction( String name, int newMenuItemID)
     110  abstract class CSAction extends AbstractAction {
     111      int menuItemID;
     112      Frame frame;
     113 
     114          CSAction( String name, int newMenuItemID, Frame f)
    119115          {
    120116            super(name);
    121117            menuItemID = newMenuItemID;
     118            frame = f;
    122119           }
    123120           
     
    128125  class FileAction extends CSAction
    129126  {
    130         FileAction(String name, int newMenuItemID)
     127        FileAction(String name, int newMenuItemID, Frame frame)
    131128        {
    132              super(name,newMenuItemID );
     129             super(name,newMenuItemID, frame );
    133130         }
    134131
     
    136133         {
    137134         switch (menuItemID) {
    138                 case NEW_PERSON_ID:
    139                      System.out.println("new person chosen from menu");
    140                      Frame f = new Frame();
    141                      //newPersonDialog = new NewPersonDialog(f, psModel);
    142                      break;
    143                 case NEW_SPACE_ID:
    144                      System.out.println("new space chosen from menu");
    145                      break;
    146                 case NEW_GROUP_ID:
    147                      System.out.println("new group chosen from menu");
    148                      break;
    149          case GARBAGE_ID:
     135                 case GARBAGE_ID:
    150136           System.err.println("forcing gc...");
    151137           System.gc() ;
     
    173159  class EditAction extends CSAction
    174160  {
    175         EditAction(String name, int newMenuItemID)
     161        EditAction(String name, int newMenuItemID, Frame frame)
    176162        {
    177              super(name,newMenuItemID );
     163             super(name,newMenuItemID, frame );
    178164         }
    179165
     
    181167         {
    182168         switch (menuItemID) {
    183                 case INFO_ID:
    184                      System.out.println("info Action chosen");
    185                      break;
    186                 case EDIT_ID:
    187                      System.out.println("edit Action chosen");
     169                case PREF_ID:
     170                     PreferencesDialog prefDialog = new PreferencesDialog(frame, "Preferences", false); // make this the instance of CSFrame
    188171                     break;
    189172                default:
     
    258241  // private declarations
    259242  private JMenuBar menuBar = new JMenuBar();      // Window menu bar
    260   private JMenuItem newSpaceItem, newGroupItem, newPersonItem, quitItem;
     243  private JMenuItem quitItem;
    261244 
    262245 private JList jlist, peopleList;
     
    268251  // EditActions
    269252 
    270   private EditAction infoAction, editAction, weightsAction;
     253  private EditAction prefAction;
    271254
    272255  //Dialog
    273256
    274   //private NewPersonDialog newPersonDialog;
     257  private PreferencesDialog newPreferencesDialog;
    275258 
    276259} //end CSFrame
  • trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/CSModel.java

    r2159 r2184  
    143143      } // end else
    144144    } // end while 
     145
     146   
     147
    145148    setCurrentCollection(getFirstCollection()); //assume at least one collection
    146149   
  • trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/Constants.java

    r2162 r2184  
    4141/* File Menu */
    4242
    43   final static int  NEW_PERSON_ID           = 101;
    44   final static int  NEW_GROUP_ID            = 102;
    45   final static int  NEW_SPACE_ID            = 103;
    4643  final static int  QUIT_ID             = 104;
    4744  final static int  POLL_ID             = 105;
     
    5047/* Edit Menu */
    5148
    52   final static int INFO_ID              = 201;
    53   final static int EDIT_ID                  = 202;
    54   final static int WEIGHTS_ID               = 207;
    55 
     49  final static int PREF_ID              = 201;
    5650
    5751
  • trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/GMLDocument.java

    r2164 r2184  
    2424
    2525
     26import org.nzdl.gsdl.service.*;
     27
    2628/**
    2729 * Class GMLDocument
     
    4244
    4345
    44     public void getImageData() {
     46    public void getImageData(NzdlService nzdl, String collectionName) {
    4547    // display image data
    4648    System.err.println("about to get iterator ...");
    47     HTML.Tag tag = HTML.Tag.A;
     49    /*
     50       HTML.Tag tag = HTML.Tag.IMG;
    4851   
    49     HTMLDocument.Iterator it = getIterator(tag);
     52       HTMLDocument.Iterator it = getIterator(tag); */
     53    //System.err.println("collectionName = " + collectionName);
     54    //System.err.println("HTTPPrefix = " + nzdl.getCollectionInfo(collectionName).getHTTPPrefix());
     55    //System.err.println("HTTPDomain = " + nzdl.getCollectionInfo(collectionName).getHTTPDomain());
     56
     57    ElementIterator iterator = new ElementIterator(this);
     58
     59    Element element;
     60
     61    while ((element = iterator.next()) != null) {
     62        // System.err.println("Got an element, getName() = " + element.getName() );
     63        if (element.getName() == "img") {
     64        //System.err.println("Got an image tag!");
     65        AttributeSet attributes = element.getAttributes();
     66        System.err.println("Num of attributes = " + attributes.getAttributeCount());
     67        //Enumeration attributeNames = attributes.getAttributeNames();
     68        for (Enumeration attributeNames = attributes.getAttributeNames()                      ; attributeNames.hasMoreElements() ;) {
     69            Object attributeName = attributeNames.nextElement();
     70            Object attributeValue = attributes.getAttribute(attributeName);
     71            System.err.println("\t" + attributeName + " = " + attributeValue);
     72        }
     73       
     74        Object name = attributes.getAttribute(StyleConstants.NameAttribute);
     75        //System.err.println("name = " + name);
     76        }
     77       
     78        }
     79
     80    /*
    5081    if (it.getTag() == null) System.err.println("iterator is null");
    5182    System.err.println("got iterator for tag type:" + it.getTag());
     
    74105    System.err.println("no more " + it.getTag() + " tags");
    75106    System.err.println("tag " + tag + " has block status " + tag.isBlock());
    76 
     107    */
    77108    }
    78109
  • trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/SearchPanel.java

    r2177 r2184  
    225225      csModel.addResult(new Result((String)titleMap.get(resultDocID), resultDocID, collectionName ));
    226226    } //end while
    227     resultsList.setSelectedIndex(0);
     227    resultsList.setSelectedIndex(0); // should be under Preference control!
    228228      } // end else
    229229      titleMap.clear();
     
    272272      Date d1 = new Date();
    273273      Date d2 = new Date();
     274      Date d21 = new Date();
    274275      Date d3 = new Date();
    275276      try { // get the document and read it in as HTML
     
    279280          //long ddiff1 = d2.getTime() - d1.getTime();
    280281          // System.err.println("getDocument = " + ddiff1 + "ms");
    281           htmlEditorKit.read( new StringReader(docContents), htmlDoc, 0);
     282           StringReader sr = new StringReader(docContents);
     283           d21 = new Date();
     284           htmlEditorKit.read( sr, htmlDoc, 0); // should be under preference control!
    282285           d3 = new Date();
    283286          //long ddiff2 = d3.getTime() - d2.getTime();
     
    297300      long diff = t2.getTime() - t1.getTime();
    298301      long ddiff1 = d2.getTime() - d1.getTime();
    299       long ddiff2 = d3.getTime() - d2.getTime();
     302      long ddiff2 = d21.getTime() - d2.getTime();
     303      long ddiff3 = d3.getTime() - d21.getTime();
    300304      System.err.println("nzdl.getDocument = " + ddiff1 + "ms");
    301       System.err.println("StringReader() = " + ddiff2 + "ms");
     305      System.err.println("StringReader() constructor = " + ddiff2 + "ms");
     306      System.err.println("EditorKit.read() = " + ddiff3 + " ms");
    302307      System.err.println("getDocument total = " + diff + " ms");
    303308     
     
    317322
    318323      //System.err.println("getting image data...");
    319       //      htmlDoc.getImageData();
     324          htmlDoc.getImageData(nzdl, result.getCollectionName());
    320325      windowParent.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    321326      Date endTime = new Date();
    322327      long diff5 = endTime.getTime() - startTime.getTime();
    323328      System.err.println("total time " + diff5 + " ms");
     329      //System.err.println("prefix = " + nzdl.getCollectionInfo(result.getCollectionName()).getHTTPPrefix());
    324330      }
    325331    } //end valueChanged
  • trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/SimpleGraphicalClient.java

    r2179 r2184  
     1
    12
    23/*
Note: See TracChangeset for help on using the changeset viewer.