This is an automated email from the git hooks/post-receive script. fnatter-guest pushed a commit to branch master in repository simplyhtml.
commit 40103884adf19f62555dfe6486d6252791c463cb Author: Felix Natter <fnat...@gmx.net> Date: Thu Aug 24 17:07:00 2017 +0200 New upstream version 0.17.3 --- build.gradle | 2 +- src/com/lightdev/app/shtm/AbstractPlugin.java | 10 +- src/com/lightdev/app/shtm/DynamicResource.java | 46 +- src/com/lightdev/app/shtm/FrmMain.java | 6 +- ...TextResources.java => InternalUiResources.java} | 29 +- src/com/lightdev/app/shtm/ManagePluginsAction.java | 10 +- src/com/lightdev/app/shtm/SHTMLEditorKit.java | 4 - .../lightdev/app/shtm/SHTMLEditorKitActions.java | 499 +++++---------------- src/com/lightdev/app/shtm/SHTMLEditorPane.java | 1 - src/com/lightdev/app/shtm/SHTMLHelpBroker.java | 2 +- src/com/lightdev/app/shtm/SHTMLPanel.java | 10 +- src/com/lightdev/app/shtm/SHTMLPanelImpl.java | 133 ++---- .../app/shtm/SHTMLPanelMultipleDocImpl.java | 4 +- .../shtm/{TextResources.java => UIResources.java} | 5 +- src/com/lightdev/app/shtm/Util.java | 4 +- .../app/shtm/resources/SimplyHTML.properties | 2 - .../shtm/resources/SimplyHTML_common.properties | 7 - .../app/shtm/resources/SimplyHTML_de.properties | 12 +- src/com/lightdev/app/shtm/resources/algnCtr_on.gif | Bin 1007 -> 0 bytes src/com/lightdev/app/shtm/resources/algnLft_on.gif | Bin 1007 -> 0 bytes src/com/lightdev/app/shtm/resources/algnRt_on.gif | Bin 1009 -> 0 bytes src/com/lightdev/app/shtm/resources/bold_on.gif | Bin 1024 -> 0 bytes src/com/lightdev/app/shtm/resources/bold_on_de.gif | Bin 1022 -> 0 bytes src/com/lightdev/app/shtm/resources/italic_on.gif | Bin 1021 -> 0 bytes .../lightdev/app/shtm/resources/italic_on_de.gif | Bin 1028 -> 0 bytes src/com/lightdev/app/shtm/resources/ol_on.gif | Bin 1032 -> 0 bytes src/de/calcom/cclib/text/FindReplaceDialog.java | 5 - .../cclib/text/PseudoDamerauLevenshtein.java | 4 - 28 files changed, 210 insertions(+), 585 deletions(-) diff --git a/build.gradle b/build.gradle index 4f6d945..00c97ed 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ apply plugin: 'eclipse' apply plugin: 'maven-publish' group 'com.lightdev.app.shtm.simplyhtml' -version = '0.16.18' +version = '0.17.3' targetCompatibility='1.7' sourceCompatibility='1.7' diff --git a/src/com/lightdev/app/shtm/AbstractPlugin.java b/src/com/lightdev/app/shtm/AbstractPlugin.java index d991599..00c2338 100644 --- a/src/com/lightdev/app/shtm/AbstractPlugin.java +++ b/src/com/lightdev/app/shtm/AbstractPlugin.java @@ -169,18 +169,18 @@ public abstract class AbstractPlugin implements SHTMLPlugin { if (plLoader != null) { final ResourceBundle resourceBundle = ResourceBundle.getBundle(this.getClass().getName(), Locale.getDefault(), plLoader); - textResources = new DefaultTextResources(resourceBundle); + textResources = new InternalUiResources(resourceBundle); //System.out.println("AbstractPlugin plLoader != null, resources=" + resources); } else { - final DefaultTextResources instance = new DefaultTextResources(ResourceBundle.getBundle(this + final InternalUiResources instance = new InternalUiResources(ResourceBundle.getBundle(this .getClass().getName(), Locale.getDefault())); textResources = instance; //System.out.println("AbstractPlugin plLoader == null, resources=" + resources); } } else { - final DefaultTextResources instance = new DefaultTextResources(ResourceBundle.getBundle(this.getClass() + final InternalUiResources instance = new InternalUiResources(ResourceBundle.getBundle(this.getClass() .getName(), Locale.getDefault())); textResources = instance; //System.out.println("AbstractPlugin pluginManager = null, resources=" + resources); @@ -335,7 +335,7 @@ public abstract class AbstractPlugin implements SHTMLPlugin { * @return the string with the given name or null, if none is found */ public String getOwnerResString(final String nm) { - return Util.getResourceString(SHTMLPanelImpl.getResources(), nm); + return Util.getResourceString(SHTMLPanelImpl.getUiResources(), nm); } /** @@ -352,7 +352,7 @@ public abstract class AbstractPlugin implements SHTMLPlugin { /* ----------- SimplyHTML plugin interface implementation end --------- */ /* --------------- class fields start --------------------- */ /** TextResources of plug-in */ - public static TextResources textResources; + public static UIResources textResources; /** constant for active setting in preferences file */ public static final String PREFSID_PLUGIN_ACTIVE = "Active"; /** constant for dock location setting in preferences file */ diff --git a/src/com/lightdev/app/shtm/DynamicResource.java b/src/com/lightdev/app/shtm/DynamicResource.java index c968222..794e8dc 100644 --- a/src/com/lightdev/app/shtm/DynamicResource.java +++ b/src/com/lightdev/app/shtm/DynamicResource.java @@ -24,13 +24,11 @@ import java.beans.PropertyChangeListener; import java.net.URL; import java.util.Enumeration; import java.util.Hashtable; -import java.util.MissingResourceException; import javax.swing.AbstractAction; import javax.swing.AbstractButton; import javax.swing.Action; import javax.swing.Icon; -import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JMenu; import javax.swing.JMenuItem; @@ -101,16 +99,12 @@ import org.dpolivaev.mnemonicsetter.MnemonicSetter; class DynamicResource { /** name constant for labels in the resource file */ public static final String labelSuffix = "Label"; - /** name constant for action commands in the resource file */ - private static final String actionSuffix = "Action"; /** name constant for accelerators in the resource file */ public static final String acceleratorSuffix = "Accelerator"; /** name constant for indicating image resources in the resource file */ public static final String imageSuffix = "Image"; /** name constant for tool tip strings in the resource file */ public static final String toolTipSuffix = "Tip"; - /** name constant for selected icon names in the resource file */ - public static final String selectedIconSuffix = "SelectedIcon"; /** indicator for menu separators */ public static final String menuSeparatorKey = "-"; /** dynamic storage for menu items */ @@ -146,7 +140,7 @@ class DynamicResource { * * @return the created menu bar */ - public SHTMLMenuBar createMenubar(final TextResources resources, final String name) { + public SHTMLMenuBar createMenubar(final UIResources resources, final String name) { final SHTMLMenuBar mb = new SHTMLMenuBar(); final String[] menuKeys = Util.tokenize(Util.getResourceString(resources, name), " "); for (int i = 0; i < menuKeys.length; i++) { @@ -167,7 +161,7 @@ class DynamicResource { * @param key the key of the menu definition in the resource file * @return the created menu */ - public JMenu createMenu(final TextResources resources, final String key) { + public JMenu createMenu(final UIResources resources, final String key) { JMenu menu = null; String def = Util.getResourceString(resources, key); if (def == null) { @@ -201,7 +195,7 @@ class DynamicResource { * @param key the key of the menu definition in the resource file * @return the created menu */ - public JPopupMenu createPopupMenu(final TextResources resources, final String key) { + public JPopupMenu createPopupMenu(final UIResources resources, final String key) { JPopupMenu menu = null; String def = Util.getResourceString(resources, key); if (def == null) { @@ -234,7 +228,7 @@ class DynamicResource { * with the new menu item * @return the created menu item */ - public JMenuItem createMenuItem(final TextResources resources, final String cmd) { + public JMenuItem createMenuItem(final UIResources resources, final String cmd) { /** * create a new menu item with the appropriate label from the * resource file. This label later is set from the action this @@ -242,15 +236,11 @@ class DynamicResource { */ JMenuItem mi; mi = new JMenuItem(); - String astr = Util.getResourceString(resources, cmd + actionSuffix); - if (astr == null) { - astr = cmd; - } - mi.setActionCommand(astr); + mi.setActionCommand(cmd); /** * connect action and menu item with appropriate listeners */ - final Action a = getAction(astr); + final Action a = getAction(cmd); if (a != null) { final Object aKey = a.getValue(AbstractAction.ACCELERATOR_KEY); if (aKey != null) { @@ -305,8 +295,7 @@ class DynamicResource { * @param nm the key of the string * @return the string for the given key or null if not found */ - static public String getResourceString(final TextResources resources, final String key) { - try { + static public String getResourceString(final UIResources resources, final String key) { //System.out.println("getResourceString nm=" + nm); if (resources != null) { return resources.getString(key); @@ -314,11 +303,6 @@ class DynamicResource { System.err.println("SimplyHTML : Warning : resources are null."); new Throwable("Dummy").printStackTrace(); return key; - } - catch (final MissingResourceException mre) { - System.err.println("SimplyHTML : Warning : resource is missing: " + key); - return key; - } } /** @@ -440,18 +424,12 @@ class DynamicResource { * @return the icon for that command or null, if none is present * for this command */ - static public Icon getIconForCommand(final TextResources resources, final String cmd) { + static public Icon getIconForCommand(final UIResources resources, final String cmd) { return DynamicResource.getIconForName(resources, cmd + imageSuffix); } - static public Icon getIconForName(final TextResources resources, final String name) { - Icon icon = null; - final URL url = DynamicResource.getResource(resources, name); - //System.out.println("getIconForName name=" + name + ", url=" + url); - if (url != null) { - icon = new ImageIcon(url); - } - return icon; + static public Icon getIconForName(final UIResources resources, final String name) { + return resources != null ? resources.getIcon(name) : null; } /** @@ -466,7 +444,7 @@ class DynamicResource { * @param key the key of the resource in the resource file * @return the resource location as a URL */ - static public URL getResource(final TextResources resources, final String key) { + static public URL getResource(final UIResources resources, final String key) { final String name = Util.getResourceString(resources, key); if (name != null/* && !name.endsWith(IMAGE_EMPTY)*/) { final URL url = DynamicResource.class.getResource(name); @@ -484,7 +462,7 @@ class DynamicResource { * * @return the created tool bar */ - public JToolBar createToolBar(final TextResources resources, final String nm) { + public JToolBar createToolBar(final UIResources resources, final String nm) { Action action; AbstractButton newButton; final java.awt.Dimension buttonSize = new java.awt.Dimension(24, 24); diff --git a/src/com/lightdev/app/shtm/FrmMain.java b/src/com/lightdev/app/shtm/FrmMain.java index 04031c2..f6b60ed 100644 --- a/src/com/lightdev/app/shtm/FrmMain.java +++ b/src/com/lightdev/app/shtm/FrmMain.java @@ -51,14 +51,14 @@ import javax.swing.JFrame; */ class FrmMain extends JFrame { public static final String APP_NAME = "SimplyHTML"; - public static final String VERSION = "0.16.18"; + public static final String VERSION = "0.17.3"; /** static reference to this instance of class FrmMain */ private SHTMLPanelImpl mainPane; private FrmMain() { - SHTMLPanelImpl.setTextResources(null); + SHTMLPanelImpl.setInternalUiResources(); setIconImage(Toolkit.getDefaultToolkit().createImage( - DynamicResource.getResource(SHTMLPanelImpl.getResources(), "appIcon"))); + DynamicResource.getResource(SHTMLPanelImpl.getUiResources(), "appIcon"))); setTitle(APP_NAME); } diff --git a/src/com/lightdev/app/shtm/DefaultTextResources.java b/src/com/lightdev/app/shtm/InternalUiResources.java similarity index 65% rename from src/com/lightdev/app/shtm/DefaultTextResources.java rename to src/com/lightdev/app/shtm/InternalUiResources.java index a34c31a..df60b42 100644 --- a/src/com/lightdev/app/shtm/DefaultTextResources.java +++ b/src/com/lightdev/app/shtm/InternalUiResources.java @@ -19,39 +19,54 @@ */ package com.lightdev.app.shtm; +import java.net.URL; import java.util.MissingResourceException; import java.util.Properties; import java.util.ResourceBundle; +import javax.swing.Icon; +import javax.swing.ImageIcon; + /** * Default implementation of TextResources based on java.util.ResourceBundle * * @author Dimitri Polivaev * 14.01.2007 */ -public class DefaultTextResources implements TextResources { +public class InternalUiResources implements UIResources { private final Properties properties; private final ResourceBundle resources; - public DefaultTextResources(final ResourceBundle languageResources) { + public InternalUiResources(final ResourceBundle languageResources) { this(languageResources, null); } - public DefaultTextResources(final ResourceBundle languageResources, final Properties properties) { + public InternalUiResources(final ResourceBundle languageResources, final Properties properties) { super(); resources = languageResources; this.properties = properties; } - public String getString(final String pKey) { + public String getString(final String key) { try { - return resources.getString(pKey); + return resources.getString(key); } catch (final MissingResourceException ex) { if (properties != null) { - return properties.getProperty(pKey); + return properties.getProperty(key); } - throw ex; + System.err.println("SimplyHTML : Warning : resource is missing: " + key); + return key; } } + + @Override + public Icon getIcon(String name) { + final URL url = DynamicResource.getResource(this, name); + if (url != null) { + return new ImageIcon(url); + } + else + return null; + } } diff --git a/src/com/lightdev/app/shtm/ManagePluginsAction.java b/src/com/lightdev/app/shtm/ManagePluginsAction.java index 9d9807d..b6828d6 100644 --- a/src/com/lightdev/app/shtm/ManagePluginsAction.java +++ b/src/com/lightdev/app/shtm/ManagePluginsAction.java @@ -46,10 +46,8 @@ class ManagePluginsAction extends AbstractAction implements SHTMLAction { public static final String managePluginsAction = "managePlugins"; public ManagePluginsAction() { - super(managePluginsAction); - getProperties(); - /*putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke( - KeyEvent.VK_N, KeyEvent.CTRL_MASK));*/ + super(); + SHTMLPanelImpl.configureActionProperties(this, managePluginsAction); } public void actionPerformed(final ActionEvent e) { @@ -78,8 +76,4 @@ class ManagePluginsAction extends AbstractAction implements SHTMLAction { public void update() { } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } diff --git a/src/com/lightdev/app/shtm/SHTMLEditorKit.java b/src/com/lightdev/app/shtm/SHTMLEditorKit.java index 8bd557c..7e36fd7 100644 --- a/src/com/lightdev/app/shtm/SHTMLEditorKit.java +++ b/src/com/lightdev/app/shtm/SHTMLEditorKit.java @@ -19,15 +19,11 @@ package com.lightdev.app.shtm; import java.awt.Cursor; -import java.awt.Font; -import java.awt.Toolkit; import java.io.IOException; import java.io.Reader; import java.io.Writer; import java.util.ArrayList; import java.util.Collections; -import java.util.Enumeration; - import javax.swing.text.BadLocationException; import javax.swing.text.Document; import javax.swing.text.Element; diff --git a/src/com/lightdev/app/shtm/SHTMLEditorKitActions.java b/src/com/lightdev/app/shtm/SHTMLEditorKitActions.java index d5ad2be..cad86f3 100644 --- a/src/com/lightdev/app/shtm/SHTMLEditorKitActions.java +++ b/src/com/lightdev/app/shtm/SHTMLEditorKitActions.java @@ -24,33 +24,23 @@ import java.awt.Color; import java.awt.Component; import java.awt.Container; import java.awt.Frame; -import java.awt.datatransfer.DataFlavor; import java.awt.event.ActionEvent; -import java.awt.event.InputEvent; -import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.File; import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; -import java.util.Arrays; -import java.util.List; import java.util.TimerTask; import java.util.prefs.Preferences; import javax.swing.AbstractAction; import javax.swing.Action; -import javax.swing.Icon; -import javax.swing.ImageIcon; -import javax.swing.JComponent; import javax.swing.JEditorPane; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JToggleButton; -import javax.swing.KeyStroke; -import javax.swing.TransferHandler; import javax.swing.text.AttributeSet; import javax.swing.text.DefaultEditorKit; import javax.swing.text.Element; @@ -59,7 +49,6 @@ import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyleConstants; import javax.swing.text.StyledDocument; import javax.swing.text.StyledEditorKit; -import javax.swing.text.StyledEditorKit.StyledTextAction; import javax.swing.text.html.CSS; import javax.swing.text.html.HTML; import javax.swing.undo.CannotRedoException; @@ -87,9 +76,9 @@ class SHTMLEditorKitActions { private boolean ignoreActions = false; public SetStyleAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.setStyleAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.setStyleAction); } public void actionPerformed(final ActionEvent ae) { @@ -112,10 +101,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive()); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -128,9 +113,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public AppendTableColAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.appendTableColAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.appendTableColAction); } public void actionPerformed(final ActionEvent ae) { @@ -140,10 +125,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive() && panel.getSHTMLEditorPane().getCurrentTableCell() != null); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -160,16 +141,14 @@ class SHTMLEditorKitActions { private String tag = null; public SetTagAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.setTagAction); - this.panel = panel; - getProperties(); + this(panel, null); } public SetTagAction(final SHTMLPanelImpl panel, final String tag) { - super(SHTMLPanelImpl.setTagAction); + super(); this.panel = panel; this.tag = tag; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.setTagAction); } public void actionPerformed(final ActionEvent ae) { @@ -194,9 +173,6 @@ class SHTMLEditorKitActions { setEnabled(panel.isWYSIWYGEditorActive()); } - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -209,9 +185,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public AppendTableRowAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.appendTableRowAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.appendTableRowAction); } public void actionPerformed(final ActionEvent ae) { @@ -221,10 +197,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive() && panel.getSHTMLEditorPane().getCurrentTableCell() != null); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /* @@ -241,9 +213,8 @@ class SHTMLEditorKitActions { //Action act = new StyledEditorKit.BoldAction(); super(); this.panel = panel; - putValue(Action.NAME, SHTMLPanelImpl.fontBoldAction); putValue(SHTMLPanelImpl.ACTION_SELECTED_KEY, SHTMLPanelImpl.ACTION_UNSELECTED); - SHTMLPanelImpl.getActionProperties(this, SHTMLPanelImpl.fontBoldAction); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.fontBoldAction); } /** @@ -277,10 +248,6 @@ class SHTMLEditorKitActions { panel.updateActions(); } - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, SHTMLPanelImpl.fontItalicAction); - } - public void update() { this.setEnabled(panel.isWYSIWYGEditorActive()); } @@ -366,13 +333,13 @@ class SHTMLEditorKitActions { */ public ApplyCSSAttributeAction(final SHTMLPanelImpl panel, final String actionName, final Object attributeName, final Object attributeValue, final boolean applyToParagraph) { - super(actionName); + super(); this.panel = panel; putValue(SHTMLPanelImpl.ACTION_SELECTED_KEY, SHTMLPanelImpl.ACTION_UNSELECTED); this.attributeName = attributeName; this.attributeValue = attributeValue; this.applyToParagraph = applyToParagraph; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, actionName); } /** @@ -455,11 +422,6 @@ class SHTMLEditorKitActions { public void update() { this.setEnabled(panel.isWYSIWYGEditorActive()); } - - /** get image, etc. from resource */ - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -472,9 +434,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public DeleteTableColAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.deleteTableColAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.deleteTableColAction); } public void actionPerformed(final ActionEvent ae) { @@ -484,10 +446,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive() && panel.getSHTMLEditorPane().getCurrentTableCell() != null); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -505,9 +463,9 @@ class SHTMLEditorKitActions { private JFrame elementTreeFrame = null; public ShowElementTreeAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.elemTreeAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.elemTreeAction); } public void actionPerformed(final ActionEvent e) { @@ -532,10 +490,6 @@ class SHTMLEditorKitActions { public void update() { } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -548,9 +502,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public DeleteTableRowAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.deleteTableRowAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.deleteTableRowAction); } public void actionPerformed(final ActionEvent ae) { @@ -560,10 +514,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive() && panel.getSHTMLEditorPane().getCurrentTableCell() != null); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -577,10 +527,10 @@ class SHTMLEditorKitActions { private final HTML.Tag listTag; public ToggleListAction(final SHTMLPanelImpl panel, final String name, final HTML.Tag listTag) { - super(name); + super(); this.panel = panel; this.listTag = listTag; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, name); } public void actionPerformed(final ActionEvent ae) { @@ -594,10 +544,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive()); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -610,9 +556,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public DocumentTitleAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.documentTitleAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.documentTitleAction); } public void actionPerformed(final ActionEvent ae) { @@ -634,10 +580,6 @@ class SHTMLEditorKitActions { public void update() { this.setEnabled(panel.isWYSIWYGEditorActive()); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /* @@ -654,9 +596,8 @@ class SHTMLEditorKitActions { //Action act = new StyledEditorKit.BoldAction(); super(); this.panel = panel; - putValue(Action.NAME, SHTMLPanelImpl.fontUnderlineAction); putValue(SHTMLPanelImpl.ACTION_SELECTED_KEY, SHTMLPanelImpl.ACTION_UNSELECTED); - SHTMLPanelImpl.getActionProperties(this, SHTMLPanelImpl.fontUnderlineAction); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.fontUnderlineAction); } /** @@ -687,11 +628,6 @@ class SHTMLEditorKitActions { } panel.updateActions(); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, SHTMLPanelImpl.fontUnderlineAction); - } - public void update() { setEnabled(panel.isWYSIWYGEditorActive()); } @@ -772,8 +708,7 @@ class SHTMLEditorKitActions { public FontColorByDialogAction(final SHTMLPanelImpl panel) { super(panel); - putValue(Action.NAME, SHTMLPanelImpl.fontColorAction); - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.fontColorAction); } protected AttributeSet getColor() { @@ -784,10 +719,6 @@ class SHTMLEditorKitActions { return color; } - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, SHTMLPanelImpl.fontColorAction); - } - public void update() { } } @@ -796,8 +727,7 @@ class SHTMLEditorKitActions { public SelectedFontColorAction(final SHTMLPanelImpl panel) { super(panel); - putValue(Action.NAME, SHTMLPanelImpl.selectedFontColorAction); - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.selectedFontColorAction); } protected AttributeSet getColor() { @@ -809,10 +739,6 @@ class SHTMLEditorKitActions { return set; } - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, SHTMLPanelImpl.selectedFontColorAction); - } - public void update() { } } @@ -823,8 +749,7 @@ class SHTMLEditorKitActions { public FixedFontColorAction(final SHTMLPanelImpl panel, String name, Color color) { super(panel); - putValue(Action.NAME, name); - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, name); this.color = color; } @@ -835,12 +760,8 @@ class SHTMLEditorKitActions { set.addAttribute(HTML.Attribute.COLOR, colorRGB); return set; } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } - public void update() { + public void update() { } } /** @@ -853,9 +774,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public EditAnchorsAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.editAnchorsAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.editAnchorsAction); } public void actionPerformed(final ActionEvent ae) { @@ -871,10 +792,6 @@ class SHTMLEditorKitActions { public void update() { this.setEnabled(panel.isWYSIWYGEditorActive()); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -887,9 +804,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public EditLinkAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.editLinkAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.editLinkAction); } public void actionPerformed(final ActionEvent ae) { @@ -928,10 +845,6 @@ class SHTMLEditorKitActions { this.setEnabled(false); } } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -944,9 +857,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public OpenLinkAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.openLinkAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.openLinkAction); } public void actionPerformed(final ActionEvent ae) { @@ -975,10 +888,6 @@ class SHTMLEditorKitActions { this.setEnabled(false); } } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -991,10 +900,10 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public UndoAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.undoAction); + super(); this.panel = panel; setEnabled(false); - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.undoAction); } public void actionPerformed(final ActionEvent e) { @@ -1015,9 +924,6 @@ class SHTMLEditorKitActions { setEnabled(panel.isWYSIWYGEditorActive() && panel.getUndo().canUndo()); } - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -1030,9 +936,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public EditNamedStyleAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.editNamedStyleAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.editNamedStyleAction); } public void actionPerformed(final ActionEvent ae) { @@ -1049,10 +955,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive()); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } static public class RemoveStyleAttributeAction extends AbstractAction implements SHTMLAction { @@ -1064,7 +966,7 @@ class SHTMLEditorKitActions { super(name); this.panel = panel; this.attributes = attributes; - SHTMLPanelImpl.getActionProperties(this, name); + SHTMLPanelImpl.configureActionProperties(this, name); } public void actionPerformed(ActionEvent e) { @@ -1096,8 +998,7 @@ class SHTMLEditorKitActions { public ClearFormatAction(final SHTMLPanelImpl panel) { super(); this.panel = panel; - putValue(Action.NAME, SHTMLPanelImpl.clearFormatAction); - SHTMLPanelImpl.getActionProperties(this, SHTMLPanelImpl.clearFormatAction); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.clearFormatAction); } /** @@ -1119,11 +1020,6 @@ class SHTMLEditorKitActions { } panel.updateActions(); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, SHTMLPanelImpl.clearFormatAction); - } - public void update() { this.setEnabled(panel.isWYSIWYGEditorActive()); } @@ -1139,9 +1035,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelMultipleDocImpl panel; public MultipleDocFindReplaceAction(final SHTMLPanelMultipleDocImpl panel) { - super(SHTMLPanelMultipleDocImpl.findReplaceAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelMultipleDocImpl.configureActionProperties(this, SHTMLPanelMultipleDocImpl.findReplaceAction); } public void actionPerformed(final ActionEvent ae) { @@ -1170,9 +1066,6 @@ class SHTMLEditorKitActions { } } - public void getProperties() { - SHTMLPanelMultipleDocImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } public void getNextDocument(final FindReplaceEvent e) { final FindReplaceDialog frd = (FindReplaceDialog) e.getSource(); @@ -1224,9 +1117,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public SingleDocFindReplaceAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.findReplaceAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.findReplaceAction); } public void actionPerformed(final ActionEvent ae) { @@ -1250,10 +1143,6 @@ class SHTMLEditorKitActions { } } - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } - public void findReplaceTerminated(final FindReplaceEvent e) { if (currentDocumentPane.isVisible()) { final JEditorPane editor = currentDocumentPane.getEditor(); @@ -1276,9 +1165,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public FontAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.fontAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.fontAction); } public void actionPerformed(final ActionEvent ae) { @@ -1301,10 +1190,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive()); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -1317,9 +1202,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public FontFamilyAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.fontFamilyAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.fontFamilyAction); } public void actionPerformed(final ActionEvent ae) { @@ -1333,10 +1218,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive()); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -1349,9 +1230,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public FontSizeAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.fontSizeAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.fontSizeAction); } public void actionPerformed(final ActionEvent ae) { @@ -1365,10 +1246,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive()); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -1392,7 +1269,7 @@ class SHTMLEditorKitActions { super(name); this.panel = panel; this.change = change; - SHTMLPanelImpl.getActionProperties(this, name); + SHTMLPanelImpl.configureActionProperties(this, name); } @@ -1447,8 +1324,7 @@ class SHTMLEditorKitActions { public FormatImageAction(final SHTMLPanelImpl panel) { super(); this.panel = panel; - putValue(Action.NAME, SHTMLPanelImpl.formatImageAction); - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.formatImageAction); } public void actionPerformed(final ActionEvent ae) { @@ -1494,10 +1370,6 @@ class SHTMLEditorKitActions { this.setEnabled(false); } } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -1510,9 +1382,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public FormatListAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.formatListAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.formatListAction); } public void actionPerformed(final ActionEvent ae) { @@ -1550,10 +1422,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive()); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -1566,9 +1434,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public FormatParaAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.formatParaAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.formatParaAction); } public void actionPerformed(final ActionEvent ae) { @@ -1590,10 +1458,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive()); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -1606,9 +1470,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public FormatTableAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.formatTableAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.formatTableAction); } public void actionPerformed(final ActionEvent ae) { @@ -1642,10 +1506,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive() && panel.getSHTMLEditorPane().getCurrentTableCell() != null); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -1665,9 +1525,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public GarbageCollectionAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.gcAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.gcAction); } public void actionPerformed(final ActionEvent e) { @@ -1677,10 +1537,6 @@ class SHTMLEditorKitActions { public void update() { } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } static class InsertImageAction extends AbstractAction implements SHTMLAction { @@ -1692,8 +1548,7 @@ class SHTMLEditorKitActions { public InsertImageAction(final SHTMLPanelImpl panel) { super(); this.panel = panel; - putValue(Action.NAME, SHTMLPanelImpl.insertImageAction); - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.insertImageAction); } public void actionPerformed(final ActionEvent ae) { @@ -1729,10 +1584,6 @@ class SHTMLEditorKitActions { this.setEnabled(false); } } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -1745,9 +1596,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public InsertTableAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.insertTableAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.insertTableAction); } public void actionPerformed(final ActionEvent ae) { @@ -1769,10 +1620,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive()); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -1785,9 +1632,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public InsertTableColAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.insertTableColAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.insertTableColAction); } public void actionPerformed(final ActionEvent ae) { @@ -1797,10 +1644,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive() && panel.getSHTMLEditorPane().getCurrentTableCell() != null); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -1814,10 +1657,10 @@ class SHTMLEditorKitActions { private final String forcedCellName; public InsertTableRowAction(final SHTMLPanelImpl panel, final String forcedCellName, final String titleID) { - super(titleID); + super(); this.panel = panel; this.forcedCellName = forcedCellName; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, titleID); } public void actionPerformed(final ActionEvent ae) { @@ -1827,10 +1670,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive() && panel.getSHTMLEditorPane().getCurrentTableCell() != null); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -1843,9 +1682,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public MoveTableRowUpAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.moveTableRowUpAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.moveTableRowUpAction); } public void actionPerformed(final ActionEvent ae) { @@ -1855,10 +1694,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive() && panel.getSHTMLEditorPane().getCurrentTableCell() != null); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -1871,9 +1706,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public MoveTableRowDownAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.moveTableRowDownAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.moveTableRowDownAction); } public void actionPerformed(final ActionEvent ae) { @@ -1883,10 +1718,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive() && panel.getSHTMLEditorPane().getCurrentTableCell() != null); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -1899,9 +1730,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public MoveTableColumnLeftAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.moveTableColumnLeftAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.moveTableColumnLeftAction); } public void actionPerformed(final ActionEvent ae) { @@ -1911,10 +1742,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive() && panel.getSHTMLEditorPane().getCurrentTableCell() != null); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -1927,9 +1754,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public MoveTableColumnRightAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.moveTableColumnRightAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.moveTableColumnRightAction); } public void actionPerformed(final ActionEvent ae) { @@ -1939,10 +1766,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive() && panel.getSHTMLEditorPane().getCurrentTableCell() != null); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -1957,7 +1780,7 @@ class SHTMLEditorKitActions { public ToggleTableHeaderCellAction(final SHTMLPanelImpl panel) { super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, null); } public void actionPerformed(final ActionEvent ae) { @@ -1967,10 +1790,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive() && panel.getSHTMLEditorPane().getCurrentTableCell() != null); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } static class ItalicAction extends StyledEditorKit.ItalicAction implements SHTMLAction, AttributeComponent { @@ -1983,9 +1802,8 @@ class SHTMLEditorKitActions { //Action act = new StyledEditorKit.BoldAction(); super(); this.panel = panel; - putValue(Action.NAME, SHTMLPanelImpl.fontItalicAction); putValue(SHTMLPanelImpl.ACTION_SELECTED_KEY, SHTMLPanelImpl.ACTION_UNSELECTED); - SHTMLPanelImpl.getActionProperties(this, SHTMLPanelImpl.fontItalicAction); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.fontItalicAction); } /** @@ -2014,10 +1832,6 @@ class SHTMLEditorKitActions { panel.updateActions(); } - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, SHTMLPanelImpl.fontItalicAction); - } - public void update() { setEnabled(panel.isWYSIWYGEditorActive()); } @@ -2081,9 +1895,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public NextTableCellAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.nextTableCellAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.nextTableCellAction); } public void actionPerformed(final ActionEvent ae) { @@ -2097,10 +1911,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive() && panel.getSHTMLEditorPane().getCurrentTableCell() != null); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -2113,9 +1923,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public PrevTableCellAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.prevTableCellAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.prevTableCellAction); } public void actionPerformed(final ActionEvent ae) { @@ -2129,10 +1939,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive() && panel.getSHTMLEditorPane().getCurrentTableCell() != null); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -2157,9 +1963,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public PrintAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.printAction); - getProperties(); + super(); this.panel = panel; + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.printAction); } public void actionPerformed(final ActionEvent e) { @@ -2179,10 +1985,6 @@ class SHTMLEditorKitActions { public void update() { } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -2195,10 +1997,10 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public RedoAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.redoAction); + super(); this.panel = panel; setEnabled(false); - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.redoAction); } public void actionPerformed(final ActionEvent e) { @@ -2218,10 +2020,6 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive() && panel.getUndo().canRedo()); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** just adds a normal name to the superclasse's action */ @@ -2234,8 +2032,7 @@ class SHTMLEditorKitActions { public SHTMLEditCopyAction(final SHTMLPanelImpl panel) { super(); this.panel = panel; - putValue(Action.NAME, SHTMLPanelImpl.copyAction); - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.copyAction); } public void actionPerformed(final ActionEvent e) { @@ -2251,10 +2048,6 @@ class SHTMLEditorKitActions { setEnabled(false); } } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** just adds a normal name to the superclasse's action */ @@ -2267,8 +2060,7 @@ class SHTMLEditorKitActions { public SHTMLEditCutAction(final SHTMLPanelImpl panel) { super(); this.panel = panel; - putValue(Action.NAME, SHTMLPanelImpl.cutAction); - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.cutAction); } public void actionPerformed(final ActionEvent e) { @@ -2284,10 +2076,6 @@ class SHTMLEditorKitActions { setEnabled(false); } } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** just adds a normal name to the superclasse's action */ @@ -2300,8 +2088,7 @@ class SHTMLEditorKitActions { public SHTMLEditPasteAction(final SHTMLPanelImpl panel) { super(); this.panel = panel; - putValue(Action.NAME, SHTMLPanelImpl.pasteAction); - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.pasteAction); } public void actionPerformed(final ActionEvent e) { @@ -2317,10 +2104,6 @@ class SHTMLEditorKitActions { setEnabled(false); } } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -2337,6 +2120,7 @@ class SHTMLEditorKitActions { public SHTMLEditPasteOtherAction(final SHTMLPanelImpl panel) { super(); this.panel = panel; + SHTMLPanelImpl.configureActionProperties(this, "pasteOther"); updateActionName(PasteMode.getValueFromPrefs().invert()); } @@ -2354,7 +2138,6 @@ class SHTMLEditorKitActions { { throw new RuntimeException("Unknown SHTMLEditorPane.PasteMode: " + pm.toString()); } - getProperties(); panel.updateActions(); } @@ -2376,10 +2159,6 @@ class SHTMLEditorKitActions { setEnabled(false); } } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, "pasteOther"); - } } static class SHTMLEditPrefsAction extends AbstractAction implements SHTMLAction { @@ -2391,8 +2170,7 @@ class SHTMLEditorKitActions { public SHTMLEditPrefsAction(final SHTMLPanelImpl panel) { super(); this.panel = panel; - putValue(Action.NAME, SHTMLPanelImpl.editPrefsAction); - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.editPrefsAction); } public void actionPerformed(final ActionEvent ae) { @@ -2414,10 +2192,6 @@ class SHTMLEditorKitActions { public void update() { } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } static class SHTMLEditSelectAllAction extends AbstractAction implements SHTMLAction { @@ -2429,8 +2203,7 @@ class SHTMLEditorKitActions { public SHTMLEditSelectAllAction(final SHTMLPanelImpl panel) { super(); this.panel = panel; - putValue(Action.NAME, SHTMLPanelImpl.selectAllAction); - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.selectAllAction); } public void actionPerformed(final ActionEvent ae) { @@ -2451,10 +2224,6 @@ class SHTMLEditorKitActions { this.setEnabled(false); } } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -2477,9 +2246,9 @@ class SHTMLEditorKitActions { /** constructor * @param panel TODO*/ public SHTMLFileCloseAction(final SHTMLPanelMultipleDocImpl panel) { - super(SHTMLPanelMultipleDocImpl.closeAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelMultipleDocImpl.closeAction); } /** close the currently active document, if there is one */ @@ -2620,10 +2389,6 @@ class SHTMLEditorKitActions { this.setEnabled(false); } } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -2641,9 +2406,9 @@ class SHTMLEditorKitActions { /** constructor * @param panel TODO*/ public SHTMLFileCloseAllAction(final SHTMLPanelMultipleDocImpl panel) { - super(SHTMLPanelMultipleDocImpl.closeAllAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelMultipleDocImpl.closeAllAction); } /** close all open documents */ @@ -2665,10 +2430,6 @@ class SHTMLEditorKitActions { this.setEnabled(false); } } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -2689,9 +2450,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelMultipleDocImpl panel; public SHTMLFileExitAction(final SHTMLPanelMultipleDocImpl panel) { - super(SHTMLPanelImpl.exitAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.exitAction); } public void actionPerformed(final ActionEvent ae) { @@ -2711,10 +2472,6 @@ class SHTMLEditorKitActions { public void update() { } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** create a new empty document and show it */ @@ -2725,9 +2482,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelMultipleDocImpl panel; public SHTMLFileNewAction(final SHTMLPanelMultipleDocImpl panel) { - super(SHTMLPanelMultipleDocImpl.newAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelMultipleDocImpl.newAction); } /** create a new empty document and show it */ @@ -2742,10 +2499,6 @@ class SHTMLEditorKitActions { public void update() { } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** open an existing document from file and show it */ @@ -2756,9 +2509,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelMultipleDocImpl panel; public SHTMLFileOpenAction(final SHTMLPanelMultipleDocImpl panel) { - super(SHTMLPanelMultipleDocImpl.openAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelMultipleDocImpl.openAction); } public void actionPerformed(final ActionEvent ae) { @@ -2868,10 +2621,6 @@ class SHTMLEditorKitActions { public void update() { } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** save a document */ @@ -2882,9 +2631,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public SHTMLFileSaveAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelMultipleDocImpl.saveAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelMultipleDocImpl.saveAction); } public void actionPerformed(final ActionEvent ae) { @@ -2928,10 +2677,6 @@ class SHTMLEditorKitActions { } this.setEnabled(isEnabled && needsSaving && !saveInProgress); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } static class SHTMLFileSaveAllAction extends AbstractAction implements SHTMLAction { @@ -2941,9 +2686,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelMultipleDocImpl panel; public SHTMLFileSaveAllAction(final SHTMLPanelMultipleDocImpl panel) { - super(SHTMLPanelMultipleDocImpl.saveAllAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelMultipleDocImpl.saveAllAction); } public void actionPerformed(final ActionEvent ae) { @@ -2966,10 +2711,6 @@ class SHTMLEditorKitActions { this.setEnabled(false); } } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -2985,9 +2726,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelMultipleDocImpl panel; public SHTMLFileSaveAsAction(final SHTMLPanelMultipleDocImpl panel) { - super(SHTMLPanelMultipleDocImpl.saveAsAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelMultipleDocImpl.saveAsAction); } public void actionPerformed(final ActionEvent ae) { @@ -3104,10 +2845,6 @@ class SHTMLEditorKitActions { } this.setEnabled(isEnabled && !saveInProgress); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -3120,9 +2857,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public SHTMLTestAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.testAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.testAction); } public void actionPerformed(final ActionEvent ae) { @@ -3131,10 +2868,6 @@ class SHTMLEditorKitActions { public void update() { } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** show information about SimplyHTML in a dialog */ @@ -3145,9 +2878,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public SHTMLHelpAppInfoAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.aboutAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.aboutAction); } public void actionPerformed(final ActionEvent ae) { @@ -3162,10 +2895,6 @@ class SHTMLEditorKitActions { public void update() { } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } /** @@ -3180,9 +2909,9 @@ class SHTMLEditorKitActions { private final SHTMLPanelImpl panel; public SetDefaultStyleRefAction(final SHTMLPanelImpl panel) { - super(SHTMLPanelImpl.setDefaultStyleRefAction); + super(); this.panel = panel; - getProperties(); + SHTMLPanelImpl.configureActionProperties(this, SHTMLPanelImpl.setDefaultStyleRefAction); } public void actionPerformed(final ActionEvent ae) { @@ -3193,9 +2922,5 @@ class SHTMLEditorKitActions { public void update() { setEnabled(panel.isWYSIWYGEditorActive() && !panel.getSHTMLDocument().hasStyleRef()); } - - public void getProperties() { - SHTMLPanelImpl.getActionProperties(this, (String) getValue(Action.NAME)); - } } } diff --git a/src/com/lightdev/app/shtm/SHTMLEditorPane.java b/src/com/lightdev/app/shtm/SHTMLEditorPane.java index c2175c5..eda020a 100644 --- a/src/com/lightdev/app/shtm/SHTMLEditorPane.java +++ b/src/com/lightdev/app/shtm/SHTMLEditorPane.java @@ -61,7 +61,6 @@ import javax.swing.JPopupMenu; import javax.swing.KeyStroke; import javax.swing.TransferHandler; import javax.swing.event.CaretEvent; -import javax.swing.plaf.ComponentUI; import javax.swing.plaf.TextUI; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; diff --git a/src/com/lightdev/app/shtm/SHTMLHelpBroker.java b/src/com/lightdev/app/shtm/SHTMLHelpBroker.java index 6dfb719..a293cbb 100644 --- a/src/com/lightdev/app/shtm/SHTMLHelpBroker.java +++ b/src/com/lightdev/app/shtm/SHTMLHelpBroker.java @@ -73,7 +73,7 @@ class SHTMLHelpBroker { static void initJavaHelpItem(final JMenuItem mi, final String helpTopicId) { CSH.setHelpIDString(mi, helpTopicId); mi.addActionListener(new CSH.DisplayHelpFromSource(SHTMLHelpBroker.getHelpBroker())); - mi.setIcon(DynamicResource.getIconForCommand(SHTMLPanelImpl.getResources(), SHTMLPanelImpl.helpTopicsAction)); + mi.setIcon(DynamicResource.getIconForCommand(SHTMLPanelImpl.getUiResources(), SHTMLPanelImpl.helpTopicsAction)); mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0)); mi.setEnabled(true); } diff --git a/src/com/lightdev/app/shtm/SHTMLPanel.java b/src/com/lightdev/app/shtm/SHTMLPanel.java index bb4da83..75b1cc3 100644 --- a/src/com/lightdev/app/shtm/SHTMLPanel.java +++ b/src/com/lightdev/app/shtm/SHTMLPanel.java @@ -64,8 +64,8 @@ public abstract class SHTMLPanel extends JPanel implements SHTMLPrefsChangeListe public abstract void setCurrentDocumentContent(String sText); - public static void setResources(final TextResources resources) { - SHTMLPanelImpl.setTextResources(resources); + public static void setResources(final UIResources resources) { + SHTMLPanelImpl.setUiResources(resources); } public static void setActionBuilder(final ActionBuilder ab){ @@ -78,8 +78,8 @@ public abstract class SHTMLPanel extends JPanel implements SHTMLPrefsChangeListe public abstract JEditorPane getSourceEditorPane(); - public static TextResources getResources() { - return SHTMLPanelImpl.getResources(); + public static UIResources getResources() { + return SHTMLPanelImpl.getUiResources(); } abstract public int getCaretPosition(); @@ -95,7 +95,7 @@ public abstract class SHTMLPanel extends JPanel implements SHTMLPrefsChangeListe * Returns a new menu item for a named action of SimplyHTML. (Can be used for building custom * popup menu, or for invoking the action externally in another way.) */ - public abstract JMenuItem newActionMenuItem(String actionName); + public abstract JMenuItem createActionMenuItem(String actionName); /** * Switches between the rich text view and the source view, given diff --git a/src/com/lightdev/app/shtm/SHTMLPanelImpl.java b/src/com/lightdev/app/shtm/SHTMLPanelImpl.java index 2b099b7..c7f42f8 100644 --- a/src/com/lightdev/app/shtm/SHTMLPanelImpl.java +++ b/src/com/lightdev/app/shtm/SHTMLPanelImpl.java @@ -73,30 +73,31 @@ public class SHTMLPanelImpl extends SHTMLPanel implements CaretListener { /** single instance of a dynamic resource for use by all */ public DynamicResource dynRes = new DynamicResource(); /** SimplyHTML's main resource bundle (plug-ins use their own) */ - private static TextResources textResources = null; + private static UIResources uiResources = null; - public static TextResources getResources() { - if (textResources == null) { - textResources = SHTMLPanelImpl.readDefaultResources(); + public static UIResources getUiResources() { + if (uiResources == null) { + setInternalUiResources(); } - return textResources; + return uiResources; } /** the plug-in manager of SimplyHTML */ public static PluginManager pluginManager; // = new PluginManager(mainFrame); protected ActionListener openHyperlinkHandler = null; - public static void setTextResources(final TextResources textResources) { - if (SHTMLPanelImpl.textResources != null) { - return; - } - SHTMLPanelImpl.textResources = textResources != null ? textResources : SHTMLPanelImpl.readDefaultResources(); + public static void setUiResources(final UIResources uiResources) { + SHTMLPanelImpl.uiResources = uiResources; + } + + public static void setInternalUiResources() { + SHTMLPanelImpl.uiResources = SHTMLPanelImpl.readDefaultResources(); } - private static TextResources readDefaultResources() { + private static UIResources readDefaultResources() { try { - final String propsLoc = "com/lightdev/app/shtm/resources/SimplyHTML_common.properties"; - final URL defaultPropsURL = ClassLoader.getSystemResource(propsLoc); + final String propsLoc = "/com/lightdev/app/shtm/resources/SimplyHTML_common.properties"; + final URL defaultPropsURL = SHTMLPanelImpl.class.getResource(propsLoc); final Properties props = new Properties(); InputStream in = null; in = defaultPropsURL.openStream(); @@ -104,7 +105,7 @@ public class SHTMLPanelImpl extends SHTMLPanel implements CaretListener { in.close(); final ResourceBundle resourceBundle = ResourceBundle.getBundle( "com.lightdev.app.shtm.resources.SimplyHTML", Locale.getDefault()); - return new DefaultTextResources(resourceBundle, props); + return new InternalUiResources(resourceBundle, props); } catch (final Exception ex) { Util.errMsg(null, "resources not found", ex); @@ -242,8 +243,8 @@ public class SHTMLPanelImpl extends SHTMLPanel implements CaretListener { initActions(); if(actionBuilder != null) actionBuilder.initActions(this); - menuBar = dynRes.createMenubar(textResources, "menubar"); - editorPopup = dynRes.createPopupMenu(textResources, "popup"); + menuBar = dynRes.createMenubar(uiResources, "menubar"); + editorPopup = dynRes.createPopupMenu(uiResources, "popup"); setJMenuBar(menuBar); customizeFrame(); initAppTempDir(); @@ -268,8 +269,8 @@ public class SHTMLPanelImpl extends SHTMLPanel implements CaretListener { return menuBar.handleKeyBinding(ks, e, condition, pressed); } - public JMenuItem newActionMenuItem(final String actionName) { - return dynRes.createMenuItem(SHTMLPanelImpl.getResources(), actionName); + public JMenuItem createActionMenuItem(final String actionName) { + return dynRes.createMenuItem(SHTMLPanelImpl.getUiResources(), actionName); } public Action getAction(final String actionName) { @@ -592,7 +593,7 @@ public class SHTMLPanelImpl extends SHTMLPanel implements CaretListener { if (pluginMenu != null) { Icon menuIcon = pluginMenu.getIcon(); if (menuIcon == null) { - final URL url = DynamicResource.getResource(textResources, emptyIcon); + final URL url = DynamicResource.getResource(uiResources, emptyIcon); if (url != null) { menuIcon = new ImageIcon(url); pluginMenu.setIcon(new ImageIcon(url)); @@ -605,7 +606,7 @@ public class SHTMLPanelImpl extends SHTMLPanel implements CaretListener { if (helpMenu.getSubElements().length > 0) { Icon menuIcon = helpMenu.getIcon(); if (menuIcon == null) { - final URL url = DynamicResource.getResource(textResources, emptyIcon); + final URL url = DynamicResource.getResource(uiResources, emptyIcon); if (url != null) { menuIcon = new ImageIcon(url); helpMenu.setIcon(new ImageIcon(url)); @@ -877,9 +878,8 @@ public class SHTMLPanelImpl extends SHTMLPanel implements CaretListener { * @return the created tool bar */ JToolBar createToolBar(final String nm) { - final String[] itemKeys = Util.tokenize(Util.getResourceString(textResources, nm), " "); + final String[] itemKeys = Util.tokenize(Util.getResourceString(uiResources, nm), " "); final JToolBar toolBar = new JToolBar(); - toolBar.putClientProperty("JToolBar.isRollover", Boolean.TRUE); for (int i = 0; i < itemKeys.length; i++) { /** special handling for separators */ final String itemKey = itemKeys[i]; @@ -889,14 +889,9 @@ public class SHTMLPanelImpl extends SHTMLPanel implements CaretListener { } protected void createToolbarItem(final JToolBar toolBar, final String itemKey) { - final ToggleBorderListener tbl = new ToggleBorderListener(); - final Dimension buttonSize = new Dimension(24, 24); - final Dimension comboBoxSize = new Dimension(300, 24); - final Dimension separatorSize = new Dimension(3, 24); JSeparator separator; if (itemKey.equals(DynamicResource.menuSeparatorKey)) { separator = new JSeparator(JSeparator.VERTICAL); - separator.setMaximumSize(separatorSize); toolBar.add(separator); } /** @@ -905,16 +900,13 @@ public class SHTMLPanelImpl extends SHTMLPanel implements CaretListener { */ else if (itemKey.equalsIgnoreCase(fontFamilyAction)) { final FontFamilyPicker fontFamily = new FontFamilyPicker(); - fontFamily.setPreferredSize(new Dimension(180, 23)); fontFamily.setAction(dynRes.getAction(fontFamilyAction)); - fontFamily.setMaximumSize(comboBoxSize); toolBar.add(fontFamily); } else if (itemKey.equalsIgnoreCase(fontSizeAction)) { final FontSizePicker fontSize = new FontSizePicker(); - fontSize.setPreferredSize(new Dimension(50, 23)); + fontSize.setPrototypeDisplayValue("88888"); fontSize.setAction(dynRes.getAction(fontSizeAction)); - fontSize.setMaximumSize(comboBoxSize); toolBar.add(fontSize); } else if (itemKey.equalsIgnoreCase(setTagAction)) { @@ -935,7 +927,7 @@ public class SHTMLPanelImpl extends SHTMLPanel implements CaretListener { if (itemKey.equalsIgnoreCase(helpTopicsAction)) { newButton = SHTMLHelpBroker.createHelpButton("item15"); final Icon icon = DynamicResource - .getIconForCommand(SHTMLPanelImpl.getResources(), helpTopicsAction); + .getIconForCommand(SHTMLPanelImpl.getUiResources(), helpTopicsAction); newButton.setIcon(icon); newButton.setToolTipText(Util.getResourceString(helpTopicsAction + DynamicResource.toolTipSuffix)); toolBar.add(newButton); @@ -946,22 +938,10 @@ public class SHTMLPanelImpl extends SHTMLPanel implements CaretListener { */ final Action action = dynRes.getAction(itemKey); if (action instanceof AttributeComponent) { - newButton = new JToggleButton("", (Icon) action.getValue(Action.SMALL_ICON)); - newButton.addMouseListener(tbl); - newButton.setAction(action); + newButton = new JToggleButton(action); newButton.setText(""); - //newButton.setActionCommand(""); - newButton.setBorderPainted(false); + newButton.setHideActionText(true); action.addPropertyChangeListener(new ToggleActionChangedListener((JToggleButton) newButton)); - final Icon si = DynamicResource.getIconForName(textResources, action.getValue(Action.NAME) - + DynamicResource.selectedIconSuffix); - if (si != null) { - newButton.setSelectedIcon(si); - } - newButton.setMargin(new Insets(0, 0, 0, 0)); - newButton.setIconTextGap(0); - newButton.setContentAreaFilled(false); - newButton.setHorizontalAlignment(SwingConstants.CENTER); newButton.setVerticalAlignment(SwingConstants.CENTER); toolBar.add(newButton); } @@ -972,11 +952,6 @@ public class SHTMLPanelImpl extends SHTMLPanel implements CaretListener { newButton = toolBar.add(action); } } - newButton.setMinimumSize(buttonSize); - newButton.setPreferredSize(buttonSize); - newButton.setMaximumSize(buttonSize); - newButton.setFocusPainted(false); - newButton.setRequestFocusEnabled(false); if (System.getProperty("os.name").equals("Mac OS X")) { newButton.putClientProperty("JButton.buttonType", "segmented"); newButton.putClientProperty("JButton.segmentPosition", "middle"); @@ -990,41 +965,6 @@ public class SHTMLPanelImpl extends SHTMLPanel implements CaretListener { } /** - * displays or removes an etched border around JToggleButtons - * this listener is registered with. - */ - private class ToggleBorderListener implements MouseListener { - private final EtchedBorder border = new EtchedBorder(EtchedBorder.LOWERED); - private JToggleButton button; - - public void mouseClicked(final MouseEvent e) { - } - - public void mouseEntered(final MouseEvent e) { - final Object src = e.getSource(); - if (src instanceof JToggleButton) { - button = (JToggleButton) src; - if (button.isEnabled()) { - ((JToggleButton) src).setBorder(border); - } - } - } - - public void mouseExited(final MouseEvent e) { - final Object src = e.getSource(); - if (src instanceof JToggleButton) { - ((JToggleButton) src).setBorder(null); - } - } - - public void mousePressed(final MouseEvent e) { - } - - public void mouseReleased(final MouseEvent e) { - } - } - - /** * register FrmMain as an object which has interest * in events from a given document pane */ @@ -1071,7 +1011,7 @@ public class SHTMLPanelImpl extends SHTMLPanel implements CaretListener { * that way, we catch the exception here. */ catch(DocNameMissingException e) { - Util.errMsg(this, Util.getResourceString(textResources, "docNameMissingError"), e); + Util.errMsg(this, Util.getResourceString(uiResources, "docNameMissingError"), e); } } @@ -1089,24 +1029,21 @@ public class SHTMLPanelImpl extends SHTMLPanel implements CaretListener { * @param action the action to apply properties to * @param cmd the name of the action to get properties for */ - public static void getActionProperties(final Action action, final String cmd) { - final Icon icon = DynamicResource.getIconForCommand(textResources, cmd); - if (icon != null) { - action.putValue(Action.SMALL_ICON, icon); - } - /*else { - action.putValue(Action.SMALL_ICON, emptyIcon); - }*/ - final String name = Util.getResourceString(textResources, cmd + DynamicResource.labelSuffix); + public static void configureActionProperties(final Action action, final String cmd) { + final String name = Util.getResourceString(uiResources, cmd + DynamicResource.labelSuffix); if (name != null) { action.putValue(Action.NAME, name); } - final String toolTip = Util.getResourceString(textResources, cmd + DynamicResource.toolTipSuffix); + final Icon icon = DynamicResource.getIconForCommand(uiResources, cmd); + if (icon != null) { + action.putValue(Action.SMALL_ICON, icon); + } + final String toolTip = Util.getResourceString(uiResources, cmd + DynamicResource.toolTipSuffix); if (toolTip != null) { action.putValue(Action.SHORT_DESCRIPTION, toolTip); } - final String accelerator = Util.getResourceString(textResources, cmd + DynamicResource.acceleratorSuffix); + final String accelerator = Util.getResourceString(uiResources, cmd + DynamicResource.acceleratorSuffix); if (accelerator != null) { action.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(accelerator)); } diff --git a/src/com/lightdev/app/shtm/SHTMLPanelMultipleDocImpl.java b/src/com/lightdev/app/shtm/SHTMLPanelMultipleDocImpl.java index aee8c8e..fb071a3 100644 --- a/src/com/lightdev/app/shtm/SHTMLPanelMultipleDocImpl.java +++ b/src/com/lightdev/app/shtm/SHTMLPanelMultipleDocImpl.java @@ -84,10 +84,8 @@ class SHTMLPanelMultipleDocImpl extends SHTMLPanelImpl implements ChangeListener protected void createToolbarItem(final JToolBar toolBar, final String itemKey) { if (itemKey.equalsIgnoreCase(setStyleAction)) { styleSelector = new StyleSelector(this, HTML.Attribute.CLASS); - styleSelector.setPreferredSize(new Dimension(110, 23)); + styleSelector.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXX"); styleSelector.setAction(dynRes.getAction(setStyleAction)); - final Dimension comboBoxSize = new Dimension(300, 24); - styleSelector.setMaximumSize(comboBoxSize); jtpDocs.addChangeListener(styleSelector); toolBar.add(styleSelector); } diff --git a/src/com/lightdev/app/shtm/TextResources.java b/src/com/lightdev/app/shtm/UIResources.java similarity index 92% rename from src/com/lightdev/app/shtm/TextResources.java rename to src/com/lightdev/app/shtm/UIResources.java index bb44b0f..eaf1207 100644 --- a/src/com/lightdev/app/shtm/TextResources.java +++ b/src/com/lightdev/app/shtm/UIResources.java @@ -19,12 +19,15 @@ */ package com.lightdev.app.shtm; +import javax.swing.Icon; + /** * interface for getting text based resources * * * @author Dimitri Polivaev * 14.01.2007 */ -public interface TextResources { +public interface UIResources { String getString(String pKey); + Icon getIcon(String name); } diff --git a/src/com/lightdev/app/shtm/Util.java b/src/com/lightdev/app/shtm/Util.java index cf42673..619b609 100644 --- a/src/com/lightdev/app/shtm/Util.java +++ b/src/com/lightdev/app/shtm/Util.java @@ -941,12 +941,12 @@ public class Util { * @param nm the key of the string * @return the string for the given key or null if not found */ - static public String getResourceString(final TextResources resources, final String nm) { + static public String getResourceString(final UIResources resources, final String nm) { return DynamicResource.getResourceString(resources, nm); } static public String getResourceString(final String nm) { - final String resourceString = DynamicResource.getResourceString(SHTMLPanelImpl.getResources(), nm); + final String resourceString = DynamicResource.getResourceString(SHTMLPanelImpl.getUiResources(), nm); return resourceString != null ? resourceString : nm; } diff --git a/src/com/lightdev/app/shtm/resources/SimplyHTML.properties b/src/com/lightdev/app/shtm/resources/SimplyHTML.properties index 7c3427a..d0d0fdc 100644 --- a/src/com/lightdev/app/shtm/resources/SimplyHTML.properties +++ b/src/com/lightdev/app/shtm/resources/SimplyHTML.properties @@ -97,11 +97,9 @@ clearFormatLabel=Remove Formatting clearFormatTip=Remove Formatting fontBoldLabel=Bold fontBoldImage=resources/bold.gif -fontBoldSelectedIcon=resources/bold_on.gif fontBoldTip=switch bold on/off fontItalicLabel=Italic fontItalicImage=resources/italic.gif -fontItalicSelectedIcon=resources/italic_on.gif fontItalicTip=switch italic on/off fontUnderlineLabel=Underline fontUnderlineImage=resources/uline.gif diff --git a/src/com/lightdev/app/shtm/resources/SimplyHTML_common.properties b/src/com/lightdev/app/shtm/resources/SimplyHTML_common.properties index 2735fcd..4918991 100644 --- a/src/com/lightdev/app/shtm/resources/SimplyHTML_common.properties +++ b/src/com/lightdev/app/shtm/resources/SimplyHTML_common.properties @@ -101,20 +101,13 @@ format=font - formatPara paraAlignLeft paraAlignCenter paraAlignRight fontBold f # format menu items fontImage=resources/font.gif clearFormatImage=resources/clearFormat.gif -fontBoldSelectedIcon=resources/bold_on.gif -fontItalicSelectedIcon=resources/italic_on.gif -fontUnderlineSelectedIcon=resources/uline_on.gif -fontColorSelectedIcon=resources/fontColor.gif formatTableImage=resources/fmtTab.gif toggleBulletsImage=resources/ul.gif toggleNumbersImage=resources/ol.gif formatParaImage=resources/fmtPara.gif paraAlignLeftImage=resources/algnLft.gif -paraAlignLeftSelectedIcon=resources/algnLft_on.gif paraAlignCenterImage=resources/algnCtr.gif -paraAlignCenterSelectedIcon=resources/algnCtr_on.gif paraAlignRightImage=resources/algnRt.gif -paraAlignRightSelectedIcon=resources/algnRt_on.gif editLinkImage=resources/link.gif # menu accelerators diff --git a/src/com/lightdev/app/shtm/resources/SimplyHTML_de.properties b/src/com/lightdev/app/shtm/resources/SimplyHTML_de.properties index d5d3702..1c7af8e 100644 --- a/src/com/lightdev/app/shtm/resources/SimplyHTML_de.properties +++ b/src/com/lightdev/app/shtm/resources/SimplyHTML_de.properties @@ -85,7 +85,7 @@ insertLabel=Einf\u00fcgen #insert menu items insertTableLabel=Tabelle Einf\u00fcgen... insertImageLabel=Bild... -insertImageTip=Bild Einf�gen... +insertImageTip=Bild Einf�gen... # format menu definition formatLabel=Format @@ -96,11 +96,9 @@ clearFormatLabel=Formattierung l\u00f6schen clearFormatTip=Formattierung l\u00f6schen fontBoldLabel=Fett fontBoldImage=resources/bold.gif -fontBoldSelectedIcon=resources/bold_on.gif fontBoldTip=fett an- und ausschalten fontItalicLabel=Kursiv fontItalicImage=resources/italic.gif -fontItalicSelectedIcon=resources/italic_on.gif fontItalicTip=kursiv an- und ausschalten fontUnderlineLabel=Unterstreichung fontUnderlineImage=resources/uline.gif @@ -109,7 +107,7 @@ fontColorTip=Textfarbe fontColorLabel=Textfarbe selectedFontColorLabel=Selektierte Textfarbe redFontColorLabel=Rot -greenFontColorLabel=Gr�n +greenFontColorLabel=Gr�n blueFontColorLabel=Blau formatTableLabel=Tabelle... formatTableTip=Tabelle formatieren... @@ -133,7 +131,7 @@ editLinkLabel=Verkn\u00fcpfung... editLinkTip=Verkn\u00fcpfung bearbeiten... editAnchorsLabel=Anker... editAnchorsTip=Anker setzen und \u00e4ndern... -increaseFontSizeLabel=Gr��er +increaseFontSizeLabel=Gr��er decreaseFontSizeLabel=Kleiner @@ -357,11 +355,11 @@ searchFromStart.tooltip=Von Anfang an (und nicht ab der Cursorposition) suchen. searchDown=nach unten suchen searchDown.tooltip=Von oben nach unten suchen. wholeWordsOnly=nur ganze Worte -wholeWordsOnly.tooltip=Treffer auf ganze W�rter beschr�nken. +wholeWordsOnly.tooltip=Treffer auf ganze W�rter beschr�nken. searchUp=nach oben suchen searchUp.tooltip=Von unten nach oben suchen. matchCase=Gro\u00df- und Kleinschreibung beachten -matchCase.tooltip=Gibt an, ob Gro�/Kleinschreibung bei der Suche beachtet werden soll. +matchCase.tooltip=Gibt an, ob Gro�/Kleinschreibung bei der Suche beachtet werden soll. matchApproximately=Approximative Suche matchApproximately.tooltip=<html>Gibt an, ob approximative Treffer angezeigt werden sollen,<br/>z.B. Suche nach 'files' findet 'flies'.</html> replaceWith=Ersetzen mit: diff --git a/src/com/lightdev/app/shtm/resources/algnCtr_on.gif b/src/com/lightdev/app/shtm/resources/algnCtr_on.gif deleted file mode 100644 index 5b20e78..0000000 Binary files a/src/com/lightdev/app/shtm/resources/algnCtr_on.gif and /dev/null differ diff --git a/src/com/lightdev/app/shtm/resources/algnLft_on.gif b/src/com/lightdev/app/shtm/resources/algnLft_on.gif deleted file mode 100644 index 0ae3829..0000000 Binary files a/src/com/lightdev/app/shtm/resources/algnLft_on.gif and /dev/null differ diff --git a/src/com/lightdev/app/shtm/resources/algnRt_on.gif b/src/com/lightdev/app/shtm/resources/algnRt_on.gif deleted file mode 100644 index 3f90304..0000000 Binary files a/src/com/lightdev/app/shtm/resources/algnRt_on.gif and /dev/null differ diff --git a/src/com/lightdev/app/shtm/resources/bold_on.gif b/src/com/lightdev/app/shtm/resources/bold_on.gif deleted file mode 100644 index e6d561e..0000000 Binary files a/src/com/lightdev/app/shtm/resources/bold_on.gif and /dev/null differ diff --git a/src/com/lightdev/app/shtm/resources/bold_on_de.gif b/src/com/lightdev/app/shtm/resources/bold_on_de.gif deleted file mode 100644 index 17f4ad2..0000000 Binary files a/src/com/lightdev/app/shtm/resources/bold_on_de.gif and /dev/null differ diff --git a/src/com/lightdev/app/shtm/resources/italic_on.gif b/src/com/lightdev/app/shtm/resources/italic_on.gif deleted file mode 100644 index 9078e80..0000000 Binary files a/src/com/lightdev/app/shtm/resources/italic_on.gif and /dev/null differ diff --git a/src/com/lightdev/app/shtm/resources/italic_on_de.gif b/src/com/lightdev/app/shtm/resources/italic_on_de.gif deleted file mode 100644 index 345614b..0000000 Binary files a/src/com/lightdev/app/shtm/resources/italic_on_de.gif and /dev/null differ diff --git a/src/com/lightdev/app/shtm/resources/ol_on.gif b/src/com/lightdev/app/shtm/resources/ol_on.gif deleted file mode 100644 index 9642167..0000000 Binary files a/src/com/lightdev/app/shtm/resources/ol_on.gif and /dev/null differ diff --git a/src/de/calcom/cclib/text/FindReplaceDialog.java b/src/de/calcom/cclib/text/FindReplaceDialog.java index 8956589..c3a2a42 100644 --- a/src/de/calcom/cclib/text/FindReplaceDialog.java +++ b/src/de/calcom/cclib/text/FindReplaceDialog.java @@ -51,13 +51,8 @@ import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTextField; import javax.swing.MutableComboBoxModel; -import javax.swing.RootPaneContainer; import javax.swing.border.TitledBorder; -import javax.swing.text.BadLocationException; -import javax.swing.text.DefaultHighlighter; import javax.swing.text.Document; -import javax.swing.text.Highlighter; - import com.lightdev.app.shtm.SHTMLPanel; import com.lightdev.app.shtm.Util; diff --git a/src/de/calcom/cclib/text/PseudoDamerauLevenshtein.java b/src/de/calcom/cclib/text/PseudoDamerauLevenshtein.java index 65ca02a..0cbe29c 100644 --- a/src/de/calcom/cclib/text/PseudoDamerauLevenshtein.java +++ b/src/de/calcom/cclib/text/PseudoDamerauLevenshtein.java @@ -23,12 +23,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; import java.util.List; import java.util.Stack; -import java.util.TreeSet; /** * Pseudo-Damerau-Levenshtein (aka "Optimal String Distance") -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/simplyhtml.git _______________________________________________ pkg-java-commits mailing list pkg-java-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits