[Buix-commits] r549 - in trunk/jaxx/src/main/java: jaxx/compiler jaxx/runtime jaxx/runtime/builder org/codelutin/ui
Author: tchemit Date: 2008-04-18 17:42:04 +0000 (Fri, 18 Apr 2008) New Revision: 549 Added: trunk/jaxx/src/main/java/org/codelutin/ui/UIHelper.java Removed: trunk/jaxx/src/main/java/jaxx/runtime/UIHelper.java Modified: trunk/jaxx/src/main/java/jaxx/compiler/JAXXCompiler.java trunk/jaxx/src/main/java/jaxx/runtime/builder/ActionFactory.java Log: lutinui module Modified: trunk/jaxx/src/main/java/jaxx/compiler/JAXXCompiler.java =================================================================== --- trunk/jaxx/src/main/java/jaxx/compiler/JAXXCompiler.java 2008-04-18 17:39:23 UTC (rev 548) +++ trunk/jaxx/src/main/java/jaxx/compiler/JAXXCompiler.java 2008-04-18 17:42:04 UTC (rev 549) @@ -107,7 +107,7 @@ staticImports.add("jaxx.runtime.swing.VBox"); staticImports.add("jaxx.runtime.swing.Table"); staticImports.add("static org.codelutin.i18n.I18n._"); - staticImports.add("static jaxx.runtime.UIHelper.createImageIcon"); + staticImports.add("static org.codelutin.ui.UIHelper.createImageIcon"); } private static DefaultObjectHandler firstPassClassTagHandler = new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(Object.class)); Deleted: trunk/jaxx/src/main/java/jaxx/runtime/UIHelper.java =================================================================== --- trunk/jaxx/src/main/java/jaxx/runtime/UIHelper.java 2008-04-18 17:39:23 UTC (rev 548) +++ trunk/jaxx/src/main/java/jaxx/runtime/UIHelper.java 2008-04-18 17:42:04 UTC (rev 549) @@ -1,65 +0,0 @@ -/* -* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin, -* Tony Chemit -* -* 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 jaxx.runtime; - -import javax.swing.ImageIcon; -import javax.swing.JDialog; -import javax.swing.JRootPane; -import javax.swing.Action; -import javax.swing.AbstractAction; -import javax.swing.JComponent; -import javax.swing.KeyStroke; -import java.awt.event.ActionEvent; - -/** @author tony */ -public class UIHelper { - - public static ImageIcon createImageIcon(String path) { - java.net.URL imgURL = UIHelper.class.getResource("/icons/" + path); - if (imgURL != null) { - return new ImageIcon(imgURL); - } else { - throw new RuntimeException("could not find icon " + path); - } - } - - /** - * Attach to <code>ui</code> an abort action,accessible by <code>ESC</code> key. - * - * @param ui ui - */ - public static void setQuitAction(final JDialog ui) { - JRootPane rootPane = ui.getRootPane(); - - Action quitAction = new AbstractAction("quit") { - private static final long serialVersionUID = -869095664995763057L; - - public void actionPerformed(ActionEvent e) { - ui.dispose(); - } - }; - rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "quit"); - rootPane.getActionMap().put("quit", quitAction); - } - - public static ImageIcon createActionIcon(String name) { - return createImageIcon("action-" + name + ".png"); - } - -} Modified: trunk/jaxx/src/main/java/jaxx/runtime/builder/ActionFactory.java =================================================================== --- trunk/jaxx/src/main/java/jaxx/runtime/builder/ActionFactory.java 2008-04-18 17:39:23 UTC (rev 548) +++ trunk/jaxx/src/main/java/jaxx/runtime/builder/ActionFactory.java 2008-04-18 17:42:04 UTC (rev 549) @@ -19,7 +19,7 @@ package jaxx.runtime.builder; import jaxx.runtime.JAXXObject; -import jaxx.runtime.UIHelper; +import org.codelutin.ui.UIHelper; import jaxx.runtime.swing.JAXXToggleButton; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; Copied: trunk/jaxx/src/main/java/org/codelutin/ui/UIHelper.java (from rev 547, trunk/jaxx/src/main/java/jaxx/runtime/UIHelper.java) =================================================================== --- trunk/jaxx/src/main/java/org/codelutin/ui/UIHelper.java (rev 0) +++ trunk/jaxx/src/main/java/org/codelutin/ui/UIHelper.java 2008-04-18 17:42:04 UTC (rev 549) @@ -0,0 +1,65 @@ +/* +* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin, +* Tony Chemit +* +* 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 org.codelutin.ui; + +import javax.swing.ImageIcon; +import javax.swing.JDialog; +import javax.swing.JRootPane; +import javax.swing.Action; +import javax.swing.AbstractAction; +import javax.swing.JComponent; +import javax.swing.KeyStroke; +import java.awt.event.ActionEvent; + +/** @author tony */ +public class UIHelper { + + public static ImageIcon createImageIcon(String path) { + java.net.URL imgURL = UIHelper.class.getResource("/icons/" + path); + if (imgURL != null) { + return new ImageIcon(imgURL); + } else { + throw new RuntimeException("could not find icon " + path); + } + } + + /** + * Attach to <code>ui</code> an abort action,accessible by <code>ESC</code> key. + * + * @param ui ui + */ + public static void setQuitAction(final JDialog ui) { + JRootPane rootPane = ui.getRootPane(); + + Action quitAction = new AbstractAction("quit") { + private static final long serialVersionUID = -869095664995763057L; + + public void actionPerformed(ActionEvent e) { + ui.dispose(); + } + }; + rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "quit"); + rootPane.getActionMap().put("quit", quitAction); + } + + public static ImageIcon createActionIcon(String name) { + return createImageIcon("action-" + name + ".png"); + } + +}
participants (1)
-
tchemit@users.labs.libre-entreprise.org