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

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

Introduction

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

Prototype

public void addStyleName(String style) 

Source Link

Document

Adds a secondary or dependent style name to this object.

Usage

From source file:org.jax.gwtutil.client.WidgetUtilities.java

License:Open Source License

/**
 * Create a message/*w w  w.  j  av a 2 s  .c  o m*/
 * @param messageType
 *          the type of message
 * @param messageWidget
 *          the message widget (usually inline label or inline HTML)
 * @return
 *          the message
 */
public static Widget createMessage(MessageType messageType, Widget messageWidget) {
    FlowPanel panel = new FlowPanel();
    panel.setStyleName("jax-MessagePanel");

    if (messageType.getIconUrl() != null) {
        Image icon = new Image(messageType.getIconUrl());
        icon.addStyleName(messageType.getStyle());
        panel.add(icon);
    }

    messageWidget.addStyleName(messageType.getStyle());
    panel.add(messageWidget);

    return panel;
}

From source file:org.jboss.as.console.client.shared.homepage.InfoBox.java

License:Open Source License

public InfoBox(final String token, final String title, final String description,
        final ClickHandler clickHandler) {
    String linkId = IdHelper.asId(getClass(), "_" + token);
    HTMLPanel panel = new HTMLPanel(TEMPLATES.infoBox(linkId, description));
    panel.getElement().setId(IdHelper.asId(getClass(), "_info-box"));
    panel.addStyleName("homepage-info-box");
    Widget link;
    if (clickHandler != null) {
        Anchor anchor = new Anchor(title);
        anchor.addClickHandler(clickHandler);
        link = anchor;/*from www . j a  v a  2 s  .c o m*/
    } else {
        link = new InlineHyperlink(title, token);
    }
    link.addStyleName("homepage-link");
    panel.add(link, linkId);

    initWidget(panel);
}

From source file:org.jboss.as.console.client.shared.subsys.infinispan.EmbeddedAliasesView.java

License:Open Source License

@Override
public Widget asWidget() {
    this.listView = new EmbeddedListView(Console.CONSTANTS.subsys_infinispan_aliases(), 5, false, this);
    this.listView.setValueColumnHeader(Console.CONSTANTS.common_label_name());
    Widget widget = listView.asWidget();
    widget.addStyleName("fill-layout-width");
    return widget;
}

From source file:org.jboss.as.console.client.shared.subsys.logging.EmbeddedHandlerView.java

License:Open Source License

@Override
public Widget asWidget() {
    this.listView = new EmbeddedListView(Console.CONSTANTS.subsys_logging_handlers(), 5, true, this);
    this.listView.setValueColumnHeader(Console.CONSTANTS.common_label_name());
    Widget widget = listView.asWidget();
    widget.addStyleName("fill-layout-width");
    return widget;
}

From source file:org.jboss.as.console.client.widgets.CollapsibleSplitLayoutPanel.java

License:Open Source License

@Override
public void addWest(Widget widget, double size) {
    super.addWest(widget, size);
    widget.addStyleName("split-west");
}

From source file:org.jboss.as.console.client.widgets.FinderPanel.java

License:Open Source License

@Override
public void addWest(Widget widget, double size) {
    super.addWest(widget, size);
    widget.addStyleName("split-west");

}

From source file:org.jboss.wise.gwt.client.view.EndpointConfigView.java

License:Open Source License

protected WiseTreeItem generateDisplayObject(WiseTreeItem parentItem, TreeElement parentTreeElement) {

    if (TreeElement.SIMPLE.equals(parentTreeElement.getKind())) {
        WiseTreeItem treeItem = new WiseTreeItem();
        treeItem.addStyleName("wise-input-row");
        HorizontalPanel hPanel = new HorizontalPanel();
        treeItem.setWidget(hPanel);//from   w  w  w . j  a  v a  2 s .c  om
        treeItem.setState(true);

        Label label = new Label(
                getBaseType(parentTreeElement.getClassType()) + " : " + parentTreeElement.getName());
        Widget widget = getWidget(parentTreeElement);
        widget.addStyleName(WiseTreeItem.CSS_ENABLEBLK);
        widget.addStyleName("wise-gwt-inputBox");
        hPanel.add(label);

        SimpleCheckBox checkBox = null;
        if (widget instanceof TextBox && parentTreeElement.isNillable()) {
            checkBox = new SimpleCheckBox();
            hPanel.add(checkBox);
            checkBox.addStyleName(WiseTreeItem.CSS_ENABLEBLK);
            ((TextBox) widget).addKeyUpHandler(new LeafKeyUpHandler(checkBox));
        }

        hPanel.add(widget);

        // validation of number fields
        if (widget instanceof ValueBox) {
            Label errorLabel = new Label("invalid input type");
            if (widget instanceof IntegerBox) {
                ((ValueBox) widget).addKeyUpHandler(new IntegerFieldValidator(treeItem, errorLabel));
            } else {
                ((ValueBox) widget).addKeyUpHandler(new NumberFieldValidator(treeItem, errorLabel));
            }
        }

        parentItem.addItem(treeItem);

        treeItem.setWTreeElement(parentTreeElement);
        treeItem.postCreateProcess();

    } else if (parentTreeElement instanceof ComplexTreeElement) {

        HorizontalPanel hPanel = new HorizontalPanel();
        hPanel.add(
                new Label(getBaseType(parentTreeElement.getClassType()) + " : " + parentTreeElement.getName()));
        SimpleCheckBox checkBox = new SimpleCheckBox();
        checkBox.setValue(true);

        hPanel.add(checkBox);
        WiseTreeItem treeItem = new WiseTreeItem(hPanel);
        checkBox.addClickHandler(new CheckBoxClickHandler(treeItem));

        for (TreeElement child : parentTreeElement.getChildren()) {
            generateDisplayObject(treeItem, child);
        }

        treeItem.setState(true);
        parentItem.addItem(treeItem);
        lazyLoadMap.put(parentTreeElement.getClassType(), parentTreeElement);

        treeItem.setWTreeElement(parentTreeElement);
        treeItem.postCreateProcess();

    } else if (parentTreeElement instanceof ParameterizedTreeElement) {

        HorizontalPanel hPanel = new HorizontalPanel();
        WiseTreeItem treeItem = new WiseTreeItem();
        treeItem.setWidget(hPanel);

        hPanel.add(new Label(parentTreeElement.getClassType() + " : " + parentTreeElement.getName()));

        for (TreeElement child : parentTreeElement.getChildren()) {
            generateDisplayObject(treeItem, child);
        }

        treeItem.setState(true);
        parentItem.addItem(treeItem);

        treeItem.setWTreeElement(parentTreeElement);
        treeItem.postCreateProcess();

    } else if (parentTreeElement instanceof GroupTreeElement) {

        WiseTreeItem treeItem = new WiseTreeItem();
        TreeElement gChild = ((GroupTreeElement) parentTreeElement).getProtoType();

        HorizontalPanel gPanel = new HorizontalPanel();
        Button addButton = new Button("add");
        addButton.addStyleName("wise-gwt-button-add");
        gPanel.add(new Label(getBaseType(parentTreeElement.getClassType()) + "<"
                + getBaseType(gChild.getClassType()) + ">" + " : " + parentTreeElement.getName()));
        gPanel.add(addButton);
        treeItem.setWidget(gPanel);

        addButton.addClickHandler(
                new AddParamerterizeBlockClickHandler(this, treeItem, (GroupTreeElement) parentTreeElement));
        parentItem.addItem(treeItem);

        treeItem.setWTreeElement(parentTreeElement);
        treeItem.postCreateProcess();

        if (!TreeElement.LAZY.equals(gChild.getKind())) {
            lazyLoadMap.put(gChild.getClassType(), gChild);
        }

    } else if (parentTreeElement instanceof EnumerationTreeElement) {
        WiseTreeItem treeItem = new WiseTreeItem();
        HorizontalPanel hPanel = createEnumerationPanel((EnumerationTreeElement) parentTreeElement);
        treeItem.setWidget(hPanel);
        treeItem.setState(true);

        parentItem.addItem(treeItem);

        treeItem.setWTreeElement(parentTreeElement);
        treeItem.postCreateProcess();

    } else {
        WiseTreeItem treeItem = new WiseTreeItem();
        HorizontalPanel hPanel = new HorizontalPanel();
        treeItem.addItem(hPanel);
        treeItem.setState(true);

        treeItem.setText("UNKNOWN: " + getBaseType(parentTreeElement.getClassType()) + " : "
                + parentTreeElement.getName() + "]");
        parentItem.addItem(treeItem);

        treeItem.setWTreeElement(parentTreeElement);
        treeItem.postCreateProcess();
    }

    return parentItem;
}

From source file:org.jbpm.formbuilder.client.effect.view.ValidationTablePanel.java

License:Apache License

public ValidationTablePanel() {
    validationsTable.setWidget(0, 0, new HTML("<strong>" + i18n.CurrentValidations() + "</strong>"));
    validationsTable.addClickHandler(new ClickHandler() {
        @Override//ww  w.ja va  2s  .  c  o m
        public void onClick(ClickEvent event) {
            for (Widget widget : validationsTable) {
                widget.removeStyleName("selectedValidationRow");
            }
            int row = getSelectedRow(event);
            if (row > 0) {
                Widget selectedWidget = validationsTable.getWidget(row, 0);
                if (selectedWidget.getStyleName().contains("selectedValidationRow")) {
                    selectedWidget.removeStyleName("selectedValidationRow");
                    setCurrentValidation(null);
                    fireSelectedValidation();
                } else {
                    selectedWidget.addStyleName("selectedValidationRow");
                    setCurrentValidation(currentValidations.get(row - 1));
                    fireSelectedValidation();
                }
            }
        }
    });
    add(validationsTable);
}

From source file:org.jrydberg.ui.client.ButtonBar.java

License:Apache License

public ButtonBar add(Widget button, int width) {
    button.addStyleName(resources.buttonBarCss().button());
    button.getElement().getStyle().setLeft(currentOffset, Unit.PX);
    button.getElement().getStyle().setWidth(width, Unit.PX);

    if (getWidgetCount() == 0) {
        button.addStyleName(resources.buttonBarCss().left());
    } else {//from  w  ww .  j  av a 2 s .  co m
        Widget oldButton = getWidget(getWidgetCount() - 1);
        if (getWidgetCount() > 1) {
            oldButton.removeStyleName(resources.buttonBarCss().right());
            oldButton.addStyleName(resources.buttonBarCss().middle());
        }
        button.addStyleName(resources.buttonBarCss().right());
    }
    add(button);
    currentOffset += width;

    return this;
}

From source file:org.jrydberg.ui.client.LayoutPanel.java

License:Apache License

public Layer add(Widget widget) {
    basePanel.add(widget);/*from  w  w  w. jav  a 2  s .co  m*/
    Layer layer = new Layer(widget);
    widget.addStyleName(resources.layoutPanelCss().layout());
    widget.setLayoutData(layer);
    return layer;
}