use of org.gephi.appearance.spi.Transformer in project gephi by gephi.
the class AppearanceControllerImpl method getTransformer.
@Override
public Transformer getTransformer(TransformerUI ui) {
Class<? extends Transformer> transformerClass = ui.getTransformerClass();
Transformer transformer = Lookup.getDefault().lookup(transformerClass);
if (transformer != null) {
return transformer;
}
return null;
}
use of org.gephi.appearance.spi.Transformer in project gephi by gephi.
the class AppearanceUIModel method saveTransformerProperties.
public void saveTransformerProperties() {
Function func = getSelectedFunction();
if (func != null) {
Transformer transformer = func.getTransformer();
Map<String, Object> props = savedProperties.get(func);
if (props == null) {
props = new HashMap<>();
savedProperties.put(func, new HashMap<String, Object>());
}
for (Map.Entry<String, Method[]> entry : getProperties(transformer).entrySet()) {
String name = entry.getKey();
Method getMethod = entry.getValue()[0];
try {
Object o = getMethod.invoke(transformer);
props.put(name, o);
} catch (Exception ex) {
}
}
}
}
use of org.gephi.appearance.spi.Transformer 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) {
}
}
}
}
}
}
Aggregations