tkormann 01/10/10 06:42:37
Modified: resources/org/apache/batik/apps/svgbrowser/resources
GUI.properties
sources/org/apache/batik/apps/svgbrowser Application.java
JSVGViewerFrame.java Main.java
PreferenceDialog.java
Added: resources/org/apache/batik/util/gui/resources
CSSMediaPanel.properties
sources/org/apache/batik/util/gui CSSMediaPanel.java
Log:
Add CSS media support (using the preferences dialog).
Revision Changes Path
1.33 +4 -1
xml-batik/resources/org/apache/batik/apps/svgbrowser/resources/GUI.properties
Index: GUI.properties
===================================================================
RCS file:
/home/cvs/xml-batik/resources/org/apache/batik/apps/svgbrowser/resources/GUI.properties,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- GUI.properties 2001/10/03 16:08:19 1.32
+++ GUI.properties 2001/10/10 13:42:37 1.33
@@ -9,7 +9,7 @@
# The viewer's GUI resources.
#
# Author: [EMAIL PROTECTED]
-# $Id: GUI.properties,v 1.32 2001/10/03 16:08:19 tkormann Exp $
+# $Id: GUI.properties,v 1.33 2001/10/10 13:42:37 tkormann Exp $
#
ViewSource.width = 750
@@ -356,6 +356,9 @@
#
# PreferenceDialog parameters
#
+PreferenceDialog.MediaPanel.title = Media
+
+
PreferenceDialog.label.user.options = User Options
PreferenceDialog.label.user.language = Language
PreferenceDialog.label.user.stylesheet = Stylesheet
1.1
xml-batik/resources/org/apache/batik/util/gui/resources/CSSMediaPanel.properties
Index: CSSMediaPanel.properties
===================================================================
#############################################################################
# Copyright (C) The Apache Software Foundation. All rights reserved. #
# ------------------------------------------------------------------------- #
# This software is published under the terms of the Apache Software License #
# version 1.1, a copy of which has been included with this distribution in #
# the LICENSE file. #
#############################################################################
#
# The resources for the location bar
#
# Author: [EMAIL PROTECTED]
# $Id: CSSMediaPanel.properties,v 1.1 2001/10/10 13:42:37 tkormann Exp $
#
OKButton.text = OK
OKButton.mnemonic = O
OKButton.action = OKButtonAction
CancelButton.text = Cancel
CancelButton.mnemonic = C
CancelButton.action = CancelButtonAction
AddButton.text = Add
AddButton.mnemonic = A
AddButton.action = AddButtonAction
RemoveButton.text = Remove
RemoveButton.mnemonic = R
RemoveButton.action = RemoveButtonAction
ClearButton.text = Clear
ClearButton.mnemonic = l
ClearButton.action = ClearButtonAction
Panel.title = CSS Media
Media.list = all aural braille embossed handheld print projection screen tty tv
AddMediumDialog.title = Add a new CSS medium
AddMediumDialog.label = Medium Name:
1.3 +8 -1
xml-batik/sources/org/apache/batik/apps/svgbrowser/Application.java
Index: Application.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/apps/svgbrowser/Application.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Application.java 2001/05/14 05:00:09 1.2
+++ Application.java 2001/10/10 13:42:37 1.3
@@ -14,7 +14,7 @@
* This interface represents a SVG viewer application.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a>
- * @version $Id: Application.java,v 1.2 2001/05/14 05:00:09 hillion Exp $
+ * @version $Id: Application.java,v 1.3 2001/10/10 13:42:37 tkormann Exp $
*/
public interface Application {
@@ -58,4 +58,11 @@
* @return null if no user style sheet was specified.
*/
String getUserStyleSheetURI();
+
+ /**
+ * Returns the CSS media to use.
+ * @return empty string if no CSS media was specified.
+ */
+ String getMedia();
+
}
1.54 +2 -2
xml-batik/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
Index: JSVGViewerFrame.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- JSVGViewerFrame.java 2001/10/08 15:49:37 1.53
+++ JSVGViewerFrame.java 2001/10/10 13:42:37 1.54
@@ -153,7 +153,7 @@
* This class represents a SVG viewer swing frame.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a>
- * @version $Id: JSVGViewerFrame.java,v 1.53 2001/10/08 15:49:37 hillion Exp $
+ * @version $Id: JSVGViewerFrame.java,v 1.54 2001/10/10 13:42:37 tkormann Exp $
*/
public class JSVGViewerFrame
extends JFrame
@@ -1741,7 +1741,7 @@
* Returns this user agent's CSS media.
*/
public String getMedia() {
- return "screen";
+ return application.getMedia();
}
/**
1.16 +15 -1 xml-batik/sources/org/apache/batik/apps/svgbrowser/Main.java
Index: Main.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/apps/svgbrowser/Main.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- Main.java 2001/05/18 06:30:14 1.15
+++ Main.java 2001/10/10 13:42:37 1.16
@@ -45,7 +45,7 @@
* This class contains the main method of an SVG viewer.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a>
- * @version $Id: Main.java,v 1.15 2001/05/18 06:30:14 hillion Exp $
+ * @version $Id: Main.java,v 1.16 2001/10/10 13:42:37 tkormann Exp $
*/
public class Main implements Application {
@@ -141,6 +141,8 @@
"");
defaults.put(PreferenceDialog.PREFERENCE_KEY_PROXY_PORT,
"");
+ defaults.put(PreferenceDialog.PREFERENCE_KEY_CSS_MEDIA,
+ "screen");
try {
preferenceManager = new XMLPreferenceManager("preferences.xml",
@@ -426,5 +428,17 @@
}
return preferenceDialog.getPreferenceManager().getString
(PreferenceDialog.PREFERENCE_KEY_USER_STYLESHEET);
+ }
+
+ /**
+ * Returns the CSS media to use.
+ * @return empty string if no CSS media was specified.
+ */
+ public String getMedia() {
+ if (preferenceDialog == null) {
+ return "";
+ }
+ return preferenceDialog.getPreferenceManager().getString
+ (PreferenceDialog.PREFERENCE_KEY_CSS_MEDIA);
}
}
1.7 +23 -2
xml-batik/sources/org/apache/batik/apps/svgbrowser/PreferenceDialog.java
Index: PreferenceDialog.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/apps/svgbrowser/PreferenceDialog.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- PreferenceDialog.java 2001/05/14 21:42:36 1.6
+++ PreferenceDialog.java 2001/10/10 13:42:37 1.7
@@ -47,6 +47,7 @@
import org.apache.batik.ext.swing.GridBagConstants;
import org.apache.batik.util.PreferenceManager;
+import org.apache.batik.util.gui.CSSMediaPanel;
import org.apache.batik.util.gui.LanguageDialog;
import org.apache.batik.util.gui.UserStyleDialog;
@@ -54,7 +55,7 @@
* Dialog that displays user preferences.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Vincent Hardy</a>
- * @version $Id: PreferenceDialog.java,v 1.6 2001/05/14 21:42:36 vhardy Exp $
+ * @version $Id: PreferenceDialog.java,v 1.7 2001/10/10 13:42:37 tkormann Exp $
*/
public class PreferenceDialog extends JDialog
implements GridBagConstants {
@@ -177,6 +178,10 @@
public static final String PREFERENCE_KEY_PROXY_HOST
= "preference.key.proxy.host";
+
+ public static final String PREFERENCE_KEY_CSS_MEDIA
+ = "preference.key.cssmedia";
+
public static final String PREFERENCE_KEY_PROXY_PORT
= "preference.key.proxy.port";
@@ -211,6 +216,8 @@
protected JTextField host, port;
+ protected CSSMediaPanel cssMediaPanel;
+
/**
* Code indicating whether the dialog was OKayed
* or cancelled
@@ -272,6 +279,10 @@
host.setText(model.getString(PREFERENCE_KEY_PROXY_HOST));
port.setText(model.getString(PREFERENCE_KEY_PROXY_PORT));
+ //
+ // Initialize the CSS media
+ //
+ cssMediaPanel.setMedia(model.getString(PREFERENCE_KEY_CSS_MEDIA));
//
// Sets the dialog's title
//
@@ -298,6 +309,8 @@
host.getText());
model.setString(PREFERENCE_KEY_PROXY_PORT,
port.getText());
+ model.setString(PREFERENCE_KEY_CSS_MEDIA,
+ cssMediaPanel.getMediaAsString());
}
/**
@@ -434,8 +447,16 @@
}
protected Component buildUserStyleSheet(){
+ JPanel panel = new JPanel(new BorderLayout());
+ panel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
+
userStylesheetPanel = new UserStyleDialog.Panel();
- return userStylesheetPanel;
+ panel.add(userStylesheetPanel, BorderLayout.NORTH);
+
+ cssMediaPanel = new CSSMediaPanel();
+ panel.add(cssMediaPanel, BorderLayout.SOUTH);
+
+ return panel;
}
protected Component buildUserFont(){
1.1 xml-batik/sources/org/apache/batik/util/gui/CSSMediaPanel.java
Index: CSSMediaPanel.java
===================================================================
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
* ------------------------------------------------------------------------- *
* This software is published under the terms of the Apache Software License *
* version 1.1, a copy of which has been included with this distribution in *
* the LICENSE file. *
*****************************************************************************/
package org.apache.batik.util.gui;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.StringTokenizer;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JComboBox;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import org.apache.batik.util.gui.resource.ActionMap;
import org.apache.batik.util.gui.resource.ButtonFactory;
import org.apache.batik.util.gui.resource.MissingListenerException;
import org.apache.batik.util.gui.resource.ResourceManager;
/**
* This class represents a panel to edit/add/remove CSS media.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Thierry Kormann</a>
* @version $Id: CSSMediaPanel.java,v 1.1 2001/10/10 13:42:37 tkormann Exp $
*/
public class CSSMediaPanel extends JPanel implements ActionMap {
/**
* The resource file name
*/
protected final static String RESOURCES =
"org.apache.batik.util.gui.resources.CSSMediaPanel";
/**
* The resource bundle
*/
protected static ResourceBundle bundle;
/**
* The resource manager
*/
protected static ResourceManager resources;
static {
bundle = ResourceBundle.getBundle(RESOURCES, Locale.getDefault());
resources = new ResourceManager(bundle);
}
/**
* The button to remove a CSS medium from the list.
*/
protected JButton removeButton;
/**
* The button to add a CSS medium from the list.
*/
protected JButton addButton;
/**
* The button to clear the CSS media list.
*/
protected JButton clearButton;
/**
* The list that represents the CSS media.
*/
protected DefaultListModel listModel = new DefaultListModel();
/**
* The list that represents the CSS media.
*/
protected JList mediaList;
/**
* Constructs a new panel to edit CSS media.
*/
public CSSMediaPanel() {
super(new GridBagLayout());
listeners.put("AddButtonAction", new AddButtonAction());
listeners.put("RemoveButtonAction", new RemoveButtonAction());
listeners.put("ClearButtonAction", new ClearButtonAction());
setBorder(BorderFactory.createTitledBorder
(BorderFactory.createEtchedBorder(),
resources.getString("Panel.title")));
ExtendedGridBagConstraints constraints =
new ExtendedGridBagConstraints();
constraints.insets = new Insets(5, 5, 5, 5);
mediaList = new JList();
mediaList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
mediaList.setModel(listModel);
mediaList.addListSelectionListener(new MediaListSelectionListener());
listModel.addListDataListener(new MediaListDataListener());
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
constraints.weightx = 1.0;
constraints.weighty = 1.0;
constraints.fill = GridBagConstraints.BOTH;
constraints.setGridBounds(0, 0, 1, 3);
scrollPane.getViewport().add(mediaList);
add(scrollPane, constraints);
ButtonFactory bf = new ButtonFactory(bundle, this);
constraints.weightx = 0;
constraints.weighty = 0;
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.anchor = GridBagConstraints.NORTH;
addButton = bf.createJButton("AddButton");
constraints.setGridBounds(1, 0, 1, 1);
add(addButton, constraints);
removeButton = bf.createJButton("RemoveButton");
constraints.setGridBounds(1, 1, 1, 1);
add(removeButton, constraints);
clearButton = bf.createJButton("ClearButton");
constraints.setGridBounds(1, 2, 1, 1);
add(clearButton, constraints);
updateButtons();
}
/**
* Updates the button states.
*/
protected void updateButtons() {
removeButton.setEnabled(!mediaList.isSelectionEmpty());
clearButton.setEnabled(!listModel.isEmpty());
}
/**
* Sets the list of media to edit.
*
* @param mediaList the list of media to edit
*/
public void setMedia(List mediaList) {
listModel.removeAllElements();
Iterator iter = mediaList.iterator();
while (iter.hasNext()) {
listModel.addElement(iter.next());
}
}
/**
* Sets the list of media to edit to the specified media list (separated by
* space).
*
* @param media the media separated by space
*/
public void setMedia(String media) {
listModel.removeAllElements();
StringTokenizer tokens = new StringTokenizer(media, " ");
while (tokens.hasMoreTokens()) {
listModel.addElement(tokens.nextToken());
}
}
/**
* Returns the list of media.
*/
public List getMedia() {
List media = new ArrayList(listModel.size());
Enumeration enum = listModel.elements();
while (enum.hasMoreElements()) {
media.add(enum.nextElement());
}
return media;
}
/**
* Returns the media list as a string separated by space.
*/
public String getMediaAsString() {
StringBuffer buffer = new StringBuffer();
Enumeration enum = listModel.elements();
while (enum.hasMoreElements()) {
buffer.append((String)enum.nextElement());
buffer.append(" ");
}
return buffer.toString();
}
/**
* Brings up a modal dialog to edit/add/remove CSS media.
*
* @param parent the parent of this dialog
* @param title the title of this dialog
*/
public static int showDialog(Component parent, String title) {
return showDialog(parent, title, "");
}
/**
* Brings up a modal dialog to edit/add/remove CSS media.
*
* @param parent the parent of this dialog
* @param title the title of this dialog
* @param mediaList the list of media
*/
public static int showDialog(Component parent,
String title,
List mediaList) {
Dialog dialog = new Dialog(parent, title, mediaList);
dialog.setModal(true);
dialog.pack();
dialog.show();
return dialog.getReturnCode();
}
/**
* Brings up a modal dialog to edit/add/remove CSS media.
*
* @param parent the parent of this dialog
* @param title the title of this dialog
* @param media the list of media
*/
public static int showDialog(Component parent,
String title,
String media) {
Dialog dialog = new Dialog(parent, title, media);
dialog.setModal(true);
dialog.pack();
dialog.show();
return dialog.getReturnCode();
}
/**
* The map that contains the listeners
*/
protected Map listeners = new HashMap();
/**
* Returns the action associated with the given string or null on error
*
* @param key the key mapped with the action to get
* @throws MissingListenerException if the action is not found
*/
public Action getAction(String key) throws MissingListenerException {
return (Action)listeners.get(key);
}
/**
* The action associated with the 'Add' button
*/
protected class AddButtonAction extends AbstractAction {
public void actionPerformed(ActionEvent e) {
AddMediumDialog dialog = new AddMediumDialog(CSSMediaPanel.this);
dialog.pack();
dialog.show();
if ((dialog.getReturnCode() == AddMediumDialog.CANCEL_OPTION) ||
(dialog.getMedium() == null)) {
return;
}
String medium = dialog.getMedium().trim();;
if (medium.length() == 0 || listModel.contains(medium)) {
return;
}
for (int i = 0; i < listModel.size() && medium != null; ++i) {
String s = (String)listModel.getElementAt(i);
int c = medium.compareTo(s);
if (c == 0) {
medium = null;
} else if (c < 0) {
listModel.insertElementAt(medium, i);
medium = null;
}
}
if (medium != null) {
listModel.addElement(medium);
}
}
}
/**
* The action associated with the 'Remove' button
*/
protected class RemoveButtonAction extends AbstractAction {
public void actionPerformed(ActionEvent e) {
int index = mediaList.getSelectedIndex();
mediaList.clearSelection();
if (index >= 0) {
listModel.removeElementAt(index);
}
}
}
/**
* The action associated with the 'Clear' button
*/
protected class ClearButtonAction extends AbstractAction {
public void actionPerformed(ActionEvent e) {
mediaList.clearSelection();
listModel.removeAllElements();
}
}
/**
* To manage selection modifications
*/
protected class MediaListSelectionListener
implements ListSelectionListener {
public void valueChanged(ListSelectionEvent e) {
updateButtons();
}
}
/**
* To manage data modifications in the media list.
*/
protected class MediaListDataListener implements ListDataListener {
public void contentsChanged(ListDataEvent e) {
updateButtons();
}
public void intervalAdded(ListDataEvent e) {
updateButtons();
}
public void intervalRemoved(ListDataEvent e) {
updateButtons();
}
}
///////////////////////////////////////////////////////////////////////////
/**
* A dialog to add a new CSS medium.
*/
public static class AddMediumDialog extends JDialog implements ActionMap {
/**
* The return value if 'OK' is chosen.
*/
public final static int OK_OPTION = 0;
/**
* The return value if 'Cancel' is chosen.
*/
public final static int CANCEL_OPTION = 1;
/**
* The new medium.
*/
protected JComboBox medium;
/**
* The return code.
*/
protected int returnCode;
/**
* Constructs a new AddMediumDialog.
*
* @param parent the parent of this dialog
*/
public AddMediumDialog(Component parent) {
super(JOptionPane.getFrameForComponent(parent),
resources.getString("AddMediumDialog.title"));
setModal(true);
listeners.put("OKButtonAction", new OKButtonAction());
listeners.put("CancelButtonAction", new CancelButtonAction());
getContentPane().add(createContentPanel(), BorderLayout.CENTER);
getContentPane().add(createButtonsPanel(), BorderLayout.SOUTH);
}
/**
* Returns the medium that might be added or null if any.
*/
public String getMedium() {
return (String)medium.getSelectedItem();
}
/**
* Returns the panel to enter a new CSS medium.
*/
protected Component createContentPanel() {
JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
panel.add(new JLabel(resources.getString("AddMediumDialog.label")),
BorderLayout.WEST);
medium = new JComboBox();
medium.setEditable(true);
String media = resources.getString("Media.list");
StringTokenizer tokens = new StringTokenizer(media, " ");
while (tokens.hasMoreTokens()) {
medium.addItem(tokens.nextToken());
}
panel.add(medium, BorderLayout.CENTER);
return panel;
}
/**
* Returns the button panel.
*/
protected Component createButtonsPanel() {
JPanel panel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
ButtonFactory bf = new ButtonFactory(bundle, this);
panel.add(bf.createJButton("OKButton"));
panel.add(bf.createJButton("CancelButton"));
return panel;
}
/**
* Returns the code that describes how the dialog has been closed (OK or
* CANCEL).
*/
public int getReturnCode() {
return returnCode;
}
/**
* The map that contains the listeners
*/
protected Map listeners = new HashMap();
/**
* Returns the action associated with the given string or null on error
*
* @param key the key mapped with the action to get
* @throws MissingListenerException if the action is not found
*/
public Action getAction(String key) throws MissingListenerException {
return (Action)listeners.get(key);
}
/**
* The action associated with the 'OK' button
*/
protected class OKButtonAction extends AbstractAction {
public void actionPerformed(ActionEvent e) {
returnCode = OK_OPTION;
dispose();
}
}
/**
* The action associated with the 'Cancel' button
*/
protected class CancelButtonAction extends AbstractAction {
public void actionPerformed(ActionEvent e) {
returnCode = CANCEL_OPTION;
dispose();
}
}
}
///////////////////////////////////////////////////////////////////////////
/**
* A dialog to edit/add/remove CSS media.
*/
public static class Dialog extends JDialog implements ActionMap {
/**
* The return value if 'OK' is chosen.
*/
public final static int OK_OPTION = 0;
/**
* The return value if 'Cancel' is chosen.
*/
public final static int CANCEL_OPTION = 1;
/**
* The return code.
*/
protected int returnCode;
/**
* Constructs a new Dialog to edit/add/remove CSS media.
*/
public Dialog() {
this(null, "", "");
}
/**
* Constructs a new Dialog to edit/add/remove CSS media.
*
* @param parent the parent of this dialog
* @param title the title of this dialog
* @param mediaList the media list
*/
public Dialog(Component parent, String title, List mediaList) {
super(JOptionPane.getFrameForComponent(parent), title);
listeners.put("OKButtonAction", new OKButtonAction());
listeners.put("CancelButtonAction", new CancelButtonAction());
CSSMediaPanel panel = new CSSMediaPanel();
panel.setMedia(mediaList);
getContentPane().add(panel, BorderLayout.CENTER);
getContentPane().add(createButtonsPanel(), BorderLayout.SOUTH);
}
/**
* Constructs a new Dialog to edit/add/remove CSS media.
*
* @param parent the parent of this dialog
* @param title the title of this dialog
* @param media the media list
*/
public Dialog(Component parent, String title, String media) {
super(JOptionPane.getFrameForComponent(parent), title);
listeners.put("OKButtonAction", new OKButtonAction());
listeners.put("CancelButtonAction", new CancelButtonAction());
CSSMediaPanel panel = new CSSMediaPanel();
panel.setMedia(media);
getContentPane().add(panel, BorderLayout.CENTER);
getContentPane().add(createButtonsPanel(), BorderLayout.SOUTH);
}
/**
* Returns the code that describes how the dialog has been closed (OK or
* CANCEL).
*/
public int getReturnCode() {
return returnCode;
}
/**
* Creates the OK/Cancel buttons panel
*/
protected JPanel createButtonsPanel() {
JPanel p = new JPanel(new FlowLayout(FlowLayout.RIGHT));
ButtonFactory bf = new ButtonFactory(bundle, this);
p.add(bf.createJButton("OKButton"));
p.add(bf.createJButton("CancelButton"));
return p;
}
/**
* The map that contains the listeners
*/
protected Map listeners = new HashMap();
/**
* Returns the action associated with the given string or null on error
*
* @param key the key mapped with the action to get
* @throws MissingListenerException if the action is not found
*/
public Action getAction(String key) throws MissingListenerException {
return (Action)listeners.get(key);
}
/**
* The action associated with the 'OK' button
*/
protected class OKButtonAction extends AbstractAction {
public void actionPerformed(ActionEvent e) {
returnCode = OK_OPTION;
dispose();
}
}
/**
* The action associated with the 'Cancel' button
*/
protected class CancelButtonAction extends AbstractAction {
public void actionPerformed(ActionEvent e) {
returnCode = CANCEL_OPTION;
dispose();
}
}
}
/**
* Main - debug -
*/
public static void main(String [] args) {
String media = "all aural braille embossed handheld print projection screen
tty tv";
int code = CSSMediaPanel.showDialog(null, "Test", media);
System.out.println(code);
System.exit(0);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]