use of org.gephi.appearance.spi.TransformerCategory in project gephi by gephi.
the class AppearanceUIController method setSelectedCategory.
public void setSelectedCategory(TransformerCategory category) {
if (graphObserver != null) {
graphObserver.destroy();
graphObserver = null;
}
if (model != null) {
TransformerCategory oldValue = model.getSelectedCategory();
if (!oldValue.equals(category)) {
model.setSelectedCategory(category);
Function function = model.getSelectedFunction();
if (function != null) {
model.refreshSelectedFunction();
if (!function.isSimple()) {
graphObserver = new GraphChangeObserver(function.getGraph(), function instanceof AttributeFunction ? ((AttributeFunction) function).getColumn() : null);
graphObserver.start();
}
}
firePropertyChangeEvent(AppearanceUIModelEvent.SELECTED_CATEGORY, oldValue, category);
}
}
}
use of org.gephi.appearance.spi.TransformerCategory in project gephi by gephi.
the class AppearanceUIModel method getAutoAppyTransformer.
public AutoAppyTransformer getAutoAppyTransformer() {
String elm = getSelectedElementClass();
TransformerCategory ct = getSelectedCategory();
if (ct != null) {
return selectedAutoTransformer.get(elm).get(ct);
}
return null;
}
use of org.gephi.appearance.spi.TransformerCategory in project gephi by gephi.
the class AppearanceUIModel method setAutoApply.
protected void setAutoApply(boolean autoApply) {
if (!autoApply) {
AutoAppyTransformer aat = getAutoAppyTransformer();
if (aat != null) {
aat.stop();
}
}
String elmt = getSelectedElementClass();
TransformerCategory cat = getSelectedCategory();
if (autoApply) {
selectedAutoTransformer.get(elmt).put(cat, new AutoAppyTransformer(controller, getSelectedFunction()));
} else {
selectedAutoTransformer.get(elmt).put(cat, null);
}
}
use of org.gephi.appearance.spi.TransformerCategory 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