ConstantSetter inputEventConstantSetter = new ConstantSetter (InputEvent.class);
ConstantSetter swingConstantsSetter = new ConstantSetter (SwingConstants.class);
ConstantSetter listSelectionModeConstantsSetter = new ConstantSetter (ListSelectionModel.class);
ConstantSetter componentOrientationConstantsSetter = new ConstantSetter (ComponentOrientation.class);
Adder contentPaneAdder = CallFunctionAdder.getAdder ("setContentPane", RootPaneContainer.class, Container.class);
Adder menuBarAdder = CallFunctionAdder.getAdder ("setJMenuBar", null, JMenuBar.class);
// Cursor
tagLibrary.setCreator ("cursor", HelperCreator.getCreator (CursorHelper.class));
tagLibrary.setConverter (Cursor.class, new CursorConverter ());
// Font
tagLibrary.setCreator ("font", HelperCreator.getCreator (FontHelper.class));
tagLibrary.setConverter (Font.class, new FontConverter ());
// KeyStroke
tagLibrary.setCreator ("keystroke", HelperCreator.getCreator (KeyStrokeHelper.class));
tagLibrary.setConverter (KeyStroke.class, new KeyStrokeConverter ());
tagLibrary.setSetter ("keystroke", "keycode", mnemonicConstantSetter);
tagLibrary.setSetter ("keystroke", "modifiers", inputEventConstantSetter);
// Insets
tagLibrary.setCreator ("insets", new InsetsCreator ());
tagLibrary.setConverter (Insets.class, new InsetsConverter ());
// Dimension
tagLibrary.setCreator ("dimension", DefaultCreator.getCreator (Dimension.class, true));
tagLibrary.setConverter (Dimension.class, new DimensionConverter ());
// Rectangle
tagLibrary.setCreator ("rectangle", DefaultCreator.getCreator (Rectangle.class, true));
tagLibrary.setConverter (Rectangle.class, new RectangleConverter ());
// Image
tagLibrary.setCreator ("image", HelperCreator.getCreator (ImageHelper.class));
tagLibrary.setConverter (Image.class, new ImageConverter ());
// ImageIcon
Converter iconConverter = new ImageIconConverter ();
tagLibrary.setCreator ("imageicon", HelperCreator.getCreator (ImageIconHelper.class));
tagLibrary.setConverter (ImageIcon.class, iconConverter);
// Icon
tagLibrary.setCreator ("icon", HelperCreator.getCreator (IconHelper.class));
tagLibrary.setConverter (Icon.class, iconConverter);
// Color
tagLibrary.setCreator ("color", HelperCreator.getCreator (ColorHelper.class));
tagLibrary.setConverter (Color.class, new ColorConverter ());
// Point
tagLibrary.setCreator ("point", DefaultCreator.getCreator (Point.class, true));
tagLibrary.setConverter (Point.class, new PointConverter ());
//
// Swing Components
//
Setter decoratedWindowSetter = new DecoratedWindowSetter ();
// UIManager
tagLibrary.setCreator ("uimanager", new UIManagerCreator ());
// JApplet
tagLibrary.setCreator ("applet", new AppletCreator ());
tagLibrary.inheritTag (WINDOW_GROUP, "applet");
// JDialog
tagLibrary.setCreator ("dialog", new DialogCreator ());
tagLibrary.inheritTag (WINDOW_GROUP, "dialog");
tagLibrary.setSetter ("dialog", "ctor", DoNothingSetter.getInstance ());
tagLibrary.setSetter ("dialog", "decorated", decoratedWindowSetter);
// JFrame
tagLibrary.setCreator ("frame", new FrameCreator ());
tagLibrary.inheritTag (WINDOW_GROUP, "frame");
tagLibrary.setSetter ("frame", "decorated", decoratedWindowSetter);
// JInternalFrame
tagLibrary.setCreator ("internalframe", new InternalFrameCreator ());
tagLibrary.inheritTag (WINDOW_GROUP, "internalframe");
// JWindow
tagLibrary.setCreator ("window", new WindowCreator ());
tagLibrary.inheritTag (WINDOW_GROUP, "window");
// JMenuBar
tagLibrary.setCreator ("menubar", DefaultCreator.getCreator (JMenuBar.class));
tagLibrary.inheritTag (COMPONENT, "menubar");
// JPopupMenu
tagLibrary.setCreator ("popupmenu", DefaultCreator.getCreator (JPopupMenu.class));
tagLibrary.inheritTag (COMPONENT, "popupmenu");
// JMenu
tagLibrary.setCreator ("menu", DefaultCreator.getCreator (JMenu.class));
tagLibrary.inheritTag (ABSTRACT_BUTTON, "menu");
tagLibrary.setSetter ("menu", "componentorientation", componentOrientationConstantsSetter);
// JMenuItem
tagLibrary.setCreator ("menuitem", DefaultCreator.getCreator (JMenuItem.class));
tagLibrary.inheritTag (ABSTRACT_BUTTON, "menuitem");
// menu split
tagLibrary.setCreator ("menusplit", new MenuSplitCreator ());
// JRadioButtonMenuItem
tagLibrary.setCreator ("radiobuttonmenuitem", DefaultCreator.getCreator (JRadioButtonMenuItem.class));
tagLibrary.inheritTag (ABSTRACT_BUTTON, "radiobuttonmenuitem");
// JCheckBoxMenuItem
tagLibrary.setCreator ("checkboxmenuitem", DefaultCreator.getCreator (JCheckBoxMenuItem.class));
tagLibrary.inheritTag (ABSTRACT_BUTTON, "checkboxmenuitem");
// JSeparator
tagLibrary.setCreator ("separator", DefaultCreator.getCreator (JSeparator.class));
tagLibrary.inheritTag (COMPONENT, "separator");
tagLibrary.setSetter ("separator", "orientation", swingConstantsSetter);
// JToolBar
tagLibrary.setCreator ("toolbar", DefaultCreator.getCreator (JToolBar.class));
tagLibrary.inheritTag (COMPONENT, "toolbar");
tagLibrary.setSetter ("toolbar", "orientation", swingConstantsSetter);
// JToolBar.Separator
tagLibrary.setCreator ("toolbar-separator", DefaultCreator.getCreator (JToolBar.Separator.class));
tagLibrary.inheritTag (COMPONENT, "toolbar-separator");
// JButton
tagLibrary.setCreator ("button", DefaultCreator.getCreator (JButton.class));
tagLibrary.inheritTag (ABSTRACT_BUTTON, "button");
// JToggleButton
tagLibrary.setCreator ("togglebutton", DefaultCreator.getCreator (JToggleButton.class));
tagLibrary.inheritTag (ABSTRACT_BUTTON, "togglebutton");
// JRadioButton
tagLibrary.setCreator ("radiobutton", DefaultCreator.getCreator (JRadioButton.class));
tagLibrary.inheritTag (ABSTRACT_BUTTON, "radiobutton");
// JCheckBox
tagLibrary.setCreator ("checkbox", DefaultCreator.getCreator (JCheckBox.class));
tagLibrary.inheritTag (ABSTRACT_BUTTON, "checkbox");
// ButtonGroup
tagLibrary.setCreator ("buttongroup", DefaultCreator.getCreator (ButtonGroup.class));
// syncbuttonstate
tagLibrary.setCreator ("syncbuttonstate", HelperCreator.getCreator (SyncButtonStateHelper.class));
// JLabel
tagLibrary.setCreator ("label", DefaultCreator.getCreator (JLabel.class));
tagLibrary.inheritTag (COMPONENT, "label");
tagLibrary.setSetter ("label", "horizontalalignment", swingConstantsSetter);
tagLibrary.setSetter ("label", "horizontaltextposition", swingConstantsSetter);
tagLibrary.setSetter ("label", "displayedmnemonic", mnemonicConstantSetter);
tagLibrary.setSetter ("label", "verticalalignment", swingConstantsSetter);
tagLibrary.setSetter ("label", "verticaltextposition", swingConstantsSetter);
tagLibrary.setSetter ("label", "labelfor", new LabelForSetter ());
// JTextField
tagLibrary.setCreator (TEXTFIELD, DefaultCreator.getCreator (JTextField.class));
tagLibrary.inheritTag (TEXTCOMPONENT, TEXTFIELD);
tagLibrary.setSetter (TEXTFIELD, "horizontalalignment", swingConstantsSetter);
// JFormattedTextField
tagLibrary.setCreator ("formattedtextfield", new FormattedTextFieldCreator ());
tagLibrary.addAdder ("formattedtextfield", new FormatterAdder ());
tagLibrary.inheritTag (TEXTFIELD, "formattedtextfield");
tagLibrary.setSetter ("formattedtextfield", "focuslostbehavior", new ConstantSetter (JFormattedTextField.class));
// JPasswordField
tagLibrary.setCreator ("passwordfield", DefaultCreator.getCreator (JPasswordField.class));
tagLibrary.inheritTag (TEXTFIELD, "passwordfield");
// JTextArea
tagLibrary.setCreator ("textarea", DefaultCreator.getCreator (JTextArea.class));
tagLibrary.inheritTag (TEXTCOMPONENT, "textarea");
// JTextPane
tagLibrary.setCreator ("textpane", DefaultCreator.getCreator (JTextPane.class));
tagLibrary.inheritTag (TEXTCOMPONENT, "textpane");
// JEditorPane
tagLibrary.setCreator ("editorpane", DefaultCreator.getCreator (JEditorPane.class));
tagLibrary.inheritTag (TEXTCOMPONENT, "editorpane");
// JPanel
tagLibrary.setCreator ("panel", DefaultCreator.getCreator (JPanel.class));
tagLibrary.inheritTag (COMPONENT, "panel");
// JDesktopPane
tagLibrary.setCreator ("desktoppane", DefaultCreator.getCreator (JDesktopPane.class));
tagLibrary.inheritTag (COMPONENT, "desktoppane");
// JSplitPane
tagLibrary.setCreator ("splitpane", DefaultCreator.getCreator (JSplitPane.class));
tagLibrary.inheritTag (COMPONENT, "splitpane");
tagLibrary.setSetter ("splitpane", "orientation", new ConstantSetter (JSplitPane.class));
tagLibrary.addAdder ("splitpane", new SplitPaneAdder ());
// JScrollPane
tagLibrary.setCreator ("scrollpane", DefaultCreator.getCreator (JScrollPane.class));
tagLibrary.inheritTag (COMPONENT, "scrollpane");
tagLibrary.addAdder ("scrollpane", CallFunctionAdder.getAdder ("setViewportView", JScrollPane.class, Component.class));
ConstantSetter scrollPaneConstantSetter = new ConstantSetter (ScrollPaneConstants.class);
tagLibrary.setSetter ("scrollpane", "horizontalscrollbarpolicy", scrollPaneConstantSetter);
tagLibrary.setSetter ("scrollpane", "verticalscrollbarpolicy", scrollPaneConstantSetter);
// JRootPane
tagLibrary.setCreator ("rootpane", DefaultCreator.getCreator (JRootPane.class));
tagLibrary.inheritTag (COMPONENT, "rootpane");
tagLibrary.addAdder ("rootpane", contentPaneAdder);
tagLibrary.addAdder ("rootpane", menuBarAdder);
// JTabbedPane
tagLibrary.inheritTag (COMPONENT, "tabbedpane");
tagLibrary.setCreator ("tabbedpane", DefaultCreator.getCreator (JTabbedPane.class));
tagLibrary.setSetter ("tabbedpane", "tablayoutpolicy", new ConstantSetter (JTabbedPane.class));
tagLibrary.setSetter ("tabbedpane", "tabplacement", swingConstantsSetter);
// tab in JTabbedPane
tagLibrary.setCreator ("tab", DefaultCreator.getCreator (TabHelper.class));
tagLibrary.addAdder ("tab", new TabAdder ());
tagLibrary.setSetter ("tab", "mnemonic", mnemonicConstantSetter);
// JFileChooser
tagLibrary.setCreator ("filechooser", DefaultCreator.getCreator (JFileChooser.class));
tagLibrary.inheritTag (COMPONENT, "filechooser");
ConstantSetter fileChooserConstantSetter = new ConstantSetter (JFileChooser.class);
tagLibrary.setSetter ("filechooser", "fileselectionmode", fileChooserConstantSetter);
tagLibrary.setSetter ("filechooser", "dialogtype", fileChooserConstantSetter);
tagLibrary.setSetter ("filechooser", "approvedbuttonmnemonic", mnemonicConstantSetter);
// JColorChooser
tagLibrary.setCreator ("colorchooser", DefaultCreator.getCreator (JColorChooser.class));
tagLibrary.inheritTag (COMPONENT, "colorchooser");
// JTable
// The reason that table is added to parent object after everything inside table has
// been set up is because TableModel can affect the table header, which would in turn
// affect the parent object if it scrollpane.
tagLibrary.setCreator ("table", DefaultCreator.getCreator (JTable.class, true));
tagLibrary.inheritTag (COMPONENT, "table");
tagLibrary.setSetter ("table", "autoresizemode", new ConstantSetter (JTable.class));
tagLibrary.setSetter ("table", "selectionmode", listSelectionModeConstantsSetter);
tagLibrary.setSetter ("table", "listselectionlistener", new ListSelectionListenerSetter ());
tagLibrary.addAdder ("table", CallFunctionAdder.getAdder ("setModel", JTable.class, TableModel.class));
tagLibrary.setCreator ("defaulttablemodel", DefaultCreator.getCreator (DefaultTableModel.class));
Utils.addListenerSetter (tagLibrary, "defaulttablemodel", TableModelListener.class);
tagLibrary.setAdder ("defaulttablemodel", new DefaultTableModelAdder ());
// JTableHeader
tagLibrary.setCreator ("tableheader", new TableHeaderCreator ());
tagLibrary.inheritTag (COMPONENT, "tableheader");
// JList
tagLibrary.setCreator ("list", DefaultCreator.getCreator (JList.class));
tagLibrary.inheritTag (COMPONENT, "list");
tagLibrary.setSetter ("list", "layoutorientation", new ConstantSetter (JList.class));
tagLibrary.setSetter ("list", "selectionmode", listSelectionModeConstantsSetter);
tagLibrary.addAdder ("list", CallFunctionAdder.getAdder ("setModel", JList.class, ListModel.class));
tagLibrary.setCreator ("defaultlistmodel", DefaultCreator.getCreator (DefaultListModel.class));
Utils.addListenerSetter (tagLibrary, "defaultlistmodel", ListDataListener.class);
tagLibrary.addAdder ("defaultlistmodel", CallFunctionAdder.getAdder ("addElement", DefaultListModel.class, null));
// JTree
tagLibrary.setCreator ("tree", DefaultCreator.getCreator (JTree.class));
tagLibrary.inheritTag (COMPONENT, "tree");
// JComboBox
tagLibrary.setCreator ("combobox", DefaultCreator.getCreator (JComboBox.class));
tagLibrary.inheritTag (COMPONENT, "combobox");
tagLibrary.addAdder ("combobox", CallFunctionAdder.getAdder ("addItem", JComboBox.class, null));
tagLibrary.addAdder ("combobox", CallFunctionAdder.getAdder ("setModel", JComboBox.class, ComboBoxModel.class));
tagLibrary.setCreator ("defaultcomboboxmodel", DefaultCreator.getCreator (DefaultComboBoxModel.class));
tagLibrary.addAdder ("defaultcomboboxmodel", CallFunctionAdder.getAdder ("addElement", DefaultComboBoxModel.class, null));
Utils.addListenerSetter (tagLibrary, "defaultcomboboxmodel", ListDataListener.class);
// JProgressBar
tagLibrary.setCreator ("progressbar", DefaultCreator.getCreator (JProgressBar.class));
tagLibrary.inheritTag (COMPONENT, "progressbar");
tagLibrary.setSetter ("progressbar", "orientation", swingConstantsSetter);
// JScrollBar
tagLibrary.setCreator ("scrollbar", DefaultCreator.getCreator (JScrollBar.class));
tagLibrary.inheritTag (COMPONENT, "scrollbar");
tagLibrary.setSetter ("scrollbar", "orientation", swingConstantsSetter);
// JSlider
tagLibrary.setCreator ("slider", DefaultCreator.getCreator (JSlider.class));
tagLibrary.inheritTag (COMPONENT, "slider");
tagLibrary.setSetter ("slider", "orientation", swingConstantsSetter);
// JSpinner
tagLibrary.setCreator ("spinner", DefaultCreator.getCreator (JSpinner.class));
tagLibrary.inheritTag (COMPONENT, "spinner");
tagLibrary.addAdder ("spinner", CallFunctionAdder.getAdder ("setModel", JSpinner.class, SpinnerModel.class));
tagLibrary.addAdder ("spinner", CallFunctionAdder.getAdder ("setEditor", JSpinner.class, JComponent.class));
tagLibrary.setCreator ("spinner-defaulteditor", new SpinnerEditorCreator (JSpinner.DefaultEditor.class));
tagLibrary.setCreator ("spinner-listeditor", new SpinnerEditorCreator (JSpinner.ListEditor.class));
tagLibrary.setCreator ("spinner-dateeditor", new SpinnerEditorCreator (JSpinner.DateEditor.class));
tagLibrary.setSetter ("spinner-dateeditor", "format", DoNothingSetter.getInstance ());
tagLibrary.setCreator ("spinner-numbereditor", new SpinnerEditorCreator (JSpinner.NumberEditor.class));
tagLibrary.setSetter ("spinner-numbereditor", "format", DoNothingSetter.getInstance ());
// SpinnerModel
tagLibrary.setCreator ("spinnerdatemodel", DefaultCreator.getCreator (SpinnerDateModel.class));
tagLibrary.setSetter ("spinnerdatemodel", "calendarfield", new ConstantSetter (Calendar.class));
tagLibrary.setCreator ("spinnerlistmodel", DefaultCreator.getCreator (SpinnerListModel.class));
tagLibrary.addAdder ("spinnerlistmodel", new CallFunctionAdder ("setList", SpinnerListModel.class, java.util.List.class));
tagLibrary.setCreator ("spinnernumbermodel", DefaultCreator.getCreator (SpinnerNumberModel.class));
// JToolTip
tagLibrary.setCreator ("tooltip", DefaultCreator.getCreator (JToolTip.class));
tagLibrary.inheritTag (COMPONENT, "tooltip");
//
// Misc
//
// BevelBorder
tagLibrary.setCreator ("bevelborder", HelperCreator.getCreator (BevelBorderHelper.class));
tagLibrary.setSetter ("bevelborder", "type", new ConstantSetter (BevelBorder.class));
// CompoundBorder
tagLibrary.setCreator ("compoundborder", HelperCreator.getCreator (CompoundBorderHelper.class));
// EmptyBorder
tagLibrary.setCreator ("emptyborder", HelperCreator.getCreator (EmptyBorderHelper.class));
// EtchedBorder
tagLibrary.setCreator ("etchedborder", HelperCreator.getCreator (EtchedBorderHelper.class));
tagLibrary.setSetter ("etchedborder", "type", new ConstantSetter (EtchedBorder.class));
// LineBorder
tagLibrary.setCreator ("lineborder", HelperCreator.getCreator (LineBorderHelper.class));
// MatteBorder
tagLibrary.setCreator ("matteborder", HelperCreator.getCreator (MatteBorderHelper.class));
// TitledBorder
tagLibrary.setCreator ("titledborder", HelperCreator.getCreator (TitledBorderHelper.class));
ConstantSetter titledBorderConstantsSetter = new ConstantSetter (TitledBorder.class);
tagLibrary.setSetter ("titledborder", "titlejustification", titledBorderConstantsSetter);
tagLibrary.setSetter ("titledborder", "titleposition", titledBorderConstantsSetter);
tagLibrary.setCreator ("clientproperty", DefaultCreator.getCreator (ClientPropertyHelper.class, true));
Adder layoutComponentAdder = new LayoutComponentAdder ();
// BorderLayout
tagLibrary.setCreator ("borderlayout", DefaultCreator.getCreator (BorderLayout.class));
// BoxLayout
tagLibrary.setCreator ("boxlayout", new BoxLayoutCreator ());
tagLibrary.addAdder ("boxlayout", layoutComponentAdder);