public void onTabClose(TabCloseEvent event) { Object data = event.getData(); if (data != null && data instanceof LogTableBean) { LogTableBean ltb = (LogTableBean) data; tabs.remove(ltb); if (ltb.getLogFile() != null && ltb.getLogFile().getHandler() != null) { tabSet.remove(ltb.getLogFile().getHandler()); dbManager.removeLogfile(ltb.getLogFile().getHandler()); } } }
public int addTab(LogTableBean ltb) { if (tabSet == null) tabSet = new HashMap<String, LogTableBean>(); String key = ltb.getLogFile().getHandler(); if (tabSet.containsKey(key)) { tabs.remove(tabSet.get(key)); } tabs.add(ltb); tabSet.put(key, ltb); return tabs.size() - 1; }