Skip to content

Commit 2576ee6

Browse files
committed
limit the automatic filling only to date
1 parent 1a3dd95 commit 2576ee6

File tree

3 files changed

+5
-64
lines changed

3 files changed

+5
-64
lines changed

app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/Preferences.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,7 @@ public class Preferences {
3333
@Preference
3434
public static String default_search_query;
3535
@Preference
36-
public static String default_title_snapshot_configuration;
37-
@Preference
38-
public static String default_title_snapshot_format;
39-
@Preference
4036
public static String default_title_snapshot_date_format;
41-
@Preference
42-
public static String default_title_snapshot_pv1;
43-
@Preference
44-
public static String default_title_snapshot_pv2;
4537

4638
static
4739
{

app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/snapshot/SnapshotController.java

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -268,33 +268,6 @@ public void newSnapshot(Node configurationNode) {
268268
});
269269
}
270270

271-
public String getValueVType(String pvEntry, List<SnapshotItem> entries){
272-
String valueOutput ="";
273-
for (SnapshotItem e : entries) {
274-
if (e.getConfigPv().getPvName().equals(pvEntry)){
275-
VType newValue=e.getValue();
276-
if (newValue instanceof VNumber) {
277-
Number newVType = ((VNumber) newValue).getValue();
278-
valueOutput=newVType.toString();
279-
return valueOutput;
280-
} else if (newValue instanceof VString) {
281-
String newVType = ((VString) newValue).getValue();
282-
valueOutput=newVType.toString();
283-
return valueOutput;
284-
} else if (newValue instanceof VStringArray) {
285-
List<String> newVType =((VStringArray) newValue).getData();
286-
valueOutput=newVType.toString();
287-
return valueOutput;
288-
} else if (newValue instanceof VEnum) {
289-
VEnum newVType = (VEnum) newValue;
290-
valueOutput=newVType.getValue().toString();
291-
return valueOutput;
292-
}
293-
}
294-
}
295-
return valueOutput;
296-
}
297-
298271
@FXML
299272
@SuppressWarnings("unused")
300273
private void takeSnapshot() {
@@ -320,31 +293,11 @@ private void takeSnapshot() {
320293
Date now = new Date();
321294
formater = new SimpleDateFormat("yy-MM-dd");
322295
String defaultTitle="";
323-
if (!Preferences.default_title_snapshot_format.equals("")) {
324-
String[] formatTitle=Preferences.default_title_snapshot_format.split("_");
325-
for (int index = 0; index < formatTitle.length; index++) {
326-
switch (formatTitle[index]) {
327-
case "<date>":
328-
if (!Preferences.default_title_snapshot_date_format.equals("")){
329-
formater = new SimpleDateFormat(Preferences.default_title_snapshot_date_format);
330-
defaultTitle+=defaultTitle+formater.format(now);
331-
}
332-
break;
333-
case "<pv1>":
334-
defaultTitle+=getValueVType(Preferences.default_title_snapshot_pv1,entries);
335-
break;
336-
case "<pv2>":
337-
defaultTitle+=getValueVType(Preferences.default_title_snapshot_pv2,entries);
338-
break;
339-
default:
340-
System.out.println("nothing");
341-
break;
342-
}
343-
if (index<formatTitle.length-1)
344-
defaultTitle+="_";
345-
}
296+
if (!Preferences.default_title_snapshot_date_format.equals("")) {
297+
formater = new SimpleDateFormat(Preferences.default_title_snapshot_date_format);
298+
defaultTitle+=defaultTitle+formater.format(now);
299+
snapshotNameProperty.set(defaultTitle);
346300
}
347-
snapshotNameProperty.set(defaultTitle);
348301

349302
})
350303
);

app/save-and-restore/app/src/main/resources/save_and_restore_preferences.properties

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,5 @@ search_result_page_size=30
2222
# Default save-and-restore search query. Used unless a saved query is located.
2323
default_search_query=tags=golden
2424

25-
# Configure the default snapshot name when "Take Snapshot"
26-
#default_title_snapshot_configuration=TuneList
27-
#default_title_snapshot_format=<date>_<pv1>_<pv2>
25+
# If declared add a date automatically in the name of the snapshot "Take Snapshot"
2826
#default_title_snapshot_date_format=YYYYMMHH_hhmmss
29-
#default_title_snapshot_pv1=SL-APP-MCS:BOM-CPU:IonSet
30-
#default_title_snapshot_pv2=SL-APP-MCS:BOM-CPU:BeamDestSet

0 commit comments

Comments
 (0)