1 package com.jsql.view.swing.panel.preferences;
2
3 import com.jsql.view.swing.panel.PanelPreferences;
4 import com.jsql.view.swing.util.MediatorHelper;
5
6 import javax.swing.*;
7 import java.util.stream.Stream;
8
9 public class PanelStrategies extends JPanel {
10
11 private final JCheckBox checkboxIsStrategyTimeDisabled = new JCheckBox("Disable Time", MediatorHelper.model().getMediatorUtils().getPreferencesUtil().isStrategyTimeDisabled());
12 private final JCheckBox checkboxIsStrategyBlindBitDisabled = new JCheckBox("Disable Blind bit", MediatorHelper.model().getMediatorUtils().getPreferencesUtil().isStrategyBlindBitDisabled());
13 private final JCheckBox checkboxIsStrategyBlindBinDisabled = new JCheckBox("Disable Blind bin", MediatorHelper.model().getMediatorUtils().getPreferencesUtil().isStrategyBlindBinDisabled());
14 private final JCheckBox checkboxIsStrategyMultibitDisabled = new JCheckBox("Disable Multibit", MediatorHelper.model().getMediatorUtils().getPreferencesUtil().isStrategyMultibitDisabled());
15 private final JCheckBox checkboxIsStrategyDnsDisabled = new JCheckBox("[Advanced] Disable Dns (requires local setup or registrar)", MediatorHelper.model().getMediatorUtils().getPreferencesUtil().isStrategyDnsDisabled());
16 private final JCheckBox checkboxIsStrategyErrorDisabled = new JCheckBox("Disable Error", MediatorHelper.model().getMediatorUtils().getPreferencesUtil().isStrategyErrorDisabled());
17 private final JCheckBox checkboxIsStrategyStackDisabled = new JCheckBox("Disable Stack", MediatorHelper.model().getMediatorUtils().getPreferencesUtil().isStrategyStackDisabled());
18 private final JCheckBox checkboxIsStrategyUnionDisabled = new JCheckBox("Disable Union", MediatorHelper.model().getMediatorUtils().getPreferencesUtil().isStrategyUnionDisabled());
19
20 public PanelStrategies(PanelPreferences panelPreferences) {
21 this.checkboxIsStrategyTimeDisabled.setToolTipText("Skip Time strategy processing");
22 this.checkboxIsStrategyBlindBitDisabled.setToolTipText("Skip Blind bit strategy processing");
23 this.checkboxIsStrategyBlindBinDisabled.setToolTipText("Skip Blind bin strategy processing");
24 this.checkboxIsStrategyMultibitDisabled.setToolTipText("Skip Multibit strategy processing");
25 this.checkboxIsStrategyDnsDisabled.setToolTipText("Skip Dns strategy processing");
26 this.checkboxIsStrategyErrorDisabled.setToolTipText("Skip Error strategy processing");
27 this.checkboxIsStrategyStackDisabled.setToolTipText("Skip Stack strategy processing");
28 this.checkboxIsStrategyUnionDisabled.setToolTipText("Skip Union strategy processing");
29
30 Stream.of(
31 this.checkboxIsStrategyTimeDisabled,
32 this.checkboxIsStrategyBlindBitDisabled,
33 this.checkboxIsStrategyBlindBinDisabled,
34 this.checkboxIsStrategyMultibitDisabled,
35 this.checkboxIsStrategyDnsDisabled,
36 this.checkboxIsStrategyErrorDisabled,
37 this.checkboxIsStrategyStackDisabled,
38 this.checkboxIsStrategyUnionDisabled
39 )
40 .forEach(button -> button.addActionListener(panelPreferences.getActionListenerSave()));
41
42 var labelOrigin = new JLabel("<html><b>Choose injection strategies to skip</b></html>");
43 labelOrigin.setBorder(PanelGeneral.MARGIN);
44
45 var groupLayout = new GroupLayout(this);
46 this.setLayout(groupLayout);
47
48 groupLayout.setHorizontalGroup(
49 groupLayout
50 .createSequentialGroup()
51 .addGroup(
52 groupLayout
53 .createParallelGroup(GroupLayout.Alignment.LEADING, false)
54 .addComponent(labelOrigin)
55 .addComponent(this.checkboxIsStrategyTimeDisabled)
56 .addComponent(this.checkboxIsStrategyBlindBinDisabled)
57 .addComponent(this.checkboxIsStrategyBlindBitDisabled)
58 .addComponent(this.checkboxIsStrategyMultibitDisabled)
59 .addComponent(this.checkboxIsStrategyDnsDisabled)
60 .addComponent(this.checkboxIsStrategyErrorDisabled)
61 .addComponent(this.checkboxIsStrategyStackDisabled)
62 .addComponent(this.checkboxIsStrategyUnionDisabled)
63 )
64 );
65
66 groupLayout.setVerticalGroup(
67 groupLayout
68 .createSequentialGroup()
69 .addGroup(
70 groupLayout
71 .createParallelGroup(GroupLayout.Alignment.BASELINE)
72 .addComponent(labelOrigin)
73 )
74 .addGroup(
75 groupLayout
76 .createParallelGroup(GroupLayout.Alignment.BASELINE)
77 .addComponent(this.checkboxIsStrategyTimeDisabled)
78 )
79 .addGroup(
80 groupLayout
81 .createParallelGroup(GroupLayout.Alignment.BASELINE)
82 .addComponent(this.checkboxIsStrategyBlindBinDisabled)
83 )
84 .addGroup(
85 groupLayout
86 .createParallelGroup(GroupLayout.Alignment.BASELINE)
87 .addComponent(this.checkboxIsStrategyBlindBitDisabled)
88 )
89 .addGroup(
90 groupLayout
91 .createParallelGroup(GroupLayout.Alignment.BASELINE)
92 .addComponent(this.checkboxIsStrategyMultibitDisabled)
93 )
94 .addGroup(
95 groupLayout
96 .createParallelGroup(GroupLayout.Alignment.BASELINE)
97 .addComponent(this.checkboxIsStrategyDnsDisabled)
98 )
99 .addGroup(
100 groupLayout
101 .createParallelGroup(GroupLayout.Alignment.BASELINE)
102 .addComponent(this.checkboxIsStrategyErrorDisabled)
103 )
104 .addGroup(
105 groupLayout
106 .createParallelGroup(GroupLayout.Alignment.BASELINE)
107 .addComponent(this.checkboxIsStrategyStackDisabled)
108 )
109 .addGroup(
110 groupLayout
111 .createParallelGroup(GroupLayout.Alignment.BASELINE)
112 .addComponent(this.checkboxIsStrategyUnionDisabled)
113 )
114 );
115 }
116
117
118
119
120 public JCheckBox getCheckboxIsStrategyTimeDisabled() {
121 return this.checkboxIsStrategyTimeDisabled;
122 }
123
124 public JCheckBox getCheckboxIsStrategyBlindBinDisabled() {
125 return this.checkboxIsStrategyBlindBinDisabled;
126 }
127
128 public JCheckBox getCheckboxIsStrategyBlindBitDisabled() {
129 return this.checkboxIsStrategyBlindBitDisabled;
130 }
131
132 public JCheckBox getCheckboxIsStrategyMultibitDisabled() {
133 return this.checkboxIsStrategyMultibitDisabled;
134 }
135
136 public JCheckBox getCheckboxIsStrategyStackDisabled() {
137 return this.checkboxIsStrategyStackDisabled;
138 }
139
140 public JCheckBox getCheckboxIsStrategyDnsDisabled() {
141 return this.checkboxIsStrategyDnsDisabled;
142 }
143
144 public JCheckBox getCheckboxIsStrategyErrorDisabled() {
145 return this.checkboxIsStrategyErrorDisabled;
146 }
147
148 public JCheckBox getCheckboxIsStrategyUnionDisabled() {
149 return this.checkboxIsStrategyUnionDisabled;
150 }
151 }