diff options
| author | Nino Breuer | 2014-10-30 09:58:59 +0100 |
|---|---|---|
| committer | Nino Breuer | 2014-10-30 09:58:59 +0100 |
| commit | 16cadcd0c0d9ea752b9e9a16f9bd390ecbe81e26 (patch) | |
| tree | 23daea4242e8588f4fd0258a37d5c1db3653cf2a /dozentenmodul/src/main/java/gui/lecture/SearchLecture_GUI.java | |
| parent | Merge branch 'master' of ssh://git.openslx.org/openslx-ng/tutor-module (diff) | |
| download | tutor-module-16cadcd0c0d9ea752b9e9a16f9bd390ecbe81e26.tar.gz tutor-module-16cadcd0c0d9ea752b9e9a16f9bd390ecbe81e26.tar.xz tutor-module-16cadcd0c0d9ea752b9e9a16f9bd390ecbe81e26.zip | |
• added full text search in earch search-gui
• fixed bug: arrayIndexOutOfBounds (several classes)
• fixed bug: failed to update image data
• changed text examples
• fixed bug: any image has been shown as template when changing value of search bar (each direction)
Diffstat (limited to 'dozentenmodul/src/main/java/gui/lecture/SearchLecture_GUI.java')
| -rw-r--r-- | dozentenmodul/src/main/java/gui/lecture/SearchLecture_GUI.java | 60 |
1 files changed, 50 insertions, 10 deletions
diff --git a/dozentenmodul/src/main/java/gui/lecture/SearchLecture_GUI.java b/dozentenmodul/src/main/java/gui/lecture/SearchLecture_GUI.java index 146f7640..d61aca35 100644 --- a/dozentenmodul/src/main/java/gui/lecture/SearchLecture_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/SearchLecture_GUI.java @@ -21,6 +21,7 @@ import java.net.URI; import java.net.URISyntaxException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -90,26 +91,36 @@ public class SearchLecture_GUI extends JFrame { "Verantwortlicher", "Image", "Schlagwort", "ID" };
ThriftConnection con = new ThriftConnection();
Client client = models.Client.clientcon.getClient();
+
final DefaultTableModel modelAll = new DefaultTableModel(titles, 0){
public boolean isCellEditable(int rowIndex, int mColIndex) {
return false;
}
};
+
final DefaultTableModel modelMyLectures = new DefaultTableModel(titles, 0){
public boolean isCellEditable(int rowIndex, int mColIndex) {
return false;
}
};
+
final TableRowSorter<TableModel> rowSorterAll = new TableRowSorter<TableModel>(
modelAll);
+
final TableRowSorter<TableModel> rowSorterMyLectures = new TableRowSorter<TableModel>(
modelMyLectures);
+ RowFilter rf = null;
+ List<RowFilter<Object,Object>> filters = new ArrayList<RowFilter<Object,Object>>(2);
/**
* Create the dialog.
*/
public SearchLecture_GUI(Component formerGUI) {
+
+ filters.add(RowFilter.regexFilter(".", 0));
+ rf = RowFilter.orFilter(filters);
+
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent arg0) {
@@ -121,7 +132,7 @@ public class SearchLecture_GUI extends JFrame { public void windowOpened(WindowEvent arg0) {
try {
initTableModel(modelMyLectures);
- initTableModel(modelAll);
+ //initTableModel(modelAll);
} catch (ParseException e) {
// TODO Auto-generated catch block
@@ -233,19 +244,26 @@ public class SearchLecture_GUI extends JFrame { if (stext != "") {
activeSearch=true;
// Filtere nach der Eingabe
- rowSorterAll.setRowFilter(RowFilter.regexFilter(
- textFieldName.getText(), 0));
- rowSorterMyLectures.setRowFilter(RowFilter.regexFilter(
- textFieldName.getText(), 0));
+ filters.clear();
+ filters.add(RowFilter.regexFilter("(?i)"+stext, 0)); //case insensitive
+ filters.add(RowFilter.regexFilter("(?i)"+stext, 1)); //case insensitive
+ rf = RowFilter.orFilter(filters);
+ rowSorterMyLectures.setRowFilter(rf);
+ rowSorterAll.setRowFilter(rf);
}else{
activeSearch=false;
- String username = person.verantwortlicher.getName() + " "
- + person.verantwortlicher.getVorname();
- rowSorterMyLectures.setRowFilter(RowFilter.regexFilter(
- username, 5));
- rowSorterAll.setRowFilter(null);
+ activeSearch = false;
+ filters.clear();
+ filters.add(RowFilter.regexFilter(".", 0)); //case insensitive, filter for anything
+ rf = RowFilter.orFilter(filters);
+ rowSorterMyLectures.setRowFilter(rf);
+ rowSorterAll.setRowFilter(rf);
}
+ tablemyLectures.clearSelection();
+ tableAllLectures.clearSelection();
+
+ resetLectureInfo();
}
});
@@ -342,6 +360,8 @@ public class SearchLecture_GUI extends JFrame { {
public void valueChanged(ListSelectionEvent e)
{
+ if(tablemyLectures.getSelectedRow() != -1)
+ {
String imageid = modelMyLectures
.getValueAt(
tablemyLectures
@@ -359,6 +379,9 @@ public class SearchLecture_GUI extends JFrame { e1.printStackTrace();
}
}
+ }
+
+
});
tablemyLectures.setModel(modelMyLectures);
@@ -601,6 +624,23 @@ public class SearchLecture_GUI extends JFrame { }
return model;
}
+
+ private void resetLectureInfo() {
+ //reset the detailed information on the right hand side when changing search string
+
+ labelName.setText("");
+ labelVerantwortlicher.setText("");
+ labelAktiv.setText("");
+ labeldesc.setText("");
+ labelenddate.setText("");
+ labelimage.setText("");
+ labelimageversion.setText("");
+ labelstartdate.setText("");
+ labelVerantwortlicher.setText("");
+
+ }
+
+
public void writeLectureData(String id) throws TException, ParseException{
SimpleDateFormat in=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
