Thread: [Japi-cvs] SF.net SVN: japi: [291] libs/swing-about/trunk/src/net/sf/japi/swing/about/ AboutDialog.
Status: Beta
Brought to you by:
christianhujer
|
From: <chr...@us...> - 2007-01-14 17:12:42
|
Revision: 291
http://svn.sourceforge.net/japi/?rev=291&view=rev
Author: christianhujer
Date: 2007-01-14 09:12:37 -0800 (Sun, 14 Jan 2007)
Log Message:
-----------
Hide license tab if there are no configured licenses.
Don't crash when there are no configured licenses.
Modified Paths:
--------------
libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java
Modified: libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java
===================================================================
--- libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java 2007-01-14 13:46:23 UTC (rev 290)
+++ libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java 2007-01-14 17:12:37 UTC (rev 291)
@@ -129,7 +129,9 @@
}
add(tabs);
addTab(buildAboutTab());
- addTab(licensePane);
+ if (licensePane.getComponentCount() > 0) {
+ addTab(licensePane);
+ }
addTab(buildRuntimePropertiesTab());
// TODO: Change this to use another way of configuration
if (actionFactoryName.equals("daieditor")) {
@@ -143,7 +145,9 @@
*/
public void showAboutDialog(final Component parent) {
tabs.setSelectedIndex(0);
- licensePane.setSelectedIndex(0);
+ if (licensePane.getComponentCount() > 0) {
+ licensePane.setSelectedIndex(0);
+ }
JOptionPane.showMessageDialog(parent, this, ACTION_FACTORY.format("about.title", actionFactory.getString("application.name")), JOptionPane.PLAIN_MESSAGE);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2007-01-14 17:25:02
|
Revision: 292
http://svn.sourceforge.net/japi/?rev=292&view=rev
Author: christianhujer
Date: 2007-01-14 09:24:54 -0800 (Sun, 14 Jan 2007)
Log Message:
-----------
Fixed bug: license.title was read from the wrong factory.
Modified Paths:
--------------
libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java
Modified: libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java
===================================================================
--- libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java 2007-01-14 17:12:37 UTC (rev 291)
+++ libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java 2007-01-14 17:24:54 UTC (rev 292)
@@ -168,7 +168,7 @@
for (int i = 1; actionFactory.getString("license." + i + ".title") != null; i++) {
licensePane.add(buildLicenseSubTab(String.valueOf(i)));
}
- licensePane.setName(actionFactory.getString("license.title"));
+ licensePane.setName(ACTION_FACTORY.getString("license.title"));
return licensePane;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2007-01-19 23:55:59
|
Revision: 315
http://svn.sourceforge.net/japi/?rev=315&view=rev
Author: christianhujer
Date: 2007-01-19 15:55:54 -0800 (Fri, 19 Jan 2007)
Log Message:
-----------
Do not throw NPE when logo URL isn't found. Instead print a warning.
Modified Paths:
--------------
libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java
Modified: libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java
===================================================================
--- libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java 2007-01-18 21:08:07 UTC (rev 314)
+++ libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java 2007-01-19 23:55:54 UTC (rev 315)
@@ -31,6 +31,7 @@
import java.util.ResourceBundle;
import java.util.SortedSet;
import java.util.TreeSet;
+import java.net.URL;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JLabel;
@@ -123,9 +124,14 @@
actionFactory = ActionFactory.getFactory(actionFactoryName);
tabs = new JTabbedPane();
licensePane = buildLicenseTab();
- @Nullable final String logoURL = actionFactory.getString("about.logo");
- if (logoURL != null) {
- add(new JLabel(new ImageIcon(getClass().getClassLoader().getResource(logoURL))), BorderLayout.NORTH);
+ @Nullable final String logoURLString = actionFactory.getString("about.logo");
+ if (logoURLString != null) {
+ @Nullable final URL logoURL = getClass().getClassLoader().getResource(logoURLString);
+ if (logoURL != null) {
+ add(new JLabel(new ImageIcon(logoURL)), BorderLayout.NORTH);
+ } else {
+ System.err.println("Warning: Logo for about dialog (\"" + logoURLString + "\") not found.");
+ }
}
add(tabs);
addTab(buildAboutTab());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2007-05-19 11:29:23
|
Revision: 346
http://svn.sourceforge.net/japi/?rev=346&view=rev
Author: christianhujer
Date: 2007-05-19 04:29:20 -0700 (Sat, 19 May 2007)
Log Message:
-----------
Removed some daimonin-specific code.
Modified Paths:
--------------
libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java
Modified: libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java
===================================================================
--- libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java 2007-05-18 09:18:55 UTC (rev 345)
+++ libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java 2007-05-19 11:29:20 UTC (rev 346)
@@ -117,11 +117,10 @@
/**
* Create an AboutDialog.
- * @param actionFactoryName name of the ActionFactory to use.
+ * @param actionFactory ActionFactory to use.
*/
- public AboutDialog(final String actionFactoryName) {
+ public AboutDialog(final ActionFactory actionFactory) {
super(new BorderLayout());
- actionFactory = ActionFactory.getFactory(actionFactoryName);
tabs = new JTabbedPane();
licensePane = buildLicenseTab();
@Nullable final String logoURLString = actionFactory.getString("about.logo");
@@ -139,13 +138,18 @@
addTab(licensePane);
}
addTab(buildRuntimePropertiesTab());
- // TODO: Change this to use another way of configuration
- if (actionFactoryName.equals("daieditor")) {
- addTab(buildBuildPropertiesTab());
- }
+ addTab(buildBuildPropertiesTab());
}
/**
+ * Create an AboutDialog.
+ * @param actionFactoryName Name of the ActionFactory to use.
+ */
+ public AboutDialog(final String actionFactoryName) {
+ this(ActionFactory.getFactory(actionFactoryName));
+ }
+
+ /**
* Show about dialog.
* @param parent Parent component to show dialog on
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2007-05-19 12:07:20
|
Revision: 347
http://svn.sourceforge.net/japi/?rev=347&view=rev
Author: christianhujer
Date: 2007-05-19 05:07:18 -0700 (Sat, 19 May 2007)
Log Message:
-----------
Fixed bug: Variable actionFactory might not have been initialized.
Modified Paths:
--------------
libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java
Modified: libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java
===================================================================
--- libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java 2007-05-19 11:29:20 UTC (rev 346)
+++ libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java 2007-05-19 12:07:18 UTC (rev 347)
@@ -121,6 +121,7 @@
*/
public AboutDialog(final ActionFactory actionFactory) {
super(new BorderLayout());
+ this.actionFactory = actionFactory;
tabs = new JTabbedPane();
licensePane = buildLicenseTab();
@Nullable final String logoURLString = actionFactory.getString("about.logo");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2007-06-25 20:00:35
|
Revision: 445
http://svn.sourceforge.net/japi/?rev=445&view=rev
Author: christianhujer
Date: 2007-06-25 13:00:34 -0700 (Mon, 25 Jun 2007)
Log Message:
-----------
Fixed checkstyle issues.
Modified Paths:
--------------
libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java
Modified: libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java
===================================================================
--- libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java 2007-06-25 19:58:39 UTC (rev 444)
+++ libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java 2007-06-25 20:00:34 UTC (rev 445)
@@ -103,7 +103,7 @@
protected static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.japi.swing.about");
/** Action Factory to create Actions. */
- protected final ActionFactory actionFactory;
+ private final ActionFactory actionFactory;
/**
* The main tabs.
@@ -311,5 +311,12 @@
return scroller;
}
+ /** Returns the ActionFactory to create actions.
+ * @return The ActionFactory to create actions.
+ */
+ protected ActionFactory getActionFactory() {
+ return actionFactory;
+ }
+
} // class AboutDialog
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2007-06-30 07:41:24
|
Revision: 460
http://svn.sourceforge.net/japi/?rev=460&view=rev
Author: christianhujer
Date: 2007-06-30 00:41:21 -0700 (Sat, 30 Jun 2007)
Log Message:
-----------
Introduced constants for magic numbers.
Added missing @NotNull / @Nullable annotations.
Modified Paths:
--------------
libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java
Modified: libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java
===================================================================
--- libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java 2007-06-29 20:08:21 UTC (rev 459)
+++ libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java 2007-06-30 07:41:21 UTC (rev 460)
@@ -43,6 +43,7 @@
import javax.swing.SwingConstants;
import net.sf.japi.swing.ActionFactory;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.NotNull;
/**
* Class for constructing and showing About dialogs.
@@ -100,26 +101,35 @@
public class AboutDialog extends JPanel {
/** Action Factory to create Actions. */
- protected static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.japi.swing.about");
+ @NotNull protected static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.japi.swing.about");
+ /** Default buffer size for I/O, e.g. when reading a license. */
+ private static final int BUF_SIZE = 4096;
+
+ /** Default number of rows in a textarea in an AboutDialog. */
+ private static final int TEXT_ROWS = 16;
+
+ /** Default number of columns in a textarea in an AboutDialog. */
+ private static final int TEXT_COLUMNS = 80;
+
/** Action Factory to create Actions. */
- private final ActionFactory actionFactory;
+ @NotNull private final ActionFactory actionFactory;
/**
* The main tabs.
*/
- private final JTabbedPane tabs;
+ @NotNull private final JTabbedPane tabs;
/**
* The tabs in the license tab.
*/
- private final JTabbedPane licensePane;
+ @NotNull private final JTabbedPane licensePane;
/**
* Create an AboutDialog.
* @param actionFactory ActionFactory to use.
*/
- public AboutDialog(final ActionFactory actionFactory) {
+ public AboutDialog(@NotNull final ActionFactory actionFactory) {
super(new BorderLayout());
this.actionFactory = actionFactory;
tabs = new JTabbedPane();
@@ -146,7 +156,7 @@
* Create an AboutDialog.
* @param actionFactoryName Name of the ActionFactory to use.
*/
- public AboutDialog(final String actionFactoryName) {
+ public AboutDialog(@NotNull final String actionFactoryName) {
this(ActionFactory.getFactory(actionFactoryName));
}
@@ -154,7 +164,7 @@
* Show about dialog.
* @param parent Parent component to show dialog on
*/
- public void showAboutDialog(final Component parent) {
+ public void showAboutDialog(@Nullable final Component parent) {
tabs.setSelectedIndex(0);
if (licensePane.getComponentCount() > 0) {
licensePane.setSelectedIndex(0);
@@ -166,7 +176,7 @@
* Adds a tab.
* @param component Component to add as tab
*/
- public void addTab(final Component component) {
+ public void addTab(@NotNull final Component component) {
tabs.add(component);
}
@@ -174,7 +184,7 @@
* Build the license tab.
* @return component for license tab
*/
- private JTabbedPane buildLicenseTab() {
+ @NotNull private JTabbedPane buildLicenseTab() {
final JTabbedPane licensePane = new JTabbedPane();
for (int i = 1; actionFactory.getString("license." + i + ".title") != null; i++) {
licensePane.add(buildLicenseSubTab(String.valueOf(i)));
@@ -188,13 +198,13 @@
* @param number number of license
* @return component for XY license tab
*/
- private JComponent buildLicenseSubTab(final String number) {
+ @NotNull private JComponent buildLicenseSubTab(@NotNull final String number) {
String licenseText;
try {
final Reader in = new InputStreamReader(new BufferedInputStream(getClass().getClassLoader().getResource(actionFactory.getString("license." + number + ".file")).openStream()));
try {
final StringBuilder sb = new StringBuilder();
- final char[] buf = new char[4096];
+ final char[] buf = new char[BUF_SIZE];
for (int bytesRead; (bytesRead = in.read(buf)) != -1;) {
sb.append(buf, 0, bytesRead);
}
@@ -207,7 +217,7 @@
} catch (final IOException e) {
licenseText = ACTION_FACTORY.getString("license.missing");
}
- final JTextArea license = new JTextArea(licenseText, 16, 80);
+ final JTextArea license = new JTextArea(licenseText, TEXT_ROWS, TEXT_COLUMNS);
license.setLineWrap(true);
license.setWrapStyleWord(true);
license.setEditable(false);
@@ -222,7 +232,7 @@
* Build the about tab.
* @return component for about tab
*/
- private JComponent buildAboutTab() {
+ @NotNull private JComponent buildAboutTab() {
String buildNumber = "unknown";
String buildDeveloper = "unknown";
String buildTstamp = "unknown";
@@ -255,7 +265,7 @@
* Build the runtime properties tab.
* @return component for runtime properties tab
*/
- private JComponent buildRuntimePropertiesTab() {
+ @NotNull private JComponent buildRuntimePropertiesTab() {
final StringBuilder propertiesText = new StringBuilder();
final SortedSet<String> keys = new TreeSet<String>();
final Properties props = System.getProperties();
@@ -271,7 +281,7 @@
.append(props.getProperty(key))
.append('\n');
}
- final JTextArea properties = new JTextArea(propertiesText.toString(), 16, 77);
+ final JTextArea properties = new JTextArea(propertiesText.toString(), TEXT_ROWS, TEXT_COLUMNS);
properties.setEditable(false);
properties.setFont(new Font("Monospaced", Font.PLAIN, properties.getFont().getSize()));
final JScrollPane scroller = new JScrollPane(properties);
@@ -284,7 +294,7 @@
* Build the build properties tab.
* @return component for build properties tab
*/
- private JComponent buildBuildPropertiesTab() {
+ @NotNull private JComponent buildBuildPropertiesTab() {
final StringBuilder propertiesText = new StringBuilder();
final SortedSet<String> keys = new TreeSet<String>();
try {
@@ -302,7 +312,7 @@
} catch (final Exception e) {
propertiesText.append(e.toString());
}
- final JTextArea properties = new JTextArea(propertiesText.toString(), 16, 77);
+ final JTextArea properties = new JTextArea(propertiesText.toString(), TEXT_ROWS, TEXT_COLUMNS);
properties.setEditable(false);
properties.setFont(new Font("Monospaced", Font.PLAIN, properties.getFont().getSize()));
final JScrollPane scroller = new JScrollPane(properties);
@@ -314,7 +324,7 @@
/** Returns the ActionFactory to create actions.
* @return The ActionFactory to create actions.
*/
- protected ActionFactory getActionFactory() {
+ @NotNull protected ActionFactory getActionFactory() {
return actionFactory;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2007-07-30 20:15:34
|
Revision: 560
http://japi.svn.sourceforge.net/japi/?rev=560&view=rev
Author: christianhujer
Date: 2007-07-30 13:15:31 -0700 (Mon, 30 Jul 2007)
Log Message:
-----------
javadoc: Added missing @serial tags.
Modified Paths:
--------------
libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java
Modified: libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java
===================================================================
--- libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java 2007-07-30 20:13:50 UTC (rev 559)
+++ libs/swing-about/trunk/src/net/sf/japi/swing/about/AboutDialog.java 2007-07-30 20:15:31 UTC (rev 560)
@@ -26,12 +26,12 @@
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
+import java.net.URL;
import java.util.Enumeration;
import java.util.Properties;
import java.util.ResourceBundle;
import java.util.SortedSet;
import java.util.TreeSet;
-import java.net.URL;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JLabel;
@@ -42,8 +42,8 @@
import javax.swing.JTextArea;
import javax.swing.SwingConstants;
import net.sf.japi.swing.ActionFactory;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.jetbrains.annotations.NotNull;
/**
* Class for constructing and showing About dialogs.
@@ -111,16 +111,20 @@
/** Default number of columns in a textarea in an AboutDialog. */
private static final int TEXT_COLUMNS = 80;
- /** Action Factory of the application, used to retrieve application logo, name and licenses. */
+ /** Action Factory of the application, used to retrieve application logo, name and licenses.
+ * @serial include
+ */
@NotNull private final ActionFactory actionFactory;
/**
* The main tabs.
+ * @serial include
*/
@NotNull private final JTabbedPane tabs;
/**
* The tabs in the license tab.
+ * @serial include
*/
@NotNull private final JTabbedPane licensePane;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|