Example usage for com.vaadin.client VCaption isNeeded

List of usage examples for com.vaadin.client VCaption isNeeded

Introduction

In this page you can find the example usage for com.vaadin.client VCaption isNeeded.

Prototype

public static boolean isNeeded(ComponentConnector connector) 

Source Link

Usage

From source file:com.haulmont.cuba.web.toolkit.ui.client.gridlayout.CubaGridLayoutConnector.java

License:Apache License

@Override
public void updateCaption(ComponentConnector childConnector) {
    // CAUTION copied from GridLayoutConnector.updateCaption(ComponentConnector childConnector)
    VGridLayout layout = getWidget();//ww  w  .  j a v  a 2  s  .c om
    VGridLayout.Cell cell = layout.widgetToCell.get(childConnector.getWidget());
    AbstractComponentState state = childConnector.getState();
    if (VCaption.isNeeded(state) || isContextHelpIconEnabled(state)) {
        VLayoutSlot layoutSlot = cell.slot;
        VCaption caption = layoutSlot.getCaption();
        if (caption == null) {
            // use our own caption widget
            caption = new CubaCaptionWidget(childConnector, getConnection());

            setDefaultCaptionParameters((CubaCaptionWidget) caption);

            Widget widget = childConnector.getWidget();

            layout.setCaption(widget, caption);
        }
        caption.updateCaption();
    } else {
        layout.setCaption(childConnector.getWidget(), null);
        getLayoutManager().setNeedsLayout(this);
    }
}

From source file:com.haulmont.cuba.web.widgets.client.addons.popupbutton.PopupButtonConnector.java

License:Apache License

public void updateCaption(ComponentConnector component) {
    if (VCaption.isNeeded(component)) {
        if (getWidget().popup.getCaptionWrapper() != null) {
            getWidget().popup.getCaptionWrapper().updateCaption();
        } else {// w w w.jav a 2  s .  c o  m
            VCaptionWrapper captionWrapper = new VCaptionWrapper(component, getConnection());
            getWidget().popup.setWidget(captionWrapper);
            captionWrapper.updateCaption();
        }
    } else {
        if (getWidget().popup.getCaptionWrapper() != null) {
            getWidget().popup
                    .setWidget(getWidget().popup.getCaptionWrapper().getWrappedConnector().getWidget());
        }
    }
}

From source file:com.haulmont.cuba.web.widgets.client.gridlayout.CubaGridLayoutConnector.java

License:Apache License

@Override
public void updateCaption(ComponentConnector childConnector) {
    // CAUTION copied from GridLayoutConnector.updateCaption(ComponentConnector childConnector)
    VGridLayout layout = getWidget();//  w  w w  .j av  a 2s  .c om
    VGridLayout.Cell cell = layout.widgetToCell.get(childConnector.getWidget());
    AbstractComponentState state = childConnector.getState();
    if (VCaption.isNeeded(childConnector) || isContextHelpIconEnabled(state)) {
        VLayoutSlot layoutSlot = cell.slot;
        VCaption caption = layoutSlot.getCaption();
        if (caption == null) {
            // use our own caption widget
            caption = new CubaCaptionWidget(childConnector, getConnection());

            setDefaultCaptionParameters((CubaCaptionWidget) caption);

            Widget widget = childConnector.getWidget();

            layout.setCaption(widget, caption);
        }
        caption.updateCaption();
    } else {
        layout.setCaption(childConnector.getWidget(), null);
        getLayoutManager().setNeedsLayout(this);
    }
}