/** * Respond to selections within the left list. * * @throws InvocationTargetException * @throws InterruptedException */ private void respondToListClick() { this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); enableOrDisableActions(); int idx = archetypeList.getSelectedIndex(); if (idx == -1 || idx >= listData.size()) { // no selection if (archetypeControl == null) { return; } archetypeControl.removeNameChangeListener(this); rightPanel.removeAll(); archetypeControl = null; rightPanel.add(selectLeftLabel); rightPanel.repaint(); return; } if (archetypeControl == null) { archetypeControl = new ArchetypeControl(listData.get(idx)); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); rightPanel.removeAll(); rightPanel.add(archetypeControl, BorderLayout.CENTER); rightPanel.repaint(); rightPanel.revalidate(); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); archetypeControl.addNameChangeListener(this); } else { archetypeControl.setArchetype(listData.get(idx)); archetypeControl.repaint(); } this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
/** Create a new archetype. */ private void makeNewAchetype() { Archetype archetype = new Archetype(); archetype.setName("New Archetype"); listData.add(archetype); archetypeList.setSelectedIndex(listData.size() - 1); saveListAction.setEnabled(true); }