Example usage for com.google.gwt.user.client.ui Label Label

List of usage examples for com.google.gwt.user.client.ui Label Label

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui Label Label.

Prototype

protected Label(Element element) 

Source Link

Document

This constructor may be used by subclasses to explicitly use an existing element.

Usage

From source file:com.agnie.useradmin.main.client.presenter.sahered.ui.PermissionsCellTable.java

License:Open Source License

public PermissionsCellTable() {
    initWidget(uiBinder.createAndBindUi(this));
    multiSelectionModel = new MultiSelectionModel<PermissionPx>(keyProvider);
    table.setPageSize(ApplicationConfig.getInstance().getPageSize());

    Column<PermissionPx, Boolean> select = new Column<PermissionPx, Boolean>(new CheckboxCell(true, false)) {
        @Override/*from w ww.  jav  a  2s.  com*/
        public Boolean getValue(PermissionPx object) {
            return multiSelectionModel.isSelected(object);
        }
    };
    table.addColumn(select, "");
    table.setColumnWidth(select, 10, Unit.PX);

    Column<PermissionPx, PermissionPx> permissions = new Column<PermissionPx, PermissionPx>(
            new PermissionsCell()) {
        @Override
        public PermissionPx getValue(PermissionPx object) {
            return object;
        }
    };
    table.addColumn(permissions, I18.messages.permissions());

    VerticalPanel panel = new VerticalPanel();
    Label label = new Label(I18.messages.no_data());
    panel.add(label);
    panel.setCellHorizontalAlignment(label, HasHorizontalAlignment.ALIGN_CENTER);
    table.setEmptyTableWidget(label);
    table.setSelectionModel(multiSelectionModel,
            DefaultSelectionEventManager
                    .<PermissionPx>createCustomManager(new MultiSelectEventTranslator<PermissionPx>(
                            new MultiSelectEventTranslator.RowSelectCommand<PermissionPx>() {
                                PermissionPx selected;

                                @Override
                                public void execute() {
                                    getViewFactory().getListPermissionsView().setPermissionsViewData(selected);
                                    getViewFactory().getListPermissionsView().setPermSelToEdit(true);
                                    getViewFactory().getListPermissionsView().setPerPxToEdit(selected);
                                }

                                @Override
                                public void setSelected(PermissionPx selected) {
                                    this.selected = selected;
                                }
                            })));
    pager.setRangeLimited(true);
    pager.setDisplay(table);
    AsyncHandler columnSortHandler = new AsyncHandler(table);
    table.addColumnSortHandler(columnSortHandler);
}

From source file:com.agnie.useradmin.main.client.presenter.sahered.ui.RolesCellTable.java

License:Open Source License

public RolesCellTable() {
    initWidget(uiBinder.createAndBindUi(this));

    multiSelectionModel = new MultiSelectionModel<RolePx>(keyProvider);
    table.setPageSize(ApplicationConfig.getInstance().getPageSize());

    Column<RolePx, Boolean> select = new Column<RolePx, Boolean>(new CheckboxCell(true, false)) {
        @Override//from w  ww  . ja  va  2 s  .c o m
        public Boolean getValue(RolePx object) {
            return multiSelectionModel.isSelected(object);
        }
    };
    table.addColumn(select, "");
    table.setColumnWidth(select, 10, Unit.PX);

    Column<RolePx, RolePx> roles = new Column<RolePx, RolePx>(new RolesCell()) {
        @Override
        public RolePx getValue(RolePx object) {
            return object;
        }
    };
    table.addColumn(roles, I18.messages.role());

    VerticalPanel panel = new VerticalPanel();
    Label label = new Label(I18.messages.no_data());
    panel.add(label);
    panel.setCellHorizontalAlignment(label, HasHorizontalAlignment.ALIGN_CENTER);
    table.setEmptyTableWidget(label);
    table.setSelectionModel(multiSelectionModel, DefaultSelectionEventManager.<RolePx>createCustomManager(
            new MultiSelectEventTranslator<RolePx>(new MultiSelectEventTranslator.RowSelectCommand<RolePx>() {
                RolePx selected;

                @Override
                public void execute() {
                    getViewFactory().getListRolesView().setRoleSelToEdit(true);
                    getViewFactory().getListRolesView().setRolePxToEdit(selected);
                    presenter.getPermById(selected);
                }

                @Override
                public void setSelected(RolePx selected) {
                    this.selected = selected;
                }
            })));
    pager.setRangeLimited(true);
    pager.setDisplay(table);
    AsyncHandler columnSortHandler = new AsyncHandler(table);
    table.addColumnSortHandler(columnSortHandler);
}

From source file:com.ait.lienzo.client.widget.LienzoPanel.java

License:Open Source License

private final void doPostCTOR(final int wide, final int high, final boolean flex) {
    m_wide = wide;/*from   w  ww. j ava  2  s  .c om*/

    m_high = high;

    m_flex = flex;

    if (LienzoCore.get().isCanvasSupported()) {
        getElement().appendChild(m_view.getElement());

        setPixelSize(wide, high);

        m_widget_cursor = CursorMap.get().lookup(getElement().getStyle().getCursor());

        m_events = new LienzoHandlerManager(this);
    } else {
        add(new Label(MessageConstants.MESSAGES.getCanvasUnsupportedMessage()));

        m_events = null;
    }
}

From source file:com.ait.lienzo.client.widget.panel.impl.LienzoPanelImpl.java

License:Open Source License

private final void doPostCTOR(final int wide, final int high, final boolean flex) {
    m_wide = wide;/*from  w ww  . ja v a 2  s. c o  m*/

    m_high = high;

    m_flex = flex;

    m_drag_mouse_control = DragMouseControl.LEFT_MOUSE_ONLY;

    if (LienzoCore.IS_CANVAS_SUPPORTED) {
        getElement().appendChild(m_view.getElement());

        setPixelSize(wide, high);

        m_events = new LienzoPanelHandlerManager(this);
    } else {
        add(new Label(MessageConstants.MESSAGES.getCanvasUnsupportedMessage()));

        m_events = null;
    }

    getElement().getStyle().setOutlineStyle(Style.OutlineStyle.NONE);
}

From source file:com.ait.toolkit.ace.examples.client.AceDemo.java

License:Open Source License

/**
 * This method builds the UI. It creates UI widgets that exercise most/all of the AceEditor methods, so it's a bit of a kitchen sink.
 *//*w  w w  .  j  a  v  a  2  s  . c  o m*/
private void buildUI() {
    VerticalPanel mainPanel = new VerticalPanel();
    mainPanel.setWidth("100%");

    mainPanel.add(new Label("Label above!"));

    mainPanel.add(editor1);

    // Label to display current row/column
    rowColLabel = new InlineLabel("");
    mainPanel.add(rowColLabel);

    // Create some buttons for testing various editor APIs
    HorizontalPanel buttonPanel = new HorizontalPanel();

    // Add button to insert text at current cursor position
    Button insertTextButton = new Button("Insert");
    insertTextButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            // Window.alert("Cursor at: " + editor1.getCursorPosition());
            editor1.insertAtCursor("inserted text!");
        }
    });
    buttonPanel.add(insertTextButton);

    // Add check box to enable/disable soft tabs
    final CheckBox softTabsBox = new CheckBox("Soft tabs");
    softTabsBox.setValue(true); // I think soft tabs is the default
    softTabsBox.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            editor1.setUseSoftTabs(softTabsBox.getValue());
        }
    });
    buttonPanel.add(softTabsBox);

    // add text box and button to set tab size
    final TextBox tabSizeTextBox = new TextBox();
    tabSizeTextBox.setWidth("4em");
    Button setTabSizeButton = new Button("Set tab size");
    setTabSizeButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            editor1.setTabSize(Integer.parseInt(tabSizeTextBox.getText()));
        }
    });
    buttonPanel.add(new InlineLabel("Tab size: "));
    buttonPanel.add(tabSizeTextBox);
    buttonPanel.add(setTabSizeButton);

    // add text box and button to go to a given line
    final TextBox gotoLineTextBox = new TextBox();
    gotoLineTextBox.setWidth("4em");
    Button gotoLineButton = new Button("Go to line");
    gotoLineButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            editor1.gotoLine(Integer.parseInt(gotoLineTextBox.getText()));
        }
    });
    buttonPanel.add(new InlineLabel("Go to line: "));
    buttonPanel.add(gotoLineTextBox);
    buttonPanel.add(gotoLineButton);

    // checkbox to set whether or not horizontal scrollbar is always visible
    final CheckBox hScrollBarAlwaysVisibleBox = new CheckBox("H scrollbar: ");
    hScrollBarAlwaysVisibleBox.setValue(true);
    hScrollBarAlwaysVisibleBox.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            editor1.setHScrollBarAlwaysVisible(hScrollBarAlwaysVisibleBox.getValue());
        }
    });
    buttonPanel.add(hScrollBarAlwaysVisibleBox);

    // checkbox to show/hide gutter
    final CheckBox showGutterBox = new CheckBox("Show gutter: ");
    showGutterBox.setValue(true);
    showGutterBox.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            editor1.setShowGutter(showGutterBox.getValue());
        }
    });
    buttonPanel.add(showGutterBox);

    // checkbox to set/unset readonly mode
    final CheckBox readOnlyBox = new CheckBox("Read only: ");
    readOnlyBox.setValue(false);
    readOnlyBox.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            editor1.setReadOnly(readOnlyBox.getValue());
        }
    });
    buttonPanel.add(readOnlyBox);

    // checkbox to show/hide print margin
    final CheckBox showPrintMarginBox = new CheckBox("Show print margin: ");
    showPrintMarginBox.setValue(true);
    showPrintMarginBox.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            editor1.setShowPrintMargin(showPrintMarginBox.getValue());
        }
    });
    buttonPanel.add(showPrintMarginBox);

    mainPanel.add(buttonPanel);

    mainPanel.add(editor2);
    mainPanel.add(new Label("Label below!"));

    RootPanel.get().add(mainPanel);
}

From source file:com.akanoo.client.views.CanvasView.java

License:Apache License

@Override
public void populateActiveUsers(List<UserInfo> collaborators) {
    activeUserPanel.clear();/*from   w  w  w  .  j  av a  2 s . c  om*/

    activeUserPanel.setVisible(collaborators.size() > 0);

    for (UserInfo userInfo : collaborators) {
        Label activeUserLabel = new Label(userInfo.name);
        activeUserLabel.setTitle(userInfo.email);
        activeUserLabel.addStyleName(resources.canvasStyle().activeUserLabel());

        activeUserPanel.add(activeUserLabel);
    }
}

From source file:com.akjava.gwt.hangout.apilist.client.APILists.java

License:Apache License

private Label boldLabel(String text) {
    Label label = new Label(text);
    label.setStylePrimaryName("bold");
    return label;
}

From source file:com.akjava.gwt.subplayer.client.SubPlayer.java

License:Apache License

@Override
public void onModuleLoad() {
    //pre load resource
    ImageResource icon = Binder.INSTANCE.loadanime();
    loadImg = new Image(icon);
    loadImg.setVisible(false);/*w  w w  .java2s . c o  m*/
    loadImg.addLoadHandler(new LoadHandler() {

        @Override
        public void onLoad(LoadEvent event) {
            RootPanel.get().remove(loadImg);
            loadImg.setVisible(true);
        }
    });
    RootPanel.get().add(loadImg);

    preference = new SubPlayerPreference();
    preference.initialize();

    tab = new TabLayoutPanel(2, Unit.EM);
    tab.setHeight("500px");

    VerticalPanel root = new VerticalPanel();
    root.setWidth("100%");
    root.setHeight("100%");
    //root.setHeight("200px");
    DockLayoutPanel doc = new DockLayoutPanel(Unit.PX);
    doc.addSouth(new HTMLPanel(
            "<div align='center'>Subtitle TTS Player by <a href='http://www.akjava.com'>akjava.com</a></div>"),
            40);
    doc.add(tab);
    RootLayoutPanel.get().add(doc);

    //RootLayoutPanel.get().add(new Label("hello"));
    tab.add(root, "PLAY");

    noSubtitle = new Label("Subtitle is empty.load from Load tab");
    noSubtitle.setStyleName("nosubtitle");
    root.add(noSubtitle);

    loadPanel = new LoadPanel();
    loadPanel.setWidth("100%");
    loadPanel.setHeight("100%");
    tab.add(loadPanel, "LOAD");

    loadPanel.setText(preference.getSrtText());

    itemPanel = new VerticalPanel();
    itemPanel.setSpacing(8);

    itemPanelScroll = new ScrollPanel(itemPanel);
    itemPanelScroll.setWidth("100%");
    itemPanelScroll.setHeight("350px");
    root.add(itemPanelScroll);

    /*
    for(int i=0;i<5;i++){
       String text=i+" hello world\n";
       for(int j=0;j<i;j++){
    text+="line\n";
       }
            
    HTMLPanel label=new HTMLPanel(text.replace("\n", "<br/>"));
    FocusPanel panel=new FocusPanel(label);
    panel.addClickHandler(new ClickHandler() {
               
       @Override
       public void onClick(ClickEvent event) {
    unselectAll();
    setlectWidget((Widget) event.getSource());
       }
    });
    //label.setHeight("100px");
    itemPanel.add(panel);
            
    }*/

    playerWidget = new PlayerWidget(this);
    root.add(playerWidget);

    DisclosurePanel ds = new DisclosurePanel("show subtitle time [start] - [end]");
    timeLabel = new Label();
    ds.add(timeLabel);
    //ds.add(new Label("0:0:0 - 0:0:12"));
    root.add(ds);

    selectWidgetHandler = new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            unselectAll();
            setlectWidget((Widget) event.getSource());
        }
    };
    DisclosurePanel vs = new DisclosurePanel("Voice Settings");
    root.add(vs);
    voiceSettings = new VoiceSettings();
    vs.add(voiceSettings);

    //load data from preferences
    //if empty load mode.
    if (!loadPanel.getText().isEmpty()) {
        loadSrt(preference.getSrtSelectIndex());
    } else {
        tab.selectTab(1);
    }

}

From source file:com.akjava.gwt.volumegraph.client.VolumeGraph.java

License:Apache License

@Override
protected void init(TestPreference preferences) {

    Hangout.setInjectHangoutService(injector.getHangoutService());
    StyleInjector.inject(".grey{color:#666}");

    HorizontalPanel root = new HorizontalPanel();
    root.setSize("100%", "100%");
    RootPanel.get().add(root);//from   w  ww. ja v a2 s  . c  o m

    VerticalPanel mainPanel = new VerticalPanel();
    mainPanel.setSize("100%", "100%");

    HorizontalPanel controler = new HorizontalPanel();
    mainPanel.add(controler);

    Label label = new Label("Emulate Participant");
    label.setStylePrimaryName("grey");
    controler.add(label);

    Button plus = new Button("+");
    plus.setStylePrimaryName("grey");
    controler.add(plus);
    plus.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            dummyParticipant++;
        }
    });
    Button clear = new Button("remove");
    clear.setStylePrimaryName("grey");
    controler.add(clear);
    clear.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            dummyParticipant = 0;
        }
    });

    root.add(mainPanel);

    canvas = Canvas.createIfSupported();

    canvas.setSize("100%", "400px");
    canvas.getContext2d().setFillStyle(CssColor.make("#fff"));

    mainPanel.add(canvas);
    int w = canvas.getOffsetWidth();
    int h = canvas.getOffsetHeight();
    canvas.setCoordinateSpaceWidth(w);
    canvas.setCoordinateSpaceHeight(h);

    addReady();
}

From source file:com.algorithmstudy.visualizer.client.AlgorithmVisualizer.java

License:Open Source License

/**
 * This is the entry point method.//from   w w w  .  j  av a  2 s . co m
 */
public void onModuleLoad() {

    Label programName = new Label("Algorithm Visualizer (v0.2.0)");
    HTML algstudyDotCom = new HTML();
    algstudyDotCom.setHTML("<a href='http://www.algorithmstudy.com'>AlgorithmStudy.com</a>");

    HorizontalPanel titleBarPanel = new HorizontalPanel();
    titleBarPanel.setStyleName(STYLE_TOP_BARS);
    titleBarPanel.setWidth("100%");
    titleBarPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
    titleBarPanel.add(programName);
    titleBarPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
    titleBarPanel.add(algstudyDotCom);

    contentsPanel = new VerticalPanel();
    contentsPanel.setStyleName(STYLE_CONTENTS);
    contentsPanel.setHorizontalAlignment(VerticalPanel.ALIGN_LEFT);
    contentsPanel.setWidth("100%");
    contentsPanel.setHeight("450px");

    Panel algorithmSelectionPanel = new AlgorithmSelectionPanel(contentsPanel);
    algorithmSelectionPanel.setStyleName(STYLE_TOP_BARS);
    algorithmSelectionPanel.setWidth("100%");

    VerticalPanel containingPanel = new VerticalPanel();
    containingPanel.setWidth("850px");
    containingPanel.setStyleName(STYLE_SUPER_CONTAINER);
    containingPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    containingPanel.add(titleBarPanel);
    containingPanel.add(algorithmSelectionPanel);
    containingPanel.add(contentsPanel);

    RootPanel.get().add(containingPanel);
}