Skip to content

Commit 40256ba

Browse files
author
Jon Iles
committed
Initial revision of the MppExplorer UI.
1 parent 4e04a69 commit 40256ba

21 files changed

+2246
-4
lines changed

.classpath

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
<classpathentry kind="src" path="src"/>
44
<classpathentry kind="lib" path="junit/junit.jar"/>
55
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
6-
<classpathentry kind="lib" path="lib/poi-3.10-PATCHED.jar"/>
6+
<classpathentry kind="lib" path="lib/poi-3.10-PATCHED.jar" sourcepath="D:/java/poi-3.10-PATCHED/src"/>
7+
<classpathentry kind="lib" path="jgoodies/jgoodies-binding-2.10.0.jar" sourcepath="D:/java/jgoodies-binding-2.10.0/jgoodies-binding-2.10.0-sources.jar"/>
8+
<classpathentry kind="lib" path="jgoodies/jgoodies-common-1.8.0.jar" sourcepath="D:/java/jgoodies-common-1_8_0/jgoodies-common-1.8.0/jgoodies-common-1.8.0-sources.jar"/>
79
<classpathentry kind="output" path="classes"/>
810
</classpath>

ant/build.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
</target>
8282

8383
<target name="compile" depends="init,update-maven-pom" description="Compile Everything">
84-
<javac srcdir="${basedir}/src" destdir="${classes.dir}" classpath="${classpath}:${poi.classpath}:${junit.classpath}" debug="on" source="${target-jvm-version}" target="${target-jvm-version}" includeantruntime="false">
84+
<javac srcdir="${basedir}/src" destdir="${classes.dir}" classpath="${classpath}:${poi.classpath}:${junit.classpath}" debug="on" source="${target-jvm-version}" target="${target-jvm-version}" includeantruntime="false" excludes="net/sf/mpxj/explorer/**">
8585
<compilerarg line="-encoding cp1252" />
8686
<!-- <compilerarg value="-Xlint"/> -->
8787
</javac>
@@ -148,7 +148,7 @@
148148
<include name="**/*.java" />
149149
</replace>
150150

151-
<javac srcdir="${ikvm.src.dir}" destdir="${ikvm.classes.dir}" classpath="${classpath}:${poi.classpath}:${junit.classpath}:${ikvm.lib.dir}/mscorlib.jar" debug="on" source="${target-jvm-version}" target="${target-jvm-version}" includeantruntime="false">
151+
<javac srcdir="${ikvm.src.dir}" destdir="${ikvm.classes.dir}" classpath="${classpath}:${poi.classpath}:${junit.classpath}:${ikvm.lib.dir}/mscorlib.jar" debug="on" source="${target-jvm-version}" target="${target-jvm-version}" includeantruntime="false" excludes="net/sf/mpxj/explorer/**">
152152
<compilerarg line="-encoding cp1252" />
153153
</javac>
154154

jgoodies/LICENSE-binding.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
The BSD License for the JGoodies Binding
3+
========================================
4+
5+
Copyright (c) 2002-2013 JGoodies Software GmbH. All rights reserved.
6+
7+
Redistribution and use in source and binary forms, with or without
8+
modification, are permitted provided that the following conditions are met:
9+
10+
o Redistributions of source code must retain the above copyright notice,
11+
this list of conditions and the following disclaimer.
12+
13+
o Redistributions in binary form must reproduce the above copyright notice,
14+
this list of conditions and the following disclaimer in the documentation
15+
and/or other materials provided with the distribution.
16+
17+
o Neither the name of JGoodies Software GmbH nor the names of
18+
its contributors may be used to endorse or promote products derived
19+
from this software without specific prior written permission.
20+
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24+
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
25+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28+
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30+
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

jgoodies/LICENSE-common.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
The BSD License for the JGoodies Common
3+
=======================================
4+
5+
Copyright (c) 2009-2014 JGoodies Software GmbH. All rights reserved.
6+
7+
Redistribution and use in source and binary forms, with or without
8+
modification, are permitted provided that the following conditions are met:
9+
10+
o Redistributions of source code must retain the above copyright notice,
11+
this list of conditions and the following disclaimer.
12+
13+
o Redistributions in binary form must reproduce the above copyright notice,
14+
this list of conditions and the following disclaimer in the documentation
15+
and/or other materials provided with the distribution.
16+
17+
o Neither the name of JGoodies Software GmbH nor the names of
18+
its contributors may be used to endorse or promote products derived
19+
from this software without specific prior written permission.
20+
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24+
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
25+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28+
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30+
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

jgoodies/jgoodies-binding-2.10.0.jar

192 KB
Binary file not shown.

jgoodies/jgoodies-common-1.8.0.jar

35 KB
Binary file not shown.

jgoodies/readme.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Note that the JGoodies libraries are only required to support the MppExplorer Swing UI.
2+
These libraries are not required to use the core MPXJ functionality.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* file: FileChooserController.java
3+
* author: Jon Iles
4+
* copyright: (c) Packwood Software 2014
5+
* date: 06/07/2014
6+
*/
7+
8+
/*
9+
* This library is free software; you can redistribute it and/or modify it
10+
* under the terms of the GNU Lesser General Public License as published by the
11+
* Free Software Foundation; either version 2.1 of the License, or (at your
12+
* option) any later version.
13+
*
14+
* This library is distributed in the hope that it will be useful, but
15+
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16+
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17+
* License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public License
20+
* along with this library; if not, write to the Free Software Foundation, Inc.,
21+
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22+
*/
23+
24+
package net.sf.mpxj.explorer;
25+
26+
/**
27+
* Implements the controller component of the FileChooser MVC.
28+
*/
29+
public class FileChooserController
30+
{
31+
private final FileChooserModel m_model;
32+
33+
/**
34+
* Constructor.
35+
*
36+
* @param model file chooser model
37+
*/
38+
public FileChooserController(FileChooserModel model)
39+
{
40+
m_model = model;
41+
}
42+
43+
/**
44+
* Open the file choose dialog.
45+
*/
46+
public void openFileChooser()
47+
{
48+
m_model.setShowDialog(true);
49+
}
50+
}
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
/*
2+
* file: FileChooserModel.java
3+
* author: Jon Iles
4+
* copyright: (c) Packwood Software 2014
5+
* date: 06/07/2014
6+
*/
7+
8+
/*
9+
* This library is free software; you can redistribute it and/or modify it
10+
* under the terms of the GNU Lesser General Public License as published by the
11+
* Free Software Foundation; either version 2.1 of the License, or (at your
12+
* option) any later version.
13+
*
14+
* This library is distributed in the hope that it will be useful, but
15+
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16+
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17+
* License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public License
20+
* along with this library; if not, write to the Free Software Foundation, Inc.,
21+
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22+
*/
23+
24+
package net.sf.mpxj.explorer;
25+
26+
import java.beans.PropertyChangeListener;
27+
import java.beans.PropertyChangeSupport;
28+
import java.io.File;
29+
30+
/**
31+
* Implements the model component of the FileChooser MVC.
32+
*/
33+
public class FileChooserModel
34+
{
35+
private PropertyChangeSupport m_changeSupport = new PropertyChangeSupport(this);
36+
private boolean m_showDialog;
37+
private File m_file;
38+
39+
/**
40+
* Retrieves the show dialog flag.
41+
*
42+
* @return show dialog flag
43+
*/
44+
public boolean getShowDialog()
45+
{
46+
return m_showDialog;
47+
}
48+
49+
/**
50+
* Sets the show dialog flag.
51+
*
52+
* @param showDialog show dialog flag
53+
*/
54+
public void setShowDialog(boolean showDialog)
55+
{
56+
m_changeSupport.firePropertyChange("showDialog", m_showDialog, m_showDialog = showDialog);
57+
}
58+
59+
/**
60+
* Retrieves the file selected by the user.
61+
*
62+
* @return file selected by the user
63+
*/
64+
public File getFile()
65+
{
66+
return m_file;
67+
}
68+
69+
/**
70+
* Sets the file selected by the user.
71+
*
72+
* @param file file selected by the user.
73+
*/
74+
public void setFile(File file)
75+
{
76+
m_changeSupport.firePropertyChange("file", m_file, m_file = file);
77+
}
78+
79+
/**
80+
* Add a property change listener.
81+
*
82+
* @param listener property change listener
83+
*/
84+
public void addPropertyChangeListener(PropertyChangeListener listener)
85+
{
86+
m_changeSupport.addPropertyChangeListener(listener);
87+
}
88+
89+
/**
90+
* Add a property change listener for a named property.
91+
*
92+
* @param propertyName property name
93+
* @param listener listener
94+
*/
95+
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
96+
{
97+
m_changeSupport.addPropertyChangeListener(propertyName, listener);
98+
}
99+
100+
/**
101+
* Remove a property change listener.
102+
*
103+
* @param listener property change listener
104+
*/
105+
public void removePropertyChangeListener(PropertyChangeListener listener)
106+
{
107+
m_changeSupport.removePropertyChangeListener(listener);
108+
}
109+
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
* file: FileChooserView.java
3+
* author: Jon Iles
4+
* copyright: (c) Packwood Software 2014
5+
* date: 06/07/2014
6+
*/
7+
8+
/*
9+
* This library is free software; you can redistribute it and/or modify it
10+
* under the terms of the GNU Lesser General Public License as published by the
11+
* Free Software Foundation; either version 2.1 of the License, or (at your
12+
* option) any later version.
13+
*
14+
* This library is distributed in the hope that it will be useful, but
15+
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16+
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17+
* License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public License
20+
* along with this library; if not, write to the Free Software Foundation, Inc.,
21+
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22+
*/
23+
24+
package net.sf.mpxj.explorer;
25+
26+
import java.awt.Component;
27+
import java.beans.PropertyChangeEvent;
28+
import java.beans.PropertyChangeListener;
29+
30+
import javax.swing.JFileChooser;
31+
import javax.swing.filechooser.FileNameExtensionFilter;
32+
33+
import com.jgoodies.binding.beans.PropertyAdapter;
34+
35+
/**
36+
* Implements the view component of the FileChooser MVC.
37+
*/
38+
public class FileChooserView
39+
{
40+
private final JFileChooser m_fileChooser;
41+
private final Component m_parent;
42+
private final FileChooserModel m_model;
43+
44+
/**
45+
* Constructor.
46+
*
47+
* @param parent parent component for the dialog
48+
* @param model file choose model
49+
*/
50+
public FileChooserView(Component parent, FileChooserModel model)
51+
{
52+
m_fileChooser = new JFileChooser();
53+
m_fileChooser.setFileFilter(new FileNameExtensionFilter("MPP Files", "mpp"));
54+
55+
m_parent = parent;
56+
m_model = model;
57+
58+
PropertyAdapter<FileChooserModel> adapter = new PropertyAdapter<FileChooserModel>(m_model, "showDialog", true);
59+
adapter.addValueChangeListener(new PropertyChangeListener()
60+
{
61+
@Override public void propertyChange(PropertyChangeEvent evt)
62+
{
63+
openFileChooser();
64+
}
65+
});
66+
}
67+
68+
/**
69+
* Command to open the file chooser.
70+
*/
71+
protected void openFileChooser()
72+
{
73+
if (m_model.getShowDialog())
74+
{
75+
76+
if (m_fileChooser.showOpenDialog(m_parent) == JFileChooser.APPROVE_OPTION)
77+
{
78+
m_model.setFile(m_fileChooser.getSelectedFile());
79+
}
80+
m_model.setShowDialog(false);
81+
}
82+
}
83+
}

0 commit comments

Comments
 (0)