source: other-projects/trunk/greenstone3-extension/mat/src/java/org/greenstone/gsdl3_extension/mat/MainApplication.java@ 17365

Last change on this file since 17365 was 17365, checked in by cc108, 16 years ago

Updating Mat Source Code

File size: 2.3 KB
Line 
1package org.greenstone.gsdl3_extension.mat;
2
3import java.awt.Toolkit;
4import javax.swing.SwingUtilities;
5import javax.swing.UIManager;
6
7
8import java.awt.Dimension;
9
10/**
11 * <p>Title: </p>
12 *
13 * <p>Description: </p>
14 *
15 * <p>Copyright: Copyright (c) 2007</p>
16 *
17 * <p>Company: </p>
18 *
19 * @author not attributable
20 * @version 1.0
21 */
22
23public class MainApplication {
24 boolean packFrame = false;
25
26 /**
27 * Construct and show the application.
28 */
29 public MainApplication(){
30
31 }
32
33 public MainApplication(String collectionName) {
34 DescribeMessenger dm = new DescribeMessenger(collectionName,"http://repositoryaut.lconz.ac.nz/cgi/oai2.cgi");
35 MainApplication ma = new MainApplication ();
36 ma.start(dm, collectionName);
37 }
38
39 public void start(DescribeMessenger dm, String collectionName){
40 dm.describeMatadata(collectionName,"http://researchcommons.waikato.ac.nz/cgi/oai2.cgi");
41
42 //HashMap
43 MainApplicationFrame frame = new MainApplicationFrame(dm.getElementClass());
44 // Validate frames that have preset sizes
45 // Pack frames that have useful preferred size info, e.g. from their layout
46 if (packFrame) {
47 frame.pack();
48 } else {
49 frame.validate();
50 }
51
52 // Center the window
53 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
54 Dimension frameSize = frame.getSize();
55 if (frameSize.height > screenSize.height) {
56 frameSize.height = screenSize.height;
57 }
58 if (frameSize.width > screenSize.width) {
59 frameSize.width = screenSize.width;
60 }
61 frame.setLocation((screenSize.width - frameSize.width) / 2,
62 (screenSize.height - frameSize.height) / 2);
63 frame.setVisible(true);
64 }
65 /**
66 * Application entry point.
67 *
68 * @param args String[]
69 */
70 public static void main(String[] args) {
71 SwingUtilities.invokeLater(new Runnable() {
72 public void run() {
73 try {
74 UIManager.setLookAndFeel(UIManager.
75 getSystemLookAndFeelClassName());
76 } catch (Exception exception) {
77 exception.printStackTrace();
78 }
79
80 new MainApplication("sampleco");
81 }
82 });
83 }
84}
Note: See TracBrowser for help on using the repository browser.