Пример #1
2
 /**
  * This function is used to re-run the analyser, and re-create the rows corresponding the its
  * results.
  */
 private void refreshReviewTable() {
   reviewPanel.removeAll();
   rows.clear();
   GridBagLayout gbl = new GridBagLayout();
   reviewPanel.setLayout(gbl);
   GridBagConstraints gbc = new GridBagConstraints();
   gbc.fill = GridBagConstraints.HORIZONTAL;
   gbc.gridy = 0;
   try {
     Map<String, Long> sums =
         analyser.processLogFile(config.getLogFilename(), fromDate.getDate(), toDate.getDate());
     for (Entry<String, Long> entry : sums.entrySet()) {
       String project = entry.getKey();
       double hours = 1.0 * entry.getValue() / (1000 * 3600);
       addRow(gbl, gbc, project, hours);
     }
     for (String project : main.getProjectsTree().getTopLevelProjects())
       if (!rows.containsKey(project)) addRow(gbl, gbc, project, 0);
     gbc.insets = new Insets(10, 0, 0, 0);
     addLeftLabel(gbl, gbc, "TOTAL");
     gbc.gridx = 1;
     gbc.weightx = 1;
     totalLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 3));
     gbl.setConstraints(totalLabel, gbc);
     reviewPanel.add(totalLabel);
     gbc.weightx = 0;
     addRightLabel(gbl, gbc);
   } catch (IOException e) {
     e.printStackTrace();
   }
   recomputeTotal();
   pack();
 }
Пример #2
0
  /*
  public void addMiniChart(Plugin p){
  	components.add(p);

  	rebuild();
  }

  public void removeMiniChart(Plugin p){
  	components.remove(p);
  	rebuild();

  }
  */
  public void rebuild() {
    // remove everything from main panel
    mainpanel.removeAll();

    GridBagLayout gbl = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();
    mainpanel.setLayout(gbl);

    gbc.anchor = gbc.NORTHWEST;
    gbc.fill = gbc.BOTH;
    gbc.weightx = 1;
    gbc.gridx = 0;

    int i = 0;
    // add chart

    gbc.weighty = 1;
    gbc.gridy = i;
    gbl.setConstraints(chartPanel, gbc);
    mainpanel.add(chartPanel);

    // add all other plugins/components
    validate();
  }