@@ -121,44 +121,37 @@ private void generate(Screen self) throws IllegalAccessException {
121121 private void entry (EntryInfo <?> entry , Naming .Entry naming ) throws IllegalAccessException {
122122 if (enabledText .equals (naming .name ())) return ;
123123 Type type = entry .getValueType ();
124- WWidget widget = null ;
125- if (type .isInt ()) {
126- widget = add ((EntryInfo <Integer >) entry , naming ,
124+ switch (type ) {
125+ case Type .TInt _0 -> add ((EntryInfo <Integer >) entry , naming ,
127126 theme .intEdit ((int ) entry .getValue (), (int ) entry .getMinValue (), (int ) entry .getMaxValue (), false ),
128127 (s , r ) -> s .action = r ,
129128 WIntEdit ::get ,
130129 WIntEdit ::set );
131- } else if (type .isLong ()) {
132- // Unsupported
133- } else if (type .isFloat ()) {
134- widget = add ((EntryInfo <Float >) entry , naming ,
130+ case Type .TLong _0 -> table .add (theme .label (entry .getName () + " (unsupported: long)" ));
131+ case Type .TFloat _0 -> add ((EntryInfo <Float >) entry , naming ,
135132 theme .doubleEdit ((float ) entry .getValue (), entry .getMinValue (), entry .getMaxValue ()),
136133 (s , r ) -> s .action = r ,
137134 s -> (float ) s .get (),
138135 (s , v ) -> s .set (v ));
139- } else if (type .isDouble ()) {
140- widget = add ((EntryInfo <Double >) entry , naming ,
136+ case Type .TDouble _0 -> add ((EntryInfo <Double >) entry , naming ,
141137 theme .doubleEdit ((double ) entry .getValue (), entry .getMinValue (), entry .getMaxValue ()),
142138 (s , r ) -> s .action = r ,
143139 WDoubleEdit ::get ,
144140 WDoubleEdit ::set );
145- } else if (type .isString ()) {
146- widget = add ((EntryInfo <String >) entry , naming ,
141+ case Type .TString _0 -> add ((EntryInfo <String >) entry , naming ,
147142 theme .textBox (Objects .requireNonNullElse ((String ) entry .getValue (), "" )),
148143 (s , r ) -> s .action = r ,
149144 WTextBox ::get ,
150145 WTextBox ::set );
151- } else if (type .isBool ()) {
152- widget = add ((EntryInfo <Boolean >) entry , naming ,
146+ case Type .TBool _0 -> add ((EntryInfo <Boolean >) entry , naming ,
153147 theme .checkbox ((boolean ) entry .getValue ()),
154148 (s , r ) -> s .action = r ,
155149 s -> s .checked ,
156150 (s , v ) -> s .checked = v );
157- } else if (type .isEnum ()) {
158- widget = tEnum (entry , naming , type .asEnum ());
151+ //noinspection rawtypes
152+ case Type .TEnum tEnum -> tEnum (entry , naming , tEnum );
153+ case Type .TUnknown _0 -> table .add (theme .label (entry .getName () + " (unsupported: unknown)" ));
159154 }
160-
161- if (widget == null ) table .add (theme .label (entry .getName () + " (unsupported)" ));
162155 table .row ();
163156 }
164157
0 commit comments