本文整理汇总了Java中com.cburch.logisim.file.Loader类的典型用法代码示例。如果您正苦于以下问题:Java Loader类的具体用法?Java Loader怎么用?Java Loader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Loader类属于com.cburch.logisim.file包,在下文中一共展示了Loader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createEmptyFile
import com.cburch.logisim.file.Loader; //导入依赖的package包/类
private static LogisimFile createEmptyFile(Loader loader) {
InputStream templReader = AppPreferences.getEmptyTemplate().createStream();
LogisimFile file;
try {
file = loader.openLogisimFile(templReader);
} catch (Throwable t) {
file = LogisimFile.createNew(loader);
file.addCircuit(new Circuit("main"));
} finally {
try {
templReader.close();
} catch (IOException e) {
}
}
return file;
}
示例2: doOpen
import com.cburch.logisim.file.Loader; //导入依赖的package包/类
public static void doOpen(Component parent, Project baseProject) {
JFileChooser chooser;
if (baseProject != null) {
Loader oldLoader = baseProject.getLogisimFile().getLoader();
chooser = oldLoader.createChooser();
if (oldLoader.getMainFile() != null) {
chooser.setSelectedFile(oldLoader.getMainFile());
}
} else {
chooser = JFileChoosers.create();
}
chooser.setFileFilter(Loader.LOGISIM_FILTER);
int returnVal = chooser.showOpenDialog(parent);
if (returnVal != JFileChooser.APPROVE_OPTION)
return;
File selected = chooser.getSelectedFile();
if (selected != null) {
doOpen(parent, baseProject, selected);
}
}
示例3: createEmptyFile
import com.cburch.logisim.file.Loader; //导入依赖的package包/类
private static LogisimFile createEmptyFile(Loader loader,Project proj) {
InputStream templReader = AppPreferences.getEmptyTemplate()
.createStream();
LogisimFile file;
try {
file = loader.openLogisimFile(templReader);
} catch (Exception t) {
file = LogisimFile.createNew(loader,proj);
file.addCircuit(new Circuit("main", file,proj));
} finally {
try {
templReader.close();
} catch (IOException e) {
}
}
return file;
}
示例4: doOpen
import com.cburch.logisim.file.Loader; //导入依赖的package包/类
public static boolean doOpen(Component parent, Project baseProject) {
JFileChooser chooser;
if (baseProject != null) {
Loader oldLoader = baseProject.getLogisimFile().getLoader();
chooser = oldLoader.createChooser();
if (oldLoader.getMainFile() != null) {
chooser.setSelectedFile(oldLoader.getMainFile());
}
} else {
chooser = JFileChoosers.create();
}
chooser.setFileFilter(Loader.LOGISIM_FILTER);
chooser.setDialogTitle(Strings.get("FileOpenItem"));
int returnVal = chooser.showOpenDialog(parent);
if (returnVal != JFileChooser.APPROVE_OPTION)
return false;
File selected = chooser.getSelectedFile();
if (selected != null) {
doOpen(parent, baseProject, selected);
}
return true;
}
示例5: doOpen
import com.cburch.logisim.file.Loader; //导入依赖的package包/类
public static void doOpen(Component parent, Project baseProject) {
JFileChooser chooser;
if (baseProject != null) {
Loader oldLoader = baseProject.getLogisimFile().getLoader();
chooser = oldLoader.createChooser();
if (oldLoader.getMainFile() != null) {
chooser.setSelectedFile(oldLoader.getMainFile());
}
} else {
chooser = JFileChoosers.create();
}
chooser.setFileFilter(Loader.LOGISIM_FILTER);
int returnVal = chooser.showOpenDialog(parent);
if (returnVal != JFileChooser.APPROVE_OPTION) return;
File selected = chooser.getSelectedFile();
if (selected != null) {
doOpen(parent, baseProject, selected);
}
}
示例6: completeProject
import com.cburch.logisim.file.Loader; //导入依赖的package包/类
private static Project completeProject(SplashScreen monitor, Loader loader, LogisimFile file, boolean isStartup) {
if (monitor != null)
monitor.setProgress(SplashScreen.PROJECT_CREATE);
Project ret = new Project(file);
if (monitor != null)
monitor.setProgress(SplashScreen.FRAME_CREATE);
SwingUtilities.invokeLater(new CreateFrame(loader, ret, isStartup));
return ret;
}
示例7: doSave
import com.cburch.logisim.file.Loader; //导入依赖的package包/类
public static boolean doSave(Project proj) {
Loader loader = proj.getLogisimFile().getLoader();
File f = loader.getMainFile();
if (f == null)
return doSaveAs(proj, true);
else
return doSave(proj, f);
}
示例8: findProjectFor
import com.cburch.logisim.file.Loader; //导入依赖的package包/类
public static Project findProjectFor(File query) {
for (Project proj : openProjects) {
Loader loader = proj.getLogisimFile().getLoader();
if (loader == null)
continue;
File f = loader.getMainFile();
if (query.equals(f))
return proj;
}
return null;
}
示例9: loadTemplate
import com.cburch.logisim.file.Loader; //导入依赖的package包/类
private void loadTemplate(Loader loader, File templFile, boolean templEmpty) {
if (showSplash)
monitor.setProgress(SplashScreen.TEMPLATE_OPEN);
if (templFile != null) {
AppPreferences.setTemplateFile(templFile);
AppPreferences.setTemplateType(AppPreferences.TEMPLATE_CUSTOM);
} else if (templEmpty) {
AppPreferences.setTemplateType(AppPreferences.TEMPLATE_EMPTY);
} else if (templPlain) {
AppPreferences.setTemplateType(AppPreferences.TEMPLATE_PLAIN);
}
}
示例10: doLoadLogisimLibrary
import com.cburch.logisim.file.Loader; //导入依赖的package包/类
public static void doLoadLogisimLibrary(Project proj) {
Loader loader = proj.getLogisimFile().getLoader();
JFileChooser chooser = loader.createChooser();
chooser.setDialogTitle(Strings.get("loadLogisimDialogTitle"));
chooser.setFileFilter(Loader.LOGISIM_FILTER);
int check = chooser.showOpenDialog(proj.getFrame());
if (check == JFileChooser.APPROVE_OPTION) {
File f = chooser.getSelectedFile();
Library lib = loader.loadLogisimLibrary(f);
if (lib != null) {
proj.doAction(LogisimFileActions.loadLibrary(lib));
}
}
}
示例11: actionPerformed
import com.cburch.logisim.file.Loader; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
Object src = e.getSource();
if (src == unload) {
ProjectLibraryActions.doUnloadLibrary(proj, lib);
} else if (src == reload) {
Loader loader = proj.getLogisimFile().getLoader();
loader.reload((LoadedLibrary) lib);
}
}
示例12: completeProject
import com.cburch.logisim.file.Loader; //导入依赖的package包/类
private static Project completeProject(SplashScreen monitor, Loader loader,
LogisimFile file, boolean isStartup) {
if (monitor != null)
monitor.setProgress(SplashScreen.PROJECT_CREATE);
Project ret = new Project(file);
if (monitor != null)
monitor.setProgress(SplashScreen.FRAME_CREATE);
SwingUtilities.invokeLater(new CreateFrame(loader, ret, isStartup));
updatecircs(file,ret);
return ret;
}
示例13: doOpenNoWindow
import com.cburch.logisim.file.Loader; //导入依赖的package包/类
public static Project doOpenNoWindow(SplashScreen monitor, File source)
throws LoadFailedException {
Loader loader = new Loader(monitor);
LogisimFile file = loader.openLogisimFile(source);
Project ret = new Project(file);
updatecircs(file,ret);
return ret;
}
示例14: doSave
import com.cburch.logisim.file.Loader; //导入依赖的package包/类
public static boolean doSave(Project proj) {
Loader loader = proj.getLogisimFile().getLoader();
File f = loader.getMainFile();
if (f == null)
return doSaveAs(proj);
else
return doSave(proj, f);
}
示例15: findProjectFor
import com.cburch.logisim.file.Loader; //导入依赖的package包/类
public static Project findProjectFor(File query) {
for (Project proj : openProjects) {
Loader loader = proj.getLogisimFile().getLoader();
if (loader == null) {
continue;
}
File f = loader.getMainFile();
if (query.equals(f)) {
return proj;
}
}
return null;
}