-/*\r
-GNU Lesser General Public License\r
-\r
-StylesAction\r
-Copyright (C) 2000-2003 Howard Kistler\r
-\r
-This library is free software; you can redistribute it and/or\r
-modify it under the terms of the GNU Lesser General Public\r
-License as published by the Free Software Foundation; either\r
-version 2.1 of the License, or (at your option) any later version.\r
-\r
-This library is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
-Lesser General Public License for more details.\r
-\r
-You should have received a copy of the GNU Lesser General Public\r
-License along with this library; if not, write to the Free Software\r
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
-*/\r
-\r
-package com.hexidec.ekit.action;\r
-\r
-import java.awt.event.ActionEvent;\r
-import javax.swing.JComboBox;\r
-import javax.swing.JEditorPane;\r
-import javax.swing.text.MutableAttributeSet;\r
-import javax.swing.text.SimpleAttributeSet;\r
-import javax.swing.text.StyledEditorKit;\r
-import javax.swing.text.html.HTML;\r
-import javax.swing.text.html.HTMLEditorKit;\r
-\r
-import com.hexidec.util.Translatrix;\r
-\r
-/** Class for handling CSS style events\r
- */\r
-public class StylesAction extends StyledEditorKit.StyledTextAction\r
-{\r
-\r
- JComboBox parent;\r
-\r
- public StylesAction(JComboBox myParent)\r
- {\r
- super("css-style");\r
- parent = myParent;\r
- }\r
-\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- if(!(this.isEnabled()))\r
- {\r
- return;\r
- }\r
- JEditorPane editor = getEditor(e);\r
- if(editor != null)\r
- {\r
- String stylename = (String)(parent.getSelectedItem());\r
- if(stylename == null)\r
- {\r
- return;\r
- }\r
- else if(stylename.equals(Translatrix.getTranslationString("NoCSSStyle")))\r
- {\r
- return;\r
- }\r
- boolean replace = false;\r
- MutableAttributeSet attr = null;\r
- SimpleAttributeSet cls = new SimpleAttributeSet();\r
- cls.addAttribute(HTML.Attribute.CLASS, stylename);\r
- attr = new SimpleAttributeSet();\r
- attr.addAttribute(HTML.Tag.FONT, cls);\r
- MutableAttributeSet inattr = ((HTMLEditorKit)(editor.getEditorKitForContentType("text/html"))).getInputAttributes();\r
- inattr.addAttributes(attr);\r
- setCharacterAttributes(editor, attr, replace);\r
- }\r
- }\r
-}\r
+/*
+GNU Lesser General Public License
+
+StylesAction
+Copyright (C) 2000 Howard Kistler
+
+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 library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+package com.hexidec.ekit.action;
+
+import java.awt.event.ActionEvent;
+import javax.swing.JComboBox;
+import javax.swing.JEditorPane;
+import javax.swing.text.MutableAttributeSet;
+import javax.swing.text.SimpleAttributeSet;
+import javax.swing.text.StyledEditorKit;
+import javax.swing.text.html.HTML;
+import javax.swing.text.html.HTMLEditorKit;
+
+import com.hexidec.util.Translatrix;
+
+/** Class for handling CSS style events
+ */
+public class StylesAction extends StyledEditorKit.StyledTextAction
+{
+
+ JComboBox parent;
+
+ public StylesAction(JComboBox myParent)
+ {
+ super("css-style");
+ parent = myParent;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if(!(this.isEnabled()))
+ {
+ return;
+ }
+ JEditorPane editor = getEditor(e);
+ if(editor != null)
+ {
+ String stylename = (String)(parent.getSelectedItem());
+ if(stylename == null)
+ {
+ return;
+ }
+ else if(stylename.equals(Translatrix.getTranslationString("NoCSSStyle")))
+ {
+ return;
+ }
+ boolean replace = false;
+ MutableAttributeSet attr = null;
+ SimpleAttributeSet cls = new SimpleAttributeSet();
+ cls.addAttribute(HTML.Attribute.CLASS, stylename);
+ attr = new SimpleAttributeSet();
+ attr.addAttribute(HTML.Tag.FONT, cls);
+ MutableAttributeSet inattr = ((HTMLEditorKit)(editor.getEditorKitForContentType("text/html"))).getInputAttributes();
+ inattr.addAttributes(attr);
+ setCharacterAttributes(editor, attr, replace);
+ }
+ }
+}