Skip to content

Commit b1ff0e6

Browse files
committed
feature: Introduce method finder panel in CallGraphUIComponents with enhanced input fields and layout
1 parent 4c76c96 commit b1ff0e6

1 file changed

Lines changed: 43 additions & 13 deletions

File tree

src/main/kotlin/org/skgroup/securityinspector/ui/component/CallGraphUIComponents.kt

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,27 +97,58 @@ class CallGraphUIComponents(val project: Project) {
9797
add(createLabel(errorInfoLabel))
9898
}
9999

100-
// New UI components for the right panel
101-
val newPanel = JBPanel<JBPanel<*>>(BorderLayout()).apply {
102-
val input1 = JBTextField(15)
103-
val input2 = JBTextField(15)
104-
val actionButton = JButton("Action")
105-
add(input1, BorderLayout.NORTH)
106-
add(input2, BorderLayout.CENTER)
107-
add(actionButton, BorderLayout.SOUTH)
100+
val methodFinderPanel = JBPanel<JBPanel<*>>(BorderLayout()).apply {
101+
layout = GridBagLayout()
102+
val c = GridBagConstraints().apply {
103+
fill = GridBagConstraints.HORIZONTAL
104+
insets = Insets(5, 5, 5, 5)
105+
}
106+
107+
val fields = listOf(
108+
"Class Name:" to JBTextField(20),
109+
"Access Modifier:" to JBTextField(10),
110+
"Method Modifier:" to JBTextField(10),
111+
"Method Name:" to JBTextField(15),
112+
"Param Count:" to JBTextField(5),
113+
"Param Type:" to JBTextField(15),
114+
"Param Name:" to JBTextField(15),
115+
"Varargs:" to JBTextField(5),
116+
"Throws Clause:" to JBTextField(15),
117+
"Return Type:" to JBTextField(15),
118+
"Annotations:" to JBTextField(20)
119+
)
120+
121+
fields.forEachIndexed { index, (labelText, textField) ->
122+
c.gridx = 0
123+
c.gridy = index
124+
c.weightx = 0.0
125+
add(JBLabel(labelText), c)
126+
127+
c.gridx = 1
128+
c.weightx = 1.0
129+
add(textField, c)
130+
}
131+
132+
c.gridx = 0
133+
c.gridy = fields.size
134+
c.gridwidth = 2
135+
c.fill = GridBagConstraints.NONE
136+
c.anchor = GridBagConstraints.CENTER
137+
val actionButton = JButton("Find Method")
138+
add(actionButton, c)
108139
}
109140

110141
val toggleButton = JButton("Toggle Panel")
111-
lateinit var splitter: JBSplitter // Splitter to manage the new panel
142+
lateinit var splitter: JBSplitter
112143

113144
fun createMainPanel(): JBPanel<JBPanel<*>> {
114145
val mainPanel = JBPanel<JBPanel<*>>(BorderLayout())
115146
mainPanel.add(createNorthContainer(), BorderLayout.NORTH)
116147

117148
val centerPanel = createCenterPanel()
118-
splitter = JBSplitter(false, 0.8f).apply { // Horizontal splitter (false = horizontal)
149+
splitter = JBSplitter(false, 0.8f).apply {
119150
firstComponent = centerPanel
120-
secondComponent = newPanel
151+
secondComponent = methodFinderPanel
121152
dividerWidth = 5
122153
}
123154
mainPanel.add(splitter, BorderLayout.CENTER)
@@ -320,7 +351,6 @@ class CallGraphUIComponents(val project: Project) {
320351
errorInfoLabel.text = "Error: $errorInfo"
321352
}
322353

323-
// Initialize toggle button behavior
324354
init {
325355
var isPanelVisible = true
326356
toggleButton.addActionListener {
@@ -329,7 +359,7 @@ class CallGraphUIComponents(val project: Project) {
329359
splitter.secondComponent = null
330360
} else {
331361
// 显示面板:重新添加 newPanel
332-
splitter.secondComponent = newPanel
362+
splitter.secondComponent = methodFinderPanel
333363
}
334364
isPanelVisible = !isPanelVisible // 切换状态
335365
splitter.revalidate() // 重新布局

0 commit comments

Comments
 (0)