changeset 641:b515d481c39e

Make the start recording button in thread tab more obvious Clearly label the 'Start Recording' button to make it more obvious to users. Reviewed-by: jerboaa, vanaltj Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2012-September/003397.html
author Omair Majid <omajid@redhat.com>
date Thu, 27 Sep 2012 12:09:57 -0400
parents e3f026b1e200
children 74cc8134e87f
files client/swing-components/src/main/java/com/redhat/thermostat/swing/HeaderPanel.java thread/client-swing/src/main/java/com/redhat/thermostat/thread/client/swing/impl/SwingThreadView.java thread/client-swing/src/main/java/com/redhat/thermostat/thread/client/swing/impl/ThreadMainPanel.java
diffstat 3 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/client/swing-components/src/main/java/com/redhat/thermostat/swing/HeaderPanel.java	Wed Sep 26 19:36:51 2012 -0400
+++ b/client/swing-components/src/main/java/com/redhat/thermostat/swing/HeaderPanel.java	Thu Sep 27 12:09:57 2012 -0400
@@ -42,6 +42,7 @@
 import java.awt.FlowLayout;
 import java.lang.reflect.InvocationTargetException;
 
+import javax.swing.AbstractButton;
 import javax.swing.BoxLayout;
 import javax.swing.JComponent;
 import javax.swing.JFrame;
@@ -108,8 +109,8 @@
         repaint();
     }
 
-    public void addToolBarButton(ToolbarButton button) {
-        controlPanel.add(button.getToolbarButton());
+    public void addToolBarButton(AbstractButton button) {
+        controlPanel.add(button);
     }
     
     public static void main(String[] args) throws InvocationTargetException, InterruptedException {
--- a/thread/client-swing/src/main/java/com/redhat/thermostat/thread/client/swing/impl/SwingThreadView.java	Wed Sep 26 19:36:51 2012 -0400
+++ b/thread/client-swing/src/main/java/com/redhat/thermostat/thread/client/swing/impl/SwingThreadView.java	Thu Sep 27 12:09:57 2012 -0400
@@ -110,6 +110,8 @@
         });
         
         timelinePanel = new ThreadAliveDaemonTimelinePanel();
+
+        panel.getToggleButton().setText(t.localize(LocaleResources.START_RECORDING));
         panel.getToggleButton().setToolTipText(t.localize(LocaleResources.START_RECORDING));
         panel.getToggleButton().addItemListener(new ItemListener()
         {
@@ -119,9 +121,11 @@
                 ThreadAction action = null;                
                 if (e.getStateChange() == ItemEvent.SELECTED) {
                     action = ThreadAction.START_LIVE_RECORDING;
+                    panel.getToggleButton().setText(t.localize(LocaleResources.STOP_RECORDING));
                     panel.getToggleButton().setToolTipText(t.localize(LocaleResources.STOP_RECORDING));
                 } else {
                     action = ThreadAction.STOP_LIVE_RECORDING;
+                    panel.getToggleButton().setText(t.localize(LocaleResources.START_RECORDING));
                     panel.getToggleButton().setToolTipText(t.localize(LocaleResources.START_RECORDING));
                 }
                 
@@ -137,6 +141,7 @@
                 };
                 worker.execute();
             }
+
         });
 
         panel.getSplitPane().setTopComponent(timelinePanel);
--- a/thread/client-swing/src/main/java/com/redhat/thermostat/thread/client/swing/impl/ThreadMainPanel.java	Wed Sep 26 19:36:51 2012 -0400
+++ b/thread/client-swing/src/main/java/com/redhat/thermostat/thread/client/swing/impl/ThreadMainPanel.java	Thu Sep 27 12:09:57 2012 -0400
@@ -42,9 +42,9 @@
 import javax.swing.GroupLayout.Alignment;
 import javax.swing.JPanel;
 import javax.swing.JSplitPane;
+import javax.swing.JToggleButton;
 
 import com.redhat.thermostat.common.locale.Translate;
-import com.redhat.thermostat.swing.ActionToggleButton;
 import com.redhat.thermostat.swing.HeaderPanel;
 import com.redhat.thermostat.thread.client.common.IconResources;
 import com.redhat.thermostat.thread.client.common.locale.LocaleResources;
@@ -55,7 +55,7 @@
     private static final Translate t = LocaleResources.createLocalizer();
     private JSplitPane splitPane;
     
-    private ActionToggleButton toggleButton;
+    private JToggleButton toggleButton;
     
     public ThreadMainPanel() {
         setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
@@ -66,7 +66,7 @@
         JPanel content = new JPanel();
         headerPanel.setContent(content);
         
-        toggleButton = new ActionToggleButton(new ImageIcon(IconResources.getRecordIcon().getData().array()));
+        toggleButton = new JToggleButton(new ImageIcon(IconResources.getRecordIcon().getData().array()));
         toggleButton.setName("recordButton");
         headerPanel.addToolBarButton(toggleButton);
         
@@ -100,7 +100,7 @@
         return splitPane;
     }
     
-    public ActionToggleButton getToggleButton() {
+    public JToggleButton getToggleButton() {
         return toggleButton;
     }
 }