Skip to content

Commit

Permalink
- fix static analyzer warning
Browse files Browse the repository at this point in the history
  • Loading branch information
derreisende77 committed Oct 26, 2024
1 parent e485363 commit 10e2ac7
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/main/java/mediathek/gui/dialog/DialogEditAbo.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class DialogEditAbo extends JDialog {
private final JSlider sliderDauer = new JSlider(0, 100, 0);
private final JLabel labelDauer = new JLabel("0");
private final boolean isMultiEditMode;
private static final String TEXTFIELD_BACKGROUND = "TextField.background";
/**
* This determines in multi edit mode, which fields should be applied to all selected abos...
*/
Expand Down Expand Up @@ -76,21 +77,20 @@ public DialogEditAbo(final JFrame parent, DatenAbo aktA, boolean isMultiEditMode
editorComp.setOpaque(true);
editorComp.getDocument().addDocumentListener(new CheckPathDocListener());

// =====================
jButtonBeenden.addActionListener(e -> {
jButtonBeenden.addActionListener(_ -> {
if (check()) {
dispose();
} else {
MVMessageDialog.showMessageDialog(parent, "Filter angeben!", "Leeres Abo", JOptionPane.ERROR_MESSAGE);
}
});
jButtonAbbrechen.addActionListener(e -> dispose());
jButtonAbbrechen.addActionListener(_ -> dispose());
getRootPane().setDefaultButton(jButtonBeenden);

EscapeKeyHandler.installHandler(this, this::dispose);

jButtonHelp.setIcon(SVGIconUtilities.createSVGIcon("icons/fontawesome/circle-question.svg"));
jButtonHelp.addActionListener(e -> new DialogHilfe(parent, true, new GetFile().getHilfeSuchen(GetFile.PFAD_HILFETEXT_DIALOG_ADD_ABO)).setVisible(true));
jButtonHelp.addActionListener(_ -> new DialogHilfe(parent, true, new GetFile().getHilfeSuchen(GetFile.PFAD_HILFETEXT_DIALOG_ADD_ABO)).setVisible(true));

if (comboboxPSet.getModel().getSize() == 0) {
// dann gibts kein Set zum Aufzeichnen
Expand Down Expand Up @@ -123,7 +123,7 @@ private void checkPfad() {
if (!s.equals(FilenameUtils.checkDateiname(s, false))) {
editor.setBackground(MVColor.DOWNLOAD_FEHLER.color);
} else {
editor.setBackground(UIManager.getColor("TextField.background"));
editor.setBackground(UIManager.getColor(TEXTFIELD_BACKGROUND));
}
}

Expand Down Expand Up @@ -251,7 +251,7 @@ private void addExtraFeld(AboTags index, GridBagLayout gridbag, GridBagConstrain
final int minDauer = aktAbo.getMindestDauerMinuten();
sliderDauer.setValue(minDauer);
labelDauer.setText(String.valueOf(minDauer == 0 ? " alles " : minDauer));
sliderDauer.addChangeListener(e -> labelDauer.setText(" " + (sliderDauer.getValue() == 0 ? "alles" : Integer.toString(sliderDauer.getValue()))));
sliderDauer.addChangeListener(_ -> labelDauer.setText(" " + (sliderDauer.getValue() == 0 ? "alles" : Integer.toString(sliderDauer.getValue()))));
var p = new JPanel(new BorderLayout());
p.add(sliderDauer, BorderLayout.CENTER);
p.add(labelDauer, BorderLayout.EAST);
Expand Down Expand Up @@ -302,7 +302,7 @@ private void addExtraFeld(AboTags index, GridBagLayout gridbag, GridBagConstrain
var jcb = new JCheckBox();
jcb.setBorder(emptyBorder);
jcb.setHorizontalTextPosition(JCheckBox.CENTER);
jcb.addActionListener(l -> multiEditCbIndices[index.getIndex()] = jcb.isSelected());
jcb.addActionListener(_ -> multiEditCbIndices[index.getIndex()] = jcb.isSelected());
gridbag.setConstraints(jcb, c);
panel.add(jcb);
}
Expand Down Expand Up @@ -372,21 +372,21 @@ public EmptyTextDocListener(JTextField tf) {
@Override
public void insertUpdate(DocumentEvent e) {
final boolean isEmpty = tf.getText().isBlank();
tf.setBackground(isEmpty ? Color.red : UIManager.getColor("TextField.background"));
tf.setBackground(isEmpty ? Color.red : UIManager.getColor(TEXTFIELD_BACKGROUND));
jButtonBeenden.setEnabled(!isEmpty);
}

@Override
public void removeUpdate(DocumentEvent e) {
final boolean isEmpty = tf.getText().isBlank();
tf.setBackground(isEmpty ? Color.red : UIManager.getColor("TextField.background"));
tf.setBackground(isEmpty ? Color.red : UIManager.getColor(TEXTFIELD_BACKGROUND));
jButtonBeenden.setEnabled(!isEmpty);
}

@Override
public void changedUpdate(DocumentEvent e) {
final boolean isEmpty = tf.getText().isBlank();
tf.setBackground(isEmpty ? Color.red : UIManager.getColor("TextField.background"));
tf.setBackground(isEmpty ? Color.red : UIManager.getColor(TEXTFIELD_BACKGROUND));
jButtonBeenden.setEnabled(!isEmpty);
}
}
Expand Down

0 comments on commit 10e2ac7

Please sign in to comment.