/** * Handling tab closure * * @param tabNumber number of the tab we want to be closed */ private void closeTab(int tabNumber) { if (this.getComponent(tabNumber) instanceof UCUseCaseTab) { UUID key = ((UCUseCaseTab) this.getComponent(tabNumber)).getUuid(); if (UCWorkspaceData.getTabs().containsKey(key)) { UCWorkspaceData.getTabs().remove(key); this.removeTabAt(tabNumber); } } }
/** * Tab handling - responsible for opening tabs * * @param uuid uuid of tab * @param name name of the tab * @param object model of use case */ public void openTab(UUID uuid, String name, UseCaseModel object) { if (UCWorkspaceData.getTabs().containsKey(uuid)) { int index = this.indexOfComponent(UCWorkspaceData.getTabs().get(uuid)); this.setSelectedIndex(index); } else { UCTabParent tab = new UCUseCaseTab(actions, uuid, name, object); this.addTab(name, new CloseTabIcon(), tab); UCWorkspaceData.getTabs().put(uuid, tab); int index = this.indexOfComponent(tab); this.setSelectedIndex(index); } }
/** * Setter - tab name * * @param uuid tab uuid * @param name name of the tab */ public void setTabName(UUID uuid, String name) { if (UCWorkspaceData.getTabs().containsKey(uuid)) { int index = this.indexOfComponent(UCWorkspaceData.getTabs().get(uuid)); this.setTitleAt(index, name); } }