Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified app/save-and-restore/app/doc/images/configuration-editor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion app/save-and-restore/app/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ Configuration View
------------------

A new configuration is created from the context menu launched when right-clicking on a folder node in the tree view.
This will launch the configuration editor:
This screenshot shows the configuration editor:

.. image:: images/configuration-editor.png
:width: 80%
Expand All @@ -170,6 +170,9 @@ with PVs in the order they appear.

PV entries in a configuration marked as read only will be omitted whe performing a restore operation.

Compare Mode and Tolerance data is optional. This is used by the service when a client requests comparison between
stored and live values of a snapshot. More information on this feature is found in the service documentation.

To add a very large number of PVs, user should consider the import feature available via the "Import Configuration file to this folder"
option in the context menu of a folder node in the tree view.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public class Messages {
public static String duplicatePVNamesAdditionalItems;
public static String duplicatePVNamesCheckFailed;
public static String duplicatePVNamesFoundInSelection;
public static String duplicatePVNamesNotSupported;
public static String Edit;
public static String editFilter;
public static String errorActionFailed;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*
* Copyright (C) 2024 European Spallation Source ERIC.
*/

package org.phoebus.applications.saveandrestore.ui.configuration;

import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import org.phoebus.applications.saveandrestore.model.Comparison;
import org.phoebus.applications.saveandrestore.model.ConfigPv;
import org.phoebus.applications.saveandrestore.model.ComparisonMode;

import java.util.Objects;

/**
* Wrapper around a {@link ConfigPv} instance for the purpose of facilitating
* configuration and data binding in (for instance) a {@link javafx.scene.control.TableView}.
*/
public class ConfigPvEntry implements Comparable<ConfigPvEntry> {

private final StringProperty pvNameProperty;
private final StringProperty readBackPvNameProperty;
private final BooleanProperty readOnlyProperty;
private final ObjectProperty<ComparisonMode> comparisonModeProperty;
private final ObjectProperty<Double> toleranceProperty;

public ConfigPvEntry(ConfigPv configPv) {
this.pvNameProperty = new SimpleStringProperty(this, "pvNameProperty", configPv.getPvName());
this.readBackPvNameProperty = new SimpleStringProperty(configPv.getReadbackPvName());
this.readOnlyProperty = new SimpleBooleanProperty(configPv.isReadOnly());
this.comparisonModeProperty = new SimpleObjectProperty<>(configPv.getComparison() == null ? null : configPv.getComparison().getComparisonMode());
this.toleranceProperty = new SimpleObjectProperty<>(configPv.getComparison() == null ? null : configPv.getComparison().getTolerance());
}

public StringProperty getPvNameProperty() {
return pvNameProperty;
}

public StringProperty getReadBackPvNameProperty() {
return readBackPvNameProperty;
}

public BooleanProperty getReadOnlyProperty() {
return readOnlyProperty;
}

public ObjectProperty<ComparisonMode> getComparisonModeProperty() {
return comparisonModeProperty;
}

public ObjectProperty<Double> getToleranceProperty() {
return toleranceProperty;
}

public void setPvNameProperty(String pvNameProperty) {
this.pvNameProperty.set(pvNameProperty);
}

public void setReadBackPvNameProperty(String readBackPvNameProperty) {
this.readBackPvNameProperty.set(readBackPvNameProperty);
}

public void setComparisonModeProperty(ComparisonMode comparisonModeProperty) {
this.comparisonModeProperty.set(comparisonModeProperty);
}

public void setToleranceProperty(Double toleranceProperty) {
this.toleranceProperty.set(toleranceProperty );
}

public ConfigPv toConfigPv() {
ConfigPv configPv = ConfigPv.builder()
.pvName(pvNameProperty.get())
.readbackPvName(readBackPvNameProperty.get())
.readOnly(readOnlyProperty.get())
.build();
if(comparisonModeProperty.isNotNull().get() && toleranceProperty.isNotNull().get()){
configPv.setComparison(new Comparison(comparisonModeProperty.get(), toleranceProperty.get()));
}
return configPv;
}

@Override
public boolean equals(Object other) {
if (other instanceof ConfigPvEntry otherConfigPv) {
return Objects.equals(pvNameProperty, otherConfigPv.getPvNameProperty()) &&
Objects.equals(readBackPvNameProperty, otherConfigPv.getReadBackPvNameProperty()) &&
Objects.equals(readOnlyProperty.get(), otherConfigPv.getReadOnlyProperty().get());
}
return false;
}

@Override
public int hashCode() {
return Objects.hash(pvNameProperty, readBackPvNameProperty, readOnlyProperty);
}

@Override
public int compareTo(ConfigPvEntry other) {
return pvNameProperty.get().compareTo(other.getPvNameProperty().get());
}
}
Loading