SPARK-1469: Code cleanup: make nested classes static if applicable.

This commit is contained in:
arthur 2020-11-03 22:11:19 +03:00
parent 0d57e949bf
commit 4359d04f6c
31 changed files with 58 additions and 58 deletions

View File

@ -1402,7 +1402,7 @@ public class LoginDialog {
/**
* Defines the background to use with the Login panel.
*/
public class LoginBackgroundPanel extends JPanel {
public static class LoginBackgroundPanel extends JPanel {
private static final long serialVersionUID = -2449309600851007447L;
final ImageIcon icons = Default.getImageIcon(Default.LOGIN_DIALOG_BACKGROUND_IMAGE);
@ -1430,7 +1430,7 @@ public class LoginDialog {
/**
* The image panel to display the Spark Logo.
*/
public class ImagePanel extends JPanel {
public static class ImagePanel extends JPanel {
private static final long serialVersionUID = -1778389077647562606L;
private final ImageIcon icons = Default.getImageIcon(Default.MAIN_IMAGE);

View File

@ -114,7 +114,7 @@ public class CheckRenderer extends JPanel implements TreeCellRenderer {
/**
* Represents one UI node for the checkbox node.
*/
public class TreeLabel extends JLabel {
public static class TreeLabel extends JLabel {
private static final long serialVersionUID = -6367572474576692556L;
boolean isSelected;
boolean hasFocus;

View File

@ -58,7 +58,7 @@ public class CheckTree extends JPanel {
}
class NodeSelectionListener extends MouseAdapter {
static class NodeSelectionListener extends MouseAdapter {
JTree tree;
NodeSelectionListener(JTree tree) {
@ -100,7 +100,7 @@ public class CheckTree extends JPanel {
}
class ButtonActionListener implements ActionListener {
static class ButtonActionListener implements ActionListener {
CheckNode root;
JTextArea textArea;

View File

@ -274,7 +274,7 @@ public class JContactItemField extends JPanel {
return popup;
}
class PopupRenderer extends JLabel implements ListCellRenderer {
static class PopupRenderer extends JLabel implements ListCellRenderer {
private static final long serialVersionUID = 239608430590852355L;
/**

View File

@ -243,7 +243,7 @@ public abstract class JiveSortableTable extends Table {
/**
* A swing renderer used to display labels within a table.
*/
public class JLabelRenderer extends JLabel implements TableCellRenderer {
public static class JLabelRenderer extends JLabel implements TableCellRenderer {
private static final long serialVersionUID = 8670248883432881619L;
Border unselectedBorder;
Border selectedBorder;
@ -303,7 +303,7 @@ public abstract class JiveSortableTable extends Table {
/**
* A swing renderer to dispaly Textareas within a table.
*/
public class TextAreaCellRenderer extends JTextArea implements TableCellRenderer {
public static class TextAreaCellRenderer extends JTextArea implements TableCellRenderer {
private static final long serialVersionUID = -1704445909682732833L;
/**
@ -334,7 +334,7 @@ public abstract class JiveSortableTable extends Table {
/**
* A swing renderer used to display Buttons within a table.
*/
public class JButtonRenderer extends JButton implements TableCellRenderer {
public static class JButtonRenderer extends JButton implements TableCellRenderer {
private static final long serialVersionUID = -1847536957519732935L;
Border unselectedBorder;
Border selectedBorder;
@ -387,7 +387,7 @@ public abstract class JiveSortableTable extends Table {
}
}
public class ComboBoxRenderer extends JComboBox implements TableCellRenderer {
public static class ComboBoxRenderer extends JComboBox implements TableCellRenderer {
private static final long serialVersionUID = 5892858463680797611L;
public ComboBoxRenderer() {
@ -416,7 +416,7 @@ public abstract class JiveSortableTable extends Table {
}
}
public class MyComboBoxEditor extends DefaultCellEditor {
public static class MyComboBoxEditor extends DefaultCellEditor {
private static final long serialVersionUID = 1003726653998005772L;
public MyComboBoxEditor(String[] items) {
@ -471,4 +471,4 @@ public abstract class JiveSortableTable extends Table {
public void enterPressed() {
}
}
}

View File

@ -41,7 +41,7 @@ public class JiveTable extends JTable {
public JiveTable(String[] headers, Integer[] columnsToUseRenderer) {
tableModel = new JiveTable.JiveTableModel(headers, 0, false);
tableModel = new JiveTableModel(headers, 0, false);
this.setModel(tableModel);
getTableHeader().setReorderingAllowed(false);
@ -58,10 +58,10 @@ public class JiveTable extends JTable {
@Override
public TableCellRenderer getCellRenderer(int row, int column) {
if (column == 3 || column == 4) {
return new JiveTable.JButtonRenderer(false);
return new JButtonRenderer(false);
}
else if (column == 1) {
return new JiveTable.JLabelRenderer(false);
return new JLabelRenderer(false);
}
else {
return super.getCellRenderer(row, column);
@ -92,7 +92,7 @@ public class JiveTable extends JTable {
return obj;
}
public class JiveTableModel extends DefaultTableModel {
public static class JiveTableModel extends DefaultTableModel {
private static final long serialVersionUID = -2072664365332767844L;
private boolean _isEditable;
@ -118,7 +118,7 @@ public class JiveTable extends JTable {
}
}
class JLabelRenderer extends JLabel implements TableCellRenderer {
static class JLabelRenderer extends JLabel implements TableCellRenderer {
private static final long serialVersionUID = 4387574944818048720L;
Border unselectedBorder = null;
Border selectedBorder = null;
@ -169,7 +169,7 @@ public class JiveTable extends JTable {
}
class JButtonRenderer extends JButton implements TableCellRenderer {
static class JButtonRenderer extends JButton implements TableCellRenderer {
private static final long serialVersionUID = -5287214156125954342L;
Border unselectedBorder = null;
@ -226,4 +226,4 @@ public class JiveTable extends JTable {
return tableModel;
}
}
}

View File

@ -271,7 +271,7 @@ public abstract class Table extends JXTable {
/**
* A swing renderer used to display labels within a table.
*/
public class JLabelRenderer extends JLabel implements TableCellRenderer {
public static class JLabelRenderer extends JLabel implements TableCellRenderer {
private static final long serialVersionUID = 4433780600297455731L;
Border unselectedBorder;
@ -332,7 +332,7 @@ public abstract class Table extends JXTable {
/**
* A swing renderer to dispaly Textareas within a table.
*/
public class TextAreaCellRenderer extends JTextArea implements TableCellRenderer {
public static class TextAreaCellRenderer extends JTextArea implements TableCellRenderer {
private static final long serialVersionUID = -8533968851464831361L;
@ -364,7 +364,7 @@ public abstract class Table extends JXTable {
/**
* A swing renderer used to display Buttons within a table.
*/
public class JButtonRenderer extends JButton implements TableCellRenderer {
public static class JButtonRenderer extends JButton implements TableCellRenderer {
private static final long serialVersionUID = 1268514163461994738L;
Border unselectedBorder;
@ -418,7 +418,7 @@ public abstract class Table extends JXTable {
}
}
public class ComboBoxRenderer extends JComboBox implements TableCellRenderer {
public static class ComboBoxRenderer extends JComboBox implements TableCellRenderer {
private static final long serialVersionUID = -545496178928790522L;
@ -448,7 +448,7 @@ public abstract class Table extends JXTable {
}
}
public class MyComboBoxEditor extends DefaultCellEditor {
public static class MyComboBoxEditor extends DefaultCellEditor {
private static final long serialVersionUID = 6097118754932234992L;
@ -499,4 +499,4 @@ public abstract class Table extends JXTable {
public void enterPressed() {
}
}
}

View File

@ -129,7 +129,7 @@ public final class TitlePanel extends JPanel {
descriptionLabel.setText(desc);
}
public class ImagePanel extends JPanel {
public static class ImagePanel extends JPanel {
private static final long serialVersionUID = 5155908601530113727L;
final ImageIcon icons = Default.getImageIcon(Default.SECONDARY_BACKGROUND_IMAGE);

View File

@ -1029,7 +1029,7 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
/**
* Used for the top toolbar.
*/
public class ChatToolBar extends JPanel {
public static class ChatToolBar extends JPanel {
private static final long serialVersionUID = 5926527530611601841L;
private JPanel buttonPanel;

View File

@ -67,7 +67,7 @@ public class ChatRoomTransferHandler extends TransferHandler {
@Override
public Transferable createTransferable(JComponent comp) {
if (comp instanceof TranscriptWindow) {
return new TranscriptWindowTransferable((TranscriptWindow)comp);
return new TranscriptWindowTransferable((TranscriptWindow) comp);
}
return null;
@ -110,7 +110,7 @@ public class ChatRoomTransferHandler extends TransferHandler {
return false;
}
public class TranscriptWindowTransferable implements Transferable {
public static class TranscriptWindowTransferable implements Transferable {
private TranscriptWindow item;

View File

@ -143,7 +143,7 @@ public class ContactGroupTransferHandler extends TransferHandler {
return false;
}
public class ContactItemTransferable implements Transferable {
public static class ContactItemTransferable implements Transferable {
private ContactItem item;

View File

@ -235,14 +235,14 @@ public class MessageEntry extends TimeStampedEntry
if ( block == null )
{
block = new Block( line );
block = new Block(line);
}
else if ( !block.tryAppend( line ) )
{
// If this line does not belong to the block that's already being constructed, then that block is
// done. Add it to the resul t, and create a new one.
result.add( block );
block = new Block( line );
block = new Block(line);
}
}
@ -263,7 +263,7 @@ public class MessageEntry extends TimeStampedEntry
* <li>A preformatted code block</li>
* </ul>
*/
class Block
static class Block
{
java.util.Deque<String> lines = new ArrayDeque<>();

View File

@ -684,7 +684,7 @@ public class RosterDialog implements ActionListener {
}
}
class AccountItem extends JPanel {
static class AccountItem extends JPanel {
private static final long serialVersionUID = -7657731912529801653L;
private Transport transport;

View File

@ -1031,7 +1031,7 @@ public class ConferenceRoomBrowser extends JPanel implements ActionListener,
}
}
private class RoomObject {
private static class RoomObject {
private String roomName;
private EntityBareJid roomJID;

View File

@ -1176,7 +1176,7 @@ public class GroupChatParticipantList extends JPanel {
*
* @author Derek DeMoro
*/
public class ParticipantRenderer extends JLabel implements ListCellRenderer {
public static class ParticipantRenderer extends JLabel implements ListCellRenderer {
private static final long serialVersionUID = -7509947975798079141L;
/**

View File

@ -207,7 +207,7 @@ public class MutualAuthenticationSettingsPanel extends JPanel implements ActionL
X509Certificate cert = idControll.createSelfSignedCertificate(keyPair);
if (saveCertToFile.isSelected()) {
PemBuilder pemBuilder = new PemHelper().new PemBuilder();
PemBuilder pemBuilder = new PemBuilder();
pemBuilder.add(keyPair.getPrivate());
pemBuilder.add(cert);
pemBuilder.saveToPemFile(IdentityController.CERT_FILE);

View File

@ -472,7 +472,7 @@ public class ThemePanel extends JPanel
}
fc.setDialogTitle( "Add Emoticon Pack" );
fc.addChoosableFileFilter( new ZipFilter() );
fc.addChoosableFileFilter(new ZipFilter());
int returnVal = fc.showOpenDialog( this );
@ -517,7 +517,7 @@ public class ThemePanel extends JPanel
* The ZipFilter class is used by the emoticon file picker to filter out all
* other files besides *.zip files.
*/
private class ZipFilter extends javax.swing.filechooser.FileFilter
private static class ZipFilter extends javax.swing.filechooser.FileFilter
{
@Override
public boolean accept( File file )

View File

@ -136,7 +136,7 @@ public class PemHelper {
* @author Paweł Ścibiorski
*
*/
public class PemBuilder {
public static class PemBuilder {
private List<Object> buildList = new ArrayList<>();
public void add(Object object) {

View File

@ -642,7 +642,7 @@ public class SparkToaster {
}
class TitleLabel extends JPanel {
static class TitleLabel extends JPanel {
private static final long serialVersionUID = -5163519932953987400L;
private JLabel label;
private RolloverButton closeButton;

View File

@ -592,7 +592,7 @@ public class ReceiveFileTransfer extends JPanel {
}
}
private class TransferButton extends JButton {
private static class TransferButton extends JButton {
private static final long serialVersionUID = -9198495278243559064L;
public TransferButton() {

View File

@ -354,7 +354,7 @@ public class SendFileTransfer extends JPanel {
}
}
private class TransferButton extends JButton {
private static class TransferButton extends JButton {
private static final long serialVersionUID = 8807434179541503654L;
public TransferButton() {

View File

@ -306,7 +306,7 @@ public class ConversationHistoryPlugin implements Plugin {
/**
* Internal handling of a Jlabel Renderer.
*/
public class InternalRenderer extends JLabel implements ListCellRenderer {
public static class InternalRenderer extends JLabel implements ListCellRenderer {
private static final long serialVersionUID = 1812281106979897477L;
/**

View File

@ -264,7 +264,7 @@ public class FrequentContactsPlugin implements Plugin {
/**
* Internal handling of a JLabel Renderer.
*/
public class InternalRenderer extends JLabel implements ListCellRenderer {
public static class InternalRenderer extends JLabel implements ListCellRenderer {
private static final long serialVersionUID = -2925096995694392323L;
/**

View File

@ -184,7 +184,7 @@ public class UserIdlePlugin extends TimerTask implements Plugin {
}
public class LockListener {
public static class LockListener {
public void intWinLockListener() {
new Thread(() -> {

View File

@ -207,7 +207,7 @@ public class NotificationPlugin implements Plugin, StanzaListener {
}
}
private class ChatAction extends AbstractAction {
private static class ChatAction extends AbstractAction {
private static final long serialVersionUID = 4752515615833181939L;
private final BareJid jid;

View File

@ -92,7 +92,7 @@ public class SoundPreference implements Preference {
public JComponent getGUI() {
if (soundPanel == null) {
try {
EventQueue.invokeAndWait( () -> soundPanel = new SoundPanel() );
EventQueue.invokeAndWait( () -> soundPanel = new SoundPanel());
} catch (Exception e) {
e.printStackTrace();
}
@ -189,7 +189,7 @@ public class SoundPreference implements Preference {
}
private class SoundPanel extends JPanel {
private static class SoundPanel extends JPanel {
private static final long serialVersionUID = 4332294589601051699L;
private final JCheckBox incomingMessageBox = new JCheckBox();
private final JTextField incomingMessageSound = new JTextField();

View File

@ -239,7 +239,7 @@ public class AvatarPanel extends JPanel implements ActionListener {
worker.start();
}
public class ImageFilter implements FilenameFilter {
public static class ImageFilter implements FilenameFilter {
public final String jpeg = "jpeg";
public final String jpg = "jpg";
public final String gif = "gif";

View File

@ -219,7 +219,7 @@ public class UserSearchResults extends JPanel {
menu.show(resultsTable, e.getX(), e.getY());
}
private final class UsersInfoTable extends Table {
private static final class UsersInfoTable extends Table {
private static final long serialVersionUID = -7097826349368800291L;
UsersInfoTable(String[] headers) {

View File

@ -795,7 +795,7 @@ public class Workpane {
}
private class PresenceChangeListener implements PresenceListener {
private static class PresenceChangeListener implements PresenceListener {
public void presenceChanged(Presence presence) {
String status = presence.getStatus();
if (status == null) {

View File

@ -614,7 +614,7 @@ public class SparkToaster {
titleLabel.setVisible(false);
}
class TitleLabel extends JPanel {
static class TitleLabel extends JPanel {
private static final long serialVersionUID = -5163519932953987400L;
private JLabel label;
private RolloverButton closeButton;

View File

@ -69,7 +69,7 @@ public class TransferSettingsPanel extends JPanel {
settings.setCannedRejectionMessage(pnlResponse.getCannedResponse());
}
private class BlockedTypesPanel extends JPanel {
private static class BlockedTypesPanel extends JPanel {
private static final long serialVersionUID = 6152402556852606706L;
private JTextArea txtBlockedTypes = new JTextArea(2, 0);
@ -92,7 +92,7 @@ public class TransferSettingsPanel extends JPanel {
}
}
private class BlockedPeoplePanel extends JPanel {
private static class BlockedPeoplePanel extends JPanel {
private static final long serialVersionUID = -1069560705582838620L;
private JTextArea txtBlockedPeople = new JTextArea(2, 0);
@ -117,7 +117,7 @@ public class TransferSettingsPanel extends JPanel {
}
}
private class FileSizePanel extends JPanel {
private static class FileSizePanel extends JPanel {
private static final long serialVersionUID = -8457074359832858639L;
private JSpinner spinMaxSize = new JSpinner();
private JCheckBox chkMaxEnabled = new JCheckBox(TGuardRes.getString("guard.settings.limitcheck"));
@ -160,7 +160,7 @@ public class TransferSettingsPanel extends JPanel {
}
}
private class CannedResponsePanel extends JPanel {
private static class CannedResponsePanel extends JPanel {
private static final long serialVersionUID = -5992704440953686488L;
private JTextArea txtMessage = new JTextArea(2, 0);
@ -181,4 +181,4 @@ public class TransferSettingsPanel extends JPanel {
return txtMessage.getText().trim();
}
}
}
}