SwingInitializer.java :  » XML-UI » JAXX » jaxx » tags » swing » Java Open Source

Java Open Source » XML UI » JAXX 
JAXX » jaxx » tags » swing » SwingInitializer.java
/*
 * Copyright 2006 Ethan Nicholas. All rights reserved.
 * Use is subject to license terms.
 */
package jaxx.tags.swing;

import java.beans.*;
import javax.swing.*;
import javax.swing.text.*;

import jaxx.compiler.*;
import jaxx.reflect.*;
import jaxx.runtime.swing.*;
import jaxx.spi.*;
import jaxx.tags.*;
import jaxx.types.*;

public class SwingInitializer implements Initializer {
    public void initialize() {
        String[] searchPath = Introspector.getBeanInfoSearchPath();
        String[] newSearchPath = new String[searchPath.length + 1];
        System.arraycopy(searchPath, 0, newSearchPath, 0, searchPath.length);
        newSearchPath[newSearchPath.length - 1] = "jaxx.beaninfos";
        Introspector.setBeanInfoSearchPath(newSearchPath);

        TagManager.registerTag("java.awt.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class)));
        
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(Application.class), ApplicationHandler.class);
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JCheckBox.class), JCheckBoxHandler.class);
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JCheckBoxMenuItem.class), JCheckBoxHandler.class);
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class), JComboBoxHandler.class);
        TagManager.registerTag("javax.swing.*", "JComboBox", new JComboBoxHandler(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class)));
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JDialog.class), JWindowHandler.class);
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JFrame.class), JWindowHandler.class);
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JInternalFrame.class), JInternalFrameHandler.class);
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXList.class), JListHandler.class);
        TagManager.registerTag("javax.swing.*", "JList", new JListHandler(ClassDescriptorLoader.getClassDescriptor(JAXXList.class)));
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JMenu.class), JMenuHandler.class);
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JPasswordField.class), JPasswordFieldHandler.class);
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JPopupMenu.class), JPopupMenuHandler.class);
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JProgressBar.class), JProgressBarHandler.class);
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JRadioButton.class), JRadioButtonHandler.class);
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JRadioButtonMenuItem.class), JRadioButtonHandler.class);
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JScrollPane.class), JScrollPaneHandler.class);
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JSlider.class), JSliderHandler.class);
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JSpinner.class), JSpinnerHandler.class);
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JSplitPane.class), JSplitPaneHandler.class);
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JTabbedPane.class), JTabbedPaneHandler.class);
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JTextComponent.class), JTextComponentHandler.class);
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JToggleButton.class), JRadioButtonHandler.class);
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JToolBar.class), JToolBarHandler.class);
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXTree.class), JTreeHandler.class);
        TagManager.registerTag("javax.swing.*", "JTree", new JTreeHandler(ClassDescriptorLoader.getClassDescriptor(JAXXTree.class)));
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JWindow.class), JWindowHandler.class);

        TagManager.registerDefaultNamespace("JEditorPane", "javax.swing.*");
        TagManager.registerDefaultNamespace("JFormattedTextField", "javax.swing.*");
        TagManager.registerDefaultNamespace("JPasswordField", "javax.swing.*");
        TagManager.registerDefaultNamespace("JTextArea", "javax.swing.*");
        TagManager.registerDefaultNamespace("JTextField", "javax.swing.*");
        TagManager.registerDefaultNamespace("JTextPane", "javax.swing.*");

        TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "tab", new TabHandler());
        TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(Table.class), TableHandler.class);
        TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "row", new RowHandler());
        TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "cell", new CellHandler());
        TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "item", new ItemHandler());

        TypeManager.registerTypeConverter(KeyStroke.class, new KeyStrokeConverter());
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.