📄 comparisonspane.java
字号:
// matched netobjects (printed in green) if (matched[ndx].size() > 0) { html.append("<font COLOR=\"green\">"); for (int k=0; k<matched[ndx].size() && k<ComparisonsTree.MAX_LIST_ELEMENTS; k++) { String descr = cleanNetObjectName( (matched[ndx].get(k)).instanceDescription()); html.append(href + (row*100000 + ndx*10000 + (mism[ndx].size()+k)) + "\">"+ descr + "</a>"); curCellText.append(descr); html.append("<br>"); curCellText.append(LSEP); } html.append("</font>"); } int len = mism[ndx].size() + matched[ndx].size(); // if nothing was printed, then print "none" if (len == 0) { html.append("<b>none</b>"); curCellText.append("none"); } html.append("</font></html>"); pane.setCellText(row,ndx,html.toString()); String title = mismatches[node.compNdx].getNames()[ndx]; if (node.type == TreeNode.WIRE) pane.setLabelText(row,ndx, " "+ len +" Wire(s) in " + title); else pane.setLabelText(row,ndx, " "+ len +" Part(s) in " + title); } }// /**// * Fill the provided split cell with parts or wires from compared cells that // * belong to the hashcode equivalence class identified by the provided tree node. // * @param node tree node// * @param pane split pane// * @param row row in the split pane (>1 rows if >1 node selected)// */// private void fillHashPartitionResults(TreeNode node, EquivClassSplitPane pane, int row) {// int swap = 0;// if (mismatches[node.compNdx].isSwapCells()) swap = 1;// EquivRecReport eqRec = mismEqRecs[node.compNdx][node.eclass];// // String href = "<a style=\"text-decoration: none\" href=\"";// StringBuffer html = new StringBuffer(256);// int cell = 0;// for (List<NetObjReport> ckt : eqRec.getNotMatchedNetObjs()) {// int ndx = (cell + swap)%2;// StringBuffer curCellText = pane.getCellPlainTextBuffer(row,ndx);// curCellText.setLength(0);// html.setLength(0);// // fonts: Courier, Dialog, Helvetica, TimesRoman, Serif// html.append("<html><FONT SIZE=3><FONT FACE=\"Helvetica, TimesRoman\">");// // int len = ckt.size();// int k=0;// for (NetObjReport r : ckt) {// if (k>=ComparisonsTree.MAX_LIST_ELEMENTS) break;// String descr = cleanNetObjectName(r.instanceDescription());// // html.append(href + (row*100000 + cell*10000 + k) +"\">"+ descr + "</a>");// curCellText.append(descr);// html.append("<br>");// curCellText.append(LSEP);// k++;// }// if (len == 0) {// html.append("<b>none</b>");// curCellText.append("none");// }// // html.append("</font></html>");// pane.setCellText(row,ndx,html.toString());// // String title = mismatches[node.compNdx].getNames()[ndx];// if (node.type == TreeNode.WIRE)// pane.setLabelText(row,ndx, " "+ len +" Wire(s) in " + title);// else// pane.setLabelText(row,ndx, " "+ len +" Part(s) in " + title);// }// cell++;// } /** * Display number of parts, wires, ports in the cells in comparison * number compNdx * @param compNdx comparison index */ private void displayComparisonSummary(int compNdx) { EquivClassSplitPane rightSplPane = rightSplPanes[0]; Cell cells[] = mismatches[compNdx].getCells(); NccResult.CellSummary summary = mismatches[compNdx].getCellSummary(); StringBuffer html = new StringBuffer(256); int swap = 0; if (mismatches[compNdx].isSwapCells()) swap = 1; for (int i=0; i<2; i++) { int ndx = (i + swap)%2; StringBuffer curCellText = rightSplPane.getCellPlainTextBuffer(0,ndx); curCellText.setLength(0); html.setLength(0); html.append("<html><FONT SIZE=3><FONT FACE=\"Helvetica, TimesRoman\">"); if (summary.cantBuildNetlist[ndx]) { html.append(/*" Can't build netlist!<br>" +*/ " See problems listed<br>in tree pane.<br>(left most pane). "); curCellText.append(/*" Can't build netlist!" + LSEP + */ " See problems listed"+LSEP+"in tree pane."+LSEP+"(left most pane). "); } else { html.append(summary.numParts[ndx] + " Parts<br>" + summary.numWires[ndx] + " Wires<br>" + summary.numPorts[ndx] + " Ports<br>"); curCellText.append(summary.numParts[ndx] + " Parts" + LSEP + summary.numWires[ndx] + " Wires" + LSEP + summary.numPorts[ndx] + " Ports"); } html.append("</font></html>"); rightSplPane.setCellText(0, ndx, html.toString()); CellName cellName = cells[i].getCellName(); String name = " Summary of " + cellName.getName() + " " + cellName.getView().getAbbreviationExtension(); rightSplPane.setLabelText(0, ndx, name); } setRightComponent(rightSplPane); } /** * Follow hyperlink with the given index and highlight required items * @param index hyperlink index */ void highlight(int index) { int recNdx = index/100000; int cellNdx = (index/10000)%10; int line = index%10000; TreeNode eqRecNode = curEqRecNodesToDisplay.elementAt(recNdx); // in case of hashcode partitions, get NetObject from Circuits NetObjReport partOrWire = null;// if (mismatches[eqRecNode.compNdx].isHashFailuresPrinted()) {// EquivRecReport eqRec = mismEqRecs[eqRecNode.compNdx][eqRecNode.eclass];// int c = 0, k = 0;// Circuit ckt = null;// for (Iterator<Circuit> it=eqRec.getCircuits(); it.hasNext(); c++, it.next())// if (c == cellNdx) {// ckt = it.next(); // break;// }// for (Iterator<NetObjReport> it=ckt.getNetObjs(); it.hasNext(); k++, it.next())// if (k == line) {// partOrWire = it.next();// break;// }// } else { // in case of LP, get the NetObjeect from the array List<NetObjReport>[] mism = mismNetObjs[eqRecNode.compNdx][eqRecNode.eclass]; List<NetObjReport>[] matched = matchedNetObjs[eqRecNode.compNdx][eqRecNode.eclass]; if (line >= mism[cellNdx].size()) partOrWire = matched[cellNdx].get(line - mism[cellNdx].size()); else partOrWire = mism[cellNdx].get(line);// } Cell cell = null; VarContext context = null; if (partOrWire instanceof PartReport) { cell = ((PartReport)partOrWire).getNameProxy().leafCell(); context = ((PartReport)partOrWire).getNameProxy().getContext(); } else if (partOrWire instanceof WireReport) { cell = ((WireReport)partOrWire).getNameProxy().leafCell(); context = ((WireReport)partOrWire).getNameProxy().getContext(); } // find the highlighter corresponding to the cell Highlighter highlighter = HighlightTools.getHighlighter(cell, context); if (highlighter == null) return; if (partOrWire instanceof PartReport) HighlightTools.highlightPart(highlighter, cell, (PartReport)partOrWire); else if (partOrWire instanceof WireReport) HighlightTools.highlightWire(highlighter, cell, (WireReport)partOrWire); highlighter.finished(); } /** * Remove unnecessary parts from a NetObject name * @param descr NetObject name * @return cleaned name */ public String cleanNetObjectName(String descr) { // drop "Part:" or "Wire:" prefices if (descr.startsWith("Wire: ") || descr.startsWith("Part: ")) descr = descr.substring(6); // drop "Cell instance:" info int ind = descr.indexOf(" Cell instance:"); if (ind > 0) descr = descr.substring(0, ind).trim(); // drop {sch} or {lay} suffices if (descr.endsWith("{sch}") || descr.endsWith("{lay}")) descr = descr.substring(0, descr.length()-5); return descr; } /* (non-Javadoc) * Action Listener interface (for popup menus) */ public void actionPerformed(ActionEvent e) { Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard(); // copy text prepared during popup to clipboard StringSelection ss = new StringSelection(clipboard); cb.setContents(ss,ss); } /** * Initialize popup menu for table cells */ private void createCellPopup() { cellPopup = new JPopupMenu(); JMenuItem menuItem = new JMenuItem("Copy Cell Text To Clipboard"); menuItem.addActionListener(this); cellPopup.add(menuItem); } /** * Display a cell popup on top of Component c, with origin at (x,y) * in component's coord system * @param text The text to be copied to clipboard if menu item is activated * @param c Component to place the popup menu on top of * @param x x origin coordinate (in component coord system) * @param y y origin coordinate (in component coord system) */ void showCellPopup(String text, Component c, int x, int y) { clipboard = text; cellPopup.show(c,x,y); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -