Example usage for com.google.gwt.user.client.ui Widget setTitle

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

Introduction

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

Prototype

public void setTitle(String title) 

Source Link

Document

Sets the title associated with this object.

Usage

From source file:com.alkacon.acacia.client.AttributeHandler.java

License:Open Source License

/**
 * Clears the error styles on the given tabbed panel.<p>
 * // w w  w  .jav a 2  s  .  com
 * @param tabbedPanel the tabbed panel
 */
public static void clearErrorStyles(TabbedPanel<?> tabbedPanel) {

    for (int i = 0; i < tabbedPanel.getTabCount(); i++) {
        Widget tab = tabbedPanel.getTabWidget(i);
        tab.setTitle(null);
        tab.getParent().removeStyleName(I_LayoutBundle.INSTANCE.form().hasError());
        tab.getParent().removeStyleName(I_LayoutBundle.INSTANCE.form().hasWarning());
    }
}

From source file:com.alkacon.acacia.client.AttributeHandler.java

License:Open Source License

/**
 * Sets the error message for the given value index.<p>
 * /*from   w  w w . ja va2s  .co m*/
 * @param valueIndex the value index
 * @param message the error message
 * @param tabbedPanel the forms tabbed panel if available
 */
public void setErrorMessage(int valueIndex, String message, TabbedPanel<?> tabbedPanel) {

    if (!m_attributeValueViews.isEmpty()) {
        FlowPanel parent = (FlowPanel) m_attributeValueViews.get(0).getParent();
        AttributeValueView valueView = (AttributeValueView) parent.getWidget(valueIndex);
        valueView.setErrorMessage(message);
        if (tabbedPanel != null) {
            int tabIndex = tabbedPanel.getTabIndex(valueView.getElement());
            if (tabIndex > -1) {
                Widget tab = tabbedPanel.getTabWidget(tabIndex);
                tab.setTitle("This tab has errors.");
                tab.getParent().removeStyleName(I_LayoutBundle.INSTANCE.form().hasWarning());
                tab.getParent().addStyleName(I_LayoutBundle.INSTANCE.form().hasError());
            }

        }
    }
}

From source file:com.alkacon.acacia.client.AttributeHandler.java

License:Open Source License

/**
 * Sets the warning message for the given value index.<p>
 * //from ww w  .j a  v  a 2s. com
 * @param valueIndex the value index
 * @param message the warning message
 * @param tabbedPanel the forms tabbed panel if available
 */
public void setWarningMessage(int valueIndex, String message, TabbedPanel<?> tabbedPanel) {

    if (!m_attributeValueViews.isEmpty()) {
        FlowPanel parent = (FlowPanel) m_attributeValueViews.get(0).getParent();
        AttributeValueView valueView = (AttributeValueView) parent.getWidget(valueIndex);
        valueView.setWarningMessage(message);
        if (tabbedPanel != null) {
            int tabIndex = tabbedPanel.getTabIndex(valueView.getElement());
            if (tabIndex > -1) {
                Widget tab = tabbedPanel.getTabWidget(tabIndex);
                tab.setTitle("This tab has warnings.");
                tab.getParent().addStyleName(I_LayoutBundle.INSTANCE.form().hasWarning());
            }

        }
    }
}

From source file:com.allen_sauer.gwt.dnd.demo.client.example.palette.PaletteWidget.java

License:Apache License

public PaletteWidget cloneWidget() {
    Widget clone;

    // Clone our internal widget
    if (widget instanceof Label) {
        Label label = (Label) widget;
        clone = new Label(label.getText());
    } else if (widget instanceof RadioButton) {
        RadioButton radioButton = (RadioButton) widget;
        clone = new RadioButton(radioButton.getName(), radioButton.getHTML(), true);
    } else if (widget instanceof CheckBox) {
        CheckBox checkBox = (CheckBox) widget;
        clone = new CheckBox(checkBox.getHTML(), true);
    } else {/*w  w  w.  j  a  v  a 2s .  c o  m*/
        throw new IllegalStateException("Unhandled Widget class " + widget.getClass().getName());
    }

    // Copy a few obvious common widget properties
    clone.setStyleName(widget.getStyleName());
    clone.setTitle(widget.getTitle());

    // Wrap the cloned widget in a new PaletteWidget instance
    return new PaletteWidget(clone);
}

From source file:com.google.code.p.gwtchismes.client.GWTCDatePickerAbstract.java

License:Apache License

public static void internationalize(Widget b, Map<String, String> strs, String ktext) {
    if (strs == null)
        return;//  w  w  w.ja v  a  2s.c o m
    String text = strs.get(ktext);
    String title = strs.get(ktext + ".title");
    if (text != null && text.length() > 0) {
        if (b instanceof HasHTML)
            ((HasHTML) b).setText(text);
        else if (b instanceof HasText)
            ((HasText) b).setText(text);
        else if (b instanceof GWTCDatePickerAbstract)
            ((GWTCDatePickerAbstract) b).setCaptionText(text);
        else
            System.out.println(
                    "GWTCDatePickerAbstract.internationalize: unknown element " + b + " " + ktext + " " + text);
    }
    if (title != null && title.length() > 0)
        b.setTitle(title);
}

From source file:com.google.testing.testify.risk.frontend.client.view.impl.ProjectDataViewImpl.java

License:Apache License

public void displayData(List<UploadedDatum> data) {
    if (data.size() == 0) {
        dataSummary.setText("No items have been uploaded.");
        return;//from  ww w.  j av  a2 s  .c  o m
    }

    UploadedDatum firstItem = data.get(0);
    dataSummary
            .setText("Showing " + Integer.toString(data.size()) + " " + firstItem.getDatumType().getPlural());

    dataGrid.clear();
    // Header row + one for each bug x datum, Attribute, Component, Capability
    dataGrid.resize(data.size() + 1, 4);

    // Set grid headers.
    dataGrid.setWidget(0, 0, new Label(firstItem.getDatumType().getPlural()));
    dataGrid.setWidget(0, 1, new Label("Attribute"));
    dataGrid.setWidget(0, 2, new Label("Component"));
    dataGrid.setWidget(0, 3, new Label("Capability"));

    dataGrid.getWidget(0, 0).addStyleName(GRID_HEADER_CSS_STYLE);
    dataGrid.getWidget(0, 1).addStyleName(GRID_HEADER_CSS_STYLE);
    dataGrid.getWidget(0, 2).addStyleName(GRID_HEADER_CSS_STYLE);
    dataGrid.getWidget(0, 3).addStyleName(GRID_HEADER_CSS_STYLE);

    // Fill with data.
    for (int i = 0; i < data.size(); i++) {
        UploadedDatum datum = data.get(i);

        String host = LinkUtil.getLinkHost(datum.getLinkUrl());
        Widget description;
        if (host != null) {
            HorizontalPanel panel = new HorizontalPanel();
            Anchor anchor = new Anchor(datum.getLinkText(), datum.getLinkUrl());
            anchor.setTarget("_blank");

            Label hostLabel = new Label(host);
            panel.add(anchor);
            panel.add(hostLabel);

            description = panel;
        } else {
            description = new Label(datum.getLinkText() + " [" + datum.getLinkUrl() + "]");
        }
        description.addStyleName(GRID_CELL_CSS_STYLE);
        description.setTitle(datum.getToolTip());
        dataGrid.setWidget(i + 1, 0, description);

        // Display images indicating whether or not the datum is associated with project artifacts.
        // For example, a Bug may be associated with a Component or a Testcase might validate scenarios
        // for a given Attribute. The user can associate data with project artifacts using SuperLabels.
        dataGrid.setWidget(i + 1, 1, (datum.isAttachedToAttribute()) ? getX() : getCheckmark());
        dataGrid.setWidget(i + 1, 2, (datum.isAttachedToComponent()) ? getX() : getCheckmark());
        dataGrid.setWidget(i + 1, 3, (datum.isAttachedToCapability()) ? getX() : getCheckmark());
    }
}

From source file:com.googlesource.gerrit.plugins.labelui.client.LabelPanel.java

License:Apache License

private static void formatNonVotable(Grid g, int row, int column) {
    Widget w = g.getWidget(row, column);
    g.getCellFormatter().addStyleName(row, column, "header");
    w.setTitle("cannot vote on this label");
}

From source file:edu.caltech.ipac.firefly.ui.table.TableFilterSupport.java

public void onUpdateHeaders(List<ColumnDefinition<TableData.Row, ?>> colDefs) {
    int numColumns = colDefs.size();

    filterBoxes.clear();/*  ww  w  .ja v  a 2  s.  c  o  m*/
    for (int i = 0; i < numColumns; i++) {
        ColDef colDef = (ColDef) colDefs.get(i);
        if (colDef.isImmutable())
            continue;

        String[] vals = colDef.getColumn() == null ? null : colDef.getColumn().getEnums();
        Widget field = null;
        if (vals != null && vals.length > 0) {
            field = new EnumList(vals);
        } else {
            field = new TextBox();
            GwtUtil.setStyle(field, "padding", "0px");
            field.setTitle(TTIPS);
            field.setWidth("100%");
        }

        final FilterBox fb = new FilterBox(colDef.getName(), field);
        table.getHeaderTable().setWidget(BasicPagingTable.FILTER_IDX, i, fb);
        fb.getElement().getParentElement().setPropertyString("type", "filter");
        filterBoxes.add(fb);

        // add event listener to the textboxes
        fb.addChangeHandler(new ChangeHandler() {
            public void onChange(ChangeEvent event) {
                onFilterChanged();
            }
        });

    }
    table.getHeaderTable().getRowFormatter().setStyleName(BasicPagingTable.FILTER_IDX, "filterRow");
    ensureFilterShow();
}

From source file:edu.caltech.ipac.firefly.visualize.VisMenuBar.java

private Widget makeHelp() {

    Widget help = new SimplePanel(HelpManager.makeHelpImage());
    help.addDomHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            Application.getInstance().getHelpManager().showHelpAt("visualization.fitsViewer");
        }//  w  w  w .j av  a2  s.c  o m
    }, ClickEvent.getType());

    help.setTitle("Help on FITS visualization");
    if (asPopup) {
        GwtUtil.setStyles(help.getElement(), "paddingLeft", "7px", "display", "inline-block", "verticalAlign",
                "top", "lineHeight", "32px", "borderColor", "transparent");

    } else {
        GwtUtil.setStyles(help.getElement(), "padding", "0 0 0px 10px", "verticalAlign", "top", "display",
                "inline-block", "lineHeight", "32px", "whitespace", "normal", "borderColor", "transparent");

    }
    return help;
}

From source file:edu.purdue.pivot.skwiki.client.dnd.PaletteWidget.java

License:Apache License

public PaletteWidget cloneWidget() {
    Widget clone;

    // Clone our internal widget
    if (widget instanceof Label) {
        Label label = (Label) widget;
        clone = new Label(label.getText());
    } else if (widget instanceof RadioButton) {
        RadioButton radioButton = (RadioButton) widget;
        clone = new RadioButton(radioButton.getName(), radioButton.getHTML(), true);
    } else if (widget instanceof CheckBox) {
        CheckBox checkBox = (CheckBox) widget;
        clone = new CheckBox(checkBox.getHTML(), true);
    } else if (widget instanceof TextWindow) {
        TextWindow editWindow = (TextWindow) widget;
        clone = new TextWindow();
    } else if (widget instanceof CanvasWindow) {
        CanvasWindow editWindow = (CanvasWindow) widget;
        clone = new CanvasWindow();
    } else {//from  www  .j  ava  2  s . c  om
        throw new IllegalStateException("Unhandled Widget class " + widget.getClass().getName());
    }

    // Copy a few obvious common widget properties
    clone.setStyleName(widget.getStyleName());
    clone.setTitle(widget.getTitle());

    // Wrap the cloned widget in a new PaletteWidget instance
    return new PaletteWidget(clone);
}