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            /** フォーマットタイプã?æŒ?®? ヘッãƒ??タイãƒ?{@value}  */
044    //      public static final String TYPE_HEAD  = "head" ;
045            /** フォーマットタイプã?æŒ?®? ボディタイãƒ?{@value}  */
046    //      public static final String TYPE_BODY  = "body" ;
047            /** フォーマットタイプã?æŒ?®? フッタータイãƒ?{@value}  */
048    //      public static final String TYPE_FOOT = "foot";
049    
050            /** フォーマットタイプã?æŒ?®šã?特殊なマã?ク {@value} */
051            public static final String HYBS_ITD_MARKER = "h_itd_marker";
052            private static final Pattern ptnKey = Pattern.compile( "[ \t]+</td" ); // 4.3.2.0 (2008/09/10)
053    
054            // 3.5.5.2 (2004/04/02) 定数化しておきますã?
055    //      private static final int SYSFORM_KEY_CLM = -1;          // [KEY.カラãƒ?��]
056    //      private static final int SYSFORM_ROWNUM  = -2;          // [I]
057    //      private static final int SYSFORM_ROW_ID  = -3;          // [ROW.ID]  3.6.0.0 (2004/09/17)
058    
059    //      private String                  formatType      = null;
060            private FormatterType   formatType      = null;
061            private int[]                   location        = null;
062            private String[]                format          = null;
063    //      private String[]                systemFormat= null;             // 3.5.5.0 (2004/03/12) [KEY.カラãƒ?��] 機è?追åŠ?
064            private String                  formatTag       = null;
065            private String                  rowspan         = " rowspan=\"2\"";
066            private String                  trTag           = null;
067            private boolean                 noClass         = false;
068            // 3.5.6.0 (2004/06/18) '!' 値のみ 追åŠ?既存ã? '$' は、レンãƒ?ƒ©ー
069            private char[]                  type            = null;         // '#':ラベルのみ  '$':レンãƒ?ƒ©ー '!':値のみ  そã?ä»?通常
070            private String                  usableKey       = null;         // キーæƒ??のカラãƒ?–‡字å?
071            private int                             usableKeyNo     = -1;           // キーæƒ??のカラãƒ?•ª号
072            private String                  usableList      = "1" ;
073    
074            private String                  itdBody         = "";           // 3.5.6.0 (2004/06/18) 追åŠ?
075            private Formatter               formatter       = null;
076    
077            /**
078             * フォーマットをセãƒ?ƒˆしますã?
079             * フォーマットにã€?lt;table&gt;を含ã‚??合ã?TextField扱ã�?�ªので、フォーマットå?割
080             * しません。table を含まずã?tr を含ã‚??合ã?ã€?¼‘行å?のãƒ??タとして扱ã�?‚ºã€?
081             * trTag を求めますã?
082             * trTag と format との間に、行ã?ãƒ?ƒ€ーがå?りますã?
083             * Tomcat6では、JSPのパã?ス時に、tabやspaceはそã?ままパã?スされるためã?&lt;/td&gt;å‰?
084             * のスペã?ス削除処ç�?‚‚行いますã?
085             *
086             * @og.rev 4.3.2.0 (2008/09/10) &lt;/td&gt;前ã?スペã?スを取り消しますã?
087             * @og.rev 5.5.0.3 (2012/03/13) &lt;tr&gt;を取らなã�?ƒ•ラグ追åŠ?
088             *
089             * @param       fmt  [カラãƒ?��] 形式ã?フォーマットデータ
090             * @param   flg  falseにすると先é?のtrタグを取るå?ç�?‚’行いません(5.5.0.3)
091             */
092            public void setFormat( final String fmt , final boolean flg ) {
093                    int tbl = fmt.indexOf( "<table" );
094                    int str = fmt.indexOf( "<tr" );
095    
096                    // tr を含み、かつ、tableを含まなã�?�‹、含んでã‚?tr の後ろにtableがあるå?合ã?
097    //              if( str >= 0 && ( tbl < 0 || str < tbl ) ) {
098                    if( str >= 0 && ( tbl < 0 || str < tbl ) && flg ) { // 5.5.0.3(2012/03/13)
099                            int end = fmt.indexOf( '>',str );
100                            formatTag = fmt.substring(end+1);
101                            trTag = fmt.substring(0,end+1) ;
102                    }
103                    else {
104                            formatTag = fmt;
105                            trTag     = null;
106                    }
107                    // 4.3.2.0 (2008/09/10) </td>前ã?スペã?スを取り消すã€?
108                    Matcher matcher = ptnKey.matcher( formatTag );
109                    formatTag = matcher.replaceAll( "</td" );
110    
111            }
112    
113            /**
114             * フォーマットをセãƒ?ƒˆしますã?
115             * フォーマットにã€?lt;table&gt;を含ã‚??合ã?TextField扱ã�?�ªので、フォーマットå?割
116             * しません。table を含まずã?tr を含ã‚??合ã?ã€?¼‘行å?のãƒ??タとして扱ã�?‚ºã€?
117             * trTag を求めますã?
118             * trTag と format との間に、行ã?ãƒ?ƒ€ーがå?りますã?
119             * Tomcat6では、JSPのパã?ス時に、tabやspaceはそã?ままパã?スされるためã?&lt;/td&gt;å‰?
120             * のスペã?ス削除処ç�?‚‚行いますã?
121             *
122             * @og.rev 5.5.0.3 (2012/03/13) 引数追åŠ?�«つきã?
123             *
124             * @param       fmt  [カラãƒ?��] 形式ã?フォーマットデータ
125             */
126            public void setFormat( final String fmt  ) {
127                    setFormat( fmt , true );
128            }
129    
130            /**
131             * フォーマットを取得しますã?
132             *
133             * @og.rev 3.5.5.8 (2004/05/20) 新規追åŠ?
134             * @og.rev 5.1.7.0 (2010/06/01) サニタイズ戻しå?ç�?"\\]\\"から"["に戻ã�?を追åŠ?
135             *
136             * @return      フォーマットデータ
137             */
138            public String getFormat() {
139                    if( trTag != null ) {
140    //                      return trTag + formatTag ;
141                            return decodeSanitizedStr( trTag + formatTag );
142                    }
143                    else {
144    //                      return formatTag ;
145                            return decodeSanitizedStr( formatTag );
146                    }
147            }
148    
149            /**
150             * DBTableModelを利用して、フォーマットデータをå?期化しますã?
151             *
152             * @og.rev 3.5.5.0 (2004/03/12) [KEY.カラãƒ?��] 機è?追åŠ?
153             * @og.rev 3.5.5.2 (2004/04/02) [I] で、行番号を作æ?しますã?
154             * @og.rev 3.5.6.0 (2004/06/18) '!' 値のみ 追åŠ?既存ã? '$' は、レンãƒ?ƒ©ー
155             * @og.rev 3.6.0.0 (2004/09/17) [ROW.ID] で、行毎ã?チェãƒ?‚¯ボックスのIDを返しますã?
156             * @og.rev 5.1.7.0 (2010/06/01) サニタイズ戻しå?ç�?"\\]\\"から"["に戻ã�?を追åŠ?
157             *
158             * @param       table   DBTableModelオブジェクãƒ?
159             */
160            public void makeFormat( final DBTableModel table ) {
161    //              String fmt2 = formatTag.replace( '[',']' );
162    //              CSVTokenizer token = new CSVTokenizer( fmt2,']',false );
163    //              int count = token.countTokens() / 2 ;
164    //              format   = new String[ count+1 ];
165    //              location = new int[ count ];
166    //              systemFormat = new String[ count ];     // 3.5.5.0 (2004/03/12)
167    //              type     = new char[ count ];
168    //              for( int i=0; i<count; i++ ) {
169    //                      format[i]  = token.nextToken();
170    //                      String clm = token.nextToken();
171    //                      type[i] = clm.charAt(0);
172    //                      if( type[i] == '#' || type[i] == '$' || type[i] == '!' ) {
173    //                              location[i] = table.getColumnNo( clm.substring(1) );
174    //                      }
175    //                      // 3.5.5.0 (2004/03/12) [KEY.カラãƒ?��] 機è?追åŠ?
176    //                      else if( clm.startsWith( "KEY." ) ) {
177    //                              location[i] = SYSFORM_KEY_CLM ;
178    //                              systemFormat[i] = clm.substring(4) ;
179    //                      }
180    //                      // 3.5.5.0 (2004/03/12) [I] 機è?追åŠ?
181    //                      else if("I".equals( clm ) ) {
182    //                              location[i] = SYSFORM_ROWNUM;
183    //                              systemFormat[i] = null ;
184    //                      }
185    //                      // 3.6.0.0 (2004/09/17) [ROW.ID] 機è?追åŠ?
186    //                      else if( "ROW.ID".equals( clm ) ) {
187    //                              location[i] = SYSFORM_ROW_ID;
188    //                              systemFormat[i] = null ;
189    //                      }
190    //                      else {
191    //                              location[i] = table.getColumnNo( clm );
192    //                      }
193    //              }
194    //              format[count] = token.nextToken();
195    
196                    formatter = new Formatter( table );
197                    formatter.setFormat( formatTag );
198                    location = formatter.getClmNos();
199                    format   = formatter.getFormat();
200    
201                    // 5.1.7.0 (2010/06/01) サニタイズ戻しå?ç�?"\\]\\"から"["に戻ã�?を追åŠ?
202                    if( format != null ) {
203                            for( int i=0; i<format.length; i++ ) {
204                                    format[i] = decodeSanitizedStr( format[i] );
205                            }
206                    }
207    
208                    type     = formatter.getType();
209    
210                    // こã?フォーマットを使用するかどã�?�‹を指定する判定条件の初期設定ですã?
211                    if( usableKey != null ) {
212                            usableKeyNo = table.getColumnNo( usableKey );
213                    }
214            }
215    
216            /**
217             * ãƒ??ブルフォーマットã?タイプをæŒ?®šしますã?
218             * enum FormatterType で、指定しますã?
219             *
220             * @og.rev 4.0.0.0 (2007/05/02) enum 定義に変更
221             *
222             * @param  ftype フォーマットã?タイãƒ?
223             */
224            public void setFormatType( final FormatterType ftype ) {
225                    formatType = ftype;
226            }
227    
228            /**
229             * ãƒ??ブルフォーマットã?タイプをæŒ?®šしますã?
230             * head/body/foot で、指定しますã?
231             *
232             * @og.rev 3.5.4.8 (2004/02/23) フォーマットã?タイプに、ith/itd を追åŠ?
233             * @og.rev 3.5.6.0 (2004/06/18) フォーマットã?タイプã?、ith/itd を削除
234             *
235             * @param  ftype フォーマットã?タイãƒ?head/body/foot)
236             */
237    //      public void setFormatType( final String ftype ) {
238    //              if( ftype == null || "head/body/foot/".indexOf( ftype ) < 0 ) {
239    //                      String errMsg = "ãƒ??ブルフォーマットã?タイプã?、head/body/foot 以外指定できませんã€?;
240    //                      errMsg = errMsg + "[" + ftype + "]";
241    //                      throw new HybsSystemException( errMsg );
242    //              }
243    //              formatType = ftype;
244    //      }
245    
246            /**
247             * こã?フォーマットã?タイプを返しますã?
248             *
249             * こã?フォーマットã?タイプを返しますã?
250             *
251             * @og.rev 4.0.0.0 (2007/05/02) enum 定義に変更
252             *
253             * @return      こã?フォーマットã?タイプを返しますã?
254             */
255            public FormatterType getFormatType() {
256                    return formatType;
257            }
258    
259            /**
260             * こã?フォーマットã?タイプを返しますã?
261             *
262             * タイプã?ã€?head/body/foot" の中から、指定しますã?
263             *
264             * @return      こã?フォーマットã?タイプを返しますã?
265             */
266    //      public String getFormatType() {
267    //              return formatType;
268    //      }
269    
270            /**
271             * ãƒ??ブルの rowspan 属æ?をセãƒ?ƒˆしますã?
272             * rowspan は、ã?ãƒ?ƒ€ー部のフォーマットã?行数ですã?初期値は ?’è¡?ですã?
273             * 設定ã?ã€?2" などの、数字部のみをセãƒ?ƒˆしますã?
274             *
275             * @param  rowspan 属æ?
276             */
277            public void setRowspan( final String rowspan ) {
278                    if( rowspan == null || rowspan.length() == 0 || rowspan.equals( "1" ) ) {
279                            this.rowspan = "";
280                    }
281                    else {
282                            this.rowspan = " rowspan=\"" + rowspan + "\"";
283                    }
284            }
285    
286            /**
287             * 設定された rowspan を返しますã?
288             * これは、フォーマットã?段çµ??数を取りå?しますã?
289             * æ–?­—å?としては、rowspan="2" とã�?�†形で取り出しますã?
290             *
291             * @return フォーマット文字å?
292             */
293            public String getRowspan() {
294                    return rowspan;
295            }
296    
297            /**
298             * ロケーション番号のサイズを返しますã?
299             * フォーãƒ?½�置番号はã€? から getLocationSize()-1 までの数字をæŒ?®šしますã?
300             * ロケーションサイズは、aaa[ABC]bbb[DEF]ccc[GHI]ddd となってã�?‚‹場合ã?
301             * aaa , bbb , ccc , ddd は、フォーマットで、サイズは?”ã?
302             * ABC , DEF , GHI に対応するカラãƒ?•ª号がロケーションで、サイズは?“ã?
303             * こã?メソãƒ?ƒ‰で返すのは、ロケーション番号(??の方ですã?
304             *
305             * @return  ロケーション番号のサイズ
306             */
307            public int getLocationSize() {
308                    return location.length;
309            }
310    
311            /**
312             * カラãƒ??ロケーション番号を返しますã?
313             * 引数はã€? から、getLocationSize()-1 までの数でæŒ?®šしますã?
314             * æŒ?®šã?位置の、フォーマットã?カラãƒ?��に対応するロケーション番号
315             * を返しますã?
316             *
317             * @param no フォーãƒ?½�置番号
318             *
319             * @return ロケーション番号
320             */
321            public int getLocation( final int no ) {
322                    return location[no];
323            }
324    
325            /**
326             * フォーマット文字å?を返しますã?
327             * 引数はã€? から、getLocationSize() までの数でæŒ?®šしますã?
328             * æŒ?®šã?フォーマットが、aaa[ABC]bbb[DEF]ccc[GHI]ddd となってã�?‚‹場合ã?
329             * aaa , bbb , ccc , ddd を引数 0 , 1 , 2 , 3 で返しますã?
330             *
331             * @param no フォーãƒ?½�置番号
332             *
333             * @return フォーマット文字å?
334             */
335            public String getFormat( final int no ) {
336                    return format[no];
337            }
338    
339            /**
340             * シスãƒ?ƒ フォーマット文字å?を返しますã?
341             * シスãƒ?ƒ フォーマット文字å?は、[KEY.カラãƒ?��] などの特殊記号でæŒ?®šされた
342             * カラãƒ?��の事で、location には、ã?イナスの値が設定されますã?
343             * マイナスの値に応じて、å?ç�?‚’変えることがå?来ますã?
344             *
345             * [KEY.カラãƒ?��] : 行番号付きカラãƒ?��
346             * [I]            : 行番号
347             * [ROW.ID]       : 行毎ã?チェãƒ?‚¯ボックスのID
348             * [ROW.JSON]     : 行毎ã?全ãƒ??タのJavaScriptオブジェクト形å¼?
349             *
350             * @og.rev 3.5.5.0 (2004/03/12) [KEY.カラãƒ?��] 機è?追åŠ?
351             * @og.rev 3.5.5.2 (2004/04/02) [I] で、行番号を作æ?しますã?
352             * @og.rev 3.6.0.0 (2004/09/17) [ROW.ID] で、行毎ã?チェãƒ?‚¯ボックスのIDを返しますã?
353             * @og.rev 4.0.0.0 (2007/05/02) Formatter を使用するように変更
354             *
355             * @param       row     行番号
356             * @param       loc     位置番号
357             *
358             * @return フォーマット文字å?
359             */
360            public String getSystemFormat( final int row,final int loc ) {
361                    if( loc == Formatter.SYS_ROWNUM ) {
362                            return String.valueOf( row );
363                    }
364                    else if( loc == Formatter.SYS_JSON ) {
365                            return formatter.getJson( row );
366                    }
367    
368                    String errMsg = "シスãƒ?ƒ フォーマットã?、下記ã?形式しか使用できませんã€?" + loc + "]" + HybsSystem.CR
369                                    + "  : [KEY.カラãƒ?��] : 行番号付きカラãƒ?��" + HybsSystem.CR
370                                    + "  : [I]            : 行番号" + HybsSystem.CR
371                                    + "  : [ROW.ID]       : 行毎ã?チェãƒ?‚¯ボックスのID" + HybsSystem.CR
372                                    + "  : [ROW.JSON]     : 行毎ã?全ãƒ??タのJavaScriptオブジェクト形å¼? ;
373                    throw new HybsSystemException( errMsg );
374            }
375    
376    //      public String getSystemFormat( final int row,final int no ) {
377    //              if( location[no] == SYSFORM_KEY_CLM ) {
378    //                      return systemFormat[no] + HybsSystem.JOINT_STRING + row ;
379    //              }
380    //              else if( location[no] == SYSFORM_ROWNUM ) {
381    //                      return String.valueOf( row );
382    //              }
383    //              else if( location[no] == SYSFORM_ROW_ID ) {
384    //                      return HybsSystem.ROW_ID_KEY + row;
385    //              }
386    //
387    //              String errMsg = "シスãƒ?ƒ フォーマットã?、下記ã?形式しか使用できませんã€?" + location[no] + "]" + HybsSystem.CR
388    //                              + "  " + SYSFORM_KEY_CLM + ": [KEY.カラãƒ?��] カラãƒ?D(接続記号)行番号 とã�?�†フィールドキーを作æ?"
389    //                              + "  " + SYSFORM_ROWNUM  + ": [I] 行番号を作æ?" ;
390    //              throw new HybsSystemException( errMsg );
391    //      }
392    
393            /**
394             * タイプ文字å?を返しますã?
395             * タイプとは、[XXX] の記述で、[#XXX] は、XXXカラãƒ??ラベルをã?[$XXX]は、XXXカラãƒ??
396             * レンãƒ?ƒ©ーをã?[!XXX} は、å?のみ取り出す指定を行いますã?
397             * 主に、TextField系のフォーマットとTable系では、意味合いが異なりますã?でã€?
398             * ご注意くã�?�•ã�??
399             *
400             * @param no フォーãƒ?½�置番号
401             *
402             * @return タイプ文字å? '#':ラベルのみ  '$':レンãƒ?ƒ©ー '!':値のみ  そã?ä»?通常
403             */
404            public char getType( final int no ) {
405                    return type[no];
406            }
407    
408            /**
409             * 設定された フォーマットã? trタグを返しますã?
410             * これは、trタグにclass属æ?他ã?設定がされてã�?�Ÿ場合に、変換後ã?
411             * æ–?­—å?にも反æ˜?�•せる為にå¿?¦�ですã?
412             *
413             * @og.rev 5.1.7.0 (2010/06/01) サニタイズ戻しå?ç�?"\\]\\"から"["に戻ã�?を追åŠ?
414             *
415             * @return フォーマットã? trタグ
416             */
417            public String getTrTag() {
418                    if( trTag == null ) { return ""; }
419    
420    //              return trTag ;
421                    return decodeSanitizedStr( trTag ) ;
422            }
423    
424            /**
425             * カラãƒ??クラスå�?X,S9 など)のセãƒ?ƒˆを行うかどã�?�‹æŒ?®šしますã?
426             *
427             * "true" で、クラス属æ?を設定しません。これã?ã€?¼£?³?³ファイルに書かれてã�?‚‹属æ?ã‚?
428             * 使用しなã�?�“とを意味しますã?
429             * 初期値はã€?false" ですã?
430             *
431             * @param       flag クラス名使用の有無(true:使用しなã�?false:使用するã€?
432             */
433            public void setNoClass( final String flag ) {
434                    noClass = StringUtil.nval( flag,noClass );
435            }
436    
437            /**
438             * カラãƒ??クラスå�?X,S9 など)のセãƒ?ƒˆを行うかどã�?�‹取得しますã?
439             *
440             * "true" で、クラス属æ?を設定しません。これã?ã€?¼£?³?³ファイルに書かれてã�?‚‹属æ?ã‚?
441             * 使用しなã�?�“とを意味しますã?
442             * 初期値はã€?false" ですã?
443             *
444             * @return      クラス名使用の有無(true:使用しなã�?false:使用するã€?
445             */
446            public boolean isNoClass() {
447                    return noClass;
448            }
449    
450            /**
451             * フォーマットã?使用可否を判断するキーとなるカラãƒ?��を指定しますã?
452             *
453             * キーがã?usableList に含まれる場合ã?、このフォーãƒ?‚’使用できますã?
454             * キー(カラãƒ?��)が指定されなã�??合ã?、常に使用されますã?
455             * ※ 現時点では、BODYタイプã?み使用してã�?�¾すã?
456             *
457             * @param  key フォーマットã?使用可否を判断するカラãƒ?��
458             */
459            public void setUsableKey( final String key ) {
460                    usableKey = key;
461            }
462    
463            /**
464             *  フォーマットã?使用可否を判断するæ–?­—å?リストをæŒ?®šしますã?
465             *
466             * キーがã?こã?æ–?­—å?リスト中に存在する場合ã?、このフォーãƒ?‚’使用できますã?
467             * こã?æ–?­—å?リストã?、固定なæ–?­—å?ですã?{&#064;XXXX}は使用できますが、[XXXX]は
468             * 使用できませんã€?
469             * 初期値はã€?1" ですã?
470             * ※ 現時点では、BODYタイプã?み使用してã�?�¾すã?
471             *
472             * @param  list フォーマットã?使用可否を判断するæ–?­—å?リスãƒ?
473             * @see TableFormatter#isUse( int,DBTableModel )
474             */
475            public void setUsableList( final String list ) {
476                    if( list != null ) {
477                            usableList = list;
478                    }
479            }
480    
481            /**
482             * こã?フォーマットを使用するかどã�?�‹の問い合わせを返しますã?
483             *
484             * "true" で、使用しますã?setUsableKey( String ) で、指定された
485             * カラãƒ?��の値がã?setUsableList( String ) でæŒ?®šされたæ–?­—å?に含まれてã�?‚Œばã€?
486             * 使用しますã?カラãƒ?��がセãƒ?ƒˆされなã�??合ã?、デフォルトå?("true")が使用されますã?
487             * ※ 現時点では、BODYタイプã?み使用してã�?�¾すã?
488             * カラãƒ??ãƒ??タに、不正なスペã?スがå?るå?合を想定して、trim() してã�?�¾すã?
489             * よって、usableList の値にスペã?スは使用できませんã€?
490             *
491             * @og.rev 3.5.6.2 (2004/07/05) 判定評価用カラãƒ??値ã‚?trim() しますã?
492             *
493             * @param  row 行番号
494             * @param       table   DBTableModelオブジェクãƒ?
495             *
496             * @return      こã?フォーãƒ?‚’使用するかどã�?�‹(true:使用する/false:使用しなã�?
497             * @see TableFormatter#setUsableKey( String )
498             * @see TableFormatter#setUsableList( String )
499             */
500            public boolean isUse( final int row, final DBTableModel table ) {
501                    if( usableKeyNo < 0 ) { return true; }
502                    String val = table.getValue( row,usableKeyNo ).trim();
503                    return ( val.length() == 0 ? false : usableList.indexOf( val ) >= 0 );
504            }
505    
506            /**
507             *  itdフォーマット文字å?を設定しますã?
508             *
509             * itd ボディ部のæ–?­—å?を指定しますã?
510             * itd ボディは、繰り返し処ç�?‚’行いますã?これをã?上位ã?ボディæ–?­—å?の中の
511             * HYBS_ITD_MARKER æ–?­—å? と置き換えますã?
512             *
513             * @og.rev 3.5.6.0 (2004/06/18) itdフォーマット文字å?の取り込み
514             *
515             * @param  itd itdフォーマットã?æ–?­—å?
516             */
517            public void setItdBody( final String itd ) {
518                    if( itd != null ) {
519                            itdBody = itd;
520                    }
521            }
522    
523            /**
524             *  itdフォーマット文字å?を取得しますã?
525             *
526             * itd ボディ部のæ–?­—å?を取得しますã?
527             * itd ボディは、繰り返し処ç�?‚’行いますã?これをã?上位ã?ボディæ–?­—å?の中の
528             * HYBS_ITD_MARKER æ–?­—å? と置き換えますã?
529             *
530             * @og.rev 3.5.6.0 (2004/06/18) itdフォーマット文字å?の取り込み
531             *
532             * @return      itdフォーマットã?æ–?­—å?
533             */
534            public String getItdBody() {
535                    return itdBody;
536            }
537    
538            /**
539             * サニタイズの戻ã�?"\\]\\"から"["に戻ã�?を行いますã?
540             *
541             * @og.rev 5.1.7.0 (2010/06/01) 新規作æ?
542             *
543             * @param str サニタイズされた文字å?
544             *
545             * @return サニタイズ戻しå?ç�?¾Œã?æ–?­—å?
546             */
547            private String decodeSanitizedStr( final String str ) {
548                    if( str != null && str.indexOf( "\\]\\" ) >= 0 ) {
549                            return str.replace( "\\]\\", "[" );
550                    }
551                    else {
552                            return str;
553                    }
554            }
555    }