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.plugin.io; 017 018 import org.odftoolkit.odfdom.OdfFileDom; 019 import org.odftoolkit.odfdom.doc.table.OdfTableCell; 020 import org.odftoolkit.odfdom.dom.element.office.OfficeAnnotationElement; 021 import org.odftoolkit.odfdom.dom.element.text.TextPElement; 022 import org.opengion.hayabusa.db.DBColumn; 023 024 /** 025 * Calcファイルの書き?しクラスです? 026 * 027 * こ?クラスでは??常の出力クラスと異なり?以下?ように出力されます? 028 * ?ータ部?は、X(??)また?9(数値?をリソース定義の桁数??? 029 * ②?ルのコメント情報として{@ANO.カラ?_行番号}を?? 030 * 031 * こ?出力結果は??常、Calc帳票シス?の雛形を作?するための、???として 032 * 利用することを想定して?す? 033 * 034 * @og.group ファイル出? 035 * 036 * @version 5.0 037 * @author Hiroki Nakamura 038 * @since JDK6.0, 039 */ 040 public class TableWriter_CalcDefAno extends TableWriter_CalcDef { 041 //* こ?プログラ??VERSION??を設定します? {@value} */ 042 private static final String VERSION = "4.0.0.0 (2005/08/31)" ; 043 044 /** 045 * ?ストコン??のセルを生成す? 046 * 047 * @param contentDom OdfFileDomオブジェク? 048 * @param content コン?? 049 * @param col DBColumnオブジェク? 050 * @param isCellTypeNumber [true:数字型/false:?型] 051 * @param isNumberList [true:数字リス?999/false:通常] 052 * 053 * @return ?ストコン??のセル 054 */ 055 @Override 056 protected OdfTableCell createTextCell( final OdfFileDom contentDom, final String content, final DBColumn col, final Boolean isCellTypeNumber, final Boolean isNumberList ) { 057 String val = null; 058 if( isNumberList ) { val = "999"; } 059 else { 060 StringBuilder buf = new StringBuilder(); 061 int sizeX = col.getSizeX(); 062 int sizeY = col.getSizeY(); 063 String fillStr = isCellTypeNumber ? "9" : "X"; 064 for( int i=0; i<sizeX; i++ ) { 065 buf.append( fillStr ); 066 } 067 if( sizeY > 0 ) { 068 buf.append( "." ); 069 for( int i=0; i<sizeY; i++ ) { 070 buf.append( fillStr ); 071 } 072 } 073 val = buf.toString(); 074 } 075 076 OdfTableCell cell = super.createTextCell( contentDom, val, isCellTypeNumber, isNumberList ); 077 OfficeAnnotationElement anotation = cell.newOfficeAnnotationElement(); 078 TextPElement text = anotation.newTextPElement(); 079 text.setTextContent( "{@ANO." + content + "}" ); 080 081 return cell; 082 } 083 }