Skip to content

Commit 61c948b

Browse files
committed
Exclude sys:// and formula functions from widget info dialog and archiver status. Externalize string resources
1 parent 3999aaf commit 61c948b

File tree

3 files changed

+32
-11
lines changed

3 files changed

+32
-11
lines changed

app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/Messages.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ public class Messages
2727
AddJavaScriptFile,
2828
AddPythonFile,
2929
Alpha,
30+
ArchivedStatus,
31+
ArchivedStatusGet,
32+
ArchivedStatusNo,
33+
ArchivedStatusNotApplicable,
34+
ArchivedStatusPleaseWait,
35+
ArchivedStatusYes,
3036
BoolButtonError_Body,
3137
BoolButtonError_Title,
3238
Blue,

app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/WidgetInfoDialog.java

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -448,21 +448,20 @@ private Tab createPVs(final Collection<NameStateValue> pvs) {
448448
boolean archiveDataSourceAvailable =
449449
ServiceLoader.load(PVFactory.class).stream().filter(f -> f.get().getType().equals("archive")).findFirst().isPresent();
450450

451-
final TableColumn<NameStateValue, ArchivedStatus> archiverValue = new TableColumn<>("Archived?");
451+
final TableColumn<NameStateValue, ArchivedStatus> archiverValue = new TableColumn<>(Messages.ArchivedStatus);
452452
archiverValue.setCellValueFactory(cell -> cell.getValue().archiverValue);
453453
archiverValue.setCellFactory(c -> new TableCell<>() {
454454
@Override
455455
protected void updateItem(ArchivedStatus item, boolean empty) {
456-
if (empty) {
456+
if (empty || item.equals(ArchivedStatus.UNKNOWN)) {
457457
setText(null);
458-
} else if (item.equals(ArchivedStatus.NOT_APPLICABLE)) {
459-
setText("Not Applicable");
460-
} else if (item.equals(ArchivedStatus.NO)) {
461-
setText("No");
462-
} else if (item.equals(ArchivedStatus.LOADING)) {
463-
setText("Please Wait...");
464-
} else if (item.equals(ArchivedStatus.YES)) {
465-
setText("Yes");
458+
return;
459+
}
460+
switch (item){
461+
case NOT_APPLICABLE -> setText(Messages.ArchivedStatusNotApplicable);
462+
case YES -> setText(Messages.ArchivedStatusYes);
463+
case NO -> setText(Messages.ArchivedStatusNo);
464+
case LOADING -> setText(Messages.ArchivedStatusPleaseWait);
466465
}
467466
}
468467
});
@@ -638,8 +637,18 @@ private void fetchArchiverStatus() {
638637
});
639638
}
640639

640+
/**
641+
* Uses the archive:// data source to retrieve last archived sample.
642+
* For loc://, sim://, sys:// and formula functions, {@link ArchivedStatus#NOT_APPLICABLE} is returned.
643+
* @param pvName A valid PV name.
644+
* @return The {@link ArchivedStatus} of the PV, if any, or {@link ArchivedStatus#UNKNOWN} if there is
645+
* an issue interacting with the data source.
646+
*/
641647
private ArchivedStatus getFromArchiver(String pvName) {
642-
if (pvName.toLowerCase().startsWith("loc://") || pvName.toLowerCase().startsWith("sim://")) {
648+
if (pvName.toLowerCase().startsWith("loc://") ||
649+
pvName.toLowerCase().startsWith("sim://") ||
650+
pvName.toLowerCase().startsWith("sys://") ||
651+
pvName.toLowerCase().startsWith("=")) {
643652
return ArchivedStatus.NOT_APPLICABLE;
644653
}
645654
// Check if pv name is prefixed with a scheme, e.g. pva://, ca://...

app/display/representation-javafx/src/main/resources/org/csstudio/display/builder/representation/javafx/messages.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ AddEmbeddedJavaScript=Add Embedded JavaScript\u2026
1616
AddEmbeddedPython=Add Embedded Python\u2026
1717
AddJavaScriptFile=Add JavaScript File
1818
AddPythonFile=Add Python File
19+
ArchivedStatus=Archived
20+
ArchivedStatusGet=Get Archived Status
21+
ArchivedStatusNo=No
22+
ArchivedStatusNotApplicable=Not Applicable
23+
ArchivedStatusPleaseWait=Please Wait
24+
ArchivedStatusYes=Yes
1925
Alpha=Alpha
2026
Blue=Blue
2127
BoolButtonError_Body=Confirmation dialog supported only for toggle mode.

0 commit comments

Comments
 (0)