KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > versioning > system > cvss > ui > history > SearchHistoryTopComponent


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.versioning.system.cvss.ui.history;
21
22 import org.openide.windows.TopComponent;
23 import org.openide.util.NbBundle;
24 import org.openide.util.HelpCtx;
25 import org.netbeans.modules.versioning.system.cvss.util.Context;
26 import org.netbeans.modules.versioning.system.cvss.ui.actions.diff.DiffSetupSource;
27
28 import java.awt.BorderLayout JavaDoc;
29 import java.io.File JavaDoc;
30 import java.util.*;
31
32 /**
33  * Search History component.
34  *
35  * @author Maros Sandor
36  */

37 public class SearchHistoryTopComponent extends TopComponent implements DiffSetupSource {
38
39     private SearchHistoryPanel shp;
40
41     public SearchHistoryTopComponent() {
42     }
43     
44     public SearchHistoryTopComponent(Context context) {
45         this(context, null, null, null, null);
46     }
47
48     public SearchHistoryTopComponent(Context context, String JavaDoc commitMessage, String JavaDoc username, Date from, Date to) {
49         initComponents(context.getRootFiles(), commitMessage, username, from, to);
50         getAccessibleContext().setAccessibleName(NbBundle.getMessage(SearchHistoryTopComponent.class, "ACSN_SearchHistoryT_Top_Component")); // NOI18N
51
getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(SearchHistoryTopComponent.class, "ACSD_SearchHistoryT_Top_Component")); // NOI18N
52
}
53
54     public void search() {
55         shp.executeSearch();
56         shp.setSearchCriteriaVisible(false);
57     }
58     
59     private void initComponents(File JavaDoc[] roots, String JavaDoc commitMessage, String JavaDoc username, Date from, Date to) {
60         setLayout(new BorderLayout JavaDoc());
61         SearchCriteriaPanel scp = new SearchCriteriaPanel(roots);
62         scp.setCommitMessage(commitMessage);
63         scp.setUsername(username);
64         if (from != null) scp.setFrom(SearchExecutor.simpleDateFormat.format(from));
65         if (to != null) scp.setTo(SearchExecutor.simpleDateFormat.format(to));
66         shp = new SearchHistoryPanel(roots, scp);
67         add(shp);
68     }
69
70     public int getPersistenceType(){
71        return TopComponent.PERSISTENCE_NEVER;
72     }
73     
74     protected void componentClosed() {
75 // ((DiffMainPanel) getComponent(0)).componentClosed();
76
super.componentClosed();
77     }
78     
79     protected String JavaDoc preferredID(){
80        return "SearchHistoryTopComponent"; // NOI18N
81
}
82
83     public HelpCtx getHelpCtx() {
84         return new HelpCtx(getClass());
85     }
86
87     public Collection getSetups() {
88         return shp.getSetups();
89     }
90
91     public String JavaDoc getSetupDisplayName() {
92         return getDisplayName();
93     }
94 }
95
Popular Tags