Package org.terasology.rendering.nui.widgets

Examples of org.terasology.rendering.nui.widgets.UILabel


                    scrollArea.moveToBottom();
                }
            }
        });

        final UILabel history = find("messageHistory", UILabel.class);
        history.bindText(new ReadOnlyBinding<String>() {
            @Override
            public String get() {
                StringBuilder messageList = new StringBuilder();
                for (Message msg : console.getMessages(CoreMessageType.CHAT, CoreMessageType.NOTIFICATION)) {
                    messageList.append(msg.getMessage());
View Full Code Here


    }

    @Override
    public void setTooltip(String value) {
        if (value != null && !value.isEmpty()) {
            setTooltip(new UILabel(value));
        } else {
            tooltip = new DefaultBinding<>(null);
        }
    }
View Full Code Here

    public void initialise() {
        WidgetUtil.trySubscribe(this, "ok", defaultCloseAction);
    }

    public void setMessage(String title, String message) {
        UILabel titleLabel = find("title", UILabel.class);
        if (titleLabel != null) {
            titleLabel.setText(title);
        }

        UILabel messageLabel = find("message", UILabel.class);
        if (messageLabel != null) {
            messageLabel.setText(message);
        }
    }
View Full Code Here

                }
            });

            final ListSelectionBinding<ServerInfo> infoBinding = new ListSelectionBinding<ServerInfo>(serverList);

            UILabel name = find("name", UILabel.class);
            name.bindText(BindHelper.bindBoundBeanProperty("name", infoBinding, ServerInfo.class, String.class));

            UILabel address = find("address", UILabel.class);
            address.bindText(BindHelper.bindBoundBeanProperty("address", infoBinding, ServerInfo.class, String.class));

            UILabel port = find("port", UILabel.class);
            port.bindText(new IntToStringBinding(BindHelper.bindBoundBeanProperty("port", infoBinding, ServerInfo.class, int.class)));

            WidgetUtil.trySubscribe(this, "add", new ActivateEventListener() {
                @Override
                public void onActivated(UIWidget button) {
                    getManager().pushScreen(AddServerPopup.ASSET_URI);
View Full Code Here

     */
    public void addPropertyProvider(String groupLabel, final PropertyProvider<?> propertyProvider) {
        if (propertyProvider.getProperties().size() > 0) {
            final UIButton expand = new UIButton("", "-");
            expand.setTooltip("Click to collapse");
            final UILabel headline = new UILabel(groupLabel);
            final MigLayout layout = new MigLayout();
            layout.setColConstraints("[min][fill]");
            layout.setRowConstraints("[min]");

            expand.subscribe(new ActivateEventListener() {
View Full Code Here

    private void expand(PropertyProvider<?> propertyProvider, MigLayout layout) {
        List<Property<?, ?>> props = Lists.newArrayList(propertyProvider.getProperties());
        Collections.sort(props, propertyComparator);
        for (Property<?, ?> property : props) {
            UILabel label = property.getLabel();
            UIWidget editor = property.getEditor();
            editor.setTooltip(property.getDescription());

            layout.addWidget(label, new CCHint("newline"));
            layout.addWidget(editor, new CCHint());
View Full Code Here

                    }
                    return null;
                }
            };

            UILabel name = find("name", UILabel.class);
            if (name != null) {
                name.bindText(new ReadOnlyBinding<String>() {
                    @Override
                    public String get() {
                        if (moduleInfoBinding.get() != null) {
                            return moduleInfoBinding.get().getDisplayName().toString();
                        }
                        return "";
                    }
                });
            }

            UILabel version = find("version", UILabel.class);
            if (version != null) {
                version.bindText(new ReadOnlyBinding<String>() {
                    @Override
                    public String get() {
                        if (moduleInfoBinding.get() != null) {
                            return moduleInfoBinding.get().getVersion().toString();
                        }
                        return "";
                    }
                });
            }

            UILabel description = find("description", UILabel.class);
            if (description != null) {
                description.bindText(new ReadOnlyBinding<String>() {
                    @Override
                    public String get() {
                        if (moduleInfoBinding.get() != null) {
                            return moduleInfoBinding.get().getDescription().toString();
                        }
                        return "";
                    }
                });
            }

            UILabel error = find("errorMessage", UILabel.class);
            if (error != null) {
                error.bindText(new ReadOnlyBinding<String>() {
                    @Override
                    public String get() {
                        if (moduleList.getSelection() != null) {
                            if (!moduleList.getSelection().isValidToSelect()) {
                                return "Incompatible with existing selection, or dependencies cannot be resolved";
View Full Code Here

            public String getString(Module value) {
                return value.getMetadata().getDisplayName().value();
            }
        });

        UILabel gameplayDescription = find("gameplayDescription", UILabel.class);
        gameplayDescription.bindText(new ReadOnlyBinding<String>() {
            @Override
            public String get() {
                Module selectedModule = gameplay.getSelection();
                if (selectedModule != null) {
                    return selectedModule.getMetadata().getDescription().value();
View Full Code Here

        addInteractionRegion(listener, tooltip, getCurrentStyle().getMargin().grow(applyStyleToSize(getRegion())));
    }

    @Override
    public void addInteractionRegion(InteractionListener listener, String tooltip, Rect2i region) {
        UIWidget tooltipLabelWidget = (tooltip == null || tooltip.isEmpty()) ? null : new UILabel(tooltip);
        addInteractionRegion(listener, tooltipLabelWidget, region);
    }
View Full Code Here

        Preconditions.checkArgument(editor != null, "editor must not be null");
       
        this.binding = binding;
        this.editor = editor;
        this.description = description;
        this.label = new UILabel("", labelText);
    }
View Full Code Here

TOP

Related Classes of org.terasology.rendering.nui.widgets.UILabel

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.