r715 - in trunk/jrst/src: main/java/org/nuiton/jrst main/java/org/nuiton/jrst/ui test/java/org/nuiton/jrst
Author: sletellier Date: 2012-06-13 15:37:59 +0200 (Wed, 13 Jun 2012) New Revision: 715 Url: http://nuiton.org/repositories/revision/jrst/715 Log: - Rename jaxxUI to ui - Fix imports - Clean launchJRST code - Dont allow to resize ui Added: trunk/jrst/src/main/java/org/nuiton/jrst/ui/ Removed: trunk/jrst/src/main/java/org/nuiton/jrst/jaxxUI/ Modified: trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java trunk/jrst/src/main/java/org/nuiton/jrst/ui/JRSTCommandModel.java trunk/jrst/src/main/java/org/nuiton/jrst/ui/JRSTView.jaxx trunk/jrst/src/main/java/org/nuiton/jrst/ui/JRSTViewHandler.java trunk/jrst/src/main/java/org/nuiton/jrst/ui/XslPanel.jaxx trunk/jrst/src/main/java/org/nuiton/jrst/ui/XslPanelHandler.java trunk/jrst/src/test/java/org/nuiton/jrst/JRSTTest.java Modified: trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java =================================================================== --- trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java 2012-06-13 13:17:14 UTC (rev 714) +++ trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java 2012-06-13 13:37:59 UTC (rev 715) @@ -40,7 +40,6 @@ import java.util.List; import java.util.Locale; import java.util.Map; -import javax.swing.*; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.TransformerException; @@ -55,7 +54,7 @@ import org.nuiton.i18n.init.ClassPathI18nInitializer; import org.nuiton.jrst.convertisor.DocUtils2RST; import org.nuiton.jrst.convertisor.DocUtilsVisitor; -import org.nuiton.jrst.jaxxUI.JRSTView; +import org.nuiton.jrst.ui.JRSTView; import org.nuiton.jrst.legacy.JRSTReader; import org.nuiton.util.ApplicationConfig; import org.nuiton.util.Resource; @@ -63,8 +62,6 @@ import org.python.util.PythonInterpreter; import org.xhtmlrenderer.pdf.ITextRenderer; -import static org.nuiton.i18n.I18n._; - /** * FIXME: 'JRST --help' doesn't work, but 'JRST --help toto' work :( FIXME: * 'JRST -c' doesn't work, but 'JRST -c toto' Modified: trunk/jrst/src/main/java/org/nuiton/jrst/ui/JRSTCommandModel.java =================================================================== --- trunk/jrst/src/main/java/org/nuiton/jrst/jaxxUI/JRSTCommandModel.java 2012-06-13 13:17:14 UTC (rev 714) +++ trunk/jrst/src/main/java/org/nuiton/jrst/ui/JRSTCommandModel.java 2012-06-13 13:37:59 UTC (rev 715) @@ -1,4 +1,28 @@ -package org.nuiton.jrst.jaxxUI; +/* + * #%L + * JRst :: Api + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ +package org.nuiton.jrst.ui; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; Modified: trunk/jrst/src/main/java/org/nuiton/jrst/ui/JRSTView.jaxx =================================================================== --- trunk/jrst/src/main/java/org/nuiton/jrst/jaxxUI/JRSTView.jaxx 2012-06-13 13:17:14 UTC (rev 714) +++ trunk/jrst/src/main/java/org/nuiton/jrst/ui/JRSTView.jaxx 2012-06-13 13:37:59 UTC (rev 715) @@ -1,4 +1,28 @@ -<JDialog title='JRST' resizable='true' modal='true' visible='false' +<!-- + #%L + JRst :: Api + + $Id$ + $HeadURL$ + %% + Copyright (C) 2004 - 2012 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + #L% + --> +<JDialog title='JRST' resizable='false' modal='true' visible='false' defaultCloseOperation='{JDialog.DO_NOTHING_ON_CLOSE}' onWindowClosing='handler.cancel()'> @@ -106,7 +130,6 @@ onActionPerformed='model.setSimpleMode(simpleModeChechBox.isSelected())'/> </cell> </row> - <row> <cell columns='3' weightx='1' fill='horizontal'> <Table> @@ -121,7 +144,5 @@ </Table> </cell> </row> - </Table> - </JDialog> \ No newline at end of file Modified: trunk/jrst/src/main/java/org/nuiton/jrst/ui/JRSTViewHandler.java =================================================================== --- trunk/jrst/src/main/java/org/nuiton/jrst/jaxxUI/JRSTViewHandler.java 2012-06-13 13:17:14 UTC (rev 714) +++ trunk/jrst/src/main/java/org/nuiton/jrst/ui/JRSTViewHandler.java 2012-06-13 13:37:59 UTC (rev 715) @@ -1,15 +1,37 @@ -package org.nuiton.jrst.jaxxUI; +/* + * #%L + * JRst :: Api + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ +package org.nuiton.jrst.ui; -import com.sun.jndi.toolkit.url.UrlUtil; import java.awt.Color; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.File; import javax.swing.ButtonGroup; import javax.swing.JFileChooser; -import javax.swing.JLabel; import javax.swing.JOptionPane; -import javax.swing.JTextField; +import javax.swing.JPanel; import jaxx.runtime.context.JAXXInitialContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -107,22 +129,15 @@ } }); - jrstView.getXslListPanel().add(xslPanel); + JPanel xslListPanel = jrstView.getXslListPanel(); + xslListPanel.add(xslPanel); jrstView.pack(); } - public JLabel getErrorLabel() { - JLabel errorLbl = jrstView.getErrorLbl(); - if (errorLbl == null) { - errorLbl = new JLabel(""); - } - return errorLbl; - } - public void convert() { if (jrstView.getOpenLocationText().getText().equals("")) { - jrstView.getHandler().getErrorLabel().setText(_("openEmpty?")); - jrstView.getHandler().getErrorLabel().setForeground(Color.RED); + jrstView.getErrorLbl().setText(_("openEmpty?")); + jrstView.getErrorLbl().setForeground(Color.RED); jrstView.pack(); } else { launchJRST(); @@ -131,27 +146,20 @@ } public void launchJRST() { - boolean exit = false; - String xslListOrFormat = ""; File fileIn = null; - File fileOut = null; JRSTCommandModel model = jrstView.getModel(); if (!model.isOverwrite()) { fileIn = new File(model.getOpenLocationText()); if (fileIn.exists()) { int choix = jrstView.getHandler().askEcraser(); - if (choix == JOptionPane.YES_OPTION) - model.setOverwrite(true); - else if (choix == JOptionPane.NO_OPTION) - exit = true; + if (choix == JOptionPane.NO_OPTION) { + fileIn = null; + } } } - JRST.Overwrite overwriteState = JRST.Overwrite.NEVER; - if (model.isOverwrite()) { - overwriteState = JRST.Overwrite.ALLTIME; - } - if (!exit) { + if (fileIn != null) { + String xslListOrFormat; if (model.isFormatEnabled()) xslListOrFormat = model.getSelectedFormat(); else { @@ -173,20 +181,20 @@ if (model.isFormatEnabled()) { outputFile += xslListOrFormat; } else { - outputFile += "xml"; + outputFile += JRST.TYPE_XML; } outputFile = fileIn.getParent() + File.separator + outputFile; } } - fileOut = new File(outputFile); - } + File fileOut = new File(outputFile); - try{ - JRST.generate(xslListOrFormat, fileIn, fileOut, overwriteState, model.isSimpleMode()); - } catch (Exception e) { - log.error("Can't generate the document with this configuration", e); - } finally { - jrstView.dispose(); + try{ + JRST.generate(xslListOrFormat, fileIn, fileOut, JRST.Overwrite.ALLTIME, model.isSimpleMode()); + } catch (Exception e) { + log.error("Can't generate the document with this configuration", e); + } finally { + jrstView.dispose(); + } } } } Modified: trunk/jrst/src/main/java/org/nuiton/jrst/ui/XslPanel.jaxx =================================================================== --- trunk/jrst/src/main/java/org/nuiton/jrst/jaxxUI/XslPanel.jaxx 2012-06-13 13:17:14 UTC (rev 714) +++ trunk/jrst/src/main/java/org/nuiton/jrst/ui/XslPanel.jaxx 2012-06-13 13:37:59 UTC (rev 715) @@ -1,3 +1,27 @@ +<!-- + #%L + JRst :: Api + + $Id$ + $HeadURL$ + %% + Copyright (C) 2004 - 2012 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + #L% + --> <Table id='xslListPanel'> <import> java.awt.Dimension Modified: trunk/jrst/src/main/java/org/nuiton/jrst/ui/XslPanelHandler.java =================================================================== --- trunk/jrst/src/main/java/org/nuiton/jrst/jaxxUI/XslPanelHandler.java 2012-06-13 13:17:14 UTC (rev 714) +++ trunk/jrst/src/main/java/org/nuiton/jrst/ui/XslPanelHandler.java 2012-06-13 13:37:59 UTC (rev 715) @@ -1,4 +1,28 @@ -package org.nuiton.jrst.jaxxUI; +/* + * #%L + * JRst :: Api + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ +package org.nuiton.jrst.ui; import java.io.File; import javax.swing.JFileChooser; Modified: trunk/jrst/src/test/java/org/nuiton/jrst/JRSTTest.java =================================================================== --- trunk/jrst/src/test/java/org/nuiton/jrst/JRSTTest.java 2012-06-13 13:17:14 UTC (rev 714) +++ trunk/jrst/src/test/java/org/nuiton/jrst/JRSTTest.java 2012-06-13 13:37:59 UTC (rev 715) @@ -26,13 +26,9 @@ package org.nuiton.jrst; import java.io.File; -import java.util.Arrays; -import java.util.List; -import org.apache.commons.io.FileUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; import org.nuiton.util.Resource;
participants (1)
-
sletellier@users.nuiton.org