PageRenderTime 53ms CodeModel.GetById 20ms RepoModel.GetById 2ms 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. package edu.psu.bd.math.grooms;
  10. import java.awt.Font;
  11. import java.awt.GridBagConstraints;
  12. import java.awt.GridBagLayout;
  13. import java.awt.GridLayout;
  14. import java.util.EnumSet;
  15. import java.util.concurrent.BlockingQueue;
  16. import javax.swing.BorderFactory;
  17. import javax.swing.JFrame;
  18. import javax.swing.JPanel;
  19. import javax.swing.JScrollPane;
  20. import org.cgsuite.plugin.GridEditorPanel;
  21. import org.cgsuite.util.Grid;
  22. /**
  23. *
  24. * @author jfp149
  25. */
  26. public final class GRoomsAnalyzer extends JPanel {
  27. /** Creates a new instance of GRoomsAnalyzer */
  28. public GRoomsAnalyzer(GoRoom gr, Grid[] grids) {
  29. super(new GridBagLayout());
  30. GridEditorPanel newGep = new
  31. GridEditorPanel(gr.getGrid());
  32. newGep.setPermissions(EnumSet.noneOf(
  33. GridEditorPanel.Permission.class));
  34. if(grids.length==2){
  35. MultiLineLabel whiteGridLabel = new MultiLineLabel
  36. (Algorithms.toString(grids[1]));
  37. MultiLineLabel blackGridLabel = new MultiLineLabel
  38. (Algorithms.toString(grids[0]));
  39. JPanel blackPanel = new JPanel();
  40. blackPanel.setBorder(BorderFactory.createTitledBorder("Black"));
  41. JPanel whitePanel = new JPanel();
  42. whitePanel.setBorder(BorderFactory.createTitledBorder("White"));
  43. blackGridLabel.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
  44. whiteGridLabel.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
  45. blackGridLabel.setAlignment(blackGridLabel.RIGHT);
  46. whiteGridLabel.setAlignment(whiteGridLabel.RIGHT);
  47. whitePanel.add(whiteGridLabel);
  48. blackPanel.add(blackGridLabel);
  49. JPanel infoPanel = new JPanel(new GridLayout(0, 1));
  50. infoPanel.setBorder(BorderFactory.createEtchedBorder());
  51. infoPanel.add(blackPanel);
  52. infoPanel.add(whitePanel);
  53. final GridBagConstraints c3 = new GridBagConstraints ();
  54. c3.anchor = c3.NORTH;
  55. c3.fill = c3.BOTH;
  56. add(infoPanel,c3);}
  57. if (grids.length == 1){
  58. newGep.setGrid(grids[0]);
  59. }
  60. GridBagConstraints c2 = new GridBagConstraints ();
  61. c2.anchor = c2.NORTH;
  62. c2.fill = c2.BOTH;
  63. c2.gridx = 1;
  64. c2.gridy = 0;
  65. add(newGep,c2);
  66. if(grids.length == 2){
  67. GoTree gt = new GoTree(gr,newGep);
  68. //JPanel wrapper = new JPanel();
  69. //wrapper.setBorder(BorderFactory.createTitledBorder("Tree"));
  70. //wrapper.add(new JScrollPane(gt));
  71. //wrapper, infoPanel, newGep
  72. GridBagConstraints c = new GridBagConstraints ();
  73. c.gridx = 0;
  74. c.gridy = 1;
  75. c.gridwidth = 2;
  76. c.fill = c.BOTH;
  77. add(new JScrollPane(gt),c);
  78. }
  79. }
  80. }