Icons
Introduction
Icons related to functionality defined in a database profile are displayed in the database objects tree, actions, and object viewers. Icons are declared by mapping a logical name with the name for the icon.
These elements supports setting the icon="xxx"
attribute:
GroupNode
DataNode
DataView
Action
The type="xxx"
attribute for GroupNode and DataNode elements is the key attribute as it is the association with the other segments (commands, actions, and viewers) in the database profile. For GroupNode and DataNode it is also used as the icon name in case the icon="xxx"
attribute is not explicitly specified.
Icons are normally of minor interest until you decide to build your own database profile or extend an existing one.
The following shows the use of the icon attribute for a DataNode element. A condition controls what icon to use based on the value of getCatalogs.TABLE_CAT.
<DataNode type="Catalog" label="${getCatalogs.TABLE_CAT}"
icon="#dataMap.get('getCatalogs.TABLE_CAT').equals('sales') ? 'salesIcon' :
(#dataMap.get('getCatalogs.TABLE_CAT').equals('support') ? 'supportIcon' : null)">
</DataNode>
The following sections explain how icons are handled and what choices you have to add your own icons.
icons.prefs file
Icons are defined in a simple text file with each row in the format: name=iconName. In DbVisualizer there is the DBVIS-HOME/resources/profiles/icons-db.prefs file provided with the installation. It maps all icons used in the supplied database profiles stored in the same folder as the icons-db.prefs file. Here is a sample of the icons-db.prefs file provided with DbVisualizer:
#
# Name Lucide (SVG)
# ------------------------------- -----------------------------------------------
collection.size.small =16x16
collection.size.large =24x24
collection.size.small.folder =/images/lucide/lucide;/images/lucide/lucide-fix
collection.size.large.folder =/images/lucide/lucide;/images/lucide/lucide-fix
collection.size.overlay.scale =0.7
collection.disabled.icons.folder =
collection.base.color.default =
collection.badge.color.default =ASIS
icon.db.Alert =megaphone.svg
icon.db.ASM =database.svg
icon.db.ASMDisk =hard-drive.svg
...
The collection.x.y entries defines the characteristics for all icons defined in the file, i.e. the search path, scaling, etc., while all icon.db.<name>=<icon name>.svg entries maps a logical name with the actual icon name. DbVisualizer uses the Lucide Icon collection where all icons are in the SVG format. In DbVisualizer we've added support for dynamic coloring, explicit scaling, and overlay support for SVG icons.
The object type may refer to grouping objects (GroupNode) such as Tables, Views, Procedures and specific objects (DataNode) such as Table, View, Procedure.
The general recommendation is to name the object type for a GroupNode in a plural form and in singular form for DataNode objects. The icon representing for example Tables and Table is in most cases the same, still there must be two definitions in the icons-db.prefs file."
Icons Search Path
The database profile search path defined in Tool Properties / General / Database Connection / Database Profile not only defines what directories are searched for profiles but also any custom icon definitions.
These are the default folders searched:
${dbvis.prefsdir}/ext/profiles
${dbvis.home}/resources/profiles
${dbvis.prefsdir}
is replaced with the setting directory for DbVisualizer on the platform being used. On Windows this is C:\Users\<user>\.dbvis.${dbvis.home}
is the installation directory for DbVisualizer.
Any icons-db.prefs file will be read from the same folder, if it exists.
This is an example of the ${dbvis.prefsdir}/ext/profiles/icons-db.prefs file:
icon.db.Alert =megaphone.svg
icon.db.ASM =database.svg
icon.db.ASMDisk =hard-drive.svg
The actual icon represented by the icon.db.Alert entry, i.e., the megaphone.svg Lucide Icon is provided with DbVisualizer.