/** * Loads a preset * * @param preset preset object to load */ public int loadPreset(Preset preset) { Msg.D("loading preset, # of mods: " + preset.size(), 3, this); for (int i = 0; i < preset.size(); i++) { if (plp.g()) { this.attachModuleToBus(preset.getType(i), preset.getAddress(i), preset.getSize(i)); if (preset.getHasFrame(i)) ((JFrame) moduleFrames.get(i)).setVisible(preset.getVisible(i)); } else this.attachModuleToBus(preset.getType(i), preset.getAddress(i), preset.getSize(i)); } return Constants.PLP_OK; }
/** Creates a preset off the currently attached modules */ public Preset createPreset() { Msg.D("Adding " + modules.size() + " modules to preset.", 3, this); Preset preset = new Preset(); for (int i = 0; i < modules.size(); i++) { preset.addModuleDefinition( type.get(i), modules.get(i).startAddr(), regSize.get(i), (moduleFrames.get(i) != null && (moduleFrames.get(i) instanceof JFrame)), (moduleFrames.get(i) instanceof JFrame) ? ((JFrame) moduleFrames.get(i)).isVisible() : false); } return preset; }