[Japi-cvs] SF.net SVN: japi:[722] libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc
Status: Beta
Brought to you by:
christianhujer
|
From: <chr...@us...> - 2008-11-30 17:50:52
|
Revision: 722
http://japi.svn.sourceforge.net/japi/?rev=722&view=rev
Author: christianhujer
Date: 2008-11-30 17:50:48 +0000 (Sun, 30 Nov 2008)
Log Message:
-----------
Minor improvements.
Modified Paths:
--------------
libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/CollectionsListModel.java
libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/JFileChooserButton.java
Added Paths:
-----------
libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/SwingUtilities2.java
Modified: libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/CollectionsListModel.java
===================================================================
--- libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/CollectionsListModel.java 2008-11-30 17:42:39 UTC (rev 721)
+++ libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/CollectionsListModel.java 2008-11-30 17:50:48 UTC (rev 722)
@@ -154,8 +154,8 @@
}
/** {@inheritDoc} */
- @Override public boolean equals(final Object o) {
- return list.equals(o);
+ @Override public boolean equals(final Object obj) {
+ return obj instanceof CollectionsListModel && list.equals(((CollectionsListModel) obj).list);
}
/** {@inheritDoc} */
Modified: libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/JFileChooserButton.java
===================================================================
--- libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/JFileChooserButton.java 2008-11-30 17:42:39 UTC (rev 721)
+++ libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/JFileChooserButton.java 2008-11-30 17:50:48 UTC (rev 722)
@@ -95,7 +95,7 @@
* @param fileSelectionMode see {@link JFileChooser}
*/
public JFileChooserButton(final File base, final JFileChooser chooser, final JTextField textField, final int fileSelectionMode) {
- setAction(JFileChooserButton.ACTION_BUILDER.createAction(false, "optionsChooseFile", this));
+ setAction(ACTION_BUILDER.createAction(false, "optionsChooseFile", this));
this.textField = textField;
this.fileSelectionMode = fileSelectionMode;
setMargin(new Insets(0, 0, 0, 0));
Copied: libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/SwingUtilities2.java (from rev 635, progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/swing/ISwingUtilities.java)
===================================================================
--- libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/SwingUtilities2.java (rev 0)
+++ libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/SwingUtilities2.java 2008-11-30 17:50:48 UTC (rev 722)
@@ -0,0 +1,52 @@
+/* JAPI - (Yet another (hopefully) useful) Java API
+ *
+ * Copyright (C) 2004-2006 Christian Hujer
+ *
+ * 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 net.sf.japi.swing.misc;
+
+import java.awt.Component;
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.Window;
+
+/** JAPI Swing Utilities.
+ * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
+ */
+public class SwingUtilities2 {
+
+ /** Find the Window for a Component.
+ * Searches for a Frame or a Dialog which is the parent component of the supplied argument.
+ * Windows are treated like normal Components since in Java Windows can't stand for themselves but must have another Window as a parent.
+ * So a real root ancestor can only be a Frame or a Dialog.
+ * @param c Component to get Window for
+ * @return Window for c, which is a Frame or a Dialog
+ */
+ public static Window getWindowForComponent(final Component c) {
+ if (c == null) {
+ return null;
+ // TODO: implement handling of null
+ // return getRootFrame();
+ }
+ if (c instanceof Frame || c instanceof Dialog) {
+ return (Window) c;
+ }
+ return getWindowForComponent(c.getParent());
+ }
+
+} // class SwingUtilities2
Property changes on: libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/SwingUtilities2.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ LF
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|