yacy_search_server/source/net/yacy/gui/framework/Application.java
orbiter ec72387165 added a very early test version of a YaCy gui component.
The gui currently does nothing else than providing a search window that sends the search string to the browser
The gui is started when YaCy is started with the option -g or --gui, like
./startYACY.sh -g
The gui will primary be used to provide a 'real' macintosh version that can be started and operated like any other macintosh application. A special mac application wrapper will follow.

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7021 6c8d7289-2bf4-0310-a012-ef5d649a1542
2010-08-05 10:43:03 +00:00

88 lines
2.7 KiB
Java

/**
* Application
* Copyright 2010 by Michael Peter Christen; mc@yacy.net, Frankfurt a. M., Germany
* First released 05.08.2010 at http://yacy.net
*
* $LastChangedDate: 2010-06-16 17:11:21 +0200 (Mi, 16 Jun 2010) $
* $LastChangedRevision: 6922 $
* $LastChangedBy: orbiter $
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program in the file lgpl21.txt
* If not, see <http://www.gnu.org/licenses/>.
*/
package net.yacy.gui.framework;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.List;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.WindowConstants;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
public class Application extends JFrame implements DocumentListener {
private static final long serialVersionUID = 1753502658600073141L;
public Application(String windowName, final Operation operation, List<JMenu> menues, Layout pageprovider) {
super(windowName);
try {
getContentPane().setLayout(pageprovider.getPage((JComponent) getContentPane(), this));
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
operation.closeAndExit();
}
});
this.addWindowStateListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
operation.closeAndExit();
}
});
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
// make menus
JMenuBar mainMenu = new JMenuBar();
setJMenuBar(mainMenu);
for (JMenu menu: menues) mainMenu.add(menu);
pack();
} catch (Exception e) {
e.printStackTrace();
}
}
public void insertUpdate(DocumentEvent e) {
}
public void removeUpdate(DocumentEvent e) {
}
public void changedUpdate(DocumentEvent e) {
}
}