⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 specialproperties.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                Object newV = Variable.withCode(newValue, newCode);				ni.newVar(Schematics.ATTR_WIDTH, newV, wtd);				Variable oldLen = ni.getVar(Schematics.ATTR_LENGTH);                TextDescriptor ltd = oldLen != null ? oldLen.getTextDescriptor() : TextDescriptor.getNodeTextDescriptor();                Object newVL = Variable.withCode(newValueLen, newCodeLen);				ni.newVar(Schematics.ATTR_LENGTH, newVL, ltd);			} else			{				// update single value on a node				Variable oldVar = ni.getVar(key);                TextDescriptor td = oldVar != null ? oldVar.getTextDescriptor() : TextDescriptor.getNodeTextDescriptor();                CodeExpression.Code newCode = oldVar != null ? oldVar.getCode() : CodeExpression.Code.NONE;                Object newV = Variable.withCode(newValue, newCode);				ni.newVar(key, newV, td);				// set techbits if requested				if (newBits != -1)					ni.setTechSpecific(newBits);			}			return true;		}	}	/**	 * This class displays a dialog for handling "global" node properties.	 */	private static class GlobalPropertiesDialog extends EDialog	{		private JTextField value;		private JComboBox combo;		private boolean cancelHit;		private boolean moreHit;		/** Creates new special node properties object for "global"s */		private GlobalPropertiesDialog(EditWindow wnd, NodeInst ni)		{			super(null, true);			String gName = "";			Variable var = ni.getVar(Schematics.SCHEM_GLOBAL_NAME);			if (var != null)				gName = var.getObject().toString();			initComponents(wnd, ni, "Global Signal", gName);			cancelHit = moreHit = false;			setVisible(true);			// all done: see if value should be updated			if (!cancelHit)			{				String newValue = value.getText();				PortCharacteristic ch = PortCharacteristic.findCharacteristic((String)combo.getSelectedItem());				int newBits = ch.getBits();				new ModifyNodeProperties(ni, Schematics.SCHEM_GLOBAL_NAME, newValue, newBits);			}		}		protected void escapePressed() { exit(false); }		private boolean wantMore() { return moreHit; }		private void exit(boolean goodButton)		{			cancelHit = !goodButton;			setVisible(false);			dispose();		}		private void moreButton()		{			moreHit = true;			exit(true);		}		private void initComponents(EditWindow wnd, NodeInst ni, String title, String initialValue)		{			getContentPane().setLayout(new GridBagLayout());			setTitle(title);			setName("");			addWindowListener(new WindowAdapter()			{				public void windowClosing(WindowEvent evt) { exit(false); }			});			// global information			JLabel lab1 = new JLabel("Global signal name:");			GridBagConstraints gbc = new GridBagConstraints();			gbc.gridx = 0;   gbc.gridy = 0;			gbc.gridwidth = 2;			gbc.anchor = GridBagConstraints.WEST;			gbc.insets = new Insets(4, 4, 4, 4);			getContentPane().add(lab1, gbc);			value = new JTextField(initialValue);			gbc = new GridBagConstraints();			gbc.gridx = 2;   gbc.gridy = 0;			gbc.gridwidth = 2;			gbc.fill = GridBagConstraints.HORIZONTAL;			gbc.weightx = .5;			gbc.insets = new Insets(4, 4, 4, 4);			getContentPane().add(value, gbc);		    EDialog.makeTextFieldSelectAllOnTab(value);			value.selectAll();			JLabel lab2 = new JLabel("Characteristics:");			gbc = new GridBagConstraints();			gbc.gridx = 0;   gbc.gridy = 1;			gbc.gridwidth = 2;			gbc.anchor = GridBagConstraints.WEST;			gbc.insets = new Insets(4, 4, 4, 4);			getContentPane().add(lab2, gbc);			combo = new JComboBox();			List<PortCharacteristic> characteristics = PortCharacteristic.getOrderedCharacteristics();			for(PortCharacteristic ch : characteristics)				combo.addItem(ch.getName());			PortCharacteristic ch = PortCharacteristic.findCharacteristic(ni.getTechSpecific());			combo.setSelectedItem(ch.getName());			gbc = new GridBagConstraints();			gbc.gridx = 2;   gbc.gridy = 1;			gbc.gridwidth = 2;			gbc.fill = GridBagConstraints.HORIZONTAL;			gbc.weightx = .5;			gbc.insets = new Insets(4, 4, 4, 4);			getContentPane().add(combo, gbc);			// OK, More, and Cancel			JButton cancel = new JButton("Cancel");			gbc = new GridBagConstraints();			gbc.gridx = 0;   gbc.gridy = 2;			gbc.anchor = GridBagConstraints.CENTER;			gbc.insets = new Insets(4, 4, 4, 4);			getContentPane().add(cancel, gbc);			cancel.addActionListener(new ActionListener()			{				public void actionPerformed(ActionEvent evt) { exit(false); }			});			JButton more = new JButton("More...");			gbc = new GridBagConstraints();			gbc.gridx = 1;   gbc.gridy = 2;			gbc.gridwidth = 2;			gbc.anchor = GridBagConstraints.CENTER;			gbc.insets = new Insets(4, 4, 4, 4);			getContentPane().add(more, gbc);			more.addActionListener(new ActionListener()			{				public void actionPerformed(ActionEvent evt) { moreButton(); }			});			JButton ok = new JButton("OK");			gbc = new GridBagConstraints();			gbc.gridx = 3;   gbc.gridy = 2;			gbc.anchor = GridBagConstraints.CENTER;			gbc.insets = new Insets(4, 4, 4, 4);			getContentPane().add(ok, gbc);			ok.addActionListener(new ActionListener()			{				public void actionPerformed(ActionEvent evt) { exit(true); }			});			getRootPane().setDefaultButton(ok);			pack();			// now make the dialog appear over a node			Point ew = wnd.getLocationOnScreen();			Point locInWnd = wnd.databaseToScreen(ni.getAnchorCenterX(), ni.getAnchorCenterY());			Point textfield = value.getLocation();			Dimension textSize = value.getSize();			setLocation(locInWnd.x+ew.x-(textfield.x+textSize.width/2), locInWnd.y+ew.y-(textfield.y+textSize.height/2+20));		}	}	/**	 * This class displays a dialog for handling "transistor" node properties.	 */	private static class TransistorPropertiesDialog extends EDialog	{		private JTextField valueWid, valueLen;		private JComboBox comboWid, comboLen;		private boolean cancelHit;		private boolean moreHit;		/** Creates new special node properties object for transistors */		private TransistorPropertiesDialog(EditWindow wnd, NodeInst ni)		{			super(null, true);			String tWid = "";			CodeExpression.Code cWid = CodeExpression.Code.NONE;			Variable varWid = ni.getVar(Schematics.ATTR_WIDTH);			if (varWid != null)			{				tWid = varWid.getObject().toString();				cWid = varWid.getCode();			}			String tLen = "";			CodeExpression.Code cLen = CodeExpression.Code.NONE;			Variable varLen = ni.getVar(Schematics.ATTR_LENGTH);			if (varLen != null)			{				tLen = varLen.getObject().toString();				cLen = varLen.getCode();			}			initComponents(wnd, ni, "Transistor Properties", tWid, cWid, tLen, cLen);			cancelHit = moreHit = false;			setVisible(true);			// all done: see if value should be updated			if (!cancelHit)			{				String newWid = valueWid.getText();				String newLen = valueLen.getText();		        CodeExpression.Code newWidCode = (CodeExpression.Code)comboWid.getSelectedItem();		        CodeExpression.Code newLenCode = (CodeExpression.Code)comboLen.getSelectedItem();				new ModifyNodeProperties(ni, newWid, newWidCode, newLen, newLenCode);			}		}		protected void escapePressed() { exit(false); }		private boolean wantMore() { return moreHit; }		private void exit(boolean goodButton)		{			cancelHit = !goodButton;			setVisible(false);			dispose();		}		private void moreButton()		{			moreHit = true;			exit(true);		}		private void initComponents(EditWindow wnd, NodeInst ni, String title, String initialWid, CodeExpression.Code codeWid,			String initialLen, CodeExpression.Code codeLen)		{			getContentPane().setLayout(new GridBagLayout());			setTitle(title);			setName("");			addWindowListener(new WindowAdapter()			{				public void windowClosing(WindowEvent evt) { exit(false); }			});			// transistor width information			JLabel lab1 = new JLabel("Width:");			GridBagConstraints gbc = new GridBagConstraints();			gbc.gridx = 0;   gbc.gridy = 0;			gbc.anchor = GridBagConstraints.WEST;			gbc.insets = new Insets(4, 4, 4, 4);			getContentPane().add(lab1, gbc);			valueWid = new JTextField(initialWid);			gbc = new GridBagConstraints();			gbc.gridx = 1;   gbc.gridy = 0;			gbc.gridwidth = 2;			gbc.fill = GridBagConstraints.HORIZONTAL;			gbc.weightx = 1;			gbc.insets = new Insets(4, 4, 4, 4);			getContentPane().add(valueWid, gbc);		    EDialog.makeTextFieldSelectAllOnTab(valueWid);			valueWid.selectAll();			comboWid = new JComboBox();			for(Iterator<CodeExpression.Code> it = CodeExpression.Code.getCodes(); it.hasNext(); )				comboWid.addItem(it.next());			comboWid.setSelectedItem(codeWid);			gbc = new GridBagConstraints();			gbc.gridx = 1;   gbc.gridy = 1;			gbc.gridwidth = 2;			gbc.fill = GridBagConstraints.HORIZONTAL;			gbc.weightx = 1;			gbc.insets = new Insets(4, 4, 4, 4);			getContentPane().add(comboWid, gbc);			// transistor length information			JLabel lab2 = new JLabel("Length:");			gbc = new GridBagConstraints();			gbc.gridx = 0;   gbc.gridy = 2;			gbc.anchor = GridBagConstraints.WEST;			gbc.insets = new Insets(4, 4, 4, 4);			getContentPane().add(lab2, gbc);			valueLen = new JTextField(initialLen);			gbc = new GridBagConstraints();			gbc.gridx = 1;   gbc.gridy = 2;			gbc.gridwidth = 2;			gbc.fill = GridBagConstraints.HORIZONTAL;			gbc.weightx = 1;			gbc.insets = new Insets(4, 4, 4, 4);			getContentPane().add(valueLen, gbc);		    EDialog.makeTextFieldSelectAllOnTab(valueLen);			comboLen = new JComboBox();			for(Iterator<CodeExpression.Code> it = CodeExpression.Code.getCodes(); it.hasNext(); )				comboLen.addItem(it.next());			comboLen.setSelectedItem(codeLen);			gbc = new GridBagConstraints();			gbc.gridx = 1;   gbc.gridy = 3;			gbc.gridwidth = 2;			gbc.fill = GridBagConstraints.HORIZONTAL;			gbc.weightx = 1;			gbc.insets = new Insets(4, 4, 4, 4);			getContentPane().add(comboLen, gbc);			// OK, More, and Cancel			JButton cancel = new JButton("Cancel");			gbc = new GridBagConstraints();			gbc.gridx = 0;   gbc.gridy = 4;			gbc.anchor = GridBagConstraints.CENTER;			gbc.insets = new Insets(4, 4, 4, 4);			getContentPane().add(cancel, gbc);			cancel.addActionListener(new ActionListener()			{				public void actionPerformed(ActionEvent evt) { exit(false); }			});			JButton more = new JButton("More...");			gbc = new GridBagConstraints();			gbc.gridx = 1;   gbc.gridy = 4;			gbc.anchor = GridBagConstraints.CENTER;			gbc.insets = new Insets(4, 4, 4, 4);			getContentPane().add(more, gbc);			more.addActionListener(new ActionListener()			{				public void actionPerformed(ActionEvent evt) { moreButton(); }			});			JButton ok = new JButton("OK");			gbc = new GridBagConstraints();			gbc.gridx = 2;   gbc.gridy = 4;			gbc.anchor = GridBagConstraints.CENTER;			gbc.insets = new Insets(4, 4, 4, 4);			getContentPane().add(ok, gbc);			ok.addActionListener(new ActionListener()			{				public void actionPerformed(ActionEvent evt) { exit(true); }			});			getRootPane().setDefaultButton(ok);			pack();			// now make the dialog appear over a node			Point ew = wnd.getLocationOnScreen();			Point locInWnd = wnd.databaseToScreen(ni.getAnchorCenterX(), ni.getAnchorCenterY());			Point textfield = valueWid.getLocation();			Dimension textSize = valueWid.getSize();			setLocation(locInWnd.x+ew.x-(textfield.x+textSize.width/2), locInWnd.y+ew.y-(textfield.y+textSize.height/2+20));		}	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -