From sletellier@users.nuiton.org Thu Jun 14 15:12:29 2012
From: sletellier@users.nuiton.org
To: jaxx-commits@list.nuiton.org
Subject: [Jaxx-commits] r2329 - in trunk:
jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor
jaxx-demo/src/main/java/jaxx/demo/tree jaxx-demo/src/main/resources/i18n
jaxx-widgets jaxx-widgets/src/main/java/jaxx/runtime/swing/editor
jaxx-widgets/src/main/resources/icons
Date: Thu, 14 Jun 2012 15:12:29 +0200
Message-ID: <20120614131229.89A3E15827@nuiton.codelutin.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============8851213820084873257=="
--===============8851213820084873257==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Author: sletellier
Date: 2012-06-14 15:12:29 +0200 (Thu, 14 Jun 2012)
New Revision: 2329
Url: http://nuiton.org/repositories/revision/jaxx/2329
Log:
- fixes #2137 : Add component to choose a file
- add file choose demo ui
- add guava dependency
- add open icon
Added:
trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/FileEditorDe=
mo.jaxx
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/FileEditor.jaxx
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/FileEditorHandl=
er.java
trunk/jaxx-widgets/src/main/resources/icons/action-open.png
Modified:
trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/DatePickerDe=
mo.jaxx
trunk/jaxx-demo/src/main/java/jaxx/demo/tree/DemoDataProvider.java
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_en_GB.properties
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_es_ES.properties
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_fr_FR.properties
trunk/jaxx-widgets/pom.xml
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/DateP=
ickerDemo.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/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/DatePickerD=
emo.jaxx 2012-06-14 09:50:58 UTC (rev 2328)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/DatePickerD=
emo.jaxx 2012-06-14 13:12:29 UTC (rev 2329)
@@ -61,7 +61,7 @@
=20
-
+ |
| |
- |
-
- |
-
+ |
|
-
+ |
|
| |
Added: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/FileEdit=
orDemo.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/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/FileEditorD=
emo.jaxx (rev 0)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/FileEditorD=
emo.jaxx 2012-06-14 13:12:29 UTC (rev 2329)
@@ -0,0 +1,73 @@
+
+
+
+ jaxx.runtime.swing.editor.FileEditor
+
+
+
+
+
+
+
+
+ |
+
+ |
+
+
+ |
+
+
+ |
+
+ |
+
+
+ |
+
+
+ |
+
+ |
+
+
+ |
+
+
+ |
+
+ |
+
+
+
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/tree/DemoDataProvider.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/jaxx-demo/src/main/java/jaxx/demo/tree/DemoDataProvider.java 2012-0=
6-14 09:50:58 UTC (rev 2328)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/tree/DemoDataProvider.java 2012-0=
6-14 13:12:29 UTC (rev 2329)
@@ -33,6 +33,7 @@
import jaxx.demo.component.jaxx.StatusMessagePanelDemo;
import jaxx.demo.component.jaxx.editor.ComboEditorDemo;
import jaxx.demo.component.jaxx.editor.DatePickerDemo;
+import jaxx.demo.component.jaxx.editor.FileEditorDemo;
import jaxx.demo.component.jaxx.editor.I18nEditorDemo;
import jaxx.demo.component.jaxx.editor.NumberEditorDemo;
import jaxx.demo.component.jaxx.editor.TimeEditorDemo;
@@ -153,7 +154,8 @@
NumberEditorDemo.class,
ComboEditorDemo.class,
I18nEditorDemo.class,
- DatePickerDemo.class
+ DatePickerDemo.class,
+ FileEditorDemo.class
);
=20
addMapping(n_("jaxxdemo.feature"),
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_en_GB.properties
=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/jaxx-demo/src/main/resources/i18n/jaxx-demo_en_GB.properties 2012-0=
6-14 09:50:58 UTC (rev 2328)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_en_GB.properties 2012-0=
6-14 13:12:29 UTC (rev 2329)
@@ -195,6 +195,9 @@
jaxxdemo.feature.databinding=3DData Binding
jaxxdemo.feature.nav=3DJaxx nav API
jaxxdemo.feature.validation=3DValidation
+jaxxdemo.fileEditor.extsDescLbl=3DExtensions description (separated by comma=
, ex \: text (*.txt), images (*.png))
+jaxxdemo.fileEditor.extsLbl=3DExtensions (separated by comma, ex \: txt, png)
+jaxxdemo.fileEditor.titleLbl=3DOpen dialog title
jaxxdemo.fun=3DFun
jaxxdemo.i18neditor.configuration=3DConfiguration
jaxxdemo.i18neditor.popup.title=3DTitle of popup
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_es_ES.properties
=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/jaxx-demo/src/main/resources/i18n/jaxx-demo_es_ES.properties 2012-0=
6-14 09:50:58 UTC (rev 2328)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_es_ES.properties 2012-0=
6-14 13:12:29 UTC (rev 2329)
@@ -195,6 +195,9 @@
jaxxdemo.feature.databinding=3DData binding
jaxxdemo.feature.nav=3DAPI JAXX pour les arbres
jaxxdemo.feature.validation=3DValidation
+jaxxdemo.fileEditor.extsDescLbl=3DDescription des extensions (s=C3=A9par=C3=
=A9es par des virgules, ex \: Texte (*.txt), Images (*.png))
+jaxxdemo.fileEditor.extsLbl=3DExtensions (separated by comma, ex \: txt, png)
+jaxxdemo.fileEditor.titleLbl=3DTitre du dialog d'ouverture de fichier
jaxxdemo.fun=3DFun
jaxxdemo.i18neditor.configuration=3DConfiguration
jaxxdemo.i18neditor.popup.title=3DTitre de la popup
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_fr_FR.properties
=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/jaxx-demo/src/main/resources/i18n/jaxx-demo_fr_FR.properties 2012-0=
6-14 09:50:58 UTC (rev 2328)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_fr_FR.properties 2012-0=
6-14 13:12:29 UTC (rev 2329)
@@ -195,6 +195,9 @@
jaxxdemo.feature.databinding=3DData binding
jaxxdemo.feature.nav=3DAPI JAXX pour les arbres
jaxxdemo.feature.validation=3DValidation
+jaxxdemo.fileEditor.extsDescLbl=3DDescription des extensions (s=C3=A9par=C3=
=A9es par des virgules, ex \: Texte (*.txt), Images (*.png))
+jaxxdemo.fileEditor.extsLbl=3DExtensions (separated by comma, ex \: txt, png)
+jaxxdemo.fileEditor.titleLbl=3DTitre de la fen=C3=AAtre de s=C3=A9lection de=
fichier
jaxxdemo.fun=3DFun
jaxxdemo.i18neditor.configuration=3DConfiguration
jaxxdemo.i18neditor.popup.title=3DTitre de la popup
Modified: trunk/jaxx-widgets/pom.xml
=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/jaxx-widgets/pom.xml 2012-06-14 09:50:58 UTC (rev 2328)
+++ trunk/jaxx-widgets/pom.xml 2012-06-14 13:12:29 UTC (rev 2329)
@@ -67,6 +67,11 @@
=20
+ com.google.guava
+ guava
+
+
+
commons-lang
commons-lang
Added: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/FileEditor.=
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/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/FileEditor.jax=
x (rev 0)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/FileEditor.jax=
x 2012-06-14 13:12:29 UTC (rev 2329)
@@ -0,0 +1,84 @@
+
+
+
+
+ java.io.File
+ java.beans.PropertyChangeEvent
+ java.beans.PropertyChangeListener
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+ |
+
+
+ |
+
+
\ No newline at end of file
Added: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/FileEditorH=
andler.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/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/FileEditorHand=
ler.java (rev 0)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/FileEditorHand=
ler.java 2012-06-14 13:12:29 UTC (rev 2329)
@@ -0,0 +1,105 @@
+/*
+ * #%L
+ * JAXX :: Widgets
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2008 - 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=20
+ * published by the Free Software Foundation, either version 3 of the=20
+ * License, or (at your option) any later version.
+ *=20
+ * 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.
+ *=20
+ * You should have received a copy of the GNU General Lesser Public=20
+ * License along with this program. If not, see
+ * .
+ * #L%
+ */
+package jaxx.runtime.swing.editor;
+
+import com.google.common.io.Files;
+import java.io.File;
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileFilter;
+
+/**
+ * @author sletellier
+ */
+public class FileEditorHandler {
+
+ public static final String SEPARATOR_REGEX =3D "\\s*,\\s*";
+ protected FileEditor view;
+
+ public FileEditorHandler(FileEditor view) {
+ this.view =3D view;
+ }
+
+ public void openLocation() {
+
+ // use last selected file
+ File startFile =3D view.getSelectedFile();
+ if (startFile =3D=3D null) {
+
+ // else filed start file
+ startFile =3D view.getStartFile();
+ }
+ if (startFile =3D=3D null) {
+
+ // else start with user home
+ startFile =3D new File(System.getProperty("user.home"));
+ }
+ JFileChooser fc =3D new JFileChooser(startFile);
+
+ fc.setDialogTitle(view.getTitle());
+ fc.setAcceptAllFileFilterUsed(view.getAcceptAllFileFilterUsed());
+
+ String extsAsString =3D view.getExts();
+ if (extsAsString !=3D null) {
+
+ // extentions can be separted by comma
+ String[] exts =3D extsAsString.split(SEPARATOR_REGEX);
+ String[] descs =3D view.getExtsDescription().split(SEPARATOR_REG=
EX);
+ for (int i =3D 0;i