Author: tchemit Date: 2008-01-18 02:08:54 +0000 (Fri, 18 Jan 2008) New Revision: 188 Removed: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/JConfigUI.jaxx trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerUI.jaxx Log: au mauvais endroit Deleted: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/JConfigUI.jaxx =================================================================== --- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/JConfigUI.jaxx 2008-01-18 02:04:14 UTC (rev 187) +++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/JConfigUI.jaxx 2008-01-18 02:08:54 UTC (rev 188) @@ -1,149 +0,0 @@ -<JDialog title='{_("simexplorer.config.title")}' modal='true' defaultCloseOperation='DISPOSE_ON_CLOSE'> - <script> - import static org.codelutin.i18n.I18n._; - import org.codelutin.option.ui.ConfigTableModel; - import org.codelutin.option.ui.ConfigTableRenderer; - import org.codelutin.option.ui.ConfigTableEditor; - import org.codelutin.option.Config; - - private static JConfigUI instance; - - public static JConfigUI getInstance() { - if (instance == null) { - instance = new JConfigUI(); - } - return instance; - } - - public static void reloadUI() { - instance=null; - } - - public static void showUI(Config config) { - showUI(config,null); - } - - public static void showTechnicalUI(Config config) { - showUI(config, ConfigTableModel.TypeModel.tech); - } - - public static void showUI(Config config,ConfigTableModel.TypeModel type) { - getInstance().setConfig(config,type); - getInstance().setVisible(true); - } - - protected Config config; - protected ConfigTableModel model; - - private AbstractAction OK_ACTION; - private AbstractAction RESET_ACTION; - private AbstractAction CANCEL_ACTION; - private TableModelListener TABLE_MODEL_LISTENER; - - @Override - public void dispose() { - config=null; - if (model!=null) { - model.removeTableModelListener(TABLE_MODEL_LISTENER); - model = null; - } - super.dispose(); - } - - protected Config getConfig() { - return config; - } - - protected ConfigTableModel getModel() { - return model; - } - - protected boolean isEmpty() { - return model==null || config==null || config.getUniverse().isEmpty(); - } - - protected boolean isOkEnabled() { - return !isEmpty() && model.isValid(); - } - - protected boolean isResetEnabled() { - return !isEmpty() && model.isModified(); - } - - protected void setConfig(Config config, ConfigTableModel.TypeModel type) { - this.config = config; - model = new ConfigTableModel(config,type); - model.addTableModelListener(TABLE_MODEL_LISTENER); - main.setModel(model); - main.setDefaultRenderer(Object.class, new ConfigTableRenderer(model)); - main.getColumn(main.getColumnName(1)).setCellEditor(new ConfigTableEditor(getModel())); - boolean action = type != ConfigTableModel.TypeModel.tech; - butons.setVisible(action); - butons2.setVisible(!action); - model.fireTableDataChanged(); - pack(); - } - - OK_ACTION= new AbstractAction("OK") { - private static final long serialVersionUID = -5259317388353753566L; - public void actionPerformed(ActionEvent e) { - if (!isEmpty() && getModel().isModified()) { - getModel().transfertModified(getConfig()); - getConfig().saveSafely(); - } - dispose(); - } - }; - RESET_ACTION= new AbstractAction("Reset") { - private static final long serialVersionUID = 3780134639606303504L; - public void actionPerformed(ActionEvent e) { - getModel().reset(); - } - }; - CANCEL_ACTION = new AbstractAction("Cancel") { - private static final long serialVersionUID = -3391009906183633110L; - public void actionPerformed(ActionEvent e) { - dispose(); - } - }; - TABLE_MODEL_LISTENER = new TableModelListener() { - public void tableChanged(TableModelEvent e) { - SwingUtilities.invokeLater(new Runnable() { - public void run() { - processDataBinding("ok.enabled"); - processDataBinding("reset.enabled"); - } - }); - } - }; - JRootPane rootPane = getRootPane(); - rootPane.setDefaultButton(ok); - rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "cancel"); - rootPane.getActionMap().put("cancel", CANCEL_ACTION); - </script> - <Table weightx="1"> - <row> - <cell weighty="1" weightx='1' fill='both'> - <JScrollPane id='scroll' verticalScrollBarPolicy='20' horizontalScrollBarPolicy='31' > - <JTable id="main" rowSelectionAllowed="false" autoResizeMode='auto_resize_last_column'/> - </JScrollPane> - </cell> - </row> - <row fill='horizontal'> - <cell> - <JPanel id='butons' visible='false' layout='{new GridLayout(0, 3, 2, 2)}'> - <JButton id='ok' text='{_("simexplorer.common.ok")}' enabled='{isOkEnabled()}' action='{OK_ACTION}'/> - <JButton id='reset' text='{_("simexplorer.common.reset")}' enabled='{isResetEnabled()}' action='{RESET_ACTION}'/> - <JButton id='cancel' text='{_("simexplorer.common.cancel")}' action='{CANCEL_ACTION}'/> - </JPanel> - </cell> - </row> - <row fill='horizontal'> - <cell> - <JPanel id='butons2' visible='false' layout='{new GridLayout(0, 1, 2, 2)}'> - <JButton text='{_("simexplorer.common.ok")}' onActionPerformed='dispose();'/> - </JPanel> - </cell> - </row> - </Table> -</JDialog> Deleted: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerUI.jaxx =================================================================== --- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerUI.jaxx 2008-01-18 02:04:14 UTC (rev 187) +++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerUI.jaxx 2008-01-18 02:08:54 UTC (rev 188) @@ -1,77 +0,0 @@ -<JFrame name="mainFrame" title='{_("simexplorer.main.ui.title")}' - defaultCloseOperation='DISPOSE_ON_CLOSE' width='800' height='600'> - <script> - import static org.codelutin.i18n.I18n._; - </script> - - <JMenuBar> - <!-- menu principal --> - <JMenu text='{_("simexplorer.main.menu")}'> - <JMenuItem id="connect" enabled='false' - text='{_("simexplorer.main.menu.connect")}' - toolTipText='{_("simexplorer.main.menu.connect.tooltip")}'/> - <JMenuItem id="unconnect" enabled='false' - text='{_("simexplorer.main.menu.unconnect")}' - toolTipText='{_("simexplorer.main.menu.unconnect.tooltip")}'/> - <JSeparator/> - <JMenuItem id="listApplication" enabled='false' - text='{_("simexplorer.main.menu.list.application")}' - toolTipText='{_("simexplorer.main.menu.list.application.tooltip")}'/> - <JSeparator/> - <JMenuItem id="quit" enabled='false' - text='{_("simexplorer.main.menu.quit")}' - toolTipText='{_("simexplorer.main.menu.quit.tooltip")}'/> - </JMenu> - <!-- menu config --> - <JMenu text='{_("simexplorer.config.menu")}'> - <JMenu text='{_("simexplorer.config.i18n.menu")}'> - <JMenuItem id="i18n_fr_FR" enabled='false' - text='{_("simexplorer.config.i18n.menu.fr")}' - toolTipText='{_("simexplorer.config.i18n.menu.fr.tooltip")}'/> - <JMenuItem id="i18n_en_GB" enabled='false' - text='{_("simexplorer.config.i18n.menu.en")}' - toolTipText='{_("simexplorer.config.i18n.menu.en.tooltip")}'/> - </JMenu> - <JMenuItem id="config" enabled='false' - text='{_("simexplorer.config.menu.config")}' - toolTipText='{_("simexplorer.config.menu.config.tooltip")}' - /> - </JMenu> - <!-- menu admin --> - <JMenu text='{_("simexplorer.admin.menu")}'> - <JMenuItem id="groups" enabled='false' - text='{_("simexplorer.admin.menu.groups")}' - toolTipText='{_("simexplorer.admin.menu.groups.tooltip")}'/> - <JMenuItem id="users" enabled='false' - text='{_("simexplorer.admin.menu.users")}' - toolTipText='{_("simexplorer.admin.menu.users.tooltip")}'/> - </JMenu> - <!-- menu aide --> - <JMenu text='{_("simexplorer.help.menu")}'> - <JMenuItem id="help" enabled='false' - text='{_("simexplorer.help.menu.help")}' - toolTipText='{_("simexplorer.help.menu.help.tooltip")}'/> - <JMenuItem id="site" enabled='false' - text='{_("simexplorer.help.menu.site")}' - toolTipText='{_("simexplorer.help.menu.site.tooltip")}'/> - <JMenuItem id="about" enabled='false' - text='{_("simexplorer.help.menu.about")}' - toolTipText='{_("simexplorer.help.menu.about.tooltip")}'/> - </JMenu> - </JMenuBar> - <Table> - <!-- le panel principal à surcharger selon le context --> - <row fill="both" weightx="1" weighty="1"> - <cell> - <JPanel id="content"/> - </cell> - </row> - <!-- la barre de status --> - <row> - <cell fill="both"> - <org.codelutin.widget.StatusBar id='statusBar'/> - </cell> - </row> - </Table> - -</JFrame>