Example usage for com.vaadin.ui DragAndDropWrapper addStyleName

List of usage examples for com.vaadin.ui DragAndDropWrapper addStyleName

Introduction

In this page you can find the example usage for com.vaadin.ui DragAndDropWrapper addStyleName.

Prototype

@Override
    public void addStyleName(String style) 

Source Link

Usage

From source file:org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtons.java

License:Open Source License

private DragAndDropWrapper createDragAndDropWrapper(final Button tagButton, final String name, final Long id) {
    final DragAndDropWrapper bsmBtnWrapper = new DragAndDropWrapper(tagButton);
    bsmBtnWrapper.addStyleName(ValoTheme.DRAG_AND_DROP_WRAPPER_NO_VERTICAL_DRAG_HINTS);
    bsmBtnWrapper.addStyleName(ValoTheme.DRAG_AND_DROP_WRAPPER_NO_HORIZONTAL_DRAG_HINTS);
    bsmBtnWrapper.addStyleName(SPUIStyleDefinitions.FILTER_BUTTON_WRAPPER);
    if (getButtonWrapperData() != null) {
        if (id == null) {
            bsmBtnWrapper.setData(getButtonWrapperData());
        } else {/*from w w  w. ja va2  s .c  o m*/
            bsmBtnWrapper.setData(getButtonWrapperData().concat("" + id));
        }
    }
    bsmBtnWrapper.setId(getButttonWrapperIdPrefix().concat(name));
    bsmBtnWrapper.setDragStartMode(DragStartMode.WRAPPER);
    bsmBtnWrapper.setDropHandler(getFilterButtonDropHandler());
    return bsmBtnWrapper;
}

From source file:org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout.java

License:Open Source License

private DragAndDropWrapper createDeleteWrapperLayout() {
    final Button dropToDelete = new Button(i18n.getMessage("label.components.drop.area"));
    dropToDelete.setCaptionAsHtml(true);
    dropToDelete.setIcon(FontAwesome.TRASH_O);
    dropToDelete.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    dropToDelete.addStyleName("drop-to-delete-button");
    dropToDelete.addStyleName(SPUIStyleDefinitions.ACTION_BUTTON);
    dropToDelete.addStyleName(SPUIStyleDefinitions.DEL_ACTION_BUTTON);
    dropToDelete.addStyleName("delete-icon");

    final DragAndDropWrapper wrapper = new DragAndDropWrapper(dropToDelete);
    wrapper.setStyleName(ValoTheme.BUTTON_PRIMARY);
    wrapper.setId(getDeleteAreaId());/*from  w  w w .  ja va  2s  .c om*/
    wrapper.setDropHandler(this);
    wrapper.addStyleName("delete-button-border");
    return wrapper;
}

From source file:org.lucidj.browser.AbstractCell.java

License:Apache License

private Component build_left_panel() {
    left_panel = new CssLayout();
    left_panel.setWidth(32, Sizeable.Unit.PIXELS);
    left_panel.addStyleName("cell-panel-left");
    left_panel.setHeight(100, Sizeable.Unit.PERCENTAGE);

    String icon_url = "/VAADIN/~/formulas/impossible.png";
    String icon_title = "The Unknown";

    ComponentInterface component_interface = Aggregate.adapt(ComponentInterface.class, source_object);
    if (component_interface != null) {
        // If it is a valid component, displays its icon on the top left corner of the cell
        ComponentDescriptor descriptor = (ComponentDescriptor) component_interface
                .getProperty(ComponentDescriptor.DESCRIPTOR);

        if (descriptor != null) {
            icon_url = descriptor.getIconUrl();
            icon_title = descriptor.getIconTitle();
        }// w ww  . j  a v a 2  s . c o  m
    }

    String component_icon_html = "<img class='component-icon' src='" + icon_url + "' title='"
            + SafeHtmlUtils.htmlEscape(icon_title) + "'/>";
    component_icon = new Label(component_icon_html, ContentMode.HTML);
    left_panel.addComponent(component_icon);

    // Put the component in a D&D wrapper and allow dragging it
    final DragAndDropWrapper panel_dd_wrap = new DragAndDropWrapper(left_panel);
    panel_dd_wrap.setDragStartMode(DragAndDropWrapper.DragStartMode.COMPONENT_OTHER);
    panel_dd_wrap.setDragImageComponent(component_icon);
    panel_dd_wrap.addStyleName("no-horizontal-drag-hints");
    panel_dd_wrap.addStyleName("no-box-drag-hints");

    // Set the wrapper to wrap tightly around the component
    panel_dd_wrap.setHeight(100, Sizeable.Unit.PERCENTAGE);
    panel_dd_wrap.setWidthUndefined();
    panel_dd_wrap.setId("test");

    // Setup DD handlers for component insertion
    panel_dd_wrap.setData(this);
    panel_dd_wrap.setDropHandler(this);

    // While left_panel is kept in order to be customized, here we return D&D wrapper
    return (panel_dd_wrap);
}

From source file:org.vaadin.alump.masonry.DnDMasonryLayout.java

License:Apache License

/**
 * Create DnD wrapper for component if not yet defined
 * @param component Component wrapped//w  w w .j ava 2 s  . c o m
 * @return Wrapper made or found
 */
protected DragAndDropWrapper createComponentDnDWrapper(Component component, String wrapperStyleName) {
    DragAndDropWrapper wrapper = getComponentDnDWrapper(component);
    if (wrapper == null) {
        wrapper = new DragAndDropWrapper(component);
        wrapper.addStyleName("masonry-dnd-wrapper");
        if (wrapperStyleName != null) {
            wrapper.addStyleName(wrapperStyleName);
        }
        wrapper.setDragStartMode(allowReorder ? getComponentDragStartMode() : DragStartMode.NONE);
        wrapper.setDropHandler(createDropHandlerForComponents(wrapper));
    }
    return wrapper;
}