Package org.gwtoolbox.widget.client.label

Examples of org.gwtoolbox.widget.client.label.BasicLabel


public class BasicLabelSamplePane extends Composite implements SamplePanel {

    public BasicLabelSamplePane() {
        VerticalPanel labels = new VerticalPanel();

        BasicLabel label = createLabel("Simple", null);
        labels.add(label);
        labels.setCellHeight(label, "30px");

        addGap(labels, "10px");

        label = createLabel("Click Me", null);
        label.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                DefaultNotifier.getInstance().showInfo("Click", "You see, you can even register click listeners on a BasicLabel", new SimpleCallback() {
                    public void handle() {
                    }
                });
            }
        });
        labels.add(label);
        labels.setCellHeight(label, "30px");

        addGap(labels, "10px");

        label = createLabel("Icon Label", WidgetImages.Instance.get().icon_Printer().createImage());
        labels.add(label);
        labels.setCellHeight(label, "30px");

        addGap(labels, "10px");

        label = createLabel("Label Custom Width", WidgetImages.Instance.get().icon_Printer().createImage());
        label.setWidth("250px");
        labels.add(label);
        labels.setCellHeight(label, "30px");

        addGap(labels, "10px");

        label = createLabel("Align Center", WidgetImages.Instance.get().icon_CubeGreen().createImage());
        label.setWidth("250px");
        label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        labels.add(label);
        labels.setCellHeight(label, "30px");

        addGap(labels, "10px");

        label = createLabel("Align Right", WidgetImages.Instance.get().icon_CubeGreen().createImage());
        label.setWidth("250px");
        label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
        labels.add(label);
        labels.setCellHeight(label, "30px");

        VerticalPanel main = new VerticalPanel();
View Full Code Here



    //============================================== Helper Methods ====================================================

    private BasicLabel createLabel(String text, Image image) {
        final BasicLabel label = new BasicLabel(text);
        if (image != null) {
            label.setImage(image);
        }
        label.addMouseHoverHandler(new MouseHoverHandler() {
            @Override
            public void onMouseOver(MouseOverEvent event) {
                DOM.setStyleAttribute(label.getElement(), "border", "1px solid blue");
            }

            @Override
            public void onMouseOut(MouseOutEvent event) {
                DOM.setStyleAttribute(label.getElement(), "border", "none");
            }
        });
        return label;
    }
View Full Code Here


    //============================================== Helper Methods ====================================================

    private BasicLabel createLabel(String text, Image image) {
        final BasicLabel label = new BasicLabel(text);
        if (image != null) {
            label.setImage(image);
        }
        label.addMouseHoverHandler(new MouseHoverHandler() {
            @Override
            public void onMouseOver(MouseOverEvent event) {
                DOM.setStyleAttribute(label.getElement(), "border", "1px solid blue");
            }

            @Override
            public void onMouseOut(MouseOutEvent event) {
                DOM.setStyleAttribute(label.getElement(), "border", "none");
            }
        });
        return label;
    }
View Full Code Here

        subMenu.addItem("Option 1", new AlertCommand("'Option 1' was clicked"));
        subMenu.addItem("option2", "Option 2", new AlertCommand("'Option 2' was clicked"));
        subMenu.addItem("Option 3", new AlertCommand("'Option 3' was clicked"));
        contextMenu.addSubMenu("Options", subMenu);

        BasicLabel label = new BasicLabel("Right-click Here");
        label.addContextMenuHandler(new com.google.gwt.event.dom.client.ContextMenuHandler() {
            public void onContextMenu(final ContextMenuEvent event) {
                contextMenu.setPopupPositionAndShow(new Popup.PositionCallback() {
                    public void setPosition(int offsetWidth, int offsetHeight) {
                        int x = event.getNativeEvent().getClientX();
                        int y = event.getNativeEvent().getClientY();
                        contextMenu.setPopupPosition(x, y);
                    }
                });
            }
        });
        main.add(label);
        label.setWidth("150px");
        label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        DOM.setStyleAttribute(label.getElement(), "cursor", "default");
        DOM.setStyleAttribute(label.getElement(), "border", "1px solid gray");
        DOM.setStyleAttribute(label.getElement(), "marginTop", "150px");

        final CheckBox checkBox = new CheckBox("Disable Option 2");
        checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
            public void onValueChange(ValueChangeEvent<Boolean> event) {
                MenuItemBase item = contextMenu.getMenu().getItem("Options.option2");
View Full Code Here

TOP

Related Classes of org.gwtoolbox.widget.client.label.BasicLabel

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.