001: /*
002: * This file is part of the GeOxygene project source files.
003: *
004: * GeOxygene aims at providing an open framework which implements OGC/ISO specifications for
005: * the development and deployment of geographic (GIS) applications. It is a open source
006: * contribution of the COGIT laboratory at the Institut Géographique National (the French
007: * National Mapping Agency).
008: *
009: * See: http://oxygene-project.sourceforge.net
010: *
011: * Copyright (C) 2005 Institut Géographique National
012: *
013: * This library is free software; you can redistribute it and/or modify it under the terms
014: * of the GNU Lesser General Public License as published by the Free Software Foundation;
015: * either version 2.1 of the License, or any later version.
016: *
017: * This library is distributed in the hope that it will be useful, but WITHOUT ANY
018: * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
019: * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
020: *
021: * You should have received a copy of the GNU Lesser General Public License along with
022: * this library (see file LICENSE if present); if not, write to the Free Software
023: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
024: *
025: */
026:
027: package fr.ign.cogit.geoxygene.util.viewer;
028:
029: import java.awt.event.ActionEvent;
030: import java.awt.event.ActionListener;
031:
032: import javax.swing.JMenu;
033: import javax.swing.JMenuBar;
034: import javax.swing.JMenuItem;
035:
036: import fr.ign.cogit.geoxygene.datatools.Geodatabase;
037:
038: /**
039: * This class defines the menu bar of the ObjectViewer's GUI.
040: *
041: * @author Thierry Badard & Arnaud Braun
042: * @version 1.0
043: *
044: */
045:
046: class ObjectViewerMenuBar extends JMenuBar {
047:
048: private ObjectViewerInterface objectViewerInterface;
049:
050: public ObjectViewerMenuBar(
051: ObjectViewerInterface objectViewerInterface, Geodatabase db) {
052:
053: this .objectViewerInterface = objectViewerInterface;
054:
055: // "File" Menu
056: JMenu file = new JMenu("File");
057:
058: // Item "Open"
059: JMenuItem item = new JMenuItem("Open");
060: item.addActionListener(new GeOxygeneViewerOpenFileAction(
061: objectViewerInterface));
062: file.add(item);
063:
064: // Item "GeOxygene"
065: if (db != null) {
066: item = new JMenuItem("GeOxygene");
067: item
068: .addActionListener(new GeOxygeneViewerOpenGeOxygeneAction(
069: objectViewerInterface, db));
070: file.add(item);
071: }
072:
073: file.addSeparator();
074:
075: // Item "Close"
076: item = new JMenuItem("Close");
077: item.addActionListener(new ActionListener() {
078: public void actionPerformed(ActionEvent e) {
079: //System.out.println("On ferme la fenetre !!! ;-))");
080: getObjectViewerInterface().dispose();
081: }
082: });
083: file.add(item);
084:
085: // Item "Exit"
086: item = new JMenuItem("Exit");
087: item.addActionListener(new ActionListener() {
088: public void actionPerformed(ActionEvent e) {
089: //System.out.println("On ferme la fenetre !!! ;-))");
090: getObjectViewerInterface().dispose();
091: System.exit(0);
092: }
093: });
094: file.add(item);
095:
096: //Add the "File" menu to the menubar
097: this .add(file);
098:
099: }
100:
101: public ObjectViewerInterface getObjectViewerInterface() {
102: return objectViewerInterface;
103: }
104:
105: }
|