Skip to content

Commit 9aa6d31

Browse files
author
banzhe
committed
feat: project tab add split pane
1 parent 3cd9542 commit 9aa6d31

File tree

2 files changed

+103
-60
lines changed

2 files changed

+103
-60
lines changed

src/main/java/io/github/linyimin/plugin/ui/MybatisSqlScannerPanel.form

Lines changed: 81 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
<grid id="27dc6" binding="scannerResultPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
44
<margin top="0" left="0" bottom="0" right="0"/>
55
<constraints>
6-
<xy x="20" y="20" width="594" height="400"/>
6+
<xy x="20" y="20" width="773" height="400"/>
77
</constraints>
88
<properties/>
99
<border type="none"/>
1010
<children>
11-
<grid id="48f7a" binding="scannerResultContentPanel" layout-manager="GridLayoutManager" row-count="2" column-count="5" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
11+
<grid id="48f7a" binding="scannerResultContentPanel" layout-manager="GridLayoutManager" row-count="2" column-count="6" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
1212
<margin top="0" left="0" bottom="0" right="0"/>
1313
<constraints>
1414
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -27,7 +27,7 @@
2727
</component>
2828
<hspacer id="89326">
2929
<constraints>
30-
<grid row="0" column="4" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
30+
<grid row="0" column="5" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
3131
</constraints>
3232
</hspacer>
3333
<component id="6630c" class="javax.swing.JRadioButton" binding="complianceWithSpecRadioButton" default-binding="true">
@@ -54,104 +54,127 @@
5454
<text value="full table scan"/>
5555
</properties>
5656
</component>
57-
<grid id="1a50f" binding="sqlPanel" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="true" same-size-vertically="false" hgap="-1" vgap="-1">
57+
<grid id="1a50f" binding="sqlPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
5858
<margin top="0" left="0" bottom="0" right="0"/>
5959
<constraints>
60-
<grid row="1" column="0" row-span="1" col-span="5" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
60+
<grid row="1" column="0" row-span="1" col-span="6" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
6161
</constraints>
6262
<properties/>
6363
<border type="none"/>
6464
<children>
65-
<grid id="41759" binding="sqlContentPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="true" hgap="-1" vgap="-1">
66-
<margin top="0" left="0" bottom="0" right="0"/>
65+
<splitpane id="28a32">
6766
<constraints>
68-
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
67+
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
68+
<preferred-size width="200" height="200"/>
69+
</grid>
6970
</constraints>
70-
<properties/>
71+
<properties>
72+
<oneTouchExpandable value="true"/>
73+
<orientation value="1"/>
74+
<resizeWeight value="0.5"/>
75+
</properties>
7176
<border type="none"/>
7277
<children>
73-
<grid id="c9af6" binding="sqlAndExplainPanel" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="true" same-size-vertically="false" hgap="-1" vgap="-1">
78+
<grid id="75394" binding="scanTreeResultPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
7479
<margin top="0" left="0" bottom="0" right="0"/>
7580
<constraints>
76-
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
81+
<splitpane position="left"/>
7782
</constraints>
7883
<properties/>
7984
<border type="none"/>
80-
<children>
81-
<grid id="e3aed" binding="statementPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
82-
<margin top="0" left="0" bottom="0" right="0"/>
83-
<constraints>
84-
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
85-
</constraints>
86-
<properties/>
87-
<border type="none"/>
88-
<children/>
89-
</grid>
90-
<grid id="d7cef" binding="statementRulePanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
91-
<margin top="0" left="0" bottom="0" right="0"/>
92-
<constraints>
93-
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
94-
</constraints>
95-
<properties/>
96-
<border type="none"/>
97-
<children/>
98-
</grid>
99-
</children>
85+
<children/>
10086
</grid>
101-
<grid id="e73c7" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
87+
<grid id="41759" binding="sqlContentPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="true" hgap="-1" vgap="-1">
10288
<margin top="0" left="0" bottom="0" right="0"/>
10389
<constraints>
104-
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
90+
<splitpane position="right"/>
10591
</constraints>
10692
<properties/>
10793
<border type="none"/>
10894
<children>
109-
<grid id="422dc" binding="indexPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
95+
<grid id="c9af6" binding="sqlAndExplainPanel" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="true" same-size-vertically="false" hgap="-1" vgap="-1">
11096
<margin top="0" left="0" bottom="0" right="0"/>
11197
<constraints>
11298
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
11399
</constraints>
114100
<properties/>
115101
<border type="none"/>
116102
<children>
117-
<scrollpane id="7071d" binding="indexScrollPane">
103+
<grid id="e3aed" binding="statementPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
104+
<margin top="0" left="0" bottom="0" right="0"/>
105+
<constraints>
106+
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
107+
</constraints>
108+
<properties/>
109+
<border type="none"/>
110+
<children/>
111+
</grid>
112+
<grid id="d7cef" binding="statementRulePanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
113+
<margin top="0" left="0" bottom="0" right="0"/>
114+
<constraints>
115+
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
116+
</constraints>
117+
<properties/>
118+
<border type="none"/>
119+
<children/>
120+
</grid>
121+
</children>
122+
</grid>
123+
<grid id="e73c7" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
124+
<margin top="0" left="0" bottom="0" right="0"/>
125+
<constraints>
126+
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
127+
</constraints>
128+
<properties/>
129+
<border type="none"/>
130+
<children>
131+
<grid id="422dc" binding="indexPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
132+
<margin top="0" left="0" bottom="0" right="0"/>
118133
<constraints>
119-
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
134+
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
120135
</constraints>
121136
<properties/>
122137
<border type="none"/>
123138
<children>
124-
<component id="c8fca" class="javax.swing.JTable" binding="indexTable">
125-
<constraints/>
139+
<scrollpane id="7071d" binding="indexScrollPane">
140+
<constraints>
141+
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
142+
</constraints>
126143
<properties/>
127-
</component>
144+
<border type="none"/>
145+
<children>
146+
<component id="c8fca" class="javax.swing.JTable" binding="indexTable">
147+
<constraints/>
148+
<properties/>
149+
</component>
150+
</children>
151+
</scrollpane>
128152
</children>
129-
</scrollpane>
153+
</grid>
154+
<component id="b51a7" class="javax.swing.JButton" binding="jumpButton" default-binding="true">
155+
<constraints>
156+
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
157+
</constraints>
158+
<properties>
159+
<text value="jump"/>
160+
</properties>
161+
</component>
130162
</children>
131163
</grid>
132-
<component id="b51a7" class="javax.swing.JButton" binding="jumpButton" default-binding="true">
133-
<constraints>
134-
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
135-
</constraints>
136-
<properties>
137-
<text value="jump"/>
138-
</properties>
139-
</component>
140164
</children>
141165
</grid>
142166
</children>
143-
</grid>
144-
<grid id="75394" binding="scanTreeResultPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
145-
<margin top="0" left="0" bottom="0" right="0"/>
146-
<constraints>
147-
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
148-
</constraints>
149-
<properties/>
150-
<border type="none"/>
151-
<children/>
152-
</grid>
167+
</splitpane>
153168
</children>
154169
</grid>
170+
<component id="657c5" class="javax.swing.JRadioButton" binding="errorRadioButton" default-binding="true">
171+
<constraints>
172+
<grid row="0" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
173+
</constraints>
174+
<properties>
175+
<text value="error"/>
176+
</properties>
177+
</component>
155178
</children>
156179
</grid>
157180
</children>

src/main/java/io/github/linyimin/plugin/ui/MybatisSqlScannerPanel.java

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public class MybatisSqlScannerPanel implements TabbedChangeListener {
7171
private JPanel sqlContentPanel;
7272
private JPanel sqlPanel;
7373
private JScrollPane indexScrollPane;
74+
private JRadioButton errorRadioButton;
7475

7576
private final Project project;
7677
private final InfoPane infoPane;
@@ -121,11 +122,13 @@ private void initRadioButtonGroup() {
121122
buttonGroup.add(complianceWithSpecRadioButton);
122123
buttonGroup.add(doesNotMeetSpecRadioButton);
123124
buttonGroup.add(fullTableScanRadioButton);
125+
buttonGroup.add(errorRadioButton);
124126

125127
this.allRadioButton.addMouseListener(new MouseCursorAdapter(this.allRadioButton));
126128
this.complianceWithSpecRadioButton.addMouseListener(new MouseCursorAdapter(this.complianceWithSpecRadioButton));
127129
this.doesNotMeetSpecRadioButton.addMouseListener(new MouseCursorAdapter(this.doesNotMeetSpecRadioButton));
128130
this.fullTableScanRadioButton.addMouseListener(new MouseCursorAdapter(this.fullTableScanRadioButton));
131+
this.errorRadioButton.addMouseListener(new MouseCursorAdapter(this.errorRadioButton));
129132

130133
this.allRadioButton.addActionListener(new AbstractAction() {
131134
@Override
@@ -187,6 +190,21 @@ public void run(@NotNull ProgressIndicator indicator) {
187190
}
188191
});
189192

193+
this.errorRadioButton.addActionListener(new AbstractAction() {
194+
@Override
195+
public void actionPerformed(ActionEvent e) {
196+
if (errorRadioButton.isSelected()) {
197+
backgroundTaskQueue.run(new Task.Backgroundable(project, Constant.APPLICATION_NAME) {
198+
@Override
199+
public void run(@NotNull ProgressIndicator indicator) {
200+
RootTreeNode root = getRootByType(FilterType.error);
201+
createTree(root);
202+
}
203+
});
204+
}
205+
}
206+
});
207+
190208
}
191209

192210
private void initText() {
@@ -217,6 +235,7 @@ public void listen() {
217235
@Override
218236
public void run(@NotNull ProgressIndicator indicator) {
219237
ApplicationManager.getApplication().invokeLater(() -> {
238+
allRadioButton.setSelected(true);
220239
scannerResultPanel.setLayout(new BorderLayout());
221240
scannerResultPanel.remove(scannerResultContentPanel);
222241
scannerResultPanel.add(infoPane.getInfoPane());
@@ -254,7 +273,7 @@ private RootTreeNode getRootByType(FilterType filterType) {
254273

255274
FilterType type = FilterType.resolveByIcon(icon);
256275

257-
if (filterType == FilterType.all || icon == IconUtils.ERROR_ICON || filterType == type) {
276+
if (filterType == FilterType.all || filterType == type) {
258277
MethodTreeNode methodTreeNode = new MethodTreeNode(namespaceTreeNode, methodNode.getName(), icon);
259278
methodTreeNode.setMybatisSqlScannerPanel(this).setConfiguration(((MethodTreeNode)methodNode).getConfiguration());
260279
namespaceTreeNode.add(methodTreeNode);
@@ -426,7 +445,8 @@ public enum FilterType {
426445
all(null),
427446
compliance_spec(IconUtils.MAJOR_ICON),
428447
not_meet_spec(IconUtils.NOT_MEET_SPEC_ICON),
429-
full_table_scan(IconUtils.FULL_SCAN_ICON);
448+
full_table_scan(IconUtils.FULL_SCAN_ICON),
449+
error(IconUtils.ERROR_ICON);
430450

431451
private final Icon icon;
432452

0 commit comments

Comments
 (0)