Add Items Tree search filter
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
[0.1.5]
|
||||
- Add Items Tree search filter
|
||||
|
||||
[0.1.4]
|
||||
- Update libGDX to 1.12.1
|
||||
- Update VisUI to 1.5.3
|
||||
|
||||
+1
-1
Submodule hyperlap2d-common-api updated: 953ccaaada...1c02946af9
@@ -1,21 +1,3 @@
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* * Copyright 2015 See AUTHORS file.
|
||||
* *
|
||||
* * 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 games.rednblack.editor.view.ui;
|
||||
|
||||
import com.kotcrab.vis.ui.widget.VisTable;
|
||||
@@ -94,7 +76,7 @@ public class UIMainTable extends VisTable {
|
||||
//TreeView
|
||||
UIItemsTreeBoxMediator uiItemsTreeBoxMediator = facade.retrieveMediator(UIItemsTreeBoxMediator.NAME);
|
||||
UIItemsTreeBox itemsBox = uiItemsTreeBoxMediator.getViewComponent();
|
||||
leftBoxesPanel.add(itemsBox).fillX().maxHeight(620).top();
|
||||
leftBoxesPanel.add(itemsBox).fillX().maxHeight(660).top();
|
||||
middleTable.add(leftBoxesPanel).top().left().expand().padTop(15).padLeft(16);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* * Copyright 2015 See AUTHORS file.
|
||||
* *
|
||||
* * 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 games.rednblack.editor.view.ui.box;
|
||||
|
||||
import com.artemis.ComponentMapper;
|
||||
@@ -68,6 +50,8 @@ public class UIItemsTreeBox extends UICollapsibleBox {
|
||||
private final ZIndexComparator zIndexComparator = new ZIndexComparator();
|
||||
private final Vector2 tmp = new Vector2();
|
||||
|
||||
public String searchString = "";
|
||||
|
||||
public UIItemsTreeBox() {
|
||||
super("Items Tree", 190);
|
||||
setMovable(false);
|
||||
@@ -107,6 +91,14 @@ public class UIItemsTreeBox extends UICollapsibleBox {
|
||||
sandbox.getEngine().inject(this);
|
||||
|
||||
treeTable.clear();
|
||||
VisTextField searchField = StandardWidgetsFactory.createTextField();
|
||||
searchField.setMessageText("Search items...");
|
||||
searchField.setTextFieldListener((textField, c) -> {
|
||||
searchString = textField.getText();
|
||||
facade.sendNotification(MsgAPI.UPDATE_TREE_ITEMS_FILTER);
|
||||
});
|
||||
treeTable.add(searchField).growX().padTop(5).colspan(2).padRight(6).row();
|
||||
|
||||
tree = new VisTree<>();
|
||||
scroller = StandardWidgetsFactory.createScrollPane(tree);
|
||||
scroller.setFlickScroll(false);
|
||||
@@ -152,12 +144,21 @@ public class UIItemsTreeBox extends UICollapsibleBox {
|
||||
setSelection(lastSelection);
|
||||
}
|
||||
|
||||
private UIItemsTreeNode addTreeRoot(int entity, UIItemsTreeNode parentNode) { // was like this addTreeRoot(CompositeItem compoiteItem, Node parentNode)
|
||||
private UIItemsTreeNode addTreeRoot(int entity, UIItemsTreeNode parentNode) {
|
||||
MainItemComponent mainItemComponent = mainItemComponentMapper.get(entity);
|
||||
if (parentNode != null && parentNode == rootNode) {
|
||||
if (mainItemComponent.itemIdentifier.isEmpty()) {
|
||||
if (!EntityUtils.itemTypeNameMap.get(mainItemComponent.entityType).toLowerCase().contains(searchString))
|
||||
return null;
|
||||
} else if (!mainItemComponent.itemIdentifier.toLowerCase().contains(searchString)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
UIItemsTreeNode node = addTreeNode(entity, parentNode);
|
||||
if (parentNode == null) rootNode = node;
|
||||
|
||||
NodeComponent nodeComponent = nodeComponentMapper.get(entity);
|
||||
MainItemComponent mainItemComponent = mainItemComponentMapper.get(entity);
|
||||
|
||||
if(nodeComponent != null) {
|
||||
for (int item : nodeComponent.children) {
|
||||
|
||||
@@ -42,7 +42,7 @@ public class UIItemsTreeBoxMediator extends PanelMediator<UIItemsTreeBox> {
|
||||
MsgAPI.ACTION_CAMERA_CHANGE_COMPOSITE,
|
||||
MsgAPI.ITEM_DATA_UPDATED,
|
||||
LayerJumpCommand.DONE);
|
||||
interests.add(LayerSwapCommand.DONE);
|
||||
interests.add(LayerSwapCommand.DONE, MsgAPI.UPDATE_TREE_ITEMS_FILTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,6 +62,7 @@ public class UIItemsTreeBoxMediator extends PanelMediator<UIItemsTreeBox> {
|
||||
case MsgAPI.ACTION_Z_INDEX_CHANGED:
|
||||
case MsgAPI.NEW_ITEM_ADDED:
|
||||
case MsgAPI.DELETE_ITEMS_COMMAND_DONE:
|
||||
case MsgAPI.UPDATE_TREE_ITEMS_FILTER:
|
||||
case DeleteResourceCommand.DONE:
|
||||
case LayerJumpCommand.DONE:
|
||||
case LayerSwapCommand.DONE:
|
||||
|
||||
+4
-25
@@ -1,21 +1,3 @@
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* * Copyright 2015 See AUTHORS file.
|
||||
* *
|
||||
* * 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 games.rednblack.editor.view.ui.box.resourcespanel;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
@@ -58,13 +40,10 @@ public abstract class UIResourcesTab extends ImageTab {
|
||||
protected VisTextField createTextField() {
|
||||
VisTextField visTextField = StandardWidgetsFactory.createTextField();
|
||||
visTextField.setMessageText(getTabTitle());
|
||||
visTextField.setTextFieldListener(new VisTextField.TextFieldListener() {
|
||||
@Override
|
||||
public void keyTyped(VisTextField textField, char c) {
|
||||
searchString = textField.getText();
|
||||
Facade facade = Facade.getInstance();
|
||||
facade.sendNotification(MsgAPI.UPDATE_RESOURCES_LIST);
|
||||
}
|
||||
visTextField.setTextFieldListener((textField, c) -> {
|
||||
searchString = textField.getText();
|
||||
Facade facade = Facade.getInstance();
|
||||
facade.sendNotification(MsgAPI.UPDATE_RESOURCES_LIST);
|
||||
});
|
||||
return visTextField;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user