generated from JetBrains/intellij-platform-plugin-template
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
...kotlin/com/github/thinkami/hellojetbrainsplugin/toolWindow/AppleTableToolWindowFactory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.github.thinkami.hellojetbrainsplugin.toolWindow | ||
|
||
import com.github.thinkami.hellojetbrainsplugin.ui.AppleTableContent | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.openapi.wm.ToolWindow | ||
import com.intellij.openapi.wm.ToolWindowFactory | ||
import com.intellij.ui.content.ContentFactory | ||
|
||
class AppleTableToolWindowFactory: ToolWindowFactory { | ||
override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) { | ||
val content = ContentFactory.getInstance().createContent(AppleTableContent().contentPanel, null, false) | ||
toolWindow.contentManager.addContent(content) | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/kotlin/com/github/thinkami/hellojetbrainsplugin/ui/AppleTableContent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.github.thinkami.hellojetbrainsplugin.ui | ||
|
||
import com.intellij.openapi.ui.DialogPanel | ||
import com.intellij.ui.dsl.builder.Cell | ||
import com.intellij.ui.dsl.builder.panel | ||
import com.intellij.ui.table.JBTable | ||
|
||
class AppleTableContent { | ||
var contentPanel : DialogPanel | ||
lateinit var myTableModel: Cell<JBTable> | ||
|
||
init { | ||
contentPanel = panel { | ||
row { | ||
|
||
val table = JBTable() | ||
val model = AppleTableModel() | ||
table.model = model | ||
myTableModel = cell(table) | ||
} | ||
} | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
src/main/kotlin/com/github/thinkami/hellojetbrainsplugin/ui/AppleTableModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.github.thinkami.hellojetbrainsplugin.ui | ||
|
||
import javax.swing.table.AbstractTableModel | ||
|
||
class AppleTableModel: AbstractTableModel() { | ||
val allData: List<List<String>> = listOf( | ||
listOf("1", "シナノゴールド", "黄"), | ||
listOf("2", "シナノホッペ", "赤"), | ||
listOf("3", "ジョナゴールド", "赤"), | ||
) | ||
|
||
val columns: List<String> = listOf("No", "Name", "Color") | ||
|
||
override fun getRowCount(): Int { | ||
return allData.size | ||
} | ||
|
||
override fun getColumnCount(): Int { | ||
return columns.size | ||
} | ||
|
||
override fun getValueAt(rowIndex: Int, columnIndex: Int): Any { | ||
return allData[rowIndex][columnIndex] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters