• R/O
  • SSH
  • HTTPS

opengion: Commit


Commit MetaInfo

Révision1659 (tree)
l'heure2018-10-16 17:11:04
Auteurtakahashi_m

Message de Log

(empty log message)

Change Summary

Modification

--- trunk/opengionV5/uap/webapps/gf/doc/RELEASE-NOTES.txt (revision 1658)
+++ trunk/opengionV5/uap/webapps/gf/doc/RELEASE-NOTES.txt (revision 1659)
@@ -1,4 +1,12 @@
1-5.10.4.1 (2018/10/12)
1+5.10.4.2 (2018/10/19)
2+ [RICHLABELのショートラベル指定]
3+ RICHLABELに対して1以上の値を属性として指定した場合、ショートラベルとして表示されるようにしておきます。
4+ これは、通常のショートラベルとして表示した場合にタグが邪魔になるためですが、
5+ 需要としては少ないため、専用のレンデラーを作成せずに属性値指定の対応としておきます。
6+ plugin.column.Renderer_RICHLABEL
7+
8+
9+5.10.4.1 (2018/10/12)
210 [レンデラーにタグ削除の機能追加]
311 V6に存在するNOTAGレンデラーを追加します。
412 利用しているStringUtilのtagCutも追加しておきます。
--- trunk/opengionV5/uap/webapps/gf/src/org/opengion/hayabusa/db/DBEventColumn.java (revision 1658)
+++ trunk/opengionV5/uap/webapps/gf/src/org/opengion/hayabusa/db/DBEventColumn.java (revision 1659)
@@ -63,7 +63,7 @@
6363 * 初期情報を含んだ新規オブジェクトを作成します。
6464 * このコンストラクタではflgEncryptをfalseとして扱う。
6565 *
66- * @og.rev 5.10.4.0 (2018/10/05) 暗号化処理追加
66+ * @og.rev 5.10.4.0 (2018/10/05) 暗号化対応
6767 *
6868 * @param name 内容を置き換えるカラム(子カラム)
6969 * @param evCol イベントカラム(親カラム・カンマ区切り)
--- trunk/opengionV5/uap/webapps/gf/src/org/opengion/plugin/column/Renderer_RICHLABEL.java (revision 1658)
+++ trunk/opengionV5/uap/webapps/gf/src/org/opengion/plugin/column/Renderer_RICHLABEL.java (revision 1659)
@@ -16,6 +16,7 @@
1616 package org.opengion.plugin.column;
1717
1818 import org.opengion.fukurou.util.StringUtil;
19+import org.opengion.hayabusa.common.HybsSystem;
1920 import org.opengion.hayabusa.db.AbstractRenderer;
2021 import org.opengion.hayabusa.db.CellRenderer;
2122 import org.opengion.hayabusa.db.DBColumn;
@@ -24,6 +25,9 @@
2425 * RICHLABEL レンデラは、特殊文字のエスケープを元に戻して表示する場合に
2526 * 使用するクラスです。
2627 * readonlyのテキストエリアでname属性は付けません。(データは送信されません)
28+ *
29+ * 属性値に1以上の数値を指定した場合はSLABELと同等の処理を行います。
30+ * その際に、有効なタグについては除外して表示します。(一覧表示用)
2731 *
2832 * カラムの表示に必要な属性は, DBColumn オブジェクト より取り出します。
2933 * このクラスは、DBColumn オブジェクト毎に1つ作成されます。
@@ -44,11 +48,43 @@
4448
4549 // 2018/06/28 MODIFY pre,img,table,thead,tbody,tr,th,td,ul,li,h[数値]を追加
4650 private static final String ignoreStr = "strong|font|a|br|p|span|div|pre|img|table|thead|tbody|tr|th|td|ul|li|h\\d";
51+ private final int cutSize;
4752
4853 /**
54+ * デフォルトコンストラクタ
55+ *
56+ * @og.rev 5.10.4.2 (2018/10/19) 出力文字数指定対応
57+ */
58+ public Renderer_RICHLABEL() {
59+ cutSize = 0; // oota tmp add
60+ }
61+
62+ // oota tmp add start
63+ /**
64+ * デフォルトコンストラクタ
65+ *
66+ * @og.rev 5.10.4.2 (2018/10/19) 出力文字数指定対応
67+ * @param clm
68+ */
69+ public Renderer_RICHLABEL(final DBColumn clm) {
70+ String param = clm.getRendererParam();
71+ int i;
72+ try {
73+ i = Integer.parseInt( param );
74+ }
75+ catch( Exception e) {
76+ i = 0;
77+ }
78+ cutSize = i;
79+ }
80+ // oota tmp add end
81+
82+ /**
4983 * 各オブジェクトから自分のインスタンスを返します。
5084 * 自分自身をキャッシュするのか、新たに作成するのかは、各サブクラスの実装に
5185 * まかされます。
86+ *
87+ * @og.rev 5.10.4.2 (2018/10/19) 出力文字数指定対応
5288 *
5389 * @param clm DBColumnオブジェクト
5490 *
@@ -55,11 +91,20 @@
5591 * @return CellEditorオブジェクト
5692 */
5793 public CellRenderer newInstance( final DBColumn clm ) {
58- return dbCell;
94+ // return dbCell;
95+ String param = clm.getRendererParam();
96+
97+ if( param != null && param.length() > 0 ) {
98+ return new Renderer_RICHLABEL(clm);
99+ }else {
100+ return dbCell;
101+ }
59102 }
60103
61104 /**
62105 * データの表示用文字列を返します。
106+ *
107+ * @og.rev 5.10.4.2 (2018/10/19) 出力文字数指定対応
63108 *
64109 * @param value 入力値
65110 *
@@ -67,6 +112,54 @@
67112 */
68113 @Override
69114 public String getValue( final String value ) {
70- return StringUtil.escapeFilter(value,ignoreStr);
115+ // 通常
116+// return StringUtil.escapeFilter(value,ignoreStr);
117+
118+ // タグ情報を除去して、表示する
119+ String escapeStr = StringUtil.escapeFilter(value,ignoreStr);
120+ if(cutSize <= 0) {
121+ // paramが未設定(0以下)の場合は、リッチラベルをhtmlに表示する形式で返す。
122+ return escapeStr;
123+ }else {
124+ // paramに1以上の数値が設定されている場合、SLABELと同様の表示形式で返す。
125+ // 改行は改行コードに変換してお
126+ String trg = StringUtil.tagCut(
127+ escapeStr
128+ .replaceAll("(?i)<br[ /]*>",System.lineSeparator())
129+ );
130+
131+ // 簡易的処理。すべてが全角であっても、制限以内である。
132+ // 以下はSLABELと同様の計算式
133+ int len = trg.length();
134+ if( len*2 <= cutSize) { return trg; };
135+
136+ int byteSize = 0;
137+ int adrs;
138+ for( adrs=0; adrs<len && byteSize<cutSize; adrs++) {
139+ char ch = trg.charAt(adrs);
140+ if( ch <= 0x7f || ( ch >= 0xff61 && ch <= 0xff9f )) {
141+ byteSize ++;
142+ }else {
143+ byteSize += 2;
144+ }
145+ }
146+
147+ // 正確にカウントした結果、制限以内であったため。
148+ if( adrs==len && byteSize<=cutSize ) {
149+ return trg;
150+ }
151+ else if( byteSize>cutSize ) { // オーバーした場合
152+ adrs-- ;
153+ }
154+
155+ StringBuilder buf = new StringBuilder( HybsSystem.BUFFER_SMALL );
156+ buf.append("<span title=\"");
157+ buf.append( trg );
158+ buf.append("\">");
159+ buf.append(trg.substring(0,adrs));
160+ buf.append("...</span>");
161+
162+ return buf.toString();
163+ }
71164 }
72165 }
Afficher sur ancien navigateur de dépôt.