/** * Save the current workspace layout into the provided file. * * @param filename valid file name to save layout into */ public static void saveLayout(String filename) { LOGGER.info("Saving layout to file: " + filename); try { SimpleMarshaller.marshallLayout(new File(filename)); } catch (Exception e) { LOGGER.error("Failed to save layout. " + e.getLocalizedMessage()); } }
/** * Load a workspace layout from the provided file. * * @param filename valid file that contains a workspace layout */ public static void loadLayout(String filename) { LOGGER.info("Loading layout from file: " + filename); try { SimpleMarshaller.unmarshallLayout(new File(filename)); } catch (Exception e) { LOGGER.error("Failed to load layout. " + e.getLocalizedMessage()); } // Put drawers on top if (leftDrawer != null) TouchClient.putZoneOnTop(leftDrawer); if (rightDrawer != null) TouchClient.putZoneOnTop(rightDrawer); if (topDrawer != null) { TouchClient.putZoneOnTop(topDrawer); } setSelectedBrush(getAllBrushes().get(0)); setSelectedPaint(getAllPaints().get(0)); }
/** * Load the GUI from a file. * * @see SimpleMarshaller#unmarshallGui(Application, File) */ public static void loadGUI() { LOGGER.info("Loading GUI from file: " + Settings.dataFolder + Settings.guiFile); try { SimpleMarshaller.unmarshallGui(instance, new File(Settings.dataFolder + Settings.guiFile)); } catch (Exception e) { LOGGER.fatal("Failed to load GUI. " + e.getLocalizedMessage()); System.exit(1); } if (backgroundImage != null && backgroundImage.length() > 0) { bg = instance.loadImage(Settings.dataFolder + backgroundImage); if (bg == null) LOGGER.error("Failed to load image: " + Settings.dataFolder + backgroundImage); } // Create default canvas (in case it is not specified in the layout file setCanvas(new Canvas((instance.width - 800) / 2, (instance.height - 600) / 2, 800, 600, 255)); // Create control buttons makeControlPanel(topDrawer.getContainer()); }