001: /**********************************************************************************
002: * $URL$
003: * $Id$
004: ***********************************************************************************
005: *
006: * Copyright (c) 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the"License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.tool.assessment.audio;
021:
022: import java.io.Serializable;
023: import java.awt.BorderLayout;
024: import java.awt.Dimension;
025: import java.awt.Toolkit;
026: import java.awt.event.ActionEvent;
027: import java.awt.event.ActionListener;
028: import java.awt.event.WindowAdapter;
029: import java.awt.event.WindowEvent;
030: import javax.swing.JFrame;
031: import javax.swing.JMenu;
032: import javax.swing.JMenuBar;
033: import javax.swing.JMenuItem;
034: import javax.swing.JOptionPane;
035: import javax.swing.JPanel;
036: import javax.swing.JTabbedPane;
037: import javax.swing.border.BevelBorder;
038: import javax.swing.border.CompoundBorder;
039: import javax.swing.border.EmptyBorder;
040: import javax.swing.event.ChangeEvent;
041: import javax.swing.event.ChangeListener;
042: import java.util.ResourceBundle;
043: import java.util.Locale;
044:
045: public class AudioConfigHelp implements Serializable {
046: static ResourceBundle res = AudioUtil.getInstance()
047: .getResourceBundle();
048: private static String message;
049: private static String about;
050: private boolean configHardware;
051: private boolean configRecord;
052: private boolean configPlayback;
053: private boolean configApplet;
054: private boolean configFileWrite;
055:
056: /**
057: * This is an everything-on help message.
058: */
059: public AudioConfigHelp() {
060: this .configHardware = false;
061: this .configRecord = false;
062: this .configPlayback = false;
063: this .configApplet = false;
064: this .configFileWrite = false; // we won't support for now
065: }
066:
067: /**
068: * Support for more sophistication, as we are able to detect some error conditions.
069: * @param configHardware
070: * @param configRecord
071: * @param configPlayback
072: * @param configApplet
073: */
074: public AudioConfigHelp(boolean configHardware,
075: boolean configRecord, boolean configPlayback,
076: boolean configApplet) {
077: this .configHardware = configHardware;
078: this .configRecord = configRecord;
079: this .configPlayback = configPlayback;
080: this .configApplet = configApplet;
081: this .configFileWrite = false; // we won't support for now
082: }
083:
084: /**
085: * We use the information to configure a message.
086: */
087: public void configHelp() {
088: String msg = res.getString("When_running_the") + "\n";
089:
090: if (!configHardware) {
091: msg += " * " + res.getString("_You_must_have_a") + "\n";
092: }
093: if (!configApplet) {
094: msg += " * " + res.getString("_You_must_have_a1") + "\n";
095: }
096: if (!configRecord || !configPlayback || !configFileWrite) {
097: msg += " * " + res.getString("_Have_these") + "\n\n";
098: msg += res.getString("grant_") + "\n";
099:
100: if (!configRecord) {
101: msg += " "
102: + res.getString("permission_javax");
103: }
104: if (!configPlayback) {
105: msg += " "
106: + res.getString("permission_java_util");
107: }
108: if (!!configFileWrite) {
109: msg += " "
110: + res.getString("permission_java_io");
111: }
112:
113: msg += " }; \n\n";
114: }
115:
116: msg += res.getString("Please_make_sure_you") + "\n";
117:
118: // to make this work we use the trick of putting it in a static,
119: // this is running in the user's JVM so shouldn't be a problem.
120: message = msg;
121:
122: new Thread(new Runnable() {
123: public void run() {
124: JOptionPane.showMessageDialog(null, message, res
125: .getString("Configuration_Help"),
126: JOptionPane.INFORMATION_MESSAGE);
127: }
128: }).start();
129: }
130:
131: public static void infoHelp() {
132: about = res.getString("ABOUT_SAKAI_AUDIO")
133: + res.getString("Portions_copyright_c")
134: + res.getString("Licensed_under_the")
135: + res.getString("http_opensource")
136: + res.getString("Portions_Copyright_c");
137:
138: new Thread(new Runnable() {
139: public void run() {
140: JOptionPane.showMessageDialog(null, about, res
141: .getString("About_the_Audio"),
142: JOptionPane.INFORMATION_MESSAGE);
143: }
144: }).start();
145: }
146:
147: public boolean isConfigHardware() {
148: return configHardware;
149: }
150:
151: public void setConfigHardware(boolean configHardware) {
152: this .configHardware = configHardware;
153: }
154:
155: public boolean isConfigRecord() {
156: return configRecord;
157: }
158:
159: public void setConfigRecord(boolean configRecord) {
160: this .configRecord = configRecord;
161: }
162:
163: public boolean isConfigPlayback() {
164: return configPlayback;
165: }
166:
167: public void setConfigPlayback(boolean configPlayback) {
168: this .configPlayback = configPlayback;
169: }
170:
171: public boolean isConfigApplet() {
172: return configApplet;
173: }
174:
175: public void setConfigApplet(boolean configApplet) {
176: this.configApplet = configApplet;
177: }
178:
179: }
|