Newer
Older
AlgebraicDataflowArchitectureModel / AlgebraicDataflowArchitectureModel / src / application / actions / ShowDependentableMediatorAction.java
package application.actions;

import java.awt.event.ActionEvent;

import com.mxgraph.model.mxCell;
import com.mxgraph.swing.mxGraphComponent;

import application.editor.stages.ControlFlowDelegationStage;
import application.editor.stages.ControlFlowDelegationStageStatus;
import models.controlFlowModel.CallEdgeAttribute;

public class ShowDependentableMediatorAction extends AbstractPopupAction {	
	private ControlFlowDelegationStage stage = null;
	
	/*************************************************************
	 *  [ *constructor ]
	/*************************************************************
	 */
	public ShowDependentableMediatorAction(final ControlFlowDelegationStage stage, final mxGraphComponent graphComponent, final mxCell targetCell) {
		super(/*propName*/"dependsOnMediator", targetCell, graphComponent);
		this.stage = stage;		
	}

	/************************************************************
	 * [ *public ]
	/*************************************************************
	 *
	 */
	@Override
	public void actionPerformed(ActionEvent e) {
		super.actionPerformed(e);
		showDependentableNodesBySelectedEdge(targetCell);
		stage.setState(ControlFlowDelegationStageStatus.SHOWING_DEPENDENTABLE_NODES);
		// -> dependent manipulation is ControlFlowStageEditor
	}

	/*************************************************************
	 * [ *private ] 	
	/*************************************************************
	 * 
	 */
	private void showDependentableNodesBySelectedEdge(Object cellObj) {
			CallEdgeAttribute callEdgeAttr = (CallEdgeAttribute)graphComponent.getGraph().getModel().getValue(cellObj);	
			if(callEdgeAttr == null) return;
			
			ControlFlowDelegationStage cfdStage = (ControlFlowDelegationStage)stage;	
			cfdStage.showDependentableNodes(this.graphComponent.getGraph(), callEdgeAttr);;
	}	
}