From 2a11a7f38d74996ab5e591199eecabb6aed71e9c Mon Sep 17 00:00:00 2001 From: Stephan Wald Date: Sun, 20 Oct 2019 12:25:00 +0200 Subject: [PATCH] fix: Rename Enterprise demo folder to Enhanced to match corporate naming convention --- demo/Enterprise/AggregationDemo.bbj | 96 ---------- demo/Enterprise/ChartingDemo.bbj | 128 -------------- demo/Enterprise/ContextMenuDemo.bbj | 121 ------------- demo/Enterprise/PivotDemo.bbj | 69 -------- demo/Enterprise/RangeSelectionDemo.bbj | 232 ------------------------- demo/Enterprise/RowGroupingDemo.bbj | 97 ----------- demo/Enterprise/SidebarDemo.bbj | 99 ----------- demo/Enterprise/StatusbarDemo.bbj | 89 ---------- demo/Enterprise/TreeDataDemo.bbj | 126 -------------- 9 files changed, 1057 deletions(-) delete mode 100644 demo/Enterprise/AggregationDemo.bbj delete mode 100644 demo/Enterprise/ChartingDemo.bbj delete mode 100644 demo/Enterprise/ContextMenuDemo.bbj delete mode 100644 demo/Enterprise/PivotDemo.bbj delete mode 100644 demo/Enterprise/RangeSelectionDemo.bbj delete mode 100644 demo/Enterprise/RowGroupingDemo.bbj delete mode 100644 demo/Enterprise/SidebarDemo.bbj delete mode 100644 demo/Enterprise/StatusbarDemo.bbj delete mode 100644 demo/Enterprise/TreeDataDemo.bbj diff --git a/demo/Enterprise/AggregationDemo.bbj b/demo/Enterprise/AggregationDemo.bbj deleted file mode 100644 index 42746e67..00000000 --- a/demo/Enterprise/AggregationDemo.bbj +++ /dev/null @@ -1,96 +0,0 @@ -rem /** -rem * This file is part of the BBjGridExWidget plugin. -rem * (c) Basis Europe -rem * -rem * For the full copyright and license information, please view the LICENSE -rem * file that was distributed with this source code. -rem */ -use ::BBjGridExWidget/BBjGridExWidget.bbj::BBjGridExWidget -use ::BBjGridExWidget/BBjGridExWidgetRenderers.bbj::BBjGridExWidgetRendererGroupCellRenderer -use ::BBjGridExWidget/BBjGridExWidgetExpressions.bbj::BBjGridExWidgetExpression -use ::BBjGridExWidget/Demo/assets/Utilities.bbj::BBjGridExWidgetDemoUtilities -use com.basiscomponents.bc.SqlQueryBC -use java.sql.Types -use com.google.gson.JsonObject - -? 'HIDE' - -BBjGridExWidgetDemoUtilities.nagAboutLicense() - -declare auto BBjTopLevelWindow wnd! -declare BBjGridExWidget grid! - -wnd! = BBjAPI().openSysGui("X0").addWindow(10,10,800,600,"BBj Grid Ex Demo") -wnd! .setCallback(BBjAPI.ON_CLOSE,"byebye") -wnd! .setCallback(BBjAPI.ON_RESIZE,"resize") - -cb! = wnd!.addCheckBox(203,12,10,200,22,"Enable Read Only Mode") -cb!.setCallback(BBjAPI.ON_CHECK_OFF,"onUseCheckbox") -cb!.setCallback(BBjAPI.ON_CHECK_ON,"onUseCheckbox") - -grid! = new BBjGridExWidget(wnd!,100,0,40,800,560) -grid!.getOptions().setGroupIncludeFooter(1) -grid!.getOptions().setGroupIncludeTotalFooter(1) -grid!.getOptions().setRowGroupPanelShow(grid!.GRID_GROUPPANEL_SHOW_VISIBLE()) - -gosub main -process_events - -rem /** -rem * Retrieve the data from the database and configure the grid -rem */ -main: - declare SqlQueryBC sbc! - sbc! = new SqlQueryBC(BBjAPI().getJDBCConnection("CDStore")) - rs! = sbc!.retrieve("SELECT LABEL , MUSICTYPE , PLAYINGTIME , COST FROM CDINVENTORY") - - grid!.setData(rs!) - - rem Group rows by music type - type! = grid!.getColumn("MUSICTYPE") - type!.setRowGroup(1) - - rem aggregate on playingtime - time! = grid!.getColumn("PLAYINGTIME") - time!.setEnableValue(1) - time!.setAggFunc("sum") - rem /** - rem * playingtime is a column of type string. in this case the sum agg function will not work - rem * So we setup up a value getter expression to convert the column values to numbers whenever - rem * the grid tries to aggregate on this column. - rem */ - time!.setValueGetterExpression("data ? Number(data.PLAYINGTIME) : null") - - rem aggregate on cost - cost! = grid!.getColumn("COST") - cost!.getValueFormatterExpression().setMask("### ##0.00") - cost!.setEnableValue(1) - cost!.setAggFunc("sum") -return - -rem /** -rem * Enable / disable functions (agg , row grouping , ...) -rem */ -onUseCheckbox: - useCheckbox! = cb!.isSelected() - grid!.setFunctionsReadOnly(useCheckbox!) -return - -rem /** -rem * Listen to the BBjTopLevelWindow resize events and -rem * resize the grid to fill the available space. -rem */ -resize: - ev! = BBjAPI().getLastEvent() - w=ev!.getWidth() - h=ev!.getHeight() - grid!.setSize(w,h - 40) -return - -rem /** -rem * Close the demo -rem */ -byebye: -bye - - diff --git a/demo/Enterprise/ChartingDemo.bbj b/demo/Enterprise/ChartingDemo.bbj deleted file mode 100644 index e4b227c3..00000000 --- a/demo/Enterprise/ChartingDemo.bbj +++ /dev/null @@ -1,128 +0,0 @@ -rem /** -rem * This file is part of the BBjGridExWidget plugin. -rem * (c) Basis Europe -rem * -rem * For the full copyright and license information, please view the LICENSE -rem * file that was distributed with this source code. -rem */ -use ::BBjGridExWidget/BBjGridExWidget.bbj::BBjGridExWidget -use ::BBjGridExWidget/BBjGridExWidgetClientModels.bbj::BBjGridExWidgetClientAddRangeChartModel -use ::BBjGridExWidget/BBjGridExWidgetClientModels.bbj::BBjGridExWidgetClientAddRangeSelectionModel -use ::BBjGridExWidget/BBjGridExWidgetContextMenu.bbj::BBjGridContextMenuItem -use ::BBjGridExWidget/Demo/assets/Utilities.bbj::BBjGridExWidgetDemoUtilities -use com.basiscomponents.db.ResultSet -use com.basiscomponents.bc.SqlQueryBC -use java.util.ArrayList -use java.util.Collections -use java.util.Random - -? 'HIDE' - -BBjGridExWidgetDemoUtilities.nagAboutLicense() - -declare auto BBjTopLevelWindow wnd! - -wnd! = BBjAPI().openSysGui("X0").addWindow(10,10,800,600,"BBj Grid Range Selection Demo") -wnd!.setCallback(BBjAPI.ON_CLOSE,"byebye") -wnd!.setCallback(BBjAPI.ON_RESIZE,"resize") - -onRandomChart! = wnd!.addButton(99,10,10,150,25,"Build Random Chart") -onRandomChart!.setCallback(BBjAPI.ON_BUTTON_PUSH,"onRandomChart") - -gosub main -process_events - -rem /** -rem * Retrieve the data from the database and configure the grid -rem */ -main: - declare BBjGridExWidget grid! - declare SqlQueryBC sbc! - declare ResultSet rs! - - sbc! = new SqlQueryBC(BBjAPI().getJDBCConnection("CDStore")) - rs! = sbc!.retrieve("SELECT ARTIST , MUSICTYPE , COST , RETAIL , PLAYINGTIME FROM CDINVENTORY") - - grid! = new BBjGridExWidget(wnd!,101, 0 , 50 , 800 , 550) - - REM we start by enabling the charts feature - grid!.getOptions().setEnableCharts(1) - - REM Set to true to enable Range Selection - grid!.getOptions().setEnableRangeSelection(1) - - REM Allow users to move between cells using arrow keys instead of rows - grid!.getOptions().setNavigationBehavior(grid!.GRID_NAVIGATION_BEHAVIOUR_NEXT_CELL()) - - REM Disable row selection on row click - grid!.getOptions().setSuppressRowClickSelection(1) - - REM Enable User Charts (allow uses to create charts by selecting a range) - grid!.getContextMenu().addItem(BBjGridContextMenuItem.CHART_RANGE()) - - REM Here we add a range selection to the grid by defining the columns which are included - REM in the range and the start and end row's index/id - - declare BBjGridExWidgetClientAddRangeChartModel chart! - rem /** - rem * In Order to create a chart , we need to setup an addRangeChartModel. - rem * The models requires the chart type to create and a range selection model - rem * - rem * Note how we are using a bounded range selection in this demo. Ranges are normally bounded by a start and end row. - rem * However it is also possible to define a range unbounded by rows (ie to contain all rows). - rem * For an unbounded range, do not provided start or end row positions. - rem */ - chart! = new BBjGridExWidgetClientAddRangeChartModel() - chart!.setRangeSelection(grid!.addRangeSelection("MUSICTYPE,COST" , 0 , 8)) - chart!.setType(BBjGridExWidgetClientAddRangeChartModel.TYPE_GROUPEDCOLUMN()) - chart!.setAggregate(1) - grid!.addRangeChart(chart!) - - rem /** - rem * You can add / remove items to the chart toolbar - rem * - rem * @see BBjGridExWidget.CHART_TOOLBAR_SETTINGS() - rem * @see BBjGridExWidget.CHART_TOOLBAR_DATA() - rem * @see BBjGridExWidget.CHART_TOOLBAR_FORMAT() - rem * @see BBjGridExWidget.CHART_TOOLBAR_DOWNLOAD() - rem */ - grid!.addChartToolbarItem(BBjGridExWidget.CHART_TOOLBAR_DOWNLOAD()) - - grid!.setFitToGrid() - grid!.getSidebar().setHiddenByDefault(1) - - grid!.setData(rs!) - - REM align columns of type number to the right to get better presentation - grid!.getColumn("COST").setAlignment(BBjGridExWidget.GRID_ALIGN_RIGHT() , 1) - grid!.getColumn("RETAIL").setAlignment(BBjGridExWidget.GRID_ALIGN_RIGHT() , 1) - grid!.getColumn("PLAYINGTIME").setAlignment(BBjGridExWidget.GRID_ALIGN_RIGHT() , 1) -return - -rem /** -rem * Add a random chart model -rem */ -onRandomChart: - REM clear all charts - grid!.clearChart() - - chart!.setRangeSelection(grid!.addRangeSelection("MUSICTYPE,COST" , rnd(20) , rnd(20))) - grid!.addRangeChart(chart!) -return - -rem /** -rem * Listen to the BBjTopLevelWindow resize events and -rem * resize the grid to fill the available space. -rem */ -resize: - ev! = BBjAPI().getLastEvent() - w=ev!.getWidth() - h=ev!.getHeight() - grid!.setSize(w,h - 50) -return - -rem /** -rem * Close the demo -rem */ -byebye: -bye \ No newline at end of file diff --git a/demo/Enterprise/ContextMenuDemo.bbj b/demo/Enterprise/ContextMenuDemo.bbj deleted file mode 100644 index 7c3fc121..00000000 --- a/demo/Enterprise/ContextMenuDemo.bbj +++ /dev/null @@ -1,121 +0,0 @@ -rem /** -rem * This file is part of the BBjGridExWidget plugin. -rem * (c) Basis Europe -rem * -rem * For the full copyright and license information, please view the LICENSE -rem * file that was distributed with this source code. -rem */ -use ::BBjGridExWidget/BBjGridExWidget.bbj::BBjGridExWidget -use ::BBjGridExWidget/BBjGridExWidgetContextMenu.bbj::BBjGridContextMenu -use ::BBjGridExWidget/BBjGridExWidgetContextMenu.bbj::BBjGridContextMenuItem -use ::BBjGridExWidget/Demo/assets/Utilities.bbj::BBjGridExWidgetDemoUtilities -use com.basiscomponents.db.ResultSet -use com.basiscomponents.bc.SqlQueryBC - -? 'HIDE' - -BBjGridExWidgetDemoUtilities.nagAboutLicense() - -declare auto BBjTopLevelWindow wnd! -declare BBjGridExWidget grid! - -wnd! = BBjAPI().openSysGui("X0").addWindow(10,10,800,600,"BBj Grid Ex Demo") -wnd!.setCallback(BBjAPI.ON_CLOSE,"byebye") -wnd!.setCallback(BBjAPI.ON_RESIZE,"resize") - -gosub main -process_events - -rem /** -rem * Retrieve the data from the database and configure the grid -rem */ -main: - declare SqlQueryBC sbc! - declare ResultSet rs! - - sbc! = new SqlQueryBC(BBjAPI().getJDBCConnection("ChileCompany")) - rs! = sbc!.retrieve("SELECT * FROM CUSTOMER") - - rem /** - rem * Create a new context menu to attach to the grid - rem */ - menu! = new BBjGridContextMenu() - - rem /** - rem * Add some predefined items with their actions to the menu - rem * @see BBjGridContextMenuItem - rem */ - menu!.addItem(BBjGridContextMenuItem.AUTO_SIZE_ALL()) - menu!.addItem(BBjGridContextMenuItem.RESET_COLUMNS()) - menu!.addItem(BBjGridContextMenuItem.EXPORT()) - menu!.addItem(BBjGridContextMenuItem.SEPARATOR()) - - rem /** - rem * Create custom menu items - rem * - rem * Any custom menu item requires two params , an id (used for handling events) and a label - rem * When the item is clicked on the client , the client will notify the grid with an event - rem * using the chosen id so you can use the grid's setCallback method to handle the event - rem */ - - direction! = new BBjGridContextMenuItem(6000,"Show Direction") - direction!.setIcon("http://icons.iconarchive.com/icons/papirus-team/papirus-apps/256/maps-icon.png" , 20 , 20) - direction!.setTooltip("Open the location in Google Maps") - menu!.addItem(direction!) - - namepedia! = new BBjGridContextMenuItem(6001,"Search Firstname in Namepedia") - namepedia!.setIcon("http://icons.iconarchive.com/icons/papirus-team/papirus-apps/256/godot-icon.png" , 20 , 20) - namepedia!.setTooltip("Search First Name in Namepedia") - menu!.addItem(namepedia!) - - menu!.addItem(BBjGridContextMenuItem.SEPARATOR()) - - copy! = new BBjGridContextMenuItem(6002,"Copy Functions") - submenu! = new BBjGridContextMenu() - submenu!.addItem(BBjGridContextMenuItem.COPY()) - submenu!.addItem(BBjGridContextMenuItem.COPY_WITH_HEADERS()) - copy!.setSubMenu(submenu!) - menu!.addItem(copy!) - - rem /** - rem * init the grid and attache the menu items callbacks - rem */ - grid! = new BBjGridExWidget(wnd!,100,0,0,800,600) - grid!.getOptions().setContextMenu(menu!) - grid!.setData(rs!) - grid!.setCallback(6000,"onShowDirection") - grid!.setCallback(6001,"onShowFirstName") -return - -onShowDirection: - ev! = BBjAPI().getLastEvent() - ev! = ev!.getObject() - row! = ev!.getRow().asDataRow() - url$ = "https://www.google.com/maps/search/?api=1&query=" + java.net.URLEncoder.encode(row!.getFieldAsString("BILL_ADDR1").trim() + "," + row!.getFieldAsString("COUNTRY").trim()) - BBjAPI().getThinClient().browse(url$) -return - -onShowFirstName: - ev! = BBjAPI().getLastEvent() - ev! = ev!.getObject() - row! = ev!.getRow().asDataRow() - url$ = "http://www.namepedia.org/en/firstname/?q="+java.net.URLEncoder.encode(row!.getFieldAsString("FIRST_NAME").trim()) - BBjAPI().getThinClient().browse(url$) -return - -rem /** -rem * Listen to the BBjTopLevelWindow resize events and -rem * resize the grid to fill the available space. -rem */ -resize: - ev! = BBjAPI().getLastEvent() - w=ev!.getWidth() - h=ev!.getHeight() - grid!.setSize(w,h) -return - -rem /** -rem * Close the demo -rem */ -byebye: -bye \ No newline at end of file diff --git a/demo/Enterprise/PivotDemo.bbj b/demo/Enterprise/PivotDemo.bbj deleted file mode 100644 index 30d1c021..00000000 --- a/demo/Enterprise/PivotDemo.bbj +++ /dev/null @@ -1,69 +0,0 @@ -rem /** -rem * This file is part of the BBjGridExWidget plugin. -rem * (c) Basis Europe -rem * -rem * For the full copyright and license information, please view the LICENSE -rem * file that was distributed with this source code. -rem */ -use ::BBjGridExWidget/BBjGridExWidget.bbj::BBjGridExWidget -use ::BBjGridExWidget/BBjGridExWidgetSidebar.bbj::BBjGridExWidgetColumnsToolpanel -use ::BBjGridExWidget/Demo/assets/Utilities.bbj::BBjGridExWidgetDemoUtilities -use com.basiscomponents.db.ResultSet -use com.basiscomponents.bc.SqlQueryBC - -? 'HIDE' - -BBjGridExWidgetDemoUtilities.nagAboutLicense() - -declare auto BBjTopLevelWindow wnd! -declare BBjGridExWidget grid! - -wnd! = BBjAPI().openSysGui("X0").addWindow(10,10,800,600,"Simple CD-Store Demo") -wnd!.setCallback(BBjAPI.ON_CLOSE,"byebye") -wnd!.setCallback(BBjAPI.ON_RESIZE,"resize") - - -REM init the grid -grid! = new BBjGridExWidget(wnd!,100,0,0,800,600) - -gosub main -process_events - -rem /** -rem * Retrieve the data from the database and configure the grid -rem */ -main: - declare SqlQueryBC sbc! - declare ResultSet rs! - - sbc! = new SqlQueryBC(BBjAPI().getJDBCConnection("CDStore")) - rs! = sbc!.retrieve("SELECT * FROM CDINVENTORY") - grid!.setData(rs!) - - grid!.setColumnMask("COST","### ##0.00") - grid!.setColumnAggFunc("COST","sum") - - grid!.setPivotMode(1) - grid!.addRowGroupColumns("LABEL") - grid!.addPivotColumns("MUSICTYPE") - grid!.addValueColumns("COST") - - grid!.getSidebar().openToolpanel(BBjGridExWidgetColumnsToolpanel.ID()) -return - -rem /** -rem * Listen to the BBjTopLevelWindow resize events and -rem * resize the grid to fill the available space. -rem */ -resize: - ev! = BBjAPI().getLastEvent() - w=ev!.getWidth() - h=ev!.getHeight() - grid!.setSize(w,h) -return - -rem /** -rem * Close the demo -rem */ -byebye: -bye \ No newline at end of file diff --git a/demo/Enterprise/RangeSelectionDemo.bbj b/demo/Enterprise/RangeSelectionDemo.bbj deleted file mode 100644 index 71de7b00..00000000 --- a/demo/Enterprise/RangeSelectionDemo.bbj +++ /dev/null @@ -1,232 +0,0 @@ -rem /** -rem * This file is part of the BBjGridExWidget plugin. -rem * (c) Basis Europe -rem * -rem * For the full copyright and license information, please view the LICENSE -rem * file that was distributed with this source code. -rem */ -use ::BBjGridExWidget/BBjGridExWidget.bbj::BBjGridExWidget -use ::BBjGridExWidget/BBjGridExWidgetStatusBar.bbj::BBjGridExWidgetStatusBarAggregationComponent -use ::BBjGridExWidget/BBjGridExWidgetClientModels.bbj::BBjGridExWidgetClientRangeSelectionModel -use ::BBjGridExWidget/BBjGridExWidgetClientModels.bbj::BBjGridExWidgetClientColumnModel -use ::BBjGridExWidget/BBjGridExWidgetClientModels.bbj::BBjGridExWidgetClientAddRangeSelectionModel -use ::BBjGridExWidget/Demo/assets/Utilities.bbj::BBjGridExWidgetDemoUtilities -use com.basiscomponents.db.ResultSet -use com.basiscomponents.bc.SqlQueryBC -use java.sql.Types -use java.util.ArrayList -use java.util.Collections -use java.util.Random - -? 'HIDE' - -BBjGridExWidgetDemoUtilities.nagAboutLicense() - -declare auto BBjTopLevelWindow wnd! - -wnd! = BBjAPI().openSysGui("X0").addWindow(10,10,800,600,"BBj Grid Range Selection Demo") -wnd!.setCallback(BBjAPI.ON_CLOSE,"byebye") -wnd!.setCallback(BBjAPI.ON_RESIZE,"resize") - -aggTemplate! = "Average : %s - Count : %s - Min : %s - Max : %s - Sum : %s" - -statusbar! = wnd!.addStatusBar(98,$8000$) -vector! = bbjapi().makeVector() -vector!.add(150) -vector!.add(65535) -statusbar!.setSegments(vector!) -statusbar!.setTextAt(0, "Aggregation done with BBj") -statusbar!.setAlignmentAt(0,statusbar!.LEFT) -statusbar!.setTextAt(1, String.format(aggTemplate!,0,0,0,0,0)) -statusbar!.setAlignmentAt(1,statusbar!.LEFT) - -onRandomRange! = wnd!.addButton(99,10,10,150,25,"Add Random Range") -onRandomRange!.setCallback(BBjAPI.ON_BUTTON_PUSH,"onRandomRange") - -clearRange! = wnd!.addButton(100,180,10,150,25,"Clear Ranges") -clearRange!.setCallback(BBjAPI.ON_BUTTON_PUSH,"onClearRange") - -gosub main -process_events - -rem /** -rem * Retrieve the data from the database and configure the grid -rem */ -main: - declare BBjGridExWidget grid! - declare SqlQueryBC sbc! - declare ResultSet rs! - - sbc! = new SqlQueryBC(BBjAPI().getJDBCConnection("CDStore")) - rs! = sbc!.retrieve("SELECT TITLE , COST , RETAIL , ONHAND FROM CDINVENTORY") - - grid! = new BBjGridExWidget(wnd!,101, 0 , 50 , 800 , 530) - - REM Set to true to enable Range Selection - grid!.getOptions().setEnableRangeSelection(1) - - REM Allow users to move between cells using arrow keys instead of rows - grid!.getOptions().setNavigationBehavior(grid!.GRID_NAVIGATION_BEHAVIOUR_NEXT_CELL()) - - REM Disable row selection on row click - grid!.getOptions().setSuppressRowClickSelection(1) - - REM Attach the aggregation component to the grid's built-in statusbar. - REM The component provides aggregations on the selected range. - grid!.getStatusbar().addComponent(new BBjGridExWidgetStatusBarAggregationComponent("right")) - - REM Here we add a range selection to the grid by defining the columns which are included - REM in the range and the start and end row's index/id - grid!.addRangeSelection("COST,RETAIL" , 2, 6) - - REM listen to the grid range selection event so we can build our own statusbar in BBj - grid!.setCallback(grid!.ON_GRID_RANGE_SELECTION_CHANGED(),"onRangeSelectionChange") - - grid!.setFitToGrid() - grid!.getSidebar().setHiddenByDefault(1) - - grid!.setData(rs!) - - REM align columns of type number to the right to get better presentation - grid!.getColumn("COST").setAlignment(BBjGridExWidget.GRID_ALIGN_RIGHT() , 1) - grid!.getColumn("RETAIL").setAlignment(BBjGridExWidget.GRID_ALIGN_RIGHT() , 1) - grid!.getColumn("ONHAND").setAlignment(BBjGridExWidget.GRID_ALIGN_RIGHT() , 1) -return - -rem /** -rem * The following code, will handle range selection changes and do the same calculation the grid does on the client -rem * but in BBj and then it displays the result in the BBj statusbar down the page. -rem * -rem * But note that It is always recommended to use the statusbar components BBjGridExWidgetStatusBarAggregationComponent -rem * which is shipped with the grid. This component will be much faster because it is handling the heavy logic on the client -rem * and it does not need to communicate with BBj to achieve its job. -rem */ -onRangeSelectionChange: - declare auto BBjGridExWidgetClientRangeSelectionModel currentRange! - declare auto BBjGridExWidgetClientColumnModel column! - - REM vector of ranges - ranges! = grid!.getRangeSelections() - - IF (ranges!.size() = 0) THEN - statusbar!.setTextAt(1, String.format(aggTemplate!,0,0,0,0,0)) - return - FI - - rangesLength! = ranges!.size() - 1 - sum! = 0 - count! = 0 - min! = 0 - max! = 0 - average! = 0 - values! = new ArrayList() - - rem we start by looping over all ranges - FOR rangeIndex! = 0 TO rangesLength! - - currentRange! = ranges!.get(rangeIndex!) - - rows! = currentRange!.getRows() - rowsLength! = rows!.size() - 1 - - columns! = currentRange!.getColumns() - columnsLength! = columns!.size() - 1 - - count! = count! + (columns!.size() * rows!.size()) - - FOR rowIndex! = 0 TO rowsLength! - FOR columnsIndex! = 0 TO columnsLength! - - column! = columns!.get(columnsIndex!) - type! = column!.getType() - - SWITCH (type!) - CASE Types.BIGINT - CASE Types.BIT - CASE Types.DECIMAL - CASE Types.DOUBLE - CASE Types.FLOAT - CASE Types.INTEGER - CASE Types.NUMERIC - CASE Types.NUMERIC - CASE Types.TINYINT - row! = rows!.get(rowIndex!).asDataRow() - value! = num(row!.getField(column!.getName()).getValue()) - sum! = sum! + value! - - values!.add(value!) - BREAK - CASE DEFAULT - BREAK - SWEND - - NEXT columnsIndex! - NEXT rowIndex! - - NEXT rangeIndex! - - IF (values!.size() > 0) THEN - min! = Collections.min(values!) - max! = Collections.max(values!) - average! = sum! / values!.size() - FI - - statusbar!.setTextAt(1, String.format(aggTemplate!, round(average!), count!, round(min!), round(max!), round(sum!))) -return - -rem /** -rem * Add a random add range model -rem */ -onRandomRange: - declare BBjGridExWidgetClientAddRangeSelectionModel addModel! - - REM list of columns which can be included in the range - columns! = new ArrayList() - columns!.add("COST") - columns!.add("RETAIL") - columns!.add("ONHAND") - - REM number of columns include with the random generated range - numberOfColumns! = rnd(3) - - rand! = new Random() - rangeColumns! = new ArrayList() - - FOR index = 0 TO numberOfColumns! - randomIndex! = rand!.nextInt(columns!.size()) - rangeColumns!.add(columns!.get(randomIndex!)) - columns!.remove(randomIndex!) - NEXT index - - addModel! = new BBjGridExWidgetClientAddRangeSelectionModel() - addModel!.setColumns(rangeColumns!) - addModel!.setStart(str(rnd(10))) - addModel!.setEnd(str(rnd(10))) - - grid!.clearRangeSelection() - grid!.addRangeSelection(addModel!) -return - -rem /** -rem * We clear all range selections -rem */ -onClearRange: - grid!.clearRangeSelection() -return - -rem /** -rem * Listen to the BBjTopLevelWindow resize events and -rem * resize the grid to fill the available space. -rem */ -resize: - ev! = BBjAPI().getLastEvent() - w=ev!.getWidth() - h=ev!.getHeight() - grid!.setSize(w,h - 50) -return - -rem /** -rem * Close the demo -rem */ -byebye: -bye \ No newline at end of file diff --git a/demo/Enterprise/RowGroupingDemo.bbj b/demo/Enterprise/RowGroupingDemo.bbj deleted file mode 100644 index 784694e4..00000000 --- a/demo/Enterprise/RowGroupingDemo.bbj +++ /dev/null @@ -1,97 +0,0 @@ -rem /** -rem * This file is part of the BBjGridExWidget plugin. -rem * (c) Basis Europe -rem * -rem * For the full copyright and license information, please view the LICENSE -rem * file that was distributed with this source code. -rem */ -use ::BBjGridExWidget/BBjGridExWidget.bbj::BBjGridExWidget -use ::BBjGridExWidget/BBjGridExWidgetColumns.bbj::BBjGridExWidgetColumn -use ::BBjGridExWidget/BBjGridExWidgetColumnsToolpanel.bbj::BBjGridExWidgetColumnsToolpanel -use ::BBjGridExWidget/Demo/assets/Utilities.bbj::BBjGridExWidgetDemoUtilities -use com.basiscomponents.db.ResultSet -use com.basiscomponents.bc.SqlQueryBC -use com.google.gson.JsonObject -use java.sql.Types - -? 'HIDE' - -BBjGridExWidgetDemoUtilities.nagAboutLicense() - -declare auto BBjTopLevelWindow wnd! -declare BBjGridExWidget grid! - -wnd! = BBjAPI().openSysGui("X0").addWindow(10,10,800,600,"BBj Grid Ex Demo") -wnd!.setCallback(BBjAPI.ON_CLOSE,"byebye") -wnd!.setCallback(BBjAPI.ON_RESIZE,"resize") - -cb! = wnd!.addCheckBox(203,12,10,200,22,"Enable Read Only Mode") -cb!.setCallback(BBjAPI.ON_CHECK_OFF,"onUseCheckbox") -cb!.setCallback(BBjAPI.ON_CHECK_ON,"onUseCheckbox") - -grid! = new BBjGridExWidget(wnd!,100,0,40,800,560) - -rem grouping options -rem ======================= -grid!.getOptions().setRowGroupPanelShow(grid!.GRID_GROUPPANEL_SHOW_VISIBLE()) -grid!.getOptions().setMultipleSelection(1) -grid!.getOptions().setGroupColumnLabel("My Custom Group") -grid!.getOptions().setShowGroupChildCount(1) -grid!.getOptions().setShowGroupSelectionCheckbox(1) -grid!.getOptions().setGroupSelectsChildren(1) -REM grid!.setGroupUseEntireRow(1) -REM grid!.setGroupMultiAutoColumn(1) - -REM cast(BBjGridExWidgetColumnsToolpanel,grid!.getSidebar().getToolpanels().get("columns")).setSuppressValues(0) - -gosub setupGrid -process_events - -setupGrid: - declare SqlQueryBC sbc! - - sbc! = new SqlQueryBC(BBjAPI().getJDBCConnection("CDStore")) - rs! = sbc!.retrieve("SELECT * FROM CDINVENTORY") - - filter! = new com.basiscomponents.db.DataRow() - filter!.setFieldValue("RECORDINGTYPE","cond:=AAD") - rs! = rs!.filterBy(filter!) - - grid!.setData(rs!, 1 , 1 , "CDNUMBER") - - rem First we group by music type - declare BBjGridExWidgetColumn musicTypeColumn! - musicTypeColumn! = grid!.getColumn("MUSICTYPE") - musicTypeColumn!.setEnableRowGroup(1) - musicTypeColumn!.setRowGroupIndex(0) - - rem Second we group by artist - rem @see https://www.ag-grid.com/javascript-grid-cell-expressions/ - declare BBjGridExWidgetColumn artistColumn! - artistColumn! = grid!.getColumn("ARTIST") - artistColumn!.setEnableRowGroup(1) - artistColumn!.setRowGroupIndex(1) - artistColumn!.setValueGetterExpression("if(data) return 'Artist : ' + data.ARTIST") - - rem Finally we aggreagate by playingtime - rem @see https://www.ag-grid.com/javascript-grid-cell-expressions/ - declare BBjGridExWidgetColumn playingTimeColumn! - playingTimeColumn! = grid!.getColumn("PLAYINGTIME") - playingTimeColumn!.setEnableValue(1) - playingTimeColumn!.setAggFunc("sum") - playingTimeColumn!.setAllowedAggFuncs("sum,min,max") - playingTimeColumn!.setValueGetterExpression("Number(data.PLAYINGTIME)") -return - -onUseCheckbox: - useCheckbox! = cb!.isSelected() - grid!.setFunctionsReadOnly(useCheckbox!) -return - -resize: - ev! = BBjAPI().getLastEvent() - grid!.setSize(ev!.getWidth(),ev!.getHeight()) -return - -byebye: -bye \ No newline at end of file diff --git a/demo/Enterprise/SidebarDemo.bbj b/demo/Enterprise/SidebarDemo.bbj deleted file mode 100644 index f1f0f9fe..00000000 --- a/demo/Enterprise/SidebarDemo.bbj +++ /dev/null @@ -1,99 +0,0 @@ -rem /** -rem * This file is part of the BBjGridExWidget plugin. -rem * (c) Basis Europe -rem * -rem * For the full copyright and license information, please view the LICENSE -rem * file that was distributed with this source code. -rem */ -use ::BBjGridExWidget/BBjGridExWidget.bbj::BBjGridExWidget -use ::BBjGridExWidget/BBjGridExWidgetSidebar.bbj::BBjGridExWidgetColumnsToolpanel -use ::BBjGridExWidget/Demo/assets/Utilities.bbj::BBjGridExWidgetDemoUtilities -use com.basiscomponents.bc.SqlQueryBC -use java.sql.Types -use com.google.gson.JsonObject - -? 'HIDE' - -BBjGridExWidgetDemoUtilities.nagAboutLicense() - -declare auto BBjTopLevelWindow wnd! -declare BBjGridExWidget grid! - -wnd! = BBjAPI().openSysGui("X0").addWindow(10,10,800,600,"BBj Grid Ex Demo") - -grid! = new BBjGridExWidget(wnd!,100,0,30,800,570) - -wnd! .setCallback(BBjAPI.ON_CLOSE,"byebye") -wnd! .setCallback(BBjAPI.ON_RESIZE,"resize") - -if (info(3,6)<>"5") then - wnd!.setCallback(BBjAPI.ON_KEYPRESS,"onWinKeypress") -fi - - -sidebarToggle! = wnd!.addButton(300,10,3,200,25,"Toggle Sidebar") -toolpanelToggle! = wnd!.addButton(301,230,3,200,25,"Toggle Columns Toolpanel") -refresh! = wnd!.addButton(302,460,3,200,25,"Refresh Data") - -sidebarToggle!.setCallback(BBjAPI.ON_BUTTON_PUSH,"sidebarToggle") -toolpanelToggle!.setCallback(BBjAPI.ON_BUTTON_PUSH,"toolpanelToggle") -refresh!.setCallback(BBjAPI.ON_BUTTON_PUSH,"refreshData") - -sidebarState! = 1 -toolpanelState! = 0 - -gosub fillGrid - -process_events - - -fillGrid: - - declare SqlQueryBC sbc! - sbc! = new SqlQueryBC(BBjAPI().getJDBCConnection("CDStore")) - rs! = sbc!.retrieve("SELECT * FROM CDINVENTORY") - rs!.setAttribute(6,"TOOLPANEL_CLASS","music-type") - - grid!.getOptions().setRowGroupPanelShow(grid!.GRID_GROUPPANEL_SHOW_VISIBLE()) - - columnsToolpanel! = cast(BBjGridExWidgetColumnsToolpanel,grid!.getSidebar().getToolpanels().get(BBjGridExWidgetColumnsToolpanel.ID())) - columnsToolpanel!.setSuppressValues(1) - - musicTypeStyle! = new JsonObject() - musicTypeStyle!.addProperty("background","gold") - grid!.addStyle(".music-type",musicTypeStyle!) - - grid!.setData(rs!,"CDNUMBER") - -return - -sidebarToggle: - sidebar! = grid!.getSidebar() - sidebarState! = !sidebarState! - sidebar!.setVisible(sidebarState!) -return - -toolpanelToggle: - sidebar! = grid!.getSidebar() - - if toolpanelState! = 0 then - sidebar!.openToolpanel(BBjGridExWidgetColumnsToolpanel.ID()) - else - sidebar!.closeToolpanel(BBjGridExWidgetColumnsToolpanel.ID()) - fi - - toolpanelState! = !toolpanelState! -return - - -refreshData: - grid!.render() -return - -byebye: - bye - -resize: - ev! = BBjAPI().getLastEvent() - grid!.setSize(ev!.getWidth(),ev!.getHeight()-30) -return diff --git a/demo/Enterprise/StatusbarDemo.bbj b/demo/Enterprise/StatusbarDemo.bbj deleted file mode 100644 index 969fc8ce..00000000 --- a/demo/Enterprise/StatusbarDemo.bbj +++ /dev/null @@ -1,89 +0,0 @@ -use ::BBjGridExWidget/BBjGridExWidget.bbj::BBjGridExWidget -use ::BBjGridExWidget/BBjGridExWidgetStatusBar.bbj::BBjGridExWidgetStatusBarTotalRowCountComponent -use ::BBjGridExWidget/BBjGridExWidgetStatusBar.bbj::BBjGridExWidgetStatusBarFilteredRowCountComponent -use ::BBjGridExWidget/BBjGridExWidgetStatusBar.bbj::BBjGridExWidgetStatusBarTotalAndFilteredRowCountComponent -use ::BBjGridExWidget/BBjGridExWidgetStatusBar.bbj::BBjGridExWidgetStatusBarSelectedRowCountComponent -use ::BBjGridExWidget/Demo/assets/Utilities.bbj::BBjGridExWidgetDemoUtilities -use com.basiscomponents.bc.SqlQueryBC -use java.sql.Types - -? 'HIDE' - -BBjGridExWidgetDemoUtilities.nagAboutLicense() - -declare auto BBjTopLevelWindow wnd! -declare BBjGridExWidget grid! - -wnd! = BBjAPI().openSysGui("X0").addWindow(10,10,800,600,"Statusbar Demo") -wnd!.setCallback(BBjAPI.ON_CLOSE,"byebye") -wnd!.setCallback(BBjAPI.ON_RESIZE,"resize") - -rem btn! = wnd!.addButton(202,10,10,80,22,"SELECT") -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(BBjGridExWidgetStatusBarTotalRowCountComponent.NAME()) -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(BBjGridExWidgetStatusBarFilteredRowCountComponent.NAME()) -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(BBjGridExWidgetStatusBarTotalAndFilteredRowCountComponent.NAME()) -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(BBjGridExWidgetStatusBarSelectedRowCountComponent.NAME()) -selectedRow!.setCallback(BBjAPI.ON_CHECK_OFF,"onToggle") -selectedRow!.setCallback(BBjAPI.ON_CHECK_ON,"onToggle") - -grid! = new BBjGridExWidget(wnd!,100,200,0,600,600) -grid!.getOptions().setMultipleSelection(1) - -statusbar! = grid!.getStatusbar() -statusbar!.addComponent(new BBjGridExWidgetStatusBarTotalRowCountComponent()) -statusbar!.addComponent(new BBjGridExWidgetStatusBarFilteredRowCountComponent()) -statusbar!.addComponent(new BBjGridExWidgetStatusBarTotalAndFilteredRowCountComponent("right")) -statusbar!.addComponent(new BBjGridExWidgetStatusBarSelectedRowCountComponent("center")) - -gosub fillGrid - -process_events - -fillGrid: - declare SqlQueryBC sbc! - - sbc! = new SqlQueryBC(BBjAPI().getJDBCConnection("CDStore")) - rs! = sbc!.retrieve("SELECT * FROM CDINVENTORY") - grid!.setData(rs!) -return - -resize: - ev! = BBjAPI().getLastEvent() - w=ev!.getWidth() - h=ev!.getHeight() - grid!.setSize(w-200,h) -return - -onToggle: - event! = BBjAPI().getLastEvent() - control! = event!.getControl() - - name$ = control!.getName() - visiblity! = iff(control!.isSelected() , 1 ,0) - - statusbar! = grid!.getStatusbar() - statusbar!.setComponentVisibility(name$ , visiblity!) -return - -byebye: -bye diff --git a/demo/Enterprise/TreeDataDemo.bbj b/demo/Enterprise/TreeDataDemo.bbj deleted file mode 100644 index e6f865b5..00000000 --- a/demo/Enterprise/TreeDataDemo.bbj +++ /dev/null @@ -1,126 +0,0 @@ -rem /** -rem * This file is part of the BBjGridExWidget plugin. -rem * (c) Basis Europe -rem * -rem * For the full copyright and license information, please view the LICENSE -rem * file that was distributed with this source code. -rem */ -use ::BBjGridExWidget/BBjGridExWidget.bbj::BBjGridExWidget -use ::BBjGridExWidget/BBjGridExWidgetRenderers.bbj::BBjGridExWidgetRendererCustomHTML -use ::BBjGridExWidget/BBjGridExWidgetExpressions.bbj::BBjGridExWidgetExpressionBytesFormatter -use ::BBjGridExWidget/Demo/assets/Utilities.bbj::BBjGridExWidgetDemoUtilities -use com.basiscomponents.db.ResultSet - -? 'HIDE' - -BBjGridExWidgetDemoUtilities.nagAboutLicense() - -declare auto BBjTopLevelWindow wnd! -declare BBjGridExWidget grid! - -wnd! = BBjAPI().openSysGui("X0").addWindow(10,10,800,600,"Tree Demo") -wnd!.setBackColor(new BBjColor(45,52,54)) -wnd!.setCallback(BBjAPI.ON_CLOSE,"byebye") -wnd!.setCallback(BBjAPI.ON_RESIZE,"resize") - -ed! = wnd!.addEditBox(200,10,8,210,25,"") -ed!.setPlaceholder("Enter a term to search ...") -ed!.setBackColor(new BBjColor(45,52,54)) -ed!.setForeColor(new BBjColor(245,245,245)) -ed!.setCallback(BBjAPI.ON_EDIT_MODIFY,"onSearchButton") - -REM init the grid -grid! = new BBjGridExWidget(wnd!,100,0,40,wnd!.getWidth(),wnd!.getHeight() - 40) -wnd!.setBackColor(new BBjColor(45,52,54)) -grid!.getOptions().setGroupDefaultExpanded(0) -grid!.getOptions().setGroupColumnLabel("BBjGridExWidget Demo") -grid!.getOptions().setShowGroupChildCount(0) - -rem /** -rem * Enable tree mode and load a lodash template to convert the "filepath" property in the rows data -rem * to an JS array which will be used to compose the tree hierarchy -rem */ -grid!.getOptions().setTreeData(1) -grid!.getOptions().setDataPathTemplate("<% return data.filepath.split(""\" + java.io.File.separator + """); %>") - -rem /** -rem * Configure the group column (files). -rem * -rem * The grid provides be default sensible configuration , but -rem * you can hook on and change these settings using the AutoGroupColumnDefinition -rem * load a lodash template and replace the icons in the template with base64 strings of the selected images -rem * on the disk. then we create a custom html renderer. the renderer will be used inside the default group renderer -rem * (BBjGridExWidgetRendererGroupCellRenderer). -rem */ -template! = BBjGridExWidgetDemoUtilities.readAssetsAsString("templates/tree-icons-custom-template.tpl") -template! = template!.replaceAll("__FILE_ICON", BBjGridExWidget.imageToBase64("BBjGridExWidget/Demo/assets/images/file.png")) -template! = template!.replaceAll("__FOLDER_ICON",BBjGridExWidget.imageToBase64("BBjGridExWidget/Demo/assets/images/folder.png")) - -autoGroupDef! = grid!.getOptions().getAutoGroupColumnDefinition() -autoGroupDef!.setPinned("left") -autoGroupDef!.setWidth(500) -autoGroupDef!.getCellRenderer().setInnerRenderer(new BBjGridExWidgetRendererCustomHTML(template!)) - -grid!.getSidebar().setHiddenByDefault(1) -grid!.setTheme("balham-dark") - -grid!.setCallback(grid!.ON_GRID_CELL_DOUBLE_CLICK(),"onSelectionEvent") - -gosub main -process_events - -rem /** -rem * Retrieve the data from the database and configure the grid -rem */ -main: - declare ResultSet rs! - - grid!.setData(BBjGridExWidgetDemoUtilities.buildResultSetFromDir("BBjGridExWidget/Demo")) - - filePath! = grid!.getColumn("filepath") - filePath!.setHidden(1) - - size! = grid!.getColumn("size") - size!.setAggFunc("sum") - size!.setAlignment(BBjGridExWidget.GRID_ALIGN_RIGHT() , 1) - size!.setValueFormatterExpression(new BBjGridExWidgetExpressionBytesFormatter("### ##0.00")) - - grid!.setFitToGrid() -return - -rem /** -rem * Set a quick filter on the grid to achieve through data search. -rem * -rem * Note : this filter is applied on the client data not the passed ResultSet -rem */ -onSearchButton: - search! = ed!.getText() - grid!.setQuickFilter(search!) -return - -rem /** -rem * pormpt the current selected file -rem */ -onSelectionEvent: - row! = grid!.getSelectedRow() - dataRow! = row!.asDataRow() - let x=MSGBOX(str(dataRow!.getFieldAsString("filepath")) , 0 , "Selected File") -return - -rem /** -rem * Listen to the BBjTopLevelWindow resize events and -rem * resize the grid to fill the available space. -rem */ -resize: - ev! = BBjAPI().getLastEvent() - w=ev!.getWidth() - h=ev!.getHeight() - grid!.setSize(w,h - 40) - grid!.setFitToGrid() -return - -rem /** -rem * Close the demo -rem */ -byebye: -bye \ No newline at end of file