PageRenderTime 17ms CodeModel.GetById 3ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/src/src/edu/psu/bd/math/grooms/GRoomsAnalyzer.java

http://grooms.googlecode.com/
Java | 101 lines | 63 code | 21 blank | 17 comment | 5 complexity | da913338bdeb3b36dc23a3e6ced5088b MD5 | raw file
  1/*
  2 * GRoomsAnalyzer.java
  3 *
  4 * Created on August 25, 2007, 1:59 PM
  5 *
  6 * To change this template, choose Tools | Template Manager
  7 * and open the template in the editor.
  8 */
  9
 10package edu.psu.bd.math.grooms;
 11
 12import java.awt.Font;
 13import java.awt.GridBagConstraints;
 14import java.awt.GridBagLayout;
 15import java.awt.GridLayout;
 16import java.util.EnumSet;
 17import java.util.concurrent.BlockingQueue;
 18import javax.swing.BorderFactory;
 19import javax.swing.JFrame;
 20import javax.swing.JPanel;
 21import javax.swing.JScrollPane;
 22import org.cgsuite.plugin.GridEditorPanel;
 23import org.cgsuite.util.Grid;
 24
 25/**
 26 *
 27 * @author jfp149
 28 */
 29public final class GRoomsAnalyzer extends JPanel {
 30    
 31    
 32    
 33    /** Creates a new instance of GRoomsAnalyzer */
 34    public GRoomsAnalyzer(GoRoom gr, Grid[] grids) {
 35        super(new GridBagLayout());
 36        
 37        GridEditorPanel newGep = new
 38                GridEditorPanel(gr.getGrid());
 39        newGep.setPermissions(EnumSet.noneOf(
 40                GridEditorPanel.Permission.class));
 41        
 42        if(grids.length==2){
 43        MultiLineLabel whiteGridLabel = new MultiLineLabel
 44                (Algorithms.toString(grids[1]));
 45        MultiLineLabel blackGridLabel = new MultiLineLabel
 46                (Algorithms.toString(grids[0]));
 47        JPanel blackPanel = new JPanel();
 48        blackPanel.setBorder(BorderFactory.createTitledBorder("Black"));
 49        JPanel whitePanel = new JPanel();
 50        whitePanel.setBorder(BorderFactory.createTitledBorder("White"));
 51        
 52        blackGridLabel.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
 53        whiteGridLabel.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
 54        blackGridLabel.setAlignment(blackGridLabel.RIGHT);
 55        whiteGridLabel.setAlignment(whiteGridLabel.RIGHT);
 56        whitePanel.add(whiteGridLabel);
 57        blackPanel.add(blackGridLabel);
 58        
 59        
 60        JPanel infoPanel = new JPanel(new GridLayout(0, 1));
 61        infoPanel.setBorder(BorderFactory.createEtchedBorder());
 62        infoPanel.add(blackPanel);
 63        infoPanel.add(whitePanel);
 64        final GridBagConstraints c3 = new GridBagConstraints ();
 65        c3.anchor = c3.NORTH;
 66        c3.fill = c3.BOTH;
 67        add(infoPanel,c3);}
 68        
 69        if (grids.length == 1){
 70            newGep.setGrid(grids[0]);
 71        }
 72        GridBagConstraints c2 = new GridBagConstraints ();
 73        c2.anchor = c2.NORTH;
 74        c2.fill = c2.BOTH;
 75        c2.gridx = 1;
 76        c2.gridy = 0;
 77        add(newGep,c2);
 78        
 79        if(grids.length == 2){
 80        
 81        GoTree gt = new GoTree(gr,newGep);
 82                
 83        //JPanel wrapper = new JPanel();
 84        //wrapper.setBorder(BorderFactory.createTitledBorder("Tree"));
 85        
 86        //wrapper.add(new JScrollPane(gt));
 87        
 88        //wrapper, infoPanel, newGep
 89        GridBagConstraints c = new GridBagConstraints ();
 90        
 91        c.gridx = 0;
 92        c.gridy = 1;
 93        c.gridwidth = 2;
 94        c.fill = c.BOTH;
 95        add(new JScrollPane(gt),c);
 96        }
 97        
 98    }
 99
100    
101}