1
/* -*- tab-width: 4 -*-
3
* Electric(tm) VLSI Design System
5
* File: GetInfoNode.java
7
* Copyright (c) 2003 Sun Microsystems and Static Free Software
9
* Electric(tm) is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 3 of the License, or
12
* (at your option) any later version.
14
* Electric(tm) is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* You should have received a copy of the GNU General Public License
20
* along with Electric(tm); see the file COPYING. If not, write to
21
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
22
* Boston, Mass 02111-1307, USA.
24
package com.sun.electric.tool.user.dialogs;
26
import com.sun.electric.database.change.DatabaseChangeEvent;
27
import com.sun.electric.database.change.DatabaseChangeListener;
28
import com.sun.electric.database.geometry.DBMath;
29
import com.sun.electric.database.geometry.Orientation;
30
import com.sun.electric.database.hierarchy.Cell;
31
import com.sun.electric.database.hierarchy.Export;
32
import com.sun.electric.database.network.Netlist;
33
import com.sun.electric.database.network.Network;
34
import com.sun.electric.database.prototype.NodeProto;
35
import com.sun.electric.database.prototype.PortCharacteristic;
36
import com.sun.electric.database.prototype.PortProto;
37
import com.sun.electric.database.text.TextUtils;
38
import com.sun.electric.database.topology.ArcInst;
39
import com.sun.electric.database.topology.Connection;
40
import com.sun.electric.database.topology.NodeInst;
41
import com.sun.electric.database.topology.PortInst;
42
import com.sun.electric.database.variable.ElectricObject;
43
import com.sun.electric.database.variable.TextDescriptor;
44
import com.sun.electric.database.variable.Variable;
45
import com.sun.electric.technology.ArcProto;
46
import com.sun.electric.technology.PrimitiveNode;
47
import com.sun.electric.technology.PrimitiveNodeSize;
48
import com.sun.electric.technology.Technology;
49
import com.sun.electric.technology.technologies.Artwork;
50
import com.sun.electric.technology.technologies.Generic;
51
import com.sun.electric.technology.technologies.Schematics;
52
import com.sun.electric.tool.Client;
53
import com.sun.electric.tool.Job;
54
import com.sun.electric.tool.JobException;
55
import com.sun.electric.tool.user.Highlight2;
56
import com.sun.electric.tool.user.HighlightListener;
57
import com.sun.electric.tool.user.Highlighter;
58
import com.sun.electric.tool.user.User;
59
import com.sun.electric.tool.user.UserInterfaceMain;
60
import com.sun.electric.tool.user.tecEdit.Manipulate;
61
import com.sun.electric.tool.user.ui.EditWindow;
62
import com.sun.electric.tool.user.ui.TopLevel;
63
import com.sun.electric.tool.user.ui.WindowFrame;
65
import java.awt.Frame;
66
import java.awt.GridBagConstraints;
67
import java.awt.Insets;
68
import java.awt.geom.Point2D;
69
import java.util.ArrayList;
70
import java.util.Iterator;
71
import java.util.List;
72
import java.util.prefs.Preferences;
74
import javax.swing.DefaultListModel;
75
import javax.swing.JFrame;
76
import javax.swing.JList;
77
import javax.swing.ListSelectionModel;
78
import javax.swing.UIManager;
81
* Class to handle the "Node Properties" dialog.
83
public class GetInfoNode extends EModelessDialog implements HighlightListener, DatabaseChangeListener
85
private static GetInfoNode theDialog = null;
86
private NodeInst shownNode = null;
87
private PortProto shownPort = null;
88
private double initialXPos, initialYPos;
89
private String initialXSize, initialYSize;
90
private boolean initialMirrorX, initialMirrorY;
91
private int initialRotation, initialPopupIndex;
92
private boolean initialEasyToSelect, initialInvisibleOutsideCell, initialLocked, initialExpansion;
93
private String initialName, initialTextField;
94
private String initialPopupEntry;
95
private DefaultListModel listModel;
97
private List<AttributesTable.AttValPair> allAttributes;
98
private List<ArcInst> portObjects;
99
private boolean bigger;
100
private boolean scalableTrans;
101
private boolean swapXY;
102
private AttributesTable attributesTable;
103
private EditWindow wnd;
105
private static Preferences prefs = Preferences.userNodeForPackage(GetInfoNode.class);
108
* Method to show the Node Properties dialog.
110
public static void showDialog()
112
if (Client.getOperatingSystem() == Client.OS.UNIX) {
114
// On Linux, if a dialog is built, closed using setVisible(false),
115
// and then requested again using setVisible(true), it does
116
// not appear on top. I've tried using toFront(), requestFocus(),
117
// but none of that works. Instead, I brute force it and
118
// rebuild the dialog from scratch each time.
119
if (theDialog != null) theDialog.dispose();
122
if (theDialog == null)
125
if (TopLevel.isMDIMode()) jf = TopLevel.getCurrentJFrame();
126
theDialog = new GetInfoNode(jf);
128
theDialog.loadInfo();
130
if (!theDialog.isVisible())
133
theDialog.ensureProperSize();
134
theDialog.setVisible(true);
140
* Reloads the dialog when Highlights change
142
public void highlightChanged(Highlighter which)
144
if (!isVisible()) return;
149
* Called when by a Highlighter when it loses focus. The argument
150
* is the Highlighter that has gained focus (may be null).
151
* @param highlighterGainedFocus the highlighter for the current window (may be null).
153
public void highlighterLostFocus(Highlighter highlighterGainedFocus) {
154
if (!isVisible()) return;
159
* Respond to database changes
160
* @param e database change event
162
public void databaseChanged(DatabaseChangeEvent e) {
163
if (!isVisible()) return;
165
// update dialog if we care about the changes
166
if (e.objectChanged(shownNode) || shownPort instanceof Export && e.objectChanged((Export)shownPort))
172
/** Creates new form Node Properties */
173
private GetInfoNode(Frame parent)
175
super(parent, false);
177
getRootPane().setDefaultButton(ok);
179
UserInterfaceMain.addDatabaseChangeListener(this);
180
Highlighter.addHighlightListener(this);
182
// make type a selectable but not editable field
183
type.setEditable(false);
184
type.setBorder(null);
185
type.setForeground(UIManager.getColor("Label.foreground"));
186
type.setFont(UIManager.getFont("Label.font"));
188
bigger = prefs.getBoolean("GetInfoNode-bigger", false);
189
int buttonSelected = prefs.getInt("GetInfoNode-buttonSelected", 0);
192
if (bigger == false) {
193
getContentPane().remove(moreStuffTop);
194
getContentPane().remove(listPane);
195
getContentPane().remove(moreStuffBottom);
196
more.setText("More");
199
more.setText("Less");
203
listModel = new DefaultListModel();
204
list = new JList(listModel);
205
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
206
listPane.setViewportView(list);
207
allAttributes = new ArrayList<AttributesTable.AttValPair>();
208
portObjects = new ArrayList<ArcInst>();
210
attributesTable = new AttributesTable(null, true, false, false);
212
switch (buttonSelected)
214
case 0: ports.setSelected(true); break;
215
case 1: attributes.setSelected(true); break;
216
case 2: busMembers.setSelected(true); break;
220
finishInitialization();
223
protected void escapePressed() { cancelActionPerformed(null); }
225
protected void loadInfo()
227
// update current window
228
EditWindow curWnd = EditWindow.getCurrent();
229
if (curWnd != null) wnd = curWnd;
231
// must have a single node selected
236
for(Highlight2 h : wnd.getHighlighter().getHighlights())
238
if (!h.isHighlightEOBJ()) continue;
239
ElectricObject eobj = h.getElectricObject();
240
if (eobj instanceof PortInst)
242
pp = ((PortInst)eobj).getPortProto();
243
eobj = ((PortInst)eobj).getNodeInst();
245
if (eobj instanceof NodeInst)
252
if (nodeCount > 1) ni = null;
255
if (shownNode != null)
257
// no node selected, disable the dialog
259
name.setEditable(false);
261
xSize.setEditable(false);
263
ySize.setEditable(false);
265
xPos.setEditable(false);
267
yPos.setEditable(false);
269
rotation.setEditable(false);
270
rotation.setText("");
271
mirrorX.setEnabled(false);
272
mirrorX.setSelected(false);
273
mirrorY.setEnabled(false);
274
mirrorY.setSelected(false);
275
apply.setEnabled(false);
278
expanded.setEnabled(false);
279
unexpanded.setEnabled(false);
280
easyToSelect.setEnabled(false);
281
easyToSelect.setSelected(false);
282
invisibleOutsideCell.setEnabled(false);
283
invisibleOutsideCell.setSelected(false);
284
textFieldLabel.setText("");
285
textField.setText("");
286
textField.setEditable(false);
287
popupLabel.setText("");
288
popup.removeAllItems();
289
popup.setEnabled(false);
290
ports.setEnabled(false);
291
attributes.setEnabled(false);
292
attributesTable.setElectricObject(null);
293
attributesTable.setEnabled(false);
294
busMembers.setEnabled(false);
295
listPane.setEnabled(false);
297
locked.setEnabled(false);
298
locked.setSelected(false);
299
see.setEnabled(false);
300
editParameters.setEnabled(false);
301
colorAndPattern.setEnabled(false);
312
EDialog.focusClearOnTextField(name);
315
NodeProto np = ni.getProto();
316
name.setEditable(true);
317
boolean sizeEditable = true;
318
xPos.setEditable(true);
319
yPos.setEditable(true);
320
rotation.setEditable(true);
321
mirrorX.setEnabled(true);
322
mirrorY.setEnabled(true);
323
apply.setEnabled(true);
325
initialName = ni.getName();
326
initialXPos = ni.getAnchorCenterX();
327
initialYPos = ni.getAnchorCenterY();
328
double initXSize = ni.getLambdaBaseXSize();
329
double initYSize = ni.getLambdaBaseYSize();
330
initialRotation = ni.getAngle();
332
if (initialRotation == 900 || initialRotation == 2700) swapXY = true;
334
type.setText(np.describe(false));
335
name.setText(initialName);
336
xPos.setText(TextUtils.formatDouble(initialXPos));
337
yPos.setText(TextUtils.formatDouble(initialYPos));
338
boolean realMirrorX = ni.isXMirrored();
339
boolean realMirrorY = ni.isYMirrored();
342
xSize.setText(TextUtils.formatDouble(initYSize));
343
ySize.setText(TextUtils.formatDouble(initXSize));
344
initialMirrorX = realMirrorY;
345
initialMirrorY = realMirrorX;
348
xSize.setText(TextUtils.formatDouble(initXSize));
349
ySize.setText(TextUtils.formatDouble(initYSize));
350
initialMirrorX = realMirrorX;
351
initialMirrorY = realMirrorY;
353
initialXSize = xSize.getText();
354
initialYSize = ySize.getText();
355
mirrorX.setSelected(initialMirrorX);
356
mirrorY.setSelected(initialMirrorY);
357
rotation.setText(TextUtils.formatDouble(initialRotation / 10.0));
359
// special case for transistors and resistors
360
PrimitiveNodeSize npSize = ni.getPrimitiveNodeSize(null);
361
if (npSize != null) {
362
xsizeLabel.setText("Width:");
363
xsizeLabel.setDisplayedMnemonic('w');
364
ysizeLabel.setText("Length:");
365
ysizeLabel.setDisplayedMnemonic('l');
366
double width = npSize.getDoubleWidth();
367
if (width == 0 && npSize.getWidth() != null)
368
xSize.setText(npSize.getWidth().toString());
370
xSize.setText(TextUtils.formatDouble(width));
371
double length = npSize.getDoubleLength();
372
if (length == 0 && npSize.getLength() != null)
373
ySize.setText(npSize.getLength().toString());
375
ySize.setText(TextUtils.formatDouble(length));
376
initialXSize = xSize.getText();
377
initialYSize = ySize.getText();
378
// } else if (ni.getFunction()==PrimitiveNode.Function.PRESIST) {
379
// // special case for Poly resistors
380
// xsizeLabel.setText("Length:");
381
// ysizeLabel.setText("Width:");
383
xsizeLabel.setText("X size:");
384
xsizeLabel.setDisplayedMnemonic('s');
385
ysizeLabel.setText("Y size:");
386
ysizeLabel.setDisplayedMnemonic('z');
390
easyToSelect.setEnabled(true);
391
invisibleOutsideCell.setEnabled(true);
392
ports.setEnabled(true);
393
attributes.setEnabled(true);
394
attributesTable.setEnabled(true);
395
busMembers.setEnabled(true);
396
listPane.setEnabled(true);
397
locked.setEnabled(true);
398
editParameters.setEnabled(false);
399
if (ni.isCellInstance()) editParameters.setEnabled(true);
400
colorAndPattern.setEnabled(ni.getProto().getTechnology() == Artwork.tech());
402
// grab all attributes and parameters
403
allAttributes.clear();
405
for(Iterator<Variable> it = ni.getParametersAndVariables(); it.hasNext(); )
407
Variable var = it.next();
408
String name = var.getKey().getName();
409
if (!name.startsWith("ATTR_")) continue;
411
// found an attribute
412
AttributesTable.AttValPair avp = new AttributesTable.AttValPair();
413
avp.key = var.getKey();
414
avp.trueName = var.getTrueName();
415
avp.value = var.getObject().toString();
416
avp.code = var.isCode();
417
allAttributes.add(avp);
419
boolean hasAttributes = allAttributes.size() != 0 || ni.getParameters().hasNext();
420
attributes.setEnabled(hasAttributes);
421
attributesTable.setEnabled(hasAttributes);
422
attributesTable.setElectricObject(ni);
423
if (attributes.isSelected() && !hasAttributes) ports.setSelected(true);
426
Netlist nl = shownNode.getParent().acquireUserNetlist();
429
if (shownPort != null && shownPort instanceof Export)
430
busWidth = nl.getBusWidth((Export)shownPort);
434
if (busMembers.isSelected()) ports.setSelected(true);
435
busMembers.setEnabled(false);
439
// special lines default to empty
440
textFieldLabel.setText("");
441
textField.setText("");
442
textField.setEditable(false);
443
popupLabel.setText("");
444
popup.removeAllItems();
445
popup.setEnabled(false);
447
// see if this node has outline information
448
Point2D [] outline = ni.getTrace();
451
sizeEditable = false;
454
// if there is outline information on a transistor, remember that
455
initialTextField = null;
456
boolean lengthEditable = false;
457
if (ni.isSerpentineTransistor())
458
lengthEditable = true;
460
// set the expansion button
461
if (np instanceof Cell)
463
expanded.setEnabled(true);
464
unexpanded.setEnabled(true);
465
initialExpansion = ni.isExpanded();
466
if (initialExpansion) expanded.setSelected(true); else
467
unexpanded.setSelected(true);
468
sizeEditable = false;
471
expanded.setEnabled(false);
472
unexpanded.setEnabled(false);
476
xSize.setEditable(true);
477
ySize.setEditable(true);
479
xSize.setEditable(false);
480
ySize.setEditable(lengthEditable);
483
// load visible-outside-cell state
484
initialInvisibleOutsideCell = ni.isVisInside();
485
invisibleOutsideCell.setSelected(initialInvisibleOutsideCell);
487
// load easy of selection
488
initialEasyToSelect = !ni.isHardSelect();
489
easyToSelect.setSelected(initialEasyToSelect);
490
if (np instanceof Cell && !User.isEasySelectionOfCellInstances())
491
easyToSelect.setEnabled(false);
494
initialLocked = ni.isLocked();
495
locked.setSelected(initialLocked);
497
// load special node information
498
PrimitiveNode.Function fun = ni.getFunction();
499
if (np == Schematics.tech().transistorNode || np == Schematics.tech().transistor4Node)
503
textField.setEditable(true);
504
textFieldLabel.setText("Area:");
506
Variable var = ni.getVar(Schematics.ATTR_AREA);
508
textField.setText(var.getPureValue(-1));
510
popupLabel.setText("Transistor type:");
511
popup.addItem(fun.getName());
515
scalableTrans = false;
516
if (!ni.isCellInstance())
518
if (np.getTechnology() == Technology.getMocmosTechnology())
520
if (np.getName().equals("P-Transistor-Scalable") ||
521
np.getName().equals("N-Transistor-Scalable"))
522
scalableTrans = true;
527
popupLabel.setText("Contacts:");
528
popup.addItem("Top & Bottom / normal spacing");
529
popup.addItem("Top & Bottom / half-unit closer");
530
popup.addItem("Only Bottom / normal spacing");
531
popup.addItem("Only Bottom / half-unit closer");
532
popup.addItem("None");
533
String pt = ni.getVarValue(Technology.TRANS_CONTACT, String.class);
535
boolean insetContacts = false;
538
for(int i=0; i<pt.length(); i++)
540
char chr = pt.charAt(i);
541
if (chr == '0' || chr == '1' || chr == '2')
543
numContacts = chr - '0';
544
} else if (chr == 'i' || chr == 'I') insetContacts = true;
547
initialPopupIndex = (2 - numContacts) * 2;
548
if (insetContacts && numContacts > 0) initialPopupIndex++;
549
popup.setSelectedIndex(initialPopupIndex);
550
popup.setEnabled(true);
552
textFieldLabel.setText("Width:");
553
Variable var = ni.getVar(Schematics.ATTR_WIDTH);
554
double width = ni.getLambdaBaseXSize();
555
if (var != null) width = TextUtils.atof(var.getPureValue(-1));
556
initialTextField = Double.toString(width);
557
textField.setEditable(true);
558
textField.setText(initialTextField);
560
if (fun.isResistor())
562
if (fun == PrimitiveNode.Function.PRESIST)
563
textFieldLabel.setText("Poly resistance:"); else
564
textFieldLabel.setText("Resistance:");
565
// formatinfstr(infstr, x_(" (%s):"),
566
// TRANSLATE(us_resistancenames[(us_electricalunits&INTERNALRESUNITS) >> INTERNALRESUNITSSH]));
567
Variable var = ni.getVar(Schematics.SCHEM_RESISTANCE);
568
if (var == null) initialTextField = "0"; else
569
initialTextField = new String(var.getObject().toString());
570
textField.setEditable(true);
571
textField.setText(initialTextField);
573
if (fun.isCapacitor())
575
if (fun == PrimitiveNode.Function.ECAPAC)
576
textFieldLabel.setText("Electrolytic cap:"); else
577
textFieldLabel.setText("Capacitance:");
578
// formatinfstr(infstr, x_(" (%s):"),
579
// TRANSLATE(us_capacitancenames[(us_electricalunits&INTERNALCAPUNITS) >> INTERNALCAPUNITSSH]));
580
Variable var = ni.getVar(Schematics.SCHEM_CAPACITANCE);
581
if (var == null) initialTextField = "0"; else
582
initialTextField = new String(var.getObject().toString());
583
textField.setEditable(true);
584
textField.setText(initialTextField);
586
if (fun == PrimitiveNode.Function.INDUCT)
588
textFieldLabel.setText("Inductance:");
589
// formatinfstr(infstr, x_(" (%s):"),
590
// TRANSLATE(us_inductancenames[(us_electricalunits&INTERNALINDUNITS) >> INTERNALINDUNITSSH]));
591
Variable var = ni.getVar(Schematics.SCHEM_INDUCTANCE);
592
if (var == null) initialTextField = "0"; else
593
initialTextField = new String(var.getObject().toString());
594
textField.setEditable(true);
595
textField.setText(initialTextField);
597
if (np == Schematics.tech().bboxNode)
599
textFieldLabel.setText("Function:");
600
Variable var = ni.getVar(Schematics.SCHEM_FUNCTION);
601
if (var == null) initialTextField = ""; else
602
initialTextField = new String(var.getObject().toString());
603
textField.setEditable(true);
604
textField.setText(initialTextField);
606
if (fun.isFlipFlop())
608
popupLabel.setText("Flip-flop type:");
609
popup.addItem(fun.getName());
611
if (np == Schematics.tech().globalNode)
613
textFieldLabel.setText("Global name:");
614
Variable var = ni.getVar(Schematics.SCHEM_GLOBAL_NAME);
615
if (var == null) initialTextField = ""; else
616
initialTextField = new String(var.getObject().toString());
617
textField.setEditable(true);
618
textField.setText(initialTextField);
620
popupLabel.setText("Characteristics:");
621
List<PortCharacteristic> characteristics = PortCharacteristic.getOrderedCharacteristics();
622
for(PortCharacteristic ch : characteristics)
624
popup.addItem(ch.getName());
626
PortCharacteristic ch = PortCharacteristic.findCharacteristic(ni.getTechSpecific());
627
initialPopupEntry = ch.getName();
628
popup.setSelectedItem(initialPopupEntry);
629
popup.setEnabled(true);
632
// handle technology editor primitives
633
if (ni.getParent().isInTechnologyLibrary())
635
popupLabel.setText("Tech. editor:");
636
popup.addItem(Manipulate.describeNodeMeaning(ni));
639
// load the degrees of a circle if appropriate
640
if (np == Artwork.tech().circleNode || np == Artwork.tech().thickCircleNode)
642
double [] arcData = ni.getArcDegrees();
643
double start = DBMath.round(arcData[0] * 180.0 / Math.PI);
644
double curvature = DBMath.round(arcData[1] * 180.0 / Math.PI);
647
textFieldLabel.setText("Offset angle / Degrees of circle:");
648
initialTextField = new String(start + " / " + curvature);
651
textFieldLabel.setText("Degrees of circle:");
652
if (curvature == 0) initialTextField = "360"; else
653
initialTextField = new String(Double.toString(curvature));
655
textField.setEditable(true);
656
textField.setText(initialTextField);
658
EDialog.focusOnTextField(name);
661
private void showProperList()
666
if (ports.isSelected())
669
listPane.setViewportView(list);
670
NodeProto np = shownNode.getProto();
671
List<String> portMessages = new ArrayList<String>();
672
int selectedLine = 0;
673
for(Iterator<PortInst> it = shownNode.getPortInsts(); it.hasNext(); )
675
PortInst pi = it.next();
676
PortProto pp = pi.getPortProto();
677
PortCharacteristic ch = pp.getCharacteristic();
679
if (ch == PortCharacteristic.UNKNOWN) description = "Port "; else
680
description = ch.getName() + " port ";
681
description += pp.getName();
683
// mention if it is highlighted
686
selectedLine = portMessages.size();
687
description += " (Highlighted)";
690
description += " connects to";
691
ArcProto [] connList = pp.getBasePort().getConnections();
693
for(int i=0; i<connList.length; i++)
695
ArcProto ap = connList[i];
696
if ((np instanceof Cell || np.getTechnology() != Generic.tech()) &&
697
ap.getTechnology() == Generic.tech()) continue;
698
if (count > 0) description += ",";
699
description += " " + ap.getName();
702
boolean moreInfo = false;
703
if (pp == shownPort) moreInfo = true;
704
for(Iterator<Connection> aIt = shownNode.getConnections(); aIt.hasNext(); )
706
Connection con = aIt.next();
707
if (con.getPortInst() == pi) { moreInfo = true; break; }
709
for(Iterator<Export> eIt = shownNode.getExports(); eIt.hasNext(); )
711
Export e = eIt.next();
712
if (e.getOriginalPort() == pi) { moreInfo = true; break; }
714
if (moreInfo) description += ":";
715
portMessages.add(description);
716
portObjects.add(null);
718
// talk about any arcs on this prototype
719
for(Iterator<Connection> aIt = shownNode.getConnections(); aIt.hasNext(); )
721
Connection con = aIt.next();
722
if (con.getPortInst() != pi) continue;
723
ArcInst ai = con.getArc();
724
description = " Connected at (" + con.getLocation().getX() + "," + con.getLocation().getY() +
726
portMessages.add(description);
730
// talk about any exports of this prototype
731
for(Iterator<Export> eIt = shownNode.getExports(); eIt.hasNext(); )
733
Export e = eIt.next();
734
if (e.getOriginalPort() != pi) continue;
735
description = " Available as " + e.getCharacteristic().getName() + " export '" + e.getName() + "'";
736
portMessages.add(description);
737
portObjects.add(null);
740
see.setEnabled(true);
741
list.setListData(portMessages.toArray());
742
list.setSelectedIndex(selectedLine);
743
list.ensureIndexIsVisible(selectedLine);
745
if (busMembers.isSelected())
747
Netlist nl = shownNode.getParent().acquireUserNetlist();
748
int busWidth = nl.getBusWidth((Export)shownPort);
749
List<String> busMessages = new ArrayList<String>();
750
for(int i=0; i<busWidth; i++)
752
Network net = nl.getNetwork(shownNode, shownPort, i);
753
String netDescr = "?";
754
if (net != null) netDescr = net.describe(false);
755
busMessages.add(i + ": " + netDescr);
757
listPane.setViewportView(list);
758
list.setListData(busMessages.toArray());
760
if (attributes.isSelected())
762
listPane.setViewportView(attributesTable);
766
private static class ChangeNode extends Job
769
private double initialXPos, initialYPos, currentXPos, currentYPos;
770
private String initialXSize, initialYSize, currentXSize, currentYSize;
771
private boolean currentMirrorX, currentMirrorY;
772
private int currentRotation;
773
private int initialPopupIndex, currentPopupIndex;
774
private boolean initialEasyToSelect, currentEasyToSelect;
775
private boolean initialInvisibleOutsideCell, currentInvisibleOutsideCell;
776
private boolean initialLocked, currentLocked;
777
private boolean initialExpansion, currentExpansion;
778
private String initialName, currentName;
779
private String initialTextField, currentTextField;
780
private String initialPopupEntry, currentPopupEntry;
781
private boolean scalableTrans;
782
private boolean swapXY;
783
private boolean expansionChanged;
785
public ChangeNode(NodeInst ni,
786
double initialXPos, double currentXPos, double initialYPos, double currentYPos,
787
String initialXSize, String currentXSize, String initialYSize, String currentYSize,
788
boolean currentMirrorX, boolean currentMirrorY,
790
int initialPopupIndex, int currentPopupIndex,
791
boolean initialEasyToSelect, boolean currentEasyToSelect,
792
boolean initialInvisibleOutsideCell, boolean currentInvisibleOutsideCell,
793
boolean initialLocked, boolean currentLocked,
794
boolean initialExpansion, boolean currentExpansion,
795
String initialName, String currentName,
796
String initialTextField, String currentTextField,
797
String initialPopupEntry, String currentPopupEntry,
799
boolean scalableTrans,
802
super("Modify Node", User.getUserTool(), Job.Type.CHANGE, null, null, Job.Priority.USER);
804
this.initialXPos = initialXPos; this.currentXPos = currentXPos;
805
this.initialYPos = initialYPos; this.currentYPos = currentYPos;
806
this.initialXSize = initialXSize; this.currentXSize = currentXSize;
807
this.initialYSize = initialYSize; this.currentYSize = currentYSize;
808
this.currentMirrorX = currentMirrorX;
809
this.currentMirrorY = currentMirrorY;
810
this.currentRotation = currentRotation;
811
this.initialPopupIndex = initialPopupIndex; this.currentPopupIndex = currentPopupIndex;
812
this.initialEasyToSelect = initialEasyToSelect; this.currentEasyToSelect = currentEasyToSelect;
813
this.initialInvisibleOutsideCell = initialInvisibleOutsideCell; this.currentInvisibleOutsideCell = currentInvisibleOutsideCell;
814
this.initialLocked = initialLocked; this.currentLocked = currentLocked;
815
this.initialExpansion = initialExpansion; this.currentExpansion = currentExpansion;
816
this.initialName = initialName; this.currentName = currentName;
817
this.initialTextField = initialTextField; this.currentTextField = currentTextField;
818
this.initialPopupEntry = initialPopupEntry; this.currentPopupEntry = currentPopupEntry;
819
this.scalableTrans = scalableTrans;
820
this.swapXY = swapXY;
824
public boolean doIt() throws JobException
826
boolean changed = false;
827
expansionChanged = false;
828
NodeProto np = ni.getProto();
830
if (!currentName.equals(initialName))
832
if (currentName.length() == 0) currentName = null;
833
ni.setName(currentName);
837
if (ni.isCellInstance())
839
if (currentExpansion != initialExpansion)
841
if (currentExpansion) ni.setExpanded(); else
844
expansionChanged = true;
848
if (currentEasyToSelect != initialEasyToSelect)
850
if (currentEasyToSelect) ni.clearHardSelect(); else
854
if (currentInvisibleOutsideCell != initialInvisibleOutsideCell)
856
if (currentInvisibleOutsideCell) ni.setVisInside(); else
861
if (currentLocked != initialLocked)
863
if (currentLocked) ni.setLocked(); else
867
// handle special node information
870
if (currentPopupIndex != initialPopupIndex)
872
int numContacts = 2 - (currentPopupIndex / 2);
873
boolean inset = (currentPopupIndex&1) != 0;
874
String contactInfo = String.valueOf(numContacts);
875
if (inset) contactInfo += "i";
876
ni.newVar(Technology.TRANS_CONTACT, contactInfo);
879
if (!currentTextField.equals(initialTextField))
881
double width = TextUtils.atof(currentTextField);
882
Variable oldVar = ni.getVar(Schematics.ATTR_WIDTH);
883
Variable var = ni.updateVar(Schematics.ATTR_WIDTH, new Double(width));
884
if (var != null && oldVar == null)
886
ni.addVar(var.withDisplay(true).withDispPart(TextDescriptor.DispPos.NAMEVALUE));
890
PrimitiveNode.Function fun = ni.getFunction();
891
if (fun == PrimitiveNode.Function.DIODE || fun == PrimitiveNode.Function.DIODEZ)
893
if (!currentTextField.equals(initialTextField))
895
Variable var = ni.updateVarText(Schematics.SCHEM_DIODE, currentTextField);
896
if (var != null && !var.isDisplay()) ni.addVar(var.withDisplay(true));
900
if (fun.isResistor())
902
if (!currentTextField.equals(initialTextField))
904
Variable var = ni.updateVarText(Schematics.SCHEM_RESISTANCE, currentTextField);
905
if (var != null && !var.isDisplay()) ni.addVar(var.withDisplay(true));
909
if (fun.isCapacitor())
911
if (!currentTextField.equals(initialTextField))
913
Variable var = ni.updateVarText(Schematics.SCHEM_CAPACITANCE, currentTextField);
914
if (var != null && !var.isDisplay()) ni.addVar(var.withDisplay(true));
918
if (fun == PrimitiveNode.Function.INDUCT)
920
if (!currentTextField.equals(initialTextField))
922
Variable var = ni.updateVarText(Schematics.SCHEM_INDUCTANCE, currentTextField);
923
if (var != null && !var.isDisplay()) ni.addVar(var.withDisplay(true));
927
if (np == Schematics.tech().bboxNode)
929
if (!currentTextField.equals(initialTextField))
931
Variable var = ni.updateVarText(Schematics.SCHEM_FUNCTION, currentTextField);
932
if (var != null && !var.isDisplay()) ni.addVar(var.withDisplay(true));
936
if (np == Schematics.tech().globalNode)
938
if (!currentTextField.equals(initialTextField))
940
Variable var = ni.updateVarText(Schematics.SCHEM_GLOBAL_NAME, currentTextField);
941
if (var != null && !var.isDisplay()) ni.addVar(var.withDisplay(true));
945
if (!currentPopupEntry.equals(initialPopupEntry))
947
PortCharacteristic ch = PortCharacteristic.findCharacteristic(currentPopupEntry);
948
ni.setTechSpecific(ch.getBits());
953
// load the degrees of a circle if appropriate
954
if (np == Artwork.tech().circleNode || np == Artwork.tech().thickCircleNode)
956
if (!currentTextField.equals(initialTextField))
959
double curvature = TextUtils.atof(currentTextField) * Math.PI / 180.0;
960
int slashPos = currentTextField.indexOf('/');
964
curvature = TextUtils.atof(currentTextField.substring(slashPos+1)) * Math.PI / 180.0;
966
ni.setArcDegrees(start, curvature);
971
double initXSize, initYSize;
972
double currXSize, currYSize;
975
// Figure out change in X and Y size
976
// if swapXY, X size was put in Y text box, and vice versa.
979
// get true size minus offset (this is the size the user sees)
980
currXSize = TextUtils.atof(currentYSize, new Double(ni.getLambdaBaseXSize()));
981
currYSize = TextUtils.atof(currentXSize, new Double(ni.getLambdaBaseYSize()));
982
initXSize = TextUtils.atof(initialYSize, new Double(currXSize));
983
initYSize = TextUtils.atof(initialXSize, new Double(currYSize));
986
orient = Orientation.fromJava(currentRotation, currentMirrorY, currentMirrorX);
989
currXSize = TextUtils.atof(currentXSize, new Double(ni.getLambdaBaseXSize()));
990
currYSize = TextUtils.atof(currentYSize, new Double(ni.getLambdaBaseYSize()));
991
initXSize = TextUtils.atof(initialXSize, new Double(currXSize));
992
initYSize = TextUtils.atof(initialYSize, new Double(currYSize));
995
orient = Orientation.fromJava(currentRotation, currentMirrorX, currentMirrorY);
998
// The following code is specific for transistors, and uses the X/Y size fields for
999
// Width and Length, and therefore may override the values such that the node size does not
1001
PrimitiveNodeSize size = ni.getPrimitiveNodeSize(null);
1004
// see if this is a schematic transistor
1005
if (np == Schematics.tech().transistorNode || np == Schematics.tech().transistor4Node ||
1006
np == Schematics.tech().resistorNode)
1008
Object width, length;
1009
if (ni.isFET() || ni.getFunction() == PrimitiveNode.Function.PRESIST)
1011
// see if we can convert width and length to a Number
1012
double w = TextUtils.atof(currentXSize, null);
1015
// set width to whatever text is there
1016
width = Variable.withCode(currentXSize, ni.getCode(Schematics.ATTR_WIDTH));
1019
width = new Double(w);
1022
double l = TextUtils.atof(currentYSize, null);
1025
// set length to whatever text is there
1026
length = Variable.withCode(currentYSize, ni.getCode(Schematics.ATTR_LENGTH));
1029
length = new Double(l);
1031
ni.setPrimitiveNodeSize(width, length);
1033
} else // transistors or resistors
1035
// this is a layout transistor
1036
if (ni.isSerpentineTransistor())
1038
// serpentine transistors can only set length
1039
double initialLength = ni.getSerpentineTransistorLength();
1040
double length = TextUtils.atof(currentYSize, new Double(initialLength));
1041
if (length != initialLength)
1042
ni.setSerpentineTransistorLength(length);
1045
// set length and width by node size for layout transistors
1046
double initialWidth = size.getDoubleWidth();
1047
double initialLength = size.getDoubleLength();
1048
double width = TextUtils.atof(currentXSize, new Double(initialWidth));
1049
double length = TextUtils.atof(currentYSize, new Double(initialLength));
1050
if (!DBMath.doublesEqual(width, initialWidth) ||
1051
!DBMath.doublesEqual(length, initialLength))
1053
// set transistor or resistor size
1054
ni.setPrimitiveNodeSize(width, length);
1058
// ignore size change, but retain mirroring change (sign)
1059
currXSize = initXSize = ni.getLambdaBaseXSize();
1060
currYSize = initYSize = ni.getLambdaBaseYSize();
1062
orient = Orientation.fromJava(currentRotation, currentMirrorY, currentMirrorX);
1064
orient = Orientation.fromJava(currentRotation, currentMirrorX, currentMirrorY);
1067
Orientation dOrient = orient.concatenate(ni.getOrient().inverse());
1068
if (!DBMath.doublesEqual(currentXPos, initialXPos) ||
1069
!DBMath.doublesEqual(currentYPos, initialYPos) ||
1070
!DBMath.doublesEqual(currXSize, initXSize) ||
1071
!DBMath.doublesEqual(currYSize, initYSize) ||
1072
dOrient != Orientation.IDENT || changed)
1074
ni.modifyInstance(DBMath.round(currentXPos - initialXPos), DBMath.round(currentYPos - initialYPos),
1075
DBMath.round(currXSize - initXSize),
1076
DBMath.round(currYSize - initYSize), dOrient);
1078
fieldVariableChanged("expansionChanged");
1083
public void terminateOK()
1085
if (expansionChanged)
1087
EditWindow.expansionChanged(ni.getParent());
1088
EditWindow.clearSubCellCache();
1089
EditWindow.repaintAllContents();
1094
/** This method is called from within the constructor to
1095
* initialize the form.
1096
* WARNING: Do NOT modify this code. The content of this method is
1097
* always regenerated by the Form Editor.
1099
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
1100
private void initComponents() {
1101
java.awt.GridBagConstraints gridBagConstraints;
1103
expansion = new javax.swing.ButtonGroup();
1104
selection = new javax.swing.ButtonGroup();
1105
jLabel1 = new javax.swing.JLabel();
1106
name = new javax.swing.JTextField();
1107
cancel = new javax.swing.JButton();
1108
ok = new javax.swing.JButton();
1109
jLabel3 = new javax.swing.JLabel();
1110
xsizeLabel = new javax.swing.JLabel();
1111
xSize = new javax.swing.JTextField();
1112
ysizeLabel = new javax.swing.JLabel();
1113
ySize = new javax.swing.JTextField();
1114
jLabel6 = new javax.swing.JLabel();
1115
xPos = new javax.swing.JTextField();
1116
jLabel7 = new javax.swing.JLabel();
1117
yPos = new javax.swing.JTextField();
1118
jLabel8 = new javax.swing.JLabel();
1119
rotation = new javax.swing.JTextField();
1120
mirrorX = new javax.swing.JCheckBox();
1121
more = new javax.swing.JButton();
1122
apply = new javax.swing.JButton();
1123
mirrorY = new javax.swing.JCheckBox();
1124
moreStuffTop = new javax.swing.JPanel();
1125
expanded = new javax.swing.JRadioButton();
1126
unexpanded = new javax.swing.JRadioButton();
1127
easyToSelect = new javax.swing.JCheckBox();
1128
invisibleOutsideCell = new javax.swing.JCheckBox();
1129
textFieldLabel = new javax.swing.JLabel();
1130
textField = new javax.swing.JTextField();
1131
popupLabel = new javax.swing.JLabel();
1132
popup = new javax.swing.JComboBox();
1133
ports = new javax.swing.JRadioButton();
1134
attributes = new javax.swing.JRadioButton();
1135
busMembers = new javax.swing.JRadioButton();
1136
moreStuffBottom = new javax.swing.JPanel();
1137
locked = new javax.swing.JCheckBox();
1138
see = new javax.swing.JButton();
1139
colorAndPattern = new javax.swing.JButton();
1140
editParameters = new javax.swing.JButton();
1141
listPane = new javax.swing.JScrollPane();
1142
type = new javax.swing.JTextField();
1144
getContentPane().setLayout(new java.awt.GridBagLayout());
1146
setTitle("Node Properties");
1148
addWindowListener(new java.awt.event.WindowAdapter() {
1149
public void windowClosing(java.awt.event.WindowEvent evt) {
1154
jLabel1.setLabelFor(type);
1155
jLabel1.setText("Type:");
1156
gridBagConstraints = new java.awt.GridBagConstraints();
1157
gridBagConstraints.gridx = 0;
1158
gridBagConstraints.gridy = 0;
1159
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1160
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1161
getContentPane().add(jLabel1, gridBagConstraints);
1163
name.setPreferredSize(new java.awt.Dimension(250, 20));
1164
gridBagConstraints = new java.awt.GridBagConstraints();
1165
gridBagConstraints.gridx = 1;
1166
gridBagConstraints.gridy = 1;
1167
gridBagConstraints.gridwidth = 3;
1168
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1169
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1170
getContentPane().add(name, gridBagConstraints);
1172
cancel.setText("Cancel");
1173
cancel.addActionListener(new java.awt.event.ActionListener() {
1174
public void actionPerformed(java.awt.event.ActionEvent evt) {
1175
cancelActionPerformed(evt);
1179
gridBagConstraints = new java.awt.GridBagConstraints();
1180
gridBagConstraints.gridx = 2;
1181
gridBagConstraints.gridy = 5;
1182
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1183
getContentPane().add(cancel, gridBagConstraints);
1186
ok.addActionListener(new java.awt.event.ActionListener() {
1187
public void actionPerformed(java.awt.event.ActionEvent evt) {
1188
okActionPerformed(evt);
1192
gridBagConstraints = new java.awt.GridBagConstraints();
1193
gridBagConstraints.gridx = 3;
1194
gridBagConstraints.gridy = 5;
1195
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1196
getContentPane().add(ok, gridBagConstraints);
1198
jLabel3.setDisplayedMnemonic('n');
1199
jLabel3.setLabelFor(name);
1200
jLabel3.setText("Name:");
1201
gridBagConstraints = new java.awt.GridBagConstraints();
1202
gridBagConstraints.gridx = 0;
1203
gridBagConstraints.gridy = 1;
1204
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1205
gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
1206
getContentPane().add(jLabel3, gridBagConstraints);
1208
xsizeLabel.setDisplayedMnemonic('s');
1209
xsizeLabel.setLabelFor(xSize);
1210
xsizeLabel.setText("X size:");
1211
gridBagConstraints = new java.awt.GridBagConstraints();
1212
gridBagConstraints.gridx = 0;
1213
gridBagConstraints.gridy = 2;
1214
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1215
gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
1216
getContentPane().add(xsizeLabel, gridBagConstraints);
1218
gridBagConstraints = new java.awt.GridBagConstraints();
1219
gridBagConstraints.gridx = 1;
1220
gridBagConstraints.gridy = 2;
1221
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1222
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1223
gridBagConstraints.weightx = 0.5;
1224
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1225
getContentPane().add(xSize, gridBagConstraints);
1227
ysizeLabel.setDisplayedMnemonic('z');
1228
ysizeLabel.setLabelFor(ySize);
1229
ysizeLabel.setText("Y size:");
1230
gridBagConstraints = new java.awt.GridBagConstraints();
1231
gridBagConstraints.gridx = 0;
1232
gridBagConstraints.gridy = 3;
1233
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1234
gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
1235
getContentPane().add(ysizeLabel, gridBagConstraints);
1237
gridBagConstraints = new java.awt.GridBagConstraints();
1238
gridBagConstraints.gridx = 1;
1239
gridBagConstraints.gridy = 3;
1240
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1241
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1242
gridBagConstraints.weightx = 0.5;
1243
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1244
getContentPane().add(ySize, gridBagConstraints);
1246
jLabel6.setDisplayedMnemonic('x');
1247
jLabel6.setLabelFor(xPos);
1248
jLabel6.setText("X position:");
1249
gridBagConstraints = new java.awt.GridBagConstraints();
1250
gridBagConstraints.gridx = 2;
1251
gridBagConstraints.gridy = 2;
1252
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1253
gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
1254
getContentPane().add(jLabel6, gridBagConstraints);
1256
gridBagConstraints = new java.awt.GridBagConstraints();
1257
gridBagConstraints.gridx = 3;
1258
gridBagConstraints.gridy = 2;
1259
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1260
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1261
gridBagConstraints.weightx = 0.5;
1262
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1263
getContentPane().add(xPos, gridBagConstraints);
1265
jLabel7.setDisplayedMnemonic('y');
1266
jLabel7.setLabelFor(yPos);
1267
jLabel7.setText("Y position:");
1268
gridBagConstraints = new java.awt.GridBagConstraints();
1269
gridBagConstraints.gridx = 2;
1270
gridBagConstraints.gridy = 3;
1271
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1272
gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
1273
getContentPane().add(jLabel7, gridBagConstraints);
1275
gridBagConstraints = new java.awt.GridBagConstraints();
1276
gridBagConstraints.gridx = 3;
1277
gridBagConstraints.gridy = 3;
1278
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1279
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1280
gridBagConstraints.weightx = 0.5;
1281
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1282
getContentPane().add(yPos, gridBagConstraints);
1284
jLabel8.setDisplayedMnemonic('r');
1285
jLabel8.setLabelFor(rotation);
1286
jLabel8.setText("Rotation:");
1287
gridBagConstraints = new java.awt.GridBagConstraints();
1288
gridBagConstraints.gridx = 0;
1289
gridBagConstraints.gridy = 4;
1290
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1291
gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
1292
getContentPane().add(jLabel8, gridBagConstraints);
1294
rotation.setColumns(6);
1295
gridBagConstraints = new java.awt.GridBagConstraints();
1296
gridBagConstraints.gridx = 1;
1297
gridBagConstraints.gridy = 4;
1298
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1299
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1300
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1301
getContentPane().add(rotation, gridBagConstraints);
1303
mirrorX.setText("Mirror L-R");
1304
gridBagConstraints = new java.awt.GridBagConstraints();
1305
gridBagConstraints.gridx = 2;
1306
gridBagConstraints.gridy = 4;
1307
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1308
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1309
getContentPane().add(mirrorX, gridBagConstraints);
1311
more.setText("More");
1312
more.addActionListener(new java.awt.event.ActionListener() {
1313
public void actionPerformed(java.awt.event.ActionEvent evt) {
1314
moreActionPerformed(evt);
1318
gridBagConstraints = new java.awt.GridBagConstraints();
1319
gridBagConstraints.gridx = 0;
1320
gridBagConstraints.gridy = 5;
1321
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1322
getContentPane().add(more, gridBagConstraints);
1324
apply.setText("Apply");
1325
apply.addActionListener(new java.awt.event.ActionListener() {
1326
public void actionPerformed(java.awt.event.ActionEvent evt) {
1327
applyActionPerformed(evt);
1331
gridBagConstraints = new java.awt.GridBagConstraints();
1332
gridBagConstraints.gridx = 1;
1333
gridBagConstraints.gridy = 5;
1334
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1335
getContentPane().add(apply, gridBagConstraints);
1337
mirrorY.setText("Mirror U-D");
1338
gridBagConstraints = new java.awt.GridBagConstraints();
1339
gridBagConstraints.gridx = 3;
1340
gridBagConstraints.gridy = 4;
1341
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1342
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1343
getContentPane().add(mirrorY, gridBagConstraints);
1345
moreStuffTop.setLayout(new java.awt.GridBagLayout());
1347
expansion.add(expanded);
1348
expanded.setText("Expanded");
1349
gridBagConstraints = new java.awt.GridBagConstraints();
1350
gridBagConstraints.gridx = 0;
1351
gridBagConstraints.gridy = 0;
1352
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1353
moreStuffTop.add(expanded, gridBagConstraints);
1355
expansion.add(unexpanded);
1356
unexpanded.setText("Unexpanded");
1357
gridBagConstraints = new java.awt.GridBagConstraints();
1358
gridBagConstraints.gridx = 1;
1359
gridBagConstraints.gridy = 0;
1360
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1361
moreStuffTop.add(unexpanded, gridBagConstraints);
1363
easyToSelect.setText("Easy to Select");
1364
gridBagConstraints = new java.awt.GridBagConstraints();
1365
gridBagConstraints.gridx = 2;
1366
gridBagConstraints.gridy = 0;
1367
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1368
moreStuffTop.add(easyToSelect, gridBagConstraints);
1370
invisibleOutsideCell.setText("Invisible Outside Cell");
1371
gridBagConstraints = new java.awt.GridBagConstraints();
1372
gridBagConstraints.gridx = 3;
1373
gridBagConstraints.gridy = 0;
1374
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1375
moreStuffTop.add(invisibleOutsideCell, gridBagConstraints);
1377
textFieldLabel.setLabelFor(textField);
1378
textFieldLabel.setText(" ");
1379
gridBagConstraints = new java.awt.GridBagConstraints();
1380
gridBagConstraints.gridx = 0;
1381
gridBagConstraints.gridy = 1;
1382
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1383
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1384
moreStuffTop.add(textFieldLabel, gridBagConstraints);
1386
gridBagConstraints = new java.awt.GridBagConstraints();
1387
gridBagConstraints.gridx = 1;
1388
gridBagConstraints.gridy = 1;
1389
gridBagConstraints.gridwidth = 3;
1390
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1391
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1392
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1393
moreStuffTop.add(textField, gridBagConstraints);
1395
popupLabel.setLabelFor(popup);
1396
popupLabel.setText(" ");
1397
gridBagConstraints = new java.awt.GridBagConstraints();
1398
gridBagConstraints.gridx = 0;
1399
gridBagConstraints.gridy = 2;
1400
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1401
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1402
moreStuffTop.add(popupLabel, gridBagConstraints);
1404
gridBagConstraints = new java.awt.GridBagConstraints();
1405
gridBagConstraints.gridx = 1;
1406
gridBagConstraints.gridy = 2;
1407
gridBagConstraints.gridwidth = 3;
1408
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1409
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1410
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1411
moreStuffTop.add(popup, gridBagConstraints);
1413
selection.add(ports);
1414
ports.setText("Ports:");
1415
ports.addActionListener(new java.awt.event.ActionListener() {
1416
public void actionPerformed(java.awt.event.ActionEvent evt) {
1417
portsActionPerformed(evt);
1421
gridBagConstraints = new java.awt.GridBagConstraints();
1422
gridBagConstraints.gridx = 0;
1423
gridBagConstraints.gridy = 3;
1424
gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 4);
1425
moreStuffTop.add(ports, gridBagConstraints);
1427
selection.add(attributes);
1428
attributes.setText("Parameters:");
1429
attributes.addActionListener(new java.awt.event.ActionListener() {
1430
public void actionPerformed(java.awt.event.ActionEvent evt) {
1431
attributesActionPerformed(evt);
1435
gridBagConstraints = new java.awt.GridBagConstraints();
1436
gridBagConstraints.gridx = 1;
1437
gridBagConstraints.gridy = 3;
1438
gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 4);
1439
moreStuffTop.add(attributes, gridBagConstraints);
1441
selection.add(busMembers);
1442
busMembers.setText("Bus Members on Port:");
1443
busMembers.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
1444
busMembers.addActionListener(new java.awt.event.ActionListener() {
1445
public void actionPerformed(java.awt.event.ActionEvent evt) {
1446
busMembersActionPerformed(evt);
1450
gridBagConstraints = new java.awt.GridBagConstraints();
1451
gridBagConstraints.gridx = 2;
1452
gridBagConstraints.gridy = 3;
1453
gridBagConstraints.gridwidth = 2;
1454
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1455
gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 4);
1456
moreStuffTop.add(busMembers, gridBagConstraints);
1458
gridBagConstraints = new java.awt.GridBagConstraints();
1459
gridBagConstraints.gridx = 0;
1460
gridBagConstraints.gridy = 6;
1461
gridBagConstraints.gridwidth = 4;
1462
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1463
gridBagConstraints.weightx = 1.0;
1464
getContentPane().add(moreStuffTop, gridBagConstraints);
1466
moreStuffBottom.setLayout(new java.awt.GridBagLayout());
1468
locked.setText("Locked");
1469
gridBagConstraints = new java.awt.GridBagConstraints();
1470
gridBagConstraints.gridx = 0;
1471
gridBagConstraints.gridy = 0;
1472
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1473
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1474
moreStuffBottom.add(locked, gridBagConstraints);
1477
see.addActionListener(new java.awt.event.ActionListener() {
1478
public void actionPerformed(java.awt.event.ActionEvent evt) {
1479
seeActionPerformed(evt);
1483
gridBagConstraints = new java.awt.GridBagConstraints();
1484
gridBagConstraints.gridx = 1;
1485
gridBagConstraints.gridy = 0;
1486
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1487
moreStuffBottom.add(see, gridBagConstraints);
1489
colorAndPattern.setText("Color and Pattern...");
1490
colorAndPattern.addActionListener(new java.awt.event.ActionListener() {
1491
public void actionPerformed(java.awt.event.ActionEvent evt) {
1492
colorAndPatternActionPerformed(evt);
1496
gridBagConstraints = new java.awt.GridBagConstraints();
1497
gridBagConstraints.gridx = 2;
1498
gridBagConstraints.gridy = 0;
1499
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1500
moreStuffBottom.add(colorAndPattern, gridBagConstraints);
1502
editParameters.setText("Edit Parameters");
1503
editParameters.addActionListener(new java.awt.event.ActionListener() {
1504
public void actionPerformed(java.awt.event.ActionEvent evt) {
1505
editParametersActionPerformed(evt);
1509
moreStuffBottom.add(editParameters, new java.awt.GridBagConstraints());
1511
gridBagConstraints = new java.awt.GridBagConstraints();
1512
gridBagConstraints.gridx = 0;
1513
gridBagConstraints.gridy = 8;
1514
gridBagConstraints.gridwidth = 4;
1515
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1516
gridBagConstraints.weightx = 1.0;
1517
getContentPane().add(moreStuffBottom, gridBagConstraints);
1519
listPane.setMinimumSize(new java.awt.Dimension(200, 100));
1520
listPane.setPreferredSize(new java.awt.Dimension(200, 100));
1521
gridBagConstraints = new java.awt.GridBagConstraints();
1522
gridBagConstraints.gridx = 0;
1523
gridBagConstraints.gridy = 7;
1524
gridBagConstraints.gridwidth = 4;
1525
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
1526
gridBagConstraints.weightx = 1.0;
1527
gridBagConstraints.weighty = 1.0;
1528
gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 4);
1529
getContentPane().add(listPane, gridBagConstraints);
1531
gridBagConstraints = new java.awt.GridBagConstraints();
1532
gridBagConstraints.gridx = 1;
1533
gridBagConstraints.gridy = 0;
1534
gridBagConstraints.gridwidth = 3;
1535
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1536
gridBagConstraints.weightx = 1.0;
1537
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1538
getContentPane().add(type, gridBagConstraints);
1541
}// </editor-fold>//GEN-END:initComponents
1543
private void busMembersActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_busMembersActionPerformed
1545
}//GEN-LAST:event_busMembersActionPerformed
1547
private void colorAndPatternActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_colorAndPatternActionPerformed
1548
{//GEN-HEADEREND:event_colorAndPatternActionPerformed
1549
ArtworkLook.showArtworkLookDialog();
1550
}//GEN-LAST:event_colorAndPatternActionPerformed
1552
private void moreActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_moreActionPerformed
1553
{//GEN-HEADEREND:event_moreActionPerformed
1557
GridBagConstraints gridBagConstraints;
1558
gridBagConstraints = new GridBagConstraints();
1559
gridBagConstraints.gridx = 0;
1560
gridBagConstraints.gridy = 6;
1561
gridBagConstraints.gridwidth = 4;
1562
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
1563
gridBagConstraints.weightx = 1.0;
1564
getContentPane().add(moreStuffTop, gridBagConstraints);
1566
gridBagConstraints = new GridBagConstraints();
1567
gridBagConstraints.gridx = 0;
1568
gridBagConstraints.gridy = 7;
1569
gridBagConstraints.gridwidth = 4;
1570
gridBagConstraints.fill = GridBagConstraints.BOTH;
1571
gridBagConstraints.insets = new Insets(0, 4, 4, 4);
1572
gridBagConstraints.weightx = 1.0;
1573
gridBagConstraints.weighty = 1.0;
1574
getContentPane().add(listPane, gridBagConstraints);
1576
gridBagConstraints = new GridBagConstraints();
1577
gridBagConstraints.gridx = 0;
1578
gridBagConstraints.gridy = 8;
1579
gridBagConstraints.gridwidth = 4;
1580
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
1581
gridBagConstraints.weightx = 1.0;
1582
getContentPane().add(moreStuffBottom, gridBagConstraints);
1584
more.setText("Less");
1587
getContentPane().remove(moreStuffTop);
1588
getContentPane().remove(listPane);
1589
getContentPane().remove(moreStuffBottom);
1590
more.setText("More");
1593
}//GEN-LAST:event_moreActionPerformed
1595
private void seeActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_seeActionPerformed
1596
{//GEN-HEADEREND:event_seeActionPerformed
1597
if (!ports.isSelected()) return;
1598
int currentIndex = list.getSelectedIndex();
1599
ArcInst ai = portObjects.get(currentIndex);
1600
if (ai == null) return;
1601
NodeInst ni = shownNode;
1603
Highlighter highlighter = wnd.getHighlighter();
1604
highlighter.clear();
1605
highlighter.addElectricObject(ni, ni.getParent());
1606
highlighter.addElectricObject(ai, ai.getParent());
1607
highlighter.finished();
1609
}//GEN-LAST:event_seeActionPerformed
1611
private void attributesActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_attributesActionPerformed
1612
{//GEN-HEADEREND:event_attributesActionPerformed
1614
}//GEN-LAST:event_attributesActionPerformed
1616
private void portsActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_portsActionPerformed
1617
{//GEN-HEADEREND:event_portsActionPerformed
1619
}//GEN-LAST:event_portsActionPerformed
1621
private void applyActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_applyActionPerformed
1622
{//GEN-HEADEREND:event_applyActionPerformed
1623
if (shownNode == null) return;
1625
double currentXPos = TextUtils.atof(xPos.getText(), new Double(initialXPos));
1626
double currentYPos = TextUtils.atof(yPos.getText(), new Double(initialYPos));
1627
int currentRotation = (int)(TextUtils.atof(rotation.getText(), new Double(initialRotation)) * 10);
1629
new ChangeNode(shownNode,
1630
initialXPos, currentXPos, initialYPos, currentYPos,
1631
initialXSize, xSize.getText(), initialYSize, ySize.getText(),
1632
mirrorX.isSelected(), mirrorY.isSelected(),
1634
initialPopupIndex, popup.getSelectedIndex(),
1635
initialEasyToSelect, easyToSelect.isSelected(),
1636
initialInvisibleOutsideCell, invisibleOutsideCell.isSelected(),
1637
initialLocked, locked.isSelected(),
1638
initialExpansion, expanded.isSelected(),
1639
initialName, name.getText().trim(),
1640
initialTextField, textField.getText(),
1641
initialPopupEntry, (String)popup.getSelectedItem(),
1645
attributesTable.applyChanges();
1647
initialName = name.getText().trim();
1648
initialExpansion = expanded.isSelected();
1649
initialEasyToSelect = easyToSelect.isSelected();
1650
initialInvisibleOutsideCell = invisibleOutsideCell.isSelected();
1651
initialLocked = locked.isSelected();
1652
initialTextField = textField.getText();
1653
initialPopupEntry = (String)popup.getSelectedItem();
1654
initialXPos = currentXPos;
1655
initialYPos = currentYPos;
1656
initialXSize = xSize.getText();
1657
initialYSize = ySize.getText();
1658
initialMirrorX = mirrorX.isSelected();
1659
initialMirrorY = mirrorY.isSelected();
1660
initialRotation = currentRotation;
1661
}//GEN-LAST:event_applyActionPerformed
1663
private void okActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_okActionPerformed
1664
{//GEN-HEADEREND:event_okActionPerformed
1665
applyActionPerformed(evt);
1667
}//GEN-LAST:event_okActionPerformed
1669
private void cancelActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_cancelActionPerformed
1670
{//GEN-HEADEREND:event_cancelActionPerformed
1672
}//GEN-LAST:event_cancelActionPerformed
1674
private void closeDialog(java.awt.event.WindowEvent evt)//GEN-FIRST:event_closeDialog
1676
prefs.putBoolean("GetInfoNode-bigger", bigger);
1677
if (ports.isSelected()) prefs.putInt("GetInfoNode-buttonSelected", 0);
1678
if (attributes.isSelected()) prefs.putInt("GetInfoNode-buttonSelected", 1);
1679
if (busMembers.isSelected()) prefs.putInt("GetInfoNode-buttonSelected", 2);
1680
super.closeDialog();
1681
}//GEN-LAST:event_closeDialog
1683
private void editParametersActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editParametersActionPerformed
1684
if (shownNode == null) return;
1685
if (!shownNode.isCellInstance()) return;
1686
Cell.CellGroup group = ((Cell)shownNode.getProto()).getCellGroup();
1687
Cell paramOwner = group.getParameterOwner();
1688
if (paramOwner != null) {
1689
WindowFrame.createEditWindow(paramOwner);
1690
Attributes.showDialog();
1692
}//GEN-LAST:event_editParametersActionPerformed
1694
// Variables declaration - do not modify//GEN-BEGIN:variables
1695
private javax.swing.JButton apply;
1696
private javax.swing.JRadioButton attributes;
1697
private javax.swing.JRadioButton busMembers;
1698
private javax.swing.JButton cancel;
1699
private javax.swing.JButton colorAndPattern;
1700
private javax.swing.JCheckBox easyToSelect;
1701
private javax.swing.JButton editParameters;
1702
private javax.swing.JRadioButton expanded;
1703
private javax.swing.ButtonGroup expansion;
1704
private javax.swing.JCheckBox invisibleOutsideCell;
1705
private javax.swing.JLabel jLabel1;
1706
private javax.swing.JLabel jLabel3;
1707
private javax.swing.JLabel jLabel6;
1708
private javax.swing.JLabel jLabel7;
1709
private javax.swing.JLabel jLabel8;
1710
private javax.swing.JScrollPane listPane;
1711
private javax.swing.JCheckBox locked;
1712
private javax.swing.JCheckBox mirrorX;
1713
private javax.swing.JCheckBox mirrorY;
1714
private javax.swing.JButton more;
1715
private javax.swing.JPanel moreStuffBottom;
1716
private javax.swing.JPanel moreStuffTop;
1717
private javax.swing.JTextField name;
1718
private javax.swing.JButton ok;
1719
private javax.swing.JComboBox popup;
1720
private javax.swing.JLabel popupLabel;
1721
private javax.swing.JRadioButton ports;
1722
private javax.swing.JTextField rotation;
1723
private javax.swing.JButton see;
1724
private javax.swing.ButtonGroup selection;
1725
private javax.swing.JTextField textField;
1726
private javax.swing.JLabel textFieldLabel;
1727
private javax.swing.JTextField type;
1728
private javax.swing.JRadioButton unexpanded;
1729
private javax.swing.JTextField xPos;
1730
private javax.swing.JTextField xSize;
1731
private javax.swing.JLabel xsizeLabel;
1732
private javax.swing.JTextField yPos;
1733
private javax.swing.JTextField ySize;
1734
private javax.swing.JLabel ysizeLabel;
1735
// End of variables declaration//GEN-END:variables