diff --git a/README.md b/README.md
index b087e12580..73a9912e37 100644
--- a/README.md
+++ b/README.md
@@ -22,6 +22,12 @@ PR with your changes. You can start right away by using the Gitpod online worksp
[](https://gitpod.io/#https://github.com/MovingBlocks/TeraNUI)
+In Terasology, you can test easily locally until you're ready for a snapshot or release. To do so, you'll need to re-embed TeraNUI into Terasology as source which has priority over any binary version. You can get the TeraNUI library as source into your local Terasology workspace as follows:
+```sh
+groovyw lib get TeraNUI
+```
+This will place the TeraNUI source code into `/libs/TeraNUI`. Please note, that you may need to reload/refresh your gradle workspace in Intellij IDEA.
+
## 🤖 Maintenance
The main development of TeraNUI happens on the `master` branch, a strong main branch that always has the latest version
@@ -51,7 +57,8 @@ The exact build steps for this library are defined in the [Jenkinsfile](./Jenkin
🗄 [**Snapshots**][artifactory-nui-snapshot] ▪ [**Releases**][artifactory-nui-release]
-> 🚧 TODO: how to consume TeraNUI from the Terasolgoy Artifactory (e.g., gradle dependency snippet)
+
+> 🚧 TODO: how to consume TeraNUI from the Terasology Artifactory (e.g., gradle dependency snippet)
### Release Process
diff --git a/build.gradle b/build.gradle
index 10bde3d7c1..dd44c0dd05 100644
--- a/build.gradle
+++ b/build.gradle
@@ -6,7 +6,7 @@ plugins {
ext {
// Overall version number for NUI's various elements
- nuiVersion = "1.0.0-SNAPSHOT"
+ nuiVersion = "2.1.0-SNAPSHOT"
// JOML version we're tracking
jomlVersion = "1.9.25"
diff --git a/gradle/common.gradle b/gradle/common.gradle
index 51447d726c..8ec6b89048 100644
--- a/gradle/common.gradle
+++ b/gradle/common.gradle
@@ -15,6 +15,9 @@ repositories {
jcenter()
mavenCentral()
+ // Google's Maven repository - Needed for com.android.support:support-annotations, which gestalt 7 uses
+ google()
+
// MovingBlocks Artifactory instance for libs not readily available elsewhere plus our own libs
maven {
def repoViaEnv = System.getenv()["RESOLUTION_REPO"]
diff --git a/nui-input/build.gradle b/nui-input/build.gradle
index 060266a95d..1b6e3f7994 100644
--- a/nui-input/build.gradle
+++ b/nui-input/build.gradle
@@ -6,8 +6,8 @@ plugins {
apply from: "$rootDir/gradle/common.gradle"
dependencies {
- api group: 'org.terasology', name: 'gestalt-module', version: '5.1.5'
- api group: 'org.terasology', name: 'gestalt-asset-core', version: '5.1.5'
+ api group: 'org.terasology.gestalt', name: 'gestalt-module', version: '7.0.3'
+ api group: 'org.terasology.gestalt', name: 'gestalt-asset-core', version: '7.0.3'
api ('org.joml:joml') {
version {
diff --git a/nui-input/src/main/java/org/terasology/input/ButtonState.java b/nui-input/src/main/java/org/terasology/input/ButtonState.java
deleted file mode 100644
index 4f049df019..0000000000
--- a/nui-input/src/main/java/org/terasology/input/ButtonState.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.terasology.input;
-
-/**
- */
-public enum ButtonState {
- DOWN(true),
- UP(false),
- REPEAT(true);
-
- private boolean down;
-
- ButtonState(boolean down) {
- this.down = down;
- }
-
- public boolean isDown() {
- return down;
- }
-}
diff --git a/nui-input/src/main/java/org/terasology/input/ControllerDevice.java b/nui-input/src/main/java/org/terasology/input/ControllerDevice.java
deleted file mode 100644
index 6a753bb5fb..0000000000
--- a/nui-input/src/main/java/org/terasology/input/ControllerDevice.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2015 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.terasology.input;
-
-import java.util.List;
-import java.util.Queue;
-
-import org.terasology.input.device.ControllerAction;
-import org.terasology.input.device.InputDevice;
-
-/**
- * Represents all connected controllers (e.g. gamepads, but also some keyboards).
- * Unfortunately, it is impossible to separate events in LWJGL2 based on controllers, so they have
- * to be processes all at once.
- */
-public interface ControllerDevice extends InputDevice {
-
- @Override
- Queue getInputQueue();
-
- /**
- * @return a list of currently connected controller IDs.
- */
- List getControllers();
-}
diff --git a/nui-input/src/main/java/org/terasology/input/device/InputDevice.java b/nui-input/src/main/java/org/terasology/input/device/InputDevice.java
deleted file mode 100644
index 15cdb5c113..0000000000
--- a/nui-input/src/main/java/org/terasology/input/device/InputDevice.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.input.device;
-
-import org.terasology.module.sandbox.API;
-
-import java.util.Queue;
-
-@API
-@FunctionalInterface
-public interface InputDevice {
-
- /**
- * @return A queue of all input actions that have occurred over the last update for this device
- */
- Queue> getInputQueue();
-}
diff --git a/nui-input/src/main/java/org/terasology/input/device/KeyboardDevice.java b/nui-input/src/main/java/org/terasology/input/device/KeyboardDevice.java
deleted file mode 100644
index 93000c6278..0000000000
--- a/nui-input/src/main/java/org/terasology/input/device/KeyboardDevice.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.input.device;
-
-import java.util.Queue;
-
-import org.terasology.module.sandbox.API;
-
-/**
- */
-@API
-public interface KeyboardDevice extends InputDevice {
-
- @Override
- Queue getInputQueue();
-
- /**
- * @param key
- * @return The current state of the given key
- */
- boolean isKeyDown(int key);
-}
diff --git a/nui-input/src/main/java/org/terasology/input/device/nulldevices/NullControllerDevice.java b/nui-input/src/main/java/org/terasology/input/device/nulldevices/NullControllerDevice.java
deleted file mode 100644
index 814f3703b0..0000000000
--- a/nui-input/src/main/java/org/terasology/input/device/nulldevices/NullControllerDevice.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2015 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.terasology.input.device.nulldevices;
-
-import java.util.ArrayDeque;
-import java.util.Collections;
-import java.util.List;
-import java.util.Queue;
-
-import org.terasology.input.ControllerDevice;
-import org.terasology.input.device.ControllerAction;
-
-/**
- * A dummy implementation of {@link ControllerDevice}.
- */
-public class NullControllerDevice implements ControllerDevice {
-
- @Override
- public Queue getInputQueue() {
- return new ArrayDeque<>();
- }
-
- @Override
- public List getControllers() {
- return Collections.emptyList();
- }
-}
diff --git a/nui-input/src/main/java/org/terasology/input/device/nulldevices/NullKeyboardDevice.java b/nui-input/src/main/java/org/terasology/input/device/nulldevices/NullKeyboardDevice.java
deleted file mode 100644
index 6eef0ee281..0000000000
--- a/nui-input/src/main/java/org/terasology/input/device/nulldevices/NullKeyboardDevice.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.input.device.nulldevices;
-
-import com.google.common.collect.Queues;
-
-import org.terasology.input.device.KeyboardAction;
-import org.terasology.input.device.KeyboardDevice;
-
-import java.util.Queue;
-
-/**
- */
-public class NullKeyboardDevice implements KeyboardDevice {
-
- @Override
- public boolean isKeyDown(int button) {
- return false;
- }
-
- @Override
- public Queue getInputQueue() {
- return Queues.newArrayDeque();
- }
-}
diff --git a/nui-input/src/main/java/org/terasology/input/device/nulldevices/NullMouseDevice.java b/nui-input/src/main/java/org/terasology/input/device/nulldevices/NullMouseDevice.java
deleted file mode 100644
index fa150415ff..0000000000
--- a/nui-input/src/main/java/org/terasology/input/device/nulldevices/NullMouseDevice.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.input.device.nulldevices;
-
-import com.google.common.collect.Queues;
-
-import org.terasology.input.device.MouseAction;
-import org.terasology.input.device.MouseDevice;
-import org.joml.Vector2i;
-
-import java.util.Queue;
-
-/**
- */
-public class NullMouseDevice implements MouseDevice {
- @Override
- public Vector2i getMousePosition() {
- return new Vector2i();
- }
-
- @Override
- public Vector2i getDelta() {
- return new Vector2i();
- }
-
- @Override
- public boolean isButtonDown(int button) {
- return false;
- }
-
- @Override
- public boolean isVisible() {
- return false;
- }
-
- @Override
- public Queue getInputQueue() {
- return Queues.newArrayDeque();
- }
-
- @Override
- public void setGrabbed(boolean grabbed) {
- }
-}
diff --git a/nui-input/src/main/java/org/terasology/input/package-info.java b/nui-input/src/main/java/org/terasology/input/package-info.java
deleted file mode 100644
index 9b0dcf36e9..0000000000
--- a/nui-input/src/main/java/org/terasology/input/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-@API package org.terasology.input;
-
-import org.terasology.module.sandbox.API;
\ No newline at end of file
diff --git a/nui-input/src/main/java/org/terasology/input/ActivateMode.java b/nui-input/src/main/java/org/terasology/nui/input/ActivateMode.java
similarity index 50%
rename from nui-input/src/main/java/org/terasology/input/ActivateMode.java
rename to nui-input/src/main/java/org/terasology/nui/input/ActivateMode.java
index 396c4a8393..8544ae7449 100644
--- a/nui-input/src/main/java/org/terasology/input/ActivateMode.java
+++ b/nui-input/src/main/java/org/terasology/nui/input/ActivateMode.java
@@ -1,24 +1,10 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
-package org.terasology.input;
+package org.terasology.nui.input;
/**
* This enum determines which events a button will send
- *
*/
public enum ActivateMode {
/**
@@ -34,8 +20,8 @@ public enum ActivateMode {
*/
BOTH(true, true);
- private boolean activatedOnPress;
- private boolean activatedOnRelease;
+ private final boolean activatedOnPress;
+ private final boolean activatedOnRelease;
ActivateMode(boolean activatedOnPress, boolean activatedOnRelease) {
this.activatedOnPress = activatedOnPress;
diff --git a/nui-input/src/main/java/org/terasology/nui/input/ButtonState.java b/nui-input/src/main/java/org/terasology/nui/input/ButtonState.java
new file mode 100644
index 0000000000..a6db83da29
--- /dev/null
+++ b/nui-input/src/main/java/org/terasology/nui/input/ButtonState.java
@@ -0,0 +1,23 @@
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+
+package org.terasology.nui.input;
+
+/**
+ *
+ */
+public enum ButtonState {
+ DOWN(true),
+ UP(false),
+ REPEAT(true);
+
+ private final boolean down;
+
+ ButtonState(boolean down) {
+ this.down = down;
+ }
+
+ public boolean isDown() {
+ return down;
+ }
+}
diff --git a/nui-input/src/main/java/org/terasology/nui/input/ControllerDevice.java b/nui-input/src/main/java/org/terasology/nui/input/ControllerDevice.java
new file mode 100644
index 0000000000..7f61421589
--- /dev/null
+++ b/nui-input/src/main/java/org/terasology/nui/input/ControllerDevice.java
@@ -0,0 +1,25 @@
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+
+package org.terasology.nui.input;
+
+import org.terasology.nui.input.device.ControllerAction;
+import org.terasology.nui.input.device.InputDevice;
+
+import java.util.List;
+import java.util.Queue;
+
+/**
+ * Represents all connected controllers (e.g. gamepads, but also some keyboards). Unfortunately, it is impossible
+ * to separate events in LWJGL2 based on controllers, so they have to be processes all at once.
+ */
+public interface ControllerDevice extends InputDevice {
+
+ @Override
+ Queue getInputQueue();
+
+ /**
+ * @return a list of currently connected controller IDs.
+ */
+ List getControllers();
+}
diff --git a/nui-input/src/main/java/org/terasology/input/ControllerId.java b/nui-input/src/main/java/org/terasology/nui/input/ControllerId.java
similarity index 58%
rename from nui-input/src/main/java/org/terasology/input/ControllerId.java
rename to nui-input/src/main/java/org/terasology/nui/input/ControllerId.java
index 516b2587db..11d78e9fd7 100644
--- a/nui-input/src/main/java/org/terasology/input/ControllerId.java
+++ b/nui-input/src/main/java/org/terasology/nui/input/ControllerId.java
@@ -1,20 +1,7 @@
-/*
- * Copyright 2015 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.terasology.input;
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+
+package org.terasology.nui.input;
public final class ControllerId {
diff --git a/nui-input/src/main/java/org/terasology/input/ControllerInput.java b/nui-input/src/main/java/org/terasology/nui/input/ControllerInput.java
similarity index 80%
rename from nui-input/src/main/java/org/terasology/input/ControllerInput.java
rename to nui-input/src/main/java/org/terasology/nui/input/ControllerInput.java
index f820674632..38ec83043a 100644
--- a/nui-input/src/main/java/org/terasology/input/ControllerInput.java
+++ b/nui-input/src/main/java/org/terasology/nui/input/ControllerInput.java
@@ -1,20 +1,7 @@
-/*
- * Copyright 2015 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
-package org.terasology.input;
+package org.terasology.nui.input;
import java.util.Locale;
@@ -48,10 +35,10 @@ public enum ControllerInput implements Input {
BUTTON_10(InputType.CONTROLLER_BUTTON, ControllerId.TEN, "BUTTON_10", "Controller Button 10"),
BUTTON_11(InputType.CONTROLLER_BUTTON, ControllerId.ELEVEN, "BUTTON_11", "Controller Button 11");
- private int id;
- private String displayName;
- private String name;
- private InputType type;
+ private final int id;
+ private final String displayName;
+ private final String name;
+ private final InputType type;
ControllerInput(InputType type, int id, String name, String displayName) {
this.type = type;
diff --git a/nui-input/src/main/java/org/terasology/input/Input.java b/nui-input/src/main/java/org/terasology/nui/input/Input.java
similarity index 52%
rename from nui-input/src/main/java/org/terasology/input/Input.java
rename to nui-input/src/main/java/org/terasology/nui/input/Input.java
index 6013ed1ef2..04d340fea7 100644
--- a/nui-input/src/main/java/org/terasology/input/Input.java
+++ b/nui-input/src/main/java/org/terasology/nui/input/Input.java
@@ -1,25 +1,10 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
-package org.terasology.input;
+package org.terasology.nui.input;
/**
- * The description of an input, whether key, mouse button or mouse wheel.
- * Immutable.
- *
+ * The description of an input, whether key, mouse button or mouse wheel. Immutable.
*/
public interface Input {
diff --git a/nui-input/src/main/java/org/terasology/input/InputCategory.java b/nui-input/src/main/java/org/terasology/nui/input/InputCategory.java
similarity index 55%
rename from nui-input/src/main/java/org/terasology/input/InputCategory.java
rename to nui-input/src/main/java/org/terasology/nui/input/InputCategory.java
index aa47f5adf6..add160e74f 100644
--- a/nui-input/src/main/java/org/terasology/input/InputCategory.java
+++ b/nui-input/src/main/java/org/terasology/nui/input/InputCategory.java
@@ -1,19 +1,6 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.input;
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.input;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/nui-input/src/main/java/org/terasology/input/InputType.java b/nui-input/src/main/java/org/terasology/nui/input/InputType.java
similarity index 76%
rename from nui-input/src/main/java/org/terasology/input/InputType.java
rename to nui-input/src/main/java/org/terasology/nui/input/InputType.java
index 619cceea81..0ec4db220d 100644
--- a/nui-input/src/main/java/org/terasology/input/InputType.java
+++ b/nui-input/src/main/java/org/terasology/nui/input/InputType.java
@@ -1,24 +1,10 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
-package org.terasology.input;
+package org.terasology.nui.input;
/**
* The type of an input
- *
*/
public enum InputType {
NONE {
diff --git a/nui-input/src/main/java/org/terasology/input/Keyboard.java b/nui-input/src/main/java/org/terasology/nui/input/Keyboard.java
similarity index 94%
rename from nui-input/src/main/java/org/terasology/input/Keyboard.java
rename to nui-input/src/main/java/org/terasology/nui/input/Keyboard.java
index 69280f7c33..6b4b389722 100644
--- a/nui-input/src/main/java/org/terasology/input/Keyboard.java
+++ b/nui-input/src/main/java/org/terasology/nui/input/Keyboard.java
@@ -1,19 +1,6 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.input;
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.input;
import com.google.common.collect.Maps;
@@ -302,12 +289,12 @@ public enum Key implements Input {
POWER(KeyId.POWER, "KEY_POWER", "Power"),
SLEEP(KeyId.SLEEP, "KEY_SLEEP", "Sleep");
- private static Map lookupByName;
- private static Map lookupById;
+ private static final Map lookupByName;
+ private static final Map lookupById;
- private int id;
- private String name;
- private String displayName;
+ private final int id;
+ private final String name;
+ private final String displayName;
static {
lookupByName = Maps.newHashMapWithExpectedSize(Key.values().length);
diff --git a/nui-input/src/main/java/org/terasology/input/MouseInput.java b/nui-input/src/main/java/org/terasology/nui/input/MouseInput.java
similarity index 71%
rename from nui-input/src/main/java/org/terasology/input/MouseInput.java
rename to nui-input/src/main/java/org/terasology/nui/input/MouseInput.java
index a0d99cbe71..eb5bf8a243 100644
--- a/nui-input/src/main/java/org/terasology/input/MouseInput.java
+++ b/nui-input/src/main/java/org/terasology/nui/input/MouseInput.java
@@ -1,20 +1,7 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
-package org.terasology.input;
+package org.terasology.nui.input;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@@ -35,13 +22,13 @@ public enum MouseInput implements Input {
WHEEL_UP(InputType.MOUSE_WHEEL, 1, "MOUSE_WHEEL_UP", "Mouse Wheel Up", "MWHEEL_UP"),
WHEEL_DOWN(InputType.MOUSE_WHEEL, -1, "MOUSE_WHEEL_DOWN", "Mouse Wheel Down", "MWHEEL_DOWN");
- private static Map lookup = Maps.newHashMap();
+ private static final Map lookup = Maps.newHashMap();
- private InputType type;
- private int id;
- private String displayName;
- private String name;
- private Set identifiers;
+ private final InputType type;
+ private final int id;
+ private final String displayName;
+ private final String name;
+ private final Set identifiers;
static {
for (MouseInput value : values()) {
diff --git a/nui-input/src/main/java/org/terasology/input/UnknownInput.java b/nui-input/src/main/java/org/terasology/nui/input/UnknownInput.java
similarity index 74%
rename from nui-input/src/main/java/org/terasology/input/UnknownInput.java
rename to nui-input/src/main/java/org/terasology/nui/input/UnknownInput.java
index 5dcb8ae0dc..18d6a242e8 100644
--- a/nui-input/src/main/java/org/terasology/input/UnknownInput.java
+++ b/nui-input/src/main/java/org/terasology/nui/input/UnknownInput.java
@@ -1,29 +1,17 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.input;
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.input;
import java.util.Locale;
import java.util.Objects;
/**
+ *
*/
public final class UnknownInput implements Input {
public static final String UNKNOWN_PART = "_UNKNOWN_";
- private InputType type;
- private int id;
+ private final InputType type;
+ private final int id;
public UnknownInput(InputType type, int id) {
this.type = type;
diff --git a/nui-input/src/main/java/org/terasology/input/device/ControllerAction.java b/nui-input/src/main/java/org/terasology/nui/input/device/ControllerAction.java
similarity index 60%
rename from nui-input/src/main/java/org/terasology/input/device/ControllerAction.java
rename to nui-input/src/main/java/org/terasology/nui/input/device/ControllerAction.java
index ffd09994cc..2b9eabee64 100644
--- a/nui-input/src/main/java/org/terasology/input/device/ControllerAction.java
+++ b/nui-input/src/main/java/org/terasology/nui/input/device/ControllerAction.java
@@ -1,24 +1,12 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.input.device;
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.input.device;
-import org.terasology.input.ButtonState;
-import org.terasology.input.Input;
+import org.terasology.nui.input.ButtonState;
+import org.terasology.nui.input.Input;
/**
+ *
*/
public final class ControllerAction {
private final Input input;
diff --git a/nui-input/src/main/java/org/terasology/nui/input/device/InputDevice.java b/nui-input/src/main/java/org/terasology/nui/input/device/InputDevice.java
new file mode 100644
index 0000000000..65e45d81dd
--- /dev/null
+++ b/nui-input/src/main/java/org/terasology/nui/input/device/InputDevice.java
@@ -0,0 +1,17 @@
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.input.device;
+
+import org.terasology.gestalt.module.sandbox.API;
+
+import java.util.Queue;
+
+@API
+@FunctionalInterface
+public interface InputDevice {
+
+ /**
+ * @return A queue of all input actions that have occurred over the last update for this device
+ */
+ Queue> getInputQueue();
+}
diff --git a/nui-input/src/main/java/org/terasology/input/device/KeyboardAction.java b/nui-input/src/main/java/org/terasology/nui/input/device/KeyboardAction.java
similarity index 53%
rename from nui-input/src/main/java/org/terasology/input/device/KeyboardAction.java
rename to nui-input/src/main/java/org/terasology/nui/input/device/KeyboardAction.java
index 55d086fcde..348b78f74e 100644
--- a/nui-input/src/main/java/org/terasology/input/device/KeyboardAction.java
+++ b/nui-input/src/main/java/org/terasology/nui/input/device/KeyboardAction.java
@@ -1,24 +1,12 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.input.device;
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.input.device;
-import org.terasology.input.ButtonState;
-import org.terasology.input.Input;
+import org.terasology.nui.input.ButtonState;
+import org.terasology.nui.input.Input;
/**
+ *
*/
public final class KeyboardAction {
private final Input input;
diff --git a/nui-input/src/main/java/org/terasology/nui/input/device/KeyboardDevice.java b/nui-input/src/main/java/org/terasology/nui/input/device/KeyboardDevice.java
new file mode 100644
index 0000000000..e188a0279f
--- /dev/null
+++ b/nui-input/src/main/java/org/terasology/nui/input/device/KeyboardDevice.java
@@ -0,0 +1,23 @@
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.input.device;
+
+import org.terasology.gestalt.module.sandbox.API;
+
+import java.util.Queue;
+
+/**
+ *
+ */
+@API
+public interface KeyboardDevice extends InputDevice {
+
+ @Override
+ Queue getInputQueue();
+
+ /**
+ * @param key
+ * @return The current state of the given key
+ */
+ boolean isKeyDown(int key);
+}
diff --git a/nui-input/src/main/java/org/terasology/input/device/MouseAction.java b/nui-input/src/main/java/org/terasology/nui/input/device/MouseAction.java
similarity index 67%
rename from nui-input/src/main/java/org/terasology/input/device/MouseAction.java
rename to nui-input/src/main/java/org/terasology/nui/input/device/MouseAction.java
index b24472e30f..c471ea3ac6 100644
--- a/nui-input/src/main/java/org/terasology/input/device/MouseAction.java
+++ b/nui-input/src/main/java/org/terasology/nui/input/device/MouseAction.java
@@ -1,25 +1,13 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.input.device;
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.input.device;
-import org.terasology.input.ButtonState;
-import org.terasology.input.Input;
import org.joml.Vector2i;
+import org.terasology.nui.input.ButtonState;
+import org.terasology.nui.input.Input;
/**
+ *
*/
public final class MouseAction {
private final Input input;
diff --git a/nui-input/src/main/java/org/terasology/input/device/MouseDevice.java b/nui-input/src/main/java/org/terasology/nui/input/device/MouseDevice.java
similarity index 55%
rename from nui-input/src/main/java/org/terasology/input/device/MouseDevice.java
rename to nui-input/src/main/java/org/terasology/nui/input/device/MouseDevice.java
index 4909a19140..345a1e819a 100644
--- a/nui-input/src/main/java/org/terasology/input/device/MouseDevice.java
+++ b/nui-input/src/main/java/org/terasology/nui/input/device/MouseDevice.java
@@ -1,26 +1,14 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.input.device;
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.input.device;
-import java.util.Queue;
-
-import org.terasology.module.sandbox.API;
import org.joml.Vector2i;
+import org.terasology.gestalt.module.sandbox.API;
+
+import java.util.Queue;
/**
+ *
*/
@API
public interface MouseDevice extends InputDevice {
@@ -34,7 +22,7 @@ public interface MouseDevice extends InputDevice {
/**
* @return The current position of the mouse in screen space
*/
- Vector2i getMousePosition();
+ Vector2i getPosition();
/**
* @return The change in mouse position over the last update
diff --git a/nui-input/src/main/java/org/terasology/nui/input/device/nulldevice/NullControllerDevice.java b/nui-input/src/main/java/org/terasology/nui/input/device/nulldevice/NullControllerDevice.java
new file mode 100644
index 0000000000..0e1aeee4c9
--- /dev/null
+++ b/nui-input/src/main/java/org/terasology/nui/input/device/nulldevice/NullControllerDevice.java
@@ -0,0 +1,28 @@
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+
+package org.terasology.nui.input.device.nulldevice;
+
+import org.terasology.nui.input.ControllerDevice;
+import org.terasology.nui.input.device.ControllerAction;
+
+import java.util.ArrayDeque;
+import java.util.Collections;
+import java.util.List;
+import java.util.Queue;
+
+/**
+ * A dummy implementation of {@link ControllerDevice}.
+ */
+public class NullControllerDevice implements ControllerDevice {
+
+ @Override
+ public Queue getInputQueue() {
+ return new ArrayDeque<>();
+ }
+
+ @Override
+ public List getControllers() {
+ return Collections.emptyList();
+ }
+}
diff --git a/nui-input/src/main/java/org/terasology/nui/input/device/nulldevice/NullKeyboardDevice.java b/nui-input/src/main/java/org/terasology/nui/input/device/nulldevice/NullKeyboardDevice.java
new file mode 100644
index 0000000000..95de37118d
--- /dev/null
+++ b/nui-input/src/main/java/org/terasology/nui/input/device/nulldevice/NullKeyboardDevice.java
@@ -0,0 +1,25 @@
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.input.device.nulldevice;
+
+import com.google.common.collect.Queues;
+import org.terasology.nui.input.device.KeyboardAction;
+import org.terasology.nui.input.device.KeyboardDevice;
+
+import java.util.Queue;
+
+/**
+ *
+ */
+public class NullKeyboardDevice implements KeyboardDevice {
+
+ @Override
+ public boolean isKeyDown(int button) {
+ return false;
+ }
+
+ @Override
+ public Queue getInputQueue() {
+ return Queues.newArrayDeque();
+ }
+}
diff --git a/nui-input/src/main/java/org/terasology/nui/input/device/nulldevice/NullMouseDevice.java b/nui-input/src/main/java/org/terasology/nui/input/device/nulldevice/NullMouseDevice.java
new file mode 100644
index 0000000000..bda3fafc5d
--- /dev/null
+++ b/nui-input/src/main/java/org/terasology/nui/input/device/nulldevice/NullMouseDevice.java
@@ -0,0 +1,44 @@
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.input.device.nulldevice;
+
+import com.google.common.collect.Queues;
+import org.joml.Vector2i;
+import org.terasology.nui.input.device.MouseAction;
+import org.terasology.nui.input.device.MouseDevice;
+
+import java.util.Queue;
+
+/**
+ *
+ */
+public class NullMouseDevice implements MouseDevice {
+ @Override
+ public Vector2i getPosition() {
+ return new Vector2i();
+ }
+
+ @Override
+ public Vector2i getDelta() {
+ return new Vector2i();
+ }
+
+ @Override
+ public boolean isButtonDown(int button) {
+ return false;
+ }
+
+ @Override
+ public boolean isVisible() {
+ return false;
+ }
+
+ @Override
+ public Queue getInputQueue() {
+ return Queues.newArrayDeque();
+ }
+
+ @Override
+ public void setGrabbed(boolean grabbed) {
+ }
+}
diff --git a/nui-input/src/main/java/org/terasology/nui/input/package-info.java b/nui-input/src/main/java/org/terasology/nui/input/package-info.java
new file mode 100644
index 0000000000..1802eba167
--- /dev/null
+++ b/nui-input/src/main/java/org/terasology/nui/input/package-info.java
@@ -0,0 +1,8 @@
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+
+
+@API
+package org.terasology.nui.input;
+
+import org.terasology.gestalt.module.sandbox.API;
\ No newline at end of file
diff --git a/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/GDXInputUtil.java b/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/GDXInputUtil.java
index 525fe1a3a5..253fbc187d 100644
--- a/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/GDXInputUtil.java
+++ b/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/GDXInputUtil.java
@@ -1,24 +1,11 @@
-/*
- * Copyright 2020 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.nui.backends.libgdx;
import com.badlogic.gdx.Input;
-import org.terasology.input.Keyboard;
-import org.terasology.input.MouseInput;
import org.joml.Vector2i;
+import org.terasology.nui.input.Keyboard;
+import org.terasology.nui.input.MouseInput;
import java.util.HashMap;
import java.util.Map;
@@ -29,8 +16,8 @@ public final class GDXInputUtil {
private GDXInputUtil() {
}
- private static Map keyMap = new HashMap<>();
- private static Map mouseMap = new HashMap<>();
+ private static final Map keyMap = new HashMap<>();
+ private static final Map mouseMap = new HashMap<>();
private NUIInputProcessor keyboardInputProcessor;
static {
diff --git a/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/GdxColorUtil.java b/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/GdxColorUtil.java
index a80c497374..079251a0b0 100644
--- a/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/GdxColorUtil.java
+++ b/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/GdxColorUtil.java
@@ -16,6 +16,7 @@
package org.terasology.nui.backends.libgdx;
import org.terasology.nui.Color;
+import org.terasology.nui.Colorc;
public final class GdxColorUtil {
private GdxColorUtil() {
@@ -25,7 +26,7 @@ public static Color gdxToTerasologyColor(com.badlogic.gdx.graphics.Color color)
return new Color(color.r, color.g, color.b, color.a);
}
- public static com.badlogic.gdx.graphics.Color terasologyToGDXColor(Color color) {
+ public static com.badlogic.gdx.graphics.Color terasologyToGDXColor(Colorc color) {
return new com.badlogic.gdx.graphics.Color(color.rf(), color.gf(), color.bf(), color.af());
}
}
diff --git a/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/LibGDXCanvasRenderer.java b/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/LibGDXCanvasRenderer.java
index 245d783f7e..5a5f1fc260 100644
--- a/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/LibGDXCanvasRenderer.java
+++ b/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/LibGDXCanvasRenderer.java
@@ -26,6 +26,7 @@
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Scaling;
import com.badlogic.gdx.utils.viewport.StretchViewport;
+import org.terasology.nui.Colorc;
import org.terasology.nui.util.NUIMathUtil;
import org.terasology.nui.Border;
import org.joml.Rectanglef;
@@ -174,7 +175,7 @@ public void crop(Rectanglei cropRegion) {
}
@Override
- public void drawLine(int sx, int sy, int ex, int ey, Color color) {
+ public void drawLine(int sx, int sy, int ex, int ey, Colorc color) {
spriteBatch.flush();
spriteBatch.end();
@@ -199,7 +200,7 @@ public void drawLine(int sx, int sy, int ex, int ey, Color color) {
}
@Override
- public void drawTexture(UITextureRegion texture, Color color, ScaleMode mode, Rectanglei absoluteRegion, float ux, float uy, float uw, float uh, float alpha) {
+ public void drawTexture(UITextureRegion texture, Colorc color, ScaleMode mode, Rectanglei absoluteRegion, float ux, float uy, float uw, float uh, float alpha) {
if (!(texture instanceof LibGDXTexture)) {
// TODO: Wrong rendering back-end ?
return;
@@ -241,7 +242,7 @@ public void drawTexture(UITextureRegion texture, Color color, ScaleMode mode, Re
}
@Override
- public void drawText(String text, Font font, HorizontalAlign hAlign, VerticalAlign vAlign, Rectanglei absoluteRegion, Color color, Color shadowColor, float alpha, boolean underlined) {
+ public void drawText(String text, Font font, HorizontalAlign hAlign, VerticalAlign vAlign, Rectanglei absoluteRegion, Colorc color, Colorc shadowColor, float alpha, boolean underlined) {
if (!(font instanceof LibGDXFont)) {
return;
}
@@ -283,7 +284,7 @@ public void drawText(String text, Font font, HorizontalAlign hAlign, VerticalAli
- vAlign.getOffset(Math.abs((int)gdxFont.getGlyphLayout().height), absoluteRegion.lengthY()));
Deque colorStack = new LinkedList();
- colorStack.push(color);
+ colorStack.push(new Color(color));
List> textSegments = new ArrayList<>();
StringBuilder currentSegment = new StringBuilder();
@@ -342,7 +343,7 @@ public void drawTextureBordered(UITextureRegion texture, Rectanglei absoluteRegi
Vector2i textureSize = new Vector2i(NUIMathUtil.ceilToInt(texture.getWidth() * uw), NUIMathUtil.ceilToInt(texture.getHeight() * uh));
// Draw texture without borders
- drawTexture(texture, Color.WHITE, tile ? ScaleMode.TILED : ScaleMode.STRETCH, absoluteRegion,
+ drawTexture(texture, Color.white, tile ? ScaleMode.TILED : ScaleMode.STRETCH, absoluteRegion,
ux + (float)border.getLeft() / textureSize.x, uy + (float)border.getTop() / textureSize.y,
uw - (float)border.getTotalWidth() / textureSize.x,
uh - (float)border.getTotalHeight() / textureSize.y, alpha);
@@ -350,23 +351,23 @@ public void drawTextureBordered(UITextureRegion texture, Rectanglei absoluteRegi
// Draw borders around texture
// Left border
- drawTexture(texture, Color.WHITE, tile ? ScaleMode.TILED : ScaleMode.STRETCH, RectUtility.createFromMinAndSize(absoluteRegion.minX, absoluteRegion.minY, border.getLeft(), absoluteRegion.lengthY()),
+ drawTexture(texture, Color.white, tile ? ScaleMode.TILED : ScaleMode.STRETCH, RectUtility.createFromMinAndSize(absoluteRegion.minX, absoluteRegion.minY, border.getLeft(), absoluteRegion.lengthY()),
ux, uy,(float)border.getLeft() / textureSize.x, uh, alpha);
// Right border
- drawTexture(texture, Color.WHITE, tile ? ScaleMode.TILED : ScaleMode.STRETCH, RectUtility.createFromMinAndSize(absoluteRegion.maxX - border.getRight(), absoluteRegion.minY, border.getRight(), absoluteRegion.lengthY()),
+ drawTexture(texture, Color.white, tile ? ScaleMode.TILED : ScaleMode.STRETCH, RectUtility.createFromMinAndSize(absoluteRegion.maxX - border.getRight(), absoluteRegion.minY, border.getRight(), absoluteRegion.lengthY()),
ux + uw - ((float)border.getRight() / textureSize.x), uy,
(float)border.getRight() / textureSize.x,
uh, alpha);
// Top border
- drawTexture(texture, Color.WHITE, tile ? ScaleMode.TILED : ScaleMode.STRETCH, RectUtility.createFromMinAndSize(absoluteRegion.minX, absoluteRegion.minY, absoluteRegion.lengthX(), border.getTop()),
+ drawTexture(texture, Color.white, tile ? ScaleMode.TILED : ScaleMode.STRETCH, RectUtility.createFromMinAndSize(absoluteRegion.minX, absoluteRegion.minY, absoluteRegion.lengthX(), border.getTop()),
ux, uy,
uw,
(float)border.getTop() / textureSize.y, alpha);
// Bottom border
- drawTexture(texture, Color.WHITE, tile ? ScaleMode.TILED : ScaleMode.STRETCH, RectUtility.createFromMinAndSize(absoluteRegion.minX, absoluteRegion.maxY - border.getBottom(), absoluteRegion.lengthX(), border.getBottom()),
+ drawTexture(texture, Color.white, tile ? ScaleMode.TILED : ScaleMode.STRETCH, RectUtility.createFromMinAndSize(absoluteRegion.minX, absoluteRegion.maxY - border.getBottom(), absoluteRegion.lengthX(), border.getBottom()),
ux, uy + uh - ((float)border.getBottom() / textureSize.y),
uw,
(float)border.getBottom() / textureSize.y, alpha);
diff --git a/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/LibGDXFont.java b/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/LibGDXFont.java
index 9dae00294b..a43e6dd657 100644
--- a/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/LibGDXFont.java
+++ b/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/LibGDXFont.java
@@ -17,8 +17,8 @@
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
-import org.terasology.assets.AssetData;
import org.joml.Vector2i;
+import org.terasology.gestalt.assets.AssetData;
import org.terasology.nui.asset.font.Font;
import java.util.List;
diff --git a/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/LibGDXKeyboardDevice.java b/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/LibGDXKeyboardDevice.java
index 841ee6b032..920e7b4c41 100644
--- a/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/LibGDXKeyboardDevice.java
+++ b/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/LibGDXKeyboardDevice.java
@@ -1,23 +1,10 @@
-/*
- * Copyright 2020 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.nui.backends.libgdx;
import com.badlogic.gdx.Gdx;
-import org.terasology.input.device.KeyboardAction;
-import org.terasology.input.device.KeyboardDevice;
+import org.terasology.nui.input.device.KeyboardAction;
+import org.terasology.nui.input.device.KeyboardDevice;
import java.util.Queue;
diff --git a/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/LibGDXMouseDevice.java b/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/LibGDXMouseDevice.java
index 9efac0c48e..2b18defc92 100644
--- a/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/LibGDXMouseDevice.java
+++ b/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/LibGDXMouseDevice.java
@@ -1,24 +1,11 @@
-/*
- * Copyright 2020 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.nui.backends.libgdx;
import com.badlogic.gdx.Gdx;
-import org.terasology.input.device.MouseAction;
-import org.terasology.input.device.MouseDevice;
import org.joml.Vector2i;
+import org.terasology.nui.input.device.MouseAction;
+import org.terasology.nui.input.device.MouseDevice;
import java.util.LinkedList;
import java.util.Queue;
@@ -27,7 +14,7 @@
* A MouseDevice implementation using LibGDX to obtain input.
*/
public class LibGDXMouseDevice implements MouseDevice {
- private LinkedList inputQueue = new LinkedList<>();
+ private final LinkedList inputQueue = new LinkedList<>();
public LibGDXMouseDevice() {
NUIInputProcessor.init();
@@ -42,7 +29,7 @@ public Queue getInputQueue() {
* @return The current position of the mouse in screen space
*/
@Override
- public Vector2i getMousePosition() {
+ public Vector2i getPosition() {
return GDXInputUtil.GDXToNuiMousePosition(Gdx.input.getX(), Gdx.input.getY());
}
diff --git a/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/LibGDXTexture.java b/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/LibGDXTexture.java
index 701e18350f..dfb4186211 100644
--- a/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/LibGDXTexture.java
+++ b/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/LibGDXTexture.java
@@ -16,10 +16,10 @@
package org.terasology.nui.backends.libgdx;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
-import org.terasology.assets.AssetData;
import org.joml.Rectanglef;
import org.joml.Rectanglei;
import org.joml.Vector2i;
+import org.terasology.gestalt.assets.AssetData;
import org.terasology.nui.UITextureRegion;
import org.terasology.nui.util.RectUtility;
diff --git a/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/NUIInputProcessor.java b/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/NUIInputProcessor.java
index 0f5bc52534..ac4be6c891 100644
--- a/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/NUIInputProcessor.java
+++ b/nui-libgdx/src/main/java/org/terasology/nui/backends/libgdx/NUIInputProcessor.java
@@ -1,38 +1,25 @@
-/*
- * Copyright 2020 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.nui.backends.libgdx;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.InputMultiplexer;
import com.badlogic.gdx.InputProcessor;
-import org.terasology.input.ButtonState;
-import org.terasology.input.InputType;
-import org.terasology.input.Keyboard;
-import org.terasology.input.device.KeyboardAction;
-import org.terasology.input.device.MouseAction;
+import org.terasology.nui.input.ButtonState;
+import org.terasology.nui.input.InputType;
+import org.terasology.nui.input.Keyboard;
+import org.terasology.nui.input.device.KeyboardAction;
+import org.terasology.nui.input.device.MouseAction;
import java.util.LinkedList;
import java.util.Queue;
public class NUIInputProcessor implements InputProcessor {
private Keyboard.Key lastKey;
- private Queue keyboardActionQueue = new LinkedList<>();
- private Queue mouseActionQueue = new LinkedList<>();
- private static NUIInputProcessor instance = new NUIInputProcessor();
+ private static final NUIInputProcessor instance = new NUIInputProcessor();
+ private final Queue keyboardActionQueue = new LinkedList<>();
+ private final Queue mouseActionQueue = new LinkedList<>();
public static boolean CONSUME_INPUT = false;
diff --git a/nui-reflect/build.gradle b/nui-reflect/build.gradle
index 00d35ccdbf..e0e1985c6b 100644
--- a/nui-reflect/build.gradle
+++ b/nui-reflect/build.gradle
@@ -10,8 +10,8 @@ dependencies {
implementation group: 'org.reflections', name: 'reflections', version: '0.9.10'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.6.2'
- implementation group: 'org.terasology', name: 'gestalt-module', version: '5.1.5'
- implementation group: 'org.terasology', name: 'gestalt-asset-core', version: '5.1.5'
+ implementation group: 'org.terasology.gestalt', name: 'gestalt-module', version: '7.0.3'
+ implementation group: 'org.terasology.gestalt', name: 'gestalt-asset-core', version: '7.0.3'
implementation group: 'com.google.guava', name: 'guava', version: '23.0'
api ('org.joml:joml') {
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/MappedContainer.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/MappedContainer.java
similarity index 50%
rename from nui-reflect/src/main/java/org/terasology/reflection/MappedContainer.java
rename to nui-reflect/src/main/java/org/terasology/nui/reflection/MappedContainer.java
index a925f0a71d..5b48dc2da7 100644
--- a/nui-reflect/src/main/java/org/terasology/reflection/MappedContainer.java
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/MappedContainer.java
@@ -1,22 +1,9 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
-package org.terasology.reflection;
+package org.terasology.nui.reflection;
-import org.terasology.module.sandbox.API;
+import org.terasology.gestalt.module.sandbox.API;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/ReflectionUtil.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/ReflectionUtil.java
similarity index 97%
rename from nui-reflect/src/main/java/org/terasology/reflection/ReflectionUtil.java
rename to nui-reflect/src/main/java/org/terasology/nui/reflection/ReflectionUtil.java
index 7ba4b13d6b..ac6998dddc 100644
--- a/nui-reflect/src/main/java/org/terasology/reflection/ReflectionUtil.java
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/ReflectionUtil.java
@@ -1,24 +1,10 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
-package org.terasology.reflection;
+package org.terasology.nui.reflection;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
import org.reflections.ReflectionUtils;
import java.lang.reflect.Array;
@@ -31,7 +17,6 @@
import java.lang.reflect.WildcardType;
import java.util.AbstractMap;
import java.util.Arrays;
-import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/TypeInfo.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/TypeInfo.java
similarity index 78%
rename from nui-reflect/src/main/java/org/terasology/reflection/TypeInfo.java
rename to nui-reflect/src/main/java/org/terasology/nui/reflection/TypeInfo.java
index f5a4a37ed8..e91ab18471 100644
--- a/nui-reflect/src/main/java/org/terasology/reflection/TypeInfo.java
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/TypeInfo.java
@@ -1,22 +1,8 @@
-/*
- * Copyright 2017 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection;
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection;
-import org.terasology.module.sandbox.API;
-import org.terasology.reflection.ReflectionUtil;
+import org.terasology.gestalt.module.sandbox.API;
import java.lang.reflect.Type;
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/TypeRegistry.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/TypeRegistry.java
similarity index 81%
rename from nui-reflect/src/main/java/org/terasology/reflection/TypeRegistry.java
rename to nui-reflect/src/main/java/org/terasology/nui/reflection/TypeRegistry.java
index bf507ea17a..f847022f42 100644
--- a/nui-reflect/src/main/java/org/terasology/reflection/TypeRegistry.java
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/TypeRegistry.java
@@ -1,19 +1,6 @@
-/*
- * Copyright 2019 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection;
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection;
import com.google.common.collect.Lists;
import org.reflections.ReflectionUtils;
@@ -22,10 +9,9 @@
import org.reflections.scanners.TypeAnnotationsScanner;
import org.reflections.util.ClasspathHelper;
import org.reflections.util.ConfigurationBuilder;
-import org.terasology.module.Module;
-import org.terasology.module.ModuleEnvironment;
-import org.terasology.module.sandbox.ModuleClassLoader;
-import org.terasology.reflection.ReflectionUtil;
+import org.terasology.gestalt.module.Module;
+import org.terasology.gestalt.module.ModuleEnvironment;
+import org.terasology.gestalt.module.sandbox.ModuleClassLoader;
import java.lang.annotation.Annotation;
import java.util.Collections;
@@ -33,7 +19,6 @@
import java.util.List;
import java.util.Optional;
import java.util.Set;
-import java.util.stream.Collectors;
public class TypeRegistry {
public static Set WHITELISTED_CLASSES = new HashSet<>();
@@ -118,11 +103,11 @@ private void initializeReflections(ClassLoader classLoader, ModuleEnvironment en
initializeReflections(classLoader);
for (Module module : environment.getModulesOrderedByDependencies()) {
- if (!module.isCodeModule()) {
+ if (module.getClasspaths().size() == 0) {
continue;
}
- reflections.merge(module.getReflectionsFragment());
+ reflections.merge(module.getModuleManifest());
}
}
diff --git a/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/CopyStrategy.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/CopyStrategy.java
new file mode 100644
index 0000000000..24e43b2deb
--- /dev/null
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/CopyStrategy.java
@@ -0,0 +1,19 @@
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection.copy;
+
+/**
+ * A strategy for copying an object/type.
+ * This may be returning the object unchanged for immutable or otherwise safe to share types.
+ * Copy strategies are deep-copies - contents should also be copied where appropriate.
+ */
+@FunctionalInterface
+public interface CopyStrategy {
+
+ /**
+ * @param value The value to copy
+ * @return A safe to use copy of the given value.
+ */
+ T copy(T value);
+
+}
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/copy/CopyStrategyLibrary.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/CopyStrategyLibrary.java
similarity index 82%
rename from nui-reflect/src/main/java/org/terasology/reflection/copy/CopyStrategyLibrary.java
rename to nui-reflect/src/main/java/org/terasology/nui/reflection/copy/CopyStrategyLibrary.java
index 702cc45b4e..3943b8b6a1 100644
--- a/nui-reflect/src/main/java/org/terasology/reflection/copy/CopyStrategyLibrary.java
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/CopyStrategyLibrary.java
@@ -1,33 +1,19 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection.copy;
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection.copy;
import com.google.common.collect.Maps;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.terasology.assets.ResourceUrn;
-import org.terasology.reflection.metadata.ClassMetadata;
-import org.terasology.reflection.metadata.DefaultClassMetadata;
-import org.terasology.reflection.MappedContainer;
-import org.terasology.reflection.copy.strategy.ListCopyStrategy;
-import org.terasology.reflection.copy.strategy.MapCopyStrategy;
-import org.terasology.reflection.copy.strategy.MappedContainerCopyStrategy;
-import org.terasology.reflection.copy.strategy.SetCopyStrategy;
-import org.terasology.reflection.reflect.ReflectFactory;
-import org.terasology.reflection.ReflectionUtil;
+import org.terasology.nui.reflection.metadata.ClassMetadata;
+import org.terasology.nui.reflection.metadata.DefaultClassMetadata;
+import org.terasology.nui.reflection.MappedContainer;
+import org.terasology.nui.reflection.copy.strategy.ListCopyStrategy;
+import org.terasology.nui.reflection.copy.strategy.MapCopyStrategy;
+import org.terasology.nui.reflection.copy.strategy.MappedContainerCopyStrategy;
+import org.terasology.nui.reflection.copy.strategy.SetCopyStrategy;
+import org.terasology.nui.reflection.reflect.ReflectFactory;
+import org.terasology.nui.reflection.ReflectionUtil;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
@@ -49,8 +35,8 @@ public class CopyStrategyLibrary {
private static final Logger logger = LoggerFactory.getLogger(CopyStrategyLibrary.class);
private Map, CopyStrategy>> strategies = Maps.newHashMap();
- private CopyStrategy> defaultStrategy = new ReturnAsIsStrategy<>();
- private ReflectFactory reflectFactory;
+ private final CopyStrategy> defaultStrategy = new ReturnAsIsStrategy<>();
+ private final ReflectFactory reflectFactory;
public CopyStrategyLibrary(ReflectFactory reflectFactory) {
this.reflectFactory = reflectFactory;
diff --git a/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/RegisterCopyStrategy.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/RegisterCopyStrategy.java
new file mode 100644
index 0000000000..dd15a7975b
--- /dev/null
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/RegisterCopyStrategy.java
@@ -0,0 +1,15 @@
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection.copy;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface RegisterCopyStrategy {
+}
diff --git a/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/ListCopyStrategy.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/ListCopyStrategy.java
new file mode 100644
index 0000000000..be9dbf20f6
--- /dev/null
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/ListCopyStrategy.java
@@ -0,0 +1,28 @@
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection.copy.strategy;
+
+import org.terasology.nui.reflection.copy.CopyStrategy;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ */
+public class ListCopyStrategy implements CopyStrategy> {
+
+ private final CopyStrategy contentStrategy;
+
+ public ListCopyStrategy(CopyStrategy contentStrategy) {
+ this.contentStrategy = contentStrategy;
+ }
+
+ @Override
+ public List copy(List value) {
+ if (value != null) {
+ return value.stream().map(contentStrategy::copy).collect(Collectors.toCollection(ArrayList::new));
+ }
+ return null;
+ }
+}
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/MapCopyStrategy.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/MapCopyStrategy.java
similarity index 53%
rename from nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/MapCopyStrategy.java
rename to nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/MapCopyStrategy.java
index cd987d2519..b2b1066353 100644
--- a/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/MapCopyStrategy.java
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/MapCopyStrategy.java
@@ -1,22 +1,9 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection.copy.strategy;
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection.copy.strategy;
import com.google.common.collect.Maps;
-import org.terasology.reflection.copy.CopyStrategy;
+import org.terasology.nui.reflection.copy.CopyStrategy;
import java.util.Map;
diff --git a/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/MappedContainerCopyStrategy.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/MappedContainerCopyStrategy.java
new file mode 100644
index 0000000000..fa76bbfb9c
--- /dev/null
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/MappedContainerCopyStrategy.java
@@ -0,0 +1,25 @@
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection.copy.strategy;
+
+import org.terasology.nui.reflection.metadata.ClassMetadata;
+import org.terasology.nui.reflection.copy.CopyStrategy;
+
+/**
+ */
+public class MappedContainerCopyStrategy implements CopyStrategy {
+
+ private final ClassMetadata classMetadata;
+
+ public MappedContainerCopyStrategy(ClassMetadata classMetadata) {
+ this.classMetadata = classMetadata;
+ }
+
+ @Override
+ public T copy(T value) {
+ if (value != null) {
+ return classMetadata.copy(value);
+ }
+ return null;
+ }
+}
diff --git a/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/Quat4fCopyStrategy.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/Quat4fCopyStrategy.java
new file mode 100644
index 0000000000..bf228e1787
--- /dev/null
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/Quat4fCopyStrategy.java
@@ -0,0 +1,21 @@
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection.copy.strategy;
+
+import org.joml.Quaternionf;
+import org.terasology.nui.reflection.copy.CopyStrategy;
+import org.terasology.nui.reflection.copy.RegisterCopyStrategy;
+
+/**
+ */
+@RegisterCopyStrategy
+public class Quat4fCopyStrategy implements CopyStrategy {
+
+ @Override
+ public Quaternionf copy(Quaternionf value) {
+ if (value != null) {
+ return new Quaternionf(value);
+ }
+ return null;
+ }
+}
diff --git a/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/SetCopyStrategy.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/SetCopyStrategy.java
new file mode 100644
index 0000000000..dc82fa116e
--- /dev/null
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/SetCopyStrategy.java
@@ -0,0 +1,27 @@
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection.copy.strategy;
+
+import org.terasology.nui.reflection.copy.CopyStrategy;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ */
+public class SetCopyStrategy implements CopyStrategy> {
+ private final CopyStrategy contentStrategy;
+
+ public SetCopyStrategy(CopyStrategy contentStrategy) {
+ this.contentStrategy = contentStrategy;
+ }
+
+ @Override
+ public Set copy(Set value) {
+ if (value != null) {
+ return value.stream().map(contentStrategy::copy).collect(Collectors.toCollection(HashSet::new));
+ }
+ return null;
+ }
+}
diff --git a/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/Vector2fCopyStrategy.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/Vector2fCopyStrategy.java
new file mode 100644
index 0000000000..f31900951a
--- /dev/null
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/Vector2fCopyStrategy.java
@@ -0,0 +1,21 @@
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection.copy.strategy;
+
+import org.joml.Vector2f;
+import org.terasology.nui.reflection.copy.CopyStrategy;
+import org.terasology.nui.reflection.copy.RegisterCopyStrategy;
+
+/**
+ */
+@RegisterCopyStrategy
+public class Vector2fCopyStrategy implements CopyStrategy {
+
+ @Override
+ public Vector2f copy(Vector2f value) {
+ if (value != null) {
+ return new Vector2f(value);
+ }
+ return null;
+ }
+}
diff --git a/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/Vector2iCopyStrategy.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/Vector2iCopyStrategy.java
new file mode 100644
index 0000000000..f2b9c7b870
--- /dev/null
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/Vector2iCopyStrategy.java
@@ -0,0 +1,17 @@
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection.copy.strategy;
+
+import org.terasology.nui.reflection.copy.CopyStrategy;
+import org.joml.Vector2i;
+import org.terasology.nui.reflection.copy.RegisterCopyStrategy;
+
+/**
+ */
+@RegisterCopyStrategy
+public class Vector2iCopyStrategy implements CopyStrategy {
+ @Override
+ public Vector2i copy(Vector2i value) {
+ return new Vector2i(value);
+ }
+}
diff --git a/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/Vector3fCopyStrategy.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/Vector3fCopyStrategy.java
new file mode 100644
index 0000000000..053ccdb860
--- /dev/null
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/Vector3fCopyStrategy.java
@@ -0,0 +1,21 @@
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection.copy.strategy;
+
+import org.joml.Vector3f;
+import org.terasology.nui.reflection.copy.CopyStrategy;
+import org.terasology.nui.reflection.copy.RegisterCopyStrategy;
+
+/**
+ */
+@RegisterCopyStrategy
+public class Vector3fCopyStrategy implements CopyStrategy {
+
+ @Override
+ public Vector3f copy(Vector3f value) {
+ if (value != null) {
+ return new Vector3f(value);
+ }
+ return null;
+ }
+}
diff --git a/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/Vector3iCopyStrategy.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/Vector3iCopyStrategy.java
new file mode 100644
index 0000000000..10e809cd48
--- /dev/null
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/Vector3iCopyStrategy.java
@@ -0,0 +1,21 @@
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection.copy.strategy;
+
+import org.joml.Vector3i;
+import org.terasology.nui.reflection.copy.CopyStrategy;
+import org.terasology.nui.reflection.copy.RegisterCopyStrategy;
+
+/**
+ */
+@RegisterCopyStrategy
+public class Vector3iCopyStrategy implements CopyStrategy {
+
+ @Override
+ public Vector3i copy(Vector3i value) {
+ if (value != null) {
+ return new Vector3i(value);
+ }
+ return null;
+ }
+}
diff --git a/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/Vector4fCopyStrategy.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/Vector4fCopyStrategy.java
new file mode 100644
index 0000000000..a0603c2ef2
--- /dev/null
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/copy/strategy/Vector4fCopyStrategy.java
@@ -0,0 +1,21 @@
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection.copy.strategy;
+
+import org.joml.Vector4f;
+import org.terasology.nui.reflection.copy.CopyStrategy;
+import org.terasology.nui.reflection.copy.RegisterCopyStrategy;
+
+/**
+ */
+@RegisterCopyStrategy
+public class Vector4fCopyStrategy implements CopyStrategy {
+
+ @Override
+ public Vector4f copy(Vector4f value) {
+ if (value != null) {
+ return new Vector4f(value);
+ }
+ return null;
+ }
+}
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/metadata/AbstractClassLibrary.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/metadata/AbstractClassLibrary.java
similarity index 84%
rename from nui-reflect/src/main/java/org/terasology/reflection/metadata/AbstractClassLibrary.java
rename to nui-reflect/src/main/java/org/terasology/nui/reflection/metadata/AbstractClassLibrary.java
index 494f0c021d..4e1b2cb440 100644
--- a/nui-reflect/src/main/java/org/terasology/reflection/metadata/AbstractClassLibrary.java
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/metadata/AbstractClassLibrary.java
@@ -1,20 +1,7 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
-package org.terasology.reflection.metadata;
+package org.terasology.nui.reflection.metadata;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Lists;
@@ -23,12 +10,12 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.terasology.assets.ResourceUrn;
-import org.terasology.module.Module;
-import org.terasology.module.ModuleEnvironment;
-import org.terasology.naming.Name;
-import org.terasology.reflection.copy.CopyStrategyLibrary;
-import org.terasology.reflection.reflect.ReflectFactory;
+import org.terasology.gestalt.assets.ResourceUrn;
+import org.terasology.gestalt.module.Module;
+import org.terasology.gestalt.module.ModuleEnvironment;
+import org.terasology.gestalt.naming.Name;
+import org.terasology.nui.reflection.copy.CopyStrategyLibrary;
+import org.terasology.nui.reflection.reflect.ReflectFactory;
import java.util.Iterator;
import java.util.List;
@@ -45,11 +32,11 @@ public abstract class AbstractClassLibrary implements ClassLibrary {
protected final CopyStrategyLibrary copyStrategyLibrary;
- private ReflectFactory reflectFactory;
+ private final ReflectFactory reflectFactory;
private ModuleEnvironment environment;
- private Map, ClassMetadata extends T, ?>> classLookup = Maps.newHashMap();
- private Table> uriLookup = HashBasedTable.create();
+ private final Map, ClassMetadata extends T, ?>> classLookup = Maps.newHashMap();
+ private final Table> uriLookup = HashBasedTable.create();
public AbstractClassLibrary(ModuleEnvironment environment, ReflectFactory reflectFactory, CopyStrategyLibrary copyStrategyLibrary) {
this.environment = environment;
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/metadata/ClassLibrary.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/metadata/ClassLibrary.java
similarity index 83%
rename from nui-reflect/src/main/java/org/terasology/reflection/metadata/ClassLibrary.java
rename to nui-reflect/src/main/java/org/terasology/nui/reflection/metadata/ClassLibrary.java
index 673fd437bf..da2b2c7f61 100644
--- a/nui-reflect/src/main/java/org/terasology/reflection/metadata/ClassLibrary.java
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/metadata/ClassLibrary.java
@@ -1,24 +1,11 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
-package org.terasology.reflection.metadata;
+package org.terasology.nui.reflection.metadata;
-import org.terasology.assets.ResourceUrn;
-import org.terasology.module.Module;
-import org.terasology.naming.Name;
+import org.terasology.gestalt.assets.ResourceUrn;
+import org.terasology.gestalt.module.Module;
+import org.terasology.gestalt.naming.Name;
import java.util.List;
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/metadata/ClassMetadata.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/metadata/ClassMetadata.java
similarity index 87%
rename from nui-reflect/src/main/java/org/terasology/reflection/metadata/ClassMetadata.java
rename to nui-reflect/src/main/java/org/terasology/nui/reflection/metadata/ClassMetadata.java
index 2bb2f68b1e..dd7dfa9d81 100644
--- a/nui-reflect/src/main/java/org/terasology/reflection/metadata/ClassMetadata.java
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/metadata/ClassMetadata.java
@@ -1,19 +1,6 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection.metadata;
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection.metadata;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
@@ -23,12 +10,12 @@
import org.reflections.ReflectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.terasology.assets.ResourceUrn;
-import org.terasology.reflection.copy.CopyStrategy;
-import org.terasology.reflection.copy.CopyStrategyLibrary;
-import org.terasology.reflection.reflect.InaccessibleFieldException;
-import org.terasology.reflection.reflect.ObjectConstructor;
-import org.terasology.reflection.reflect.ReflectFactory;
+import org.terasology.gestalt.assets.ResourceUrn;
+import org.terasology.nui.reflection.copy.CopyStrategy;
+import org.terasology.nui.reflection.copy.CopyStrategyLibrary;
+import org.terasology.nui.reflection.reflect.InaccessibleFieldException;
+import org.terasology.nui.reflection.reflect.ObjectConstructor;
+import org.terasology.nui.reflection.reflect.ReflectFactory;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
@@ -55,8 +42,8 @@ public abstract class ClassMetadata> {
private final ResourceUrn uri;
private final Class clazz;
private final ObjectConstructor constructor;
- private Map fields = Maps.newHashMap();
- private Map fieldsById = new HashMap<>();
+ private final Map fields = Maps.newHashMap();
+ private final Map fieldsById = new HashMap<>();
/**
* Creates a class metatdata
@@ -133,8 +120,18 @@ public Class getType() {
/**
* @param id The previously set id of the field
* @return The field identified by the given id, or null if there is no such field
+ * @deprecated use getField(byte) or change fieldsById to support a larger type if needed
*/
+ @Deprecated
public FIELD getField(int id) {
+ return getField((byte) id);
+ }
+
+ /**
+ * @param id The previously set id of the field
+ * @return The field identified by the given id, or null if there is no such field
+ */
+ public FIELD getField(byte id) {
return fieldsById.get(id);
}
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/metadata/DefaultClassLibrary.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/metadata/DefaultClassLibrary.java
similarity index 57%
rename from nui-reflect/src/main/java/org/terasology/reflection/metadata/DefaultClassLibrary.java
rename to nui-reflect/src/main/java/org/terasology/nui/reflection/metadata/DefaultClassLibrary.java
index f888d7136c..315621173b 100644
--- a/nui-reflect/src/main/java/org/terasology/reflection/metadata/DefaultClassLibrary.java
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/metadata/DefaultClassLibrary.java
@@ -1,26 +1,13 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection.metadata;
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection.metadata;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.terasology.assets.ResourceUrn;
-import org.terasology.module.ModuleEnvironment;
-import org.terasology.reflection.copy.CopyStrategyLibrary;
-import org.terasology.reflection.reflect.ReflectFactory;
+import org.terasology.gestalt.assets.ResourceUrn;
+import org.terasology.gestalt.module.ModuleEnvironment;
+import org.terasology.nui.reflection.copy.CopyStrategyLibrary;
+import org.terasology.nui.reflection.reflect.ReflectFactory;
/**
* A simple implementation of ClassLibrary. It provides ClassMetadata for a type of class. These classes are identified through their simple name.
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/metadata/DefaultClassMetadata.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/metadata/DefaultClassMetadata.java
similarity index 55%
rename from nui-reflect/src/main/java/org/terasology/reflection/metadata/DefaultClassMetadata.java
rename to nui-reflect/src/main/java/org/terasology/nui/reflection/metadata/DefaultClassMetadata.java
index 8b5efed95f..93fb7582ff 100644
--- a/nui-reflect/src/main/java/org/terasology/reflection/metadata/DefaultClassMetadata.java
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/metadata/DefaultClassMetadata.java
@@ -1,26 +1,13 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection.metadata;
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection.metadata;
import com.google.common.base.Predicates;
-import org.terasology.assets.ResourceUrn;
-import org.terasology.reflection.copy.CopyStrategy;
-import org.terasology.reflection.copy.CopyStrategyLibrary;
-import org.terasology.reflection.reflect.InaccessibleFieldException;
-import org.terasology.reflection.reflect.ReflectFactory;
+import org.terasology.gestalt.assets.ResourceUrn;
+import org.terasology.nui.reflection.copy.CopyStrategy;
+import org.terasology.nui.reflection.copy.CopyStrategyLibrary;
+import org.terasology.nui.reflection.reflect.InaccessibleFieldException;
+import org.terasology.nui.reflection.reflect.ReflectFactory;
import java.lang.reflect.Field;
@@ -40,7 +27,7 @@ public class DefaultClassMetadata extends ClassMetadata type, ReflectFactory factory, CopyStrategyLibrary copyStrategyLibrary) throws NoSuchMethodException {
- super(uri, type, factory, copyStrategyLibrary, Predicates.alwaysTrue());
+ super(uri, type, factory, copyStrategyLibrary, Predicates.alwaysTrue());
}
@Override
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/metadata/FieldMetadata.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/metadata/FieldMetadata.java
similarity index 86%
rename from nui-reflect/src/main/java/org/terasology/reflection/metadata/FieldMetadata.java
rename to nui-reflect/src/main/java/org/terasology/nui/reflection/metadata/FieldMetadata.java
index c3b263b532..ee02210d0f 100644
--- a/nui-reflect/src/main/java/org/terasology/reflection/metadata/FieldMetadata.java
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/metadata/FieldMetadata.java
@@ -1,27 +1,14 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection.metadata;
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection.metadata;
import com.google.common.base.Objects;
import com.google.gson.annotations.SerializedName;
-import org.terasology.reflection.copy.CopyStrategy;
-import org.terasology.reflection.reflect.FieldAccessor;
-import org.terasology.reflection.reflect.InaccessibleFieldException;
-import org.terasology.reflection.reflect.ReflectFactory;
-import org.terasology.reflection.ReflectionUtil;
+import org.terasology.nui.reflection.copy.CopyStrategy;
+import org.terasology.nui.reflection.reflect.FieldAccessor;
+import org.terasology.nui.reflection.reflect.InaccessibleFieldException;
+import org.terasology.nui.reflection.reflect.ReflectFactory;
+import org.terasology.nui.reflection.ReflectionUtil;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/metadata/package-info.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/metadata/package-info.java
similarity index 54%
rename from nui-reflect/src/main/java/org/terasology/reflection/metadata/package-info.java
rename to nui-reflect/src/main/java/org/terasology/nui/reflection/metadata/package-info.java
index 67c8b66ec4..f021707e5e 100644
--- a/nui-reflect/src/main/java/org/terasology/reflection/metadata/package-info.java
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/metadata/package-info.java
@@ -1,18 +1,5 @@
-/*
- * Copyright 2016 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
/**
* This package provides a low-level system for describing classes and fields, with support for construction and field access. Essentially it is a simplified reflection
@@ -28,6 +15,6 @@
* Additionally, ReflectFactory is used to provide support for construction and field access, to allow for alternate implementations.
*/
@API
-package org.terasology.reflection.metadata;
+package org.terasology.nui.reflection.metadata;
-import org.terasology.module.sandbox.API;
+import org.terasology.gestalt.module.sandbox.API;
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/package-info.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/package-info.java
similarity index 56%
rename from nui-reflect/src/main/java/org/terasology/reflection/package-info.java
rename to nui-reflect/src/main/java/org/terasology/nui/reflection/package-info.java
index d2ae379002..5b84c237ac 100644
--- a/nui-reflect/src/main/java/org/terasology/reflection/package-info.java
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/package-info.java
@@ -1,18 +1,5 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
/**
* This package provides a low-level system for describing classes and fields, with support for construction and field access. Essentially it is a simplified reflection
@@ -27,4 +14,4 @@
*
* Additionally, ReflectFactory is used to provide support for construction and field access, to allow for alternate implementations.
*/
-package org.terasology.reflection;
+package org.terasology.nui.reflection;
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/reflect/FieldAccessor.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/reflect/FieldAccessor.java
similarity index 54%
rename from nui-reflect/src/main/java/org/terasology/reflection/reflect/FieldAccessor.java
rename to nui-reflect/src/main/java/org/terasology/nui/reflection/reflect/FieldAccessor.java
index 7324aef8a6..2299729d46 100644
--- a/nui-reflect/src/main/java/org/terasology/reflection/reflect/FieldAccessor.java
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/reflect/FieldAccessor.java
@@ -1,19 +1,6 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection.reflect;
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection.reflect;
/**
* Provider get and set access to a field. Where possible this will use getter and setter methods (following the Java Bean standards), but otherwise it will
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/reflect/InaccessibleFieldException.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/reflect/InaccessibleFieldException.java
similarity index 51%
rename from nui-reflect/src/main/java/org/terasology/reflection/reflect/InaccessibleFieldException.java
rename to nui-reflect/src/main/java/org/terasology/nui/reflection/reflect/InaccessibleFieldException.java
index 461553eeac..0a20e09157 100644
--- a/nui-reflect/src/main/java/org/terasology/reflection/reflect/InaccessibleFieldException.java
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/reflect/InaccessibleFieldException.java
@@ -1,19 +1,6 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection.reflect;
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection.reflect;
/**
*/
diff --git a/nui-reflect/src/main/java/org/terasology/nui/reflection/reflect/ObjectConstructor.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/reflect/ObjectConstructor.java
new file mode 100644
index 0000000000..2670ac4c9d
--- /dev/null
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/reflect/ObjectConstructor.java
@@ -0,0 +1,19 @@
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection.reflect;
+
+/**
+ * Providers the ability to construct an instance of a type.
+ *
+ * These types must provide a default constructor, which will be invoked.
+ *
+ * @param The type of the class to construct instances of
+ */
+@FunctionalInterface
+public interface ObjectConstructor {
+
+ /**
+ * @return A new instance of the object type
+ */
+ T construct();
+}
diff --git a/nui-reflect/src/main/java/org/terasology/nui/reflection/reflect/ReflectFactory.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/reflect/ReflectFactory.java
new file mode 100644
index 0000000000..cd58339124
--- /dev/null
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/reflect/ReflectFactory.java
@@ -0,0 +1,18 @@
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection.reflect;
+
+import java.lang.reflect.Field;
+
+/**
+ * A factory providing reflection abilities, such as object construction and field access.
+ *
+ */
+public interface ReflectFactory {
+
+ ObjectConstructor createConstructor(Class type) throws NoSuchMethodException;
+
+ FieldAccessor createFieldAccessor(Class ownerType, Field field) throws InaccessibleFieldException;
+
+ FieldAccessor createFieldAccessor(Class ownerType, Field field, Class fieldType) throws InaccessibleFieldException;
+}
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/reflect/ReflectionReflectFactory.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/reflect/ReflectionReflectFactory.java
similarity index 81%
rename from nui-reflect/src/main/java/org/terasology/reflection/reflect/ReflectionReflectFactory.java
rename to nui-reflect/src/main/java/org/terasology/nui/reflection/reflect/ReflectionReflectFactory.java
index 0572fe5c4f..d7125146f2 100644
--- a/nui-reflect/src/main/java/org/terasology/reflection/reflect/ReflectionReflectFactory.java
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/reflect/ReflectionReflectFactory.java
@@ -1,23 +1,10 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection.reflect;
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection.reflect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.terasology.reflection.ReflectionUtil;
+import org.terasology.nui.reflection.ReflectionUtil;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
@@ -63,8 +50,8 @@ public FieldAccessor createFieldAccessor(Class ownerType, Field
* @param
*/
private static class ReflectionConstructor implements ObjectConstructor {
- private Class type;
- private Constructor constructor;
+ private final Class type;
+ private final Constructor constructor;
ReflectionConstructor(Class type) throws NoSuchMethodException {
this.type = type;
@@ -91,9 +78,9 @@ public T construct() {
*/
private static class ReflectionFieldAccessor implements FieldAccessor {
- private Field field;
- private Method getter;
- private Method setter;
+ private final Field field;
+ private final Method getter;
+ private final Method setter;
ReflectionFieldAccessor(Field field, Class fieldType) {
this.field = field;
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/reflect/internal/UnsafeAllocator.java b/nui-reflect/src/main/java/org/terasology/nui/reflection/reflect/internal/UnsafeAllocator.java
similarity index 81%
rename from nui-reflect/src/main/java/org/terasology/reflection/reflect/internal/UnsafeAllocator.java
rename to nui-reflect/src/main/java/org/terasology/nui/reflection/reflect/internal/UnsafeAllocator.java
index d4a58f5010..cd0ee8ae15 100644
--- a/nui-reflect/src/main/java/org/terasology/reflection/reflect/internal/UnsafeAllocator.java
+++ b/nui-reflect/src/main/java/org/terasology/nui/reflection/reflect/internal/UnsafeAllocator.java
@@ -1,22 +1,6 @@
-/*
- * Copyright (C) 2011 Google Inc.
- * Copyright 2018 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * com.google.gson.internal.UnsafeAllocator, Gson v2.6.2
- */
-package org.terasology.reflection.reflect.internal;
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
+package org.terasology.nui.reflection.reflect.internal;
import java.io.ObjectInputStream;
import java.io.ObjectStreamClass;
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/copy/CopyStrategy.java b/nui-reflect/src/main/java/org/terasology/reflection/copy/CopyStrategy.java
deleted file mode 100644
index b78ab77113..0000000000
--- a/nui-reflect/src/main/java/org/terasology/reflection/copy/CopyStrategy.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection.copy;
-
-/**
- * A strategy for copying an object/type.
- * This may be returning the object unchanged for immutable or otherwise safe to share types.
- * Copy strategies are deep-copies - contents should also be copied where appropriate.
- */
-@FunctionalInterface
-public interface CopyStrategy {
-
- /**
- * @param value The value to copy
- * @return A safe to use copy of the given value.
- */
- T copy(T value);
-
-}
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/copy/RegisterCopyStrategy.java b/nui-reflect/src/main/java/org/terasology/reflection/copy/RegisterCopyStrategy.java
deleted file mode 100644
index 03eb1e3296..0000000000
--- a/nui-reflect/src/main/java/org/terasology/reflection/copy/RegisterCopyStrategy.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2014 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection.copy;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface RegisterCopyStrategy {
-}
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/ListCopyStrategy.java b/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/ListCopyStrategy.java
deleted file mode 100644
index 03f21419bf..0000000000
--- a/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/ListCopyStrategy.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection.copy.strategy;
-
-import org.terasology.reflection.copy.CopyStrategy;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- */
-public class ListCopyStrategy implements CopyStrategy> {
-
- private final CopyStrategy contentStrategy;
-
- public ListCopyStrategy(CopyStrategy contentStrategy) {
- this.contentStrategy = contentStrategy;
- }
-
- @Override
- public List copy(List value) {
- if (value != null) {
- return value.stream().map(contentStrategy::copy).collect(Collectors.toCollection(ArrayList::new));
- }
- return null;
- }
-}
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/MappedContainerCopyStrategy.java b/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/MappedContainerCopyStrategy.java
deleted file mode 100644
index adcbbc88e3..0000000000
--- a/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/MappedContainerCopyStrategy.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection.copy.strategy;
-
-import org.terasology.reflection.metadata.ClassMetadata;
-import org.terasology.reflection.copy.CopyStrategy;
-
-/**
- */
-public class MappedContainerCopyStrategy implements CopyStrategy {
-
- private ClassMetadata classMetadata;
-
- public MappedContainerCopyStrategy(ClassMetadata classMetadata) {
- this.classMetadata = classMetadata;
- }
-
- @Override
- public T copy(T value) {
- if (value != null) {
- return classMetadata.copy(value);
- }
- return null;
- }
-}
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/Quat4fCopyStrategy.java b/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/Quat4fCopyStrategy.java
deleted file mode 100644
index 79b45733e1..0000000000
--- a/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/Quat4fCopyStrategy.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection.copy.strategy;
-
-import org.joml.Quaternionf;
-import org.terasology.reflection.copy.CopyStrategy;
-import org.terasology.reflection.copy.RegisterCopyStrategy;
-
-/**
- */
-@RegisterCopyStrategy
-public class Quat4fCopyStrategy implements CopyStrategy {
-
- @Override
- public Quaternionf copy(Quaternionf value) {
- if (value != null) {
- return new Quaternionf(value);
- }
- return null;
- }
-}
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/SetCopyStrategy.java b/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/SetCopyStrategy.java
deleted file mode 100644
index 9b2164d423..0000000000
--- a/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/SetCopyStrategy.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection.copy.strategy;
-
-import org.terasology.reflection.copy.CopyStrategy;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-/**
- */
-public class SetCopyStrategy implements CopyStrategy> {
- private final CopyStrategy contentStrategy;
-
- public SetCopyStrategy(CopyStrategy contentStrategy) {
- this.contentStrategy = contentStrategy;
- }
-
- @Override
- public Set copy(Set value) {
- if (value != null) {
- return value.stream().map(contentStrategy::copy).collect(Collectors.toCollection(HashSet::new));
- }
- return null;
- }
-}
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/Vector2fCopyStrategy.java b/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/Vector2fCopyStrategy.java
deleted file mode 100644
index 10091971fa..0000000000
--- a/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/Vector2fCopyStrategy.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection.copy.strategy;
-
-import org.joml.Vector2f;
-import org.terasology.reflection.copy.CopyStrategy;
-import org.terasology.reflection.copy.RegisterCopyStrategy;
-
-/**
- */
-@RegisterCopyStrategy
-public class Vector2fCopyStrategy implements CopyStrategy {
-
- @Override
- public Vector2f copy(Vector2f value) {
- if (value != null) {
- return new Vector2f(value);
- }
- return null;
- }
-}
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/Vector2iCopyStrategy.java b/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/Vector2iCopyStrategy.java
deleted file mode 100644
index 54dac92e82..0000000000
--- a/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/Vector2iCopyStrategy.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection.copy.strategy;
-
-import org.terasology.reflection.copy.CopyStrategy;
-import org.joml.Vector2i;
-import org.terasology.reflection.copy.RegisterCopyStrategy;
-
-/**
- */
-@RegisterCopyStrategy
-public class Vector2iCopyStrategy implements CopyStrategy {
- @Override
- public Vector2i copy(Vector2i value) {
- return new Vector2i(value);
- }
-}
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/Vector3fCopyStrategy.java b/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/Vector3fCopyStrategy.java
deleted file mode 100644
index 93980d81ff..0000000000
--- a/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/Vector3fCopyStrategy.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection.copy.strategy;
-
-import org.joml.Vector3f;
-import org.terasology.reflection.copy.CopyStrategy;
-import org.terasology.reflection.copy.RegisterCopyStrategy;
-
-/**
- */
-@RegisterCopyStrategy
-public class Vector3fCopyStrategy implements CopyStrategy {
-
- @Override
- public Vector3f copy(Vector3f value) {
- if (value != null) {
- return new Vector3f(value);
- }
- return null;
- }
-}
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/Vector3iCopyStrategy.java b/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/Vector3iCopyStrategy.java
deleted file mode 100644
index 1c45729330..0000000000
--- a/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/Vector3iCopyStrategy.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection.copy.strategy;
-
-import org.joml.Vector3i;
-import org.terasology.reflection.copy.CopyStrategy;
-import org.terasology.reflection.copy.RegisterCopyStrategy;
-
-/**
- */
-@RegisterCopyStrategy
-public class Vector3iCopyStrategy implements CopyStrategy {
-
- @Override
- public Vector3i copy(Vector3i value) {
- if (value != null) {
- return new Vector3i(value);
- }
- return null;
- }
-}
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/Vector4fCopyStrategy.java b/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/Vector4fCopyStrategy.java
deleted file mode 100644
index c489d0374b..0000000000
--- a/nui-reflect/src/main/java/org/terasology/reflection/copy/strategy/Vector4fCopyStrategy.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection.copy.strategy;
-
-import org.joml.Vector4f;
-import org.terasology.reflection.copy.CopyStrategy;
-import org.terasology.reflection.copy.RegisterCopyStrategy;
-
-/**
- */
-@RegisterCopyStrategy
-public class Vector4fCopyStrategy implements CopyStrategy {
-
- @Override
- public Vector4f copy(Vector4f value) {
- if (value != null) {
- return new Vector4f(value);
- }
- return null;
- }
-}
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/reflect/ObjectConstructor.java b/nui-reflect/src/main/java/org/terasology/reflection/reflect/ObjectConstructor.java
deleted file mode 100644
index 9b879189ef..0000000000
--- a/nui-reflect/src/main/java/org/terasology/reflection/reflect/ObjectConstructor.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection.reflect;
-
-/**
- * Providers the ability to construct an instance of a type.
- *
- * These types must provide a default constructor, which will be invoked.
- *
- * @param The type of the class to construct instances of
- */
-@FunctionalInterface
-public interface ObjectConstructor {
-
- /**
- * @return A new instance of the object type
- */
- T construct();
-}
diff --git a/nui-reflect/src/main/java/org/terasology/reflection/reflect/ReflectFactory.java b/nui-reflect/src/main/java/org/terasology/reflection/reflect/ReflectFactory.java
deleted file mode 100644
index 2702c6fc9b..0000000000
--- a/nui-reflect/src/main/java/org/terasology/reflection/reflect/ReflectFactory.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2013 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.terasology.reflection.reflect;
-
-import java.lang.reflect.Field;
-
-/**
- * A factory providing reflection abilities, such as object construction and field access.
- *
- */
-public interface ReflectFactory {
-
- ObjectConstructor createConstructor(Class type) throws NoSuchMethodException;
-
- FieldAccessor createFieldAccessor(Class ownerType, Field field) throws InaccessibleFieldException;
-
- FieldAccessor createFieldAccessor(Class ownerType, Field field, Class fieldType) throws InaccessibleFieldException;
-}
diff --git a/nui/build.gradle b/nui/build.gradle
index bfe9119388..d8d17bb746 100644
--- a/nui/build.gradle
+++ b/nui/build.gradle
@@ -6,8 +6,8 @@ plugins {
apply from: "$rootDir/gradle/common.gradle"
dependencies {
- api group: 'org.terasology', name: 'gestalt-module', version: '5.1.5'
- api group: 'org.terasology', name: 'gestalt-asset-core', version: '5.1.5'
+ api group: 'org.terasology.gestalt', name: 'gestalt-module', version: '7.0.3'
+ api group: 'org.terasology.gestalt', name: 'gestalt-asset-core', version: '7.0.3'
api group: 'org.abego.treelayout', name: 'org.abego.treelayout.core', version: '1.0.3'
api group: 'com.miglayout', name: 'miglayout-core', version: '5.0'
diff --git a/nui/src/main/java/org/terasology/nui/AbstractWidget.java b/nui/src/main/java/org/terasology/nui/AbstractWidget.java
index 1a23ca2dcb..738ad5bffb 100644
--- a/nui/src/main/java/org/terasology/nui/AbstractWidget.java
+++ b/nui/src/main/java/org/terasology/nui/AbstractWidget.java
@@ -1,33 +1,20 @@
-/*
- * Copyright 2016 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.nui;
import com.google.common.collect.Lists;
import org.joml.Vector2i;
-import org.terasology.nui.events.NUIBindButtonEvent;
-import org.terasology.input.ButtonState;
-import org.terasology.input.Input;
-import org.terasology.input.InputType;
-import org.terasology.input.MouseInput;
import org.terasology.nui.databinding.Binding;
import org.terasology.nui.databinding.DefaultBinding;
import org.terasology.nui.databinding.ReadOnlyBinding;
+import org.terasology.nui.events.NUIBindButtonEvent;
import org.terasology.nui.events.NUIKeyEvent;
import org.terasology.nui.events.NUIMouseButtonEvent;
import org.terasology.nui.events.NUIMouseWheelEvent;
+import org.terasology.nui.input.ButtonState;
+import org.terasology.nui.input.Input;
+import org.terasology.nui.input.InputType;
+import org.terasology.nui.input.MouseInput;
import org.terasology.nui.skin.UISkin;
import org.terasology.nui.widgets.UIDropdown;
import org.terasology.nui.widgets.UILabel;
@@ -278,7 +265,7 @@ public final void setTooltipDelay(float value) {
private static class TooltipLabelBinding extends ReadOnlyBinding {
- private UILabel tooltipLabel = new UILabel();
+ private final UILabel tooltipLabel = new UILabel();
TooltipLabelBinding(Binding stringBind) {
tooltipLabel.bindText(stringBind);
diff --git a/nui/src/main/java/org/terasology/nui/Canvas.java b/nui/src/main/java/org/terasology/nui/Canvas.java
index 88d58e81c9..a329b0b4f7 100644
--- a/nui/src/main/java/org/terasology/nui/Canvas.java
+++ b/nui/src/main/java/org/terasology/nui/Canvas.java
@@ -170,7 +170,7 @@ public interface Canvas {
* @param texture The texture to draw
* @param color
*/
- void drawTexture(UITextureRegion texture, Color color);
+ void drawTexture(UITextureRegion texture, Colorc color);
/**
* Draws a texture to the given region using the current style.
@@ -187,7 +187,7 @@ public interface Canvas {
* @param region The area to draw the texture in, in pixels
* @param color The color modifier for the texture
*/
- void drawTexture(UITextureRegion texture, Rectanglei region, Color color);
+ void drawTexture(UITextureRegion texture, Rectanglei region, Colorc color);
/**
* Draws the background of the current style, filling the entire canvas.
@@ -261,7 +261,7 @@ public interface Canvas {
* @param font The font to use to draw text
* @param color The color of to draw the text
*/
- void drawTextRaw(String text, Font font, Color color);
+ void drawTextRaw(String text, Font font, Colorc color);
/**
* Draws text without using the current style. Text may include new lines.
@@ -273,7 +273,7 @@ public interface Canvas {
* @param color The color of to draw the text
* @param region The region in which to draw the text
*/
- void drawTextRaw(String text, Font font, Color color, Rectanglei region);
+ void drawTextRaw(String text, Font font, Colorc color, Rectanglei region);
/**
* Draws text without using the current style, aligned within the drawWidth. Text may include new lines.
@@ -287,7 +287,7 @@ public interface Canvas {
* @param hAlign The horizontal alignment or justification of the text
* @param vAlign The vertical alignment of the text
*/
- void drawTextRaw(String text, Font font, Color color, Rectanglei region, HorizontalAlign hAlign, VerticalAlign vAlign);
+ void drawTextRaw(String text, Font font, Colorc color, Rectanglei region, HorizontalAlign hAlign, VerticalAlign vAlign);
/**
* Draws text without using the current style, aligned within the drawWidth. Text may include new lines.
@@ -302,7 +302,7 @@ public interface Canvas {
* @param hAlign The horizontal alignment or justification of the text
* @param vAlign The vertical alignment of the text
*/
- void drawTextRaw(String text, Font font, Color color, boolean underlined, Rectanglei region, HorizontalAlign hAlign, VerticalAlign vAlign);
+ void drawTextRaw(String text, Font font, Colorc color, boolean underlined, Rectanglei region, HorizontalAlign hAlign, VerticalAlign vAlign);
/**
* Draws shadowed text without using the current style. Text may include new lines. This text will always be left-aligned.
@@ -312,7 +312,7 @@ public interface Canvas {
* @param color The color of to draw the text
* @param shadowColor The color to draw the shadow
*/
- void drawTextRawShadowed(String text, Font font, Color color, Color shadowColor);
+ void drawTextRawShadowed(String text, Font font, Colorc color, Colorc shadowColor);
/**
* raws shadowed text without using the current style. Text may include new lines. Additionally new lines will be added to prevent any given line exceeding drawWidth.
@@ -324,7 +324,7 @@ public interface Canvas {
* @param shadowColor The color to draw the shadow
* @param region The region within which to draw this text. The text will be wrapped to new lines if it exceeds this width.
*/
- void drawTextRawShadowed(String text, Font font, Color color, Color shadowColor, Rectanglei region);
+ void drawTextRawShadowed(String text, Font font, Colorc color, Colorc shadowColor, Rectanglei region);
/**
* Draws shadowed text without using the current style. Text may include new lines. Additionally new lines will be added to prevent any given line exceeding drawWidth.
@@ -338,7 +338,7 @@ public interface Canvas {
* @param hAlign The horizontal alignment or justification of the text
* @param vAlign The vertical alignment of the text
*/
- void drawTextRawShadowed(String text, Font font, Color color, Color shadowColor, Rectanglei region, HorizontalAlign hAlign, VerticalAlign vAlign);
+ void drawTextRawShadowed(String text, Font font, Colorc color, Colorc shadowColor, Rectanglei region, HorizontalAlign hAlign, VerticalAlign vAlign);
/**
* Draws shadowed text without using the current style. Text may include new lines. Additionally new lines will be added to prevent any given line exceeding drawWidth.
@@ -353,7 +353,7 @@ public interface Canvas {
* @param hAlign The horizontal alignment or justification of the text
* @param vAlign The vertical alignment of the text
*/
- void drawTextRawShadowed(String text, Font font, Color color, Color shadowColor, boolean underline, Rectanglei region, HorizontalAlign hAlign, VerticalAlign vAlign);
+ void drawTextRawShadowed(String text, Font font, Colorc color, Colorc shadowColor, boolean underline, Rectanglei region, HorizontalAlign hAlign, VerticalAlign vAlign);
/**
* Draws a texture to the given area without using the current style. If the texture is a different size to the area, it will be adapted according to the ScaleMode.
@@ -372,7 +372,7 @@ public interface Canvas {
* @param color The color modifier for drawing the texture
* @param mode The method for adapting this texture to the region
*/
- void drawTextureRaw(UITextureRegion texture, Rectanglei region, Color color, ScaleMode mode);
+ void drawTextureRaw(UITextureRegion texture, Rectanglei region, Colorc color, ScaleMode mode);
/**
* Draws a sub-region of a texture to the given area. If the texture is a different size to the area, it will be adapted according to the ScaleMode.
@@ -412,7 +412,7 @@ public interface Canvas {
* @param uw The width of the sub-region of the texture to draw, relative to the texture size
* @param uh The height of the sub-region of the texture to draw, relative to the texture size
*/
- void drawTextureRaw(UITextureRegion texture, Rectanglei region, Color color, ScaleMode mode, float ux, float uy, float uw, float uh);
+ void drawTextureRaw(UITextureRegion texture, Rectanglei region, Colorc color, ScaleMode mode, float ux, float uy, float uw, float uh);
/**
* Draws a texture with a border - allows the drawing of a texture to a wider area without distorting the edge of the texture.
@@ -530,7 +530,7 @@ public interface Canvas {
*/
void addInteractionRegion(InteractionListener listener, String tooltip, Rectanglei region);
- void drawLine(int startX, int startY, int endX, int endY, Color color);
+ void drawLine(int startX, int startY, int endX, int endY, Colorc color);
- void drawFilledRectangle(Rectanglei region, Color color);
+ void drawFilledRectangle(Rectanglei region, Colorc color);
}
diff --git a/nui/src/main/java/org/terasology/nui/Color.java b/nui/src/main/java/org/terasology/nui/Color.java
index 9b23b2c5ea..30f266a3dc 100644
--- a/nui/src/main/java/org/terasology/nui/Color.java
+++ b/nui/src/main/java/org/terasology/nui/Color.java
@@ -21,7 +21,7 @@
import org.joml.Vector3ic;
import org.joml.Vector4fc;
import org.joml.Vector4ic;
-import org.terasology.module.sandbox.API;
+import org.terasology.gestalt.module.sandbox.API;
import java.nio.ByteBuffer;
import java.util.Locale;
diff --git a/nui/src/main/java/org/terasology/nui/FontColor.java b/nui/src/main/java/org/terasology/nui/FontColor.java
index f0292462a7..403b4e6905 100644
--- a/nui/src/main/java/org/terasology/nui/FontColor.java
+++ b/nui/src/main/java/org/terasology/nui/FontColor.java
@@ -16,23 +16,23 @@
package org.terasology.nui;
-import org.terasology.module.sandbox.API;
+import org.terasology.gestalt.module.sandbox.API;
import org.terasology.nui.Color;
/**
* Defines a set of special characters that manipulate the font color of a rendered text string.
* Use {@link #toChar(int, int, int)}# to get such a char and append it to the text string at the desired position.
* Use {@link #getReset()} to reset the color back to the default.
- *
- * Note: The resolution is only 4 bit per channel (not 8 as usual).
+ *
+ * Note: The resolution is only 4 bit per channel (not 8 as usual).
*/
@API
public final class FontColor {
private static final char FIRST_COLOR = 0xE000; // Unicode 6 specs: "Private Use Area: U+E000 -- U+F8FF"
- private static final char LAST_COLOR = 0xEFFF;
+ private static final char LAST_COLOR = 0xEFFF;
private static final char RESET_COLOR = 0xF000;
-
+
private FontColor() {
// avoid instantiation
}
@@ -44,60 +44,60 @@ private FontColor() {
public static boolean isValid(char ch) {
return (ch == RESET_COLOR) || (ch >= FIRST_COLOR && ch <= LAST_COLOR);
}
-
+
/**
* @param ch the character to convert
* @return the actual color
*/
public static Color toColor(char ch) {
-
+
int rgb = ch - FIRST_COLOR;
int r = (rgb >> 8) & 0xF;
int g = (rgb >> 4) & 0xF;
int b = (rgb >> 0) & 0xF;
-
+
return new Color(r << 4, g << 4, b << 4);
}
-
+
/**
* Stores the color with (4 + 4 + 4) = 12 bit accuracy as Unicode char
* @param color the color
* @return the unicode char
- * @deprecated use {@link FontColor#getColored(String, Color)} instead
+ * @deprecated use {@link FontColor#getColored(String, Colorc)} instead
*/
@Deprecated
- public static char toChar(org.terasology.nui.Color color) {
+ public static char toChar(Colorc color) {
return toChar(color.r(), color.g(), color.b());
}
-
+
/**
* Stores the color with (4 + 4 + 4) = 12 bit accuracy as Unicode char
* @param r red in [0..255]
* @param g green in [0..255]
* @param b blue in [0..255]
* @return the unicode char
- * @deprecated use {@link FontColor#getColored(String, Color)} instead
+ * @deprecated use {@link FontColor#getColored(String, Colorc)} instead
*/
@Deprecated
public static char toChar(int r, int g, int b) {
int rr = (r >> 4);
int rg = (g >> 4);
int rb = (b >> 4);
-
+
int ch = (rr << 8) | (rg << 4) | (rb << 0);
return (char) (FIRST_COLOR + ch);
}
-
+
/**
* Returns a string with encoded color information
* @param str the text
* @param color the color
* @return the encoded string
*/
- public static String getColored(String str, org.terasology.nui.Color color) {
+ public static String getColored(String str, Colorc color) {
return toChar(color) + str + getReset();
}
-
+
/**
* @return the color reset char
*/
@@ -110,16 +110,16 @@ public static char getReset() {
* @return the same text string, but without the color information
*/
public static String stripColor(String text) {
-
+
StringBuffer sb = new StringBuffer(text.length());
for (int i = 0; i < text.length(); i++) {
char c = text.charAt(i);
-
+
if (!isValid(c)) {
sb.append(c);
}
}
-
+
return sb.toString();
}
}
diff --git a/nui/src/main/java/org/terasology/nui/FontUnderline.java b/nui/src/main/java/org/terasology/nui/FontUnderline.java
index a42dd8cbf0..f9d4065291 100644
--- a/nui/src/main/java/org/terasology/nui/FontUnderline.java
+++ b/nui/src/main/java/org/terasology/nui/FontUnderline.java
@@ -16,7 +16,7 @@
package org.terasology.nui;
-import org.terasology.module.sandbox.API;
+import org.terasology.gestalt.module.sandbox.API;
/**
* Defines a set of special characters that mark contents of a string to be underlined
diff --git a/nui/src/main/java/org/terasology/nui/TabbingManager.java b/nui/src/main/java/org/terasology/nui/TabbingManager.java
index 89aafe5abd..07b8db2082 100644
--- a/nui/src/main/java/org/terasology/nui/TabbingManager.java
+++ b/nui/src/main/java/org/terasology/nui/TabbingManager.java
@@ -1,23 +1,10 @@
-/*
- * Copyright 2018 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.nui;
-import org.terasology.input.Input;
-import org.terasology.input.Keyboard;
+import org.terasology.nui.input.Input;
+import org.terasology.nui.input.Keyboard;
import java.util.ArrayList;
import java.util.Collections;
diff --git a/nui/src/main/java/org/terasology/nui/WidgetWithOrder.java b/nui/src/main/java/org/terasology/nui/WidgetWithOrder.java
index e830de9dc8..0ce7a895ab 100644
--- a/nui/src/main/java/org/terasology/nui/WidgetWithOrder.java
+++ b/nui/src/main/java/org/terasology/nui/WidgetWithOrder.java
@@ -1,23 +1,10 @@
-/*
- * Copyright 2018 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.nui;
-import org.terasology.input.Keyboard;
import org.terasology.nui.events.NUIKeyEvent;
+import org.terasology.nui.input.Keyboard;
import org.terasology.nui.layouts.ScrollableArea;
/**
diff --git a/nui/src/main/java/org/terasology/nui/asset/Sound.java b/nui/src/main/java/org/terasology/nui/asset/Sound.java
index 5729a3a6ef..b7a1411d11 100644
--- a/nui/src/main/java/org/terasology/nui/asset/Sound.java
+++ b/nui/src/main/java/org/terasology/nui/asset/Sound.java
@@ -18,7 +18,7 @@
package org.terasology.nui.asset;
-import org.terasology.module.sandbox.API;
+import org.terasology.gestalt.module.sandbox.API;
@API
public interface Sound {
diff --git a/nui/src/main/java/org/terasology/nui/asset/UIData.java b/nui/src/main/java/org/terasology/nui/asset/UIData.java
index 61624ff7c7..1406bddb97 100644
--- a/nui/src/main/java/org/terasology/nui/asset/UIData.java
+++ b/nui/src/main/java/org/terasology/nui/asset/UIData.java
@@ -15,9 +15,9 @@
*/
package org.terasology.nui.asset;
-import org.terasology.assets.AssetData;
-import org.terasology.assets.format.AssetDataFile;
-import org.terasology.module.sandbox.API;
+import org.terasology.gestalt.assets.AssetData;
+import org.terasology.gestalt.assets.format.AssetDataFile;
+import org.terasology.gestalt.module.sandbox.API;
import org.terasology.nui.UIWidget;
/**
diff --git a/nui/src/main/java/org/terasology/nui/asset/UIElement.java b/nui/src/main/java/org/terasology/nui/asset/UIElement.java
index 63a6170389..4359d5e59a 100644
--- a/nui/src/main/java/org/terasology/nui/asset/UIElement.java
+++ b/nui/src/main/java/org/terasology/nui/asset/UIElement.java
@@ -15,11 +15,11 @@
*/
package org.terasology.nui.asset;
-import org.terasology.assets.Asset;
-import org.terasology.assets.AssetType;
-import org.terasology.assets.ResourceUrn;
-import org.terasology.assets.format.AssetDataFile;
-import org.terasology.module.sandbox.API;
+import org.terasology.gestalt.assets.Asset;
+import org.terasology.gestalt.assets.AssetType;
+import org.terasology.gestalt.assets.ResourceUrn;
+import org.terasology.gestalt.assets.format.AssetDataFile;
+import org.terasology.gestalt.module.sandbox.API;
import org.terasology.nui.UIWidget;
import java.util.List;
diff --git a/nui/src/main/java/org/terasology/nui/asset/font/Font.java b/nui/src/main/java/org/terasology/nui/asset/font/Font.java
index c77cf304bd..cdccadd358 100644
--- a/nui/src/main/java/org/terasology/nui/asset/font/Font.java
+++ b/nui/src/main/java/org/terasology/nui/asset/font/Font.java
@@ -16,8 +16,8 @@
package org.terasology.nui.asset.font;
-import org.terasology.module.sandbox.API;
import org.joml.Vector2i;
+import org.terasology.gestalt.module.sandbox.API;
import java.util.List;
diff --git a/nui/src/main/java/org/terasology/nui/asset/font/FontCharacter.java b/nui/src/main/java/org/terasology/nui/asset/font/FontCharacter.java
index 967e1204b7..0a2ae77030 100644
--- a/nui/src/main/java/org/terasology/nui/asset/font/FontCharacter.java
+++ b/nui/src/main/java/org/terasology/nui/asset/font/FontCharacter.java
@@ -16,7 +16,7 @@
package org.terasology.nui.asset.font;
-import org.terasology.module.sandbox.API;
+import org.terasology.gestalt.module.sandbox.API;
import org.terasology.nui.UITextureRegion;
/**
diff --git a/nui/src/main/java/org/terasology/nui/canvas/CanvasControl.java b/nui/src/main/java/org/terasology/nui/canvas/CanvasControl.java
index 368e34cb82..4e34ce8ade 100644
--- a/nui/src/main/java/org/terasology/nui/canvas/CanvasControl.java
+++ b/nui/src/main/java/org/terasology/nui/canvas/CanvasControl.java
@@ -1,23 +1,10 @@
-/*
- * Copyright 2014 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.nui.canvas;
-import org.terasology.input.MouseInput;
import org.joml.Vector2i;
import org.terasology.nui.Canvas;
+import org.terasology.nui.input.MouseInput;
/**
*/
diff --git a/nui/src/main/java/org/terasology/nui/canvas/CanvasImpl.java b/nui/src/main/java/org/terasology/nui/canvas/CanvasImpl.java
index c7d00e0334..680e8bf5a7 100644
--- a/nui/src/main/java/org/terasology/nui/canvas/CanvasImpl.java
+++ b/nui/src/main/java/org/terasology/nui/canvas/CanvasImpl.java
@@ -1,53 +1,41 @@
-/*
- * Copyright 2014 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.nui.canvas;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Queues;
import com.google.common.collect.Sets;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.terasology.input.MouseInput;
-import org.terasology.input.device.KeyboardDevice;
-import org.terasology.input.device.MouseDevice;
-import org.terasology.nui.Border;
-import org.terasology.nui.util.NUIMathUtil;
import org.joml.Rectanglei;
import org.joml.Vector2i;
-import org.terasology.nui.FocusManager;
-import org.terasology.nui.asset.font.Font;
-import org.terasology.nui.UITextureRegion;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.terasology.nui.BaseInteractionListener;
+import org.terasology.nui.Border;
import org.terasology.nui.Color;
+import org.terasology.nui.Colorc;
+import org.terasology.nui.FocusManager;
import org.terasology.nui.HorizontalAlign;
import org.terasology.nui.InteractionListener;
import org.terasology.nui.ScaleMode;
import org.terasology.nui.SubRegion;
import org.terasology.nui.TabbingManager;
+import org.terasology.nui.UITextureRegion;
import org.terasology.nui.UIWidget;
import org.terasology.nui.VerticalAlign;
+import org.terasology.nui.asset.font.Font;
import org.terasology.nui.events.NUIMouseClickEvent;
import org.terasology.nui.events.NUIMouseDoubleClickEvent;
import org.terasology.nui.events.NUIMouseDragEvent;
import org.terasology.nui.events.NUIMouseOverEvent;
import org.terasology.nui.events.NUIMouseReleaseEvent;
import org.terasology.nui.events.NUIMouseWheelEvent;
+import org.terasology.nui.input.MouseInput;
+import org.terasology.nui.input.device.KeyboardDevice;
+import org.terasology.nui.input.device.MouseDevice;
import org.terasology.nui.skin.UISkin;
import org.terasology.nui.skin.UIStyle;
+import org.terasology.nui.util.NUIMathUtil;
import org.terasology.nui.util.RectUtility;
import org.terasology.nui.widgets.UILabel;
import org.terasology.nui.widgets.UITooltip;
@@ -477,7 +465,7 @@ public void drawTexture(UITextureRegion texture) {
}
@Override
- public void drawTexture(UITextureRegion texture, Color color) {
+ public void drawTexture(UITextureRegion texture, Colorc color) {
drawTexture(texture, state.getRelativeRegion(), color);
}
@@ -487,7 +475,7 @@ public void drawTexture(UITextureRegion texture, Rectanglei region) {
}
@Override
- public void drawTexture(UITextureRegion texture, Rectanglei region, Color color) {
+ public void drawTexture(UITextureRegion texture, Rectanglei region, Colorc color) {
drawTextureRaw(texture, region, color, getCurrentStyle().getTextureScaleMode());
}
@@ -560,42 +548,42 @@ public void drawBackground(Rectanglei region) {
}
@Override
- public void drawTextRaw(String text, Font font, Color color) {
- drawTextRawShadowed(text, font, color, Color.TRANSPARENT);
+ public void drawTextRaw(String text, Font font, Colorc color) {
+ drawTextRawShadowed(text, font, color, Color.transparent);
}
@Override
- public void drawTextRaw(String text, Font font, Color color, Rectanglei region) {
- drawTextRawShadowed(text, font, color, Color.TRANSPARENT, region);
+ public void drawTextRaw(String text, Font font, Colorc color, Rectanglei region) {
+ drawTextRawShadowed(text, font, color, Color.transparent, region);
}
@Override
- public void drawTextRaw(String text, Font font, Color color, Rectanglei region, HorizontalAlign hAlign, VerticalAlign vAlign) {
- drawTextRawShadowed(text, font, color, Color.TRANSPARENT, region, hAlign, vAlign);
+ public void drawTextRaw(String text, Font font, Colorc color, Rectanglei region, HorizontalAlign hAlign, VerticalAlign vAlign) {
+ drawTextRawShadowed(text, font, color, Color.transparent, region, hAlign, vAlign);
}
@Override
- public void drawTextRaw(String text, Font font, Color color, boolean underlined, Rectanglei region, HorizontalAlign hAlign, VerticalAlign vAlign) {
- drawTextRawShadowed(text, font, color, Color.TRANSPARENT, underlined, region, hAlign, vAlign);
+ public void drawTextRaw(String text, Font font, Colorc color, boolean underlined, Rectanglei region, HorizontalAlign hAlign, VerticalAlign vAlign) {
+ drawTextRawShadowed(text, font, color, Color.transparent, underlined, region, hAlign, vAlign);
}
@Override
- public void drawTextRawShadowed(String text, Font font, Color color, Color shadowColor) {
+ public void drawTextRawShadowed(String text, Font font, Colorc color, Colorc shadowColor) {
drawTextRawShadowed(text, font, color, shadowColor, state.drawRegion);
}
@Override
- public void drawTextRawShadowed(String text, Font font, Color color, Color shadowColor, Rectanglei region) {
+ public void drawTextRawShadowed(String text, Font font, Colorc color, Colorc shadowColor, Rectanglei region) {
drawTextRawShadowed(text, font, color, shadowColor, region, HorizontalAlign.LEFT, VerticalAlign.TOP);
}
@Override
- public void drawTextRawShadowed(String text, Font font, Color color, Color shadowColor, Rectanglei region, HorizontalAlign hAlign, VerticalAlign vAlign) {
+ public void drawTextRawShadowed(String text, Font font, Colorc color, Colorc shadowColor, Rectanglei region, HorizontalAlign hAlign, VerticalAlign vAlign) {
drawTextRawShadowed(text, font, color, shadowColor, false, region, hAlign, vAlign);
}
@Override
- public void drawTextRawShadowed(String text, Font font, Color color, Color shadowColor, boolean underline, Rectanglei region, HorizontalAlign hAlign, VerticalAlign vAlign) {
+ public void drawTextRawShadowed(String text, Font font, Colorc color, Colorc shadowColor, boolean underline, Rectanglei region, HorizontalAlign hAlign, VerticalAlign vAlign) {
Rectanglei absoluteRegion = relativeToAbsolute(region);
Rectanglei cropRegion = absoluteRegion.intersection(state.cropRegion, new Rectanglei());
if (cropRegion.isValid()) {
@@ -613,7 +601,7 @@ public void drawTextureRaw(UITextureRegion texture, Rectanglei region, ScaleMode
}
@Override
- public void drawTextureRaw(UITextureRegion texture, Rectanglei region, Color color, ScaleMode mode) {
+ public void drawTextureRaw(UITextureRegion texture, Rectanglei region, Colorc color, ScaleMode mode) {
drawTextureRaw(texture, region, color, mode, 0f, 0f, 1f, 1f);
}
@@ -630,7 +618,7 @@ public void drawTextureRaw(UITextureRegion texture, Rectanglei region, ScaleMode
}
@Override
- public void drawTextureRaw(UITextureRegion texture, Rectanglei region, Color color, ScaleMode mode, float ux, float uy, float uw, float uh) {
+ public void drawTextureRaw(UITextureRegion texture, Rectanglei region, Colorc color, ScaleMode mode, float ux, float uy, float uw, float uh) {
if (!state.cropRegion.intersectsRectangle(relativeToAbsolute(region))) {
return;
}
@@ -714,7 +702,7 @@ public void addInteractionRegion(InteractionListener listener, UIWidget tooltip,
}
@Override
- public void drawLine(int startX, int startY, int endX, int endY, Color color) {
+ public void drawLine(int startX, int startY, int endX, int endY, Colorc color) {
Line.LineCoordinates lc = Line.getLineCoordinates(startX, startY, endX, endY, state.drawRegion, state.cropRegion);
if (lc != null) {
@@ -727,7 +715,7 @@ public void drawLine(int startX, int startY, int endX, int endY, Color color) {
}
@Override
- public void drawFilledRectangle(Rectanglei region, Color color) {
+ public void drawFilledRectangle(Rectanglei region, Colorc color) {
drawTextureRaw(whiteTexture, region, color, ScaleMode.STRETCH);
}
@@ -792,7 +780,7 @@ public Rectanglei getRelativeRegion() {
protected class SubRegionImpl implements SubRegion {
public boolean croppingRegion;
- private CanvasState previousState;
+ private final CanvasState previousState;
private boolean disposed;
public SubRegionImpl(Rectanglei region, boolean crop) {
@@ -874,19 +862,19 @@ protected interface DrawOperation {
protected final class DrawTextureOperation implements DrawOperation {
- private Color color;
- private ScaleMode mode;
- private UITextureRegion texture;
- private Rectanglei absoluteRegion;
- private Rectanglei cropRegion;
- private float ux;
- private float uy;
- private float uw;
- private float uh;
- private float alpha;
-
- public DrawTextureOperation(UITextureRegion texture, Color color, ScaleMode mode, Rectanglei absoluteRegion,
- Rectanglei cropRegion, float ux, float uy, float uw, float uh, float alpha) {
+ private final Colorc color;
+ private final ScaleMode mode;
+ private final UITextureRegion texture;
+ private final Rectanglei absoluteRegion;
+ private final Rectanglei cropRegion;
+ private final float ux;
+ private final float uy;
+ private final float uw;
+ private final float uh;
+ private final float alpha;
+
+ public DrawTextureOperation(UITextureRegion texture, Colorc color, ScaleMode mode, Rectanglei absoluteRegion,
+ Rectanglei cropRegion, float ux, float uy, float uw, float uh, float alpha) {
this.color = color;
this.mode = mode;
this.texture = texture;
@@ -909,19 +897,21 @@ public void draw() {
protected final class DrawBorderedTextureOperation implements DrawOperation {
- private UITextureRegion texture;
- private Border border;
- private boolean tile;
- private Rectanglei absoluteRegion;
- private Rectanglei cropRegion;
- private float ux;
- private float uy;
- private float uw;
- private float uh;
- private float alpha;
-
- public DrawBorderedTextureOperation(UITextureRegion texture, Rectanglei absoluteRegion, Border border, boolean tile,
- Rectanglei cropRegion, float ux, float uy, float uw, float uh, float alpha) {
+ private final UITextureRegion texture;
+ private final Border border;
+ private final boolean tile;
+ private final Rectanglei absoluteRegion;
+ private final Rectanglei cropRegion;
+ private final float ux;
+ private final float uy;
+ private final float uw;
+ private final float uh;
+ private final float alpha;
+
+ public DrawBorderedTextureOperation(UITextureRegion texture, Rectanglei absoluteRegion, Border border,
+ boolean tile,
+ Rectanglei cropRegion, float ux, float uy, float uw, float uh,
+ float alpha) {
this.texture = texture;
this.tile = tile;
this.absoluteRegion = absoluteRegion;
@@ -944,13 +934,13 @@ public void draw() {
protected final class DrawLineOperation implements DrawOperation {
- private int x0;
- private int y0;
- private int x1;
- private int y1;
- private Color color;
+ private final int x0;
+ private final int y0;
+ private final int x1;
+ private final int y1;
+ private final Colorc color;
- public DrawLineOperation(int x0, int y0, int x1, int y1, Color color) {
+ public DrawLineOperation(int x0, int y0, int x1, int y1, Colorc color) {
this.x0 = x0;
this.y0 = y0;
this.x1 = x1;
@@ -971,13 +961,13 @@ protected final class DrawTextOperation implements DrawOperation {
private final HorizontalAlign hAlign;
private final VerticalAlign vAlign;
private final Rectanglei cropRegion;
- private final Color shadowColor;
- private final Color color;
+ private final Colorc shadowColor;
+ private final Colorc color;
private final float alpha;
private final boolean underline;
public DrawTextOperation(String text, Font font, HorizontalAlign hAlign, VerticalAlign vAlign, Rectanglei absoluteRegion, Rectanglei cropRegion,
- Color color, Color shadowColor, float alpha, boolean underline) {
+ Colorc color, Colorc shadowColor, float alpha, boolean underline) {
this.text = text;
this.font = font;
this.absoluteRegion = absoluteRegion;
diff --git a/nui/src/main/java/org/terasology/nui/canvas/CanvasRenderer.java b/nui/src/main/java/org/terasology/nui/canvas/CanvasRenderer.java
index 2abf5830bc..955bd00eb1 100644
--- a/nui/src/main/java/org/terasology/nui/canvas/CanvasRenderer.java
+++ b/nui/src/main/java/org/terasology/nui/canvas/CanvasRenderer.java
@@ -15,15 +15,15 @@
*/
package org.terasology.nui.canvas;
-import org.terasology.nui.Border;
import org.joml.Rectanglei;
import org.joml.Vector2i;
-import org.terasology.nui.UITextureRegion;
-import org.terasology.nui.asset.font.Font;
-import org.terasology.nui.Color;
+import org.terasology.nui.Border;
+import org.terasology.nui.Colorc;
import org.terasology.nui.HorizontalAlign;
import org.terasology.nui.ScaleMode;
+import org.terasology.nui.UITextureRegion;
import org.terasology.nui.VerticalAlign;
+import org.terasology.nui.asset.font.Font;
/**
*/
@@ -37,12 +37,12 @@ public interface CanvasRenderer {
void crop(Rectanglei cropRegion);
- void drawLine(int sx, int sy, int ex, int ey, Color color);
+ void drawLine(int sx, int sy, int ex, int ey, Colorc color);
- void drawTexture(UITextureRegion texture, Color color, ScaleMode mode, Rectanglei absoluteRegion, float ux, float uy, float uw, float uh, float alpha);
+ void drawTexture(UITextureRegion texture, Colorc color, ScaleMode mode, Rectanglei absoluteRegion, float ux, float uy, float uw, float uh, float alpha);
- void drawText(String text, Font font, HorizontalAlign hAlign, VerticalAlign vAlign, Rectanglei absoluteRegion, Color color,
- Color shadowColor, float alpha, boolean underlined);
+ void drawText(String text, Font font, HorizontalAlign hAlign, VerticalAlign vAlign, Rectanglei absoluteRegion, Colorc color,
+ Colorc shadowColor, float alpha, boolean underlined);
void drawTextureBordered(UITextureRegion texture, Rectanglei absoluteRegion, Border border, boolean tile, float ux, float uy, float uw, float uh, float alpha);
diff --git a/nui/src/main/java/org/terasology/nui/databinding/BindHelper.java b/nui/src/main/java/org/terasology/nui/databinding/BindHelper.java
index 5f60fcc54f..15d3ca8d5b 100644
--- a/nui/src/main/java/org/terasology/nui/databinding/BindHelper.java
+++ b/nui/src/main/java/org/terasology/nui/databinding/BindHelper.java
@@ -1,23 +1,10 @@
-/*
- * Copyright 2014 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.nui.databinding;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.terasology.reflection.ReflectionUtil;
+import org.terasology.nui.reflection.ReflectionUtil;
import java.lang.reflect.Method;
import java.util.List;
diff --git a/nui/src/main/java/org/terasology/nui/databinding/package-info.java b/nui/src/main/java/org/terasology/nui/databinding/package-info.java
index 01333858f5..a8f8bf28a6 100644
--- a/nui/src/main/java/org/terasology/nui/databinding/package-info.java
+++ b/nui/src/main/java/org/terasology/nui/databinding/package-info.java
@@ -19,4 +19,4 @@
*/
@API package org.terasology.nui.databinding;
-import org.terasology.module.sandbox.API;
+import org.terasology.gestalt.module.sandbox.API;
diff --git a/nui/src/main/java/org/terasology/nui/events/NUIBindButtonEvent.java b/nui/src/main/java/org/terasology/nui/events/NUIBindButtonEvent.java
index b6fabb0b45..589930ce0a 100644
--- a/nui/src/main/java/org/terasology/nui/events/NUIBindButtonEvent.java
+++ b/nui/src/main/java/org/terasology/nui/events/NUIBindButtonEvent.java
@@ -1,34 +1,23 @@
-/*
- * Copyright 2020 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.nui.events;
-import org.terasology.assets.ResourceUrn;
-import org.terasology.input.ButtonState;
-import org.terasology.input.device.KeyboardDevice;
-import org.terasology.input.device.MouseDevice;
+import org.terasology.gestalt.assets.ResourceUrn;
+import org.terasology.nui.input.ButtonState;
+import org.terasology.nui.input.device.KeyboardDevice;
+import org.terasology.nui.input.device.MouseDevice;
/**
+ *
*/
public class NUIBindButtonEvent extends NUIInputEvent {
- private ResourceUrn id;
- private ButtonState state;
+ private final ResourceUrn id;
+ private final ButtonState state;
- public NUIBindButtonEvent(MouseDevice mouseDevice, KeyboardDevice keyboardDevice, ResourceUrn buttonId, ButtonState newState) {
+ public NUIBindButtonEvent(MouseDevice mouseDevice, KeyboardDevice keyboardDevice, ResourceUrn buttonId,
+ ButtonState newState) {
super(mouseDevice, keyboardDevice);
this.id = buttonId;
diff --git a/nui/src/main/java/org/terasology/nui/events/NUIInputEvent.java b/nui/src/main/java/org/terasology/nui/events/NUIInputEvent.java
index a784e681f3..0233a166e8 100644
--- a/nui/src/main/java/org/terasology/nui/events/NUIInputEvent.java
+++ b/nui/src/main/java/org/terasology/nui/events/NUIInputEvent.java
@@ -1,32 +1,18 @@
-/*
- * Copyright 2015 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.nui.events;
-import org.terasology.input.device.KeyboardDevice;
-import org.terasology.input.device.MouseDevice;
+import org.terasology.nui.input.device.KeyboardDevice;
+import org.terasology.nui.input.device.MouseDevice;
/**
- * The NUIManager has it's own event classes, so that it is independent from the entity event system.
- * The event class contains all the information needed to process the event. It is abstract as each event type
- * should have it's own class so that it is later on possible to add fields to a certain event without breaking
- * signatures.
+ * The NUIManager has it's own event classes, so that it is independent from the entity event system. The event class
+ * contains all the information needed to process the event. It is abstract as each event type should have it's own
+ * class so that it is later on possible to add fields to a certain event without breaking signatures.
*/
public abstract class NUIInputEvent {
- private MouseDevice mouse;
- private KeyboardDevice keyboard;
+ private final MouseDevice mouse;
+ private final KeyboardDevice keyboard;
private boolean consumed;
public NUIInputEvent(MouseDevice mouse, KeyboardDevice keyboard) {
diff --git a/nui/src/main/java/org/terasology/nui/events/NUIKeyEvent.java b/nui/src/main/java/org/terasology/nui/events/NUIKeyEvent.java
index 5ba9630c55..b396cbd5af 100644
--- a/nui/src/main/java/org/terasology/nui/events/NUIKeyEvent.java
+++ b/nui/src/main/java/org/terasology/nui/events/NUIKeyEvent.java
@@ -1,32 +1,19 @@
-/*
- * Copyright 2015 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.nui.events;
-import org.terasology.input.ButtonState;
-import org.terasology.input.Input;
-import org.terasology.input.device.KeyboardDevice;
-import org.terasology.input.device.MouseDevice;
+import org.terasology.nui.input.ButtonState;
+import org.terasology.nui.input.Input;
+import org.terasology.nui.input.device.KeyboardDevice;
+import org.terasology.nui.input.device.MouseDevice;
/**
* See {@link NUIInputEvent}
*/
public class NUIKeyEvent extends NUIInputEvent {
- private Input key;
- private char keyCharacter;
- private ButtonState state;
+ private final Input key;
+ private final char keyCharacter;
+ private final ButtonState state;
public NUIKeyEvent(MouseDevice mouse, KeyboardDevice keyboard, Input key, char keyChar, ButtonState state) {
super(mouse, keyboard);
diff --git a/nui/src/main/java/org/terasology/nui/events/NUIMouseButtonEvent.java b/nui/src/main/java/org/terasology/nui/events/NUIMouseButtonEvent.java
index ef53ed82e5..283d80f661 100644
--- a/nui/src/main/java/org/terasology/nui/events/NUIMouseButtonEvent.java
+++ b/nui/src/main/java/org/terasology/nui/events/NUIMouseButtonEvent.java
@@ -1,28 +1,15 @@
-/*
- * Copyright 2020 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.nui.events;
-import org.terasology.input.ButtonState;
-import org.terasology.input.MouseInput;
import org.joml.Vector2i;
+import org.terasology.nui.input.ButtonState;
+import org.terasology.nui.input.MouseInput;
public class NUIMouseButtonEvent extends NUIMouseEvent {
private MouseInput button;
- private ButtonState state;
- private Vector2i mousePosition = new Vector2i();
+ private final ButtonState state;
+ private final Vector2i mousePosition = new Vector2i();
public NUIMouseButtonEvent(MouseInput button, ButtonState state, Vector2i mousePosition) {
super(null, null, mousePosition);
diff --git a/nui/src/main/java/org/terasology/nui/events/NUIMouseClickEvent.java b/nui/src/main/java/org/terasology/nui/events/NUIMouseClickEvent.java
index b27a7f7012..69d9cf39fb 100644
--- a/nui/src/main/java/org/terasology/nui/events/NUIMouseClickEvent.java
+++ b/nui/src/main/java/org/terasology/nui/events/NUIMouseClickEvent.java
@@ -1,24 +1,11 @@
-/*
- * Copyright 2015 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.nui.events;
-import org.terasology.input.MouseInput;
-import org.terasology.input.device.KeyboardDevice;
-import org.terasology.input.device.MouseDevice;
import org.joml.Vector2i;
+import org.terasology.nui.input.MouseInput;
+import org.terasology.nui.input.device.KeyboardDevice;
+import org.terasology.nui.input.device.MouseDevice;
/**
* See {@link NUIInputEvent}
diff --git a/nui/src/main/java/org/terasology/nui/events/NUIMouseDoubleClickEvent.java b/nui/src/main/java/org/terasology/nui/events/NUIMouseDoubleClickEvent.java
index e177f0e243..5a0f91add3 100644
--- a/nui/src/main/java/org/terasology/nui/events/NUIMouseDoubleClickEvent.java
+++ b/nui/src/main/java/org/terasology/nui/events/NUIMouseDoubleClickEvent.java
@@ -1,24 +1,11 @@
-/*
- * Copyright 2015 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.nui.events;
-import org.terasology.input.MouseInput;
-import org.terasology.input.device.KeyboardDevice;
-import org.terasology.input.device.MouseDevice;
import org.joml.Vector2i;
+import org.terasology.nui.input.MouseInput;
+import org.terasology.nui.input.device.KeyboardDevice;
+import org.terasology.nui.input.device.MouseDevice;
/**
* See {@link NUIInputEvent}
diff --git a/nui/src/main/java/org/terasology/nui/events/NUIMouseDragEvent.java b/nui/src/main/java/org/terasology/nui/events/NUIMouseDragEvent.java
index bda1e61273..e146389a6f 100644
--- a/nui/src/main/java/org/terasology/nui/events/NUIMouseDragEvent.java
+++ b/nui/src/main/java/org/terasology/nui/events/NUIMouseDragEvent.java
@@ -1,23 +1,10 @@
-/*
- * Copyright 2015 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.nui.events;
-import org.terasology.input.device.KeyboardDevice;
-import org.terasology.input.device.MouseDevice;
import org.joml.Vector2i;
+import org.terasology.nui.input.device.KeyboardDevice;
+import org.terasology.nui.input.device.MouseDevice;
/**
* See {@link NUIInputEvent}
diff --git a/nui/src/main/java/org/terasology/nui/events/NUIMouseEvent.java b/nui/src/main/java/org/terasology/nui/events/NUIMouseEvent.java
index 924be442db..e79d4e83f3 100644
--- a/nui/src/main/java/org/terasology/nui/events/NUIMouseEvent.java
+++ b/nui/src/main/java/org/terasology/nui/events/NUIMouseEvent.java
@@ -1,23 +1,10 @@
-/*
- * Copyright 2015 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.nui.events;
-import org.terasology.input.device.KeyboardDevice;
-import org.terasology.input.device.MouseDevice;
import org.joml.Vector2i;
+import org.terasology.nui.input.device.KeyboardDevice;
+import org.terasology.nui.input.device.MouseDevice;
/**
@@ -25,7 +12,7 @@
* See also: {@link NUIInputEvent}
*/
public abstract class NUIMouseEvent extends NUIInputEvent {
- private Vector2i relativeMousePosition;
+ private final Vector2i relativeMousePosition;
public NUIMouseEvent(MouseDevice mouse, KeyboardDevice keyboard, Vector2i relativeMousePosition) {
super(mouse, keyboard);
diff --git a/nui/src/main/java/org/terasology/nui/events/NUIMouseOverEvent.java b/nui/src/main/java/org/terasology/nui/events/NUIMouseOverEvent.java
index 13a3263a86..0017612a21 100644
--- a/nui/src/main/java/org/terasology/nui/events/NUIMouseOverEvent.java
+++ b/nui/src/main/java/org/terasology/nui/events/NUIMouseOverEvent.java
@@ -1,29 +1,16 @@
-/*
- * Copyright 2015 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.nui.events;
-import org.terasology.input.device.KeyboardDevice;
-import org.terasology.input.device.MouseDevice;
import org.joml.Vector2i;
+import org.terasology.nui.input.device.KeyboardDevice;
+import org.terasology.nui.input.device.MouseDevice;
/**
* See {@link NUIMouseEvent}
*/
public final class NUIMouseOverEvent extends NUIMouseEvent {
- private boolean topMostElement;
+ private final boolean topMostElement;
public NUIMouseOverEvent(MouseDevice mouse, KeyboardDevice keyboard, Vector2i relativeMousePosition,
boolean topMostElement) {
diff --git a/nui/src/main/java/org/terasology/nui/events/NUIMouseReleaseEvent.java b/nui/src/main/java/org/terasology/nui/events/NUIMouseReleaseEvent.java
index 1d94aecde4..1d83ce3b5a 100644
--- a/nui/src/main/java/org/terasology/nui/events/NUIMouseReleaseEvent.java
+++ b/nui/src/main/java/org/terasology/nui/events/NUIMouseReleaseEvent.java
@@ -1,24 +1,11 @@
-/*
- * Copyright 2015 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.nui.events;
-import org.terasology.input.MouseInput;
-import org.terasology.input.device.KeyboardDevice;
-import org.terasology.input.device.MouseDevice;
import org.joml.Vector2i;
+import org.terasology.nui.input.MouseInput;
+import org.terasology.nui.input.device.KeyboardDevice;
+import org.terasology.nui.input.device.MouseDevice;
/**
* See {@link NUIInputEvent}
diff --git a/nui/src/main/java/org/terasology/nui/events/NUIMouseWheelEvent.java b/nui/src/main/java/org/terasology/nui/events/NUIMouseWheelEvent.java
index 3d4f8c5786..1435a20c84 100644
--- a/nui/src/main/java/org/terasology/nui/events/NUIMouseWheelEvent.java
+++ b/nui/src/main/java/org/terasology/nui/events/NUIMouseWheelEvent.java
@@ -1,23 +1,10 @@
-/*
- * Copyright 2015 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.nui.events;
-import org.terasology.input.device.KeyboardDevice;
-import org.terasology.input.device.MouseDevice;
import org.joml.Vector2i;
+import org.terasology.nui.input.device.KeyboardDevice;
+import org.terasology.nui.input.device.MouseDevice;
/**
* See {@link NUIInputEvent}
diff --git a/nui/src/main/java/org/terasology/nui/events/package-info.java b/nui/src/main/java/org/terasology/nui/events/package-info.java
index f2d3373b41..94d15eb770 100644
--- a/nui/src/main/java/org/terasology/nui/events/package-info.java
+++ b/nui/src/main/java/org/terasology/nui/events/package-info.java
@@ -19,4 +19,4 @@
*/
@API package org.terasology.nui.events;
-import org.terasology.module.sandbox.API;
+import org.terasology.gestalt.module.sandbox.API;
diff --git a/nui/src/main/java/org/terasology/nui/itemRendering/package-info.java b/nui/src/main/java/org/terasology/nui/itemRendering/package-info.java
index 61dbd06c85..d101678c13 100644
--- a/nui/src/main/java/org/terasology/nui/itemRendering/package-info.java
+++ b/nui/src/main/java/org/terasology/nui/itemRendering/package-info.java
@@ -19,4 +19,4 @@
*/
@API package org.terasology.nui.itemRendering;
-import org.terasology.module.sandbox.API;
+import org.terasology.gestalt.module.sandbox.API;
diff --git a/nui/src/main/java/org/terasology/nui/layouts/ZoomableLayout.java b/nui/src/main/java/org/terasology/nui/layouts/ZoomableLayout.java
index 8cecee0998..241c538004 100644
--- a/nui/src/main/java/org/terasology/nui/layouts/ZoomableLayout.java
+++ b/nui/src/main/java/org/terasology/nui/layouts/ZoomableLayout.java
@@ -1,26 +1,11 @@
-/*
- * Copyright 2017 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.nui.layouts;
import com.google.common.collect.Lists;
-import org.terasology.input.Keyboard;
import org.joml.Rectanglei;
-import org.terasology.nui.util.NUIMathUtil;
-import org.joml.Vector2i;
import org.joml.Vector2f;
+import org.joml.Vector2i;
import org.terasology.nui.BaseInteractionListener;
import org.terasology.nui.Canvas;
import org.terasology.nui.CoreLayout;
@@ -31,6 +16,8 @@
import org.terasology.nui.events.NUIMouseDragEvent;
import org.terasology.nui.events.NUIMouseOverEvent;
import org.terasology.nui.events.NUIMouseWheelEvent;
+import org.terasology.nui.input.Keyboard;
+import org.terasology.nui.util.NUIMathUtil;
import java.util.Iterator;
import java.util.List;
@@ -41,7 +28,7 @@
*
*/
public class ZoomableLayout extends CoreLayout {
- private List widgets = Lists.newArrayList();
+ private final List widgets = Lists.newArrayList();
private Vector2f pixelSize;
private Vector2i screenSize;
private Vector2f windowPosition = new Vector2f();
@@ -49,7 +36,7 @@ public class ZoomableLayout extends CoreLayout {
private Vector2i last;
- private InteractionListener dragListener = new BaseInteractionListener() {
+ private final InteractionListener dragListener = new BaseInteractionListener() {
@Override
public void onMouseOver(NUIMouseOverEvent event) {
last = new Vector2i(event.getRelativeMousePosition());
@@ -174,7 +161,7 @@ public List getWidgets() {
@Override
public Iterator iterator() {
return new Iterator() {
- private Iterator delegate = widgets.iterator();
+ private final Iterator delegate = widgets.iterator();
@Override
public boolean hasNext() {
diff --git a/nui/src/main/java/org/terasology/nui/layouts/miglayout/package-info.java b/nui/src/main/java/org/terasology/nui/layouts/miglayout/package-info.java
index e4aa54987b..23252eff8e 100644
--- a/nui/src/main/java/org/terasology/nui/layouts/miglayout/package-info.java
+++ b/nui/src/main/java/org/terasology/nui/layouts/miglayout/package-info.java
@@ -16,4 +16,4 @@
@API package org.terasology.nui.layouts.miglayout;
-import org.terasology.module.sandbox.API;
+import org.terasology.gestalt.module.sandbox.API;
diff --git a/nui/src/main/java/org/terasology/nui/layouts/package-info.java b/nui/src/main/java/org/terasology/nui/layouts/package-info.java
index 3cf15db306..4ba3b8a321 100644
--- a/nui/src/main/java/org/terasology/nui/layouts/package-info.java
+++ b/nui/src/main/java/org/terasology/nui/layouts/package-info.java
@@ -19,4 +19,4 @@
*/
@API package org.terasology.nui.layouts;
-import org.terasology.module.sandbox.API;
+import org.terasology.gestalt.module.sandbox.API;
diff --git a/nui/src/main/java/org/terasology/nui/layouts/relative/package-info.java b/nui/src/main/java/org/terasology/nui/layouts/relative/package-info.java
index a68c137683..d27fd48e5c 100644
--- a/nui/src/main/java/org/terasology/nui/layouts/relative/package-info.java
+++ b/nui/src/main/java/org/terasology/nui/layouts/relative/package-info.java
@@ -19,4 +19,4 @@
*/
@API package org.terasology.nui.layouts.relative;
-import org.terasology.module.sandbox.API;
+import org.terasology.gestalt.module.sandbox.API;
diff --git a/nui/src/main/java/org/terasology/nui/package-info.java b/nui/src/main/java/org/terasology/nui/package-info.java
index ddebfe9021..94456830d4 100644
--- a/nui/src/main/java/org/terasology/nui/package-info.java
+++ b/nui/src/main/java/org/terasology/nui/package-info.java
@@ -29,4 +29,4 @@
*/
@API package org.terasology.nui;
-import org.terasology.module.sandbox.API;
+import org.terasology.gestalt.module.sandbox.API;
diff --git a/nui/src/main/java/org/terasology/nui/properties/Checkbox.java b/nui/src/main/java/org/terasology/nui/properties/Checkbox.java
index 47a95d62fa..24af23429c 100644
--- a/nui/src/main/java/org/terasology/nui/properties/Checkbox.java
+++ b/nui/src/main/java/org/terasology/nui/properties/Checkbox.java
@@ -15,7 +15,7 @@
*/
package org.terasology.nui.properties;
-import org.terasology.module.sandbox.API;
+import org.terasology.gestalt.module.sandbox.API;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/nui/src/main/java/org/terasology/nui/properties/OneOf.java b/nui/src/main/java/org/terasology/nui/properties/OneOf.java
index aa6ecc9817..987ed63171 100644
--- a/nui/src/main/java/org/terasology/nui/properties/OneOf.java
+++ b/nui/src/main/java/org/terasology/nui/properties/OneOf.java
@@ -15,7 +15,7 @@
*/
package org.terasology.nui.properties;
-import org.terasology.module.sandbox.API;
+import org.terasology.gestalt.module.sandbox.API;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/nui/src/main/java/org/terasology/nui/properties/OneOfProviderFactory.java b/nui/src/main/java/org/terasology/nui/properties/OneOfProviderFactory.java
index e4b4ed75c5..ce5be714d3 100644
--- a/nui/src/main/java/org/terasology/nui/properties/OneOfProviderFactory.java
+++ b/nui/src/main/java/org/terasology/nui/properties/OneOfProviderFactory.java
@@ -16,7 +16,7 @@
package org.terasology.nui.properties;
import com.google.common.collect.Maps;
-import org.terasology.module.sandbox.API;
+import org.terasology.gestalt.module.sandbox.API;
import org.terasology.nui.databinding.Binding;
import org.terasology.nui.itemRendering.ItemRenderer;
diff --git a/nui/src/main/java/org/terasology/nui/properties/PropertyProvider.java b/nui/src/main/java/org/terasology/nui/properties/PropertyProvider.java
index 0fac5c9b65..ece103004e 100644
--- a/nui/src/main/java/org/terasology/nui/properties/PropertyProvider.java
+++ b/nui/src/main/java/org/terasology/nui/properties/PropertyProvider.java
@@ -1,25 +1,12 @@
-/*
- * Copyright 2014 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.nui.properties;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-import org.terasology.assets.ResourceUrn;
import org.joml.Vector3f;
+import org.terasology.gestalt.assets.ResourceUrn;
import org.terasology.nui.databinding.Binding;
import org.terasology.nui.databinding.DefaultBinding;
import org.terasology.nui.itemRendering.ItemRenderer;
@@ -27,11 +14,11 @@
import org.terasology.nui.widgets.UIDropdown;
import org.terasology.nui.widgets.UISlider;
import org.terasology.nui.widgets.UITextEntry;
-import org.terasology.reflection.copy.CopyStrategyLibrary;
-import org.terasology.reflection.metadata.ClassMetadata;
-import org.terasology.reflection.metadata.DefaultClassMetadata;
-import org.terasology.reflection.metadata.FieldMetadata;
-import org.terasology.reflection.reflect.ReflectFactory;
+import org.terasology.nui.reflection.copy.CopyStrategyLibrary;
+import org.terasology.nui.reflection.metadata.ClassMetadata;
+import org.terasology.nui.reflection.metadata.DefaultClassMetadata;
+import org.terasology.nui.reflection.metadata.FieldMetadata;
+import org.terasology.nui.reflection.reflect.ReflectFactory;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
@@ -280,7 +267,7 @@ private interface TextMapper extends UITextEntry.Formatter, UITextEntry.Pa
}
private class TextBinding implements Binding {
- private FieldMetadata