mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 09:12:09 +10:00
sort categories
This commit is contained in:
+12
-3
@@ -1,6 +1,8 @@
|
|||||||
package org.diylc.plugins.toolbox;
|
package org.diylc.plugins.toolbox;
|
||||||
|
|
||||||
import java.awt.Container;
|
import java.awt.Container;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -11,7 +13,12 @@ import javax.swing.JTabbedPane;
|
|||||||
import org.diylc.common.ComponentType;
|
import org.diylc.common.ComponentType;
|
||||||
import org.diylc.common.IPlugInPort;
|
import org.diylc.common.IPlugInPort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tabbed pane that shows all available components categorized into
|
||||||
|
* tabs.
|
||||||
|
*
|
||||||
|
* @author Branislav Stojkovic
|
||||||
|
*/
|
||||||
class ComponentTabbedPane extends JTabbedPane {
|
class ComponentTabbedPane extends JTabbedPane {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -21,8 +28,10 @@ class ComponentTabbedPane extends JTabbedPane {
|
|||||||
super();
|
super();
|
||||||
this.plugInPort = plugInPort;
|
this.plugInPort = plugInPort;
|
||||||
Map<String, List<ComponentType>> componentTypes = plugInPort.getComponentTypes();
|
Map<String, List<ComponentType>> componentTypes = plugInPort.getComponentTypes();
|
||||||
for (Map.Entry<String, List<ComponentType>> entry : componentTypes.entrySet()) {
|
List<String> categories = new ArrayList<String>(componentTypes.keySet());
|
||||||
addTab(entry.getKey(), createComponentPanel(entry.getValue()));
|
Collections.sort(categories);
|
||||||
|
for (String category : categories) {
|
||||||
|
addTab(category, createComponentPanel(componentTypes.get(category)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user