source: trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/SimpleGraphicalClient.java@ 2154

Last change on this file since 2154 was 2145, checked in by say1, 23 years ago

Added Model initialisation to CSModel. Fixed the bug where empty collections appear. Fixed the exception thrown on an empty doc set

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1
2/*
3 * SimpleGraphicalClient.java
4 * Copyright (C) 2001 New Zealand Digital Library Project
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21package org.nzdl.gsdl.SimpleGraphicalClient;
22
23import java.awt.*;
24import javax.swing.*;
25import java.util.*;
26import java.io.*;
27import java.net.URL;
28
29// long live GNU ...
30import gnu.getopt.Getopt;
31import gnu.getopt.LongOpt;
32
33// local libraries
34import org.nzdl.gsdl.service.NzdlCollectionInfo;
35import org.nzdl.gsdl.service.NzdlQuery;
36import org.nzdl.gsdl.service.NzdlRequest;
37import org.nzdl.gsdl.service.NzdlResponse;
38import org.nzdl.gsdl.service.NzdlResultSet;
39import org.nzdl.gsdl.service.NzdlService;
40import org.nzdl.gsdl.service.NzdlServiceClient;
41import org.nzdl.gsdl.util.NzdlIORs;
42
43/**
44 * Class SimpleGraphicalClient
45 *
46 * A class to test the workings of Corba interface from the client side.
47 *
48 * @author Dave Nichols ([email protected])
49 * @author stuart yeates ([email protected])
50 * @author Brett Sheeran ([email protected])
51 * @author Gordon Paynter ([email protected])
52 * @version $Revision: 2145 $
53 * @see org.nzdl.gsdl.service.NzdlCollectionInfo
54 * @see org.nzdl.gsdl.service.NzdlQuery
55 * @see org.nzdl.gsdl.service.NzdlRequest
56 * @see org.nzdl.gsdl.service.NzdlResponse
57 * @see org.nzdl.gsdl.service.NzdlResultSet
58 * @see org.nzdl.gsdl.service.NzdlService
59 * @see org.nzdl.gsdl.service.NzdlServiceImpl
60 * @see org.nzdl.gsdl.util.NzdlIORs;
61 * @see gnu.getopt.Getopt;
62 * @see gnu.getopt.LongOpt;
63 */
64
65
66public class SimpleGraphicalClient implements Cloneable {
67
68 CSModel csModel;
69 CSFrame window;
70
71
72 /** The underlying CORBA inferface */
73 NzdlService nzdl = null;
74
75 /** The name of the file we look for IOR's in */
76 String IORFileName = "/tmp/localcorba.objid";
77 /** The IOR that was specified on the commandline */
78 String IORFromCommandLine = null;
79
80 /** How verbose do we want to be ? */
81 int verbosity = 2;
82
83 /**
84 * Basic constructor
85 */
86 SimpleGraphicalClient() {
87 System.err.println("in constructor");
88 init(null);
89 }
90
91 /**
92 * Normal constructor
93 * @param args the command line arguments
94 */
95 public SimpleGraphicalClient(String [] args) {
96
97 init(args);
98 }
99
100 /**
101 * Do initialisation, including finding a server to connect to and
102 * setting up all the GUI stuff
103 * @param args the command line arguments
104 */
105 void init(String [] args) {
106 nzdl = NzdlIORs.findIOR(null, null,
107 IORFileName, IORFromCommandLine);
108 if (nzdl == null)
109 throw new Error("URK! unable to find an IOR...");
110
111 csModel = new CSModel(nzdl);
112
113 window = new CSFrame("Search via Corba", csModel);
114 Toolkit theKit = window.getToolkit(); // Get the window toolkit
115 Dimension screenSize = theKit.getScreenSize(); // Get screen size
116
117 // Set the position to screen center & size to half screen size
118 /* window.setBounds(screenSize.width/4, screenSize.height/4, // Position
119 screenSize.width/2, screenSize.height/2); // Size
120
121 */
122 window.setVisible(true);
123 } // init
124
125
126 /**
127 * Start the SimpleGraphicalClient
128 * @param commandline arguments (only used in ORB initialisation).
129 */
130
131 public static void main(String args[])
132 {
133
134 System.err.println("starting...");
135 SimpleGraphicalClient sgc = new SimpleGraphicalClient();
136
137
138 } //main
139
140
141} // class GraphicalClient
142
143
144
145
146
147
Note: See TracBrowser for help on using the repository browser.