use of org.gephi.appearance.api.AttributeFunction in project gephi by gephi.
the class AppearanceUIController method setSelectedElementClass.
public void setSelectedElementClass(String elementClass) {
if (graphObserver != null) {
graphObserver.destroy();
graphObserver = null;
}
if (!elementClass.equals(NODE_ELEMENT) && !elementClass.equals(EDGE_ELEMENT)) {
throw new RuntimeException("Element class has to be " + NODE_ELEMENT + " or " + EDGE_ELEMENT);
}
if (model != null) {
String oldValue = model.getSelectedElementClass();
if (!oldValue.equals(elementClass)) {
model.setSelectedElementClass(elementClass);
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_ELEMENT_CLASS, oldValue, elementClass);
}
}
}
use of org.gephi.appearance.api.AttributeFunction in project gephi by gephi.
the class AppearanceUIController method setSelectedTransformerUI.
public void setSelectedTransformerUI(TransformerUI ui) {
if (graphObserver != null) {
graphObserver.destroy();
graphObserver = null;
}
if (model != null) {
TransformerUI oldValue = model.getSelectedTransformerUI();
if (!oldValue.equals(ui)) {
model.setAutoApply(false);
model.setSelectedTransformerUI(ui);
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_TRANSFORMER_UI, oldValue, ui);
}
}
}
use of org.gephi.appearance.api.AttributeFunction 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.api.AttributeFunction in project gephi by gephi.
the class AppearanceUIController method setSelectedFunction.
public void setSelectedFunction(Function function) {
if (graphObserver != null) {
graphObserver.destroy();
graphObserver = null;
}
if (model != null) {
Function oldValue = model.getSelectedFunction();
if ((oldValue == null && function != null) || (oldValue != null && function == null) || (function != null && oldValue != null && !oldValue.equals(function))) {
model.setAutoApply(false);
model.setSelectedFunction(function);
firePropertyChangeEvent(AppearanceUIModelEvent.SELECTED_FUNCTION, oldValue, function);
if (function != null && !function.isSimple()) {
graphObserver = new GraphChangeObserver(function.getGraph(), function instanceof AttributeFunction ? ((AttributeFunction) function).getColumn() : null);
graphObserver.start();
}
}
}
}
use of org.gephi.appearance.api.AttributeFunction in project gephi by gephi.
the class AppearanceUIModel method replaceSelectedFunction.
public synchronized Function replaceSelectedFunction() {
Graph graph = graphController.getGraphModel(appearanceModel.getWorkspace()).getGraph();
Function sFunction = getSelectedFunction();
if (sFunction instanceof AttributeFunction) {
AttributeFunction af = (AttributeFunction) sFunction;
for (Function func : getSelectedElementClass().equals(AppearanceUIController.NODE_ELEMENT) ? appearanceModel.getNodeFunctions(graph) : appearanceModel.getEdgeFunctions(graph)) {
if (func instanceof AttributeFunction) {
if (af.getColumn().equals(((AttributeFunction) func).getColumn()) && sFunction.getUI().getCategory().equals(func.getUI().getCategory())) {
return func;
}
}
}
}
return null;
}
Aggregations