Skip to content

Commit

Permalink
render FK columns in blue
Browse files Browse the repository at this point in the history
  • Loading branch information
Wisser committed Aug 18, 2023
1 parent 8b1573a commit c0390ed
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8162,13 +8162,32 @@ public int compare(String o1, String o2) {

final JComboBox2 combobox = new JComboBox2();
combobox.setModel(new DefaultComboBoxModel(columNames.toArray()));

Set<Column> fks = new HashSet<>();

table.associations.forEach(a -> {
if (a.isInsertDestinationBeforeSource()) {
a.createSourceToDestinationKeyMapping().keySet().forEach(c -> fks.add(c));
}
});

Map<String, Consumer<JLabel>> renderConsumer;
renderConsumer = new HashMap<String, Consumer<JLabel>>();
rowIdSupport.getColumns(table, session, false).forEach(c -> { if (c.name != null) { renderConsumer.put(Quoting.staticUnquote(c.name), label -> label.setIcon(emptyIcon)); }});
fks.forEach(c -> {
if (c.name != null) {
renderConsumer.put(Quoting.staticUnquote(c.name),
label -> {
label.setForeground(Color.blue);
label.setIcon(emptyIcon);
}
);
}
});
if (table.primaryKey != null) {
table.primaryKey.getColumns().forEach(c -> {
if (c.name != null) {
renderConsumer.put(c.name,
renderConsumer.put(Quoting.staticUnquote(c.name),
label -> {
label.setForeground(Color.red);
label.setIcon(constraintPKIcon);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,16 @@ public TableDetailsView(final Table table, final MDTable mdTable, final MetaData
Set<Column> fks = new HashSet<>();

table.associations.forEach(a -> {
a.createSourceToDestinationKeyMapping().keySet().forEach(c -> fks.add(c));
if (a.isInsertDestinationBeforeSource()) {
a.createSourceToDestinationKeyMapping().keySet().forEach(c -> fks.add(c));
}
});

renderConsumer = new HashMap<String, Consumer<JLabel>>();
table.getColumns().forEach(c -> { if (c.name != null) { renderConsumer.put(Quoting.staticUnquote(c.name), label -> label.setIcon(emptyIcon)); }});
fks.forEach(c -> {
if (c.name != null) {
renderConsumer.put(c.name,
renderConsumer.put(Quoting.staticUnquote(c.name),
label -> {
label.setForeground(Color.blue);
label.setIcon(emptyIcon);
Expand All @@ -112,7 +114,7 @@ public TableDetailsView(final Table table, final MDTable mdTable, final MetaData
if (table.primaryKey != null) {
table.primaryKey.getColumns().forEach(c -> {
if (c.name != null) {
renderConsumer.put(c.name,
renderConsumer.put(Quoting.staticUnquote(c.name),
label -> {
label.setForeground(Color.red);
label.setIcon(constraintPKIcon);
Expand Down

0 comments on commit c0390ed

Please sign in to comment.