From f79fe64b6e3c9b5ce57275f5413a789f1b1836f7 Mon Sep 17 00:00:00 2001 From: Hyyan Abo Fakher Date: Tue, 5 May 2020 12:57:43 +0200 Subject: [PATCH] refactor!: deprecate `GxStatusBarComponentInterface.NAME()` BREAKING CHANGE: deprecate `GxStatusBarComponentInterface.NAME()` in favor of `GxStatusBarComponentInterface.getId()` --- GxStatusBar.bbj | 73 +++++++++++++++++++++++++++++-------- demo/Enhanced/Statusbar.bbj | 12 +++--- 2 files changed, 63 insertions(+), 22 deletions(-) diff --git a/GxStatusBar.bbj b/GxStatusBar.bbj index 09a6481e..f0a9a252 100644 --- a/GxStatusBar.bbj +++ b/GxStatusBar.bbj @@ -25,10 +25,19 @@ interface public GxStatusBarComponentInterface rem * Get the component name rem * rem * @returns BBjString the component name + rem * + rem * @deprecated use `getId()` instead rem */ method public static BBjString NAME() rem /** + rem * Get the component id + rem * + rem * @returns BBjString the component unique id + rem */ + + method public static BBjString getId() + rem /** rem * Set the component alignment rem * rem * @param BBjString alignment$ "right", "left" or "center" @@ -78,7 +87,7 @@ class public GxStatusBarComponent implements GxStatusBarComponentInterface declare JsonObject json! json! = new JsonObject() - json!.addProperty("statusPanel",#this!.NAME()) + json!.addProperty("statusPanel",#getId()) json!.addProperty("align",#getAlignment()) methodret json! methodend @@ -102,6 +111,12 @@ class public GxStatusBarSelectedRowCountComponent extends GxStatusBarComponent rem * {@inheritDoc} rem */ method public static BBjString NAME() + methodret GxStatusBarSelectedRowCountComponent.getId() + methodend + rem /** + rem * {@inheritDoc} + rem */ + method public static BBjString getId() methodret "agSelectedRowCountComponent" methodend @@ -124,6 +139,12 @@ class public GxStatusBarFilteredRowCountComponent extends GxStatusBarComponent rem * {@inheritDoc} rem */ method public static BBjString NAME() + methodret GxStatusBarFilteredRowCountComponent.getId() + methodend + rem /** + rem * {@inheritDoc} + rem */ + method public static BBjString getId() methodret "agFilteredRowCountComponent" methodend @@ -146,6 +167,12 @@ class public GxStatusBarTotalAndFilteredRowCountComponent extends GxStatusBarCom rem * {@inheritDoc} rem */ method public static BBjString NAME() + methodret GxStatusBarTotalAndFilteredRowCountComponent.getId() + methodend + rem /** + rem * {@inheritDoc} + rem */ + method public static BBjString getId() methodret "agTotalAndFilteredRowCountComponent" methodend @@ -168,6 +195,12 @@ class public GxStatusBarTotalRowCountComponent extends GxStatusBarComponent rem * {@inheritDoc} rem */ method public static BBjString NAME() + methodret GxStatusBarTotalRowCountComponent.getId() + methodend + rem /** + rem * {@inheritDoc} + rem */ + method public static BBjString getId() methodret "agTotalRowCountComponent" methodend @@ -201,6 +234,12 @@ class public GxStatusBarAggregationComponent extends GxStatusBarComponent rem * {@inheritDoc} rem */ method public static BBjString NAME() + methodret GxStatusBarAggregationComponent.getId() + methodend + rem /** + rem * {@inheritDoc} + rem */ + method public static BBjString getId() methodret "agAggregationComponent" methodend rem /** @@ -256,26 +295,28 @@ class public GxStatusBar rem * @param GxStatusBarComponentInterface component! a statusbar component rem */ method public void addComponent(GxStatusBarComponentInterface component!) - #Components!.put(component!.NAME(),component!) + #Components!.put(component!.getId(),component!) methodend rem /** rem * Get statusbar component rem * - rem * @param BBjString name! the component name + rem * @param BBjString id! The component id + rem * + rem * @return GxStatusBarComponentInterface The component instance rem */ - method public GxStatusBarComponentInterface getComponent(BBjString name!) + method public GxStatusBarComponentInterface getComponent(BBjString id!) declare auto GxStatusBarComponentInterface c! - c! = #Components!.get(name!) + c! = #Components!.get(id!) methodret c! methodend rem /** rem * Remove statusbar component rem * - rem * @param BBjString name! the component name + rem * @param BBjString id! The component id rem */ - method public void removeComponent(BBjString name!) - #Components!.remove(name!) + method public void removeComponent(BBjString id!) + #Components!.remove(id!) methodend rem /** rem * Remove statusbar component @@ -283,17 +324,17 @@ class public GxStatusBar rem * @param GxStatusBarComponentInterface component! a statusbar component rem */ method public void removeComponent(GxStatusBarComponentInterface component!) - #Components!.remove(component!.NAME()) + #Components!.remove(component!.getId()) methodend rem /** rem * Hide/show statusbar component rem * - rem * @param BBjString name! the component name + rem * @param BBjString id! The component id rem * @param BBjNumber visibility! 0 to hide component, 1 to show component rem */ - method public void setComponentVisibility(BBjString name! , BBjNumber visibility!) - scriptKey! = "$wnd.gw_setStatusbarComponentVisibility" + name! - #Widget!.getExecutor().execute(scriptKey!,"$wnd.gw_setStatusbarComponentVisibility('" + #Widget!.getGRIDID() + "','" + name! + "'," + str(visibility!) + ")") + method public void setComponentVisibility(BBjString id! , BBjNumber visibility!) + scriptKey! = "$wnd.gw_setStatusbarComponentVisibility" + id! + #Widget!.getExecutor().execute(scriptKey!,"$wnd.gw_setStatusbarComponentVisibility('" + #Widget!.getGRIDID() + "','" + id! + "'," + str(visibility!) + ")") methodend rem /** rem * Hide/show statusbar component @@ -302,7 +343,7 @@ class public GxStatusBar rem * @param BBjNumber visibility! 0 to hide component, 1 to show component rem */ method public void setComponentVisibility(GxStatusBarComponentInterface component! , BBjNumber visibility!) - #setComponentVisibility(component!.NAME() , visibility!) + #setComponentVisibility(component!.getId() , visibility!) methodend rem /** rem * Convert the statusbar into a parsable json string @@ -314,7 +355,7 @@ class public GxStatusBar defs! = new JsonArray() it! = #Components!.entrySet().iterator() - while it!.hasNext()=BBjAPI.TRUE + while it!.hasNext() = BBjAPI.TRUE defs!.add(it!.next().getValue().getAsJsonObject()) wend @@ -325,4 +366,4 @@ class public GxStatusBar methodret new Gson().toJson(json!) methodend -classend \ No newline at end of file +classend diff --git a/demo/Enhanced/Statusbar.bbj b/demo/Enhanced/Statusbar.bbj index 10b84678..a344823b 100644 --- a/demo/Enhanced/Statusbar.bbj +++ b/demo/Enhanced/Statusbar.bbj @@ -24,25 +24,25 @@ rem btn!.setCallback(BBjAPI.ON_BUTTON_PUSH,"onToggle") static! = wnd!.addStaticText(202,10,10,200,25,"Toggle Statusbar Components" , $0000$ ) totalRow! = wnd!.addCheckBox(203,10,30,200,22,"Total Row") totalRow!.setSelected(1) -totalRow!.setName(GxStatusBarTotalRowCountComponent.NAME()) +totalRow!.setName(GxStatusBarTotalRowCountComponent.getId()) totalRow!.setCallback(BBjAPI.ON_CHECK_OFF,"onToggle") totalRow!.setCallback(BBjAPI.ON_CHECK_ON,"onToggle") filteredRow! = wnd!.addCheckBox(204,10,50,200,22,"Filtered Row") filteredRow!.setSelected(1) -filteredRow!.setName(GxStatusBarFilteredRowCountComponent.NAME()) +filteredRow!.setName(GxStatusBarFilteredRowCountComponent.getId()) filteredRow!.setCallback(BBjAPI.ON_CHECK_OFF,"onToggle") filteredRow!.setCallback(BBjAPI.ON_CHECK_ON,"onToggle") totalAndFilteredRow! = wnd!.addCheckBox(205,10,70,200,22,"Total And Filtered Row") totalAndFilteredRow!.setSelected(1) -totalAndFilteredRow!.setName(GxStatusBarTotalAndFilteredRowCountComponent.NAME()) +totalAndFilteredRow!.setName(GxStatusBarTotalAndFilteredRowCountComponent.getId()) totalAndFilteredRow!.setCallback(BBjAPI.ON_CHECK_OFF,"onToggle") totalAndFilteredRow!.setCallback(BBjAPI.ON_CHECK_ON,"onToggle") selectedRow! = wnd!.addCheckBox(206,10,90,200,22,"Selected Row") selectedRow!.setSelected(1) -selectedRow!.setName(GxStatusBarSelectedRowCountComponent.NAME()) +selectedRow!.setName(GxStatusBarSelectedRowCountComponent.getId()) selectedRow!.setCallback(BBjAPI.ON_CHECK_OFF,"onToggle") selectedRow!.setCallback(BBjAPI.ON_CHECK_ON,"onToggle") @@ -79,10 +79,10 @@ onToggle: control! = event!.getControl() name$ = control!.getName() - visiblity! = iff(control!.isSelected() , 1 ,0) + visibility! = iff(control!.isSelected() , 1 ,0) statusbar! = grid!.getStatusbar() - statusbar!.setComponentVisibility(name$ , visiblity!) + statusbar!.setComponentVisibility(name$ , visibility!) return byebye: