Changeset 2184 for trunk/java-client
- Timestamp:
- 2001-03-15T20:39:37+13:00 (23 years ago)
- 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 1 2 /* 2 3 * SimpleGraphicalClient.java … … 71 72 // File Menu 72 73 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));76 74 //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 84 83 85 84 menuBar.add(fileMenu); // Add the file menu 86 //menuBar.add(editMenu); // Add the edit menu85 menuBar.add(editMenu); // Add the edit menu 87 86 88 87 89 88 searchPanel = new SearchPanel(csModel, this); 90 otherPanel = new JPanel(); 91 89 92 90 content.setLayout(new BoxLayout(content, BoxLayout.X_AXIS)); 93 91 content.add(searchPanel); 94 92 95 //csModel.addObserver(this); 96 addWindowListener(new WindowHandler()); 97 //jlist.addMouseListener( new MouseHandler(this)); 98 93 addWindowListener(new WindowHandler()); 94 99 95 pack(); 100 96 searchPanel.searchTextField.requestFocus(); … … 112 108 // action objects 113 109 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) 119 115 { 120 116 super(name); 121 117 menuItemID = newMenuItemID; 118 frame = f; 122 119 } 123 120 … … 128 125 class FileAction extends CSAction 129 126 { 130 FileAction(String name, int newMenuItemID )127 FileAction(String name, int newMenuItemID, Frame frame) 131 128 { 132 super(name,newMenuItemID );129 super(name,newMenuItemID, frame ); 133 130 } 134 131 … … 136 133 { 137 134 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: 150 136 System.err.println("forcing gc..."); 151 137 System.gc() ; … … 173 159 class EditAction extends CSAction 174 160 { 175 EditAction(String name, int newMenuItemID )161 EditAction(String name, int newMenuItemID, Frame frame) 176 162 { 177 super(name,newMenuItemID );163 super(name,newMenuItemID, frame ); 178 164 } 179 165 … … 181 167 { 182 168 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 188 171 break; 189 172 default: … … 258 241 // private declarations 259 242 private JMenuBar menuBar = new JMenuBar(); // Window menu bar 260 private JMenuItem newSpaceItem, newGroupItem, newPersonItem,quitItem;243 private JMenuItem quitItem; 261 244 262 245 private JList jlist, peopleList; … … 268 251 // EditActions 269 252 270 private EditAction infoAction, editAction, weightsAction;253 private EditAction prefAction; 271 254 272 255 //Dialog 273 256 274 //private NewPersonDialog newPersonDialog;257 private PreferencesDialog newPreferencesDialog; 275 258 276 259 } //end CSFrame -
trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/CSModel.java
r2159 r2184 143 143 } // end else 144 144 } // end while 145 146 147 145 148 setCurrentCollection(getFirstCollection()); //assume at least one collection 146 149 -
trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/Constants.java
r2162 r2184 41 41 /* File Menu */ 42 42 43 final static int NEW_PERSON_ID = 101;44 final static int NEW_GROUP_ID = 102;45 final static int NEW_SPACE_ID = 103;46 43 final static int QUIT_ID = 104; 47 44 final static int POLL_ID = 105; … … 50 47 /* Edit Menu */ 51 48 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; 56 50 57 51 -
trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/GMLDocument.java
r2164 r2184 24 24 25 25 26 import org.nzdl.gsdl.service.*; 27 26 28 /** 27 29 * Class GMLDocument … … 42 44 43 45 44 public void getImageData( ) {46 public void getImageData(NzdlService nzdl, String collectionName) { 45 47 // display image data 46 48 System.err.println("about to get iterator ..."); 47 HTML.Tag tag = HTML.Tag.A; 49 /* 50 HTML.Tag tag = HTML.Tag.IMG; 48 51 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 /* 50 81 if (it.getTag() == null) System.err.println("iterator is null"); 51 82 System.err.println("got iterator for tag type:" + it.getTag()); … … 74 105 System.err.println("no more " + it.getTag() + " tags"); 75 106 System.err.println("tag " + tag + " has block status " + tag.isBlock()); 76 107 */ 77 108 } 78 109 -
trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/SearchPanel.java
r2177 r2184 225 225 csModel.addResult(new Result((String)titleMap.get(resultDocID), resultDocID, collectionName )); 226 226 } //end while 227 resultsList.setSelectedIndex(0); 227 resultsList.setSelectedIndex(0); // should be under Preference control! 228 228 } // end else 229 229 titleMap.clear(); … … 272 272 Date d1 = new Date(); 273 273 Date d2 = new Date(); 274 Date d21 = new Date(); 274 275 Date d3 = new Date(); 275 276 try { // get the document and read it in as HTML … … 279 280 //long ddiff1 = d2.getTime() - d1.getTime(); 280 281 // 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! 282 285 d3 = new Date(); 283 286 //long ddiff2 = d3.getTime() - d2.getTime(); … … 297 300 long diff = t2.getTime() - t1.getTime(); 298 301 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(); 300 304 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"); 302 307 System.err.println("getDocument total = " + diff + " ms"); 303 308 … … 317 322 318 323 //System.err.println("getting image data..."); 319 // htmlDoc.getImageData();324 htmlDoc.getImageData(nzdl, result.getCollectionName()); 320 325 windowParent.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); 321 326 Date endTime = new Date(); 322 327 long diff5 = endTime.getTime() - startTime.getTime(); 323 328 System.err.println("total time " + diff5 + " ms"); 329 //System.err.println("prefix = " + nzdl.getCollectionInfo(result.getCollectionName()).getHTTPPrefix()); 324 330 } 325 331 } //end valueChanged -
trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/SimpleGraphicalClient.java
r2179 r2184 1 1 2 2 3 /*
Note:
See TracChangeset
for help on using the changeset viewer.