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:asquare.gwt.tkdemo.client.demos.FocusCycleDemo.java

License:Apache License

private Widget createFocusCycle2() {
    BasicPanel cycle2 = new BasicPanel("div", "block");
    FocusModel focusModel = new FocusModel();
    TabFocusController focusController = (TabFocusController) GWT.create(TabFocusController.class);
    focusController.setModel(focusModel);

    cycle2.add(new Label("Cycle 2"));
    Label label = new Label("A custom focus cycle across containers");
    DomUtil.setStyleAttribute(label, "fontSize", "smaller");
    cycle2.add(label);/*from  w  w  w .  j  a v a 2  s.  c  o  m*/
    HorizontalPanel containers = new HorizontalPanel();

    FocusStyleDecorator[] buttons = new FocusStyleDecorator[6];
    for (int i = 0; i < buttons.length; i++) {
        buttons[i] = new FocusStyleDecorator(new Button("index&nbsp;" + i));
    }
    VerticalPanel container1 = new VerticalPanel();
    container1.addStyleName("focus-container");
    VerticalPanel container2 = new VerticalPanel();
    container2.addStyleName("focus-container");

    for (int i = 0; i < buttons.length; i += 2) {
        container1.add(buttons[i]);
        focusModel.add(buttons[i]);
        container2.add(buttons[i + 1]);
        focusModel.add(buttons[i + 1]);
    }

    containers.add(new CWrapper(container1).addController(focusController));
    containers.add(new CWrapper(container2).addController(focusController));
    cycle2.add(containers);

    new WidgetFocusStyleController(focusModel);

    return cycle2;
}

From source file:at.ac.fhcampuswien.atom.client.gui.dnd.MouseListBox.java

License:Apache License

void add(String text) {
    add(new Label(text));
}

From source file:at.ac.fhcampuswien.atom.client.gui.frames.TabLayoutPanelCopy.java

License:Apache License

/**
 * Inserts a widget into the panel. If the Widget is already attached, it will
 * be moved to the requested index.//from www.j  a  v  a2  s . c  o  m
 *
 * @param child the widget to be added
 * @param text the text to be shown on its tab
 * @param asHtml <code>true</code> to treat the specified text as HTML
 * @param beforeIndex the index before which it will be inserted
 */
public void insert(Widget child, String text, boolean asHtml, int beforeIndex) {
    Widget contents;
    if (asHtml) {
        contents = new HTML(text);
    } else {
        contents = new Label(text);
    }
    insert(child, contents, beforeIndex);
}

From source file:at.ac.fhcampuswien.atom.client.gui.frames.TabLayoutPanelCopy.java

License:Apache License

/**
 * Sets a tab's text contents./*from w w w  .  j av a2  s . c  o m*/
 *
 * @param index the index of the tab whose text is to be set
 * @param text the object's new text
 */
public void setTabText(int index, String text) {
    checkIndex(index);
    tabs.get(index).setWidget(new Label(text));
}

From source file:at.ait.dme.yuma.client.image.annotation.ImageAnnotationComposite.java

License:EUPL

/**
 * show hints and create link to help page
 *///from w w w  .  j  a  va2 s  .co  m
protected Widget createHeader() {
    // The parent header panel
    FlowPanel header = new FlowPanel();

    // 'Add your Annotation' label
    Label addAnnotationLabel = new Label(Application.getConstants().addAnnotation());
    addAnnotationLabel.setStyleName("imageAnnotation-add-annotation");
    header.add(addAnnotationLabel);

    // 'Help' link
    HTML help = new HTML(
            "<a target=\"_blank\" href=\"userguide_" + LocaleInfo.getCurrentLocale().getLocaleName()
                    + ".html\">" + Application.getConstants().help() + "</a>");
    help.setStyleName("imageAnnotation-help");
    header.add(help);

    // Instructions text
    Label addAnnotationHint = new Label(Application.getConstants().addAnnotationHint());
    addAnnotationHint.setStyleName("imageAnnotation-add-annotation-hint");
    header.add(addAnnotationHint);

    // Button panel
    HorizontalPanel buttons = new HorizontalPanel();

    // 'Annotate' button
    annotateButton.setStyleName("imageAnnotation-button");
    annotateButton.setText(Application.getConstants().actionCreate());
    annotateButton.addClickHandler(new CreateImageAnnotationClickHandler(this, null, false, false));
    annotateButton.setEnabled(!Application.getUser().isEmpty());
    buttons.add(annotateButton);

    // 'Annotate Fragment' button
    annotateFragmentButton.setStyleName("imageAnnotation-button");
    annotateFragmentButton.setText(Application.getConstants().actionCreateFragment());
    annotateFragmentButton.addClickHandler(new CreateImageAnnotationClickHandler(this, null, true, false));
    annotateFragmentButton.setEnabled(!Application.getUser().isEmpty());
    buttons.add(annotateFragmentButton);

    // 'Show on Map' button
    showOnMapButton.setStyleName("imageAnnotation-button");
    showOnMapButton.setText(Application.getConstants().actionShowOnMap());
    showOnMapButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            WindowPanel window = MinMaxWindowPanel.createMinMaxWindowPanel(550, 300, 500, 300);
            window.getHeader().setText("Map");
            window.setWidget(new GoogleMapsComposite(annotations));
            window.setResizable(false);
            window.show();
        }
    });
    showOnMapButton.setVisible(Application.getBbox() != null || Application.isInTileMode());
    buttons.add(showOnMapButton);

    header.add(buttons);
    header.add(annotationFormPanel);
    return header;
}

From source file:at.ait.dme.yuma.client.image.annotation.StandardImageAnnotationForm.java

License:EUPL

private HorizontalPanel createTitlePanel(boolean update, ImageAnnotationTreeNode annotationTreeNode) {

    HorizontalPanel titlePanel = new HorizontalPanel();
    Label titleLabel = new Label(Application.getConstants().annotationTitle());
    titleLabel.setStyleName("imageAnnotation-form-label");
    titleTextBox.setStyleName("imageAnnotation-form-title");
    // in case of an update
    if (update)/*from  w ww .  j  ava  2  s  .  c  o m*/
        titleTextBox.setText(annotationTreeNode.getTitle());
    //in case of an reply
    if (!update && annotationTreeNode != null)
        titleTextBox.setText(
                Application.getConstants().annotationReplyTitlePrefix() + annotationTreeNode.getTitle());

    titlePanel.add(titleLabel);
    titlePanel.add(titleTextBox);

    return titlePanel;
}

From source file:at.ait.dme.yuma.client.image.annotation.StandardImageAnnotationForm.java

License:EUPL

private HorizontalPanel createTextPanel(boolean update, ImageAnnotationTreeNode annotationTreeNode,
        ImageAnnotationComposite annotationComposite) {

    HorizontalPanel textPanel = new HorizontalPanel();
    Label textLabel = new Label(Application.getConstants().annotationText());
    textLabel.setStyleName("imageAnnotation-form-label");
    textArea.setStyleName("imageAnnotation-form-text");
    if (update)/*from  w  w w.  java 2  s  .c  om*/
        textArea.setText(annotationTreeNode.getText());

    textPanel.add(textLabel);
    textPanel.add(textArea);

    textArea.addKeyDownHandler(createKeyDownHandler(annotationComposite));

    return textPanel;
}

From source file:at.ait.dme.yuma.client.image.annotation.StandardImageAnnotationForm.java

License:EUPL

protected Panel createLinksPanel(boolean update, ImageAnnotationTreeNode annotationTreeNode) {

    HorizontalPanel linksPanel = new HorizontalPanel();
    Label linksLabel = new Label(Application.getConstants().annotationLinks());
    linksLabel.setStyleName("imageAnnotation-form-label");
    linksPanel.add(linksLabel);//  w  w w . j av a 2s.  c  om

    linksStack = new VerticalPanel();
    linksStack.setStyleName("imageAnnotation-form-links");
    linksPanel.add(linksStack);

    if (update && annotationTreeNode.getAnnotation().hasSemanticTags()) {
        for (SemanticTag t : annotationTreeNode.getAnnotation().getSemanticTags()) {
            addLink(t, linksStack, true);
            if (!this.tags.contains(t)) {
                this.tags.add(t);
            }
        }
    }

    return linksPanel;
}

From source file:at.ait.dme.yuma.client.image.annotation.StandardImageAnnotationForm.java

License:EUPL

protected Panel createSemanticLinksPanel(boolean update, ImageAnnotationTreeNode annotationTreeNode) {

    HorizontalPanel linksPanel = new HorizontalPanel();
    Label linksLabel = new Label(Application.getConstants().annotationSuggestedLinks());
    linksLabel.setStyleName("imageAnnotation-form-label");
    linksPanel.add(linksLabel);//  w  w w .  j ava2 s.  c o  m

    suggestedLinksStack = new VerticalPanel();
    suggestedLinksStack.setStyleName("imageAnnotation-form-links");

    linksPanel.add(suggestedLinksStack);

    return linksPanel;
}

From source file:at.ait.dme.yuma.client.image.annotation.StandardImageAnnotationForm.java

License:EUPL

/**
 * Displays suggested entities that can be linked to the annotation
 * @param entities a collection of {@link GroupOfAmbiguousSemanticTags}-s
 *///from w w  w  . ja  v a2s . c  o  m
public void displaySuggestedLinks(Collection<SemanticTagGroup> entities) {
    suggestedLinksStack.clear();
    for (SemanticTagGroup e : entities) {
        suggestedLinksStack.add(new Label(e.getTitle()));
        for (SemanticTag t : e.getAmbiguousTags()) {
            if (!this.tags.contains(t)) {
                addLink(t, suggestedLinksStack, false);
            }
        }
    }
}