*
* @return south panel content
*/
protected Component createSouthContent ()
{
final WebPanel southPanel = new WebPanel ();
southPanel.setLayout ( new ToolbarLayout ( 4 ) );
southPanel.setOpaque ( false );
southPanel.setMargin ( 0, 4, 4, 4 );
add ( southPanel, BorderLayout.SOUTH );
final WebLabel selectedFilesLabel = new WebLabel ();
selectedFilesLabel.setLanguage ( "weblaf.filechooser.files.selected" );
selectedFilesLabel.setDrawShade ( true );
selectedFilesLabel.setMargin ( 0, 4, 0, 0 );
southPanel.add ( selectedFilesLabel );
selectedFilesViewField = new WebFileChooserField ( false );
selectedFilesViewField.setShowRemoveButton ( false );
selectedFilesViewField.setShowFileShortName ( true );
selectedFilesViewField.setFilesDropEnabled ( false );
selectedFilesTextField = new WebTextField ( 0, true );
selectedFilesTextField.addCaretListener ( new CaretListener ()
{
@Override
public void caretUpdate ( final CaretEvent e )
{
// No need to specify files, they will be calculated when needed
updateApproveButtonState ( null );
}
} );
selectedFilesTextField.addActionListener ( new ActionListener ()
{
@Override
public void actionPerformed ( final ActionEvent e )
{
// Try to approve selection
approveButton.doClick ( 0 );
}
} );
selectedFilesPanel = new WebPanel ( chooserType == FileChooserType.save ? selectedFilesTextField : selectedFilesViewField );
southPanel.add ( selectedFilesPanel, ToolbarLayout.FILL );
fileFilters = new WebComboBox ();
fileFilters.setRenderer ( new DefaultFileFilterListCellRenderer () );
fileFilters.addActionListener ( new ActionListener ()
{
@Override
public void actionPerformed ( final ActionEvent e )
{
setActiveFileFilter ( ( AbstractFileFilter ) fileFilters.getSelectedItem (), false );
}
} );
approveButton = new WebButton ( "", APPROVE_ICON );
// approveButton.addHotkey ( WebFileChooserPanel.this, Hotkey.CTRL_ENTER ).setHotkeyDisplayWay ( TooltipWay.up );
approveButton.setRolloverShine ( StyleConstants.highlightControlButtons );
approveButton.setShineColor ( StyleConstants.greenHighlight );
approveButton.putClientProperty ( GroupPanel.FILL_CELL, true );
approveButton.setEnabled ( false );
approveButton.addActionListener ( new ActionListener ()
{
@Override
public void actionPerformed ( final ActionEvent e )
{
fireApproveAction ( e );
}
} );
cancelButton = new WebButton ( "", CANCEL_ICON );
cancelButton.setLanguage ( "weblaf.filechooser.cancel" );
// cancelButton.addHotkey ( WebFileChooserPanel.this, Hotkey.ESCAPE ).setHotkeyDisplayWay ( TooltipWay.up );
cancelButton.setRolloverShine ( StyleConstants.highlightControlButtons );
cancelButton.setShineColor ( StyleConstants.redHighlight );
cancelButton.putClientProperty ( GroupPanel.FILL_CELL, true );
cancelButton.addActionListener ( new ActionListener ()
{
@Override
public void actionPerformed ( final ActionEvent e )
{
fireCancelAction ( e );
}
} );
controlsPanel = new WebPanel ();
updateControls ();
southPanel.add ( controlsPanel, ToolbarLayout.END );
// For proper equal sizing of control buttons
SwingUtils.equalizeComponentsSize ( approveButton, cancelButton );
final PropertyChangeListener pcl = new PropertyChangeListener ()
{
@Override
public void propertyChange ( final PropertyChangeEvent e )
{
approveButton.setPreferredSize ( null );
cancelButton.setPreferredSize ( null );
SwingUtils.equalizeComponentsSize ( approveButton, cancelButton );
southPanel.revalidate ();
}
};
approveButton.addPropertyChangeListener ( AbstractButton.TEXT_CHANGED_PROPERTY, pcl );
cancelButton.addPropertyChangeListener ( AbstractButton.TEXT_CHANGED_PROPERTY, pcl );