Package org.thechiselgroup.choosel.core.client.resources.ui

Examples of org.thechiselgroup.choosel.core.client.resources.ui.ResourceSetAvatar


        this.resourceLabelModifiable = resourceLabelModifiable;
    }

    @Override
    public ResourceSetAvatar createAvatar(final ResourceSet resources) {
        final ResourceSetAvatar avatar = delegate.createAvatar(resources);

        List<ResourceSetAvatarPopupWidgetFactoryAction> actionAdapters = new ArrayList<ResourceSetAvatarPopupWidgetFactoryAction>();
        for (Action action : actions) {
            actionAdapters
                    .add(new ActionToDragAvatarPopupWidgetFactoryActionAdapter(
                            viewAccessor, avatar, action));
        }

        final PopupManager popupManager = popupManagerFactory
                .createPopupManager(createWidget(resources, avatar,
                        actionAdapters));

        for (ResourceSetAvatarPopupWidgetFactoryAction action : actionAdapters) {
            ((ActionToDragAvatarPopupWidgetFactoryActionAdapter) action)
                    .setPopupManager(popupManager);
        }

        final HandlerRegistration link = popupManager.linkToWidget(avatar);

        popupManager.setEnabled(avatar.isEnabled());
        final HandlerRegistration handlerRegistration = avatar
                .addEnabledStatusHandler(new ResourceSetAvatarEnabledStatusEventHandler() {
                    @Override
                    public void onDragAvatarEnabledStatusChange(
                            ResourceSetAvatarEnabledStatusEvent event) {
                        popupManager.setEnabled(avatar.isEnabled());
                    }
                });

        avatar.addDisposable(new Disposable() {
            @Override
            public void dispose() {
                handlerRegistration.removeHandler();
                link.removeHandler();
            }
View Full Code Here


    public boolean canDrop(DragContext context) {
        if (!(context.draggable instanceof ResourceSetAvatar)) {
            return false;
        }

        ResourceSetAvatar avatar = getAvatar(context);

        /*
         * TODO we need the automatic visualization algorithm that takes the
         * current configuration and the new data and gives us a ranked list of
         * possible configurations. If that list is empty, we cannot drop.
View Full Code Here

        dragController.addDragHandler(handler);
    }

    @Override
    public ResourceSetAvatar createAvatar(ResourceSet resources) {
        final ResourceSetAvatar avatar = super.createAvatar(resources);

        /**
         * Removes the hover at the end of a drag and drop operation. Because
         * the resource set is already hovered, this saves the effort of
         * highlighting the resources again.
         */
        final DragHandlerAdapter dragHandler = new DragHandlerAdapter() {
            @Override
            public void onDragEnd(DragEndEvent event) {
                removeFromHover();
            }

        };

        addDragHandler(dragHandler);

        avatar.addDisposable(new Disposable() {
            @Override
            public void dispose() {
                removeDragHandler(dragHandler);
            }
        });
View Full Code Here

        this.dragController = dragController;
    }

    @Override
    public ResourceSetAvatar createAvatar(ResourceSet resources) {
        final ResourceSetAvatar avatar = new DraggableResourceSetAvatar(
                resources.getLabel(), enabledCSSClass, resources, type);

        final HandlerRegistration registration = avatar
                .addEnabledStatusHandler(new ResourceSetAvatarEnabledStatusEventHandler() {
                    @Override
                    public void onDragAvatarEnabledStatusChange(
                            ResourceSetAvatarEnabledStatusEvent event) {
                        updateAvatar(avatar);
                    }
                });

        avatar.addDisposable(new Disposable() {
            @Override
            public void dispose() {
                registration.removeHandler();
            }
        });

        // throws exception if we try to remove drag handle from avatar without
        // drag handle, so we need to check if enabled.
        if (avatar.isEnabled()) {
            updateAvatar(avatar);
        }

        return avatar;
    }
View Full Code Here

        this.dropTargetManager = dropTargetManager;
    }

    @Override
    public ResourceSetAvatar createAvatar(ResourceSet resources) {
        final ResourceSetAvatar avatar = delegate.createAvatar(resources);

        avatar.addDisposable(new Disposable() {
            @Override
            public void dispose() {
                dropTargetManager.disableDropTarget(avatar);
            }
        });
View Full Code Here

        this.commandManager = commandManager;
    }

    @Override
    public ResourceSetAvatar createAvatar(ResourceSet resources) {
        final ResourceSetAvatar avatar = delegate.createAvatar(resources);

        avatar.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                SelectionModel selectionModel = viewAccessor.findView(avatar)
                        .getSelectionModel();
                setSelection(selectionModel, avatar.getResourceSet());
            }
        });

        return avatar;
    }
View Full Code Here

        this.resourceLabelModifiable = resourceLabelModifiable;
    }

    @Override
    public ResourceSetAvatar createAvatar(final ResourceSet resources) {
        final ResourceSetAvatar avatar = delegate.createAvatar(resources);

        List<ResourceSetAvatarPopupWidgetFactoryAction> actionAdapters = new ArrayList<ResourceSetAvatarPopupWidgetFactoryAction>();
        for (Action action : actions) {
            actionAdapters
                    .add(new ActionToDragAvatarPopupWidgetFactoryActionAdapter(
                            viewAccessor, avatar, action));
        }

        final PopupManager popupManager = popupManagerFactory
                .createPopupManager(createWidget(resources, avatar,
                        actionAdapters));

        for (ResourceSetAvatarPopupWidgetFactoryAction action : actionAdapters) {
            ((ActionToDragAvatarPopupWidgetFactoryActionAdapter) action)
                    .setPopupManager(popupManager);
        }

        final HandlerRegistration link = popupManager.linkToWidget(avatar);

        popupManager.setEnabled(avatar.isEnabled());
        final HandlerRegistration handlerRegistration = avatar
                .addEnabledStatusHandler(new ResourceSetAvatarEnabledStatusEventHandler() {
                    @Override
                    public void onDragAvatarEnabledStatusChange(
                            ResourceSetAvatarEnabledStatusEvent event) {
                        popupManager.setEnabled(avatar.isEnabled());
                    }
                });

        avatar.addDisposable(new Disposable() {
            @Override
            public void dispose() {
                handlerRegistration.removeHandler();
                link.removeHandler();
            }
View Full Code Here

TOP

Related Classes of org.thechiselgroup.choosel.core.client.resources.ui.ResourceSetAvatar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.