Mercurial > hg > release > thermostat-0.9
changeset 95:f337c6583c07
Refactor localization method name.
Reviewed by: rkennke
Review thread: http://icedtea.classpath.org/pipermail/thermostat/2012-February/000175.html
line wrap: on
line diff
--- a/client/src/main/java/com/redhat/thermostat/client/ApplicationInfo.java Wed Feb 29 17:36:38 2012 -0500 +++ b/client/src/main/java/com/redhat/thermostat/client/ApplicationInfo.java Thu Mar 01 12:04:00 2012 +0100 @@ -36,7 +36,7 @@ package com.redhat.thermostat.client; -import static com.redhat.thermostat.client.Translate._; +import static com.redhat.thermostat.client.Translate.localize; import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -71,15 +71,15 @@ } public String getName() { - return appInfo.getProperty("APP_NAME", _("MISSING_INFO")); + return appInfo.getProperty("APP_NAME", localize("MISSING_INFO")); } public String getVersion() { - return appInfo.getProperty("APP_VERSION", _("MISSING_INFO")); + return appInfo.getProperty("APP_VERSION", localize("MISSING_INFO")); } public String getDescription() { - return appInfo.getProperty("APP_DESCRIPTION", _("MISSING_INFO")); + return appInfo.getProperty("APP_DESCRIPTION", localize("MISSING_INFO")); } public Icon getIcon() { @@ -91,23 +91,23 @@ } public String getReleaseDate() { - return appInfo.getProperty("APP_RELEASE_DATE", _("MISSING_INFO")); + return appInfo.getProperty("APP_RELEASE_DATE", localize("MISSING_INFO")); } public String getCopyright() { - return appInfo.getProperty("APP_COPYRIGHT", _("MISSING_INFO")); + return appInfo.getProperty("APP_COPYRIGHT", localize("MISSING_INFO")); } public String getLicenseSummary() { - return appInfo.getProperty("APP_LICENSE_SUMMARY", _("MISSING_INFO")); + return appInfo.getProperty("APP_LICENSE_SUMMARY", localize("MISSING_INFO")); } public String getEmail() { - return appInfo.getProperty("APP_EMAIL", _("MISSING_INFO")); + return appInfo.getProperty("APP_EMAIL", localize("MISSING_INFO")); } public String getWebsite() { - return appInfo.getProperty("APP_WEBSITE", _("MISSING_INFO")); + return appInfo.getProperty("APP_WEBSITE", localize("MISSING_INFO")); } }
--- a/client/src/main/java/com/redhat/thermostat/client/HostPanelFacadeImpl.java Wed Feb 29 17:36:38 2012 -0500 +++ b/client/src/main/java/com/redhat/thermostat/client/HostPanelFacadeImpl.java Thu Mar 01 12:04:00 2012 +0100 @@ -36,7 +36,7 @@ package com.redhat.thermostat.client; -import static com.redhat.thermostat.client.Translate._; +import static com.redhat.thermostat.client.Translate.localize; import java.util.ArrayList; import java.util.Arrays; @@ -100,9 +100,9 @@ memoryStatsCollection = db.getCollection("memory-stats"); networkTableColumnVector = new Vector<String>(); - networkTableColumnVector.add(_("NETWORK_INTERFACE_COLUMN")); - networkTableColumnVector.add(_("NETWORK_IPV4_COLUMN")); - networkTableColumnVector.add(_("NETWORK_IPV6_COLUMN")); + networkTableColumnVector.add(localize("NETWORK_INTERFACE_COLUMN")); + networkTableColumnVector.add(localize("NETWORK_IPV4_COLUMN")); + networkTableColumnVector.add(localize("NETWORK_IPV6_COLUMN")); cpuLoadTimeSeriesCollection.addSeries(cpuLoadSeries);
--- a/client/src/main/java/com/redhat/thermostat/client/Main.java Wed Feb 29 17:36:38 2012 -0500 +++ b/client/src/main/java/com/redhat/thermostat/client/Main.java Thu Mar 01 12:04:00 2012 +0100 @@ -36,7 +36,7 @@ package com.redhat.thermostat.client; -import static com.redhat.thermostat.client.Translate._; +import static com.redhat.thermostat.client.Translate.localize; import java.util.logging.Level; import java.util.logging.Logger; @@ -89,8 +89,8 @@ if (newStatus == ConnectionStatus.FAILED_TO_CONNECT) { JOptionPane.showMessageDialog( null, - _("CONNECTION_FAILED_TO_CONNECT_DESCRIPTION"), - _("CONNECTION_FAILED_TO_CONNECT_TITLE"), + localize("CONNECTION_FAILED_TO_CONNECT_DESCRIPTION"), + localize("CONNECTION_FAILED_TO_CONNECT_TITLE"), JOptionPane.ERROR_MESSAGE); System.exit(Constants.EXIT_UNABLE_TO_CONNECT_TO_DATABASE); }
--- a/client/src/main/java/com/redhat/thermostat/client/MainWindowFacadeImpl.java Wed Feb 29 17:36:38 2012 -0500 +++ b/client/src/main/java/com/redhat/thermostat/client/MainWindowFacadeImpl.java Thu Mar 01 12:04:00 2012 +0100 @@ -36,7 +36,7 @@ package com.redhat.thermostat.client; -import static com.redhat.thermostat.client.Translate._; +import static com.redhat.thermostat.client.Translate.localize; import java.io.PrintStream; import java.util.ArrayList; @@ -72,7 +72,7 @@ private final DBCollection hostInfoCollection; private final DBCollection vmInfoCollection; - private final DefaultMutableTreeNode publishedRoot = new DefaultMutableTreeNode(_("MAIN_WINDOW_TREE_ROOT_NAME")); + private final DefaultMutableTreeNode publishedRoot = new DefaultMutableTreeNode(localize("MAIN_WINDOW_TREE_ROOT_NAME")); private final DefaultTreeModel publishedTreeModel = new DefaultTreeModel(publishedRoot); private String filterText;
--- a/client/src/main/java/com/redhat/thermostat/client/MemoryType.java Wed Feb 29 17:36:38 2012 -0500 +++ b/client/src/main/java/com/redhat/thermostat/client/MemoryType.java Thu Mar 01 12:04:00 2012 +0100 @@ -36,15 +36,15 @@ package com.redhat.thermostat.client; -import static com.redhat.thermostat.client.Translate._; +import static com.redhat.thermostat.client.Translate.localize; public enum MemoryType { - MEMORY_TOTAL("total", _("HOST_MEMORY_TOTAL")), - MEMORY_FREE("free", _("HOST_MEMORY_FREE")), - MEMORY_USED("used", _("HOST_MEMORY_USED")), - SWAP_TOTAL("swap-total", _("HOST_SWAP_TOTAL")), - SWAP_FREE("swap-free", _("HOST_SWAP_FREE")), - SWAP_BUFFERS("buffers", _("HOST_BUFFERS")); + MEMORY_TOTAL("total", localize("HOST_MEMORY_TOTAL")), + MEMORY_FREE("free", localize("HOST_MEMORY_FREE")), + MEMORY_USED("used", localize("HOST_MEMORY_USED")), + SWAP_TOTAL("swap-total", localize("HOST_SWAP_TOTAL")), + SWAP_FREE("swap-free", localize("HOST_SWAP_FREE")), + SWAP_BUFFERS("buffers", localize("HOST_BUFFERS")); private String humanReadable; private String internalName;
--- a/client/src/main/java/com/redhat/thermostat/client/Translate.java Wed Feb 29 17:36:38 2012 -0500 +++ b/client/src/main/java/com/redhat/thermostat/client/Translate.java Thu Mar 01 12:04:00 2012 +0100 @@ -47,11 +47,11 @@ resourceBundle = ResourceBundle.getBundle("com.redhat.thermostat.client.strings"); } - public static String _(String toTranslate) { + public static String localize(String toTranslate) { return resourceBundle.getString(toTranslate); } - public static String _(String toTranslate, String... params) { - return MessageFormat.format(_(toTranslate), (Object[]) params); + public static String localize(String toTranslate, String... params) { + return MessageFormat.format(localize(toTranslate), (Object[]) params); } }
--- a/client/src/main/java/com/redhat/thermostat/client/VmPanelFacadeImpl.java Wed Feb 29 17:36:38 2012 -0500 +++ b/client/src/main/java/com/redhat/thermostat/client/VmPanelFacadeImpl.java Thu Mar 01 12:04:00 2012 +0100 @@ -36,7 +36,7 @@ package com.redhat.thermostat.client; -import static com.redhat.thermostat.client.Translate._; +import static com.redhat.thermostat.client.Translate.localize; import java.text.DateFormat; import java.util.ArrayList; @@ -123,7 +123,7 @@ // Only show a stop time if we have actually stopped. stopTime.setText(vmRunningTimeFormat.format(new Date(actualStopTime))); } else { - stopTime.setText(_("VM_INFO_RUNNING")); + stopTime.setText(localize("VM_INFO_RUNNING")); } javaVersion.setText((String) vmInfoObject.get("runtime-version")); javaHome.setText((String) vmInfoObject.get("java-home")); @@ -135,7 +135,7 @@ String actualVmVersion = (String) vmInfoObject.get("vm-version"); vmVersion.setText(actualVmVersion); vmArguments.setText((String) vmInfoObject.get("vm-arguments")); - vmNameAndVersion.setText(_("VM_INFO_VM_NAME_AND_VERSION", actualVmName, actualVmVersion)); + vmNameAndVersion.setText(localize("VM_INFO_VM_NAME_AND_VERSION", actualVmName, actualVmVersion)); String[] collectorNames = getCollectorNames(); for (String collectorName: collectorNames) { @@ -348,7 +348,7 @@ return g.name; } } - return _("UNKNOWN_GEN"); + return localize("UNKNOWN_GEN"); } private void doUpdateCurrentMemoryChartAsync() { @@ -378,9 +378,9 @@ for (Generation generation: generations) { List<Space> spaces = generation.spaces; for (Space space: spaces) { - dataset.addValue(space.used, _("VM_CURRENT_MEMORY_CHART_USED"), space.name); - dataset.addValue(space.capacity - space.used, _("VM_CURRENT_MEMORY_CHART_CAPACITY"), space.name); - dataset.addValue(space.maxCapacity - space.capacity, _("VM_CURRENT_MEMORY_CHART_MAX_CAPACITY"), space.name); + dataset.addValue(space.used, localize("VM_CURRENT_MEMORY_CHART_USED"), space.name); + dataset.addValue(space.capacity - space.used, localize("VM_CURRENT_MEMORY_CHART_CAPACITY"), space.name); + dataset.addValue(space.maxCapacity - space.capacity, localize("VM_CURRENT_MEMORY_CHART_MAX_CAPACITY"), space.name); } } } catch (InterruptedException ie) {
--- a/client/src/main/java/com/redhat/thermostat/client/ui/AboutDialog.java Wed Feb 29 17:36:38 2012 -0500 +++ b/client/src/main/java/com/redhat/thermostat/client/ui/AboutDialog.java Thu Mar 01 12:04:00 2012 +0100 @@ -36,7 +36,7 @@ package com.redhat.thermostat.client.ui; -import static com.redhat.thermostat.client.Translate._; +import static com.redhat.thermostat.client.Translate.localize; import java.awt.BorderLayout; import java.awt.event.ActionEvent; @@ -92,19 +92,19 @@ descriptionContainer.add(Box.createGlue()); descriptionContainer.add(new JLabel(new HtmlTextBuilder().larger(name).toHtml())); - descriptionContainer.add(new JLabel(_("ABOUT_DIALOG_VERSION_AND_RELEASE", version, releaseDate))); + descriptionContainer.add(new JLabel(localize("ABOUT_DIALOG_VERSION_AND_RELEASE", version, releaseDate))); descriptionContainer.add(new JLabel(description)); descriptionContainer.add(new JLabel(copyright)); - descriptionContainer.add(new JLabel(_("ABOUT_DIALOG_LICENSE", license))); - descriptionContainer.add(new JLabel(_("ABOUT_DIALOG_EMAIL", email))); - JLabel websiteLink = new JLabel(_("ABOUT_DIALOG_WEBSITE", website)); + descriptionContainer.add(new JLabel(localize("ABOUT_DIALOG_LICENSE", license))); + descriptionContainer.add(new JLabel(localize("ABOUT_DIALOG_EMAIL", email))); + JLabel websiteLink = new JLabel(localize("ABOUT_DIALOG_WEBSITE", website)); descriptionContainer.add(websiteLink); descriptionContainer.add(Box.createGlue()); add(descriptionContainer, BorderLayout.CENTER); JPanel buttonContainer = new JPanel(); - JButton closeButton = new JButton(_("BUTTON_CLOSE")); + JButton closeButton = new JButton(localize("BUTTON_CLOSE")); closeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) {
--- a/client/src/main/java/com/redhat/thermostat/client/ui/ConnectionSelectionDialog.java Wed Feb 29 17:36:38 2012 -0500 +++ b/client/src/main/java/com/redhat/thermostat/client/ui/ConnectionSelectionDialog.java Thu Mar 01 12:04:00 2012 +0100 @@ -36,7 +36,7 @@ package com.redhat.thermostat.client.ui; -import static com.redhat.thermostat.client.Translate._; +import static com.redhat.thermostat.client.Translate.localize; import java.awt.BorderLayout; import java.awt.FlowLayout; @@ -71,7 +71,7 @@ public ConnectionSelectionDialog(JFrame owner, Connection model) { super(owner); - setTitle(_("STARTUP_MODE_SELECTION_DIALOG_TITLE")); + setTitle(localize("STARTUP_MODE_SELECTION_DIALOG_TITLE")); this.model = model; setupUi(); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); @@ -94,7 +94,7 @@ buttonsPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); bottomPanel.add(buttonsPanel); - JButton cancelButton = new JButton(_("BUTTON_CANCEL")); + JButton cancelButton = new JButton(localize("BUTTON_CANCEL")); cancelButton.setMargin(new Insets(0, 15, 0, 15)); cancelButton.addActionListener(new CancelListener(this)); buttonsPanel.add(cancelButton); @@ -115,21 +115,21 @@ c.gridwidth = GridBagConstraints.REMAINDER; c.weighty = 0; - JLabel info = new JLabel(_("STARTUP_MODE_SELECTION_INTRO")); + JLabel info = new JLabel(localize("STARTUP_MODE_SELECTION_INTRO")); container.add(info, c); c.gridy++; - String localButtonHtml = buildHtml(_("STARTUP_MODE_SELECTION_TYPE_LOCAL"), IconResource.COMPUTER.getUrl()); + String localButtonHtml = buildHtml(localize("STARTUP_MODE_SELECTION_TYPE_LOCAL"), IconResource.COMPUTER.getUrl()); JButton localButton = new JButton(localButtonHtml); container.add(localButton, c); c.gridy++; - String remoteButtonHtml = buildHtml(_("STARTUP_MODE_SELECTION_TYPE_REMOTE"), IconResource.NETWORK_SERVER.getUrl()); + String remoteButtonHtml = buildHtml(localize("STARTUP_MODE_SELECTION_TYPE_REMOTE"), IconResource.NETWORK_SERVER.getUrl()); JButton remoteButton = new JButton(remoteButtonHtml); container.add(remoteButton, c); c.gridy++; - String clusterButtonHtml = buildHtml(_("STARTUP_MODE_SELECTION_TYPE_CLUSTER"), IconResource.NETWORK_GROUP.getUrl()); + String clusterButtonHtml = buildHtml(localize("STARTUP_MODE_SELECTION_TYPE_CLUSTER"), IconResource.NETWORK_GROUP.getUrl()); JButton clusterButton = new JButton(clusterButtonHtml); container.add(clusterButton, c);
--- a/client/src/main/java/com/redhat/thermostat/client/ui/HostPanel.java Wed Feb 29 17:36:38 2012 -0500 +++ b/client/src/main/java/com/redhat/thermostat/client/ui/HostPanel.java Thu Mar 01 12:04:00 2012 +0100 @@ -36,7 +36,7 @@ package com.redhat.thermostat.client.ui; -import static com.redhat.thermostat.client.Translate._; +import static com.redhat.thermostat.client.Translate.localize; import java.awt.BorderLayout; import java.awt.FlowLayout; @@ -91,9 +91,9 @@ JTabbedPane tabPane = new JTabbedPane(); - tabPane.insertTab(_("HOST_INFO_TAB_OVERVIEW"), null, createOverviewPanel(), null, 0); - tabPane.insertTab(_("HOST_INFO_TAB_CPU"), null, createCpuStatisticsPanel(), null, 1); - tabPane.insertTab(_("HOST_INFO_TAB_MEMORY"), null, createMemoryStatisticsPanel(), null, 2); + tabPane.insertTab(localize("HOST_INFO_TAB_OVERVIEW"), null, createOverviewPanel(), null, 0); + tabPane.insertTab(localize("HOST_INFO_TAB_CPU"), null, createCpuStatisticsPanel(), null, 1); + tabPane.insertTab(localize("HOST_INFO_TAB_MEMORY"), null, createMemoryStatisticsPanel(), null, 2); // TODO additional tabs provided by plugins // tabPane.insertTab(title, icon, component, tip, 3) @@ -107,20 +107,20 @@ TableEntry entry; List<Section> allSections = new ArrayList<Section>(); - Section basics = new Section(_("HOST_OVERVIEW_SECTION_BASICS")); + Section basics = new Section(localize("HOST_OVERVIEW_SECTION_BASICS")); allSections.add(basics); - entry = new TableEntry(_("HOST_INFO_HOSTNAME"), facade.getHostName()); + entry = new TableEntry(localize("HOST_INFO_HOSTNAME"), facade.getHostName()); basics.add(entry); - Section hardware = new Section(_("HOST_OVERVIEW_SECTION_HARDWARE")); + Section hardware = new Section(localize("HOST_OVERVIEW_SECTION_HARDWARE")); allSections.add(hardware); - entry = new TableEntry(_("HOST_INFO_CPU_MODEL"), facade.getCpuModel()); + entry = new TableEntry(localize("HOST_INFO_CPU_MODEL"), facade.getCpuModel()); hardware.add(entry); - entry = new TableEntry(_("HOST_INFO_CPU_COUNT"), facade.getCpuCount()); + entry = new TableEntry(localize("HOST_INFO_CPU_COUNT"), facade.getCpuCount()); hardware.add(entry); - entry = new TableEntry(_("HOST_INFO_MEMORY_TOTAL"), facade.getTotalMemory()); + entry = new TableEntry(localize("HOST_INFO_MEMORY_TOTAL"), facade.getTotalMemory()); hardware.add(entry); JTable networkTable = new JTable(facade.getNetworkTableModel()); @@ -129,15 +129,15 @@ networkPanel.add(networkTable.getTableHeader(), BorderLayout.PAGE_START); networkPanel.add(networkTable, BorderLayout.CENTER); - Key key = new Key(_("HOST_INFO_NETWORK")); + Key key = new Key(localize("HOST_INFO_NETWORK")); hardware.add(new TableEntry(key, new Value(networkPanel))); - Section software = new Section(_("HOST_OVERVIEW_SECTION_SOFTWARE")); + Section software = new Section(localize("HOST_OVERVIEW_SECTION_SOFTWARE")); allSections.add(software); - entry = new TableEntry(_("HOST_INFO_OS_NAME"), facade.getOsName()); + entry = new TableEntry(localize("HOST_INFO_OS_NAME"), facade.getOsName()); software.add(entry); - entry = new TableEntry(_("HOST_INFO_OS_KERNEL"), facade.getOsKernel()); + entry = new TableEntry(localize("HOST_INFO_OS_KERNEL"), facade.getOsKernel()); software.add(entry); SimpleTable simpleTable = new SimpleTable(); @@ -158,13 +158,13 @@ List<Section> allSections = new ArrayList<Section>(); - Section cpuBasics = new Section(_("HOST_CPU_SECTION_OVERVIEW")); + Section cpuBasics = new Section(localize("HOST_CPU_SECTION_OVERVIEW")); allSections.add(cpuBasics); TableEntry entry; - entry = new TableEntry(_("HOST_INFO_CPU_MODEL"), facade.getCpuModel()); + entry = new TableEntry(localize("HOST_INFO_CPU_MODEL"), facade.getCpuModel()); cpuBasics.add(entry); - entry = new TableEntry(_("HOST_INFO_CPU_COUNT"), facade.getCpuCount()); + entry = new TableEntry(localize("HOST_INFO_CPU_COUNT"), facade.getCpuCount()); cpuBasics.add(entry); final SimpleTable simpleTable = new SimpleTable(); @@ -175,8 +175,8 @@ TimeSeriesCollection dataset = facade.getCpuLoadDataSet(); JFreeChart chart = ChartFactory.createTimeSeriesChart( null, - _("HOST_CPU_USAGE_CHART_TIME_LABEL"), - _("HOST_CPU_USAGE_CHART_VALUE_LABEL"), + localize("HOST_CPU_USAGE_CHART_TIME_LABEL"), + localize("HOST_CPU_USAGE_CHART_VALUE_LABEL"), dataset, false, false, false); @@ -203,11 +203,11 @@ List<Section> allSections = new ArrayList<Section>(); - Section memoryBasics = new Section(_("HOST_MEMORY_SECTION_OVERVIEW")); + Section memoryBasics = new Section(localize("HOST_MEMORY_SECTION_OVERVIEW")); allSections.add(memoryBasics); TableEntry entry; - entry = new TableEntry(_("HOST_INFO_MEMORY_TOTAL"), facade.getTotalMemory()); + entry = new TableEntry(localize("HOST_INFO_MEMORY_TOTAL"), facade.getTotalMemory()); memoryBasics.add(entry); SimpleTable simpleTable = new SimpleTable(); @@ -258,9 +258,9 @@ } JFreeChart chart = ChartFactory.createTimeSeriesChart( - _("HOST_MEMORY_CHART_TITLE"), // Title - _("HOST_MEMORY_CHART_TIME_LABEL"), // x-axis Label - _("HOST_MEMORY_CHART_SIZE_LABEL"), // y-axis Label + localize("HOST_MEMORY_CHART_TITLE"), // Title + localize("HOST_MEMORY_CHART_TIME_LABEL"), // x-axis Label + localize("HOST_MEMORY_CHART_SIZE_LABEL"), // y-axis Label dataset, // Dataset false, // Show Legend false, // Use tooltips
--- a/client/src/main/java/com/redhat/thermostat/client/ui/MainWindow.java Wed Feb 29 17:36:38 2012 -0500 +++ b/client/src/main/java/com/redhat/thermostat/client/ui/MainWindow.java Thu Mar 01 12:04:00 2012 +0100 @@ -36,7 +36,7 @@ package com.redhat.thermostat.client.ui; -import static com.redhat.thermostat.client.Translate._; +import static com.redhat.thermostat.client.Translate.localize; import java.awt.BorderLayout; import java.awt.Color; @@ -101,7 +101,7 @@ public MainWindow(UiFacadeFactory facadeFactory) { super(); - setTitle(_("MAIN_WINDOW_TITLE")); + setTitle(localize("MAIN_WINDOW_TITLE")); this.facadeFactory = facadeFactory; this.facade = facadeFactory.getMainWindow(); @@ -133,11 +133,11 @@ private void setupMenus() { JMenuBar mainMenuBar = new JMenuBar(); - JMenu fileMenu = new JMenu(_("MENU_FILE")); + JMenu fileMenu = new JMenu(localize("MENU_FILE")); fileMenu.getPopupMenu().setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1)); mainMenuBar.add(fileMenu); - JMenuItem fileConnectMenu = new JMenuItem(_("MENU_FILE_CONNECT")); + JMenuItem fileConnectMenu = new JMenuItem(localize("MENU_FILE_CONNECT")); fileConnectMenu.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -148,24 +148,24 @@ fileMenu.add(new Separator()); - JMenuItem fileImportMenu = new JMenuItem(_("MENU_FILE_IMPORT")); + JMenuItem fileImportMenu = new JMenuItem(localize("MENU_FILE_IMPORT")); fileMenu.add(fileImportMenu); - JMenuItem fileExportMenu = new JMenuItem(_("MENU_FILE_EXPORT")); + JMenuItem fileExportMenu = new JMenuItem(localize("MENU_FILE_EXPORT")); fileMenu.add(fileExportMenu); fileMenu.add(new Separator()); - JMenuItem fileExitMenu = new JMenuItem(_("MENU_FILE_EXIT")); + JMenuItem fileExitMenu = new JMenuItem(localize("MENU_FILE_EXIT")); fileExitMenu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, InputEvent.CTRL_DOWN_MASK)); fileExitMenu.addActionListener(shutdownAction); fileMenu.add(fileExitMenu); - JMenu helpMenu = new JMenu(_("MENU_HELP")); + JMenu helpMenu = new JMenu(localize("MENU_HELP")); helpMenu.getPopupMenu().setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1)); mainMenuBar.add(helpMenu); - JMenuItem helpAboutMenu = new JMenuItem(_("MENU_HELP_ABOUT")); + JMenuItem helpAboutMenu = new JMenuItem(localize("MENU_HELP_ABOUT")); helpAboutMenu.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -344,18 +344,18 @@ String hostNameHtml = new HtmlTextBuilder().bold(hostRef.getHostName()).toPartialHtml(); String agentIdHtml = new HtmlTextBuilder().bold(hostRef.getAgentId()).toPartialHtml(); HtmlTextBuilder builder = new HtmlTextBuilder() - .appendRaw(_("TREE_HOST_TOOLTIP_HOST_NAME", hostNameHtml)) + .appendRaw(localize("TREE_HOST_TOOLTIP_HOST_NAME", hostNameHtml)) .newLine() - .appendRaw(_("TREE_HOST_TOOLTIP_AGENT_ID", agentIdHtml)); + .appendRaw(localize("TREE_HOST_TOOLTIP_AGENT_ID", agentIdHtml)); return builder.toHtml(); } else if (value instanceof VmRef) { VmRef vmRef = (VmRef) value; String vmNameHtml= new HtmlTextBuilder().bold(vmRef.getName()).toPartialHtml(); String vmIdHtml = new HtmlTextBuilder().bold(vmRef.getId()).toPartialHtml(); HtmlTextBuilder builder = new HtmlTextBuilder() - .appendRaw(_("TREE_HOST_TOOLTIP_VM_NAME", vmNameHtml)) + .appendRaw(localize("TREE_HOST_TOOLTIP_VM_NAME", vmNameHtml)) .newLine() - .appendRaw(_("TREE_HOST_TOOLTIP_VM_ID", vmIdHtml)); + .appendRaw(localize("TREE_HOST_TOOLTIP_VM_ID", vmIdHtml)); return builder.toHtml(); } else { return null;
--- a/client/src/main/java/com/redhat/thermostat/client/ui/SummaryPanel.java Wed Feb 29 17:36:38 2012 -0500 +++ b/client/src/main/java/com/redhat/thermostat/client/ui/SummaryPanel.java Thu Mar 01 12:04:00 2012 +0100 @@ -36,7 +36,7 @@ package com.redhat.thermostat.client.ui; -import static com.redhat.thermostat.client.Translate._; +import static com.redhat.thermostat.client.Translate.localize; import java.awt.BorderLayout; import java.util.ArrayList; @@ -66,12 +66,12 @@ List<Section> sections = new ArrayList<Section>(); TableEntry entry; - Section summarySection = new Section(_("HOME_PANEL_SECTION_SUMMARY")); + Section summarySection = new Section(localize("HOME_PANEL_SECTION_SUMMARY")); sections.add(summarySection); - entry = new TableEntry(_("HOME_PANEL_TOTAL_MACHINES"), facade.getTotalConnectedAgents()); + entry = new TableEntry(localize("HOME_PANEL_TOTAL_MACHINES"), facade.getTotalConnectedAgents()); summarySection.add(entry); - entry = new TableEntry(_("HOME_PANEL_TOTAL_JVMS"), facade.getTotalConnectedVms()); + entry = new TableEntry(localize("HOME_PANEL_TOTAL_JVMS"), facade.getTotalConnectedVms()); summarySection.add(entry); SimpleTable simpleTable = new SimpleTable(); @@ -89,7 +89,7 @@ public JPanel createIssuesPanel() { JPanel result = new JPanel(new BorderLayout()); - result.add(Components.header(_("HOME_PANEL_SECTION_ISSUES")), BorderLayout.PAGE_START); + result.add(Components.header(localize("HOME_PANEL_SECTION_ISSUES")), BorderLayout.PAGE_START); ListModel model = new IssuesListModel(new ArrayList<Object>()); @@ -105,7 +105,7 @@ private List<? extends Object> delegate; - private String emptyElement = new String(_("HOME_PANEL_NO_ISSUES")); + private String emptyElement = new String(localize("HOME_PANEL_NO_ISSUES")); public IssuesListModel(List<? extends Object> actualList) { this.delegate = actualList;
--- a/client/src/main/java/com/redhat/thermostat/client/ui/VmPanel.java Wed Feb 29 17:36:38 2012 -0500 +++ b/client/src/main/java/com/redhat/thermostat/client/ui/VmPanel.java Thu Mar 01 12:04:00 2012 +0100 @@ -36,7 +36,7 @@ package com.redhat.thermostat.client.ui; -import static com.redhat.thermostat.client.Translate._; +import static com.redhat.thermostat.client.Translate.localize; import java.awt.BorderLayout; import java.awt.Component; @@ -77,9 +77,9 @@ JTabbedPane tabPane = new JTabbedPane(); - tabPane.insertTab(_("VM_INFO_TAB_OVERVIEW"), null, createOverviewPanel(), null, 0); - tabPane.insertTab(_("VM_INFO_TAB_MEMORY"), null, createMemoryPanel(), null, 1); - tabPane.insertTab(_("VM_INFO_TAB_GC"), null, createGcPanel(), _("GARBAGE_COLLECTION"), 2); + tabPane.insertTab(localize("VM_INFO_TAB_OVERVIEW"), null, createOverviewPanel(), null, 0); + tabPane.insertTab(localize("VM_INFO_TAB_MEMORY"), null, createMemoryPanel(), null, 1); + tabPane.insertTab(localize("VM_INFO_TAB_GC"), null, createGcPanel(), localize("GARBAGE_COLLECTION"), 2); // TODO additional tabs provided by plugins // tabPane.insertTab(title, icon, component, tip, 3) @@ -95,28 +95,28 @@ TableEntry entry; List<Section> allSections = new ArrayList<Section>(); - Section processSection = new Section(_("VM_INFO_SECTION_PROCESS")); + Section processSection = new Section(localize("VM_INFO_SECTION_PROCESS")); allSections.add(processSection); - entry = new TableEntry(_("VM_INFO_PROCESS_ID"), facade.getVmPid()); + entry = new TableEntry(localize("VM_INFO_PROCESS_ID"), facade.getVmPid()); processSection.add(entry); - entry = new TableEntry(_("VM_INFO_START_TIME"), facade.getStartTimeStamp()); + entry = new TableEntry(localize("VM_INFO_START_TIME"), facade.getStartTimeStamp()); processSection.add(entry); - entry = new TableEntry(_("VM_INFO_STOP_TIME"), facade.getStopTimeStamp()); + entry = new TableEntry(localize("VM_INFO_STOP_TIME"), facade.getStopTimeStamp()); processSection.add(entry); - Section javaSection = new Section(_("VM_INFO_SECTION_JAVA")); + Section javaSection = new Section(localize("VM_INFO_SECTION_JAVA")); allSections.add(javaSection); - entry = new TableEntry(_("VM_INFO_MAIN_CLASS"), facade.getMainClass()); + entry = new TableEntry(localize("VM_INFO_MAIN_CLASS"), facade.getMainClass()); javaSection.add(entry); - entry = new TableEntry(_("VM_INFO_COMMAND_LINE"), facade.getJavaCommandLine()); + entry = new TableEntry(localize("VM_INFO_COMMAND_LINE"), facade.getJavaCommandLine()); javaSection.add(entry); - entry = new TableEntry(_("VM_INFO_JAVA_VERSION"), facade.getJavaVersion()); + entry = new TableEntry(localize("VM_INFO_JAVA_VERSION"), facade.getJavaVersion()); javaSection.add(entry); - entry = new TableEntry(_("VM_INFO_VM"), facade.getVmNameAndVersion()); + entry = new TableEntry(localize("VM_INFO_VM"), facade.getVmNameAndVersion()); javaSection.add(entry); - entry = new TableEntry(_("VM_INFO_VM_ARGUMENTS"), facade.getVmArguments()); + entry = new TableEntry(localize("VM_INFO_VM_ARGUMENTS"), facade.getVmArguments()); javaSection.add(entry); SimpleTable simpleTable = new SimpleTable(); @@ -147,8 +147,8 @@ JFreeChart chart = ChartFactory.createStackedBarChart( null, - _("VM_CURRENT_MEMORY_CHART_SPACE"), - _("VM_CURRENT_MEMORY_CHART_SIZE"), + localize("VM_CURRENT_MEMORY_CHART_SPACE"), + localize("VM_CURRENT_MEMORY_CHART_SIZE"), data, PlotOrientation.HORIZONTAL, true, false, false); @@ -198,13 +198,13 @@ c.gridx = 0; c.fill = GridBagConstraints.BOTH; - detailsPanel.add(Components.header(_("VM_GC_COLLECTOR_OVER_GENERATION", collectorName, facade.getCollectorGeneration(collectorName))), BorderLayout.NORTH); + detailsPanel.add(Components.header(localize("VM_GC_COLLECTOR_OVER_GENERATION", collectorName, facade.getCollectorGeneration(collectorName))), BorderLayout.NORTH); TimeSeriesCollection dataset = facade.getCollectorDataSet(collectorName); JFreeChart chart = ChartFactory.createTimeSeriesChart( null, - _("VM_GC_COLLECTOR_CHART_REAL_TIME_LABEL"), - _("VM_GC_COLLECTOR_CHART_GC_TIME_LABEL"), + localize("VM_GC_COLLECTOR_CHART_REAL_TIME_LABEL"), + localize("VM_GC_COLLECTOR_CHART_GC_TIME_LABEL"), dataset, false, false, false);