Search in sources :

Example 6 with TransformerUI

use of org.gephi.appearance.spi.TransformerUI in project gephi by gephi.

the class AppearanceUIModel method initSelectedTransformerUIs.

private void initSelectedTransformerUIs(String elementClass) {
    Graph graph = graphController.getGraphModel(appearanceModel.getWorkspace()).getGraph();
    Map<TransformerCategory, TransformerUI> newMap = new HashMap<>();
    for (Function func : elementClass.equals(AppearanceUIController.NODE_ELEMENT) ? appearanceModel.getNodeFunctions(graph) : appearanceModel.getEdgeFunctions(graph)) {
        TransformerUI ui = func.getUI();
        if (ui != null) {
            TransformerCategory cat = ui.getCategory();
            if (!newMap.containsKey(cat)) {
                newMap.put(cat, ui);
            }
            if (!selectedCategory.containsKey(elementClass)) {
                selectedCategory.put(elementClass, cat);
            }
        }
    }
    //Prefer color to start
    if (newMap.containsKey(DefaultCategory.COLOR)) {
        selectedCategory.put(elementClass, DefaultCategory.COLOR);
    }
    selectedTransformerUI.put(elementClass, newMap);
    selectedFunction.put(elementClass, new HashMap<TransformerUI, Function>());
    selectedAutoTransformer.put(elementClass, new HashMap<TransformerCategory, AutoAppyTransformer>());
}
Also used : Function(org.gephi.appearance.api.Function) AttributeFunction(org.gephi.appearance.api.AttributeFunction) Graph(org.gephi.graph.api.Graph) TransformerCategory(org.gephi.appearance.spi.TransformerCategory) HashMap(java.util.HashMap) TransformerUI(org.gephi.appearance.spi.TransformerUI)

Aggregations

TransformerUI (org.gephi.appearance.spi.TransformerUI)6 AttributeFunction (org.gephi.appearance.api.AttributeFunction)5 Function (org.gephi.appearance.api.Function)5 Graph (org.gephi.graph.api.Graph)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 ItemEvent (java.awt.event.ItemEvent)1 ItemListener (java.awt.event.ItemListener)1 Comparator (java.util.Comparator)1 HashSet (java.util.HashSet)1 List (java.util.List)1 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)1 RankingFunction (org.gephi.appearance.api.RankingFunction)1 TransformerCategory (org.gephi.appearance.spi.TransformerCategory)1