Esempio n. 1
0
  public AggregateViewer(Controller controller) {
    // Basic instantiation
    myTurtle = new Turtle(0, 0);
    myController = controller;
    myPanel = new JSplitPane();
    myPanel.setLayout(new BorderLayout());
    JList myCommands = new JList();
    JTextArea myOutput = new JTextArea(300, 100);
    myGame = new TurtleViewer(myTurtle, TURTLE_SIZE, this);
    textView = new TopLeftView(myCommands, myOutput);
    myTextInput = new TextInputArea(myController);
    LeftView myUpperView = new LeftView(textView, myTextInput);
    myPanel = new FullView(myUpperView, myGame);

    setSize(1200, 800);
    add(myPanel);
    setVisible(true);
  }
Esempio n. 2
0
  public JipViewer(String title, JipRun run) {
    super(title);

    addKeyListener(this);
    mMethodModel.addChangeListener(this);

    // build the call tree
    mCallTreeRoot = new TreeNode(title);
    buildTree(run, mCallTreeRoot);

    mCallTree = new JTree(mCallTreeRoot);
    mCallTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    mCallTree.addTreeSelectionListener(this);
    mCallTree.addKeyListener(this);

    // build the allMethods table
    Collection<JipRun.PerMethodInfo> perMethodInfos = run.perMethodsInTotalTimeOrder();
    long totalTimeForAllThreads = run.getTotalTimeForAllThreads();
    for (JipRun.PerMethodInfo perMethod : perMethodInfos) {
      MethodRow row = new MethodRow(perMethod.getMethod());
      for (JipFrame frame : perMethod.allFrames()) {
        if (!frame.isReentrant()) {
          row.addFrame(frame);
        }
        row.setTimeDenominator(totalTimeForAllThreads);
      }
      mAllMethodsModel.add(row);
    }
    mAllMethodsModel.sort();
    mMethods = MethodViewer.makeTableForMethodRows(mAllMethodsModel);
    mMethods.getSelectionModel().addListSelectionListener(this);
    mMethods.addKeyListener(this);
    mAllMethodsSorterModel = (TableSorter) mMethods.getModel();

    // make the ByPackageViewer
    mPkgViewer = new ByPackageViewer(run);
    mPkgViewer.addKeyListener(this);

    // Make the classs count viewer

    mClassAllocationViewer = new ClassAllocationViewer(run);
    mClassAllocationViewer.addKeyListener(this);

    if (instanceNumero == 0) {
      // make the RemoteController only if root
      mRemoteController = new RemoteController();
      mRemoteController.addKeyListener(this);
    }

    // make the methodViewer
    MethodViewer methodViewerMethods = new MethodViewer(run, mMethodModel);
    MethodViewer methodViewerCallTree = new MethodViewer(run, mMethodModel);

    // combine all the views
    JTabbedPane tabPane = new JTabbedPane();
    if (instanceNumero != 0 || FIRST_HAS_DATA) {
      JSplitPane splitPane =
          new JSplitPane(
              JSplitPane.VERTICAL_SPLIT, new JScrollPane(mCallTree), methodViewerCallTree);
      splitPane.setLayout(new BoxLayout(splitPane, BoxLayout.Y_AXIS));
      tabPane.addTab("call tree", splitPane);
      splitPane =
          new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JScrollPane(mMethods), methodViewerMethods);
      splitPane.setLayout(new BoxLayout(splitPane, BoxLayout.Y_AXIS));
      tabPane.addTab("methods", splitPane);
      tabPane.addTab("by package", new JScrollPane(mPkgViewer));
      tabPane.addTab("class allocation", mClassAllocationViewer);
    }

    if (instanceNumero == 0) {
      tabPane.addTab("remote control", mRemoteController);
    }

    tabPane.addTab("help", new HelpViewer());
    tabPane.addKeyListener(this);
    setContentPane(tabPane);
    pack();
    setSize(new Dimension(1024, 768));
    setVisible(true);

    if (instanceNumero == 0) {
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    } else {
      setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    }
    instanceNumero++;
  }