...
カスタムフォーマッターは、「com.hof.mi.interfaces.CustomFormatter」classの実装です。このclassには、以下の関数を実装しなくてはいけません。
これらのメソッドは、必要に応じて上書きすることができます。
関数定義
public abstract String getName();
...
public abstract boolean acceptsNativeType(int type);
このメソッドは、フォーマッターが与えられたデータ型のフィールドをサポートする場合にtrueを返し、それ以外にはfalseを返します。サポートされている型の一覧は、付録に掲載されています。このメソッドは、フォーマッターが与えられたデータ型のフィールドをサポートする場合にtrueを返し、それ以外にはfalseを返します。サポートされている型の一覧は、付録に掲載されています。
例1:
Code Block | ||
---|---|---|
| ||
public boolean acceptsNativeType(int type) { //accept text and numeric data if (type == TYPE_TEXT || type == TYPE_NUMERIC) { return true; } else { //don't allow any other types return false; } } |
...
このメソッドは、単一の値を表示します。「renderType引数」は、レンダリングする出力型を決定します。Yellowfinは、書式設定されたカラム(列)のすべての値に対してこの関数を実行します。「renderTypeパラメーター」は、値の表示方法に関するヒントを提供します。PDF/XLS形式でドキュメントを出力する場合は、「RENDER_TEXT」型が使用されます。利用可能な「renderType」値の一覧は、付録に掲載されています。」値の一覧は、付録に掲載されています。
Code Block | ||
---|---|---|
| ||
public String render(Object value, int renderType) throws Exception { if (value == null) return null if (renderType == RENDER_LINK) // Render the value for a drill-through link. // In this case you almost always want to return a generic // representation of the value. return value.toString(); } // Return the formatted value return "Value: " + value.toString(); } |
...
Section | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|