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 file name for the icon. For database profiles provided with DbVisualizer, the type="xxx" attribute for GroupNode and DataNode elements map the xxx with a matching icon file name. Icons are normally of minor interest until you decide to build your own database profile or extend an existing one.
The following show the use of the icon attribute for a DataNode element. A condition control 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=iconFileName. In DbVisualizer there is a icons.prefs file provided with the installation and it maps all icons used not only in database profiles but for all features. Here is a sample of the icons.prefs file.
PhysicalStandby= server_certificate
Plan= FIX_execute_explain
PrimaryKey= key
Privileges= key
Procedure= gears
Procedures= gears
Process= cpu
Processes= cpu
Program= hat_green
Programs= hat_green
Properties= control_panel
PublicDatabaseLinks= FIX_public_link
PublicDatabaseLink= FIX_public_link
The first name is the logical name used in the database profile. For all object types such as Table, Column, View, Source and so on these names are defined in the icons.prefs file. For non object types icons are named with the name the icon represents such as cut, copy, paste, open and so on. The value for each logical name is the file name without the extension .png.
The object type may refer grouping objects (GroupNode) such as Tables, Views, Procedures and specific a 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.prefs file.
Icons Search Path
The database profile search path defined in Tool Properties / General / Database Connection / Database Profile not only define what directories are searched for profiles but also icons. 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 while ${dbvis.home}
is the installation directory for DbVisualizer. If there is an icons.prefs file available in the scanned directories the actual icon files bust be available in the images/16x16 and images/24x24 sub directories such as ${dbvis.prefsdir}/ext/profiles/images/16x16
. The 16x16 directory should contain a 16 by 16 sized icon and the 24x24 a 24 by 24 sized icon.
This is an example of the ${dbvis.prefsdir}/ext/profiles/icons.prefs
file:
sample-schema-dict=dict
The actual icon represented by the dict file name is located in:
${dbvis.prefsdir}/ext/profiles/images/16x16/dict.png
${dbvis.prefsdir}/ext/profiles/images/24x24/dict.png