tentative merge of EKIT_0_9H and custom patches
[old-projects.git] / ekit / com / hexidec / ekit / EkitApplet.java
index e7e9201..b67aa53 100644 (file)
@@ -2,7 +2,7 @@
 GNU Lesser General Public License
 
 EkitApplet - Java Swing HTML Editor & Viewer Applet
-Copyright (C) 2000-2003 Howard Kistler
+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
@@ -22,6 +22,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 package com.hexidec.ekit;
 
 import java.awt.BorderLayout;
+import java.awt.GridBagLayout;
+import java.awt.GridBagConstraints;
 import java.awt.Toolkit;
 import java.awt.event.KeyEvent;
 import java.net.MalformedURLException;
@@ -48,8 +50,6 @@ public class EkitApplet extends JApplet
        /* Components */
        EkitCore ekitCore;
 
-       private JLabel jlblStatus;
-
        /** Constructor
          */
        public EkitApplet()
@@ -77,7 +77,9 @@ public class EkitApplet extends JApplet
                        murle.printStackTrace(System.err);
                }
                boolean showToolBar = true;
+               boolean showToolBarMulti = false;
                if(this.getParameter("TOOLBAR") != null) { showToolBar = this.getParameter("TOOLBAR").equalsIgnoreCase("true"); }
+               if(this.getParameter("TOOLBARMULTI") != null) { showToolBar = this.getParameter("TOOLBARMULTI").equalsIgnoreCase("true"); showToolBarMulti = this.getParameter("TOOLBARMULTI").equalsIgnoreCase("true"); }
                boolean showViewSource = ((this.getParameter("SOURCEVIEW") != null && this.getParameter("SOURCEVIEW").equalsIgnoreCase("true")));
                String sLanguage = this.getParameter("LANGCODE");
                String sCountry = this.getParameter("LANGCOUNTRY");
@@ -85,8 +87,17 @@ public class EkitApplet extends JApplet
                if(this.getParameter("EXCLUSIVE") != null) { editModeExclusive = this.getParameter("EXCLUSIVE").equalsIgnoreCase("true"); }
                boolean showMenuIcons = true;
                if(this.getParameter("MENUICONS") != null) { showMenuIcons = this.getParameter("MENUICONS").equalsIgnoreCase("true"); }
+               boolean spellChecker = false;
+               if(this.getParameter("SPELLCHECK") != null) { spellChecker = this.getParameter("SPELLCHECK").equalsIgnoreCase("true"); }
 
-               ekitCore = new EkitCore(sRawDocument, urlCSS, showViewSource, showMenuIcons, editModeExclusive, sLanguage, sCountry, base64, this.getParameter("BASEURL"));
+               if(spellChecker)
+               {
+                       //ekitCore = new EkitCoreSpell(sRawDocument, urlCSS, showToolBar, showViewSource, showMenuIcons, editModeExclusive, sLanguage, sCountry, base64, showToolBarMulti, this.getParameter("BASEURL"));
+               }
+               else
+               {
+                       ekitCore = new EkitCore(sRawDocument, urlCSS, showToolBar, showViewSource, showMenuIcons, editModeExclusive, sLanguage, sCountry, base64, false, showToolBarMulti, this.getParameter("BASEURL"));
+               }
 
                /* Obtain image servlet information */
                ekitCore.setServletURL(this.getParameter("SERVLETURL"));
@@ -107,38 +118,78 @@ public class EkitApplet extends JApplet
                if(this.getParameter("MENU_HELP")   != null) { if(this.getParameter("MENU_HELP").equalsIgnoreCase("true"))   { vcMenus.add(EkitCore.KEY_MENU_HELP); } }   else { vcMenus.add(EkitCore.KEY_MENU_HELP); }
                this.setJMenuBar(ekitCore.getCustomMenuBar(vcMenus));
 
-               jlblStatus = new JLabel();
-               
                /* Add the components to the app */
-               this.getContentPane().setLayout(new BorderLayout());
-               this.getContentPane().add(ekitCore, BorderLayout.CENTER);
-               this.getContentPane().add(jlblStatus, BorderLayout.SOUTH);
                if(showToolBar)
                {
-                       Vector vcTools = new Vector();
-                       vcTools.add(EkitCore.KEY_TOOL_NEW);
-                       vcTools.add(EkitCore.KEY_TOOL_SEP);
-                       vcTools.add(EkitCore.KEY_TOOL_CUT);
-                       vcTools.add(EkitCore.KEY_TOOL_COPY);
-                       vcTools.add(EkitCore.KEY_TOOL_PASTE);
-                       vcTools.add(EkitCore.KEY_TOOL_SEP);
-                       vcTools.add(EkitCore.KEY_TOOL_BOLD);
-                       vcTools.add(EkitCore.KEY_TOOL_ITALIC);
-                       vcTools.add(EkitCore.KEY_TOOL_UNDERLINE);
-                       vcTools.add(EkitCore.KEY_TOOL_STRIKE);
-                       vcTools.add(EkitCore.KEY_TOOL_SUPER);
-                       vcTools.add(EkitCore.KEY_TOOL_SUB);
-                       vcTools.add(EkitCore.KEY_TOOL_ULIST);
-                       vcTools.add(EkitCore.KEY_TOOL_OLIST);
-                       vcTools.add(EkitCore.KEY_TOOL_SEP);
-                       vcTools.add(EkitCore.KEY_TOOL_CLEAR);
-                       vcTools.add(EkitCore.KEY_TOOL_SEP);
-                       vcTools.add(EkitCore.KEY_TOOL_ANCHOR);
-                       vcTools.add(EkitCore.KEY_TOOL_SEP);
-                       vcTools.add(EkitCore.KEY_TOOL_SOURCE);
-                       vcTools.add(EkitCore.KEY_TOOL_SEP);
-                       vcTools.add(EkitCore.KEY_TOOL_STYLES);
-                       this.getContentPane().add(ekitCore.getCustomToolBar(vcTools, showToolBar), BorderLayout.NORTH);
+                       if(showToolBarMulti)
+                       {
+                               this.getContentPane().setLayout(new GridBagLayout());
+                               GridBagConstraints gbc = new GridBagConstraints();
+                               gbc.fill       = GridBagConstraints.HORIZONTAL;
+                               gbc.anchor     = GridBagConstraints.NORTH;
+                               gbc.gridheight = 1;
+                               gbc.gridwidth  = 1;
+                               gbc.weightx    = 1.0;
+                               gbc.weighty    = 0.0;
+                               gbc.gridx      = 1;
+
+                               gbc.gridy      = 1;
+                               Vector vcTools = new Vector();
+                               vcTools.add(EkitCore.KEY_TOOL_NEW);
+                               vcTools.add(EkitCore.KEY_TOOL_SEP);
+                               vcTools.add(EkitCore.KEY_TOOL_CUT);
+                               vcTools.add(EkitCore.KEY_TOOL_COPY);
+                               vcTools.add(EkitCore.KEY_TOOL_PASTE);
+                               vcTools.add(EkitCore.KEY_TOOL_SEP);
+                               vcTools.add(EkitCore.KEY_TOOL_CLEAR);
+                               vcTools.add(EkitCore.KEY_TOOL_SEP);
+                               vcTools.add(EkitCore.KEY_TOOL_ANCHOR);
+                               vcTools.add(EkitCore.KEY_TOOL_SEP);
+                               vcTools.add(EkitCore.KEY_TOOL_SOURCE);
+                               this.getContentPane().add(ekitCore.customizeToolBar(EkitCore.TOOLBAR_MAIN, vcTools, showToolBar), gbc);
+
+                               gbc.gridy      = 2;
+                               this.getContentPane().add(ekitCore.getToolBarFormat(showToolBar), gbc);
+
+                               gbc.gridy      = 3;
+                               this.getContentPane().add(ekitCore.getToolBarStyles(showToolBar), gbc);
+
+                               gbc.anchor     = GridBagConstraints.CENTER;
+                               gbc.fill       = GridBagConstraints.BOTH;
+                               gbc.weighty    = 1.0;
+                               gbc.gridy      = 4;
+                               this.getContentPane().add(ekitCore, gbc);
+                       }
+                       else
+                       {
+                               Vector vcTools = new Vector();
+                               vcTools.add(EkitCore.KEY_TOOL_NEW);
+                               vcTools.add(EkitCore.KEY_TOOL_SEP);
+                               vcTools.add(EkitCore.KEY_TOOL_CUT);
+                               vcTools.add(EkitCore.KEY_TOOL_COPY);
+                               vcTools.add(EkitCore.KEY_TOOL_PASTE);
+                               vcTools.add(EkitCore.KEY_TOOL_SEP);
+                               vcTools.add(EkitCore.KEY_TOOL_BOLD);
+                               vcTools.add(EkitCore.KEY_TOOL_ITALIC);
+                               vcTools.add(EkitCore.KEY_TOOL_UNDERLINE);
+                               vcTools.add(EkitCore.KEY_TOOL_STRIKE);
+                               vcTools.add(EkitCore.KEY_TOOL_SUPER);
+                               vcTools.add(EkitCore.KEY_TOOL_SUB);
+                               vcTools.add(EkitCore.KEY_TOOL_ULIST);
+                               vcTools.add(EkitCore.KEY_TOOL_OLIST);
+                               vcTools.add(EkitCore.KEY_TOOL_SEP);
+                               vcTools.add(EkitCore.KEY_TOOL_CLEAR);
+                               vcTools.add(EkitCore.KEY_TOOL_SEP);
+                               vcTools.add(EkitCore.KEY_TOOL_ANCHOR);
+                               vcTools.add(EkitCore.KEY_TOOL_SEP);
+                               vcTools.add(EkitCore.KEY_TOOL_SOURCE);
+                               vcTools.add(EkitCore.KEY_TOOL_SEP);
+                               vcTools.add(EkitCore.KEY_TOOL_STYLES);
+
+                               this.getContentPane().setLayout(new BorderLayout());
+                               this.getContentPane().add(ekitCore, BorderLayout.CENTER);
+                               this.getContentPane().add(ekitCore.customizeToolBar(EkitCore.TOOLBAR_MAIN, vcTools, showToolBar), BorderLayout.NORTH);
+                       }
                }
        }