@Override
 public void handleEvent(VisualMappingFunctionChangedEvent e) {
   final VisualMappingFunction<?, ?> mapping = e.getSource();
   if (this.mappings.containsValue(mapping)) {
     eventHelper.addEventPayload(
         (VisualStyle) this, new VisualStyleChangeRecord(), VisualStyleChangedEvent.class);
   }
 }
Esempio n. 2
0
  /**
   * Code to notify our listeners of some particular event.
   *
   * @param notificationType What type of notification to perform.
   */
  private void notifyListeners(int notificationType) {
    final CyEventHelper eventHelper = serviceRegistrar.getService(CyEventHelper.class);

    // determine what event to fire
    switch (notificationType) {
      case NOTIFICATION_STATE_CHANGE:
        eventHelper.fireEvent(new CytoPanelStateChangedEvent(this, this, cytoPanelState));
        break;

      case NOTIFICATION_COMPONENT_SELECTED:
        int selectedIndex = tabbedPane.getSelectedIndex();
        eventHelper.fireEvent(new CytoPanelComponentSelectedEvent(this, this, selectedIndex));
        break;

      case NOTIFICATION_COMPONENT_ADDED:
        break;

      case NOTIFICATION_COMPONENT_REMOVED:
        break;
    }
  }
  public void redo() {
    ;

    final CyNetworkView view = viewFactory.createNetworkView(network);
    networkViewManager.addNetworkView(view);

    for (final View<CyNode> nodeView : view.getNodeViews())
      nodesAndLocations.get(nodeView.getModel()).restoreLocations(nodeView);

    view.setVisualProperty(NETWORK_CENTER_X_LOCATION, networkCenterX);
    view.setVisualProperty(NETWORK_CENTER_Y_LOCATION, networkCenterY);
    view.setVisualProperty(NETWORK_CENTER_Z_LOCATION, networkCenterZ);
    view.setVisualProperty(NETWORK_SCALE_FACTOR, networkScaleFactor);

    eventHelper.flushPayloadEvents();
    view.updateView();
  }
 @Override
 public <V, S extends V> void setDefaultValue(final VisualProperty<V> vp, final S value) {
   styleDefaults.put(vp, value);
   eventHelper.addEventPayload(
       (VisualStyle) this, new VisualStyleChangeRecord(), VisualStyleChangedEvent.class);
 }
 @Override
 public void removeVisualMappingFunction(VisualProperty<?> t) {
   mappings.remove(t);
   eventHelper.addEventPayload(
       (VisualStyle) this, new VisualStyleChangeRecord(), VisualStyleChangedEvent.class);
 }
 @Override
 public void addVisualMappingFunction(final VisualMappingFunction<?, ?> mapping) {
   mappings.put(mapping.getVisualProperty(), mapping);
   eventHelper.addEventPayload(
       (VisualStyle) this, new VisualStyleChangeRecord(), VisualStyleChangedEvent.class);
 }