Example usage for com.vaadin.ui Component getId

List of usage examples for com.vaadin.ui Component getId

Introduction

In this page you can find the example usage for com.vaadin.ui Component getId.

Prototype

public String getId();

Source Link

Document

Gets currently set debug identifier.

Usage

From source file:org.eclipse.hawkbit.ui.management.footer.DeleteActionsLayoutHelper.java

License:Open Source License

static boolean isTargetTable(final Component source) {
    return UIComponentIdProvider.TARGET_TABLE_ID.equalsIgnoreCase(source.getId());
}

From source file:org.eclipse.hawkbit.ui.management.footer.DeleteActionsLayoutHelper.java

License:Open Source License

static boolean isDistributionTable(final Component source) {
    return UIComponentIdProvider.DIST_TABLE_ID.equalsIgnoreCase(source.getId());
}

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

License:Apache License

@Override // DropHandler
public void drop(DragAndDropEvent dragAndDropEvent) {
    log.info("**** DROP! {}", dragAndDropEvent);

    final Transferable transferable = dragAndDropEvent.getTransferable();
    final Component sourceComponent = transferable.getSourceComponent();

    log.info("sourceComponent = {}", sourceComponent);

    final TargetDetails dropTargetData = dragAndDropEvent.getTargetDetails();
    final DropTarget target = dropTargetData.getTarget();

    log.info("DROP: source={} target={}", sourceComponent, target);

    String pos = (String) dropTargetData.getData("verticalLocation");
    String canonical_name = sourceComponent.getId();
    Object source_cell = ((DragAndDropWrapper) sourceComponent).getData();
    Object source_object = (source_cell instanceof AbstractCell)
            ? ((AbstractCell) source_cell).getSourceObject()
            : null;/*from   w  w  w  .  ja v a 2s  .com*/
    Object target_cell = ((DragAndDropWrapper) target).getData();
    Object target_object = (target_cell instanceof AbstractCell)
            ? ((AbstractCell) target_cell).getSourceObject()
            : null;

    log.info("D&D: source=[{}, {}] => target=[{}, {}]", source_cell, source_object, target_cell, target_object);

    if (target_object == null) {
        insertNewObjectBefore(canonical_name, null);
    } else if (pos.equals(VerticalDropLocation.BOTTOM.toString())) {
        if (source_cell instanceof AbstractCell) {
            if (source_object != target_object) {
                log.info("Move AFTER component #{}: {} {}", target_object, source_cell, canonical_name);
                moveObjectAfter(source_object, target_object);
            }
        } else {
            log.info("Drop AFTER component #{}: {} {}", target_object, source_cell, canonical_name);
            insertNewObjectAfter(canonical_name, target_object);
        }
    } else if (pos.equals(VerticalDropLocation.TOP.toString())) {
        if (source_cell instanceof AbstractCell) {
            if (source_object != target_object) {
                log.info("Move BEFORE component #{}: {} {}", target_object, source_cell, canonical_name);
                moveObjectBefore(source_object, target_object);
            }
        } else {
            log.info("Drop BEFORE component #{}: {} {}", target_object, source_cell, canonical_name);
            insertNewObjectBefore(canonical_name, target_object);
        }
    }
}

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

License:Apache License

private void build_sidebar() {
    acSidebar = new Accordion();
    acSidebar.setSizeFull();/*from w w w.  ja  v a  2s  . co  m*/
    acSidebar.addStyleName("borderless");

    sidebar = new ComponentPalette(componentManager.newComponentSet());
    sidebar.setWidth(100, Unit.PERCENTAGE);
    sidebar.setHeightUndefined();
    sidebar.setPaletteClickListener(new LayoutEvents.LayoutClickListener() {
        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent layoutClickEvent) {
            Component clicked = layoutClickEvent.getClickedComponent();
            String canonical_name = clicked != null ? clicked.getId() : null;

            log.info("layoutClick: DoubleClick clicked={} canonical_name={}", clicked, canonical_name);

            // Handle double-clicking a component inside the palette
            if (canonical_name != null && layoutClickEvent.isDoubleClick()) {
                log.info("layoutClick: DoubleClick clicked={} canonical_name={}", clicked, canonical_name);
                int cell_index = get_current_cell_index();
                Object new_object = insert_new_cell(canonical_name, cell_index + 1);
                update_cell_focus(new_object, true);
            }
        }
    });

    acSidebar.addTab(sidebar, "Components");

    acSidebar.addTab(new Label("Hello world"), "Visualization");
}