summaryrefslogtreecommitdiffstats
path: root/dozentenmodul
diff options
context:
space:
mode:
authorSimon Rettberg2018-11-28 15:48:15 +0100
committerSimon Rettberg2018-11-28 15:48:15 +0100
commit101851e26aa8e2a57b2812f5c38c4f818a93d370 (patch)
treef1b17fd0259bc547a506c6600ae3fc36cfe2c747 /dozentenmodul
parent[client] Fix indexing error (array OOB) (diff)
downloadtutor-module-101851e26aa8e2a57b2812f5c38c4f818a93d370.tar.gz
tutor-module-101851e26aa8e2a57b2812f5c38c4f818a93d370.tar.xz
tutor-module-101851e26aa8e2a57b2812f5c38c4f818a93d370.zip
[client] LdapFilter: Fix editing/deleting existing items
Diffstat (limited to 'dozentenmodul')
-rwxr-xr-xdozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/LdapFilterConfigurator.java17
1 files changed, 8 insertions, 9 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/LdapFilterConfigurator.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/LdapFilterConfigurator.java
index b0f0eefb..c2a8d2bd 100755
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/LdapFilterConfigurator.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/LdapFilterConfigurator.java
@@ -55,19 +55,19 @@ public class LdapFilterConfigurator extends LdapFilterConfiguratorLayout {
@Override
public void valueChanged(ListSelectionEvent e) {
LdapFilter item = tblFilters.getSelectedItem2();
+ boolean editable = (item == null || item.filterId == 0);
+ txtAttribute.setEditable(editable);
+ txtValue.setEditable(editable);
+ btnAdd.setEnabled(editable);
+ btnDel.setEnabled(editable);
+ btnAdd.setText("Ändern");
if (item == null) {
clearInputFields();
return;
}
// share from the list is selected: fill bottom form and change "Add" to "Apply"
- boolean editable = (item.filterId == 0);
txtAttribute.setText(item.attribute);
txtValue.setText(item.value);
- txtAttribute.setEditable(editable);
- txtValue.setEditable(editable);
- btnAdd.setEnabled(editable);
- btnDel.setEnabled(editable);
- btnAdd.setText("Ändern");
}
});
@@ -89,7 +89,7 @@ public class LdapFilterConfigurator extends LdapFilterConfiguratorLayout {
}
Wrapper<LdapFilter> newEntry = new Wrapper<LdapFilter>(input, false);
- List<Wrapper<LdapFilter>> oldList = tblFilters.getData();
+ List<Wrapper<LdapFilter>> oldList = new ArrayList<>(tblFilters.getData());
// either we delete the existing share from the data or we are
// creating a new one, either way add it to the list and update
@@ -102,7 +102,6 @@ public class LdapFilterConfigurator extends LdapFilterConfiguratorLayout {
Wrapper<LdapFilter> oldEntry = tblFilters.getSelectedItem();
if (oldEntry != null && oldList.contains(oldEntry)) {
// editing existing one, delete it from the internal data
- oldList = new ArrayList<>(oldList);
oldList.remove(oldEntry);
}
oldList.add(newEntry);
@@ -120,7 +119,7 @@ public class LdapFilterConfigurator extends LdapFilterConfiguratorLayout {
return;
}
try {
- List<Wrapper<LdapFilter>> oldList = tblFilters.getData();
+ List<Wrapper<LdapFilter>> oldList = new ArrayList<>(tblFilters.getData());
if (!oldList.remove(selection)) {
// false if it was not found
LOGGER.error("Could not remove non-existent filter '" + selection.toString()