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.html;
017    
018    import org.opengion.hayabusa.common.HybsSystem;
019    import org.opengion.hayabusa.common.HybsSystemException;
020    import org.opengion.hayabusa.db.DBTableModel;
021    import org.opengion.fukurou.util.StringUtil;
022    import org.opengion.fukurou.model.Formatter;
023    
024    import java.util.regex.Pattern;
025    import java.util.regex.Matcher;
026    
027    /**
028     * [PN],[OYA] ãªã©ã® [] ã§æŒ?®šã•れãŸã‚«ãƒ©ãƒ?§è¡¨ã•れãŸãƒ•ォーマットデータã«å¯¾ã—ã¦ã€?
029     * DBTableModelオブジェクトをé©ç”¨ã—㦠å?‚«ãƒ©ãƒ?«å®Ÿãƒ‡ãƒ¼ã‚¿ã‚’割り当ã¦ã‚‹ã‚ªãƒ–ジェクトã§ã™ã?
030     *
031     * 特ã«ã€[XXXX]ã«å¯¾ã—ã¦ã€[#XXXX]ã€[$XXXX]ã€[$XXXX]ãªã©ã®ç‰¹æ®Šè¨˜å·ãŒä½¿ç”¨ã§ãã¾ã™ã?
032     * 特殊記å·ã®è§£é‡ˆã?ã€HTMLFormatTextFieldç³»ã¨HTMLFormatTableç³»ã§ç•°ãªã‚Šã¾ã™ã?ã§
033     * ã”æ³¨æ„ãã?•ã??
034     *
035     * @og.rev 3.5.4.0 (2003/11/25) æ–°è¦è¿½åŠ?
036     * @og.group ç”»é¢è¡¨ç¤º
037     *
038     * @version  4.0
039     * @author   Kazuhiko Hasegawa
040     * @since    JDK5.0,
041     */
042    public class TableFormatter {
043    
044            /** フォーマットタイプã?æŒ?®šã?特殊ãªãƒžã?ク {@value} */
045            public static final String HYBS_ITD_MARKER = "h_itd_marker";
046            private static final Pattern ptnKey = Pattern.compile( "[ \t]+</td" ); // 4.3.2.0 (2008/09/10)
047    
048            private FormatterType   formatType      = null;
049            private int[]                   location        = null;
050            private String[]                format          = null;
051            private String                  formatTag       = null;
052            private String                  rowspan         = " rowspan=\"2\"";
053            private String                  trTag           = null;
054            private boolean                 noClass         = false;
055            // 3.5.6.0 (2004/06/18) '!' 値ã®ã¿ 追åŠ?既存ã? '$' ã¯ã€ãƒ¬ãƒ³ãƒ?ƒ©ãƒ¼
056            private char[]                  type            = null;         // '#':ラベルã®ã¿  '$':レンãƒ?ƒ©ãƒ¼ '!':値ã®ã¿  ãã?ä»?通常
057            private String                  usableKey       = null;         // キーæƒ??ã®ã‚«ãƒ©ãƒ?–‡å­—å?
058            private int                             usableKeyNo     = -1;           // キーæƒ??ã®ã‚«ãƒ©ãƒ?•ªå·
059            private String                  usableList      = "1" ;
060    
061            private String                  keyBreakClm     = null;         // 5.7.6.3 (2014/05/23) キーブレイクをãƒã‚§ãƒ?‚¯ã™ã‚‹ã‚«ãƒ©ãƒ?D
062            private int                             breakClmNo      = -1;           // 5.7.6.3 (2014/05/23) キーブレイクカラãƒ?•ªå·
063            private String                  breakVal        = null;         // 5.7.6.3 (2014/05/23) キーブレイクをãƒã‚§ãƒ?‚¯ã™ã‚‹å€¤
064    
065            private String                  itdBody         = "";           // 3.5.6.0 (2004/06/18) 追�
066            private Formatter               formatter       = null;
067    
068            /**
069             * フォーマットをセãƒ?ƒˆã—ã¾ã™ã?
070             * フォーマットã«ã€?lt;table&gt;ã‚’å«ã‚??åˆã?TextField扱ã?ªã®ã§ã€ãƒ•ォーマットå?割
071             * ã—ã¾ã›ã‚“。table ã‚’å«ã¾ãšã?tr ã‚’å«ã‚??åˆã?ã€?¼‘行å?ã®ãƒ??ã‚¿ã¨ã—ã¦æ‰±ã?‚ºã€?
072             * trTag を求ã‚ã¾ã™ã?
073             * trTag 㨠format ã¨ã®é–“ã«ã€è¡Œã?ãƒ?ƒ€ãƒ¼ãŒå?りã¾ã™ã?
074             * Tomcat6ã§ã¯ã€JSPã®ãƒ‘ã?ス時ã«ã€tabã‚„spaceã¯ãã?ã¾ã¾ãƒ‘ã?スã•れるãŸã‚ã?&lt;/td&gt;å‰?
075             * ã®ã‚¹ãƒšã?ス削除処ç?‚‚行ã„ã¾ã™ã?
076             *
077             * @og.rev 4.3.2.0 (2008/09/10) &lt;/td&gt;å‰ã?スペã?スをå–り消ã—ã¾ã™ã?
078             * @og.rev 5.5.0.3 (2012/03/13) &lt;tr&gt;ã‚’å–らãªã?ƒ•ラグ追åŠ?
079             *
080             * @param       fmt  [カラãƒ?] å½¢å¼ã?フォーマットデータ
081             * @param   flg  falseã«ã™ã‚‹ã¨å…ˆé?ã®trã‚¿ã‚°ã‚’å–ã‚‹å?ç?‚’行ã„ã¾ã›ã‚“(5.5.0.3)
082             */
083            public void setFormat( final String fmt , final boolean flg ) {
084                    int tbl = fmt.indexOf( "<table" );
085                    int str = fmt.indexOf( "<tr" );
086    
087                    // tr ã‚’å«ã¿ã€ã‹ã¤ã€tableã‚’å«ã¾ãªã?‹ã€å«ã‚“ã§ã‚?tr ã®å¾Œã‚ã«tableãŒã‚ã‚‹å?åˆã?
088                    if( str >= 0 && ( tbl < 0 || str < tbl ) && flg ) { // 5.5.0.3(2012/03/13)
089                            int end = fmt.indexOf( '>',str );
090                            formatTag = fmt.substring(end+1);
091                            trTag = fmt.substring(0,end+1) ;
092                    }
093                    else {
094                            formatTag = fmt;
095                            trTag     = null;
096                    }
097                    // 4.3.2.0 (2008/09/10) </td>å‰ã?スペã?スをå–り消ã™ã€?
098                    Matcher matcher = ptnKey.matcher( formatTag );
099                    formatTag = matcher.replaceAll( "</td" );
100    
101            }
102    
103            /**
104             * フォーマットをセãƒ?ƒˆã—ã¾ã™ã?
105             * フォーマットã«ã€?lt;table&gt;ã‚’å«ã‚??åˆã?TextField扱ã?ªã®ã§ã€ãƒ•ォーマットå?割
106             * ã—ã¾ã›ã‚“。table ã‚’å«ã¾ãšã?tr ã‚’å«ã‚??åˆã?ã€?¼‘行å?ã®ãƒ??ã‚¿ã¨ã—ã¦æ‰±ã?‚ºã€?
107             * trTag を求ã‚ã¾ã™ã?
108             * trTag 㨠format ã¨ã®é–“ã«ã€è¡Œã?ãƒ?ƒ€ãƒ¼ãŒå?りã¾ã™ã?
109             * Tomcat6ã§ã¯ã€JSPã®ãƒ‘ã?ス時ã«ã€tabã‚„spaceã¯ãã?ã¾ã¾ãƒ‘ã?スã•れるãŸã‚ã?&lt;/td&gt;å‰?
110             * ã®ã‚¹ãƒšã?ス削除処ç?‚‚行ã„ã¾ã™ã?
111             *
112             * @og.rev 5.5.0.3 (2012/03/13) 引数追åŠ?«ã¤ãã?
113             *
114             * @param       fmt  [カラãƒ?] å½¢å¼ã?フォーマットデータ
115             */
116            public void setFormat( final String fmt  ) {
117                    setFormat( fmt , true );
118            }
119    
120            /**
121             * フォーマットをå–å¾—ã—ã¾ã™ã?
122             *
123             * @og.rev 3.5.5.8 (2004/05/20) æ–°è¦è¿½åŠ?
124             * @og.rev 5.1.7.0 (2010/06/01) サニタイズ戻ã—å?ç?"\\]\\"ã‹ã‚‰"["ã«æˆ»ã?を追åŠ?
125             *
126             * @return      フォーマットデータ
127             */
128            public String getFormat() {
129                    if( trTag != null ) {
130                            return decodeSanitizedStr( trTag + formatTag );
131                    }
132                    else {
133                            return decodeSanitizedStr( formatTag );
134                    }
135            }
136    
137            /**
138             * DBTableModelを利用ã—ã¦ã€ãƒ•ォーマットデータをå?期化ã—ã¾ã™ã?
139             *
140             * @og.rev 3.5.5.0 (2004/03/12) [KEY.カラãƒ?] 機è?追åŠ?
141             * @og.rev 3.5.5.2 (2004/04/02) [I] ã§ã€è¡Œç•ªå·ã‚’作æ?ã—ã¾ã™ã?
142             * @og.rev 3.5.6.0 (2004/06/18) '!' 値ã®ã¿ 追åŠ?既存ã? '$' ã¯ã€ãƒ¬ãƒ³ãƒ?ƒ©ãƒ¼
143             * @og.rev 3.6.0.0 (2004/09/17) [ROW.ID] ã§ã€è¡Œæ¯Žã?ãƒã‚§ãƒ?‚¯ãƒœãƒƒã‚¯ã‚¹ã®IDã‚’è¿”ã—ã¾ã™ã?
144             * @og.rev 5.1.7.0 (2010/06/01) サニタイズ戻ã—å?ç?"\\]\\"ã‹ã‚‰"["ã«æˆ»ã?を追åŠ?
145             * @og.rev 5.7.6.3 (2014/05/23) キーブレイクをãƒã‚§ãƒ?‚¯ã™ã‚‹ keyBreakClm 属æ?追åŠ?
146             *
147             * @param       table   DBTableModelオブジェク�
148             */
149            public void makeFormat( final DBTableModel table ) {
150                    formatter = new Formatter( table );
151                    formatter.setFormat( formatTag );
152                    location = formatter.getClmNos();
153                    format   = formatter.getFormat();
154    
155                    // 5.1.7.0 (2010/06/01) サニタイズ戻ã—å?ç?"\\]\\"ã‹ã‚‰"["ã«æˆ»ã?を追åŠ?
156                    if( format != null ) {
157                            for( int i=0; i<format.length; i++ ) {
158                                    format[i] = decodeSanitizedStr( format[i] );
159                            }
160                    }
161    
162                    type     = formatter.getType();
163    
164                    // ã“ã?フォーマットを使用ã™ã‚‹ã‹ã©ã?‹ã‚’指定ã™ã‚‹åˆ¤å®šæ¡ä»¶ã®åˆæœŸè¨­å®šã§ã™ã?
165                    if( usableKey != null ) {
166                            usableKeyNo = table.getColumnNo( usableKey );
167                    }
168    
169                    // 5.7.6.3 (2014/05/23) キーブレイクをãƒã‚§ãƒ?‚¯ã™ã‚‹ keyBreakClm 属æ?追åŠ?
170                    if( keyBreakClm != null ) {
171                            breakClmNo = table.getColumnNo( keyBreakClm );
172                            breakVal   = null;              // åˆæœŸåŒ–ã—ã¾ã™ã?
173                    }
174            }
175    
176            /**
177             * ãƒ??ブルフォーマットã?タイプをæŒ?®šã—ã¾ã™ã?
178             * enum FormatterType ã§ã€æŒ‡å®šã—ã¾ã™ã?
179             *
180             * @og.rev 4.0.0.0 (2007/05/02) enum 定義ã«å¤‰æ›´
181             *
182             * @param  ftype フォーマットã?タイãƒ?
183             */
184            public void setFormatType( final FormatterType ftype ) {
185                    formatType = ftype;
186            }
187    
188            /**
189             * ã“ã?フォーマットã?タイプを返ã—ã¾ã™ã?
190             *
191             * ã“ã?フォーマットã?タイプを返ã—ã¾ã™ã?
192             *
193             * @og.rev 4.0.0.0 (2007/05/02) enum 定義ã«å¤‰æ›´
194             *
195             * @return      ã“ã?フォーマットã?タイプを返ã—ã¾ã™ã?
196             */
197            public FormatterType getFormatType() {
198                    return formatType;
199            }
200    
201            /**
202             * ãƒ??ブル㮠rowspan 属æ?ã‚’ã‚»ãƒ?ƒˆã—ã¾ã™ã?
203             * rowspan ã¯ã€ã?ãƒ?ƒ€ãƒ¼éƒ¨ã®ãƒ•ォーマットã?行数ã§ã™ã?åˆæœŸå€¤ã¯ ?’è¡?ã§ã™ã?
204             * 設定ã?ã€?2" ãªã©ã®ã€æ•°å­—部ã®ã¿ã‚’ã‚»ãƒ?ƒˆã—ã¾ã™ã?
205             *
206             * @param  rowspan 属æ?
207             */
208            public void setRowspan( final String rowspan ) {
209                    if( rowspan == null || rowspan.length() == 0 || rowspan.equals( "1" ) ) {
210                            this.rowspan = "";
211                    }
212                    else {
213                            this.rowspan = " rowspan=\"" + rowspan + "\"";
214                    }
215            }
216    
217            /**
218             * 設定ã•れ㟠rowspan ã‚’è¿”ã—ã¾ã™ã?
219             * ã“れã¯ã€ãƒ•ォーマットã?段çµ??æ•°ã‚’å–りå?ã—ã¾ã™ã?
220             * æ–?­—å?ã¨ã—ã¦ã¯ã€rowspan="2" ã¨ã?†å½¢ã§å–り出ã—ã¾ã™ã?
221             *
222             * @return フォーマット文字å?
223             */
224            public String getRowspan() {
225                    return rowspan;
226            }
227    
228            /**
229             * ロケーション番å·ã®ã‚µã‚¤ã‚ºã‚’è¿”ã—ã¾ã™ã?
230             * フォーãƒ?½ç½®ç•ªå·ã¯ã€? ã‹ã‚‰ getLocationSize()-1 ã¾ã§ã®æ•°å­—ã‚’æŒ?®šã—ã¾ã™ã?
231             * ロケーションサイズã¯ã€aaa[ABC]bbb[DEF]ccc[GHI]ddd ã¨ãªã£ã¦ã?‚‹å ´åˆã?
232             * aaa , bbb , ccc , ddd ã¯ã€ãƒ•ォーマットã§ã€ã‚µã‚¤ã‚ºã¯?”ã?
233             * ABC , DEF , GHI ã«å¯¾å¿œã™ã‚‹ã‚«ãƒ©ãƒ?•ªå·ãŒãƒ­ã‚±ãƒ¼ã‚·ãƒ§ãƒ³ã§ã€ã‚µã‚¤ã‚ºã¯?“ã?
234             * ã“ã?メソãƒ?ƒ‰ã§è¿”ã™ã®ã¯ã€ãƒ­ã‚±ãƒ¼ã‚·ãƒ§ãƒ³ç•ªå·(??ã®æ–¹ã§ã™ã?
235             *
236             * @return  ロケーション番å·ã®ã‚µã‚¤ã‚º
237             */
238            public int getLocationSize() {
239                    return location.length;
240            }
241    
242            /**
243             * カラãƒ??ロケーション番å·ã‚’è¿”ã—ã¾ã™ã?
244             * 引数ã¯ã€? ã‹ã‚‰ã€getLocationSize()-1 ã¾ã§ã®æ•°ã§æŒ?®šã—ã¾ã™ã?
245             * æŒ?®šã?ä½ç½®ã®ã€ãƒ•ォーマットã?カラãƒ?ã«å¯¾å¿œã™ã‚‹ãƒ­ã‚±ãƒ¼ã‚·ãƒ§ãƒ³ç•ªå·
246             * ã‚’è¿”ã—ã¾ã™ã?
247             *
248             * @param no フォーãƒ?½ç½®ç•ªå·
249             *
250             * @return ロケーション番å·
251             */
252            public int getLocation( final int no ) {
253                    return location[no];
254            }
255    
256            /**
257             * フォーマット文字å?ã‚’è¿”ã—ã¾ã™ã?
258             * 引数ã¯ã€? ã‹ã‚‰ã€getLocationSize() ã¾ã§ã®æ•°ã§æŒ?®šã—ã¾ã™ã?
259             * æŒ?®šã?フォーマットãŒã€aaa[ABC]bbb[DEF]ccc[GHI]ddd ã¨ãªã£ã¦ã?‚‹å ´åˆã?
260             * aaa , bbb , ccc , ddd を引数 0 , 1 , 2 , 3 ã§è¿”ã—ã¾ã™ã?
261             *
262             * @param no フォーãƒ?½ç½®ç•ªå·
263             *
264             * @return フォーマット文字å?
265             */
266            public String getFormat( final int no ) {
267                    return format[no];
268            }
269    
270            /**
271             * シスãƒ?ƒ ãƒ•ォーマット文字å?ã‚’è¿”ã—ã¾ã™ã?
272             * シスãƒ?ƒ ãƒ•ォーマット文字å?ã¯ã€[KEY.カラãƒ?] ãªã©ã®ç‰¹æ®Šè¨˜å·ã§æŒ?®šã•れãŸ
273             * カラãƒ?ã®äº‹ã§ã€location ã«ã¯ã€ã?イナスã®å€¤ãŒè¨­å®šã•れã¾ã™ã?
274             * マイナスã®å€¤ã«å¿œã˜ã¦ã€å?ç?‚’変ãˆã‚‹ã“ã¨ãŒå?æ¥ã¾ã™ã?
275             *
276             * [KEY.カラãƒ?] : 行番å·ä»˜ãカラãƒ?
277             * [I]            : 行番å·
278             * [ROW.ID]       : 行毎ã?ãƒã‚§ãƒ?‚¯ãƒœãƒƒã‚¯ã‚¹ã®ID
279             * [ROW.JSON]     : 行毎ã?å…¨ãƒ??ã‚¿ã®JavaScriptオブジェクト形å¼?
280             *
281             * @og.rev 3.5.5.0 (2004/03/12) [KEY.カラãƒ?] 機è?追åŠ?
282             * @og.rev 3.5.5.2 (2004/04/02) [I] ã§ã€è¡Œç•ªå·ã‚’作æ?ã—ã¾ã™ã?
283             * @og.rev 3.6.0.0 (2004/09/17) [ROW.ID] ã§ã€è¡Œæ¯Žã?ãƒã‚§ãƒ?‚¯ãƒœãƒƒã‚¯ã‚¹ã®IDã‚’è¿”ã—ã¾ã™ã?
284             * @og.rev 4.0.0.0 (2007/05/02) Formatter を使用ã™ã‚‹ã‚ˆã†ã«å¤‰æ›´
285             *
286             * @param       row     行番å·
287             * @param       loc     ä½ç½®ç•ªå·
288             *
289             * @return フォーマット文字å?
290             */
291            public String getSystemFormat( final int row,final int loc ) {
292                    if( loc == Formatter.SYS_ROWNUM ) {
293                            return String.valueOf( row );
294                    }
295                    else if( loc == Formatter.SYS_JSON ) {
296                            return formatter.getJson( row );
297                    }
298    
299                    String errMsg = "シスãƒ?ƒ ãƒ•ォーマットã?ã€ä¸‹è¨˜ã?å½¢å¼ã—ã‹ä½¿ç”¨ã§ãã¾ã›ã‚“ã€?" + loc + "]" + HybsSystem.CR
300                                    + "  : [KEY.カラãƒ?] : 行番å·ä»˜ãカラãƒ?" + HybsSystem.CR
301                                    + "  : [I]            : 行番å·" + HybsSystem.CR
302                                    + "  : [ROW.ID]       : 行毎ã?ãƒã‚§ãƒ?‚¯ãƒœãƒƒã‚¯ã‚¹ã®ID" + HybsSystem.CR
303                                    + "  : [ROW.JSON]     : 行毎ã?å…¨ãƒ??ã‚¿ã®JavaScriptオブジェクト形å¼? ;
304                    throw new HybsSystemException( errMsg );
305            }
306    
307            /**
308             * タイプ文字å?ã‚’è¿”ã—ã¾ã™ã?
309             * タイプã¨ã¯ã€[XXX] ã®è¨˜è¿°ã§ã€[#XXX] ã¯ã€XXXカラãƒ??ラベルをã?[$XXX]ã¯ã€XXXカラãƒ??
310             * レンãƒ?ƒ©ãƒ¼ã‚’ã?[!XXX} ã¯ã€å?ã®ã¿å–ã‚Šå‡ºã™æŒ‡å®šã‚’行ã„ã¾ã™ã?
311             * 主ã«ã€TextFieldç³»ã®ãƒ•ォーマットã¨Tableç³»ã§ã¯ã€æ„味åˆã„ãŒç•°ãªã‚Šã¾ã™ã?ã§ã€?
312             * ã”æ³¨æ„ãã?•ã??
313             *
314             * @param no フォーãƒ?½ç½®ç•ªå·
315             *
316             * @return タイプ文字å? '#':ラベルã®ã¿  '$':レンãƒ?ƒ©ãƒ¼ '!':値ã®ã¿  ãã?ä»?通常
317             */
318            public char getType( final int no ) {
319                    return type[no];
320            }
321    
322            /**
323             * 設定ã•れ㟠フォーマットã? trã‚¿ã‚°ã‚’è¿”ã—ã¾ã™ã?
324             * ã“れã¯ã€trã‚¿ã‚°ã«class属æ?ä»–ã?設定ãŒã•れã¦ã?Ÿå ´åˆã«ã€å¤‰æ›å¾Œã?
325             * æ–?­—å?ã«ã‚‚åæ˜?•ã›ã‚‹ç‚ºã«å¿?¦ã§ã™ã?
326             *
327             * @og.rev 5.1.7.0 (2010/06/01) サニタイズ戻ã—å?ç?"\\]\\"ã‹ã‚‰"["ã«æˆ»ã?を追åŠ?
328             *
329             * @return フォーマットã? trã‚¿ã‚°
330             */
331            public String getTrTag() {
332                    if( trTag == null ) { return ""; }
333    
334                    return decodeSanitizedStr( trTag ) ;
335            }
336    
337            /**
338             * カラãƒ??クラスå?X,S9 ãªã©)ã®ã‚»ãƒ?ƒˆã‚’行ã†ã‹ã©ã?‹æŒ?®šã—ã¾ã™ã?
339             *
340             * "true" ã§ã€ã‚¯ãƒ©ã‚¹å±žæ?を設定ã—ã¾ã›ã‚“。ã“れã?ã€?¼£?³?³ãƒ•ã‚¡ã‚¤ãƒ«ã«æ›¸ã‹ã‚Œã¦ã?‚‹å±žæ?ã‚?
341             * 使用ã—ãªã?“ã¨ã‚’æ„味ã—ã¾ã™ã?
342             * åˆæœŸå€¤ã¯ã€?false" ã§ã™ã?
343             *
344             * @param       flag クラスåä½¿ç”¨ã®æœ‰ç„¡(true:使用ã—ãªã?false:使用ã™ã‚‹ã€?
345             */
346            public void setNoClass( final String flag ) {
347                    noClass = StringUtil.nval( flag,noClass );
348            }
349    
350            /**
351             * カラãƒ??クラスå?X,S9 ãªã©)ã®ã‚»ãƒ?ƒˆã‚’行ã†ã‹ã©ã?‹å–å¾—ã—ã¾ã™ã?
352             *
353             * "true" ã§ã€ã‚¯ãƒ©ã‚¹å±žæ?を設定ã—ã¾ã›ã‚“。ã“れã?ã€?¼£?³?³ãƒ•ã‚¡ã‚¤ãƒ«ã«æ›¸ã‹ã‚Œã¦ã?‚‹å±žæ?ã‚?
354             * 使用ã—ãªã?“ã¨ã‚’æ„味ã—ã¾ã™ã?
355             * åˆæœŸå€¤ã¯ã€?false" ã§ã™ã?
356             *
357             * @return      クラスåä½¿ç”¨ã®æœ‰ç„¡(true:使用ã—ãªã?false:使用ã™ã‚‹ã€?
358             */
359            public boolean isNoClass() {
360                    return noClass;
361            }
362    
363            /**
364             * フォーマットã?使用å¯å¦ã‚’判断ã™ã‚‹ã‚­ãƒ¼ã¨ãªã‚‹ã‚«ãƒ©ãƒ?を指定ã—ã¾ã™ã?
365             *
366             * キーãŒã?usableList ã«å«ã¾ã‚Œã‚‹å ´åˆã?ã€ã“ã®ãƒ•ォーãƒ?‚’使用ã§ãã¾ã™ã?
367             * キー(カラãƒ?)ãŒæŒ‡å®šã•れãªã??åˆã?ã€å¸¸ã«ä½¿ç”¨ã•れã¾ã™ã?
368             * ※ ç¾æ™‚点ã§ã¯ã€BODYタイプã?ã¿ä½¿ç”¨ã—ã¦ã?¾ã™ã?
369             *
370             * @param  key フォーマットã?使用å¯å¦ã‚’判断ã™ã‚‹ã‚«ãƒ©ãƒ?
371             */
372            public void setUsableKey( final String key ) {
373                    usableKey = key;
374            }
375    
376            /**
377             *  フォーマットã?使用å¯å¦ã‚’判断ã™ã‚‹æ–?­—å?リストをæŒ?®šã—ã¾ã™ã?
378             *
379             * キーãŒã?ã“ã?æ–?­—å?リスト中ã«å­˜åœ¨ã™ã‚‹å ´åˆã?ã€ã“ã®ãƒ•ォーãƒ?‚’使用ã§ãã¾ã™ã?
380             * ã“ã?æ–?­—å?リストã?ã€å›ºå®šãªæ–?­—å?ã§ã™ã?{&#064;XXXX}ã¯ä½¿ç”¨ã§ãã¾ã™ãŒã€[XXXX]ã¯
381             * 使用ã§ãã¾ã›ã‚“ã€?
382             * åˆæœŸå€¤ã¯ã€?1" ã§ã™ã?
383             * ※ ç¾æ™‚点ã§ã¯ã€BODYタイプã?ã¿ä½¿ç”¨ã—ã¦ã?¾ã™ã?
384             *
385             * @param  list フォーマットã?使用å¯å¦ã‚’判断ã™ã‚‹æ–?­—å?リスãƒ?
386             * @see TableFormatter#isUse( int,DBTableModel )
387             */
388            public void setUsableList( final String list ) {
389                    if( list != null ) {
390                            usableList = list;
391                    }
392            }
393    
394            /**
395             * ã“ã“ã§æŒ?®šã—ãŸã‚«ãƒ©ãƒ??値ãŒã?キーブレイクã—ãŸå ´åˆã?ã“ã?タグを使用ã—ã¾ã™ã?
396             *
397             * キーブレイク㧠使用å¯å¦ã‚’指定ã™ã‚‹ç‚ºã®æ©Ÿè?ã§ã™ã?
398             * ã“ã?設定å?ã¯ã€usableKey,usableList ã¨ã¯ã€ç‹¬ç«‹ã—ã¦ã?‚‹ãŸã‚ã€ãれãžã‚Œã§
399             * 有効ã«ãªã‚Œã?ã€ä½¿ç”¨ã•れるã¨åˆ¤æ–­ã•れã¾ã™ã?
400             * キーブレイク判定ã§ã¯ã€æœ€åˆã?1ä»¶ç›®ã¯ã€å¿?šä½¿ç”¨ã•れるã¨åˆ¤æ–­ã•れã¾ã™ã?
401             *
402             * @og.rev 5.7.6.3 (2014/05/23) æ–°è¦è¿½åŠ?
403             *
404             * @param  kclm  キーブレイクをãƒã‚§ãƒ?‚¯ã™ã‚‹ã‚«ãƒ©ãƒ?D
405             */
406            public void setKeyBreakClm( final String kclm ) {
407                    keyBreakClm = kclm;
408            }
409    
410            /**
411             * ã“ã?フォーマットを使用ã™ã‚‹ã‹ã©ã?‹ã®å•ã„åˆã‚ã›ã‚’è¿”ã—ã¾ã™ã?
412             *
413             * "true" ã§ã€ä½¿ç”¨ã—ã¾ã™ã?setUsableKey( String ) ã§ã€æŒ‡å®šã•れãŸ
414             * カラãƒ?ã®å€¤ãŒã?setUsableList( String ) ã§æŒ?®šã•ã‚ŒãŸæ–?­—å?ã«å«ã¾ã‚Œã¦ã?‚Œã°ã€?
415             * 使用ã—ã¾ã™ã?カラãƒ?ãŒã‚»ãƒ?ƒˆã•れãªã??åˆã?ã€ãƒ‡ãƒ•ォルトå?("true")ãŒä½¿ç”¨ã•れã¾ã™ã?
416             * ※ ç¾æ™‚点ã§ã¯ã€BODYタイプã?ã¿ä½¿ç”¨ã—ã¦ã?¾ã™ã?
417             * カラãƒ??ãƒ??ã‚¿ã«ã€ä¸æ­£ãªã‚¹ãƒšã?スãŒå?ã‚‹å?åˆã‚’想定ã—ã¦ã€trim() ã—ã¦ã?¾ã™ã?
418             * よã£ã¦ã€usableList ã®å€¤ã«ã‚¹ãƒšã?スã¯ä½¿ç”¨ã§ãã¾ã›ã‚“ã€?
419             *
420             * 5.7.6.3 (2014/05/23) 以é™ã?ã€keyBreakClm ã«ã‚ˆã‚‹ã‚­ãƒ¼ãƒ–レイクãƒã‚§ãƒ?‚¯ã‚‚追åŠ?•れã¾ã—ãŸã€?
421             * 従æ¥ã® usableKey,usableList ã¨ã¯ã€ç‹¬ç«‹ã—ã¦ã?‚‹ãŸã‚ã€ãれãžã‚Œã§æœ‰åйã«ãªã‚Œã?ã€?
422             * 使用ã•れるã¨åˆ¤æ–­ã•れã¾ã™ã?
423             *
424             * @og.rev 3.5.6.2 (2004/07/05) 判定評価用カラãƒ??値ã‚?trim() ã—ã¾ã™ã?
425             * @og.rev 5.7.6.3 (2014/05/23) キーブレイクをãƒã‚§ãƒ?‚¯ã™ã‚‹ keyBreakClm 属æ?追åŠ?
426             *
427             * @param  row 行番å·
428             * @param       table   DBTableModelオブジェク�
429             *
430             * @return      ã“ã?フォーãƒ?‚’使用ã™ã‚‹ã‹ã©ã?‹(true:使用ã™ã‚‹/false:使用ã—ãªã?
431             * @see TableFormatter#setUsableKey( String )
432             * @see TableFormatter#setUsableList( String )
433             */
434            public boolean isUse( final int row, final DBTableModel table ) {
435    // 5.7.6.3 (2014/05/23) keyBreakClm 属æ?ã®è¿½åŠ?§ã€å?ç?ƒ­ã‚¸ãƒ?‚¯ã®è¦‹ç›´ã?
436    //              if( usableKeyNo < 0 ) { return true; }
437    //              String val = table.getValue( row,usableKeyNo ).trim();
438    //              return val.length() == 0 ? false : usableList.indexOf( val ) >= 0 ;
439    
440                    // ã©ã¡ã‚‰ã‚‚設定ã•れã¦ã?ªã‘れã°ã€ä½¿ç”¨ã•れã‚?=true)
441                    if( usableKeyNo < 0 && breakClmNo < 0 ) { return true; }
442    
443                    // 以下ã?ã©ã¡ã‚‰ã‹ã¯è¨­å®šã•れã¦ã?‚‹ãŸã‚ã€true ã®æ™‚点ã§ã€ä½¿ç”¨ã•れã‚?=true)ã‚’è¿”ã™ã€?
444                    if( usableKeyNo >= 0 ) {
445                            String val = table.getValue( row,usableKeyNo ).trim();
446                            if( usableList.indexOf( val ) >= 0 ) { return true; }
447                    }
448    
449                    if( breakClmNo >= 0 ) {
450                            String val = table.getValue( row,breakClmNo ).trim();
451                            if( !val.equals( breakVal ) ) {                 // åŒã˜ã§ãªã??åˆã?ã€true
452                                    breakVal = val;
453                                    return true;
454                            }
455                    }
456    
457                    return false ;                  // æœ?¾Œã¾ã§æ®‹ã‚‹ã¨ã€ä½¿ç”¨ã•れãªã?¨åˆ¤æ–­ã€false ã‚’è¿”ã™ã€?
458            }
459    
460            /**
461             *  itdフォーマット文字å?を設定ã—ã¾ã™ã?
462             *
463             * itd ãƒœãƒ‡ã‚£éƒ¨ã®æ–?­—å?を指定ã—ã¾ã™ã?
464             * itd ボディã¯ã€ç¹°ã‚Šè¿”ã—処ç?‚’行ã„ã¾ã™ã?ã“れをã?上ä½ã?ボディæ–?­—å?ã®ä¸­ã®
465             * HYBS_ITD_MARKER æ–?­—å? ã¨ç½®ãæ›ãˆã¾ã™ã?
466             *
467             * @og.rev 3.5.6.0 (2004/06/18) itdフォーマット文字å?ã®å–り込ã¿
468             *
469             * @param  itd itdフォーマットã?æ–?­—å?
470             */
471            public void setItdBody( final String itd ) {
472                    if( itd != null ) {
473                            itdBody = itd;
474                    }
475            }
476    
477            /**
478             *  itdフォーマット文字å?ã‚’å–å¾—ã—ã¾ã™ã?
479             *
480             * itd ãƒœãƒ‡ã‚£éƒ¨ã®æ–?­—å?ã‚’å–å¾—ã—ã¾ã™ã?
481             * itd ボディã¯ã€ç¹°ã‚Šè¿”ã—処ç?‚’行ã„ã¾ã™ã?ã“れをã?上ä½ã?ボディæ–?­—å?ã®ä¸­ã®
482             * HYBS_ITD_MARKER æ–?­—å? ã¨ç½®ãæ›ãˆã¾ã™ã?
483             *
484             * @og.rev 3.5.6.0 (2004/06/18) itdフォーマット文字å?ã®å–り込ã¿
485             *
486             * @return      itdフォーマットã?æ–?­—å?
487             */
488            public String getItdBody() {
489                    return itdBody;
490            }
491    
492            /**
493             * ã‚µãƒ‹ã‚¿ã‚¤ã‚ºã®æˆ»ã?"\\]\\"ã‹ã‚‰"["ã«æˆ»ã?を行ã„ã¾ã™ã?
494             *
495             * @og.rev 5.1.7.0 (2010/06/01) æ–°è¦ä½œæ?
496             *
497             * @param str サニタイズã•ã‚ŒãŸæ–‡å­—å?
498             *
499             * @return サニタイズ戻ã—å?ç?¾Œã?æ–?­—å?
500             */
501            private String decodeSanitizedStr( final String str ) {
502                    if( str != null && str.indexOf( "\\]\\" ) >= 0 ) {
503                            return str.replace( "\\]\\", "[" );
504                    }
505                    else {
506                            return str;
507                    }
508            }
509    }