01: /*
02: * Lucane - a collaborative platform
03: * Copyright (C) 2004 Vincent Fiack <vfiack@mail15.com>
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18: */
19: package org.lucane.applications.audioconf.gui;
20:
21: import java.awt.BorderLayout;
22: import java.awt.event.*;
23:
24: import javax.swing.*;
25:
26: import org.lucane.applications.audioconf.AudioConf;
27: import org.lucane.client.Client;
28: import org.lucane.client.widgets.ManagedWindow;
29:
30: public class Controller implements ActionListener, WindowListener {
31: private AudioConf plugin;
32: private ManagedWindow controller;
33:
34: public Controller(AudioConf plugin) {
35: this .plugin = plugin;
36: }
37:
38: public void showController() {
39: controller = new ManagedWindow(plugin, plugin.getTitle());
40:
41: JButton stop = new JButton(plugin.tr("btn.stop"));
42: stop.addActionListener(this );
43: String msg = plugin.tr("msg.nowStreamingWith");
44: msg = msg.replaceAll("%1", plugin.getFriendName());
45: JLabel label = new JLabel(msg);
46:
47: try {
48: label.setIcon(plugin.getImageIcon(plugin.getIcon()));
49: stop.setIcon(Client.getImageIcon("cancel.png"));
50: } catch (Exception e) {
51: //no icons
52: }
53:
54: controller.getContentPane().setLayout(new BorderLayout());
55: controller.getContentPane().add(label, BorderLayout.CENTER);
56: controller.getContentPane().add(stop, BorderLayout.EAST);
57:
58: controller.addWindowListener(this );
59: controller.show();
60: }
61:
62: public void hideController() {
63: controller.dispose();
64: }
65:
66: public void actionPerformed(ActionEvent ae) {
67: plugin.stopAndExit();
68: }
69:
70: public void windowIconified(WindowEvent we) {
71: }
72:
73: public void windowDeiconified(WindowEvent we) {
74: }
75:
76: public void windowActivated(WindowEvent we) {
77: }
78:
79: public void windowDeactivated(WindowEvent we) {
80: }
81:
82: public void windowOpened(WindowEvent we) {
83: }
84:
85: public void windowClosing(WindowEvent we) {
86: }
87:
88: public void windowClosed(WindowEvent we) {
89: plugin.stopAndExit();
90: }
91: }
|