Search in sources :

Example 1 with PreviewProperty

use of org.gephi.preview.api.PreviewProperty in project gephi by gephi.

the class PreviewUIControllerImpl method savePreset.

@Override
public void savePreset(String name) {
    if (model != null) {
        PreviewModel previewModel = previewController.getModel();
        Map<String, Object> map = new HashMap<>();
        for (PreviewProperty p : previewModel.getProperties().getProperties()) {
            map.put(p.getName(), p.getValue());
        }
        for (Entry<String, Object> p : previewModel.getProperties().getSimpleValues()) {
            map.put(p.getKey(), p.getValue());
        }
        PreviewPreset preset = new PreviewPreset(name, map);
        presetUtils.savePreset(preset);
        model.setCurrentPreset(preset);
    }
}
Also used : PreviewModel(org.gephi.preview.api.PreviewModel) HashMap(java.util.HashMap) PreviewProperty(org.gephi.preview.api.PreviewProperty) PreviewPreset(org.gephi.preview.api.PreviewPreset)

Example 2 with PreviewProperty

use of org.gephi.preview.api.PreviewProperty in project gephi by gephi.

the class PreviewWorkspaceDuplicateProvider method duplicate.

@Override
public void duplicate(Workspace source, Workspace destination) {
    PreviewController previewController = Lookup.getDefault().lookup(PreviewController.class);
    PreviewModel sourceModel = previewController.getModel(source);
    PreviewModel destModel = previewController.getModel(destination);
    destModel.setManagedRenderers(sourceModel.getManagedRenderers());
    for (PreviewProperty property : sourceModel.getProperties().getProperties()) {
        destModel.getProperties().putValue(property.getName(), property.getValue());
    }
    for (Entry<String, Object> property : sourceModel.getProperties().getSimpleValues()) {
        destModel.getProperties().putValue(property.getKey(), property.getValue());
    }
}
Also used : PreviewModel(org.gephi.preview.api.PreviewModel) PreviewProperty(org.gephi.preview.api.PreviewProperty) PreviewController(org.gephi.preview.api.PreviewController)

Aggregations

PreviewModel (org.gephi.preview.api.PreviewModel)2 PreviewProperty (org.gephi.preview.api.PreviewProperty)2 HashMap (java.util.HashMap)1 PreviewController (org.gephi.preview.api.PreviewController)1 PreviewPreset (org.gephi.preview.api.PreviewPreset)1