From d9a35cc452a3e08a69f8cb1e7d40ace41b8bd7d5 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Wed, 10 Dec 2008 07:53:33 +0000 Subject: [PATCH] * Allow user to control the dashboard panel to be static or collapsible --- .../compiere/model/I_PA_DashboardContent.java | 73 ++++++++++++------- .../compiere/model/X_PA_DashboardContent.java | 26 +++++++ .../353_PA_DashboardContent_IsCollapsible.sql | 35 +++++++++ .../353_PA_DashboardContent_IsCollapsible.sql | 35 +++++++++ .../src/org/adempiere/webui/Desktop.java | 4 +- 5 files changed, 144 insertions(+), 29 deletions(-) create mode 100644 migration/352a-trunk/353_PA_DashboardContent_IsCollapsible.sql create mode 100644 migration/352a-trunk/postgresql/353_PA_DashboardContent_IsCollapsible.sql diff --git a/base/src/org/compiere/model/I_PA_DashboardContent.java b/base/src/org/compiere/model/I_PA_DashboardContent.java index e35945a562..ddb5481350 100644 --- a/base/src/org/compiere/model/I_PA_DashboardContent.java +++ b/base/src/org/compiere/model/I_PA_DashboardContent.java @@ -1,31 +1,22 @@ -/********************************************************************** - * This file is part of Adempiere ERP Bazaar * - * http://www.adempiere.org * - * * - * Copyright (C) Trifon Trifonov. * - * Copyright (C) Contributors * - * * - * This program is free software, you can redistribute it and/or * - * modify it under the terms of the GNU General Public License * - * as published by the Free Software Foundation, either version 2 * - * of the License, or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY, without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program, if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * - * MA 02110-1301, USA. * - * * - * Contributors: * - * - Trifon Trifonov (trifonnt@users.sourceforge.net) * - * * - * Sponsors: * - * - Company (http://www.site.com) * - **********************************************************************/ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. * + * This program is free software; + you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; + without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; + if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ package org.compiere.model; import java.math.BigDecimal; @@ -52,6 +43,19 @@ public interface I_PA_DashboardContent /** Load Meta Data */ + /** Column name AD_Org_ID */ + public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID"; + + /** Set Organization. + * Organizational entity within client + */ + public void setAD_Org_ID (int AD_Org_ID); + + /** Get Organization. + * Organizational entity within client + */ + public int getAD_Org_ID(); + /** Column name AD_Window_ID */ public static final String COLUMNNAME_AD_Window_ID = "AD_Window_ID"; @@ -102,6 +106,19 @@ public interface I_PA_DashboardContent /** Get HTML */ public String getHTML(); + /** Column name IsCollapsable */ + public static final String COLUMNNAME_IsCollapsable = "IsCollapsable"; + + /** Set Collapsable. + * Flag to indicate the state of dashboard panel (i.e. collapsable or static) + */ + public void setIsCollapsable (boolean IsCollapsable); + + /** Get Collapsable. + * Flag to indicate the state of dashboard panel (i.e. collapsable or static) + */ + public boolean isCollapsable(); + /** Column name Line */ public static final String COLUMNNAME_Line = "Line"; diff --git a/base/src/org/compiere/model/X_PA_DashboardContent.java b/base/src/org/compiere/model/X_PA_DashboardContent.java index 5bcc7d541b..e25e541fac 100644 --- a/base/src/org/compiere/model/X_PA_DashboardContent.java +++ b/base/src/org/compiere/model/X_PA_DashboardContent.java @@ -42,6 +42,8 @@ public class X_PA_DashboardContent extends PO implements I_PA_DashboardContent, super (ctx, PA_DashboardContent_ID, trxName); /** if (PA_DashboardContent_ID == 0) { + setIsCollapsable (true); +// Y setName (null); setPA_DashboardContent_ID (0); } */ @@ -165,6 +167,30 @@ public class X_PA_DashboardContent extends PO implements I_PA_DashboardContent, return (String)get_Value(COLUMNNAME_HTML); } + /** Set Collapsable. + @param IsCollapsable + Flag to indicate the state of dashboard panel (i.e. collapsable or static) + */ + public void setIsCollapsable (boolean IsCollapsable) + { + set_Value (COLUMNNAME_IsCollapsable, Boolean.valueOf(IsCollapsable)); + } + + /** Get Collapsable. + @return Flag to indicate the state of dashboard panel (i.e. collapsable or static) + */ + public boolean isCollapsable () + { + Object oo = get_Value(COLUMNNAME_IsCollapsable); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + /** Set Line No. @param Line Unique line for this document diff --git a/migration/352a-trunk/353_PA_DashboardContent_IsCollapsible.sql b/migration/352a-trunk/353_PA_DashboardContent_IsCollapsible.sql new file mode 100644 index 0000000000..0aa8a59c4e --- /dev/null +++ b/migration/352a-trunk/353_PA_DashboardContent_IsCollapsible.sql @@ -0,0 +1,35 @@ +-- Dec 10, 2008 3:05:18 PM SGT +-- Allow user to control the dashboard panel to be static or collapsible +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,Help,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,53715,0,'IsCollapsible',TO_DATE('2008-12-10 15:05:17','YYYY-MM-DD HH24:MI:SS'),100,'Flag to indicate the state of the dashboard panel','D','Flag to indicate the state of the dashboard panel (i.e. collapsible or static)','Y','Collapsible','Collapsible',TO_DATE('2008-12-10 15:05:17','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Dec 10, 2008 3:05:19 PM SGT +-- Allow user to control the dashboard panel to be static or collapsible +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53715 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Dec 10, 2008 3:05:44 PM SGT +-- Allow user to control the dashboard panel to be static or collapsible +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,56522,53715,0,20,50010,'IsCollapsible',TO_DATE('2008-12-10 15:05:40','YYYY-MM-DD HH24:MI:SS'),100,'Y','Flag to indicate the state of the dashboard panel','D',1,'Flag to indicate the state of the dashboard panel (i.e. collapsible or static)','Y','Y','N','N','N','N','N','Y','N','N','N','N','Y','Collapsible',0,TO_DATE('2008-12-10 15:05:40','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Dec 10, 2008 3:05:44 PM SGT +-- Allow user to control the dashboard panel to be static or collapsible +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=56522 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Dec 10, 2008 3:05:47 PM SGT +-- Allow user to control the dashboard panel to be static or collapsible +ALTER TABLE PA_DashboardContent ADD IsCollapsible CHAR(1) DEFAULT 'Y' CHECK (IsCollapsible IN ('Y','N')) NOT NULL +; + +-- Dec 10, 2008 3:06:04 PM SGT +-- Allow user to control the dashboard panel to be static or collapsible +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,56522,56504,0,50010,TO_DATE('2008-12-10 15:06:00','YYYY-MM-DD HH24:MI:SS'),100,'Flag to indicate the state of the dashboard panel',1,'D','Flag to indicate the state of the dashboard panel (i.e. collapsible or static)','Y','Y','Y','N','N','N','N','N','Collapsible',TO_DATE('2008-12-10 15:06:00','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Dec 10, 2008 3:06:04 PM SGT +-- Allow user to control the dashboard panel to be static or collapsible +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56504 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + diff --git a/migration/352a-trunk/postgresql/353_PA_DashboardContent_IsCollapsible.sql b/migration/352a-trunk/postgresql/353_PA_DashboardContent_IsCollapsible.sql new file mode 100644 index 0000000000..f6792afc33 --- /dev/null +++ b/migration/352a-trunk/postgresql/353_PA_DashboardContent_IsCollapsible.sql @@ -0,0 +1,35 @@ +-- Dec 10, 2008 3:05:19 PM SGT +-- Allow user to control the dashboard panel to be static or collapsible +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,Help,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,53715,0,'IsCollapsible',TO_TIMESTAMP('2008-12-10 15:05:17','YYYY-MM-DD HH24:MI:SS'),100,'Flag to indicate the state of the dashboard panel','D','Flag to indicate the state of the dashboard panel (i.e. collapsible or static)','Y','Collapsible','Collapsible',TO_TIMESTAMP('2008-12-10 15:05:17','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Dec 10, 2008 3:05:19 PM SGT +-- Allow user to control the dashboard panel to be static or collapsible +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53715 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Dec 10, 2008 3:05:44 PM SGT +-- Allow user to control the dashboard panel to be static or collapsible +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,56522,53715,0,20,50010,'IsCollapsible',TO_TIMESTAMP('2008-12-10 15:05:40','YYYY-MM-DD HH24:MI:SS'),100,'Y','Flag to indicate the state of the dashboard panel','D',1,'Flag to indicate the state of the dashboard panel (i.e. collapsible or static)','Y','Y','N','N','N','N','N','Y','N','N','N','N','Y','Collapsible',0,TO_TIMESTAMP('2008-12-10 15:05:40','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Dec 10, 2008 3:05:44 PM SGT +-- Allow user to control the dashboard panel to be static or collapsible +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=56522 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Dec 10, 2008 3:05:47 PM SGT +-- Allow user to control the dashboard panel to be static or collapsible +ALTER TABLE PA_DashboardContent ADD COLUMN IsCollapsible CHAR(1) DEFAULT 'Y' CHECK (IsCollapsible IN ('Y','N')) NOT NULL +; + +-- Dec 10, 2008 3:06:04 PM SGT +-- Allow user to control the dashboard panel to be static or collapsible +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,56522,56504,0,50010,TO_TIMESTAMP('2008-12-10 15:06:00','YYYY-MM-DD HH24:MI:SS'),100,'Flag to indicate the state of the dashboard panel',1,'D','Flag to indicate the state of the dashboard panel (i.e. collapsible or static)','Y','Y','Y','N','N','N','N','N','Collapsible',TO_TIMESTAMP('2008-12-10 15:06:00','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Dec 10, 2008 3:06:04 PM SGT +-- Allow user to control the dashboard panel to be static or collapsible +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56504 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/Desktop.java b/zkwebui/WEB-INF/src/org/adempiere/webui/Desktop.java index ab5e1e8fcc..f3ec2b5488 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/Desktop.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/Desktop.java @@ -232,7 +232,9 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl if(description != null) panel.setTooltiptext(description); - panel.setCollapsible(true); + boolean collapsible = rs.getString(X_PA_DashboardContent.COLUMNNAME_IsCollapsable).equals("Y"); + panel.setCollapsible(collapsible); + panel.setBorder("normal"); portalchildren.appendChild(panel); Panelchildren content = new Panelchildren();