Skip to content

Commit

Permalink
feat: allow columns to override icons
Browse files Browse the repository at this point in the history
  • Loading branch information
hyyan committed Jun 28, 2019
1 parent 88543c7 commit 6c30fa9
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions BBjGridExWidgetColumns.bbj
Expand Up @@ -15,6 +15,7 @@ use java.sql.Types
use com.google.gson.Gson
use com.google.gson.JsonObject
use com.google.gson.JsonArray
use com.google.gson.JsonParser
use com.basiscomponents.db.DataField
use ::BBjGridExWidget/BBjGridExWidget.bbj::BBjGridExWidget
use ::BBjGridExWidget/BBjGridExWidgetFilters.bbj::BBjGridExWidgetFilterInterface
Expand Down Expand Up @@ -330,6 +331,63 @@ class public BBjGridExWidgetDefaultColumnDefinition extends BBjGridExWidgetColum
rem */
field public BBjString DefaultTimestampsMask! = "%Dz.%Mz.%Yl %Hz:%mz:%sz"
rem /**
rem * Icons to use inside the column instead of the grid's default icons.
rem *
rem * The icons can either be set on the grid options (all icons) or on the column definition (all except group).
rem * If defined in both the grid options and column definitions, the column definition will get used.
rem * This allows you to specify defaults in the grid options to fall back on, and then provide individual icons for
rem * specific columns. This is handy if, for example, you want to include 'A..Z' as string sort icons
rem * and just the simple arrow for other columns.
rem *
rem * The icons are set as follows:
rem * <pre>
rem * <code>
rem * // column header items
rem * menu
rem * filter
rem * columns
rem * sortAscending
rem * sortDescending
rem * sortUnSort
rem *
rem * // row checkbox selection and tool panel column selection
rem * checkboxChecked
rem * checkboxUnchecked
rem * checkboxIndeterminate
rem *
rem * // tool panel column selection, when read only (ie disabled checkboxes)
rem * checkboxCheckedReadOnly
rem * checkboxUncheckedReadOnly
rem * checkboxIndeterminateReadOnly
rem *
rem * // when moving columns
rem * columnMovePin // when column is to the left, before it gets pinned
rem * columnMoveAdd // when adding a column
rem * columnMoveHide // when removing a column
rem * columnMoveMove // when moving a column
rem * columnMoveLeft // when moving and scrolling left
rem * columnMoveRight // when moving and scrolling right
rem * columnMoveGroup // when about to drop into group panel
rem * columnMoveValue // when about to drop into value panel
rem * columnMovePivot // when about to drop into pivot panel
rem * dropNotAllowed // when trying to drop column into group/value/pivot panel and column doesn't support it
rem *
rem * // menu
rem * menuPin // beside the column pin menu item
rem * menuValue // beside the column value menu item
rem * menuAddRowGroup // beside the column row group menu item
rem * menuRemoveRowGroup // beside the column row group menu item
rem * clipboardCopy // beside the copy to clipboard menu item
rem * clipboardPaste // beside the paste from clipboard menu item
rem *
rem * // column drop panels
rem * pivotPanel // beside where to drop columns for pivot
rem * valuePanel // beside where to drop columns for value
rem * </code>
rem * </pre>
rem */
field public JsonObject Icons! = new JsonObject()
rem /**
rem * Get pinned left constant
rem *
rem * @return BBjString <b>left</b>
Expand Down Expand Up @@ -511,6 +569,17 @@ class public BBjGridExWidgetDefaultColumnDefinition extends BBjGridExWidgetColum
SWEND
methodend
rem /**
rem * Set the grid icons
rem *
rem * @param BBjString json! The icons as a json object
rem */
method public void setIcons(BBjString json!)
declare JsonParser parser!

parser! = new JsonParser()
#setIcons(parser!.parse(json!).getAsJsonObject())
methodend
rem /**
rem * Set the column type
rem *
rem * @param BBjString type! SQL type
Expand Down Expand Up @@ -608,6 +677,7 @@ class public BBjGridExWidgetDefaultColumnDefinition extends BBjGridExWidgetColum
column!.addProperty("filterValueGetter",#getFilterValueGetterExpression().toString(),err=*next)
column!.addProperty("valueSetter",#getValueSetterExpression().toString(),err=*next)
column!.addProperty("valueParser",#getValueParserExpression().toString(),err=*next)
column!. add("icons",iff(#getIcons().entrySet().size() <> 0 , #getIcons() , null()),err=*next)
filterEnabled! = #getEnableFilter()
filter! = #getFilter()

Expand Down

0 comments on commit 6c30fa9

Please sign in to comment.