当前位置: 首页>>代码示例>>Java>>正文


Java Project.getLogisimFile方法代码示例

本文整理汇总了Java中com.cburch.logisim.proj.Project.getLogisimFile方法的典型用法代码示例。如果您正苦于以下问题:Java Project.getLogisimFile方法的具体用法?Java Project.getLogisimFile怎么用?Java Project.getLogisimFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.cburch.logisim.proj.Project的用法示例。


在下文中一共展示了Project.getLogisimFile方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doIt

import com.cburch.logisim.proj.Project; //导入方法依赖的package包/类
@Override
public void doIt(Project proj) {
	LogisimFile src = ProjectActions.createNewFile(proj);
	LogisimFile dst = proj.getLogisimFile();

	copyToolAttributes(src, dst);
	for (Library srcLib : src.getLibraries()) {
		Library dstLib = dst.getLibrary(srcLib.getName());
		if (dstLib == null) {
			String desc = src.getLoader().getDescriptor(srcLib);
			dstLib = dst.getLoader().loadLibrary(desc);
			proj.getLogisimFile().addLibrary(dstLib);
			if (libraries == null)
				libraries = new ArrayList<Library>();
			libraries.add(dstLib);
		}
		copyToolAttributes(srcLib, dstLib);
	}

	Options newOpts = proj.getOptions();
	oldOpts = new Options();
	oldOpts.copyFrom(newOpts, dst);
	newOpts.copyFrom(src.getOptions(), dst);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:25,代码来源:LogisimFileActions.java

示例2: CircuitJList

import com.cburch.logisim.proj.Project; //导入方法依赖的package包/类
public CircuitJList(Project proj, boolean includeEmpty) {
	LogisimFile file = proj.getLogisimFile();
	Circuit current = proj.getCurrentCircuit();
	Vector<Circuit> options = new Vector<Circuit>();
	boolean currentFound = false;
	for (Circuit circ : file.getCircuits()) {
		if (!includeEmpty || circ.getBounds() != Bounds.EMPTY_BOUNDS) {
			if (circ == current)
				currentFound = true;
			options.add(circ);
		}
	}

	setListData(options);
	if (currentFound)
		setSelectedValue(current, true);
	setVisibleRowCount(Math.min(6, options.size()));
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:19,代码来源:CircuitJList.java

示例3: doLoadBuiltinLibrary

import com.cburch.logisim.proj.Project; //导入方法依赖的package包/类
public static void doLoadBuiltinLibrary(Project proj) {
	LogisimFile file = proj.getLogisimFile();
	List<Library> baseBuilt = file.getLoader().getBuiltin().getLibraries();
	ArrayList<Library> builtins = new ArrayList<Library>(baseBuilt);
	builtins.removeAll(file.getLibraries());
	if (builtins.isEmpty()) {
		JOptionPane.showMessageDialog(proj.getFrame(), Strings.get("loadBuiltinNoneError"),
				Strings.get("loadBuiltinErrorTitle"), JOptionPane.INFORMATION_MESSAGE);
		return;
	}
	LibraryJList list = new LibraryJList(builtins);
	JScrollPane listPane = new JScrollPane(list);
	int action = JOptionPane.showConfirmDialog(proj.getFrame(), listPane, Strings.get("loadBuiltinDialogTitle"),
			JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
	if (action == JOptionPane.OK_OPTION) {
		Library[] libs = list.getSelectedLibraries();
		if (libs != null)
			proj.doAction(LogisimFileActions.loadLibraries(libs));
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:21,代码来源:ProjectLibraryActions.java

示例4: doUnloadLibraries

import com.cburch.logisim.proj.Project; //导入方法依赖的package包/类
public static void doUnloadLibraries(Project proj) {
	LogisimFile file = proj.getLogisimFile();
	ArrayList<Library> canUnload = new ArrayList<Library>();
	for (Library lib : file.getLibraries()) {
		String message = file.getUnloadLibraryMessage(lib);
		if (message == null)
			canUnload.add(lib);
	}
	if (canUnload.isEmpty()) {
		JOptionPane.showMessageDialog(proj.getFrame(), Strings.get("unloadNoneError"),
				Strings.get("unloadErrorTitle"), JOptionPane.INFORMATION_MESSAGE);
		return;
	}
	LibraryJList list = new LibraryJList(canUnload);
	JScrollPane listPane = new JScrollPane(list);
	int action = JOptionPane.showConfirmDialog(proj.getFrame(), listPane, Strings.get("unloadLibrariesDialogTitle"),
			JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
	if (action == JOptionPane.OK_OPTION) {
		Library[] libs = list.getSelectedLibraries();
		if (libs != null)
			proj.doAction(LogisimFileActions.unloadLibraries(libs));
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:24,代码来源:ProjectLibraryActions.java

示例5: computeRevertEnabled

import com.cburch.logisim.proj.Project; //导入方法依赖的package包/类
private void computeRevertEnabled() {
	// do this separately since it can happen rather often
	Project proj = frame.getProject();
	LogisimFile file = proj.getLogisimFile();
	Circuit cur = proj.getCurrentCircuit();
	boolean isProjectCircuit = file.contains(cur);
	boolean viewAppearance = frame.getEditorView().equals(Frame.EDIT_APPEARANCE);
	boolean canRevert = isProjectCircuit && viewAppearance && !cur.getAppearance().isDefaultAppearance();
	boolean oldValue = menubar.isEnabled(LogisimMenuBar.REVERT_APPEARANCE);
	if (canRevert != oldValue) {
		menubar.setEnabled(LogisimMenuBar.REVERT_APPEARANCE, canRevert);
		fireEnableChanged();
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:15,代码来源:MenuListener.java

示例6: CircuitPopup

import com.cburch.logisim.proj.Project; //导入方法依赖的package包/类
CircuitPopup(Project proj, Tool tool, Circuit circuit) {
	super(Strings.get("circuitMenu"));
	this.proj = proj;
	this.circuit = circuit;

	add(editLayout);
	editLayout.addActionListener(this);
	add(editAppearance);
	editAppearance.addActionListener(this);
	add(analyze);
	analyze.addActionListener(this);
	add(stats);
	stats.addActionListener(this);
	addSeparator();
	add(main);
	main.addActionListener(this);
	add(remove);
	remove.addActionListener(this);

	boolean canChange = proj.getLogisimFile().contains(circuit);
	LogisimFile file = proj.getLogisimFile();
	if (circuit == proj.getCurrentCircuit()) {
		if (proj.getFrame().getEditorView().equals(Frame.EDIT_APPEARANCE)) {
			editAppearance.setEnabled(false);
		} else {
			editLayout.setEnabled(false);
		}
	}
	main.setEnabled(canChange && file.getMainCircuit() != circuit);
	remove.setEnabled(canChange && file.getCircuitCount() > 1 && proj.getDependencies().canRemove(circuit));
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:32,代码来源:Popups.java

示例7: OptionsFrame

import com.cburch.logisim.proj.Project; //导入方法依赖的package包/类
public OptionsFrame(Project project) {
	this.project = project;
	this.file = project.getLogisimFile();
	file.addLibraryListener(myListener);
	setDefaultCloseOperation(HIDE_ON_CLOSE);
	setJMenuBar(new LogisimMenuBar(this, project));

	panels = new OptionsPanel[] { new SimulateOptions(this), new ToolbarOptions(this), new MouseOptions(this), };
	tabbedPane = new JTabbedPane();
	for (int index = 0; index < panels.length; index++) {
		OptionsPanel panel = panels[index];
		tabbedPane.addTab(panel.getTitle(), null, panel, panel.getToolTipText());
	}

	JPanel buttonPanel = new JPanel();
	buttonPanel.add(revert);
	buttonPanel.add(close);
	revert.addActionListener(myListener);
	close.addActionListener(myListener);

	Container contents = getContentPane();
	tabbedPane.setPreferredSize(new Dimension(450, 300));
	contents.add(tabbedPane, BorderLayout.CENTER);
	contents.add(buttonPanel, BorderLayout.SOUTH);

	LocaleManager.addLocaleListener(myListener);
	myListener.localeChanged();
	pack();
	setLocationRelativeTo(null);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:31,代码来源:OptionsFrame.java

示例8: computeEnabled

import com.cburch.logisim.proj.Project; //导入方法依赖的package包/类
private void computeEnabled() {
	Project proj = frame.getProject();
	LogisimFile file = proj.getLogisimFile();
	Circuit cur = proj.getCurrentCircuit();
	int curIndex = file.getCircuits().indexOf(cur);
	boolean isProjectCircuit = curIndex >= 0;
	String editorView = frame.getEditorView();
	String explorerView = frame.getExplorerView();
	boolean canSetMain = false;
	boolean canMoveUp = false;
	boolean canMoveDown = false;
	boolean canRemove = false;
	boolean canRevert = false;
	boolean viewAppearance = editorView.equals(Frame.EDIT_APPEARANCE);
	boolean viewLayout = editorView.equals(Frame.EDIT_LAYOUT);
	boolean viewToolbox = explorerView.equals(Frame.VIEW_TOOLBOX);
	boolean viewSimulation = explorerView.equals(Frame.VIEW_SIMULATION);
	if (isProjectCircuit) {
		List<?> tools = proj.getLogisimFile().getTools();

		canSetMain = proj.getLogisimFile().getMainCircuit() != cur;
		canMoveUp = curIndex > 0;
		canMoveDown = curIndex < tools.size() - 1;
		canRemove = tools.size() > 1;
		canRevert = viewAppearance && !cur.getAppearance().isDefaultAppearance();
	}

	menubar.setEnabled(LogisimMenuBar.ADD_CIRCUIT, true);
	menubar.setEnabled(LogisimMenuBar.MOVE_CIRCUIT_UP, canMoveUp);
	menubar.setEnabled(LogisimMenuBar.MOVE_CIRCUIT_DOWN, canMoveDown);
	menubar.setEnabled(LogisimMenuBar.SET_MAIN_CIRCUIT, canSetMain);
	menubar.setEnabled(LogisimMenuBar.REMOVE_CIRCUIT, canRemove);
	menubar.setEnabled(LogisimMenuBar.VIEW_TOOLBOX, !viewToolbox);
	menubar.setEnabled(LogisimMenuBar.VIEW_SIMULATION, !viewSimulation);
	menubar.setEnabled(LogisimMenuBar.EDIT_LAYOUT, !viewLayout);
	menubar.setEnabled(LogisimMenuBar.EDIT_APPEARANCE, !viewAppearance);
	menubar.setEnabled(LogisimMenuBar.REVERT_APPEARANCE, canRevert);
	menubar.setEnabled(LogisimMenuBar.ANALYZE_CIRCUIT, true);
	menubar.setEnabled(LogisimMenuBar.CIRCUIT_STATS, true);
	fireEnableChanged();
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:42,代码来源:MenuListener.java


注:本文中的com.cburch.logisim.proj.Project.getLogisimFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。