From: <aki...@us...> - 2006-12-15 20:48:48
|
Revision: 1079 http://svn.sourceforge.net/gridarta/?rev=1079&view=rev Author: akirschbaum Date: 2006-12-15 12:48:49 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Remove unused method. Modified Paths: -------------- trunk/daimonin/src/daieditor/CArchPanelPan.java Modified: trunk/daimonin/src/daieditor/CArchPanelPan.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-12-15 20:45:23 UTC (rev 1078) +++ trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-12-15 20:48:49 UTC (rev 1079) @@ -199,10 +199,6 @@ return panelDesktop; } - public List<PanelEntry> getPanelEntries() { - return archList; - } - void showArchList() { final int index = comboBox.getSelectedIndex(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-15 20:56:44
|
Revision: 1081 http://svn.sourceforge.net/gridarta/?rev=1081&view=rev Author: akirschbaum Date: 2006-12-15 12:56:44 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Speed up archetype panel implementation. Modified Paths: -------------- trunk/daimonin/src/daieditor/CArchPanelPan.java Modified: trunk/daimonin/src/daieditor/CArchPanelPan.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-12-15 20:50:10 UTC (rev 1080) +++ trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-12-15 20:56:44 UTC (rev 1081) @@ -33,7 +33,9 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListModel; import javax.swing.ImageIcon; @@ -62,8 +64,8 @@ /** Controller of this subview. */ private final CMainControl mainControl; - /** List of index-archetype name pairs. */ - private List<PanelEntry> archList = new ArrayList<PanelEntry>(); + /** Maps index to list of archetype names. */ + private Map<Integer, ArrayList<String>> archLists = new HashMap<Integer, ArrayList<String>>(); private final JList theList; @@ -178,7 +180,16 @@ * @param index index of subdir where to add */ public void addArchPanelArch(final String archetypeName, final int index) { - archList.add(new PanelEntry(index, archetypeName)); + final ArrayList<String> tmp = archLists.get(index); + final ArrayList<String> archList; + if (tmp == null) { + archList = new ArrayList<String>(); + archLists.put(index, archList); + } else { + archList = tmp; + } + + archList.add(archetypeName); } /** @@ -203,39 +214,22 @@ final int index = comboBox.getSelectedIndex(); model.removeAllElements(); - for (PanelEntry p : archList) { - if (index >= 0) { - if (index == 0) { - model.addElement(p.getName()); - } else { - if (index == p.getIndex()) { - model.addElement(p.getName()); - } + if (index == 0) { + for (final List<String> archList : archLists.values()) { + for (final String archName : archList) { + model.addElement(archName); } } + } else if (index > 0) { + final List<String> archList = archLists.get(index); + if (archList != null) { + for (final String archName : archList) { + model.addElement(archName); + } + } } } - public static final class PanelEntry { - - private int index; - - private String archName; - - public PanelEntry(final int i, final String name) { - index = i; - archName = name; - } - - public int getIndex() { - return index; - } - - public String getName() { - return archName; - } - } - /** Cell Renderer for rendering cells in the ArchPanelPan. */ private final class MyCellRenderer extends DefaultListCellRenderer { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-15 21:06:57
|
Revision: 1082 http://svn.sourceforge.net/gridarta/?rev=1082&view=rev Author: akirschbaum Date: 2006-12-15 13:06:55 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Unify code. Modified Paths: -------------- trunk/daimonin/src/daieditor/CArchPanelPan.java Modified: trunk/daimonin/src/daieditor/CArchPanelPan.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-12-15 20:56:44 UTC (rev 1081) +++ trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-12-15 21:06:55 UTC (rev 1082) @@ -75,8 +75,6 @@ private final JComboBox comboBox; - private int comboCounter; - /** The popup menu for the arch lists to bring up the editor. */ // This looks unused, but don't remove it. It will be used in future. private final JPopupMenu menu = createListPopupMenu(); @@ -87,7 +85,6 @@ CArchPanelPan(final CArchPanel controlPanel, final CMainControl mainControl) { this.mainControl = mainControl; archPanel = controlPanel; - comboCounter = 0; setLayout(new BorderLayout()); panelDesktop = new JPanel(); @@ -203,7 +200,7 @@ setEnabled(false); comboBox.addItem(name); setEnabled(true); - return comboCounter++; + return comboBox.getItemCount() - 1; } JPanel getPanel() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |