alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 *
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 *
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
 * Microsystems, Inc. All Rights Reserved.
 */

package org.netbeans.modules.cvsclient.commands.annotate;


import java.io.*;
import java.util.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.tree.DefaultMutableTreeNode;

import org.netbeans.lib.cvsclient.command.annotate.AnnotateCommand;
import org.netbeans.lib.cvsclient.command.annotate.AnnotateInformation;
import org.netbeans.modules.cvsclient.FsCommandFactory;
import org.openide.util.*;
import org.netbeans.modules.cvsclient.commands.*;
import org.netbeans.modules.javacvs.commands.FileSystemCommand;
import org.netbeans.modules.javacvs.commands.CvsAnnotate;
import org.netbeans.lib.cvsclient.command.*;
import org.netbeans.modules.vcscore.ui.*;
import org.netbeans.modules.vcscore.util.table.*;

/**
 *
 * @author  mkleint
 * @version
 */
public class AnnotateTreeInfoPanel extends AbstractTreeInfoPanel implements PersistentCommandDisplayer {
    
    private AnnotateInfoPanel annotatePanel;
    private AnnotateInformation clearAnnInfo;
    private CvsAnnotate command;
    /** Creates new form StatusTreeInfoPanel */
    public AnnotateTreeInfoPanel(File topDir, CvsAnnotate comm) {
        super(topDir);
        command = comm;
        initPanelComponenents();
        postInit();
 //       recreateModel();
    }
    
    private void initPanelComponenents() {
        JPanel panel = getButtonPanel();
    }    
    
    
  private void initClearInfo() {
      clearAnnInfo = new AnnotateInformation();
      clearAnnInfo.setFile(new File("")); //NOI18N
  }
  
  
  protected void setPanel(Object infoData) {
      AnnotateInformation annData = (AnnotateInformation)infoData;
      annotatePanel.setData(annData);
  }
  
  protected JComponent initPanel() {
      initClearInfo();
      annotatePanel = new AnnotateInfoPanel(command);
      setClearPanel();
      return annotatePanel.getComponent();
  }
  
  protected void setClearPanel() {
      annotatePanel.setData(clearAnnInfo);
  }

/** Does the actual display - docking into the javacvs Mode, 
 *  displaying as single Dialog.. whatever.
 */
  public void displayOutputData() {
     String title = NbBundle.getMessage(AnnotateTreeInfoPanel.class, 
                                     "CvsAnnotate.dialogTitle", topDirectory.getName()); //NOI18N
     FsCommandFactory.displayOutputPanel(title, this);

  }
  
  /** defines which InfoContainer instances will be added to the tree
   * By default adds all, can be overriden by subclasses to define filtering
 */
  protected void addFileNode(FileInfoContainer info,DefaultMutableTreeNode parent) {
/*      LogInformation logInfo = (LogInformation)info;
      totalCount = totalCount + 1;
      if (shouldAddLogInfo(logInfo)) {
            DefaultMutableTreeNode child = new DefaultMutableTreeNode(info);
            parent.add(child);
            selectedCount = selectedCount + 1;
      }    
 */
      DefaultMutableTreeNode child = new DefaultMutableTreeNode(info);
      parent.add(child);
  }
  
  /** defines which InfoContainer instances will be added to the table
   * By default adds all, can be overriden by subclasses to define filtering
 */
  protected boolean addToList(FileInfoContainer info) {
//      LogInformation logInfo = (LogInformation)info;
//      return shouldAddLogInfo(logInfo);
      return true;
  }
  
  
  /** in this method the displayer should use the data returned by the command to
   * produce it's own data structures/ fill in UI components
   * @param resultList - the data from the command. It is assumed the Displayer 
   * knows what command the data comes from and most important in what format. 
   * (which FileInfoContainer class is used).
 */
  public void setDataToDisplay(Collection resultList) {
//      totalCount = 0;
//      selectedCount = 0;
      super.setDataToDisplay(resultList);
/*      Integer selCount = new Integer(selectedCount);
      Integer totCount = new Integer(totalCount);
      String txt = NbBundle.getMessage(LogTreeInfoPanel.class, "LogTreeInfoPanel.lblCount",
                                selCount.toString(), totCount.toString());
      lblCount.setText(txt);
 */
  }

  
  public void setCommand(CvsAnnotate comm) {
        command = comm;
  }
 
  public JComponent getComponent() {
      return this;
  }
  
  public Object getComparisonData() {
      return topDirectory;
  }
  
  /**
   * Persistent stuff...
   */
  public boolean equalDisplayedData(File file, Class type, Object comparisonData) {
      if (!getClass().equals(type)) return false;
      if (topDirectory == null || 
                !topDirectory.equals(file)) {
          return false;
      }
      return true;
  }
  
  public File getFileDisplayed() {
      return topDirectory;
  }
  
  
  public String getCommandSwitches() {
      return command.getCVSArguments();
  }
  
  
  public FileSystemCommand getFileSystemCommand() {
      return command;
  }
  
  public void closeNotify() {
    super.closeNotify();
  }  
  
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.