IDEMPIERE-5342 : Ability to hide the title of the chart when displaye… (#1392)

* IDEMPIERE-5342 : Ability to hide the title of the chart when displayed on Home page
This commit is contained in:
Nicolas Micoud 2022-07-21 14:09:11 +02:00 committed by GitHub
parent 9a977d6e16
commit 58027792d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 141 additions and 13 deletions

View File

@ -0,0 +1,46 @@
-- IDEMPIERE-5342
SELECT register_migration_script('202207121657_IDEMPIERE-5342.sql') FROM dual;
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Jul 12, 2022, 4:57:32 PM CEST
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203626,0,0,'Y',TO_TIMESTAMP('2022-07-12 16:57:32','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-07-12 16:57:32','YYYY-MM-DD HH24:MI:SS'),0,'IsShowTitle','Show Title','Show Title','D','bf9b4ad5-68c4-4836-8af0-c4ca689bcc05')
;
-- Jul 12, 2022, 4:58:05 PM CEST
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (215037,0,'Show Title',50010,'IsShowTitle','Y',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2022-07-12 16:58:04','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-07-12 16:58:04','YYYY-MM-DD HH24:MI:SS'),0,203626,'Y','N','D','N','N','N','Y','425d1cae-6c95-4eef-a27b-eef7e9106e48','Y',0,'N','N','N','N')
;
-- Jul 12, 2022, 4:58:09 PM CEST
ALTER TABLE PA_DashboardContent ADD IsShowTitle CHAR(1) DEFAULT 'Y' CHECK (IsShowTitle IN ('Y','N')) NOT NULL
;
-- Jul 12, 2022, 4:58:20 PM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (207125,'Show Title',50010,215037,'Y',1,210,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-07-12 16:58:20','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-07-12 16:58:20','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','d0316669-2559-4a19-9eb9-0f2a5c704c6e','Y',200,2,2)
;
-- Jul 12, 2022, 4:58:32 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-07-12 16:58:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=207125
;
-- Jul 12, 2022, 4:58:32 PM CEST
UPDATE AD_Field SET SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-07-12 16:58:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=56504
;
-- Jul 12, 2022, 4:58:32 PM CEST
UPDATE AD_Field SET SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-07-12 16:58:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=200268
;
-- Jul 12, 2022, 4:58:32 PM CEST
UPDATE AD_Field SET SeqNo=200, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-07-12 16:58:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=200260
;
-- Jul 12, 2022, 4:58:32 PM CEST
UPDATE AD_Field SET SeqNo=210, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-07-12 16:58:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=202286
;
-- Jul 12, 2022, 4:59:01 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Chart_ID@ > 0', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-07-12 16:59:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=207125
;

View File

@ -0,0 +1,43 @@
-- IDEMPIERE-5342
SELECT register_migration_script('202207121657_IDEMPIERE-5342.sql') FROM dual;
-- Jul 12, 2022, 4:57:32 PM CEST
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203626,0,0,'Y',TO_TIMESTAMP('2022-07-12 16:57:32','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-07-12 16:57:32','YYYY-MM-DD HH24:MI:SS'),0,'IsShowTitle','Show Title','Show Title','D','bf9b4ad5-68c4-4836-8af0-c4ca689bcc05')
;
-- Jul 12, 2022, 4:58:05 PM CEST
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (215037,0,'Show Title',50010,'IsShowTitle','Y',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2022-07-12 16:58:04','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-07-12 16:58:04','YYYY-MM-DD HH24:MI:SS'),0,203626,'Y','N','D','N','N','N','Y','425d1cae-6c95-4eef-a27b-eef7e9106e48','Y',0,'N','N','N','N')
;
-- Jul 12, 2022, 4:58:09 PM CEST
ALTER TABLE PA_DashboardContent ADD COLUMN IsShowTitle CHAR(1) DEFAULT 'Y' CHECK (IsShowTitle IN ('Y','N')) NOT NULL
;
-- Jul 12, 2022, 4:58:20 PM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (207125,'Show Title',50010,215037,'Y',1,210,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-07-12 16:58:20','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-07-12 16:58:20','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','d0316669-2559-4a19-9eb9-0f2a5c704c6e','Y',200,2,2)
;
-- Jul 12, 2022, 4:58:32 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-07-12 16:58:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=207125
;
-- Jul 12, 2022, 4:58:32 PM CEST
UPDATE AD_Field SET SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-07-12 16:58:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=56504
;
-- Jul 12, 2022, 4:58:32 PM CEST
UPDATE AD_Field SET SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-07-12 16:58:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=200268
;
-- Jul 12, 2022, 4:58:32 PM CEST
UPDATE AD_Field SET SeqNo=200, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-07-12 16:58:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=200260
;
-- Jul 12, 2022, 4:58:32 PM CEST
UPDATE AD_Field SET SeqNo=210, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-07-12 16:58:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=202286
;
-- Jul 12, 2022, 4:59:01 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Chart_ID@ > 0', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-07-12 16:59:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=207125
;

View File

@ -22,7 +22,7 @@ import org.compiere.util.KeyNamePair;
/** Generated Interface for PA_DashboardContent
* @author iDempiere (generated)
* @version Release 9
* @version Release 10
*/
public interface I_PA_DashboardContent
{
@ -271,6 +271,15 @@ public interface I_PA_DashboardContent
/** Get Show on Login */
public boolean isShowinLogin();
/** Column name IsShowTitle */
public static final String COLUMNNAME_IsShowTitle = "IsShowTitle";
/** Set Show Title */
public void setIsShowTitle (boolean IsShowTitle);
/** Get Show Title */
public boolean isShowTitle();
/** Column name Line */
public static final String COLUMNNAME_Line = "Line";

View File

@ -25,7 +25,7 @@ import org.compiere.util.KeyNamePair;
/** Generated Model for PA_DashboardContent
* @author iDempiere (generated)
* @version Release 9 - $Id$ */
* @version Release 10 - $Id$ */
@org.adempiere.base.Model(table="PA_DashboardContent")
public class X_PA_DashboardContent extends PO implements I_PA_DashboardContent, I_Persistent
{
@ -33,7 +33,7 @@ public class X_PA_DashboardContent extends PO implements I_PA_DashboardContent,
/**
*
*/
private static final long serialVersionUID = 20220116L;
private static final long serialVersionUID = 20220712L;
/** Standard Constructor */
public X_PA_DashboardContent (Properties ctx, int PA_DashboardContent_ID, String trxName)
@ -49,6 +49,8 @@ public class X_PA_DashboardContent extends PO implements I_PA_DashboardContent,
// N
setIsShowInDashboard (true);
// 'Y'
setIsShowTitle (true);
// Y
setName (null);
setPA_DashboardContent_ID (0);
} */
@ -68,6 +70,8 @@ public class X_PA_DashboardContent extends PO implements I_PA_DashboardContent,
// N
setIsShowInDashboard (true);
// 'Y'
setIsShowTitle (true);
// Y
setName (null);
setPA_DashboardContent_ID (0);
} */
@ -427,6 +431,28 @@ public class X_PA_DashboardContent extends PO implements I_PA_DashboardContent,
return false;
}
/** Set Show Title.
@param IsShowTitle Show Title
*/
public void setIsShowTitle (boolean IsShowTitle)
{
set_Value (COLUMNNAME_IsShowTitle, Boolean.valueOf(IsShowTitle));
}
/** Get Show Title.
@return Show Title */
public boolean isShowTitle()
{
Object oo = get_Value(COLUMNNAME_IsShowTitle);
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
*/

View File

@ -51,7 +51,8 @@ public interface IChartRendererService {
* @param width
* @param height
* @param chartModel
* @param showTitle
* @return true if render successfully
*/
public boolean renderChart(Component parent, int width, int height, ChartModel chartModel);
public boolean renderChart(Component parent, int width, int height, ChartModel chartModel, boolean showTitle);
}

View File

@ -53,10 +53,14 @@ import org.zkoss.zul.Imagemap;
*
* @param panel
* @param width
* @param height
* @param showTitle
*/
public void render(Component parent, int width, int height) {
public void render(Component parent, int width, int height, boolean showTitle) {
chartBuilder = new ChartBuilder(chartModel);
JFreeChart chart = chartBuilder.createChart();
if (!showTitle)
chart.setTitle("");
chart.getPlot().setForegroundAlpha(0.6f);
ChartRenderingInfo info = new ChartRenderingInfo();

View File

@ -169,10 +169,9 @@ public class ChartRendererServiceImpl implements IChartRendererService {
}
@Override
public boolean renderChart(Component parent, int width, int height,
ChartModel chartModel) {
public boolean renderChart(Component parent, int width, int height, ChartModel chartModel, boolean showTitle) {
ChartRenderer renderer = new ChartRenderer(chartModel.chart);
renderer.render(parent, width, height);
renderer.render(parent, width, height, showTitle);
return true;
}
}

View File

@ -553,7 +553,7 @@ public class DashboardController implements EventListener<Event> {
chartPanel.getChildren().clear();
ChartModel model = new ChartModel();
model.chart = chartModel;
renderChart(chartPanel, width, height, model);
renderChart(chartPanel, width, height, model, dc.isShowTitle());
}
});
}
@ -1125,10 +1125,10 @@ public class DashboardController implements EventListener<Event> {
}
}
private void renderChart(final Div chartPanel, int width, int height, ChartModel model) {
private void renderChart(final Div chartPanel, int width, int height, ChartModel model, boolean showTitle) {
List<IChartRendererService> list = Extensions.getChartRendererServices();
for (IChartRendererService renderer : list) {
if (renderer.renderChart(chartPanel, width, height, model))
if (renderer.renderChart(chartPanel, width, height, model, showTitle))
break;
}
}

View File

@ -85,7 +85,7 @@ public class WChartEditor extends WEditor
model.chart = chartModel;
List<IChartRendererService> list = Extensions.getChartRendererServices();
for (IChartRendererService renderer : list) {
if (renderer.renderChart(chartDiv, chartWidth, chartHeight, model))
if (renderer.renderChart(chartDiv, chartWidth, chartHeight, model, true))
break;
}
}
@ -175,7 +175,7 @@ public class WChartEditor extends WEditor
model.chart = chartModel;
List<IChartRendererService> list = Extensions.getChartRendererServices();
for (IChartRendererService renderer : list) {
if (renderer.renderChart(chartDiv, chartWidth, chartHeight, model))
if (renderer.renderChart(chartDiv, chartWidth, chartHeight, model, true))
break;
}
}