📄 getinfoexport.java
字号:
// change the characteristic PortCharacteristic newChar = PortCharacteristic.findCharacteristic(newCharName); if (newChar != pp.getCharacteristic()) { pp.setCharacteristic(newChar); // change characteristic in all views List<Cell> othersChanged = new ArrayList<Cell>(); Cell thisCell = pp.getParent(); for(Iterator<Cell> it = thisCell.getCellGroup().getCells(); it.hasNext(); ) { Cell otherCell = it.next(); if (otherCell == thisCell) continue; Export otherPP = pp.getEquivalentPort(otherCell); if (otherPP != null) { if (otherPP.getCharacteristic() != newChar) { otherPP.setCharacteristic(newChar); othersChanged.add(otherCell); } } } if (othersChanged.size() > 0) { System.out.print("Also changed the characteristic of this export in"); for(int i=0; i<othersChanged.size(); i++) { Cell otherCell = othersChanged.get(i); if (i != 0) System.out.print(","); System.out.print(" " + otherCell.describe(false)); } System.out.println(); } } // change reference name if (newChar.isReference()) pp.newVar(Export.EXPORT_REFERENCE_NAME, newRefName); return true; } } /** 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; cancel = new javax.swing.JButton(); ok = new javax.swing.JButton(); apply = new javax.swing.JButton(); leftSide = new javax.swing.JPanel(); jLabel10 = new javax.swing.JLabel(); characteristics = new javax.swing.JComboBox(); jLabel1 = new javax.swing.JLabel(); refName = new javax.swing.JTextField(); bodyOnly = new javax.swing.JCheckBox(); alwaysDrawn = new javax.swing.JCheckBox(); centerLoc = new javax.swing.JLabel(); header = new javax.swing.JLabel(); theText = new javax.swing.JTextField(); setTitle("Export Properties"); setName(""); // NOI18N addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); getContentPane().setLayout(new java.awt.GridBagLayout()); cancel.setText("Cancel"); cancel.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; gridBagConstraints.weightx = 0.25; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); getContentPane().add(cancel, gridBagConstraints); ok.setText("OK"); ok.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { okActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 3; gridBagConstraints.weightx = 0.25; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); getContentPane().add(ok, gridBagConstraints); apply.setText("Apply"); apply.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { applyActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.weightx = 0.25; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); getContentPane().add(apply, gridBagConstraints); leftSide.setBorder(javax.swing.BorderFactory.createEtchedBorder()); leftSide.setLayout(new java.awt.GridBagLayout()); jLabel10.setText("Characteristics:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); leftSide.add(jLabel10, gridBagConstraints); characteristics.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { characteristicsActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 0.1; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); leftSide.add(characteristics, gridBagConstraints); jLabel1.setText("Reference name:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); leftSide.add(jLabel1, gridBagConstraints); refName.setText(" "); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 0.1; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); leftSide.add(refName, gridBagConstraints); bodyOnly.setText("Body only"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 0); leftSide.add(bodyOnly, gridBagConstraints); alwaysDrawn.setText("Always drawn"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 0); leftSide.add(alwaysDrawn, gridBagConstraints); centerLoc.setText("Center:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); leftSide.add(centerLoc, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 4, 2, 4); getContentPane().add(leftSide, gridBagConstraints); header.setText("Export name:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); getContentPane().add(header, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); getContentPane().add(theText, gridBagConstraints); pack(); }// </editor-fold>//GEN-END:initComponents private void characteristicsActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_characteristicsActionPerformed {//GEN-HEADEREND:event_characteristicsActionPerformed String stringNow = (String)characteristics.getSelectedItem(); PortCharacteristic ch = PortCharacteristic.findCharacteristic(stringNow); refName.setEditable(ch.isReference()); }//GEN-LAST:event_characteristicsActionPerformed private void applyActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_applyActionPerformed {//GEN-HEADEREND:event_applyActionPerformed if (shownExport == null) return; // check if changes to be made boolean changed = false; // check name String newName = theText.getText(); if (!newName.equals(initialName)) changed = true; // check body only boolean newBodyOnly = bodyOnly.isSelected(); if (newBodyOnly != initialBodyOnly) changed = true; // check always drawn boolean newAlwaysDrawn = alwaysDrawn.isSelected(); if (newAlwaysDrawn != initialAlwaysDrawn) changed = true; // check characteristic String newCharName = (String)characteristics.getSelectedItem(); if (!newCharName.equals(initialCharacteristicName)) changed = true; // check reference name String newRefName = refName.getText(); if (!newRefName.equals(initialRefName)) changed = true; if (changed) { // generate Job to change export port options new ChangeExport(shownExport, initialName, newName, newBodyOnly, newAlwaysDrawn, newCharName, newRefName); } // possibly generate job to change export text options textPanel.applyChanges(true); initialName = newName; initialBodyOnly = newBodyOnly; initialAlwaysDrawn = newAlwaysDrawn; initialCharacteristicName = newCharName; initialRefName = newRefName; }//GEN-LAST:event_applyActionPerformed private void okActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_okActionPerformed {//GEN-HEADEREND:event_okActionPerformed applyActionPerformed(evt); closeDialog(null); }//GEN-LAST:event_okActionPerformed private void cancelActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_cancelActionPerformed {//GEN-HEADEREND:event_cancelActionPerformed closeDialog(null); }//GEN-LAST:event_cancelActionPerformed /** Closes the dialog */ private void closeDialog(java.awt.event.WindowEvent evt)//GEN-FIRST:event_closeDialog { super.closeDialog(); }//GEN-LAST:event_closeDialog // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JCheckBox alwaysDrawn; private javax.swing.JButton apply; private javax.swing.JCheckBox bodyOnly; private javax.swing.JButton cancel; private javax.swing.JLabel centerLoc; private javax.swing.JComboBox characteristics; private javax.swing.JLabel header; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JPanel leftSide; private javax.swing.JButton ok; private javax.swing.JTextField refName; private javax.swing.JTextField theText; // End of variables declaration//GEN-END:variables}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -