LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  March 2015

HPS-SVN March 2015

Subject:

r2579 - /java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/PlotInfoPanel.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Thu, 26 Mar 2015 23:04:14 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (118 lines)

Author: [log in to unmask]
Date: Thu Mar 26 16:04:07 2015
New Revision: 2579

Log:
Improve layout and sizing of plot info panel.

Modified:
    java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/PlotInfoPanel.java

Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/PlotInfoPanel.java
 =============================================================================
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/PlotInfoPanel.java	(original)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/PlotInfoPanel.java	Thu Mar 26 16:04:07 2015
@@ -27,6 +27,7 @@
 import java.util.TimerTask;
 
 import javax.swing.BorderFactory;
+import javax.swing.Box;
 import javax.swing.BoxLayout;
 import javax.swing.JButton;
 import javax.swing.JComboBox;
@@ -53,11 +54,11 @@
     
     PlotterRegion currentRegion;
     Object currentObject;
-    static final int INSET_SIZE = 5;
-    static final int BORDER_SIZE = 10;
-
+    
+    static final int MAX_ROWS = 13;
+    static final int MIN_WIDTH = 400;
+    static final int MIN_HEIGHT = 300;
     static final String[] COLUMN_NAMES = { "Field", "Value" };
-
     static final String PLOT_SELECTED = "PlotSelected";
 
     Timer timer = new Timer();
@@ -68,20 +69,32 @@
     @SuppressWarnings("unchecked")
     PlotInfoPanel() {
                 
-        setLayout(new FlowLayout(FlowLayout.LEFT));
+        setLayout(new FlowLayout(FlowLayout.CENTER));
 
         JPanel leftPanel = new JPanel();
         leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.PAGE_AXIS));
-           
-        JPanel buttonPanel = new JPanel();
+        leftPanel.setPreferredSize(new Dimension(MIN_WIDTH, MIN_HEIGHT));
+        
+        Dimension filler = new Dimension(0, 10);
+        
+        // Save button.
         saveButton = new JButton("Save Plots ...");
         saveButton.setActionCommand(Commands.SAVE_SELECTED_PLOTS);
-        buttonPanel.add(saveButton);       
-        //c.anchor = GridBagConstraints.NORTHWEST;
-        leftPanel.add(buttonPanel);
-
-        plotComboBox = new JComboBox<Object>();
+        saveButton.setAlignmentX(CENTER_ALIGNMENT);
+        leftPanel.add(saveButton);
+        
+        leftPanel.add(new Box.Filler(filler, filler, filler));
+
+        // Combo box for selecting plotted object.
+        plotComboBox = new JComboBox<Object>() {
+            public Dimension getMaximumSize() {
+                Dimension max = super.getMaximumSize();
+                max.height = getPreferredSize().height;
+                return max;
+            }
+        };
         plotComboBox.setActionCommand(PLOT_SELECTED);
+        plotComboBox.setAlignmentX(CENTER_ALIGNMENT);
         plotComboBox.setRenderer(new BasicComboBoxRenderer() {
             @SuppressWarnings("rawtypes")
             public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
@@ -98,12 +111,15 @@
         plotComboBox.addActionListener(this);
         leftPanel.add(plotComboBox);
         
+        leftPanel.add(new Box.Filler(filler, filler, filler));
+        
+        // Table with plot info.
         String data[][] = new String[0][0];
         model = new DefaultTableModel(data, COLUMN_NAMES);
+        model.setColumnIdentifiers(COLUMN_NAMES);
         infoTable.setModel(model);
-        infoTable.getColumn("Field").setMinWidth(25);
-        infoTable.getColumn("Value").setMinWidth(20);
-        infoTable.setMinimumSize(new Dimension(100, 200));
+        ((DefaultTableModel)infoTable.getModel()).setRowCount(MAX_ROWS);
+        infoTable.setAlignmentX(CENTER_ALIGNMENT);
         leftPanel.add(infoTable);
         
         add(leftPanel);
@@ -185,8 +201,6 @@
     synchronized void setCurrentRegion(PlotterRegion region) {
         if (region != currentRegion) {
             currentRegion = region;
-            //if (currentRegion.title() != null)
-            //    setTitle(currentRegion.title());
             updateComboBox();
             setCurrentObject(plotComboBox.getSelectedItem());
             setupContentPane();
@@ -206,8 +220,7 @@
      * Update the info table from the state of the current AIDA object.
      */
     void updateTable() {
-        model.setRowCount(0);
-        model.setColumnIdentifiers(COLUMN_NAMES);
+        model.setRowCount(0);        
         if (currentObject instanceof IHistogram1D) {
             addRows((IHistogram1D) currentObject);
         } else if (currentObject instanceof IHistogram2D) {

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use