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

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

Introduction

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

Prototype

public void setStyleName(String style) 

Source Link

Document

Clears all of the object's style names and sets it to the given style.

Usage

From source file:com.edgenius.wiki.gwt.client.widgets.ImageSlider.java

License:Open Source License

public void setSelect(String key) {
    selectedID = key;// w w  w.  j a v  a  2 s.  c  om
    for (Iterator<Widget> iter = rowPanel.iterator(); iter.hasNext();) {
        //reset all image as unselected first
        Widget widget = iter.next();
        if (!(widget instanceof VerticalKeyPanel))
            continue;

        widget.setStyleName(Css.DESELECTED);

        //mark selected
        if (StringUtil.equals(key, ((VerticalKeyPanel) widget).getKey())) {
            widget.setStyleName(Css.SELECTED);
        }

    }

}

From source file:com.eucalyptus.webui.client.view.ItemViewImpl.java

License:Open Source License

@Override
public void display(ArrayList<GuideItem> items) {
    if (items != null) {
        content.clear();//w w  w.  j a  v  a  2 s  .c  o  m
        for (GuideItem item : items) {
            Widget itemWidget = new IconLink(item.getTitle(), item.getLink(), item.getIcon());
            itemWidget.setStyleName(itemStyle.item());
            content.add(itemWidget);
        }
    }
}

From source file:com.google.caliper.cloud.client.BenchmarkDataViewer.java

License:Apache License

public void rebuildResultsTable() {
    if (plainText) {
        Label label = new Label();
        label.setStyleName("plaintext");
        label.setText(gridToString(toGrid()));

        resultsDiv.clear();//from w w  w  . j  a v  a2 s  .c  om
        resultsDiv.add(label);
        resultsDiv.add(new PlainTextEditor().getWidget());
        HTML dash = new HTML(" - ", false);
        dash.setStyleName("inline");
        resultsDiv.add(dash);
        resultsDiv.add(new SnapshotCreator().getWidget());
        return;
    }

    FlexTable table = new FlexTable();
    table.setStyleName("data");
    int r = 0;
    int c = 0;
    int evenRowMod = 0;

    // results header #1: cValue variables
    if (cVariable != null) {
        evenRowMod = 1;
        table.insertRow(r);
        table.getRowFormatter().setStyleName(r, "valueRow");
        table.getRowFormatter().addStyleName(r, "headerRow");

        table.addCell(r);
        table.getFlexCellFormatter().setColSpan(r, 0, rVariables.size());
        c++;
        for (Value cValue : cValues) {
            table.addCell(r);
            table.getFlexCellFormatter().setColSpan(r, c, 3);
            table.getCellFormatter().setStyleName(r, c, "parameterKey");

            Widget contents = newVariableLabel(cVariable, cValue.getLabel(), rVariables.size());
            contents.setStyleName("valueHeader");

            table.setWidget(r, c++, contents);
        }
        r++;
    }

    // results header 2: rValue variables, followed by "nanos/barchart" column pairs
    c = 0;
    table.insertRow(r);
    table.getRowFormatter().setStyleName(r, "evenRow");
    table.getRowFormatter().addStyleName(r, "headerRow");
    for (Variable variable : rVariables) {
        table.addCell(r);
        table.getCellFormatter().setStyleName(r, c, "parameterKey");
        table.setWidget(r, c, newVariableLabel(variable, variable.getName(), c));
        c++;
    }
    for (Value unused : cValues) {
        table.addCell(r);
        table.getCellFormatter().setStyleName(r, c, "parameterKey");
        table.setWidget(r, c++, newUnitLabel(unitMap.get(selectedType).trim()));

        table.addCell(r);
        table.getCellFormatter().setStyleName(r, c, "parameterKey");
        table.setWidget(r, c++, newRuntimeLabel());

        table.addCell(r);
        table.getCellFormatter().setStyleName(r, c, "parameterKey");
        table.setWidget(r, c++, new InlineLabel("%"));
    }
    r++;

    Key key = newDefaultKey();
    for (RowsIterator rows = new RowsIterator(rVariables); rows.nextRow();) {
        rows.updateKey(key);

        table.insertRow(r);
        table.getRowFormatter().setStyleName(r, r % 2 == evenRowMod ? "evenRow" : "oddRow");
        c = 0;
        for (int v = 0, size = rVariables.size(); v < size; v++) {
            table.addCell(r);
            table.setWidget(r, c++, new Label(rows.getRValue(v).getLabel()));
        }

        for (Value value : cValues) {
            table.addCell(r);
            table.addCell(r);

            if (cVariable != null) {
                key.set(cVariable, value);
            }

            final Datapoint datapoint = keysToDatapoints.get(key);
            table.getCellFormatter().setStyleName(r, c, "numericCell");
            table.getCellFormatter().setStyleName(r, c + 1, "bar");
            table.getCellFormatter().setStyleName(r, c + 2, "numericCell");
            MeasurementSet measurementSet;
            if (datapoint != null
                    && (measurementSet = datapoint.scenarioResults.getMeasurementSet(selectedType)) != null) {
                double rawMedian = getMedian(selectedType, measurementSet);
                String displayedValue = numberFormatMap.get(selectedType)
                        .format(rawMedian / divideByMap.get(selectedType));
                Anchor valueAnchor = new Anchor(displayedValue, false);
                valueAnchor.setStyleName("subtleLink");
                valueAnchor.setStyleName("nanos", true);

                final DialogBox eventLogPopup = new DialogBox(true);
                eventLogPopup.setText("");

                valueAnchor.addClickHandler(new ClickHandler() {
                    public void onClick(ClickEvent clickEvent) {
                        // Do this lazily since it takes quite a bit of time to render these popups for all
                        // the scenarios shown, and quite often they won't even be used.
                        if (eventLogPopup.getText().isEmpty()) {
                            eventLogPopup.setText("Event Log");
                            String eventLog = datapoint.scenarioResults.getEventLog(selectedType);
                            if (eventLog == null || eventLog.isEmpty()) {
                                eventLog = "No event log recorded.";
                            }
                            FlowPanel panel = new FlowPanel();
                            for (String line : eventLog.split("\n")) {
                                panel.add(new Label(line));
                            }
                            panel.setStyleName("eventLog");
                            eventLogPopup.add(panel);
                        }
                        eventLogPopup.center();
                        eventLogPopup.show();
                    }
                });

                table.setWidget(r, c, valueAnchor);
                table.setWidget(r, c + 1, newBar(datapoint.style, measurementSet, value));
                table.setWidget(r, c + 2, newPercentOfReferencePointLabel(rawMedian, value));
            } else {
                table.setWidget(r, c, new Label(""));
                table.setWidget(r, c + 1, new Label(""));
                table.setWidget(r, c + 2, new Label(""));
            }
            c += 3;
        }

        r++;
    }
    resultsDiv.clear();
    resultsDiv.add(table);
    resultsDiv.add(new PlainTextEditor().getWidget());
    HTML dash = new HTML(" - ", false);
    dash.setStyleName("inline");
    resultsDiv.add(dash);
    resultsDiv.add(new SnapshotCreator().getWidget());
}

From source file:com.ikon.frontend.client.widget.dashboard.HorizontalToolBar.java

License:Open Source License

/**
 * HorizontalToolBar//from www .  j a v  a2  s. c o  m
 */
public HorizontalToolBar() {
    widgetExtensionList = new ArrayList<ToolBarBoxExtension>();
    hPanel = new HorizontalPanel();
    user = new ToolBarBox(new Image(OKMBundleResources.INSTANCE.userIcon()), Main.i18n("dashboard.tab.user"));
    mail = new ToolBarBox(new Image(OKMBundleResources.INSTANCE.mailIcon()), Main.i18n("dashboard.tab.mail"));
    news = new ToolBarBox(new Image(OKMBundleResources.INSTANCE.newsIcon()), Main.i18n("dashboard.tab.news"));
    general = new ToolBarBox(new Image(OKMBundleResources.INSTANCE.generalIcon()),
            Main.i18n("dashboard.tab.general"));
    workflow = new ToolBarBox(new Image(OKMBundleResources.INSTANCE.workflowIcon()),
            Main.i18n("dashboard.tab.workflow"));
    keywordMap = new ToolBarBox(new Image(OKMBundleResources.INSTANCE.keywordMapIcon()),
            Main.i18n("dashboard.tab.keymap"));

    enabledWidget = user; // Setting the enabled widget

    user.addMouseOverHandler(mouseOverHandler);
    user.addMouseOutHandler(mouseOutHandler);
    mail.addMouseOverHandler(mouseOverHandler);
    mail.addMouseOutHandler(mouseOutHandler);
    news.addMouseOverHandler(mouseOverHandler);
    news.addMouseOutHandler(mouseOutHandler);
    general.addMouseOverHandler(mouseOverHandler);
    general.addMouseOutHandler(mouseOutHandler);
    workflow.addMouseOverHandler(mouseOverHandler);
    workflow.addMouseOutHandler(mouseOutHandler);
    keywordMap.addMouseOverHandler(mouseOverHandler);
    keywordMap.addMouseOutHandler(mouseOutHandler);

    user.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Widget sender = (Widget) event.getSource();
            enabledWidget.removeStyleName("okm-ToolBar-Big-selected");
            sender.setStyleName("okm-ToolBar-Big-selected");
            enabledWidget = sender;
            Main.get().mainPanel.dashboard.changeView(UIDashboardConstants.DASHBOARD_USER);
        }
    });

    mail.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Widget sender = (Widget) event.getSource();
            enabledWidget.removeStyleName("okm-ToolBar-Big-selected");
            sender.setStyleName("okm-ToolBar-Big-selected");
            enabledWidget = sender;
            Main.get().mainPanel.dashboard.changeView(UIDashboardConstants.DASHBOARD_MAIL);
        }
    });

    news.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Widget sender = (Widget) event.getSource();
            enabledWidget.removeStyleName("okm-ToolBar-Big-selected");
            sender.setStyleName("okm-ToolBar-Big-selected");
            enabledWidget = sender;
            Main.get().mainPanel.dashboard.changeView(UIDashboardConstants.DASHBOARD_NEWS);
        }
    });

    general.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Widget sender = (Widget) event.getSource();
            enabledWidget.removeStyleName("okm-ToolBar-Big-selected");
            sender.setStyleName("okm-ToolBar-Big-selected");
            enabledWidget = sender;
            Main.get().mainPanel.dashboard.changeView(UIDashboardConstants.DASHBOARD_GENERAL);
        }
    });

    workflow.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Widget sender = (Widget) event.getSource();
            enabledWidget.removeStyleName("okm-ToolBar-Big-selected");
            sender.setStyleName("okm-ToolBar-Big-selected");
            enabledWidget = sender;
            Main.get().mainPanel.dashboard.changeView(UIDashboardConstants.DASHBOARD_WORKFLOW);
        }
    });

    keywordMap.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Widget sender = (Widget) event.getSource();
            enabledWidget.removeStyleName("okm-ToolBar-Big-selected");
            sender.setStyleName("okm-ToolBar-Big-selected");
            enabledWidget = sender;
            Main.get().mainPanel.dashboard.changeView(UIDashboardConstants.DASHBOARD_KEYMAP);
        }
    });

    user.setStyleName("okm-ToolBar-Big-selected");
    hPanel.setStyleName("okm-ToolBar");
    hPanel.addStyleName("okm-ToolBar-Border");
    hPanel.addStyleName("okm-DisableSelect");

    initWidget(hPanel);
}

From source file:com.ikon.frontend.client.widget.dashboard.HorizontalToolBar.java

License:Open Source License

/**
 * init/*from   ww  w  .  ja v a 2s .c o  m*/
 */
public void init() {
    for (Iterator<ToolBarBoxExtension> it = widgetExtensionList.iterator(); it.hasNext();) {
        ToolBarBoxExtension extension = it.next();
        hPanel.add(extension);
        hPanel.setCellWidth(extension, "80");
        extension.addMouseOverHandler(mouseOverHandler);
        extension.addMouseOutHandler(mouseOutHandler);
        extension.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                Widget sender = (Widget) event.getSource();
                enabledWidget.removeStyleName("okm-ToolBar-Big-selected");
                sender.setStyleName("okm-ToolBar-Big-selected");
                enabledWidget = sender;
                Main.get().mainPanel.dashboard.changeView(UIDashboardConstants.DASHBOARD_EXTENSION);
            }
        });
    }
    HTML space = new HTML("&nbsp;");
    hPanel.add(space);
}

From source file:com.ksyzt.gwt.client.ui.richeditor.RichTextToolbar.java

License:Open Source License

/**
 * Show popup./*w w  w  .  j  a va  2 s . c om*/
 *
 * @param attacheElement the attache element
 * @param w the w
 */
private void showPopup(Widget attacheElement, Widget w) {
    back_widget = attacheElement;
    if (w == null) {
        w = new HTMLPanel("");
        w.setSize("100px", "100px");
        m_ap_content.clear();
        m_ap_content.add(w);
    } else {
        m_ap_content.clear();
        m_ap_content.add(w);
    }

    m_ap_content.setVisible(true);
    m_ap_shadow.setVisible(true);
    m_ap_line.setVisible(true);

    int aleft = attacheElement.getAbsoluteLeft();
    int atop = attacheElement.getAbsoluteTop();
    int aw = attacheElement.getOffsetWidth();
    int ah = attacheElement.getOffsetHeight();

    int width = m_ap_content.getOffsetWidth();
    int height = m_ap_content.getOffsetHeight();

    int lbx = aleft;
    int lby = atop + ah;
    int rbx = lbx + aw;
    int rby = lby;

    Style style = m_ap_content.getElement().getStyle();
    style.setLeft(rbx - width, Unit.PX);
    style.setTop(lby - 1, Unit.PX);

    style = m_ap_shadow.getElement().getStyle();
    style.setLeft(rbx - width + 3, Unit.PX);
    style.setTop(lby + 2, Unit.PX);
    style.setWidth(width, Unit.PX);
    style.setHeight(height, Unit.PX);

    style = m_ap_line.getElement().getStyle();
    style.setLeft(lbx + 1, Unit.PX);
    style.setTop(lby - 1, Unit.PX);
    style.setWidth(aw - 2, Unit.PX);

    back_css = attacheElement.getStyleName();
    attacheElement.setStyleName("toolbar_over");

    m_ap_content.getElement().focus();

    m_b_show_popup = true;

}

From source file:com.risevision.ui.client.common.widgets.AddressWidget.java

License:Open Source License

private void gridAdd(String label, Widget widget, String styleName) {
    row++;//from w  w w . j  ava  2 s .com
    getCellFormatter().setStyleName(row, 0, "rdn-Column1");
    setText(row, 0, label);
    if (widget != null) {
        setWidget(row, 1, widget);
        if (styleName != null)
            widget.setStyleName(styleName);
    }
}

From source file:com.risevision.ui.client.common.widgets.background.BackgroundDialog.java

License:Open Source License

private void gridAdd(String label, Widget widget, String styleName) {
    row++;//from   w  ww  .j a va 2  s .c om
    mainGrid.getCellFormatter().setStyleName(row, 0, "rdn-ColumnShort");
    mainGrid.setText(row, 0, label);
    if (widget != null) {
        mainGrid.setWidget(row, 1, widget);
        if (styleName != null)
            widget.setStyleName(styleName);
    }
}

From source file:com.risevision.ui.client.common.widgets.grid.DoubleRowFormGridWidget.java

License:Open Source License

private void addField(Widget widget, String styleName) {
    row++;/*from  w w w  . j  ava 2  s  .  co m*/
    //      getCellFormatter().setStyleName(row, 0, "rdn-Column1");
    if (widget != null) {
        setWidget(row, 0, widget);

        if (styleName != null) {
            widget.setStyleName(styleName);
        }

        widget.addStyleName("rdn-Indent");
    }
}

From source file:com.risevision.ui.client.common.widgets.grid.FormGridWidget.java

License:Open Source License

private void addRow(Widget widget, String styleName) {
    row++;// w  ww.j  a va 2 s  .c  o m
    getCellFormatter().setStyleName(row, 0, isShort ? "rdn-ColumnShort" : "rdn-Column1");
    if (widget != null) {
        setWidget(row, 1, widget);
        if (styleName != null)
            widget.setStyleName(styleName);
    }
}