📄 crosslibcopy.java
字号:
dialog.listCenter.setSelectedIndex(index); } } /** 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; Top = new javax.swing.JPanel(); librariesLeft = new javax.swing.JComboBox(); librariesRight = new javax.swing.JComboBox(); copyLeft = new javax.swing.JButton(); copyRight = new javax.swing.JButton(); done = new javax.swing.JButton(); cellsLeft = new javax.swing.JScrollPane(); center = new javax.swing.JScrollPane(); cellsRight = new javax.swing.JScrollPane(); centerLabel = new javax.swing.JLabel(); Bottom = new javax.swing.JPanel(); BottomLeft = new javax.swing.JPanel(); compareContent = new javax.swing.JCheckBox(); compareQuite = new javax.swing.JCheckBox(); BottomCenter = new javax.swing.JPanel(); examineContents = new javax.swing.JButton(); BottomRight = new javax.swing.JPanel(); deleteAfterCopy = new javax.swing.JCheckBox(); copySubcells = new javax.swing.JCheckBox(); useExistingSubcells = new javax.swing.JCheckBox(); copyRelatedViews = new javax.swing.JCheckBox(); getContentPane().setLayout(new java.awt.BorderLayout(0, 10)); setTitle("Cross Library Copy"); setName(""); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); Top.setLayout(new java.awt.GridBagLayout()); librariesLeft.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { librariesLeftActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 4); Top.add(librariesLeft, gridBagConstraints); librariesRight.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { librariesRightActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 4); Top.add(librariesRight, gridBagConstraints); copyLeft.setText("<< Copy"); copyLeft.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { copyLeftActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); Top.add(copyLeft, gridBagConstraints); copyRight.setText("Copy >>"); copyRight.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { copyRightActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); Top.add(copyRight, gridBagConstraints); done.setText("Done"); done.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { doneActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); Top.add(done, gridBagConstraints); cellsLeft.setPreferredSize(new java.awt.Dimension(200, 350)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.5; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); Top.add(cellsLeft, gridBagConstraints); center.setMinimumSize(new java.awt.Dimension(50, 200)); center.setOpaque(false); center.setPreferredSize(new java.awt.Dimension(50, 200)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(4, 0, 4, 0); Top.add(center, gridBagConstraints); cellsRight.setPreferredSize(new java.awt.Dimension(200, 350)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.5; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); Top.add(cellsRight, gridBagConstraints); centerLabel.setText("Date"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; Top.add(centerLabel, gridBagConstraints); getContentPane().add(Top, java.awt.BorderLayout.CENTER); BottomLeft.setLayout(new java.awt.GridBagLayout()); compareContent.setText("Date and content"); compareContent.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { compareContentItemStateChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; BottomLeft.add(compareContent, gridBagConstraints); compareQuite.setSelected(true); compareQuite.setText("Examine quietly"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; BottomLeft.add(compareQuite, gridBagConstraints); Bottom.add(BottomLeft); BottomCenter.setLayout(new java.awt.GridBagLayout()); examineContents.setText("Compare"); examineContents.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { examineContentsActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); BottomCenter.add(examineContents, gridBagConstraints); Bottom.add(BottomCenter); BottomRight.setLayout(new java.awt.GridBagLayout()); deleteAfterCopy.setText("Delete after copy"); deleteAfterCopy.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { deleteAfterCopyItemStateChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; BottomRight.add(deleteAfterCopy, gridBagConstraints); copySubcells.setText("Copy subcells"); copySubcells.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { copySubcellsActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; BottomRight.add(copySubcells, gridBagConstraints); useExistingSubcells.setText("Use existing subcells"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 20, 0, 0); BottomRight.add(useExistingSubcells, gridBagConstraints); copyRelatedViews.setText("Copy all related views"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; BottomRight.add(copyRelatedViews, gridBagConstraints); Bottom.add(BottomRight); getContentPane().add(Bottom, java.awt.BorderLayout.SOUTH); pack(); }// </editor-fold>//GEN-END:initComponents private void copySubcellsActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_copySubcellsActionPerformed {//GEN-HEADEREND:event_copySubcellsActionPerformed if (copySubcells.isSelected()) { useExistingSubcells.setSelected(true); useExistingSubcells.setEnabled(false); } else { useExistingSubcells.setEnabled(true); } }//GEN-LAST:event_copySubcellsActionPerformed private void compareContentItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_compareContentItemStateChanged if (compareContent.isSelected()) { centerLabel.setText("Date/Content"); } else { centerLabel.setText("Date"); } // Clean any information modelCenter.clear(); // re-create data column again showCells(false); }//GEN-LAST:event_compareContentItemStateChanged private void deleteAfterCopyItemStateChanged(java.awt.event.ItemEvent evt)//GEN-FIRST:event_deleteAfterCopyItemStateChanged {//GEN-HEADEREND:event_deleteAfterCopyItemStateChanged if (deleteAfterCopy.isSelected()) { copyLeft.setText("<< Move"); copyRight.setText("Move >>"); } else { copyLeft.setText("<< Copy"); copyRight.setText("Copy >>"); } }//GEN-LAST:event_deleteAfterCopyItemStateChanged private void librariesRightActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_librariesRightActionPerformed {//GEN-HEADEREND:event_librariesRightActionPerformed // the right popup of libraies changed JComboBox cb = (JComboBox)evt.getSource(); int index = cb.getSelectedIndex(); curLibRight = libList.get(index); showCells(false); }//GEN-LAST:event_librariesRightActionPerformed private void librariesLeftActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_librariesLeftActionPerformed {//GEN-HEADEREND:event_librariesLeftActionPerformed // the left popup of libraies changed JComboBox cb = (JComboBox)evt.getSource(); int index = cb.getSelectedIndex(); curLibLeft = libList.get(index); showCells(false); }//GEN-LAST:event_librariesLeftActionPerformed private void examineContentsActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_examineContentsActionPerformed {//GEN-HEADEREND:event_examineContentsActionPerformed showCells(!compareQuite.isSelected()); }//GEN-LAST:event_examineContentsActionPerformed private void copyRightActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_copyRightActionPerformed {//GEN-HEADEREND:event_copyRightActionPerformed List<Cell> fromCells = new ArrayList<Cell>(); for (Object cellObj : listLeft.getSelectedValues()) { String cellName = (String)cellObj; Cell fromCell = curLibLeft.findNodeProto(cellName); if (fromCell == null) return; fromCells.add(fromCell); } new CrossLibraryCopyJob(fromCells, curLibRight, this, deleteAfterCopy.isSelected(), copyRelatedViews.isSelected(), copySubcells.isSelected(), useExistingSubcells.isSelected()); }//GEN-LAST:event_copyRightActionPerformed private void doneActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_doneActionPerformed {//GEN-HEADEREND:event_doneActionPerformed closeDialog(null); }//GEN-LAST:event_doneActionPerformed private void copyLeftActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_copyLeftActionPerformed {//GEN-HEADEREND:event_copyLeftActionPerformed List<Cell> fromCells = new ArrayList<Cell>(); for (Object cellObj : listRight.getSelectedValues()) { String cellName = (String)cellObj; Cell fromCell = curLibRight.findNodeProto(cellName); if (fromCell == null) return; fromCells.add(fromCell); } new CrossLibraryCopyJob(fromCells, curLibLeft, this, deleteAfterCopy.isSelected(), copyRelatedViews.isSelected(), copySubcells.isSelected(), useExistingSubcells.isSelected()); }//GEN-LAST:event_copyLeftActionPerformed /** Closes the dialog */ private void closeDialog(java.awt.event.WindowEvent evt)//GEN-FIRST:event_closeDialog { lastDeleteAfterCopy = deleteAfterCopy.isSelected(); lastCopyRelated = copyRelatedViews.isSelected(); lastCopySubcells = copySubcells.isSelected(); lastUseExisting = useExistingSubcells.isSelected(); setVisible(false); dispose(); }//GEN-LAST:event_closeDialog // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel Bottom; private javax.swing.JPanel BottomCenter; private javax.swing.JPanel BottomLeft; private javax.swing.JPanel BottomRight; private javax.swing.JPanel Top; private javax.swing.JScrollPane cellsLeft; private javax.swing.JScrollPane cellsRight; private javax.swing.JScrollPane center; private javax.swing.JLabel centerLabel; private javax.swing.JCheckBox compareContent; private javax.swing.JCheckBox compareQuite; private javax.swing.JButton copyLeft; private javax.swing.JCheckBox copyRelatedViews; private javax.swing.JButton copyRight; private javax.swing.JCheckBox copySubcells; private javax.swing.JCheckBox deleteAfterCopy; private javax.swing.JButton done; private javax.swing.JButton examineContents; private javax.swing.JComboBox librariesLeft; private javax.swing.JComboBox librariesRight; private javax.swing.JCheckBox useExistingSubcells; // End of variables declaration//GEN-END:variables}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -