IDEMPIERE-3073 improve set of max text lenght on grid panel / thanks to Eduardo Gil and Dirk Niemeyer

This commit is contained in:
Carlos Ruiz 2016-05-30 21:46:23 -05:00
parent eab2cc1612
commit 803979d925
4 changed files with 26 additions and 3 deletions

View File

@ -0,0 +1,11 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-3073 improve set of max text lenght on grid panel
-- May 23, 2016 5:02:39 PM CEST
INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200077,0,0,TO_DATE('2016-05-23 17:02:39','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2016-05-23 17:02:39','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','MAX_TEXT_LENGTH_ON_GRID_VIEW','60','Max length of a text in grid view after wihich it is cut off (IDEMPIERE-3073)','D','C','092aeedc-22d9-4a70-9c90-d27aa68d47e7')
;
SELECT register_migration_script('20160523170239_IDEMPIERE-3073.sql') FROM dual
;

View File

@ -0,0 +1,8 @@
-- IDEMPIERE-3073 improve set of max text lenght on grid panel
-- May 23, 2016 5:02:39 PM CEST
INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200077,0,0,TO_TIMESTAMP('2016-05-23 17:02:39','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2016-05-23 17:02:39','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','MAX_TEXT_LENGTH_ON_GRID_VIEW','60','Max length of a text in grid view after wihich it is cut off (IDEMPIERE-3073)','D','C','092aeedc-22d9-4a70-9c90-d27aa68d47e7')
;
SELECT register_migration_script('20160523170239_IDEMPIERE-3073.sql') FROM dual
;

View File

@ -39,10 +39,11 @@ import org.compiere.util.DisplayType;
*/
public class MSysConfig extends X_AD_SysConfig
{
/**
*
*/
private static final long serialVersionUID = 5139119853639605887L;
private static final long serialVersionUID = -2568590773996678544L;
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS";
@ -100,6 +101,7 @@ public class MSysConfig extends X_AD_SysConfig
public static final String MAIL_SEND_CREDENTIALS = "MAIL_SEND_CREDENTIALS";
public static final String MAX_ACTIVITIES_IN_LIST = "MAX_ACTIVITIES_IN_LIST";
public static final String MAX_RESULTS_PER_SEARCH_IN_DOCUMENT_CONTROLLER = "MAX_RESULTS_PER_SEARCH_IN_DOCUMENT_CONTROLLER";
public static final String MAX_TEXT_LENGTH_ON_GRID_VIEW = "MAX_TEXT_LENGTH_ON_GRID_VIEW";
public static final String MENU_INFOUPDATER_SLEEP_MS = "MENU_INFOUPDATER_SLEEP_MS";
public static final String MFG_ValidateCostsDifferenceOnCreate = "MFG_ValidateCostsDifferenceOnCreate";
public static final String MFG_ValidateCostsOnCreate = "MFG_ValidateCostsOnCreate";

View File

@ -42,6 +42,7 @@ import org.adempiere.webui.util.GridTabDataBinder;
import org.compiere.model.GridField;
import org.compiere.model.GridTab;
import org.compiere.model.MStyle;
import org.compiere.model.MSysConfig;
import org.compiere.model.X_AD_StyleLine;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
@ -82,7 +83,7 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
private static final String CELL_DIV_STYLE_ALIGN_CENTER = CELL_DIV_STYLE + "text-align:center; ";
private static final String CELL_DIV_STYLE_ALIGN_RIGHT = CELL_DIV_STYLE + "text-align:right; ";
private static final int MAX_TEXT_LENGTH = 60;
private static final int MAX_TEXT_LENGTH_DEFAULT = 60;
private GridTab gridTab;
private int windowNo;
private GridTabDataBinder dataBinder;
@ -306,6 +307,7 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
*/
private void setLabelText(String text, Label label) {
String display = text;
final int MAX_TEXT_LENGTH = MSysConfig.getIntValue(MSysConfig.MAX_TEXT_LENGTH_ON_GRID_VIEW,MAX_TEXT_LENGTH_DEFAULT,Env.getAD_Client_ID(Env.getCtx()));
if (text != null && text.length() > MAX_TEXT_LENGTH)
display = text.substring(0, MAX_TEXT_LENGTH - 3) + "...";
// since 5.0.8, the org.zkoss.zhtml.Text is encoded by default