Example usage for com.google.gwt.event.shared HandlerManager HandlerManager

List of usage examples for com.google.gwt.event.shared HandlerManager HandlerManager

Introduction

In this page you can find the example usage for com.google.gwt.event.shared HandlerManager HandlerManager.

Prototype

public HandlerManager(Object source) 

Source Link

Document

Creates a handler manager with a source to be set on all events fired via #fireEvent(GwtEvent) .

Usage

From source file:org.thechiselgroup.biomixer.client.core.label.DefaultHasLabel.java

License:Apache License

public DefaultHasLabel(HasLabel eventSource) {
    assert eventSource != null;

    this.eventSource = eventSource;
    this.eventBus = new HandlerManager(eventSource);
}

From source file:org.thechiselgroup.biomixer.client.core.resources.ProxyResourceSet.java

License:Apache License

public ProxyResourceSet(ResourceSet delegate) {
    super(delegate);

    eventBus = new HandlerManager(this);

    addEventHandlersToDelegate();
}

From source file:org.thechiselgroup.biomixer.client.core.resources.ResourceGrouping.java

License:Apache License

@Inject
public ResourceGrouping(ResourceMultiCategorizer multiCategorizer, ResourceSetFactory resourceSetFactory) {

    this.multiCategorizer = multiCategorizer;
    this.resourceSetFactory = resourceSetFactory;
    this.uncategorizableResources = resourceSetFactory.createResourceSet();
    this.allResources = new ProxyResourceSet(resourceSetFactory.createResourceSet());

    eventBus = new HandlerManager(this);

    allResources.addEventHandler(new ResourceSetChangedEventHandler() {
        @Override//www  .j  a  va2s.  com
        public void onResourceSetChanged(ResourceSetChangedEvent event) {
            change(event.getAddedResources(), event.getRemovedResources());
        }
    });
}

From source file:org.thechiselgroup.biomixer.client.core.resources.ResourceSetContainer.java

License:Apache License

@Inject
public ResourceSetContainer() {
    eventBus = new HandlerManager(this);
}

From source file:org.thechiselgroup.biomixer.client.core.ui.Action.java

License:Apache License

public Action(String name, Command command, String normalIconUrl, String disabledIconUrl,
        String highlightedIconUrl, boolean enabled, String description) {

    assert name != null;
    assert command != null;

    this.command = command;
    this.name = name;
    this.description = description;
    this.normalIconUrl = normalIconUrl;
    this.disabledIconUrl = disabledIconUrl;
    this.highlightedIconUrl = highlightedIconUrl;
    this.enabled = enabled;

    this.eventBus = new HandlerManager(this);
}

From source file:org.thechiselgroup.biomixer.client.core.util.event.PrioritizedHandlerManager.java

License:Apache License

public PrioritizedHandlerManager(Object source) {
    assert source != null;

    firstPriorityHandlers = new HandlerManager(source);
    normalPriorityHandlers = new HandlerManager(source);
    lastPriorityHandlers = new HandlerManager(source);
}

From source file:org.thechiselgroup.biomixer.client.core.util.HandlerManagerProvider.java

License:Apache License

@Override
public HandlerManager get() {
    // TODO check what source should be...
    return new HandlerManager(new Object());
}

From source file:org.thechiselgroup.biomixer.client.core.visualization.model.extensions.DefaultSelectionModel.java

License:Apache License

public DefaultSelectionModel(LabelProvider selectionModelLabelFactory, ResourceSetFactory resourceSetFactory) {

    assert selectionModelLabelFactory != null;
    assert resourceSetFactory != null;

    this.selectionModelLabelFactory = selectionModelLabelFactory;
    this.resourceSetFactory = resourceSetFactory;

    eventBus = new HandlerManager(this);
}

From source file:org.thechiselgroup.biomixer.client.core.visualization.model.managed.DefaultManagedSlotMappingConfiguration.java

License:Apache License

public DefaultManagedSlotMappingConfiguration(VisualItemValueResolverFactoryProvider resolverProvider,
        SlotMappingInitializer slotMappingInitializer, VisualizationModel visualizationModel,
        VisualItemResolutionErrorModel errorModel) {

    assert resolverProvider != null;
    assert slotMappingInitializer != null;
    assert visualizationModel != null;
    assert errorModel != null;

    this.resolverProvider = resolverProvider;
    this.slotMappingInitializer = slotMappingInitializer;
    this.visualizationModel = visualizationModel;
    this.errorModel = errorModel;
    this.eventBus = new HandlerManager(this);

    // this does not set up a mapping
    initSlotModels(visualizationModel.getSlots());

    /**/*from w ww  . j a  v  a  2 s . c o  m*/
     * This is a event handler registered on the view model for changes in
     * the slot mapping
     */
    visualizationModel.addHandler(new SlotMappingChangedHandler() {
        @Override
        public void onSlotMappingChanged(SlotMappingChangedEvent e) {
            assert e.getCurrentResolver() instanceof ManagedVisualItemValueResolver : "tried to set unmanaged resolver for "
                    + e.getSlot();

            // check if there is actually a change at all
            if (ObjectUtils.equals(e.getOldResolver(), e.getCurrentResolver())) {
                return;
            }

            handleResolverChange(e.getSlot(), e.getOldResolver(), e.getCurrentResolver());

            // create a list of slots changed (ie the single one)
            LightweightList<Slot> slots = CollectionFactory.createLightweightList();
            slots.add(e.getSlot());

            // construct and fire a new event for the current resolver
            // this is basically just forwarding the event
            eventBus.fireEvent(new ManagedSlotMappingConfigurationChangedEvent(
                    generateSlotMappingStateSnapshot(slots, getVisualItems()), getVisualItems()));

        }
    });
    /**
     * This is an event fired whenever the viewModel's contained VisualItems
     * change
     */
    visualizationModel.getFullVisualItemContainer().addHandler(new VisualMappingUpdaterForVisualItemChanges());
}

From source file:org.thechiselgroup.biomixer.client.core.visualization.model.managed.ManagedSlotMapping.java

License:Apache License

public ManagedSlotMapping(Slot slot, VisualItemValueResolverFactoryProvider provider,
        SlotMappingConfiguration configuration, VisualItemResolutionErrorModel errorModel) {

    assert slot != null;
    assert provider != null;
    assert configuration != null;
    assert errorModel != null;

    this.slot = slot;
    this.provider = provider;
    this.configuration = configuration;
    this.errorModel = errorModel;

    this.eventBus = new HandlerManager(this);
    this.allowableResolverFactories = CollectionFactory.createStringMap();

    updateAllowableFactories(CollectionFactory.<VisualItem>createLightweightList());

    assertCurrentResolverIsManaged();//from  w  w w .  j  a  va2 s.co m
}