Added Checkstyle to build process and fixing checkstyle to all com.src.jpexs classes

This commit is contained in:
Jindra Petřík
2023-10-09 08:57:05 +02:00
parent b6e8ca0d67
commit dc5e50813f
789 changed files with 23773 additions and 22843 deletions

View File

@@ -47,12 +47,12 @@ import layout.TableLayout;
*
* @author JPEXS
*/
public class NewFileDialog extends AppDialog {
public class NewFileDialog extends AppDialog {
private final JPanel compressionEditorPanel = new JPanel();
private final JComboBox<ComboBoxItem<SWFCompression>> compressionComboBox = new JComboBox<>();
private final JComboBox<String> unitComboBox = new JComboBox<>();
private final JPanel versionEditorPanel = new JPanel();
@@ -68,7 +68,7 @@ public class NewFileDialog extends AppDialog {
private final JPanel propertiesPanel = new JPanel();
private final JPanel buttonsPanel = new JPanel();
private final JButton okButton = new JButton(AppStrings.translate("button.ok"));
private final JButton cancelButton = new JButton(AppStrings.translate("button.cancel"));
@@ -76,29 +76,29 @@ public class NewFileDialog extends AppDialog {
private final JPanel displayRectEditorPanel = new JPanel();
private final JSpinner widthEditor = new JSpinner();
private final JSpinner heightEditor = new JSpinner();
private final JPanel warningPanel = new JPanel();
private final JLabel warningLabel = new JLabel();
private final JRadioButton actionScript12RadioButton = new JRadioButton(translate("script.type.actionscript1_2"));
private final JRadioButton actionScript3RadioButton = new JRadioButton(translate("script.type.actionscript3"));
private JButton backgroundColorButton;
private int result = ERROR_OPTION;
public NewFileDialog(Window owner) {
super(owner);
setTitle(translate("dialog.title"));
setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
Container cnt = getContentPane();
cnt.setLayout(new BorderLayout());
cnt.setLayout(new BorderLayout());
TableLayout tl;
@@ -108,7 +108,7 @@ public class NewFileDialog extends AppDialog {
TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED,
TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED,
TableLayout.PREFERRED}
}));
}));
FlowLayout layout = new FlowLayout(SwingConstants.WEST);
layout.setHgap(0);
@@ -138,11 +138,9 @@ public class NewFileDialog extends AppDialog {
frameRateEditor.setPreferredSize(new Dimension(80, frameRateEditor.getPreferredSize().height));
frameRateEditorPanel.add(frameRateEditor);
unitComboBox.addItem(translate("unit.pixels"));
unitComboBox.addItem(translate("unit.twips"));
displayRectEditorPanel.setLayout(layout);
displayRectEditorPanel.setMinimumSize(new Dimension(10, displayRectEditorPanel.getMinimumSize().height));
widthEditor.setPreferredSize(new Dimension(80, widthEditor.getPreferredSize().height));
@@ -157,7 +155,7 @@ public class NewFileDialog extends AppDialog {
warningPanel.setBackground(new Color(255, 213, 29));
warningPanel.add(warningLabel);
warningPanel.setVisible(false);
backgroundColorButton = new JButton("") {
@Override
@@ -178,20 +176,20 @@ public class NewFileDialog extends AppDialog {
backgroundColorButton.setSize(colorDim);
backgroundColorButton.setPreferredSize(colorDim);
backgroundColorButton.setMaximumSize(colorDim);
JPanel backgroundColorPanel = new JPanel(new BorderLayout());
backgroundColorPanel.add(backgroundColorButton, BorderLayout.WEST);
actionScript3RadioButton.setSelected(true);
ButtonGroup actionScriptTypeGroup = new ButtonGroup();
actionScriptTypeGroup.add(actionScript12RadioButton);
actionScriptTypeGroup.add(actionScript3RadioButton);
JPanel actionScriptTypePanel = new JPanel(new FlowLayout());
actionScriptTypePanel.add(actionScript12RadioButton);
actionScriptTypePanel.add(actionScript3RadioButton);
propertiesPanel.add(new JLabel(AppStrings.translate("header.compression")), "0,0");
propertiesPanel.add(compressionEditorPanel, "1,0");
propertiesPanel.add(new JLabel(AppStrings.translate("header.version")), "0,1");
@@ -203,15 +201,13 @@ public class NewFileDialog extends AppDialog {
propertiesPanel.add(new JLabel(translate("canvas.size")), "0,4");
propertiesPanel.add(displayRectEditorPanel, "1,4");
propertiesPanel.add(warningPanel, "0,5,1,5");
propertiesPanel.add(new JLabel(translate("background.color")), "0,6");
propertiesPanel.add(new JLabel(translate("background.color")), "0,6");
propertiesPanel.add(backgroundColorPanel, "1,6");
propertiesPanel.add(new JLabel(translate("script.type")), "0,7");
propertiesPanel.add(new JLabel(translate("script.type")), "0,7");
propertiesPanel.add(actionScriptTypePanel, "1,7");
cnt.add(propertiesPanel, BorderLayout.CENTER);
okButton.addActionListener(this::okButtonActionPerformed);
cancelButton.addActionListener(this::cancelButtonActionPerformed);
@@ -221,30 +217,30 @@ public class NewFileDialog extends AppDialog {
buttonsPanel.add(okButton);
buttonsPanel.add(cancelButton);
cnt.add(buttonsPanel, BorderLayout.SOUTH);
TableLayoutHelper.addTableSpaces(tl, 4);
TableLayoutHelper.addTableSpaces(tl, 4);
pack();
setResizable(false);
View.centerScreen(this);
View.setWindowIcon(this);
setModal(true);
widthEditor.setValue(550);
heightEditor.setValue(400);
unitComboBox.setSelectedIndex(0);
frameRateEditor.setValue(24);
compressionComboBox.setSelectedIndex(1);
versionEditor.setValue(17);
versionEditor.setValue(17);
backgroundColorButton.setBackground(Color.white);
}
private void selectBackgroundColorActionPerformed(ActionEvent evt) {
Color newColor = JColorChooser.showDialog(null, AppStrings.translate("dialog.selectcolor.title"), backgroundColorButton.getBackground());
if (newColor != null) {
backgroundColorButton.setBackground(newColor);
}
}
private boolean validateHeader() {
int version = getVersionNumber();
boolean gfx = gfxCheckBox.isSelected();
@@ -273,22 +269,22 @@ public class NewFileDialog extends AppDialog {
return result;
}
public int showDialog() {
setVisible(true);
return result;
}
private void okButtonActionPerformed(ActionEvent evt) {
result = OK_OPTION;
setVisible(false);
}
private void cancelButtonActionPerformed(ActionEvent evt) {
result = CANCEL_OPTION;
setVisible(false);
}
public int getVersionNumber() {
return (int) versionEditor.getModel().getValue();
}
@@ -298,36 +294,39 @@ public class NewFileDialog extends AppDialog {
ComboBoxItem<SWFCompression> item = (ComboBoxItem<SWFCompression>) compressionComboBox.getSelectedItem();
return item.getValue();
}
public boolean isGfx() {
return gfxCheckBox.isSelected();
}
public float getFrameRate() {
return ((Number) (frameRateEditor.getModel().getValue())).floatValue();
}
public int getXMin() {
return 0;
}
public int getXMax() {
return getUnitMultiplier() * (int) widthEditor.getModel().getValue();
}
public int getYMin() {
return 0;
}
public int getYmax() {
return getUnitMultiplier() * (int)heightEditor.getModel().getValue();
return getUnitMultiplier() * (int) heightEditor.getModel().getValue();
}
private int getUnitMultiplier() {
return unitComboBox.getSelectedIndex() == 0 ? 20 : 1;
}
public Color getBackgroundColor() {
return backgroundColorButton.getBackground();
}
public boolean isAs3() {
return actionScript3RadioButton.isSelected();
}