added custom code
authorJeremy Laine <jeremy.laine@m4x.org>
Mon, 1 Dec 2003 19:18:34 +0000 (19:18 +0000)
committerJeremy Laine <jeremy.laine@m4x.org>
Mon, 1 Dec 2003 19:18:34 +0000 (19:18 +0000)
ekit/com/hexidec/ekit/EkitApplet.java
ekit/com/hexidec/ekit/EkitCore.java
ekit/com/hexidec/ekit/component/ExtendedHTMLEditorKit.java
ekit/com/hexidec/ekit/component/RelativeImageView.java

index 9400970..e7e9201 100644 (file)
@@ -86,7 +86,7 @@ public class EkitApplet extends JApplet
                boolean showMenuIcons = true;
                if(this.getParameter("MENUICONS") != null) { showMenuIcons = this.getParameter("MENUICONS").equalsIgnoreCase("true"); }
 
-               ekitCore = new EkitCore(sRawDocument, urlCSS, showViewSource, showMenuIcons, editModeExclusive, sLanguage, sCountry, base64);
+               ekitCore = new EkitCore(sRawDocument, urlCSS, showViewSource, showMenuIcons, editModeExclusive, sLanguage, sCountry, base64, this.getParameter("BASEURL"));
 
                /* Obtain image servlet information */
                ekitCore.setServletURL(this.getParameter("SERVLETURL"));
index ef23e15..07df9cb 100644 (file)
@@ -286,7 +286,7 @@ public class EkitCore extends JPanel implements ActionListener, KeyListener, Doc
          * @param base64            [boolean] Specifies whether the raw document is Base64 encoded or not.
          * @param debugMode         [boolean] Specifies whether to show the Debug menu or not.
          */
-       public EkitCore(String sDocument, String sStyleSheet, String sRawDocument, URL urlStyleSheet, boolean showViewSource, boolean showMenuIcons, boolean editModeExclusive, String sLanguage, String sCountry, boolean base64, boolean debugMode)
+       public EkitCore(String sDocument, String sStyleSheet, String sRawDocument, URL urlStyleSheet, boolean showViewSource, boolean showMenuIcons, boolean editModeExclusive, String sLanguage, String sCountry, boolean base64, boolean debugMode, String baseurl)
        {
                super();
 
@@ -330,7 +330,7 @@ public class EkitCore extends JPanel implements ActionListener, KeyListener, Doc
 
                /* Create the editor kit, document, and stylesheet */
                jtpMain = new JTextPane();
-               htmlKit = new ExtendedHTMLEditorKit();
+               htmlKit = new ExtendedHTMLEditorKit(baseurl);
                htmlDoc = (ExtendedHTMLDocument)(htmlKit.createDefaultDocument());
                styleSheet = htmlDoc.getStyleSheet();
                htmlKit.setDefaultCursor(new Cursor(Cursor.TEXT_CURSOR));
@@ -741,7 +741,7 @@ public class EkitCore extends JPanel implements ActionListener, KeyListener, Doc
          */
        public EkitCore(String sDocument, String sStyleSheet, boolean showViewSource, boolean showMenuIcons, boolean editModeExclusive, String sLanguage, String sCountry, boolean base64)
        {
-               this(sDocument, sStyleSheet, null, null, showViewSource, showMenuIcons, editModeExclusive, sLanguage, sCountry, base64, false);
+               this(sDocument, sStyleSheet, null, null, showViewSource, showMenuIcons, editModeExclusive, sLanguage, sCountry, base64, false,"");
        }
 
        /** Default Language Constructor
@@ -753,7 +753,7 @@ public class EkitCore extends JPanel implements ActionListener, KeyListener, Doc
          */
        public EkitCore(String sDocument, String sStyleSheet, boolean showViewSource, boolean showMenuIcons, boolean editModeExclusive, boolean base64)
        {
-               this(sDocument, sStyleSheet, null, null, showViewSource, showMenuIcons, editModeExclusive, null, null, base64, false);
+               this(sDocument, sStyleSheet, null, null, showViewSource, showMenuIcons, editModeExclusive, null, null, base64, false, "");
        }
 
        /** Raw/Base64 Document & Style Sheet URL Constructor (Ideal for EkitApplet)
@@ -765,9 +765,9 @@ public class EkitCore extends JPanel implements ActionListener, KeyListener, Doc
          * @param sLanguage         [String]  The language portion of the Internationalization Locale to run Ekit in.
          * @param sCountry          [String]  The country portion of the Internationalization Locale to run Ekit in.
          */
-       public EkitCore(String sRawDocument, URL urlStyleSheet, boolean showViewSource, boolean showMenuIcons, boolean editModeExclusive, String sLanguage, String sCountry, boolean base64)
+       public EkitCore(String sRawDocument, URL urlStyleSheet, boolean showViewSource, boolean showMenuIcons, boolean editModeExclusive, String sLanguage, String sCountry, boolean base64, String baseurl)
        {
-               this(null, null, sRawDocument, urlStyleSheet, showViewSource, showMenuIcons, editModeExclusive, sLanguage, sCountry, base64, false);
+               this(null, null, sRawDocument, urlStyleSheet, showViewSource, showMenuIcons, editModeExclusive, sLanguage, sCountry, base64, false, baseurl);
        }
 
        /** Document Constructor
@@ -780,7 +780,7 @@ public class EkitCore extends JPanel implements ActionListener, KeyListener, Doc
          */
        public EkitCore(String sRawDocument, boolean showViewSource, boolean showMenuIcons, boolean editModeExclusive, String sLanguage, String sCountry, boolean base64)
        {
-               this(null, null, sRawDocument, null, showViewSource, showMenuIcons, editModeExclusive, sLanguage, sCountry, base64, false);
+               this(null, null, sRawDocument, null, showViewSource, showMenuIcons, editModeExclusive, sLanguage, sCountry, base64, false,"");
        }
 
        /** Default Language & Document Constructor
@@ -791,7 +791,7 @@ public class EkitCore extends JPanel implements ActionListener, KeyListener, Doc
          */
        public EkitCore(String sRawDocument, boolean showViewSource, boolean showMenuIcons, boolean editModeExclusive, boolean base64)
        {
-               this(null, null, sRawDocument, null, showViewSource, showMenuIcons, editModeExclusive, null, null, base64, false);
+               this(null, null, sRawDocument, null, showViewSource, showMenuIcons, editModeExclusive, null, null, base64, false,"");
        }
 
        /** Flags & Language Constructor
@@ -803,7 +803,7 @@ public class EkitCore extends JPanel implements ActionListener, KeyListener, Doc
          */
        public EkitCore(boolean showViewSource, boolean showMenuIcons, boolean editModeExclusive, String sLanguage, String sCountry)
        {
-               this(null, null, null, null, showViewSource, showMenuIcons, editModeExclusive, sLanguage, sCountry, false, false);
+               this(null, null, null, null, showViewSource, showMenuIcons, editModeExclusive, sLanguage, sCountry, false, false,"");
        }
 
        /** Flags Constructor
@@ -813,7 +813,7 @@ public class EkitCore extends JPanel implements ActionListener, KeyListener, Doc
          */
        public EkitCore(boolean showViewSource, boolean showMenuIcons, boolean editModeExclusive)
        {
-               this(null, null, null, null, showViewSource, showMenuIcons, editModeExclusive, null, null, false, false);
+               this(null, null, null, null, showViewSource, showMenuIcons, editModeExclusive, null, null, false, false,"");
        }
 
        /** Language & Debug Constructor
@@ -823,7 +823,7 @@ public class EkitCore extends JPanel implements ActionListener, KeyListener, Doc
          */
        public EkitCore(String sLanguage, String sCountry, boolean debugMode)
        {
-               this(null, null, null, null, false, true, true, sLanguage, sCountry, false, debugMode);
+               this(null, null, null, null, false, true, true, sLanguage, sCountry, false, debugMode,"");
        }
 
        /** Language Constructor
@@ -832,7 +832,7 @@ public class EkitCore extends JPanel implements ActionListener, KeyListener, Doc
          */
        public EkitCore(String sLanguage, String sCountry)
        {
-               this(null, null, null, null, false, true, true, sLanguage, sCountry, false, false);
+               this(null, null, null, null, false, true, true, sLanguage, sCountry, false, false,"");
        }
 
        /** Debug Constructor
@@ -840,14 +840,14 @@ public class EkitCore extends JPanel implements ActionListener, KeyListener, Doc
          */
        public EkitCore(boolean debugMode)
        {
-               this(null, null, null, null, false, true, true, null, null, false, debugMode);
+               this(null, null, null, null, false, true, true, null, null, false, debugMode,"");
        }
 
        /** Empty Constructor
          */
        public EkitCore()
        {
-               this(null, null, null, null, false, true, true, null, null, false, false);
+               this(null, null, null, null, false, true, true, null, null, false, false,"");
        }
 
        /* ActionListener method */
index bb2b14a..07c1122 100644 (file)
@@ -44,17 +44,24 @@ import javax.swing.text.Document;
 
 public class ExtendedHTMLEditorKit extends HTMLEditorKit
 {
+       private String BaseUrl = "";
+       
        /** Constructor
          */
        public ExtendedHTMLEditorKit()
        {
        }
+       
+       public ExtendedHTMLEditorKit(String baseurl)
+       {
+               BaseUrl = baseurl;
+       }
 
        /** Method for returning a ViewFactory which handles the image rendering.
          */
        public ViewFactory getViewFactory()
        {
-               return new HTMLFactoryExtended();
+               return new HTMLFactoryExtended(BaseUrl);
        }
 
 /* WACKY GERMAN CODE */
@@ -76,10 +83,13 @@ public class ExtendedHTMLEditorKit extends HTMLEditorKit
          */
        public static class HTMLFactoryExtended extends HTMLFactory implements ViewFactory
        {
+               private String BaseUrl;
+
                /** Constructor
                  */
-               public HTMLFactoryExtended()
+               public HTMLFactoryExtended(String baseurl)
                {
+                       BaseUrl = baseurl;
                }
 
                /** Method to handle IMG tags and
@@ -93,7 +103,7 @@ public class ExtendedHTMLEditorKit extends HTMLEditorKit
                                HTML.Tag tagType = (HTML.Tag)obj;
                                if(tagType == HTML.Tag.IMG)
                                {
-                                       return new RelativeImageView(elem);
+                                       return new RelativeImageView(elem,BaseUrl);
                                }
                        }
                        return super.create(elem);
index 95adcee..6ef7b6c 100644 (file)
@@ -100,15 +100,17 @@ public class RelativeImageView extends View implements ImageObserver, MouseListe
        private Component    fComponent;\r
        private Point        fGrowBase; // base of drag while growing image\r
        private boolean      fGrowProportionally; // should grow be proportional?\r
+       private String BaseUrl;\r
        private boolean      bLoading; // set to true while the receiver is locked, to indicate the reciever is loading the image. This is used in imageUpdate.\r
 \r
        /** Constructor\r
          * Creates a new view that represents an IMG element.\r
          * @param elem the element to create a view for\r
          */\r
-       public RelativeImageView(Element elem)\r
+       public RelativeImageView(Element elem,String baseurl)\r
        {\r
                super(elem);\r
+               BaseUrl = baseurl;\r
                initialize(elem);\r
                StyleSheet sheet = getStyleSheet();\r
                attr = sheet.getViewAttributes(this);\r
@@ -131,7 +133,7 @@ public class RelativeImageView extends View implements ImageObserver, MouseListe
                        fElement = elem;\r
                        // request image from document's cache\r
                        AttributeSet attr = elem.getAttributes();\r
-                       if(isURL())\r
+                       if(true || isURL())\r
                        {\r
                                URL src = getSourceURL();\r
                                if(src != null)\r
@@ -358,9 +360,10 @@ public class RelativeImageView extends View implements ImageObserver, MouseListe
                {\r
                        return null;\r
                }\r
-               URL reference = ((HTMLDocument)getDocument()).getBase();\r
+               //URL reference = ((HTMLDocument)getDocument()).getBase();\r
                try\r
                {\r
+                       URL reference = new URL(BaseUrl);\r
                        URL u = new URL(reference,src);\r
                        return u;\r
                }\r