private void onListRead(QueryListCreator queryListCreator) { for (int i = 0; i < _objectResultTabbedPane.getTabCount(); i++) { if (_objectResultTabbedPane.getComponentAt(i) == queryListCreator.getWaitPanel()) { _objectResultTabbedPane.removeTabAt(i); break; } } List list = queryListCreator.getList(); if (null == list) { return; } ObjectResultTabControllerListener l = new ObjectResultTabControllerListener() { @Override public void closeTab(ObjectResultTabController toClose) { onCloseTab(toClose); } }; String hqlQuery = queryListCreator.getHqlQuery(); int maxNumResults = queryListCreator.getMaxNumResults(); HibernateConnection con = queryListCreator.getConnection(); ObjectResultTabController ortc = new ObjectResultTabController(list, maxNumResults, con, hqlQuery, _resource, l, _session); int titelLen = Math.min(hqlQuery.length(), 14); String title = hqlQuery.trim().substring(0, titelLen).replaceAll("\n", " "); _objectResultTabbedPane.addTab(title, ortc.getPanel()); _objectResultTabbedPane.setSelectedComponent(ortc.getPanel()); }
private void onCloseTab(ObjectResultTabController toClose) { for (int i = 0; i < _objectResultTabbedPane.getTabCount(); i++) { if (_objectResultTabbedPane.getComponentAt(i) == toClose.getPanel()) { _objectResultTabbedPane.removeTabAt(i); break; } } }