Skip to content

Commit 3372bdc

Browse files
committed
Implemented editable string property.
1 parent ac65e0d commit 3372bdc

File tree

16 files changed

+206
-7
lines changed

16 files changed

+206
-7
lines changed

jme3-spaceshift-extension/src/com/ss/extension/property/EditablePropertyType.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public enum EditablePropertyType {
1414
QUATERNION,
1515
COLOR,
1616
ENUM,
17+
STRING,
1718
DIRECTION_LIGHT_FROM_SCENE,
1819
POINT_LIGHT_FROM_SCENE;
1920

155 Bytes
Binary file not shown.
33 Bytes
Binary file not shown.
214 Bytes
Binary file not shown.

libs/jME/jme3-core-3.2.0.jar

317 Bytes
Binary file not shown.

src/com/ss/editor/ui/control/app/state/property/builder/impl/AppStatePropertyBuilder.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.ss.editor.ui.control.app.state.property.control.EnumAppStatePropertyControl;
1010
import com.ss.editor.ui.control.app.state.property.control.FloatAppStatePropertyControl;
1111
import com.ss.editor.ui.control.app.state.property.control.IntegerAppStatePropertyControl;
12+
import com.ss.editor.ui.control.app.state.property.control.StringAppStatePropertyControl;
1213
import com.ss.editor.ui.control.app.state.property.control.Vector2fAppStatePropertyControl;
1314
import com.ss.editor.ui.control.app.state.property.control.Vector3fAppStatePropertyControl;
1415
import com.ss.editor.ui.control.property.AbstractPropertyControl;
@@ -91,7 +92,7 @@ protected void buildForImpl(@NotNull final Object object, @Nullable final Object
9192
case COLOR: {
9293

9394
final EditableProperty<ColorRGBA, ?> property = cast(editableProperty);
94-
final ColorRGBA color = Objects.requireNonNull(property.getValue(), "Color value can't be null.");
95+
final ColorRGBA color = property.getValue();
9596

9697
final ColorAppStatePropertyControl<EditableProperty<ColorRGBA, ?>> propertyControl =
9798
new ColorAppStatePropertyControl<>(color, property.getName(), changeConsumer);
@@ -110,6 +111,17 @@ protected void buildForImpl(@NotNull final Object object, @Nullable final Object
110111
addControl(container, property, propertyControl);
111112
break;
112113
}
114+
case STRING: {
115+
116+
final EditableProperty<String, ?> property = cast(editableProperty);
117+
final String value = property.getValue();
118+
119+
final StringAppStatePropertyControl<EditableProperty<String, ?>> propertyControl =
120+
new StringAppStatePropertyControl<>(value, property.getName(), changeConsumer);
121+
122+
addControl(container, property, propertyControl);
123+
break;
124+
}
113125
case VECTOR_2F: {
114126

115127
final EditableProperty<Vector2f, ?> property = cast(editableProperty);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.ss.editor.ui.control.app.state.property.control;
2+
3+
import static com.ss.editor.ui.control.app.state.property.control.AppStatePropertyControl.newChangeHandler;
4+
5+
import com.ss.editor.model.undo.editor.SceneChangeConsumer;
6+
import com.ss.editor.ui.control.property.AbstractPropertyControl;
7+
import com.ss.editor.ui.control.property.impl.AbstractStringPropertyControl;
8+
9+
import org.jetbrains.annotations.NotNull;
10+
import org.jetbrains.annotations.Nullable;
11+
12+
/**
13+
* The implementation of the {@link AbstractPropertyControl} to edit string values.
14+
*
15+
* @author JavaSaBr
16+
*/
17+
public class StringAppStatePropertyControl<T> extends AbstractStringPropertyControl<SceneChangeConsumer, T> {
18+
19+
public StringAppStatePropertyControl(@Nullable final String propertyValue, @NotNull final String propertyName,
20+
@NotNull final SceneChangeConsumer changeConsumer) {
21+
super(propertyValue, propertyName, changeConsumer, newChangeHandler());
22+
}
23+
}

src/com/ss/editor/ui/control/filter/property/builder/impl/FilterPropertyBuilder.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import com.ss.editor.ui.control.filter.property.control.FloatFilterPropertyControl;
1414
import com.ss.editor.ui.control.filter.property.control.IntegerFilterPropertyControl;
1515
import com.ss.editor.ui.control.filter.property.control.PointLightElementPropertyControl;
16+
import com.ss.editor.ui.control.filter.property.control.StringFilterPropertyControl;
1617
import com.ss.editor.ui.control.filter.property.control.Vector2fFilterPropertyControl;
1718
import com.ss.editor.ui.control.filter.property.control.Vector3fFilterPropertyControl;
1819
import com.ss.editor.ui.control.property.AbstractPropertyControl;
@@ -95,7 +96,7 @@ protected void buildForImpl(@NotNull final Object object, @Nullable final Object
9596
case COLOR: {
9697

9798
final EditableProperty<ColorRGBA, ?> property = cast(editableProperty);
98-
final ColorRGBA color = Objects.requireNonNull(property.getValue(), "Color value can't be null.");
99+
final ColorRGBA color = property.getValue();
99100

100101
final ColorFilterPropertyControl<EditableProperty<ColorRGBA, ?>> propertyControl =
101102
new ColorFilterPropertyControl<>(color, property.getName(), changeConsumer);
@@ -114,6 +115,17 @@ protected void buildForImpl(@NotNull final Object object, @Nullable final Object
114115
addControl(container, property, propertyControl);
115116
break;
116117
}
118+
case STRING: {
119+
120+
final EditableProperty<String, ?> property = cast(editableProperty);
121+
final String value = property.getValue();
122+
123+
final StringFilterPropertyControl<EditableProperty<String, ?>> propertyControl =
124+
new StringFilterPropertyControl<>(value, property.getName(), changeConsumer);
125+
126+
addControl(container, property, propertyControl);
127+
break;
128+
}
117129
case VECTOR_2F: {
118130

119131
final EditableProperty<Vector2f, ?> property = cast(editableProperty);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.ss.editor.ui.control.filter.property.control;
2+
3+
import static com.ss.editor.ui.control.filter.property.control.FilterPropertyControl.newChangeHandler;
4+
5+
import com.ss.editor.model.undo.editor.SceneChangeConsumer;
6+
import com.ss.editor.ui.control.property.AbstractPropertyControl;
7+
import com.ss.editor.ui.control.property.impl.AbstractStringPropertyControl;
8+
9+
import org.jetbrains.annotations.NotNull;
10+
import org.jetbrains.annotations.Nullable;
11+
12+
/**
13+
* The implementation of the {@link AbstractPropertyControl} to edit string values.
14+
*
15+
* @author JavaSaBr
16+
*/
17+
public class StringFilterPropertyControl<T> extends AbstractStringPropertyControl<SceneChangeConsumer, T> {
18+
19+
public StringFilterPropertyControl(@Nullable final String propertyValue, @NotNull final String propertyName,
20+
@NotNull final SceneChangeConsumer changeConsumer) {
21+
super(propertyValue, propertyName, changeConsumer, newChangeHandler());
22+
}
23+
}

src/com/ss/editor/ui/control/model/property/builder/impl/EditableControlPropertyBuilder.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.ss.editor.ui.control.model.property.control.EnumControlPropertyControl;
1111
import com.ss.editor.ui.control.model.property.control.FloatModelPropertyControl;
1212
import com.ss.editor.ui.control.model.property.control.IntegerModelPropertyControl;
13+
import com.ss.editor.ui.control.model.property.control.StringModelPropertyControl;
1314
import com.ss.editor.ui.control.model.property.control.Vector2fModelPropertyControl;
1415
import com.ss.editor.ui.control.model.property.control.Vector3fModelPropertyControl;
1516
import com.ss.editor.ui.control.property.AbstractPropertyControl;
@@ -92,7 +93,7 @@ protected void buildForImpl(@NotNull final Object object, @Nullable final Object
9293
case COLOR: {
9394

9495
final EditableProperty<ColorRGBA, ?> property = cast(editableProperty);
95-
final ColorRGBA color = Objects.requireNonNull(property.getValue(), "Color value can't be null.");
96+
final ColorRGBA color = property.getValue();
9697

9798
final ColorModelPropertyControl<EditableProperty<ColorRGBA, ?>> propertyControl =
9899
new ColorModelPropertyControl<>(color, property.getName(), changeConsumer);
@@ -111,6 +112,17 @@ protected void buildForImpl(@NotNull final Object object, @Nullable final Object
111112
addControl(container, property, propertyControl);
112113
break;
113114
}
115+
case STRING: {
116+
117+
final EditableProperty<String, ?> property = cast(editableProperty);
118+
final String value = property.getValue();
119+
120+
final StringModelPropertyControl<EditableProperty<String, ?>> propertyControl =
121+
new StringModelPropertyControl<>(value, property.getName(), changeConsumer);
122+
123+
addControl(container, property, propertyControl);
124+
break;
125+
}
114126
case VECTOR_2F: {
115127

116128
final EditableProperty<Vector2f, ?> property = cast(editableProperty);

0 commit comments

Comments
 (0)