Horus Doc || Java GUI Reference || Doxygen's quick Index  

MiaSurfApp Class Reference

An image surfer application. More...

Inheritance diagram for MiaSurfApp::

SampleApp ViewerInspectionListener List of all members.

Public Methods

void handleOpen ()
 This function is called by _bmenu if the associated menu item is selected. More...

void handleRandomImages ()
 This function is called by _bmenu if the associated menu item is selected. More...

void handleAbstract ()
 This function is called by _bmenu if the associated menu item is selected. More...

void handleBalloon ()
 This function is called by _bmenu if the associated menu item is selected. More...

void handlePeople ()
 This function is called by _bmenu if the associated menu item is selected. More...

void handleExit ()
 This function is called by _bmenu if the associated menu item is selected. More...

void handleSearchE ()
 This function is called by _bmenu if the associated menu item is selected. More...

void handleSearchC ()
 This function is called by _bmenu if the associated menu item is selected. More...

void handleSearchWw ()
 This function is called by _bmenu if the associated menu item is selected. More...

void handleSearchCw ()
 This function is called by _bmenu if the associated menu item is selected. More...

void handleListCollections ()
 This function is called by _bmenu if the associated menu item is selected. More...

void handleCollection (String collection)
 This function is called by _bmenu if the associated menu item is selected. More...

void handleSetScale (double scale)
 This function is called by _bmenu if the associated menu item is selected. More...

void handleTestNJetInvar ()
 This function is called by _bmenu if the associated menu item is selected. More...

void viewerEntered (ViewerEvent e)
 Implementation of ViewerInspectionListener. More...

void viewerExited (ViewerEvent e)
 Implementation of ViewerInspectionListener. More...

void viewerSelected (ViewerEvent e)
 Implementation of ViewerInspectionListener. More...

void objectEntered (ViewerEvent e)
 Implementation of ViewerInspectionListener. More...

void objectProbed (ViewerEvent e)
 Implementation of ViewerInspectionListener. More...

void objectSelected (ViewerEvent e)
 Implementation of ViewerInspectionListener. More...


Static Public Methods

void main (String[] args)
 main is called when this is used as an application. More...


Protected Methods

boolean buildSample (JFrame parent, JApplet applet, String[] args)

Detailed Description

An image surfer application.


Member Function Documentation

void MiaSurfApp::main String    args[] [inline, static]
 

main is called when this is used as an application.

This function has to be overloaded in the "leaf node" application itself.

Reimplemented from SampleApp.

00045 {
00046     MiaSurfApp app = new MiaSurfApp();
00047     app.doMain(args);
00048 
00049     // doMain will call buildSample
00050 }

void MiaSurfApp::handleOpen   [inline]
 

This function is called by _bmenu if the associated menu item is selected.

00056 {
00057     String name = JOptionPane.showInputDialog("URL:");
00058     if (name == null)
00059         return;
00060     newQueryImage(name);
00061 }

void MiaSurfApp::handleRandomImages   [inline]
 

This function is called by _bmenu if the associated menu item is selected.

00067 {
00068 /*
00069     java.util.Random rand = new java.util.Random();
00070     for (int i=0 ; i<9 ; i++) {
00071         int n = rand.nextInt(100);
00072         java.text.DecimalFormat df = new java.text.DecimalFormat("00");
00073         _viewerUrl[i] = "http://carol.wins.uva.nl/~mark/corel/Work/5060" +
00074                         df.format(n) + ".JPG";
00075     }
00076 */
00077 
00078     int[] oids = _search.randomImages(_colName, 9);
00079     _viewerUrl = _collection.oidSeq2urls(oids);
00080 //for (int i=0 ; i<9 ; i++)
00081 //OutputStreamArea.println("got url " + _viewerUrl[i]);
00082     updateViewersFromUrls();
00083 }

void MiaSurfApp::handleAbstract   [inline]
 

This function is called by _bmenu if the associated menu item is selected.

00089 {
00090     newQueryImage("http://carol.wins.uva.nl/~mark/corel/Abstract/583000.JPG");
00091 }

void MiaSurfApp::handleBalloon   [inline]
 

This function is called by _bmenu if the associated menu item is selected.

00097 {
00098     newQueryImage("http://carol.wins.uva.nl/~mark/corel/Balloon1/329000.JPG");
00099 }

void MiaSurfApp::handlePeople   [inline]
 

This function is called by _bmenu if the associated menu item is selected.

00105 {
00106     newQueryImage("http://carol.wins.uva.nl/~mark/corel/People1/365000.JPG");
00107 }

void MiaSurfApp::handleExit   [inline]
 

This function is called by _bmenu if the associated menu item is selected.

00114 {
00115     System.exit(0);
00116 }

void MiaSurfApp::handleSearchE   [inline]
 

This function is called by _bmenu if the associated menu item is selected.

00122 {
00123     handleSearch(invarEnum.E);
00124 }

void MiaSurfApp::handleSearchC   [inline]
 

This function is called by _bmenu if the associated menu item is selected.

00130 {
00131     handleSearch(invarEnum.C);
00132 }

void MiaSurfApp::handleSearchWw   [inline]
 

This function is called by _bmenu if the associated menu item is selected.

00138 {
00139     handleSearch(invarEnum.Ww);
00140 }

void MiaSurfApp::handleSearchCw   [inline]
 

This function is called by _bmenu if the associated menu item is selected.

00146 {
00147     handleSearch(invarEnum.Cw);
00148 }

void MiaSurfApp::handleListCollections   [inline]
 

This function is called by _bmenu if the associated menu item is selected.

00154 {
00155     String[] strs = _collection.listCollections();
00156     for (int i=0 ; i<strs.length ; i++)
00157         OutputStreamArea.println(strs[i]);
00158 }

void MiaSurfApp::handleCollection String    collection [inline]
 

This function is called by _bmenu if the associated menu item is selected.

00164 {
00165     _colName = collection;
00166     OutputStreamArea.println("Setting collection to " + _colName);
00167 }

void MiaSurfApp::handleSetScale double    scale [inline]
 

This function is called by _bmenu if the associated menu item is selected.

00173 {
00174     _scale = scale;
00175 }

void MiaSurfApp::handleTestNJetInvar   [inline]
 

This function is called by _bmenu if the associated menu item is selected.

00181 {
00182     OutputStreamArea.println("Calling NJetInvar with " + _queryUrl);
00183     if (_queryUrl == null)
00184         return;
00185     double[][] result = _content.NJetInvar(_queryUrl, invarEnum.E, 1.0);
00186     for (int i=0 ; i<result.length ; i++) {
00187         for (int j=0 ; j<result[i].length ; j++)
00188             OutputStreamArea.print(" " + result[i][j]);
00189         OutputStreamArea.println("");
00190     }
00191 }

void MiaSurfApp::viewerEntered ViewerEvent    e [inline]
 

Implementation of ViewerInspectionListener.

Reimplemented from ViewerInspectionListener.

00197 {
00198 }

void MiaSurfApp::viewerExited ViewerEvent    e [inline]
 

Implementation of ViewerInspectionListener.

Reimplemented from ViewerInspectionListener.

00204 {
00205 }

void MiaSurfApp::viewerSelected ViewerEvent    e [inline]
 

Implementation of ViewerInspectionListener.

Reimplemented from ViewerInspectionListener.

00211 {
00212 }

void MiaSurfApp::objectEntered ViewerEvent    e [inline]
 

Implementation of ViewerInspectionListener.

Reimplemented from ViewerInspectionListener.

00218 {
00219 }

void MiaSurfApp::objectProbed ViewerEvent    e [inline]
 

Implementation of ViewerInspectionListener.

Reimplemented from ViewerInspectionListener.

00225 {
00226 }

void MiaSurfApp::objectSelected ViewerEvent    e [inline]
 

Implementation of ViewerInspectionListener.

Reimplemented from ViewerInspectionListener.

00232 {
00233     CanvasViewer v = (CanvasViewer) e.getViewer();
00234     int index = -1;
00235     for (int i=0 ; i<9 ; i++) {
00236         if (_viewer[i] == v)
00237             index = i;
00238     }
00239     if (index != -1) {
00240         if (_viewerUrl[index] != null)
00241             newQueryImage(_viewerUrl[index]);
00242     }
00243 }

boolean MiaSurfApp::buildSample JFrame    parent,
JApplet    applet,
String    args[]
[inline, protected, virtual]
 

Reimplemented from SampleApp.

00266 {
00267     OutputStreamArea.println("Initializing "+getSampleName()+"...");
00268 
00269     initZomer(args);
00270 /*
00271 
00272     OutputStreamArea.println("Initializing CorbaMediator...");
00273     CorbaMediator.init(args);
00274 
00275     try {
00276         org.omg.CORBA.Object objOP = CorbaMediator.getInitialObject("GlobalOps");
00277         _ops = HxCorba.GlobalOpsHelper.narrow(objOP);
00278     } catch (Exception e) {
00279         ErrorStreamArea.println("Cannot connect with GlobalOps. Is the server running?");
00280         _ops = null;
00281     }
00282 
00283     // Create FileChooser, for loading images into viewer
00284 
00285     _fc = new JFileChooser("\\images");
00286     _horusFilter = new HorusImageFilter();
00287     _fc.addChoosableFileFilter(_horusFilter);
00288 */
00289 
00290     OutputStreamArea.println("Building "+getSampleName()+" GUI...");
00291 
00292     // set layout manager
00293 
00294     JPanel gui = new JPanel(new GridBagLayout());
00295 
00296     // load MIA logo
00297 
00298     final Image logoIm = Toolkit.getDefaultToolkit().createImage(mia_logo_abbr_data);
00299     JComponent logo = new JComponent() {
00300         public void paint(Graphics g) { g.drawImage(logoIm, 0, 0, this); }
00301     };
00302     logo.setBounds(0, 0, 247, 120);
00303 
00304     // Setup splitpanes
00305 
00306     JSplitPane middleLeft = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
00307                                            new OutputStreamArea(10, 80),
00308                                            new ErrorStreamArea(parent, 3, 80));
00309     middleLeft.setOneTouchExpandable(true);
00310     middleLeft.setDividerLocation(170);
00311 
00312     JSplitPane lowmidLeft = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
00313                                            middleLeft, logo);
00314     lowmidLeft.setOneTouchExpandable(true);
00315     lowmidLeft.setDividerLocation(250);
00316 
00317     _mainViewer = ViewerFactory.makeBasicViewer();
00318     _mainViewer.addViewerInspectionListener(this);
00319     JSplitPane left = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
00320                                      _mainViewer, lowmidLeft);
00321     left.setOneTouchExpandable(true);
00322     left.setDividerLocation(400);
00323 
00324     JSplitPane viewSP = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
00325                                        left, makeViewers());
00326     viewSP.setOneTouchExpandable(true);
00327     viewSP.setDividerLocation(512);
00328     HX.addGridComp(gui, viewSP, 0, 0, 1, 1,
00329                    GridBagConstraints.BOTH, 1.0, 1.0, 1, 1);
00330 
00331 
00332     // Create ExtMenuBar:
00333 
00334     _bmenu = new ExtMenuBar(this);
00335     _bmenu.addMenu("File");
00336     _bmenu.addMenuItem("File", "Open", "handleOpen");
00337     _bmenu.addSeparator("File");
00338     _bmenu.addMenuItem("File", "Random images", "handleRandomImages");
00339     _bmenu.addSeparator("File");
00340     _bmenu.addMenuItem("File", "Open Abstract image", "handleAbstract");
00341     _bmenu.addMenuItem("File", "Open Balloon image", "handleBalloon");
00342     _bmenu.addMenuItem("File", "Open People image", "handlePeople");
00343     _bmenu.addSeparator("File");
00344     _bmenu.addMenuItem("File", "Exit", "handleExit");
00345 
00346     _bmenu.addMenu("Surf");
00347     _bmenu.addMenuItem("Surf", "SearchE", "handleSearchE");
00348     _bmenu.addMenuItem("Surf", "SearchC", "handleSearchC");
00349     _bmenu.addMenuItem("Surf", "SearchWw", "handleSearchWw");
00350     _bmenu.addMenuItem("Surf", "SearchCw", "handleSearchCw");
00351     _bmenu.addSeparator("Surf");
00352     _bmenu.addMenuItem("Surf", "list collections", "handleListCollections");
00353     _bmenu.addSeparator("Surf");
00354     _bmenu.addMenuItem("Surf", "Set scale",
00355         new CallableMethod("handleSetScale",
00356                                 "double", "scale", "double"));
00357     _bmenu.addSeparator("Surf");
00358     _bmenu.addMenuItem("Surf", "Test NJetInvar", "handleTestNJetInvar");
00359 
00360     _bmenu.addMenu("Collection");
00361     String[] strs = _collection.listCollections();
00362     System.out.println("length : " + strs.length);
00363     String[] colSel = new String[24];
00364     for (int ii=0 ; ii<23 ; ii++)
00365         colSel[ii] = strs[ii*20];
00366     colSel[23] = strs[strs.length-1]; // last one is corel
00367     _bmenu.addGroupMenu("Collection", colSel, "handleCollection", colSel[23]);
00368 
00369     parent.setJMenuBar(_bmenu);
00370     parent.getContentPane().add(gui, BorderLayout.CENTER);
00371 
00372     parent.setSize(1100, 840);
00373     parent.setLocation(0, 0);
00374 
00375     OutputStreamArea.println("Done");
00376 
00377     return true;
00378 }


The documentation for this class was generated from the following file:
Generated on Mon Jan 27 15:11:23 2003 for JavaReference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001