Package org.jpos.ui

Examples of org.jpos.ui.UI


* @see org.jpos.ui.UIFactory
*/
@SuppressWarnings("unchecked")
public class JTreeFactory implements UIFactory {
    public JComponent create (UI ui, Element e) {
        final UI parentUI = ui;
        final Map map = new HashMap ();
        final JTree tree = new JTree (getNode (e, map));
        String font = e.getAttributeValue ("font");
        if (font != null)
            tree.setFont (Font.decode (font));
        tree.setRootVisible (e.getTextTrim().length() > 0);

        tree.addTreeSelectionListener (
            new TreeSelectionListener() {
                public void valueChanged(TreeSelectionEvent evt) {
                    DefaultMutableTreeNode node =
                        (DefaultMutableTreeNode)
                            tree.getLastSelectedPathComponent();
                    if (node != null) {
                        String s = (String) map.get (node);
                        if (s != null) {
                            StringTokenizer st = new StringTokenizer (s);
                            String action  = st.nextToken ();
                            String command = null;
                            if (st.hasMoreTokens ())
                                command = st.nextToken ();

                            ActionListener al =
                                (ActionListener) parentUI.get(action);
                            if (al != null) {
                                al.actionPerformed (
                                    new ActionEvent (node, 0, command)
                                );
                            }
View Full Code Here

TOP

Related Classes of org.jpos.ui.UI

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.