001    /*
002     * Copyright (c) 2009 The openGion Project.
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *     http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
013     * either express or implied. See the License for the specific language
014     * governing permissions and limitations under the License.
015     */
016    package org.opengion.hayabusa.io;
017    
018    import org.jfree.chart.imagemap.URLTagFragmentGenerator;
019    
020    /**
021     * Generates URLs using the HTML href attribute for image map area tags.
022     */
023    public class HybsURLTagFragmentGenerator implements URLTagFragmentGenerator {
024            private final String href ;
025    
026            /**
027             * ãƒ?ƒ•ォルトコンストラクター
028             *
029             */
030            public HybsURLTagFragmentGenerator() {
031                    href = " href=\"";
032            }
033    
034            /**
035             * 引数æŒ?®šã?コンストラクター
036             *
037             * 引数ã®ã‚¿ãƒ¼ã‚²ãƒ?ƒˆã«å¿œã˜ã¦ã€href ã« target 属æ?を追åŠ?—ã¦ãŠãã¾ã™ã?
038             * ターゲãƒ?ƒˆãŒã?null ã®å ´åˆã?ã€ãƒ‡ãƒ•ォルトコンストラクターã¨åŒã˜çµæžœã«ãªã‚Šã¾ã™ã?
039             *
040             * @param       target ターゲãƒ?ƒˆ
041             */
042            public HybsURLTagFragmentGenerator( final String target ) {
043                    if( target == null ) {
044                            href = " href=\"";
045                    }
046                    else {
047                            href = " target=\"" + target + "\" href=\"" ;
048                    }
049            }
050    
051            /**
052             * 引数㮠URLãƒ?‚­ã‚¹ãƒˆã‚’使用ã—ã¦ã€href アドレス部を作æ?ã—ã¾ã™ã?
053             *
054             * @param       urlText URLãƒ?‚­ã‚¹ãƒ?
055             *
056             * @return      hrefアドレス
057             */
058            public String generateURLFragment( final String urlText ) {
059                    return href + urlText + "\"";
060            }
061    
062    }