Mercurial > hg > release > thermostat-1.6
changeset 1728:ef983c4da7ea
Use ThermostatScrollPane instead of JScrollPane
PR 2589
Reviewed-by: aazores, jerboaa, neugens
Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2015-August/015188.html
line wrap: on
line diff
--- a/client/swing/src/main/java/com/redhat/thermostat/client/swing/components/ThermostatScrollPane.java Mon Mar 30 10:10:43 2015 -0400 +++ b/client/swing/src/main/java/com/redhat/thermostat/client/swing/components/ThermostatScrollPane.java Mon Aug 17 10:59:04 2015 -0400 @@ -43,13 +43,17 @@ public class ThermostatScrollPane extends JScrollPane { public ThermostatScrollPane(JComponent view) { + this(view, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + } + + public ThermostatScrollPane(JComponent view, int vsb, int hsb) { super(view); setVerticalScrollBar(new ThermostatScrollBar(ThermostatThinScrollBar.VERTICAL)); setHorizontalScrollBar(new ThermostatScrollBar(ThermostatThinScrollBar.HORIZONTAL)); - setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + setVerticalScrollBarPolicy(vsb); + setHorizontalScrollBarPolicy(hsb); setBorder(null); setViewportBorder(null);
--- a/client/swing/src/main/java/com/redhat/thermostat/client/swing/internal/progress/AggregateNotificationPanel.java Mon Mar 30 10:10:43 2015 -0400 +++ b/client/swing/src/main/java/com/redhat/thermostat/client/swing/internal/progress/AggregateNotificationPanel.java Mon Aug 17 10:59:04 2015 -0400 @@ -36,14 +36,15 @@ package com.redhat.thermostat.client.swing.internal.progress; -import com.redhat.thermostat.client.swing.components.ThermostatThinScrollBar; - import java.awt.BorderLayout; import javax.swing.BoxLayout; import javax.swing.JPanel; import javax.swing.JScrollPane; +import com.redhat.thermostat.client.swing.components.ThermostatScrollPane; +import com.redhat.thermostat.client.swing.components.ThermostatThinScrollBar; + @SuppressWarnings("serial") public class AggregateNotificationPanel extends JPanel { @@ -56,18 +57,10 @@ BoxLayout layout = new BoxLayout(progressBarPane, BoxLayout.Y_AXIS); progressBarPane.setLayout(layout); - JScrollPane scrollPane = new JScrollPane(progressBarPane); - + JScrollPane scrollPane = new ThermostatScrollPane(progressBarPane); scrollPane.setVerticalScrollBar(new ThermostatThinScrollBar(ThermostatThinScrollBar.VERTICAL)); scrollPane.setHorizontalScrollBar(new ThermostatThinScrollBar(ThermostatThinScrollBar.HORIZONTAL)); - scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - - scrollPane.setBorder(null); - scrollPane.setViewportBorder(null); - scrollPane.getViewport().setOpaque(false); - add(scrollPane); }
--- a/client/swing/src/main/java/com/redhat/thermostat/client/swing/internal/views/AgentInformationDisplayFrame.java Mon Mar 30 10:10:43 2015 -0400 +++ b/client/swing/src/main/java/com/redhat/thermostat/client/swing/internal/views/AgentInformationDisplayFrame.java Mon Aug 17 10:59:04 2015 -0400 @@ -66,6 +66,7 @@ import com.redhat.thermostat.client.swing.NonEditableTableModel; import com.redhat.thermostat.client.swing.components.LabelField; import com.redhat.thermostat.client.swing.components.SectionHeader; +import com.redhat.thermostat.client.swing.components.ThermostatScrollPane; import com.redhat.thermostat.client.swing.components.ValueField; import com.redhat.thermostat.common.ActionEvent; import com.redhat.thermostat.common.ActionListener; @@ -145,15 +146,14 @@ JLabel agentLabel = new JLabel(translate.localize(LocaleResources.AGENT_INFO_AGENTS_LIST).getContents()); - JScrollPane scrollPane = new JScrollPane(); - listModel = new DefaultListModel<String>(); agentList = new JList<String>(listModel); agentList.setName("agentList"); agentList.addListSelectionListener(agentChanged); agentListPanel.setLayout(new BorderLayout()); - scrollPane.setViewportView(agentList); + JScrollPane scrollPane = new ThermostatScrollPane(agentList); + agentListPanel.add(scrollPane); agentListPanel.add(agentLabel, BorderLayout.NORTH); @@ -194,7 +194,7 @@ backendsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); backendsTable.getSelectionModel().addListSelectionListener(new BackendSelectionListener()); - JScrollPane backendsTableScollPane = new JScrollPane(backendsTable); + JScrollPane backendsTableScollPane = new ThermostatScrollPane(backendsTable); JLabel backendDescriptionLabel = new JLabel(translate.localize(LocaleResources.AGENT_INFO_BACKEND_DESCRIPTION_LABEL).getContents()); backendDescription = new ValueField(notAvailable);
--- a/host-overview/client-swing/src/main/java/com/redhat/thermostat/host/overview/client/swing/internal/HostOverviewPanel.java Mon Mar 30 10:10:43 2015 -0400 +++ b/host-overview/client-swing/src/main/java/com/redhat/thermostat/host/overview/client/swing/internal/HostOverviewPanel.java Mon Aug 17 10:59:04 2015 -0400 @@ -54,6 +54,7 @@ import com.redhat.thermostat.client.swing.SwingComponent; import com.redhat.thermostat.client.swing.components.LabelField; import com.redhat.thermostat.client.swing.components.SectionHeader; +import com.redhat.thermostat.client.swing.components.ThermostatScrollPane; import com.redhat.thermostat.client.swing.components.ValueField; import com.redhat.thermostat.client.swing.experimental.ComponentVisibilityNotifier; import com.redhat.thermostat.common.ActionListener; @@ -375,7 +376,7 @@ visiblePanel.setLayout(gl_visiblePanel); - scrollPane = new JScrollPane(visiblePanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + scrollPane = new ThermostatScrollPane(visiblePanel); } @Override
--- a/thread/client-swing/src/main/java/com/redhat/thermostat/thread/client/swing/impl/SwingVmDeadLockView.java Mon Mar 30 10:10:43 2015 -0400 +++ b/thread/client-swing/src/main/java/com/redhat/thermostat/thread/client/swing/impl/SwingVmDeadLockView.java Mon Aug 17 10:59:04 2015 -0400 @@ -64,6 +64,8 @@ import com.mxgraph.util.mxConstants; import com.mxgraph.view.mxGraph; import com.redhat.thermostat.client.swing.SwingComponent; +import com.redhat.thermostat.client.swing.components.ThermostatScrollBar; +import com.redhat.thermostat.client.swing.components.ThermostatScrollPane; import com.redhat.thermostat.client.swing.experimental.ComponentVisibilityNotifier; import com.redhat.thermostat.shared.locale.Translate; import com.redhat.thermostat.thread.client.common.DeadlockParser; @@ -108,7 +110,7 @@ actualComponent.add(tabbedPane, c); - JScrollPane scrollPane = new JScrollPane(description); + JScrollPane scrollPane = new ThermostatScrollPane(description); graphical.setLayout(new BorderLayout()); @@ -181,6 +183,9 @@ graphComponent.setToolTips(true); graphComponent.setConnectable(false); + graphComponent.setHorizontalScrollBar(new ThermostatScrollBar(ThermostatScrollBar.HORIZONTAL)); + graphComponent.setVerticalScrollBar(new ThermostatScrollBar(ThermostatScrollBar.VERTICAL)); + Map<String, Object> style = graph.getStylesheet().getDefaultVertexStyle(); style.put(mxConstants.STYLE_LABEL_POSITION, mxConstants.ALIGN_CENTER); graph.getStylesheet().setDefaultVertexStyle(style);
--- a/vm-heap-analysis/client-swing/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/swing/internal/ObjectDetailsPanel.java Mon Mar 30 10:10:43 2015 -0400 +++ b/vm-heap-analysis/client-swing/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/swing/internal/ObjectDetailsPanel.java Mon Aug 17 10:59:04 2015 -0400 @@ -36,6 +36,10 @@ package com.redhat.thermostat.vm.heap.analysis.client.swing.internal; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collection; @@ -44,39 +48,19 @@ import java.util.concurrent.CopyOnWriteArrayList; import javax.swing.ButtonGroup; -import javax.swing.JMenuItem; -import javax.swing.JPanel; import javax.swing.GroupLayout; -import javax.swing.JPopupMenu; -import javax.swing.JToggleButton; -import javax.swing.JTree; -import javax.swing.SwingUtilities; import javax.swing.GroupLayout.Alignment; import javax.swing.JLabel; - -import com.redhat.thermostat.client.swing.EdtHelper; -import com.redhat.thermostat.client.swing.SwingComponent; -import com.redhat.thermostat.client.swing.components.SearchField; -import com.redhat.thermostat.client.ui.SearchProvider.SearchAction; -import com.redhat.thermostat.common.ActionListener; -import com.redhat.thermostat.common.ActionEvent; -import com.redhat.thermostat.common.ActionNotifier; -import com.redhat.thermostat.shared.locale.Translate; -import com.redhat.thermostat.vm.heap.analysis.client.core.HeapObjectUI; -import com.redhat.thermostat.vm.heap.analysis.client.core.ObjectDetailsView; -import com.redhat.thermostat.vm.heap.analysis.client.locale.LocaleResources; -import com.sun.tools.hat.internal.model.JavaHeapObject; - +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.JScrollPane; +import javax.swing.JSplitPane; +import javax.swing.JTextPane; +import javax.swing.JToggleButton; +import javax.swing.JTree; import javax.swing.LayoutStyle.ComponentPlacement; -import javax.swing.JScrollPane; -import javax.swing.JTextPane; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; - -import javax.swing.JSplitPane; +import javax.swing.SwingUtilities; import javax.swing.event.TreeExpansionEvent; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; @@ -88,6 +72,20 @@ import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; +import com.redhat.thermostat.client.swing.EdtHelper; +import com.redhat.thermostat.client.swing.SwingComponent; +import com.redhat.thermostat.client.swing.components.SearchField; +import com.redhat.thermostat.client.swing.components.ThermostatScrollPane; +import com.redhat.thermostat.client.ui.SearchProvider.SearchAction; +import com.redhat.thermostat.common.ActionEvent; +import com.redhat.thermostat.common.ActionListener; +import com.redhat.thermostat.common.ActionNotifier; +import com.redhat.thermostat.shared.locale.Translate; +import com.redhat.thermostat.vm.heap.analysis.client.core.HeapObjectUI; +import com.redhat.thermostat.vm.heap.analysis.client.core.ObjectDetailsView; +import com.redhat.thermostat.vm.heap.analysis.client.locale.LocaleResources; +import com.sun.tools.hat.internal.model.JavaHeapObject; + /** * A Panel that displays JavaHeapObjects and referrers and references. */ @@ -200,8 +198,7 @@ button.addActionListener(treeToggleListener); } - JScrollPane scrollPane = new JScrollPane(); - scrollPane.setViewportView(objectTree); + JScrollPane scrollPane = new ThermostatScrollPane(objectTree); splitPane.setLeftComponent(scrollPane);
--- a/vm-heap-analysis/client-swing/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/swing/internal/ObjectRootsFrame.java Mon Mar 30 10:10:43 2015 -0400 +++ b/vm-heap-analysis/client-swing/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/swing/internal/ObjectRootsFrame.java Mon Aug 17 10:59:04 2015 -0400 @@ -59,6 +59,7 @@ import javax.swing.tree.TreePath; import com.redhat.thermostat.client.swing.EdtHelper; +import com.redhat.thermostat.client.swing.components.ThermostatScrollPane; import com.redhat.thermostat.common.ActionListener; import com.redhat.thermostat.common.ActionNotifier; import com.redhat.thermostat.shared.locale.Translate; @@ -93,7 +94,7 @@ JLabel lblNewLabel = new JLabel(translator.localize(LocaleResources.OBJECT_ROOTS_VIEW_TITLE).getContents()); - JScrollPane scrollPane = new JScrollPane(pathToRootTree); + JScrollPane scrollPane = new ThermostatScrollPane(pathToRootTree); objectDetails = new JTextPane(); objectDetails.setName(DETAILS_NAME);
--- a/vm-heap-analysis/client-swing/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/swing/internal/SwingHeapDumpListView.java Mon Mar 30 10:10:43 2015 -0400 +++ b/vm-heap-analysis/client-swing/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/swing/internal/SwingHeapDumpListView.java Mon Aug 17 10:59:04 2015 -0400 @@ -65,6 +65,7 @@ import com.redhat.thermostat.client.swing.components.ActionButton; import com.redhat.thermostat.client.swing.components.FontAwesomeIcon; import com.redhat.thermostat.client.swing.components.ShadowLabel; +import com.redhat.thermostat.client.swing.components.ThermostatScrollPane; import com.redhat.thermostat.client.swing.components.ThermostatThinScrollBar; import com.redhat.thermostat.client.ui.Palette; import com.redhat.thermostat.shared.locale.LocalizedString; @@ -88,12 +89,8 @@ table.setBorder(new EmptyBorder(Constants.THIN_INSETS)); table.setOpaque(false); - scrollPane = new JScrollPane(table); + scrollPane = new ThermostatScrollPane(table); scrollPane.setVerticalScrollBar(new ThermostatThinScrollBar(ThermostatThinScrollBar.VERTICAL)); - scrollPane.setBorder(new EmptyBorder(Constants.INVISIBLE_INSETS)); - scrollPane.setViewportBorder(null); - scrollPane.getViewport().setOpaque(false); - scrollPane.setOpaque(false); container.add(scrollPane, BorderLayout.CENTER);
--- a/vm-overview/client-swing/src/main/java/com/redhat/thermostat/vm/overview/client/swing/internal/VmOverviewPanel.java Mon Mar 30 10:10:43 2015 -0400 +++ b/vm-overview/client-swing/src/main/java/com/redhat/thermostat/vm/overview/client/swing/internal/VmOverviewPanel.java Mon Aug 17 10:59:04 2015 -0400 @@ -50,6 +50,7 @@ import com.redhat.thermostat.client.swing.components.HeaderPanel; import com.redhat.thermostat.client.swing.components.LabelField; import com.redhat.thermostat.client.swing.components.SectionHeader; +import com.redhat.thermostat.client.swing.components.ThermostatScrollPane; import com.redhat.thermostat.client.swing.components.ValueField; import com.redhat.thermostat.client.swing.experimental.ComponentVisibilityNotifier; import com.redhat.thermostat.common.ActionListener; @@ -294,7 +295,7 @@ .addGap(0, 0, Short.MAX_VALUE) .addContainerGap()); - container = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + container = new ThermostatScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); visiblePanel.setContent(container); }