aboutsummaryrefslogtreecommitdiff
path: root/src/compat/moulconfig/java/ProcessedCategoryFirm.kt
blob: 53134416e4bf7697ac2d740a5a63f6468409fb44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package moe.nea.firmament.compat.moulconfig

import io.github.notenoughupdates.moulconfig.gui.editors.GuiOptionEditorAccordion
import io.github.notenoughupdates.moulconfig.processor.ProcessedCategory
import io.github.notenoughupdates.moulconfig.processor.ProcessedOption
import moe.nea.firmament.gui.config.ManagedConfig

class ProcessedCategoryFirm(
	val category: ManagedConfig.Category,
	private val options: List<ProcessedOptionFirm>
) : ProcessedCategory {
	val accordions = options.filter { it.editor is GuiOptionEditorAccordion }
		.associateBy { (it.editor as GuiOptionEditorAccordion).accordionId }
	init {
		for (option in options) {
			option.category = this
		}
	}

	override fun getDebugDeclarationLocation(): String? {
		return "FirmamentCategory.${category.name}"
	}

	override fun getDisplayName(): String {
		return category.labelText.string
	}

	override fun getDescription(): String {
		return category.description.string
	}

	override fun getIdentifier(): String {
		return category.name
	}

	override fun getParentCategoryId(): String? {
		return null
	}

	override fun getOptions(): List<ProcessedOption> {
		return options
	}

	override fun getAccordionAnchors(): Map<Int, ProcessedOption> {
		return accordions
	}
}