summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LectureLdapFilterTable.java
blob: e839583de3ffe35e86b4cc71e4d95a30abacf631 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package org.openslx.dozmod.gui.control.table;

import org.openslx.bwlp.thrift.iface.LdapFilter;
import org.openslx.dozmod.gui.helper.I18n;

public class LectureLdapFilterTable extends CheckListTable<LdapFilter> {

	/**
	 * Version for serialization.
	 */
	private static final long serialVersionUID = -3593023625165902800L;

	public static final ListTableColumn COL_TITLE = new ListTableColumn(
			I18n.CONTROL.getString("LectureLdapFilterTable.ListTableColumn.title.colName"));
	public static final ListTableColumn COL_ATTRIBUTE = new ListTableColumn(
			I18n.CONTROL.getString("LectureLdapFilterTable.ListTableColumn.attribute.colName"));
	public static final ListTableColumn COL_VALUE = new ListTableColumn(
			I18n.CONTROL.getString("LectureLdapFilterTable.ListTableColumn.value.colName"));
	
	public LectureLdapFilterTable() {
		super(COL_TITLE, COL_ATTRIBUTE, COL_VALUE);
	}

	@Override
	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
	protected boolean isItemCheckable(LdapFilter item) {
		return item.filterId > 0;
	}

}