diff options
author | Simon Rettberg | 2018-11-26 15:51:31 +0100 |
---|---|---|
committer | Simon Rettberg | 2018-11-26 15:51:31 +0100 |
commit | a06c4dcb0ae2d829350c035d67b603c831088940 (patch) | |
tree | a23d632a9aa0af9861a2e844d13b28bc91caa04a /dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LectureLdapFilterTable.java | |
parent | [client] Add edit support to ListTable (diff) | |
download | tutor-module-a06c4dcb0ae2d829350c035d67b603c831088940.tar.gz tutor-module-a06c4dcb0ae2d829350c035d67b603c831088940.tar.xz tutor-module-a06c4dcb0ae2d829350c035d67b603c831088940.zip |
[client] Support predefined filters in LDAP editor
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LectureLdapFilterTable.java')
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LectureLdapFilterTable.java | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LectureLdapFilterTable.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LectureLdapFilterTable.java index ac5e8e0f..70d0291e 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LectureLdapFilterTable.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LectureLdapFilterTable.java @@ -1,24 +1,57 @@ package org.openslx.dozmod.gui.control.table; +import java.awt.Color; +import java.awt.Component; + +import javax.swing.UIManager; + import org.openslx.bwlp.thrift.iface.LdapFilter; +import org.openslx.dozmod.gui.helper.ColorUtil; @SuppressWarnings("serial") -public class LectureLdapFilterTable extends ListTable<LdapFilter> { +public class LectureLdapFilterTable extends CheckListTable<LdapFilter> { + public static final ListTableColumn COL_TITLE = new ListTableColumn("Name"); public static final ListTableColumn COL_ATTRIBUTE = new ListTableColumn("Attribut"); public static final ListTableColumn COL_VALUE = new ListTableColumn("Wert"); + + private final Color invalidColor; public LectureLdapFilterTable() { - super(COL_ATTRIBUTE, COL_VALUE); + super(COL_TITLE, COL_ATTRIBUTE, COL_VALUE); + Color fg = UIManager.getColor("Table.foreground"); + Color bg = UIManager.getColor("Table.background"); + invalidColor = ColorUtil.blend(fg, bg, .66f); } @Override - protected Object getValueAtInternal(LdapFilter item, ListTableColumn columnIndex) { + protected Object getValueAtInternal2(LdapFilter item, ListTableColumn columnIndex) { + if (columnIndex == COL_TITLE) { + if (item.filterId == 0) + return ""; + return item.title; + } if (columnIndex == COL_ATTRIBUTE) return item.attribute; if (columnIndex == COL_VALUE) return item.value; throw new IndexOutOfBoundsException(); } + + @Override + public Component prepareRenderHook2(Component component, LdapFilter row, + ListTableColumn listTableColumn, boolean isSelected) { + if (row.filterId == 0) { + component.setForeground(isSelected ? getSelectionForeground() : getForeground()); + } else { + component.setForeground(invalidColor); + } + return component; + } + + @Override + protected boolean isItemCheckable(LdapFilter item) { + return item.filterId > 0; + } } |