Changeset 2539

Show
Ignore:
Timestamp:
10/24/08 16:19:15 (3 months ago)
Author:
huangb
Message:

Have an export button on the top of window.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plugins/visualization/edu.iu.nwb.visualization.prefuse.beta/src/edu/iu/nwb/visualization/prefuse/beta/common/AbstractVisualization.java

    r2535 r2539  
    104104         
    105105        //      guaranteed to be called after getLayoutActions and getInitialDrawActions 
    106         protected abstract void arrangeComponents(JFrame frame, Display display, JComponent legend); 
     106        protected abstract Component arrangeComponents(Display display, JComponent legend); 
     107         
     108        protected abstract void setTitle(JFrame frame); 
    107109         
    108110        //right now everything should return null; the return parameter is a remainder of experiments in getting graphs out of visualizations 
     
    366368                //create a frame to stick everything in 
    367369        final JFrame frame = new JFrame(); 
    368  
    369        KeyAdapter keyAdapter = new KeyAdapter() { 
     370        JPanel contentPane = new JPanel(new BorderLayout()); 
     371         
     372        KeyAdapter keyAdapter = new KeyAdapter() { 
    370373                                 
    371374 
     
    395398        scrollPane.setPreferredSize(new Dimension(100, Math.min(180, maxHeight * 2))); 
    396399        display.setOpaque(true); 
    397         JPanel wrapper = new JPanel(new BorderLayout()); 
    398         wrapper.add(exportButton, BorderLayout.NORTH); 
    399         wrapper.add(scrollPane, BorderLayout.CENTER);  
    400         wrapper.addKeyListener(keyAdapter);   
    401  
    402         //let the given visualization layout the frame as desired 
    403 //              this.arrangeComponents(frame, display, scrollPane); 
    404         this.arrangeComponents(frame, display, wrapper); 
     400         
     401        Component thePanel = this.arrangeComponents(display, scrollPane); 
     402        contentPane.add(exportButton, BorderLayout.NORTH); 
     403        contentPane.add(thePanel, BorderLayout.CENTER); 
     404         
     405        this.setTitle(frame); 
     406        frame.setContentPane(contentPane); 
    405407                 
    406408                //standard boilerplate 
  • trunk/plugins/visualization/edu.iu.nwb.visualization.prefuse.beta/src/edu/iu/nwb/visualization/prefuse/beta/fruchtermanreingold/FruchtermanReingoldVisualization.java

    r1975 r2539  
    33import java.awt.BorderLayout; 
    44import java.util.Dictionary; 
     5import java.awt.Component; 
    56 
    67import javax.swing.JComponent; 
     
    1516import prefuse.action.layout.graph.FruchtermanReingoldLayout; 
    1617import edu.iu.nwb.visualization.prefuse.beta.common.AbstractVisualization; 
    17  
    18  
    1918 
    2019 
     
    3534        } 
    3635         
    37         public void arrangeComponents(JFrame frame, Display display, JComponent legend) { 
    38                 frame.setTitle("Fruchterman-Reingold with Annotation (prefuse beta)"); 
     36        protected Component arrangeComponents(Display display, JComponent legend) { 
     37                 
    3938                 
    4039                JPanel panel = new JPanel(new BorderLayout()); 
    4140        panel.add(display, BorderLayout.CENTER); 
    4241        panel.add(legend, BorderLayout.SOUTH); 
    43          
    44         frame.setContentPane(panel); 
     42        return panel; 
     43 
     44        } 
     45         
     46        protected void setTitle (JFrame frame){ 
     47                frame.setTitle("Fruchterman-Reingold with Annotation (prefuse beta)"); 
    4548        } 
    4649 
  • trunk/plugins/visualization/edu.iu.nwb.visualization.prefuse.beta/src/edu/iu/nwb/visualization/prefuse/beta/graphview/ForceDirectedVisualization.java

    r1975 r2539  
    44import java.awt.Color; 
    55import java.awt.Dimension; 
     6import java.awt.Component; 
    67import java.util.Dictionary; 
    78 
     
    3738        private int hops = 30;; 
    3839 
    39         protected void arrangeComponents(JFrame frame, final Display display, 
     40        protected Component arrangeComponents(final Display display, 
    4041                        JComponent legend) { 
    41                  
    42                  
    4342                 
    4443                display.pan(350, 350); 
     
    8180        panel.add(legend, BorderLayout.SOUTH); 
    8281         
    83         frame.setContentPane(panel); 
    84          
    85         frame.setTitle("Force Directed with Annotation (prefuse beta)"); 
    86                 /* frame.addWindowListener(new WindowAdapter() { 
    87             public void windowActivated(WindowEvent e) { 
    88                 display.getVisualization().run(LAYOUT); 
    89             } 
    90             public void windowDeactivated(WindowEvent e) { 
    91                 display.getVisualization().cancel(LAYOUT); 
    92             } 
    93         }); */ 
     82        return panel;      
    9483 
    9584        } 
     
    137126                return animate; 
    138127        } 
     128         
     129        protected void setTitle (JFrame frame){ 
     130               frame.setTitle("Force Directed with Annotation (prefuse beta)"); 
     131        } 
    139132 
    140133} 
  • trunk/plugins/visualization/edu.iu.nwb.visualization.prefuse.beta/src/edu/iu/nwb/visualization/prefuse/beta/radialgraph/RadialVisualization.java

    r1975 r2539  
    33import java.awt.BorderLayout; 
    44import java.awt.Dimension; 
     5import java.awt.Component; 
    56import java.awt.event.MouseEvent; 
    67import java.util.Dictionary; 
     
    4445 
    4546 
    46         protected void arrangeComponents(JFrame frame, Display display, 
     47        protected Component arrangeComponents(Display display, 
    4748                        JComponent legend) { 
    4849                 
     
    8081        overall.add(legend, BorderLayout.SOUTH); 
    8182         
    82         frame.setContentPane(overall); 
    83         frame.setTitle("Radial Tree/Graph with Annotation (prefuse beta)"); 
     83        return overall;  
    8484        } 
    8585 
     86        protected void setTitle (JFrame frame){ 
     87                frame.setTitle("Radial Tree/Graph with Annotation (prefuse beta)"); 
     88        } 
     89         
    8690        protected Action getInitialDrawActions(String everythingGroup, 
    8791                        Visualization visualization, Dictionary parameters) {