11package com .ss .editor .ui .control .property .impl ;
22
3+ import static com .ss .rlib .util .ObjectUtils .notNull ;
34import com .ss .editor .model .undo .editor .ChangeConsumer ;
45import com .ss .editor .ui .control .property .AbstractPropertyControl ;
56import com .ss .editor .ui .css .CSSClasses ;
6- import com .ss .editor .ui .css .CSSIds ;
7-
7+ import com .ss .rlib .function .SixObjectConsumer ;
8+ import com .ss .rlib .ui .util .FXUtils ;
9+ import javafx .scene .control .Label ;
10+ import javafx .scene .layout .HBox ;
811import org .jetbrains .annotations .NotNull ;
912import org .jetbrains .annotations .Nullable ;
1013
1114import java .util .function .BiConsumer ;
1215import java .util .function .Function ;
1316
14- import javafx .scene .control .Label ;
15- import javafx .scene .layout .HBox ;
16- import com .ss .rlib .function .SixObjectConsumer ;
17- import com .ss .rlib .ui .util .FXUtils ;
18-
1917/**
2018 * The default implementation of the property control.
2119 *
2422 * @param <T> the type parameter
2523 * @author JavaSaBr
2624 */
27- public abstract class AbstractDefaultPropertyControl <C extends ChangeConsumer , D , T > extends AbstractPropertyControl <C , D , T > {
25+ public abstract class AbstractDefaultPropertyControl <C extends ChangeConsumer , D , T >
26+ extends AbstractPropertyControl <C , D , T > {
2827
2928 /**
3029 * The label with value of the property.
3130 */
31+ @ Nullable
3232 protected Label propertyValueLabel ;
3333
3434 /**
3535 * The string function.
3636 */
37+ @ Nullable
3738 private Function <T , String > toStringFunction ;
3839
3940 /**
@@ -55,32 +56,35 @@ public AbstractDefaultPropertyControl(@Nullable final T propertyValue, @NotNull
5556 *
5657 * @param toStringFunction the string function.
5758 */
58- public void setToStringFunction (final Function <T , String > toStringFunction ) {
59+ public void setToStringFunction (@ Nullable final Function <T , String > toStringFunction ) {
5960 this .toStringFunction = toStringFunction ;
6061 }
6162
6263 /**
6364 * @return the string function.
6465 */
66+ @ Nullable
6567 private Function <T , String > getToStringFunction () {
6668 return toStringFunction ;
6769 }
6870
6971 /**
7072 * @return the label with value of the property.
7173 */
74+ @ NotNull
7275 private Label getPropertyValueLabel () {
73- return propertyValueLabel ;
76+ return notNull ( propertyValueLabel ) ;
7477 }
7578
7679 @ Override
7780 protected void createComponents (@ NotNull final HBox container ) {
7881 super .createComponents (container );
7982
8083 propertyValueLabel = new Label ();
81- propertyValueLabel .setId (CSSIds .ABSTRACT_PARAM_CONTROL_LABEL_VALUE );
8284
83- FXUtils .addClassTo (propertyValueLabel , CSSClasses .SPECIAL_FONT_13 );
85+ FXUtils .addClassesTo (propertyValueLabel , CSSClasses .ABSTRACT_PARAM_CONTROL_LABEL_VALUE ,
86+ CSSClasses .TEXT_INPUT_CONTAINER );
87+
8488 FXUtils .addToPane (propertyValueLabel , container );
8589 }
8690
@@ -91,6 +95,7 @@ public void reload() {
9195 final Function <T , String > function = getToStringFunction ();
9296
9397 final Label propertyValueLabel = getPropertyValueLabel ();
94- propertyValueLabel .setText (function == null ? String .valueOf (getPropertyValue ()) : function .apply (getPropertyValue ()));
98+ propertyValueLabel .setText (function == null ? String .valueOf (getPropertyValue ()) :
99+ function .apply (getPropertyValue ()));
95100 }
96101}
0 commit comments