Re: [PATCH] Swixml - Extending DefaultFactory

Don Brown <[email protected]>
Newsgroups gmane.comp.embedded.carlsbad-cubes
Message-ID <[email protected]>
Yes, that would make things easier for me, not so much to replace Swing,
but to make adding new plugin easier.  Until I write a proper plugin
component (ala jEdit or Eclipse), I'm using Swixml to make it easier for
users to edit the display and add in their own components (not to mention
it sure beats hand coding guis :)

While you are at it, perhaps simplifying the Factory interface would be
good.  All it really needs, that I can see, is one method to create an
instance and one or two others for setting properties.

BTW, what's the process for getting the additions into swixml?  Yes, it is
open source, but there isn't a public CVS and it seems only one developer.

Don

On Thu, 23 Oct 2003, Brian P Michael wrote:

> Don,
>
> I am working on quite a few changes to the guts of Swixml so
> that multiple engines, including SWT and Swing can be used.
>
> I will have the changes completed and tested within a week or so.
>
> One of the major changes that I am working on is to dynamically
> register the
> factories and converters via an file like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <swixml>
>   <engine type="swing">
>      <tag name="Applet" factory="javax.swing.JApplet" />
>      <tag name="Button" factory="javax.swing.JButton" />
>      <tag name="ButtonGroup" factory="javax.swing.ButtonGroup" />
>      <tag name="HBox" factory="org.swixml.swing.XHBox" />
>      <tag name="VBox" factory="org.swixml.swing.XVBox" />
>      <tag name="Checkbox" factory="javax.swing.JCheckBox" />
>      <tag name="CheckBoxMenuItem"
> factory="javax.swing.JCheckBoxMenuItem" />
>      <tag name="ComboBox" factory="javax.swing.JComboBox" />
>      <tag name="Component" factory="javax.swing.JComponent" />
>      <tag name="DesktopPane" factory="javax.swing.JDesktopPane" />
>      <tag name="Dialog" factory="org.swixml.swing.XDialog" />
>      <tag name="EditorPane" factory="javax.swing.JEditorPane" />
>      <tag name="FormattedTextField"
> factory="javax.swing.JFormattedTextField" />
>      <tag name="Frame" factory="org.swixml.swing.JFrame.class);
>      <tag name="Glue" factory="org.swixml.swing.XGlue" />
>      <tag name="GridBagConstraints"
> factory="org.swixml.swing.XGridBagConstraints" />
>      <tag name="InternalFrame" factory="javax.swing.JInternalFrame" />
>      <tag name="Label" factory="javax.swing.JLabel" />
>      <tag name="List" factory="javax.swing.JList" />
>      <tag name="Menu" factory="javax.swing.JMenu" />
>      <tag name="Menubar" factory="javax.swing.JMenuBar" />
>      <tag name="Menuitem" factory="javax.swing.JMenuItem" />
>      <tag name="Panel" factory="javax.swing.JPanel" />
>      <tag name="PasswordField" factory="javax.swing.JPasswordField" />
>      <tag name="PopupMenu" factory="javax.swing.JPopupMenu" />
>      <tag name="ProgressBar" factory="javax.swing.JProgressBar" />
>      <tag name="RadioButton" factory="javax.swing.JRadioButton" />
>      <tag name="RadioButtonMenuItem"
> factory="javax.swing.JRadioButtonMenuItem" />
>      <tag name="OptionPane" factory="javax.swing.JOptionPane" />
>      <tag name="ScrollPane" factory="javax.swing.JScrollPane" />
>      <tag name="Separator" factory="javax.swing.JSeparator" />
>      <tag name="Slider" factory="javax.swing.JSlider" />
>      <tag name="Spinner" factory="javax.swing.JSpinner" />
>      <tag name="SplitPane" factory="org.swixml.swing.XSplitPane" />
>      <tag name="TabbedPane" factory="org.swixml.swing.XTabbedPane" />
>      <tag name="Table" factory="javax.swing.JTable" />
>      <tag name="TableHeader" factory="javax.swing.JTableHeader" />
>      <tag name="TextArea" factory="javax.swing.JTextArea" />
>      <tag name="TextField" factory="javax.swing.JTextField" />
>      <tag name="TextPane" factory="javax.swing.JTextPane" />
>      <tag name="ToggleButton" factory="javax.swing.JToggleButton" />
>      <tag name="Tree" factory="javax.swing.JTree" />
>      <tag name="Toolbar" factory="javax.swing.JToolBar" />
>      <converter class="Action.class"
> converterlib="org.swixml.swing.Converters.ActionConverter" />
>      <converter class="Border.class"
> converterlib="org.swixml.swing.Converters.BorderConverter" />
>      <converter class="Color.class"
> converterlib="org.swixml.swing.Converters.ColorConverter" />
>      <converter class="Dimension.class"
> converterlib="org.swixml.swing.Converters.DimensionConverter" />
>      <converter class="Font.class"
> converterlib="org.swixml.swing.Converters.FontConverter" />
>      <converter class="Image.class"
> converterlib="org.swixml.swing.Converters.ImageConverter" />
>      <converter class="Icon.class"
> converterlib="org.swixml.swing.Converters.ImageIconConverter" />
>      <converter class="ImageIcon.class"
> converterlib="org.swixml.swing.Converters.ImageIconConverter" />
>      <converter class="Insets.class"
> converterlib="org.swixml.swing.Converters.InsetsConverter" />
>      <converter class="KeyStroke.class"
> converterlib="org.swixml.swing.Converters.KeyStrokeConverter" />
>      <converter class="LayoutManager.class"
> converterlib="org.swixml.swing.Converters.LayoutConverter" />
>      <converter class="Locale.class"
> converterlib="org.swixml.swing.Converters.LocaleConverter" />
>      <converter class="Point.class"
> converterlib="org.swixml.swing.Converters.PointConverter" />
>      <converter class="String.class"
> converterlib="org.swixml.swing.Converters.StringConverter" />
>      <converter class="boolean.class"
> converterlib="org.swixml.swing.Converters.PrimitiveConverter" />
>      <converter class="int.class"
> converterlib="org.swixml.swing.Converters.PrimitiveConverter" />
>      <converter class="long.class"
> converterlib="org.swixml.swing.Converters.PrimitiveConverter" />
>      <converter class="float.class"
> converterlib="org.swixml.swing.Converters.PrimitiveConverter" />
>      <converter class="double.class"
> converterlib="org.swixml.swing.Converters.PrimitiveConverter" />
>   </engine>
> </swixml>
>
> This should make it easier to register any tag and factory that you
> wish.
>
> Sincerely,
>
> Brian P Michael
>
> PS.  Were you ever involved in a company called AlgoSol.
>
>
> On Thursday, October 23, 2003, at 03:49  PM, Don Brown wrote:
>
> > I made several small changes to DefaultFactory to make it possible to
> > extend; basically, I removed the final modifier from the class and
> > template variable.
> >
> > Here's my use case:  I want my custom tags, and some swing tags, to be
> > created by my inversion of control (IoC) framework (Spring -
> > http://www.springframework.org).  This lets my plugins declare what
> > resources they will need through JavaBean setters, and spring, at call
> > time, will create the plugin and provide it with its resources.
> >
> > The best way I could see to accomplish this was to extend
> > DefaultFactory
> > and override its newInstance() method, leaving all the other method
> > implementation to DefaultFactory.  Unfortunately, I discovered
> > DefaultFactory and the key template variable are declared final.  I
> > think
> > there is value in making it possible to extend DefaultFactory for use
> > cases such as mine.
> >
> > My modified DefaultFactory:
> > http://www.twdata.org/dakine/DefaultFactory.java
> >
> > Comments?
> >
> > Don
> >
> >
> > _______________________________________________
> > Forum mailing list
> > [email protected]
> > http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com
> >
> >
> Sincerely,
>
> Brian P Michael
> 630-897-8364 x17
> [email protected]
>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.