本文整理汇总了Java中com.vaadin.event.dd.DropHandler类的典型用法代码示例。如果您正苦于以下问题:Java DropHandler类的具体用法?Java DropHandler怎么用?Java DropHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DropHandler类属于com.vaadin.event.dd包,在下文中一共展示了DropHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFilterButtonDropHandler
import com.vaadin.event.dd.DropHandler; //导入依赖的package包/类
@Override
protected DropHandler getFilterButtonDropHandler() {
return new DropHandler() {
private static final long serialVersionUID = 1L;
@Override
public AcceptCriterion getAcceptCriterion() {
return managementViewClientCriterion;
}
@Override
public void drop(final DragAndDropEvent event) {
if (validate(event) && isNoTagAssigned(event)) {
final TableTransferable tbl = (TableTransferable) event.getTransferable();
final Table source = tbl.getSourceComponent();
if (source.getId().equals(UIComponentIdProvider.TARGET_TABLE_ID)) {
UI.getCurrent().access(() -> processTargetDrop(event));
}
}
}
};
}
示例2: getFilterButtonDropHandler
import com.vaadin.event.dd.DropHandler; //导入依赖的package包/类
@Override
protected DropHandler getFilterButtonDropHandler() {
return new DropHandler() {
private static final long serialVersionUID = 1L;
@Override
public AcceptCriterion getAcceptCriterion() {
return uploadViewClientCriterion;
}
@Override
public void drop(final DragAndDropEvent event) {
/* Not required */
}
};
}
示例3: getDropFilterHandler
import com.vaadin.event.dd.DropHandler; //导入依赖的package包/类
@Override
protected DropHandler getDropFilterHandler() {
return new DropHandler() {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void drop(final DragAndDropEvent event) {
filterByDroppedDist(event);
}
@Override
public AcceptCriterion getAcceptCriterion() {
return managementViewClientCriterion;
}
};
}
示例4: getFilterButtonDropHandler
import com.vaadin.event.dd.DropHandler; //导入依赖的package包/类
@Override
protected DropHandler getFilterButtonDropHandler() {
return new DropHandler() {
private static final long serialVersionUID = 1L;
@Override
public AcceptCriterion getAcceptCriterion() {
return distributionsViewClientCriterion;
}
@Override
public void drop(final DragAndDropEvent event) {
/* Not required */
}
};
}
示例5: getTableDropHandler
import com.vaadin.event.dd.DropHandler; //导入依赖的package包/类
private DropHandler getTableDropHandler() {
return new DropHandler() {
private static final long serialVersionUID = 1L;
@Override
public AcceptCriterion getAcceptCriterion() {
return getDropAcceptCriterion();
}
@Override
public void drop(final DragAndDropEvent event) {
if (!isDropValid(event)) {
return;
}
if (event.getTransferable().getSourceComponent() instanceof Table) {
onDropEventFromTable(event);
} else if (event.getTransferable().getSourceComponent() instanceof DragAndDropWrapper) {
onDropEventFromWrapper(event);
}
}
};
}
示例6: initTree
import com.vaadin.event.dd.DropHandler; //导入依赖的package包/类
private void initTree() {
this.setSizeFull();
this.setImmediate(true);
this.setSelectable(true);
this.addItemClickListener(this);
this.addContainerProperty("", String.class, null);
this.addContainerProperty(ACTIONS, HorizontalLayout.class, null );
this.addItem(new Object[] {TOOL, getActionLayout(false, false, TOOL)}, TOOL);
this.setItemDescriptionGenerator(new ItemDescriptionGenerator() {
private static final long serialVersionUID = -1913286695570843896L;
@Override
public String generateDescription(Component source, Object itemId,
Object propertyId) {
String description = "Show all ";
if(itemId.equals(TOOL))
description += "elements";
else if (itemId.equals(INPUTS))
description += "inputs";
else if (itemId.equals(OUTPUTS))
description += "outputs";
else if (itemId.equals(PARAMETERS))
description += "parameters";
else
return null;
return description;
}
});
this.setCollapsed(TOOL, false);
String[] rootToolElements = new String[] {INPUTS, OUTPUTS, PARAMETERS};
for(String element : rootToolElements) {
this.addItem(new Object[] {element, getActionLayout(true, false, element)}, element);
this.setParent(element, TOOL);
this.setCollapsed(element, false);
}
this.setDragMode(TableDragMode.ROW);
this.setDropHandler(new DropHandler() {
private static final long serialVersionUID = -4415321436294383112L;
@Override
public AcceptCriterion getAcceptCriterion() {
return new Or(Tree.TargetItemAllowsChildren.get(), new Not(VerticalLocationIs.MIDDLE));
}
@Override
public void drop(DragAndDropEvent event) {
final Transferable t = event.getTransferable();
if (t.getSourceComponent() != TreeToolEditor.this
|| !(t instanceof DataBoundTransferable)) {
return;
}
final AbstractSelectTargetDetails dropData = ((AbstractSelectTargetDetails) event.getTargetDetails());
final Object sourceItemId = ((DataBoundTransferable) t).getItemId();
final Object targetItemId = dropData.getItemIdOver();
final VerticalDropLocation location = dropData.getDropLocation();
moveNode(sourceItemId, targetItemId, location);
}
});
}
示例7: getDropHandler
import com.vaadin.event.dd.DropHandler; //导入依赖的package包/类
/**
* Get the currently active drop handler
*/
@Override
public DropHandler getDropHandler() {
return dropHandler;
}
示例8: getDropHandler
import com.vaadin.event.dd.DropHandler; //导入依赖的package包/类
@Override
public DropHandler getDropHandler() {
return dropHandler;
}
示例9: buildMenuItems
import com.vaadin.event.dd.DropHandler; //导入依赖的package包/类
private Component buildMenuItems() {
CssLayout menuItemsLayout = new CssLayout();
menuItemsLayout.addStyleName("valo-menuitems");
for (final DashboardViewType view : DashboardViewType.values()) {
Component menuItemComponent = new ValoMenuItemButton(view);
if (view == DashboardViewType.REPORTS) {
// Add drop target to reports button
DragAndDropWrapper reports = new DragAndDropWrapper(
menuItemComponent);
reports.setSizeUndefined();
reports.setDragStartMode(DragStartMode.NONE);
reports.setDropHandler(new DropHandler() {
@Override
public void drop(final DragAndDropEvent event) {
UI.getCurrent()
.getNavigator()
.navigateTo(
DashboardViewType.REPORTS.getViewName());
Table table = (Table) event.getTransferable()
.getSourceComponent();
DashboardEventBus.post(new TransactionReportEvent(
(Collection<Transaction>) table.getValue()));
}
@Override
public AcceptCriterion getAcceptCriterion() {
return AcceptItem.ALL;
}
});
menuItemComponent = reports;
}
if (view == DashboardViewType.DASHBOARD) {
notificationsBadge = new Label();
notificationsBadge.setId(NOTIFICATIONS_BADGE_ID);
menuItemComponent = buildBadgeWrapper(menuItemComponent,
notificationsBadge);
}
if (view == DashboardViewType.REPORTS) {
reportsBadge = new Label();
reportsBadge.setId(REPORTS_BADGE_ID);
menuItemComponent = buildBadgeWrapper(menuItemComponent,
reportsBadge);
}
menuItemsLayout.addComponent(menuItemComponent);
}
return menuItemsLayout;
}
示例10: initDragAndDrop
import com.vaadin.event.dd.DropHandler; //导入依赖的package包/类
@Override
public void initDragAndDrop(Table<User> usersTable, Tree<Group> groupsTree, Consumer<UserGroupChangedEvent> userGroupChangedHandler) {
com.vaadin.ui.Table vTable = usersTable.unwrap(com.vaadin.ui.Table.class);
vTable.setDragMode(com.vaadin.ui.Table.TableDragMode.MULTIROW);
CubaTree vTree = groupsTree.unwrap(CubaTree.class);
vTree.setDragMode(com.vaadin.ui.Tree.TreeDragMode.NODE);
vTree.setDropHandler(new DropHandler() {
@Override
public void drop(DragAndDropEvent dropEvent) {
DataBoundTransferable transferable = (DataBoundTransferable) dropEvent.getTransferable();
AbstractSelect.AbstractSelectTargetDetails dropData =
((AbstractSelect.AbstractSelectTargetDetails) dropEvent.getTargetDetails());
Component sourceComponent = transferable.getSourceComponent();
List<User> users = null;
if (sourceComponent instanceof com.vaadin.ui.Table) {
users = new ArrayList<>(usersTable.getSelected());
}
if (users == null) {
return;
}
if (users.isEmpty()) {
User user = convertToEntity(vTable.getItem(transferable.getItemId()), User.class);
users.add(user);
}
final Object targetItemId = dropData.getItemIdOver();
if (targetItemId == null) {
return;
}
Group group = convertToEntity(vTree.getItem(targetItemId), Group.class);
if (group == null) {
return;
}
userGroupChangedHandler.accept(new UserGroupChangedEvent(groupsTree, users, group));
}
@Override
public AcceptCriterion getAcceptCriterion() {
return new And(AbstractSelect.AcceptItem.ALL);
}
});
}
示例11: getFilterButtonDropHandler
import com.vaadin.event.dd.DropHandler; //导入依赖的package包/类
@Override
protected DropHandler getFilterButtonDropHandler() {
return spDistTagDropEvent;
}
示例12: getDropFilterHandler
import com.vaadin.event.dd.DropHandler; //导入依赖的package包/类
@Override
protected DropHandler getDropFilterHandler() {
return null;
}
示例13: MilestoneTicketGroupComponent
import com.vaadin.event.dd.DropHandler; //导入依赖的package包/类
MilestoneTicketGroupComponent(Integer milestoneId) {
this.setMargin(new MarginInfo(true, false, true, false));
wrapBody = new DDVerticalLayout();
wrapBody.setWidth("100%");
wrapBody.addStyleName(WebThemes.BORDER_LIST);
headerLbl = ELabel.h3("");
MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class);
if (milestoneId == null) {
headerGroup = new MVerticalLayout(headerLbl).withMargin(false);
} else {
milestone = milestoneService.findById(milestoneId, AppUI.getAccountId());
if (milestone != null) {
ELabel milestoneDateLbl = new ELabel(UserUIContext.getMessage(GenericI18Enum.OPT_FROM_TO,
UserUIContext.formatDate(milestone.getStartdate()), UserUIContext.formatDate(milestone.getEnddate())))
.withStyleName(UIConstants.META_INFO);
headerGroup = new MVerticalLayout(headerLbl, milestoneDateLbl).withMargin(false);
} else {
headerGroup = new MVerticalLayout(headerLbl).withMargin(false);
}
}
with(headerGroup);
addComponent(wrapBody);
wrapBody.setComponentVerticalDropRatio(0.3f);
wrapBody.setDragMode(LayoutDragMode.CLONE);
wrapBody.setDropHandler(new DropHandler() {
@Override
public void drop(DragAndDropEvent event) {
LayoutBoundTransferable transferable = (LayoutBoundTransferable) event.getTransferable();
DDVerticalLayout.VerticalLayoutTargetDetails details = (DDVerticalLayout.VerticalLayoutTargetDetails) event
.getTargetDetails();
Component dragComponent = transferable.getComponent();
if (dragComponent instanceof TicketRowRenderer) {
TicketRowRenderer ticketRowRenderer = (TicketRowRenderer) dragComponent;
MilestoneTicketGroupComponent originalMilestoneContainer = UIUtils.getRoot(ticketRowRenderer,
MilestoneTicketGroupComponent.class);
ProjectTicket ticket = ticketRowRenderer.getTicket();
ticket.setMilestoneId(milestoneId);
AppContextUtil.getSpringBean(ProjectTicketService.class).updateTicket(ticket, UserUIContext.getUsername());
wrapBody.addComponent(ticketRowRenderer);
updateTitle();
if (originalMilestoneContainer != null) {
originalMilestoneContainer.updateTitle();
}
}
}
@Override
public AcceptCriterion getAcceptCriterion() {
return new Not(VerticalLocationIs.MIDDLE);
}
});
}
示例14: setDropHandler
import com.vaadin.event.dd.DropHandler; //导入依赖的package包/类
public void setDropHandler(DropHandler dropHandler)
{
selectableTable.setDropHandler(dropHandler);
}
示例15: setDropHandler
import com.vaadin.event.dd.DropHandler; //导入依赖的package包/类
/**
* Set the drop handler for the calendar See {@link DropHandler} for
* implementation details.
*
* @param dropHandler
* The drop handler to set
*/
public void setDropHandler(DropHandler dropHandler) {
this.dropHandler = dropHandler;
}