📄 composeconfigdialog.java
字号:
xtext = UserProperties.getProperty( Configuration.P_COMPOSE_FORWARD_ENCLOSURE, null ); forwardEnclosure_.setText( xtext ); forwardAttachments_ = ComponentFactory.getCheckBox( ICEMail.getBundle(), "ConfigComposition.Attachments", true ); AWTUtilities.constrain( fPan, forwardAttachments_, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER, 1, fRow++, 1, 1, 1.0, 0.0 ); boolean xboolean = UserProperties.getProperty( Configuration.P_COMPOSE_FORWARD_ATTACHMENTS, false ); forwardAttachments_.setSelected( xboolean ); JPanel namePan = new JPanel(); namePan.setLayout( new GridBagLayout() ); namePan.setBorder( new EmptyBorder( 4, 4, 4, 4 ) ); AWTUtilities.constrain( cont, namePan, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER, 0, row++, 2, 1, 1.0, 0.0 ); // add path for saving compositions lbl = ComponentFactory.getLabel( ICEMail.getBundle(), "ConfigComposition.SaveFolder" ); lbl.setHorizontalAlignment( JLabel.LEFT ); AWTUtilities.constrain( namePan, lbl, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST, 0, 0, 1, 1, 1.0, 0.0 ); compositionsPath_ = ComponentFactory.getTextField( ICEMail.getBundle(), "ConfigComposition.SaveFolder", null ); AWTUtilities.constrain( namePan, compositionsPath_, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST, 0, 1, 1, 1, 1.0, 0.0 ); String xpath = UserProperties.getProperty( "composeFolderPath", null ); compositionsPath_.setText( xpath ); compositionsPath_.addFocusListener( treeListener_ ); // add path for saving sent messages lbl = ComponentFactory.getLabel( ICEMail.getBundle(), "ConfigComposition.SentFolder" ); lbl.setHorizontalAlignment( JLabel.LEFT ); AWTUtilities.constrain( namePan, lbl, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST, 0, 2, 1, 1, 1.0, 0.0 ); sentPath_ = ComponentFactory.getTextField( ICEMail.getBundle(), "ConfigComposition.SentFolder", null ); AWTUtilities.constrain( namePan, sentPath_, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST, 0, 3, 1, 1, 1.0, 0.0 ); xpath = UserProperties.getProperty( "sentFolderPath", null ); sentPath_.setText( xpath ); sentPath_.addFocusListener( treeListener_ ); // add buttons JPanel btnPan = new JPanel(); btnPan.setLayout( new GridBagLayout() ); btnPan.setBorder( JFCUtilities.StandardBorder ); AWTUtilities.constrain( cont, btnPan, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER, 0, row++, 2, 1, 1.0, 0.0 ); JButton btn; btn = ComponentFactory.getButton( ICEMail.getBundle(), "ConfigComposition.Save", xactionListener, null ); AWTUtilities.constrain( btnPan, btn, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER, 0, 0, 1, 1, 1.0, 0.0 ); btn = ComponentFactory.getButton( ICEMail.getBundle(), "ConfigComposition.Cancel", xactionListener, null ); AWTUtilities.constrain( btnPan, btn, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER, 1, 0, 1, 1, 1.0, 0.0 ); // add list of stores for selecting paths DefaultMutableTreeNode newRoot = new DefaultMutableTreeNode( "Stores" ); DefaultMutableTreeNode rootNode = FolderTreePanel.getInstance().getRootNode(); for ( int i = 0 ; i < rootNode.getChildCount() ; ++i ) { StoreTreeNode sNode = (StoreTreeNode) rootNode.getChildAt( i ); if ( sNode != null ) { newRoot.add( (StoreTreeNode) sNode.clone() ); } } tree_ = new JTree( new DefaultTreeModel( newRoot ) ); tree_.addTreeSelectionListener( treeListener_ ); tree_.setCellRenderer( new FolderTreeCellRenderer() ); JScrollPane xscroller = new JScrollPane(); xscroller.getViewport().add( tree_ ); AWTUtilities.constrain( cont, xscroller, GridBagConstraints.BOTH, GridBagConstraints.CENTER, 0, row++, 2, 1, 1.0, 1.0 ); }//............................................................ private class IActionListener implements ActionListener { /** * Invoked when an action occurs. * <p> * Implementation of java.awt.event.ActionListener.actionPerformed() * * @param event the action event that occured */ public void actionPerformed( ActionEvent event ) { boolean disposeIt = false; String command = event.getActionCommand(); if ( command.equals( "SAVE" ) ) { Configuration config = Configuration.getInstance(); config.setProperty( "composeFolderPath", compositionsPath_.getText() ); config.setProperty( "sentFolderPath", sentPath_.getText() ); config.setProperty( Configuration.P_COMPOSE_REPLY_PREFIX, replyPrefix_.getText() ); config.setProperty( Configuration.P_COMPOSE_REPLY_ENCLOSURE, replyEnclosure_.getText() ); config.setProperty( Configuration.P_COMPOSE_FORWARD_PREFIX, forwardPrefix_.getText() ); config.setProperty( Configuration.P_COMPOSE_FORWARD_ENCLOSURE, forwardEnclosure_.getText() ); config.setProperty( Configuration.P_COMPOSE_FORWARD_ATTACHMENTS, forwardAttachments_.isSelected() ); config.saveProperties(); disposeIt = true; } else if ( command.equals( "CANCEL" ) ) { disposeIt = true; } if ( disposeIt ) dispose(); } }//............................................................ private class ITreeSelectionListener implements TreeSelectionListener, FocusListener { private JTextField pathField_ = null; public void valueChanged( TreeSelectionEvent event ) { TreePath path = tree_.getSelectionPath(); if ( path != null ) { String storeName = null; String folderPath = null; Object obj = path.getPathComponent( 1 ); if ( obj instanceof StoreTreeNode ) { StoreTreeNode node = (StoreTreeNode) obj; storeName = node.getName(); } obj = path.getLastPathComponent(); if ( obj instanceof FolderTreeNode ) { FolderTreeNode node = (FolderTreeNode) obj; folderPath = node.getFolder().getFullName(); } if ( storeName != null && folderPath != null && pathField_ != null ) { pathField_.setText( storeName + "/" + folderPath ); } } } public void setPathField( JTextField field ) { pathField_ = field; } public void focusGained( FocusEvent event ) { pathField_ = (JTextField)event.getComponent(); } public void focusLost( FocusEvent event ) { } }//............................................................ /** * A internal class to handle the closing of window by the window manager, * i.e. disposing of the window properly. */ private class IWindowAdapter extends WindowAdapter { public void windowClosing( WindowEvent event ) { event.getWindow().dispose(); } public void windowActivated( WindowEvent event ) { if ( compositionsPath_ != null ) { compositionsPath_.requestFocus(); } } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -