From jpages@users.nuiton.org Mon Jun 11 17:57:49 2012 From: jpages@users.nuiton.org To: jrst-commits@list.nuiton.org Subject: [Jrst-commits] r712 - in trunk/jrst/src/main/java/org/nuiton/jrst: . jaxxUI Date: Mon, 11 Jun 2012 17:57:48 +0200 Message-ID: <20120611155748.F326615827@nuiton.codelutin.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2461044783670336507==" --===============2461044783670336507== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Author: jpages Date: 2012-06-11 17:57:48 +0200 (Mon, 11 Jun 2012) New Revision: 712 Url: http://nuiton.org/repositories/revision/jrst/712 Log: Suite du passage ?\195?\160 Jaxx pour l'interface graphique. Modified: trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java trunk/jrst/src/main/java/org/nuiton/jrst/jaxxUI/JRSTView.jaxx trunk/jrst/src/main/java/org/nuiton/jrst/jaxxUI/JRSTViewHandler.java Modified: trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java 2012-06-08 16:18:59 UT= C (rev 711) +++ trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java 2012-06-11 15:57:48 UT= C (rev 712) @@ -24,8 +24,7 @@ */ package org.nuiton.jrst; =20 -import java.awt.GraphicsDevice; -import java.awt.GraphicsEnvironment; +import java.awt.*; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; @@ -38,9 +37,11 @@ import java.io.Reader; import java.net.URL; import java.util.HashMap; +import java.util.LinkedList; 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,6 +56,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.legacy.JRSTReader; import org.nuiton.util.ApplicationConfig; import org.nuiton.util.Resource; @@ -262,9 +264,15 @@ protected static String[] askOptionGraph() throws SecurityException, NoSuchMethodException { =20 + /* JRSTInterface graph =3D new JRSTInterface(PATTERN_TYPE); + return graph.getCmd(); + */ + JRSTView jrstView =3D new JRSTView(); + jrstView.setVisible(true); =20 - return graph.getCmd(); + jrstView.pack(); + return jrstView.getHandler().getCmd(); } =20 /** Modified: trunk/jrst/src/main/java/org/nuiton/jrst/jaxxUI/JRSTView.jaxx =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/jrst/src/main/java/org/nuiton/jrst/jaxxUI/JRSTView.jaxx 2012-06-08 = 16:18:59 UTC (rev 711) +++ trunk/jrst/src/main/java/org/nuiton/jrst/jaxxUI/JRSTView.jaxx 2012-06-11 = 15:57:48 UTC (rev 712) @@ -1,60 +1,114 @@ - + =20 - javax.swing.JFrame + javax.swing.BoxLayout java.awt.BorderLayout java.awt.FlowLayout java.awt.Dimension org.nuiton.jrst.JRST + org.nuiton.util.Resource =20 =20 + =20 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + =20 - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
\ No newline at end of file Modified: trunk/jrst/src/main/java/org/nuiton/jrst/jaxxUI/JRSTViewHandler.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/jrst/src/main/java/org/nuiton/jrst/jaxxUI/JRSTViewHandler.java 2012= -06-08 16:18:59 UTC (rev 711) +++ trunk/jrst/src/main/java/org/nuiton/jrst/jaxxUI/JRSTViewHandler.java 2012= -06-11 15:57:48 UTC (rev 712) @@ -1,11 +1,11 @@ package org.nuiton.jrst.jaxxUI; =20 -import org.nuiton.jrst.JRST; +import org.nuiton.util.Resource; =20 import javax.swing.*; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.io.File; import java.util.LinkedList; =20 @@ -18,37 +18,36 @@ */ public class JRSTViewHandler { =20 - private LinkedList ListAddXslPanel; =20 - private LinkedList ListXslText; =20 - private LinkedList ListXslBouton; - - private LinkedList ListXslBoutonLocation; - - private LinkedList composantsXSL; - private String[] listFormats; =20 private boolean ecrase; private boolean simpleMode; private String[] commande; =20 + protected LinkedList textFieldList; + protected LinkedListListXslBoutonLocation; + protected JRSTView jrstView; =20 protected JRSTViewHandler(JRSTView jrstView) { this.jrstView =3D jrstView; } =20 - public void init(String formats) { - setFormats(formats); - composantsXSL =3D new LinkedList(); - ListAddXslPanel =3D new LinkedList(); - ListXslBouton =3D new LinkedList(); - ListXslText =3D new LinkedList(); - ListXslBoutonLocation =3D new LinkedList(); + public void init() { + ButtonGroup group =3D new ButtonGroup(); + group.add(getXslRadio()); } =20 + private JRadioButton getXslRadio() { + JRadioButton xslRadio =3D jrstView.getXslRadio(); + if (xslRadio =3D=3D null) { + xslRadio =3D new JRadioButton(_("externalXSL")); + } + return xslRadio; + } + protected void openOpenLocation() { JFileChooser fc =3D new JFileChooser(System.getProperty("user.home")= ); fc.showOpenDialog(jrstView); @@ -56,13 +55,14 @@ if (file !=3D null) { getOpenText().setText(file.getAbsolutePath()); } - } =20 private JTextField getOpenText() { JTextField openText =3D jrstView.getOpenText(); - openText =3D new JTextField(); - openText.setColumns(31); + if (openText =3D=3D null) { + openText =3D new JTextField(); + openText.setColumns(31); + } return openText; } =20 @@ -81,61 +81,102 @@ } else getSaveText().setText(file.getAbsolutePath()); } + } =20 + protected void formatEnable() { + jrstView.getFormatList().setEnabled(jrstView.getFormat().isEnabled()= ); + jrstView.getXslText().setEnabled(!jrstView.getXslText().isEnabled()); + jrstView.getBoutonXslLocation().setEnabled(!jrstView.getBoutonXslLoc= ation().isEnabled()); } =20 public int askEcraser() { - int choix =3D JOptionPane.showConfirmDialog(jrstView, _("overwriteGr= aph?")); - - return choix; + return JOptionPane.showConfirmDialog(jrstView, _("overwriteGraph?")); } =20 private JTextField getSaveText() { JTextField saveText =3D jrstView.getSaveText(); - saveText =3D new JTextField(); - saveText.setColumns(31); + if (saveText =3D=3D null) { + saveText =3D new JTextField(); + saveText.setColumns(31); + } return saveText; } =20 - protected void formatEnable() { - getFormatList().setEnabled(getFormat().isSelected()); - for (Container c : composantsXSL) - c.setEnabled(!getFormat().isSelected()); + protected JComboBox getFormatList() { + return jrstView.formatList; } =20 - private JRadioButton getFormat() { - JRadioButton format =3D jrstView.getFormat(); - format =3D new JRadioButton("Format : "); - format.setSelected(true); - format.addChangeListener(new ChangeListener() { + public String[] setFormats(String formats) { + listFormats =3D formats.split("\\|"); + return listFormats; + } =20 - public void stateChanged(ChangeEvent e) { - formatEnable(); + protected void setMode() { + simpleMode =3D !simpleMode; + } =20 + protected void annuler() { + System.exit(0); + } + + public String[] getCmd() { + return commande; + } + + public void addXslLocation(JButton button) { + JPanel panel =3D (JPanel)button.getParent(); + panel =3D new JPanel(new BoxLayout(panel, BoxLayout.Y_AXIS)); + + JTextField xslText =3D new JTextField(); + xslText.setColumns(30); + xslText.setEnabled(false); + JButton boutonXslLocation =3D new JButton(Resource.getIcon("icone/op= en.png")); + boutonXslLocation.setPreferredSize(new Dimension(30, 30)); + boutonXslLocation.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + //openXslLocation((JButton) e.getSource()); } + }); + boutonXslLocation.setEnabled(false); =20 + panel.add(xslText); + panel.add(boutonXslLocation); + + JPanel panel2 =3D new JPanel(new BoxLayout(panel, BoxLayout.Y_AXIS)); + JButton addXslButton =3D new JButton(Resource.getIcon("icone/more.gi= f")); + addXslButton.setPreferredSize(new Dimension(20, 20)); + addXslButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent event) { + addXslLocation((JButton) event.getSource()); + } }); - return format; + panel2.add(addXslButton); } =20 - protected JComboBox getFormatList() { - JComboBox formatList =3D jrstView.getFormatList(); - formatList =3D new JComboBox(setFormats(JRST.PATTERN_TYPE)); - return formatList; + private JLabel getErrorLabel() { + JLabel errorLbl =3D jrstView.getErrorLbl(); + if (errorLbl =3D=3D null) { + errorLbl =3D new JLabel(""); + } + return errorLbl; } =20 - public String[] setFormats(String formats) { - return listFormats =3D formats.split("\\|"); - } + protected void openXslLocation(JButton b) { + JFileChooser fc =3D new JFileChooser(System.getProperty("user.home")= ); + fc.showOpenDialog(jrstView); + File file =3D fc.getSelectedFile(); + if (file !=3D null) { + int i =3D 0; + for (JButton btmp : ListXslBoutonLocation) { + if (btmp =3D=3D b) { + textFieldList.get(i).setText(file.getAbsolutePath()); + } =20 - protected void setMode() { - simpleMode =3D !simpleMode; + i++; + } + } } =20 - protected void annuler() { - System.exit(0); - } - protected void convert() { boolean exit =3D false; if (getOpenText().getText().equals("")) { @@ -160,11 +201,11 @@ if (simpleMode) { cmd +=3D "--simple "; } - if (getFormat().isSelected()) + if (jrstView.getFormat().isSelected()) cmd +=3D "-t " + getFormatList().getSelectedItem(); else { cmd +=3D "-x "; - for (JTextField t : ListXslText) { + for (JTextField t : textFieldList) { if (!t.getText().equals("")) cmd +=3D t.getText() + ","; } @@ -179,11 +220,4 @@ =20 } } - - private JLabel getErrorLabel() { - JLabel errorLbl =3D jrstView.getErrorLbl(); - errorLbl =3D new JLabel(""); - return errorLbl; - } - } --===============2461044783670336507==--