use of eu.ggnet.dwoss.util.Tuple2 in project dwoss by gg-net.
the class UniversalSearcherOperation method searchDocuments.
/**
* Search for Documents where the search matches the identifier.
* This method will search for any partial matches from the beginning of a identifier if a wildcard is used.
* <p/>
* @param identifier the identifier to search for
* @param type
* @return a List of Tuple2 containing document.id and string representation
*/
// Used in Misc. Unversal Search
@Override
public List<Tuple2<Long, String>> searchDocuments(String identifier, DocumentType type) {
List<Tuple2<Long, String>> result = new ArrayList<>();
List<Document> documents = new DocumentEao(redTapeEm).findByIdentifierAndType(identifier, type);
for (Document document : documents) {
String s = DocumentFormater.toHtmlSimple(document);
Tuple2<Long, String> tuple = new Tuple2<>(document.getId(), s);
result.add(tuple);
}
return result;
}
use of eu.ggnet.dwoss.util.Tuple2 in project dwoss by gg-net.
the class TupleHtmlRenderer method getListCellRendererComponent.
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof Tuple2) {
label.setText("<html>" + ((Tuple2<Long, String>) value)._2 + "</html>");
label.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
}
return label;
}
Aggregations