📄 parasitictab.java
字号:
/* -*- tab-width: 4 -*- * * Electric(tm) VLSI Design System * * File: ParasiticTab.java * * Copyright (c) 2006 Sun Microsystems and Static Free Software * * Electric(tm) is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * Electric(tm) is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Electric(tm); see the file COPYING. If not, write to * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, Mass 02111-1307, USA. */package com.sun.electric.tool.user.dialogs.projsettings;import com.sun.electric.database.text.Setting;import com.sun.electric.database.text.TextUtils;import com.sun.electric.technology.Layer;import com.sun.electric.technology.Technology;import com.sun.electric.tool.user.dialogs.EDialog;import com.sun.electric.tool.user.dialogs.ProjectSettingsFrame;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.MouseAdapter;import java.awt.event.MouseEvent;import java.util.Iterator;import javax.swing.DefaultListModel;import javax.swing.JList;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.ListSelectionModel;import javax.swing.event.DocumentEvent;import javax.swing.event.DocumentListener;/** * Class to handle the "Parasitics" tab of the Project Settings dialog. */public class ParasiticTab extends ProjSettingsPanel { private JList layerList; private DefaultListModel layerListModel; private boolean changing; /** Creates new form ParasiticTab */ public ParasiticTab(ProjectSettingsFrame parent, boolean modal) { super(parent, modal); initComponents(); // make all text fields select-all when entered EDialog.makeTextFieldSelectAllOnTab(resistance); EDialog.makeTextFieldSelectAllOnTab(capacitance); EDialog.makeTextFieldSelectAllOnTab(edgeCapacitance); EDialog.makeTextFieldSelectAllOnTab(minResistance); EDialog.makeTextFieldSelectAllOnTab(minCapacitance); EDialog.makeTextFieldSelectAllOnTab(maxSeriesResistance); EDialog.makeTextFieldSelectAllOnTab(gateLengthSubtraction); } /** return the panel to use for this preferences tab. */ public JPanel getPanel() { return topPanel; } /** return the name of this preferences tab. */ public String getName() { return "Parasitic"; } /** * Method called at the start of the dialog. * Caches current values and displays them in the Routing tab. */ public void init() { changing = false; layerListModel = new DefaultListModel(); layerList = new JList(layerListModel); layerList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); spiceLayer.setViewportView(layerList); layerList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { layerListClick(); } }); for(Iterator<Technology> it = Technology.getTechnologies(); it.hasNext(); ) { Technology tech = it.next(); techSelection.addItem(tech.getTechName()); } techSelection.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { techChanged(); } }); techSelection.setSelectedItem(Technology.getCurrent().getTechName()); ParasiticLayerDocumentListener updateLayerParasitics = new ParasiticLayerDocumentListener(); resistance.getDocument().addDocumentListener(updateLayerParasitics); capacitance.getDocument().addDocumentListener(updateLayerParasitics); edgeCapacitance.getDocument().addDocumentListener(updateLayerParasitics); ParasiticTechDocumentListener updateTechnologyGlobals = new ParasiticTechDocumentListener(); minResistance.getDocument().addDocumentListener(updateTechnologyGlobals); minCapacitance.getDocument().addDocumentListener(updateTechnologyGlobals); maxSeriesResistance.getDocument().addDocumentListener(updateTechnologyGlobals); gateLengthSubtraction.getDocument().addDocumentListener(updateTechnologyGlobals); includeGate.addActionListener(updateTechnologyGlobals); includeGround.addActionListener(updateTechnologyGlobals); } private void techChanged() { String techName = (String)techSelection.getSelectedItem(); Technology tech = Technology.findTechnology(techName); if (tech == null) return; changing = true; minResistance.setText(getFormattedDouble(tech.getMinResistanceSetting())); minCapacitance.setText(getFormattedDouble(tech.getMinCapacitanceSetting())); gateLengthSubtraction.setText(getFormattedDouble(tech.getGateLengthSubtractionSetting())); maxSeriesResistance.setText(getFormattedDouble(tech.getMaxSeriesResistanceSetting())); includeGate.setSelected(getBoolean(tech.getGateIncludedSetting())); includeGround.setSelected(getBoolean(tech.getGroundNetIncludedSetting())); layerListModel.clear(); for(Iterator<Layer> it = tech.getLayers(); it.hasNext(); ) { Layer layer = it.next(); layerListModel.addElement(layer.getName()); } layerList.setSelectedIndex(0); layerListClick(); changing = false; } private void layerListClick() { String techName = (String)techSelection.getSelectedItem(); Technology tech = Technology.findTechnology(techName); if (tech == null) return; changing = true; String layerName = (String)layerList.getSelectedValue(); Layer layer = tech.findLayer(layerName); if (layer != null) { resistance.setText(getFormattedDouble(layer.getResistanceSetting())); capacitance.setText(getFormattedDouble(layer.getCapacitanceSetting())); edgeCapacitance.setText(getFormattedDouble(layer.getEdgeCapacitanceSetting())); } changing = false; } /** * Class to handle special changes to per-layer parasitics. */ private class ParasiticLayerDocumentListener implements DocumentListener { private void change() { if (changing) return; // get the currently selected layer String techName = (String)techSelection.getSelectedItem(); Technology tech = Technology.findTechnology(techName); if (tech == null) return; String layerName = (String)layerList.getSelectedValue(); Layer layer = tech.findLayer(layerName); if (layer == null) return; setDouble(layer.getResistanceSetting(), TextUtils.atof(resistance.getText())); setDouble(layer.getCapacitanceSetting(), TextUtils.atof(capacitance.getText())); setDouble(layer.getEdgeCapacitanceSetting(), TextUtils.atof(edgeCapacitance.getText())); } public void changedUpdate(DocumentEvent e) { change(); } public void insertUpdate(DocumentEvent e) { change(); } public void removeUpdate(DocumentEvent e) { change(); } } /** * Class to handle special changes to per-layer parasitics. */ private class ParasiticTechDocumentListener implements ActionListener, DocumentListener { public void actionPerformed(ActionEvent evt) { updateTechnologyGlobals(); } public void changedUpdate(DocumentEvent e) { updateTechnologyGlobals(); } public void insertUpdate(DocumentEvent e) { updateTechnologyGlobals(); } public void removeUpdate(DocumentEvent e) { updateTechnologyGlobals(); } private void updateTechnologyGlobals() { if (changing) return; String techName = (String)techSelection.getSelectedItem(); Technology tech = Technology.findTechnology(techName); if (tech == null) return; setDouble(tech.getMinResistanceSetting(), TextUtils.atof(minResistance.getText())); setDouble(tech.getMinCapacitanceSetting(),TextUtils.atof(minCapacitance.getText())); setDouble(tech.getGateLengthSubtractionSetting(), TextUtils.atof(gateLengthSubtraction.getText())); setDouble(tech.getMaxSeriesResistanceSetting(), TextUtils.atof(maxSeriesResistance.getText())); setBoolean(tech.getGateIncludedSetting(), includeGate.isSelected()); setBoolean(tech.getGroundNetIncludedSetting(), includeGround.isSelected()); } } private void factoryResetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_factoryResetActionPerformed String techName = (String)techSelection.getSelectedItem(); Technology tech = Technology.findTechnology(techName); if (tech == null) return; int ret = JOptionPane.showConfirmDialog(this, "Are you sure you want to reset all layers for technology "+techName+" to their default resistance and capacitance values?", "Factory Reset", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); if (ret == JOptionPane.YES_OPTION) { for (Iterator<Layer> lIt = tech.getLayers(); lIt.hasNext(); ) { Layer layer = lIt.next();// layer.resetToFactoryParasitics(); Setting resistanceSetting = layer.getResistanceSetting(); setDouble(resistanceSetting, resistanceSetting.getDoubleFactoryValue()); Setting capacitanceSetting = layer.getCapacitanceSetting(); setDouble(capacitanceSetting, capacitanceSetting.getDoubleFactoryValue()); Setting edgeCapacitanceSetting = layer.getEdgeCapacitanceSetting(); setDouble(edgeCapacitanceSetting, edgeCapacitanceSetting.getDoubleFactoryValue()); } init(); } }//GEN-LAST:event_factoryResetActionPerformed /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; topPanel = new javax.swing.JPanel(); techValues = new javax.swing.JPanel(); spiceLayer = new javax.swing.JScrollPane(); jLabel7 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); resistance = new javax.swing.JTextField(); jLabel12 = new javax.swing.JLabel(); capacitance = new javax.swing.JTextField(); edgeCapacitance = new javax.swing.JTextField(); factoryReset = new javax.swing.JButton(); globalValues = new javax.swing.JPanel(); jLabel20 = new javax.swing.JLabel(); minResistance = new javax.swing.JTextField(); jLabel21 = new javax.swing.JLabel(); minCapacitance = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -