Re: [PATCH] Swixml - Extending DefaultFactory

Brian P Michael <[email protected]>
Newsgroups gmane.comp.embedded.carlsbad-cubes
Message-ID <[email protected]>
Don,

To answer your questions:

1) I am not really sure about your question of "how" to get things 
added.  Currently,
I am taking Swixml code and am making quite a few changes to the guts 
so that
it can run both SWT and Swing code from the engine.

I have taken the DefaultFactory and turned it into an abstract class.
SwingFactory and SWTFactory then extends DefaultFactory.

I have done similar things with ConverterLib and TagLibrary.  A 
SwingConverterLibrary
and SWTConverterLibrary, A SwingTagLibrary and SWTTagLibrary as well.

I sent Wolf a copy of the code last night so that he could get a look 
at what I have been
doing with the code, but these changes are not yet complete.

When I am done with all the refactoring of the code, I will release it 
out to Wolf and he can decide
what, if anything, he will do with the changes.   I will also let 
everyone on the forum know when I am done.

Wolf was hoping to release 1.0 shortly, so I know these changes are not 
on the top of his plate right now.
We had discussed that my changes can be incorporated into a new 
version, 1.x or 2.0

I am hoping to have all the refactoring of the core components done by 
late next week.


2) I do wish there was a public CVS site up. Wolf has been added to 
java.net, but there is
no code out there yet.

Brian Michael

On Thursday, October 23, 2003, at 07:35  PM, Don Brown wrote:

> 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]
>>
>>
>>
>
>
> _______________________________________________
> Forum mailing list
> [email protected]
> http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com
>
>
Sincerely,

Brian P Michael
630-897-8364 x17
[email protected]

_______________________________________________
Forum mailing list
[email protected]
http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com
Brian P Michael.vcf (text/directory, 374 B)
BEGIN:VCARD
VERSION:2.1
N:Michael;Brian;P
FN:Brian P Michael
ORG:GoldParrot Corporation
TITLE:President
TEL;WORK;VOICE:630-897-8364 x17
TEL;WORK;FAX:630-897-8364 x21
ADR;WORK:;;1326 Eastwood Dr;Aurora;IL;60506;USA
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:1326 Eastwood Dr=0D=0AAurora, IL 60506=0D=0AUSA
EMAIL;PREF;INTERNET:[email protected]
REV:20020311T030256Z
END:VCARD
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.