r274 - in trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui: . engine
Author: fgilet Date: 2010-03-25 13:15:59 +0100 (Thu, 25 Mar 2010) New Revision: 274 Log: Refactoring (suppression de la sauvegarde des plugins car fait en double). Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.jaxx trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/engine/ApplicationEngine.java Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.jaxx =================================================================== --- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.jaxx 2010-03-25 11:45:54 UTC (rev 273) +++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.jaxx 2010-03-25 12:15:59 UTC (rev 274) @@ -153,8 +153,6 @@ <JMenu id='menuPlugin'> <JMenuItem id='menuPluginLoad' onActionPerformed='engine.loadAPlugin()'/> - <JMenuItem id='menuPluginSave' - onActionPerformed='engine.savePlugin()'/> <JMenuItem id='menuPluginBootLoaderManager' onActionPerformed='BootLoaderManager.getInstance().setVisible(true)'/> <JSeparator/> Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/engine/ApplicationEngine.java =================================================================== --- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/engine/ApplicationEngine.java 2010-03-25 11:45:54 UTC (rev 273) +++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/engine/ApplicationEngine.java 2010-03-25 12:15:59 UTC (rev 274) @@ -157,114 +157,6 @@ } /** - * Save plugin for next application reload. - */ - public void savePlugin() { - - final JPanel buttonDisplay = new JPanel(new GridLayout(20,3)); - final JPanel content = new JPanel(new BorderLayout()); - - final JFrame frameTemp = new JFrame(); - List<String> nomPlugins = new ArrayList<String>(); - final Map<String,String> mapPlugins = new HashMap<String,String>(); - - //check all plugins in .properties - final Properties properties = new Properties(); - final File propertiesFile = new File(MSM_PLUGINS_DIR, ".properties"); - try { - FileInputStream fis = new FileInputStream(propertiesFile); - properties.load(fis); - Set<Object> props = properties.keySet(); - for (Object property : props) { - String nomPlugin = property.toString(); - nomPlugin = nomPlugin.substring(nomPlugin.lastIndexOf('/')+1); - nomPlugins.add(nomPlugin); - mapPlugins.put(nomPlugin, property.toString()); - } - - } catch(FileNotFoundException e){ - LOG.fatal(e, e); - } catch (IOException ioe){ - LOG.fatal(ioe, ioe); - } - - final int buttonWidth = 100; - final int buttonHeight = 20; - - for (final String nomPlugin : nomPlugins) { - JCheckBox pluginButton = new JCheckBox(nomPlugin); - pluginButton.setSize(buttonWidth, buttonHeight); - //boolean isSelected = isSelected(nomPlugin); - //pluginButton.setEnabled(isSelected); - buttonDisplay.add(pluginButton); - } - - //save into .properties the button enabled - JButton saveButton = new JButton(_("ok")); - saveButton.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - Component[] components = buttonDisplay.getComponents(); - for (final Component comp : components) { - JCheckBox buttonTemp = (JCheckBox) comp; - //if disable, write false into .properties - if (!buttonTemp.isSelected()) { - properties.put(mapPlugins.get(buttonTemp.getText()), "false"); - try { - properties.store(new FileOutputStream(propertiesFile), null); - } catch (IOException ex) { - LOG.error(ex, ex); - } - } - } - frameTemp.dispose(); - } - }); - - content.add(buttonDisplay, BorderLayout.CENTER); - content.add(saveButton, BorderLayout.SOUTH); - frameTemp.setContentPane(content); - frameTemp.pack(); - frameTemp.setVisible(true); - frameTemp.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - - } - - /** - * To know if plugins are active in .properties. - */ -// public boolean isSelected(String nomPluginToControl) { -// final Properties properties = new Properties(); -// final File propertiesFile = new File(MSM_PLUGINS_DIR, ".properties"); -// try { -// FileInputStream fis = new FileInputStream(propertiesFile); -// properties.load(fis); -// Set<Object> props = properties.keySet(); -// for (Object property : props) { -// String nomPlugin = property.toString(); -// nomPlugin = nomPlugin.substring(nomPlugin.lastIndexOf('/')+1); -// String isSelected = nomPlugin.substring(nomPlugin.lastIndexOf('"')+1); -// LOG.info("isSelected : " + isSelected); -// if(nomPluginToControl.equals(nomPlugin)){ -// if(isSelected.equals("false")){ -// return false; -// }else{ -// return true; -// } -// } -// } -// -// } catch(FileNotFoundException e){ -// LOG.fatal(e, e); -// } catch (IOException ioe){ -// LOG.fatal(ioe, ioe); -// } -// return true; -// } - - - /** * Method to close application. */ public void close() { @@ -418,33 +310,8 @@ message += "Version 0.1-SNAPSHOT Codelutin @ 2009-2010"; JOptionPane.showMessageDialog(null, message); } - - //GETTERS AND SETTERS + /** - * Getter BigTable. - * @return the application engine's bigtable. - */ - public BigTable getBigTable() { - return bigTable; - } - - /** - * Setter BigTable. - * @param bigTable the bigtable to use. - */ - public void setBigTable(final BigTable bigTable) { - this.bigTable = bigTable; - } - - /** - * Get the bigTableLoader. - * @return return the bigTableLoader. - */ - public PluginLoader getPluginLoader() { - return pluginLoader; - } - - /** * update the navigationTree. * @param tree the navigationTree. * @param nameBase the name of the base. @@ -596,4 +463,31 @@ public boolean bigTableIsSet() { return this.bigTable != null; } + + //GETTERS AND SETTERS + /** + * Getter BigTable. + * @return the application engine's bigtable. + */ + public BigTable getBigTable() { + return bigTable; + } + + /** + * Setter BigTable. + * @param bigTable the bigtable to use. + */ + public void setBigTable(final BigTable bigTable) { + this.bigTable = bigTable; + } + + /** + * Get the bigTableLoader. + * @return return the bigTableLoader. + */ + public PluginLoader getPluginLoader() { + return pluginLoader; + } + + }
participants (1)
-
fgilet@users.nuiton.org