1 19 20 package org.netbeans.modules.versioning.system.cvss.ui.history; 21 22 import org.openide.util.RequestProcessor; 23 import org.openide.util.NbBundle; 24 import org.openide.util.Lookup; 25 import org.openide.explorer.ExplorerManager; 26 import org.openide.nodes.Node; 27 import org.openide.windows.TopComponent; 28 import org.openide.awt.Mnemonics; 29 import org.openide.filesystems.FileObject; 30 import org.netbeans.modules.versioning.system.cvss.util.Utils; 31 import org.netbeans.modules.versioning.system.cvss.CvsVersioningSystem; 32 import org.netbeans.modules.versioning.system.cvss.VersionsCache; 33 import org.netbeans.modules.versioning.system.cvss.ui.actions.diff.DiffSetupSource; 34 import org.netbeans.modules.versioning.system.cvss.ui.actions.diff.Setup; 35 import org.netbeans.modules.versioning.util.NoContentPanel; 36 import org.netbeans.lib.cvsclient.command.log.LogInformation; 37 import org.netbeans.api.project.Project; 38 39 import javax.swing.*; 40 import java.io.File ; 41 import java.util.*; 42 import java.beans.PropertyChangeEvent ; 43 import java.beans.PropertyChangeListener ; 44 import java.awt.event.KeyEvent ; 45 import java.awt.event.ActionEvent ; 46 import java.awt.event.ActionListener ; 47 import java.awt.Dimension ; 48 49 54 class SearchHistoryPanel extends javax.swing.JPanel implements ExplorerManager.Provider, PropertyChangeListener , ActionListener , DiffSetupSource { 55 56 private final File [] roots; 57 private final SearchCriteriaPanel criteria; 58 59 private Divider divider; 60 private RequestProcessor.Task currentSearchTask; 61 62 private boolean criteriaVisible; 63 private boolean searchInProgress; 64 private List results; 65 private List<Object > dispResults; 66 private SummaryView summaryView; 67 private DiffResultsView diffView; 68 69 private AbstractAction nextAction; 70 private AbstractAction prevAction; 71 72 private Map<File , Project> fileProjects = new HashMap<File , Project>(100); 73 74 75 public SearchHistoryPanel(File [] roots, SearchCriteriaPanel criteria) { 76 this.roots = roots; 77 this.criteria = criteria; 78 criteriaVisible = true; 79 explorerManager = new ExplorerManager (); 80 initComponents(); 81 setupComponents(); 82 refreshComponents(true); 83 } 84 85 private void setupComponents() { 86 remove(jPanel1); 87 88 divider = new Divider(this); 89 java.awt.GridBagConstraints gridBagConstraints; 90 gridBagConstraints = new java.awt.GridBagConstraints (); 91 gridBagConstraints.gridy = 2; 92 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 93 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 94 gridBagConstraints.weightx = 1.0; 95 gridBagConstraints.insets = new java.awt.Insets (2, 0, 2, 0); 96 add(divider, gridBagConstraints); 97 98 searchCriteriaPanel.add(criteria); 99 Action searchAction = new AbstractAction(NbBundle.getMessage(SearchHistoryPanel.class, "CTL_Search")) { { 101 putValue(Action.SHORT_DESCRIPTION, NbBundle.getMessage(SearchHistoryPanel.class, "TT_Search")); } 103 public void actionPerformed(ActionEvent e) { 104 search(); 105 } 106 }; 107 getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "search"); getActionMap().put("search", searchAction); bSearch.setAction(searchAction); 110 Mnemonics.setLocalizedText(bSearch, NbBundle.getMessage(SearchHistoryPanel.class, "CTL_Search")); 112 Dimension d1 = tbSummary.getPreferredSize(); 113 Dimension d2 = tbDiff.getPreferredSize(); 114 if (d1.width > d2.width) { 115 tbDiff.setPreferredSize(d1); 116 } 117 118 nextAction = new AbstractAction(null, new javax.swing.ImageIcon (getClass().getResource("/org/netbeans/modules/versioning/system/cvss/resources/icons/diff-next.png"))) { { 120 putValue(Action.SHORT_DESCRIPTION, java.util.ResourceBundle.getBundle("org/netbeans/modules/versioning/system/cvss/ui/actions/diff/Bundle"). 121 getString("CTL_DiffPanel_Next_Tooltip")); 122 } 123 public void actionPerformed(ActionEvent e) { 124 diffView.onNextButton(); 125 } 126 }; 127 prevAction = new AbstractAction(null, new javax.swing.ImageIcon (getClass().getResource("/org/netbeans/modules/versioning/system/cvss/resources/icons/diff-prev.png"))) { { 129 putValue(Action.SHORT_DESCRIPTION, java.util.ResourceBundle.getBundle("org/netbeans/modules/versioning/system/cvss/ui/actions/diff/Bundle"). 130 getString("CTL_DiffPanel_Prev_Tooltip")); 131 } 132 public void actionPerformed(ActionEvent e) { 133 diffView.onPrevButton(); 134 } 135 }; 136 bNext.setAction(nextAction); 137 bPrev.setAction(prevAction); 138 139 getActionMap().put("jumpNext", nextAction); getActionMap().put("jumpPrev", prevAction); } 142 143 public void actionPerformed(ActionEvent e) { 144 if (e.getID() == Divider.DIVIDER_CLICKED) { 145 criteriaVisible = !criteriaVisible; 146 refreshComponents(false); 147 } 148 } 149 150 void setSearchCriteriaVisible(boolean visible) { 151 criteriaVisible = visible; 152 refreshComponents(false); 153 } 154 155 private ExplorerManager explorerManager; 156 157 public void propertyChange(PropertyChangeEvent evt) { 158 if (ExplorerManager.PROP_SELECTED_NODES.equals(evt.getPropertyName())) { 159 TopComponent tc = (TopComponent) SwingUtilities.getAncestorOfClass(TopComponent.class, this); 160 if (tc == null) return; 161 tc.setActivatedNodes((Node[]) evt.getNewValue()); 162 } 163 } 164 165 public void addNotify() { 166 super.addNotify(); 167 explorerManager.addPropertyChangeListener(this); 168 } 169 170 public void removeNotify() { 171 explorerManager.removePropertyChangeListener(this); 172 super.removeNotify(); 173 } 174 175 public ExplorerManager getExplorerManager () { 176 return explorerManager; 177 } 178 179 final void refreshComponents(boolean refreshResults) { 180 if (refreshResults) { 181 resultsPanel.removeAll(); 182 if (results == null) { 183 if (searchInProgress) { 184 resultsPanel.add(new NoContentPanel(NbBundle.getMessage(SearchHistoryPanel.class, "LBL_SearchHistory_Searching"))); } else { 186 resultsPanel.add(new NoContentPanel(NbBundle.getMessage(SearchHistoryPanel.class, "LBL_SearchHistory_NoResults"))); } 188 } else { 189 if (tbSummary.isSelected()) { 190 if (summaryView == null) { 191 summaryView = new SummaryView(this, dispResults); 192 } 193 resultsPanel.add(summaryView.getComponent()); 194 } else { 195 if (diffView == null) { 196 diffView = new DiffResultsView(this, dispResults); 197 } 198 resultsPanel.add(diffView.getComponent()); 199 } 200 } 201 resultsPanel.revalidate(); 202 resultsPanel.repaint(); 203 } 204 nextAction.setEnabled(!tbSummary.isSelected() && diffView != null && diffView.isNextEnabled()); 205 prevAction.setEnabled(!tbSummary.isSelected() && diffView != null && diffView.isPrevEnabled()); 206 207 divider.setArrowDirection(criteriaVisible ? Divider.UP : Divider.DOWN); 208 searchCriteriaPanel.setVisible(criteriaVisible); 209 bSearch.setVisible(criteriaVisible); 210 revalidate(); 211 repaint(); 212 } 213 214 219 public void setResults(List newResults) { 220 setResults(newResults, false); 221 } 222 223 private void setResults(List newResults, boolean searching) { 224 if (newResults != null) this.dispResults = createDisplayList(newResults); 225 this.results = newResults; 226 this.searchInProgress = searching; 227 summaryView = null; 228 diffView = null; 229 SwingUtilities.invokeLater(new Runnable () { 230 public void run() { 231 refreshComponents(true); 232 } 233 }); 234 } 235 236 List getDispResults() { 237 return dispResults; 238 } 239 240 private final Project NULL_PROJECT = new Project() { 241 242 public FileObject getProjectDirectory() { 243 return null; 244 } 245 246 public Lookup getLookup() { 247 return null; 248 } 249 }; 250 251 Project getProject(File file) { 252 Project p = fileProjects.get(file); 253 if (p == null) { 254 p = Utils.getProject(file); 255 if (p == null) p = NULL_PROJECT; 256 fileProjects.put(file, p); 257 } 258 if (p == NULL_PROJECT) p = null; 259 return p; 260 } 261 262 public File [] getRoots() { 263 return roots; 264 } 265 266 public SearchCriteriaPanel getCriteria() { 267 return criteria; 268 } 269 270 private synchronized void search() { 271 if (currentSearchTask != null) { 272 currentSearchTask.cancel(); 273 } 274 setResults(null, true); 275 SearchExecutor currentSearch = new SearchExecutor(this); 276 currentSearchTask = RequestProcessor.getDefault().create(currentSearch); 277 currentSearchTask.schedule(0); 278 } 279 280 private List<Object > createDisplayList(List<LogInformation.Revision> inputList) { 281 List dispResults = new ArrayList(); 282 if (inputList.isEmpty()) return dispResults; 283 284 List<LogInformation.Revision> list = new ArrayList<LogInformation.Revision>(inputList); 285 Collections.sort(list, new ByRemotePathRevisionNumberComparator()); 286 287 List<DispRevision> rs = new ArrayList<DispRevision>(list.size()); 288 Set<String > addedBranchNumbers = new HashSet<String >(10); 289 for (LogInformation.Revision revision : list) { 290 String branchNumber = getBranchName(revision); 291 if (branchNumber != null && addedBranchNumbers.add(branchNumber)) { 292 List<LogInformation.SymName> symNames = revision.getLogInfoHeader().getSymNamesForRevision(Utils.createBranchRevisionNumber(branchNumber)); 293 String branchName = null; 294 if (symNames.size() > 0) { 295 branchName = symNames.get(0).getName(); 296 } 297 LogInformation.Revision aRev = revision.getLogInfoHeader().new Revision(); 298 aRev.setNumber(branchNumber); 299 rs.add(new DispRevision(branchNumber, branchName, aRev)); 300 } 301 List<LogInformation.SymName> allTtags = revision.getLogInfoHeader().getAllSymbolicNames(); 302 List<String > revisionTags = new ArrayList<String >(2); 303 List<String > revisionBranches = new ArrayList<String >(2); 304 String aBranch = revision.getNumber() + ".0."; for (LogInformation.SymName name : allTtags) { 306 String nameRevision = name.getRevision(); 307 if (revision.getNumber().equals(nameRevision)) { 308 revisionTags.add(name.getName()); 309 } 310 if (nameRevision.startsWith(aBranch)) { 311 int idx = nameRevision.lastIndexOf('.'); revisionBranches.add(name.getName() + " (" + nameRevision.substring(0, idx - 1) + nameRevision.substring(idx + 1) + ")"); } 314 } 315 rs.add(new DispRevision(revision, revisionTags, revisionBranches)); 316 } 317 318 ResultsContainer currentContainer = null; 319 320 currentContainer = new ResultsContainer((rs.get(0)).getRevision().getLogInfoHeader()); 321 currentContainer.add(createLocalRevision((rs.get(0)).getRevision().getLogInfoHeader())); 322 dispResults.add(currentContainer); 323 324 for (DispRevision revision : rs) { 325 if (currentContainer.getHeader() != revision.getRevision().getLogInfoHeader()) { 326 getProject(currentContainer.getHeader().getFile()); if (currentContainer.getRevisions().size() < 1) { 328 dispResults.remove(currentContainer); 329 if (currentContainer.getRevisions().size() == 1) { 330 dispResults.add(currentContainer.getRevisions().get(0)); 331 } 332 } 333 currentContainer = new ResultsContainer(revision.getRevision().getLogInfoHeader()); 334 currentContainer.add(createLocalRevision(revision.getRevision().getLogInfoHeader())); 335 dispResults.add(currentContainer); 336 } 337 DispRevision parent = getParentRevision(rs, revision); 338 if (parent != null) { 339 parent.addRevision(revision); 340 } else { 341 currentContainer.add(revision); 342 } 343 } 344 if (currentContainer.getRevisions().size() < 1) { 345 dispResults.remove(currentContainer); 346 if (currentContainer.getRevisions().size() == 1) { 347 dispResults.add(currentContainer.getRevisions().get(0)); 348 } 349 } 350 return dispResults; 351 } 352 353 private DispRevision createLocalRevision(LogInformation logInfo) { 354 LogInformation.Revision currentRevision = logInfo.new Revision(); 355 currentRevision.setNumber(VersionsCache.REVISION_CURRENT); 356 return new DispRevision(currentRevision, null, null); 357 } 358 359 private String getBranchName(LogInformation.Revision rev) { 360 String number = rev.getNumber(); 361 int idx = number.lastIndexOf('.', number.lastIndexOf('.') - 1); return (idx == -1) ? null : number.substring(0, number.lastIndexOf('.')); } 364 365 private static DispRevision getParentRevision(List results, DispRevision revision) { 366 String number = revision.getRevision().getNumber(); 367 for (;;) { 368 int idx = number.lastIndexOf('.'); 369 if (idx == -1) return null; 370 number = number.substring(0, idx); 371 LogInformation.Revision parentRev = revision.getRevision().getLogInfoHeader().new Revision(); 372 parentRev.setNumber(number); 373 int index = Collections.binarySearch(results, new DispRevision(parentRev, null, null), revisionsComparator); 374 if (index >= 0) return (DispRevision) results.get(index); 375 } 376 } 377 378 private static final Comparator revisionsComparator = new ByRemotePathRevisionNumberComparator() { 379 public int compare(Object o1, Object o2) { 380 return super.compare(((DispRevision) o1).getRevision(), ((DispRevision) o2).getRevision()); 381 } 382 }; 383 384 void executeSearch() { 385 search(); 386 } 387 388 void showDiff(DispRevision revision) { 389 tbDiff.setSelected(true); 390 refreshComponents(true); 391 diffView.select(revision); 392 } 393 394 public void showDiff(ResultsContainer container) { 395 tbDiff.setSelected(true); 396 refreshComponents(true); 397 diffView.select(container); 398 } 399 400 405 public Collection<Setup> getSetups() { 406 if (dispResults == null) { 407 return Collections.emptySet(); 408 } 409 410 List<Object > selectedItems = dispResults; 411 if (tbSummary.isSelected()) { 412 selectedItems = summaryView.getSelection(); 413 } else { 414 selectedItems = diffView.getSelection(); 415 } 416 417 if (selectedItems.size() == 0) { 419 for (Object o : dispResults) { 420 if (o instanceof ResultsContainer) { 421 selectedItems.add(o); 422 } 423 } 424 } 425 426 List<Setup> setups = new ArrayList<Setup>(selectedItems.size()); 429 Set<LogInformation> includedFiles = new HashSet<LogInformation>(); 430 431 for (Object item : selectedItems) { 432 if (!(item instanceof ResultsContainer)) continue; 433 ResultsContainer entry = (ResultsContainer) item; 434 File file = entry.getHeader().getFile(); 435 436 boolean atomicRange = true; 437 String prev = null; 438 List revisions = entry.getRevisions(); 439 Iterator revs = revisions.iterator(); 440 while (revs.hasNext()) { 441 DispRevision revision = (DispRevision) revs.next(); 442 String rev = revision.getRevision().getNumber(); 443 if (VersionsCache.REVISION_CURRENT.equals(rev)) { 444 continue; 446 } 447 if (prev != null) { 448 if (!rev.equals(Utils.previousRevision(prev))) { 449 atomicRange = false; 450 break; 451 } 452 } 453 prev = rev; 454 } 455 456 if (!atomicRange) { 458 continue; 459 } 460 461 String eldest = entry.getEldestRevision(); 462 String newest = entry.getNewestRevision(); 463 Setup setup = new Setup(file, eldest, newest); 464 includedFiles.add(entry.getHeader()); 465 setups.add(setup); 466 } 467 468 for (int i = 0; i < selectedItems.size(); i++) { 469 Object item = selectedItems.get(i); 470 if (!(item instanceof DispRevision)) continue; 471 DispRevision rev1 = (DispRevision) item; 472 LogInformation header = rev1.getRevision().getLogInfoHeader(); 473 if (includedFiles.contains(header)) continue; 474 String r1 = rev1.getRevision().getNumber(); 475 String r2 = r1; 476 for (int j = i + 1; j < selectedItems.size(); j++) { 477 Object item2 = selectedItems.get(j); 478 if (!(item2 instanceof DispRevision)) continue; 479 DispRevision rev2 = (DispRevision) item2; 480 if (header.equals(rev2.getRevision().getLogInfoHeader())) { 481 r2 = rev2.getRevision().getNumber(); 482 } 483 } 484 if (r2 == null) continue; 485 if (compareRevisions(r1, r2) > 0) { 486 String tmp = r2; 487 r2 = r1; 488 r1 = tmp; 489 } 490 if (Utils.previousRevision(r1) != null) { 491 r1 = Utils.previousRevision(r1); 492 } 493 Setup setup = new Setup(header.getFile(), r1, r2); 494 includedFiles.add(header); 495 setups.add(setup); 496 } 497 498 return setups; 499 } 500 501 public String getSetupDisplayName() { 502 return null; 503 } 504 505 static class ResultsContainer { 506 507 private List<DispRevision> revisions = new ArrayList<DispRevision>(2); 508 private String name; 509 private String path; 510 private final LogInformation header; 511 512 public ResultsContainer(LogInformation header) { 513 this.header = header; 514 File file = header.getFile(); 515 try { 516 name = CvsVersioningSystem.getInstance().getAdminHandler().getRepositoryForDirectory(file.getParentFile().getAbsolutePath(), "") + "/" + file.getName(); } catch (Exception e) { 518 name = header.getRepositoryFilename(); 519 if (name.endsWith(",v")) name = name.substring(0, name.lastIndexOf(",v")); } 521 path = name.substring(0, name.lastIndexOf('/')); 522 name = name.substring(path.length() + 1); 523 } 524 525 public LogInformation getHeader() { 526 return header; 527 } 528 529 public void add(DispRevision revision) { 530 revisions.add(revisions.size(), revision); 531 } 532 533 public String getName() { 534 return name; 535 } 536 537 public List<DispRevision> getRevisions() { 538 return revisions; 539 } 540 541 545 public String getEldestRevision() { 546 DispRevision rev = revisions.get(revisions.size() - 1); 547 String revNumber = Utils.previousRevision(rev.getRevision().getNumber()); 548 return revNumber != null ? revNumber : rev.getRevision().getNumber(); 549 } 550 551 public String getNewestRevision() { 552 String newest = revisions.get(0).getRevision().getNumber(); 553 if (VersionsCache.REVISION_CURRENT.equals(newest)) newest = revisions.get(1).getRevision().getNumber(); 554 return newest; 555 } 556 557 public String getPath() { 558 return path; 559 } 560 561 public File getFile() { 562 return header.getFile(); 563 } 564 565 566 public String toString() { 567 return getName() + " " + getPath(); } 569 } 570 571 static class DispRevision { 572 573 private final LogInformation.Revision revision; 574 private String name; 575 private List children; 576 private String path; 577 private int indentation; 578 579 private final String branchNumber; 580 private final String branchName; 581 private final int hashCode; 582 private final List<String > tags; 583 private final List<String > branches; 584 585 public DispRevision(String branchNumber, String branchName, LogInformation.Revision revision) { 586 this.branchNumber = branchNumber; 587 this.branchName = branchName; 588 this.revision = revision; 589 this.hashCode = branchNumber.hashCode(); 590 tags = null; 591 branches = null; 592 } 593 594 public DispRevision(LogInformation.Revision revision, List<String > tags, List<String > branches) { 595 this.revision = revision; 596 this.tags = tags == null ? null : Collections.unmodifiableList(tags); 597 this.branches = branches == null ? null : Collections.unmodifiableList(branches); 598 this.hashCode = revision.hashCode(); 599 this.branchNumber = null; 600 this.branchName = null; 601 File file = revision.getLogInfoHeader().getFile(); 602 try { 603 name = CvsVersioningSystem.getInstance().getAdminHandler().getRepositoryForDirectory(file.getParentFile().getAbsolutePath(), "") + "/" + file.getName(); } catch (Exception e) { 605 name = revision.getLogInfoHeader().getRepositoryFilename(); 606 if (name.endsWith(",v")) name = name.substring(0, name.lastIndexOf(",v")); } 608 path = name.substring(0, name.lastIndexOf('/')); 609 } 610 611 public List<String > getTags() { 612 return tags; 613 } 614 615 public List<String > getBranches() { 616 return branches; 617 } 618 619 public String getBranchName() { 620 return branchName; 621 } 622 623 public String getName() { 624 return name; 625 } 626 627 public String getPath() { 628 return path; 629 } 630 631 public LogInformation.Revision getRevision() { 632 return revision; 633 } 634 635 public void addRevision(DispRevision revision) { 636 if (children == null) { 637 children = new ArrayList(); 638 } 639 children.add(revision); 640 } 641 642 public List getChildren() { 643 return children; 644 } 645 646 public boolean equals(Object o) { 647 if (this == o) return true; 648 if (!(o instanceof DispRevision)) return false; 649 if (branchNumber != null) { 650 return branchNumber.equals(((DispRevision) o).branchNumber); 651 } 652 return revision.equals(((DispRevision) o).revision); 653 } 654 655 public int hashCode() { 656 return hashCode; 657 } 658 659 public int getIndentation() { 660 return indentation; 661 } 662 663 public void setIndentation(int indentation) { 664 this.indentation = indentation; 665 } 666 667 668 public String toString() { 669 StringBuffer indent = new StringBuffer (" "); for (int i = 0; i<getIndentation(); i++) { 671 indent.append(" "); } 673 StringBuffer text = new StringBuffer (); 674 text.append(indent).append(getRevision().getNumber()).append("\t").append(getRevision().getDateString()).append(" ").append(getRevision().getAuthor()); text.append("\n"); text.append(getRevision().getMessage()); 677 678 return text.toString(); 679 } 680 681 public boolean isBranchRoot() { 682 return branchNumber != null; 683 } 684 } 685 686 689 private static class ByRemotePathRevisionNumberComparator implements Comparator { 690 691 public int compare(Object o1, Object o2) { 692 LogInformation.Revision r1 = (LogInformation.Revision) o1; 693 LogInformation.Revision r2 = (LogInformation.Revision) o2; 694 int namec = r1.getLogInfoHeader().getFile().getName().compareToIgnoreCase(r2.getLogInfoHeader().getFile().getName()); 695 if (namec != 0) return namec; 696 namec = r1.getLogInfoHeader().getRepositoryFilename().compareToIgnoreCase(r2.getLogInfoHeader().getRepositoryFilename()); 697 if (namec != 0) return namec; 698 return compareRevisionsTrunkFirst(r1.getNumber(), r2.getNumber()); 699 } 700 } 701 702 public static int compareRevisionsTrunkFirst(String r1, String r2) { 703 StringTokenizer st1 = new StringTokenizer(r1, "."); StringTokenizer st2 = new StringTokenizer(r2, "."); for (;;) { 706 if (!st1.hasMoreTokens()) { 707 return st2.hasMoreTokens() ? -1 : 0; 708 } 709 if (!st2.hasMoreTokens()) { 710 return st1.hasMoreTokens() ? 1 : 0; 711 } 712 int n1 = Integer.parseInt(st1.nextToken()); 713 int n2 = Integer.parseInt(st2.nextToken()); 714 if (n1 != n2) return n2 - n1; 715 } 716 } 717 718 724 public static int compareRevisions(String r1, String r2) { 725 if (r1.equals(r2)) return 0; 726 StringTokenizer st1 = new StringTokenizer(r1, "."); StringTokenizer st2 = new StringTokenizer(r2, "."); for (;;) { 729 if (!st1.hasMoreTokens()) { 730 return -1; 731 } 732 if (!st2.hasMoreTokens()) { 733 return 1; 734 } 735 int n1 = Integer.parseInt(st1.nextToken()); 736 int n2 = Integer.parseInt(st2.nextToken()); 737 if (n1 != n2) return n1 - n2; 738 } 739 } 740 741 746 private void initComponents() { 748 java.awt.GridBagConstraints gridBagConstraints; 749 750 buttonGroup1 = new javax.swing.ButtonGroup (); 751 searchCriteriaPanel = new javax.swing.JPanel (); 752 bSearch = new javax.swing.JButton (); 753 jPanel1 = new javax.swing.JPanel (); 754 jToolBar1 = new javax.swing.JToolBar (); 755 tbSummary = new javax.swing.JToggleButton (); 756 tbDiff = new javax.swing.JToggleButton (); 757 jSeparator2 = new javax.swing.JSeparator (); 758 bNext = new javax.swing.JButton (); 759 bPrev = new javax.swing.JButton (); 760 resultsPanel = new javax.swing.JPanel (); 761 762 setLayout(new java.awt.GridBagLayout ()); 763 764 setBorder(javax.swing.BorderFactory.createEmptyBorder(8, 8, 0, 8)); 765 searchCriteriaPanel.setLayout(new java.awt.BorderLayout ()); 766 767 gridBagConstraints = new java.awt.GridBagConstraints (); 768 gridBagConstraints.gridx = 0; 769 gridBagConstraints.gridy = 0; 770 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 771 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 772 gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; 773 gridBagConstraints.weightx = 1.0; 774 add(searchCriteriaPanel, gridBagConstraints); 775 776 bSearch.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/versioning/system/cvss/ui/history/Bundle").getString("TT_Search")); 777 gridBagConstraints = new java.awt.GridBagConstraints (); 778 gridBagConstraints.gridx = 0; 779 gridBagConstraints.gridy = 1; 780 gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; 781 add(bSearch, gridBagConstraints); 782 783 jPanel1.setPreferredSize(new java.awt.Dimension (10, 6)); 784 gridBagConstraints = new java.awt.GridBagConstraints (); 785 gridBagConstraints.gridy = 2; 786 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 787 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 788 gridBagConstraints.weightx = 1.0; 789 gridBagConstraints.insets = new java.awt.Insets (0, 0, 2, 0); 790 add(jPanel1, gridBagConstraints); 791 792 jToolBar1.setFloatable(false); 793 jToolBar1.setRollover(true); 794 buttonGroup1.add(tbSummary); 795 tbSummary.setSelected(true); 796 org.openide.awt.Mnemonics.setLocalizedText(tbSummary, java.util.ResourceBundle.getBundle("org/netbeans/modules/versioning/system/cvss/ui/history/Bundle").getString("CTL_ShowSummary")); 797 tbSummary.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/versioning/system/cvss/ui/history/Bundle").getString("TT_Summary")); 798 tbSummary.addActionListener(new java.awt.event.ActionListener () { 799 public void actionPerformed(java.awt.event.ActionEvent evt) { 800 onViewToggle(evt); 801 } 802 }); 803 804 jToolBar1.add(tbSummary); 805 806 buttonGroup1.add(tbDiff); 807 org.openide.awt.Mnemonics.setLocalizedText(tbDiff, java.util.ResourceBundle.getBundle("org/netbeans/modules/versioning/system/cvss/ui/history/Bundle").getString("CTL_ShowDiff")); 808 tbDiff.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/versioning/system/cvss/ui/history/Bundle").getString("TT_ShowDiff")); 809 tbDiff.addActionListener(new java.awt.event.ActionListener () { 810 public void actionPerformed(java.awt.event.ActionEvent evt) { 811 onViewToggle(evt); 812 } 813 }); 814 815 jToolBar1.add(tbDiff); 816 817 jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL); 818 jSeparator2.setMaximumSize(new java.awt.Dimension (2, 32767)); 819 jToolBar1.add(jSeparator2); 820 821 bNext.setIcon(new javax.swing.ImageIcon (getClass().getResource("/org/netbeans/modules/versioning/system/cvss/resources/icons/diff-next.png"))); 822 jToolBar1.add(bNext); 823 bNext.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/versioning/system/cvss/ui/history/Bundle").getString("ACSN_NextDifference")); 824 825 bPrev.setIcon(new javax.swing.ImageIcon (getClass().getResource("/org/netbeans/modules/versioning/system/cvss/resources/icons/diff-prev.png"))); 826 jToolBar1.add(bPrev); 827 bPrev.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/versioning/system/cvss/ui/history/Bundle").getString("ACSN_PrevDifference")); 828 829 gridBagConstraints = new java.awt.GridBagConstraints (); 830 gridBagConstraints.gridy = 3; 831 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 832 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 833 add(jToolBar1, gridBagConstraints); 834 835 resultsPanel.setLayout(new java.awt.BorderLayout ()); 836 837 gridBagConstraints = new java.awt.GridBagConstraints (); 838 gridBagConstraints.gridx = 0; 839 gridBagConstraints.gridy = 4; 840 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 841 gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; 842 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 843 gridBagConstraints.weightx = 1.0; 844 gridBagConstraints.weighty = 1.0; 845 gridBagConstraints.insets = new java.awt.Insets (8, 0, 8, 0); 846 add(resultsPanel, gridBagConstraints); 847 848 } 849 851 private void onViewToggle(java.awt.event.ActionEvent evt) { refreshComponents(true); 853 } 855 856 private javax.swing.JButton bNext; 858 private javax.swing.JButton bPrev; 859 private javax.swing.JButton bSearch; 860 private javax.swing.ButtonGroup buttonGroup1; 861 private javax.swing.JPanel jPanel1; 862 private javax.swing.JSeparator jSeparator2; 863 private javax.swing.JToolBar jToolBar1; 864 private javax.swing.JPanel resultsPanel; 865 private javax.swing.JPanel searchCriteriaPanel; 866 private javax.swing.JToggleButton tbDiff; 867 private javax.swing.JToggleButton tbSummary; 868 870 } 871 | Popular Tags |