Newer
Older
AlgebraicDataflowArchitectureModel / AlgebraicDataflowArchitectureModel / src / application / ApplicationMenuBar.java
@Shohei Yamagiwa Shohei Yamagiwa on 1 Dec 3 KB Format files
package application;

import application.actions.*;
import application.editor.Editor;

import javax.swing.*;

public class ApplicationMenuBar extends JMenuBar {
	private static final long serialVersionUID = 4811536194182272888L;
	
	private ApplicationWindow applicationWindow = null;
	
	private NewResourceAction newResourceAction = null;
	private NewChannelAction newChannelAction = null;
	private NewEventChannelAction newIOChannelAction = null;
	private NewFormulaChannelAction newFormulaChannelAction = null;
	private DeleteAction deleteAction = null;
	private JavaPrototypeGenerateAction javaPrototypeGenerateAction = null;
	private JerseyPrototypeGenerateAction jerseyPrototypeGenerateAction = null;
	private DAGLayoutAction dagLayoutAction = null;
	private TreeLayoutAction treeLayoutAction = null;
	private CircleLayoutAction circleLayoutAction = null;
	private ShowNavigationAction showNavigationAction;
	private ShowFlowLayerWindowAction showFlowLayerWindowAction;
	//private SimulateAction simulateAction = null;
	
	
	public ApplicationMenuBar(ApplicationWindow applicationWindow) {
		this.applicationWindow = applicationWindow;
		JMenu newMenu = new JMenu("New");
		
		newMenu.add(new NewModelAction(applicationWindow));
		
		newMenu.add(newResourceAction = new NewResourceAction(applicationWindow.getEditor()));
		newMenu.add(newChannelAction = new NewChannelAction(applicationWindow.getEditor()));
		newMenu.add(newIOChannelAction = new NewEventChannelAction(applicationWindow.getEditor()));
		newMenu.add(newFormulaChannelAction = new NewFormulaChannelAction(applicationWindow.getEditor()));
		
		JMenu menu = null;
		menu = add(new JMenu("File"));
		menu.add(newMenu);
		menu.add(new OpenAction(applicationWindow));
		menu.addSeparator();
		menu.add(new SaveAction(applicationWindow));
		menu.add(new SaveAsAction(applicationWindow));
		menu.addSeparator();
		menu.add(new ExitAction());
		
		menu = add(new JMenu("Edit"));
		menu.add(deleteAction = new DeleteAction(applicationWindow.getEditor()));
		
		
		menu = add(new JMenu("Layout"));
		menu.add(dagLayoutAction = new DAGLayoutAction(applicationWindow.getEditor()));
		menu.add(treeLayoutAction = new TreeLayoutAction(applicationWindow.getEditor()));
		menu.add(circleLayoutAction = new CircleLayoutAction(applicationWindow.getEditor()));
		
		menu = add(new JMenu("View"));
		menu.add(new ZoomInAction(applicationWindow.getGraphComponent()));
		menu.add(new ZoomOutAction(applicationWindow.getGraphComponent()));
		
		menu = add(new JMenu("Simulate"));
		menu.add(new SimulateAction(applicationWindow));
		
		menu = add(new JMenu("Generate"));
		menu.add(javaPrototypeGenerateAction = new JavaPrototypeGenerateAction(applicationWindow.getEditor()));
		menu.add(jerseyPrototypeGenerateAction = new JerseyPrototypeGenerateAction(applicationWindow.getEditor()));
		
		menu = add(new JMenu("Window"));
		menu.add(showNavigationAction = new ShowNavigationAction(applicationWindow));
		menu.add(showFlowLayerWindowAction = new ShowFlowLayerWindowAction(applicationWindow));
	}
	
	public Editor getEditor() {
		return applicationWindow.getEditor();
	}
	
	public void setEditor(Editor editor) {
		newResourceAction.setEditor(editor);
		newChannelAction.setEditor(editor);
		newIOChannelAction.setEditor(editor);
		deleteAction.setEditor(editor);
		javaPrototypeGenerateAction.setEditor(editor);
		jerseyPrototypeGenerateAction.setEditor(editor);
		treeLayoutAction.setEditor(editor);
		circleLayoutAction.setEditor(editor);
	}
}