Skip to content

Commit bf1d36c

Browse files
SwingGroupingInputHarvester: Use grouping attributes from group: part of widgetStyle, fix Miglayout spanning mistake
1 parent 5e30f5b commit bf1d36c

File tree

3 files changed

+35
-38
lines changed

3 files changed

+35
-38
lines changed

src/main/java/sc/iview/commands/demo/GameOfLife3D.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,16 @@ class GameOfLife3D : Command {
6767
@Parameter
6868
private lateinit var commandService: CommandService
6969

70-
@Parameter(label = "[Game of Life]Starvation threshold", min = "0", max = "26", persist = false)
70+
@Parameter(label = "Starvation threshold", min = "0", max = "26", persist = false, style = "group:Game of Life")
7171
private var starvation = 5
7272

73-
@Parameter(label = "[Game of Life]Birth threshold", min = "0", max = "26", persist = false)
73+
@Parameter(label = "Birth threshold", min = "0", max = "26", persist = false, style = "group:Game of Life")
7474
private var birth = 6
7575

76-
@Parameter(label = "[Game of Life]Suffocation threshold", min = "0", max = "26", persist = false)
76+
@Parameter(label = "Suffocation threshold", min = "0", max = "26", persist = false, style = "group:Game of Life")
7777
private var suffocation = 9
7878

79-
@Parameter(label = "[Game of Life]Connectedness", choices = [SIX, EIGHTEEN, TWENTY_SIX], persist = false)
79+
@Parameter(label = "Connectedness", choices = [SIX, EIGHTEEN, TWENTY_SIX], persist = false, style = "group:Game of Life")
8080
private var connectedness = TWENTY_SIX
8181

8282
@Parameter(label = "Initial saturation % when randomizing", min = "1", max = "99", style = NumberWidget.SCROLL_BAR_STYLE, persist = false)

src/main/java/sc/iview/commands/edit/Properties.kt

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,11 @@
2828
*/
2929
package sc.iview.commands.edit
3030

31-
import bdv.viewer.SourceAndConverter
3231
import graphics.scenery.*
3332
import graphics.scenery.volumes.Colormap.Companion.fromColorTable
3433
import graphics.scenery.volumes.Volume
3534
import net.imagej.lut.LUTService
36-
import net.imglib2.RandomAccessibleInterval
3735
import net.imglib2.display.ColorTable
38-
import net.imglib2.type.numeric.RealType
3936
import org.joml.Quaternionf
4037
import org.joml.Vector3f
4138
import org.joml.Vector4f
@@ -90,95 +87,95 @@ class Properties : InteractiveCommand() {
9087
@Parameter(required = false, style = ChoiceWidget.LIST_BOX_STYLE, callback = "refreshSceneNodeInDialog")
9188
private val sceneNode: String? = null
9289

93-
@Parameter(label = "[Basic]Visible", callback = "updateNodeProperties")
90+
@Parameter(label = "Visible", callback = "updateNodeProperties", style = "group:Basic")
9491
private var visible = false
9592

96-
@Parameter(label = "[Basic]Color", required = false, callback = "updateNodeProperties")
93+
@Parameter(label = "Color", required = false, callback = "updateNodeProperties", style = "group:Basic")
9794
private var colour: ColorRGB? = null
9895

99-
@Parameter(label = "[Camera]Active", required = false, callback = "updateNodeProperties")
96+
@Parameter(label = "Active", required = false, callback = "updateNodeProperties", style = "group:Camera")
10097
private var active = false
10198

102-
@Parameter(label = "[Basic]Name", callback = "updateNodeProperties")
99+
@Parameter(label = "Name", callback = "updateNodeProperties", style = "group:Basic")
103100
private var name: String = ""
104101

105-
@Parameter(label = "[Volume]Timepoint", callback = "updateNodeProperties", style = NumberWidget.SLIDER_STYLE)
102+
@Parameter(label = "Timepoint", callback = "updateNodeProperties", style = NumberWidget.SLIDER_STYLE+"group:Volume")
106103
private var timepoint = 0
107104

108-
@Parameter(label = "[Volume]Play", callback = "playTimeSeries")
105+
@Parameter(label = "Play", callback = "playTimeSeries", style = "group:Volume")
109106
private var playPauseButton: Button? = null
110107

111108
@Volatile
112-
@Parameter(label = "[Volume]Speed", min = "1", max = "10", style = NumberWidget.SCROLL_BAR_STYLE, persist = false)
109+
@Parameter(label = "Speed", min = "1", max = "10", style = NumberWidget.SCROLL_BAR_STYLE + ",group:Volume", persist = false)
113110
private var playSpeed = 4
114111

115-
@Parameter(label = "[Volume]Min", callback = "updateNodeProperties")
112+
@Parameter(label = "Min", callback = "updateNodeProperties", style = "group:Volume")
116113
private var min = 0
117114

118-
@Parameter(label = "[Volume]Max", callback = "updateNodeProperties")
115+
@Parameter(label = "Max", callback = "updateNodeProperties", style = "group:Volume")
119116
private var max = 255
120117

121-
@Parameter(label = "[Volume]Color map", choices = [], callback = "updateNodeProperties")
118+
@Parameter(label = "Color map", choices = [], callback = "updateNodeProperties", style = "group:Volume")
122119
private var colormapName: String = "Red"
123120

124-
@Parameter(label = "[Volume] ")
121+
@Parameter(label = " ", style = "group:Volume")
125122
private var colormap = dummyColorTable
126123

127-
@Parameter(label = "[Lighting]Intensity", style = NumberWidget.SPINNER_STYLE, stepSize = "0.1", callback = "updateNodeProperties")
124+
@Parameter(label = "Intensity", style = NumberWidget.SPINNER_STYLE+ ",group:Lighting", stepSize = "0.1", callback = "updateNodeProperties")
128125
private var intensity = 0f
129126

130-
@Parameter(label = "[Basic]Position X", style = NumberWidget.SPINNER_STYLE, stepSize = "0.1", callback = "updateNodeProperties")
127+
@Parameter(label = "Position X", style = NumberWidget.SPINNER_STYLE+ ",group:Basic", stepSize = "0.1", callback = "updateNodeProperties")
131128
private var positionX = 0f
132129

133-
@Parameter(label = "[Basic]Position Y", style = NumberWidget.SPINNER_STYLE, stepSize = "0.1", callback = "updateNodeProperties")
130+
@Parameter(label = "Position Y", style = NumberWidget.SPINNER_STYLE+ ",group:Basic", stepSize = "0.1", callback = "updateNodeProperties")
134131
private var positionY = 0f
135132

136-
@Parameter(label = "[Basic]Position Z", style = NumberWidget.SPINNER_STYLE, stepSize = "0.1", callback = "updateNodeProperties")
133+
@Parameter(label = "Position Z", style = NumberWidget.SPINNER_STYLE+ ",group:Lighting", stepSize = "0.1", callback = "updateNodeProperties")
137134
private var positionZ = 0f
138135

139-
@Parameter(label = "[Rotation & Scaling]Scale X", style = NumberWidget.SPINNER_STYLE, stepSize = "0.1", callback = "updateNodeProperties")
136+
@Parameter(label = "[Rotation & Scaling]Scale X", style = NumberWidget.SPINNER_STYLE+"group:Rotation & Scaling", stepSize = "0.1", callback = "updateNodeProperties")
140137
private var scaleX = 1f
141138

142-
@Parameter(label = "[Rotation & Scaling]Scale Y", style = NumberWidget.SPINNER_STYLE, stepSize = "0.1", callback = "updateNodeProperties")
139+
@Parameter(label = "[Rotation & Scaling]Scale Y", style = NumberWidget.SPINNER_STYLE+"group:Rotation & Scaling", stepSize = "0.1", callback = "updateNodeProperties")
143140
private var scaleY = 1f
144141

145-
@Parameter(label = "[Rotation & Scaling]Scale Z", style = NumberWidget.SPINNER_STYLE, stepSize = "0.1", callback = "updateNodeProperties")
142+
@Parameter(label = "[Rotation & Scaling]Scale Z", style = NumberWidget.SPINNER_STYLE+"group:Rotation & Scaling", stepSize = "0.1", callback = "updateNodeProperties")
146143
private var scaleZ = 1f
147144

148-
@Parameter(label = "[Rotation & Scaling]Rotation Phi", style = NumberWidget.SPINNER_STYLE, min = PI_NEG, max = PI_POS, stepSize = "0.01", callback = "updateNodeProperties")
145+
@Parameter(label = "[Rotation & Scaling]Rotation Phi", style = NumberWidget.SPINNER_STYLE+"group:Rotation & Scaling", min = PI_NEG, max = PI_POS, stepSize = "0.01", callback = "updateNodeProperties")
149146
private var rotationPhi = 0f
150147

151-
@Parameter(label = "[Rotation & Scaling]Rotation Theta", style = NumberWidget.SPINNER_STYLE, min = PI_NEG, max = PI_POS, stepSize = "0.01", callback = "updateNodeProperties")
148+
@Parameter(label = "[Rotation & Scaling]Rotation Theta", style = NumberWidget.SPINNER_STYLE+"group:Rotation & Scaling", min = PI_NEG, max = PI_POS, stepSize = "0.01", callback = "updateNodeProperties")
152149
private var rotationTheta = 0f
153150

154-
@Parameter(label = "[Rotation & Scaling]Rotation Psi", style = NumberWidget.SPINNER_STYLE, min = PI_NEG, max = PI_POS, stepSize = "0.01", callback = "updateNodeProperties")
151+
@Parameter(label = "[Rotation & Scaling]Rotation Psi", style = NumberWidget.SPINNER_STYLE+"group:Rotation & Scaling", min = PI_NEG, max = PI_POS, stepSize = "0.01", callback = "updateNodeProperties")
155152
private var rotationPsi = 0f
156153

157154
/* Volume properties */
158-
@Parameter(label = "[Volume]Rendering Mode", style = ChoiceWidget.LIST_BOX_STYLE, callback = "updateNodeProperties")
155+
@Parameter(label = "Mode", style = ChoiceWidget.LIST_BOX_STYLE+"group:Volume", callback = "updateNodeProperties")
159156
private var renderingMode: String = Volume.RenderingMethod.AlphaBlending.name
160157

161-
@Parameter(label = "[Volume]AO steps", style = NumberWidget.SPINNER_STYLE, callback = "updateNodeProperties")
158+
@Parameter(label = "AO steps", style = NumberWidget.SPINNER_STYLE+"group:Volume", callback = "updateNodeProperties")
162159
private val occlusionSteps = 0
163160

164161
/* Bounding Grid properties */
165-
@Parameter(label = "[Grid]Grid Color", callback = "updateNodeProperties")
162+
@Parameter(label = "Grid Color", callback = "updateNodeProperties", style = "group:Grid")
166163
private var gridColor: ColorRGB? = null
167164

168-
@Parameter(label = "[Grid]Ticks only", callback = "updateNodeProperties")
165+
@Parameter(label = "Ticks only", callback = "updateNodeProperties", style = "group:Grid")
169166
private var ticksOnly = false
170167

171168
/* TextBoard properties */
172-
@Parameter(label = "[Text]Text", callback = "updateNodeProperties")
169+
@Parameter(label = "Text", callback = "updateNodeProperties", style = "group:Text")
173170
private var text: String? = null
174171

175-
@Parameter(label = "[Text]Text Color", callback = "updateNodeProperties")
172+
@Parameter(label = "Text Color", callback = "updateNodeProperties", style = "group:Text")
176173
private var fontColor: ColorRGB? = null
177174

178-
@Parameter(label = "[Text]Background Color", callback = "updateNodeProperties")
175+
@Parameter(label = "Background Color", callback = "updateNodeProperties", style = "group:Text")
179176
private var backgroundColor: ColorRGB? = null
180177

181-
@Parameter(label = "[Text]Transparent Background", callback = "updateNodeProperties")
178+
@Parameter(label = "Transparent Background", callback = "updateNodeProperties", style = "group:Text")
182179
private var transparentBackground = false
183180
private val renderingModeChoices = Arrays.asList(*Volume.RenderingMethod.values())
184181
var fieldsUpdating = true

src/main/java/sc/iview/ui/SwingGroupingInputHarvester.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class SwingGroupingInputHarvester : SwingInputHarvester() {
3939
val inputs = module.info.inputs()
4040
val models = ArrayList<WidgetModel>()
4141
val sortedInputs = inputs.groupBy {
42-
val sortKey = it.label.substringBeforeLast("]").substringAfter("[")
42+
val sortKey = it.widgetStyle.substringAfter("group:").substringBefore(",")
4343
sortKey
4444
}
4545

@@ -103,7 +103,7 @@ class SwingGroupingInputHarvester : SwingInputHarvester() {
103103
})
104104

105105
labelPanel.component.add(label)
106-
inputPanel.component.add(labelPanel.component, "span 2")
106+
inputPanel.component.add(labelPanel.component, "wrap")
107107
// hidemode 3 ignores the space taken up by components when rendered
108108
inputPanel.component.add(panel.component, "wrap,hidemode 3")
109109

0 commit comments

Comments
 (0)