Package org.terasology.rendering.nui.layouts

Examples of org.terasology.rendering.nui.layouts.ScrollableArea


        }
    };

    @Override
    public void initialise() {
        final ScrollableArea scrollArea = find("scrollArea", ScrollableArea.class);
        scrollArea.moveToBottom();

        commandLine = find("commandLine", UIText.class);
        getManager().setFocus(commandLine);

        commandLine.subscribe(new ActivateEventListener() {
            @Override
            public void onActivated(UIWidget widget) {
                String text = commandLine.getText();

                if (!text.isEmpty()) {
                    String command = "say";
                    List<String> params = Collections.singletonList(text);
   
                    // TODO: move command execution to separate class
                    console.execute(command, params, localPlayer.getClientEntity());
                    commandLine.setText("");
                    scrollArea.moveToBottom();
                }
            }
        });

        final UILabel history = find("messageHistory", UILabel.class);
View Full Code Here


        }
    };

    @Override
    public void initialise() {
        final ScrollableArea scrollArea = find("scrollArea", ScrollableArea.class);
        scrollArea.moveToBottom();

        List<CommandInfo> commands = console.getCommandList();
       
        // JAVA8: replace with lamba expression
        Collection<String> commandNames = Collections2.transform(commands, new Function<CommandInfo, String>() {

            @Override
            public String apply(CommandInfo input) {
                return input.getName();
            }
        });

        commandLine = find("commandLine", UICommandEntry.class);
        getManager().setFocus(commandLine);
        commandLine.setTabCompletionEngine(new CyclingTabCompletionEngine(console, commandNames));
        commandLine.bindCommandHistory(new ReadOnlyBinding<List<String>>() {
            @Override
            public List<String> get() {
                return console.getPreviousCommands();
            }
        });
        commandLine.subscribe(new ActivateEventListener() {
            @Override
            public void onActivated(UIWidget widget) {
                console.execute(commandLine.getText(), localPlayer.getClientEntity());
                commandLine.setText("");
                scrollArea.moveToBottom();
            }
        });

        final UIText history = find("messageHistory", UIText.class);
        history.bindText(new ReadOnlyBinding<String>() {
View Full Code Here

        for (InputCategory category : inputCategories.values()) {
            addInputSection(category, mainLayout, inputsById);
        }
        mainLayout.addWidget(new UISpace(new Vector2i(1, 16)));

        ScrollableArea area = new ScrollableArea();
        area.setContent(mainLayout);
        //area.setContentHeight(mainLayout.getRowCount() * 32);

        ColumnLayout footerGrid = new ColumnLayout("footer");
        footerGrid.setFamily("menu-options");
        footerGrid.setColumns(2);
View Full Code Here

TOP

Related Classes of org.terasology.rendering.nui.layouts.ScrollableArea

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.