Example usage for com.vaadin.shared.communication URLReference getURL

List of usage examples for com.vaadin.shared.communication URLReference getURL

Introduction

In this page you can find the example usage for com.vaadin.shared.communication URLReference getURL.

Prototype

public String getURL() 

Source Link

Document

Returns the URL that this object refers to.

Usage

From source file:com.haulmont.cuba.web.toolkit.ui.client.orderedactionslayout.CubaOrderedActionsLayoutConnector.java

License:Apache License

@Override
protected void updateCaptionInternal(ComponentConnector child) {
    // CAUTION copied from superclass
    CubaOrderedLayoutSlot slot = (CubaOrderedLayoutSlot) getWidget().getSlot(child.getWidget());

    String caption = child.getState().caption;
    URLReference iconUrl = child.getState().resources.get(ComponentConstants.ICON_RESOURCE);
    String iconUrlString = iconUrl != null ? iconUrl.getURL() : null;
    Icon icon = child.getConnection().getIcon(iconUrlString);

    List<String> styles = child.getState().styles;
    String error = child.getState().errorMessage;
    boolean showError = error != null;
    if (child.getState() instanceof AbstractFieldState) {
        AbstractFieldState abstractFieldState = (AbstractFieldState) child.getState();
        showError = showError && !abstractFieldState.hideErrors;
    }//from   w w w. ja v a2  s.  c om
    boolean required = false;
    if (child instanceof AbstractFieldConnector) {
        required = ((AbstractFieldConnector) child).isRequired();
    }
    boolean enabled = child.isEnabled();

    if (slot.hasCaption() && null == caption) {
        slot.setCaptionResizeListener(null);
    }

    // Haulmont API
    boolean contextHelpIconEnabled = isContextHelpIconEnabled(child.getState());

    // Haulmont API
    slot.setCaption(caption, contextHelpIconEnabled, icon, styles, error, showError, required, enabled,
            child.getState().captionAsHtml);

    AriaHelper.handleInputRequired(child.getWidget(), required);
    AriaHelper.handleInputInvalid(child.getWidget(), showError);
    AriaHelper.bindCaption(child.getWidget(), slot.getCaptionElement());

    if (slot.hasCaption()) {
        CaptionPosition pos = slot.getCaptionPosition();
        slot.setCaptionResizeListener(slotCaptionResizeListener);
        if (child.isRelativeHeight() && (pos == CaptionPosition.TOP || pos == CaptionPosition.BOTTOM)) {
            getWidget().updateCaptionOffset(slot.getCaptionElement());
        } else if (child.isRelativeWidth() && (pos == CaptionPosition.LEFT || pos == CaptionPosition.RIGHT)) {
            getWidget().updateCaptionOffset(slot.getCaptionElement());
        }
    }
}

From source file:com.haulmont.cuba.web.widgets.client.orderedactionslayout.CubaOrderedActionsLayoutConnector.java

License:Apache License

@Override
protected void updateCaptionInternal(ComponentConnector child) {
    // CAUTION copied from superclass
    CubaOrderedLayoutSlot slot = (CubaOrderedLayoutSlot) getWidget().getSlot(child.getWidget());

    String caption = child.getState().caption;
    URLReference iconUrl = child.getState().resources.get(ComponentConstants.ICON_RESOURCE);
    String iconUrlString = iconUrl != null ? iconUrl.getURL() : null;
    Icon icon = child.getConnection().getIcon(iconUrlString);

    List<String> styles = child.getState().styles;
    String error = child.getState().errorMessage;
    boolean showError = error != null;
    if (child.getState() instanceof AbstractFieldState) {
        AbstractFieldState abstractFieldState = (AbstractFieldState) child.getState();
        // vaadin8 rework
        //            showError = showError && !abstractFieldState.hideErrors;
    }//from ww w.  ja v a2  s  .c  o m
    boolean required = false;
    if (child instanceof AbstractFieldConnector) {
        required = ((AbstractFieldConnector) child).isRequiredIndicatorVisible();
    }
    boolean enabled = child.isEnabled();

    if (slot.hasCaption() && null == caption) {
        slot.setCaptionResizeListener(null);
    }

    // Haulmont API
    boolean contextHelpIconEnabled = isContextHelpIconEnabled(child.getState());

    // Haulmont API
    slot.setCaption(caption, contextHelpIconEnabled, icon, styles, error, showError, required, enabled,
            child.getState().captionAsHtml);

    AriaHelper.handleInputRequired(child.getWidget(), required);
    AriaHelper.handleInputInvalid(child.getWidget(), showError);
    AriaHelper.bindCaption(child.getWidget(), slot.getCaptionElement());

    if (slot.hasCaption()) {
        CaptionPosition pos = slot.getCaptionPosition();
        slot.setCaptionResizeListener(slotCaptionResizeListener);
        if (child.isRelativeHeight() && (pos == CaptionPosition.TOP || pos == CaptionPosition.BOTTOM)) {
            getWidget().updateCaptionOffset(slot.getCaptionElement());
        } else if (child.isRelativeWidth() && (pos == CaptionPosition.LEFT || pos == CaptionPosition.RIGHT)) {
            getWidget().updateCaptionOffset(slot.getCaptionElement());
        }
    }
}

From source file:org.vaadin.addons.portallayout.gwt.client.portal.connection.PortalLayoutConnector.java

License:Apache License

@Override
public void updateCaption(ComponentConnector connector) {
    if (getState().contentToPortlet.get(connector) != null) {
        final PortletConnector pc = (PortletConnector) getState().contentToPortlet.get(connector);
        pc.setCaption(connector.getState().caption);
        URLReference iconRef = connector.getState().resources.get(ComponentConstants.ICON_RESOURCE);
        pc.setIcon(iconRef != null ? iconRef.getURL() : null);
    }//from   www . j av  a  2s.c o m
}