Skip to content

Commit 6978bf3

Browse files
committed
Set column names from externalized strings
1 parent 97f2cc2 commit 6978bf3

File tree

3 files changed

+39
-5
lines changed

3 files changed

+39
-5
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2010 Oak Ridge National Laboratory.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v10.html
7+
******************************************************************************/
8+
package org.phoebus.channel.views;
9+
10+
import org.phoebus.framework.nls.NLS;
11+
12+
/**
13+
* String externalization
14+
*/
15+
public class Messages
16+
{
17+
// ---
18+
// --- Keep alphabetically sorted and 'in sync' with messages.properties!
19+
// ---
20+
/** Externalized strings */
21+
public static String ChannelTableNameColumn;
22+
public static String ChannelTableOwnerColumn;
23+
24+
static
25+
{
26+
NLS.initializeMessages(Messages.class);
27+
}
28+
29+
private Messages()
30+
{
31+
// Prevent instantiation
32+
}
33+
}

app/channel/views/src/main/java/org/phoebus/channel/views/ui/ChannelTableController.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.util.stream.Collectors;
99

1010
import org.phoebus.channel.views.ChannelTableApp;
11+
import org.phoebus.channel.views.Messages;
1112
import org.phoebus.channelfinder.Channel;
1213
import org.phoebus.channelfinder.ChannelUtil;
1314
import org.phoebus.channelfinder.Property;
@@ -92,10 +93,10 @@ public void initialize() {
9293
});
9394

9495
tableView.getColumns().clear();
95-
TableColumn<Channel, String> nameCol = new TableColumn<>("Name");
96+
TableColumn<Channel, String> nameCol = new TableColumn<>(Messages.ChannelTableNameColumn);
9697
nameCol.setCellValueFactory(new PropertyValueFactory<Channel, String>("name"));
9798

98-
TableColumn<Channel, String> ownerCol = new TableColumn<>("Owner");
99+
TableColumn<Channel, String> ownerCol = new TableColumn<>(Messages.ChannelTableOwnerColumn);
99100
ownerCol.setCellValueFactory(new PropertyValueFactory<Channel, String>("owner"));
100101
tableView.getColumns().addAll(nameCol, ownerCol);
101102

@@ -196,9 +197,7 @@ public void createContextMenu() {
196197
if (addTagJob != null) {
197198
addTagJob.cancel();
198199
}
199-
List<String> channelNames = tableView.getSelectionModel().getSelectedItems().stream().map(ch -> {
200-
return ch.getName();
201-
}).collect(Collectors.toList());
200+
List<String> channelNames = tableView.getSelectionModel().getSelectedItems().stream().map(Channel::getName).collect(Collectors.toList());
202201
AddTag2ChannelsJob.submit(getClient(),
203202
channelNames,
204203
tag,
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ChannelTableNameColumn=name
2+
ChannelTableOwnerColumn=owner

0 commit comments

Comments
 (0)