//////////////////////////////////////////////////////////////////////////// // KeyListener //////////////////////////////////////////////////////////////////////////// @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { if (!eventsDatabase.getEvents().isEmpty()) { String searchCriteria = searchBox.getText().trim(); if (searchCriteria.length() > 0) { filters.setFilterCriteria(searchCriteria); List<Event> events = filters.filterEvents(eventsDatabase.getEvents()); TableWindow window = new TableWindow("Filtered by : " + searchCriteria, events); window.setVisible(true); jCloudTrailViewer.DESKTOP.add(window); try { window.setSelected(true); } catch (java.beans.PropertyVetoException pve) { } } } else { JOptionPane.showMessageDialog( jCloudTrailViewer.DESKTOP, "No Events Loaded!", "Data Error", JOptionPane.WARNING_MESSAGE); } } }
//////////////////////////////////////////////////////////////////////////// // private methods //////////////////////////////////////////////////////////////////////////// private void addRequiredFilters() { filters.addEventFilter(new FreeformFilter()); }