@@ -90,6 +90,12 @@ public class Texture2DPropertyControl<C extends ChangeConsumer, T> extends Prope
9090 @ Nullable
9191 private Label textureLabel ;
9292
93+ /**
94+ * The field container.
95+ */
96+ @ Nullable
97+ private HBox fieldContainer ;
98+
9399 public Texture2DPropertyControl (@ Nullable final Texture2D propertyValue , @ NotNull final String propertyName ,
94100 @ NotNull final C changeConsumer ) {
95101 super (propertyValue , propertyName , changeConsumer );
@@ -127,7 +133,12 @@ protected void handleDragOverEvent(@NotNull final DragEvent dragEvent) {
127133 protected void createComponents (@ NotNull final HBox container ) {
128134 super .createComponents (container );
129135
130- textureLabel = new Label (NO_TEXTURE );
136+ fieldContainer = new HBox ();
137+
138+ if (!isSingleRow ()) {
139+ fieldContainer .prefWidthProperty ().bind (container .widthProperty ());
140+ }
141+
131142 textureTooltip = new ImageChannelPreview ();
132143
133144 final VBox previewContainer = new VBox ();
@@ -152,23 +163,32 @@ protected void createComponents(@NotNull final HBox container) {
152163 removeButton .setOnAction (event -> processRemove ());
153164 removeButton .disableProperty ().bind (buildDisableRemoveCondition ());
154165
155- textureLabel .prefWidthProperty ().bind (widthProperty ()
156- .subtract (removeButton .widthProperty ())
157- .subtract (previewContainer .widthProperty ())
158- .subtract (settingsButton .widthProperty ())
159- .subtract (addButton .widthProperty ()));
160-
161- FXUtils .addToPane (textureLabel , container );
162- FXUtils .addToPane (previewContainer , container );
163- FXUtils .addToPane (addButton , container );
164- FXUtils .addToPane (settingsButton , container );
165- FXUtils .addToPane (removeButton , container );
166+ if (!isSingleRow ()) {
167+
168+ textureLabel = new Label (NO_TEXTURE );
169+ textureLabel .prefWidthProperty ().bind (widthProperty ()
170+ .subtract (removeButton .widthProperty ())
171+ .subtract (previewContainer .widthProperty ())
172+ .subtract (settingsButton .widthProperty ())
173+ .subtract (addButton .widthProperty ()));
174+
175+ FXUtils .addToPane (textureLabel , fieldContainer );
176+ FXUtils .addClassTo (textureLabel , CSSClasses .ABSTRACT_PARAM_CONTROL_ELEMENT_LABEL );
177+ FXUtils .addClassesTo (fieldContainer , CSSClasses .TEXT_INPUT_CONTAINER ,
178+ CSSClasses .ABSTRACT_PARAM_CONTROL_INPUT_CONTAINER );
179+
180+ } else {
181+ FXUtils .addClassesTo (fieldContainer , CSSClasses .TEXT_INPUT_CONTAINER_WITHOUT_PADDING );
182+ }
183+
184+ FXUtils .addToPane (previewContainer , fieldContainer );
185+ FXUtils .addToPane (addButton , fieldContainer );
186+ FXUtils .addToPane (settingsButton , fieldContainer );
187+ FXUtils .addToPane (removeButton , fieldContainer );
188+ FXUtils .addToPane (fieldContainer , container );
166189 FXUtils .addToPane (texturePreview , previewContainer );
167190
168- FXUtils .addClassesTo (container , CSSClasses .DEF_HBOX , CSSClasses .TEXT_INPUT_CONTAINER ,
169- CSSClasses .ABSTRACT_PARAM_CONTROL_INPUT_CONTAINER );
170191 FXUtils .addClassTo (previewContainer , CSSClasses .ABSTRACT_PARAM_CONTROL_PREVIEW_CONTAINER );
171- FXUtils .addClassTo (textureLabel , CSSClasses .ABSTRACT_PARAM_CONTROL_ELEMENT_LABEL );
172192 FXUtils .addClassesTo (settingsButton , addButton , removeButton , CSSClasses .FLAT_BUTTON ,
173193 CSSClasses .INPUT_CONTROL_TOOLBAR_BUTTON );
174194 }
@@ -189,6 +209,16 @@ protected void createComponents(@NotNull final HBox container) {
189209 return notNull (textureLabel );
190210 }
191211
212+ /**
213+ * Get the field container.
214+ *
215+ * @return the field container.
216+ */
217+ @ FXThread
218+ protected @ NotNull HBox getFieldContainer () {
219+ return notNull (fieldContainer );
220+ }
221+
192222 /**
193223 * @return the texture preview.
194224 */
@@ -325,8 +355,10 @@ protected void reload() {
325355 final Texture2D texture2D = getPropertyValue ();
326356 final AssetKey key = texture2D == null ? null : texture2D .getKey ();
327357
328- final Label textureLabel = getTextureLabel ();
329- textureLabel .setText (key == null ? NO_TEXTURE : key .getName ());
358+ if (!isSingleRow ()) {
359+ final Label textureLabel = getTextureLabel ();
360+ textureLabel .setText (key == null ? NO_TEXTURE : key .getName ());
361+ }
330362
331363 final ImageChannelPreview textureTooltip = getTextureTooltip ();
332364 final ImageView preview = getTexturePreview ();
0 commit comments