From: <aki...@us...> - 2007-01-13 21:13:06
|
Revision: 1593 http://svn.sourceforge.net/gridarta/?rev=1593&view=rev Author: akirschbaum Date: 2007-01-13 13:13:01 -0800 (Sat, 13 Jan 2007) Log Message: ----------- Add build information (including the SVN revision number) and licenses to about dialog. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/build.xml trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/IGUIConstants.java trunk/crossfire/src/cfeditor/messages.properties trunk/crossfire/src/cfeditor/messages_de.properties Added Paths: ----------- trunk/crossfire/resource/icons/crossfireLogoSmall.png trunk/crossfire/src/cfeditor/gui/AboutDialog.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2007-01-13 21:07:56 UTC (rev 1592) +++ trunk/crossfire/ChangeLog 2007-01-13 21:13:01 UTC (rev 1593) @@ -1,3 +1,8 @@ +2007-01-13 Andreas Kirschbaum + + * Add build information (including the SVN revision number) and + licenses to about dialog. + 2007-01-11 Andreas Kirschbaum * Enable "save" after "save as". Modified: trunk/crossfire/build.xml =================================================================== --- trunk/crossfire/build.xml 2007-01-13 21:07:56 UTC (rev 1592) +++ trunk/crossfire/build.xml 2007-01-13 21:13:01 UTC (rev 1593) @@ -24,7 +24,6 @@ <!-- set properties and clean build directory --> <target name="init"> <property file="developer.properties" /> - <property file="nextBuildNumber.properties" /> <property name="src.dir" value="src" /> <property name="lib.dir" value="lib" /> <property name="devlib.dir" value="devlib/" /><!-- Don't forget trailing / ! --> @@ -44,10 +43,12 @@ <property name="build.developer" value="unknown" /> <property name="javac.args" value="-Xlint:all,-path,-unchecked,-fallthrough,-serial" /> <tstamp><format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss z" timezone="UTC"/></tstamp> + <exec executable="svnversion" outputproperty="build.number" /> <echoproperties destfile="build.properties"> - <propertyset negate="true"> - <propertyref prefix="user.ftp"/> - <propertyref prefix="user.scp"/> + <propertyset> + <propertyref prefix="build.developer"/> + <propertyref prefix="build.number"/> + <propertyref prefix="build.tstamp"/> </propertyset> </echoproperties> </target> @@ -115,6 +116,14 @@ <!-- pack everything into the jar file --> <fileset dir="${build.dir}" excludes="MANIFEST.MF,test/**"/> <fileset dir="${src.dir}" includes="**/*.properties" /> + <fileset file="build.properties" /> + <fileset file="../COPYING" /> + <fileset dir="${lib.dir}"> + <include name="*-LICENSE" /> + </fileset> + <fileset dir="../lib"> + <include name="LICENSE-japi.jar" /> + </fileset> <zipgroupfileset dir="../lib/" includes="japi-*.jar" /> <!-- creating the manifest --> @@ -163,7 +172,7 @@ link = "${user.javadoc.link}" > <classpath> - <fileset dir="${lib.dir}" includes="*.jar" excludes="LICENSE-*.jar" /> + <fileset dir="${lib.dir}" includes="*.jar" excludes="*.jar-LICENSE" /> <fileset dir="../lib/" includes="*.jar" excludes="LICENSE-*.jar" /> </classpath> <sourcepath path="${src.dir}" /> @@ -276,8 +285,6 @@ <include name="update.properties" /> </fileset> </scp> - <buildnumber file="nextBuildNumber.properties" /> - <cvs command="commit -m "Released new update version, committing next build number." nextBuildNumber.properties" /> </target> </project> Added: trunk/crossfire/resource/icons/crossfireLogoSmall.png =================================================================== (Binary files differ) Property changes on: trunk/crossfire/resource/icons/crossfireLogoSmall.png ___________________________________________________________________ Name: svn:mime-type + image/png Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2007-01-13 21:07:56 UTC (rev 1592) +++ trunk/crossfire/src/cfeditor/CMainView.java 2007-01-13 21:13:01 UTC (rev 1593) @@ -25,6 +25,7 @@ package cfeditor; import cfeditor.gameobject.GameObject; +import cfeditor.gui.AboutDialog; import cfeditor.gui.GameObjectAttributesPanel; import cfeditor.gui.InsertionObjectChooser; import cfeditor.gui.pickmapchooser.PickmapChooserControl; @@ -784,9 +785,12 @@ } } + /** The AboutDialog. */ + private final AboutDialog aboutDialog = new AboutDialog(); + /** Action method for about. */ public void about() { - mainControl.showMessage("About " + IGUIConstants.APP_NAME, " Version " + IGUIConstants.VERSION + "\n (c) 2001 Michael Toennies\n" + " Andreas Vogl\n"); + aboutDialog.showAboutDialog(this); } public GameObjectAttributesPanel getMapArchPanel() { Modified: trunk/crossfire/src/cfeditor/IGUIConstants.java =================================================================== --- trunk/crossfire/src/cfeditor/IGUIConstants.java 2007-01-13 21:07:56 UTC (rev 1592) +++ trunk/crossfire/src/cfeditor/IGUIConstants.java 2007-01-13 21:13:01 UTC (rev 1593) @@ -37,12 +37,6 @@ public interface IGUIConstants { /** - * Version number of the CFJavaEditor. - * Should be increased when a certain amount of changes happened. - */ - String VERSION = "0.986"; - - /** * Internal version number of the included online-documentation. * Increasing the number causes an automated popup of the docu * when users upgrade their editor and run for the first time. Added: trunk/crossfire/src/cfeditor/gui/AboutDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/AboutDialog.java (rev 0) +++ trunk/crossfire/src/cfeditor/gui/AboutDialog.java 2007-01-13 21:13:01 UTC (rev 1593) @@ -0,0 +1,188 @@ +/* + * Gridarta Map Editor. + * Copyright (C) 2007 The Gridarta Developers + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 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 Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +package cfeditor.gui; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Font; +import java.io.BufferedInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.Reader; +import java.util.Enumeration; +import java.util.Properties; +import java.util.ResourceBundle; +import java.util.SortedSet; +import java.util.TreeSet; +import javax.swing.ImageIcon; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTabbedPane; +import javax.swing.JTextArea; +import javax.swing.SwingConstants; +import net.sf.japi.swing.ActionFactory; + +/** + * The AboutDialog displays information about the editor like properties and + * licenses. + * + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @author Andreas Kirschbaum + */ +public class AboutDialog extends JPanel { + + /** Action Factory to create Actions. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); + + /** + * The main tabs. + */ + private final JTabbedPane tabs; + + /** + * The tabs in the license tab. + */ + private final JTabbedPane licensePane; + + /** Create an AboutDialog. */ + public AboutDialog() { + super(new BorderLayout()); + tabs = new JTabbedPane(); + tabs.add(buildAboutTab()); + licensePane = buildLicenseTab(); + tabs.add(licensePane); + add(tabs); + tabs.add(buildRuntimePropertiesTab()); + add(new JLabel(new ImageIcon(getClass().getClassLoader().getResource("icons/crossfireLogoSmall.png"))), BorderLayout.NORTH); + } + + /** + * Show about dialog. + * @param parent Parent component to show dialog on + */ + public void showAboutDialog(final Component parent) { + tabs.setSelectedIndex(0); + licensePane.setSelectedIndex(0); + JOptionPane.showMessageDialog(parent, this, ACTION_FACTORY.getString("about.title"), JOptionPane.PLAIN_MESSAGE); + } + + /** + * Build the about tab. + * @return component for about tab + */ + private static JComponent buildAboutTab() { + String buildNumber = "unknown"; + String buildDeveloper = "unknown"; + String buildTstamp = "unknown"; + try { + final ResourceBundle bundle = ResourceBundle.getBundle("build"); + buildDeveloper = bundle.getString("build.developer"); + buildNumber = bundle.getString("build.number"); + buildTstamp = bundle.getString("build.tstamp"); + } catch (final Exception e) { + /* ignore */ + } + final JLabel aboutTab = new JLabel(ACTION_FACTORY.format("about", System.getProperty("java.version"), buildNumber, buildDeveloper, buildTstamp), SwingConstants.CENTER); + aboutTab.setName(ACTION_FACTORY.getString("aboutTab.title")); + return aboutTab; + } + + /** + * Build the license tab. + * @return component for license tab + */ + private JTabbedPane buildLicenseTab() { + final JTabbedPane licensePane = new JTabbedPane(); + for (int i = 1; ACTION_FACTORY.getString("license." + i + ".title") != null; i++) { + licensePane.add(buildLicenseSubTab(String.valueOf(i))); + } + licensePane.setName(ACTION_FACTORY.getString("license.title")); + return licensePane; + } + + /** + * Build a XY license tab. + * @param number number of license + * @return component for XY license tab + */ + private JComponent buildLicenseSubTab(final String number) { + String licenseText; + try { + final Reader in = new InputStreamReader(new BufferedInputStream(getClass().getClassLoader().getResource(ACTION_FACTORY.getString("license." + number + ".file")).openStream())); + try { + final StringBuilder sb = new StringBuilder(); + final char[] buf = new char[4096]; + for (int bytesRead; (bytesRead = in.read(buf)) != -1; sb.append(buf, 0, bytesRead)) { + ; + } + licenseText = sb.toString(); + } finally { + in.close(); + } + } catch (final NullPointerException e) { + licenseText = ACTION_FACTORY.getString("license.missing"); + } catch (final IOException e) { + licenseText = ACTION_FACTORY.getString("license.missing"); + } + final JTextArea license = new JTextArea(licenseText, 16, 80); + license.setLineWrap(true); + license.setWrapStyleWord(true); + license.setEditable(false); + license.setFont(new Font("Monospaced", Font.PLAIN, license.getFont().getSize())); + final JScrollPane scroller = new JScrollPane(license); + scroller.setFocusable(true); + scroller.setName(ACTION_FACTORY.getString("license." + number + ".title")); + return scroller; + } + + /** + * Build the runtime properties tab. + * @return component for runtime properties tab + */ + private static JComponent buildRuntimePropertiesTab() { + final StringBuilder propertiesText = new StringBuilder(); + final SortedSet<String> keys = new TreeSet<String>(); + final Properties props = System.getProperties(); + for (final Object key : props.keySet()) { + if (key instanceof String) { + keys.add((String) key); + } + } + for (final String key : keys) { + propertiesText + .append(key) + .append('=') + .append(props.getProperty(key)) + .append('\n'); + } + final JTextArea properties = new JTextArea(propertiesText.toString(), 16, 77); + properties.setEditable(false); + properties.setFont(new Font("Monospaced", Font.PLAIN, properties.getFont().getSize())); + final JScrollPane scroller = new JScrollPane(properties); + scroller.setName(ACTION_FACTORY.getString("aboutRuntimeProperties.title")); + scroller.setFocusable(true); + return scroller; + } + +} // class AboutDialog Property changes on: trunk/crossfire/src/cfeditor/gui/AboutDialog.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/crossfire/src/cfeditor/messages.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages.properties 2007-01-13 21:07:56 UTC (rev 1592) +++ trunk/crossfire/src/cfeditor/messages.properties 2007-01-13 21:13:01 UTC (rev 1593) @@ -436,7 +436,30 @@ about.text=About... about.mnemonic=A +about.title=About Gridarta for Crossfire +about=<html><h1 align="center">Gridarta for Crossfire</h1><p>Editor for Crossfire MMORPG maps and arches</p><table><tr><td valign="top" align="right" width="50%">Copyright \xA9 2001-2007</td><td width="50%">Michael Toennies<br>Andreas Vogl<br>Peter Plischewsky<br>Gecko<br>Christian Hujer<br>Daniel Viegas<br>Andreas Kirschbaum</td></tr><tr><td align="right">Java version:</td><td>{0}</td></tr><tr><td align="right">Version:</td><td>{1}</td></tr><tr><td align="right">by:</td><td>{2}</td></tr><tr><td align="right">at:</td><td>{3}</td></tr></table></html> +aboutTab.title=About +license.text=License... +license.mnemonic=L +license.title=License +license.missing=Cannot find License file. +license.1.title=Gridarta +license.1.file=COPYING +license.2.title=JAPI +license.2.file=LICENSE-japi.jar +license.3.title=SUN Icons +license.3.file=jlfgr-1_0.jar-LICENSE +license.4.title=BSH +license.4.file=bsh-LICENSE +license.5.title=JDOM +license.5.file=jdom.jar-LICENSE +license.6.title=Log4j +license.6.file=log4j.jar-LICENSE + +aboutRuntimeProperties.title=Runtime properties + + ############ # Map window Modified: trunk/crossfire/src/cfeditor/messages_de.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_de.properties 2007-01-13 21:07:56 UTC (rev 1592) +++ trunk/crossfire/src/cfeditor/messages_de.properties 2007-01-13 21:13:01 UTC (rev 1593) @@ -639,7 +639,18 @@ about.text=\xDCber... about.mnemonic=B +about.title=\xDCber Gridarta f\xFCr Crossfire +about=<html><h1 align="center">Gridarta f\xFCr Crossfire</h1><p>Editor f\xFCr Crossfire MMORPG Karten und Objekte</p><table><tr><td valign="top" align="right" width="50%">Copyright \xA9 2001-2007</td><td width="50%">Michael Toennies<br>Andreas Vogl<br>Peter Plischewsky<br>Gecko<br>Christian Hujer<br>Daniel Viegas<br>Andreas Kirschbaum</td></tr><tr><td align="right">Java version:</td><td>{0}</td></tr><tr><td align="right">Version:</td><td>{1}</td></tr><tr><td align="right">Entwickler:</td><td>{2}</td></tr><tr><td align="right">Erstellung:</td><td>{3}</td></tr></table></html> +aboutTab.title=\xDCber +license.text=Lizenz... +license.mnemonic=L +license.title=Lizenz +license.missing=Kann Lizenzdatei nicht finden. + +aboutRuntimeProperties.title=Laufzeitparameter + + ############ # Map window This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |