亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? htmltemplatedisplay.java

?? JAVA開源LDAP瀏覽器jxplorer的源碼!
?? JAVA
?? 第 1 頁 / 共 5 頁
字號:
                recreateEditor(current, htmlText);
            }
        }
        else
        {
            recreateEditor(current, htmlText);
        }
        editor.validate();

        // TODO: figure out a way of being able to reuse the viewport without getting exceptions.
        // In Java 1.5 exceptions are thrown more than not when reusing the viewport.
        // Now we will recreated it each time :-S
        try
        {
            viewport.setView(editor);
        }
        catch (ArrayIndexOutOfBoundsException e) // XXX sun stuff sometimes throws an exception, claiming the viewport has no existing child??
        {
            viewport = new JViewport();
            viewport.setView(editor);
            scrollDisplay.setViewport(viewport);
        }
    }

    /**
     * The Swing editor is a fragile beast, and must be frequently executed because deep inside it is as
     * buggy a piece of crap as Sun ever wrote.
     * @param current
     * @param htmlText
     */
    private void recreateEditor(Dimension current, String htmlText)
    {
        editor = getNewEditor();
        if (current == null) // this occasionally happens.  *shrug*
        {
            //System.out.println("CURRENT IS NULL???");
            current = new Dimension (400,400);
        }
        editor.setSize(current);
        editor.setText(htmlText);
    }


    /**
     *	As advised in the doco, it is apparently better to re-create an
     *  editor pane every time, rather than reuse the old one.  Phenomenal.
     *
     *  Sept '04 - this method causes a memory leak, so calling repeatedly
     * is not advised.  The doco actually advises recreating the document
     * object, however for our purposes we can probably accept the performance
     * hit of tearing down the old document and rebuilding it.  Seems to fix
     * the memory leak anyway :-).
     */

    protected JEditorPane getNewEditor()
    {
        // this fixes the memory leak, but removes the point of the method -
        // better not to call it at all.
        //if (editor != null) { return editor; }

        //System.out.println("Getting new editor");

        JEditorPane newEditor = new JEditorPane();

        newEditor.setEditorKitForContentType("text/html", htmlEditorKit);
        newEditor.addHyperlinkListener(hyperlinkListener);
        newEditor.setEditable(false);
        newEditor.setMinimumSize(new Dimension(400, 400));
        newEditor.setContentType("text/html");

        return newEditor;

    }

    /**
     * <p>This code is run by both constructors.  It sets up the GUI and the template lists, and other
     * housekeeping tasks.</p>
     * @param owner
     * @param props
     * @param resourceLoader
     */
    private void commonConstructorCode(Component owner, Properties props, CBResourceLoader resourceLoader)
    {
        initMyProperties(props);

        this.resourceLoader = resourceLoader;

        setupTemplateLists();

/*
        baseURL = JXplorer.getFileURL(myProperties.getProperty("dir.templates"));
        try
        {
            base = new URL(baseURL);
        }
        catch (MalformedURLException e)
        {
            log.warning(" unable to parse file url: " + baseURL + "\n ( error was: " + e + " )");
        }

        localURL = myProperties.getProperty("dir.local"); 							//TE: gets the path of the users local dir.
*/
        initGUI(owner);

        setStartPage();



    }

    /**
     * <p>This searches the template directories at start up, and builds up a list
     * of available templates, keyed by lowercase object class.</p>
     */
    private void setupTemplateLists()
    {
        try
        {
            // unpack any plugin templates (sets 'pluginTemplateDirectory')
            initZipTemplates();

            // Find the root of the /template directory tree
            baseTemplateDir = getBaseTemplateDirectory();
            String baseTemplate = baseTemplateDir.getCanonicalPath();

            // get the list of default html templates that can be used for all object classes
            String[] defaultTemplates = CBUtility.readFilteredDirectory(baseTemplate, new String[]{"html", "htm"});

            addToGlobalTemplateList(defaultTemplates, DEFAULT);

            // do the same for the plugin templates (if any)
            if (pluginTemplateDirectory != null)
            {

                defaultTemplates = CBUtility.readFilteredDirectory(pluginTemplateDirectory.getCanonicalPath(), new String[]{"html", "htm"});
                addToGlobalTemplateList(defaultTemplates, "");
            }

            if (defaultTemplates == null || defaultTemplates.length == 0)
                log.warning("Warning - can't find any default html templates in " + baseTemplate);

            // get the list of object class directories (e.g. /person, /organizationalUnit etc.)
            String[] objectClassFolders = getAllTemplateSubDirectories(baseTemplateDir);
            addIndividualObjectClassTemplates(objectClassFolders, baseTemplate);

            // do the same for the plugin templates (if any)
            if (pluginTemplateDirectory != null)
            {
                objectClassFolders = getAllTemplateSubDirectories(pluginTemplateDirectory);
                addIndividualObjectClassTemplates(objectClassFolders, pluginTemplateDirectory.toString());
            }

            //printTemplates();
        }
        catch (FileNotFoundException e)
        {
            log.warning("Error initialising HTML Template: " + e.toString());
        }
        catch (IOException e2)
        {
            log.warning("Error initialising HTML Template file paths: " + e2.toString());
        }
    }
/*
    private void printTemplates()
    {
            System.out.println("***PRINTING TEMPLATES VARIABLE***");
            Enumeration bloop = templates.keys();
            while (bloop.hasMoreElements())
            {
                String key = (String)bloop.nextElement();
                System.out.println("hashtable: " + key);
                File[] files = (File[]) templates.get(key);
                if (files == null)
                    System.out.println("  NULL !");
                else
                    for (int i=0; i<files.length; i++)
                        System.out.println("  -> " + files[i].toString());
            }
    }
*/
    private void addIndividualObjectClassTemplates(String[] objectClassFolders, String baseTemplate)
    {
        // search the discovered object class directories, adding their html templates to the global hash.
        for (int i = 0; i < objectClassFolders.length; i++)
        {
            String folderName = baseTemplate + File.separator + objectClassFolders[i];
            String objectClass = objectClassFolders[i];
            String[] ocTemplates = CBUtility.readFilteredDirectory(folderName, new String[]{"html", "htm"});
            addToGlobalTemplateList(ocTemplates, objectClass);
        }
    }

    /**
     * <p>Adds a directory of html files (with paths relative to baseTemplateDir) to the global hash, keyed by lower case object class.</p>
     * @param fileNames the individual file names
     * @param folderName the name of the folder, in mixed case, which is also the object class to key by.
     */
    private void addToGlobalTemplateList(String[] fileNames, String folderName)
    {
        if (fileNames == null)  // there may not be any templates at all...
            return;

        String objectClass = folderName.toLowerCase();

        File[] fileList = new File[fileNames.length];
        for (int i = 0; i < fileNames.length; i++)
        {
            if (DEFAULT.equals(folderName))
                fileList[i] = new File(fileNames[i]);
            else
                fileList[i] = new File(folderName, fileNames[i]);
        }

        // add the array of files to the hashtable, keyed by lowercase object class.
        templates.put(objectClass, fileList);
    }

    /**
     * <p>CONSTRUCTOR METHOD: returns all sub directories under the template directory</p>
     * <p>These correspond to the various object classes.</p>
     * @param baseTemplateDir
     * @return
     */
    private String[] getAllTemplateSubDirectories(File baseTemplateDir)
    {
        String[] childDirectories = baseTemplateDir.list(new FilenameFilter()
        {
            public boolean accept(File dir, String name)
            {
                File candidate = new File(dir, name);
                return candidate.isDirectory();
            }
        });

        return childDirectories;
    }

    /**
     * <p>CONSTRUCTOR METHOD: This finds the root of the /templates directory tree, where the
     * html file templates are stored.  (It is also where any templates
     * in .zip resource files are kept.)</p>
     * @return the file location of /templates (usually [jxplorer home]/templates )
     * @throws FileNotFoundException
     */
    private File getBaseTemplateDirectory()
            throws FileNotFoundException
    {
        File baseTemplateDir = new File(myProperties.getProperty("dir.templates"));
        if (!baseTemplateDir.exists())
        {
            log.warning("can't find html template directory " + baseTemplateDir + " - trying to find /templates directory");
            baseTemplateDir = new File(JXplorer.localDir + "templates" + File.separator);
            if (!baseTemplateDir.exists())
            {
                throw new FileNotFoundException("ERROR - Cannot find backup /template directory in " + baseTemplateDir);
            }
        }
        return baseTemplateDir;
    }

    /**
     *	<p>Gets any resourses from a zip/jar file depending on the object class of the entry.
     *	For example, if the oc is person, this checks the zip/jar file for resources in
     *	templates/oc/.  It then extracts these files and puts them in a temporary dir of the
     *	same path within the plugins dir.  For example, jxplorer/plugins/templates/oc/Main.html .
     *
     * <p>This is Trudi code, that has been kidnapped by Chris and mungified...
     * It now unpacks permanently, and only does the writing if needed (checks the
     * date stamps).</p>
     */
    private void initZipTemplates()
    {
        String[] zipTemplates = null;		//TE: stores the names of any resourses found in the zip/jar file.

        File pluginDirectory = new File(JXplorer.getProperty("dir.plugins"));
        if (!pluginDirectory.exists())
            pluginDirectory.mkdirs();

        //zipTemplates = resourceLoader.getPrefixedResources("templates/"+className+"/");//+File.separator);// doesn't wk w file.sep??????

        // read all plugin files with the prefix 'templates/'

        zipTemplates = resourceLoader.getPrefixedResources("templates/");

        if (zipTemplates.length == 0)
            return; // nothing to do!

        pluginTemplateDirectory = new File(pluginDirectory, "templates/");

        // unpack them to the plugins directory.

        int prefixSize = "templates/".length();

        for (int i = 0; i < zipTemplates.length; i++)
        {
            // get the template name as a string and as a (potential) file.
            String templateName = zipTemplates[i];

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品一区二区免费不卡| 蜜臀久久99精品久久久久宅男 | 亚洲图片激情小说| 亚洲乱码精品一二三四区日韩在线| 视频一区二区欧美| 国产在线播放一区三区四| 99视频精品在线| 欧美一级黄色录像| 国产欧美日产一区| 蜜臀久久久久久久| 在线一区二区视频| 久久综合五月天婷婷伊人| 亚洲欧美一区二区三区极速播放 | 亚洲综合色噜噜狠狠| 国产不卡视频在线播放| 欧美日韩国产成人在线免费| 日本一区二区三区四区| 国产综合久久久久久鬼色| 欧美亚洲丝袜传媒另类| 26uuu另类欧美| 精品伊人久久久久7777人| 91视频国产观看| 久久亚洲二区三区| 奇米影视一区二区三区| 欧美三区在线观看| 国产精品欧美经典| 不卡的av网站| 国产色产综合产在线视频| 免费视频一区二区| 欧美电视剧在线看免费| 亚洲大片在线观看| 色婷婷久久久综合中文字幕| 一区二区三区四区五区视频在线观看| 国产制服丝袜一区| 欧美一区二区三区色| 日韩精品91亚洲二区在线观看| 91视视频在线观看入口直接观看www | 日本不卡一二三| 欧美丝袜丝nylons| 自拍偷拍国产精品| 99精品在线免费| 国产精品国产精品国产专区不片| 国产真实乱对白精彩久久| 日韩视频免费观看高清完整版 | 欧美视频在线一区| 伊人色综合久久天天| 本田岬高潮一区二区三区| 中文在线资源观看网站视频免费不卡 | 亚洲欧美福利一区二区| 成人黄色电影在线| 中文字幕第一页久久| 韩国毛片一区二区三区| 久久综合色婷婷| 激情文学综合插| www国产成人| 99re这里只有精品视频首页| 最新中文字幕一区二区三区| 99久久国产综合色|国产精品| 亚洲影视资源网| 欧美日韩亚洲高清一区二区| 亚洲成人动漫av| 欧美v日韩v国产v| 国产麻豆欧美日韩一区| 欧美高清在线一区二区| 欧美日韩亚洲国产综合| 日韩av中文字幕一区二区三区| 欧美精品久久天天躁| 亚洲在线中文字幕| 26uuu国产在线精品一区二区| 极品少妇一区二区三区精品视频| 亚洲精品在线电影| 色综合色综合色综合| 日韩电影在线观看一区| 欧美刺激午夜性久久久久久久 | 最新不卡av在线| 在线看日韩精品电影| 一区二区三区在线播放| 精品久久久久一区| 成人黄色小视频在线观看| 亚洲欧美日韩国产中文在线| 日韩一级完整毛片| 99久免费精品视频在线观看| 亚洲一区在线观看免费| 久久免费看少妇高潮| 91麻豆免费看| 精品午夜久久福利影院| 久久影院视频免费| 欧美日韩国产中文| 国产aⅴ精品一区二区三区色成熟| 亚洲精品第一国产综合野| 久久九九全国免费| 欧美精品自拍偷拍| 成人av免费在线观看| 亚洲影院久久精品| 亚洲视频网在线直播| 日韩欧美中文一区| 日本精品一区二区三区高清| 大尺度一区二区| 日韩国产高清在线| 亚洲精品国产精华液| 国产精品美女久久久久久2018| 7777女厕盗摄久久久| 丰满少妇在线播放bd日韩电影| 欧美精品成人一区二区三区四区| av资源站一区| 国产成人午夜视频| 日本不卡一区二区| 日本在线不卡视频| 亚洲精品美国一| 日本一区免费视频| 日韩一级免费一区| 欧美性大战xxxxx久久久| av不卡免费电影| caoporm超碰国产精品| 久久99国产精品尤物| 日韩精品一二三| 日韩av高清在线观看| 亚洲欧美日韩精品久久久久| 欧美高清在线一区二区| 国产精品久久久久久久久晋中 | 日韩欧美高清dvd碟片| 欧美午夜精品一区| 91福利小视频| 欧美二区在线观看| 7777精品伊人久久久大香线蕉超级流畅 | 国产午夜精品理论片a级大结局| 99视频精品在线| 视频一区在线视频| 久久久久99精品国产片| 欧美揉bbbbb揉bbbbb| 亚洲一卡二卡三卡四卡| 精品久久国产老人久久综合| 99国产麻豆精品| 国产丶欧美丶日本不卡视频| 久久久久国产精品麻豆ai换脸| 日韩你懂的在线观看| 麻豆精品新av中文字幕| 日韩国产欧美在线播放| 国产精品国产三级国产| 亚洲一区二区三区爽爽爽爽爽 | 精品一二三四区| 国产二区国产一区在线观看| 国产精品1区2区3区在线观看| 国产麻豆91精品| www.亚洲人| 欧美精品vⅰdeose4hd| 久久九九久久九九| 亚洲综合另类小说| 精品中文字幕一区二区| av影院午夜一区| 欧美精品 国产精品| 久久日一线二线三线suv| 亚洲精选视频在线| 久久99久久久欧美国产| 99re66热这里只有精品3直播| 91精品免费观看| 中文字幕一区二区三区av| 日韩av午夜在线观看| 成人午夜在线播放| 91精品国产乱码| 综合亚洲深深色噜噜狠狠网站| 麻豆成人久久精品二区三区小说| 91丨九色丨黑人外教| 精品国产伦一区二区三区免费| 亚洲三级免费电影| 国产福利91精品| 日韩你懂的电影在线观看| 一区二区三区四区激情| 激情文学综合插| 91精品国产美女浴室洗澡无遮挡| 中文字幕在线观看不卡| 韩国v欧美v亚洲v日本v| 在线电影一区二区三区| 亚洲视频一二区| 成人精品在线视频观看| 26uuu欧美| 精品一区精品二区高清| 欧美高清精品3d| 亚洲国产成人tv| 91免费国产在线| 中文字幕精品在线不卡| 欧美自拍偷拍一区| 亚洲啪啪综合av一区二区三区| 欧美电影在哪看比较好| 日韩av网站免费在线| 欧美一级欧美三级在线观看| 日本aⅴ免费视频一区二区三区| 成人的网站免费观看| 久久 天天综合| 91精品福利在线一区二区三区| 国产亚洲综合色| 另类中文字幕网| 色综合中文字幕| 色呦呦日韩精品| 国产精品一区二区久激情瑜伽| 亚洲综合免费观看高清完整版| 欧美国产日韩一二三区| 久久综合久久综合九色| 亚洲日本韩国一区| 麻豆精品国产91久久久久久|