use of org.gephi.appearance.api.Function in project gephi by gephi.
the class AppearanceUIModel method refreshSelectedFunction.
public synchronized boolean refreshSelectedFunction() {
Graph graph = graphController.getGraphModel(appearanceModel.getWorkspace()).getGraph();
Function sFunction = getSelectedFunction();
if (sFunction != null && sFunction.isAttribute()) {
for (Function func : getSelectedElementClass().equals(AppearanceUIController.NODE_ELEMENT) ? appearanceModel.getNodeFunctions(graph) : appearanceModel.getEdgeFunctions(graph)) {
if (func.equals(sFunction)) {
return false;
}
}
}
return true;
}
use of org.gephi.appearance.api.Function in project gephi by gephi.
the class AppearanceUIModel method loadTransformerProperties.
public void loadTransformerProperties() {
Function func = getSelectedFunction();
if (func != null) {
Transformer transformer = func.getTransformer();
Map<String, Object> props = savedProperties.get(func);
if (props != null) {
for (Map.Entry<String, Method[]> entry : getProperties(transformer).entrySet()) {
String name = entry.getKey();
Object o = props.get(name);
if (o != null) {
Method setMethod = entry.getValue()[1];
try {
setMethod.invoke(transformer, o);
} catch (Exception ex) {
}
}
}
}
}
}
use of org.gephi.appearance.api.Function 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>());
}
Aggregations