Closed railarem closed 6 years ago
Thanks for this issue! I need more details, though.
As for today, when you check one or more rows of a table and you click on a foreign key, the table related to the foreign key opens as described in https://aferrandi.github.io/dbtarzan/Tags.html, with the tab name [TABLE] < [ORIGINAL TABLE].
Now, I understood that your idea is to, whenever you open a table, change the tabs tags of all open tables related to the new one, using an icon. Did I get it right? What kind of icon do you mean? What happens if you open several tables related to a tab? Will the tag of this tab contain several icons, one for each related table?
I have prepared an example to better explain the idea follow the link: https://ibb.co/gdv5re For the icons, I used fontAwelsomeFX: https://bintray.com/jerady/maven/FontAwesomeFX
It seems possible to add icons to the tableview header via css, even if I did not find direct examples of it. Something similar is described in http://dgrieve.blogspot.com/2014/06/javafx-tableview-with-image-background.html. The problem remains to distinguish among columns (they have to have no or different icons depending by the type of key). Here is an example of how it can be done (in this case the css configures a font, but the principle should be the same): https://stackoverflow.com/questions/16857031/javafx-table-column-different-font-with-css
ResultSet DatabaeMetaData.getPrimaryKeys(String catalog, String schema, String table) throws SQLException
to get the primary keys.
The columns parts of primary key are now displayed with a "primary key" icon (a blue key), the columns parts of foreign key are now displayed with an "foreign key" icon (a yelllow key), the columns that are both primary and foreign key are displayed with an icon that shows both types of keys.
I think it would be intuitive if you open the table in the tableview the tabs that match the primary and secondary keys, have an icon pointing it. That's an idea.